Merge lp:~xnox/upstart/kfreebsd into lp:upstart

Proposed by Dimitri John Ledkov on 2013-11-20
Status: Work in progress
Proposed branch: lp:~xnox/upstart/kfreebsd
Merge into: lp:upstart
Diff against target: 541 lines (+134/-27)
12 files modified
config-freebsd.h (+19/-0)
configure.ac (+1/-0)
init/job_process.c (+24/-0)
init/main.c (+16/-10)
init/parse_job.c (+8/-0)
init/state.c (+4/-1)
init/system.c (+18/-1)
init/system.h (+20/-0)
init/tests/test_job.c (+4/-2)
init/tests/test_job_process.c (+2/-3)
init/tests/test_parse_job.c (+10/-8)
util/reboot.c (+8/-2)
To merge this branch: bzr merge lp:~xnox/upstart/kfreebsd
Reviewer Review Type Date Requested Status
Upstart Reviewers 2013-11-20 Pending
Review via email: mp+196028@code.launchpad.net
To post a comment you must log in.
lp:~xnox/upstart/kfreebsd updated on 2013-12-31
1578. By xnox <xnox@localhost> on 2013-11-23

Unbreak build

1579. By Dimitri John Ledkov on 2013-12-31

Merge trunk

Unmerged revisions

1579. By Dimitri John Ledkov on 2013-12-31

Merge trunk

1578. By xnox <xnox@localhost> on 2013-11-23

Unbreak build

1577. By Dimitri John Ledkov on 2013-11-20

Start on freebsd

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'config-freebsd.h'
--- config-freebsd.h 1970-01-01 00:00:00 +0000
+++ config-freebsd.h 2013-12-31 00:12:51 +0000
@@ -0,0 +1,19 @@
1#if defined(__FreeBSD_kernel__)
2/* Stolen from sysvinit */
3#ifndef SIGPWR
4# define SIGPWR SIGUSR2
5#endif
6
7#ifndef CBAUD
8# define CBAUD 0
9#endif
10#ifndef CBAUDEX
11# define CBAUDEX 0
12#endif
13
14#define PTRACE_TRACEME PT_TRACE_ME
15#define PTRACE_CONT PT_CONTINUE
16#define PTRACE_DETACH PT_DETACH
17
18#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_FAST
19#endif
020
=== modified file 'configure.ac'
--- configure.ac 2013-11-14 14:33:24 +0000
+++ configure.ac 2013-12-31 00:12:51 +0000
@@ -152,6 +152,7 @@
152152
153NIH_LINKER_OPTIMISATIONS153NIH_LINKER_OPTIMISATIONS
154154
155AH_BOTTOM([#include "config-freebsd.h"])
155156
156AC_CONFIG_FILES([ Makefile157AC_CONFIG_FILES([ Makefile
157 dbus/Makefile init/Makefile util/Makefile conf/Makefile158 dbus/Makefile init/Makefile util/Makefile conf/Makefile
158159
=== modified file 'init/job_process.c'
--- init/job_process.c 2013-11-03 02:54:03 +0000
+++ init/job_process.c 2013-12-31 00:12:51 +0000
@@ -1071,21 +1071,31 @@
1071 case RLIMIT_AS:1071 case RLIMIT_AS:
1072 res = "as";1072 res = "as";
1073 break;1073 break;
1074#if defined(RLIMIT_LOCKS)
1074 case RLIMIT_LOCKS:1075 case RLIMIT_LOCKS:
1075 res = "locks";1076 res = "locks";
1076 break;1077 break;
1078#endif
1079#if defined(RLIMIT_SIGPENDING)
1077 case RLIMIT_SIGPENDING:1080 case RLIMIT_SIGPENDING:
1078 res = "sigpending";1081 res = "sigpending";
1079 break;1082 break;
1083#endif
1084#if defined(RLIMIT_MSGQUEUE)
1080 case RLIMIT_MSGQUEUE:1085 case RLIMIT_MSGQUEUE:
1081 res = "msgqueue";1086 res = "msgqueue";
1082 break;1087 break;
1088#endif
1089#if defined(RLIMIT_NICE)
1083 case RLIMIT_NICE:1090 case RLIMIT_NICE:
1084 res = "nice";1091 res = "nice";
1085 break;1092 break;
1093#endif
1094#if defined(RLIMIT_RTPRIO)
1086 case RLIMIT_RTPRIO:1095 case RLIMIT_RTPRIO:
1087 res = "rtprio";1096 res = "rtprio";
1088 break;1097 break;
1098#endif
1089 default:1099 default:
1090 nih_assert_not_reached ();1100 nih_assert_not_reached ();
1091 }1101 }
@@ -1533,12 +1543,14 @@
1533 * state of the process trace we hold.1543 * state of the process trace we hold.
1534 */1544 */
1535 switch (status) {1545 switch (status) {
1546#if defined(__linux)
1536 case PTRACE_EVENT_FORK:1547 case PTRACE_EVENT_FORK:
1537 job_process_trace_fork (job, process);1548 job_process_trace_fork (job, process);
1538 break;1549 break;
1539 case PTRACE_EVENT_EXEC:1550 case PTRACE_EVENT_EXEC:
1540 job_process_trace_exec (job, process);1551 job_process_trace_exec (job, process);
1541 break;1552 break;
1553#endif
1542 default:1554 default:
1543 nih_assert_not_reached ();1555 nih_assert_not_reached ();
1544 }1556 }
@@ -1923,14 +1935,18 @@
1923 * get a different kind of notification when it execs to a plain1935 * get a different kind of notification when it execs to a plain
1924 * SIGTRAP.1936 * SIGTRAP.
1925 */1937 */
1938#if defined(__linux__)
1926 if (ptrace (PTRACE_SETOPTIONS, job->pid[process], NULL,1939 if (ptrace (PTRACE_SETOPTIONS, job->pid[process], NULL,
1927 PTRACE_O_TRACEFORK | PTRACE_O_TRACEEXEC) < 0) {1940 PTRACE_O_TRACEFORK | PTRACE_O_TRACEEXEC) < 0) {
1941#endif
1928 nih_warn (_("Failed to set ptrace options for "1942 nih_warn (_("Failed to set ptrace options for "
1929 "%s %s process (%d): %s"),1943 "%s %s process (%d): %s"),
1930 job_name (job), process_name (process),1944 job_name (job), process_name (process),
1931 job->pid[process], strerror (errno));1945 job->pid[process], strerror (errno));
1932 return;1946 return;
1947#if defined(__linux__)
1933 }1948 }
1949#endif
19341950
1935 job->trace_state = TRACE_NORMAL;1951 job->trace_state = TRACE_NORMAL;
19361952
@@ -2051,14 +2067,18 @@
2051 || (job->trace_state != TRACE_NORMAL))2067 || (job->trace_state != TRACE_NORMAL))
2052 return;2068 return;
20532069
2070#if defined(__linux__)
2054 /* Obtain the child process id from the ptrace event. */2071 /* Obtain the child process id from the ptrace event. */
2055 if (ptrace (PTRACE_GETEVENTMSG, job->pid[process], NULL, &data) < 0) {2072 if (ptrace (PTRACE_GETEVENTMSG, job->pid[process], NULL, &data) < 0) {
2073#endif
2056 nih_warn (_("Failed to obtain child process id "2074 nih_warn (_("Failed to obtain child process id "
2057 "for %s %s process (%d): %s"),2075 "for %s %s process (%d): %s"),
2058 job_name (job), process_name (process),2076 job_name (job), process_name (process),
2059 job->pid[process], strerror (errno));2077 job->pid[process], strerror (errno));
2060 return;2078 return;
2079#if defined(__linux__)
2061 }2080 }
2081#endif
20622082
2063 nih_info (_("%s %s process (%d) became new process (%d)"),2083 nih_info (_("%s %s process (%d) became new process (%d)"),
2064 job_name (job), process_name (process),2084 job_name (job), process_name (process),
@@ -2083,13 +2103,17 @@
2083 * waiting at SIGSTOP, in which case a ptrace() call will succeed2103 * waiting at SIGSTOP, in which case a ptrace() call will succeed
2084 * for it.2104 * for it.
2085 */2105 */
2106#if defined(__linux__)
2086 if (ptrace (PTRACE_SETOPTIONS, job->pid[process], NULL, 0) < 0) {2107 if (ptrace (PTRACE_SETOPTIONS, job->pid[process], NULL, 0) < 0) {
2108#endif
2087 nih_debug ("Failed to set options for new %s %s process (%d), "2109 nih_debug ("Failed to set options for new %s %s process (%d), "
2088 "probably not yet forked: %s",2110 "probably not yet forked: %s",
2089 job_name (job), process_name (process),2111 job_name (job), process_name (process),
2090 job->pid[process], strerror (errno));2112 job->pid[process], strerror (errno));
2091 return;2113 return;
2114#if defined(__linux__)
2092 }2115 }
2116#endif
20932117
2094 job_process_trace_new_child (job, process);2118 job_process_trace_new_child (job, process);
2095}2119}
20962120
=== modified file 'init/main.c'
--- init/main.c 2013-11-05 16:15:19 +0000
+++ init/main.c 2013-12-31 00:12:51 +0000
@@ -46,7 +46,9 @@
46#include <syslog.h>46#include <syslog.h>
47#include <unistd.h>47#include <unistd.h>
4848
49#if defined(__linux__)
49#include <linux/kd.h>50#include <linux/kd.h>
51#endif
5052
51#include <nih/macros.h>53#include <nih/macros.h>
52#include <nih/alloc.h>54#include <nih/alloc.h>
@@ -293,8 +295,7 @@
293 needs_devtmpfs = 1;295 needs_devtmpfs = 1;
294296
295 if (needs_devtmpfs) {297 if (needs_devtmpfs) {
296 if (system_mount ("devtmpfs", "/dev",298 if (system_mount_DEVFS () < 0) {
297 MS_NOEXEC | MS_NOSUID, NULL) < 0) {
298 NihError *err;299 NihError *err;
299300
300 err = nih_error_get ();301 err = nih_error_get ();
@@ -310,8 +311,7 @@
310 nih_error ("%s: %s", _("Cannot create directory"), "/dev/pts");311 nih_error ("%s: %s", _("Cannot create directory"), "/dev/pts");
311 }312 }
312313
313 if (system_mount ("devpts", "/dev/pts", MS_NOEXEC | MS_NOSUID,314 if (system_mount_DEVPTS () < 0) {
314 "gid=5,mode=0620") < 0) {
315 NihError *err;315 NihError *err;
316316
317 err = nih_error_get ();317 err = nih_error_get ();
@@ -327,10 +327,13 @@
327 * hence these checks are performed as early as is327 * hence these checks are performed as early as is
328 * feasible.328 * feasible.
329 */329 */
330#if defined(__linux__)
331 system_mknod ("/dev/kmsg", (S_IFCHR | 0600), makedev (1, 11));
332#endif
330 system_mknod ("/dev/null", (S_IFCHR | 0666), makedev (1, 3));333 system_mknod ("/dev/null", (S_IFCHR | 0666), makedev (1, 3));
331 system_mknod ("/dev/tty", (S_IFCHR | 0666), makedev (5, 0));334 system_mknod ("/dev/tty", (S_IFCHR | 0666), makedev (5, 0));
332 system_mknod ("/dev/console", (S_IFCHR | 0600), makedev (5, 1));335 system_mknod ("/dev/console", (S_IFCHR | 0600), makedev (5, 1));
333 system_mknod ("/dev/kmsg", (S_IFCHR | 0600), makedev (1, 11));336
334337
335 /* Set the standard file descriptors to the ordinary console device,338 /* Set the standard file descriptors to the ordinary console device,
336 * resetting it to sane defaults unless we're inheriting from another339 * resetting it to sane defaults unless we're inheriting from another
@@ -371,8 +374,7 @@
371 * ourselves. Also mount /dev/pts to allow CONSOLE_LOG374 * ourselves. Also mount /dev/pts to allow CONSOLE_LOG
372 * to function if booted in an initramfs-less environment.375 * to function if booted in an initramfs-less environment.
373 */376 */
374 if (system_mount ("proc", "/proc",377 if (system_mount_PROC () < 0) {
375 MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL) < 0) {
376 NihError *err;378 NihError *err;
377379
378 err = nih_error_get ();380 err = nih_error_get ();
@@ -381,8 +383,8 @@
381 nih_free (err);383 nih_free (err);
382 }384 }
383385
384 if (system_mount ("sysfs", "/sys",386#ifdef system_mount_SYSFS
385 MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL) < 0) {387 if (system_mount_SYSFS () < 0) {
386 NihError *err;388 NihError *err;
387389
388 err = nih_error_get ();390 err = nih_error_get ();
@@ -390,6 +392,7 @@
390 err->message);392 err->message);
391 nih_free (err);393 nih_free (err);
392 }394 }
395#endif
393396
394 } else {397 } else {
395 nih_debug ("Running with UID %d as PID %d (PPID %d)",398 nih_debug ("Running with UID %d as PID %d (PPID %d)",
@@ -437,10 +440,13 @@
437 /* Ask the kernel to send us SIGINT when control-alt-delete is440 /* Ask the kernel to send us SIGINT when control-alt-delete is
438 * pressed; generate an event with the same name.441 * pressed; generate an event with the same name.
439 */442 */
443#if defined(__linux__)
440 reboot (RB_DISABLE_CAD);444 reboot (RB_DISABLE_CAD);
445#endif
441 nih_signal_set_handler (SIGINT, nih_signal_handler);446 nih_signal_set_handler (SIGINT, nih_signal_handler);
442 NIH_MUST (nih_signal_add_handler (NULL, SIGINT, cad_handler, NULL));447 NIH_MUST (nih_signal_add_handler (NULL, SIGINT, cad_handler, NULL));
443448
449#if defined(__linux__)
444 /* Ask the kernel to send us SIGWINCH when alt-uparrow is pressed;450 /* Ask the kernel to send us SIGWINCH when alt-uparrow is pressed;
445 * generate a keyboard-request event.451 * generate a keyboard-request event.
446 */452 */
@@ -449,7 +455,7 @@
449 NIH_MUST (nih_signal_add_handler (NULL, SIGWINCH,455 NIH_MUST (nih_signal_add_handler (NULL, SIGWINCH,
450 kbd_handler, NULL));456 kbd_handler, NULL));
451 }457 }
452458#endif
453 /* powstatd sends us SIGPWR when it changes /etc/powerstatus */459 /* powstatd sends us SIGPWR when it changes /etc/powerstatus */
454 nih_signal_set_handler (SIGPWR, nih_signal_handler);460 nih_signal_set_handler (SIGPWR, nih_signal_handler);
455 NIH_MUST (nih_signal_add_handler (NULL, SIGPWR, pwr_handler, NULL));461 NIH_MUST (nih_signal_add_handler (NULL, SIGPWR, pwr_handler, NULL));
456462
=== modified file 'init/parse_job.c'
--- init/parse_job.c 2013-07-21 23:54:16 +0000
+++ init/parse_job.c 2013-12-31 00:12:51 +0000
@@ -2641,20 +2641,28 @@
2641 resource = RLIMIT_FSIZE;2641 resource = RLIMIT_FSIZE;
2642 } else if (! strcmp (arg, "memlock")) {2642 } else if (! strcmp (arg, "memlock")) {
2643 resource = RLIMIT_MEMLOCK;2643 resource = RLIMIT_MEMLOCK;
2644#if defined(RLIMIT_MSGQUEUE)
2644 } else if (! strcmp (arg, "msgqueue")) {2645 } else if (! strcmp (arg, "msgqueue")) {
2645 resource = RLIMIT_MSGQUEUE;2646 resource = RLIMIT_MSGQUEUE;
2647#endif
2648#if defined(RLIMIT_NICE)
2646 } else if (! strcmp (arg, "nice")) {2649 } else if (! strcmp (arg, "nice")) {
2647 resource = RLIMIT_NICE;2650 resource = RLIMIT_NICE;
2651#endif
2648 } else if (! strcmp (arg, "nofile")) {2652 } else if (! strcmp (arg, "nofile")) {
2649 resource = RLIMIT_NOFILE;2653 resource = RLIMIT_NOFILE;
2650 } else if (! strcmp (arg, "nproc")) {2654 } else if (! strcmp (arg, "nproc")) {
2651 resource = RLIMIT_NPROC;2655 resource = RLIMIT_NPROC;
2652 } else if (! strcmp (arg, "rss")) {2656 } else if (! strcmp (arg, "rss")) {
2653 resource = RLIMIT_RSS;2657 resource = RLIMIT_RSS;
2658#if defined(RLIMIT_RTPRIO)
2654 } else if (! strcmp (arg, "rtprio")) {2659 } else if (! strcmp (arg, "rtprio")) {
2655 resource = RLIMIT_RTPRIO;2660 resource = RLIMIT_RTPRIO;
2661#endif
2662#if defined(RLIMIT_SIGPENDING)
2656 } else if (! strcmp (arg, "sigpending")) {2663 } else if (! strcmp (arg, "sigpending")) {
2657 resource = RLIMIT_SIGPENDING;2664 resource = RLIMIT_SIGPENDING;
2665#endif
2658 } else if (! strcmp (arg, "stack")) {2666 } else if (! strcmp (arg, "stack")) {
2659 resource = RLIMIT_STACK;2667 resource = RLIMIT_STACK;
2660 } else {2668 } else {
26612669
=== modified file 'init/state.c'
--- init/state.c 2013-10-11 13:35:51 +0000
+++ init/state.c 2013-12-31 00:12:51 +0000
@@ -1046,8 +1046,11 @@
1046 for (i = 0; i < json_object_array_length (json_limits); i++) {1046 for (i = 0; i < json_object_array_length (json_limits); i++) {
1047 json_object *json_rlimit;1047 json_object *json_rlimit;
10481048
1049#if defined(__FreeBSD_kernel__)
1050 if (i > RLIMIT_NLIMITS) continue;
1051#else
1049 nih_assert (i <= RLIMIT_NLIMITS);1052 nih_assert (i <= RLIMIT_NLIMITS);
10501053#endif
1051 json_rlimit = json_object_array_get_idx (json_limits, i);1054 json_rlimit = json_object_array_get_idx (json_limits, i);
1052 if (! json_rlimit)1055 if (! json_rlimit)
1053 goto error;1056 goto error;
10541057
=== modified file 'init/system.c'
--- init/system.c 2013-10-25 19:11:25 +0000
+++ init/system.c 2013-12-31 00:12:51 +0000
@@ -207,12 +207,29 @@
207 return 0;207 return 0;
208208
209 /* Mount the filesystem */209 /* Mount the filesystem */
210 if (mount ("none", dir, type, flags, options) < 0)210 if (MOUNT (dir, type, flags, options) < 0)
211 nih_return_system_error (-1);211 nih_return_system_error (-1);
212212
213 return 0;213 return 0;
214}214}
215215
216
217/**
218 * system_mount_NAME:
219 *
220 * Implement wrapper system_mount functions for well known
221 * filesystems, e.g. proc.
222 **/
223#define MOUNT_POINT(name, type, dir, flags, options) \
224 int \
225 system_mount_##name(void) \
226 { \
227 return system_mount(type, dir, flags, options); \
228 }
229 MOUNT_POINTS
230#undef MOUNT_POINT
231
232
216/**233/**
217 * system_mknod:234 * system_mknod:
218 *235 *
219236
=== modified file 'init/system.h'
--- init/system.h 2013-10-25 19:11:25 +0000
+++ init/system.h 2013-12-31 00:12:51 +0000
@@ -26,6 +26,22 @@
2626
27#include "job_class.h"27#include "job_class.h"
2828
29#if defined(__linux__)
30#define MOUNT_POINTS \
31 MOUNT_POINT(PROC, "proc", "/proc", (MS_NODEV | MS_NOEXEC | MS_NOSUID), NULL) \
32 MOUNT_POINT(DEVFS, "devtmpfs", "/dev", (MS_NOEXEC | MS_NOSUID), NULL) \
33 MOUNT_POINT(DEVPTS, "devpts", "/dev/pts", (MS_NOEXEC | MS_NOSUID), "gid=5,mode=0620") \
34 MOUNT_POINT(SYSFS, "sysfs", "/sys", (MS_NODEV | MS_NOEXEC | MS_NOSUID), NULL)
35#define MOUNT(type, dir, flags, options) mount("none", dir, type, flags, options)
36#elif defined (__FreeBSD_kernel__)
37#define MOUNT_POINTS \
38 MOUNT_POINT(PROC, "linprocfs", "/proc", MNT_LOCAL, NULL) \
39 MOUNT_POINT(DEVFS, "devfs", "/dev", (MNT_LOCAL | MNT_MULTILABEL), NULL) \
40 MOUNT_POINT(DEVPTS, "fdescfs", "/dev/fd", 0, NULL)
41#define MOUNT(type, dir, flags, options) mount(type, dir, flags, NULL)
42#else
43#define MOUNT_POINTS "Mount points unknown for target"
44#endif
2945
30NIH_BEGIN_EXTERN46NIH_BEGIN_EXTERN
3147
@@ -44,6 +60,10 @@
44int system_check_file (const char *path, mode_t type, dev_t dev)60int system_check_file (const char *path, mode_t type, dev_t dev)
45 __attribute__ ((warn_unused_result));61 __attribute__ ((warn_unused_result));
4662
63#define MOUNT_POINT(name, type, dir, flags, options) int system_mount_##name(void);
64 MOUNT_POINTS
65#undef MOUNT_POINT
66
47NIH_END_EXTERN67NIH_END_EXTERN
4868
49#endif /* INIT_SYSTEM_H */69#endif /* INIT_SYSTEM_H */
5070
=== modified file 'init/tests/test_job.c'
--- init/tests/test_job.c 2013-08-23 12:46:42 +0000
+++ init/tests/test_job.c 2013-12-31 00:12:51 +0000
@@ -7410,6 +7410,7 @@
7410 }7410 }
7411}7411}
74127412
7413#if defined(__linux__)
7413void7414void
7414test_deserialise_ptrace (void)7415test_deserialise_ptrace (void)
7415{7416{
@@ -7492,7 +7493,7 @@
7492 /* Continue in deserialise_ptrace_next */7493 /* Continue in deserialise_ptrace_next */
7493 }7494 }
7494}7495}
74957496#endif
74967497
7497void7498void
7498deserialise_ptrace_next (void)7499deserialise_ptrace_next (void)
@@ -7605,8 +7606,9 @@
7605 test_get_state ();7606 test_get_state ();
76067607
7607 test_get_processes ();7608 test_get_processes ();
76087609#if defined(__linux__)
7609 test_deserialise_ptrace ();7610 test_deserialise_ptrace ();
7611#endif
76107612
7611 return 0;7613 return 0;
7612}7614}
76137615
=== modified file 'init/tests/test_job_process.c'
--- init/tests/test_job_process.c 2013-11-11 10:13:08 +0000
+++ init/tests/test_job_process.c 2013-12-31 00:12:51 +0000
@@ -8535,7 +8535,7 @@
85358535
8536 class->expect = EXPECT_NONE;8536 class->expect = EXPECT_NONE;
85378537
85388538#if defined(__linux__)
8539 /* Check that when a process forks and we receive the event for8539 /* Check that when a process forks and we receive the event for
8540 * the parent before the child (faked by killing the child), the8540 * the parent before the child (faked by killing the child), the
8541 * trace state is to expect a new child - with the state updated8541 * trace state is to expect a new child - with the state updated
@@ -8682,7 +8682,6 @@
86828682
8683 class->expect = EXPECT_NONE;8683 class->expect = EXPECT_NONE;
86848684
8685
8686 /* Check that should the process call exec() before the first fork()8685 /* Check that should the process call exec() before the first fork()
8687 * it's allowed since it's likely a shell script calling the real8686 * it's allowed since it's likely a shell script calling the real
8688 * thing that we want to follow.8687 * thing that we want to follow.
@@ -8789,7 +8788,7 @@
87898788
8790 nih_free (job);8789 nih_free (job);
8791 }8790 }
87928791#endif
8793 class->expect = EXPECT_NONE;8792 class->expect = EXPECT_NONE;
8794#if HAVE_VALGRIND_VALGRIND_H8793#if HAVE_VALGRIND_VALGRIND_H
8795 }8794 }
87968795
=== modified file 'init/tests/test_parse_job.c'
--- init/tests/test_parse_job.c 2013-07-21 23:54:16 +0000
+++ init/tests/test_parse_job.c 2013-12-31 00:12:51 +0000
@@ -7608,7 +7608,7 @@
7608 nih_free (job);7608 nih_free (job);
7609 }7609 }
76107610
76117611#if defined(RLIMIT_MSGQUEUE)
7612 /* Check that the limit msgqueue stanza sets the RLIMIT_MSGQUEUE7612 /* Check that the limit msgqueue stanza sets the RLIMIT_MSGQUEUE
7613 * resource.7613 * resource.
7614 */7614 */
@@ -7642,8 +7642,9 @@
76427642
7643 nih_free (job);7643 nih_free (job);
7644 }7644 }
76457645#endif
76467646
7647#if defined(RLIMIT_NICE)
7647 /* Check that the limit nice stanza sets the RLIMIT_NICE resource.7648 /* Check that the limit nice stanza sets the RLIMIT_NICE resource.
7648 */7649 */
7649 TEST_FEATURE ("with nice limit");7650 TEST_FEATURE ("with nice limit");
@@ -7676,7 +7677,7 @@
76767677
7677 nih_free (job);7678 nih_free (job);
7678 }7679 }
76797680#endif
76807681
7681 /* Check that the limit nofile stanza sets the RLIMIT_NOFILE7682 /* Check that the limit nofile stanza sets the RLIMIT_NOFILE
7682 * resource.7683 * resource.
@@ -7780,7 +7781,7 @@
7780 nih_free (job);7781 nih_free (job);
7781 }7782 }
77827783
77837784#if defined(RLIMIT_RTPRIO)
7784 /* Check that the limit rtprio stanza sets the RLIMIT_RTPRIO resource.7785 /* Check that the limit rtprio stanza sets the RLIMIT_RTPRIO resource.
7785 */7786 */
7786 TEST_FEATURE ("with rtprio limit");7787 TEST_FEATURE ("with rtprio limit");
@@ -7813,8 +7814,9 @@
78137814
7814 nih_free (job);7815 nih_free (job);
7815 }7816 }
78167817#endif
78177818
7819#if defined(RLIMIT_SIGPENDING)
7818 /* Check that the limit sigpending stanza sets the RLIMIT_SIGPENDING7820 /* Check that the limit sigpending stanza sets the RLIMIT_SIGPENDING
7819 * resource.7821 * resource.
7820 */7822 */
@@ -7848,7 +7850,7 @@
78487850
7849 nih_free (job);7851 nih_free (job);
7850 }7852 }
78517853#endif
78527854
7853 /* Check that the limit stack stanza sets the RLIMIT_STACK resource.7855 /* Check that the limit stack stanza sets the RLIMIT_STACK resource.
7854 */7856 */
78557857
=== modified file 'util/reboot.c'
--- util/reboot.c 2013-08-22 11:13:41 +0000
+++ util/reboot.c 2013-12-31 00:12:51 +0000
@@ -21,8 +21,9 @@
21# include <config.h>21# include <config.h>
22#endif /* HAVE_CONFIG_H */22#endif /* HAVE_CONFIG_H */
2323
2424#if defined(__linux__)
25#include <linux/reboot.h>25#include <linux/reboot.h>
26#endif
26#include <sys/reboot.h>27#include <sys/reboot.h>
27#include <sys/syscall.h>28#include <sys/syscall.h>
2829
@@ -237,9 +238,10 @@
237 if (! no_sync)238 if (! no_sync)
238 sync ();239 sync ();
239240
241#if defined(RB_ENABLE_CAD)
240 /* Re-enable Control-Alt-Delete in case it breaks */242 /* Re-enable Control-Alt-Delete in case it breaks */
241 reboot (RB_ENABLE_CAD);243 reboot (RB_ENABLE_CAD);
242244#endif
243 /* Do the syscall */245 /* Do the syscall */
244 switch (mode) {246 switch (mode) {
245 case REBOOT:247 case REBOOT:
@@ -254,6 +256,7 @@
254 nih_info (_("Powering off"));256 nih_info (_("Powering off"));
255 reboot (RB_POWER_OFF);257 reboot (RB_POWER_OFF);
256 break;258 break;
259#if defined(__linux__)
257 case REBOOTCOMMAND:260 case REBOOTCOMMAND:
258 nih_info (_("Rebooting with %s"), rebootcommand);261 nih_info (_("Rebooting with %s"), rebootcommand);
259 syscall (SYS_reboot,262 syscall (SYS_reboot,
@@ -261,10 +264,13 @@
261 LINUX_REBOOT_MAGIC2,264 LINUX_REBOOT_MAGIC2,
262 LINUX_REBOOT_CMD_RESTART2,265 LINUX_REBOOT_CMD_RESTART2,
263 rebootcommand);266 rebootcommand);
267#endif
264 }268 }
265269
270#if defined(__linux_)
266 /* Shouldn't get here, but if we do, carry on */271 /* Shouldn't get here, but if we do, carry on */
267 reboot (RB_DISABLE_CAD);272 reboot (RB_DISABLE_CAD);
273#endif
268274
269 return 0;275 return 0;
270}276}

Subscribers

People subscribed via source and target branches