Bash's ulimit currently does not support RLIMIT_RTTIME present in the Linux
kernel. If you think such support could be added, please consider using my
patch (in the attachment).

I had some trouble coming up with a string that shows up when invoking
ulimit -a. In the patch, it's "real-time cpu time" which is misleading,
since it suggests that this option is analogous to -t, (cpu time), which it
isn't. There's also a question which letter should be used to denote this
new option.

Please let me know what you think.
milloni
diff --git a/builtins/ulimit.def b/builtins/ulimit.def
index 62def4f..c700ba3 100644
--- a/builtins/ulimit.def
+++ b/builtins/ulimit.def
@@ -23,7 +23,7 @@ $PRODUCES ulimit.c
 $BUILTIN ulimit
 $FUNCTION ulimit_builtin
 $DEPENDS_ON !_MINIX
-$SHORT_DOC ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]
+$SHORT_DOC ulimit [-SHabcdefiklmnpqrstuvxPRT] [limit]
 Modify shell resource limits.
 
 Provides control over the resources available to the shell and processes
@@ -52,6 +52,7 @@ Options:
   -v	the size of virtual memory
   -x	the maximum number of file locks
   -P	the maximum number of pseudoterminals
+  -R	the maximum time a real-time process can run without blocking
   -T	the maximum number of threads
 
 Not all options are available on all platforms.
@@ -234,6 +235,9 @@ static RESOURCE_LIMITS limits[] = {
 #ifdef RLIMIT_NPTS
   { 'P',	RLIMIT_NPTS,  1,	"number of pseudoterminals",	(char *)NULL },
 #endif
+#ifdef RLIMIT_RTTIME
+  { 'R',	RLIMIT_RTTIME,  1,  "real-time cpu time",   "microseconds" },
+#endif
 #ifdef RLIMIT_PTHREAD
   { 'T',	RLIMIT_PTHREAD,  1,	"number of threads",	(char *)NULL },
 #endif
@@ -743,7 +747,7 @@ printone (limind, curlim, pdesc)
       else
         sprintf (unitstr, "(-%c) ", limits[limind].option);
 
-      printf ("%-20s %16s", limits[limind].description, unitstr);
+      printf ("%-20s %20s", limits[limind].description, unitstr);
     }
   if (curlim == RLIM_INFINITY)
     puts ("unlimited");

Reply via email to