aboutsummaryrefslogtreecommitdiff
path: root/init/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/init.c')
-rw-r--r--init/init.c26
1 files changed, 13 insertions, 13 deletions
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();