From e5b8f91cc6229a5f8b38f1338fad29c800fef179 Mon Sep 17 00:00:00 2001 From: Bruce Cran Date: Wed, 22 Feb 2012 19:56:22 +0000 Subject: [PATCH] Implement sigaction for Windows. Signed-off-by: Jens Axboe --- os/windows/posix.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/os/windows/posix.c b/os/windows/posix.c index ea3736d5..ba7abb54 100755 --- a/os/windows/posix.c +++ b/os/windows/posix.c @@ -124,8 +124,17 @@ void syslog(int priority, const char *message, ... /* argument */) int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { - errno = ENOSYS; - return (-1); + int rc = 0; + void (*prev_handler)(int); + + prev_handler = signal(sig, act->sa_handler); + if (oact != NULL) + oact->sa_handler = prev_handler; + + if (prev_handler == SIG_ERR) + rc = -1; + + return rc; } int lstat(const char * path, struct stat * buf) -- 2.25.1