Commit Graph

884 Commits

Author SHA1 Message Date
Ben Noordhuis
b779a0db74 Merge branch 'v0.8' 2012-06-29 02:28:57 +02:00
Ben Noordhuis
f6a02fbe76 linux: don't use accept4() syscall after ENOSYS
Repeatedly calling the syscall when it's not supported has a small but
measurable performance impact.

Besides, it's a silly thing to do.
2012-06-29 02:23:47 +02:00
Ben Noordhuis
27cd5f03ef linux: fix accept4() ENOSYS detection on i386
accept4() piggybacks on the socketcall() on i386. socketcall() has the flaw
that it returns EINVAL instead of ENOSYS when the operation is not supported.

The problem is that accept4() also returns EINVAL when its flag argument is
invalid.

Try to discern between the two failure cases to the best of our abilities.
2012-06-29 02:11:45 +02:00
Bert Belder
4a88b3b4b7 windows: don't inhibit reparse behavior when non-symlink is encountered
This fixes the issue that a mount point would be treated as a
symlink, but readlink would subsequently return an NT namespaced
path that is unusable for many purposes.

This also pre-emptively fixes the problems that would arise when
an user has a reparse point whose tag is neither
IO_REPARSE_TAG_MOUNT_POINT nor IO_REPARSE_TAG_SYMLINK.

Finally uv_lstat() will now return the correct length in st_size.
Previously the length was computed incorrectly for relative
symlinks, and those that had non-ascii characters in their target.
2012-06-28 05:07:18 +02:00
Ben Noordhuis
1b6843482a unix: assume that dlopen() clobbers dlerror()
Or rather, don't assume that dlopen() does *not* clobber dlerror().

Joe Ferner reports that loading libjava on OS X sets dlerror() even when
dlopen() succeeds, which makes uv_dlopen() raise an error when it shouldn't.

I haven't been able to reproduce it but it's possible that libjava clobbers
dlerror() by trying (and failing) to load other libraries.

At any rate, Joe confirmed that this patch addresses the issue.

Fixes #462.
2012-06-28 01:54:02 +02:00
Ben Noordhuis
4d42af20e3 unix: don't create connect req when connect() fails
Fixes a lifecycle issue where the req got created, added to the list of active
reqs but wasn't properly activated because uv__connect() returned early.
2012-06-26 23:35:25 +02:00
Roman Neuhauser
5a0f3411fc unix: map ENODEV to UV_ENODEV
produces better error message from test-dgram-multicast-multi-process
when run w/o network.

before:

=== release test-dgram-multicast-multi-process ===
Path: simple/test-dgram-multicast-multi-process
dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership Unknown system errno 19
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 9223 died. 1 dead of 3

dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership Unknown system errno 19
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

[PARENT] sent 'First message to send' to 224.0.0.114:12346
dgram.js:287
[PARENT] sent 'Second message to send' to 224.0.0.114:12346
    throw new errnoException(errno, 'addMembership');
[PARENT] sent 'Third message to send' to 224.0.0.114:12346
          ^
[PARENT] sendSocket closed
[PARENT] Worker 9224 died. 2 dead of 3
Error: addMembership Unknown system errno 19
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 9225 died. 3 dead of 3
[PARENT] All workers have died.
[PARENT] Fail
Command: out/Release/node /home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js

after:

=== release test-dgram-multicast-multi-process ===
Path: simple/test-dgram-multicast-multi-process
dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership ENODEV
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 13141 died. 1 dead of 3

dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
[PARENT] sent 'First message to send' to 224.0.0.114:12346
[PARENT] sent 'Second message to send' to 224.0.0.114:12346
[PARENT] sent 'Third message to send' to 224.0.0.114:12346
[PARENT] sent 'Fourth message to send' to 224.0.0.114:12346
[PARENT] sendSocket closed

dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership ENODEV
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 13142 died. 2 dead of 3
Error: addMembership ENODEV
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 13143 died. 3 dead of 3
[PARENT] All workers have died.
[PARENT] Fail
Command: out/Release/node /home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js
2012-06-26 17:33:29 +02:00
Ben Noordhuis
a416a585b2 Merge branch 'v0.8' 2012-06-25 16:53:29 +02:00
Ben Noordhuis
d0816aae52 sunos: fix free() of non-malloc'd pointer 2012-06-25 16:53:24 +02:00
saghul
431d61af31 win: map ERROR_PRIVILEGE_NOT_HELD to UV_EPERM 2012-06-25 16:37:08 +02:00
Xidorn Quan
aec320b76c darwin: get cpu model correctly on mac 2012-06-25 03:57:04 +02:00
Ben Noordhuis
0fde10825e linux: set close-on-exec flag with ioctl(FIOCLEX)
ioctl(FIOCLEX) is 25% faster than fcntl(F_SETFD) on a stock 2.6.32 kernel.
2012-06-24 06:06:33 +02:00
Ben Noordhuis
e21cdf1e0d unix: malloc only once in uv_getaddrinfo() 2012-06-23 04:09:22 +02:00
Bert Belder
82340e96cc Merge branch 'v0.8' 2012-06-22 20:43:23 +02:00
Bert Belder
0387c23759 windows: don't use CRT functions to implement (f)utimes and (f)stat 2012-06-22 20:04:07 +02:00
Bert Belder
3da9504beb windows: map ERROR_INVALID_HANDLE to UV_EBADF 2012-06-22 20:04:07 +02:00
Bert Belder
d0950dd491 windows: whitespace fixes 2012-06-22 20:04:06 +02:00
Ben Noordhuis
f91e6be07d linux: add epoll syscalls 2012-06-22 19:04:41 +02:00
Ben Noordhuis
e132075738 unix: rename linux/core.c to linux/linux-core.c
Newer versions of gyp do not support files with the same basenames (example:
core.c and linux/core.c).

The nominal reason is consistency across build systems. Apparently, msbuild
doesn't support it either.

Somewhere, someplace, baby Jesus cries sad little tears...

Fixes #464.
2012-06-22 18:40:54 +02:00
Ben Noordhuis
42df4cb7f6 sunos: fix use of pid_t in format string 2012-06-22 15:15:20 +00:00
Ben Noordhuis
2a5ff050dd sunos: replace bzero with memset 2012-06-22 15:10:43 +00:00
Ben Noordhuis
c222f075c3 sunos: replace ev_io with uv__io_t 2012-06-22 15:09:56 +00:00
Ben Noordhuis
f01e9d708a unix: clarify that uv_getaddrinfo_t is a req 2012-06-22 16:40:45 +02:00
Bert Belder
ea3e2cd480 windows: get rid of overly complicated uv_filetime_to_time_t helper 2012-06-22 01:45:19 +02:00
Bert Belder
da59427c66 windows: don't set WT_EXECUTELONGFUNCTION for fs operations 2012-06-21 02:37:44 +02:00
Ben Noordhuis
14ffaa668d unix, windows: stat: never pass NULL to cb
Never pass NULL to the fs_poll callback, use a zeroed out statbuf instead.

Makes the interface a little more convenient to use.
2012-06-20 17:56:37 +02:00
Bert Belder
6e8eb33249 windows: abort accept requests when a shared tcp server is closed
Just closing the listening socket handle does not cancel AcceptEx
operations when another handle is keeping the underlying socket
open. Thus the AcceptEx operations have to be explicitly canceled
in uv_tcp_close.
2012-06-20 03:33:15 +02:00
Bert Belder
67090653df windows: set the child_pid property for all IPC pipes in uv_spawn 2012-06-19 19:22:49 +02:00
isaacs
382f2a262b sunos: allow suppression of ifaddrs.h
Older Solaris versions do not have this feature.  This allows
them to set SUNOS_NO_IFADDRS to allow libuv to build.

Re: joyent/node#3465
2012-06-18 23:07:46 +02:00
Fedor Indutny
61a6e06ec2 sunos: fix assertion errors in uv__finish_close 2012-06-18 22:43:53 +02:00
Ben Noordhuis
c1d8e011f4 linux: fix typo in syscall name 2012-06-18 17:06:50 +02:00
Ben Noordhuis
6d67cf1952 unix, windows: update uv_fs_poll API
* the callback gets called only once on error, not repeatedly...

* ...unless the error reason changes from e.g. UV_ENOENT to UV_EACCES

* the callback receives pointers to uv_statbuf_t objects so it can inspect what
  changed
2012-06-16 04:54:25 +02:00
Ben Noordhuis
7ca524e133 unix: stat: detect sub-second changes on darwin 2012-05-31 20:32:33 +02:00
Ben Noordhuis
5ff2b6121f unix: stat: detect sub-second changes on linux 2012-05-31 20:32:32 +02:00
Ben Noordhuis
cc7c8542a5 unix, windows: add stat() based file watcher
Monitors a file path for changes. Supersedes ev_stat.
2012-05-31 20:32:24 +02:00
Bert Belder
b1649b6f77 windows: prevent accidental inheritance of sockets pending acceptance 2012-06-14 21:19:04 +02:00
Bert Belder
5d5688f241 unix: always set CLOEXEC flag for child process stdio FDs 2012-06-14 18:29:47 +02:00
Ben Noordhuis
2c983fb994 unix: fix memory leak in libev
Not everything that identifies itself as glibc really is glibc.
2012-06-14 04:03:05 +02:00
Ben Noordhuis
4d7f1e1864 unix: implement uv_disable_stdio_inheritance() 2012-06-14 01:20:49 +02:00
Bert Belder
ade6930241 windows: implement uv_disable_stdio_inheritance 2012-06-14 01:19:52 +02:00
Ben Noordhuis
94cb06fecf unix: make uv__nonblock() EINTR resilient
It's underspecified if and when ioctl(FIONBIO) or fcntl() can return EINTR.
Let's take the safe route.
2012-06-14 01:19:34 +02:00
Ben Noordhuis
b3a97f8981 unix: make uv__cloexec() EINTR resilient
It's somewhat underspecified if and when fcntl() can return EINTR. It never
does on Linux for F_GETFD or F_SETFD but let's not make any assumptions.
2012-06-14 01:19:34 +02:00
Bert Belder
07c6ac2b55 windows: move child stdio buffer ops to a separate file 2012-06-13 19:17:13 +02:00
Bert Belder
9f44b0e393 windows: fix serious typo in init_child_stdio 2012-06-13 01:30:43 +02:00
Ben Noordhuis
95e89c6a0e unix, windows: share uv__handle_init() 2012-06-13 01:28:58 +02:00
Bert Belder
b7e150ee91 windows: uv_kill() should report UV_ESRC when the victim is already dead 2012-06-12 17:00:16 +02:00
Bert Belder
048422d865 windows: fix some comments 2012-06-12 17:00:15 +02:00
Ben Noordhuis
84f0d96ae0 unix: reset error status in uv_dlopen()
Fixes a bug where uv_dlopen() mistakenly reported failure because of previous
errors.
2012-06-12 01:48:21 +02:00
Bert Belder
e0c6114e32 windows: remove run-time RB_INSERT check from release builds 2012-06-11 22:19:24 +02:00
Ben Noordhuis
3b417d10bc linux: add eventfd and eventfd2 syscalls 2012-06-11 04:20:03 +02:00