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

709 Коммитов

Автор SHA1 Сообщение Дата
卜部昌平 9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平 d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada 5bb80b76b0
[win32] suppress false warning by mingw gcc 2020-03-04 23:13:18 +09:00
卜部昌平 5e22f873ed decouple internal.h headers
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).
2019-12-26 20:45:12 +09:00
Gabriel Nagy ddfb306e8e win32.c: Remove unused calls to StartSockets (#2312)
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>
2019-10-11 13:48:02 +09:00
Nobuyoshi Nakada 0c6f36668a
Adjusted spaces [ci skip] 2019-09-27 10:20:56 +09:00
卜部昌平 9ef51b0b89 drop-in type check for rb_define_method
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.
2019-08-29 18:34:09 +09:00
Nobuyoshi Nakada 2283411265
Added license comment [Bug #12230] [ci skip] 2019-08-27 07:59:50 +09:00
git 1f3f50fb5e * expand tabs. [ci skip] 2019-08-19 14:34:29 +09:00
Nobuyoshi Nakada 574a9edfb3
Set flag to allow unprivileged users to create symlinks (#2381)
* [Win32] set flag to allow unprivileged users to create symlinks
2019-08-19 14:34:13 +09:00
Nobuyoshi Nakada 0a63c4d5fb
Fix errno at seeking socket/pipe on Windows
[Bug #12230]
2019-07-25 06:39:40 +09:00
NAKAMURA Usaku 151b7d72bd
Forgotten to remove 2019-04-30 15:02:03 +09:00
NAKAMURA Usaku 320f0aba49
Revert previous commit; it was meaningless 2019-04-30 04:09:07 +09:00
git ae3a986204 * expand tabs. 2019-04-30 03:33:51 +09:00
NAKAMURA Usaku 09022b6d70 Use CreateToolhelp32Snapshot instead of NtQueryInformationProcess to get ppid on Windows
Try to get rid of a spec error.
2019-04-30 03:33:31 +09:00
normal 6a65f2b1e4 io + socket: make pipes and sockets nonblocking by default
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
2018-11-22 08:46:51 +00:00
k0kubun e296f6cf63 win32/win32.c: fix typo in comment [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-13 01:32:20 +00:00
k0kubun cc5154af6d win32/win32.c: I meant FindFreeChildSlot [ci skip]
which was formerly used in CreateChild.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-13 00:25:58 +00:00
k0kubun 26519ebaed win32/win32.c: don't call FindChildSlot in MJIT
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
2018-10-13 00:22:18 +00:00
svn d6b0fe7db1 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-12 23:57:44 +00:00
k0kubun 09cd99b304 win32/win32.c: drop always-NULL psa parameter
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
2018-10-12 23:57:42 +00:00
k0kubun b712840c8a mjit_worker.c: suppress child process's output properly
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
2018-10-12 15:14:51 +00:00
usa c4e433a83a Support ubasecrt.dll 10.0.17763.1 included in Windows 10 October 2018 Update
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-04 06:29:31 +00:00
nobu 0d95805c2e Suppress more -Wparentheses warnings
[Fix GH-1958]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-21 10:31:11 +00:00
nobu 73ae3e9b46 win32.c: limit write size on console
* 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
2018-07-28 15:29:14 +00:00
nobu 19ad3b2b2d win32.c: precise time
* 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
2018-06-12 00:39:14 +00:00
nobu 55d3ed4b9d win32.c: fix CSI sequences to delete
* 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
2018-04-18 03:51:19 +00:00
nobu 044e6f12be win32.c: EPIPE for ERROR_NO_DATA
* 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
2018-02-01 02:56:28 +00:00
hsbt 2701001b2f Fix a typo.
* win32/win32.c: wrok -> work

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15 10:09:00 +00:00
nobu ee85a6e72b internal.h: remove dependecy on ruby/io.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09 06:24:10 +00:00
usa 1dcdb86876 set ino at `File.lstat` on Windows
* win32/win32.c (winnt_stat): support symbolic link and others.

* win32/win32.c (w32_stati128, wstati128, name_for_stat, rb_w32_{,ul}stati128,
  wutimensat): follow above change.
  [Feature #14169]

  From: Takehiro Kubo kubo@jiubao.org


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 15:02:51 +00:00
usa 838f23ae34 remove unused variable
thanks kubo-san. c.f. [ruby-dev:50345]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 11:43:18 +00:00
usa 9e9498c227 fixed typo
* win32/win32.c (get_ino): forgotten to specify the member.  thanks kubo-san.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-11 17:31:43 +00:00
usa 91de3d6539 support 128bit ino on Windows (if available)
* win32/win32.c, include/ruby/win32.h (stati128, rb_{,u,l,ul}stati128): rename
  from stati64ns, change the type of st_ino to 64bit and added st_inohigh.

* dir.c, file.c (stat, lstat): follow above changes.

* file.c (rb_stat_ino): support 128bit ino.

* win32/win32.c (rb_{,u,l,ul}stati128): ditto.
  [Feature #13731]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-10 17:26:58 +00:00
nobu 23c86d84e6 win32.c: check error code
* win32/win32.c (w32_io_info): check GetFileInformationByHandleEx
  error code to fallback to GetFileInformationByHandle.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-08 06:20:06 +00:00
nobu 284e3ae137 win32/win32.c: removed a stale comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-07 04:42:16 +00:00
nobu 185133fd43 win32.c: fallback to old API
* 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
2017-12-07 04:03:44 +00:00
nobu 5a8a2706d3 win32.c: fix error on mingw
* win32/win32.c (FILE_ID_128): defined on mingw already.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-04 12:49:20 +00:00
usa ce7c1c0577 support nanosec file timestamp on newer Windows
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
2017-12-04 10:48:30 +00:00
usa b7de978e45 try to pass compiling with VC12
* 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
2017-12-04 06:41:28 +00:00
usa 8e7560bbaf support `File.identical?` on ReFS
* file.c (rb_file_idenitical_p): move Windows dependent code to win32/win32.c.

* win32/win32.c (rb_w32_file_identical_p): support ReFS.
  see [Feature #13731] [ruby-dev:50166]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-04 03:33:48 +00:00
nobu e33b1690d0 win32.c: vm_exit_handler
* 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
2017-11-20 01:17:43 +00:00
nobu fffcf46f93 win32.c: unknown reparse tags
* win32/win32.c (rb_w32_read_reparse_point): skip unknown reparse
  tags.  [ruby-core:83539] [Bug #14047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-25 08:37:17 +00:00
usa 6a832cdb8d Use GetSystemTimePreciseAsFileTime on recent Windows
* 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
2017-10-21 08:41:22 +00:00
nobu c5683c9a63 win32.c: fix function pointer
* 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
2017-08-28 23:25:56 +00:00
nobu 420efa9c78 win32.c: fix return value
* 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
2017-08-26 14:22:31 +00:00
nobu 19d692920d thread_win32.c: set thread name
* thread_win32.c (native_set_another_thread_name): set thread name
  by SetThreadDescription.

* win32/win32.c (rb_w32_set_thread_description): dynamically try
  SetThreadDescription.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-26 00:30:03 +00:00
nobu da373e5394 win32.c: restrict cursor move
* win32/win32.c (constat_apply): restrict cursor move in visible
  screen only.  [ruby-core:81883] [Bug #13707]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-03 23:42:12 +00:00
nobu 66245e1b2b win32.c: clear relative to screen
* win32/win32.c (constat_apply): clear visible screen only, not
  the entire buffer.  [ruby-core:81883] [Bug #13707]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-03 10:56:21 +00:00