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 better credentials. sigset() is now relegated to a #define in signal.h that makes it equivalent to signal().

This commit is contained in:
Gregory Nutt 2016-04-10 14:35:45 -06:00
parent 502ac79e0c
commit 28a4ca6713
4 changed files with 32 additions and 22 deletions

View File

@ -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).

View File

@ -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 <gnutt@nuttx.org>
*
* 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);

View File

@ -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

View File

@ -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 <gnutt@nuttx.org>
*
* 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.
*/