Merge authors: Steve Langasek (vorlon) Related merge proposals: https://code.launchpad.net/~vorlon/upstart/default-priority-not-always-zero/+merge/140025 proposed by: Steve Langasek (vorlon) review: Approve - James Hunt (jamesodhunt) ------------------------------------------------------------ revno: 1412 [merge] committer: James Hunt <[email protected]> branch nick: upstart timestamp: Tue 2012-12-18 09:02:24 +0000 message: * Merge of lp:~vorlon/upstart/default-priority-not-always-zero. modified: ChangeLog init/job_class.c init/job_class.h init/job_process.c init/tests/test_job_class.c
-- lp:upstart https://code.launchpad.net/~upstart-devel/upstart/trunk Your team Upstart Reviewers is subscribed to branch lp:upstart. To unsubscribe from this branch go to https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'ChangeLog' --- ChangeLog 2012-12-17 14:24:22 +0000 +++ ChangeLog 2012-12-18 09:02:24 +0000 @@ -3,6 +3,15 @@ * init/man/init.5: Document that User Jobs are not supported within a chroot environment. +2012-12-14 Steve Langasek <[email protected]> + * init/job_class.[ch]: instead of assuming a fixed value (0) as the + default nice value for job processes, use whatever the nice value + of the current process is. This will be important later for user + sessions where an entire session may be started with a higher nice + value; and it fixes running the test suite as part of a nice'd + build. + * init/tests/test_job_class.c: update test suite to match. + 2012-12-11 James Hunt <[email protected]> * init/Makefile.am: Add explicit -lrt for tests (LP: #1088863) === modified file 'init/job_class.c' --- init/job_class.c 2012-11-22 16:32:36 +0000 +++ init/job_class.c 2012-12-14 20:55:41 +0000 @@ -27,6 +27,8 @@ #include <errno.h> #include <string.h> #include <signal.h> +#include <sys/time.h> +#include <sys/resource.h> #include <nih/macros.h> #include <nih/alloc.h> @@ -219,7 +221,7 @@ class->console = default_console >= 0 ? default_console : CONSOLE_LOG; class->umask = JOB_DEFAULT_UMASK; - class->nice = JOB_DEFAULT_NICE; + class->nice = JOB_NICE_INVALID; class->oom_score_adj = JOB_DEFAULT_OOM_SCORE_ADJ; for (i = 0; i < RLIMIT_NLIMITS; i++) === modified file 'init/job_class.h' --- init/job_class.h 2012-09-24 09:10:05 +0000 +++ init/job_class.h 2012-12-14 20:48:51 +0000 @@ -102,11 +102,11 @@ #define JOB_DEFAULT_UMASK 022 /** - * JOB_DEFAULT_NICE: + * JOB_NICE_INVALID: * - * The default nice level for processes. + * The nice level for processes when no nice level is set. **/ -#define JOB_DEFAULT_NICE 0 +#define JOB_NICE_INVALID -21 /** * JOB_DEFAULT_OOM_SCORE_ADJ: === modified file 'init/job_process.c' --- init/job_process.c 2012-12-17 15:53:01 +0000 +++ init/job_process.c 2012-12-18 09:02:24 +0000 @@ -786,7 +786,8 @@ /* Adjust the process priority ("nice level"). */ - if (setpriority (PRIO_PROCESS, 0, class->nice) < 0) { + if (class->nice != JOB_NICE_INVALID && + setpriority (PRIO_PROCESS, 0, class->nice) < 0) { nih_error_raise_system (); job_process_error_abort (fds[1], JOB_PROCESS_ERROR_PRIORITY, 0); === modified file 'init/tests/test_job_class.c' --- init/tests/test_job_class.c 2011-12-09 15:27:57 +0000 +++ init/tests/test_job_class.c 2012-12-14 20:48:51 +0000 @@ -27,6 +27,8 @@ #include <sys/wait.h> #include <sys/ptrace.h> #include <sys/select.h> +#include <sys/time.h> +#include <sys/resource.h> #include <time.h> #include <stdio.h> @@ -131,7 +133,7 @@ TEST_EQ (class->console, CONSOLE_LOG); TEST_EQ (class->umask, 022); - TEST_EQ (class->nice, 0); + TEST_EQ (class->nice, JOB_NICE_INVALID); TEST_EQ (class->oom_score_adj, 0); for (i = 0; i < RLIMIT_NLIMITS; i++)
-- upstart-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel
