aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-09-17 20:06:29 +0000
committerEric Andersen <andersen@codepoet.org>2002-09-17 20:06:29 +0000
commit871d93c4620953a4ef19fc9df4865b0e351cd455 (patch)
tree1e04813a254c4bd35ea4d8eb09866af0d3679343
parent927c3bdc18eda39f36d05241a95987cc586289e2 (diff)
downloadbusybox-w32-871d93c4620953a4ef19fc9df4865b0e351cd455.tar.gz
busybox-w32-871d93c4620953a4ef19fc9df4865b0e351cd455.tar.bz2
busybox-w32-871d93c4620953a4ef19fc9df4865b0e351cd455.zip
Vodz' last_patch57:
Ok. Patch with reduce size ready. Notes: syslogd imposible close logsocket, the real programm write logmessages (hmm, cycle loop?) (Excuse me - this have small tab-formats rewroting also) text data bss dec hex filename 2913 332 12388 15633 3d11 syslogd.o 3109 332 9252 12693 3195 syslogd_old.o
-rw-r--r--sysklogd/syslogd.c197
1 files changed, 93 insertions, 104 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index f0a7f1a84..1b5a209aa 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -55,7 +55,7 @@
55#define __LOG_FILE "/var/log/messages" 55#define __LOG_FILE "/var/log/messages"
56 56
57/* Path to the unix socket */ 57/* Path to the unix socket */
58static char lfile[BUFSIZ]; 58static char lfile[MAXPATHLEN];
59 59
60static char *logFilePath = __LOG_FILE; 60static char *logFilePath = __LOG_FILE;
61 61
@@ -63,7 +63,7 @@ static char *logFilePath = __LOG_FILE;
63static int MarkInterval = 20 * 60; 63static int MarkInterval = 20 * 60;
64 64
65/* localhost's name */ 65/* localhost's name */
66static char LocalHostName[32]; 66static char LocalHostName[64];
67 67
68#ifdef CONFIG_FEATURE_REMOTE_LOG 68#ifdef CONFIG_FEATURE_REMOTE_LOG
69#include <netinet/in.h> 69#include <netinet/in.h>
@@ -78,9 +78,12 @@ static int doRemoteLog = FALSE;
78static int local_logging = FALSE; 78static int local_logging = FALSE;
79#endif 79#endif
80 80
81
82#define MAXLINE 1024 /* maximum line length */
83
84
81/* circular buffer variables/structures */ 85/* circular buffer variables/structures */
82#ifdef CONFIG_FEATURE_IPC_SYSLOG 86#ifdef CONFIG_FEATURE_IPC_SYSLOG
83
84#if __GNU_LIBRARY__ < 5 87#if __GNU_LIBRARY__ < 5
85#error Sorry. Looks like you are using libc5. 88#error Sorry. Looks like you are using libc5.
86#error libc5 shm support isnt good enough. 89#error libc5 shm support isnt good enough.
@@ -96,19 +99,19 @@ static const long KEY_ID = 0x414e4547; /*"GENA"*/
96 99
97// Semaphore operation structures 100// Semaphore operation structures
98static struct shbuf_ds { 101static struct shbuf_ds {
99 int size; // size of data written 102 int size; // size of data written
100 int head; // start of message list 103 int head; // start of message list
101 int tail; // end of message list 104 int tail; // end of message list
102 char data[1]; // data/messages 105 char data[1]; // data/messages
103} *buf = NULL; // shared memory pointer 106} *buf = NULL; // shared memory pointer
104 107
105static struct sembuf SMwup[1] = {{1, -1, IPC_NOWAIT}}; // set SMwup 108static struct sembuf SMwup[1] = {{1, -1, IPC_NOWAIT}}; // set SMwup
106static struct sembuf SMwdn[3] = {{0, 0}, {1, 0}, {1, +1}}; // set SMwdn 109static struct sembuf SMwdn[3] = {{0, 0}, {1, 0}, {1, +1}}; // set SMwdn
107 110
108static int shmid = -1; // ipc shared memory id 111static int shmid = -1; // ipc shared memory id
109static int s_semid = -1; // ipc semaphore id 112static int s_semid = -1; // ipc semaphore id
110int data_size = 16000; // data size 113int data_size = 16000; // data size
111int shm_size = 16000 + sizeof(*buf); // our buffer size 114int shm_size = 16000 + sizeof(*buf); // our buffer size
112static int circular_logging = FALSE; 115static int circular_logging = FALSE;
113 116
114/* 117/*
@@ -129,6 +132,7 @@ static inline void sem_down(int semid)
129 perror_msg_and_die("semop[SMwdn]"); 132 perror_msg_and_die("semop[SMwdn]");
130} 133}
131 134
135
132void ipcsyslog_cleanup(void){ 136void ipcsyslog_cleanup(void){
133 printf("Exiting Syslogd!\n"); 137 printf("Exiting Syslogd!\n");
134 if (shmid != -1) 138 if (shmid != -1)
@@ -143,11 +147,11 @@ void ipcsyslog_cleanup(void){
143void ipcsyslog_init(void){ 147void ipcsyslog_init(void){
144 if (buf == NULL){ 148 if (buf == NULL){
145 if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1) 149 if ((shmid = shmget(KEY_ID, shm_size, IPC_CREAT | 1023)) == -1)
146 perror_msg_and_die("shmget"); 150 perror_msg_and_die("shmget");
147 151
148 152
149 if ((buf = shmat(shmid, NULL, 0)) == NULL) 153 if ((buf = shmat(shmid, NULL, 0)) == NULL)
150 perror_msg_and_die("shmat"); 154 perror_msg_and_die("shmat");
151 155
152 156
153 buf->size=data_size; 157 buf->size=data_size;
@@ -155,11 +159,11 @@ void ipcsyslog_init(void){
155 159
156 // we'll trust the OS to set initial semval to 0 (let's hope) 160 // we'll trust the OS to set initial semval to 0 (let's hope)
157 if ((s_semid = semget(KEY_ID, 2, IPC_CREAT | IPC_EXCL | 1023)) == -1){ 161 if ((s_semid = semget(KEY_ID, 2, IPC_CREAT | IPC_EXCL | 1023)) == -1){
158 if (errno == EEXIST){ 162 if (errno == EEXIST){
159 if ((s_semid = semget(KEY_ID, 2, 0)) == -1) 163 if ((s_semid = semget(KEY_ID, 2, 0)) == -1)
160 perror_msg_and_die("semget"); 164 perror_msg_and_die("semget");
161 }else 165 }else
162 perror_msg_and_die("semget"); 166 perror_msg_and_die("semget");
163 } 167 }
164 }else{ 168 }else{
165 printf("Buffer already allocated just grab the semaphore?"); 169 printf("Buffer already allocated just grab the semaphore?");
@@ -184,16 +188,16 @@ void circ_message(const char *msg){
184 * insert the new message. (Note: if the message being added is >1 message then 188 * insert the new message. (Note: if the message being added is >1 message then
185 * we will need to "remove" >1 old message from the buffer). The way this is done 189 * we will need to "remove" >1 old message from the buffer). The way this is done
186 * is the following: 190 * is the following:
187 * When we reach the end of the buffer we set a mark and start from the beginning. 191 * When we reach the end of the buffer we set a mark and start from the beginning.
188 * Now what about the beginning and end of the buffer? Well we have the "head" 192 * Now what about the beginning and end of the buffer? Well we have the "head"
189 * index/pointer which is the starting point for the messages and we have "tail" 193 * index/pointer which is the starting point for the messages and we have "tail"
190 * index/pointer which is the ending point for the messages. When we "display" the 194 * index/pointer which is the ending point for the messages. When we "display" the
191 * messages we start from the beginning and continue until we reach "tail". If we 195 * messages we start from the beginning and continue until we reach "tail". If we
192 * reach end of buffer, then we just start from the beginning (offset 0). "head" and 196 * reach end of buffer, then we just start from the beginning (offset 0). "head" and
193 * "tail" are actually offsets from the beginning of the buffer. 197 * "tail" are actually offsets from the beginning of the buffer.
194 * 198 *
195 * Note: This algorithm uses Linux IPC mechanism w/ shared memory and semaphores to provide 199 * Note: This algorithm uses Linux IPC mechanism w/ shared memory and semaphores to provide
196 * a threasafe way of handling shared memory operations. 200 * a threasafe way of handling shared memory operations.
197 */ 201 */
198 if ( (buf->tail + l) < buf->size ){ 202 if ( (buf->tail + l) < buf->size ){
199 /* before we append the message we need to check the HEAD so that we won't 203 /* before we append the message we need to check the HEAD so that we won't
@@ -207,19 +211,19 @@ void circ_message(const char *msg){
207 * to worry about overflows here! 211 * to worry about overflows here!
208 */ 212 */
209 int k= buf->tail + l - buf->head; /* we need to know how many bytes 213 int k= buf->tail + l - buf->head; /* we need to know how many bytes
210 we are overwriting to make 214 we are overwriting to make
211 enough room */ 215 enough room */
212 char *c=memchr(buf->data+buf->head + k,'\0',buf->size - (buf->head + k)); 216 char *c=memchr(buf->data+buf->head + k,'\0',buf->size - (buf->head + k));
213 if (c != NULL) {/* do a sanity check just in case! */ 217 if (c != NULL) {/* do a sanity check just in case! */
214 buf->head = c - buf->data + 1; /* we need to convert pointer to 218 buf->head = c - buf->data + 1; /* we need to convert pointer to
215 offset + skip the '\0' since 219 offset + skip the '\0' since
216 we need to point to the beginning 220 we need to point to the beginning
217 of the next message */ 221 of the next message */
218 /* Note: HEAD is only used to "retrieve" messages, it's not used 222 /* Note: HEAD is only used to "retrieve" messages, it's not used
219 when writing messages into our buffer */ 223 when writing messages into our buffer */
220 }else{ /* show an error message to know we messed up? */ 224 }else{ /* show an error message to know we messed up? */
221 printf("Weird! Can't find the terminator token??? \n"); 225 printf("Weird! Can't find the terminator token??? \n");
222 buf->head=0; 226 buf->head=0;
223 } 227 }
224 } 228 }
225 } /* in other cases no overflows have been done yet, so we don't care! */ 229 } /* in other cases no overflows have been done yet, so we don't care! */
@@ -231,22 +235,22 @@ void circ_message(const char *msg){
231 /* we need to break up the message and "circle" it around */ 235 /* we need to break up the message and "circle" it around */
232 char *c; 236 char *c;
233 int k=buf->tail + l - buf->size; /* count # of bytes we don't fit */ 237 int k=buf->tail + l - buf->size; /* count # of bytes we don't fit */
234 238
235 /* We need to move HEAD! This is always the case since we are going 239 /* We need to move HEAD! This is always the case since we are going
236 * to "circle" the message. 240 * to "circle" the message.
237 */ 241 */
238 c=memchr(buf->data + k ,'\0', buf->size - k); 242 c=memchr(buf->data + k ,'\0', buf->size - k);
239 243
240 if (c != NULL) /* if we don't have '\0'??? weird!!! */{ 244 if (c != NULL) /* if we don't have '\0'??? weird!!! */{
241 /* move head pointer*/ 245 /* move head pointer*/
242 buf->head=c-buf->data+1; 246 buf->head=c-buf->data+1;
243 247
244 /* now write the first part of the message */ 248 /* now write the first part of the message */
245 strncpy(buf->data + buf->tail, msg, l - k - 1); 249 strncpy(buf->data + buf->tail, msg, l - k - 1);
246 250
247 /* ALWAYS terminate end of buffer w/ '\0' */ 251 /* ALWAYS terminate end of buffer w/ '\0' */
248 buf->data[buf->size-1]='\0'; 252 buf->data[buf->size-1]='\0';
249 253
250 /* now write out the rest of the string to the beginning of the buffer */ 254 /* now write out the rest of the string to the beginning of the buffer */
251 strcpy(buf->data, &msg[l-k-1]); 255 strcpy(buf->data, &msg[l-k-1]);
252 256
@@ -256,11 +260,12 @@ void circ_message(const char *msg){
256 printf("Weird! Can't find the terminator token from the beginning??? \n"); 260 printf("Weird! Can't find the terminator token from the beginning??? \n");
257 buf->head = buf->tail = 0; /* reset buffer, since it's probably corrupted */ 261 buf->head = buf->tail = 0; /* reset buffer, since it's probably corrupted */
258 } 262 }
259 263
260 } 264 }
261 sem_up(s_semid); 265 sem_up(s_semid);
262} 266}
263#endif 267#endif /* CONFIG_FEATURE_IPC_SYSLOG */
268
264/* Note: There is also a function called "message()" in init.c */ 269/* Note: There is also a function called "message()" in init.c */
265/* Print a message to the log file. */ 270/* Print a message to the log file. */
266static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2))); 271static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
@@ -275,10 +280,10 @@ static void message (char *fmt, ...)
275 fl.l_len = 1; 280 fl.l_len = 1;
276 281
277#ifdef CONFIG_FEATURE_IPC_SYSLOG 282#ifdef CONFIG_FEATURE_IPC_SYSLOG
278 if ((circular_logging) && (buf != NULL)){ 283 if ((circular_logging == TRUE) && (buf != NULL)){
279 char b[1024]; 284 char b[1024];
280 va_start (arguments, fmt); 285 va_start (arguments, fmt);
281 vsprintf (b, fmt, arguments); 286 vsnprintf (b, sizeof(b)-1, fmt, arguments);
282 va_end (arguments); 287 va_end (arguments);
283 circ_message(b); 288 circ_message(b);
284 289
@@ -354,20 +359,19 @@ static const int IOV_COUNT = 2;
354 memset(&res, 0, sizeof(res)); 359 memset(&res, 0, sizeof(res));
355 snprintf(res, sizeof(res), "<%d>", pri); 360 snprintf(res, sizeof(res), "<%d>", pri);
356 v->iov_base = res ; 361 v->iov_base = res ;
357 v->iov_len = strlen(res); 362 v->iov_len = strlen(res);
358 v++; 363 v++;
359 364
360 v->iov_base = msg; 365 v->iov_base = msg;
361 v->iov_len = strlen(msg); 366 v->iov_len = strlen(msg);
362
363writev_retry: 367writev_retry:
364 if ( -1 == writev(remotefd,iov, IOV_COUNT)){ 368 if ( -1 == writev(remotefd,iov, IOV_COUNT)){
365 if (errno == EINTR) goto writev_retry; 369 if (errno == EINTR) goto writev_retry;
366 error_msg_and_die("syslogd: cannot write to remote file handle on" 370 error_msg_and_die("cannot write to remote file handle on"
367 "%s:%d",RemoteHost,RemotePort); 371 "%s:%d",RemoteHost,RemotePort);
368 } 372 }
369 } 373 }
370 if (local_logging) 374 if (local_logging == TRUE)
371#endif 375#endif
372 /* now spew out the message to wherever it is supposed to go */ 376 /* now spew out the message to wherever it is supposed to go */
373 message("%s %s %s %s\n", timestamp, LocalHostName, res, msg); 377 message("%s %s %s %s\n", timestamp, LocalHostName, res, msg);
@@ -396,7 +400,6 @@ static void domark(int sig)
396 400
397/* This must be a #define, since when DODEBUG and BUFFERS_GO_IN_BSS are 401/* This must be a #define, since when DODEBUG and BUFFERS_GO_IN_BSS are
398 * enabled, we otherwise get a "storage size isn't constant error. */ 402 * enabled, we otherwise get a "storage size isn't constant error. */
399#define BUFSIZE 1023
400static int serveConnection (char* tmpbuf, int n_read) 403static int serveConnection (char* tmpbuf, int n_read)
401{ 404{
402 char *p = tmpbuf; 405 char *p = tmpbuf;
@@ -404,16 +407,14 @@ static int serveConnection (char* tmpbuf, int n_read)
404 while (p < tmpbuf + n_read) { 407 while (p < tmpbuf + n_read) {
405 408
406 int pri = (LOG_USER | LOG_NOTICE); 409 int pri = (LOG_USER | LOG_NOTICE);
407 char line[ BUFSIZE + 1 ]; 410 char line[ MAXLINE + 1 ];
408 unsigned char c; 411 unsigned char c;
409 int gotpri = 0;
410 412
411 char *q = line; 413 char *q = line;
412 414
413 while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) { 415 while ( (c = *p) && q < &line[ sizeof (line) - 1 ]) {
414 if ((c == '<') && !gotpri && isdigit(p[1])) { 416 if (c == '<') {
415 /* Parse the magic priority number. */ 417 /* Parse the magic priority number. */
416 gotpri = 1;
417 pri = 0; 418 pri = 0;
418 while (isdigit (*(++p))) { 419 while (isdigit (*(++p))) {
419 pri = 10 * pri + (*p - '0'); 420 pri = 10 * pri + (*p - '0');
@@ -441,7 +442,8 @@ static int serveConnection (char* tmpbuf, int n_read)
441 442
442 443
443#ifdef CONFIG_FEATURE_REMOTE_LOG 444#ifdef CONFIG_FEATURE_REMOTE_LOG
444static void init_RemoteLog (void){ 445static void init_RemoteLog (void)
446{
445 447
446 struct sockaddr_in remoteaddr; 448 struct sockaddr_in remoteaddr;
447 struct hostent *hostinfo; 449 struct hostent *hostinfo;
@@ -452,7 +454,7 @@ static void init_RemoteLog (void){
452 remotefd = socket(AF_INET, SOCK_DGRAM, 0); 454 remotefd = socket(AF_INET, SOCK_DGRAM, 0);
453 455
454 if (remotefd < 0) { 456 if (remotefd < 0) {
455 error_msg_and_die("syslogd: cannot create socket"); 457 error_msg_and_die("cannot create socket");
456 } 458 }
457 459
458 hostinfo = xgethostbyname(RemoteHost); 460 hostinfo = xgethostbyname(RemoteHost);
@@ -461,26 +463,23 @@ static void init_RemoteLog (void){
461 remoteaddr.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; 463 remoteaddr.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
462 remoteaddr.sin_port = htons(RemotePort); 464 remoteaddr.sin_port = htons(RemotePort);
463 465
464 /* 466 /*
465 Since we are using UDP sockets, connect just sets the default host and port 467 Since we are using UDP sockets, connect just sets the default host and port
466 for future operations 468 for future operations
467 */ 469 */
468 if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ 470 if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){
469 error_msg_and_die("syslogd: cannot connect to remote host %s:%d", RemoteHost, RemotePort); 471 error_msg_and_die("cannot connect to remote host %s:%d", RemoteHost, RemotePort);
470 } 472 }
471 473
472} 474}
473#endif 475#endif
474 476
475#define MAXLINE 1024 /* maximum line length */
476
477static void doSyslogd (void) __attribute__ ((noreturn)); 477static void doSyslogd (void) __attribute__ ((noreturn));
478static void doSyslogd (void) 478static void doSyslogd (void)
479{ 479{
480 struct sockaddr_un sunx; 480 struct sockaddr_un sunx;
481 socklen_t addrLength; 481 socklen_t addrLength;
482 482
483
484 int sock_fd; 483 int sock_fd;
485 fd_set fds; 484 fd_set fds;
486 485
@@ -507,71 +506,61 @@ static void doSyslogd (void)
507 perror_msg_and_die ("Couldn't get file descriptor for socket " _PATH_LOG); 506 perror_msg_and_die ("Couldn't get file descriptor for socket " _PATH_LOG);
508 507
509 addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path); 508 addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
510 if (bind (sock_fd, (struct sockaddr *) &sunx, addrLength) < 0) 509 if (bind(sock_fd, (struct sockaddr *) &sunx, addrLength) < 0)
511 perror_msg_and_die ("Could not connect to socket " _PATH_LOG); 510 perror_msg_and_die ("Could not connect to socket " _PATH_LOG);
512 511
513 if (chmod (lfile, 0666) < 0) 512 if (chmod (lfile, 0666) < 0)
514 perror_msg_and_die ("Could not set permission on " _PATH_LOG); 513 perror_msg_and_die ("Could not set permission on " _PATH_LOG);
515 514
516 FD_ZERO (&fds);
517 FD_SET (sock_fd, &fds);
518 515
519#ifdef CONFIG_FEATURE_IPC_SYSLOG 516#ifdef CONFIG_FEATURE_IPC_SYSLOG
520 if (circular_logging ){ 517 if (circular_logging == TRUE ){
521 ipcsyslog_init(); 518 ipcsyslog_init();
522 } 519 }
523#endif 520#endif
524 521
525 #ifdef CONFIG_FEATURE_REMOTE_LOG 522#ifdef CONFIG_FEATURE_REMOTE_LOG
526 if (doRemoteLog){ 523 if (doRemoteLog == TRUE){
527 init_RemoteLog(); 524 init_RemoteLog();
528 } 525 }
529 #endif 526#endif
530 527
531 logMessage (LOG_SYSLOG | LOG_INFO, "syslogd started: " BB_BANNER); 528 logMessage (LOG_SYSLOG | LOG_INFO, "syslogd started: " CONFIG_BANNER);
532 529
533 for (;;) { 530 for (;;) {
534 531
535 fd_set readfds; 532 FD_ZERO (&fds);
536 int n_ready; 533 FD_SET (sock_fd, &fds);
537 int fd;
538
539 memcpy (&readfds, &fds, sizeof (fds));
540 534
541 if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) { 535 if (select (sock_fd+1, &fds, NULL, NULL, NULL) < 0) {
542 if (errno == EINTR) continue; /* alarm may have happened. */ 536 if (errno == EINTR) {
537 /* alarm may have happened. */
538 continue;
539 }
543 perror_msg_and_die ("select error"); 540 perror_msg_and_die ("select error");
544 } 541 }
545 542
546 for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) { 543 if (FD_ISSET (sock_fd, &fds)) {
547 if (FD_ISSET (fd, &readfds)) { 544 int i;
548 545 RESERVE_CONFIG_BUFFER(tmpbuf, BUFSIZ + 1);
549 --n_ready; 546
550 547 memset(tmpbuf, '\0', BUFSIZ+1);
551 if (fd == sock_fd) { 548 if ( (i = recv(sock_fd, tmpbuf, BUFSIZ, 0)) > 0) {
552 int i; 549 serveConnection(tmpbuf, i);
553 RESERVE_CONFIG_BUFFER(tmpbuf, BUFSIZE + 1); 550 } else {
554 551 perror_msg_and_die ("UNIX socket error");
555 memset(tmpbuf, '\0', BUFSIZE+1); 552 }
556 if ( (i = recv(fd, tmpbuf, MAXLINE - 2, 0)) > 0) { 553 RELEASE_CONFIG_BUFFER (tmpbuf);
557 if ( serveConnection(tmpbuf, i) <= 0 ) { 554 }/* FD_ISSET() */
558 close (fd);
559 FD_CLR(fd, &fds);
560 }
561 } else {
562 perror_msg_and_die ("UNIX socket error");
563 }
564 RELEASE_CONFIG_BUFFER (tmpbuf);
565 } /* fd == sock_fd */
566 }/* FD_ISSET() */
567 }/* for */
568 } /* for main loop */ 555 } /* for main loop */
569} 556}
570 557
571extern int syslogd_main(int argc, char **argv) 558extern int syslogd_main(int argc, char **argv)
572{ 559{
573 int opt; 560 int opt;
561#if ! defined(__uClinux__)
574 int doFork = TRUE; 562 int doFork = TRUE;
563#endif
575 564
576 char *p; 565 char *p;
577 566
@@ -581,9 +570,11 @@ extern int syslogd_main(int argc, char **argv)
581 case 'm': 570 case 'm':
582 MarkInterval = atoi(optarg) * 60; 571 MarkInterval = atoi(optarg) * 60;
583 break; 572 break;
573#if ! defined(__uClinux__)
584 case 'n': 574 case 'n':
585 doFork = FALSE; 575 doFork = FALSE;
586 break; 576 break;
577#endif
587 case 'O': 578 case 'O':
588 logFilePath = xstrdup(optarg); 579 logFilePath = xstrdup(optarg);
589 break; 580 break;
@@ -612,7 +603,7 @@ extern int syslogd_main(int argc, char **argv)
612 603
613#ifdef CONFIG_FEATURE_REMOTE_LOG 604#ifdef CONFIG_FEATURE_REMOTE_LOG
614 /* If they have not specified remote logging, then log locally */ 605 /* If they have not specified remote logging, then log locally */
615 if (! doRemoteLog) 606 if (doRemoteLog == FALSE)
616 local_logging = TRUE; 607 local_logging = TRUE;
617#endif 608#endif
618 609
@@ -625,14 +616,12 @@ extern int syslogd_main(int argc, char **argv)
625 616
626 umask(0); 617 umask(0);
627 618
628 if (doFork) { 619#if ! defined(__uClinux__)
629#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__) 620 if (doFork == TRUE) {
630 if (daemon(0, 1) < 0) 621 if (daemon(0, 1) < 0)
631 perror_msg_and_die("daemon"); 622 perror_msg_and_die("daemon");
632#else
633 error_msg_and_die("daemon not supported");
634#endif
635 } 623 }
624#endif
636 doSyslogd(); 625 doSyslogd();
637 626
638 return EXIT_SUCCESS; 627 return EXIT_SUCCESS;