diff options
author | Bert Belder <bertbelder@gmail.com> | 2012-04-29 00:22:01 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-04-29 00:22:01 +0200 |
commit | d2dd9d108d6bd61ac49522450b98ad57eac5be45 (patch) | |
tree | a53bd3b01637cff18fe01552f6a3cf006189929f /deps/uv/src/unix/sunos.c | |
parent | c8a10e97c8def4c6a89f34f655b675d4204e16d4 (diff) | |
download | android-node-v8-d2dd9d108d6bd61ac49522450b98ad57eac5be45.tar.gz android-node-v8-d2dd9d108d6bd61ac49522450b98ad57eac5be45.tar.bz2 android-node-v8-d2dd9d108d6bd61ac49522450b98ad57eac5be45.zip |
uv: upgrade to e2cae340a6
Diffstat (limited to 'deps/uv/src/unix/sunos.c')
-rw-r--r-- | deps/uv/src/unix/sunos.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c index 37fdd8982f..0057e68651 100644 --- a/deps/uv/src/unix/sunos.c +++ b/deps/uv/src/unix/sunos.c @@ -37,6 +37,7 @@ #include <sys/time.h> #include <unistd.h> #include <kstat.h> +#include <fcntl.h> #if HAVE_PORTS_FS # include <sys/port.h> @@ -190,7 +191,7 @@ int uv_fs_event_init(uv_loop_t* loop, } -void uv__fs_event_destroy(uv_fs_event_t* handle) { +void uv__fs_event_close(uv_fs_event_t* handle) { ev_ref(handle->loop->ev); ev_io_stop(handle->loop->ev, &handle->event_watcher); close(handle->fd); @@ -213,7 +214,7 @@ int uv_fs_event_init(uv_loop_t* loop, } -void uv__fs_event_destroy(uv_fs_event_t* handle) { +void uv__fs_event_close(uv_fs_event_t* handle) { UNREACHABLE(); } @@ -239,28 +240,24 @@ uv_err_t uv_get_process_title(char* buffer, size_t size) { uv_err_t uv_resident_set_memory(size_t* rss) { - pid_t pid = getpid(); psinfo_t psinfo; - char pidpath[1024]; - FILE *f; + uv_err_t err; + int fd; - sprintf(pidpath, "/proc/%d/psinfo", (int)pid); - - f = fopen(pidpath, "r"); - if (!f) return uv__new_sys_error(errno); - - if (fread(&psinfo, sizeof(psinfo_t), 1, f) != 1) { - fclose (f); + fd = open("/proc/self/psinfo", O_RDONLY); + if (fd == -1) return uv__new_sys_error(errno); - } - /* XXX correct? */ + err = uv_ok_; - *rss = (size_t) psinfo.pr_rssize * 1024; + if (read(fd, &psinfo, sizeof(psinfo)) == sizeof(psinfo)) + *rss = (size_t)psinfo.pr_rssize * 1024; + else + err = uv__new_sys_error(EINVAL); - fclose (f); + close(fd); - return uv_ok_; + return err; } |