1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

19 commits

Author SHA1 Message Date
akr
b104173c4c add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-30 12:38:47 +00:00
akr
5adabb4010 don't use fork method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-30 06:17:28 +00:00
akr
36cb003300 * process.c (check_exec_redirect_fd): prohibit duplex IO.
(check_exec_fds): record maxhint even if close_others is not
  specified.
  (rb_exec_arg_fixup): renamed from rb_exec_arg_fix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-30 05:40:19 +00:00
akr
01e712d786 add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-29 02:24:26 +00:00
akr
80b1f7b50e add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-27 06:10:35 +00:00
akr
2142a5af51 don't use Unix commands such as true, env, etc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 15:39:09 +00:00
akr
514715250a * include/ruby/intern.h (rb_hash_dup): declared.
* hash.c (rb_hash_dup): new function.

* process.c (rb_spawn_internal): don't modify option hash.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 12:52:25 +00:00
akr
fe9b92f149 * process.c (rb_spawn_internal): new function to specify
default_close_others.
  (rb_spawn): specify default_close_others true.
  (rb_f_system): call rb_spawn_internal with default_close_others as
  false.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 15:50:24 +00:00
akr
b50eaa73b3 FreeBSD ash doesn't fail with echo >&4 where 4 is not opened.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 15:57:44 +00:00
akr
34bb79c031 * process.c: include sys/stat.h for umask.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 15:16:38 +00:00
akr
278b63a3e4 * include/ruby/intern.h (rb_env_clear): declared.
(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
2008-04-24 14:46:39 +00:00
mame
4133458dee * test/ruby/test_process.rb (test_rlimit_nofile): reset RLIMIT_NOFILE
before exit (for gcov).
* test/ruby/test_rubyoptions.rb: new tests for option of ruby
  interpreter, to achieve over 95% test coverage of ruby.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-16 15:48:54 +00:00
akr
310735aa4a * process.c (rlimit_resource_type): new function.
(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
2008-02-22 16:12:32 +00:00
akr
092ec0146d report the reason of process termination.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 08:47:22 +00:00
akr
ed2c204a2f * test/ruby/test_process.rb (TestProcess#test_rlimit_nofile):
setrlimit may fail with EINVAL.
  reported by MIYAMUKO Katsuyuki.  [ruby-dev:29174]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-31 07:18:43 +00:00
akr
ad5f0fc6cc use fork to isolate rlimit effect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-21 07:08:34 +00:00
akr
c703f58807 add RLIMIT_NOFILE test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-15 08:29:15 +00:00
akr
8317037ce5 give dummy argument for Process.getrlimit and rescue TypeError.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-15 07:07:09 +00:00
akr
511626799f new file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-15 03:39:20 +00:00