summaryrefslogtreecommitdiff
path: root/process.c
AgeCommit message (Collapse)Author
2012-06-06update async-signal-safe comments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06* process.c (proc_exec_v): don't call dln_find_exe_r here because itakr
is not async-signal-safe and proc_exec_v is called in a child process. command_abspath field of rb_exec_arg. (rb_exec_fillarg): call dln_find_exe_r and set command_abspath. (rb_exec_err): Give the absolute path of the invoking command for proc_exec_v, instead of the command name. * internal.h: add command_abspath field for rb_exec_arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06* process.c (try_with_sh): take envp argument.akr
(exec_with_sh): ditto. use it for execve. (proc_exec_v): provide envp for try_with_sh. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-06* process.c (rb_run_exec_options_err): allocate a temporary buffer forusa
run_exec_dup2() for restoring fds on non-fork environments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c (rb_exec_fillarg): check use_shell field before accessingakr
a union field. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c (rb_spawn_process): prog variable is not used for Unix.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05update async-signal-safe comments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* internal.h (rb_exec_arg_init): change return type to void.akr
* process.c (rb_exec_arg_init): don't return a value. (rb_exec_arg_prepare): ditto. (rb_spawn_process): don't take the prog argument. extract the information from earg. (rb_spawn_internal): follow rb_spawn_process change. (rb_f_spawn): ditto. * io.c (pipe_open): don't take the prog argument. extract the information from eargp. (pipe_open_v): follow pipe_open change. (pipe_open_s): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* internal.h (rb_exec_arg): use union to represent command invocationakr
with/without shell. * process.c: follow the rb_exec_arg change. * io.c (pipe_open): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05update async-signal-safe comments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c (rb_exec_arg_fixup): allocate a temporary buffer forakr
run_exec_dup2 here because it should be async-signal-safe. (run_exec_dup2): use the temporary buffer. (run_exec_dup2_tmpbuf_size): new function. * include/ruby/intern.h (rb_exec_arg): add dup2_tmpbuf field. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c (strtok): declaration removed because it is not used.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c (proc_spawn): don't detect simple command line hereakr
because rb_exec_fillarg already did. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c (rb_exec_fillarg): bail out a loop eagerly.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05* process.c: add comments about async-signal-safe.akr
* io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04add comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* process.c (rb_exec_fillarg): allocate one more element beforeakr
beginning in argv_str for try_with_sh. * internal.h (ARGVSTR2ARGC): adjust for the above change. (ARGVSTR2ARGV): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* internal.h (ARGVSTR2ARGC): defined.akr
(ARGVSTR2ARGV): defined. * process.c (proc_exec_v): use ARGVSTR2ARGV. (rb_spawn_process): use ARGVSTR2ARGC and ARGVSTR2ARGV. * io.c (pipe_open): use ARGVSTR2ARGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04merge definitionsnobu
* process.c (proc_exec_v, rb_proc_exec_e): merge definitions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04unused parameternobu
* process.c (proc_spawn_n): remove unused parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04unused variablesnobu
* io.c (pipe_open): argc and argv are not used on win32. * process.c (rb_spawn_process): remove already useless variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* process.c (rb_exec_err): should preserve errno.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* process.c (rb_run_exec_options_err): restore save_env() call forusa
non-fork environments. * process.c (rb_exec_err): restore environments after the failure of exec to fix [ruby-core:44093] [Bug #6249] on non-fork environments git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* io.c (pipe_open): follow up changes in r35889.usa
* process.c (proc_spawn_n): now uses char ** instead of VALUE *. * process.c (rb_spawn_process): prog is now VALUE of String, not char *. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03* process.c (rb_spawn_process): fix for Windows. not tested.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03* process.c (rb_proc_exec_e): don't use ISSPACE(). \f, \r and \vakr
are not word separator in Bourne shell. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03* include/ruby/intern.h (rb_exec_arg): remove argc and argv fields.akr
add use_shell, argv_str and argv_buf fields. * process.c (rb_proc_exec_e): don't split shell command line arguments here to avoid memory allocation in a child process. (rb_exec_fillarg): split shell command line arguments here. (proc_exec_v): takes argv_str argument instead of argv. (rb_proc_exec_ne): removed. (rb_proc_exec_n): removed. (rb_run_exec_options_err): don't initialize the removed fields. (rb_exec_err): don't initialize the removed fields. call proc_exec_v directly instead of rb_proc_exec_ne. (rb_spawn_process): use use_shell field. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03* process.c (rb_exec_getargs): remove rb_exec_arg argument.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03* process.c (rb_check_argv): use rb_str_new_frozen instead ofakr
rb_str_new4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03* process.c (rb_proc_exec_e): extended version of rb_proc_exec() toakr
call execle(). (rb_proc_exec): use rb_proc_exec_e(). (rb_exec_err): use rb_proc_exec_e(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03* use execve() to preserve environment variables when exec method isakr
failed. [ruby-core:44093] [ruby-trunk - Bug #6249] * include/ruby/intern.h (rb_exec_arg): add envp_str and envp_buf field to store envp of execve(). * process.c (proc_exec_v): takes envp_str as an argument and use it for execve(). (rb_proc_exec_ne): extended version of rb_proc_exec_n(). (rb_proc_exec_n): use rb_proc_exec_ne(). (rb_proc_exec): follow proc_exec_v() change. (fill_envp_buf_i): new function. (rb_exec_arg_fixup): set up envp_str and envp_buf. (save_env_i): removed. (save_env): removed. (rb_run_exec_options_err): don't modify environment variables. (rb_exec_err): use rb_proc_exec_ne(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17Imports Ruby's port to NativeClient (a.k.a NaCl).yugui
Patch by Google Inc. [ruby-core:45073]. * configure.in (RUBY_NACL): New M4 func to configure variables for NaCl. (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names of Pepper interface types. (BTESTRUBY): New variable to specify which ruby should be run on "make btest". NaCl can run the built binary by sel_ldr, but it need rbconfig.rb. So this variable is distinguished from $MINIRUBY. * thread_pthread.c: Disabled some features on NaCl. * io.c: ditto. * process.c: ditto. * signal.c: ditto. * file.c: ditto. * missing/flock.c: ditto. * nacl/pepper_main.c: An example implementation of Pepper application that embeds Ruby. * nacl/example.html: An example of web page that uses the Pepper application. * nacl/nacl-config.rb: Detects variants of NaCl SDK. * nacl/GNUmakefile.in: Makefile template for NaCl specific build process. * nacl/package.rb: script for packaging a NaCl-Ruby embedding application. * nacl/reate_nmf.rb: Wrapper script of create_nmf.py * dln.c (dln_load): Added a hack to call on NaCl. * util.c (ruby_getcwd): Path to the current directort is not available on NaCl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14* variable.c (trace_ev): Removed "not reached" comment as this line isdrbrain
reached. * variable.c (rb_obj_remove_instance_variable): Replaced "not reached" comment with the UNREACHABLE macro. * variable.c (rb_mod_const_missing): ditto. * variable.c (rb_mod_remove_cvar): ditto. * enum.c (first_i): ditto. * string.c (rb_str_aref): ditto. * string.c (str_byte_aref): ditto. * string.c (rb_to_id): ditto. * io.c (rb_io_fmode_modestr): ditto. * io.c (rb_io_oflags_modestr): ditto. * pack.c (num2i32): ditto. * vm_eval.c (rb_method_missing): ditto. * vm_eval.c (rb_f_throw): ditto. * dir.c (dir_read): ditto. * win32/win32.c (child_result): ditto. * struct.c (rb_struct_getmember): ditto. * struct.c (rb_struct_set): ditto. * struct.c (rb_struct_aref_id): ditto. * eval.c (rb_f_raise): ditto. * process.c (rb_f_exit_bang): ditto. * process.c (rb_f_exit): ditto. * process.c (rb_f_abort): ditto. * ext/-test-/iter/break.c (iter_break_value): ditto. * ext/pty/pty.c (pty_check): ditto. * ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto. * ext/readline/readline.c (rb_remove_history): ditto. * ext/stringio/stringio.c (strio_unimpl): ditto. * numeric.c (num_sadded): ditto. * numeric.c (num_init_copy): ditto. * numeric.c (rb_num2ll): ditto. * numeric.c (rb_num2ull): ditto. * vm_insnhelper.c (call_cfunc): ditto. * ruby.c (opt_W_getter): ditto. * bignum.c (rb_big_coerce): ditto. * file.c (rb_f_test): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13* encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "controldrbrain
reaches end of non-void function" warnings. [ruby-trunk - Bug #6066] * re.c (name_to_backref_number): ditto. * object.c (rb_Float): ditto. * io.c (io_readpartial): ditto. * io.c (io_read_nonblock): ditto. * pack.c (rb_uv_to_utf8): ditto. * proc.c (rb_method_entry_arity): ditto. * vm_method.c (rb_f_notimplement): ditto. * struct.c (rb_struct_aset_id): ditto. * class.c (rb_scan_args): ditto. * process.c (rlimit_resource_type): ditto. * process.c (rlimit_resource_value): ditto. * process.c (p_uid_switch): ditto. * process.c (p_gid_switch): ditto. * ext/digest/digest.c (rb_digest_instance_update): ditto. * ext/digest/digest.c (rb_digest_instance_finish): ditto. * ext/digest/digest.c (rb_digest_instance_reset): ditto. * ext/digest/digest.c (rb_digest_instance_block_length): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto. * ext/dl/handle.c (rb_dlhandle_close): ditto. * ext/tk/tcltklib.c (pending_exception_check0): ditto. * ext/tk/tcltklib.c (pending_exception_check1): ditto. * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto. * ext/tk/tcltklib.c (lib_get_reltype_name): ditto. * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto. * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto. * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto. * ext/fiddle/conversions.c (generic_to_value): ditto. * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto. * ext/socket/socket.c (sock_s_getnameinfo): ditto. * ext/ripper/eventids2.c (ripper_token2eventid): ditto. * cont.c (return_fiber): ditto. * dmydln.c (dln_load): ditto. * vm_insnhelper.c (vm_search_normal_superclass): ditto. * bignum.c (big_fdiv): ditto. * marshal.c (r_symlink): ditto. * marshal.c (r_symbol): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-07* include/ruby/win32.h (rb_w32_aspawn_flags): add the declaration ofshirosaki
new function. * process.c (enum): add EXEC_OPTION_PGROUP and move the position above for the usage in proc_spawn_n(). * process.c (proc_spawn_n): add an argument to pass new option `new_pgroup`. The option specifies CREATE_NEW_PROCESS_GROUP flag to CreateProcessW(). This flag is necessary for the usage of Process.kill on the subprocess on Windows. * process.c (rb_exec_arg_addopt): ditto. * process.c (rb_spawn_process): ditto. * process.c (documentation for rb_f_spawn): add documentation for new option `new_pgroup` of spawn. * test/ruby/test_process.rb (TestProcess#test_execopts_new_pgroup): add tests for option `new_pgroup`. * test/ruby/test_thread.rb (TestThreadGroup#test_thread_timer_and_interrupt): add option `new_pgroup: true` to spawn on Windows. It's needed for Process.kill on a subprocess. * win32/win32.c (CreateChild): add an argument to pass dwCreationFlags of CreateProcessW(). * win32/win32.c (rb_w32_spawn): ditto. * win32/win32.c (rb_w32_aspawn_flags): add new function to pass dwCreationFlags. * win32/win32.c (rb_w32_aspawn): refactor to move the content to rb_w32_aspawn_flags(). [ruby-core:43245][Bug #6131] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-03* process.c (setreuid, setregid): suppress warnings.nobu
[ruby-core:43374][Bug #6169] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-28* process.c (obj2uid, obj2gid): allow strings as input user/group id.nobu
[ruby-core:40923][Feature #5610] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-28* process.c: no cuddle up else's.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]marcandre
* array.c: Use rb_check_arity / rb_error_arity * class.c: ditto * enumerator.c: ditto * eval.c: ditto * file.c: ditto * hash.c: ditto * numeric.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * re.c: ditto * signal.c: ditto * string.c: ditto * struct.c: ditto * transcode.c: ditto * vm_eval.c: ditto * vm_insnhelper.c: ditto & implementation of rb_error_arity * test/ruby/test_arity.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-03* process.c (rb_run_exec_options_err): chdir at last to interpretakr
relative pathnames from the current directory of the parent process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-27* io.c, process.c, time.c, ext: use rb_sys_fail_str instead ofnobu
rb_sys_fail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-13* process.c (proc_wait): Change typo "SystemError" todrbrain
"SystemCallError". [ruby-trunk - Bug #5962] * process.c (proc_wait2): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08* gc.c (rb_objspace_free): global_List is allocated with xmalloc.naruse
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/78 * dln_find.c: remove useless replacement of free. * ext/readline/readline.c (readline_attempted_completion_function): strings for readline must allocated with malloc. * process.c (run_exec_dup2): use free; see also r20950. * re.c (onig_new_with_source): use malloc for oniguruma. * vm.c (ruby_vm_destruct): use free for VMs. * vm.c (thread_free): use free for threads. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-03* process.c: Fix typo. patch from Aviv Ben-Yosef.ayumin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-11* process.c (rb_exit_status_code): extract from rb_f_exit_bang andnobu
rb_f_exit. assume 0 to be success in Kernel#exit! too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05* process.c (proc_seteuid_m): fix argument.nobu
* test/ruby/test_process.rb (test_geteuid): fix typo. * test/ruby/test_process.rb (test_getegid, test_set[eg]uid): add. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-05* bignum.c (big_rshift), compile.c (validate_label,nobu
iseq_build_from_ary_exception), cont.c (cont_capture), dir.c (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open) (rb_io_advise), parse.y (parser_compile_string) (rb_parser_compile_file), proc.c (binding_free), process.c (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core) (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null), signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main), vm_insnhelper.c (vm_expandarray): suppress unused-but-set-variable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-11* process.c (proc_seteuid): separate an internal wrapper functionnobu
from the method implementation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01* io.c (nogvl_io_cntl): rb_cloexec_fcntl_dupfd's 2nd argument is int.naruse
* process.c (move_fds_to_avoid_crash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30* include/ruby/intern.h (rb_cloexec_fcntl_dupfd): declared.akr
* io.c (rb_cloexec_fcntl_dupfd): new function. (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd. * process.c (move_fds_to_avoid_crash): use rb_cloexec_fcntl_dupfd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e