aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/halt.c2
-rw-r--r--init/init.c26
-rw-r--r--init/mesg.c4
-rw-r--r--init/poweroff.c2
-rw-r--r--init/reboot.c4
-rw-r--r--init/start_stop_daemon.c22
6 files changed, 30 insertions, 30 deletions
diff --git a/init/halt.c b/init/halt.c
index 3d4725f09..7e663227c 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -32,7 +32,7 @@ extern int halt_main(int argc, char **argv)
32 if (!pid || *pid<=0) { 32 if (!pid || *pid<=0) {
33 pid = find_pid_by_name("linuxrc"); 33 pid = find_pid_by_name("linuxrc");
34 if (!pid || *pid<=0) 34 if (!pid || *pid<=0)
35 error_msg_and_die("no process killed"); 35 bb_error_msg_and_die("no process killed");
36 } 36 }
37 return(kill(*pid, SIGUSR1)); 37 return(kill(*pid, SIGUSR1));
38#else 38#else
diff --git a/init/init.c b/init/init.c
index 258a7fa6b..be91d6a8f 100644
--- a/init/init.c
+++ b/init/init.c
@@ -247,14 +247,14 @@ static void message(int device, const char *fmt, ...)
247 if (log_fd < 0) { 247 if (log_fd < 0) {
248 if ((log_fd = device_open(log, O_RDWR | O_NDELAY | O_NOCTTY)) < 0) { 248 if ((log_fd = device_open(log, O_RDWR | O_NDELAY | O_NOCTTY)) < 0) {
249 log_fd = -2; 249 log_fd = -2;
250 error_msg("Bummer, can't write to log on %s!", log); 250 bb_error_msg("Bummer, can't write to log on %s!", log);
251 device = CONSOLE; 251 device = CONSOLE;
252 } else { 252 } else {
253 fcntl(log_fd, F_SETFD, FD_CLOEXEC); 253 fcntl(log_fd, F_SETFD, FD_CLOEXEC);
254 } 254 }
255 } 255 }
256 if ((device & LOG) && (log_fd >= 0)) { 256 if ((device & LOG) && (log_fd >= 0)) {
257 full_write(log_fd, msg, l); 257 bb_full_write(log_fd, msg, l);
258 } 258 }
259#endif 259#endif
260 260
@@ -263,12 +263,12 @@ static void message(int device, const char *fmt, ...)
263 O_WRONLY | O_NOCTTY | O_NDELAY); 263 O_WRONLY | O_NOCTTY | O_NDELAY);
264 /* Always send console messages to /dev/console so people will see them. */ 264 /* Always send console messages to /dev/console so people will see them. */
265 if (fd >= 0) { 265 if (fd >= 0) {
266 full_write(fd, msg, l); 266 bb_full_write(fd, msg, l);
267 close(fd); 267 close(fd);
268#ifdef DEBUG_INIT 268#ifdef DEBUG_INIT
269 /* all descriptors may be closed */ 269 /* all descriptors may be closed */
270 } else { 270 } else {
271 error_msg("Bummer, can't print: "); 271 bb_error_msg("Bummer, can't print: ");
272 va_start(arguments, fmt); 272 va_start(arguments, fmt);
273 vfprintf(stderr, fmt, arguments); 273 vfprintf(stderr, fmt, arguments);
274 va_end(arguments); 274 va_end(arguments);
@@ -323,7 +323,7 @@ static int check_free_memory(void)
323 unsigned int result, u, s = 10; 323 unsigned int result, u, s = 10;
324 324
325 if (sysinfo(&info) != 0) { 325 if (sysinfo(&info) != 0) {
326 perror_msg("Error checking free memory"); 326 bb_perror_msg("Error checking free memory");
327 return -1; 327 return -1;
328 } 328 }
329 329
@@ -564,11 +564,11 @@ static pid_t run(const struct init_action *a)
564 ++cmdpath; 564 ++cmdpath;
565 565
566 /* find the last component in the command pathname */ 566 /* find the last component in the command pathname */
567 s = get_last_path_component(cmdpath); 567 s = bb_get_last_path_component(cmdpath);
568 568
569 /* make a new argv[0] */ 569 /* make a new argv[0] */
570 if ((cmd[0] = malloc(strlen(s) + 2)) == NULL) { 570 if ((cmd[0] = malloc(strlen(s) + 2)) == NULL) {
571 message(LOG | CONSOLE, memory_exhausted); 571 message(LOG | CONSOLE, bb_msg_memory_exhausted);
572 cmd[0] = cmdpath; 572 cmd[0] = cmdpath;
573 } else { 573 } else {
574 cmd[0][0] = '-'; 574 cmd[0][0] = '-';
@@ -589,7 +589,7 @@ static pid_t run(const struct init_action *a)
589 messageD(LOG, "Waiting for enter to start '%s'" 589 messageD(LOG, "Waiting for enter to start '%s'"
590 "(pid %d, terminal %s)\n", 590 "(pid %d, terminal %s)\n",
591 cmdpath, getpid(), a->terminal); 591 cmdpath, getpid(), a->terminal);
592 full_write(1, press_enter, sizeof(press_enter) - 1); 592 bb_full_write(1, press_enter, sizeof(press_enter) - 1);
593 while(read(0, &c, 1) == 1 && c != '\n') 593 while(read(0, &c, 1) == 1 && c != '\n')
594 ; 594 ;
595 } 595 }
@@ -1017,7 +1017,7 @@ extern int init_main(int argc, char **argv)
1017 if (!pid || *pid <= 0) { 1017 if (!pid || *pid <= 0) {
1018 pid = find_pid_by_name("linuxrc"); 1018 pid = find_pid_by_name("linuxrc");
1019 if (!pid || *pid <= 0) 1019 if (!pid || *pid <= 0)
1020 error_msg_and_die("no process killed"); 1020 bb_error_msg_and_die("no process killed");
1021 } 1021 }
1022 return kill(*pid, SIGHUP); 1022 return kill(*pid, SIGHUP);
1023 } 1023 }
@@ -1025,10 +1025,10 @@ extern int init_main(int argc, char **argv)
1025 /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */ 1025 /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
1026 if (getpid() != 1 1026 if (getpid() != 1
1027#ifdef CONFIG_FEATURE_INITRD 1027#ifdef CONFIG_FEATURE_INITRD
1028 && strstr(applet_name, "linuxrc") == NULL 1028 && strstr(bb_applet_name, "linuxrc") == NULL
1029#endif 1029#endif
1030 ) { 1030 ) {
1031 show_usage(); 1031 bb_show_usage();
1032 } 1032 }
1033 /* Set up sig handlers -- be sure to 1033 /* Set up sig handlers -- be sure to
1034 * clear all of these in run() */ 1034 * clear all of these in run() */
@@ -1068,10 +1068,10 @@ extern int init_main(int argc, char **argv)
1068 const char * const *e; 1068 const char * const *e;
1069 /* Make sure environs is set to something sane */ 1069 /* Make sure environs is set to something sane */
1070 for(e = environment; *e; e++) 1070 for(e = environment; *e; e++)
1071 putenv(*e); 1071 putenv((char *) *e);
1072 } 1072 }
1073 /* Hello world */ 1073 /* Hello world */
1074 message(MAYBE_CONSOLE | LOG, "init started: %s", full_version); 1074 message(MAYBE_CONSOLE | LOG, "init started: %s", bb_msg_full_version);
1075 1075
1076 /* Make sure there is enough memory to do something useful. */ 1076 /* Make sure there is enough memory to do something useful. */
1077 check_memory(); 1077 check_memory();
diff --git a/init/mesg.c b/init/mesg.c
index f9b46e029..7b8acf657 100644
--- a/init/mesg.c
+++ b/init/mesg.c
@@ -52,7 +52,7 @@ extern int mesg_main(int argc, char *argv[])
52 return EXIT_SUCCESS; 52 return EXIT_SUCCESS;
53 } 53 }
54 } 54 }
55 perror_msg_and_die("%s", tty); 55 bb_perror_msg_and_die("%s", tty);
56 } 56 }
57 show_usage(); 57 bb_show_usage();
58} 58}
diff --git a/init/poweroff.c b/init/poweroff.c
index 27468bac0..aca6e2f25 100644
--- a/init/poweroff.c
+++ b/init/poweroff.c
@@ -32,7 +32,7 @@ extern int poweroff_main(int argc, char **argv)
32 if (!pid || *pid<=0) { 32 if (!pid || *pid<=0) {
33 pid = find_pid_by_name("linuxrc"); 33 pid = find_pid_by_name("linuxrc");
34 if (!pid || *pid<=0) 34 if (!pid || *pid<=0)
35 error_msg_and_die("no process killed"); 35 bb_error_msg_and_die("no process killed");
36 } 36 }
37 return(kill(*pid, SIGUSR2)); 37 return(kill(*pid, SIGUSR2));
38#else 38#else
diff --git a/init/reboot.c b/init/reboot.c
index 872d9e741..8c380fa6a 100644
--- a/init/reboot.c
+++ b/init/reboot.c
@@ -52,7 +52,7 @@ extern int reboot_main(int argc, char **argv)
52 break; 52 break;
53 53
54 default: 54 default:
55 show_usage(); 55 bb_show_usage();
56 break; 56 break;
57 } 57 }
58 } 58 }
@@ -99,7 +99,7 @@ extern int reboot_main(int argc, char **argv)
99 if (!pid || *pid<=0) 99 if (!pid || *pid<=0)
100 pid = find_pid_by_name("linuxrc"); 100 pid = find_pid_by_name("linuxrc");
101 if (!pid || *pid<=0) 101 if (!pid || *pid<=0)
102 error_msg_and_die("no process killed"); 102 bb_error_msg_and_die("no process killed");
103 fflush(stdout); 103 fflush(stdout);
104 return(kill(*pid, SIGTERM)); 104 return(kill(*pid, SIGTERM));
105 } 105 }
diff --git a/init/start_stop_daemon.c b/init/start_stop_daemon.c
index 576526183..a1c2c21c2 100644
--- a/init/start_stop_daemon.c
+++ b/init/start_stop_daemon.c
@@ -74,7 +74,7 @@ parse_options(int argc, char * const *argv)
74 break; 74 break;
75 case 's': 75 case 's':
76 if (sscanf(optarg, "%d", &signal_nr) != 1) 76 if (sscanf(optarg, "%d", &signal_nr) != 1)
77 error_msg_and_die ("-s takes a numeric argument"); 77 bb_error_msg_and_die ("-s takes a numeric argument");
78 break; 78 break;
79 case 'u': 79 case 'u':
80 userspec = optarg; 80 userspec = optarg;
@@ -86,21 +86,21 @@ parse_options(int argc, char * const *argv)
86 fork_before_exec = 1; 86 fork_before_exec = 1;
87 break; 87 break;
88 default: 88 default:
89 show_usage(); 89 bb_show_usage();
90 } 90 }
91 } 91 }
92 92
93 if (start == stop) 93 if (start == stop)
94 error_msg_and_die ("need one of -S or -K"); 94 bb_error_msg_and_die ("need one of -S or -K");
95 95
96 if (!execname && !userspec) 96 if (!execname && !userspec)
97 error_msg_and_die ("need at least one of -x or -u"); 97 bb_error_msg_and_die ("need at least one of -x or -u");
98 98
99 if (!startas) 99 if (!startas)
100 startas = execname; 100 startas = execname;
101 101
102 if (start && !startas) 102 if (start && !startas)
103 error_msg_and_die ("-S needs -x or -a"); 103 bb_error_msg_and_die ("-S needs -x or -a");
104} 104}
105 105
106 106
@@ -185,7 +185,7 @@ do_procfs(void)
185 185
186 procdir = opendir("/proc"); 186 procdir = opendir("/proc");
187 if (!procdir) 187 if (!procdir)
188 perror_msg_and_die ("opendir /proc"); 188 bb_perror_msg_and_die ("opendir /proc");
189 189
190 foundany = 0; 190 foundany = 0;
191 while ((entry = readdir(procdir)) != NULL) { 191 while ((entry = readdir(procdir)) != NULL) {
@@ -196,7 +196,7 @@ do_procfs(void)
196 } 196 }
197 closedir(procdir); 197 closedir(procdir);
198 if (!foundany) 198 if (!foundany)
199 error_msg_and_die ("nothing in /proc - not mounted?"); 199 bb_error_msg_and_die ("nothing in /proc - not mounted?");
200} 200}
201 201
202 202
@@ -214,7 +214,7 @@ do_stop(void)
214 else if (userspec) 214 else if (userspec)
215 sprintf(what, "process(es) owned by `%s'", userspec); 215 sprintf(what, "process(es) owned by `%s'", userspec);
216 else 216 else
217 error_msg_and_die ("internal error, please report"); 217 bb_error_msg_and_die ("internal error, please report");
218 218
219 if (!found) { 219 if (!found) {
220 printf("no %s found; none killed.\n", what); 220 printf("no %s found; none killed.\n", what);
@@ -225,7 +225,7 @@ do_stop(void)
225 p->pid = -p->pid; 225 p->pid = -p->pid;
226 killed++; 226 killed++;
227 } else { 227 } else {
228 perror_msg("warning: failed to kill %d:", p->pid); 228 bb_perror_msg("warning: failed to kill %d:", p->pid);
229 } 229 }
230 } 230 }
231 if (killed) { 231 if (killed) {
@@ -262,10 +262,10 @@ start_stop_daemon_main(int argc, char **argv)
262 *--argv = startas; 262 *--argv = startas;
263 if (fork_before_exec) { 263 if (fork_before_exec) {
264 if (daemon(0, 0) == -1) 264 if (daemon(0, 0) == -1)
265 perror_msg_and_die ("unable to fork"); 265 bb_perror_msg_and_die ("unable to fork");
266 } 266 }
267 setsid(); 267 setsid();
268 execv(startas, argv); 268 execv(startas, argv);
269 perror_msg_and_die ("unable to start %s", startas); 269 bb_perror_msg_and_die ("unable to start %s", startas);
270} 270}
271 271