Commit Graph

2320 Commits

Author SHA1 Message Date
Ben Noordhuis
ddd7e04fd6 build: switch to autotools
Switch to the build tool everyone loves to hate.  The Makefile has
served us well over the years but it's been acquiring more and more
features that autotools gives us for free, like easy static+shared
library building, sane install targets, and so on.

This commit drops MinGW support.  If there is demand for it, we'll
re-add it.
2013-07-02 01:21:16 +02:00
Navaneeth Kedaram Nambiathan
624be53e02 build: add install target to the makefile
Before this commit, there was no way to install libuv other than
manually copying required files to the path. This commit introduces
an install target which installs the libuv.a, libuv.so and header files
to the install prefix.

    ``
    make
    make install
    ``

The above will use the default prefix `/usr/local`

    ``
    make
    make install PREFIX=/usr
    ``

The above will install to `/usr`
2013-06-30 02:02:05 +02:00
Saúl Ibarra Corretgé
f9e6029b82 unix, windows: add extra fields to uv_stat_t 2013-06-28 00:42:37 +02:00
Ben Noordhuis
ce2458c053 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	test/test-fs.c
	test/test-list.h
2013-06-26 10:35:41 +02:00
isaacs
652d5c9e45 Now working on v0.11.6 2013-06-26 10:19:42 -07:00
isaacs
e3c63ff162 2013.06.27, Version 0.11.5 (Unstable)
Changes since version 0.11.4:

* build: remove CSTDFLAG, use only CFLAGS (Ben Noordhuis)

* unix: support for android builds (Linus Mårtensson)

* unix: avoid extra read, short-circuit on POLLHUP (Ben Noordhuis)

* uv: support android libuv standalone build (Linus Mårtensson)

* src: make queue.h c++ compatible (Ben Noordhuis)

* unix: s/ngx-queue.h/queue.h/ in checksparse.sh (Ben Noordhuis)

* unix: unconditionally stop handle on close (Ben Noordhuis)

* freebsd: don't enable dtrace if it's not available (Brian White)

* build: make HAVE_DTRACE=0 should disable dtrace (Timothy J. Fontaine)

* unix: remove overzealous assert (Ben Noordhuis)

* unix: remove unused function uv_fatal_error() (Ben Noordhuis)

* unix, windows: clean up uv_thread_create() (Ben Noordhuis)

* queue: fix pointer truncation on LLP64 platforms (Bert Belder)

* build: set OS=="android" for android builds (Linus Mårtensson)

* windows: don't use uppercase in include filename (Ben Noordhuis)

* stream: add an API to make streams do blocking writes (Henry Rawas)

* windows: use WSAGetLastError(), not errno (Ben Noordhuis)
2013-06-26 10:19:40 -07:00
Ben Noordhuis
88a2c7ff20 build: all now builds static and dynamic lib
The `make all` target now builds both libuv.a and libuv.{so,dylib}
rather than just libuv.a.
2013-06-26 10:32:18 +02:00
Ben Noordhuis
5841852703 test: add 'start timer from check handle' test
Check that a timer that is started from a check handle gets picked up
correctly, i.e. that it influences the timeout used in the next tick
of the event loop.
2013-06-26 13:56:32 +02:00
Ben Noordhuis
488b43ecc5 test: fix signed/unsigned compiler warning 2013-06-26 13:40:40 +02:00
Ben Noordhuis
a0bc4cca74 build: darwin: disable -fstrict-aliasing warnings
gcc 4.2.1 as shipped with Xcode complains incessantly about aliasing
warnings, which, while technically true, disregards the fact that the
aliased types have the same layout in memory. Squelch the warnings.
2013-06-26 13:13:53 +02:00
Ben Noordhuis
c8c775bd97 windows: use WSAGetLastError(), not errno
setsockopt() doesn't touch errno on failure. Use WSAGetLastError()
instead.

This is a back-port of commit 30a8b44 from the master branch.
2013-06-26 01:09:18 +02:00
Ben Noordhuis
30a8b44c4c windows: use WSAGetLastError(), not errno
setsockopt() doesn't touch errno on failure. Use WSAGetLastError()
instead.
2013-06-26 01:03:38 +02:00
Henry Rawas
92040eb712 stream: add an API to make streams do blocking writes
This patch adds the `uv_stream_set_blocking` API which makes all
uv_write calls to that stream blocking. It currently only works for
pipes, on windows.
2013-06-20 19:27:39 +02:00
Bert Belder
495d1a09fb windows: uv_spawn shouldn't reject reparse points
This fixes an issue where uv_spawn would not try to run a reparse point,
and continue to scan the PATH instead. Effectively, it was impossible to
spawn a symlinked binary. This commit fixes that.

Also see #748
2013-06-19 00:15:20 +02:00
Ben Noordhuis
6607e70253 test: open stdout fd in write-only mode
Fixes #771.
2013-06-18 23:53:03 +02:00
Ben Noordhuis
b1d390eb79 windows: don't use uppercase in include filename
Change <Winsock2.h> to <winsock2.h>. The former breaks
cross-compilation with mingw.
2013-06-14 00:45:03 +02:00
Linus Mårtensson
ff3ee84442 build: set OS=="android" for android builds
Work around the build name issues by instead manually adding the build
target for android builds using '-DOS=android'

This additionally resolves problems caused by the OS variable being
rewritten from "android" to "linux" in gyp. This causes errors, as
real-time support (-lrt) and pthread support (-lpthread) is not
available in the android NDK toolchain as libraries.

The functions present in these libraries are included automatically
during the build instead during the android compilation process.
2013-06-13 21:04:03 +02:00
Bert Belder
7d8504cf69 queue: fix pointer truncation on LLP64 platforms
QUEUE_DATA used to cast a pointer to long and back to pointer. This can
corrupt pointers on systems where the long type isn't large enough to
store pointer, like Windows x64. This commit fixes that.

Fixes #835
2013-06-15 14:08:36 +02:00
Ben Noordhuis
7e8d0e6d9c Merge remote-tracking branch 'origin/v0.10' 2013-06-13 09:05:12 +02:00
Andrei Sedoi
5096f1e096 linux: add support for MIPS 2013-06-13 09:04:15 +02:00
Ben Noordhuis
0c3b061aac Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	src/unix/stream.c
	src/version.c
2013-06-13 02:28:44 +02:00
Ben Noordhuis
72e440d7e1 Now working on v0.10.12 2013-06-12 21:52:05 +02:00
Ben Noordhuis
c3b75406a6 2013.06.13, Version 0.10.11 (Stable)
Changes since version 0.10.10:

* unix: unconditionally stop handle on close (Ben Noordhuis)

* freebsd: don't enable dtrace if it's not available (Brian White)

* build: make HAVE_DTRACE=0 should disable dtrace (Timothy J. Fontaine)

* unix: remove overzealous assert (Ben Noordhuis)

* unix: clear UV_STREAM_SHUTTING after shutdown() (Ben Noordhuis)

* unix: fix busy loop, write if POLLERR or POLLHUP (Ben Noordhuis)
2013-06-12 21:52:01 +02:00
Ben Noordhuis
12210fe578 unix: fix busy loop, write if POLLERR or POLLHUP
This fixes a busy loop by working around a quirk with Linux kernels
<= 2.6.32 where an EPIPE or ECONNRESET error on a file descriptor that
is polled for EPOLLOUT but not EPOLLIN gets reported by epoll_wait() as
just EPOLLERR|EPOLLHUP, like this:

  epoll_wait(5, {{EPOLLERR|EPOLLHUP, {u32=12, u64=12}}}, 1024, 433) = 1

Before this commit, libuv called uv__read() which attempts to read from
the file descriptor.  With newer kernels and on other operating systems
that fails like this:

  read(12, "", 65536)         = -1 EPIPE (Broken pipe)

Which tells libuv there is a connection error and it should notify the
user of that.  On the affected Linux kernels however, the read succeeds
with an EOF:

  read(12, "", 65536)         = 0

Which is subsequently passed on to the user. In most cases, the user
will close the handle and everything is fine.

Node.js however sometimes keeps the handle open in an attempt to flush
pending write requests.  While libuv doesn't officially support this,
unofficially it works...

...except on those older kernels.  Because the kernel keeps waking up
the event loop without setting POLLOUT and because the read calls EOF
but don't error, libuv's I/O state machine doesn't progress.

That's why this commit changes uv__stream_io() to also write pending
data.  While the read() system call doesn't error, the write() system
call will.

Fixes joyent/node#5504.
2013-06-08 04:09:42 +02:00
Ben Noordhuis
536c5f8661 unix: clear UV_STREAM_SHUTTING after shutdown()
Fix a state machine buglet where the UV_STREAM_SHUTTING flag didn't get
cleared.
2013-06-08 03:14:33 +02:00
Ben Noordhuis
3ab354367b unix: remove overzealous assert
Several node.js users are hitting this assert under what appear to be
mostly benign conditions. In other words, it's unclear whether it's
catching real bugs or just has wrong expectations.

An aborting process is rather disruptive so I'm removing the assert
from the stable branch and relanding it in the master branch.
2013-06-07 11:28:32 +02:00
Timothy J Fontaine
f84becc64e build: make HAVE_DTRACE=0 should disable dtrace 2013-06-06 20:32:52 +02:00
Ben Noordhuis
897463326b unix, windows: clean up uv_thread_create()
Make uv_thread_create() and its helper function a little more DRY and
a little less impenetrable.
2013-06-06 11:27:07 +02:00
Ben Noordhuis
43205ed553 unix: remove unused function uv_fatal_error() 2013-06-06 08:54:36 +02:00
Ben Noordhuis
c16ed503b0 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	src/unix/stream.c
	src/version.c
2013-06-07 11:41:41 +02:00
Brian White
c8ffee3460 freebsd: don't enable dtrace if it's not available 2013-06-05 22:50:08 +02:00
Ben Noordhuis
8e4b248ca6 unix: unconditionally stop handle on close
Make sure the handle is fully stopped by the time uv__stream_close()
calls uv_read_stop(). Fixes the following assertion:

    Assertion failed: (!uv__io_active(&stream->io_watcher, UV__POLLOUT)
    || !ngx_queue_empty(&stream->write_completed_queue)
    || !ngx_queue_empty(&stream->write_queue)
    || stream->shutdown_req != NULL
    || stream->connect_req != NULL), function uv_read_stop,
    file ../deps/uv/src/unix/stream.c, line 1329.

Fixes joyent/node#5622.
2013-06-05 15:17:01 +02:00
isaacs
e9ae62d13a Now working on v0.10.11 2013-06-04 12:00:31 -07:00
isaacs
0d95a88bd3 2013.06.05, Version 0.10.10 (Stable)
Changes since version 0.10.9:

* include: document uv_update_time() and uv_now() (Ben Noordhuis)

* linux: fix cpu model parsing on newer arm kernels (Ben Noordhuis)

* linux: fix memory leak in uv_cpu_info() error path (Ben Noordhuis)

* linux: don't ignore OOM errors in uv_cpu_info() (Ben Noordhuis)

* unix, windows: move uv_now() to uv-common.c (Ben Noordhuis)

* darwin: make uv_fs_sendfile() respect length param (Wynn Wilkes)
2013-06-04 12:00:29 -07:00
Ben Noordhuis
5b1422ba2b unix: s/ngx-queue.h/queue.h/ in checksparse.sh 2013-06-04 12:25:19 +02:00
Ben Noordhuis
c766dfe815 src: make queue.h c++ compatible
Squelch a warning about a cast from void* to another pointer type.
It's legal C but not legal C++. Makes queue.h usable in node.js.
2013-06-04 12:20:40 +02:00
Ben Noordhuis
eb1f60c022 build: fix build breakage from 3fdd2a1
Make sure the android_build variable is defined.
2013-05-31 17:18:22 +02:00
Linus Mårtensson
3fdd2a1128 uv: support android libuv standalone build
Tested most of my compilation in the previous patch on NodeJS
and extracted the patches from there. This patch ensures libuv
will be capable of building standalone as well, both with gyp
and Makefiles.

Build documentation was added to the README.md file.

Some tests are failing, and I have not heavily investigated
the reasons. The failures are generally on errors, and are
likely related to differences between fully POSIX-compatible
systems and android.
2013-05-31 13:25:17 +02:00
Ben Noordhuis
ede83188f3 test: don't use S_IREAD and S_IWRITE
They're BSD-isms and obsolete ones at that. Replace with S_IRUSR and
S_IWUSR. Alias as _S_IREAD and _S_IWRITE on Windows because the '90s
never ended in Redmond, WA.
2013-05-31 12:50:19 +02:00
Bert Belder
b9eb402fb0 include: remove lame comment from uv.h 2013-05-30 22:54:44 +02:00
Ben Noordhuis
442d11d618 unix: avoid extra read, short-circuit on POLLHUP
Avoid going through an extra alloc_cb -> read() -> read_cb cycle when
the POLLHUP flag is set because we know the next read() will hit EOF.

Fixes #803.
2013-05-30 22:34:03 +02:00
Wynn Wilkes
b4c658c3c0 darwin: make uv_fs_sendfile() respect length param
The darwin sendfile implementation uses the &len parameter as input
and output. The code was sending 0 (not using the value of req->len)
so the behavior wasn't what the caller was expecting.

This makes sure to initialize len with req->len to ensure that the
caller can send portions of a file (not always everything to the
end of the file).
2013-05-29 22:25:43 +02:00
Bert Belder
081f7018ec test: use c-style comments
Fixes a compilation problem on OS X caused by the use of c++-style
comments in test-osx-select.c.
2013-05-29 18:32:25 +03:00
Ben Noordhuis
e0bdb3dbc9 unix, windows: move uv_now() to uv-common.c 2013-05-29 16:13:34 +02:00
Ben Noordhuis
b93cf8b594 linux: don't ignore OOM errors in uv_cpu_info() 2013-05-29 01:43:05 +02:00
Ben Noordhuis
31282a97e7 linux: fix memory leak in uv_cpu_info() error path
Any memory allocated to hold CPU model strings wasn't freed on error.
2013-05-29 01:43:05 +02:00
Ben Noordhuis
92c72f58bf linux: fix cpu model parsing on newer arm kernels
The format of /proc/cpuinfo on ARM kernels >= 3.8 has changed. Scan for
the string "model name" (like x86) first, "Processor" second.

Fixes #812.
2013-05-29 01:40:09 +02:00
Ben Noordhuis
dfff2e9e23 include: document uv_update_time() and uv_now() 2013-05-28 23:49:09 +02:00
isaacs
21c12b824a Now working on v0.10.10 2013-05-28 12:08:49 -07:00
isaacs
a195f9ace2 2013.05.29, Version 0.10.9 (Stable)
Changes since version 0.10.8:

* unix: fix stream refcounting buglet (Ben Noordhuis)

* unix: remove erroneous asserts (Ben Noordhuis)

* unix: add uv__is_closing() macro (Ben Noordhuis)

* unix: stop stream POLLOUT watcher on write error (Ben Noordhuis)
2013-05-28 12:08:46 -07:00