about summary refs log tree commit diff
path: root/resource/Makefile
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-06-19 11:59:19 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-06-19 11:59:19 +0000
commita66bc30d6b19ca6c9c77c0d3750acb18c691705f (patch)
treeecbba69fd496ecfee9324a8478ad5f3d97812bc4 /resource/Makefile
parent5b83faf6a7ca57ef2bfbca2c77992cafc8daa0be (diff)
downloadglibc-a66bc30d6b19ca6c9c77c0d3750acb18c691705f.tar.gz
glibc-a66bc30d6b19ca6c9c77c0d3750acb18c691705f.tar.xz
glibc-a66bc30d6b19ca6c9c77c0d3750acb18c691705f.zip
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>
Diffstat (limited to 'resource/Makefile')
-rw-r--r--resource/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/resource/Makefile b/resource/Makefile
index 8235770737..06bc7a2fb2 100644
--- a/resource/Makefile
+++ b/resource/Makefile
@@ -20,7 +20,7 @@ subdir := resource
 include ../Makeconfig
 
 headers	  := sys/resource.h bits/resource.h sys/vlimit.h sys/vtimes.h	\
-	     ulimit.h
+	     ulimit.h bits/types/struct_rusage.h
 
 routines := getrlimit setrlimit getrlimit64 setrlimit64 getrusage ulimit      \
 	    vlimit vtimes getpriority setpriority nice