X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1+x53UtWjSxBxvGLaS0OtIDqRRRkTQZeyGjhJaQ0Z Tx5BkEbJG4jnud Message-ID: <51059281.805@gmx.de> Date: Sun, 27 Jan 2013 21:48:01 +0100 From: Juan Manuel Guerrero User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2 MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: typedefing rlim_t References: <51054184 DOT 8000700 AT gmx DOT de> In-Reply-To: <51054184.8000700@gmx.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com According to http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/resource.h.html on implementations where all resource limits are representable in an object of type rlim_t, RLIM_SAVED_MAX and RLIM_SAVED_CUR need not be distinct from RLIM_INFINITY. I think this is the case in djgpp so I have also added RLIM_SAVED_MAX and RLIM_SAVED_CUR. If nobody objects I will commit the patch below. Regards, Juan M. Guerrero diff -aprNU5 djgpp.orig/include/sys/resource.h djgpp/include/sys/resource.h --- djgpp.orig/include/sys/resource.h 2012-09-23 07:49:18 +0000 +++ djgpp/include/sys/resource.h 2013-01-27 21:21:24 +0000 @@ -1,5 +1,6 @@ +/* Copyright (C) 2013 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #ifndef __dj_include_sys_resource_h_ #define __dj_include_sys_resource_h_ @@ -53,14 +54,18 @@ struct rusage { #define RLIMIT_NPROC 7 /* number of processes */ #define RLIMIT_NOFILE 8 /* number of open files */ #define RLIM_NLIMITS 9 /* number of resource limits */ #define RLIM_INFINITY ((long) ((1UL << 31) - 1UL)) +#define RLIM_SAVED_CUR (RLIM_INFINITY) +#define RLIM_SAVED_MAX (RLIM_INFINITY) + +typedef long rlim_t; struct rlimit { - long rlim_cur; /* current (soft) limit */ - long rlim_max; /* maximum value for rlim_cur */ + rlim_t rlim_cur; /* current (soft) limit */ + rlim_t rlim_max; /* maximum value for rlim_cur */ }; int getrusage(int _who, struct rusage *_rusage); int getrlimit(int _rltype, struct rlimit *_rlimit); int setrlimit(int _rltype, const struct rlimit *_rlimit); diff -aprNU5 djgpp.orig/src/docs/kb/wc204.txi djgpp/src/docs/kb/wc204.txi --- djgpp.orig/src/docs/kb/wc204.txi 2012-12-24 18:04:06 +0000 +++ djgpp/src/docs/kb/wc204.txi 2013-01-27 21:38:30 +0000 @@ -1266,5 +1266,11 @@ of the @acronym{POSIX.1} standard. @findex _doscan AT r{, and @acronym{C99} numeric conversion specifiers} @findex scanf AT r{, and @acronym{C99} numeric conversion specifiers} The @code{%@var{n}$} numeric conversion specifiers are now supported by @code{_doscan} and the @code{scanf} family of functions. + +@tindex rlim_t +@tindex struct rlimit AT r{, and }rlim_t +The type @code{rlim_t} has been added. +@code{rlim_t} is now used for the @code{rlim_cur} and @code{rlim_max} +members of @code{struct rlimit}. diff -aprNU5 djgpp.orig/src/libc/compat/sys/resource/gtrlimit.txh djgpp/src/libc/compat/sys/resource/gtrlimit.txh --- djgpp.orig/src/libc/compat/sys/resource/gtrlimit.txh 2003-02-07 18:13:52 +0000 +++ djgpp/src/libc/compat/sys/resource/gtrlimit.txh 2013-01-27 15:45:42 +0000 @@ -15,12 +15,12 @@ This function gets the resource limit sp stores it in the buffer pointed to by @var{rlimitp}. The @code{rlimit} structure is defined on @file{sys/resource.h} as follows: @example struct rlimit @{ - long rlim_cur; /* current (soft) limit */ - long rlim_max; /* maximum value for rlim_cur */ + rlim_t rlim_cur; /* current (soft) limit */ + rlim_t rlim_max; /* maximum value for rlim_cur */ @}; @end example The following resource types can be passed in @var{rltype}: