Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit a992f50

Browse files
committed
Remove __need macros from signal.h.
The types affected are __sig_atomic_t, sig_atomic_t, __sigset_t, sigset_t, sigval_t, sigevent_t, and siginfo_t. __sig_atomic_t is a scalar, so it's now directly available from bits/types.h. The others get bits/types/ headers. Side effects include: There have been small changes to which non-signal headers expose which subset of the signal-related types. A couple of architectures' nested siginfo_t fields had to be renamed to prevent undesired macro expansion. Internal code that wants to manipulate signal masks must now include <sigsetops.h> (which is not installed) and should be aware that __sigaddset, __sigandset, __sigdelset, __sigemptyset, and __sigorset no longer return a value (unlike the public API). Relatedly, the public signal.h no longer declares any of those functions. The obsolete sigmask() macro no longer has a system-specific definition -- in the cases where it matters, it didn't work anyway. New Linux architectures should create bits/siginfo-arch.h and/or bits/siginfo-consts-arch.h to customize their siginfo_t, rather than duplicating everything in bits/siginfo.h (which no longer exists). Add new __SI_* macros if necessary. Ports to other operating systems are strongly encouraged to generalize this scheme further. * bits/sigevent-consts.h * bits/siginfo-consts.h * bits/types/__sigset_t.h * bits/types/sigevent_t.h * bits/types/siginfo_t.h * sysdeps/unix/sysv/linux/bits/sigevent-consts.h * sysdeps/unix/sysv/linux/bits/siginfo-consts.h * sysdeps/unix/sysv/linux/bits/types/__sigset_t.h * sysdeps/unix/sysv/linux/bits/types/sigevent_t.h * sysdeps/unix/sysv/linux/bits/types/siginfo_t.h: New system-dependent bits headers. * sysdeps/unix/sysv/linux/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h * sysdeps/unix/sysv/linux/tile/bits/siginfo-consts-arch.h * sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h: New Linux-only system-dependent bits headers. * signal/bits/types/sig_atomic_t.h * signal/bits/types/sigset_t.h * signal/bits/types/sigval_t.h: New non-system-dependent bits headers. * sysdeps/generic/sigsetops.h * sysdeps/unix/sysv/linux/sigsetops.h: New internal headers. * include/bits/types/sig_atomic_t.h * include/bits/types/sigset_t.h * include/bits/types/sigval_t.h: New wrappers. * signal/sigsetops.h * bits/siginfo.h * bits/sigset.h * sysdeps/unix/sysv/linux/bits/siginfo.h * sysdeps/unix/sysv/linux/bits/sigset.h * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h * sysdeps/unix/sysv/linux/mips/bits/siginfo.h * sysdeps/unix/sysv/linux/s390/bits/siginfo.h * sysdeps/unix/sysv/linux/sparc/bits/siginfo.h * sysdeps/unix/sysv/linux/tile/bits/siginfo.h * sysdeps/unix/sysv/linux/x86/bits/siginfo.h: Deleted. * signal/Makefile, sysdeps/unix/sysv/linux/Makefile: Update lists of installed headers. * posix/bits/types.h: Define __sig_atomic_t here. * signal/signal.h: Use the new bits headers; no need to handle __need_sig_atomic_t nor __need_sigset_t. Don't use __sigmask to define sigmask. * include/signal.h: No need to handle __need_sig_atomic_t nor __need_sigset_t. Don't define __sigemptyset. * io/sys/poll.h, setjmp/setjmp.h * sysdeps/arm/sys/ucontext.h, sysdeps/generic/sys/ucontext.h * sysdeps/i386/sys/ucontext.h, sysdeps/m68k/sys/ucontext.h * sysdeps/mach/hurd/i386/bits/sigcontext.h * sysdeps/mips/sys/ucontext.h, sysdeps/powerpc/novmxsetjmp.h * sysdeps/pthread/bits/sigthread.h * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h * sysdeps/unix/sysv/linux/mips/sys/ucontext.h * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h * sysdeps/unix/sysv/linux/s390/sys/ucontext.h * sysdeps/unix/sysv/linux/sh/sys/ucontext.h * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h * sysdeps/unix/sysv/linux/tile/sys/ucontext.h * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Use bits/types/__sigset_t.h. * misc/sys/select.h, posix/spawn.h * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h * sysdeps/unix/sysv/linux/sys/epoll.h * sysdeps/unix/sysv/linux/sys/signalfd.h: Use bits/types/sigset_t.h. * resolv/netdb.h, rt/mqueue.h: Use bits/types/sigevent_t.h. * rt/aio.h: Use bits/types/sigevent_t.h and bits/sigevent-consts.h. * socket/sys/socket.h: Don't include bits/sigset.h. * login/utmp_file.c, shadow/lckpwdf.c, signal/sigandset.c * signal/sigisempty.c, stdlib/abort.c, sysdeps/posix/profil.c * sysdeps/posix/sigignore.c, sysdeps/posix/sigintr.c * sysdeps/posix/signal.c, sysdeps/posix/sigset.c * sysdeps/posix/sprofil.c, sysdeps/posix/sysv_signal.c * sysdeps/unix/sysv/linux/nptl-signals.h: Include sigsetops.h. * signal/sigaddset.c, signal/sigandset.c, signal/sigdelset.c * signal/sigorset.c, stdlib/abort.c, sysdeps/posix/sigignore.c * sysdeps/posix/signal.c, sysdeps/posix/sigset.c: __sigaddset, __sigandset, __sigdelset, __sigemptyset, __sigorset now return no value. * signal/sigaddset.c, signal/sigdelset.c, signal/sigismem.c Include <errno.h>, <signal.h>, and <sigsetops.h> instead of "sigsetops.h". * signal/sigsetops.c: Explicitly define __sigismember, __sigaddset, and __sigdelset as compatibility symbols. * signal/Versions: Correct commentary on __sigpause, __sigaddset, __sigdelset, __sigismember. * inet/rcmd.c: Include sigsetops.h. Convert old code using __sigblock/__sigsetmask to use __sigprocmask and friends.
1 parent 500b3a4 commit a992f50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1192
-2911
lines changed

ChangeLog

+127
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,132 @@
11
2017-05-20 Zack Weinberg <[email protected]>
22

3+
* bits/sigevent-consts.h
4+
* bits/siginfo-consts.h
5+
* bits/types/__sigset_t.h
6+
* bits/types/sigevent_t.h
7+
* bits/types/siginfo_t.h
8+
* sysdeps/unix/sysv/linux/bits/sigevent-consts.h
9+
* sysdeps/unix/sysv/linux/bits/siginfo-consts.h
10+
* sysdeps/unix/sysv/linux/bits/types/__sigset_t.h
11+
* sysdeps/unix/sysv/linux/bits/types/sigevent_t.h
12+
* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h:
13+
New system-dependent bits headers.
14+
15+
* sysdeps/unix/sysv/linux/bits/siginfo-arch.h
16+
* sysdeps/unix/sysv/linux/bits/siginfo-consts-arch.h
17+
* sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h
18+
* sysdeps/unix/sysv/linux/ia64/bits/siginfo-consts-arch.h
19+
* sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h
20+
* sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h
21+
* sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h
22+
* sysdeps/unix/sysv/linux/tile/bits/siginfo-consts-arch.h
23+
* sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h:
24+
New Linux-only system-dependent bits headers.
25+
26+
* signal/bits/types/sig_atomic_t.h
27+
* signal/bits/types/sigset_t.h
28+
* signal/bits/types/sigval_t.h:
29+
New non-system-dependent bits headers.
30+
31+
* sysdeps/generic/sigsetops.h
32+
* sysdeps/unix/sysv/linux/sigsetops.h:
33+
New internal headers.
34+
35+
* include/bits/types/sig_atomic_t.h
36+
* include/bits/types/sigset_t.h
37+
* include/bits/types/sigval_t.h:
38+
New wrappers.
39+
40+
* signal/sigsetops.h
41+
* bits/siginfo.h
42+
* bits/sigset.h
43+
* sysdeps/unix/sysv/linux/bits/siginfo.h
44+
* sysdeps/unix/sysv/linux/bits/sigset.h
45+
* sysdeps/unix/sysv/linux/ia64/bits/siginfo.h
46+
* sysdeps/unix/sysv/linux/mips/bits/siginfo.h
47+
* sysdeps/unix/sysv/linux/s390/bits/siginfo.h
48+
* sysdeps/unix/sysv/linux/sparc/bits/siginfo.h
49+
* sysdeps/unix/sysv/linux/tile/bits/siginfo.h
50+
* sysdeps/unix/sysv/linux/x86/bits/siginfo.h:
51+
Deleted.
52+
53+
* signal/Makefile, sysdeps/unix/sysv/linux/Makefile:
54+
Update lists of installed headers.
55+
56+
* posix/bits/types.h: Define __sig_atomic_t here.
57+
* signal/signal.h: Use the new bits headers; no need to handle
58+
__need_sig_atomic_t nor __need_sigset_t. Don't use __sigmask
59+
to define sigmask.
60+
* include/signal.h: No need to handle __need_sig_atomic_t
61+
nor __need_sigset_t. Don't define __sigemptyset.
62+
63+
* io/sys/poll.h, setjmp/setjmp.h
64+
* sysdeps/arm/sys/ucontext.h, sysdeps/generic/sys/ucontext.h
65+
* sysdeps/i386/sys/ucontext.h, sysdeps/m68k/sys/ucontext.h
66+
* sysdeps/mach/hurd/i386/bits/sigcontext.h
67+
* sysdeps/mips/sys/ucontext.h, sysdeps/powerpc/novmxsetjmp.h
68+
* sysdeps/pthread/bits/sigthread.h
69+
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
70+
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
71+
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
72+
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
73+
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
74+
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
75+
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
76+
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
77+
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
78+
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
79+
Use bits/types/__sigset_t.h.
80+
81+
* misc/sys/select.h, posix/spawn.h
82+
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
83+
* sysdeps/unix/sysv/linux/sys/epoll.h
84+
* sysdeps/unix/sysv/linux/sys/signalfd.h:
85+
Use bits/types/sigset_t.h.
86+
87+
* resolv/netdb.h, rt/mqueue.h: Use bits/types/sigevent_t.h.
88+
* rt/aio.h: Use bits/types/sigevent_t.h and bits/sigevent-consts.h.
89+
* socket/sys/socket.h: Don't include bits/sigset.h.
90+
91+
* login/utmp_file.c, shadow/lckpwdf.c, signal/sigandset.c
92+
* signal/sigisempty.c, stdlib/abort.c, sysdeps/posix/profil.c
93+
* sysdeps/posix/sigignore.c, sysdeps/posix/sigintr.c
94+
* sysdeps/posix/signal.c, sysdeps/posix/sigset.c
95+
* sysdeps/posix/sprofil.c, sysdeps/posix/sysv_signal.c
96+
* sysdeps/unix/sysv/linux/nptl-signals.h:
97+
Include sigsetops.h.
98+
99+
* signal/sigaddset.c, signal/sigandset.c, signal/sigdelset.c
100+
* signal/sigorset.c, stdlib/abort.c, sysdeps/posix/sigignore.c
101+
* sysdeps/posix/signal.c, sysdeps/posix/sigset.c:
102+
__sigaddset, __sigandset, __sigdelset, __sigemptyset, __sigorset
103+
now return no value.
104+
105+
* signal/sigaddset.c, signal/sigdelset.c, signal/sigismem.c
106+
Include <errno.h>, <signal.h>, and <sigsetops.h> instead of
107+
"sigsetops.h".
108+
109+
* signal/sigsetops.c: Explicitly define __sigismember,
110+
__sigaddset, and __sigdelset as compatibility symbols.
111+
112+
* signal/Versions: Correct commentary on __sigpause,
113+
__sigaddset, __sigdelset, __sigismember.
114+
115+
* inet/rcmd.c: Include sigsetops.h. Convert old code using
116+
__sigblock/__sigsetmask to use __sigprocmask and friends.
117+
118+
* resolv/resolv.h: Remove __need_res_state logic.
119+
Move definition of res_state and related constants to ...
120+
* resolv/bits/types/res_state.h: ...this new file.
121+
* resolv/Makefile: Install bits/types/res_state.h.
122+
* include/bits/types/res_state.h: New wrapper.
123+
* include/list.h: Remove __need_list_t logic.
124+
Move definition of list_t to ...
125+
* include/list_t.h: ...this new file.
126+
127+
* nptl/descr.h: Include list_t.h and bits/types/res_state.h
128+
instead of list.h and resolv.h.
129+
3130
* resolv/resolv.h: Remove __need_res_state logic.
4131
Move definition of res_state and related constants to ...
5132
* resolv/bits/types/res_state.h: ...this new file.
+18-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
1+
/* sigevent constants. Stub version.
2+
Copyright (C) 1997-2017 Free Software Foundation, Inc.
23
This file is part of the GNU C Library.
34
45
The GNU C Library is free software; you can redistribute it and/or
@@ -15,18 +16,22 @@
1516
License along with the GNU C Library; if not, see
1617
<http://www.gnu.org/licenses/>. */
1718

18-
/* Definitions relevant to functions that operate on `sigset_t's. */
19+
#ifndef _BITS_SIGEVENT_CONSTS_H
20+
#define _BITS_SIGEVENT_CONSTS_H 1
1921

20-
#include <errno.h>
21-
#include <signal.h>
22-
#include <string.h>
22+
#if !defined _SIGNAL_H && !defined _AIO_H
23+
#error "Don't include <bits/sigevent-consts.h> directly; use <signal.h> instead."
24+
#endif
2325

24-
#define BITS (_NSIG - 1)
25-
#define ELT(signo) (((signo) - 1) / BITS)
26-
#define MASK(signo) (1 << (((signo) - 1) % BITS))
26+
/* `sigev_notify' values. */
27+
enum
28+
{
29+
SIGEV_SIGNAL = 0, /* Notify via signal. */
30+
# define SIGEV_SIGNAL SIGEV_SIGNAL
31+
SIGEV_NONE, /* Other notification: meaningless. */
32+
# define SIGEV_NONE SIGEV_NONE
33+
SIGEV_THREAD /* Deliver via thread creation. */
34+
# define SIGEV_THREAD SIGEV_THREAD
35+
};
2736

28-
#undef sigemptyset
29-
#undef sigfillset
30-
#undef sigaddset
31-
#undef sigdelset
32-
#undef sigismember
37+
#endif

bits/siginfo.h bits/siginfo-consts.h

+4-70
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* siginfo_t, sigevent and constants. Stub version.
1+
/* siginfo_t constants. Stub version.
22
Copyright (C) 1997-2017 Free Software Foundation, Inc.
33
This file is part of the GNU C Library.
44
@@ -16,42 +16,8 @@
1616
License along with the GNU C Library; if not, see
1717
<http://www.gnu.org/licenses/>. */
1818

19-
#if !defined _SIGNAL_H && !defined __need_siginfo_t \
20-
&& !defined __need_sigevent_t
21-
# error "Never include this file directly. Use <signal.h> instead"
22-
#endif
23-
24-
#if (!defined __have_sigval_t \
25-
&& (defined _SIGNAL_H || defined __need_siginfo_t \
26-
|| defined __need_sigevent_t))
27-
# define __have_sigval_t 1
28-
29-
/* Type for data associated with a signal. */
30-
typedef union sigval
31-
{
32-
int sival_int;
33-
void *sival_ptr;
34-
} sigval_t;
35-
#endif
36-
37-
#if (!defined __have_siginfo_t \
38-
&& (defined _SIGNAL_H || defined __need_siginfo_t))
39-
# define __have_siginfo_t 1
40-
41-
typedef struct siginfo
42-
{
43-
int si_signo; /* Signal number. */
44-
int si_errno; /* If non-zero, an errno value associated with
45-
this signal, as defined in <errno.h>. */
46-
int si_code; /* Signal code. */
47-
__pid_t si_pid; /* Sending process ID. */
48-
__uid_t si_uid; /* Real user ID of sending process. */
49-
void *si_addr; /* Address of faulting instruction. */
50-
int si_status; /* Exit value or signal. */
51-
long int si_band; /* Band event for SIGPOLL. */
52-
union sigval si_value; /* Signal value. */
53-
} siginfo_t;
54-
19+
#ifndef _BITS_SIGINFO_CONSTS_H
20+
#define _BITS_SIGINFO_CONSTS_H 1
5521

5622
/* Values for `si_code'. Positive values are reserved for kernel-generated
5723
signals. */
@@ -181,36 +147,4 @@ enum
181147
};
182148
# endif
183149

184-
# undef __need_siginfo_t
185-
#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */
186-
187-
188-
#if (defined _SIGNAL_H || defined __need_sigevent_t) \
189-
&& !defined __have_sigevent_t
190-
# define __have_sigevent_t 1
191-
192-
/* Structure to transport application-defined values with signals. */
193-
# define SIGEV_MAX_SIZE 64
194-
# define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE / sizeof (int)) - 3)
195-
196-
typedef struct sigevent
197-
{
198-
sigval_t sigev_value;
199-
int sigev_signo;
200-
int sigev_notify;
201-
void (*sigev_notify_function) (sigval_t); /* Function to start. */
202-
void *sigev_notify_attributes; /* Really pthread_attr_t.*/
203-
} sigevent_t;
204-
205-
/* `sigev_notify' values. */
206-
enum
207-
{
208-
SIGEV_SIGNAL = 0, /* Notify via signal. */
209-
# define SIGEV_SIGNAL SIGEV_SIGNAL
210-
SIGEV_NONE, /* Other notification: meaningless. */
211-
# define SIGEV_NONE SIGEV_NONE
212-
SIGEV_THREAD /* Deliver via thread creation. */
213-
# define SIGEV_THREAD SIGEV_THREAD
214-
};
215-
216-
#endif /* have _SIGNAL_H. */
150+
#endif

bits/sigset.h

-84
This file was deleted.

bits/types/__sigset_t.h

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef ____sigset_t_defined
2+
#define ____sigset_t_defined 1
3+
4+
/* A `sigset_t' has a bit for each signal. */
5+
typedef unsigned long int __sigset_t;
6+
7+
#endif

bits/types/sigevent_t.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef __sigevent_t_defined
2+
#define __sigevent_t_defined 1
3+
4+
#include <bits/types.h>
5+
#include <bits/types/sigval_t.h>
6+
7+
/* Structure to transport application-defined values with signals. */
8+
typedef struct sigevent
9+
{
10+
sigval_t sigev_value;
11+
int sigev_signo;
12+
int sigev_notify;
13+
void (*sigev_notify_function) (sigval_t); /* Function to start. */
14+
void *sigev_notify_attributes; /* Really pthread_attr_t.*/
15+
} sigevent_t;
16+
17+
#endif

bits/types/siginfo_t.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef __siginfo_t_defined
2+
#define __siginfo_t_defined 1
3+
4+
#include <bits/types.h>
5+
#include <bits/types/sigval_t.h>
6+
7+
typedef struct siginfo
8+
{
9+
int si_signo; /* Signal number. */
10+
int si_errno; /* If non-zero, an errno value associated with
11+
this signal, as defined in <errno.h>. */
12+
int si_code; /* Signal code. */
13+
__pid_t si_pid; /* Sending process ID. */
14+
__uid_t si_uid; /* Real user ID of sending process. */
15+
void *si_addr; /* Address of faulting instruction. */
16+
int si_status; /* Exit value or signal. */
17+
long int si_band; /* Band event for SIGPOLL. */
18+
sigval_t si_value; /* Signal value. */
19+
} siginfo_t;
20+
21+
#endif

include/bits/types/sig_atomic_t.h

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <signal/bits/types/sig_atomic_t.h>

0 commit comments

Comments
 (0)