summaryrefslogtreecommitdiffstats
path: root/signals.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-07-24 15:09:33 +0000
committerRoy Marples <roy@marples.name>2008-07-24 15:09:33 +0000
commit318fbafe9e81b35ec47014418c05360448046e0b (patch)
tree5398a6401c8c4300584a15265adaed7669a22208 /signals.c
parent5fa0b31f1008b99c38637cbcccf8233b76e78b9b (diff)
downloaddhcpcd-318fbafe9e81b35ec47014418c05360448046e0b.tar.xz
Normalise tv_usecs. Also, send the fd ready back to the main loop so we don't have to re-poll each fd. Saves bytes and is more efficient.
Diffstat (limited to 'signals.c')
-rw-r--r--signals.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/signals.c b/signals.c
index fb986d7d..599bec16 100644
--- a/signals.c
+++ b/signals.c
@@ -62,31 +62,20 @@ signal_fd(void)
return (signal_pipe[0]);
}
-/* Check if we have a signal or not */
-int
-signal_exists(int fd)
-{
- if (fd_hasdata(fd) == 1)
- return 0;
- return -1;
-}
-
/* 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
-signal_read(int fd)
+signal_read(void)
{
int sig = -1;
char buf[16];
size_t bytes;
- if (fd_hasdata(fd) == 1) {
- memset(buf, 0, sizeof(buf));
- bytes = read(signal_pipe[0], buf, sizeof(buf));
- if (bytes >= sizeof(sig))
- memcpy(&sig, buf, sizeof(sig));
- }
+ memset(buf, 0, sizeof(buf));
+ bytes = read(signal_pipe[0], buf, sizeof(buf));
+ if (bytes >= sizeof(sig))
+ memcpy(&sig, buf, sizeof(sig));
return sig;
}