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

715 Коммитов

Автор SHA1 Сообщение Дата
naruse 2a732947a6 * process.c (make_clock_result): add :second as a unit for
Process.clock_gettime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-16 05:04:03 +00:00
charliesome e0290c9404 * array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL
* process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
  barriers where appropriate

* vm.c (kwmerge_i): use RHASH_TBL_RAW

* vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
  st_insert

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-08 00:41:01 +00:00
nobu 7566c49068 ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLIST
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration
  argument list of rb_block_call_func.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 07:59:14 +00:00
nobu 9f45081627 ruby/ruby.h: add blockarg to rb_block_call_func
* include/ruby/ruby.h (rb_block_call_func): add blockarg.  block
  function can take block argument, e.g., proc {|&blockarg| ...}.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 02:26:48 +00:00
nobu 21f81885ab win32.c: rb_w32_dup2
* win32/win32.c (rb_w32_dup2): extract from rb_cloexec_dup2() and
  redirect_dup2().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-28 07:15:56 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
nobu d956453a98 process.c: Process::Tms
* process.c (Init_process): rename Struct::Tms as Process::Tms.  keep
  the former defined for the backward compatibility, for the time
  being.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-27 01:38:20 +00:00
akr c2bbe4b01e * process.c: Fix a typo. MacOS X don't have ENOTSUPP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-15 08:48:33 +00:00
nobu ddef263a89 process.c: remove cloexec setting
* process.c (rb_fork_internal): remove cloexec setting on pipes
  created by rb_cloexec_pipe.  patch by normalperson (Eric Wong) at
  [ruby-core:56523].  [Bug #8769]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-21 11:11:10 +00:00
akr 888e5cbbe7 * process.c: Remove spaces between SI prefix and unit to follow
SI brochure.
  http://www.bipm.org/en/si/si_brochure/
  https://www.nmij.jp/library/units/si/

* time.c: Ditto.

* ext/socket/ancdata.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09 12:33:36 +00:00
akr bc3d736f43 * process.c (rb_clock_gettime): Support times() based monotonic clock.
(rb_clock_getres): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 03:10:41 +00:00
akr 8a108ffc21 * process.c (get_mach_timebase_info): Extracted from rb_clock_gettime.
(rb_clock_gettime): Use get_mach_timebase_info.
  (rb_clock_getres): Support MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 15:09:06 +00:00
nobu cec97f40f6 process.c: suppress warning
* process.c (rb_clock_getres): move conditionally used variable to the
  proper block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 09:04:10 +00:00
akr 23da5a785e * process.c (rb_clock_getres): New method.
(timetick2dblnum_reciprocal): New function.

* configure.in: Check clock_getres.

[ruby-core:56780] [Feature #8809] accepted at
DevelopersMeeting20130831Japan
https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130831Japan



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-31 13:21:48 +00:00
kazu ae5ac37f2d fix typo
* process.c (gcd_timetick_int): Renamed from gcd_timtick_int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26 01:39:19 +00:00
akr cd9f60dfa5 [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-24 02:19:41 +00:00
akr 8eb27cb16f [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-24 02:01:07 +00:00
akr 811eaddf4c * process.c (rb_clock_gettime): The emulated clock names changed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-24 01:38:34 +00:00
akr a0cac92b34 * process.c (rb_clock_gettime): Add a cast to fix compile error by
-Werror,-Wshorten-64-to-32.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-23 13:25:12 +00:00
nobu 703bd17594 process.c: no symbol cache
* process.c (rb_intern): no symbol cache while initialization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-23 13:12:46 +00:00
akr ca0b5118a5 * process.c (reduce_factors): New function.
(timetick2dblnum): Use reduce_factors.
  (timetick2integer): Ditto.
  (make_clock_result): Follow the above change.
  (rb_clock_gettime): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-23 12:46:06 +00:00
akr f0bf7f7518 * process.c (timetick_int_t): Renamed from timetick_giga_count_t.
(gcd_timtick_int): Renamed from gcd_ul and make the arguments
  timetick_giga_count_t.
  (reduce_fraction): Make the arguments timetick_int_t.
  (timetick2integer): Ditto.
  (make_clock_result): Ditto.
  (timetick2dblnum): Fix the return type.
  (rb_clock_gettime): Use timetick_int_t.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-23 12:06:02 +00:00
akr bf9ce0429f Fix the previous commit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-23 11:53:12 +00:00
akr 49b9f61fdb * process.c (gcd_ul): New function.
(reduce_fraction): Ditto.
  (reduce_fraction): Ditto.
  (timetick2dblnum): Ditto.
  (timetick2integer): Ditto.
  (make_clock_result): Use timetick2dblnum and timetick2integer.
  (rb_clock_gettime): Follow the make_clock_result change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-23 10:44:33 +00:00
nobu fb8b2689db process.c: suppress warnings
* process.c (rb_clock_gettime): cast for tv_nsec explicitly to
  suppress warnings by VC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-23 02:17:25 +00:00
akr a641003f66 * process.c (rb_clock_gettime): Strip "s" from unit names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-22 13:04:06 +00:00
akr 3873e09cad * process.c (unsigned_clock_t): Defined.
(rb_clock_gettime): Consider clock_t overflow for
  ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID.

* configure.in: Check the size of clock_t.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-22 11:19:49 +00:00
akr 9438bc0c86 Exchange order of ISO_C_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID and
POSIX_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 22:17:55 +00:00
akr cda87d9e00 * process.c (rb_clock_gettime): Change emulation symbols for
Process.clock_gettime.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 21:57:25 +00:00
akr 47ae41ce34 * process.c (make_clock_result): Extracted from rb_clock_gettime.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 21:27:44 +00:00
akr 4c661094c9 * process.c (rb_clock_gettime): clock() based CLOCK_PROCESS_CPUTIME_ID
emulation implemented.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 13:33:59 +00:00
akr 31a092c687 * process.c (rb_proc_times): Use RB_GC_GUARD to guard objects from GC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 12:05:29 +00:00
akr 4b033d2692 * process.c (get_clk_tck): Extracted from rb_proc_times.
(rb_clock_gettime): times() based CLOCK_PROCESS_CPUTIME_ID emulation
  is implemented.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 11:36:43 +00:00
akr a24930bf08 * process.c: POSIX_GETTIMEOFDAY_CLOCK_REALTIME is renamed to
SUS_GETTIMEOFDAY_CLOCK_REALTIME.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 10:31:59 +00:00
akr 167419848f * process.c (rb_clock_gettime): CLOCK_PROCESS_CPUTIME_ID emulation
using getrusage is implemented.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-21 10:18:37 +00:00
nobu 7f9f6c3122 process.c: retry fork if ENOMEM
* process.c (retry_fork): retry with GC if ENOMEM occurred, to free
  swap/kernel space.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-19 08:01:26 +00:00
akr 0a0c96308f * process.c (Init_process): Add constants: CLOCK_REALTIME_ALARM and
CLOCK_BOOTTIME_ALARM.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-19 03:57:23 +00:00
akr 408b8110d5 * process.c (rb_clock_gettime): Rename POSIX_TIME_CLOCK_REALTIME to
ISO_C_TIME_CLOCK_REALTIME.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18 05:34:13 +00:00
akr 2a47ee5e78 * process.c (Init_process): Add constants: CLOCK_REALTIME_COARSE,
CLOCK_MONOTONIC_COARSE and CLOCK_BOOTTIME.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-18 04:21:33 +00:00
akr 61313ade46 [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-17 11:23:16 +00:00
eregon ce34fce82b * process.c: [DOC] MACH_ABSOLUTE_TIME_CLOCK_MONOTONIC is an
available emulation for a monotonic clock on Darwin.
  https://developer.apple.com/library/mac/qa/qa1398/_index.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-17 11:13:01 +00:00
eregon 2a0482b4d4 * process.c: revert r42591. Only an emulation is available on Darwin.
[ruby-core:56672]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-17 08:24:41 +00:00
eregon 1a5b74a252 * process.c (rb_clock_gettime): document CLOCK_REALTIME and
CLOCK_MONOTONIC are now available on Darwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-16 16:55:13 +00:00
nobu d51138ddad process.c: downcast
* process.c (rb_clock_gettime): downcast for I32 environment.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-16 08:15:09 +00:00
naruse b26f8003c3 * process.c (rb_clock_gettime): add CLOCK_MONOTONIC support on OS X.
http://developer.apple.com/library/mac/qa/qa1398/_index.html
  [Feature #8658]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-15 17:18:45 +00:00
akr 1c9df374f3 * process.c (rb_clock_gettime): [DOC] FreeBSD 7.1 supports
CLOCK_THREAD_CPUTIME_ID.
  http://www.freebsd.org/releases/7.1R/relnotes.html



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-15 06:50:37 +00:00
zzak 7f0a26e271 * process.c: [DOC] RDoc formatting of Process.clock_gettime
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-12 04:48:28 +00:00
akr cef46a5e72 [DOC] update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-11 03:43:04 +00:00
akr 93bb48995c * process.c (rb_clock_gettime): New method.
This is accepted in the meeting:
  https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20130809
  This method is accepted as a CRuby feature.
  I.e. Other Ruby implementations don't need to implement it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-11 02:59:30 +00:00
zzak 0bd6f36aa7 * process.c: [DOC] Document caveats of command form of Process.spawn
with regard to the shell and OS. Patched by Steve Klabnik [Bug #8550]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-05 16:42:37 +00:00
naruse 300b7c80e4 * process.c (rb_daemon): daemon(3) is implemented with fork(2).
Therefore it needs rb_thread_atfork(). (and revert r41903)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-11 01:13:10 +00:00
nobu 863d148a4e process.c: kill threads in daemon process
* process.c (fork_daemon): kill the other threads all and abandon the
  kept mutexes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-10 05:19:01 +00:00
nobu 5956967a99 process.c: remove ineffective assignment
* process.c (rb_exec_fillarg): remove ineffective assignment unless
  default process encoding is set.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-30 14:16:26 +00:00
nobu 637d668bca win32: UTF-8 spawn
* io.c (spawnv, spawn): use UTF-8 spawn family.  [Bug #1771]
* process.c (proc_exec_sh, proc_spawn_cmd, proc_spawn_sh): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-30 01:59:21 +00:00
nobu 69bbcbe4c1 process.c: default process encoding
* process.c (EXPORT_STR, EXPORT_DUP): convert to default process
  encoding if defined.
* process.c (check_exec_env_i): convert environment variables too.
* process.c (rb_exec_fillarg): convert program path and arguments too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-30 01:57:18 +00:00
nobu 3e9c0bfaeb process.c: adjust indent
* process.c (exec_arg_data_type): adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-30 01:57:16 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
nobu 5c11384416 adjust style
* process.c (rb_execarg_get): adjust style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-04 08:23:26 +00:00
naruse 94b120fe75 add some rdoc
* add reference to spawn to fork
* add an example which runs ruby

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-03 02:37:34 +00:00
nobu 6db56c86c9 fill rdocs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 03:12:04 +00:00
zzak 1d80ad6a39 * process.c: Improve Process::exec documentation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-31 08:58:06 +00:00
zzak 89a452c7c1 * process.c: RDoc on Process.spawn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-30 08:55:41 +00:00
akr 184bfbba7f Update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-30 03:57:46 +00:00
ko1 c4c821a7d7 * hash.c (rb_hash_tbl_raw), internal.h: added.
Returns st_table without shading hash.
* array.c: use rb_hash_tbl_raw() for read-only purpose.
* compile.c (iseq_compile_each): ditto.
* gc.c (count_objects): ditto.
* insns.def: ditto.
* process.c: ditto.
* thread.c (clear_coverage): ditto.
* vm_insnhelper.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-26 16:19:04 +00:00
kazu c54733e120 fix typos inspired by r40825
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 14:50:47 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
kosaki 93d061a8fd * process.c: move '#define SPAWNV 1' to win32/Makefile.sub.
* win32/Makefile.sub: see above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 08:42:19 +00:00
nobu ce3029cd19 process.c: fix failed status with spawnv
* process.c (proc_spawn_cmd_internal, proc_spawn_sh): spawn() with
  P_NOWAIT returns process ID, so it must not be set as a status.

* process.c (rb_spawn_process): set failed status on error on
  platforms using spawnv not only on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02 04:02:32 +00:00
nobu cdce1dd4ef process.c: rb_daemon should not raise
* process.c (rb_daemon): should not raise exceptions, since
  proc_daemon() will deal with errors.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01 03:14:55 +00:00
akr 1a67580eb5 * process.c (obj2gid): Don't call endgrnam() if not exist.
Bionic (Android's libc) don't have endgrnam().

* configure.in: Check endgrnam function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-27 15:38:36 +00:00
akr 2767139e05 * process.c: Describe the behavior which Ruby invokes a commandline
directly without shell if the commandline is simple enough.
  [ruby-core:50459] [Bug #7489]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-03 11:55:18 +00:00
kazu 7e052c7b81 use rb_pid_t instead of pid_t.
* process.c (rb_execarg_addopt, run_exec_pgroup): use rb_pid_t
  instead of pid_t.

* ext/pty/pty.c (raise_from_check, pty_check): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-21 16:11:32 +00:00
kosaki de6d82f907 * process.c (setup_communication_pipe): remove unused function.
it was unintentionally added r39683.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 06:04:51 +00:00
kosaki 383a2579c3 * thread_pthread.c (rb_thread_create_timer_thread): factor out
creating communication pipe logic into separate function.
* thread_pthread.c (setup_communication_pipe): new helper function.
* thread_pthread.c (set_nonblock): moves a definition before
  setup_communication_pipe.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 03:59:49 +00:00
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
akr 46e23dc03d * process.c (rb_execarg_init): take a VALUE argument instead of
struct rb_execarg.
  (rb_execarg_new): follow the rb_execarg_init change.
  (rb_exec_arg_init): ditto.

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



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 09:39:10 +00:00
nobu b8b67c0b9d process.c: fix type
* process.c (rb_spawn_internal): fix type of a local variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21 05:08:24 +00:00
akr d73d3a743b * process.c (rb_execarg_fixup): take a VALUE argument instead of
struct rb_execarg.

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

* io.c (pipe_open): follow rb_execarg_fixup change.

* ext/pty/pty.c (establishShell): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 21:25:20 +00:00
akr 5309af971d * internal.h (struct rb_execarg): add umask_given and umask_mask
fields.

* process.c (STATIC_ASSERT): removed.
  (rb_execarg_addopt): follow the rb_execarg change.
  (rb_execarg_run_options): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 12:27:09 +00:00
akr b60713de73 * internal.h (struct rb_execarg) moved and renamed from
struct rb_exec_arg in intern.h.

* include/ruby/intern.h (struct rb_exec_arg): refer Data object which
  contains struct rb_execarg.

* process.c: use struct rb_execarg instead of struct rb_exec_arg
  except functions declared in intern.h.
  (rb_exec_arg_addopt): extract a pointer to struct rb_execarg from
  struct rb_exec_arg.
  (rb_exec_arg_init): ditto.
  (rb_exec_arg_fixup): ditto.
  (rb_run_exec_options_err): ditto.
  (rb_run_exec_options): ditto.
  (rb_exec_err): ditto.
  (rb_exec): ditto.

* io.c: use struct rb_execarg instead of struct rb_exec_arg.

* ext/pty/pty.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 11:46:50 +00:00
akr 826f98e688 * internal.h (rb_execarg_new): declared.
(rb_execarg_get): ditto.

* process.c (mark_exec_arg): new function.
  (free_exec_arg): ditto.
  (memsize_exec_arg): ditto.
  (exec_arg_data_type): defined.
  (rb_execarg_new): new function.
  (rb_execarg_get): ditto.
  (rb_f_exec): use rb_execarg_new.
  (rb_spawn_internal): ditto.
  (rb_f_spawn): ditto.

* io.c (pipe_open_v): use rb_execarg_new.
  (pipe_open_s): ditto.

* ext/pty/pty.c (establishShell): use rb_execarg_new.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 10:31:02 +00:00
nobu 5a24475a13 process.c: fixnum umask
* process.c (rb_execarg_addopt): always make Fixnum, and ignore higher
  bits in too large umask value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 02:33:06 +00:00
akr a60fe909d7 fix async-signal-safe comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 09:14:18 +00:00
nobu 52b497d8b7 process.c: no method calls in async-signal-safe
* process.c (rb_execarg_run_options): do not call any methods in the
  async-signal-safe function.  mask has been checked with NUM2MODET()
  already and converted with LONG2NUM().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 08:51:57 +00:00
akr ea325fcd67 * process.c (proc_exec_sh): don't strip leading spaces of the script.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 13:11:41 +00:00
akr b41bc68688 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 20:55:40 +00:00
akr d793a86b43 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 11:37:33 +00:00
akr e9a1ba232a * process.c (rb_fork_internal): move a variable declaration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 11:20:33 +00:00
nobu 9c48976392 process.c: suppress warning
* process.c (compare_posix_sh): not used on Win32.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 07:38:06 +00:00
nobu 621153bf3f process.c: no SIZE_T_MAX
* process.c (rb_exec_fillarg): get rid of SIZE_T_MAX which may need
  more headers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 01:20:29 +00:00
nobu 33b15cef6c process.c: fix array element size
* process.c (rb_exec_fillarg): fix array element size.  "continue" and
  "readonly" exceeded the size.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 01:20:05 +00:00
nobu 2d460925f2 process.c: use shell for reserved or special built-in
* process.c (rb_exec_fillarg): use shell if the first word is reserved
  or special built-in name.
  http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 00:56:31 +00:00
nobu e6a6561121 process.c: treat '=' only in the first word
* process.c (rb_exec_fillarg): treat '=' only in the first word.  if
  the first word does not contain '=', it is the command name and
  environment assignments cannot be anymore.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 00:55:31 +00:00
nobu 18c32c9451 process.c: constified
* process.c (rb_exec_fillarg): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-13 00:54:32 +00:00
ngoto 3f4b0e17f4 * process.c (rb_exec_arg_fixup): fix compile error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12 13:55:42 +00:00
akr 640e0a33b7 * process.c (rb_exec_fillarg): treat '=' character as an meta
character to detect assignments preceding command name.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12 12:41:08 +00:00
akr 37a1355bf8 * include/ruby/intern.h (rb_exec_arg_init): deprecated.
(rb_exec_arg_addopt): ditto.
  (rb_exec_arg_fixup): ditto.
  (rb_run_exec_options): ditto.
  (rb_run_exec_options_err): ditto.

* internal.h (rb_execarg_init): declared.
  (rb_execarg_addopt): ditto.
  (rb_execarg_fixup): ditto.
  (rb_execarg_run_options): ditto.

* process.c: call rb_execarg_addopt, rb_execarg_fixup,
  rb_execarg_run_options, rb_execarg_init.
  (rb_execarg_addopt): renamed from rb_exec_arg_addopt.
  (rb_exec_arg_addopt): stub to call rb_execarg_addopt.
  (rb_execarg_init): renamed from rb_exec_arg_init.
  (rb_exec_arg_init): stub to call rb_execarg_init.
  (rb_execarg_fixup): renamed from rb_exec_arg_fixup.
  (rb_exec_arg_fixup): stub to call rb_execarg_fixup.
  (rb_execarg_run_options): renamed from rb_run_exec_options_err.
  (rb_run_exec_options_err): stub to call rb_execarg_run_options.
  (rb_run_exec_options): call rb_execarg_run_options.

* io.c: call rb_execarg_addopt, rb_execarg_fixup,
  rb_execarg_run_options, rb_execarg_init.

* ext/pty/pty.c (establishShell): call rb_execarg_init and
  rb_execarg_fixup.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12 11:34:51 +00:00
akr 45e5f2f690 * process.c (rb_exec_fillarg): detect '#' as a meta character.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 21:40:50 +00:00