1251875Speter/****************************************************************************
2251875Speter * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
3251875Speter *                                                                          *
4251875Speter * Permission is hereby granted, free of charge, to any person obtaining a  *
5251875Speter * copy of this software and associated documentation files (the            *
6251875Speter * "Software"), to deal in the Software without restriction, including      *
7251875Speter * without limitation the rights to use, copy, modify, merge, publish,      *
8251875Speter * distribute, distribute with modifications, sublicense, and/or sell       *
9251875Speter * copies of the Software, and to permit persons to whom the Software is    *
10251875Speter * furnished to do so, subject to the following conditions:                 *
11251875Speter *                                                                          *
12251875Speter * The above copyright notice and this permission notice shall be included  *
13251875Speter * in all copies or substantial portions of the Software.                   *
14251875Speter *                                                                          *
15251875Speter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16251875Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17251875Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18251875Speter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19251875Speter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20251875Speter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21251875Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22251875Speter *                                                                          *
23251875Speter * Except as contained in this notice, the name(s) of the above copyright   *
24251875Speter * holders shall not be used in advertising or otherwise to promote the     *
25251875Speter * sale, use or other dealings in this Software without prior written       *
26251875Speter * authorization.                                                           *
27251875Speter ****************************************************************************/
28251875Speter
29251875Speter/****************************************************************************
30251875Speter *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
31251875Speter *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
32251875Speter *     and: Thomas E. Dickey                        1996-2003               *
33251875Speter ****************************************************************************/
34251875Speter
35251875Speter/* This file provides sigaction() emulation using sigvec() */
36251875Speter/* Use only if this is non POSIX system */
37251875Speter
38251875SpeterMODULE_ID("$Id: sigaction.c,v 1.14 2003/12/07 01:06:52 tom Exp $")
39251875Speter
40251875Speterstatic int
41251875Speter_nc_sigaction(int sig, sigaction_t * sigact, sigaction_t * osigact)
42251875Speter{
43251875Speter    return sigvec(sig, sigact, osigact);
44251875Speter}
45251875Speter
46251875Speterstatic int
47251875Speter_nc_sigemptyset(sigset_t * mask)
48251875Speter{
49251875Speter    *mask = 0;
50251875Speter    return 0;
51251875Speter}
52251875Speter
53251875Speterstatic int
54251875Speter_nc_sigprocmask(int mode, sigset_t * mask, sigset_t * omask)
55251875Speter{
56251875Speter    sigset_t current = sigsetmask(0);
57251875Speter
58251875Speter    if (omask)
59251875Speter	*omask = current;
60251875Speter
61    if (mode == SIG_BLOCK)
62	current |= *mask;
63    else if (mode == SIG_UNBLOCK)
64	current &= ~*mask;
65    else if (mode == SIG_SETMASK)
66	current = *mask;
67
68    sigsetmask(current);
69    return 0;
70}
71
72static int
73_nc_sigaddset(sigset_t * mask, int sig)
74{
75    *mask |= sigmask(sig);
76    return 0;
77}
78
79/* not used in lib_tstp.c */
80#if 0
81static int
82_nc_sigsuspend(sigset_t * mask)
83{
84    return sigpause(*mask);
85}
86
87static int
88_nc_sigdelset(sigset_t * mask, int sig)
89{
90    *mask &= ~sigmask(sig);
91    return 0;
92}
93
94static int
95_nc_sigismember(sigset_t * mask, int sig)
96{
97    return (*mask & sigmask(sig)) != 0;
98}
99#endif
100