Commit Graph

1722 Commits

Author SHA1 Message Date
Bert Belder
7c3ba514e7 windows: use WCHAR consistently 2012-08-13 22:31:48 +02:00
Bert Belder
aa69f34d53 windows: report spawn errors to the exit callback
Formerly spawn errors would be reported as a message printed to the
process' stderr, to match unix behaviour. Unix has now been fixed to
be more sensible, so this hack can now be removed.

This also fixes a race condition that could occur when the user closes
a process handle before the exit callback has been made.
2012-08-13 22:31:47 +02:00
Bert Belder
80eae82104 test: spawn failures are reported by setting the exit code to -1 2012-08-13 22:31:47 +02:00
Bert Belder
3f1f11f338 windows: use UV_ECANCELED to signal canceled requests
This used to be UV_EINTR, but that's not an appropriate error code in
this situation.
2012-08-13 22:31:46 +02:00
Bert Belder
1b8307637b test: fix intermittent failure of tcp_unexpected_read on windows 2012-08-13 22:31:46 +02:00
Bert Belder
c85672eb13 test: avoid compiler complaints about implicit double-to-int cast 2012-08-13 22:31:45 +02:00
Bert Belder
762c85c3ef windows: un-break the build 2012-08-13 22:31:45 +02:00
Ben Noordhuis
758a76922b unix: fix SIGCHLD race in process.c
Start the SIGCHLD signal watcher before calling fork(). There was a very subtle
race where a child process could quit (and generate a SIGCHILD) before the
signal handler was installed.

To reproduce, call uv_spawn() repeatedly with the below x86_64 program:

    // compile with `gcc -O2 -nostdlib`
    void _start(void)
    {
      // syscall(SYS_exit, 0)
      __asm__ __volatile__ (
        "xorq %rdi, %rdi;"
        "xorq %rax, %rax;"
        "mov $0x3c, %al;"
        "syscall;"
      );
      for (;;);
    }
2012-08-13 16:51:53 +02:00
Ben Noordhuis
9d7e300364 Merge branch 'v0.8' 2012-08-13 15:51:12 +02:00
Ben Noordhuis
2c3e8b6aa6 build: rework -fvisibility=hidden detection
Make the gcc_version macro conform with what node.js and v8 use. Important
because node.js's common.gypi is going to export it soon.
2012-08-13 15:29:21 +02:00
Ben Noordhuis
ac0d46851a unix: work around darwin bug, don't poll() on pipe
poll() on newer versions of OS X sets POLLHUP|POLLIN whereas older versions
(and other Unices) only set POLLHUP. It was tripping up a check that expected
to read data when POLLIN was set.

While easy to work around, I switched it to a blocking read instead:
it's less code and avoids surprises like the one above altogether.

Fixes #522.
2012-08-12 00:59:18 +02:00
Fedor Indutny
23dc564f3b darwin: emulate fdatasync() with fcntl(F_FULLFSYNC)
OS X has no public API for fdatasync. And as pointed out in `man fsync(2)`:

  For applications that require tighter guarantees about the integrity of
  their data, Mac OS X provides the F_FULLFSYNC fcntl. The F_FULLFSYNC
  fcntl asks the drive to flush all buffered data to permanent storage.
  Applications, such as databases, that require a strict ordering of writes
  should use F_FULLFSYNC to ensure that their data is written in the order
  they expect.  Please see fcntl(2) for more detail.
2012-08-11 23:43:51 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
caa79af2ad unix: rework uv_eio_init() init once logic
Don't use counters.eio_init to track if libeio has been initialized, it's going
to be removed in a follow-up commit.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
75ba681913 unix: remove dependency on ev_child 2012-08-10 02:00:11 +02:00
Ben Noordhuis
ee50db6e36 unix, windows: preliminary signal handler support
* a no-op on Windows for now
* only supports the main loop on UNIX (again, for now)
2012-08-10 02:00:07 +02:00
Trond Norbye
5143d54ad3 Allow inclusion of <uv.h> with Sun Studio compiler
The Sun Studio compiler did not define any of the symbols used to determine if
the system was a unix-like system or not causing it to include the windows
header.
2012-08-09 01:09:14 +02:00
Trond Norbye
cbb930024f Allow headers to be included with -Werror and -Wundef
Users of the library may enforce a stricter set of compiler warnings causing
their builds to fail due to warnings emitted from the headers.
2012-08-09 01:09:09 +02:00
Ben Noordhuis
d4737abd6d unix: remove dead code in process.c
uv_spawn() saves and restores the environ in case the child clobbers it -
which is impossible because the child process runs in a separate address space.
2012-08-08 23:20:28 +02:00
Ben Noordhuis
47f496aa65 unix: simplify stdio handling in process.c 2012-08-08 23:20:28 +02:00
Ben Noordhuis
13467a40d4 unix: retrieve execve() errors in process.c
Make the forked child process send the errno to its parent process when it
fails to spawn a new process.
2012-08-08 23:19:50 +02:00
Ben Noordhuis
bf28aa4e78 unix: drop SPAWN_WAIT_EXEC guard in process.c
Code cleanup. This "experimental" feature was always enabled anyway, might as
well remove the define guard.
2012-08-08 14:44:38 +02:00
Bert Belder
a1157cef37 windows: don't duplicate invalid stdio handles
Ref: joyent/node#3779
2012-08-08 02:24:48 +02:00
Ben Noordhuis
21f2c1629a include: fix macro formatting 2012-08-08 02:18:59 +02:00
Bert Belder
00d2f22151 windows: fix typos in process-stdio.c 2012-08-08 02:18:53 +02:00
Ben Noordhuis
f372024342 include: link to Nikhil Marathe's libuv ebook 2012-08-07 22:01:24 +02:00
Ben Noordhuis
f97c80fa98 unix: fix const correctness compiler warning 2012-08-07 21:26:02 +02:00
Bert Belder
41b1265af8 Rip out c-ares 2012-08-07 01:04:26 +02:00
Bert Belder
a069956996 Remove c-ares integrations 2012-08-07 01:03:52 +02:00
Bert Belder
35c4858231 Remove c-ares tests and benchmarks 2012-08-07 01:03:51 +02:00
Bert Belder
3a8bb3b2b1 Use uv_inet_ntop/uv_inet_pton, instead of the c-ares implementations 2012-08-07 01:03:51 +02:00
Bert Belder
32f93e14cb Add libuv-ified versions of inet_pton and inet_ntop 2012-08-07 01:03:47 +02:00
Bert Belder
3b46285ff8 windows: remove libeio mentions from Makefile
Libeio is not used on Windows.
2012-08-07 01:03:38 +02:00
Bert Belder
32da23988b Merge branch 'v0.8'
Conflicts:
	src/unix/sunos.c
2012-08-05 23:51:04 +02:00
Bert Belder
dfb6be0e07 windows: map WSANO_DATA to UV_ENOENT
This improves uv_getaddrinfo error reporting.
2012-08-03 17:37:22 +02:00
Ben Noordhuis
9f7cdb20aa unix: add relaxed accept() setting
Mitigates unfair scheduling in multi-process setups that share a single listen
socket across multiple processes.
2012-08-02 15:58:55 +02:00
Bert Belder
6209fe51f0 windows: invalid stdio handles should be INVALID_HANDLE_VALUE and not NULL 2012-08-01 01:09:07 +02:00
Bert Belder
109e176ae2 windows: only allow opening directories for reading
This is closer to the Posix model.
2012-08-01 00:31:31 +02:00
Bert Belder
69c2ef8acc windows: initialize uv_fs_t.path to NULL
This shouldn't be necessary, but node v0.8 relies on it.
2012-07-31 21:08:26 +02:00
Bert Belder
9d71d1cab5 windows/uv_spawn: ignore errors when duplicating fd 0-2 fails
Hopefully this fixes joyent/node#3779.
2012-07-31 19:38:43 +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
7edc29a414 windows: fix regression in uv_fs_link
Old and new path were accidentally reversed.
2012-07-31 17:24:45 +02:00
Ben Noordhuis
d192a317aa sunos: workaround OS bug to prevent fs.watch() from spinning
This is a back-port of commit cfb06db from the master branch.

Fixes joyent/node#3768.
2012-07-31 15:07:40 +00:00
Bryan Cantrill
cfb06db5e5 sunos: workaround OS bug to prevent fs.watch() from spinning
Fixes joyent/node#3768.
2012-07-31 16:56:00 +02:00
Alan Gutierrez
8f66bfcee0 doc: add 'Intro to libuv' link to README
Add a link to 'An Introduction to libuv' to the documentation section of
README.md. Format the section as a bullet list.
2012-07-31 01:31:16 +02:00
Ben Noordhuis
4168855da5 include: move ssize_t workaround to uv-win.h 2012-07-31 00:05:03 +02:00
Bert Belder
514265ec6e windows: fix memory leaks in fs
Also clean up the code in various ways.
2012-07-31 00:04:48 +02:00
Ben Noordhuis
4eccb2ee52 include: move ssize_t workaround to uv-win.h 2012-07-30 14:26:50 +02:00
Bert Belder
1d5eb91474 Avoid compiler warning 2012-07-30 11:00:37 +02:00