diff options
author | Brad King <brad.king@kitware.com> | 2018-05-07 15:48:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-05-07 15:48:01 (GMT) |
commit | 42fbb285161a7424116a1e838b29741864ab3691 (patch) | |
tree | 858d1d7aa84098ce326d32c41da9047d9cd95064 /Utilities/cmlibuv/src/unix/netbsd.c | |
parent | dd3e1a737216b7c9bfb6c7569685b36a1bff9cba (diff) | |
parent | c8b67ea119c4000018238f6c3201a1364356d93a (diff) | |
download | CMake-42fbb285161a7424116a1e838b29741864ab3691.zip CMake-42fbb285161a7424116a1e838b29741864ab3691.tar.gz CMake-42fbb285161a7424116a1e838b29741864ab3691.tar.bz2 |
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv:
libuv 2018-05-06 (bf605bd7)
Diffstat (limited to 'Utilities/cmlibuv/src/unix/netbsd.c')
-rw-r--r-- | Utilities/cmlibuv/src/unix/netbsd.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Utilities/cmlibuv/src/unix/netbsd.c b/Utilities/cmlibuv/src/unix/netbsd.c index 7425072..2605c11 100644 --- a/Utilities/cmlibuv/src/unix/netbsd.c +++ b/Utilities/cmlibuv/src/unix/netbsd.c @@ -82,7 +82,7 @@ int uv_exepath(char* buffer, size_t* size) { int mib[4]; if (buffer == NULL || size == NULL || *size == 0) - return -EINVAL; + return UV_EINVAL; mib[0] = CTL_KERN; mib[1] = KERN_PROC_ARGS; @@ -91,7 +91,7 @@ int uv_exepath(char* buffer, size_t* size) { int_size = ARRAY_SIZE(int_buf); if (sysctl(mib, 4, int_buf, &int_size, NULL, 0)) - return -errno; + return UV__ERR(errno); /* Copy string from the intermediate buffer to outer one with appropriate * length. @@ -111,7 +111,7 @@ uint64_t uv_get_free_memory(void) { int which[] = {CTL_VM, VM_UVMEXP}; if (sysctl(which, 2, &info, &size, NULL, 0)) - return -errno; + return UV__ERR(errno); return (uint64_t) info.free * sysconf(_SC_PAGESIZE); } @@ -128,7 +128,7 @@ uint64_t uv_get_total_memory(void) { size_t size = sizeof(info); if (sysctl(which, 2, &info, &size, NULL, 0)) - return -errno; + return UV__ERR(errno); return (uint64_t) info; } @@ -150,7 +150,7 @@ int uv_set_process_title(const char* title) { if (process_title == NULL) { uv_mutex_unlock(&process_title_mutex); - return -ENOMEM; + return UV_ENOMEM; } uv__free(process_title); @@ -167,7 +167,7 @@ int uv_get_process_title(char* buffer, size_t size) { size_t len; if (buffer == NULL || size == 0) - return -EINVAL; + return UV_EINVAL; uv_once(&process_title_mutex_once, init_process_title_mutex_once); uv_mutex_lock(&process_title_mutex); @@ -177,7 +177,7 @@ int uv_get_process_title(char* buffer, size_t size) { if (size < len) { uv_mutex_unlock(&process_title_mutex); - return -ENOBUFS; + return UV_ENOBUFS; } memcpy(buffer, process_title, len); @@ -219,7 +219,7 @@ int uv_resident_set_memory(size_t* rss) { error: if (kd) kvm_close(kd); - return -EPERM; + return UV_EPERM; } @@ -230,7 +230,7 @@ int uv_uptime(double* uptime) { static int which[] = {CTL_KERN, KERN_BOOTTIME}; if (sysctl(which, 2, &info, &size, NULL, 0)) - return -errno; + return UV__ERR(errno); now = time(NULL); @@ -254,12 +254,12 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { size = sizeof(model); if (sysctlbyname("machdep.cpu_brand", &model, &size, NULL, 0) && sysctlbyname("hw.model", &model, &size, NULL, 0)) { - return -errno; + return UV__ERR(errno); } size = sizeof(numcpus); if (sysctlbyname("hw.ncpu", &numcpus, &size, NULL, 0)) - return -errno; + return UV__ERR(errno); *count = numcpus; /* Only i386 and amd64 have machdep.tsc_freq */ @@ -270,16 +270,16 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { size = numcpus * CPUSTATES * sizeof(*cp_times); cp_times = uv__malloc(size); if (cp_times == NULL) - return -ENOMEM; + return UV_ENOMEM; if (sysctlbyname("kern.cp_time", cp_times, &size, NULL, 0)) - return -errno; + return UV__ERR(errno); *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos)); if (!(*cpu_infos)) { uv__free(cp_times); uv__free(*cpu_infos); - return -ENOMEM; + return UV_ENOMEM; } for (i = 0; i < numcpus; i++) { |