diff options
author | Brad King <brad.king@kitware.com> | 2019-01-16 20:00:33 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-17 15:26:32 (GMT) |
commit | 1e1209729b26312cb511d5995bd57b6f5d35235e (patch) | |
tree | 8fb1927e363a9278f103a9a70a5a7923d398cbaf /Utilities/cmlibuv/src/unix/freebsd.c | |
parent | c59eae7ebc5423c2b06befd762f8639b0f23b7a0 (diff) | |
parent | 4fcb0d0213112bb2fdb04bb27e82543b93cfe41d (diff) | |
download | CMake-1e1209729b26312cb511d5995bd57b6f5d35235e.zip CMake-1e1209729b26312cb511d5995bd57b6f5d35235e.tar.gz CMake-1e1209729b26312cb511d5995bd57b6f5d35235e.tar.bz2 |
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv:
libuv 2019-01-15 (f84c5e69)
Diffstat (limited to 'Utilities/cmlibuv/src/unix/freebsd.c')
-rw-r--r-- | Utilities/cmlibuv/src/unix/freebsd.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/Utilities/cmlibuv/src/unix/freebsd.c b/Utilities/cmlibuv/src/unix/freebsd.c index 70ccb13..0f729cf 100644 --- a/Utilities/cmlibuv/src/unix/freebsd.c +++ b/Utilities/cmlibuv/src/unix/freebsd.c @@ -47,15 +47,6 @@ # define CP_INTR 4 #endif -static uv_mutex_t process_title_mutex; -static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -static char *process_title; - - -static void init_process_title_mutex_once(void) { - uv_mutex_init(&process_title_mutex); -} - int uv__platform_loop_init(uv_loop_t* loop) { return uv__kqueue_init(loop); @@ -159,76 +150,6 @@ void uv_loadavg(double avg[3]) { } -char** uv_setup_args(int argc, char** argv) { - process_title = argc ? uv__strdup(argv[0]) : NULL; - return argv; -} - - -int uv_set_process_title(const char* title) { - int oid[4]; - char* new_title; - - new_title = uv__strdup(title); - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title == NULL) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOMEM; - } - - uv__free(process_title); - process_title = new_title; - - oid[0] = CTL_KERN; - oid[1] = KERN_PROC; - oid[2] = KERN_PROC_ARGS; - oid[3] = getpid(); - - sysctl(oid, - ARRAY_SIZE(oid), - NULL, - NULL, - process_title, - strlen(process_title) + 1); - - uv_mutex_unlock(&process_title_mutex); - - return 0; -} - - -int uv_get_process_title(char* buffer, size_t size) { - size_t len; - - if (buffer == NULL || size == 0) - return UV_EINVAL; - - uv_once(&process_title_mutex_once, init_process_title_mutex_once); - uv_mutex_lock(&process_title_mutex); - - if (process_title) { - len = strlen(process_title) + 1; - - if (size < len) { - uv_mutex_unlock(&process_title_mutex); - return UV_ENOBUFS; - } - - memcpy(buffer, process_title, len); - } else { - len = 0; - } - - uv_mutex_unlock(&process_title_mutex); - - buffer[len] = '\0'; - - return 0; -} - int uv_resident_set_memory(size_t* rss) { struct kinfo_proc kinfo; size_t page_size; |