glibc/include/bits/types
Joseph Myers a66bc30d6b Define struct rusage in sys/wait.h when required (bug 21575).
Some older standards (XPG4.2 through POSIX.1:2001, XSI only) require
sys/wait.h to include the definition of struct rusage.  This is
missing in glibc.

This patch adds the required definition.  struct rusage is moved to a
new header bits/types/struct_rusage.h to avoid bringing in the whole
of sys/resource.h (although the standards in question do allow the
whole of sys/resource.h to be brought in).  In the five
bits/resource.h headers, the only variation between the definitions of
struct rusage is that the sysdeps/unix/sysv/linux version is prepared
for x32 (by having anonymous unions with __syscall_slong_t fields) and
the others are not.  Thus, this version is suitable for use
generically (everything other than x32 simply has __syscall_slong_t
the same as long int, so there are no API or ABI changes involved, and
anonymous unions are already a required language feature for glibc
headers elsewhere), and this patch uses it as a base for the single
implementation of bits/types/struct_rusage.h.

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

	[BZ #21575]
	* resource/bits/types/struct_rusage.h: New file.
	* include/bits/types/struct_rusage.h: Likewise.
	* bits/resource.h (struct rusage): Include
	<bits/types/struct_rusage.h> instead of defining here.
	* sysdeps/unix/sysv/linux/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/resource.h (struct rusage):
	Likewise.
	* resource/Makefile (headers): Add bits/types/struct_rusage.h.
	* posix/sys/wait.h [__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8]:
	Include <bits/types/struct_rusage.h>
2017-06-19 11:59:19 +00:00
..
FILE.h Remove __need macros from stdio.h and wchar.h. 2017-06-08 13:58:17 -04:00
__FILE.h Remove __need macros from stdio.h and wchar.h. 2017-06-08 13:58:17 -04:00
__mbstate_t.h Remove __need macros from stdio.h and wchar.h. 2017-06-08 13:58:17 -04:00
clock_t.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
clockid_t.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
mbstate_t.h Remove __need macros from stdio.h and wchar.h. 2017-06-08 13:58:17 -04:00
res_state.h Remove __need_list_t and __need_res_state. 2017-05-20 19:01:46 -04:00
sig_atomic_t.h Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
sigset_t.h Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
sigval_t.h Remove __need macros from signal.h. 2017-05-20 19:04:43 -04:00
struct_iovec.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
struct_itimerspec.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
struct_osockaddr.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
struct_rusage.h Define struct rusage in sys/wait.h when required (bug 21575). 2017-06-19 11:59:19 +00:00
struct_sigstack.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
struct_timespec.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
struct_timeval.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
struct_tm.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
time_t.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
timer_t.h Fix include paths in include/bits/types/*.h. 2017-06-07 17:59:50 +00:00
wint_t.h Remove __need macros from stdio.h and wchar.h. 2017-06-08 13:58:17 -04:00