It's been reported that calling this function causes the Core Graphics
framework to start reporting bogus values.
Commit 565cdd16 ('Revert "darwin: speed up uv_set_process_title()"')
attempted to fix this but apparently merely postponed the moment
when `CGDisplayPixelsWide()` and friends start reporting bogus values.
The Chromium code base mentions that calling `SetApplicationIsDaemon()`
prevents the HIServices framework from terminating the process when it
can't connect to launchservicesd.
Libuv itself doesn't use HIServices but it's possible that the libuv
user does. If said user doesn't call `SetApplicationIsDaemon()`, it's
possible this commit introduces an observable change in behavior.
The `SetApplicationIsDaemon()` call was introduced in commit 08e0e63f
("darwin: avoid calling GetCurrentProcess") from October 2013 to work
around a bug in macos 10.9 where the Activity Monitor showed the program
as "Not responding."
Fixes: https://github.com/libuv/libuv/issues/2566 (for real, hopefully)
Fixes: https://github.com/nodejs/node/issues/31328
PR-URL: https://github.com/libuv/libuv/pull/2593
Refs: https://cs.chromium.org/chromium/src/sandbox/mac/system_services.cc?l=26&rcl=a06d2fe5a279ddecd358d919d461080e2c53c92e
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Stop dlsym-ing the symbol name at run-time, that was only necessary to
support macOS and iOS versions that were already near-obsolete when this
feature was introduced in August 2013.
This reapplies commit bee1bf5dd7 from October.
PR-URL: https://github.com/libuv/libuv/pull/2568
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This reverts commit 038eacfbf4.
It was reported that this change causes a regression when trying
to obtain the screen resolution with `CGDisplayPixelsWide()` or
`CGDisplayPixelsHigh()` after changing the process title.
This is the second time this change had to be reverted due to
regressions and, although third time is allegedly the charm,
leaving well enough alone is the proverb I plan to adhere to...
Fixes: https://github.com/libuv/libuv/issues/2566
PR-URL: https://github.com/libuv/libuv/pull/2568
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This reverts commit bee1bf5dd7.
This is necessary in order to be able to revert commit 038eacfbf4
("darwin: speed up uv_set_process_title()") from October.
PR-URL: https://github.com/libuv/libuv/pull/2568
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Stop dlsym-ing the symbol name at run-time, that was only necessary to
support macOS and iOS versions that were already near-obsolete when this
feature was introduced in August 2013.
PR-URL: https://github.com/libuv/libuv/pull/2480
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Libuv loaded and unloaded the Core Services and Application Services for
every call to uv_set_process_title().
Change that to load them on the first call to uv_set_process_title() and
delay unloading until libuv is unloaded.
Speeds up process_title_threadsafe by about 10x on my system. It should
fail less often (hopefully not at all) on the CI now.
PR-URL: https://github.com/libuv/libuv/pull/2480
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
This reverts commit 00c6b1649d.
It's been reported (and I can confirm) that this change breaks
`process.title = 'foo'` in Node.js.
Since libuv just calls out to Core Services and Application Services,
and since those frameworks are really just black boxes that you can't
look inside, it's impossible to debug what exactly goes wrong. Revert
it is then.
Fixes: https://github.com/nodejs/node/issues/28945
PR-URL: https://github.com/libuv/libuv/pull/2405
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Libuv loaded and unloaded the Core Services and Application Services for
every call to uv_set_process_title().
Change that to load them on the first call to uv_set_process_title() and
delay unloading until libuv is unloaded.
Speeds up process_title_threadsafe by about 10x on my system.
PR-URL: https://github.com/libuv/libuv/pull/2064
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Using -errno, -E**, and -pthread_function() can be
error prone, and breaks compatibility with some operating
systems that already negate errno's (e.g. Haiku).
This commit adds a UV__ERR() macro that ensures libuv
errors are negative.
Fixes: https://github.com/libuv/help/issues/39
PR-URL: https://github.com/libuv/libuv/pull/1687
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Load the required symbols at run-time rather than linking against the
CoreFoundation (and CoreServices and ApplicationServices) frameworks
at build time.
Should make integration easier for people that bundle libuv with their
own projects because they no longer have to replicate magic -framework
incantations in their top-level build system.
Include <errno.h> and <stdlib.h>. They're being pulled in implicitly
on OS X but apparently that's not the case with iOS builds.
Build breakage introduced in 5ff6f85 by yours truly. Mea culpa.
Fixes#885 and #891.
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.
Rename it to darwin-getproctitle.c, it doesn't need an Objective-C
compiler. Fix up -Wpedantic warnings about void to function pointer
casts and include <ApplicationServices/ApplicationServices.h> to get
the GetCurrentProcess() function prototype.