aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/signalpipe.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-02-16 23:25:44 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-02-16 23:25:44 +0100
commit52a515d18724bbb34e3ccbbb0218efcc4eccc0a8 (patch)
tree16a5a05a328d7e0bd2b4b1bfbcaf543cf8a36d33 /networking/udhcp/signalpipe.c
parentdc207f669675a271812a21b0ddbe3b894adf8e4c (diff)
downloadbusybox-52a515d18724bbb34e3ccbbb0218efcc4eccc0a8.tar.gz
udhcp: use poll() instead of select()
function old new delta udhcp_sp_read 65 46 -19 udhcp_sp_fd_set 79 54 -25 udhcpd_main 1530 1482 -48 udhcpc_main 2780 2730 -50 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-142) Total: -142 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/signalpipe.c')
-rw-r--r--networking/udhcp/signalpipe.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c
index 30bccd6bf..b101b4ce4 100644
--- a/networking/udhcp/signalpipe.c
+++ b/networking/udhcp/signalpipe.c
@@ -48,28 +48,29 @@ void FAST_FUNC udhcp_sp_setup(void)
, signal_handler);
}
-/* Quick little function to setup the rfds. Will return the
- * max_fd for use with select. Limited in that you can only pass
- * one extra fd */
-int FAST_FUNC udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
+/* Quick little function to setup the pfds.
+ * Limited in that you can only pass one extra fd.
+ */
+void FAST_FUNC udhcp_sp_fd_set(struct pollfd pfds[2], int extra_fd)
{
- FD_ZERO(rfds);
- FD_SET(signal_pipe.rd, rfds);
+ pfds[0].fd = signal_pipe.rd;
+ pfds[0].events = POLLIN;
+ pfds[1].fd = -1;
if (extra_fd >= 0) {
close_on_exec_on(extra_fd);
- FD_SET(extra_fd, rfds);
+ pfds[1].fd = extra_fd;
+ pfds[1].events = POLLIN;
}
- return signal_pipe.rd > extra_fd ? signal_pipe.rd : extra_fd;
}
/* Read a signal from the signal pipe. Returns 0 if there is
* no signal, -1 on error (and sets errno appropriately), and
* your signal on success */
-int FAST_FUNC udhcp_sp_read(const fd_set *rfds)
+int FAST_FUNC udhcp_sp_read(struct pollfd pfds[2])
{
unsigned char sig;
- if (!FD_ISSET(signal_pipe.rd, rfds))
+ if (!pfds[0].revents)
return 0;
if (safe_read(signal_pipe.rd, &sig, 1) != 1)