Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-02-16 21:21:49 +0300
committerCorinna Vinschen <corinna@vinschen.de>2006-02-16 21:21:49 +0300
commitc6e48b1cd1b6d30aa485972411d78b8e308bd974 (patch)
tree7aabfc7aa17cf7d35bad297f56a28cf84283001e /winsup/cygwin/exceptions.cc
parentdf4f13b723bdd3b8b5912501b11a7854c08a58c7 (diff)
* cygwin.din: Export sigignore and sigset.
* exceptions.cc (sigset): New function. (sigignore): New function. * include/cygwin/signal.h (SIG_HOLD): Define. (sigignore): Declare. (sigset): Declare. * include/cygwin/version.h: Bump API minor number to 154.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 4162ebd6b..3f2c13c88 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1021,6 +1021,50 @@ sigrelse (int sig)
return 0;
}
+extern "C" _sig_func_ptr
+sigset (int sig, _sig_func_ptr func)
+{
+ sig_dispatch_pending ();
+ _sig_func_ptr prev;
+
+ /* check that sig is in right range */
+ if (sig < 0 || sig >= NSIG || sig == SIGKILL || sig == SIGSTOP)
+ {
+ set_errno (EINVAL);
+ syscall_printf ("SIG_ERR = sigset (%d, %p)", sig, func);
+ return (_sig_func_ptr) SIG_ERR;
+ }
+
+ mask_sync.acquire (INFINITE);
+ sigset_t mask = myself->getsigmask ();
+ /* If sig was in the signal mask return SIG_HOLD, otherwise return the
+ previous disposition. */
+ if (sigismember (&mask, sig))
+ prev = SIG_HOLD;
+ else
+ prev = global_sigs[sig].sa_handler;
+ /* If func is SIG_HOLD, add sig to the signal mask, otherwise set the
+ disposition to func and remove sig from the signal mask. */
+ if (func == SIG_HOLD)
+ sigaddset (&mask, sig);
+ else
+ {
+ /* No error checking. The test which could return SIG_ERR has already
+ been made above. */
+ signal (sig, func);
+ sigdelset (&mask, sig);
+ }
+ set_signal_mask (mask, myself->getsigmask ());
+ mask_sync.release ();
+ return prev;
+}
+
+extern "C" int
+sigignore (int sig)
+{
+ return sigset (sig, SIG_IGN) == SIG_ERR ? -1 : 0;
+}
+
/* Update the signal mask for this process and return the old mask.
Called from sigdelayed */
extern "C" sigset_t