Commit Graph

1703 Commits

Author SHA1 Message Date
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
Ben Noordhuis
21f2c1629a include: fix macro formatting 2012-08-08 02:18:59 +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
Ben Noordhuis
be1032431d Merge branch 'v0.8' 2012-07-29 03:13:21 +02:00
Ben Noordhuis
4fe1916926 linux: fix 'two watchers, one path' segfault
Problem: registering two uv_fs_event_t watchers for the same path, then closing
them, caused a segmentation fault. While active, the watchers didn't work right
either, only one would receive events.

Cause: each watcher has a wd (watch descriptor) that's used as its key in a
binary tree. When you call inotify_watch_add() twice with the same path, the
second call doesn't return a new wd - it returns the existing one. That in turn
resulted in the first handle getting ousted from the binary tree, leaving
dangling pointers.

This commit addresses that by storing the watchers in a queue and storing the
queue in the binary tree instead of storing the watchers directly in the tree.

Fixes joyent/node#3789.
2012-07-28 16:31:47 +02:00
Ben Noordhuis
ec76a42515 test: add uv_loop_t to benchmark-sizes.c 2012-07-28 14:56:36 +02:00
Ben Noordhuis
4fe369b179 test: add uv_fs_event_t to benchmark-sizes.c 2012-07-28 14:48:47 +02:00
Ben Noordhuis
b5b8ead808 test: add failing fs_event test
Watches the same file twice. Fails on Linux with a segmentation fault.
2012-07-28 14:40:03 +02:00
Ben Noordhuis
912348261e include: update confusing uv_write comment 2012-07-27 16:04:13 +02:00
Ben Noordhuis
cf05c5f0d6 Raise UV_ECANCELED on premature close.
Set the error code to the more appropriate UV_ECANCELED instead of UV_EINTR
when the handle is closed and there are in-flight requests.
2012-07-27 15:13:29 +02:00
Ben Noordhuis
9f59e8e38c include: update uv_close documentation 2012-07-27 14:44:06 +02:00
Shuhei Tanuma
22f004db61 unix: don't abort() when trylock functions return EBUSY
Fixes #500.
2012-07-26 00:11:46 +02:00
Ben Noordhuis
94355e4718 unix: fix format string vulnerability in freebsd.c
uv_set_process_title() was susceptible to a format string vulnerability:

  $ node -e 'process.title = Array(42).join("%s")'
  Segmentation fault: 11 (core dumped)

The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
but valgrind complains loudly about reads from and writes to uninitialized
memory in libc. It's not a libuv bug because the test case below triggers the
same warnings:

  #include <sys/types.h>
  #include <unistd.h>

  int main(void)
  {
    setproctitle("%s", "test");
    return 0;
  }

That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).

This commit reapplies commit a9f6f06, which got reverted in 69a6afe. The revert
turned out to be unnecessary.
2012-07-19 16:26:54 +02:00
Ben Noordhuis
ff59525c7e unix: fix uv_pipe_connect() with existing fd
Don't create a new socket descriptor if one has been previously assigned with
uv_pipe_open().
2012-07-19 16:25:49 +02:00
Ben Noordhuis
e3a28508b2 unix: fix errno reporting in uv_pipe_connect()
Remember the errno when the socket() syscall fails.
2012-07-19 16:13:44 +02:00
Ben Noordhuis
69a6afea63 unix: undo changes to uv_set_process_title()
It's making node.js crash when run as root. Backtrace:

  (gdb) bt
  #0  0x00007fff856e3ff9 in __findenv ()
  #1  0x00007fff856e404c in getenv ()
  #2  0x000000010004c850 in loop_init (loop=0x10045a792, flags=8) at ev.c:1707
  #3  0x000000010004cb3b in ev_backend [inlined] () at /Users/tjfontaine/Development/node/deps/uv/src/unix/ev/ev.c:2090
  #4  0x000000010004cb3b in ev_default_loop (flags=1606417108) at ev.c:2092
  #5  0x000000010004e5c6 in uv__loop_init (loop=0x10066e330, default_loop=1) at loop.c:52
  #6  0x0000000100044367 in uv_default_loop () at core.c:196
  #7  0x0000000100004625 in node::Init (argc=1606417456, argv=0x100b0f490) at node.cc:2761
  #8  0x000000010000797d in node::Start (argc=1606417600, argv=0x0) at node.cc:2888
  #9  0x0000000100000ca4 in start ()

This reverts commits:

  b49d6f7 unix: fix uv_set_process_title()
  a9f6f06 unix: fix format string vulnerability in freebsd.c
  a87abc7 unix: avoid buffer overflow in proctitle.c
  dc97d44 unix: move uv_set_process_title() to proctitle.c
2012-07-18 22:54:39 +02:00
Ben Noordhuis
b49d6f7c30 unix: fix uv_set_process_title()
Use strncpy() to set the process title, it pads the remainder with nul bytes.
Avoids garbage output on systems where `ps aux` prints the entire proctitle
buffer, not just the characters up to the first '\0'.

Fixes joyent/node#3726.
2012-07-18 00:26:02 +02:00
Ben Noordhuis
a9f6f06fea unix: fix format string vulnerability in freebsd.c
uv_set_process_title() was susceptible to a format string vulnerability:

  $ node -e 'process.title = Array(42).join("%s")'
  Segmentation fault: 11 (core dumped)

The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
but valgrind complains loudly about reads from and writes to uninitialized
memory in libc. It's not a libuv bug because the test case below triggers the
same warnings:

  #include <stdio.h>
  #include <stdlib.h>
  #include <sys/types.h>
  #include <unistd.h>

  int main(void)
  {
    setproctitle("%s", "test");
    return 0;
  }

That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).
2012-07-13 17:16:38 +02:00
Ben Noordhuis
a87abc7070 unix: avoid buffer overflow in proctitle.c
Get/set process title with uv_strlcpy(), not strncpy(). The latter won't
zero-terminate the result if the destination buffer is too small.
2012-07-13 15:03:39 +02:00
Fedor Indutny
dc97d44c56 unix: move uv_set_process_title() to proctitle.c
Use hijacking argv array to change process' title. It seems to be working fine
on almost every platform (at least it should not break anything as it's used in
nginx in a similar way).
2012-07-13 14:57:40 +02:00
Fedor Indutny
3726dee5e9 unix: thread: use mach semaphores on osx 2012-07-10 14:14:50 +02:00
Ben Noordhuis
ad382bcac0 test: add missing return statement 2012-07-09 18:46:57 +02:00