Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead. This would significantly
speed up incremental builds.
We take the following inclusion order in this changeset:
1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very
first thing among everything).
2. RUBY_EXTCONF_H if any.
3. Standard C headers, sorted alphabetically.
4. Other system headers, maybe guarded by #ifdef
5. Everything else, sorted alphabetically.
Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
NtSocketsInitialized behavior changed in e33b1690, requiring
a call to rb_w32_sysinit for starting Windows Sockets.
This commit removes NtSocketsInitialized entirely to avoid confusion.
Signed-off-by: Gabriel Nagy <gabriel.nagy@puppet.com>
The rb_define_method function takes a pointer to ANYARGS-ed functions,
which in fact varies 18 different prototypes. We still need to
preserve ANYARGS for storages but why not check the consistencies if
possible.
Q&As:
Q: Where did the magic number "18" came from in the description above?
A: Count the case branch of vm_method.c:call_cfunc_invoker_func().
Note also that the 18 branches has lasted for at least 25 years.
See also 200e0ee2fd.
Q: What is this __weakref__ thing?
A: That is a kind of function overloading mechanism that GCC provides.
In this case for instance rb_define_method0 is an alias of
rb_define_method, with a strong type.
Q: What is this __transparent_union__ thing?
A: That is another kind of function overloading mechanism that GCC
provides. In this case the attributed function pointer is either
VALUE(*)(int,VALUE*,VALUE) or VALUE(*)(int,const VALUE*,VALUE).
This is better than void* or ANYARGS because we can reject all
other possibilities than the two.
Q: What does this rb_define_method macro mean?
A: It selects appropriate alias of the rb_define_method function,
depending on the arity.
Q: Why the prototype change of rb_f_notimplement?
A: Function pointer to rb_f_notimplement is special cased in
vm_method.c:rb_add_method_cfunc(). That should be handled by the
__builtin_choose_expr chain inside of rb_define_method macro
expansion. In order to do so, comparison like (func ==
rb_f_notimplement) is inappropriate for __builtin_choose_expr's
expression (which must be a compile-time integer constant but the
address of rb_f_notimplement is not fixed until the linker). So
instead we are using __builtin_types_compatible_p, and in doing so
we need to distinguish rb_f_notimplement from others, by type.
All normal Ruby IO methods (IO#read, IO#gets, IO#write, ...) are
all capable of appearing to be "blocking" when presented with a
file description with the O_NONBLOCK flag set; so there is
little risk of incompatibility within Ruby-using programs.
The biggest compatibility risk is when spawning external
programs. As a result, stdin, stdout, and stderr are now always
made blocking before exec-family calls.
This change will make an event-oriented MJIT usable if it is
waiting on pipes on POSIX_like platforms.
It is ALSO necessary to take advantage of (proposed lightweight
concurrency (aka "auto-Fiber") or any similar proposal for
network concurrency: https://bugs.ruby-lang.org/issues/13618
Named-pipe (FIFO) are NOT yet non-blocking by default since
they are rarely-used and may introduce compatibility problems
and extra syscall overhead for a common path.
Please revert this commit if there are problems and if I am afk
since I am afk a lot, lately.
[ruby-core:89950] [Bug #14968]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
worker. It's very likely to be thread-unsafe and so it's better to avoid
using in MJIT worker to prevent surprises by race condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
I'm simplifying the interface of ChildRecord as I'm going to complicate
it a little next.
I didn't drop hInput since leaving it would be more natural as its
interface.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Prior to this commit, some of parent process's output was unintentionally
suppressed. We couldn't suppress only child process's output with spawnvp.
Instead of that, this commit uses CreateProcess directly to redirect stdout
and stderr only for child process.
As it's dealing with HANDLE returned from CreateProcess, now waitpid macro
needs to CloseHandle it.
win32/win32.c: Introduce rb_w32_start_process which is designed for MJIT
worker. Other similar functions can't be used since they are using ALLOCV
that may trigger GC, which should be avoided on MJIT worker.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (constat_parse): split long buffer and limit write
size on a console, as well as rb_w32_write.
[ruby-dev:50597] [Bug #14942]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (filetime_split, clock_gettime): keep the
precision as possible as the FILETIME format.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (constat_apply): CSI 'J' and 'K' are defaulted to
1, not 0. [ruby-core:86560] [Bug #14691]
* win32/win32.c (constat_apply): "delete before cursor" sequences
include the cursor position.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (rb_w32_write): writing to closed pipe fails with
ERROR_NO_DATA but msvcrt maps it to EINVAL. map it to EPIPE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (w32_io_info, rb_w32_file_identical_p): fallback
to GetFileInformationByHandle if GetFileInformationByHandleEx
failed. it seems not working on network drives.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Support nanosec file timestamp on Windows 8 or later.
Original patches are written by kubo (Kubo Takehiro).
Windows 7 and earlier also supports nanosec file timestamp, but it's too
accurate than system time. so, this feature is disabled on such versions.
[Feature #13726]
this change also includes [Misc #13702]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (FILE_ID_128): it's not defined in SDK with VC10, but seems to
be defined in SDK with VC12.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (vm_exit_handler): separate exit handler for
resources which must be released at exit of Ruby VM.
* win32/win32.c (socklist_insert, constat_handle): install the VM
exit handler.
* gc.c (ENABLE_VM_OBJSPACE): no longer needs process global object
space on Windows too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (gettiemeofday, wutime): use GetSystemTimePreciseAsFileTime
instead of GetSystemTimeAsFileTime if it is available.
This patch is based on Takehiro Kubo <kubo@jiubao.org> 's one (change only
the name of wrapper function). Thanks! and sorry to late
[ruby-dev:50167] [Feature #13732]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (rb_w32_set_thread_description): fix the condition
if the API function pointer is found.
[ruby-core:82494] [Bug #13845]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (rb_w32_set_thread_description_str): return the
result when name is nil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e