Commit Graph

1735 Commits

Author SHA1 Message Date
Ben Noordhuis
3b69c0f56d unix: split up uv-unix.h 2012-08-17 16:42:31 +02:00
Ben Noordhuis
ddd52773dd build: handle bad gcc -dumpversion output
`gcc -dumpversion` usually prints major.minor - but on sunos it prints
major.minor.patch.
2012-08-17 16:32:12 +02:00
Ben Noordhuis
a7f7696a8d unix: remove UV_REQ_BUFSML_SIZE 2012-08-17 15:19:40 +02:00
Ben Noordhuis
894b0fc0a7 unix: move platform init out of loop.c
Move platform-specific initialization logic out of loop.c and into the
platform files (freebsd.c, sunos.c, etc).
2012-08-17 14:48:52 +02:00
Bert Belder
1b929bfff5 windows: readable tty handles need access to console output
Readable tty handles need to be able to update the virtual window,
so if uv_tty_t is initialized with a console input fd, additionally
open the console output.
2012-08-17 00:10:18 +02:00
Bert Belder
88634c1405 windows: separate uv_tty_t read state from write state 2012-08-17 00:10:15 +02:00
Bert Belder
7cf1b67594 windows: small style fix in uv-win.h 2012-08-16 23:11:26 +02:00
Bert Belder
938a30589c windows: tweak formatting inside uv-win.h 2012-08-15 03:13:58 +02:00
Ben Noordhuis
7cd400ef10 unix: report exit_status==-1 when execve() fails
Call exit_cb with exit_status==-1 when spawning a new process with uv_spawn()
fails.
2012-08-14 18:22:30 +02:00
Ben Noordhuis
54bfb66806 linux: improve /proc/cpuinfo parser
Make uv_cpu_info() understand the ARM and MIPS versions of /proc/cpuinfo,
it only knew how to deal with the x86 version

This commit also fixes a buglet where uv_cpu_info() reported the maximum CPU
frequency instead of the actual CPU frequency. That is, before this commit
`out/Debug/run-tests platform_output | grep speed | sort | uniq -c` on my
system always reported:

      8   speed: 3400

Now it reports (for example):

      2   speed: 3400
      6   speed: 1600

In other words, two CPUs are running at full speed while the others have been
scaled back because they're mostly idle.

Fixes #526.
2012-08-14 18:06:51 +02:00
Ben Noordhuis
f4f294f7c6 linux: remove bogus comment in linux-core.c 2012-08-14 12:45:18 +02:00
Bert Belder
7fb43d3c5b windows: move uv_atomic_exchange_set to atomicops-inl.h 2012-08-14 01:04:43 +02:00
Bert Belder
4442ddcaae windows: fix formatting issue in uv-win.h 2012-08-14 00:19:19 +02:00
Bert Belder
7c3ba514e7 windows: use WCHAR consistently 2012-08-13 22:31:48 +02:00
Bert Belder
aa69f34d53 windows: report spawn errors to the exit callback
Formerly spawn errors would be reported as a message printed to the
process' stderr, to match unix behaviour. Unix has now been fixed to
be more sensible, so this hack can now be removed.

This also fixes a race condition that could occur when the user closes
a process handle before the exit callback has been made.
2012-08-13 22:31:47 +02:00
Bert Belder
80eae82104 test: spawn failures are reported by setting the exit code to -1 2012-08-13 22:31:47 +02:00
Bert Belder
3f1f11f338 windows: use UV_ECANCELED to signal canceled requests
This used to be UV_EINTR, but that's not an appropriate error code in
this situation.
2012-08-13 22:31:46 +02:00
Bert Belder
1b8307637b test: fix intermittent failure of tcp_unexpected_read on windows 2012-08-13 22:31:46 +02:00
Bert Belder
c85672eb13 test: avoid compiler complaints about implicit double-to-int cast 2012-08-13 22:31:45 +02:00
Bert Belder
762c85c3ef windows: un-break the build 2012-08-13 22:31:45 +02:00
Ben Noordhuis
758a76922b unix: fix SIGCHLD race in process.c
Start the SIGCHLD signal watcher before calling fork(). There was a very subtle
race where a child process could quit (and generate a SIGCHILD) before the
signal handler was installed.

To reproduce, call uv_spawn() repeatedly with the below x86_64 program:

    // compile with `gcc -O2 -nostdlib`
    void _start(void)
    {
      // syscall(SYS_exit, 0)
      __asm__ __volatile__ (
        "xorq %rdi, %rdi;"
        "xorq %rax, %rax;"
        "mov $0x3c, %al;"
        "syscall;"
      );
      for (;;);
    }
2012-08-13 16:51:53 +02:00
Ben Noordhuis
9d7e300364 Merge branch 'v0.8' 2012-08-13 15:51:12 +02:00
Ben Noordhuis
2c3e8b6aa6 build: rework -fvisibility=hidden detection
Make the gcc_version macro conform with what node.js and v8 use. Important
because node.js's common.gypi is going to export it soon.
2012-08-13 15:29:21 +02:00
Ben Noordhuis
ac0d46851a unix: work around darwin bug, don't poll() on pipe
poll() on newer versions of OS X sets POLLHUP|POLLIN whereas older versions
(and other Unices) only set POLLHUP. It was tripping up a check that expected
to read data when POLLIN was set.

While easy to work around, I switched it to a blocking read instead:
it's less code and avoids surprises like the one above altogether.

Fixes #522.
2012-08-12 00:59:18 +02:00
Fedor Indutny
23dc564f3b darwin: emulate fdatasync() with fcntl(F_FULLFSYNC)
OS X has no public API for fdatasync. And as pointed out in `man fsync(2)`:

  For applications that require tighter guarantees about the integrity of
  their data, Mac OS X provides the F_FULLFSYNC fcntl. The F_FULLFSYNC
  fcntl asks the drive to flush all buffered data to permanent storage.
  Applications, such as databases, that require a strict ordering of writes
  should use F_FULLFSYNC to ensure that their data is written in the order
  they expect.  Please see fcntl(2) for more detail.
2012-08-11 23:43:51 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
caa79af2ad unix: rework uv_eio_init() init once logic
Don't use counters.eio_init to track if libeio has been initialized, it's going
to be removed in a follow-up commit.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
75ba681913 unix: remove dependency on ev_child 2012-08-10 02:00:11 +02:00
Ben Noordhuis
ee50db6e36 unix, windows: preliminary signal handler support
* a no-op on Windows for now
* only supports the main loop on UNIX (again, for now)
2012-08-10 02:00:07 +02:00
Trond Norbye
5143d54ad3 Allow inclusion of <uv.h> with Sun Studio compiler
The Sun Studio compiler did not define any of the symbols used to determine if
the system was a unix-like system or not causing it to include the windows
header.
2012-08-09 01:09:14 +02:00
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
Bert Belder
a1157cef37 windows: don't duplicate invalid stdio handles
Ref: joyent/node#3779
2012-08-08 02:24:48 +02:00
Ben Noordhuis
21f2c1629a include: fix macro formatting 2012-08-08 02:18:59 +02:00
Bert Belder
00d2f22151 windows: fix typos in process-stdio.c 2012-08-08 02:18:53 +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