www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2013/01/27/10:02:28

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/3jz95xGj3P/IXqjN5xJgjQwWu8IUQaFAL0ioVnp
IWHs2URWfKY2K4
Message-ID: <51054184.8000700@gmx.de>
Date: Sun, 27 Jan 2013 16:02:28 +0100
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
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: typedefing rlim_t
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

While I was trying to port latest sed, I have noted that djgpp's resource.h
does not provide rlim_t.  An inspection of other resource.h files shows that
this typedef should be an unsigned long but djgpp uses long.  I was not able
to figure out why djgpp's implementation uses long.  Anyway a typedef of
rlim_t is required to be able to compile certain sources.

Suggestions concerning this issue are welcome.


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 15:43:56 +0000
@@ -54,13 +54,15 @@ struct rusage {
  #define RLIMIT_NOFILE    8    /* number of open files */

  #define RLIM_NLIMITS    9    /* number of resource limits */
  #define RLIM_INFINITY    ((long) ((1UL << 31) - 1UL))

+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/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}:


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019