summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-12-16 07:30:36 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-12-16 07:30:36 +0000
commite299d511db939232c628d6880e61c32e83937d66 (patch)
treea2083bfd64a4fb3ed7454a7e7062ff9f7fa1232e /process.c
parentce8859c5563493a94f57d3b630e7b9c1d3cd656f (diff)
first public release of 1.1d (pre1.2) series
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1dev@354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/process.c b/process.c
index e4d0d0a..79d30c8 100644
--- a/process.c
+++ b/process.c
@@ -212,28 +212,9 @@ rb_f_waitpid(obj, vpid, vflags)
char *strtok();
-#if defined(USE_THREAD) && defined(HAVE_SETITIMER)
-static void
-before_exec()
-{
- struct itimerval tval;
-
- tval.it_interval.tv_sec = 0;
- tval.it_interval.tv_usec = 0;
- tval.it_value = tval.it_interval;
- setitimer(ITIMER_VIRTUAL, &tval, NULL);
-}
-
-static void
-after_exec()
-{
- struct itimerval tval;
-
- tval.it_interval.tv_sec = 0;
- tval.it_interval.tv_usec = 100000;
- tval.it_value = tval.it_interval;
- setitimer(ITIMER_VIRTUAL, &tval, NULL);
-}
+#if defined(THREAD) && defined(HAVE_SETITIMER)
+#define before_exec() thread_stop_timer()
+#define after_exec() thread_start_timer()
#else
#define before_exec()
#define after_exec()
@@ -503,6 +484,9 @@ rb_f_exec(argc, argv)
VALUE prog = 0;
int i;
+ if (argc == 0) {
+ rb_raise(rb_eArgError, "wrong # of arguments");
+ }
if (TYPE(argv[0]) == T_ARRAY) {
if (RARRAY(argv[0])->len != 2) {
rb_raise(rb_eArgError, "wrong first argument");
@@ -835,6 +819,20 @@ proc_setpgrp(argc, argv)
}
static VALUE
+proc_getpgid(obj, pid)
+ VALUE obj, pid;
+{
+#ifdef HAVE_GETPGID
+ int i;
+
+ i = getpgid(NUM2INT(pid));
+ return INT2NUM(i);
+#else
+ rb_notimplement();
+#endif
+}
+
+static VALUE
proc_setpgid(obj, pid, pgrp)
VALUE obj, pid, pgrp;
{
@@ -1085,7 +1083,7 @@ Init_process()
rb_define_module_function(rb_mProcess, "getpriority", proc_getpriority, 2);
rb_define_module_function(rb_mProcess, "setpriority", proc_setpriority, 3);
-#ifdef PRIO_PROCESS
+#ifdef HAVE_GETPRIORITY
rb_define_const(rb_mProcess, "PRIO_PROCESS", INT2FIX(PRIO_PROCESS));
rb_define_const(rb_mProcess, "PRIO_PGRP", INT2FIX(PRIO_PGRP));
rb_define_const(rb_mProcess, "PRIO_USER", INT2FIX(PRIO_USER));