History log of /libuv/src/unix/core.c (Results 1 – 25 of 291)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 6b56200c 28-Feb-2024 Thomas Walter <31201229+waltoss@users.noreply.github.com>

linux: fix uv_available_parallelism using cgroup (#4278)

uv_available_parallelism does not handle container cpu limit
set by systems like Docker or Kubernetes. This patch fixes
this

linux: fix uv_available_parallelism using cgroup (#4278)

uv_available_parallelism does not handle container cpu limit
set by systems like Docker or Kubernetes. This patch fixes
this limitation by comparing the amount of available cpus
returned by syscall with the quota of cpus available defined
in the cgroup.

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

show more ...


# e135dfe1 14-Nov-2023 Hao Hu <33607772+hhu8@users.noreply.github.com>

unix,win: utility for setting priority for thread (#4075)

Add uv_thread_setpriority for setting priority for threads created by
uv_thread_create. Add uv_thread_getpriority for getting th

unix,win: utility for setting priority for thread (#4075)

Add uv_thread_setpriority for setting priority for threads created by
uv_thread_create. Add uv_thread_getpriority for getting thread priority.

For Linux by default, if the scheduling policy is SCHED_OTHER and the
priority is 0, we need to set the nice value.

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

show more ...


# 7b43d70b 26-Jun-2023 小明 <7737673+caobug@users.noreply.github.com>

unix: fix build for lower versions of Android (#4046)

Available since Android N (API level 24): getgrgid_r, preadv, pwritev

Refs: https://cs.android.com/android/platform/superprojec

unix: fix build for lower versions of Android (#4046)

Available since Android N (API level 24): getgrgid_r, preadv, pwritev

Refs: https://cs.android.com/android/platform/superproject/+/master:bionic/docs/status.md

show more ...


# 24d1d080 14-Jun-2023 Trevor Norris

src: don't run timers if loop is stopped/unref'd (#4048)

The initial run of timers shouldn't happen if uv_stop() has been run
before uv_run() was called, and for backwards compatibility

src: don't run timers if loop is stopped/unref'd (#4048)

The initial run of timers shouldn't happen if uv_stop() has been run
before uv_run() was called, and for backwards compatibility they also
shouldn't run if they have been unref'd before calling uv_run().

show more ...


# 65c1402e 25-May-2023 Ben Noordhuis

ios: fix uv_getrusage() ru_maxrss calculation (#4027)

Apple's documentation claims ru_maxrss is reported in kilobytes but the
XNU source code suggests the actual unit is bytes, like macO

ios: fix uv_getrusage() ru_maxrss calculation (#4027)

Apple's documentation claims ru_maxrss is reported in kilobytes but the
XNU source code suggests the actual unit is bytes, like macOS.

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

show more ...


# 1b01b786 24-May-2023 Ben Noordhuis

unix,win: replace QUEUE with struct uv__queue (#4022)

Recent versions of gcc have started emitting warnings about the liberal
type casting inside the QUEUE macros. Although the warnings

unix,win: replace QUEUE with struct uv__queue (#4022)

Recent versions of gcc have started emitting warnings about the liberal
type casting inside the QUEUE macros. Although the warnings are false
positives, let's use them as the impetus to switch to a type-safer and
arguably cleaner approach.

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

show more ...


# c8a1e613 27-Apr-2023 Ben Noordhuis

unix,win: add uv_clock_gettime() (#3971)

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


# 2f33980a 12-Apr-2023 Trevor Norris

src: switch to use C11 atomics where available (#3950)

Switch all code in unix/ to use C11 atomics directly.

Change uv_library_shutdown() to use an exchange instead of load/store.

src: switch to use C11 atomics where available (#3950)

Switch all code in unix/ to use C11 atomics directly.

Change uv_library_shutdown() to use an exchange instead of load/store.

Unfortunately MSVC only started supporting C11 atomics in VS2022 version
17.5 Preview 2 as experimental. So resort to using the Interlocked API.

Ref: https://devblogs.microsoft.com/cppblog/c11-atomics-in-visual-studio-2022-version-17-5-preview-2/
Fixes: https://github.com/libuv/libuv/issues/3948

show more ...


# 66009549 20-Mar-2023 Trevor Norris

win,unix: change execution order of timers (#3927)

The maximum number of times timers should run when uv_run() is called
with UV_RUN_ONCE and UV_RUN_NOWAIT is 1. Do that by conditionally

win,unix: change execution order of timers (#3927)

The maximum number of times timers should run when uv_run() is called
with UV_RUN_ONCE and UV_RUN_NOWAIT is 1. Do that by conditionally
calling timers before entering the while loop when called with
UV_RUN_DEFAULT.

The reason to always run timers at the end of the while loop, instead of
at the beginning, is to help enforce the conceptual event loop model.
Which starts when entering the event provider (e.g. calling poll).

Other than only allowing timers to be processed once per uv_run()
execution, the only other noticeable change this will show is if all the
following are true:
* uv_run() is called with UV_RUN_NOWAIT or UV_RUN_ONCE.
* An event is waiting to be received when poll is called.
* Execution time between the call to uv_timer_start() and entering the
while loop is longer than the timeout.

If all these are true, then timers that would have executed before
entering the event provider will now be executed afterward.

Fixes: https://github.com/libuv/libuv/issues/3686
Co-authored-by: Momtchil Momtchev <momtchil@momtchev.com>

show more ...


# 42cc412c 01-Feb-2023 Jameson Nash

darwin,process: feed kevent the signal to reap children (#3893)

Since we are emulating this event, but are not using the pending_queue,
we need to make sure it is accounted for properly.

darwin,process: feed kevent the signal to reap children (#3893)

Since we are emulating this event, but are not using the pending_queue,
we need to make sure it is accounted for properly. Also DRY some of the
reset_timeout code here.

This was observed to cause a hang in certain rare cases, particularly on
M1 machines.

Do a bit of code cleanup too, since we do not need to initialize the
internal signal handling pipe if it will not be used.

show more ...


# 2638237e 21-Jan-2023 James McCoy

build: add CI for OpenBSD and FreeBSD (#3548)

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


# 2f110a50 18-Jan-2023 Jameson Nash

misc: extend getpw to take uid as an argument (#3523)

File system operations may return uid and gid values, which we may want
to pretty-print. We already have the code for getting inform

misc: extend getpw to take uid as an argument (#3523)

File system operations may return uid and gid values, which we may want
to pretty-print. We already have the code for getting information for
the current user, so just need to add a parameter to make it exposed for
every user. We expose information about groups in a similar manner also.

show more ...


# 5102b2c0 28-Nov-2022 Ben Noordhuis

unix: drop kfreebsd support (#3835)

Because kFreeBSD is dead. RIP.

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


# e1415860 11-Nov-2022 Trevor Norris

src: add new metrics APIs (#3749)

The following metrics are now always recorded and available via the new
uv_metrics_info() API.

* loop_count: Number of event loop iterations.

src: add new metrics APIs (#3749)

The following metrics are now always recorded and available via the new
uv_metrics_info() API.

* loop_count: Number of event loop iterations.
* events: Total number of events processed by the event handler.
* events_waiting: Total number of events waiting in the event queue when
the event provider request was made.

Benchmarking has shown no noticeable impact recording these metrics.

PR-URL: https://github.com/libuv/libuv/pull/3749

show more ...


# e9000066 21-Oct-2022 daomingq

thread: add support for affinity (#3774)

Backported thread affinity feature and related dependency commits
from master. It will add support for those APIs: uv_cpumask_size,
uv_thread

thread: add support for affinity (#3774)

Backported thread affinity feature and related dependency commits
from master. It will add support for those APIs: uv_cpumask_size,
uv_thread_setaffinity, uv_thread_getaffinity.
The supported platforms are Linux, Freebsd, and Windows.
Empty implementations (returning UV_ENOTSUP) on non-supported platforms
(such as OS X and AIX).

show more ...


# fb76f210 21-Aug-2022 Ben Noordhuis

unix: fix uv_getrusage() ru_maxrss reporting (#3721)

Most platforms report it in kilobytes but macOS and Solaris report it in
bytes and pages respectively.

Fixes: https://github

unix: fix uv_getrusage() ru_maxrss reporting (#3721)

Most platforms report it in kilobytes but macOS and Solaris report it in
bytes and pages respectively.

Fixes: https://github.com/nodejs/node/issues/44332

show more ...


# 6c692ad1 20-Jul-2022 Ben Noordhuis

unix: don't accept() connections in a loop (#3696)

After analysis of many real-world programs I've come to conclude that
accepting in a loop is nearly always suboptimal.

1. 99.9

unix: don't accept() connections in a loop (#3696)

After analysis of many real-world programs I've come to conclude that
accepting in a loop is nearly always suboptimal.

1. 99.9% of the time the second accept() call fails with EAGAIN, meaning
there are no additional connections to accept. Not super expensive
in isolation but it adds up.

2. When there are more connections to accept but the listen socket is
shared between multiple processes (ex. the Node.js cluster module),
libuv's greedy behavior necessitated the UV_TCP_SINGLE_ACCEPT hack
to slow it down in order to give other processes a chance.

Accepting a single connection and relying on level-triggered polling to
get notified on the next incoming connection both simplifies the code
and optimizes for the common case.

show more ...


# 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


12345678910>>...12