diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-13 09:42:40 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-06-13 09:42:40 +0000 |
| commit | 87af593ce27b48ca27ee8b5e5278ec2abbad5a5f (patch) | |
| tree | 6bf09f98a1fdc4f538a37d9d12b7ce602c63b0a6 /process.c | |
| parent | 00c5f6b1e53ab40c95e5da02ff8bfb9d5631c00a (diff) | |
| download | ruby-87af593ce27b48ca27ee8b5e5278ec2abbad5a5f.tar.gz ruby-87af593ce27b48ca27ee8b5e5278ec2abbad5a5f.tar.xz ruby-87af593ce27b48ca27ee8b5e5278ec2abbad5a5f.zip | |
2000-06-13
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
| -rw-r--r-- | process.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -826,13 +826,29 @@ proc_setpgid(obj, pid, pgrp) static VALUE proc_setsid() { -#ifdef HAVE_SETSID +#if defined(HAVE_SETSID) int pid; rb_secure(2); pid = setsid(); if (pid < 0) rb_sys_fail(0); return INT2FIX(pid); +#elif defined(HAVE_SETPGRP) && defined(TIOCNOTTY) + pid_t sid; + +#if defined(SETPGRP_VOID) + sid = setpgrp(); +#else + sid = setpgrp(0, getpid()); +#endif + if (sid == -1) return -1; + + if ((fd = open("/dev/tty", O_RDWR)) >= 0) { + ioctl(fd, TIOCNOTTY, NULL); + close(fd); + } + return sid; +} #else rb_notimplement(); #endif @@ -1025,9 +1041,7 @@ Init_process() #endif #endif -#if !defined(NT) rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0); -#endif rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1); rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1); #ifndef NT |
