From 371a3a2d058f3709baeeb0dbe18ae21ddb11ea90 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 22 Jun 2008 21:54:08 +0200
Subject: [PATCH] Define SA_RESTART also for mingw.

---
 ChangeLog       |  3 +++
 lib/sigaction.c | 14 +++++++++-----
 lib/signal.in.h |  1 +
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4ad9767ab..8eab917113 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-06-22  Bruno Haible  <bruno@clisp.org>
 
+	* lib/signal.in.h (SA_RESTART): New macro.
+	* lib/sigaction.c: Update comment.
+
 	* m4/sigaction.m4 (gl_SIGACTION): Require gl_SIGNAL_H_DEFAULTS.
 
 	* m4/signalblocking.m4 (gl_PREREQ_SIG_HANDLER_H): New macro.
diff --git a/lib/sigaction.c b/lib/sigaction.c
index 9b0c92fdae..1bad8092f2 100644
--- a/lib/sigaction.c
+++ b/lib/sigaction.c
@@ -35,11 +35,15 @@
    the situation by reading static storage in a signal handler, which
    POSIX warns is not generically async-signal-safe.  Oh well.
 
-   Additionally, SIGCHLD is not defined, so we don't implement
-   SA_NOCLDSTOP or SA_NOCLDWAIT; sigaltstack() is not present, so we
-   don't implement SA_ONSTACK; and siginterrupt() is not present, so
-   we don't implement SA_RESTART.  Supporting SA_SIGINFO is impossible
-   to do portably.
+   Additionally:
+     - We don't implement SA_NOCLDSTOP or SA_NOCLDWAIT, because SIGCHLD
+       is not defined.
+     - We don't implement SA_ONSTACK, because sigaltstack() is not present.
+     - We ignore SA_RESTART, because blocking Win32 calls are not interrupted
+       anyway when an asynchronous signal occurs, and the MSVCRT runtime
+       never sets errno to EINTR.
+     - We don't implement SA_SIGINFO because it is impossible to do so
+       portably.
 
    POSIX states that an application should not mix signal() and
    sigaction().  We support the use of signal() within the gnulib
diff --git a/lib/signal.in.h b/lib/signal.in.h
index f0551380cd..a1c9e6f6d3 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -142,6 +142,7 @@ struct sigaction
 /* Unsupported flags are not present.  */
 # define SA_RESETHAND 1
 # define SA_NODEFER 2
+# define SA_RESTART 4
 
 extern int sigaction (int, const struct sigaction *restrict,
                       struct sigaction *restrict);
-- 
2.30.2