* process.c (initgroups): not declared on cygwin if _POSIX_SOURCE
or _XOPEN_SOURCE are defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
process blocking when opening a named pipe.
(open_func): New function.
(rb_execarg_parent_start1): Extracted from rb_execarg_parent_start and
use rb_thread_call_without_gvl2 to release GVL when opening a file.
(rb_execarg_parent_start): Invoke rb_execarg_parent_start1 via
rb_protect and invoke rb_execarg_parent_end when error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c: "spawn" opens files in the parent process.
(check_exec_redirect): Add an placeholder for fd in parameters
for fd_open.
(check_exec_fds_1): Delete fd_open condition.
(check_exec_fds): Don't call check_exec_fds_1 with fd_open.
(rb_execarg_parent_start): Open files specified as "spawn" options
and add "dup2" options.
(rb_execarg_parent_end): New function to close opened fds.
(run_exec_open): Removed.
(rb_execarg_run_options): Don't call run_exec_open.
(rb_spawn_internal): Call rb_execarg_parent_end.
* io.c (pipe_open): Call rb_execarg_parent_end.
* ext/pty/pty.c (establishShell): Call rb_execarg_parent_end.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (env_aset): state that ENV keys must be strings.
* process.c (rb_f_spawn): ditto. [ruby-core:68146] [Bug #10859]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
It seems waitpid() is universaly available on POSIX platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (rb_fork_async_signal_safe): remove initialized but
never assigned local variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (check_exec_redirect_fd, check_exec_redirect),
(rb_execarg_addopt): get rid of inadvertent ID pindown.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Note: Some of the fixes are for newlib in general but not NaCl-specific.
* include/ruby/intern.h (rb_fd_select): declare struct timeval, or the
struct gets local to the function in C99.
* file.c (#include): add nacl/stat.h for PNaCl.
(utimes): added a declaration for PNaCl.
(stat_atimespec): stat::st_atimensec is long long but
timespec::tv_nsec is long in PNaCl.
(stat_mtimespec, stat_ctimespec): ditto.
(rb_group_member): disable getgroups unless HAVE_GETGROUPS.
(eaccess): unify the fallback to generic defined(USE_GETEUID).
* io.c: include sys/time.h for struct timeval.
(rb_close_before_exec): nothing we can do if F_GETFD is not
available.
(ioctl): pnacl newlib actually doesn't have ioctl.
* process.c (maxgroups): it is used iff
defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX) but not
defined(HAVE_GETGROUPS) || defined(HAVE_SETGROUPS).
(obj2gid): fail unless the object is a Fixnum if getgrnam is not
available.
(disable_child_handler_fork_child): sigaction is not available in
PNaCl newlib.
* configure.in (warnflags, strict_warnflags): avoid -ansi for strlcpy.
(rb_cv_gcc_atomic_builtins): also check
__atomic_or_etch because it is used in ruby_atomic.h.
(rb_cv_gcc_sync_builtins): ditto.
(HAVE_GETGRNAM): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (free_exec_arg): remove
(memsize_exec_arg): ptr is never NULL
(exec_arg_data_type): use RUBY_TYPED_DEFAULT_FREE
* variable.c (autoload_i_free): remove
(autoload_data_i_type): use RUBY_TYPED_DEFAULT_FREE
(autoload_memsize): ptr is never NULL
* vm_backtrace.c (location_free): remove
(location_mark): ptr is never NULL
(location_data_type): use RUBY_TYPED_DEFAULT_FREE
(backtrace_mark): ditto
(backtrace_free): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (Init_process): subclass Thread as Process::Waiter
(rb_detach_process): use Process::Waiter instead of singleton class
* test/ruby/test_process.rb (test_process_detach): new test
* inits.c (rb_call_inits): call Init_Thread before Init_process to
ensure Process::Waiter may be a subclass of Thread
Thanks to headius for reporting [Bug #10231]
Thanks to nobu for review of my initial patch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (retry_fork_async_signal_safe): revert r47439 but
disable use of vfork on OS X instead, as it cause hang-up at
test_process.rb:test_deadlock_by_signal_at_forking with parallel
test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (retry_fork_async_signal_safe): vfork may not work
with pthread always even if fork works with it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (rb_exec_without_timer_thread): add missing semicolon
to fix compilation error on OS X and Haiku.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (getresuid): Defined for AIX.
(getresgid): Ditto
AIX don't have getresuid/getresgid but getuidx/getgidx.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vfork() is still faster than fork() especially when the parent
process uses big memory.
ruby -rbenchmark -e 'a = "a" * 1_000_000_000; puts Benchmark.measure { system("true") }'
fork: 0.000000 0.010000 0.010000 ( 0.014968)
vfork: 0.000000 0.000000 0.000000 ( 0.000912)
on Debian sid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
retry_fork respect to rb_fork_async_signal_safe.
(retry_fork_ruby): Specialized version of retry_fork respect to
rb_fork_ruby.
(rb_fork_ruby): Removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e