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

1395 Коммитов

Автор SHA1 Сообщение Дата
yugui 57bc5eaf2f Fixes build failures on Portable Native Client.
Note: Some of the fixes are for newlib in general but not NaCl-specific.

* include/ruby/intern.h (rb_fd_select): declare struct timeval, or the
  struct gets local to the function in C99.

* file.c (#include): add nacl/stat.h for PNaCl.
  (utimes): added a declaration for PNaCl.
  (stat_atimespec): stat::st_atimensec is long long but
  timespec::tv_nsec is long in PNaCl.
  (stat_mtimespec, stat_ctimespec): ditto.
  (rb_group_member): disable getgroups unless HAVE_GETGROUPS.
  (eaccess): unify the fallback to generic defined(USE_GETEUID).

* io.c: include sys/time.h for struct timeval.
  (rb_close_before_exec): nothing we can do if F_GETFD is not
  available.
  (ioctl): pnacl newlib actually doesn't have ioctl.

* process.c (maxgroups): it is used iff
   defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX) but not
   defined(HAVE_GETGROUPS) || defined(HAVE_SETGROUPS).
  (obj2gid): fail unless the object is a Fixnum if getgrnam is not
  available.
  (disable_child_handler_fork_child): sigaction is not available in
  PNaCl newlib.

* configure.in (warnflags, strict_warnflags): avoid -ansi for strlcpy.
  (rb_cv_gcc_atomic_builtins): also check
  __atomic_or_etch because it is used in ruby_atomic.h.
  (rb_cv_gcc_sync_builtins): ditto.
  (HAVE_GETGRNAM): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 13:33:14 +00:00
yugui e4ac591a20 * io.c: fix issues in the last two commits. don't disable cloexec for
platforms other than NativeClient.
* ChangeLog: ditto. add entries for the last two commits.
Sat Oct 11 11:12:00 2014  Yuki Yugui Sonoda  <yugui@yugui.jp>

	* signal.c (install_signalhandler, init_sigchld): allow failure because it
	  always fails with ENOSYS on NaCl.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 02:29:00 +00:00
yugui 1a14a7a1d7 Allow failure of sighandler installation on NativeClient.
* signal.c (install_signalhandler, init_sigchld): allow failure because it
  always fails with ENOSYS on NaCl.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 02:12:00 +00:00
yugui 69ac654c90 Merges a patch form naclports.
* configure.in (RUBY_NACL and others): Supports PNaCl.
* dln.c: replace the old hacky dynamic loading over HTTP with nacl_io.
* file.c: tenatively use access(2) instead of eaccess.
  (rb_file_load_ok): weaken with attribute but not by postprocess.
* io.c (socket.h): now NaCl has socket.h
  (flock): disable here instead of nacl/ioctl.h
* nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY):
  respect path to them if they are absolute.
  This helps naclports to build ruby in their source tree.
  (PROGRAM_NMF, .SUFFIXES): support .pnexe for PNaCl.
  (ruby.o, file.o): move the hack to attributes in ruby.c and file.c
* nacl/ioctl.h: removed. move the hack to io.c.
* nacl/nacl-config.rb: support arm, pnacl and others.
* nacl/pepper_main.c: support build in a naclports tree.
* ruby.c (rb_load_file): weaken with attribute but not by postprocess.

The patch is by sbc@google.com and the Native Client Authors.
It is available at:
* 873ca4910a/ports/ruby/nacl.patch

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 02:11:53 +00:00
nobu 12088a7e95 io.c: fix typo
* io.c (rb_io_make_open_file): remove useless backslash.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-10 11:26:22 +00:00
nobu b44c47d102 io.c: move RFile initialization
* io.c (rb_io_make_open_file): move from include/ruby/io.h, and
  hide too detailed implementations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-10 02:34:24 +00:00
nobu e1b5111ff4 io.c: ID instead of Symbol
* io.c (get_kwargs_exception): rb_get_kwargs() expects IDs, but
  not Symbols.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-05 15:31:38 +00:00
normal 3aab1f8467 io.c (fptr_finalize): free memory before GC sweep
This releases memory on explict calls to rb_io_close,
reducing pressure on the GC.

Final massif snapshot shows reduced heap usage after RubyGems load
(valgrind --tool=massif ./ruby -e exit)

before:
	mem_heap_B=4821992
	mem_heap_extra_B=1302952

after:
	mem_heap_B=4791056
	mem_heap_extra_B=1192440

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-01 20:36:28 +00:00
normal 405c4abb9f io.c: common function to free IO buffers
This also allows easier tracking of freed memory for systems
without malloc_usable_size, and also makes future changes
to freeing buffer memory easier-to-implement.

* io.c (free_io_buffer): new function for a common pattern
  (clear_readconv): use free_io_buffer
  (rb_io_fptr_finalize): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-25 10:40:37 +00:00
normal d198d64e04 trivial packing for on-stack structs
* io.c (struct io_advise_struct): 32 => 24 bytes on 64-bit
* io.c (struct io_internal_writev_struct): 24 => 16 bytes on 64-bit
* process.c (struct waitpid_arg): ditto

Slightly reduce stack pressure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15 07:31:38 +00:00
akr 93a7bf4b17 * configure.in: Use AC_FUNC_FORK.
* io.c: Use HAVE_WORKING_FORK instead of HAVE_FORK.

* process.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-02 22:51:03 +00:00
nobu dacc19e409 io.c: fix uninitialized variable
* io.c (argf_next_argv): fix uninitialized variable in skipping
  message when inplace edit without backup.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-28 13:56:47 +00:00
nobu 58c2571b59 io.c: preserve encodings
* io.c (argf_next_argv): preserve encodings in warning messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-28 06:18:30 +00:00
nobu ffa153f282 io.c: preserve encodings
* io.c (rb_io_extract_encoding_option): preserve encodings in
  warning messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-28 05:55:22 +00:00
nobu cdacaa0a29 io.c: preserve encodings
* io.c (advice_arg_check): preserve encodings in warning messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-28 05:55:08 +00:00
nobu 20da239464 io.c: preserve encodings
* io.c (rb_io_s_new): preserve encodings in warning messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-28 05:55:05 +00:00
nobu febf2cefb3 io.c: do not swallow exceptions at end of block
* io.c (io_close): ignore only "closed stream" IOError and
  NoMethodError, do not swallow other exceptions at the end of
  block.  [ruby-core:64463] [Bug #10153]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-26 08:12:48 +00:00
normal 48a2b96d2b introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use
Using calloc where possible reduces code and binary sizes.

* include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
  (Data_Make_Struct, TypedData_Make_Struct):
  ZALLOC replaces ALLOC+memset
* compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
* cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
* io.c (rb_io_reopen): ditto
* iseq.c (prepare_iseq_build): ditto
* parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
* re.c (match_alloc): ditto
* variable.c (rb_const_set): ditto
* ext/socket/raddrinfo.c (get_addrinfo): ditto
* ext/strscan/strscan.c (strscan_s_allocate): ditto
* gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:34:35 +00:00
nobu c73c34e27f io.c: fix rdoc of append mode
* io.c (rb_io_initialize): [DOC] fix rdoc of append mode.  it does
  not move the pointer at open.  [ruby-core:63747] [Bug #10039]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-19 15:32:46 +00:00
hsbt dcf296f74c * io.c: Improve Documentation by @dapplebeforedawn.
[fix GH-658] [ruby-core:63579] [Bug #10012]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-11 06:41:44 +00:00
nobu 92a04a4915 io.c: refine error message
* io.c (do_io_advise): more precise error message, with arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09 07:19:43 +00:00
nobu e99ee55abc constify parameters
* include/ruby/intern.h: constify `argv` parameters.

* include/ruby/ruby.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18 06:16:39 +00:00
nobu 8a2dc6f1dd configure.in: disable posix_fadvise
* configure.in (posix_fadvise): disable use of posix_fadvise
  itself on 32-bit AIX.  [ruby-core:62968] [Bug #9914]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-08 15:04:29 +00:00
kanemoto 1c0b507b79 io.c (rb_io_advise): AIX currently does not support a 32-bit call to
posix_fadvise() if _LARGE_FILES is defined. Patch by Rei Odaira.
[ruby-core:62968] [Bug #9914]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-08 14:39:27 +00:00
nobu 0e7cd6417a io.c: truncate before appending
* io.c (read_all): truncate the buffer before appending read data,
  instead of truncating before reading.
  [ruby-core:55951] [Bug #8625]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-07 03:51:57 +00:00
nobu 71a3cb13eb io.c: not shorten buffer unless succeeded
* io.c (io_setstrbuf, io_read): should not shorten the given buffer until
  read succeeds.  [ruby-core:55951] [Bug #8625]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-06 04:39:37 +00:00
nobu 6ab08d2e8d configure.in, missing.h: jemalloc mangling
* configure.in (with-jemalloc): also check for header, for ABIs
  which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF
  platforms.  [ruby-core:62939] [Feature #9113]
* include/ruby/missing.h: include alternative malloc header to
  replace memory management functions.
* dln.c, io.c, parse.y, st.c: undef malloc family before
  re-definition to suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-05 05:16:46 +00:00
akr 52e91e0f72 * io.c (pipe_open): Close pipes when rb_execarg_fixup() raises
an exception.
  (rb_execarg_fixup_v): New function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-29 14:13:20 +00:00
akr be4d1fd953 * io.c (rb_io_s_pipe): Close pipes if io_encoding_set() raises an
exception.
  (io_encoding_set_v): New function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-29 11:29:47 +00:00
akr 1c35277c2b * io.c (rb_io_autoclose_p): Don't raise on frozen IO.
* test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 10:09:55 +00:00
nobu 2e5d698538 io.c: no error on frozen IO
* io.c (rb_io_fileno, rb_io_inspect): non-modification does not
  error on frozen IO.  [ruby-dev:48241] [Bug #9865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 02:12:59 +00:00
nobu 3b8b470c8e io.c: update ARGF examples
* io.c (argf_each_line, argf_inplace_mode_set): [DOC] Update ARGF
  documentation examples.  `ARGF.lines` has been deprecated in
  favor of `ARGF.each_line`.  [Fixes GH-615]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18 03:15:57 +00:00
nobu 831202f85c io.c: buffer must be modifiable
* io.c (io_setstrbuf): always check if the buffer is modifiable.
  [ruby-core:62643] [Bug #9847]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-17 23:22:28 +00:00
tadf d85c226f73 * io.c (io_{read,write}_nonblock): use rb_get_kwargs instead of
rb_hash_aref.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06 09:37:24 +00:00
nobu d64ba37ad0 process.c: constify
* process.c (rb_execarg_new, rb_execarg_init): constify argv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 08:21:47 +00:00
ko1 57e557908a * enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR()
instead of RARRAY_PTR().
* io.c (rb_io_s_popen): ditto.
* numeric.c (num_step_size): ditto.
* vm_eval.c (rb_apply): ditto.
* vm_eval.c (rb_eval_cmd): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 04:20:16 +00:00
usa 8b48053beb * io.c (rb_io_fsync): need to fsync even if on Windows. fixed mistake of
r45254 and r45256.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-02 19:41:01 +00:00
usa e1c40b1967 * io.c (rb_io_fsync): revert a part of r45254. explicit fsync should update
the metadata.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-02 18:08:04 +00:00
usa ab3002afa3 * io.c (rb_io_flush_raw, rb_io_fsync): [EXPERIMENTAL] remove force
syncing for Win32 to speed up IO.  this may break some tests, and
  they'll be fixed later.
  [ruby-core:58570] [Bug #9153]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-02 17:56:32 +00:00
nobu cc216f9aae adjust indent and style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27 07:10:14 +00:00
normal 10a8e87ce5 io.c (rb_f_backquote): trade volatile for manual recycle
* io.c (rb_f_backquote): trade volatile for manual recycle
  rb_gc_force_recycle ensures object is visible until recycle

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 04:19:29 +00:00
akr 6f8b0e9bb0 * include/ruby/intern.h,
include/ruby/io.h,
  include/ruby/ruby.h,
  include/ruby/win32.h,
  include/ruby/backward/rubysig.h,
  bignum.c,
  gc.c,
  io.c,
  process.c,
  safe.c,
  struct.c,
  thread.c,
  ext/socket/rubysocket.h,
  ext/-test-/old_thread_select: Remove deprecated definitions
  [ruby-core:60581] [Feature #9502]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 15:16:31 +00:00
akr 61f50ae03e * io.c (SMALLBUF): Unused macro removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-08 06:11:47 +00:00
normal 5061285407 io.c (rb_io_syswrite): add RB_GC_GUARD
* io.c (rb_io_syswrite): add RB_GC_GUARD
  [Bug #9472][ruby-core:60407]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-01 20:50:56 +00:00
nobu 3d3a02c97f io.c: check socket on other than linux
* io.c (nogvl_copy_stream_sendfile): check socket on other than
  linux, as sendfile(2) on non-socket fd works only on linux.
  [Feature #9427]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-29 11:08:16 +00:00
normal c5f2c66270 io.c: remove socket check
* io.c (nogvl_copy_stream_sendfile): remove socket check
  [ruby-core:59856][Feature #9427]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-29 09:13:08 +00:00
akr e457f6312f * io.c (rb_update_max_fd): Return immediately if the given fd is small
enough.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18 13:42:39 +00:00
akr f962eba5f4 * io.c: Test O_CLOEXEC only once.
Patch by Eric Wong.  [ruby-core:59419] [Feature #9328]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18 13:28:35 +00:00
glass bddde8eee3 * io.c (io_binwrite): use writev(2) to avoid double write if available.
* configure.in: check writev(2)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-15 11:37:23 +00:00
glass 72385b042d * io.c (io_fwrite): freeze converted str.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-02 07:29:13 +00:00