summaryrefslogtreecommitdiff
path: root/win32/win32.c
AgeCommit message (Collapse)Author
2019-10-11win32.c: Remove unused calls to StartSockets (#2312)Gabriel Nagy
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-09-27Adjusted spaces [ci skip]Nobuyoshi Nakada
2019-08-29drop-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 200e0ee2fd3c1c006c528874a88f684447215524. 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-27Added license comment [Bug #12230] [ci skip]Nobuyoshi Nakada
2019-08-19* expand tabs. [ci skip]git
2019-08-19Set flag to allow unprivileged users to create symlinks (#2381)Nobuyoshi Nakada
* [Win32] set flag to allow unprivileged users to create symlinks Notes: Merged-By: nobu <nobu@ruby-lang.org>
2019-07-25Fix errno at seeking socket/pipe on WindowsNobuyoshi Nakada
[Bug #12230]
2019-04-30Forgotten to removeNAKAMURA Usaku
2019-04-30Revert previous commit; it was meaninglessNAKAMURA Usaku
2019-04-30* expand tabs.git
2019-04-30Use CreateToolhelp32Snapshot instead of NtQueryInformationProcess to get ↵NAKAMURA Usaku
ppid on Windows Try to get rid of a spec error.
2018-11-22io + socket: make pipes and sockets nonblocking by defaultnormal
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-10-13win32/win32.c: fix typo in comment [ci skip]k0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-13win32/win32.c: I meant FindFreeChildSlot [ci skip]k0kubun
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-13win32/win32.c: don't call FindChildSlot in MJITk0kubun
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-12* expand tabs.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-12win32/win32.c: drop always-NULL psa parameterk0kubun
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-12mjit_worker.c: suppress child process's output properlyk0kubun
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-04Support ubasecrt.dll 10.0.17763.1 included in Windows 10 October 2018 Updateusa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-21Suppress more -Wparentheses warningsnobu
[Fix GH-1958] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-28win32.c: limit write size on consolenobu
* 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-06-12win32.c: precise timenobu
* 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-04-18win32.c: fix CSI sequences to deletenobu
* 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-02-01win32.c: EPIPE for ERROR_NO_DATAnobu
* 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-01-15Fix a typo.hsbt
* win32/win32.c: wrok -> work git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-09internal.h: remove dependecy on ruby/io.hnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12set ino at `File.lstat` on Windowsusa
* 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-12remove unused variableusa
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-11fixed typousa
* 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-10support 128bit ino on Windows (if available)usa
* 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-08win32.c: check error codenobu
* 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-07win32/win32.c: removed a stale commentnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-07win32.c: fallback to old APInobu
* 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-04win32.c: fix error on mingwnobu
* 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-04support nanosec file timestamp on newer Windowsusa
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-04try to pass compiling with VC12usa
* 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-04support `File.identical?` on ReFSusa
* 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-11-20win32.c: vm_exit_handlernobu
* 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-10-25win32.c: unknown reparse tagsnobu
* 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-21Use GetSystemTimePreciseAsFileTime on recent Windowsusa
* 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-08-28win32.c: fix function pointernobu
* 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-26win32.c: fix return valuenobu
* 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-26thread_win32.c: set thread namenobu
* 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-07-03win32.c: restrict cursor movenobu
* 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-03win32.c: clear relative to screennobu
* 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-03win32.c: cursor relative to screennobu
* win32/win32.c (constat_apply): move relative to visible screen, not the entire buffer. [ruby-core:81883] [Bug #13707] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12win32.c: rb_dir_getwd_ospathnobu
* win32/win32.c (rb_dir_getwd_ospath): Windows implementation moved from dir.c. get rid of freeing malloced memory by xfree. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-05win32.c: no localenobu
* win32/win32.c (skipspace, w32_cmdvector): get rid of iswspace(), which is locale dependent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16rb_w32_ugetcwd: UTF-8 version getcwdnobu
* dir.c (rb_dir_getwd): convert from UTF-8. * win32/win32.c (w32_getcwd): codepage aware getcwd using GetCurrentDirectoryW. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-28disable critical-error-handlernobu
* win32/win32.c (rb_w32_sysinit): disable critical-error-handler message box even on mswin, regardless of runtime DLL version. [ruby-dev:49988] [Bug #13254] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e