diff options
author | Mark Whitley | 2001-03-12 19:51:09 +0000 |
---|---|---|
committer | Mark Whitley | 2001-03-12 19:51:09 +0000 |
commit | 1a49fc5e92e2b6478f46b0e22edd6079b75dc30e (patch) | |
tree | f49e78ff8f1f2d1ddf4828e75b2d5053ea677620 /sysklogd/syslogd.c | |
parent | fe4e13fb972aef69e1d041b726ebecdf000e91ee (diff) | |
download | busybox-1a49fc5e92e2b6478f46b0e22edd6079b75dc30e.zip busybox-1a49fc5e92e2b6478f46b0e22edd6079b75dc30e.tar.gz |
Applied patch from Gennady Feldman to use single-thread instead of forking.
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r-- | sysklogd/syslogd.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 8049fc5..1276201 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -362,32 +362,24 @@ static void doSyslogd (void) --n_ready; if (fd == sock_fd) { - int conn; - pid_t pid; + //printf("New Connection request.\n"); if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) { perror_msg_and_die ("accept error"); } - pid = fork(); - - if (pid < 0) { - perror ("syslogd: fork"); - close (conn); - continue; - } - - if (pid == 0) { - serveConnection (conn); - close (conn); - exit( TRUE); - } - close (conn); - } - } - } - } + FD_SET(conn, &fds); + //printf("conn: %i, set_size: %i\n",conn,FD_SETSIZE); + } else { + //printf("Serving connection: %i\n",fd); + serveConnection (fd); + close (fd); + FD_CLR(fd, &fds); + } /* fd == sock_fd */ + }/* FD_ISSET() */ + }/* for */ + } /* for main loop */ } #ifdef BB_FEATURE_KLOGD |