Commit Graph

1869 Commits

Author SHA1 Message Date
Ben Noordhuis
fd136da04a unix: remove always_inline attribute
Fixes the following gcc 4.7+ warning:

  ../src/unix/internal.h:105:13: warning: always_inline function might not be
  inlinable [-Wattributes]

gcc wants the always_inline function to be annotated with the 'inline' keyword
which we can't do because we compile in C89 mode.

Using __inline is not an option because that makes clang generate warnings when
-Wlanguage-extension-token is enabled.

Therefore, remove the always_inline attribute altogether and hope that the
compiler is smart enough to inline the functions.
2012-10-15 01:08:47 +02:00
Ben Noordhuis
d8de4fbd13 build: compile with -fwrapv in debug mode 2012-10-15 00:52:27 +02:00
Ben Noordhuis
47b2cd31c9 build: rename uv.a to libuv.a 2012-10-11 14:32:06 +02:00
Ben Noordhuis
cb03e3bd26 darwin: work around concurrent write() kernel bug
Simultaneously writing from multiple threads to the same file descriptor is not
safe on OS X. We already serialized all pwrite() system calls, apply the same
workaround to the write() system call.

Fixes a node.js test, test/simple/test-fs-sir-writes-alot.js, that was failing
because parts of the output file got filled with nul bytes.
2012-10-10 02:15:54 +02:00
Ben Noordhuis
4affbe70b6 unix: remove unnecessary pthread_join ESRCH check
ESRCH means the thread never got started but we guard against that now.
2012-10-10 01:11:09 +02:00
Hiroaki Nakamura
acea3028c5 unix, windows: add thread barrier support 2012-10-09 17:30:52 +02:00
Hiroaki Nakamura
2684f876a9 windows: don't set CRT debug mode on MinGW 2012-10-09 17:00:02 +02:00
Andrius Bentkus
193432df7d uv.h: move gid and uid to the end of the uv_process_t struct
uv_gid_t and uv_uid_t have different sizes on different platforms.
Moving them to the end of the struct is easier for bindings that use
FFI.
2012-10-09 16:57:02 +02:00
Andrius Bentkus
b2caee7cfb uv.h: move private uv_req_t fields to the bottom of the struct 2012-10-09 16:56:11 +02:00
Ben Noordhuis
40134c3537 unix: don't reap threads if none were started
Fixes a segmentation fault on 32 bits linux with glibc 2.15.

Thanks to Johan Bergström (@jbergstroem) for reporting the issue and testing
out the patch.
2012-10-08 00:37:03 +02:00
Shigeki Ohtsu
f7c991f1ce test: add consumer-producer test for condvar 2012-10-07 23:17:31 +02:00
Ting-Yu Lin
8f1ec32865 windows: fix application crashed popup in debug version 2012-10-07 15:43:03 +02:00
Ben Noordhuis
b9ed1a6dbf unix: don't abort() on EINVAL in threadpool.c
The FreeBSD implementation of pthread_join() returns EINVAL when a thread has
already quit, not ESRCH.
2012-10-06 22:58:28 +02:00
Ben Noordhuis
b152b12772 unix: fix scandir filter prototype again
The only platforms where the dirent argument is non-const are OS X, OpenBSD
and older versions of FreeBSD (but not FreeBSD 9). Accommodate the first two.
2012-10-06 22:25:58 +02:00
Ben Noordhuis
7833df14ba freebsd, openbsd: don't use fdatasync()
The fdatasync() system call does not exist on either FreeBSD or OpenBSD, fall
back to fsync().
2012-10-06 17:19:12 +02:00
Ben Noordhuis
7aa1261769 include: fix confusing uv_tcp_keepalive comment 2012-10-05 15:05:40 +02:00
Hiroaki Nakamura
976c8a4387 Add support for condition variables on all platforms 2012-10-05 13:03:55 +02:00
Bert Belder
744dc3e77c windows: make uv_rwlock_init initialize libuv
Without this patch, the fallback implementation would be used if
uv_rwlock_init were to be called before a loop was created or
uv_default_loop() was called.
2012-10-04 01:21:30 +02:00
Artur Adib
fed718c6cb unix: move queue stuff from fs.c to threadpool.c 2012-10-03 23:56:01 +02:00
Shigeki Ohtsu
01337af65d test, windows: fix duplicated windows.h
including windows.h before winsock2.h cause build error
2012-10-03 03:46:49 +02:00
Ben Noordhuis
d796c3b6f4 test: fix windows #include bug
Fixes a "'AF_IPX' : macro redefinition" warning when compiling test/runner.c.
2012-10-03 00:58:04 +02:00
Ben Noordhuis
b88f8b40d6 test: fix uninitialized memory warning, use calloc
Fixes the following valgrind warning:

  ==29019== Syscall param writev(vector[...]) points to uninitialised byte(s)
  ==29019==    at 0x584270B: writev (writev.c:51)
  ==29019==    by 0x449BB2: uv__write (stream.c:733)
  ==29019==    by 0x44AE91: uv_write2 (stream.c:1159)
  ==29019==    by 0x44AF25: uv_write (stream.c:1180)
  ==29019==    by 0x42CCAA: connect_cb (test-tcp-writealot.c:129)
  ==29019==    by 0x44AC05: uv__stream_connect (stream.c:1097)
  ==29019==    by 0x44AA25: uv__stream_io (stream.c:1050)
  ==29019==    by 0x437430: uv__io_rw (core.c:539)
  ==29019==    by 0x43C3D9: ev_invoke_pending (ev.c:2145)
  ==29019==    by 0x436EC5: uv__poll (core.c:260)
  ==29019==    by 0x436F0F: uv__run (core.c:269)
  ==29019==    by 0x436F6E: uv_run (core.c:277)
  ==29019==  Address 0x5f15040 is 0 bytes inside a block of size 94,371,840 alloc'd
  ==29019==    at 0x4C2C5EF: malloc (vg_replace_malloc.c:270)
  ==29019==    by 0x42CDED: run_test_tcp_writealot (test-tcp-writealot.c:148)
  ==29019==    by 0x406551: run_test_part (runner.c:302)
  ==29019==    by 0x405384: main (run-tests.c:57)
2012-10-03 00:23:38 +02:00
Ben Noordhuis
c666b6310d unix: fix uninitialized memory read in uv__read()
This commit fixes the following valgrind warning:

  ==26443== Conditional jump or move depends on uninitialised value(s)
  ==26443==    at 0x44AAFF: uv__read (stream.c:872)
  ==26443==    by 0x44ADD4: uv__stream_io (stream.c:1051)
  ==26443==    by 0x4377B8: uv__io_rw (core.c:539)
  ==26443==    by 0x43C761: ev_invoke_pending (ev.c:2145)
  ==26443==    by 0x43724D: uv__poll (core.c:260)
  ==26443==    by 0x437297: uv__run (core.c:269)
  ==26443==    by 0x4372F6: uv_run (core.c:277)
  ==26443==    by 0x42094B: run_test_pipe_ref4 (test-ref.c:334)
  ==26443==    by 0x406551: run_test_part (runner.c:302)
  ==26443==    by 0x405384: main (run-tests.c:57)
2012-10-03 00:03:01 +02:00
Ben Noordhuis
c6c691f323 test: join worker thread at exit in test-async.c 2012-10-02 23:54:19 +02:00
Ben Noordhuis
5135cfc45b test: fix memory leak in test-getsockname.c 2012-10-02 23:45:27 +02:00
Ben Noordhuis
f89986b153 test: fix memory leaks in test-fs-event.c 2012-10-02 23:19:53 +02:00
Ben Noordhuis
e474a2a420 test: fix memory leak in test-fs.c 2012-10-02 23:10:59 +02:00
Ben Noordhuis
b37a0f5bb3 unix: fix small race in fs.c
Don't return req->result after posting the work request. It's possible (if
unlikely) for a worker thread to process the request before the main thread
reaches the return statement.
2012-10-02 23:06:08 +02:00
Ben Noordhuis
3977d1b36c unix: emulate sendfile if necessary
Some platforms don't support sendfile() (netbsd, openbsd), others don't support
arbitrary file descriptors (freebsd, darwin) and yet others have quirks in their
implementation (sunos).

Work around the quirks. If all else fails, fall back to sendfile() emulation.
2012-10-02 22:50:42 +02:00
Ben Noordhuis
2d3760a17c unix: fix scandir filter prototype
The dirent argument is const on systems that conform to POSIX.2008 (Linux and
Solaris) but non-const on others.
2012-10-02 14:40:27 +02:00
Ben Noordhuis
8399cb1fc3 test: fix memory leaks in fs_symlink test 2012-10-01 23:54:34 +02:00
Ben Noordhuis
d36e2f21cf unix: fix buffer overrun in fs.c 2012-10-01 23:50:58 +02:00
Ben Noordhuis
6342658ad8 unix, windows: fix memory leak in fs-poll.c
The internal timer handle associated with the uv_fs_poll_t wasn't always closed
when the fs poll handle was closed, leaking about 650 bytes memory.
2012-10-01 23:43:32 +02:00
Ben Noordhuis
f793298c9e include: remove uv_fs_poll ABI compat padding 2012-10-01 23:43:32 +02:00
Bert Belder
447ee1060c doc: add link to test/ to the readme 2012-10-01 23:07:31 +02:00
Ben Noordhuis
7320633c4b unix: remove uv_fs_stat windows compat hack
uv_fs_stat and uv_fs_lstat removed the trailing backslash (if any) from the path
in order to please a test case that was written for Windows. Remove the
compatibility hack and fix the test.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
678e95a443 test: close handle in ref tests
Everything that gets reported by valgrind now is an actual memory leak.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
b60a24a206 unix: remove libeio 2012-10-01 22:53:59 +02:00
Ben Noordhuis
74999f8f99 unix: port fs and work api to new thread pool 2012-10-01 22:53:59 +02:00
Ben Noordhuis
36c91e3ba0 unix: port getaddrinfo to new thread pool 2012-10-01 22:53:59 +02:00
Ben Noordhuis
f35a4b628a unix: add custom thread pool 2012-10-01 22:53:59 +02:00
Ben Noordhuis
1020a1a82e include: make ngx_queue macros sanitary 2012-10-01 22:53:59 +02:00
Ben Noordhuis
5e09e1b57e linux: please valgrind, free memory at exit
Free the memory that is used to store the new argv and envp. It's not strictly
necessary (the OS is going to reclaim the memory anyway) but it makes the output
from valgrind a lot less noisy.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
45b5e79f8e test: fix memory leak in tcp_ping_pong 2012-10-01 22:53:59 +02:00
Ben Noordhuis
f090297f62 test: delete default loop after test run
Delete the default event loop after the test completes. Keeps valgrind happy.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
4e268f7718 test: add valgrind support
Run tests through valgrind when UV_USE_VALGRIND=1 is set in the environment.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
48f98424bd test: fix error message in runner 2012-10-01 22:53:59 +02:00
Ben Noordhuis
1923abda94 test: add uv_fs_readlink test 2012-10-01 22:53:59 +02:00
Bert Belder
e2cffdcf5f doc: add lxjs talk to readme 2012-10-01 19:49:30 +02:00
Ben Noordhuis
7ac23ee0c6 unix: move getaddrinfo code to getaddrinfo.c 2012-09-28 08:05:53 +02:00