X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fprocess-util.c;h=da825a7c3c5f6d2916980430d71f2e6d8bae870e;hb=627d9a980cae493247e7ace980256e9909760bc4;hp=a5f355c10d567e87de29d9208e4c6e30f94e3481;hpb=bced11a985de1016bfc33655cb30a2fbece8bc59;p=elogind.git diff --git a/src/basic/process-util.c b/src/basic/process-util.c index a5f355c10..da825a7c3 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -310,7 +310,7 @@ int rename_process(const char name[]) { /* Third step, completely replace the argv[] array the kernel maintains for us. This requires privileges, but * has the advantage that the argv[] array is exactly what we want it to be, and not filled up with zeros at - * the end. This is the best option for changing /proc/self/cmdline.*/ + * the end. This is the best option for changing /proc/self/cmdline. */ if (mm_size < l+1) { size_t nn_size; char *nn; @@ -708,7 +708,7 @@ int kill_and_sigcont(pid_t pid, int sig) { /* If this worked, also send SIGCONT, unless we already just sent a SIGCONT, or SIGKILL was sent which isn't * affected by a process being suspended anyway. */ - if (r >= 0 && !IN_SET(SIGCONT, SIGKILL)) + if (r >= 0 && !IN_SET(sig, SIGCONT, SIGKILL)) (void) kill(pid, SIGCONT); return r; @@ -814,7 +814,7 @@ int pid_from_same_root_fs(pid_t pid) { root = procfs_file_alloca(pid, "root"); - return files_same(root, "/proc/1/root"); + return files_same(root, "/proc/1/root", 0); } #endif // 0 @@ -914,6 +914,23 @@ int pid_compare_func(const void *a, const void *b) { return 0; } +int ioprio_parse_priority(const char *s, int *ret) { + int i, r; + + assert(s); + assert(ret); + + r = safe_atoi(s, &i); + if (r < 0) + return r; + + if (!ioprio_priority_is_valid(i)) + return -EINVAL; + + *ret = i; + return 0; +} + static const char *const ioprio_class_table[] = { [IOPRIO_CLASS_NONE] = "none", [IOPRIO_CLASS_RT] = "realtime",