init.c (12185) | init.c (19227) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Donn Seeley at Berkeley Software Design, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 7/15/93"; 45#endif /* not lint */ 46 47#include <sys/param.h> | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Donn Seeley at Berkeley Software Design, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 7/15/93"; 45#endif /* not lint */ 46 47#include <sys/param.h> |
48#include <sys/mount.h> |
|
48#include <sys/sysctl.h> 49#include <sys/wait.h> 50 51#include <db.h> 52#include <errno.h> 53#include <fcntl.h> 54#include <signal.h> 55#include <stdio.h> --- 60 unchanged lines hidden (view full) --- 116state_func_t death __P((void)); 117 118enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT; 119#define FALSE 0 120#define TRUE 1 121 122int Reboot = FALSE; 123 | 49#include <sys/sysctl.h> 50#include <sys/wait.h> 51 52#include <db.h> 53#include <errno.h> 54#include <fcntl.h> 55#include <signal.h> 56#include <stdio.h> --- 60 unchanged lines hidden (view full) --- 117state_func_t death __P((void)); 118 119enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT; 120#define FALSE 0 121#define TRUE 1 122 123int Reboot = FALSE; 124 |
125int devfs; 126 |
|
124void transition __P((state_t)); 125state_t requested_transition = runcom; 126 127void setctty __P((char *)); 128 129typedef struct init_session { 130 int se_index; /* index of entry in ttys file */ 131 pid_t se_process; /* controlling process */ --- 79 unchanged lines hidden (view full) --- 211 */ 212 if (setlogin("root") < 0) 213 warning("setlogin() failed: %m"); 214 215 /* 216 * This code assumes that we always get arguments through flags, 217 * never through bits set in some random machine register. 218 */ | 127void transition __P((state_t)); 128state_t requested_transition = runcom; 129 130void setctty __P((char *)); 131 132typedef struct init_session { 133 int se_index; /* index of entry in ttys file */ 134 pid_t se_process; /* controlling process */ --- 79 unchanged lines hidden (view full) --- 214 */ 215 if (setlogin("root") < 0) 216 warning("setlogin() failed: %m"); 217 218 /* 219 * This code assumes that we always get arguments through flags, 220 * never through bits set in some random machine register. 221 */ |
219 while ((c = getopt(argc, argv, "sf")) != -1) | 222 while ((c = getopt(argc, argv, "dsf")) != -1) |
220 switch (c) { | 223 switch (c) { |
224 case 'd': 225 devfs = 1; 226 break; |
|
221 case 's': 222 requested_transition = single_user; 223 break; 224 case 'f': 225 runcom_mode = FASTBOOT; 226 break; 227 default: 228 warning("unrecognized flag '-%c'", c); 229 break; 230 } 231 232 if (optind != argc) 233 warning("ignoring excess arguments"); 234 | 227 case 's': 228 requested_transition = single_user; 229 break; 230 case 'f': 231 runcom_mode = FASTBOOT; 232 break; 233 default: 234 warning("unrecognized flag '-%c'", c); 235 break; 236 } 237 238 if (optind != argc) 239 warning("ignoring excess arguments"); 240 |
241 /* Mount devfs on /dev */ 242 if (devfs) { 243 mount(MOUNT_DEVFS, "/dev", MNT_NOEXEC|MNT_RDONLY, 0); 244 } 245 |
|
235 /* 236 * We catch or block signals rather than ignore them, 237 * so that they get reset on exec. 238 */ 239 handle(badsys, SIGSYS, 0); 240 handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, 241 SIGBUS, SIGXCPU, SIGXFSZ, 0); 242 handle(transition_handler, SIGHUP, SIGINT, SIGTERM, SIGTSTP, 0); --- 1183 unchanged lines hidden --- | 246 /* 247 * We catch or block signals rather than ignore them, 248 * so that they get reset on exec. 249 */ 250 handle(badsys, SIGSYS, 0); 251 handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, 252 SIGBUS, SIGXCPU, SIGXFSZ, 0); 253 handle(transition_handler, SIGHUP, SIGINT, SIGTERM, SIGTSTP, 0); --- 1183 unchanged lines hidden --- |