summaryrefslogtreecommitdiffstats
path: root/process.c
Commit message (Collapse)AuthorAgeFilesLines
* * marshal.c (dump_ensure), process.c (run_exec_dup2),nobu2008-08-041-3/+3
| | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@18341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (pst_message): removed no longer used variable.nobu2008-07-221-1/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compile.c (insn_data_to_s_detail), file.c (rb_stat_inspect),nobu2008-07-221-10/+6
| | | | | | | | | | | | | | iseq.c (ruby_iseq_disasm_insn, ruby_iseq_disasm), process.c (pst_message), re.c (match_inspect): use rb_str_catf. * dir.c (dir_inspect), iseq.c (iseq_inspect, insn_operand_intern): use rb_sprintf. * error.c (rb_name_error, rb_raise, rb_loaderror, rb_fatal): use rb_vsprintf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h (rb_thread_t), vm.c (rb_thread_mark), process.cnobu2008-07-101-7/+6
| | | | | | | | | | (rb_last_status_get, rb_last_status_set, rb_last_status_clear): moved last_status from rb_vm_t. [ruby-dev:35414] * vm.c (th_init2): initialize last_status with nil. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename rb_pipe_internal to rb_pipe.akr2008-07-051-1/+1
| | | | | | | use rb_pipe in pipe_nocrash. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update spawn rdoc a bit.akr2008-07-051-0/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (run_exec_rlimit): ISO C90 forbids mixed declarationsshyouhei2008-07-011-4/+5
| | | | | | | and code git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (enum ruby_special_consts): ISO C forbidsshyouhei2008-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | comma at end of enumerator list * include/ruby/ruby.h (enum ruby_value_type): ditto. * eval_intern.h (enum): ditto. * vm_core.h (enum rb_thread_status): ditto. * parse.y (enum lex_state_e): ditto. * parse.y (enum string_type): ditto. * process.c (enum): ditto. * ruby.c (enum dump_flag_bits): ditto. * ruby.c (enum disable_flag_bits): ditto. * compile.c (iseq_link_element): ditto * debug.c (union): ditto. * cont.c (enum context_type): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (Init_process): fix to avoid a warning.ko12008-06-291-3/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in: need a ",".ko12008-06-261-1/+1
| | | | | | | | * process.c (rb_fork): check CANNOT_FORK_WITH_PTHREAD macro. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/win32.h, win32/win32.c (rb_w32_getppid): now supportusa2008-06-241-4/+0
| | | | | | | | | | getppid() on win32 (but only Win2k or later). * process.c (get_ppid): remove win32 special logic. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (Init_process): Process::Status#to_int removed.akr2008-06-201-14/+14
| | | | | | | | | | | | | | | | | | | | | (PST2INT): defined. (pst_to_s): use PST2INT. (pst_inspect): ditto. (pst_equal): ditto. (pst_bitand): ditto. (pst_rshift): ditto. (pst_wifstopped): ditto. (pst_wstopsig): ditto. (pst_wifsignaled): ditto. (pst_wtermsig): ditto. (pst_wifexited): ditto. (pst_wexitstatus): ditto. (pst_success_p): ditto. (pst_wcoredump): ditto. (rb_f_system): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_detach_process): store detached process ID in thenobu2008-06-201-1/+18
| | | | | | | thread local storage. moved from lib/open3.rb. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_f_fork): NetBSD 4.0 or later can fork.usa2008-06-191-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (run_exec_pgroup): C99 ism.usa2008-06-031-1/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_spawn_internal): set last_status when status == -1usa2008-05-191-0/+4
| | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@16470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c, include/ruby/intern.h (rb_run_exec_options): externed.usa2008-05-121-18/+112
| | | | | | | | | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@16395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_spawn_internal): remove calling run_exec_options()usa2008-05-121-0/+2
| | | | | | | | because cannot restore after spawn. we'll fix this later. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_spawn_internal): need to call run_exec_options() beforeusa2008-05-121-8/+11
| | | | | | | | spawn if the platform doesn't have fork. [ruby-dev:34647] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (thread_cleanup_func_before_exec): extracted fromakr2008-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@16355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dln.c (dln_find_exe_r, dln_find_file_r): reentrant versions.nobu2008-05-071-7/+18
| | | | | | | | | * file.c (rb_find_file_ext, rb_find_file), process.c (proc_exec_v), (rb_proc_exec, proc_spawn_v, proc_spawn), ruby.c (process_options): use reentrant versions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (check_exec_redirect_fd): prohibit duplex IO.akr2008-04-301-5/+9
| | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@16235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_exec_arg_addopt, rb_exec_arg_addopt): now can specifyusa2008-04-281-4/+0
| | | | | | | | close_exec on having no fork environment (but still meaningless). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (run_exec_options): don't call FIX2INT for nil.akr2008-04-281-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_exec_arg_init): declared.akr2008-04-281-67/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@16222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_hash_dup): declared.akr2008-04-261-0/+4
| | | | | | | | | | * hash.c (rb_hash_dup): new function. * process.c (rb_spawn_internal): don't modify option hash. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_cProcessTms, rb_cProcessStatus): renamed.nobu2008-04-261-23/+23
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update spawn rdoc.akr2008-04-251-10/+15
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_spawn_internal): new function to specifyakr2008-04-251-5/+23
| | | | | | | | | | default_close_others. (rb_spawn): specify default_close_others true. (rb_f_system): call rb_spawn_internal with default_close_others as false. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_spawn): rb_exec_initarg() returns new argc and argv innobu2008-04-251-0/+4
| | | | | | | earg. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c: suppress warning.nobu2008-04-251-0/+8
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/win32.h: define mode_t for umask.usa2008-04-251-0/+8
| | | | | | | | | * process.c (check_exec_options_i, check_exec_fds, run_exec_options): support "close_others" only when fork(2) is available. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix argument type.akr2008-04-241-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c: include sys/stat.h for umask.akr2008-04-241-1/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_env_clear): declared.akr2008-04-241-69/+1037
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@16183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enumerator.c (enumerator_each, enumerator_with_index): suppressnobu2008-04-221-3/+3
| | | | | | | | | | | | | | | | | | warnings. * pack.c (pack_unpack): ditto. * process.c (rb_syswait): ditto. * re.c (rb_reg_prepare_enc, rb_reg_prepare_re, rb_reg_adjust_startpos): ditto. * regparse.c (onig_name_to_group_numbers): ditto. * missing/vsnprintf.c (BSD_vfprintf): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rlimit_resource_value): use NUM2RLIM.akr2008-03-221-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-6/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (fix_to_s): avoid rb_scan_args() when no argumentmatz2008-03-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | given. * bignum.c (rb_big_to_s): ditto. * enum.c (enum_first): ditto. * eval_jump.c (rb_f_catch): ditto. * io.c (rb_obj_display): ditto. * class.c (rb_obj_singleton_methods): ditto. * object.c (rb_class_initialize): ditto. * random.c (rb_f_srand): ditto. * range.c (range_step): ditto. * re.c (rb_reg_s_last_match): ditto. * string.c (rb_str_to_i): ditto. * string.c (rb_str_each_line): ditto. * string.c (rb_str_chomp_bang): ditto. * string.c (rb_str_sum): ditto. * string.c (str_modifiable): declare inline. * string.c (str_independent): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (Init_process): share bignum objects for RLIM_INFINITY,akr2008-02-251-5/+8
| | | | | | | RLIM_SAVED_MAX and RLIM_SAVED_CUR if they are equal. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rlimit_resource_type): new function.akr2008-02-221-25/+162
| | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@15579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in: moved broken syscall checks from process.c etc.nobu2008-01-111-5/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_isascii): defined.akr2008-01-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_isalnum): ditto. (rb_isalpha): ditto. (rb_isblank): ditto. (rb_iscntrl): ditto. (rb_isdigit): ditto. (rb_isgraph): ditto. (rb_islower): ditto. (rb_isprint): ditto. (rb_ispunct): ditto. (rb_isspace): ditto. (rb_isupper): ditto. (rb_isxdigit): ditto. (rb_tolower): ditto. (rb_toupper): ditto. * include/ruby/st.h (st_strcasecmp): declared. (st_strncasecmp): ditto. * st.c (type_strcasehash): use st_strcasecmp instead of strcasecmp. (st_strcasecmp): defined. (st_strncasecmp): ditto. * include/ruby/ruby.h: include include/ruby/encoding.h. (ISASCII): use rb_isascii. (ISPRINT): use rb_isprint. (ISSPACE): use rb_isspace. (ISUPPER): use rb_isupper. (ISLOWER): use rb_islower. (ISALNUM): use rb_isalnum. (ISALPHA): use rb_isalpha. (ISDIGIT): use rb_isdigit. (ISXDIGIT): use rb_isxdigit. (TOUPPER): defined. (TOLOWER): ditto. (STRCASECMP): ditto. (STRNCASECMP): ditto. * dir.c, encoding.c, file.c, hash.c, process.c, ruby.c, time.c, transcode.c, ext/readline/readline.c: use locale insensitive functions. [ruby-core:14662] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2007-12-311-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enable document of Kernel#system.akr2007-12-231-4/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_f_fork): Unsupport Kernel.fork() on NetBSD.ko12007-12-221-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * signal.c (ruby_signal): use SA_SIGINFO if available.matz2007-11-301-0/+4
| | | | | | [ ruby-Patches-6418 ] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * process.c (rb_f_system): returns nil on execution failure.matz2007-11-201-4/+5
| | | | | | [ruby-core:13715] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.h, vm_core.h: decl of rb_gc_save_machine_context()ko12007-11-201-1/+1
| | | | | | | | | | | | | | should be at vm_core.h. * include/ruby/ruby.h, intern.h: remove type rb_thread_t. * include/ruby/intern.h: change rb_unblock_function_t, rb_unblock_function_t. * file.c, process.c: apply above changes. * thread.c, thread_pthread.ci, thread_win32.ci: ditto. * io.c: support blocking open (2). [ruby-core:13614] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e