tags 627619 + upstream
quit

Hi,

brian m. carlson wrote:

> On amd64, /usr/include/bits/resource.h defines RLIM_NLIMITS as 15.
> However, in /usr/include/asm-generic/resource.h, the kernel defines
> RLIM_NLIMITS as 16 and instead defines RLIMIT_RTTIME as 15.  This
> appears to be part of the reason behind #625226, so fixing it soon would
> be appreciated.

Thanks.  Quick notes:

The file to patch is sysdeps/unix/sysv/linux/bits/resource.h.  It
hasn't been updated upstream, either.  The relevant Linux change was
v2.6.25-rc1~1237^2~29 (sched: SCHED_FIFO/SCHED_RR watchdog timer,
2008-01-25).

I wonder why the enum trick in bits/resource.h is not ported to
Linux so we could just #include <asm/resource.h>?  That would save
alpha, sparc, and mips from having to maintain their own copies of
bits/resource.h.  Lacking that, something like the following might
work.  Untested.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 .../sysdeps/unix/sysv/linux/alpha/bits/resource.h  |    7 ++++++-
 ports/sysdeps/unix/sysv/linux/mips/bits/resource.h |    7 ++++++-
 resource/tst-getrlimit.c                           |    3 +++
 sysdeps/unix/sysv/linux/bits/resource.h            |    7 ++++++-
 sysdeps/unix/sysv/linux/sparc/bits/resource.h      |    7 ++++++-
 5 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/resource.h 
b/ports/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index 92d0199..552bc21 100644
--- a/ports/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -100,7 +100,12 @@ enum __rlimit_resource
   __RLIMIT_RTPRIO = 14,
 #define RLIMIT_RTPRIO __RLIMIT_RTPRIO
 
-  __RLIMIT_NLIMITS = 15,
+  /* Maximum time since last sleep for realtime tasks, in microseconds.
+     Once the soft limit is exceeded, the task will receive SIGXCPU
+     every second.  When the hard limit is exceeded, the task dies.  */
+  __RLIMIT_RTTIME = 15,
+
+  __RLIMIT_NLIMITS = 16,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/ports/sysdeps/unix/sysv/linux/mips/bits/resource.h 
b/ports/sysdeps/unix/sysv/linux/mips/bits/resource.h
index a6454c4..0905eb7 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/bits/resource.h
@@ -100,7 +100,12 @@ enum __rlimit_resource
   __RLIMIT_RTPRIO = 14,
 #define RLIMIT_RTPRIO __RLIMIT_RTPRIO
 
-  __RLIMIT_NLIMITS = 15,
+  /* Maximum time since last sleep for realtime tasks, in microseconds.
+     Once the soft limit is exceeded, the task will receive SIGXCPU
+     every second.  When the hard limit is exceeded, the task dies.  */
+  __RLIMIT_RTTIME = 15,
+
+  __RLIMIT_NLIMITS = 16,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/resource/tst-getrlimit.c b/resource/tst-getrlimit.c
index 6748034..933deff 100644
--- a/resource/tst-getrlimit.c
+++ b/resource/tst-getrlimit.c
@@ -42,6 +42,9 @@ static struct
 #ifdef RLIMIT_RTPRIO
     { "RLIMIT_RTPRIO", RLIMIT_RTPRIO, false }, #endif
+#ifdef RLIMIT_RTTIME
+    { "RLIMIT_RTTIME", RLIMIT_RTTIME, false },
+#endif
   };
 #define ntests (sizeof (tests) / sizeof (tests[0]))
 
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h 
b/sysdeps/unix/sysv/linux/bits/resource.h
index ca2c9f0..36ef4da 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -100,7 +100,12 @@ enum __rlimit_resource
   __RLIMIT_RTPRIO = 14,
 #define RLIMIT_RTPRIO __RLIMIT_RTPRIO
 
-  __RLIMIT_NLIMITS = 15,
+  /* Maximum time since last sleep for realtime tasks, in microseconds.
+     Once the soft limit is exceeded, the task will receive SIGXCPU
+     every second.  When the hard limit is exceeded, the task dies.  */
+  __RLIMIT_RTTIME = 15,
+
+  __RLIMIT_NLIMITS = 16,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h 
b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index 6e4fc97..77a5325 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -100,7 +100,12 @@ enum __rlimit_resource
   __RLIMIT_RTPRIO = 14,
 #define RLIMIT_RTPRIO __RLIMIT_RTPRIO
 
-  __RLIMIT_NLIMITS = 15,
+  /* Maximum time since last sleep for realtime tasks, in microseconds.
+     Once the soft limit is exceeded, the task will receive SIGXCPU
+     every second.  When the hard limit is exceeded, the task dies.  */
+  __RLIMIT_RTTIME = 15,
+
+  __RLIMIT_NLIMITS = 16,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
-- 
1.7.5.1




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to