Process::Status.allocate.pid.
(pst_inspect): don't raise if self is not initialized.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
string.c (rb_str_replace), transcode.c (transcode_dispatch): fixed
memory leaks. based on patches from shinichiro.h <shinichiro.hamaji
AT gmail.com> at [ruby-dev:35751].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
getppid() on win32 (but only Win2k or later).
* process.c (get_ppid): remove win32 special logic.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because there is no path to set it on win32. this patch is derived
from [ruby-core:16787], submitted by Luis Lavena <luislavena at
gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (save_redirect_fd, save_env_i, save_env, run_exec_dup2,
run_exec_open, run_exec_pgroup, run_exec_rlimit, rb_run_exec_options):
save parent's process environments.
!!!remark!!! these are not thread-safe.
* process.c (rb_spawn_internal): remove calling run_exec_options()
because cannot restore after spawn. we'll fix this later.
* io.c (pipe_open): ditto.
* test/ruby/test_process.rb (test_execopts_env): upcase environment
variable name for case insensitive platforms.
* win32/win32.c (init_env): set USER environment variable only when
USERNAME is available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
thread_cleanup_func not to touch pthread data.
pthread_cond_destroy in forked process may cause deadlock on
Debian GNU/Linux Etch on x86, x86-64 and IA64.
this doesn't cause resource leak because the process will exec soon.
(terminate_atfork_before_exec_i): defined.
(rb_thread_atfork_before_exec): defined.
* include/ruby/intern.h (rb_thread_atfork_before_exec): declared.
* process.c (rb_exec_atfork): call rb_thread_atfork_before_exec
instead of rb_thread_atfork.
* io.c (popen_exec): call rb_thread_atfork_before_exec instead of
rb_thread_atfork.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(check_exec_fds): record maxhint even if close_others is not
specified.
(rb_exec_arg_fixup): renamed from rb_exec_arg_fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
close_exec on having no fork environment (but still meaningless).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(rb_exec_arg_addopt): delared.
(rb_exec_arg_fix): declared.
(rb_exec_initarg): removed.
(rb_exec_getargs): removed.
(rb_exec_initarg2): removed.
* io.c (struct popen_arg): make execarg as a pointer.
(popen_exec): follow popen_arg change.
(pipe_open): add eargp argument. extract argc and argv from eargp.
use rb_exec_arg_addopt to add redirect options.
(pipe_open_v): set up struct rb_exec_arg.
(pipe_open_s): set up struct rb_exec_arg.
* process.c (rb_exec_arg_addopt): new function extracted from
check_exec_options_i.
(check_exec_options_i): use rb_exec_arg_addopt.
(rb_check_exec_options): opthash is always a hash now.
(rb_exec_getargs): make it static.
(rb_exec_fillarg): renamed from rb_exec_initarg2. don't set up
redirect_fds.
(rb_exec_arg_init): new function.
(rb_exec_arg_fix): new function.
(rb_f_exec): use rb_exec_arg_init and rb_exec_arg_fix. use
rb_exec_arg_addopt to set close_others option.
(run_exec_options): make close_others by default.
(rb_spawn_internal): use rb_exec_arg_init and rb_exec_arg_fix. use
rb_exec_arg_addopt to set close_others option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (check_exec_options_i, check_exec_fds, run_exec_options):
support "close_others" only when fork(2) is available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(rb_io_mode_modenum): declared.
(rb_close_before_exec): declared.
(struct rb_exec_arg): add options and redirect_fds field.
(rb_check_argv): removed.
(rb_exec_initarg): declared.
(rb_exec_getargs): declared.
(rb_exec_initarg2): declared.
(rb_fork): add third argument: fds.
* io.c (max_file_descriptor): new static variable to record maximum
file descriptor ruby used.
(UPDATE_MAXFD): new macro.
(UPDATE_MAXFD_PIPE): new macro.
(rb_io_mode_modenum): externed.
(rb_sysopen): update max_file_descriptor.
(rb_close_before_exec): new function.
(popen_exec): redirection removed because it is done by extended
spawn mechanism.
(pipe_open): generate a hash for spawn options to specify
redirections.
(pipe_open_v): use rb_exec_getargs.
(pipe_open_s): use rb_exec_getargs.
(rb_io_initialize): update max_file_descriptor..
* process.c (hide_obj): new function.
(check_exec_redirect_fd): new function.
(check_exec_redirect): new function.
(check_exec_options_i): new function.
(check_exec_fds): new function.
(rb_check_exec_options): new function.
(check_exec_env_i): new function.
(rb_check_exec_env): new function.
(rb_exec_getargs): new function.
(rb_exec_initarg2): new function.
(rb_exec_initarg): new function.
(rb_f_exec): use rb_exec_initarg.
(intcmp): new function.
(run_exec_dup2): new function.
(run_exec_close): new function.
(run_exec_open): new function.
(run_exec_pgroup): new function.
(run_exec_rlimit): new function.
(run_exec_options): new function.
(rb_exec): call run_exec_options.
(move_fds_to_avoid_crash): new function.
(pipe_nocrash): new function.
(rb_fork): use pipe_nocrash to avoid file descriptor conflicts.
(rb_spawn): use rb_exec_initarg.
(rlimit_resource_name2int): extracted from rlimit_resource_type.
(rlimit_type_by_hname): new function.
(rlimit_type_by_lname): new function.
(rlimit_resource_type): use rlimit_type_by_hname.
(proc_daemon): add fds argument for rb_fork.
* hash.c (rb_env_clear): renamed from env_clear and externed.
[ruby-dev:34086]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(rlimit_resource_value): new function.
(proc_getrlimit): use rlimit_resource_type to accept
symbol and string as resource type.
(proc_setrlimit): use rlimit_resource_type and rlimit_resource_value
to accept symbol and string as resource type and values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e