mingw.h: add dummy functions for sigset_t operations

Windows does not have POSIX-like signals, and so we ignore all operations on the non-existent signal mask machinery. Do not turn sigemptyset into a function, but leave it a macro that erases the code in the argument because it is used to set sa_mask of a struct sigaction, but our dummy in mingw.h does not have that member. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Sep 22, 2014 at 20:24 UTC 4e6d207c45e6f5c13b38c4a200f0d3339f88ad34
2 files changed +8 -3
compat/mingw.h
+6 -1
@@ -69,7 +69,6 @@ struct sigaction {
69 sig_handler_t sa_handler;
70 unsigned sa_flags;
71 };
72 -#define sigemptyset(x) (void)0
72 #define SA_RESTART 0
73
74 struct itimerval {
@@ -116,6 +115,12 @@ static inline int fcntl(int fd, int cmd, ...)
115 }
116 /* bash cannot reliably detect negative return codes as failure */
117 #define exit(code) exit((code) & 0xff)
118 +#define sigemptyset(x) (void)0
119 +static inline int sigaddset(sigset_t *set, int signum)
120 +{ return 0; }
121 +#define SIG_UNBLOCK 0
122 +static inline int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
123 +{ return 0; }
124
125 /*
126 * simple adaptors
t/t0005-signals.sh
+2 -2
@@ -39,12 +39,12 @@ test_expect_success 'create blob' '
39 git add file
40 '
41
42 -test_expect_success 'a constipated git dies with SIGPIPE' '
42 +test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
43 OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 )
44 test "$OUT" -eq 141
45 '
46
47 -test_expect_success 'a constipated git dies with SIGPIPE even if parent ignores it' '
47 +test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
48 OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 )
49 test "$OUT" -eq 141
50 '