From 4bdc9824a00f2a93ff6d75fae97b386938f648dc Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 10 Aug 2011 01:34:14 -0400 Subject: [PATCH] Added two missing files --- src/win32/sigaction/sigaction.cpp | 31 +++++++++++++++++++++++++++++++ src/win32/sigaction/sigaction.h | 25 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/win32/sigaction/sigaction.cpp create mode 100644 src/win32/sigaction/sigaction.h diff --git a/src/win32/sigaction/sigaction.cpp b/src/win32/sigaction/sigaction.cpp new file mode 100644 index 000000000..f65ffaa84 --- /dev/null +++ b/src/win32/sigaction/sigaction.cpp @@ -0,0 +1,31 @@ + /* POSIX emulation layer for Windows. + * + * Copyright (C) 2008-2011 Anope Team + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + + #include + #include "sigaction.h" + #include + + int sigaction(int sig, struct sigaction *action, struct sigaction *old) + { + if (sig == -1) + return 0; + if (old == NULL) + { + if (signal(sig, SIG_DFL) == SIG_ERR) + return -1; + } + else + { + if (signal(sig, action->sa_handler) == SIG_ERR) + return -1; + } + return 0; + } + \ No newline at end of file diff --git a/src/win32/sigaction/sigaction.h b/src/win32/sigaction/sigaction.h new file mode 100644 index 000000000..87fd17992 --- /dev/null +++ b/src/win32/sigaction/sigaction.h @@ -0,0 +1,25 @@ + /* POSIX emulation layer for Windows. + * + * Copyright (C) 2008-2011 Anope Team + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + + #define sigemptyset(x) memset((x), 0, sizeof(*(x))) + + #ifndef SIGHUP + # define SIGHUP -1 + #endif + + struct sigaction + { + void (*sa_handler)(int); + int sa_flags; + int sa_mask; + }; + + extern int sigaction(int, struct sigaction *, struct sigaction *); + \ No newline at end of file