summaryrefslogtreecommitdiff
path: root/process.c
AgeCommit message (Collapse)Author
2014-10-11Fixes build failures on Portable Native Client.yugui
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
2014-09-30protoize no-arguments functionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15trivial packing for on-stack structsnormal
* io.c (struct io_advise_struct): 32 => 24 bytes on 64-bit * io.c (struct io_internal_writev_struct): 24 => 16 bytes on 64-bit * process.c (struct waitpid_arg): ditto Slightly reduce stack pressure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-13simplify some trivial rb_data_type_t callbacksnormal
* 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
2014-09-12Process.detach: avoid singleton class creationnormal
* 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
2014-09-07* process.c: PTHREAD_CANCEL_DISABLE is not defined on Android.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-07process.c: disable vfork on OS Xnobu
* 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
2014-09-07process.c: vfork may not work with pthreadnobu
* 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
2014-09-06* process.c (has_privilege): The gid zero is not a privilege.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-06* process.c (struct child_handler_disabler_state): cancelstate fieldakr
added. (disable_child_handler_before_fork): Record cancelstate. (disable_child_handler_fork_parent): Restore cancelstate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-06* process.c (struct child_handler_disabler_state): Defined.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05process.c: missing semicolonnobu
* 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
2014-09-05* process.c (rb_f_exec): Call before_exec_async_signal_safe andakr
after_exec_async_signal_safe around rb_exec_async_signal_safe. (rb_exec_async_signal_safe): Don't call before_exec_async_signal_safe and after_exec_async_signal_safe. (rb_exec_without_timer_thread): Call before_exec and after_exec. (disable_child_handler_fork_child): Make SIGPIPE handler SIG_DFL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05Unwrap a useless block.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05* process.c (disable_child_handler_before_fork): New function.akr
(disable_child_handler_fork_parent): Ditto. (disable_child_handler_fork_child): Ditto. (retry_fork_async_signal_safe): Call above functions to disable signal handlers in child process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05* process.c (handle_fork_error): Make try_gc_p argument volatile toakr
suppress "clobbered" warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05* process.c (handle_fork_error): Don't need state_p argument.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05* process.c (has_privilege): Fix a return value.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05* process.c (has_privilege): Refine uid/gid check.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05* configure.in: Check sys/id.h, getuidx and getgidx for AIX.akr
* 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
2014-09-05* process.c (has_privilege): Fix assignements.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04* process.c (has_privilege): New function.akr
(retry_fork_async_signal_safe): Don't use vfork() for privileged process. * configure.in (getresuid): Check function. (getresgid): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03* process.c (before_fork_ruby): Renamed from before_fork.akr
(after_fork_ruby): Renamed from after_fork. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03* process.c (forked_child): Removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-03* process.c (retry_fork_async_signal_safe): Use vfork() if available.akr
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
2014-09-02* configure.in: Use AC_FUNC_FORK.akr
* io.c: Use HAVE_WORKING_FORK instead of HAVE_FORK. * process.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02* process.c (retry_fork_async_signal_safe): Don't return on in childakr
process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02* process.c (retry_fork_async_signal_safe): Specialized version ofakr
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
2014-09-02* process.c (send_child_error): Simplified.akr
(recv_child_error): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02* process.c (rb_fork_async_signal_safe): Inline rb_fork_internal.akr
(rb_fork_ruby): Ditto. (rb_fork_internal): Removed. (chfunc_protect): Removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02* process.c (handle_fork_error): Extracted from retry_fork.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30get rid of function calls in RSTRING_PTRnobu
* process.c (rlimit_resource_type, rlimit_resource_value): get rid of function calls in RSTRING_PTR(), as it evaluates the argument twice. * re.c (match_backref_number): ditto. * signal.c (esignal_init, rb_f_kill, trap_signm): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30* process.c (rlimit_resource_type, rlimit_resource_value):ktsj
get rid of inadvertent dynamic symbol pin-down. * re.c (match_backref_number): ditto. * signal.c (esignal_init, rb_f_kill, trap_signm): ditto. * transcode.c (econv_opts): ditto. * vm_trace.c (symbol2event_flag): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18constify parametersnobu
* include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-16process.c: use UTF-8nobu
* process.c (open): use UTF-8 version function to support non-ascii path properly. [ruby-core:63185] [Bug #9946] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-16process.c: variable as macro argumentnobu
* process.c (run_exec_open): use a local variable to get rid of RARRAY_AREF() is evaluated multiple times by RSTRING_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-15process.c: use RB_TYPE_Pnobu
* process.c (check_exec_redirect): use RB_TYPE_P instead of single comparison of TYPE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-24process.c (proc_getgroups, proc_setgroups): use ALLOCV_Nnormal
* process.c (proc_getgroups, proc_setgroups): use ALLOCV_N [Bug #9856] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10process.c: use ruby_stopnobu
* process.c (rb_exit): call ruby_stop() which calls ruby_cleanup(), instead of calling ruby_finalize() directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09[DOC]akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05* process.c (check_exec_redirect): Open the file in write mode forakr
redirect from [:out, :err]. Proposed and implemented by Yusuke Endoh. [ruby-dev:41430] [Feature #3348] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02[DOC]akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-09* process.c (OBJ2UID1): Defined even if getpwnam_r is not usable.akr
(OBJ2GID1): Defined even if getgrnam_r is not usable. This fixes compilation error on Android. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-30process.c: preserve encodingsnobu
* process.c (rlimit_resource_type, rlimit_resource_value): preserve argument encoding in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17process.c: constifynobu
* process.c (rb_execarg_new, rb_execarg_init): constify argv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08process.c: expand buffer on ERANGEnobu
* process.c (obj2uid, obj2gid): now getpwnam_r() and getgrnam_r() may need larger buffers than sysconf values, so retry with expanding the buffer when ERANGE is returned. [ruby-core:61325] [Bug #9600] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08process.c: need capacitynobu
* process.c (obj2uid, obj2gid): need capacity as buffer size, not length. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08process.c: GETPW_R_SIZE_INIT, GETGR_R_SIZE_INITnobu
* process.c (GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT): sysconf values are not maximum sizes, but initial sizes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08process.c: tmp buffer instead of allocanobu
* process.c (OBJ2UID1, OBJ2GID1): separate from OBJ2UID and OBJ2GID respectively, need given buffers. * process.c (OBJ2UID, OBJ2GID): no longer need PREPARE_GETPWNAM and PREPARE_GETGRNAM. * process.c (obj2uid, obj2gid): use tmp buffer instead of alloca to get rid of potential stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-23* process.c: [DOC] typo fix by @jkassemi [fix GH-544][ci skip]hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e