mirror of
https://sourceware.org/git/glibc.git
synced 2025-10-12 19:04:54 +03:00
signal: Deprecate additional legacy signal handling functions
This needs a few test adjustments: In some cases, sigignore was used for convenience (replaced with xsignal with SIG_IGN). Tests for the deprecated functions need to disable -Wdeprecated-declarations, and for the sigmask deprecation, -Wno-error. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
5
NEWS
5
NEWS
@@ -39,6 +39,11 @@ Deprecated and removed features, and other changes affecting compatibility:
|
|||||||
Its implementation always returned with a failure, and the function
|
Its implementation always returned with a failure, and the function
|
||||||
was not declared in any header file.
|
was not declared in any header file.
|
||||||
|
|
||||||
|
* The legacy signal handling functions siginterrupt, sigpause, sighold,
|
||||||
|
sigrelse, sigignore and sigset, and the sigmask macro have been
|
||||||
|
deprecated. Applications should use the sigsuspend, sigprocmask and
|
||||||
|
sigaction functions instead.
|
||||||
|
|
||||||
* ldconfig now defaults to the new format for ld.so.cache. glibc has
|
* ldconfig now defaults to the new format for ld.so.cache. glibc has
|
||||||
already supported this format for almost 20 years.
|
already supported this format for almost 20 years.
|
||||||
|
|
||||||
|
@@ -3250,6 +3250,9 @@ are interrupted by handling signal @var{signum}. If @var{failflag} is
|
|||||||
false, signal @var{signum} restarts primitives. If @var{failflag} is
|
false, signal @var{signum} restarts primitives. If @var{failflag} is
|
||||||
true, handling @var{signum} causes these primitives to fail with error
|
true, handling @var{signum} causes these primitives to fail with error
|
||||||
code @code{EINTR}. @xref{Interrupted Primitives}.
|
code @code{EINTR}. @xref{Interrupted Primitives}.
|
||||||
|
|
||||||
|
This function has been replaced by the @code{SA_RESTART} flag of the
|
||||||
|
@code{sigaction} function. @xref{Advanced Signal Handling}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@deftypefn Macro int sigmask (int @var{signum})
|
@deftypefn Macro int sigmask (int @var{signum})
|
||||||
@@ -3267,6 +3270,9 @@ together to specify more than one signal. For example,
|
|||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
specifies a mask that includes all the job-control stop signals.
|
specifies a mask that includes all the job-control stop signals.
|
||||||
|
|
||||||
|
This macro has been replaced by the @code{sigset_t} type and the
|
||||||
|
associated signal set manipulation functions. @xref{Signal Sets}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@deftypefun int sigblock (int @var{mask})
|
@deftypefun int sigblock (int @var{mask})
|
||||||
|
@@ -510,6 +510,13 @@ endif
|
|||||||
# function frequently to get a thread-specific handle.
|
# function frequently to get a thread-specific handle.
|
||||||
CFLAGS-pthread_self.os += -fomit-frame-pointer
|
CFLAGS-pthread_self.os += -fomit-frame-pointer
|
||||||
|
|
||||||
|
# The sigmask macro is deprecated and triggers are compiler warning
|
||||||
|
# which cannot be suppressed (as of GCC 9).
|
||||||
|
CFLAGS-tst-cancel4.c += -Wno-error
|
||||||
|
CFLAGS-tst-cancel5.c += -Wno-error
|
||||||
|
CFLAGS-tst-cancelx4.c += -Wno-error
|
||||||
|
CFLAGS-tst-cancelx5.c += -Wno-error
|
||||||
|
|
||||||
# Run the cancellation and cleanup tests also for the modern, exception-based
|
# Run the cancellation and cleanup tests also for the modern, exception-based
|
||||||
# implementation. For this we have to pass the -fexceptions parameter.
|
# implementation. For this we have to pass the -fexceptions parameter.
|
||||||
CFLAGS-tst-cancelx2.c += -fexceptions
|
CFLAGS-tst-cancelx2.c += -fexceptions
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <libc-diag.h>
|
||||||
|
|
||||||
|
|
||||||
/* Since STREAMS are not supported in the standard Linux kernel and
|
/* Since STREAMS are not supported in the standard Linux kernel and
|
||||||
@@ -527,7 +528,13 @@ tf_sigpause (void *arg)
|
|||||||
|
|
||||||
pthread_cleanup_push (cl, NULL);
|
pthread_cleanup_push (cl, NULL);
|
||||||
|
|
||||||
|
/* This tests the deprecated sigpause and sigmask functions. The
|
||||||
|
file is compiled with -Wno-errno so that the sigmask deprecation
|
||||||
|
warning is not fatal. */
|
||||||
|
DIAG_PUSH_NEEDS_COMMENT;
|
||||||
|
DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
|
||||||
sigpause (sigmask (SIGINT));
|
sigpause (sigmask (SIGINT));
|
||||||
|
DIAG_POP_NEEDS_COMMENT;
|
||||||
|
|
||||||
pthread_cleanup_pop (0);
|
pthread_cleanup_pop (0);
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <support/xsignal.h>
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@@ -56,11 +57,7 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Not interested in knowing when the pipe is closed. */
|
/* Not interested in knowing when the pipe is closed. */
|
||||||
if (sigignore (SIGPIPE) != 0)
|
xsignal (SIGPIPE, SIG_IGN);
|
||||||
{
|
|
||||||
puts ("sigignore failed");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
posix_spawn_file_actions_t a;
|
posix_spawn_file_actions_t a;
|
||||||
if (posix_spawn_file_actions_init (&a) != 0)
|
if (posix_spawn_file_actions_init (&a) != 0)
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <support/xsignal.h>
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@@ -56,11 +57,7 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Not interested in knowing when the pipe is closed. */
|
/* Not interested in knowing when the pipe is closed. */
|
||||||
if (sigignore (SIGPIPE) != 0)
|
xsignal (SIGPIPE, SIG_IGN);
|
||||||
{
|
|
||||||
puts ("sigignore failed");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pid_t pid = fork ();
|
pid_t pid = fork ();
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <support/xsignal.h>
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@@ -50,11 +51,7 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Not interested in knowing when the pipe is closed. */
|
/* Not interested in knowing when the pipe is closed. */
|
||||||
if (sigignore (SIGPIPE) != 0)
|
xsignal (SIGPIPE, SIG_IGN);
|
||||||
{
|
|
||||||
puts ("sigignore failed");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pid_t pid = fork ();
|
pid_t pid = fork ();
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
|
@@ -22,17 +22,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <support/xsignal.h>
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
tf (void *arg)
|
tf (void *arg)
|
||||||
{
|
{
|
||||||
/* Ignore SIGUSR1 and block SIGUSR2. */
|
/* Ignore SIGUSR1 and block SIGUSR2. */
|
||||||
if (sigignore (SIGUSR1) != 0)
|
xsignal (SIGUSR1, SIG_IGN);
|
||||||
{
|
|
||||||
puts ("sigignore failed");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
sigset_t ss;
|
sigset_t ss;
|
||||||
sigemptyset (&ss);
|
sigemptyset (&ss);
|
||||||
|
@@ -86,11 +86,7 @@ do_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Not interested in knowing when the pipe is closed. */
|
/* Not interested in knowing when the pipe is closed. */
|
||||||
if (sigignore (SIGPIPE) != 0)
|
xsignal (SIGPIPE, SIG_IGN);
|
||||||
{
|
|
||||||
puts ("error: sigignore failed");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* To synchronize with the thread. */
|
/* To synchronize with the thread. */
|
||||||
if (pthread_barrier_init (&b, NULL, 2) != 0)
|
if (pthread_barrier_init (&b, NULL, 2) != 0)
|
||||||
|
@@ -148,7 +148,8 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
|
|||||||
|
|
||||||
#ifdef __USE_XOPEN_EXTENDED
|
#ifdef __USE_XOPEN_EXTENDED
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
|
extern int sigpause (int __sig) __asm__ ("__xpg_sigpause")
|
||||||
|
__attribute_deprecated_msg__ ("Use the sigsuspend function instead");
|
||||||
# else
|
# else
|
||||||
extern int __sigpause (int __sig_or_mask, int __is_sig);
|
extern int __sigpause (int __sig_or_mask, int __is_sig);
|
||||||
/* Remove a signal from the signal mask and suspend the process. */
|
/* Remove a signal from the signal mask and suspend the process. */
|
||||||
@@ -164,7 +165,9 @@ extern int __sigpause (int __sig_or_mask, int __is_sig);
|
|||||||
simply do not work in many situations. Use `sigprocmask' instead. */
|
simply do not work in many situations. Use `sigprocmask' instead. */
|
||||||
|
|
||||||
/* Compute mask for signal SIG. */
|
/* Compute mask for signal SIG. */
|
||||||
# define sigmask(sig) ((int)(1u << ((sig) - 1)))
|
# define sigmask(sig) \
|
||||||
|
__glibc_macro_warning ("sigmask is deprecated") \
|
||||||
|
((int)(1u << ((sig) - 1)))
|
||||||
|
|
||||||
/* Block signals in MASK, returning the old mask. */
|
/* Block signals in MASK, returning the old mask. */
|
||||||
extern int sigblock (int __mask) __THROW __attribute_deprecated__;
|
extern int sigblock (int __mask) __THROW __attribute_deprecated__;
|
||||||
@@ -311,7 +314,8 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
|
|||||||
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
|
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
|
||||||
(causing them to fail with EINTR); if INTERRUPT is zero, make system
|
(causing them to fail with EINTR); if INTERRUPT is zero, make system
|
||||||
calls be restarted after signal SIG. */
|
calls be restarted after signal SIG. */
|
||||||
extern int siginterrupt (int __sig, int __interrupt) __THROW;
|
extern int siginterrupt (int __sig, int __interrupt) __THROW
|
||||||
|
__attribute_deprecated_msg__ ("Use sigaction with SA_RESTART instead");
|
||||||
|
|
||||||
# include <bits/sigstack.h>
|
# include <bits/sigstack.h>
|
||||||
# include <bits/ss_flags.h>
|
# include <bits/ss_flags.h>
|
||||||
@@ -340,16 +344,21 @@ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
|
|||||||
/* Simplified interface for signal management. */
|
/* Simplified interface for signal management. */
|
||||||
|
|
||||||
/* Add SIG to the calling process' signal mask. */
|
/* Add SIG to the calling process' signal mask. */
|
||||||
extern int sighold (int __sig) __THROW;
|
extern int sighold (int __sig) __THROW
|
||||||
|
__attribute_deprecated_msg__ ("Use the sigprocmask function instead");
|
||||||
|
|
||||||
/* Remove SIG from the calling process' signal mask. */
|
/* Remove SIG from the calling process' signal mask. */
|
||||||
extern int sigrelse (int __sig) __THROW;
|
extern int sigrelse (int __sig) __THROW
|
||||||
|
__attribute_deprecated_msg__ ("Use the sigprocmask function instead");
|
||||||
|
|
||||||
/* Set the disposition of SIG to SIG_IGN. */
|
/* Set the disposition of SIG to SIG_IGN. */
|
||||||
extern int sigignore (int __sig) __THROW;
|
extern int sigignore (int __sig) __THROW
|
||||||
|
__attribute_deprecated_msg__ ("Use the signal function instead");
|
||||||
|
|
||||||
/* Set the disposition of SIG. */
|
/* Set the disposition of SIG. */
|
||||||
extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
|
extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW
|
||||||
|
__attribute_deprecated_msg__
|
||||||
|
("Use the signal and sigprocmask functions instead");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __USE_POSIX199506 || defined __USE_UNIX98
|
#if defined __USE_POSIX199506 || defined __USE_UNIX98
|
||||||
|
@@ -9,6 +9,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <libc-diag.h>
|
||||||
|
|
||||||
|
/* The sigset function is deprecated. */
|
||||||
|
DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
|
||||||
|
|
||||||
#define TEST_SIG SIGINT
|
#define TEST_SIG SIGINT
|
||||||
|
|
||||||
|
@@ -20,7 +20,10 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <libc-diag.h>
|
||||||
|
|
||||||
|
/* The sighold and sigrelse functions are deprecated. */
|
||||||
|
DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_test (void)
|
do_test (void)
|
||||||
|
Reference in New Issue
Block a user