Pad each field to __syscall_slong_t in struct rusage

This commit is contained in:
H.J. Lu 2012-05-22 05:32:34 -07:00
parent 46259beccc
commit 5e1a27a96d
2 changed files with 85 additions and 17 deletions

View File

@ -1,3 +1,10 @@
2012-05-22 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/unix/sysv/linux/bits/resource.h (RLIM_INFINITY): Use
__rlim_t cast.
(struct rusage): Use anonymous union to pad each field to
__syscall_slong_t.
2012-05-21 David S. Miller <davem@davemloft.net> 2012-05-21 David S. Miller <davem@davemloft.net>
* Makefules (o-iterator): Remove .s cases. * Makefules (o-iterator): Remove .s cases.

View File

@ -1,6 +1,5 @@
/* Bit values & structures for resource limits. Linux version. /* Bit values & structures for resource limits. Linux version.
Copyright (C) 1994, 1996-2000, 2004, 2005, 2008, 2009, 2010, 2011, 2012 Copyright (C) 1994-2012 Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -113,7 +112,7 @@ enum __rlimit_resource
/* Value to indicate that there is no limit. */ /* Value to indicate that there is no limit. */
#ifndef __USE_FILE_OFFSET64 #ifndef __USE_FILE_OFFSET64
# define RLIM_INFINITY ((unsigned long int)(~0UL)) # define RLIM_INFINITY ((__rlim_t) -1)
#else #else
# define RLIM_INFINITY 0xffffffffffffffffuLL # define RLIM_INFINITY 0xffffffffffffffffuLL
#endif #endif
@ -180,6 +179,11 @@ enum __rusage_who
#include <bits/time.h> /* For `struct timeval'. */ #include <bits/time.h> /* For `struct timeval'. */
/* Structure which says how much of each resource has been used. */ /* Structure which says how much of each resource has been used. */
/* The purpose of all the unions is to have the kernel-compatible layout
while keeping the API type as 'long int', and among machines where
__syscall_slong_t is not 'long int', this only does the right thing
for little-endian ones, like x32. */
struct rusage struct rusage
{ {
/* Total amount of user time used. */ /* Total amount of user time used. */
@ -187,39 +191,96 @@ struct rusage
/* Total amount of system time used. */ /* Total amount of system time used. */
struct timeval ru_stime; struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */ /* Maximum resident set size (in kilobytes). */
__extension__ union
{
long int ru_maxrss; long int ru_maxrss;
__syscall_slong_t __ru_maxrss_word;
};
/* Amount of sharing of text segment memory /* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */ with other processes (kilobyte-seconds). */
/* Maximum resident set size (in kilobytes). */
__extension__ union
{
long int ru_ixrss; long int ru_ixrss;
__syscall_slong_t __ru_ixrss_word;
};
/* Amount of data segment memory used (kilobyte-seconds). */ /* Amount of data segment memory used (kilobyte-seconds). */
__extension__ union
{
long int ru_idrss; long int ru_idrss;
__syscall_slong_t __ru_idrss_word;
};
/* Amount of stack memory used (kilobyte-seconds). */ /* Amount of stack memory used (kilobyte-seconds). */
__extension__ union
{
long int ru_isrss; long int ru_isrss;
__syscall_slong_t __ru_isrss_word;
};
/* Number of soft page faults (i.e. those serviced by reclaiming /* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */ a page from the list of pages awaiting reallocation. */
__extension__ union
{
long int ru_minflt; long int ru_minflt;
__syscall_slong_t __ru_minflt_word;
};
/* Number of hard page faults (i.e. those that required I/O). */ /* Number of hard page faults (i.e. those that required I/O). */
__extension__ union
{
long int ru_majflt; long int ru_majflt;
__syscall_slong_t __ru_majflt_word;
};
/* Number of times a process was swapped out of physical memory. */ /* Number of times a process was swapped out of physical memory. */
__extension__ union
{
long int ru_nswap; long int ru_nswap;
__syscall_slong_t __ru_nswap_word;
};
/* Number of input operations via the file system. Note: This /* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */ and `ru_oublock' do not include operations with the cache. */
__extension__ union
{
long int ru_inblock; long int ru_inblock;
__syscall_slong_t __ru_inblock_word;
};
/* Number of output operations via the file system. */ /* Number of output operations via the file system. */
__extension__ union
{
long int ru_oublock; long int ru_oublock;
__syscall_slong_t __ru_oublock_word;
};
/* Number of IPC messages sent. */ /* Number of IPC messages sent. */
__extension__ union
{
long int ru_msgsnd; long int ru_msgsnd;
__syscall_slong_t __ru_msgsnd_word;
};
/* Number of IPC messages received. */ /* Number of IPC messages received. */
__extension__ union
{
long int ru_msgrcv; long int ru_msgrcv;
__syscall_slong_t __ru_msgrcv_word;
};
/* Number of signals delivered. */ /* Number of signals delivered. */
__extension__ union
{
long int ru_nsignals; long int ru_nsignals;
__syscall_slong_t __ru_nsignals_word;
};
/* Number of voluntary context switches, i.e. because the process /* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some gave up the process before it had to (usually to wait for some
resource to be available). */ resource to be available). */
__extension__ union
{
long int ru_nvcsw; long int ru_nvcsw;
__syscall_slong_t __ru_nvcsw_word;
};
/* Number of involuntary context switches, i.e. a higher priority process /* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */ became runnable or the current process used up its time slice. */
__extension__ union
{
long int ru_nivcsw; long int ru_nivcsw;
__syscall_slong_t __ru_nivcsw_word;
};
}; };
/* Priority limits. */ /* Priority limits. */