Граф коммитов

538 Коммитов

Автор SHA1 Сообщение Дата
nobu 6f4d00e565 process.c: fix error message
* process.c (check_exec_redirect_fd): fix error message for unknown
  symbol.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-06 06:30:06 +00:00
kazu dbec401c11 use INT2FIX(0) instead of INT2NUM(0).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 16:31:19 +00:00
kosaki e93a68abfa * file.c (RB_MAX_GROUPS): moved to
* internal.h (RB_MAX_GROUPS): here.

* file.c (rb_group_member): use RB_MAX_GROUPS instead of
  RUBY_GROUP_MAX. They are the same.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 04:41:39 +00:00
nobu 7fd6f82fe1 process.c: ix typo
* process.c (USE_GETPWNAM_R): fix typo.  _SC_GETPW_R_SIZE_MAX instead
  of same macro twice.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-08 00:26:53 +00:00
akr 9b0a7f493e * process.c (obj2gid): use getgrnum_r() only if getgrnam_r() and
_SC_GETGR_R_SIZE_MAX is available.
  MirOS BSD (MirBSD 10 GENERIC#1382 i386) have getgrnam_r() but
  no _SC_GETGR_R_SIZE_MAX.
  (obj2uid): use getpwnam_r() only if getpwnam_r() and
  _SC_GETPW_R_SIZE_MAX is available.
  This is consistency for obj2gid.
  MirOS BSD have neither getpwnam_r() nor _SC_GETPW_R_SIZE_MAX.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-07 15:07:35 +00:00
nobu a16c576fac process.c: suppress warnings
* process.c (p_uid_change_privilege, p_gid_change_privilege): suppress
  set-but-unsed warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-15 14:07:20 +00:00
ko1 0f9b33c793 * thread.c: rename methods:
from Thread.async_interrupt_timing to Thread.handle_interrupt,
  from Thread.async_interrupted? to Thread.pending_interrupt?.
  Also rename option from `defer' to `never'.
  [ruby-core:51074] [ruby-trunk - Feature #6762]
* vm_core.c, thread.c: rename functions and data structure
  `async_errinfo' to `pending_interrupt'.
* thread.c: add global variables sym_immediate, sym_on_blocking and
  sym_never.
* cont.c, process.c, vm.c, signal.c: ditto.
* lib/sync.rb, lib/thread.rb: catch up this renaming.
* test/ruby/test_thread.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23 10:18:58 +00:00
ko1 f6f388a5bd * array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
range.c: use prepared IDs.
  A patch from charliesome (Charlie Somerville).
  [Bug #7495]
* common.mk: add dependency to id.h.
* common.mk: replace ID_H_INCLUDES with id.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 09:57:47 +00:00
kosaki 5611df706e * process.c (proc_getsid): adds new method for getting session id.
Contributed from fumiyas (Fumiyasu SATOH). Thank you!
  [Feature #6757] [ruby-dev:45977]
* configure.in: adds getsid check.
* test/ruby/test_process.rb (TestProcess#test_setsid): new test
  for the above.
* NEWS: news for the above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24 02:51:24 +00:00
usa ee2718039c * process.c (redirect_dup2): set standard handles when new fd is stdio,
because if there is no allocated console at the moment Windows does
  not automatically associate it for child process's standard handle.
  this is adhoc workaround.
  reported by Martin Thiede at [ruby-core:48542] [Bug #7239].

* io.c (rb_cloexec_dup2): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-30 10:32:56 +00:00
akr 7206f9bc79 * process.c (posix_sh_cmds): the command name of colon is ":".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-12 11:41:40 +00:00
nobu dd83dd6bda process.c: uid gid exec options
* process.c (rb_execarg_addopt, rb_execarg_run_options): add :uid and
  :gid options.  [ruby-core:47414] [Feature #6975]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-09 08:13:29 +00:00
naruse aa8dd0290b * process.c: exec() requires to be single threaded also on Haiku.
by Takashi Toyoshima <toyoshim@gmail.com>
  https://github.com/ruby/ruby/pull/178

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-09 15:17:15 +00:00
akr e7ddd1fdc3 * internal.h (rb_last_status_clear): declared.
* process.c (rb_last_status_clear): exported.
  (rb_f_system): call rb_last_status_clear.

* io.c (rb_f_backquote): call rb_last_status_clear.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-29 14:44:08 +00:00
akr 7c854d6d5e * process.c (rb_f_system): check failures of waitpid.
[ruby-talk:398687]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-29 13:02:45 +00:00
nobu 2933909caf remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 07:45:46 +00:00
nobu c05e6a8cda process.c: try conversion at redirection
* io.c (rb_io_check_io): make public.
* process.c (check_exec_redirect): try conversion to IO on redirect
  parameters.  [ruby-core:44181] [Bug #6269]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-27 09:25:54 +00:00
ko1 f4a8db647a * thread.c (rb_thread_s_control_interrupt,
rb_thread_s_check_interrupt): added for
  Thread.control_intgerrupt and Thread.check_interrupt.
  See details on rdoc.
  I'll make an ticket for this feature.
* test/ruby/test_thread.rb: add a test for Thread.control_intgerrupt.
* thread.c (rb_threadptr_raise): make a new exception object
  even if argc is 0.
* thread.c (rb_thread_kill): kill thread immediately if target thread
  is current thread.
* vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): added.
  CHECK_INTS while/after blocking operation.
* vm_core.h (RUBY_VM_CHECK_INTS): require rb_thread_t ptr.
* cont.c (fiber_switch): use replaced RUBY_VM_CHECK_INTS().
* eval.c (ruby_cleanup): ditto.
* insns.def: ditto.
* process.c (rb_waitpid): ditto.
* vm_eval.c (vm_call0): ditto.
* vm_insnhelper.c (vm_call_method): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-19 14:19:40 +00:00
ko1 28144433b2 * thread.c (rb_threadptr_async_errinfo_*): manage async errors queue.
Async events such as an exception throwed by Thread#raise,
  Thread#kill and thread termination (after main thread termination)
  will be queued to th->async_errinfo_queue.
  - clear: clear the queue.
  - enque: enque err object into queue.
  - deque: deque err object from queue.
  - active_p: return 1 if the queue should be checked.
  rb_thread_t#thrown_errinfo was removed.
* vm_core.h: add declarations of rb_threadptr_async_errinfo_*.
  remove rb_thread_t#thrown_errinfo field and
  add rb_thread_t#async_errinfo_queue (queue body: Array),
  rb_thread_t#async_errinfo_queue_checked (flag),
  rb_thread_t#async_errinfo_mask_stack(Array, not used yet).
* vm.c (rb_thread_mark): fix a mark function.
* cont.c (rb_fiber_start): enque an error.
* process.c (after_fork): clear async errinfo queue.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18 05:46:40 +00:00
nobu 7bca2f031a get rid of warnings
* io.c (sysopen_func, rb_sysopen_internal): cast through VALUE to get
  rid of warnings.  fixup of r36355.
* process.c (rb_waitpid_blocking, rb_waitpid): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-11 03:17:35 +00:00
nobu c51a826764 rb_thread_call_without_gvl
* include/ruby/thread.h: new header file for thread stuff.
* thread.c (rb_thread_call_without_gvl): export.  [Feature#4328]
  returns void* instead of VALUE.  [Feature #5543]
* thread.c (rb_thread_blocking_region): deprecate.  [ruby-core:46295]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-10 13:57:11 +00:00
kosaki 3e1d8aab17 * dln.c: Simplify and make consistent an ifdef for Mac OS X.
* ext/socket/rubysocket.h: ditto.
* ext/tk/stubs.c: ditto.
* io.c: ditto.
* process.c: ditto.
* signal.c: ditto.
* vm_dump.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-09 15:52:49 +00:00
akr f559d61607 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-28 10:38:26 +00:00
nobu f4d2374b45 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27 05:37:15 +00:00
nobu 2240eb37b8 popen: shell commands with envvars and execopts
* io.c (is_popen_fork): check if fork and raise NotImplementedError if
  unavailable.
* io.c (rb_io_s_popen): allow environment variables hash and exec
  options as flat parameters, not in an array arguments.
  [Feature#6651] [EXPERIMENTAL]
* process.c (rb_execarg_extract_options): extract exec options, but no
  exceptions on non-exec options and returns them as a Hash.
* process.c (rb_execarg_setenv): set environment variables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27 00:15:51 +00:00
nobu ffa20cf154 use rb_check_hash_type
* class.c (rb_scan_args): use rb_check_hash_type.
* process.c (rb_exec_getargs): ditto.
* sprintf.c (get_hash): ditto.
* string.c (rb_str_sub_bang, str_gsub): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-26 07:46:24 +00:00
nobu 5be0ab591c process.c: separate check_exec_fds_1
* process.c (check_exec_fds): separate check_exec_fds_1() since
  nonstatic initializer of an aggregate type is not allowed by C89.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-24 13:53:44 +00:00
akr 78993d43c7 update async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-24 13:35:56 +00:00
akr 72bbf9822d * internal.h (rb_execarg): options field removed.
* process.c: follow the rb_execarg change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 22:48:11 +00:00
akr 1ad4751aac * process.c (proc_spawn_cmd): unused variable removed to suppress a
warning.
  (save_env): ditto.

  [ruby-core:45797] reported by Luis Lavena.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 14:50:38 +00:00
akr f1734b4287 * internal.h (rb_execarg): add new_pgroup_given and new_pgroup_flag
fields.

* process.c (EXEC_OPTION_NEW_PGROUP): removed.
  (proc_spawn_cmd): take a struct rb_execarg argument.
  use the new fields.
  (rb_execarg_addopt): use the new fields.
  (rb_spawn_process): follow the proc_spawn_cmd change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 14:21:47 +00:00
akr 345ecf3711 * internal.h (rb_execarg): add fd_dup2, fd_close, fd_open,
fd_dup2_child fields.

* process.c (EXEC_OPTION_DUP2): removed.
  (EXEC_OPTION_CLOSE): removed.
  (EXEC_OPTION_OPEN): removed.
  (EXEC_OPTION_DUP2_CHILD): removed.
  (mark_exec_arg): mark the new fields.
  (check_exec_redirect1): change condition for default option.
  (check_exec_redirect): take a struct rb_execarg argument.
  use the new fields.
  (rb_execarg_addopt): follow the check_exec_redirect change.
  (check_exec_fds): use the new fields.
  (save_redirect_fd): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 11:35:32 +00:00
akr fe688f2d30 * process.c (rb_execarg_fixup): fix envopts condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 10:01:46 +00:00
akr 759c214a33 * process.c (check_exec_redirect1): extracted from
check_exec_redirect.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 09:44:43 +00:00
akr 92af9dddc8 * process.c (save_env): don't use EXEC_OPTION_UNSETENV_OTHERS.
(rb_execarg_run_options): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 08:22:53 +00:00
akr 26ecb6cbc4 * internal.h (rb_execarg): add env_modification field.
* process.c (EXEC_OPTION_ENV): removed.
  (mark_exec_arg): mark env_modification field.
  (rb_exec_fillarg): update the new field, instead of options array.
  (rb_execarg_fixup): use the new field.
  (save_env): ditto.
  (rb_execarg_run_options): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 08:18:34 +00:00
akr f732c5046e * internal.h (rb_execarg): add rlimit_limits field.
* process.c (EXEC_OPTION_RLIMIT): removed.
  (mark_exec_arg): mark rlimit_limits field.
  (rb_execarg_addopt): update the new fields, instead of options array.
  (run_exec_rlimit): use the new field.
  (rb_execarg_run_options): clear sarg using MEMZERO.  use the new
  field.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 07:30:26 +00:00
akr b25b9569e5 * internal.h (rb_execarg): add chdir_given and chdir_dir fields.
* process.c (EXEC_OPTION_CHDIR): removed.
  (mark_exec_arg): mark chdir_dir field.
  (rb_execarg_addopt): update the new fields, instead of options array.
  (rb_execarg_run_options): use the new fields.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 06:23:35 +00:00
akr f527ad625d * internal.h (rb_execarg): add close_others_given, close_others_do and
close_others_maxhint fields.

* process.c (EXEC_OPTION_CLOSE_OTHERS): removed.
  (rb_execarg_addopt): update the new fields, instead of options array.
  (check_exec_fds): take eargp as an argument.  update the
  close_others_maxhint field.
  (rb_execarg_fixup): follow the argument change of check_exec_fds.
  (rb_execarg_run_options): use the new fields.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 04:23:03 +00:00
akr 40ae2e0108 * internal.h (rb_execarg): add unsetenv_others_given and
unsetenv_others_do fields.

* process.c (EXEC_OPTION_UNSETENV_OTHERS): removed.
  (rb_execarg_addopt): update the new fields, instead of options array.
  (rb_execarg_fixup): use the new fields.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 01:43:51 +00:00
akr 2a15a26c57 * process.c: use the variable name "soptions" for sargp->options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 00:36:42 +00:00
akr 5c25fad66d * process.c: use the name "sargp" for struct rb_execarg variables
consistently for saving process attributes. 

* io.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23 00:18:32 +00:00
akr 3eafc1660f * process.c: use the name "eargp" for struct rb_execarg variables
consistently except for saving process attributes. 

* io.c: ditto.

* ext/pty/pty.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 23:09:16 +00:00
akr bcadfd9c08 * internal.h (rb_execarg): add pgroup_given and pgroup_pgid fields.
* process.c (EXEC_OPTION_PGROUP): removed.
  (rb_execarg_addopt): update the new fields, instead of options array.
  (run_exec_pgroup): take a struct rb_execarg argument.  refer the new
  fields.
  (rb_execarg_run_options): follow run_exec_pgroup change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 11:30:29 +00:00
akr 471d8d2586 * process.c: pass struct rb_execarg value instead of its options
field for saving process attribute changing functions.
  (save_redirect_fd): take a struct rb_execarg argument.
  (run_exec_dup2): ditto.
  (run_exec_close): ditto.
  (run_exec_open): ditto.
  (run_exec_dup2_child): ditto.
  (run_exec_pgroup): ditto.
  (run_exec_rlimit): ditto.
  (save_env): ditto.
  (rb_execarg_run_options): follow the above functions change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 09:24:21 +00:00
nobu 47c6131b29 process.c: constant expression
* process.c (rb_exec_async_signal_safe): use a constant expression
  instead of a macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 03:07:26 +00:00
akr ed8040a62b * process.c (rb_execarg_addopt): take a VALUE argument instead of
struct rb_execarg.
  (rb_exec_arg_addopt): follow the rb_execarg_addopt change.
  (check_exec_options_i): ditto.

* io.c (pipe_open): follow the rb_execarg_addopt change.

* internal.h (rb_execarg_addopt): follow the definition change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 12:18:40 +00:00
akr 511e25b2d5 * process.c (rb_exec_fillarg): take a VALUE argument instead of
struct rb_execarg.
  (rb_check_exec_options): ditto.
  (check_exec_options_i): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 11:36:25 +00:00
akr 1b2c2316a5 * process.c (rb_exec_async_signal_safe): use rb_execarg_run_options
instead of rb_run_exec_options_err.
  (rb_spawn_process): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 10:48:48 +00:00
akr 0a431f6903 * process.c (rb_exec_fillarg): take a VALUE argument instead of
struct rb_execarg.
  (rb_execarg_init): follow the rb_exec_fillarg change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 10:03:23 +00:00