summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1994-10-14 06:19:03 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:30 +0900
commit29f237a8b1df650089b54447f070726c75706b6f (patch)
treee6ee836a39a5f2f1d433d6532de32471b655fb6d /process.c
parent173976c97c9426aa8d96e53aef6c0e570c5fdfda (diff)
version 0.54v0_54
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-0.54.tar.gz
Diffstat (limited to 'process.c')
-rw-r--r--process.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/process.c b/process.c
index 15f101ef1a..0f36bf7c39 100644
--- a/process.c
+++ b/process.c
@@ -693,7 +693,7 @@ Fsleep(argc, argv)
int beg, end;
beg = time(0);
- if (argc == 1) {
+ if (argc == 0) {
sleep((32767<<16)+32767);
}
else if (argc == 1) {
@@ -832,19 +832,19 @@ VALUE M_Process;
Init_process()
{
- extern VALUE C_Builtin;
+ extern VALUE C_Kernel;
- rb_define_variable("$$", Qnil, get_pid, rb_readonly_hook);
+ rb_define_variable("$$", Qnil, get_pid, Qnil);
rb_define_variable("$?", &status, Qnil, rb_readonly_hook);
- rb_define_method(C_Builtin, "exec", Fexec, 1);
- rb_define_method(C_Builtin, "fork", Ffork, 0);
- rb_define_method(C_Builtin, "_exit", Ffork, 1);
- rb_define_method(C_Builtin, "wait", Fwait, 0);
- rb_define_method(C_Builtin, "waitpid", Fwaitpid, 2);
- rb_define_method(C_Builtin, "system", Fsystem, 1);
- rb_define_method(C_Builtin, "kill", Fkill, -1);
- rb_define_method(C_Builtin, "trap", Ftrap, -1);
- rb_define_method(C_Builtin, "sleep", Fsleep, -1);
+ rb_define_private_method(C_Kernel, "exec", Fexec, 1);
+ rb_define_private_method(C_Kernel, "fork", Ffork, 0);
+ rb_define_private_method(C_Kernel, "_exit", Ffork, 1);
+ rb_define_private_method(C_Kernel, "wait", Fwait, 0);
+ rb_define_private_method(C_Kernel, "waitpid", Fwaitpid, 2);
+ rb_define_private_method(C_Kernel, "system", Fsystem, 1);
+ rb_define_private_method(C_Kernel, "kill", Fkill, -1);
+ rb_define_private_method(C_Kernel, "trap", Ftrap, -1);
+ rb_define_private_method(C_Kernel, "sleep", Fsleep, -1);
M_Process = rb_define_module("Process");
@@ -854,27 +854,21 @@ Init_process()
rb_define_single_method(M_Process, "waitpid", Fwaitpid, 2);
rb_define_single_method(M_Process, "kill", Fkill, -1);
- rb_define_method(M_Process, "pid", get_pid, 0);
- rb_define_method(M_Process, "ppid", get_ppid, 0);
+ rb_define_module_function(M_Process, "pid", get_pid, 0);
+ rb_define_module_function(M_Process, "ppid", get_ppid, 0);
- rb_define_method(M_Process, "getpgrp", Fproc_getpgrp, -2);
- rb_define_method(M_Process, "setpgrp", Fproc_setpgrp, 2);
+ rb_define_module_function(M_Process, "getpgrp", Fproc_getpgrp, -2);
+ rb_define_module_function(M_Process, "setpgrp", Fproc_setpgrp, 2);
- rb_define_method(M_Process, "getpriority", Fproc_getpriority, 2);
- rb_define_method(M_Process, "setpriority", Fproc_setpriority, 3);
+ rb_define_module_function(M_Process, "getpriority", Fproc_getpriority, 2);
+ rb_define_module_function(M_Process, "setpriority", Fproc_setpriority, 3);
rb_define_const(M_Process, "%PRIO_PROCESS", INT2FIX(PRIO_PROCESS));
rb_define_const(M_Process, "%PRIO_PGRP", INT2FIX(PRIO_PGRP));
rb_define_const(M_Process, "%PRIO_USER", INT2FIX(PRIO_USER));
- rb_define_single_method(M_Process, "uid", Fproc_getuid, 0);
- rb_define_method(M_Process, "uid", Fproc_getuid, 0);
- rb_define_single_method(M_Process, "uid=", Fproc_setuid, 1);
- rb_define_method(M_Process, "uid=", Fproc_setuid, 1);
- rb_define_single_method(M_Process, "euid", Fproc_geteuid, 0);
- rb_define_method(M_Process, "euid", Fproc_geteuid, 0);
- rb_define_single_method(M_Process, "euid=", Fproc_seteuid, 1);
- rb_define_method(M_Process, "euid=", Fproc_seteuid, 1);
-
- rb_include_module(CLASS_OF(M_Process), M_Process);
+ rb_define_module_function(M_Process, "uid", Fproc_getuid, 0);
+ rb_define_module_function(M_Process, "uid=", Fproc_setuid, 1);
+ rb_define_module_function(M_Process, "euid", Fproc_geteuid, 0);
+ rb_define_module_function(M_Process, "euid=", Fproc_seteuid, 1);
}