diff options
Diffstat (limited to 'Utilities/cmlibuv/src/unix/freebsd.c')
-rw-r--r-- | Utilities/cmlibuv/src/unix/freebsd.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Utilities/cmlibuv/src/unix/freebsd.c b/Utilities/cmlibuv/src/unix/freebsd.c index f2b3f24..70ccb13 100644 --- a/Utilities/cmlibuv/src/unix/freebsd.c +++ b/Utilities/cmlibuv/src/unix/freebsd.c @@ -72,11 +72,11 @@ int uv_exepath(char* buffer, size_t* size) { ssize_t abspath_size; if (buffer == NULL || size == NULL || *size == 0) - return -EINVAL; + return UV_EINVAL; abspath_size = readlink("/proc/curproc/file", abspath, sizeof(abspath)); if (abspath_size < 0) - return -errno; + return UV__ERR(errno); assert(abspath_size > 0); *size -= 1; @@ -96,7 +96,7 @@ int uv_exepath(char* buffer, size_t* size) { size_t abspath_size; if (buffer == NULL || size == NULL || *size == 0) - return -EINVAL; + return UV_EINVAL; mib[0] = CTL_KERN; mib[1] = KERN_PROC; @@ -105,7 +105,7 @@ int uv_exepath(char* buffer, size_t* size) { abspath_size = sizeof abspath; if (sysctl(mib, 4, abspath, &abspath_size, NULL, 0)) - return -errno; + return UV__ERR(errno); assert(abspath_size > 0); abspath_size -= 1; @@ -126,7 +126,7 @@ uint64_t uv_get_free_memory(void) { size_t size = sizeof(freecount); if (sysctlbyname("vm.stats.vm.v_free_count", &freecount, &size, NULL, 0)) - return -errno; + return UV__ERR(errno); return (uint64_t) freecount * sysconf(_SC_PAGESIZE); @@ -140,7 +140,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; } @@ -176,7 +176,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); @@ -204,7 +204,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); @@ -214,7 +214,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); @@ -243,7 +243,7 @@ int uv_resident_set_memory(size_t* rss) { kinfo_size = sizeof(kinfo); if (sysctl(mib, 4, &kinfo, &kinfo_size, NULL, 0)) - return -errno; + return UV__ERR(errno); page_size = getpagesize(); @@ -262,7 +262,7 @@ int uv_uptime(double* uptime) { struct timespec sp; r = clock_gettime(CLOCK_MONOTONIC, &sp); if (r) - return -errno; + return UV__ERR(errno); *uptime = sp.tv_sec; return 0; @@ -309,15 +309,15 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { size = sizeof(model); if (sysctlbyname(model_key, &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); *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos)); if (!(*cpu_infos)) - return -ENOMEM; + return UV_ENOMEM; *count = numcpus; @@ -327,7 +327,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { size = sizeof(maxcpus); if (sysctlbyname(maxcpus_key, &maxcpus, &size, NULL, 0)) { uv__free(*cpu_infos); - return -errno; + return UV__ERR(errno); } size = maxcpus * CPUSTATES * sizeof(long); @@ -335,13 +335,13 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { cp_times = uv__malloc(size); if (cp_times == NULL) { uv__free(*cpu_infos); - return -ENOMEM; + return UV_ENOMEM; } if (sysctlbyname(cptimes_key, cp_times, &size, NULL, 0)) { uv__free(cp_times); uv__free(*cpu_infos); - return -errno; + return UV__ERR(errno); } for (i = 0; i < numcpus; i++) { |