This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Add x86_64/bits/resource.h
On Wed, May 16, 2012 at 12:55 PM, Roland McGrath <roland@hack.frob.com> wrote:
> Using __rlim_t looks like it will be right for everywhere else too.
> Instead of the ugly padding fields, you can just make each one:
>
> ? ? ? ?__extension__ union
> ? ? ? ?{
> ? ? ? ? ?long int ru_maxrss;
> ? ? ? ? ?__syscall_slong_t __ru_maxrss_word;
> ? ? ? ?};
>
> and then having all this in linux/bits/resource.h will be right everywhere
> without duplication.
>
Here is a patch to update RLIM_INFINITY and use anonymous union.
OK to install?
Thanks.
--
H.J.
----
* sysdeps/unix/sysv/linux/bits/resource.h (RLIM_INFINITY): Use
__rlim_t cast.
(rusage): Use anonymous union to pad each field to
__syscall_slong_t.
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h
b/sysdeps/unix/sysv/linux/bits/resource.h
index be852e5..218c87e 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,6 +1,5 @@
/* Bit values & structures for resource limits. Linux version.
- Copyright (C) 1994, 1996-2000, 2004, 2005, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1994-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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. */
#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((unsigned long int)(~0UL))
+# define RLIM_INFINITY ((__rlim_t) -1)
#else
# define RLIM_INFINITY 0xffffffffffffffffuLL
#endif
@@ -187,39 +186,96 @@ struct rusage
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
- long int ru_maxrss;
+ __extension__ union
+ {
+ long int ru_maxrss;
+ __syscall_slong_t __ru_maxrss_word;
+ };
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
- long int ru_ixrss;
+ /* Maximum resident set size (in kilobytes). */
+ __extension__ union
+ {
+ long int ru_ixrss;
+ __syscall_slong_t __ru_ixrss_word;
+ };
/* Amount of data segment memory used (kilobyte-seconds). */
- long int ru_idrss;
+ __extension__ union
+ {
+ long int ru_idrss;
+ __syscall_slong_t __ru_idrss_word;
+ };
/* Amount of stack memory used (kilobyte-seconds). */
- long int ru_isrss;
+ __extension__ union
+ {
+ long int ru_isrss;
+ __syscall_slong_t __ru_isrss_word;
+ };
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
- long int ru_minflt;
+ __extension__ union
+ {
+ long int ru_minflt;
+ __syscall_slong_t __ru_minflt_word;
+ };
/* Number of hard page faults (i.e. those that required I/O). */
- long int ru_majflt;
+ __extension__ union
+ {
+ long int ru_majflt;
+ __syscall_slong_t __ru_majflt_word;
+ };
/* Number of times a process was swapped out of physical memory. */
- long int ru_nswap;
+ __extension__ union
+ {
+ long int ru_nswap;
+ __syscall_slong_t __ru_nswap_word;
+ };
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
- long int ru_inblock;
+ __extension__ union
+ {
+ long int ru_inblock;
+ __syscall_slong_t __ru_inblock_word;
+ };
/* Number of output operations via the file system. */
- long int ru_oublock;
+ __extension__ union
+ {
+ long int ru_oublock;
+ __syscall_slong_t __ru_oublock_word;
+ };
/* Number of IPC messages sent. */
- long int ru_msgsnd;
+ __extension__ union
+ {
+ long int ru_msgsnd;
+ __syscall_slong_t __ru_msgsnd_word;
+ };
/* Number of IPC messages received. */
- long int ru_msgrcv;
+ __extension__ union
+ {
+ long int ru_msgrcv;
+ __syscall_slong_t __ru_msgrcv_word;
+ };
/* Number of signals delivered. */
- long int ru_nsignals;
+ __extension__ union
+ {
+ long int ru_nsignals;
+ __syscall_slong_t __ru_nsignals_word;
+ };
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
- long int ru_nvcsw;
+ __extension__ union
+ {
+ long int ru_nvcsw;
+ __syscall_slong_t __ru_nvcsw_word;
+ };
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
- long int ru_nivcsw;
+ __extension__ union
+ {
+ long int ru_nivcsw;
+ __syscall_slong_t __ru_nivcsw_word;
+ };
};
/* Priority limits. */