diff options
author | Saúl Ibarra Corretgé <saghul@gmail.com> | 2015-08-05 21:17:46 +0200 |
---|---|---|
committer | thefourtheye <thechargingvolcano@gmail.com> | 2015-09-02 03:16:47 -0400 |
commit | a1615949a591fc523048a09540a2d340ff1b3da8 (patch) | |
tree | 1cc576ea6104f1baf8f92c6a82f3ca2b45afaccd /deps/uv/src/unix/freebsd.c | |
parent | e3740e452402892c1ce03bbbb4807e34f31558ad (diff) | |
download | android-node-v8-a1615949a591fc523048a09540a2d340ff1b3da8.tar.gz android-node-v8-a1615949a591fc523048a09540a2d340ff1b3da8.tar.bz2 android-node-v8-a1615949a591fc523048a09540a2d340ff1b3da8.zip |
deps: upgrade libuv to 1.7.3
PR-URL: https://github.com/nodejs/node/pull/2310
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/uv/src/unix/freebsd.c')
-rw-r--r-- | deps/uv/src/unix/freebsd.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/deps/uv/src/unix/freebsd.c b/deps/uv/src/unix/freebsd.c index 44976f7fe2..c838beb28e 100644 --- a/deps/uv/src/unix/freebsd.c +++ b/deps/uv/src/unix/freebsd.c @@ -74,6 +74,30 @@ uint64_t uv__hrtime(uv_clocktype_t type) { } +#ifdef __DragonFly__ +int uv_exepath(char* buffer, size_t* size) { + char abspath[PATH_MAX * 2 + 1]; + ssize_t abspath_size; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + abspath_size = readlink("/proc/curproc/file", abspath, sizeof(abspath)); + if (abspath_size < 0) + return -errno; + + assert(abspath_size > 0); + *size -= 1; + + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + return 0; +} +#else int uv_exepath(char* buffer, size_t* size) { char abspath[PATH_MAX * 2 + 1]; int mib[4]; @@ -82,19 +106,12 @@ int uv_exepath(char* buffer, size_t* size) { if (buffer == NULL || size == NULL || *size == 0) return -EINVAL; -#ifdef __DragonFly__ - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_ARGS; - mib[3] = getpid(); -#else mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PATHNAME; mib[3] = -1; -#endif - abspath_size = sizeof abspath;; + abspath_size = sizeof abspath; if (sysctl(mib, 4, abspath, &abspath_size, NULL, 0)) return -errno; @@ -110,7 +127,7 @@ int uv_exepath(char* buffer, size_t* size) { return 0; } - +#endif uint64_t uv_get_free_memory(void) { int freecount; |