diff --git a/ChangeLog b/ChangeLog index c45a1b34ec0..0c60c4227ce 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11615,5 +11615,10 @@ * STM3220G-EVAL: Add support for both the IAR and uVision GCC IDEs From Kha Vo (2016-04-08). * STM32F429I Discovery: Add support for the uVision GCC IDE. From - Kha Vo (2016-04-08). - + * Kha Vo (2016-04-08). + * libc/signal and include/signal.h: Rename sigset() to signal(). + sigset() is the System V function; signal() is the obsoleted POSIX + name. These seem to be equivalent. Neither are relevant in modern + POSIX programming but the name signal() probably has the better + credentials. sigset() is now relegated to a #define in signal.h that + makes it equivalent to signal() (2016-04-10). diff --git a/include/signal.h b/include/signal.h index 57c5742d838..f01181d4a7c 100644 --- a/include/signal.h +++ b/include/signal.h @@ -1,7 +1,7 @@ /******************************************************************************** * include/signal.h * - * Copyright (C) 2007-2009, 2011, 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2013-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -189,6 +189,10 @@ # define SIG_HOLD ((CODE void*)0) #endif +/* System V name compatibility */ + +#define sigset(s) signal(s) + /******************************************************************************** * Public Type Definitions ********************************************************************************/ @@ -250,8 +254,9 @@ typedef struct siginfo siginfo_t; * These should be used only internally within the NuttX signal logic. */ -typedef CODE void (*_sa_handler_t)(int); -typedef CODE void (*_sa_sigaction_t)(int, FAR siginfo_t *, FAR void *); +typedef CODE void (*_sa_handler_t)(int signo); +typedef CODE void (*_sa_sigaction_t)(int signo, FAR siginfo_t *siginfo, + FAR void *context); /* The following structure defines the action to take for given signal */ @@ -291,8 +296,8 @@ int sigdelset(FAR sigset_t *set, int signo); int sigismember(FAR const sigset_t *set, int signo); int sigaction(int sig, FAR const struct sigaction *act, FAR struct sigaction *oact); -void (*sigset(int signo, void (*disp)(int)))(int); int sigignore(int signo); +CODE void (*signal(int sig, CODE void (*func)(int signo)))(int signo); int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); int sigpause(int signo); int sigrelse(int signo); diff --git a/libc/signal/Make.defs b/libc/signal/Make.defs index 7be0ba02e6b..aa3b473baf3 100644 --- a/libc/signal/Make.defs +++ b/libc/signal/Make.defs @@ -39,7 +39,7 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y) CSRCS += sig_emptyset.c sig_fillset.c sig_addset.c sig_delset.c CSRCS += sig_ismember.c sig_hold.c sig_relse.c sig_ignore.c sig_pause.c -CSRCS += sig_set.c +CSRCS += signal.c # Add the signal directory to the build diff --git a/libc/signal/sig_set.c b/libc/signal/signal.c similarity index 83% rename from libc/signal/sig_set.c rename to libc/signal/signal.c index b6186fdc6c1..fed1b55abd0 100644 --- a/libc/signal/sig_set.c +++ b/libc/signal/signal.c @@ -1,7 +1,7 @@ /**************************************************************************** - * libc/signal/sig_set.c + * libc/signal/signal.c * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,39 +44,39 @@ ****************************************************************************/ /**************************************************************************** - * Name: sigset + * Name: signal * * Description: - * The sigset() function will modify signal dispositions. The 'signo' - * argument specifies the signal. The 'disp' argument specifies the + * The signal() function will modify signal dispositions. The 'signo' + * argument specifies the signal. The 'func' argument specifies the * signal's disposition, which may be SIG_DFL, SIG_IGN, or the address - * of a signal handler. If 'disp' is the address of a signal handler, the + * of a signal handler. If 'func' is the address of a signal handler, the * system will add 'signo' to the calling process' signal mask before * executing the signal handler; when the signal handler returns, the * system will restore the calling process' signal mask to its state prior * to the delivery of the signal. 'signo' will be removed from the calling * process' signal mask. * - * NOTE: The value SIG_HOLD for 'disp' is not supported. It should work - * like this: If 'disp' is equal to SIG_HOLD, 'signo' will be added to, + * NOTE: The value SIG_HOLD for 'func' is not supported. It should work + * like this: If 'func' is equal to SIG_HOLD, 'signo' will be added to, * not removed from, the calling process' signal mask and 'signo''s * disposition will remain unchanged. * * Input Parameters: * signo - Identifies the signal to operate on - * disp - The new disposition of the signal + * func - The new disposition of the signal * * Returned Value: - * Upon successful completion, sigset() will the previous disposition of + * Upon successful completion, signal() will the previous disposition of * the signal. Otherwise, SIG_ERR will be returned and errno set to * indicate the error. * - * NOTE: sigset() would return SIG_HOLD if the signal had been blocked and + * NOTE: signal() would return SIG_HOLD if the signal had been blocked and * the signal's previous disposition if it had not been blocked. * ****************************************************************************/ -void (*sigset(int signo, void (*disp)(int)))(int) +CODE void (*signal(int signo, CODE void (*func)(int signo)))(int signo) { struct sigaction act; struct sigaction oact; @@ -84,7 +84,7 @@ void (*sigset(int signo, void (*disp)(int)))(int) /* Initialize the sigaction structure */ - act.sa_handler = disp; + act.sa_handler = func; act.sa_flags = 0; (void)sigemptyset(&act.sa_mask); @@ -94,7 +94,7 @@ void (*sigset(int signo, void (*disp)(int)))(int) * and cannot be distinguished. */ - if (disp != SIG_DFL /* && disp != SIG_IGN */) + if (func != SIG_DFL /* && func != SIG_IGN */) { /* Add the signal to the set of signals to be ignored when the signal * handler executes. @@ -113,7 +113,7 @@ void (*sigset(int signo, void (*disp)(int)))(int) ret = sigaction(signo, &act, &oact); - /* Upon successful completion, sigset() will the signal's previous + /* Upon successful completion, signal() will the signal's previous * disposition. Otherwise, SIG_ERR will be returned and errno set to * indicate the error. */