Commit Graph

168 Commits

Author SHA1 Message Date
Adhemerval Zanella 51f4beb081 termios: Add powerpc termios-misc
PowerPC termios.h header contains additional BSD terminal mode definitions
(sgttyb, tchars, ltchars, and associated TIOCPKT_* symbolic constants).
This patch moves all powerpc termios specific definition to its own header.

No semantic change is expected, checked on a build against a
powerpc64le-linux-gnu build.

	* sysdeps/unix/sysv/linux/powerpc/bits/termios-misc.h: New file.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]
	(struct sgtty, struct tchars, struct ltchars, TIOCPKT_DATA,
	TIOCPKT_FLUSHREAD, TIOCPKT_FLUSHWRITE, TIOCPKT_STOP, TIOCPKT_START,
	TIOCPKT_NOSTOP, TIOCPKT_DOSTOP, _VINTR, _VQUIT, _VERASE, _VKILL,
	_VEOF, _VMIN, _VEOL, _VTIME, _VEOL2, _VSWTC): Move to
	termios-misc.h.
	* sysdeps/unix/sysv/linux/powerpc/Makefile [$subdir == misc]
	(sysdep_headers): Add termios-misc.h.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 3aa4a07ec1 termios: Consolidate tcflow symbolic constants
This patch consolidates the termios symbolic constants for use with tcflow
in its own header.  The Linux generic implementation values match the
kernel UAPI and each architecture with deviate values have their own
implementation (currently only mips).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	termios-tcflow.h.
	* sysdeps/unix/sysv/linux/bits/termios-tcflow.h: New file.
	* sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h (TCSANOW, TCSADRAIN,
	TCSAFLUSH): Move to termios-tcflow.h.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 22679ddf10 termios: Consolidate local mode definitions
This patch consolidates the termios symbolic constants used for local
mode with c_lflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, mips, and powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	termios-c_lflag.h.
	* sysdeps/unix/sysv/linux/bits/termios-c_lflag.h: New file.
	* sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h (ISIG, ISCANON, ECHO, ECHOE,
	ECHOK, ECHONL, NOFLSH, TOSTOP, IEXTEN): Move to termios-c_lflag.h.
	[__USE_MISC || (__USE_XOPEN && !__USE_XOPEN2K)] (XCASE): Likewise.
	[__USE_MISC] (ECHOCTL, ECHOPRT, ECHOKE, FLUSHO, PENDIN, EXTPROC):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 72eb6ecc7e termios: Consolidate control mode definitions
This patch consolidates the termios symbolic constants used for output
mode with c_cflag memver on its own header.  The Linux generic
implementation values match the kernel UAPI and each architecture with
deviate values have their own implementation (in this case alpha and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	termios-c_cflag.h.
	* sysdeps/unix/sysv/linux/bits/termios-c_cflag.h: New file.
	* sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h (CSIZE, CS5, CS6, CS7, CS8,
	CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL): Move to
	termios-c_cflag.h.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 9c5d0d02c1 termios: Consolidate Baud Rate Selection definitions (BZ#23783)
This patch consolidates the termios symbolic constants used for baud rates
selection used along with speed_t on its own header.  The Linux generic
implementation values match the kernel UAPI and each architecture with
deviate values have their own implementation (in this case alpha and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	[BZ #23783]
	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	termios-baud.h.
	* sysdeps/unix/sysv/linux/bits/termios-baud.h: New file.
	* sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios-baud.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h (B57600, B115200,
	B230400, B460800, B500000, B576000, B921600, B1000000, B1152000,
	B1500000, B2000000, B2500000, B3000000, B3500000, B4000000,
	__MAX_BAUD): Move to termios-baud.h.
	[__USE_MISC] (CBAUD, CBAUDEX): Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 7b83201888 termios: Consolidate Output Modes definitions
This patch consolidates the termios symbolic constants used for ouput
modes with c_oflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, powerpc, and sparc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
	termios-c_oflag.h.
	* sysdeps/unix/sysv/linux/bits/termios-c_oflag.h: New file.
	* sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h (OPOST, OLCUC, ONLCR, OCRNL,
	ONOCR, ONLRET, OFILL, OFDEL, VTDLY, VT0, VT1):  Move to
	termios-c_oflag.h.
	[__USE_MISC || __USE_XOPEN] (NLDLY, NL0, NL1, CRDLY, CR0, CR1, CR2,
	CR3, TABDLY, TAB0, TAB1, TAB2, TAB3, BSDLY, BS0, BS1, FFDLY, FF0,
	FFR1): Likewise.
	[USE_MISC] (XTABS): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 3127003e75 termios: Consolidate Input Modes definitions.
This patch consolidates the termios symbolic constants used for input
modes with c_iflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha and powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add
	termios-c_iflag.h.
	* sysdeps/unix/sysv/linux/bits/termios-c_iflag.h: New file.
	* sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h (IGNBRK, BRKINT, IGNPAR, PARMRK,
	INPCK, ISTRIP, INLCR, IGNCR, ICRNL, IXON, IXOFF, IXANY, IUCLC, IMAXBEL,
	IUTF8): Move to termios-c_iflag.h.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 48c1dd9632 termios: Consolidate termios c_cc symbolic constants
This patch consolidates the termios symbolic constants used as subscript
for the array c_cc on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, mips64, sparc64, and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add
	termios-cc.h.
	* sysdeps/unix/sysv/linux/bits/termios-c_cc.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h: New file.
	* sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h (VINTR, VQUIT, VERASE,
	VKILL, VEOF, VTIME, VMIN, VSWTC, VSTART, VSTOP, VSUSP, VEOL,
	VREPRINT, VDISCARD, VWERASE, VLNEXT, VEOLF2): Move to termios-cc.h.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella e5a50db36e termios: Consolidate struct termios
This patch consolidates the struct termios definition on its own header
and adds arch-defined ones for ABIs that deviate from generic
implementation. They are:

  - alpha which has a slight different layout than generic one (c_cc
    field is defined prior c_line).

  - sparc and mips which do not have the c_ispeed/c_ospeed fields.

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h: New file.
	* sysdeps/unix/sysv/linux/bits/termios-struct.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios-struct.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h: Likewise.
	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	termios-struct.h.
	* sysdeps/unix/sysv/linux/bits/termios.h (struct termios): Move to
	termios-struct.h.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h (struct termios):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h (struct termios):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h (struct termios):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h (struct termios):
	Likewise.
	* sysdeps/unix/sysv/linux/kernel_termios.h (_HAVE_C_ISPEED,
	_HAVE_C_OSPEED): Define.
	* sysdeps/unix/sysv/linux/mips/kernel_termios.h (_HAVE_C_ISPEED,
	_HAVE_C_OSPEED): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel_termios.h (_HAVE_C_ISPEED,
	_HAVE_C_OSPEED): Likewise.
	* sysdeps/unix/sysv/linux/speed.c [_HAVE_STRUCT_TERMIOS_C_OSPEED]
	(cfsetospeed): Check for define value instead of existence.
	[_HAVE_STRUCT_TERMIOS_C_ISPEED] (cfsetispeed): Likewise.
	* sysdeps/unix/sysv/linux/tcgetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
	&& _HAVE_C_ISPEED] (__tcgetattr): Likewise.
	* sysdeps/unix/sysv/linux/tcsetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
	&& _HAVE_C_ISPEED] (__tcsetattr): Likewise.
2019-01-03 09:32:12 -02:00
Adhemerval Zanella 8083afa55d termios: Define TIOCSER_TEMT with __USE_MISC (BZ#17783)
This patch defines TIOCSER_TEMT on all architectures using the __USE_MISC
guards similar to BZ#17782 fix.  Latest Linux UAPI defines TIOCSER_TEMT
with the same value for all architectures, so it is safe to use the value
as default for all ABIs.

Checked on x86_64linux-gnu and build against sparc64-linux-gnu and
powerpc64le-linux-gnu.

	[BZ #17783]
	* sysdeps/unix/sysv/linux/bits/termios.h [__USE_MISC] (TIOCSER_TEMT):
	Define.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]
	(TIOCSER_TEMT): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_MISC]
	(TEOCSER_TEMT): Likewise.
2019-01-03 09:32:12 -02:00
Joseph Myers 04277e02d7 Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2019-01-01 00:11:28 +00:00
Albert ARIBAUD (3ADEV) a27a4f4721 Y2038: provide size of default time_t for target architecture
To determine whether the default time_t interfaces are 32-bit
    and so need conversions, or are 64-bit and so are compatible
    with the internal 64-bit type without conversions, a macro
    giving the size of the  default time_t is also required.
    This macro is called __TIMESIZE.

    This macro can then be used instead of __WORDSIZE in msq-pad.h
    and shm-pad.h files, which in turn allows removing their x86
    variants, and in sem-pad.h files but keeping the x86 variant.

    This patch was tested by running 'make check' on branch master
    then applying this patch and running 'make check' again, and
    checking that both 'make check' yield identical results.
    This was done on x86_64-linux-gnu and i686-linux-gnu.

	* bits/timesize.h: New file.
	* stdlib/Makefile (headers): Add bits/timesize.h.
	* sysdeps/unix/sysv/linux/bits/msq-pad.h
	(__MSQ_PAD_AFTER_TIME): Use __TIMESIZE instead of __WORDSIZE.
	* sysdeps/unix/sysv/linux/bits/sem-pad.h
	(__SEM_PAD_AFTER_TIME): Likewise.
	* sysdeps/unix/sysv/linux/bits/shm-pad.h
	(__SHM_PAD_AFTER_TIME): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/msq-pad.h
	(__MSQ_PAD_BEFORE_TIME): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/sem-pad.h
	(__SEM_PAD_BEFORE_TIME): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/shm-pad.h
	(__SHM_PAD_BEFORE_TIME, __SHM_PAD_BETWEEN_TIME_AND_SEGSZ): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/msq-pad.h
        (__MSQ_PAD_AFTER_TIME, __MSQ_PAD_BEFORE_TIME): Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/msq-pad.h
        (__MSQ_PAD_BEFORE_TIME): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/sem-pad.h
	(__SEM_PAD_BEFORE_TIME): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/shm-pad.h
	(__SHM_PAD_BEFORE_TIME, __SHM_PAD_BETWEEN_TIME_AND_SEGSZ): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/msq-pad.h
	(__MSQ_PAD_BEFORE_TIME): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sem-pad.h
	(__SEM_PAD_BEFORE_TIME): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/shm-pad.h
	(__SHM_PAD_BEFORE_TIME): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/msq-pad.h: Delete file.
	* sysdeps/unix/sysv/linux/x86/bits/shm-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/timesize.h: New file.
2018-10-24 11:37:09 +02:00
Joseph Myers 729f34028a Use single bits/shm.h for all architectures.
After my patch to move SHMLBA to its own header, the bits/shm.h
headers for architectures using the Linux kernel still vary in a few
ways: the use of __syscall_ulong_t; whether padding for 32-bit systems
is present before or after time fields, or missing altogether (mips,
x32); whether shm_segsz is before or after the time fields; whether,
if after time fields, there is extra padding before shm_segsz.

This patch arranges for a single header to be used.  __syscall_ulong_t
is safe to use everywhere, while bits/shm-pad.h is added with new
macros __SHM_PAD_AFTER_TIME, __SHM_PAD_BEFORE_TIME,
__SHM_SEGSZ_AFTER_TIME and __SHM_PAD_BETWEEN_TIME_AND_SEGSZ to
describe the differences.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	bits/shm-pad.h.
	* sysdeps/unix/sysv/linux/bits/shm.h: Include <bits/shm-pad.h>.
	(shmatt_t): Define as __syscall_ulong_t.
	(__SHM_PAD_TIME): New macro, depending on [__SHM_PAD_BEFORE_TIME]
	and [__SHM_PAD_AFTER_TIME].
	(struct shmid_ds): Define time fields using __SHM_PAD_TIME.
	Define shm_segsz and associated padding based on
	[__SHM_SEGSZ_AFTER_TIME] and [__SHM_PAD_BETWEEN_TIME_AND_SEGSZ].
	Use __syscall_ulong_t instead of unsigned long int.
	[__USE_MISC] (struct shminfo): Use __syscall_ulong_t instead of
	unsigned long int.
	[__USE_MISC] (struct shm_info): Likewise.
	* sysdeps/unix/sysv/linux/bits/shm-pad.h: New file.
	* sysdeps/unix/sysv/linux/hppa/bits/shm-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/shm-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/shm-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/shm-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/shm-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/shm.h: Remove.
	* sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/shm.h: Likewise.
2018-10-17 11:56:28 +00:00
Joseph Myers 8c8d2a8aff Move SHMLBA to its own header.
One difference between bits/shm.h headers for architectures using the
Linux kernel is the definition of SHMLBA.  This was noted in
<https://sourceware.org/ml/libc-alpha/2018-09/msg00175.html> as a
reason why even a new architecture (C-SKY) might need its own
bits/shm.h; thus, splitting it out of bits/shm.h can allow less
duplication of headers for new architectures.

This patch moves that definition to its own header, bits/shmlba.h, to
allow more sharing of headers between architectures.  That move allows
the arm, ia64 and sh variants of bits/shm.h to be removed, as they had
no other significant differences from the generic bits/shm.h; powerpc
and x86 have their own bits/shm.h but do not need to get their own
bits/shmlba.h because they use the same SHMLBA as the generic header.
Other architectures with their own bits/shm.h get their own
bits/shmlba.h without being able to remove their own bits/shm.h until
the generic one has been adapted to be able to handle more
architectures (where, in addition to the differences seen for
bits/msq.h and bits/sem.h, the position of shm_segsz in struct
shmid_ds also depends on the architecture).

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	bits/shmlba.h.
	* sysdeps/unix/sysv/linux/bits/shm.h: Include <bits/shmlba.h>.
	(SHMLBA): Remove macro.
	(__getpagesize): Remove function declaration.
	* sysdeps/unix/sysv/linux/hppa/bits/shm.h: Include
	<bits/shmlba.h>.
	(SHMLBA): Remove macro.
	* sysdeps/unix/sysv/linux/mips/bits/shm.h: Include
	<bits/shmlba.h>.
	(SHMLBA): Remove macro.
	* sysdeps/unix/sysv/linux/powerpc/bits/shm.h: Include
	<bits/shmlba.h>.
	(SHMLBA): Remove macro.
	(__getpagesize): Remove function declaration.
	* sysdeps/unix/sysv/linux/sparc/bits/shm.h: Include
	<bits/shmlba.h>.
	(SHMLBA): Remove macro.
	(__getshmlba): Remove function declaration.
	* sysdeps/unix/sysv/linux/x86/bits/shm.h: Include <bits/shmlba.h>.
	(SHMLBA): Remove macro.
	(__getpagesize): Remove function declaration.
	* sysdeps/unix/sysv/linux/arm/bits/shm.h: Remove file.
	* sysdeps/unix/sysv/linux/ia64/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/shmlba.h: New file.
	* sysdeps/unix/sysv/linux/arm/bits/shmlba.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/shmlba.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/shmlba.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/shmlba.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/shmlba.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/shmlba.h: Likewise.
2018-10-17 11:55:10 +00:00
Joseph Myers bcdb1bfa0c Use single bits/sem.h for all architectures.
The bits/sem.h headers for architectures using the Linux kernel vary
in a few ways:

* x32 uses __syscall_ulong_t instead of unsigned long int.

* The x86 header uses padding after time fields unconditionally
  (including for both x86_64 ABIs), not just for 32-bit time (unlike
  in msqid_ds where there is only padding for 32-bit time).  Because
  this padding is present for x32, and is __syscall_ulong_t there, it
  does have to be __syscall_ulong_t, not unsigned long int.

* The MIPS header never uses padding around time fields, even when
  32-bit (unlike in msqid_ds where it has endian-dependent padding for
  32-bit time).

* Some older 32-bit big-endian architectures have padding before
  rather than after time fields, although the preferred generic
  approach is padding after the time fields independent of endianness.

(There are also insubstantial differences such as use of unsigned int
for padding instead of unsigned long int, which makes no difference to
layout since the padding fields using unsigned int are only present on
32-bit architectures.)

For the first, __syscall_ulong_t can be used in the generic version as
it's the same as unsigned long int everywhere except x32.  For the
other differences, this patch adds macros __SEM_PAD_BEFORE_TIME and
__SEM_PAD_AFTER_TIME in a new bits/sem-pad.h header, so that header is
the only one needing to be provided on architectures with differences
in this area, and everything else can go in a single common bits/sem.h
header.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	bits/sem-pad.h.
	* sysdeps/unix/sysv/linux/bits/sem.h: Include <bits/sem-pad.h>
	instead of <bits/wordsize.h>.
	(__SEM_PAD_TIME): New macro, depending on [__SEM_PAD_BEFORE_TIME]
	and [__SEM_PAD_AFTER_TIME].
	(struct semid_ds): Define time fields using __SEM_PAD_TIME.  Use
	__syscall_ulong_t instead of unsigned long int.
	* sysdeps/unix/sysv/linux/bits/sem-pad.h: New file.
	* sysdeps/unix/sysv/linux/hppa/bits/sem-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sem-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/sem-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sem-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/sem-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/sem.h: Remove.
	* sysdeps/unix/sysv/linux/mips/bits/sem.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/sem.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sem.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/sem.h: Likewise.
2018-10-15 19:28:04 +00:00
Joseph Myers 9f9feb6d5d Use single bits/msq.h for all architectures.
The bits/msq.h headers for architectures using the Linux kernel vary
in a few ways:

* x32 uses __syscall_ulong_t instead of unsigned long int.

* x32 has 64-bit time_t, so no padding around time fields despite
  __WORDSIZE == 32.

* Some older 32-bit big-endian architectures have padding before
  rather than after time fields, although the preferred generic
  approach is padding after the time fields independent of endianness.

(There are also insubstantial differences such as use of unsigned int
for padding instead of unsigned long int, which makes no difference to
layout since the padding fields using unsigned int are only present on
32-bit architectures.)

For the first, __syscall_ulong_t can be used in the generic version as
it's the same as unsigned long int everywhere except x32.  For the
other two differences, this patch adds macros __MSQ_PAD_BEFORE_TIME
and __MSQ_PAD_AFTER_TIME in a new bits/msq-pad.h header, so that
header is the only one needing to be provided on architectures with
differences in this area, and everything else can go in a single
common bits/msq.h header.  Once we have __TIMESIZE, the generic
bits/msq-pad.h can change to use that instead of __WORDSIZE, at which
point the x86 version of bits/msq-pad.h won't be needed either.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	bits/msq-pad.h.
	* sysdeps/unix/sysv/linux/bits/msq.h: Include <bits/msq-pad.h>
	instead of <bits/wordsize.h>.
	(msgqnum_t): Define as __syscall_ulong_t.
	(msglen_t): Likewise.
	(__MSQ_PAD_TIME): New macro, depending on [__MSQ_PAD_BEFORE_TIME]
	and [__MSQ_PAD_AFTER_TIME].
	(struct msqid_ds): Define time fields using __MSQ_PAD_TIME.  Use
	__syscall_ulong_t instead of unsigned long int.
	* sysdeps/unix/sysv/linux/bits/msq-pad.h: New file.
	* sysdeps/unix/sysv/linux/hppa/bits/msq-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/msq-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/msq-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/msq-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/msq-pad.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/msq.h: Remove.
	* sysdeps/unix/sysv/linux/mips/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/msq.h: Likewise.
2018-10-11 12:07:27 +00:00
Joseph Myers 8ea4d2b7d1 Unify some sys/procfs.h headers.
As per recent discussions, this patch unifies some of the sys/procfs.h
headers for architectures using the Linux kernel, producing a generic
version that can hopefully be used by all new architectures as well.

The new generic version is based on the AArch64 one.  The register
definitions, the only part that generally needs to vary by
architecture, go in a new bits/procfs.h header (which each
architecture using the generic version needs to provide); that header
also has any #includes that were in the architecture-specific
sys/procfs.h, where those includes went beyond the generic set.

The generic version is used for eight architectures where the generic
definitions were the same as the architecture-specific ones.  (Some of
those architectures had #if 0 fields, now removed; some defined types
or fields using different type names which were typedefs for the same
underlying types.)

Six of the remaining architectures with their own sys/procfs.h use
unsigned short for pr_uid / pr_gid in some cases; moving those to the
generic header will require a bits/ header to define a typedef for the
type of those fields.  In the case of alpha, the generic sys/procfs.h
uses elf_gregset_t (= unsigned long int[33]) to define prgregset_t and
elf_fpregset_t (= double[32]) to define prfpregset_t, but the alpha
version uses gregset_t (= long int[33]) and fpregset_t (= long
int[32]), so avoiding unnecessarily changing the underlying types (and
thus C++ name mangling) again means a bits/ header will need to be
able to define a different choice for those typedefs.

bits/procfs.h is included outside the __BEGIN_DECLS / __END_DECLS pair
(whereas the definitions it contains were previously inside that pair
in various sys/procfs.h headers), because it sometimes includes other
headers and putting those other #includes inside that pair seems
risky.  Because none of the declarations in bits/procfs.h are of
functions or variables or involve function types, I don't think it
makes any difference whether they are inside or outside an extern "C"
context.

Tested with build-many-glibcs.py (again, that does not provide much
validation for the correctness of this patch).

	* sysdeps/unix/sysv/linux/sys/procfs.h: Replace with file based on
	AArch64 version.  Include <bits/procfs.h>.
	* sysdeps/unix/sysv/linux/Makefile [$(subdir) = misc]
	(sysdep_headers): Add bits/procfs.h.
	* sysdeps/unix/sysv/linux/bits/procfs.h: New file.
	* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/riscv/bits/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sys/procfs.h: Remove file.
	* sysdeps/unix/sysv/linux/hppa/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/riscv/sys/procfs.h: Likewise.
2018-09-25 16:48:15 +00:00
Joseph Myers f2857da7cd Add SHM_STAT_ANY from Linux 4.17 to bits/shm.h.
Linux 4.17 adds a SHM_STAT_ANY constant (ipcs command).  This patch
adds it to the relevant bits/shm.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/alpha/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): New macro.
	* sysdeps/unix/sysv/linux/arm/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/shm.h [__USE_MISC]
	(SHM_STAT_ANY): Likewise.
2018-06-18 13:37:57 +00:00
Joseph Myers 176c7fee51 Add SEM_STAT_ANY from Linux 4.17 to bits/sem.h.
Linux 4.17 adds a SEM_STAT_ANY constant (ipcs command).  This patch
adds it to the relevant bits/sem.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/alpha/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): New macro.
	* sysdeps/unix/sysv/linux/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/sem.h [__USE_MISC]
	(SEM_STAT_ANY): Likewise.
2018-06-18 13:36:41 +00:00
Joseph Myers 86bf0019ed Add MSG_STAT_ANY from Linux 4.17 to bits/msq.h.
Linux 4.17 adds a MSG_STAT_ANY constant (ipcs command).  This patch
adds it to the relevant bits/msq.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/alpha/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): New macro.
	* sysdeps/unix/sysv/linux/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/msq.h [__USE_MISC]
	(MSG_STAT_ANY): Likewise.
2018-06-18 13:34:52 +00:00
Joseph Myers bef1cbf4da Add MAP_FIXED_NOREPLACE from Linux 4.17 to bits/mman.h.
Linux 4.17 adds MAP_FIXED_NOREPLACE (value 0x100000 on most
architectures, 0x200000 on alpha).  This patch adds that macro to
glibc's bits/mman.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/aarch64/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): New macro.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/arm/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/nios2/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/riscv/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
2018-06-05 11:04:46 +00:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Joseph Myers 0bcec5321f Split up bits/sigstack.h.
bits/sigstack.h contains four things: the legacy struct sigstack type,
the preferred stack_t type, the SS_* enum values and macros for signal
stack sizes.

These vary in different ways between glibc configurations; in
particular, the stack sizes vary much more than any of the other
pieces.  Furthermore, these pieces have different standard namespace
rules for when they should be visible (not currently visible in
conform/ results both because the relevant tests are XFAILed for
sys/ucontext.h namespace issues, and because some of the expectations
are incorrect in the same way as the headers, e.g. neither
expectations nor headers reflect that current POSIX no longer has
either the sigstack function or the sigstack structure).

To reduce duplication of identical definitions, and facilitate
namespace fixes without requiring the same feature test macro
conditions to be repeated in many versions of the same header, this
patch splits bits/sigstack.h up into four headers.  It keeps the stack
size macros, while new bits/types/struct_sigstack.h,
bits/types/stack_t.h and bits/ss_flags.h are added for the other
pieces.  bits/types/struct_sigstack.h is the same everywhere,
bits/types/stack_t.h has three variants different in the order of the
structure elements (generic = MIPS Linux, and other Linux), and
bits/ss_flags.h has generic and Linux variants.

This patch includes the new headers everywhere that included
<bits/sigstack.h>, so should cause no difference to what any public
header defines.  Subsequent namespace fixes would then remove or
condition some of those includes.

There should be no conflicts with Zack's changes to signal.h types,
beyond the trivial conflict of both making additions to
signal/Makefile's headers list; the two patches affect disjoint sets
of types and other definitions.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* bits/ss_flags.h: New file.
	* bits/types/stack_t.h: Likewise.
	* include/bits/types/struct_sigstack.h: Likewise.
	* signal/bits/types/struct_sigstack.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ss_flags.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/types/stack_t.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h: Likewise.
	* signal/Makefile (headers): Add bits/types/struct_sigstack.h,
	bits/types/stack_t.h and bits/ss_flags.h.
	* signal/signal.h [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8]:
	Include <bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and
	<bits/ss_flags.h>.
	* bits/sigstack.h (struct sigstack): Remove.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
	(struct sigstack): Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigstack.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
	(struct sigstack): Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/arm/sys/ucontext.h: Include
	<bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and
	<bits/ss_flags.h>.
	* sysdeps/generic/sys/ucontext.h: Likewise.
	* sysdeps/i386/sys/ucontext.h: Likewise.
	* sysdeps/m68k/sys/ucontext.h: Likewise.
	* sysdeps/mips/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Likewise.
2017-05-19 20:35:07 +00:00
Adhemerval Zanella 38efe8c5a5 Consolidate pthreadtype.h placementConsolidate pthreadtype.h placement
This patch moves all arch specific pthreadtypes.h to a similar path
for all architectures (sysdeps/unix/sysv/<arch>/bits).  No functional
or build change is expected.  The idea is mainly to organize the
header placement for all architectures.

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,
m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).

	* sysdeps/unix/sysv/linux/x86/Implies: New file.
	* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Move to ...
	* sysdeps/alpha/nptl/bits/pthreadtypes.h: ... here.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Move to ...
	* sysdeps/powerpc/nptl/bits/pthreadtypes.h: ... here.
	* sysdeps/x86/bits/pthreadtypes.h: Move to ...
	* sysdeps/x86/nptl/bits/pthreadtypes.h: ... here.
2017-04-10 17:33:10 -03:00
Torvald Riegel cc25c8b4c1 New pthread rwlock that is more scalable.
This replaces the pthread rwlock with a new implementation that uses a
more scalable algorithm (primarily through not using a critical section
anymore to make state changes).  The fast path for rdlock acquisition and
release is now basically a single atomic read-modify write or CAS and a few
branches.  See nptl/pthread_rwlock_common.c for details.

	* nptl/DESIGN-rwlock.txt: Remove.
	* nptl/lowlevelrwlock.sym: Remove.
	* nptl/Makefile: Add new tests.
	* nptl/pthread_rwlock_common.c: New file.  Contains the new rwlock.
	* nptl/pthreadP.h (PTHREAD_RWLOCK_PREFER_READER_P): Remove.
	(PTHREAD_RWLOCK_WRPHASE, PTHREAD_RWLOCK_WRLOCKED,
	PTHREAD_RWLOCK_RWAITING, PTHREAD_RWLOCK_READER_SHIFT,
	PTHREAD_RWLOCK_READER_OVERFLOW, PTHREAD_RWLOCK_WRHANDOVER,
	PTHREAD_RWLOCK_FUTEX_USED): New.
	* nptl/pthread_rwlock_init.c (__pthread_rwlock_init): Adapt to new
	implementation.
	* nptl/pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock_slow): Remove.
	(__pthread_rwlock_rdlock): Adapt.
	* nptl/pthread_rwlock_timedrdlock.c
	(pthread_rwlock_timedrdlock): Adapt.
	* nptl/pthread_rwlock_timedwrlock.c
	(pthread_rwlock_timedwrlock): Adapt.
	* nptl/pthread_rwlock_trywrlock.c (pthread_rwlock_trywrlock): Adapt.
	* nptl/pthread_rwlock_tryrdlock.c (pthread_rwlock_tryrdlock): Adapt.
	* nptl/pthread_rwlock_unlock.c (pthread_rwlock_unlock): Adapt.
	* nptl/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock_slow): Remove.
	(__pthread_rwlock_wrlock): Adapt.
	* nptl/tst-rwlock10.c: Adapt.
	* nptl/tst-rwlock11.c: Adapt.
	* nptl/tst-rwlock17.c: New file.
	* nptl/tst-rwlock18.c: New file.
	* nptl/tst-rwlock19.c: New file.
	* nptl/tst-rwlock2b.c: New file.
	* nptl/tst-rwlock8.c: Adapt.
	* nptl/tst-rwlock9.c: Adapt.
	* sysdeps/aarch64/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/arm/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/hppa/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/ia64/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/m68k/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/microblaze/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/mips/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/nios2/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/s390/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/sh/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/sparc/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/tile/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
	(pthread_rwlock_t): Adapt.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
	(pthread_rwlock_t): Adapt.
	* sysdeps/x86/bits/pthreadtypes.h (pthread_rwlock_t): Adapt.
	* nptl/nptl-printers.py (): Adapt.
	* nptl/nptl_lock_constants.pysym: Adapt.
	* nptl/test-rwlock-printers.py: Adapt.
	* nptl/test-rwlockattr-printers.c: Adapt.
	* nptl/test-rwlockattr-printers.py: Adapt.
2017-01-10 11:50:17 +01:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Torvald Riegel ed19993b5b New condvar implementation that provides stronger ordering guarantees.
This is a new implementation for condition variables, required
after http://austingroupbugs.net/view.php?id=609 to fix bug 13165.  In
essence, we need to be stricter in which waiters a signal or broadcast
is required to wake up; this couldn't be solved using the old algorithm.
ISO C++ made a similar clarification, so this also fixes a bug in
current libstdc++, for example.

We can't use the old algorithm anymore because futexes do not guarantee
to wake in FIFO order.  Thus, when we wake, we can't simply let any
waiter grab a signal, but we need to ensure that one of the waiters
happening before the signal is woken up.  This is something the previous
algorithm violated (see bug 13165).

There's another issue specific to condvars: ABA issues on the underlying
futexes.  Unlike mutexes that have just three states, or semaphores that
have no tokens or a limited number of them, the state of a condvar is
the *order* of the waiters.  A waiter on a semaphore can grab a token
whenever one is available; a condvar waiter must only consume a signal
if it is eligible to do so as determined by the relative order of the
waiter and the signal.
Therefore, this new algorithm maintains two groups of waiters: Those
eligible to consume signals (G1), and those that have to wait until
previous waiters have consumed signals (G2).  Once G1 is empty, G2
becomes the new G1.  64b counters are used to avoid ABA issues.

This condvar doesn't yet use a requeue optimization (ie, on a broadcast,
waking just one thread and requeueing all others on the futex of the
mutex supplied by the program).  I don't think doing the requeue is
necessarily the right approach (but I haven't done real measurements
yet):
* If a program expects to wake many threads at the same time and make
that scalable, a condvar isn't great anyway because of how it requires
waiters to operate mutually exclusive (due to the mutex usage).  Thus, a
thundering herd problem is a scalability problem with or without the
optimization.  Using something like a semaphore might be more
appropriate in such a case.
* The scalability problem is actually at the mutex side; the condvar
could help (and it tries to with the requeue optimization), but it
should be the mutex who decides how that is done, and whether it is done
at all.
* Forcing all but one waiter into the kernel-side wait queue of the
mutex prevents/avoids the use of lock elision on the mutex.  Thus, it
prevents the only cure against the underlying scalability problem
inherent to condvars.
* If condvars use short critical sections (ie, hold the mutex just to
check a binary flag or such), which they should do ideally, then forcing
all those waiter to proceed serially with kernel-based hand-off (ie,
futex ops in the mutex' contended state, via the futex wait queues) will
be less efficient than just letting a scalable mutex implementation take
care of it.  Our current mutex impl doesn't employ spinning at all, but
if critical sections are short, spinning can be much better.
* Doing the requeue stuff requires all waiters to always drive the mutex
into the contended state.  This leads to each waiter having to call
futex_wake after lock release, even if this wouldn't be necessary.

	[BZ #13165]
	* nptl/pthread_cond_broadcast.c (__pthread_cond_broadcast): Rewrite to
	use new algorithm.
	* nptl/pthread_cond_destroy.c (__pthread_cond_destroy): Likewise.
	* nptl/pthread_cond_init.c (__pthread_cond_init): Likewise.
	* nptl/pthread_cond_signal.c (__pthread_cond_signal): Likewise.
	* nptl/pthread_cond_wait.c (__pthread_cond_wait): Likewise.
	(__pthread_cond_timedwait): Move here from pthread_cond_timedwait.c.
	(__condvar_confirm_wakeup, __condvar_cancel_waiting,
	__condvar_cleanup_waiting, __condvar_dec_grefs,
	__pthread_cond_wait_common): New.
	(__condvar_cleanup): Remove.
	* npt/pthread_condattr_getclock.c (pthread_condattr_getclock): Adapt.
	* npt/pthread_condattr_setclock.c (pthread_condattr_setclock):
	Likewise.
	* npt/pthread_condattr_getpshared.c (pthread_condattr_getpshared):
	Likewise.
	* npt/pthread_condattr_init.c (pthread_condattr_init): Likewise.
	* nptl/tst-cond1.c: Add comment.
	* nptl/tst-cond20.c (do_test): Adapt.
	* nptl/tst-cond22.c (do_test): Likewise.
	* sysdeps/aarch64/nptl/bits/pthreadtypes.h (pthread_cond_t): Adapt
	structure.
	* sysdeps/arm/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/ia64/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/m68k/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/microblaze/nptl/bits/pthreadtypes.h (pthread_cond_t):
	Likewise.
	* sysdeps/mips/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/nios2/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/s390/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/sh/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/tile/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_cond_t):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h (pthread_cond_t):
	Likewise.
	* sysdeps/x86/bits/pthreadtypes.h (pthread_cond_t): Likewise.
	* sysdeps/nptl/internaltypes.h (COND_NWAITERS_SHIFT): Remove.
	(COND_CLOCK_BITS): Adapt.
	* sysdeps/nptl/pthread.h (PTHREAD_COND_INITIALIZER): Adapt.
	* nptl/pthreadP.h (__PTHREAD_COND_CLOCK_MONOTONIC_MASK,
	__PTHREAD_COND_SHARED_MASK): New.
	* nptl/nptl-printers.py (CLOCK_IDS): Remove.
	(ConditionVariablePrinter, ConditionVariableAttributesPrinter): Adapt.
	* nptl/nptl_lock_constants.pysym: Adapt.
	* nptl/test-cond-printers.py: Adapt.
	* sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear,
	cond_compat_check_and_clear): Adapt.
	* sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c: Remove file ...
	* sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c
	(__pthread_cond_timedwait): ... and move here.
	* nptl/DESIGN-condvar.txt: Remove file.
	* nptl/lowlevelcond.sym: Likewise.
	* nptl/pthread_cond_timedwait.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
2016-12-31 14:56:47 +01:00
Joseph Myers 0acb8a2a85 Refactor long double information into bits/long-double.h.
Information about whether the ABI of long double is the same as that
of double is split between bits/mathdef.h and bits/wordsize.h.

When the ABIs are the same, bits/mathdef.h defines
__NO_LONG_DOUBLE_MATH.  In addition, in the case where the same glibc
binary supports both -mlong-double-64 and -mlong-double-128,
bits/wordsize.h defines __LONG_DOUBLE_MATH_OPTIONAL, along with
__NO_LONG_DOUBLE_MATH if this particular compilation is with
-mlong-double-64.

As part of the refactoring I proposed in
<https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>, this
patch puts all that information in a single header,
bits/long-double.h.  It is included from sys/cdefs.h alongside the
include of bits/wordsize.h, so other headers generally do not need to
include bits/long-double.h directly.

Previously, various bits/mathdef.h headers and bits/wordsize.h headers
had this long double information (including implicitly in some
bits/mathdef.h headers through not having the defines present in the
default version).  After the patch, it's all in six bits/long-double.h
headers.  Furthermore, most of those new headers are not
architecture-specific.  Architectures with optional long double all
use the ldbl-opt sysdeps directory, either in the order (ldbl-64-128,
ldbl-opt, ldbl-128) or (ldbl-128ibm, ldbl-opt).  Thus a generic header
for the case where long double = double, and headers in ldbl-128,
ldbl-96 and ldbl-opt, suffices to cover every architecture except for
cases where long double properties vary between different ABIs sharing
a set of installed headers; fortunately all the ldbl-opt cases share a
single compiler-predefined macro __LONG_DOUBLE_128__ that can be used
to tell whether this compilation is -mlong-double-64 or
-mlong-double-128.

The two cases where a set of headers is shared between ABIs with
different long double properties, MIPS (o32 has long double = double,
other ABIs use ldbl-128) and SPARC (32-bit has optional long double,
64-bit has required long double), need their own bits/long-double.h
headers.

As with bits/wordsize.h, multiple-include protection for this header
is generally implicit through the include guards on sys/cdefs.h, and
multiple inclusion is harmless in any case.  There is one subtlety:
the header must not define __LONG_DOUBLE_MATH_OPTIONAL if
__NO_LONG_DOUBLE_MATH was defined before its inclusion, because doing
so breaks how sysdeps/ieee754/ldbl-opt/nldbl-compat.h defines
__NO_LONG_DOUBLE_MATH itself before including system headers.  Subject
to keeping that working, it would be reasonable to move these macros
from defined/undefined #ifdef to always-defined 1/0 #if semantics, but
this patch does not attempt to do so, just rearranges where the macros
are defined.

After this patch, the only use of bits/mathdef.h is the alpha one for
modifying complex function ABIs for old GCC.  Thus, all versions of
the header other than the default and alpha versions are removed, as
is the include from math.h.

Tested for x86_64 and x86.  Also did compilation-only testing with
build-many-glibcs.py.

	* bits/long-double.h: New file.
	* sysdeps/ieee754/ldbl-128/bits/long-double.h: Likewise.
	* sysdeps/ieee754/ldbl-96/bits/long-double.h: Likewise.
	* sysdeps/ieee754/ldbl-opt/bits/long-double.h: Likewise.
	* sysdeps/mips/bits/long-double.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Likewise.
	* math/Makefile (headers): Add bits/long-double.h.
	* misc/sys/cdefs.h: Include <bits/long-double.h>.
	* stdlib/strtold.c: Include <bits/long-double.h> instead of
	<bits/wordsize.h>.
	* bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion.
	[!__NO_LONG_DOUBLE_MATH]: Remove conditional code.
	* math/math.h: Do not include <bits/mathdef.h>.
	* sysdeps/aarch64/bits/mathdef.h: Remove file.
	* sysdeps/alpha/bits/mathdef.h [!_COMPLEX_H]: Do not allow
	inclusion.
	* sysdeps/ia64/bits/mathdef.h: Remove file.
	* sysdeps/m68k/m680x0/bits/mathdef.h: Likewise.
	* sysdeps/mips/bits/mathdef.h: Likewise.
	* sysdeps/powerpc/bits/mathdef.h: Likewise.
	* sysdeps/s390/bits/mathdef.h: Likewise.
	* sysdeps/sparc/bits/mathdef.h: Likewise.
	* sysdeps/x86/bits/mathdef.h: Likewise.
	* sysdeps/s390/s390-32/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Remove
	conditional code.
	* sysdeps/s390/s390-64/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
2016-12-14 18:27:56 +00:00
Florian Weimer c74940f2a7 nptl: Document the reason why __kind in pthread_mutex_t is part of the ABI 2016-11-07 20:24:32 +01:00
Steve Ellcey d060cd002d Define wordsize.h macros everywhere
* bits/wordsize.h: Add documentation.
	* sysdeps/aarch64/bits/wordsize.h : New file
	* sysdeps/generic/stdint.h (PTRDIFF_MIN, PTRDIFF_MAX): Update
	definitions.
	(SIZE_MAX): Change ifdef to if in __WORDSIZE32_SIZE_ULONG check.
	* sysdeps/gnu/bits/utmp.h (__WORDSIZE_TIME64_COMPAT32): Check
	with #if instead of #ifdef.
	* sysdeps/gnu/bits/utmpx.h (__WORDSIZE_TIME64_COMPAT32): Ditto.
	* sysdeps/mips/bits/wordsize.h (__WORDSIZE32_SIZE_ULONG,
	__WORDSIZE32_PTRDIFF_LONG, __WORDSIZE_TIME64_COMPAT32):
	Add or change defines.
	* sysdeps/powerpc/powerpc32/bits/wordsize.h: Likewise.
	* sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise.
	* sysdeps/s390/s390-32/bits/wordsize.h: Likewise.
	* sysdeps/s390/s390-64/bits/wordsize.h: Likewise.
	* sysdeps/sparc/sparc32/bits/wordsize.h: Likewise.
	* sysdeps/sparc/sparc64/bits/wordsize.h: Likewise.
	* sysdeps/tile/tilegx/bits/wordsize.h: Likewise.
	* sysdeps/tile/tilepro/bits/wordsize.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/wordsize.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: Likewise.
	* sysdeps/wordsize-32/bits/wordsize.h: Likewise.
	* sysdeps/wordsize-64/bits/wordsize.h: Likewise.
	* sysdeps/x86/bits/wordsize.h: Likewise.
2016-11-04 09:37:44 -07:00
Zack Weinberg c66b29f9cc Installed-header hygiene (BZ#20366): stack_t.
sys/ucontext.h unconditionally uses stack_t, and it does not make
sense to change that.  But signal.h only declares stack_t under
__USE_XOPEN_EXTENDED || __USE_XOPEN2K8.  The actual definition is
already in a bits header, bits/sigstack.h, but that header insists on
only being included by signal.h, so we have to change that as well as
all of the sys/ucontext.h variants.  (Some but not all variants of
bits/sigcontext.h, which sys/ucontext.h may also need, had already
received this adjustment; for consistency, I made them all the same,
even if that's not strictly necessary in some configurations.)
bits/sigcontext.h and bits/sigstack.h also all need to receive
multiple inclusion guards.

	* sysdeps/generic/sys/ucontext.h
	* sysdeps/arm/sys/ucontext.h
	* sysdeps/i386/sys/ucontext.h
	* sysdeps/m68k/sys/ucontext.h
	* sysdeps/mips/sys/ucontext.h
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
	* sysdeps/unix/sysv/linux/ia64/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:
	Include both bits/sigcontext.h and bits/sigstack.h.
	Fix grammar error in comment, if present.

	* bits/sigstack.h
	* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
	* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
	* sysdeps/unix/sysv/linux/bits/sigstack.h
	* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
	* sysdeps/unix/sysv/linux/mips/bits/sigstack.h
	* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
	* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
	* bits/sigcontext.h
	* sysdeps/mach/hurd/i386/bits/sigcontext.h
	* sysdeps/unix/sysv/linux/bits/sigcontext.h
	* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
	* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h:
	Add multiple inclusion guard.  Permit inclusion by sys/ucontext.h
	as well as signal.h, if this was not already allowed.  Request
	definition of size_t if necessary.  Minimize semantically-null
	differences across files.
2016-09-23 08:43:56 -04:00
Joseph Myers fb3227b95c Fix termios.h XCASE namespace (bug 19925).
bits/termios.h (various versions under sysdeps/unix/sysv/linux)
defines XCASE if defined __USE_MISC || defined __USE_XOPEN.  This
macro was removed in the 2001 edition of POSIX, and is not otherwise
reserved, so should not be defined for 2001 and later versions of
POSIX.  This patch fixes the conditions accordingly (leaving the macro
defined for __USE_MISC, so still in the default namespace).

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).

	[BZ #19925]
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h (XCASE): Do not
	define if [!__USE_MISC && __USE_XOPEN2K].
	* sysdeps/unix/sysv/linux/bits/termios.h (XCASE): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h (XCASE): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h (XCASE):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h (XCASE): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/termios.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K8/termios.h/conform): Likewise.
2016-04-08 18:16:09 +00:00
Paul E. Murphy 9200e581e5 Cleanup ppc bits/ipc.h
Ages ago (commit e9dcb08) the ipc syscalls were inlined and
eventually abstracted away any need for direct __ipc calls.
2016-01-25 10:35:21 -02:00
Joseph Myers fb53a27c57 Add new header definitions from Linux 4.4 (plus older ptrace definitions).
This patch adds some new header definitions from Linux 4.4:

* MCL_ONFAULT is added to bits/mman.h / bits/mman-linux.h (this was
  already done for hppa).

* PTRACE_SECCOMP_GET_FILTER is added to sys/ptrace.h.  Along with it,
  the older PTRACE_GETSIGMASK and PTRACE_SETSIGMASK, added in Linux
  3.11 but missed at the time, are also added.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* bits/mman-linux.h [!MCL_CURRENT] (MCL_ONFAULT): New macro.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h (MCL_ONFAULT):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h (MCL_ONFAULT):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/mman.h (MCL_ONFAULT):
	Likewise.
	* sysdeps/unix/sysv/linux/sys/ptrace.h (PTRACE_GETSIGMASK): New
	enum constant and macro.
	(PTRACE_SETSIGMASK): Likewise.
	(PTRACE_SECCOMP_GET_FILTER): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
	(PTRACE_GETSIGMASK): Likewise.
	(PTRACE_SETSIGMASK): Likewise.
	(PTRACE_SECCOMP_GET_FILTER): Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h (PTRACE_GETSIGMASK):
	Likewise.
	(PTRACE_SETSIGMASK): Likewise.
	(PTRACE_SECCOMP_GET_FILTER): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
	(PTRACE_GETSIGMASK): Likewise.
	(PTRACE_SETSIGMASK): Likewise.
	(PTRACE_SECCOMP_GET_FILTER): Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ptrace.h (PTRACE_GETSIGMASK):
	Likewise.
	(PTRACE_SETSIGMASK): Likewise.
	(PTRACE_SECCOMP_GET_FILTER): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h (PTRACE_GETSIGMASK):
	Likewise.
	(PTRACE_SETSIGMASK): Likewise.
	(PTRACE_SECCOMP_GET_FILTER): Likewise.
	* sysdeps/unix/sysv/linux/tile/sys/ptrace.h (PTRACE_GETSIGMASK):
	Likewise.
	(PTRACE_SETSIGMASK): Likewise.
	(PTRACE_SECCOMP_GET_FILTER): Likewise.
2016-01-12 12:42:55 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Adhemerval Zanella 7bf8fb1042 libc-vdso.h place consolidation
This patch moves the libc-vdso.h internal header from bits folder to
default architecture one and also corrects the remaning includes in
the files.
2015-04-20 08:51:17 -03:00
Adhemerval Zanella 4b45943a6f powerpc: Add adaptive elision to rwlocks
This patch adds support for lock elision using ISA 2.07 hardware
transactional memory for rwlocks.  The logic is similar to the
one presented in pthread_mutex lock elision.
2015-01-12 06:30:54 -05:00
Adhemerval Zanella 8d2c0a593b powerpc: Add the lock elision using HTM
This patch adds support for lock elision using ISA 2.07 hardware
transactional memory instructions for pthread_mutex primitives.
Similar to s390 version, the for elision logic defined in
'force-elision.h' is only enabled if ENABLE_LOCK_ELISION is defined.

Also, the lock elision code should be able to be built even with
a compiler that does not provide HTM support with builtins.
However I have noted the performance is sub-optimal due scheduling
pressures.
2015-01-12 06:30:19 -05:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Adhemerval Zanella d4795e4a43 PowerPC: Fix termios definitions
This patch fixes the incorrect guard by __USE_MISC of struct winsize and
struct termio in powerpc termios header.  Current states leads to build
failures if the program defines _XOPEN_SOURCE, but not _DEFAULT_SOURCE
or either _BSD_SOURCE or _SVID_SOURCE.  Without any definition,
__USE_MISC will not be defined and neither the struct definitions.

This patch copies the default Linux ioctl-types.h by adjusting only the
character control field (c_cc) size in struct termio.
2014-08-06 14:31:54 -04:00
Andi Kleen 8491ed6d70 Add adaptive elision to rwlocks
This patch relies on the C version of the rwlocks posted earlier.
With C rwlocks it is very straight forward to do adaptive elision
using TSX. It is based on the infrastructure added earlier
for mutexes, but uses its own elision macros. The macros
are fairly general purpose and could be used for other
elision purposes too.

This version is much cleaner than the earlier assembler based
version, and in particular implements adaptation which makes
it safer.

I changed the behavior slightly to not require any changes
in the test suite and fully conform to all expected
behaviors (generally at the cost of not eliding in
various situations). In particular this means the timedlock
variants are not elided.  Nested trylock aborts.
2014-06-13 13:15:28 -07:00
Adhemerval Zanella c7a8d66787 PowerPC: Move remaining nptl/sysdeps/unix/sysv/linux/powerpc/ files. 2014-05-26 11:45:14 -05:00
Adhemerval Zanella daee7851e2 PowerPC: Move NPTL ABI headers to sysdeps. 2014-05-26 11:41:47 -05:00
Adhemerval Zanella 026b0fe4e7 PowerPC: clean BSD Terminal Modes expectation in termios.h
This patch guard the BSD definition for terminal modes in PowerPC
specific header fixing the following conformance failures:

FAIL: conform/POSIX/termios.h/conform
FAIL: conform/POSIX2008/termios.h/conform
FAIL: conform/UNIX98/termios.h/conform
2014-05-16 15:54:30 -05:00
Joseph Myers acd7f096d7 Complete _BSD_SOURCE / _SVID_source followup cleanup.
This patch completes the headers cleanup consequent on removal of
_BSD_SOURCE and _SVID_SOURCE (apart from any subsequent deprecations):

* #endif conditionals that referred to BSD or SVID are updated.

* Redundant __USE_* tests in cases involving __USE_MISC are removed.
  This includes cases such as __USE_MISC || __USE_ISOC99, where
  __USE_MISC is redundant (because __USE_MISC is only ever defined in
  the default / _DEFAULT_SOURCE / _GNU_SOURCE case, when __USE_ISOC99
  is also defined; the same applies to the non-XSI-extended POSIX
  versions), and cases involving __USE_GNU, where __USE_GNU is
  redundant (because if __USE_GNU is defined, so are the other __USE_*
  macros).  There may well be other cases of __USE_FOO || __USE_BAR
  tests that could be simplified because one macro implies the other;
  this patch only addresses cases involving __USE_MISC.

Tested x86_64.

	* bits/fcntl.h [__USE_MISC]: Remove redundant conditionals.
	* bits/sigaction.h [__USE_MISC]: Likewise.
	* bits/waitstatus.h: Update #endif comments.
	* ctype/ctype.h: Likewise.
	* dirent/dirent.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
	* grp/grp.h: Update #endif comments.
	[__USE_GNU]: Remove redundant conditionals.
	[__USE_MISC]: Likewise.
	* inet/netinet/in.h [__USE_GNU]: Likewise.
	* io/sys/stat.h [__USE_MISC]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_MISC]: Likewise.
	* libio/bits/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* libio/bits/stdio2.h [__USE_MISC]: Likewise.
	* libio/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* math/bits/math-finite.h [__USE_MISC]: Likewise.
	* math/bits/mathcalls.h [__USE_MISC]: Likewise.
	* math/math.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* misc/sys/uio.h: Update #endif comments.
	* posix/bits/unistd.h [__USE_MISC]: Remove redundant conditionals.
	* posix/glob.h [__USE_MISC]: Likewise.
	* posix/sys/types.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/sys/wait.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/unistd.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* pwd/pwd.h [__USE_GNU]: Likewise.
	[__USE_MISC]: Likewise.
	* resolv/netdb.h [__USE_GNU]: Likewise.
	* signal/signal.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* stdlib/stdlib.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	[__USE_GNU]: Likewise.
	* string/bits/string2.h [__USE_MISC]: Likewise.
	* string/string.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h [__USE_MISC]:
	Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_MISC]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Update #endif
	comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/unix/sysv/linux/bits/in.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sigaction.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/bits/socket.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/x86/bits/string.h: Update #endif comments.
	* sysdeps/x86/fpu/bits/mathinline.h [__USE_MISC]: Remove redundant
	conditionals.
	* time/sys/time.h: Update #endif comments.
	* time/time.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
2014-02-21 21:45:26 +00:00
Joseph Myers 498afc54df Combine __USE_BSD and __USE_SVID into __USE_MISC.
This patch cleans up following the obsoletion of _BSD_SOURCE and
_SVID_SOURCE by combining __USE_BSD and __USE_SVID into __USE_MISC.

The only non-mechanical part of this patch is the changes to
features.h; everything else is simple substitution of __USE_MISC for
the old macros.  Thus, this patch leaves obviously redundant
conditionals such as "defined __USE_MISC || defined __USE_MISC", and
does not update #endif comments where they referred to BSD or SVID in
words instead of the literal macro name.  This is intended to
facilitate patch review by separating the less mechanical changes from
these purely mechanical changes into a separate patch.  (I do intend
to integrate all the changes from
<https://sourceware.org/ml/libc-alpha/2013-12/msg00226.html>, which I
believe includes all the trailing comment updates, in subsequent
patches.)

Tested x86_64.

	* include/features.h (__USE_BSD): Remove macro definitions.
	(__USE_SVID): Likewise.
	(_BSD_SOURCE): Likewise.
	(_SVID_SOURCE): Likewise.
	[!defined _BSD_SOURCE && !defined _SVID_SOURCE]: Remove condition
	from definition of _DEFAULT_SOURCE.
	[_BSD_SOURCE || _SVID_SOURCE]: Change condition to
	[_DEFAULT_SOURCE].
	* bits/fcntl.h [__USE_BSD]: Change condition to [__USE_MISC].
	* bits/mman.h [__USE_BSD]: Likewise.
	* bits/termios.h [__USE_BSD]: Likewise.
	* bits/waitstatus.h [__USE_BSD]: Likewise.
	* ctype/ctype.h [__USE_SVID]: Likewise.
	* dirent/dirent.h [__USE_BSD]: Likewise.
	* grp/grp.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* inet/netinet/igmp.h [__USE_BSD]: Likewise.
	* io/fcntl.h [__USE_BSD]: Likewise.
	* io/ftw.h [__USE_BSD]: Likewise.
	* io/sys/stat.h [__USE_BSD]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_BSD]: Likewise.
	* libio/bits/stdio2.h [__USE_BSD]: Likewise.
	* libio/stdio.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* math/math.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* misc/bits/syslog-ldbl.h [__USE_BSD]: Likewise.
	* misc/bits/syslog.h [__USE_BSD]: Likewise.
	* misc/search.h [__USE_SVID]: Likewise.
	* misc/sys/mman.h [__USE_BSD]: Likewise.
	* misc/sys/syslog.h [__USE_BSD]: Likewise.
	* misc/sys/uio.h [__USE_BSD]: Likewise.
	* posix/bits/unistd.h [__USE_BSD]: Likewise.
	* posix/glob.h [__USE_BSD]: Likewise.
	* posix/regex.h [__USE_BSD]: Likewise.
	* posix/sys/types.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/sys/utsname.h [__USE_SVID]: Likewise.
	* posix/sys/wait.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/unistd.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* pwd/pwd.h [__USE_SVID]: Likewise.
	* resolv/netdb.h [__USE_BSD]: Likewise.
	* setjmp/setjmp.h [__USE_BSD]: Likewise.
	* signal/signal.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* socket/sys/socket.h [__USE_BSD]: Likewise.
	* stdlib/fmtmsg.h [__USE_SVID]: Likewise.
	* stdlib/stdlib.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string2.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string3.h [__USE_BSD]: Likewise.
	* string/endian.h [__USE_BSD]: Likewise.
	* string/string.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* string/strings.h [__USE_BSD]: Likewise.
	* sysdeps/generic/netinet/ip.h [__USE_BSD]: Likewise.
	* sysdeps/gnu/netinet/ip_icmp.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/mman-linux.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sys_errlist.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_ether.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_fddi.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_tr.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/x86/bits/string.h [__USE_BSD]: Likewise.
	* sysvipc/sys/ipc.h [__USE_SVID]: Likewise.
	* termios/termios.h [__USE_BSD]: Likewise.
	* time/sys/time.h [__USE_BSD]: Likewise.
	* time/time.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.

	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_BSD]: Change
	condition to [__USE_MISC].
2014-02-12 23:41:01 +00:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Ulrich Weigand 696caf1d00 PowerPC64 ELFv2 ABI 2/6: Remove function descriptors
This patch adds support for the ELFv2 ABI feature to remove function
descriptors.  See this GCC patch for in-depth discussion:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html

This mostly involves two types of changes: updating assembler source
files to the new logic, and updating the dynamic loader.

After the refactoring in the previous patch, most of the assembler source
changes can be handled simply by providing ELFv2 versions of the
macros in sysdep.h.   One somewhat non-obvious change is in __GI__setjmp:
this used to "fall through" to the immediately following __setjmp ENTRY
point.  This is no longer safe in the ELFv2 since ENTRY defines both
a global and a local entry point, and you cannot simply fall through
to a global entry point as it requires r12 to be set up.

Also, makecontext needs to be updated to set up registers according to
the new ABI for calling into the context's start routine.

The dynamic linker changes mostly consist of removing special code
to handle function descriptors.  We also need to support the new PLT
and glink format used by the the ELFv2 linker, see:
https://sourceware.org/ml/binutils/2013-10/msg00376.html

In addition, the dynamic linker now verifies that the dynamic libraries
it loads match its own ABI.

The hack in VDSO_IFUNC_RET to "synthesize" a function descriptor
for vDSO routines is also no longer necessary for ELFv2.
2013-12-04 07:41:38 -06:00
Ondřej Bílka d1d9eaf478 Use __glibc_reserved instead __unused. 2013-11-26 12:32:28 +01:00
Adhemerval Zanella 76a9b99861 PowerPC: Fix vDSO missing ODP entries
This patch fixes the vDSO symbol used directed in IFUNC resolver where
they do not have an associated ODP entry leading to undefined behavior
in some cases. It adds an artificial OPD static entry to such cases
and set its TOC to non 0 to avoid triggering lazy resolutions.
2013-11-08 05:04:25 -06:00