Commit Graph

55 Commits

Author SHA1 Message Date
Jameson Nash
c5593b51dc warnings: fix code that emits compiler warnings
PR-URL: https://github.com/libuv/libuv/pull/2066
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2018-11-29 11:21:44 -05:00
Jameson Nash
153ea114ff
Partially revert "win,code: remove GetQueuedCompletionStatus-based poller"
This reverts commit fd8d212a80,
and thereby restores partial support for using libuv under Wine
(which does not implement GetQueuedCompletionStatusEx).

PR-URL: https://github.com/libuv/libuv/pull/1963
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2018-09-10 07:59:00 +02:00
Bert Belder
a7493d8a1d
win: remove the remaining dynamic kernel32 imports
They were only there to aid Windows XP support, which libuv no longer
does.

PR-URL: https://github.com/libuv/libuv/pull/1858
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2018-06-05 00:45:48 -07:00
Bert Belder
fd8d212a80
win,code: remove GetQueuedCompletionStatus-based poller
All Windows versions that libuv supports have GetQueuedCompletionStatusEx,
so this fallback option is no longer needed.

PR-URL: https://github.com/libuv/libuv/pull/1858
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2018-06-05 00:45:41 -07:00
Bert Belder
13e8b15eb7
win,thread: remove fallback uv_cond implementation
The fallback implementation existed to support Windows XP and Server 2003,
but these old versions of windows are no longer supporter by libuv.

PR-URL: https://github.com/libuv/libuv/pull/1852
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-30 13:23:55 -07:00
Bert Belder
e318e001ea
Revert "win: add Windows XP support to uv_if_indextoname()"
Libuv is not supported on Windows XP, as stated in the
SUPPORTED_PLATFORMS document. It also can't possibly work because
`ReOpenFile()` in src/win/fs.c is not weakly linked, so any executable
that links libuv would simply fail to load on XP.

This reverts commit 17eaa956bd.

Refs: https://github.com/libuv/libuv/pull/1810
PR-URL: https://github.com/libuv/libuv/pull/1854
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-30 13:20:35 -07:00
Bert Belder
4f60e0c1d7
win,pipe: refactor pipe read cancellation logic
* Don't silently ignore ERROR_OPERATION_ABORTED.

  Code to silently ignore this error was added in c42a4ca, under the
  false premise that this error is somehow equivalent to EINTR on posix
  platforms. This isn't true; ERROR_OPERATION_ABORTED doesn't happen
  unless the application explicitly aborts an I/O operation.

  Silently ignoring this error elsewhere could potentially hide bugs,
  hence libuv shouldn't do it. Instead, explicitly deal with it where
  it is expected.

* Don't mark aborted reads as successful.

  The worker thread used to call ReadFile() on synchronous pipes would
  incorrectly mark cancelled read requests as successful, leading to
  issues later on.

* Rely on main thread to restart aborted reads.

  After a blocking ReadFile() call was cancelled, the worker thread
  would previously attempt to restart it immediately, making
  synchronization logic needlessly complex. Instead, we simply cancel
  the operation, and leave it to the main loop to restart it if so
  desired.

  Since we now realy on the main thread to restart interrupted
  ReadFile() calls, we can now have a single function interrupts a
  synchronous read until the event loop restarts it again.

* Clean up uv__pipe_read_stop().

  A single function to interrupt blocking reads also allows us to
  remove weird logic in uv__pipe_read_stop() that quickly pauses and
  unpauses a read operation in the hope of cancelling it.

* Assume CancelIo() and CancelSynchronousIo() are always available.

  Since libuv doesn't support windows XP and Server 2003 any more, we
  can assume that these APIs are always available, and do away with
  branching around them.

PR-URL: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-05-29 13:01:34 -07:00
Bert Belder
9584df25dc
src,test: fix idiosyncratic comment style
Back in the day I wrote comments in a really unusual way. Nowadays it
makes my eyes bleed, and clang-format doesn't know how to deal with it.

PR-URL: https://github.com/libuv/libuv/pull/1853
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-05-29 11:56:49 -07:00
ssrlive
17eaa956bd
win: add Windows XP support to uv_if_indextoname()
This commit attempts to dynamically load
ConvertInterfaceIndexToLuid() and ConvertInterfaceLuidToNameW()
from iphlpapi.dll before using them. If they are not available,
UV_ENOSYS is returned.

PR-URL: https://github.com/libuv/libuv/pull/1810
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-04-22 15:04:59 -04:00
Bartosz Sosnowski
e7f4e9ecca tty, win: get SetWinEventHook pointer at startup
SetWinEventHook is not available on some Windows versions.

Fixes: https://github.com/nodejs/node/issues/16603
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-03 12:18:52 +01:00
Bartosz Sosnowski
89d31932a5 fs, win: add support for user symlinks
Add SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE to CreateSymbolicLink
which allows unelevated users to create symbolic links on supported
platforms.

Fixes: https://github.com/libuv/libuv/issues/1157
PR-URL: https://github.com/libuv/libuv/pull/1466
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-08-18 14:21:58 +02:00
Richard Lau
12bfad9c6d win: define ERROR_ELEVATION_REQUIRED for MinGW
Refs: https://github.com/libuv/libuv/issues/1194
PR-URL: https://github.com/libuv/libuv/pull/1195
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2017-01-30 12:07:14 -05:00
Brad King
060877d483 win: fix anonymous union syntax
Remove use of the DUMMYUNIONNAME macro from our definitions of
internal winapi anonymous unions. This macro was added to
winternl.h in Windows SDK v7.0a in combination with a conditional
definition of DUMMYUNIONNAME to either empty or `u` depending on
compiler support. libuv doesn't support any compilers that lack
anonymous unions, but does support compilers such as VS 2008 that
complain about the presence of the DUMMYUNIONNAME identifier on an
anonymous union because their winapi headers do not define the
macro publicly.

PR-URL: https://github.com/libuv/libuv/pull/1090
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-11-02 19:38:24 -04:00
Bartosz Sosnowski
6fa3524ea7 win: evaluate timers when system wakes up
When Windows resumes after sleep GetQueuedCompletionStatus timeout is
not updated. This commit adds a method for signaling all loops to
wake up and update their timers.

Fixes: https://github.com/nodejs/node/issues/6763
PR-URL: https://github.com/libuv/libuv/pull/962
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-12 11:27:37 +01:00
Yuval Brik
e76b8838e5 fs: add uv_fs_realpath()
Equivalent to realpath(3), returns the full resolved absolute path of a
file or directory.

PR-URL: https://github.com/libuv/libuv/pull/531
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-12-05 11:32:58 +01:00
Bert Belder
98239224c3 win: don't fetch function pointers to SRWLock APIs
They're no longer needed, since the Windows-native SRWLock functions are
no longer used.

PR-URL: https://github.com/libuv/libuv/pull/525
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-22 11:18:23 -04:00
Bert Belder
6da887f416 win: add definitions for MUI errors mingw lacks
PR-URL: https://github.com/libuv/libuv/pull/110
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-05 17:15:00 +01:00
Bert Belder
2af8294895 win: add definitions for directory information types
PR-URL: https://github.com/libuv/libuv/pull/105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-05 01:38:28 +01:00
Bert Belder
7a322479ad win: make available NtQueryDirectoryFile
PR-URL: https://github.com/libuv/libuv/pull/105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-05 01:38:27 +01:00
Bert Belder
dfd908fc9b win: fix and clarify comments in winapi.h
PR-URL: https://github.com/libuv/libuv/pull/105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-05 01:38:27 +01:00
Jameson Nash
837c62c71b windows: make uv_read_stop immediately stop reading
This implements locking around the blocking call to ReadFile to get
around a Windows kernel bug where a blocking ReadFile operation on a
stream can deadlock the thread. This allows uv_read_stop to immediately
cancel a pending IO operation, and allows uv_pipe_getsockname to
"pause" any pending read (from libuv) while it retrieves the
sockname information.

If unsupported by the OS (pre-Vista), this reverts to the old
(e.g. deadlock-prone) behavior

Closes #1313
2014-08-09 11:10:57 +02:00
Ben Noordhuis
d8ab41bee3 windows: fix stray comments 2013-09-01 08:25:25 +02:00
Alex Crichton
b647c27b02 windows: fix mingw build
On older mingw installations, DEVICE_TYPE isn't defined. This was
redefined in windows.h, but it was done after it was already attempted
to be used. This moves the #define for DEVICE_TYPE above the usage of
it in windows.h to prevent compilation failures.
2013-08-25 16:02:41 +02:00
Bert Belder
315d7001e8 windows: make it possible to use NtQueryVolumeInformationFile
This commit adds bootstrap code, function signatures, struct definitions
etc. to make it possible for libuv to use NtQueryVolumeInformationFile.

Most of this comes from the NT DDK, which libuv mirrors so that people
don't need the DDK to compile it.
2013-08-24 19:13:42 +02:00
Bert Belder
c283a9ef84 windows: add DDK definitions for more file information classes
Copy some more structs from the NT DDK to winapi.h, so people can
compile libuv without installing the DDK.
2013-08-24 16:45:32 +02:00
Bert Belder
1f73bd4030 windows: add additional NTSTATUS class detection macros 2013-08-24 16:45:31 +02:00
Yasuhiro Matsumoto
bfa3e28b0d windows: fix mingw32 build, define JOB_OBJECT_XXX
mingw32 doesn't have the JOB_OBJECT_XXX defines. Provide them ourselves
when they are not already defined.

This is possibly only an issue with older versions of mingw32 because
mingw-w64 2.0 _does_ export the defines.
2013-08-01 15:21:35 +02:00
Hiroaki Nakamura
976c8a4387 Add support for condition variables on all platforms 2012-10-05 13:03:55 +02:00
Bert Belder
ed2bc23346 windows: fix the MinGW build 2012-07-31 17:24:46 +02:00
Bert Belder
7f6b86c687 windows: improve uv_fs_unlink
* It's now more efficient, the file is not opened twice.
* It no longer allows deletion of non-symlink directory reparse points.
2012-07-31 17:24:45 +02:00
Bert Belder
048422d865 windows: fix some comments 2012-06-12 17:00:15 +02:00
Brian White
87f3530a1e windows: retrieve NtQuerySystemInformation at startup 2012-06-02 20:05:11 +02:00
Bert Belder
120d997809 windows: fix NTSTATUS redefined when compiling with MinGW
Closes #403
Closes #422
2012-06-02 17:39:31 +02:00
Bert Belder
9f0dc2601e Windows: fetch pointer for CancelIoEx on startup 2012-05-02 03:38:31 +02:00
Keno Fischer
d13b1e0803 Windows: fix uv_fs_ftruncate to compile with Mingw32
Close: #382, #397
Ref: #381
2012-04-29 02:32:27 +02:00
Luis Lavena
b6e3dcc799 Windows: actually detect mingw-w64 and not 64 bits mode
__MINGW64__ is only defined when using mingw-w64 in 64bits mode, not when
using the 32bits version of the compiler.

Instead, to detect usage of mingw-w64 instead of mingw version of GCC we
should look at __MINGW64_VERSION_MAJOR and __MINGW64_VERSION_MINOR. If one
of these is defined means we are running on mingw-w64 compiler and headers
and not mingw.org build.

Read more here: http://bit.ly/detect-mingw-w64-vs-mingw

Closes #384
2012-04-25 04:06:53 +02:00
okuoku
db413f3806 win: Fix MinGW32 build 2012-03-12 02:24:50 +01:00
Bert Belder
18b37d4a49 Windows: fix compiler warnings 2012-03-09 17:04:26 +01:00
Igor Zinkovsky
94a5c7b002 fix warnings in windows build 2012-01-11 18:12:51 -08:00
Ben Noordhuis
f5c2a4a1ae Merge branch 'v0.6'
Conflicts:
	src/unix/core.c
	src/win/winapi.h
2011-12-02 18:15:04 +01:00
Bert Belder
2a6a4a0864 Fix MinGW and MinGW-w64 builds 2011-12-01 22:45:40 +01:00
Bert Belder
ee49c7a2b6 Fix MinGW and MinGW-w64 builds
Closes GH-222 and GH-267.
Thanks Yuki Okumura and Yasuhiro Matsumoto for providing fixes.
2011-12-01 15:47:49 +01:00
Ben Noordhuis
1fc1f28093 Wrap platform mutex and rwlock APIs.
Read/write locks are emulated with critical sections on Windows XP and Vista
because those platforms don't have a (complete) native read/write lock API.
2011-11-18 12:42:08 +01:00
Bert Belder
66f39250b7 Fix MinGW build 2011-10-21 18:42:39 -07:00
Igor Zinkovsky
54982a23ef windows: stdio over non-overlapped pipes 2011-10-20 15:14:39 -07:00
Bert Belder
51e9dbc2bb Work around windows udp bug, allow zero reads 2011-10-20 15:01:31 -07:00
Igor Zinkovsky
72b5976e83 windows: support utf8 in uv_fs functions
fixes #201
2011-10-12 13:24:22 -07:00
Bert Belder
12e689dcf8 win: the ddk got the NTSTATUS_FROM_WIN32 wrong 2011-09-09 04:39:41 +02:00
Bert Belder
2d1c672e2d More MinGW fixes 2011-09-08 23:49:46 +02:00
Bert Belder
06d69a82ee Make MinGW happy again 2011-09-08 20:19:32 +02:00