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

721 Коммитов

Автор SHA1 Сообщение Дата
akr 1a70dfe6f4 * include/ruby/intern.h (rb_fd_fix_cloexec): renamed from
rb_fd_set_cloexec.

* io.c: follow the above renaming.

* ext/pty/pty.c: ditto.

* ext/socket/init.c: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/ancdata.c: ditto.

* ext/socket/unixsocket.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31 12:49:16 +00:00
usa b2a1af1547 * win32/win32.c (setfl): extract from fcntl().
* win32/win32.c (dupfd): new function to support F_DUPFD. base on a
  patch written by akr.

* win32/win32.c (fcntl): use above functions.

* include/ruby/win32.h (F_DUPFD): define. [experimental]

* include/ruby/win32.h (F_SETFL): change the value to correspond with
  other platforms.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31 04:16:11 +00:00
akr 5c19f07700 * include/ruby/intern.h (rb_cloexec_fcntl_dupfd): declared.
* io.c (rb_cloexec_fcntl_dupfd): new function.
  (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd.

* process.c (move_fds_to_avoid_crash): use rb_cloexec_fcntl_dupfd.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30 15:17:27 +00:00
akr 0d2a92e0b3 * include/ruby/intern.h (rb_cloexec_pipe): declared.
* io.c (rb_cloexec_pipe): new function.
  (rb_pipe): use rb_cloexec_pipe.

* thread_pthread.c (rb_thread_create_timer_thread): use
  rb_cloexec_pipe.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30 12:13:05 +00:00
akr 0a9cb21e62 * include/ruby/intern.h (rb_cloexec_dup2): declared.
* io.c (rb_cloexec_dup2): new function.
  (io_reopen): use rb_cloexec_dup2.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 13:11:01 +00:00
akr 4ae2b92576 * include/ruby/intern.h (rb_cloexec_dup): declared.
* io.c (rb_cloexec_dup): new function.
  (ruby_dup): use rb_cloexec_dup.

* ext/pty/pty.c (pty_getpty): use rb_cloexec_dup.
  
* ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 11:02:32 +00:00
akr 3ae3cd741d * include/ruby/intern.h (rb_cloexec_open): declared.
* io.c (fd_set_cloexec): extracted from rb_fd_set_cloexec.
  (rb_cloexec_open): new function.
  (sysopen_func): use rb_cloexec_open.
  (rb_sysopen_internal): use rb_update_max_fd instead of
  rb_fd_set_cloexec.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 02:33:28 +00:00
naruse bafe837658 * include/ruby/ruby.h (SIZE_MAX): define SIZE_MAX if not defined.
patched by The Written Word Inc. [ruby-core:40422] [Bug #5489]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-27 00:59:46 +00:00
akr 49f6242b34 * include/ruby/defines.h: use "__sparc" instead of "sparc" and
"__sparc__".

* dln.c: ditto.

  [ruby-dev:44694]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-25 12:54:21 +00:00
akr b574a4d4a1 * include/ruby/intern.h (rb_fd_set_cloexec): declared.
* io.c (rb_fd_set_cloexec): new function.
  (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag.
  (rb_sysopen_internal): ditto.
  (rb_pipe): ditto.
  (io_reopen): ditto.
  (io_cntl): ditto.

* process.c (rb_f_exec): change the default :close_others option to
  true.
  (rb_f_system): ditto.
  (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set
  close-on-exec flag.
  (ruby_setsid): ditto.
  (rb_daemon): ditto.

* thread_pthread.c (rb_thread_create_timer_thread): call
  rb_fd_set_cloexec to set close-on-exec flag.

* ruby.c (load_file_internal): ditto.

* file.c (rb_file_s_truncate): ditto.
  (file_load_ok): ditto.

* random.c (fill_random_seed): ditto.

* ext/pty/pty.c (chfunc): ditto.
  (get_device_once): ditto.

* ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.

* ext/socket/init.c (rsock_socket): ditto.
  (rsock_s_accept_nonblock): ditto.
  (rsock_s_accept): ditto.

* ext/socket/socket.c (rsock_sock_s_socketpair): ditto.

* ext/socket/ancdata.c (discard_cmsg): ditto.
  (make_io_for_unix_rights): ditto.

* ext/socket/unixsocket.c (unix_recv_io): ditto.

* ext/io/console/console.c (console_dev): ditto.

[ruby-core:38140] [Feature #5041]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-22 09:58:15 +00:00
ngoto 971769cd76 * numeric.c (rb_infinity, rb_nan): use union to prevent bus error
caused by misalignment.  [Bug #5469] [ruby-dev:44657]
* include/ruby/missing.h (INFINITY, NAN): ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-21 17:34:58 +00:00
nobu 9c49753182 * include/ruby/defines.h (flush_register_windows): use software
trap on Debian Sparc 32-bit userspace.  [Bug #5244]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-20 04:09:37 +00:00
nobu 3a0e582e1f * include/ruby/intern.h (rb_ary_reverse): export.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-14 02:19:39 +00:00
kosaki 20ae79b0c2 * include/ruby/defines.h: remove NextStep, OpenStep, Rhapsody
support. Last activity of their OSs are 7 years ago.
* configure.in: ditto.
* dir.c: ditto.
* ext/tk/extconf.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-26 00:19:03 +00:00
usa ee7d523631 * win32/win32.c, include/ruby/intern.h (rb_w32_fd_copy): implement
for rb_thread_select() in thread.c.  the use of rb_fd_copy() is
  introduced in r33117.
  [Bug #5229] [ruby-core:39102]

* thread.c (rb_thread_select): must call rb_fd_init() before using
  rb_fdset_t.  see the implementations of rb_fd_init()s if you want to
  know the reason.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-30 15:04:11 +00:00
nobu 543ecd95d5 * include/ruby/win32.h (frexp, modf): original macros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-05 13:20:26 +00:00
nobu 11667b9c9a * include/ruby/missing.h: fix typo and so on.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-04 02:54:22 +00:00
naruse d04697df88 * include/ruby/missing.h: define __syscall on OpenBSD as r32702.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-04 02:32:19 +00:00
naruse d7c026d058 Mark a code is GPL or not.
This is made the comparison between current and initial commit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-03 15:40:03 +00:00
usa f9e9eee677 * util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
[Bug #5153] [ruby-core:38736]

* io.c (argf_next_argv): remove the call of above function.

* ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
  extension module because this is only for testsing ruby_add_suffix().

* LEGAL: remove the mention about a part of util.c, because now we
  removed the part.

* io.c (argf_next_argv): now the new filename is not guranteed to
  use, so should check the return value of rename(2).

* test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
  now we expect same result with other platforms on no_safe_rename
  platforms (=Windows).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-03 07:10:56 +00:00
naruse da6c57aa54 See __APPLE__ for __syscall.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-28 00:23:28 +00:00
naruse 9f2b8eafdd * include/ruby/missing.h: define __syscall if the platform has
__syscall in the library but doesn't define it in headers
  for example Mac OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-27 08:58:38 +00:00
nobu 3fbc65d47f * parse.y (rb_check_id): make the given name a symbol or a string.
based on the second patch by Jeremy Evans at [ruby-core:38447]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26 16:05:27 +00:00
nobu 4dc1a21809 * error.c (rb_name_error_str): new function to raise NameError
with the name string but not ID.
* object.c, proc.c, variable.c: more removal of inadvertent symbol
  creation.  [Feature #5079]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23 15:05:03 +00:00
nobu 34918aa832 * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
avoid inadvertent symbol creation in reflection methods.  based
  on a patch by Jeremy Evans at [ruby-core:38367].  [Feature #5072]
* vm_method.c (rb_mod_method_defined)
  (rb_mod_{public,private,protected}_method_defined)
  (obj_respond_to): ditto.
* parse.y (rb_check_id): new function returns already interned ID
  or 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 12:06:42 +00:00
nobu c276b73804 * parse.y (rb_is_global_id, rb_is_attrset_id): add missing
predicates.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 11:44:53 +00:00
akr b41ccc4a9c * include/ruby/intern.h (rb_update_max_fd): declaration moved from
internal.h.

* file.c: ditto.

* io.c: call rb_update_max_fd for each new fds.

* process.c: ditto.

* random.c: ditto.

* ruby.c: ditto.

* ext/io/console/console.c: ditto.

* ext/openssl/ossl_bio.c: ditto.

* ext/pty/pty.c: ditto.

* ext/socket/init.c: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/ancdata.c: ditto.

* ext/socket/unixsocket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-20 13:26:10 +00:00
nobu e2fd80b3d3 * error.c (rb_check_trusted): new function to check an object is
trusted.
* struct.c (rb_struct_modify), time.c (time_modify): check by the
  above function to show proper class names.  [Bug #5036]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17 07:26:45 +00:00
usa f15d0deaaf * win32/win32.c, include/ruby/win32.h (rb_w32_io_cancelable_p): renamed
from rb_w32_has_cancel_io().  now it takes a parameter as fd to check
  the fd is console or not, because we cannot cancel console input even
  if we have cancel_io function.

* io.c (WAIT_FD_IN_WIN32): call above function instead of the old one,
  so now we can kill the thread which calls STDIN.gets.
  the problem was reported by ko1 vir IRC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-15 05:33:45 +00:00
nobu 63ab190151 * win32/win32.c (rb_w32_{read,write}): should be signed.
Bug #5001

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09 06:59:23 +00:00
ko1 eb35bb0b35 * include/ruby/intern.h, thread_pthread.c (rb_reserved_fd_p,
RB_RESERVED_FD_P): added.  This C API is to limit to access
  fds which are used by RubyVM internal.  In this version of
  CRuby, return 1 if fd is communication pipe.
  If your application needs to close all file descriptors to
  preent resource leak, skip internal fds using this C API.
  We also define a macro RB_RESERVED_FD_P(fd).  So you can write
  #ifndef RB_RESERVED_FD_P
  #define RB_RESERVED_FD_P(fd) 0
  #endif
  for Ruby 1.9.2 or previous version to write compatible extensions.
  See [ruby-core:37727]
* thread_win32.c (rb_reserved_fd_p): added (return 0 for any fds).
* io.c (rb_io_initialize): raise ArgumentError if given fd is reserved by Ruby.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-03 21:56:59 +00:00
kosaki 908baefe7d * internal.h: move rb_thread_io_blocking_region() declaration
from intern.h to internal.h. It's still experimental API and
  need more discussion. [ruby-dev:43698]
* include/ruby/intern.h: ditto.

* ext/socket/rubysocket.h: include internal.h.
* ext/socket/depend: add internal.h dependency.
* ext/socket/extconf.rb: add $INCFLAGS to topdir.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 12:31:17 +00:00
kosaki b9d9ea62b4 revert r32183
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 11:52:24 +00:00
kosaki 97beed076f * internal.h: move rb_thread_io_blocking_region() declaration
from intern.h to internal.h. It's still experimental API and
  need more discussion.
* include/ruby/intern.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 10:57:53 +00:00
nobu 19f386674e * include/ruby/backward/classext.h: for evil gems. fixed #4803
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:05:11 +00:00
nobu 685444569c * fix for build on solaris 10.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 00:12:55 +00:00
usa 5574d874fb * include/ruby/{defines,missing}.h (rb_infinity, rb_nan): move from
defines.h to missing.h.  (couldn't use RUBY_EXTERN there.)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-06 06:11:37 +00:00
usa f0bd1c2174 * include/ruby/defines.h (rb_inifinity, rb_nan): export for Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-06 05:09:58 +00:00
usa 799fafc03b * include/ruby/missing.h, numeric.c (round): moved prototype of round()
from numeric.c to missing.h.  (note: round() is C99 feature, so ruby
  provides it if not exists in C runtime.)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-03 11:58:11 +00:00
nahi 7d20942bf6 * include/ruby/defines.h (CASEFOLD_FILESYSTEM): Revert r30508. Forgot to
include this file in the commit r31692. __APPLE__ is not
  CASEFOLD_FILESYSTEM again, from this time.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-23 01:04:07 +00:00
mrkn 4eb3654178 * bignum.c (dump_bignum, bigmul1_balance, big_split, biglsh_bang,
bigrsh_bang, big_split3, bigmul1_toom3, bigmul0): implement Toom3 (Toom-Cook)
  multiplication.
* include/ruby/defines.h: add format prefixes for BDIGIT and BDIGIT_DBL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-22 15:37:00 +00:00
nobu 52f5f410e4 * internal.h: add for internal use only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 13:41:54 +00:00
kosaki d734c9dea2 * include/ruby/intern.h: resurrect old rb_fd_copy().
* thread.c (rb_fd_copy): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 14:57:35 +00:00
kosaki 2b7996e839 * include/ruby/intern.h: remove rb_fd_copy() to rb_fd_dup() and
rb_w32_fdcopy() to rb_w32_fd_dup().
* win32/win32.c: ditto.
* thread.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 14:51:09 +00:00
nobu 3a47cf3395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
kosaki 3ad44e0aa1 introduce missing/setproctitle.c
* include/ruby/missing.h: add setproctitle() declaration.
* missing/setproctitle.c: added.
* configure.in: add check for missing/setproctitle.c.

* ruby.c (ruby_process_options): add to call compat_init_setproctitle().
* ruby.c (set_arg0): remove all platform specific code. it's
  moved to missing/setproctitle.c.
* ruby.c (origarg): remove len field. It's no longer used.
* ruby.c (get_arglen): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-14 10:49:47 +00:00
kosaki 9468e945c8 * thread.c (rb_fd_init): remove volatile qualifier.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-07 13:40:56 +00:00
kosaki 156ccab796 * thread.c (rb_fd_init_copy): new internal api. It provide efficient
copy constructor semantics.
* thread.c (do_select): use rb_fd_init_copy().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-07 13:36:08 +00:00
kosaki 249fe0e742 * thread.c (rb_wait_for_single_fd): new. poll(2) based backend for rb_wait_for_single_fd().
Now only Linux uses it.

The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-04 01:07:03 +00:00
kosaki 9be37ca7d5 * thread.c (rb_wait_for_single_fd): new.
* thread.c (select_single): select(2) based backend for rb_wait_for_single_fd().

* io.c (make_writeconv): use rb_wait_for_single_fd() instaed of
  rb_thread_fd_select().
* io.c (rb_io_wait_readable): ditto.
* thread.c (rb_thread_wait_fd_rw): ditto.

* io.c (wait_readable): removed.
* thread.c (init_set_fd): new helper function.
* include/ruby/io.h (RB_WAITFD_IN, RB_WAITFD_PRI, RB_WAITFD_OUT):
  new constant for rb_single_wait_fd().

The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-04 00:59:57 +00:00