[fuchsia/uv] Compile/run libuv tests on Fuchsia
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 626ceba..1a4f07c 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h
@@ -1027,7 +1027,7 @@ struct uv_process_s { UV_HANDLE_FIELDS uv_exit_cb exit_cb; - int pid; + uv_pid_t pid; UV_PROCESS_PRIVATE_FIELDS }; @@ -1037,6 +1037,7 @@ UV_EXTERN int uv_process_kill(uv_process_t*, int signum); UV_EXTERN int uv_kill(int pid, int signum); UV_EXTERN uv_pid_t uv_process_get_pid(const uv_process_t*); +UV_EXTERN uv_pid_t uv__waitpid(uv_pid_t pid, int *status, int options); /* @@ -1168,7 +1169,9 @@ uint64_t ru_nivcsw; /* involuntary context switches */ } uv_rusage_t; +#ifndef __FUCHSIA__ UV_EXTERN int uv_getrusage(uv_rusage_t* rusage); +#endif UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); @@ -1184,8 +1187,10 @@ #define UV_PRIORITY_HIGH -14 #define UV_PRIORITY_HIGHEST -20 +#ifndef __FUCHSIA__ UV_EXTERN int uv_os_getpriority(uv_pid_t pid, int* priority); UV_EXTERN int uv_os_setpriority(uv_pid_t pid, int priority); +#endif UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
diff --git a/deps/uv/include/uv/unix.h b/deps/uv/include/uv/unix.h index 3a13163..42934fd 100644 --- a/deps/uv/include/uv/unix.h +++ b/deps/uv/include/uv/unix.h
@@ -69,6 +69,9 @@ # include "uv/posix.h" #elif defined(__HAIKU__) # include "uv/posix.h" +#elif defined(__FUCHSIA__) +# include "uv/posix.h" +# include <zircon/types.h> #endif #ifndef NI_MAXHOST @@ -126,7 +129,11 @@ typedef int uv_file; typedef int uv_os_sock_t; typedef int uv_os_fd_t; +#ifdef __FUCHSIA__ +typedef zx_handle_t uv_pid_t; +#else typedef pid_t uv_pid_t; +#endif #define UV_ONCE_INIT PTHREAD_ONCE_INIT
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index 04999dc..a4453f1 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c
@@ -38,7 +38,9 @@ #include <arpa/inet.h> #include <limits.h> /* INT_MAX, PATH_MAX, IOV_MAX */ #include <sys/uio.h> /* writev */ +#ifndef __FUCHSIA__ #include <sys/resource.h> /* getrusage */ +#endif #include <pwd.h> #include <sys/utsname.h> #include <sys/time.h> @@ -969,6 +971,7 @@ } +#ifndef __FUCHSIA__ int uv_getrusage(uv_rusage_t* rusage) { struct rusage usage; @@ -1000,7 +1003,7 @@ return 0; } - +#endif // !__FUCHSIA__ int uv__open_cloexec(const char* path, int flags) { #if defined(O_CLOEXEC) @@ -1436,7 +1439,7 @@ return getppid(); } - +#ifndef __FUCHSIA__ int uv_os_getpriority(uv_pid_t pid, int* priority) { int r; @@ -1463,7 +1466,7 @@ return 0; } - +#endif // !__FUCHSIA__ int uv_os_uname(uv_utsname_t* buffer) { struct utsname buf;
diff --git a/deps/uv/src/unix/loop.c b/deps/uv/src/unix/loop.c index c2a03d7..39a9f0e 100644 --- a/deps/uv/src/unix/loop.c +++ b/deps/uv/src/unix/loop.c
@@ -30,7 +30,7 @@ int uv_loop_init(uv_loop_t* loop) { void* saved_data; int err; - + saved_data = loop->data; memset(loop, 0, sizeof(*loop));
diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c index bb6b76c..19147fe 100644 --- a/deps/uv/src/unix/process.c +++ b/deps/uv/src/unix/process.c
@@ -33,6 +33,11 @@ #include <fcntl.h> #include <poll.h> +#ifdef __FUCHSIA__ +# include <lib/fdio/spawn.h> +# include <zircon/syscalls.h> +#endif + #if defined(__APPLE__) && !TARGET_OS_IPHONE # include <crt_externs.h> # define environ (*_NSGetEnviron()) @@ -44,6 +49,30 @@ # include <grp.h> #endif +uv_pid_t uv__waitpid(uv_pid_t pid, int *status, int options) { +#ifdef __FUCHSIA__ + // TODO(victor): ignoring options for now + assert(options == 0); + + zx_status_t result = zx_object_wait_one(pid, ZX_TASK_TERMINATED, ZX_TIME_INFINITE, NULL); + if (result != ZX_OK) + goto error; + + zx_info_process_t proc_info; + result = zx_object_get_info(pid, ZX_INFO_PROCESS, &proc_info, sizeof(proc_info), NULL, NULL); + if (result != ZX_OK) + goto error; + + *status = proc_info.return_code; + return 0; + +error: + errno = ECHILD; + return -1; +#else + return waitpid(pid, status, options); +#endif +} static void uv__chld(uv_signal_t* handle, int signum) { uv_process_t* process; @@ -51,7 +80,7 @@ int exit_status; int term_signal; int status; - pid_t pid; + uv_pid_t pid; QUEUE pending; QUEUE* q; QUEUE* h; @@ -68,7 +97,7 @@ q = QUEUE_NEXT(q); do - pid = waitpid(process->pid, &status, WNOHANG); + pid = uv__waitpid(process->pid, &status, WNOHANG); while (pid == -1 && errno == EINTR); if (pid == 0) @@ -412,7 +441,6 @@ } #endif - int uv_spawn(uv_loop_t* loop, uv_process_t* process, const uv_process_options_t* options) { @@ -425,7 +453,7 @@ int (*pipes)[2]; int stdio_count; ssize_t r; - pid_t pid; + uv_pid_t pid; int err; int exec_errorno; int i; @@ -494,6 +522,29 @@ /* Acquire write lock to prevent opening new fds in worker threads */ uv_rwlock_wrlock(&loop->cloexec_lock); + +#ifdef __FUCHSIA__ + const char *executable_path; + if (*options->file == 0) { + executable_path = "/pkg/uv_tests_bin"; + } else { + executable_path = options->file; + } + + // TODO(victor): missing uv_process_child_init logic before spawning. + char err_msg_out[FDIO_SPAWN_ERR_MSG_MAX_LENGTH]; + zx_status_t zx_status = fdio_spawn_etc(ZX_HANDLE_INVALID, FDIO_SPAWN_CLONE_ALL, executable_path, + (const char* const *)options->args, + (const char* const *)options->env, 0, NULL, + &pid, err_msg_out); + if (zx_status != ZX_OK) { + err = UV__ERR(ENOENT); + uv_rwlock_wrunlock(&loop->cloexec_lock); + uv__close(signal_pipe[0]); + uv__close(signal_pipe[1]); + goto error; + } +#else pid = fork(); if (pid == -1) { @@ -508,6 +559,7 @@ uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]); abort(); } +#endif /* Release lock in parent process */ uv_rwlock_wrunlock(&loop->cloexec_lock); @@ -523,12 +575,12 @@ ; /* okay, EOF */ else if (r == sizeof(exec_errorno)) { do - err = waitpid(pid, &status, 0); /* okay, read errorno */ + err = uv__waitpid(pid, &status, 0); /* okay, read errorno */ while (err == -1 && errno == EINTR); assert(err == pid); } else if (r == -1 && errno == EPIPE) { do - err = waitpid(pid, &status, 0); /* okay, got EPIPE */ + err = uv__waitpid(pid, &status, 0); /* okay, got EPIPE */ while (err == -1 && errno == EINTR); assert(err == pid); } else
diff --git a/deps/uv/src/unix/signal.c b/deps/uv/src/unix/signal.c index ba8fcc2..ddda679 100644 --- a/deps/uv/src/unix/signal.c +++ b/deps/uv/src/unix/signal.c
@@ -63,6 +63,8 @@ static void uv__signal_global_reinit(void); static void uv__signal_global_init(void) { +// TODO(victor): not sure if I can skip the lock here for fuchsia +#ifndef __FUCHSIA__ if (uv__signal_lock_pipefd[0] == -1) /* pthread_atfork can register before and after handlers, one * for each child. This only registers one for the child. That @@ -72,6 +74,7 @@ */ if (pthread_atfork(NULL, NULL, &uv__signal_global_reinit)) abort(); +#endif uv__signal_global_reinit(); }
diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c index f10c351..10f4191 100644 --- a/deps/uv/src/unix/thread.c +++ b/deps/uv/src/unix/thread.c
@@ -27,7 +27,10 @@ #include <errno.h> #include <sys/time.h> +#ifndef __FUCHSIA__ #include <sys/resource.h> /* getrlimit() */ +#endif + #include <unistd.h> /* getpagesize() */ #include <limits.h>
diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c index dbb33bf..fb48bef 100644 --- a/deps/uv/test/runner-unix.c +++ b/deps/uv/test/runner-unix.c
@@ -21,6 +21,7 @@ #include "runner-unix.h" #include "runner.h" +#include "uv.h" #include <limits.h> #include <stdint.h> /* uintptr_t */ @@ -40,6 +41,11 @@ #include <sys/time.h> #include <pthread.h> +#ifdef __FUCHSIA__ +# include <lib/fdio/spawn.h> +# include <zircon/syscalls.h> +#endif + extern char** environ; static void closefd(int fd) { @@ -81,23 +87,23 @@ return 0; } - /* Invoke "argv[0] test-name [test-part]". Store process info in *p. Make sure * that all stdio output of the processes is buffered up. */ int process_start(char* name, char* part, process_info_t* p, int is_helper) { FILE* stdout_file; int stdout_fd; - const char* arg; - char* args[16]; + const char* args[16]; int pipefd[2]; char fdstr[8]; ssize_t rc; int n; - pid_t pid; - arg = getenv("UV_USE_VALGRIND"); n = 0; +#ifndef __FUCHSIA__ + const char* arg; + arg = getenv("UV_USE_VALGRIND"); + /* Disable valgrind for helpers, it complains about helpers leaking memory. * They're killed after the test and as such never get a chance to clean up. */ @@ -108,6 +114,7 @@ args[n++] = "--show-reachable=yes"; args[n++] = "--error-exitcode=125"; } +#endif args[n++] = executable_path; args[n++] = name; @@ -128,6 +135,7 @@ } snprintf(fdstr, sizeof(fdstr), "%d", pipefd[1]); + printf("setting UV_TEST_RUNNER_FD\n"); if (setenv("UV_TEST_RUNNER_FD", fdstr, /* overwrite */ 1)) { perror("setenv"); return -1; @@ -137,6 +145,17 @@ p->terminated = 0; p->status = 0; +#ifdef __FUCHSIA__ + zx_status_t status; + + status = fdio_spawn(ZX_HANDLE_INVALID, FDIO_SPAWN_CLONE_ALL, executable_path, args, &p->pid); + if (status != ZX_OK) { + perror("fdio_spawn"); + return -1; + } +#else + pid_t pid; + pid = fork(); if (pid < 0) { @@ -157,6 +176,8 @@ /* parent */ p->pid = pid; +#endif + p->name = strdup(name); p->stdout_file = stdout_file; @@ -185,7 +206,6 @@ return 0; } - typedef struct { int pipe[2]; process_info_t* vec; @@ -205,7 +225,7 @@ for (i = 0; i < args->n; i++) { p = (process_info_t*)(args->vec + i * sizeof(process_info_t)); if (p->terminated) continue; - r = waitpid(p->pid, &p->status, 0); + r = uv__waitpid(p->pid, &p->status, 0); if (r < 0) { perror("waitpid"); return NULL; @@ -225,7 +245,6 @@ return NULL; } - /* Wait for all `n` processes in `vec` to terminate. Time out after `timeout` * msec, or never if timeout == -1. Return 0 if all processes are terminated, * -1 on error, -2 on timeout. */ @@ -330,7 +349,11 @@ /* Timeout. Kill all the children. */ for (i = 0; i < n; i++) { p = (process_info_t*)(vec + i * sizeof(process_info_t)); +#ifdef __FUCHSIA__ + assert(0 && "kill not supported!"); +#else kill(p->pid, SIGTERM); +#endif } retval = -2; } @@ -420,7 +443,12 @@ /* Terminate process `p`. */ int process_terminate(process_info_t *p) { +#ifdef __FUCHSIA__ + assert(0 && "kill not supported"); + return -1; +#else return kill(p->pid, SIGTERM); +#endif }
diff --git a/deps/uv/test/runner-unix.h b/deps/uv/test/runner-unix.h index e21847f..4c44ec3 100644 --- a/deps/uv/test/runner-unix.h +++ b/deps/uv/test/runner-unix.h
@@ -25,9 +25,17 @@ #include <sys/types.h> #include <stdio.h> /* FILE */ +#ifdef __FUCHSIA__ +#include <zircon/types.h> +#endif + typedef struct { FILE* stdout_file; +#ifdef __FUCHSIA__ + zx_handle_t pid; +#else pid_t pid; +#endif char* name; int status; int terminated;
diff --git a/deps/uv/test/task.h b/deps/uv/test/task.h index 13105d0..4eae278 100644 --- a/deps/uv/test/task.h +++ b/deps/uv/test/task.h
@@ -34,7 +34,7 @@ # include <stdint.h> #endif -#if !defined(_WIN32) +#if !defined(_WIN32) && !defined(__FUCHSIA__) # include <sys/time.h> # include <sys/resource.h> /* setrlimit() */ #endif
diff --git a/deps/uv/test/test-close-fd.c b/deps/uv/test/test-close-fd.c index 2ed9a10..41fa61b 100644 --- a/deps/uv/test/test-close-fd.c +++ b/deps/uv/test/test-close-fd.c
@@ -45,7 +45,7 @@ uv_close((uv_handle_t *) handle, NULL); break; default: - ASSERT(!"read_cb_called > 2"); + ASSERT(0 && "read_cb_called > 2"); } }
diff --git a/deps/uv/test/test-fs-copyfile.c b/deps/uv/test/test-fs-copyfile.c index c3e698e..532aae1 100644 --- a/deps/uv/test/test-fs-copyfile.c +++ b/deps/uv/test/test-fs-copyfile.c
@@ -25,7 +25,7 @@ #if defined(__unix__) || defined(__POSIX__) || \ defined(__APPLE__) || defined(__sun) || \ defined(_AIX) || defined(__MVS__) || \ - defined(__HAIKU__) + defined(__HAIKU__) || defined(__FUCHSIA__) #include <unistd.h> /* unlink, etc. */ #else # include <direct.h>
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 75cefe3..1203e06 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c
@@ -32,7 +32,7 @@ #if defined(__unix__) || defined(__POSIX__) || \ defined(__APPLE__) || defined(__sun) || \ defined(_AIX) || defined(__MVS__) || \ - defined(__HAIKU__) + defined(__HAIKU__) || defined(__FUCHSIA__) #include <unistd.h> /* unlink, rmdir, etc. */ #else # include <winioctl.h>
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index a6cfc6b..970c165 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h
@@ -58,7 +58,9 @@ TEST_DECLARE (tty_composing_character) #endif TEST_DECLARE (tty_file) +#ifndef __FUCHSIA__ TEST_DECLARE (tty_pty) +#endif TEST_DECLARE (stdio_over_pipes) TEST_DECLARE (ip6_pton) TEST_DECLARE (connect_unspecified) @@ -204,7 +206,9 @@ TEST_DECLARE (loop_handles) TEST_DECLARE (get_loadavg) TEST_DECLARE (walk_handles) +#ifndef __FUCHSIA__ TEST_DECLARE (watcher_cross_stop) +#endif TEST_DECLARE (ref) TEST_DECLARE (idle_ref) TEST_DECLARE (async_ref) @@ -233,7 +237,9 @@ TEST_DECLARE (pipe_set_non_blocking) TEST_DECLARE (pipe_set_chmod) TEST_DECLARE (process_ref) +#ifndef __FUCHSIA__ TEST_DECLARE (process_priority) +#endif TEST_DECLARE (has_ref) TEST_DECLARE (active) TEST_DECLARE (embed) @@ -443,7 +449,9 @@ TEST_DECLARE (ipc_listen_after_bind_twice) TEST_DECLARE (win32_signum_number) #else +#ifndef __FUCHSIA__ TEST_DECLARE (emfile) +#endif TEST_DECLARE (close_fd) TEST_DECLARE (spawn_fs_open) TEST_DECLARE (spawn_setuid_setgid) @@ -491,8 +499,10 @@ #endif #endif +#ifndef __FUCHSIA__ TEST_DECLARE (idna_toascii) TEST_DECLARE (utf8_decode1) +#endif TEST_DECLARE (uname) TASK_LIST_START @@ -547,7 +557,9 @@ TEST_ENTRY (tty_composing_character) #endif TEST_ENTRY (tty_file) +#ifndef __FUCHSIA__ TEST_ENTRY (tty_pty) +#endif TEST_ENTRY (stdio_over_pipes) TEST_ENTRY (ip6_pton) TEST_ENTRY (connect_unspecified) @@ -769,13 +781,17 @@ TEST_ENTRY (pipe_ref4) TEST_HELPER (pipe_ref4, pipe_echo_server) TEST_ENTRY (process_ref) +#ifndef __FUCHSIA__ TEST_ENTRY (process_priority) +#endif TEST_ENTRY (has_ref) TEST_ENTRY (loop_handles) TEST_ENTRY (walk_handles) +#ifndef __FUCHSIA__ TEST_ENTRY (watcher_cross_stop) +#endif TEST_ENTRY (active) @@ -893,7 +909,9 @@ TEST_ENTRY (ipc_listen_after_bind_twice) TEST_ENTRY (win32_signum_number) #else +#ifndef __FUCHSIA__ TEST_ENTRY (emfile) +#endif TEST_ENTRY (close_fd) TEST_ENTRY (spawn_fs_open) TEST_ENTRY (spawn_setuid_setgid) @@ -1000,7 +1018,9 @@ #endif TEST_ENTRY (get_osfhandle_valid_handle) TEST_ENTRY (open_osfhandle_valid_handle) +#ifndef __FUCHSIA__ TEST_ENTRY (strscpy) +#endif TEST_ENTRY (threadpool_queue_work_simple) TEST_ENTRY (threadpool_queue_work_einval) TEST_ENTRY_CUSTOM (threadpool_multiple_event_loops, 0, 0, 60000) @@ -1048,11 +1068,13 @@ #endif #endif +#ifndef __FUCHSIA__ TEST_ENTRY (utf8_decode1) +#endif TEST_ENTRY (uname) /* Doesn't work on z/OS because that platform uses EBCDIC, not ASCII. */ -#ifndef __MVS__ +#if !defined(__MVS__) && !defined(__FUCHSIA__) TEST_ENTRY (idna_toascii) #endif
diff --git a/deps/uv/test/test-platform-output.c b/deps/uv/test/test-platform-output.c index 65cfa1b..9427d99 100644 --- a/deps/uv/test/test-platform-output.c +++ b/deps/uv/test/test-platform-output.c
@@ -25,13 +25,13 @@ TEST_IMPL(platform_output) { + ASSERT(0 && "my error"); char buffer[512]; size_t rss; size_t size; double uptime; uv_pid_t pid; uv_pid_t ppid; - uv_rusage_t rusage; uv_cpu_info_t* cpus; uv_interface_address_t* interfaces; uv_passwd_t pwd; @@ -66,6 +66,8 @@ printf("uv_uptime: %f\n", uptime); #endif +#ifndef __FUCHSIA__ + uv_rusage_t rusage; err = uv_getrusage(&rusage); ASSERT(err == 0); ASSERT(rusage.ru_utime.tv_sec >= 0); @@ -82,6 +84,7 @@ printf(" page faults: %llu\n", (unsigned long long) rusage.ru_majflt); printf(" maximum resident set size: %llu\n", (unsigned long long) rusage.ru_maxrss); +#endif err = uv_cpu_info(&cpus, &count); #if defined(__CYGWIN__) || defined(__MSYS__)
diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c index be9e253..ea0e96b 100644 --- a/deps/uv/test/test-spawn.c +++ b/deps/uv/test/test-spawn.c
@@ -217,7 +217,7 @@ /* verify the child is successfully cleaned up within libuv */ do - err = waitpid(process.pid, &status, 0); + err = uv__waitpid(process.pid, &status, 0); while (err == -1 && errno == EINTR); ASSERT(err == -1);
diff --git a/deps/uv/test/test-strscpy.c b/deps/uv/test/test-strscpy.c index 4e7db6f..43f3329 100644 --- a/deps/uv/test/test-strscpy.c +++ b/deps/uv/test/test-strscpy.c
@@ -23,7 +23,6 @@ #include "task.h" #include <string.h> -#include "../src/strscpy.h" #include "../src/strscpy.c" TEST_IMPL(strscpy) {
diff --git a/src/node_os.cc b/src/node_os.cc index 12a4ec3..9cedbe1 100644 --- a/src/node_os.cc +++ b/src/node_os.cc
@@ -346,6 +346,7 @@ args.GetReturnValue().Set(entry); } +#ifndef __FUCHSIA__ static void SetPriority(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); @@ -385,7 +386,7 @@ args.GetReturnValue().Set(priority); } - +#endif // !__FUCHSIA__ void Initialize(Local<Object> target, Local<Value> unused, @@ -403,8 +404,10 @@ env->SetMethod(target, "getInterfaceAddresses", GetInterfaceAddresses); env->SetMethod(target, "getHomeDirectory", GetHomeDirectory); env->SetMethod(target, "getUserInfo", GetUserInfo); +#ifndef __FUCHSIA__ env->SetMethod(target, "setPriority", SetPriority); env->SetMethod(target, "getPriority", GetPriority); +#endif target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "isBigEndian"), Boolean::New(env->isolate(), IsBigEndian())).Check();
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 4d53749..e02582d 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc
@@ -89,6 +89,7 @@ } } +#ifndef __FUCHSIA__ // CPUUsage use libuv's uv_getrusage() this-process resource usage accessor, // to access ru_utime (user CPU time used) and ru_stime (system CPU time used), // which are uv_timeval_t structs (long tv_sec, long tv_usec). @@ -116,6 +117,7 @@ fields[0] = MICROS_PER_SEC * rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec; fields[1] = MICROS_PER_SEC * rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec; } +#endif static void Cwd(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); @@ -174,7 +176,7 @@ int sig; if (!args[1]->Int32Value(context).To(&sig)) return; - uv_pid_t own_pid = uv_os_getpid(); + int own_pid = uv_os_getpid(); if (sig > 0 && (pid == 0 || pid == -1 || pid == own_pid || pid == -own_pid) && !HasSignalJSHandler(sig)) { @@ -295,6 +297,7 @@ Array::New(env->isolate(), handle_v.data(), handle_v.size())); } +#ifndef __FUCHSIA__ static void ResourceUsage(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); @@ -326,6 +329,7 @@ fields[14] = rusage.ru_nvcsw; fields[15] = rusage.ru_nivcsw; } +#endif #ifdef __POSIX__ static void DebugProcess(const FunctionCallbackInfo<Value>& args) { @@ -465,10 +469,15 @@ env->SetMethod(target, "umask", Umask); env->SetMethod(target, "_rawDebug", RawDebug); env->SetMethod(target, "memoryUsage", MemoryUsage); + + #ifndef __FUCHSIA__ env->SetMethod(target, "cpuUsage", CPUUsage); + env->SetMethod(target, "resourceUsage", ResourceUsage); + #endif + env->SetMethod(target, "hrtime", Hrtime); env->SetMethod(target, "hrtimeBigInt", HrtimeBigInt); - env->SetMethod(target, "resourceUsage", ResourceUsage); + env->SetMethod(target, "_getActiveRequests", GetActiveRequests); env->SetMethod(target, "_getActiveHandles", GetActiveHandles);
diff --git a/src/node_report.cc b/src/node_report.cc index c29f866..31b423f 100644 --- a/src/node_report.cc +++ b/src/node_report.cc
@@ -539,6 +539,7 @@ (uv_hrtime() - node::per_process::node_start_time) / (NANOS_PER_SEC); if (uptime == 0) uptime = 1; // avoid division by zero. +#ifndef __FUCHSIA__ // Process and current thread usage statistics uv_rusage_t rusage; writer->json_objectstart("resourceUsage"); @@ -563,6 +564,7 @@ writer->json_objectend(); } writer->json_objectend(); +#endif #ifdef RUSAGE_THREAD struct rusage stats; if (getrusage(RUSAGE_THREAD, &stats) == 0) {