Commit Graph

2063 Commits

Author SHA1 Message Date
Ben Noordhuis
b271b0686d build: fix up WIN_SRCS 2013-02-02 01:16:37 +01:00
Ben Noordhuis
7f3c783583 unix: don't clobber errno in signal handler 2013-01-31 15:28:16 +01:00
Bert Belder
3759d71269 win: get rid of early ipv6 support detection
No longer explictly check wheter an IPv6 stack is present when the user
tries to use IPV6 sockets. Instead realy on the operating system
to report the lack of protocol support via appropriate error messages.
2013-01-30 18:27:45 +01:00
Bert Belder
f21d94125e win/udp: DRY up setting SO_REUSEADDR
This patch makes sure that only uv_udp_set_socket sets the SO_REUSEADDR
bit for UDP sockets.
2013-01-30 18:27:44 +01:00
Bert Belder
3d779000b1 win/udp: fix bug in getsockopt() return value check 2013-01-30 18:27:44 +01:00
Bert Belder
4f54053517 win/udp: make uv_udp_set_socket set UV_HANDLE_IPV6
This patch makes uv_udp_set_socket responsible for setting the
UV_HANDLE_IPV6 flag. It also fixes the problem that uv_udp_open would
never set this flag at all.

In addition, this patch fixes some minor style issues.
2013-01-30 18:27:43 +01:00
Bert Belder
40c60cfc54 win/tcp: make uv_tcp_set_socket set UV_HANDLE_IPV6
This makes uv_tcp_set_socket responsible for setting the UV_HANDLE_IPV6
flag. This fixes a couple of situations where the the fact that a socket
is an IPv6 socket is not taken into account when deciding whether a call
to SetFileCompletionNotificationModes is appropriate.

It also fixes the issue that uv_tcp_open would never set this flag at
all.
2013-01-30 18:27:43 +01:00
Bert Belder
cfe14452ae win: fix uv_winsock_init crash when no IPv4 stack present
uv_winsock_init() tries to create an IPv4 socket in order to detect
if the system has any layered service providers (LSPs) installed.
When creating this socket failed it would call uv_fatal_error and exit
with the following message:

  socket: (10047) An address incompatible with the requested protocol was used.

This patch fixes that. It also includes some minor style tweaks.
2013-01-30 18:27:42 +01:00
Bert Belder
00503d6067 win: add error mappings related to unsupported protocols 2013-01-30 18:27:42 +01:00
Bert Belder
98c79f3e0d win: sort error code mappings 2013-01-30 18:27:41 +01:00
Ben Noordhuis
40a9e119ff build: fix up dependency rules
* Auto-create build subdirectories.

* Add coarse dependencies on header files so make rebuilds the sources
  whenever the headers change.
2013-01-29 17:07:41 +01:00
Ben Noordhuis
b607a7fed7 linux: move files out of src/unix/linux
Flattens the source tree and simplifies the Makefile.
2013-01-29 17:07:41 +01:00
Ben Noordhuis
75dea933eb build: support out of tree builds
Invoking make with builddir_name=/path/to/dir builds libuv in the
designated directory.
2013-01-29 17:07:25 +01:00
Ben Noordhuis
01fe4e73a6 build: add OS= make switch
Overrides the platform detection heuristic. Useful for cross-compiling.
2013-01-29 14:44:13 +01:00
Ben Noordhuis
93f61b7c3f unix: fix style issues in udp.c 2013-01-27 14:50:09 +01:00
Bert Belder
e4d8cbac78 unix: support sending uv_udp_t handles over ipc pipes 2013-01-22 23:58:13 +01:00
Ben Noordhuis
cf1dc61317 test: remove .travis.yml
Travis CI was generating a lot of false positives (or rather, false
negatives - tests that fail due to the environment they run in) and
it's been in a continuous error state for days now.

Remove it, we'll set up something ourselves.
2013-01-22 16:49:08 +01:00
Ben Noordhuis
7841f77b2e build: don't export _POSIX_C_SOURCE on non-linux
Don't export _POSIX_C_SOURCE to dependents. On the BSDs (and the
BSD-ish, like OS X), it hides SysV and BSD definitions.

The exception is Linux: _POSIX_C_SOURCE=200112 unlocks some of the
newer pthreads features like spinlocks and barriers, so keep
exporting it on that platform.
2013-01-22 16:19:52 +01:00
Andrius Bentkus
bdb498f8b1 unix, windows: return UV_EINVAL, not UV_EFAULT
A wrong multicast membership should return EINVAL.
2013-01-22 15:41:55 +01:00
Andrius Bentkus
017e2d5fde unix, windows: make uv_*_bind() error codes consistent
Just like uv_tcp_connect() it should return an EINVAL when the handle
is of an invalid type or when the network address is faulty.
2013-01-18 12:18:23 +01:00
Ben Noordhuis
372ac34d5f linux: translate futimes() fallback error codes
The fallback added in 9d4a16e uses the /proc filesystem to emulate
utimensat().

Translate error codes that indicate no procfs is mounted to ENOSYS.
Letting those error codes through unchecked will only confuse callers.
2013-01-17 18:43:07 +01:00
Ben Noordhuis
358957cdec doc: update gyp build instructions 2013-01-17 16:47:30 +01:00
Ben Noordhuis
9d4a16eefe linux: add futimes() fallback
The utimensat() syscall was added in 2.6.22. Add a fallback mode for
older kernels that uses utimes("/proc/self/fd/<fd>").

Fixes #687.
2013-01-17 14:22:55 +01:00
Ben Noordhuis
629a59b35b linux: use stdint types in structs
Use the typedefs from stdint.h to avoid build breakage on systems
where __u64 and friends are hidden when --std=c89 is in effect.

Fixes #685.
2013-01-17 01:29:47 +01:00
Ben Noordhuis
e7f384f853 test: make threadpool tests valgrind-compliant
Delete the event loop after the test to stop valgrind from complaining
about memory leaks.
2013-01-16 23:59:58 +01:00
Ben Noordhuis
4ba03ddd56 unix, windows: rename uv_run2 to uv_run
This changes the prototype of uv_run() from:

  int uv_run(uv_loop_t* loop);

To:

  int uv_run(uv_loop_t* loop, uv_run_mode mode);

Where `mode` is UV_RUN_DEFAULT, UV_RUN_ONCE or UV_RUN_NOWAIT.

Fixes #683.
2013-01-16 23:35:29 +01:00
Ben Noordhuis
4cbd5c7b32 test: remove bad tcp_write_error test
It makes the assumption that if you try to write to a localhost socket
often enough, eventually its send queue will fill up - which doesn't
happen if the machine it's running on is fast enough.
2013-01-16 00:31:21 +01:00
Ben Noordhuis
768b524639 unix: make stream.c more DRY 2013-01-14 16:53:35 +01:00
Ben Noordhuis
c931e31746 unix: make assertion message more descriptive 2013-01-14 11:32:55 +01:00
Ben Noordhuis
8e3e60ffbf linux: only pack struct uv__epoll_event on x86_64
On i386, it does not need packing; it's 12 bytes packed or unpacked.

On ARM, it's actively harmful: the struct is 12 bytes when packed and
16 bytes when unpacked.
2013-01-13 00:58:05 +01:00
Ben Noordhuis
9cd9bd33b4 build: fix host/target arch detection
Setting the target_arch without setting the host_arch as well was
effectively broken.
2013-01-13 00:51:53 +01:00
Ben Noordhuis
9aab5d4837 Revert "unix: improve uv_guess_handle() implementation"
This reverts commit 98bcddc8dd.

It's making a lot of tests in the node.js test suite fail.
2013-01-11 13:40:25 +01:00
Ben Noordhuis
fc42885d0e unix: set closed fd to -1, avoid double close bugs
* abort() if close() fails
* set fd to -1 after close() to prevent double close bugs
2013-01-11 13:39:39 +01:00
Ben Noordhuis
2ec2a5194f unix: clean up code in process.c 2013-01-11 13:38:01 +01:00
Ben Noordhuis
6f679a4ff7 unix: don't swap stdin file descriptors
Bug introduced in 47f496a. It turns out the file descriptors of the
stdin pipe don't have to be swapped around.
2013-01-11 13:32:00 +01:00
Bruce Mitchener
2cecd0d3d1 include: fix typos in comments 2013-01-10 15:12:02 +01:00
Ben Noordhuis
80f6a9c643 unix: omit second fcntl() call if possible
Omit the fcntl() syscall when the O_NONBLOCK or FD_CLOEXEC is already
set/clear because it's a no-op in that case.
2013-01-10 01:25:40 +01:00
Ben Noordhuis
9eedd32e40 build: make clean target remove libuv.{a,so,dylib} 2013-01-09 17:26:21 +01:00
Tim Bradshaw
bc0c61cd7f linux: ensure that all CPUs have model information 2013-01-08 05:29:21 +01:00
Ben Leslie
98bcddc8dd unix: improve uv_guess_handle() implementation
uv_guess_handle is currently squelching both fifo and all
sockets on to the UV_NAMED_PIPE type. Rather than treating
all sockets as UV_NAMED_PIPE, use getsockopt() and
getsockaddr() to determine if the socket is an AF_UNIX
stream (in which case return UV_NAMED_PIPE), or an AF_INET
stream (in which case return UV_TCP), or an AF_INET datagram
socket (in which case return UV_UDP).

Additionally, currently all other file descriptor types are
squelched to the UV_FILE type. Instead, only file descriptors
that are marked as regular files are treated as UV_FILE. All
other types (such as directories, character and block devices)
are now treated as UV_UNKNOWN_HANDLE.
2013-01-08 05:26:58 +01:00
Ben Noordhuis
cb3c448d8f unix: fix GNU-ism introduced in edd1007
Don't use features.h, it's only available on GNU/glibc systems.
2013-01-07 15:43:58 +01:00
Ben Noordhuis
f24335d498 test: fix #if defined checks
Same as edd1007 but this time for the tests.
2013-01-06 22:36:54 +01:00
Ben Noordhuis
fb725c0893 test: simplify tcp_ref2b
Said test doesn't need its own close callback, it can piggyback on the
common close callback.
2013-01-06 22:31:48 +01:00
Ben Noordhuis
ccb96b67df test: remove unused function declaration 2013-01-06 22:31:48 +01:00
Ben Noordhuis
847182cdf1 test, bench: make functions/variables static
Make functions and variables that are local to the compilation unit
static. Remove what turns out to be unused.
2013-01-06 22:31:48 +01:00
Ben Noordhuis
7ff6f29b85 test, bench: ANSI-fy function prototypes
Replace `void f()` with `void f(void)`; the former means "a function
that takes any number of arguments, including none" while the latter
is what is actually intended: a function taking no arguments.

The first form also isn't strictly conforming ANSI/ISO C.
2013-01-06 22:31:48 +01:00
Ben Noordhuis
fa9c577e55 linux: fix race in uv_resident_set_memory()
uv_resident_set_memory() used a global buffer to read data into, which
is a decidedly unsafe thing to do in a multi-threaded environment.
2013-01-06 22:31:48 +01:00
Ben Noordhuis
5b63285805 unix, windows: ANSI-fy uv_tty_reset_mode() prototype 2013-01-06 22:31:47 +01:00
Ben Noordhuis
edd10071eb unix: fix up #if defined checks
`#if FOO` (where FOO is undefined) is a legal construct in C89 and C99
but gcc, clang and sparse complain loudly about it at higher warning
levels.

Squelch those warnings. Makes the code more consistent as well.
2013-01-06 22:31:47 +01:00
Ben Noordhuis
e62dd3caa0 unix: fix include in cygwin.c 2013-01-06 21:25:58 +01:00