Commit Graph

15 Commits

Author SHA1 Message Date
Brian White
e3a657c662 unix, windows: add MAC to uv_interface_addresses()
Make uv_interface_addresses() return the MAC address as a 48 bits
binary value in the phys_addr field of the uv_interface_address_t
struct.
2013-07-25 13:49:39 +02:00
Ben Noordhuis
3ee4d3f183 unix, windows: return error codes directly
This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like this one:

    if (uv_foo(loop) < 0) {
      uv_err_t err = uv_last_error(loop);
      fprintf(stderr, "%s\n", uv_strerror(err));
    }

Should be rewritten like this:

    int err = uv_foo(loop);
    if (err < 0)
      fprintf(stderr, "%s\n", uv_strerror(err));

The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.
2013-07-07 09:51:00 +02:00
Ben Noordhuis
339033afc0 unix: use uv__hrtime() internally
This commit renames the various uv_hrtime() implementations to uv__hrtime().

Libuv uses the high-res timer internally in performance-critical code paths.
Calling the non-public version avoids going through the PLT when libuv is
compiled as a shared object.

The exported uv_hrtime() now has a single definition in src/unix/core.c that
calls uv__hrtime().

A future optimization is to lift the uv__hrtime() declarations into header
files so they can be inlined at the call sites. Then again, linking with -flto
should accomplish the same thing.
2013-01-06 17:35:34 +01:00
Ben Noordhuis
1282d64868 unix: remove dependency on libev 2012-11-16 17:33:25 +01:00
Bert Belder
201b8f935f Merge branch 'v0.8' 2012-08-18 03:57:41 +02:00
Tim Holy
ce87b7e14c unix: fix integer overflow in uv_hrtime
Conversion to nanoseconds was overflowing with 32-bit builds.
2012-08-18 03:55:13 +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
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
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
Ben Noordhuis
59cda86709 unix, test: make NANOSEC a 64 bits unsigned int
Avoids accidental overflow / truncation when it's used in 32 bits arithmetic.
2012-06-07 17:00:01 +02:00
Aaron Bieber
40e6373263 unix: fix compiler warning
Fix warning "for loop initial declaration used outside C99 mode" on openbsd.
2012-03-27 17:34:18 +02:00
Frank Denis
e19724912d Fix libuv on OpenBSD. struct kproc2 doesn't exist any more. 2012-02-14 14:49:31 +01:00
Igor Zinkovsky
3d189de699 platform api 2011-12-14 17:50:36 -08:00
Ben Noordhuis
d396799210 Change return type of uv_get_*_memory() functions
... from double to uint64_t. Limit use of floating point in public API as much
as possible.
2011-10-21 10:09:59 -07:00
Frank DENIS
4ab1990064 unix: add support for OpenBSD 2011-10-14 01:59:45 +02:00