Commit Graph

2432 Commits

Author SHA1 Message Date
Ben Noordhuis
d8ab41bee3 windows: fix stray comments 2013-09-01 08:25:25 +02:00
Ben Noordhuis
bdc828972a windows: fix flags assignment in uv_fs_readdir() 2013-09-01 08:25:25 +02:00
Ben Noordhuis
779b8d81e9 include: make uv_write{2} const correct 2013-09-01 08:25:25 +02:00
Ben Noordhuis
8c6ea10502 include: uv_spawn takes const uv_process_options_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:25:00 +02:00
Ben Noordhuis
263da51967 include: uv_udp_send{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:20 +02:00
Ben Noordhuis
525dbb5e31 include: uv_udp_bind{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:18 +02:00
Ben Noordhuis
0f7b2963ad include: uv_udp_recv_cb now takes const uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:17 +02:00
Ben Noordhuis
255671da74 include: uv_tcp_connect{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:15 +02:00
Ben Noordhuis
daa229ace3 include: uv_tcp_bind{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:13 +02:00
Ben Noordhuis
8184076879 include: uv_ip[46]_addr now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:07 +02:00
Ben Noordhuis
b7d027c3a8 include: uv_read{2}_cb now takes const uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:01:34 +02:00
Ben Noordhuis
3fb6612233 include: uv_alloc_cb now takes uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 07:57:31 +02:00
Ben Noordhuis
8c9f28b4ac test: fix epoll_wait() usage in test-embed.c
Passing 0 as the `maxevents` argument fails with EINVAL, passing NULL as
the `events` argument fails with EFAULT.

Fixes #915.
2013-08-31 22:09:53 +02:00
Bert Belder
90874cc4de Now working on v0.11.12 2013-08-29 15:31:07 +02:00
Bert Belder
ba876d5353 2013.08.30, Version 0.11.11 (Unstable)
Changes since version 0.11.10:

* unix, windows: add thread-local storage API (Ben Noordhuis)

* linux: don't turn on SO_REUSEPORT socket option (Ben Noordhuis)

* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis)

* windows: make uv_shutdown() for write-only pipes work (Bert Belder)

* include: update uv_udp_open() / uv_udp_bind() docs (Ben Noordhuis)

* unix: req queue must be empty when destroying loop (Ben Noordhuis)

* unix: move loop functions from core.c to loop.c (Ben Noordhuis)

* darwin: remove CoreFoundation dependency (Ben Noordhuis)

* windows: make autotools build system work with mingw (Keno Fischer)

* windows: fix mingw build (Alex Crichton)

* windows: tweak Makefile.mingw for easier usage (Alex Crichton)

* build: remove _GNU_SOURCE macro definition (Ben Noordhuis)
2013-08-29 15:30:53 +02:00
Bert Belder
2e74e2ceca windows: make uv_shutdown() for write-only pipes work
A couple of issues prevented uv_shutdown() from working correctly with
write-only pipes.

  * The pipe handle wasn't opened with the right permissions, so an
    attempt to probe the state of the write buffer would fail with
    ERROR_ACCESS_DENIED.

  * The pipe flags for child process stdio pipes were always set to
    UV_HANDLE_READABLE and UV_HANDLE_WRITABLE, even in cases where it
    was actually half-duplex.

  * There was no code path that lead to closing the pipe handle if the
    pipe was write-only.
2013-08-29 15:16:52 +02:00
Ben Noordhuis
82f2472b9f darwin: fix 10.6 build error in fsevents.c
Work around an 'initializer element is not constant' build error in
src/unix/fsevents.c by turning the const int flags into #defines.

Only an issue on OS X 10.6 due to the old compiler it uses.

Fixes #908.
2013-08-28 11:59:04 +02:00
Ben Noordhuis
d48168afd0 darwin: remove CoreFoundation dependency
Load the required symbols at run-time rather than linking against the
CoreFoundation (and CoreServices and ApplicationServices) frameworks
at build time.

Should make integration easier for people that bundle libuv with their
own projects because they no longer have to replicate magic -framework
incantations in their top-level build system.
2013-08-27 23:58:21 +02:00
Ben Noordhuis
12933f43c9 unix: move loop functions from core.c to loop.c
Move uv_default_loop(), uv_loop_new() and uv_loop_delete() to loop.c.
2013-08-27 22:48:16 +02:00
Ben Noordhuis
3f2d4d5358 unix: req queue must be empty when destroying loop
Assert that the request queue is empty when destroying the event loop.

Should catch errors where people call uv_loop_delete() when there are
still in-progress work requests (for example.)
2013-08-27 22:48:16 +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
Alex Crichton
a9b3fe2e19 windows: tweak Makefile.mingw for easier usage
Default CC to `gcc` instead of `cc` because at least on the mingw
installation I had there was no `cc` executable. This avoids having
to type `CC=gcc` in all the `make` commands.

Also append to `CFLAGS` instead of defining if not previously defined.
These flags are required to build libuv, so they should not be
overridden if other extra CFLAGS are supplied via the command
line as well.
2013-08-25 16:01:33 +02:00
Ben Noordhuis
5d2434bf71 unix, windows: add thread-local storage API
Uses the pthread_key_{create,delete} and pthread_{get,set}specific
functions on UNIX platforms, Tls{Alloc,Free} and Tls{Get,Set}Value
on Windows.

Fixes #904.
2013-08-25 15:51:07 +02:00
Ben Noordhuis
d5ab1c1a3b Revert "build: remove mingw makefile"
As requested by the Rust people.

This reverts commit 8f3621e4dd.
2013-08-26 22:05:01 +02:00
Ben Noordhuis
d3308c25b9 include: update uv_udp_open() / uv_udp_bind() docs
Mention that:

* these functions set the SO_REUSEADDR and SO_REUSEPORT socket flags,
* what the effect of those flags is, and
* that we may remove it someday
2013-08-25 22:00:12 +02:00
Ben Noordhuis
9d60f1ebda linux: don't turn on SO_REUSEPORT socket option
On the BSDs, SO_REUSEPORT is pretty much SO_REUSEADDR with some special
casing for IP multicast.  When two processes (that don't do multicast)
bind to the same address, only the last one receives traffic.  It allows
one to "steal" the bound address from another process.  (Both processes
have to enable SO_REUSEPORT though, so it only works in a cooperative
setting.)

On Linux however, it enables port sharing, not stealing - both processes
receive a share of the traffic.  This is a desirable trait but pre-3.9
kernels don't support the socket option and a libuv program therefore
behaves differently with older kernels or on another platform.

The difference in behavior (sharing vs. stealing) is, in my opinion,
big enough and confusing enough that it merits a rollback.  People
that want this kind of functionality can prepare the socket manually
and hand it off to uv_udp_open().

This commit effectively reverts commit 17452cd.
2013-08-25 21:38:39 +02:00
Ben Noordhuis
d6464c87bd build: remove _GNU_SOURCE macro definition
Compile libuv without -D_GNU_SOURCE, remove mention from the README.

The only place where it's still used is in the test suite and only
because test/test-fs.c uses struct stat directly.
2013-08-24 22:00:48 +02:00
Ben Noordhuis
8f3621e4dd build: remove mingw makefile
Commit e52aa6c adds MinGW support to the autotools build.  Remove the
Makefile, it's no longer needed.
2013-08-24 21:50:08 +02:00
Keno Fischer
e52aa6cc57 build: make autotools build system work with mingw 2013-08-24 21:49:37 +02:00
Bert Belder
c8607675b9 Now working on v0.11.11 2013-08-24 19:46:03 +02:00
Bert Belder
742dadcb71 2013.08.25, Version 0.11.10 (Unstable)
* windows: Re-implement uv_fs_stat. The st_ctime field now contains the
  change time, not the creation time, like on unix systems. st_dev,
  st_ino, st_blocks and st_blksize are now also filled out. (Bert
  Belder)

* linux: fix setsockopt(SO_REUSEPORT) error handling (Ben Noordhuis)

* windows: report uv_process_t exit code correctly (Bert Belder)

* windows: make uv_fs_chmod() report errors correctly (Bert Belder)

* windows: make some more NT apis available for libuv's internal use
  (Bert Belder)

* windows: squelch some compiler warnings (Bert Belder)
2013-08-24 19:45:59 +02:00
Bert Belder
f4e4e6a629 authors: remove duplicate entry 2013-08-24 19:43:00 +02:00
Bert Belder
20a8e58adb windows: reimplement uv_fs_stat using NT syscalls
This improves the output of uv_fs_stat:
  * `st_ctime` now contains the change time, not the creation time.
  * `st_ino` is now filled in with an fs-specific unique number.
  * `st_dev` is set to the serial number of the containing file system.
  * `st_blocks` now gets set.
  * `st_blksize` is no longer zero, but set to a reasonable default.
2013-08-24 19:13:51 +02:00
Bert Belder
1cc6f96f0c windows: squelch some compiler warnings
This removes some compiler warnings caused by implicit type conversion
from uint64_t to long, which would happen in the `FILETIME_TO_TIMESPEC`
macro.
2013-08-24 19:13:50 +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
Bert Belder
7f756955b6 windows: make uv_fs_chmod() report errors correctly
Before this patch libuv would attempt to use GetLastError() to retrieve
the cause of NtQueryInformationFile failure, but that's not how it
should be done.
2013-08-24 16:45:31 +02:00
Bert Belder
d667653f77 windows: report uv_process_t exit code correctly
A stupid oversight in 66ae0ff would cause a random value to be reported
as the exit code for a 'normally exited' child process.
2013-08-24 16:45:30 +02:00
Bert Belder
d8a3ed6cd0 test: strip trailing whitespace 2013-08-24 16:45:30 +02:00
Ben Noordhuis
17452cd0e2 linux: fix setsockopt(SO_REUSEPORT) error handling
Linux as of 3.9 has a SO_REUSEPORT option that is similar but not
identical to its BSD counterpart.

On the BSDs, it turns on SO_REUSEADDR _and_ makes it possible to share
the address and port across processes.

On Linux, it "merely" enables fair load distribution - port sharing
still requires that you set SO_REUSEADDR.

Fair distribution is a desirable trait but not an essential one.
We don't know in advance whether the kernel actually supports
SO_REUSEPORT so don't treat EINVAL or ENOPROTOOPT as errors.

As an aside, on the BSDs we now omit the setsockopt(SO_REUSEADDR)
system call because it's implied by SO_REUSEPORT.

Fixes #870.
2013-08-24 15:26:51 +02:00
Bert Belder
e47e6b2afa Now working on v0.11.10 2013-08-23 18:51:38 +02:00
Bert Belder
a2d29b5b06 2013.08.24, Version 0.11.9 (Unstable)
Changes since version 0.11.8:

* fsevents: share FSEventStream between multiple FS watchers, which
  removes a limit on the maximum number of file watchers that can be
  created on OS X. (Fedor Indutny)

* process: the `exit_status` parameter for a uv_process_t's exit
  callback now is an int64_t, and no longer an int. (Bert Belder)

* process: make uv_spawn() return some types of errors immediately on
  windows, instead of passing the error code the the exit callback. This
  brings it on par with libuv's behavior on unix. (Bert Belder)
2013-08-23 18:51:36 +02:00
Bert Belder
66ae0ff562 process: make the 'status' parameter for exit_cb an int64_t
This means we no longer have to strip the high bit from the process exit
code on Windows, which is problematic because an unhandled SEH exception
can make a process exit with a status code that has the high bit set.
2013-08-23 18:35:09 +02:00
Bert Belder
ed82eae13a windows: make uv_spawn() failure more predictable
* It will now report some types of errors synchronously, to bring it on
  par with uv-unix. Fixes #865.

* Failure to find the target executable will now set up stdio pipes
  correctly, so the user can assume that when uv_spawn() returns 0 these
  pipes will never trigger asserts in libuv's guts.
2013-08-23 18:34:14 +02:00
Fedor Indutny
cd2794c01f fsevents: use shared FSEventStream
It seems that number of simultaneously opened FSEventStreams is
limited on OSX (i.e. you can have only fixed number of them on
one running system), getting past through this limit will cause
`FSEventStreamCreate` to return false and write following message
to stderr:

    (CarbonCore.framework) FSEventStreamStart: register_with_server:
    ERROR: f2d_register_rpc() => (null) (-21)

To prevent this, we must use only one shared FSEventStream with a
paths for all uv_fsevent_t handles, and then filter out events for
each handle using this paths again.

See https://github.com/joyent/node/issues/5463
2013-08-22 16:35:13 +04:00
Timothy J Fontaine
abcad99e23 Now working on v0.11.9 2013-08-21 10:25:40 -07:00
Timothy J Fontaine
a5260462db 2013.08.22, Version 0.11.8 (Unstable)
Changes since version 0.11.7:

* unix: fix missing return value warning in stream.c (Ben Noordhuis)

* build: serial-tests was added in automake v1.12 (Ben Noordhuis)

* windows: fix uninitialized local variable warning (Ben Noordhuis)

* windows: fix missing return value warning (Ben Noordhuis)

* build: fix string comparisons in autogen.sh (Ben Noordhuis)

* windows: move INLINE macro, remove UNUSED (Ben Noordhuis)

* unix: clean up __attribute__((quux)) usage (Ben Noordhuis)

* sunos: remove futimes() macro (Ben Noordhuis)

* unix: fix uv__signal_unlock() prototype (Ben Noordhuis)

* unix, windows: allow NULL async callback (Ben Noordhuis)

* build: apply dtrace -G to all object files (Timothy J. Fontaine)

* darwin: fix indentation in uv__hrtime() (Ben Noordhuis)

* darwin: create fsevents thread on demand (Ben Noordhuis)

* darwin: reduce fsevents thread stack size (Ben Noordhuis)

* darwin: call pthread_setname_np() if available (Ben Noordhuis)

* build: fix automake serial-tests check again (Ben Noordhuis)

* unix: retry waitpid() on EINTR (Ben Noordhuis)

* darwin: fix ios build error (Ben Noordhuis)

* darwin: fix ios compiler warning (Ben Noordhuis)

* test: simplify test-ip6-addr.c (Ben Noordhuis)

* unix, windows: fix ipv6 link-local address parsing (Ben Noordhuis)

* fsevents: FSEvents is most likely not thread-safe (Fedor Indutny)

* windows: omit stdint.h, fix msvc 2008 build error (Ben Noordhuis)
2013-08-21 10:25:37 -07:00
Ben Noordhuis
8531046a86 windows: omit stdint.h, fix msvc 2008 build error
Don't include <stdint.h>, it's not available when compiling with MSVC
2008 and we don't need it in the first place - just cast the argument
to `char *` rather than `uintptr_t`.

Fixes #893.
2013-08-20 14:06:35 +02:00
Fedor Indutny
303ae3b958 fsevents: FSEvents is most likely not thread-safe
Perform all operation with FSEventStream in the same thread, where it'll
be used.
2013-08-20 13:04:47 +04:00