aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-12 19:51:09 +0000
committermarkw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-12 19:51:09 +0000
commitbc6cd646366bc1ffb285366b1781f779f2892fdc (patch)
treef49e78ff8f1f2d1ddf4828e75b2d5053ea677620
parent2ebd480fe2bda59f14b6bbfdd98943eb1b999e01 (diff)
downloadbusybox-w32-bc6cd646366bc1ffb285366b1781f779f2892fdc.tar.gz
busybox-w32-bc6cd646366bc1ffb285366b1781f779f2892fdc.tar.bz2
busybox-w32-bc6cd646366bc1ffb285366b1781f779f2892fdc.zip
Applied patch from Gennady Feldman to use single-thread instead of forking.
git-svn-id: svn://busybox.net/trunk/busybox@2045 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--sysklogd/syslogd.c32
-rw-r--r--syslogd.c32
2 files changed, 24 insertions, 40 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 8049fc5d1..1276201c3 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -362,32 +362,24 @@ static void doSyslogd (void)
362 --n_ready; 362 --n_ready;
363 363
364 if (fd == sock_fd) { 364 if (fd == sock_fd) {
365
366 int conn; 365 int conn;
367 pid_t pid;
368 366
367 //printf("New Connection request.\n");
369 if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) { 368 if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
370 perror_msg_and_die ("accept error"); 369 perror_msg_and_die ("accept error");
371 } 370 }
372 371
373 pid = fork(); 372 FD_SET(conn, &fds);
374 373 //printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
375 if (pid < 0) { 374 } else {
376 perror ("syslogd: fork"); 375 //printf("Serving connection: %i\n",fd);
377 close (conn); 376 serveConnection (fd);
378 continue; 377 close (fd);
379 } 378 FD_CLR(fd, &fds);
380 379 } /* fd == sock_fd */
381 if (pid == 0) { 380 }/* FD_ISSET() */
382 serveConnection (conn); 381 }/* for */
383 close (conn); 382 } /* for main loop */
384 exit( TRUE);
385 }
386 close (conn);
387 }
388 }
389 }
390 }
391} 383}
392 384
393#ifdef BB_FEATURE_KLOGD 385#ifdef BB_FEATURE_KLOGD
diff --git a/syslogd.c b/syslogd.c
index 8049fc5d1..1276201c3 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -362,32 +362,24 @@ static void doSyslogd (void)
362 --n_ready; 362 --n_ready;
363 363
364 if (fd == sock_fd) { 364 if (fd == sock_fd) {
365
366 int conn; 365 int conn;
367 pid_t pid;
368 366
367 //printf("New Connection request.\n");
369 if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) { 368 if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
370 perror_msg_and_die ("accept error"); 369 perror_msg_and_die ("accept error");
371 } 370 }
372 371
373 pid = fork(); 372 FD_SET(conn, &fds);
374 373 //printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE);
375 if (pid < 0) { 374 } else {
376 perror ("syslogd: fork"); 375 //printf("Serving connection: %i\n",fd);
377 close (conn); 376 serveConnection (fd);
378 continue; 377 close (fd);
379 } 378 FD_CLR(fd, &fds);
380 379 } /* fd == sock_fd */
381 if (pid == 0) { 380 }/* FD_ISSET() */
382 serveConnection (conn); 381 }/* for */
383 close (conn); 382 } /* for main loop */
384 exit( TRUE);
385 }
386 close (conn);
387 }
388 }
389 }
390 }
391} 383}
392 384
393#ifdef BB_FEATURE_KLOGD 385#ifdef BB_FEATURE_KLOGD