* 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
* thread_win32.ci, thread_win32.h, thread_pthread.ci, thread_pthread.h:
prepare native_cond_*() which are based on pthread_cond_*() spec.
* prelude.rb: fix Mutex#synchronize method.
* vm_core.h, include/ruby/intern.h: change unblock function interface
(to pass some user data).
* file.c, process.c: ditto.
* benchmark/bm_vm2_mutex.rb: add a benchmark for mutex.
* benchmark/bm_vm3_thread_mutex.rb: add a benchmark for mutex
with contension.
* benchmark/run.rb: fix to remove ENV['RUBYLIB'] for matzruby.
* test/ruby/test_thread.rb: add a test.
* common.mk: fix benchmark options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in (XCFLAGS): add _GNU_SOURCE on linux.
* file.c (group_member): use system routine if available.
* process.c: moved _GNU_SOURCE macro to Makefile.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to an auto variable to the thread to be created. pointed and
fix by KUBO Takehiro <kubo at jiubao.org> [ruby-dev:30618]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
moving definitions place, add/remove prototypes, deleting
unused variables and removing yarv.h.
This commit doesn't change any behavior of ruby/vm.
* yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h).
* error.c, eval_intern.h: include yarvcore.h instead yarv.h
* rename some functions:
* debug.[ch]: debug_*() -> ruby_debug_*()
* iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm()
* iseq.c: node_name() -> ruby_node_name()
* vm.c: yarv_check_redefinition_opt_method() ->
rb_vm_check_redefinition_opt_method()
* some refactoring with checking -Wall.
* array.c: remove rb_ary_ptr() (unused) and remove unused
local variables.
* object.c: add a prototype of rb_mod_module_exec().
* eval_intern.h (ruby_cref): set it inline.
* eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal().
* parse.y: add a prototype of rb_parse_in_eval() (in eval.c).
* process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c).
* thread.c: remove raw_gets() function (unused) and fix some format
mismatch (format mismatchs have remained yet. this is todo).
* thread.c (rb_thread_wait_fd_rw): fix typo on label name.
* thread_pthread.ci: comment out codes with USE_THREAD_CACHE.
* vm.c (rb_svar, rb_backref_get, rb_backref_get,
rb_lastline_get, rb_lastline_set) : moved from yarvcore.c.
* vm.c (yarv_init_redefined_flag): add a prototype and rename
yarv_opt_method_table to vm_opt_method_table.
* vm.c (rb_thread_eval): moved from yarvcore.c.
* yarvcore.c: remove unused global variables and fix to use nsdr().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* yarvcore.c: rename cYarvThread to rb_cThread.
* gc.c: remove YARV_* prefix.
* gc.h: add an include guard and prototype of rb_gc_set_stack_end().
* inits.c: fix to ANSI prototype style and reorder Init_*().
* io.c (pipe_finalize): TODO: comment out last_status.
* process.c, yarvcore.h: fix to use yarv_vm_t#last_status instead of
rb_last_status and make last_status_get() to access $?.
* yarvcore.c (vm_mark): mark yarv_vm_t#last_status.
* ruby.h: add declarations of rb_cISeq and rb_cVM.
* thread.c: move eval_thread.c codes to thread.c and remove yarv_*
function prefix.
* thread.c (thread_start_func_2): use yarv_thread_t#first_func if
it is not null.
* vm.c: fix copyright year.
* yarvcore.c (Init_vm): rename to Init_VM().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_thread_start_timer_thread()): added.
* thread_pthread.ci: add a native_thread_join() and move
rb_thread_reset_timer_thread() definition to thread.c.
* thread_win32.ci: ditto
* process.c: fix before_exec(), after_exec() to stop timer thread
(and restart timer thread if exec failed). and fix to reset
timer thread information when forked child process starts
(to fix [ruby-core:09822]).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/cgi.rb (CGI::out): should not convert utf-8 implicitly using
NKF. it is too Japanese centric.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(RARRAY_LEN): defined for accessing array members.
(RARRAY_PTR): ditto.
* array.c: use RARRAY_LEN and RARRAY_PTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(RSTRING_LEN): defined for accessing string members.
(RSTRING_PTR): ditto.
* string.c: use RSTRING_LEN and RSTRING_PTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e