aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-26 08:12:56 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-26 08:12:56 +0000
commit4c78147755fa3193269d665cae49410f529b2094 (patch)
tree4e7f867d6517643b35df03e5ec684719a41baa68
parentec33d45e8939bc8ab186489e64da3650e402a171 (diff)
downloadbusybox-w32-4c78147755fa3193269d665cae49410f529b2094.tar.gz
busybox-w32-4c78147755fa3193269d665cae49410f529b2094.tar.bz2
busybox-w32-4c78147755fa3193269d665cae49410f529b2094.zip
Changes
-rw-r--r--init.c27
-rw-r--r--init/init.c27
2 files changed, 44 insertions, 10 deletions
diff --git a/init.c b/init.c
index 75a659911..7258d3151 100644
--- a/init.c
+++ b/init.c
@@ -40,6 +40,9 @@
40#include <linux/serial.h> /* for serial_struct */ 40#include <linux/serial.h> /* for serial_struct */
41#include <sys/vt.h> /* for vt_stat */ 41#include <sys/vt.h> /* for vt_stat */
42#include <sys/ioctl.h> 42#include <sys/ioctl.h>
43#ifdef BB_SYSLOGD
44#include <sys/syslog.h>
45#endif
43 46
44#define DEV_CONSOLE "/dev/console" /* Logical system console */ 47#define DEV_CONSOLE "/dev/console" /* Logical system console */
45#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ 48#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */
@@ -83,8 +86,20 @@ int device_open(char *device, int mode)
83void message(int device, char *fmt, ...) 86void message(int device, char *fmt, ...)
84{ 87{
85 int fd; 88 int fd;
86 static int log_fd=-1;
87 va_list arguments; 89 va_list arguments;
90#ifdef BB_SYSLOGD
91
92 /* Log the message to syslogd */
93 if (device & LOG ) {
94 char msg[1024];
95 va_start(arguments, fmt);
96 vsnprintf(msg, sizeof(msg), fmt, arguments);
97 va_end(arguments);
98 syslog(LOG_DAEMON|LOG_NOTICE, msg);
99 }
100
101#else
102 static int log_fd=-1;
88 103
89 /* Take full control of the log tty, and never close it. 104 /* Take full control of the log tty, and never close it.
90 * It's mine, all mine! Muhahahaha! */ 105 * It's mine, all mine! Muhahahaha! */
@@ -102,12 +117,13 @@ void message(int device, char *fmt, ...)
102 return; 117 return;
103 } 118 }
104 } 119 }
105
106 if ( (device & LOG) && (log_fd >= 0) ) { 120 if ( (device & LOG) && (log_fd >= 0) ) {
107 va_start(arguments, fmt); 121 va_start(arguments, fmt);
108 vdprintf(log_fd, fmt, arguments); 122 vdprintf(log_fd, fmt, arguments);
109 va_end(arguments); 123 va_end(arguments);
110 } 124 }
125#endif
126
111 if (device & CONSOLE) { 127 if (device & CONSOLE) {
112 /* Always send console messages to /dev/console so people will see them. */ 128 /* Always send console messages to /dev/console so people will see them. */
113 if ((fd = device_open(DEV_CONSOLE, O_WRONLY|O_NOCTTY|O_NDELAY)) >= 0) { 129 if ((fd = device_open(DEV_CONSOLE, O_WRONLY|O_NOCTTY|O_NDELAY)) >= 0) {
@@ -433,8 +449,9 @@ extern int init_main(int argc, char **argv)
433 const char* const shell_command[] = { SHELL, "-" SHELL, 0}; 449 const char* const shell_command[] = { SHELL, "-" SHELL, 0};
434 const char* const* tty0_command = shell_command; 450 const char* const* tty0_command = shell_command;
435 const char* const* tty1_command = shell_command; 451 const char* const* tty1_command = shell_command;
436#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS 452#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS
437 const char* const rc_exit_command[] = BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS; 453 const char* const rc_exit_command[] = { "BB_INIT_CMD_IF_RC_SCRIPT_EXITS",
454 "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 0 };
438#endif 455#endif
439 456
440#ifdef DEBUG_INIT 457#ifdef DEBUG_INIT
@@ -536,7 +553,7 @@ extern int init_main(int argc, char **argv)
536 if (run_rc == FALSE) { 553 if (run_rc == FALSE) {
537 pid1 = 0; 554 pid1 = 0;
538 } 555 }
539#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS 556#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS
540 else { 557 else {
541 pid1 = 0; 558 pid1 = 0;
542 run_rc=FALSE; 559 run_rc=FALSE;
diff --git a/init/init.c b/init/init.c
index 75a659911..7258d3151 100644
--- a/init/init.c
+++ b/init/init.c
@@ -40,6 +40,9 @@
40#include <linux/serial.h> /* for serial_struct */ 40#include <linux/serial.h> /* for serial_struct */
41#include <sys/vt.h> /* for vt_stat */ 41#include <sys/vt.h> /* for vt_stat */
42#include <sys/ioctl.h> 42#include <sys/ioctl.h>
43#ifdef BB_SYSLOGD
44#include <sys/syslog.h>
45#endif
43 46
44#define DEV_CONSOLE "/dev/console" /* Logical system console */ 47#define DEV_CONSOLE "/dev/console" /* Logical system console */
45#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ 48#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */
@@ -83,8 +86,20 @@ int device_open(char *device, int mode)
83void message(int device, char *fmt, ...) 86void message(int device, char *fmt, ...)
84{ 87{
85 int fd; 88 int fd;
86 static int log_fd=-1;
87 va_list arguments; 89 va_list arguments;
90#ifdef BB_SYSLOGD
91
92 /* Log the message to syslogd */
93 if (device & LOG ) {
94 char msg[1024];
95 va_start(arguments, fmt);
96 vsnprintf(msg, sizeof(msg), fmt, arguments);
97 va_end(arguments);
98 syslog(LOG_DAEMON|LOG_NOTICE, msg);
99 }
100
101#else
102 static int log_fd=-1;
88 103
89 /* Take full control of the log tty, and never close it. 104 /* Take full control of the log tty, and never close it.
90 * It's mine, all mine! Muhahahaha! */ 105 * It's mine, all mine! Muhahahaha! */
@@ -102,12 +117,13 @@ void message(int device, char *fmt, ...)
102 return; 117 return;
103 } 118 }
104 } 119 }
105
106 if ( (device & LOG) && (log_fd >= 0) ) { 120 if ( (device & LOG) && (log_fd >= 0) ) {
107 va_start(arguments, fmt); 121 va_start(arguments, fmt);
108 vdprintf(log_fd, fmt, arguments); 122 vdprintf(log_fd, fmt, arguments);
109 va_end(arguments); 123 va_end(arguments);
110 } 124 }
125#endif
126
111 if (device & CONSOLE) { 127 if (device & CONSOLE) {
112 /* Always send console messages to /dev/console so people will see them. */ 128 /* Always send console messages to /dev/console so people will see them. */
113 if ((fd = device_open(DEV_CONSOLE, O_WRONLY|O_NOCTTY|O_NDELAY)) >= 0) { 129 if ((fd = device_open(DEV_CONSOLE, O_WRONLY|O_NOCTTY|O_NDELAY)) >= 0) {
@@ -433,8 +449,9 @@ extern int init_main(int argc, char **argv)
433 const char* const shell_command[] = { SHELL, "-" SHELL, 0}; 449 const char* const shell_command[] = { SHELL, "-" SHELL, 0};
434 const char* const* tty0_command = shell_command; 450 const char* const* tty0_command = shell_command;
435 const char* const* tty1_command = shell_command; 451 const char* const* tty1_command = shell_command;
436#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS 452#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS
437 const char* const rc_exit_command[] = BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS; 453 const char* const rc_exit_command[] = { "BB_INIT_CMD_IF_RC_SCRIPT_EXITS",
454 "BB_INIT_CMD_IF_RC_SCRIPT_EXITS", 0 };
438#endif 455#endif
439 456
440#ifdef DEBUG_INIT 457#ifdef DEBUG_INIT
@@ -536,7 +553,7 @@ extern int init_main(int argc, char **argv)
536 if (run_rc == FALSE) { 553 if (run_rc == FALSE) {
537 pid1 = 0; 554 pid1 = 0;
538 } 555 }
539#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS 556#ifdef BB_INIT_CMD_IF_RC_SCRIPT_EXITS
540 else { 557 else {
541 pid1 = 0; 558 pid1 = 0;
542 run_rc=FALSE; 559 run_rc=FALSE;