aboutsummaryrefslogtreecommitdiff
path: root/sysklogd
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-07 13:43:28 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-07 13:43:28 +0000
commit87f3b26b3a17369c12f4f9a70d6845796f8648d6 (patch)
tree2f7fe9fc910d5e97f695c902f848db497fec8bfd /sysklogd
parent40f0bcf9d3f8f8a8d14a9b2cff51761019c75cf4 (diff)
downloadbusybox-87f3b26b3a17369c12f4f9a70d6845796f8648d6.tar.gz
*: replace select-for-one descriptor with poll, it's smaller.
$ ./.cmk bloatcheck function old new delta readit 406 364 -42 syslogd_main 1249 1206 -43 traceroute_main 4115 4060 -55 mysleep 112 45 -67 arpping 579 441 -138 tftp 1575 1182 -393 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-738) Total: -738 bytes text data bss dec hex filename 770580 1051 10764 782395 bf03b busybox_old 769820 1051 10764 781635 bed43 busybox_unstripped
Diffstat (limited to 'sysklogd')
-rw-r--r--sysklogd/syslogd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 5b153f509..ae3f1a2eb 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -471,8 +471,8 @@ static void do_syslogd(void) ATTRIBUTE_NORETURN;
static void do_syslogd(void)
{
struct sockaddr_un sunx;
- int sock_fd;
- fd_set fds;
+ struct pollfd pfd[1];
+#define sock_fd (pfd[0].fd)
char *dev_log_name;
/* Set up signal handlers */
@@ -526,20 +526,20 @@ static void do_syslogd(void)
(char*)"syslogd started: BusyBox v" BB_VER, 0);
for (;;) {
- FD_ZERO(&fds);
- FD_SET(sock_fd, &fds);
-
- if (select(sock_fd + 1, &fds, NULL, NULL, NULL) < 0) {
+ /*pfd[0].fd = sock_fd;*/
+ pfd[0].events = POLLIN;
+ pfd[0].revents = 0;
+ if (poll(pfd, 1, -1) < 0) { /* -1: no timeout */
if (errno == EINTR) {
/* alarm may have happened */
continue;
}
- bb_perror_msg_and_die("select");
+ bb_perror_msg_and_die("poll");
}
- if (FD_ISSET(sock_fd, &fds)) {
+ if (pfd[0].revents) {
int i;
- i = recv(sock_fd, G.recvbuf, MAX_READ - 1, 0);
+ i = read(sock_fd, G.recvbuf, MAX_READ - 1);
if (i <= 0)
bb_perror_msg_and_die("UNIX socket error");
/* TODO: maybe suppress duplicates? */
@@ -559,7 +559,7 @@ static void do_syslogd(void)
#endif
G.recvbuf[i] = '\0';
split_escape_and_log(G.recvbuf, i);
- } /* FD_ISSET() */
+ }
} /* for */
}