summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-11 23:38:44 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-11 23:38:44 +0000
commitd900ed31f776a85291a6aee870c942a57ab86e6b (patch)
tree66323e1f766b81c2b9b77be5356089f9459f1f24 /process.c
parentc755baf85f553e7ea20290facdeff56c490162a1 (diff)
* process.c (rlimit_resource_name2int): support more limits:
RLIMIT_MSGQUEUE, RLIMIT_NICE, RLIMIT_RTPRIO, RLIMIT_RTTIME and RLIMIT_SIGPENDING. (Init_process): ditto. patch by Run Paint Run Run. [ruby-core:32262] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c59
1 files changed, 47 insertions, 12 deletions
diff --git a/process.c b/process.c
index 85d2aeb0e8..ad884ea07e 100644
--- a/process.c
+++ b/process.c
@@ -3620,6 +3620,9 @@ rlimit_resource_name2int(const char *name, int casetype)
#ifdef RLIMIT_MEMLOCK
RESCHECK(MEMLOCK);
#endif
+#ifdef RLIMIT_MSGQUEUE
+ RESCHECK(MSGQUEUE);
+#endif
break;
case 'N':
@@ -3629,12 +3632,21 @@ rlimit_resource_name2int(const char *name, int casetype)
#ifdef RLIMIT_NPROC
RESCHECK(NPROC);
#endif
+#ifdef RLIMIT_NICE
+ RESCHECK(NICE);
+#endif
break;
case 'R':
#ifdef RLIMIT_RSS
RESCHECK(RSS);
#endif
+#ifdef RLIMIT_RTPRIO
+ RESCHECK(RTPRIO);
+#endif
+#ifdef RLIMIT_RTTIME
+ RESCHECK(RTTIME);
+#endif
break;
case 'S':
@@ -3644,6 +3656,9 @@ rlimit_resource_name2int(const char *name, int casetype)
#ifdef RLIMIT_SBSIZE
RESCHECK(SBSIZE);
#endif
+#ifdef RLIMIT_SIGPENDING
+ RESCHECK(SIGPENDING);
+#endif
break;
}
return -1;
@@ -3810,17 +3825,22 @@ proc_getrlimit(VALUE obj, VALUE resource)
* The available resources are OS dependent.
* Ruby may support following resources.
*
+ * [AS] total available memory (bytes) (SUSv3, NetBSD, FreeBSD, OpenBSD but 4.4BSD-Lite)
* [CORE] core size (bytes) (SUSv3)
* [CPU] CPU time (seconds) (SUSv3)
* [DATA] data segment (bytes) (SUSv3)
* [FSIZE] file size (bytes) (SUSv3)
- * [NOFILE] file descriptors (number) (SUSv3)
- * [STACK] stack size (bytes) (SUSv3)
- * [AS] total available memory (bytes) (SUSv3, NetBSD, FreeBSD, OpenBSD but 4.4BSD-Lite)
* [MEMLOCK] total size for mlock(2) (bytes) (4.4BSD, GNU/Linux)
+ * [MSGQUEUE] allocation for POSIX message queues (bytes) (GNU/Linux)
+ * [NICE] ceiling on process's nice(2) value (number) (GNU/Linux)
+ * [NOFILE] file descriptors (number) (SUSv3)
* [NPROC] number of processes for the user (number) (4.4BSD, GNU/Linux)
* [RSS] resident memory size (bytes) (4.2BSD, GNU/Linux)
+ * [RTPRIO] ceiling on the process's real-time priority (number) (GNU/Linux)
+ * [RTTIME] CPU time for real-time process (us) (GNU/Linux)
* [SBSIZE] all socket buffers (bytes) (NetBSD, FreeBSD)
+ * [SIGPENDING] number of queued signals allowed (signals) (GNU/Linux)
+ * [STACK] stack size (bytes) (SUSv3)
*
* _cur_limit_ and _max_limit_ may be
* <code>:INFINITY</code>, <code>"INFINITY"</code> or
@@ -3831,7 +3851,7 @@ proc_getrlimit(VALUE obj, VALUE resource)
* corresponding symbols and strings too.
* See system setrlimit(2) manual for details.
*
- * The following example raise the soft limit of core size to
+ * The following example raises the soft limit of core size to
* the hard limit to try to make core dump possible.
*
* Process.setrlimit(:CORE, Process.getrlimit(:CORE)[1])
@@ -5601,6 +5621,9 @@ Init_process(void)
}
#endif
}
+#ifdef RLIMIT_AS
+ rb_define_const(rb_mProcess, "RLIMIT_AS", INT2FIX(RLIMIT_AS));
+#endif
#ifdef RLIMIT_CORE
rb_define_const(rb_mProcess, "RLIMIT_CORE", INT2FIX(RLIMIT_CORE));
#endif
@@ -5613,17 +5636,17 @@ Init_process(void)
#ifdef RLIMIT_FSIZE
rb_define_const(rb_mProcess, "RLIMIT_FSIZE", INT2FIX(RLIMIT_FSIZE));
#endif
-#ifdef RLIMIT_NOFILE
- rb_define_const(rb_mProcess, "RLIMIT_NOFILE", INT2FIX(RLIMIT_NOFILE));
+#ifdef RLIMIT_MEMLOCK
+ rb_define_const(rb_mProcess, "RLIMIT_MEMLOCK", INT2FIX(RLIMIT_MEMLOCK));
#endif
-#ifdef RLIMIT_STACK
- rb_define_const(rb_mProcess, "RLIMIT_STACK", INT2FIX(RLIMIT_STACK));
+#ifdef RLIMIT_MSGQUEUE
+ rb_define_const(rb_mProcess, "RLIMIT_MSGQUEUE", INT2FIX(RLIMIT_MSGQUEUE));
#endif
-#ifdef RLIMIT_AS
- rb_define_const(rb_mProcess, "RLIMIT_AS", INT2FIX(RLIMIT_AS));
+#ifdef RLIMIT_NICE
+ rb_define_const(rb_mProcess, "RLIMIT_NICE", INT2FIX(RLIMIT_NICE));
#endif
-#ifdef RLIMIT_MEMLOCK
- rb_define_const(rb_mProcess, "RLIMIT_MEMLOCK", INT2FIX(RLIMIT_MEMLOCK));
+#ifdef RLIMIT_NOFILE
+ rb_define_const(rb_mProcess, "RLIMIT_NOFILE", INT2FIX(RLIMIT_NOFILE));
#endif
#ifdef RLIMIT_NPROC
rb_define_const(rb_mProcess, "RLIMIT_NPROC", INT2FIX(RLIMIT_NPROC));
@@ -5631,9 +5654,21 @@ Init_process(void)
#ifdef RLIMIT_RSS
rb_define_const(rb_mProcess, "RLIMIT_RSS", INT2FIX(RLIMIT_RSS));
#endif
+#ifdef RLIMIT_RTPRIO
+ rb_define_const(rb_mProcess, "RLIMIT_RTPRIO", INT2FIX(RLIMIT_RTPRIO));
+#endif
+#ifdef RLIMIT_RTTIME
+ rb_define_const(rb_mProcess, "RLIMIT_RTTIME", INT2FIX(RLIMIT_RTTIME));
+#endif
#ifdef RLIMIT_SBSIZE
rb_define_const(rb_mProcess, "RLIMIT_SBSIZE", INT2FIX(RLIMIT_SBSIZE));
#endif
+#ifdef RLIMIT_SIGPENDING
+ rb_define_const(rb_mProcess, "RLIMIT_SIGPENDING", INT2FIX(RLIMIT_SIGPENDING));
+#endif
+#ifdef RLIMIT_STACK
+ rb_define_const(rb_mProcess, "RLIMIT_STACK", INT2FIX(RLIMIT_STACK));
+#endif
#endif
rb_define_module_function(rb_mProcess, "uid", proc_getuid, 0);