Cygwin: rename NSIG to _NSIG, change visibility of NSIG to MISC

NSIG is a deprecated symbol only visible under MISC visibility.
_NSIG is used widely instead, and on most systems NSIG is
defined in terms of _NSIG.

Follow suit: Change NSIG to _NSIG throughout and change visiblity
of NSIG to be defined only in __MISC_VISIBLE case.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2020-02-18 11:17:43 +01:00
parent f3793803a7
commit 40245925ce
7 changed files with 37 additions and 29 deletions

View File

@ -1166,7 +1166,7 @@ extern "C" int
sighold (int sig)
{
/* check that sig is in right range */
if (sig < 0 || sig >= NSIG)
if (sig < 0 || sig >= _NSIG)
{
set_errno (EINVAL);
syscall_printf ("signal %d out of range", sig);
@ -1182,7 +1182,7 @@ extern "C" int
sigrelse (int sig)
{
/* check that sig is in right range */
if (sig < 0 || sig >= NSIG)
if (sig < 0 || sig >= _NSIG)
{
set_errno (EINVAL);
syscall_printf ("signal %d out of range", sig);
@ -1201,7 +1201,7 @@ sigset (int sig, _sig_func_ptr func)
_sig_func_ptr prev;
/* check that sig is in right range */
if (sig < 0 || sig >= NSIG || sig == SIGKILL || sig == SIGSTOP)
if (sig < 0 || sig >= _NSIG || sig == SIGKILL || sig == SIGSTOP)
{
set_errno (EINVAL);
syscall_printf ("SIG_ERR = sigset (%d, %p)", sig, func);

View File

@ -438,14 +438,18 @@ struct sigaction
#define SIGUSR2 31 /* user defined signal 2 */
#if __WORDSIZE == 64
#define NSIG 65 /* signal 0 implied */
#define _NSIG 65 /* signal 0 implied */
#else
#define NSIG 33 /* signal 0 implied */
#define _NSIG 33 /* signal 0 implied */
#endif
#if __MISC_VISIBLE
#define NSIG _NSIG
#endif
/* Real-Time signals per SUSv3. RT_SIGMAX is defined as 8 in limits.h */
#define SIGRTMIN 32
#define SIGRTMAX (NSIG - 1)
#define SIGRTMAX (_NSIG - 1)
#define SIG_HOLD ((_sig_func_ptr)2) /* Signal in signal mask */

View File

@ -13,6 +13,10 @@ What changed:
- Allow AF_LOCAL sockets to be opened with O_PATH.
- <signal.h>: New macro _NSIG replacing NSIG. NSIG is now only
visible to MISC builds, as on Linux.
Bug Fixes:
----------

View File

@ -36,7 +36,7 @@ signal (int sig, _sig_func_ptr func)
_sig_func_ptr prev;
/* check that sig is in right range */
if (sig <= 0 || sig >= NSIG || sig == SIGKILL || sig == SIGSTOP)
if (sig <= 0 || sig >= _NSIG || sig == SIGKILL || sig == SIGSTOP)
{
set_errno (EINVAL);
syscall_printf ("SIG_ERR = signal (%d, %p)", sig, func);
@ -311,7 +311,7 @@ kill0 (pid_t pid, siginfo_t& si)
{
syscall_printf ("kill (%d, %d)", pid, si.si_signo);
/* check that sig is in right range */
if (si.si_signo < 0 || si.si_signo >= NSIG)
if (si.si_signo < 0 || si.si_signo >= _NSIG)
{
set_errno (EINVAL);
syscall_printf ("signal %d out of range", si.si_signo);
@ -417,7 +417,7 @@ sigaction_worker (int sig, const struct sigaction *newact,
{
sig_dispatch_pending ();
/* check that sig is in right range */
if (sig <= 0 || sig >= NSIG)
if (sig <= 0 || sig >= _NSIG)
set_errno (EINVAL);
else
{
@ -480,7 +480,7 @@ extern "C" int
sigaddset (sigset_t *set, const int sig)
{
/* check that sig is in right range */
if (sig <= 0 || sig >= NSIG)
if (sig <= 0 || sig >= _NSIG)
{
set_errno (EINVAL);
syscall_printf ("SIG_ERR = sigaddset signal %d out of range", sig);
@ -495,7 +495,7 @@ extern "C" int
sigdelset (sigset_t *set, const int sig)
{
/* check that sig is in right range */
if (sig <= 0 || sig >= NSIG)
if (sig <= 0 || sig >= _NSIG)
{
set_errno (EINVAL);
syscall_printf ("SIG_ERR = sigdelset signal %d out of range", sig);
@ -510,7 +510,7 @@ extern "C" int
sigismember (const sigset_t *set, int sig)
{
/* check that sig is in right range */
if (sig <= 0 || sig >= NSIG)
if (sig <= 0 || sig >= _NSIG)
{
set_errno (EINVAL);
syscall_printf ("SIG_ERR = sigdelset signal %d out of range", sig);
@ -709,7 +709,7 @@ sigqueue (pid_t pid, int sig, const union sigval value)
}
if (sig == 0)
return 0;
if (sig < 0 || sig >= NSIG)
if (sig < 0 || sig >= _NSIG)
{
set_errno (EINVAL);
return -1;

View File

@ -71,7 +71,7 @@ static void WINAPI wait_sig (VOID *arg);
class pending_signals
{
sigpacket sigs[NSIG + 1];
sigpacket sigs[_NSIG + 1];
sigpacket start;
bool retry;
@ -91,7 +91,7 @@ void __stdcall
sigalloc ()
{
cygheap->sigs = global_sigs =
(struct sigaction *) ccalloc_abort (HEAP_SIGS, NSIG, sizeof (struct sigaction));
(struct sigaction *) ccalloc_abort (HEAP_SIGS, _NSIG, sizeof (struct sigaction));
global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER;
}
@ -100,7 +100,7 @@ signal_fixup_after_exec ()
{
global_sigs = cygheap->sigs;
/* Set up child's signal handlers */
for (int i = 0; i < NSIG; i++)
for (int i = 0; i < _NSIG; i++)
{
global_sigs[i].sa_mask = 0;
if (global_sigs[i].sa_handler != SIG_IGN)
@ -449,7 +449,7 @@ sigproc_init ()
char char_sa_buf[1024];
PSECURITY_ATTRIBUTES sa = sec_user_nih ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
DWORD err = fhandler_pipe::create (sa, &my_readsig, &my_sendsig,
NSIG * sizeof (sigpacket), "sigwait",
_NSIG * sizeof (sigpacket), "sigwait",
PIPE_ADD_PID);
if (err)
{

View File

@ -10,19 +10,19 @@ details. */
#include <signal.h>
#include "sync.h"
#ifdef NSIG
#ifdef _NSIG
enum
{
__SIGFLUSH = -(NSIG + 1),
__SIGSTRACE = -(NSIG + 2),
__SIGCOMMUNE = -(NSIG + 3),
__SIGPENDING = -(NSIG + 4),
__SIGDELETE = -(NSIG + 5), /* Not currently used */
__SIGFLUSHFAST = -(NSIG + 6),
__SIGHOLD = -(NSIG + 7),
__SIGNOHOLD = -(NSIG + 8),
__SIGSETPGRP = -(NSIG + 9),
__SIGTHREADEXIT = -(NSIG + 10)
__SIGFLUSH = -(_NSIG + 1),
__SIGSTRACE = -(_NSIG + 2),
__SIGCOMMUNE = -(_NSIG + 3),
__SIGPENDING = -(_NSIG + 4),
__SIGDELETE = -(_NSIG + 5), /* Not currently used */
__SIGFLUSHFAST = -(_NSIG + 6),
__SIGHOLD = -(_NSIG + 7),
__SIGNOHOLD = -(_NSIG + 8),
__SIGSETPGRP = -(_NSIG + 9),
__SIGTHREADEXIT = -(_NSIG + 10)
};
#endif

View File

@ -174,7 +174,7 @@ psiginfo (const siginfo_t *info, const char *s)
ADD (strsignal (info->si_signo));
if (info->si_signo > 0 && info->si_signo < NSIG)
if (info->si_signo > 0 && info->si_signo < _NSIG)
{
switch (info->si_signo)
{