New siginfo member in uev_t for signal watchers

This patch adds support for exporting the signalfd_siginfo struct read
from the signal fd descriptor on signals.  This allows watcher callbacks
to, e.g., figure out who sent a signal.  See signalfd(2) for details on
struct signalfd_siginfo.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-05-18 09:57:57 +02:00
1 parent bfd8454a92
commit e20d37228d
4 files changed
+14 -2

No files matched your search

+1
View File
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <sys/epoll.h>
#include <sys/signalfd.h>
/*
* List functions.
+3 -1
View File
@@ -369,7 +369,9 @@ int uev_run(uev_ctx_t *ctx, int flags)
uev_signal_stop(w);
events = UEV_ERROR;
}
}
memset(&w->siginfo, 0, sizeof(w->siginfo));
} else
w->siginfo = fdsi;
break;
case UEV_TIMER_TYPE:
+3
View File
@@ -61,6 +61,9 @@ typedef struct uev {
int signo;
int fd;
uev_ctx_t *ctx;
/* Extra data for certain watcher types */
struct signalfd_siginfo siginfo;
} uev_t;
/*