Commit graph

747 commits

Author SHA1 Message Date
YO4
5d90c60109
Avoid console input behavior in windows 10 [Bug #18588]
When ANSI versions of PeekConsoleInput read multibyte charactor
partially, subsequent ReadFile returns wrong data on newer Windows
10 versions (probably since Windows Terminal introduced).  To
avoid this, use Unicode version of of PeekConsoleInput/ReadConsole.
2022-03-16 10:28:35 +09:00
Yuta Saito
6729258839
include/ruby/win32.h: define HAVE_X for the missing prototypes (#5456) 2022-01-18 19:08:07 +09:00
nagachika
d5fc3fa4db win32/win32.c Fix PROT_EXEC bit flag check for FlushInstrucitonCache() 2021-12-30 21:16:29 +09:00
U.Nakamura
4e007d705c Fix some bornheads 2021-12-27 17:15:09 +09:00
U.Nakamura
85a426dc86 Tiny mmap emulation for Windows
- prerequisite of supporting YJIT with VC++.
- note that now can specfily `--yjit` on mswin64, but not enabled
  YJIT'ed code because of YJIT requires `OPT_DIRECT_THREADED_CODE`
  or `OPT_CALL_THREADED_CODE` in `rb_yjit_compile_iseq`.
2021-12-27 15:56:23 +09:00
xtkoba
0cf9197988 Clang never evaluates expr in __builtin_assume 2021-10-04 08:13:37 +09:00
Nobuyoshi Nakada
845c017e08
Reminders of the Windows versions each API is available [ci skip] 2021-09-24 12:31:20 +09:00
xtkoba (Tee KOBAYASHI)
e32fe3ce76 MINGW: _WIN64 is not defined on i386-mingw32 + ucrt. 2021-09-20 00:15:30 +09:00
xtkoba (Tee KOBAYASHI)
4705ebd907 MINGW: Fix build error on Windows UCRT 2021-09-20 00:15:30 +09:00
Jeremy Evans
7c31ecd3ac Add parentheses to avoid pointless condition
Pointed out by xtkoba (Tee KOBAYASHI).

Fixes [Bug #17946]
2021-06-23 21:48:42 +09:00
xtkoba
44cff500a0 _MSC_VER may not be defined 2021-05-04 20:38:25 -04:00
Nobuyoshi Nakada
e85bffc324
Increment global variables atomically 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
b7d4dcf3a6
Make vm_exit_handler installation MT-safe 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
9299703b39
Make uenvarea thread exclusive 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
8c943e3be8
Make the flag in thread_exclusive unique 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
1a00402987
Enclose crtitical sections in thread_exclusive block 2021-03-08 17:45:02 +09:00
Nobuyoshi Nakada
a12e950816
Revert "Enclose crtitical sections in thread_exclusive block"
19cc24b34b and fixups.
2021-02-24 03:13:07 +09:00
Nobuyoshi Nakada
7563d542d6
Use the system getenv in setup_debug_log
As ruby_set_debug_option() is called before ruby_sysinit(),
CRITICAL_SECTIONs are not initialized yet.
2021-02-23 23:11:44 +09:00
Nobuyoshi Nakada
819dd464de
Fixed commit miss at 41eb4fbf86 2021-02-23 21:23:46 +09:00
Nobuyoshi Nakada
5a4742a0b4
Make uenvarea thread exclusive 2021-02-23 21:19:25 +09:00
Nobuyoshi Nakada
41eb4fbf86
Fixed commit miss at 19cc24b34b 2021-02-23 20:46:40 +09:00
Nobuyoshi Nakada
da18d6f015
Constified possible data 2021-02-23 19:28:03 +09:00
Nobuyoshi Nakada
19cc24b34b Enclose crtitical sections in thread_exclusive block 2021-02-23 19:03:54 +09:00
Andrew Aladjev
0d76636117 added mutexes for socket and connection lists on win32 2021-02-23 16:20:01 +09:00
Nobuyoshi Nakada
67d2619463 Expand final path name buffer for namespace prefix
As final path name includes the namespace prefix, so expand room
for it in path name buffer.
2021-02-22 19:48:15 +09:00
YO4 (Yoshinao Muramatsu)
b94b7965c4
Fixed fallback ENABLE_VIRTUAL_TERMINAL_PROCESSING value [Bug #17639] 2021-02-20 00:50:57 +09:00
xtkoba (Tee KOBAYASHI)
a681c484a3
Fixed codepage for utime [Bug #17626]
Should use the given codepage argument.

Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-02-14 19:44:41 +09:00
卜部昌平
73e948afd5 win32/win32.c:getcwd_value: delete OBJ_TAINT
Makes no sense any longer.
2021-01-27 09:30:15 +09:00
Nobuyoshi Nakada
ecfbd97292
win32: Removed never used/worked functions
Almost certainly, these have never been used in external extension
libraries.  If any had, these would have had to be declared in
headers.
2020-12-27 16:50:10 +09:00
Nobuyoshi Nakada
90dd482061
win32: Declared wait and fixed the return type 2020-12-27 16:49:27 +09:00
U.Nakamura
09f939d3a0 Enable escape sequence on Windows10 console
* win32/win32.c (init_stdhandle): enable escape sequence on
	  Windows10 console to show `ruby --help` colors correctly.
2020-12-21 17:29:09 +09:00
Nobuyoshi Nakada
37987d9994 win32: Deprecate file CP version functions 2020-12-20 18:34:04 +09:00
Nobuyoshi Nakada
95862ae440 win32: Added rb_w32_ureaddir only for UTF-8 [Feature #12654] 2020-12-20 18:34:04 +09:00
Nobuyoshi Nakada
5b98b2ce39 win32: Use UTF-8 as filesystem encoding [Feature #12654]
Co-Authored-By: Dāvis Mosāns <davispuh@gmail.com>
2020-12-20 18:34:04 +09:00
Nobuyoshi Nakada
d44671c819
Revived the getenv macro for dln_find.c
This partially reverts commit "Windows: Improve readablity of
getenv() encoding" 14453a256d.

The `getenv` macro defined here is to also substitute the function
in dln_find.c, not only in this file.
2020-12-20 01:57:51 +09:00
Lars Kanis
ca76337a00
Windows: Read ENV names and values as UTF-8 encoded Strings (#3818)
* Windows: Read ENV names and values as UTF-8 encoded Strings

Implements issue #12650: fix https://bugs.ruby-lang.org/issues/12650

This also removes the special encoding for ENV['PATH'] and some
complexity in the code that is unnecessary now.

* Windows: Improve readablity of getenv() encoding

getenv() did use the expected codepage as an implicit parameter of the macro.
This is mis-leading since include/ruby/win32.h has a different definition.
Using the "cp" variable explicit (like the other function calls) makes it
more readable and consistent.

* Windows: Change external C-API macros getenv() and execv() to use UTF-8

They used to process and return strings with locale encoding,
but since all ruby-internal spawn and environment functions use UTF-8,
it makes sense to change the C-API equally.
2020-12-08 02:00:39 +09:00
Nobuyoshi Nakada
3db21cf25f
Revived the getenv macro for dln_find.c
This partially reverts commit "Windows: Improve readablity of
getenv() encoding" 14453a256d.

The `getenv` macro defined here is to also substitute the function
in dln_find.c, not only in this file.
2020-11-28 18:47:56 +09:00
Lars Kanis
14453a256d
Windows: Improve readablity of getenv() encoding
getenv() did use the expected codepage as an implicit parameter of the macro.
This is mis-leading since include/ruby/win32.h has a different definition.
Using the "cp" variable explicit (like the other function calls) makes it
more readable and consistent.
2020-11-28 17:49:47 +09:00
卜部昌平
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