/* Check if we have a signal or not */
int
-signal_exists(const struct pollfd *fd)
+signal_exists(int fd)
{
- if (signals[0] || (fd && fd->revents & POLLIN))
+ if (signals[0] || fd_hasdata(fd) == 1)
return 0;
return -1;
}
* no signal, -1 on error (and sets errno appropriately), and
* your signal on success */
int
-signal_read(struct pollfd *fd)
+signal_read(int fd)
{
int sig = -1;
unsigned int i = 0;
}
}
- if (fd && fd->revents & POLLIN) {
+ 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));
-
- /* We need to clear us from rset if nothing left in the buffer
- * in case we are called many times */
- if (bytes == sizeof(sig))
- fd->revents = 0;
}
-
return sig;
}
int signal_setup(void);
int signal_reset(void);
int signal_fd(void);
-int signal_exists(const struct pollfd *);
-int signal_read(struct pollfd *);
+int signal_exists(int fd);
+int signal_read(int fd);
#endif