History log of /libuv/src/unix/core.c (Results 26 – 50 of 299)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 0b1c752b 17-Jun-2022 Wayne Zhang

zos: implement uv_available_parallelism() (#3650)

Implement uv_available_parallelism() for z/OS by reporting the number of
online cpu using __get_num_online_cpus() from ZOSLIB.


# 77c8e993 11-Jun-2022 Wayne Zhang

zos: avoid fs event callbacks after uv_close() (#3620)

On z/OS, fs events are implemented by registering file interest. When
closing a fs event handle, it's possible that a change notifi

zos: avoid fs event callbacks after uv_close() (#3620)

On z/OS, fs events are implemented by registering file interest. When
closing a fs event handle, it's possible that a change notification has
already been generated. In that case, the attempt to unregister file
interest will fail with EALREADY. This will result in the fs event being
delivered even though the handle is closing, which should not happen.

Fixes: https://github.com/libuv/libuv/issues/3601

show more ...


# ee3718dd 13-May-2022 Jameson Nash

loop: better align order-of-events behavior between platforms (#3598)

Previously, Windows would always defer event processing to the loop
after they were received. This could cause confu

loop: better align order-of-events behavior between platforms (#3598)

Previously, Windows would always defer event processing to the loop
after they were received. This could cause confusion for users who were
using prepare and idle callbacks, as seen from this bug in nodejs[^1] and
this discussion in libuv[^2], and even some discrepancies in the libuv
tests too[^3].

[^1]: https://github.com/nodejs/node/pull/42340
[^2]: https://github.com/libuv/libuv/discussions/3550
[^3]: See change to test-spawn.c in this PR

So rather than declare those usages to be wrong, we change libuv to meet
those users expectations.

Replaces: https://github.com/libuv/libuv/pull/3585

show more ...


# 03a698b9 27-Apr-2022 Ben Noordhuis

unix: use MSG_CMSG_CLOEXEC where supported (#3609)

Use MSG_CMSG_CLOEXEC on Unix-y platforms that support it (all except
macOS and SunOS spawn.)

Remove the feature test for Linux

unix: use MSG_CMSG_CLOEXEC where supported (#3609)

Use MSG_CMSG_CLOEXEC on Unix-y platforms that support it (all except
macOS and SunOS spawn.)

Remove the feature test for Linux. Libuv's kernel baseline is 2.6.32
and MSG_CMSG_CLOEXEC was added in 2.6.23.

show more ...


# 612c28b8 11-Apr-2022 Andy Fiddaman

sunos: fs-event callback can be called after uv_close() (#3542)

On illumos and Solaris, fs events are implemented with
PORT_SOURCE_FILE type event ports. These are one-shot so
need r

sunos: fs-event callback can be called after uv_close() (#3542)

On illumos and Solaris, fs events are implemented with
PORT_SOURCE_FILE type event ports. These are one-shot so
need re-arming each time they fire. Once they are armed
and an event occurs, the kernel removes them from the current
cache list and puts them on an event queue to be read by
the application.

There's a window in closing one of these ports when it could
have triggered and be pending delivery. In that case, the
attempt to disarm (dissociate) the event will fail with ENOENT
but libuv still goes ahead and closes down the handle. In
particular, the close callback (uv_close() argument) will be
called but then the event will subsequently be delivered if
the loop is still active; this should not happen.

show more ...


# 1fe609ea 06-Apr-2022 Ben Noordhuis

unix,win: fix UV_RUN_ONCE + uv_idle_stop loop hang (#3590)

Wrong accounting of idle handles in uv_run() made it sleep when there
was nothing left to do. Do a non-blocking poll for I/O in

unix,win: fix UV_RUN_ONCE + uv_idle_stop loop hang (#3590)

Wrong accounting of idle handles in uv_run() made it sleep when there
was nothing left to do. Do a non-blocking poll for I/O instead.

show more ...


# 2a31fe85 22-Mar-2022 Guilherme Íscaro

core: add thread-safe strtok implementation (#3553)

This commit adds the support for a custom strtok implementation, which
is reentrant. On some systems strtok_r or strstep is available

core: add thread-safe strtok implementation (#3553)

This commit adds the support for a custom strtok implementation, which
is reentrant. On some systems strtok_r or strstep is available for that
purpose; however, since these are an extension, it is difficult to
control if it will be available on every supported system.

show more ...


# 93309c6d 21-Mar-2022 Jameson Nash

unix: simplify getpwuid call (#3535)

As suggested in https://github.com/libuv/libuv/pull/3523#discussion_r821550169


# 20a2b1c3 06-Mar-2022 Jameson Nash

unix: remove uv__cloexec_ioctl() (#3515)

Now that uv__cloexec_fcntl() is simplified
(https://github.com/libuv/libuv/pull/3492), there is no benefit to
maintaining duplicate code path

unix: remove uv__cloexec_ioctl() (#3515)

Now that uv__cloexec_fcntl() is simplified
(https://github.com/libuv/libuv/pull/3492), there is no benefit to
maintaining duplicate code paths for the same thing.

show more ...


# c8583bbd 05-Mar-2022 Ben Noordhuis

unix: simplify uv__cloexec_fcntl() (#3492)

FD_CLOEXEC is the only defined flag for fcntl(F_SETFD) so don't bother
getting the status of that flag first with fcntl(F_GETFD), just set it.


# fd34b17f 05-Mar-2022 Ben Noordhuis

zos: fix build breakage (#3513)

Introduced earlier today in commit f250c6c7. _SC_NPROCESSORS_ONLN does
not seem to be defined on that platform.


# f250c6c7 04-Mar-2022 Ben Noordhuis

unix,win: add uv_available_parallelism() (#3499)

Replacement for the usage pattern where people use uv_cpu_info() as an
imperfect heuristic for determining the amount of parallelism that

unix,win: add uv_available_parallelism() (#3499)

Replacement for the usage pattern where people use uv_cpu_info() as an
imperfect heuristic for determining the amount of parallelism that is
available to their programs.

Fixes #3493.

show more ...


# 7ae0c954 23-Feb-2022 Vittore F. Scolari

hurd: unbreak build on GNU/Hurd (#3450)

The GNU/Hurd platform does not define IP_ADD_SOURCE_MEMBERSHIP,
IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_SOURCE_GROUP and
MCAST_LEAVE_SOURCE_GROU

hurd: unbreak build on GNU/Hurd (#3450)

The GNU/Hurd platform does not define IP_ADD_SOURCE_MEMBERSHIP,
IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_SOURCE_GROUP and
MCAST_LEAVE_SOURCE_GROUP.

Implement a few functions for the GNU/Hurd. Specifically:

* uv_resident_set_memory (from Linux)
* uv_get_free_memory (from Linux)
* uv_get_total_memory (from Linux)
* uv_cpu_info (from cygwin)
* uv__process_title_cleanup (void)
* uv_get_constrained_memory (stub)
* Leave proctitle unimplemented on Hurd for now
* Implement hurdish uv_exepath
* Enable ifaddrs api
* Unbreak udp basics
* Unbreak futime and lutime on Hurd

show more ...


# cc7dbaa3 14-Feb-2022 Jameson Nash

fix oopsie from #3466 (#3475)

I created `uv__backend_timeout` to be used internally for this reason,
then forgot to use it, resulting in flaky tests and excessive trips
around the uv

fix oopsie from #3466 (#3475)

I created `uv__backend_timeout` to be used internally for this reason,
then forgot to use it, resulting in flaky tests and excessive trips
around the uv_run loop.

Fix #3472

show more ...


# 939a0563 13-Feb-2022 Jameson Nash

loop: add pending work to loop-alive check (#3466)

Pending work may be either (on any platform) pending_queue callbacks or
(on unix) watcher_queue handles to add to the io poll object.

loop: add pending work to loop-alive check (#3466)

Pending work may be either (on any platform) pending_queue callbacks or
(on unix) watcher_queue handles to add to the io poll object.
Previously, we might have gotten somewhat stuck if the user caused an
event to be added to one of these in the idle or prepare callbacks, or
was embedding libuv.

Refs: https://github.com/libuv/libuv/pull/3234
Refs: https://github.com/libuv/libuv/issues/3101
Refs: https://github.com/libuv/libuv/pull/3308

show more ...


# 2fbfa035 13-Jan-2022 Jessica Clarke

unix: fix STATIC_ASSERT to check what it means to check (#3417)

Currently it's checking pointers to the uv_buf_t fields match the size
of the iovec fields. This is true on traditional ar

unix: fix STATIC_ASSERT to check what it means to check (#3417)

Currently it's checking pointers to the uv_buf_t fields match the size
of the iovec fields. This is true on traditional architectures where
pointers are just machine word-sized integers, but not on CHERI, and
thus Arm's Morello prototype, where pointers contain additional metadata
(including bounds and permissions). Drop the & to fix this.

show more ...


# 6b0051d1 08-Jun-2021 Ali Mohammad Pur

core: Correct the conditionals for {cloexec,nonblock}_ioctl

These functions are declared with one set of conditionals in the
header, and defined with another set of conditionals in the c

core: Correct the conditionals for {cloexec,nonblock}_ioctl

These functions are declared with one set of conditionals in the
header, and defined with another set of conditionals in the c file.
This commit makes all decisions regarding `uv__{nonblock,cloexec}_ioctl`
depend on a boolean macro instead.
There's one function that expects `uv__nonblock_ioctl` to be defined,
so that bit of the function is also conditionally compiled.

PR-URL: https://github.com/libuv/libuv/pull/3163
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

show more ...


# a064166b 21-May-2021 Darshan Sen

unix,core: fix errno handling in uv__getpwuid_r

Fixes: https://github.com/libuv/libuv/issues/3174
PR-URL: https://github.com/libuv/libuv/pull/3177
Reviewed-By: Jameson Nash <vtjnash@

unix,core: fix errno handling in uv__getpwuid_r

Fixes: https://github.com/libuv/libuv/issues/3174
PR-URL: https://github.com/libuv/libuv/pull/3177
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...

# c3fe3cf1 19-Feb-2021 Ondřej Surý

Make Thread Sanitizer aware of file descriptor close in uv__close()

Thread Sanitizer can't intercept syscall(SYS_close, fd) that's used
instead of close(fd); on Linux. That leads to fal

Make Thread Sanitizer aware of file descriptor close in uv__close()

Thread Sanitizer can't intercept syscall(SYS_close, fd) that's used
instead of close(fd); on Linux. That leads to false positives as Thread
Sanitizer thinks the descriptor is still being used by the thread.

clang defines pre- and post- syscall actions, so wrap the close
syscall() into the action macros. For gcc, use close() from glibc
instead of the syscall. This allows the thread sanitizer to intercept
closing of the file descriptor when libuv is compiled with Thread
Sanitizer.

PR-URL: https://github.com/libuv/libuv/pull/3112
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

show more ...

Revision tags: v1.41.0
# c9406ba0 28-Dec-2020 Bob Weinand

poll,unix: ensure safety of rapid fd reuse

Consider the following scenario:

uv_poll_init(loop, poll, fd);
uv_poll_start(poll, UV_READABLE, cb);
// the cb gets invoked etc.

poll,unix: ensure safety of rapid fd reuse

Consider the following scenario:

uv_poll_init(loop, poll, fd);
uv_poll_start(poll, UV_READABLE, cb);
// the cb gets invoked etc.
uv_poll_stop(poll);

close(fd);
fd = allocate_new_socket(); // allocate_new_socket() is assigned the same fd by "bad luck" from the OS

// some time later:
uv_poll_init(loop, otherpoll, fd);
uv_poll_start(otherpoll, UV_READABLE, cb);

uv_close(poll); // uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.

According to documentation, "however the fd can be safely closed
immediately after a call to uv_poll_stop() or uv_close()."
Though, in this scenario, we close()'d our file descriptor, and by
bad luck we got the same file descriptor again and register a new
handle for it and start polling.

Previously that would lead to an assertion failure, if we were to
properly free the original handle via uv_close().

This commit fixes that by moving the check whether a only a single
poll handle is active to uv_poll_start() instead of the stopping
routines.

Fixes: https://github.com/libuv/libuv/issues/1172
Fixes: https://github.com/bwoebi/php-uv/issues/81
Fixes: https://github.com/b2wdigital/aiologger/issues/82
Fixes: https://github.com/invenia/LibPQ.jl/issues/140
PR-URL: https://github.com/libuv/libuv/pull/2686
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...

Revision tags: v1.40.0, v1.39.0, v1.38.1, v1.38.0, v1.37.0, v1.36.0, v1.35.0
# ea92e9c7 07-Feb-2020 Richard Lau

aix: protect uv_exepath() from uv_set_process_title()

Store a copy of the original argv[0] to protect `uv_exepath()`
against `uv_set_process_title()` changing the value of argv[0].

aix: protect uv_exepath() from uv_set_process_title()

Store a copy of the original argv[0] to protect `uv_exepath()`
against `uv_set_process_title()` changing the value of argv[0].

Extract common code for finding a program on the current PATH.

Fixes: https://github.com/libuv/libuv/issues/2674
PR-URL: https://github.com/libuv/libuv/pull/2677
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...

# e8effd45 26-Mar-2020 Trevor Norris

core: add API to measure event loop idle time

The API addition `uv_metrics_idle_time()` is a thread safe call that
allows the user to retrieve the amount of time the event loop has spent

core: add API to measure event loop idle time

The API addition `uv_metrics_idle_time()` is a thread safe call that
allows the user to retrieve the amount of time the event loop has spent
in the kernel's event provider (i.e. poll). It was done this way to
allow retrieving this value without needing to interrupt the execution
of the event loop. This option can be enabled by passing
`UV_METRICS_IDLE_TIME` to `uv_loop_configure()`.

One important aspect of this change is, when enabled, to always first
call the event provider with a `timeout == 0`. This allows libuv to know
whether any events were waiting in the event queue when the event
provider was called. The importance of this is because libuv is tracking
the amount of "idle time", not "poll time". Thus the provider entry time
is not recorded when `timeout == 0` (the event provider never idles in
this case).

While this does add a small amount of overhead, when enabled, but the
overhead decreases when the event loop has a heavier load. This is
because poll events will be waiting when the event provider is called.
Thus never actually recording the provider entry time.

Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always
happens in `uv__metrics_set_provider_entry_time()` and
`uv__metrics_update_idle_time()`. Making the conditional logic wrapping
each call simpler and allows for instrumentation to always hook into
those two function calls.

Rather than placing the fields directly on `uv__loop_internal_fields_t`
add the struct `uv__loop_metrics_t` as a location for future metrics API
additions.

Tests and additional documentation has been included.

PR-URL: https://github.com/libuv/libuv/pull/2725
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...

# c70dd705 16-Jun-2020 Ben Noordhuis

unix: use relaxed loads/stores for feature checks

Make ThreadSanitizer stop complaining about the static variables that
libuv uses to record the presence (or lack) of system calls and ot

unix: use relaxed loads/stores for feature checks

Make ThreadSanitizer stop complaining about the static variables that
libuv uses to record the presence (or lack) of system calls and other
kernel features.

Fixes: https://github.com/libuv/libuv/issues/2884
PR-URL: https://github.com/libuv/libuv/pull/2886
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>

show more ...

# e50b631d 12-Jun-2020 gengjiawen

android: remove patch code for below 21

PR-URL: https://github.com/libuv/libuv/pull/2880
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

# 815b0766 07-Apr-2020 Brad King

unix: fix compilation on macOS 32-bit architectures

In commit 2475296c (build: make code compilable for iOS on Xcode,
2020-01-18, v1.35.0~47) we added a `defined(TARGET_OS_IPHONE)`
p

unix: fix compilation on macOS 32-bit architectures

In commit 2475296c (build: make code compilable for iOS on Xcode,
2020-01-18, v1.35.0~47) we added a `defined(TARGET_OS_IPHONE)`
preprocessor condition, but `TARGET_OS_IPHONE` is always defined on
Apple to either 0 or 1. On 32-bit macOS architectures this
leads to an undefined symbol reference to `_close$NOCANCEL`.
Fix the preprocessor condition to use just `TARGET_OS_IPHONE`.

Refs: https://github.com/libuv/libuv/pull/2639
PR-URL: https://github.com/libuv/libuv/pull/2776
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

show more ...

12345678910>>...12