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> |
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 |
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 */ |
222 while ((c = getopt(argc, argv, "dsf")) != -1) |
223 switch (c) { |
224 case 'd': 225 devfs = 1; 226 break; |
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 |
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 --- |