GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/node_process_methods.cc Lines: 258 271 95.2 %
Date: 2020-09-06 22:14:11 Branches: 68 102 66.7 %

Line Branch Exec Source
1
#include "base_object-inl.h"
2
#include "debug_utils-inl.h"
3
#include "env-inl.h"
4
#include "memory_tracker-inl.h"
5
#include "node.h"
6
#include "node_errors.h"
7
#include "node_external_reference.h"
8
#include "node_internals.h"
9
#include "node_process.h"
10
#include "util-inl.h"
11
#include "uv.h"
12
#include "v8-fast-api-calls.h"
13
#include "v8.h"
14
15
#include <vector>
16
17
#if HAVE_INSPECTOR
18
#include "inspector_io.h"
19
#endif
20
21
#include <climits>  // PATH_MAX
22
#include <cstdio>
23
24
#if defined(_MSC_VER)
25
#include <direct.h>
26
#include <io.h>
27
#define umask _umask
28
typedef int mode_t;
29
#else
30
#include <pthread.h>
31
#include <sys/resource.h>  // getrlimit, setrlimit
32
#include <termios.h>  // tcgetattr, tcsetattr
33
#endif
34
35
namespace node {
36
37
using v8::Array;
38
using v8::ArrayBuffer;
39
using v8::BackingStore;
40
using v8::Context;
41
using v8::Float64Array;
42
using v8::FunctionCallbackInfo;
43
using v8::HeapStatistics;
44
using v8::Integer;
45
using v8::Isolate;
46
using v8::Local;
47
using v8::NewStringType;
48
using v8::Number;
49
using v8::Object;
50
using v8::String;
51
using v8::Uint32;
52
using v8::Value;
53
54
namespace per_process {
55
4473
Mutex umask_mutex;
56
}   // namespace per_process
57
58
// Microseconds in a second, as a float, used in CPUUsage() below
59
#define MICROS_PER_SEC 1e6
60
// used in Hrtime() and Uptime() below
61
#define NANOS_PER_SEC 1000000000
62
63
static void Abort(const FunctionCallbackInfo<Value>& args) {
64
  Abort();
65
}
66
67
// For internal testing only, not exposed to userland.
68
static void CauseSegfault(const FunctionCallbackInfo<Value>& args) {
69
  // This should crash hard all platforms.
70
  volatile void** d = static_cast<volatile void**>(nullptr);
71
  *d = nullptr;
72
}
73
74
412
static void Chdir(const FunctionCallbackInfo<Value>& args) {
75
412
  Environment* env = Environment::GetCurrent(args);
76
412
  CHECK(env->owns_process_state());
77
78
412
  CHECK_EQ(args.Length(), 1);
79
1236
  CHECK(args[0]->IsString());
80
823
  Utf8Value path(env->isolate(), args[0]);
81
412
  int err = uv_chdir(*path);
82
412
  if (err) {
83
    // Also include the original working directory, since that will usually
84
    // be helpful information when debugging a `chdir()` failure.
85
    char buf[PATH_MAX_BYTES];
86
1
    size_t cwd_len = sizeof(buf);
87
1
    uv_cwd(buf, &cwd_len);
88
1
    return env->ThrowUVException(err, "chdir", nullptr, buf, *path);
89
  }
90
}
91
92
// CPUUsage use libuv's uv_getrusage() this-process resource usage accessor,
93
// to access ru_utime (user CPU time used) and ru_stime (system CPU time used),
94
// which are uv_timeval_t structs (long tv_sec, long tv_usec).
95
// Returns those values as Float64 microseconds in the elements of the array
96
// passed to the function.
97
33
static void CPUUsage(const FunctionCallbackInfo<Value>& args) {
98
  uv_rusage_t rusage;
99
100
  // Call libuv to get the values we'll return.
101
33
  int err = uv_getrusage(&rusage);
102
33
  if (err) {
103
    // On error, return the strerror version of the error code.
104
    Local<String> errmsg = OneByteString(args.GetIsolate(), uv_strerror(err));
105
    return args.GetReturnValue().Set(errmsg);
106
  }
107
108
  // Get the double array pointer from the Float64Array argument.
109
66
  CHECK(args[0]->IsFloat64Array());
110
66
  Local<Float64Array> array = args[0].As<Float64Array>();
111
33
  CHECK_EQ(array->Length(), 2);
112
33
  Local<ArrayBuffer> ab = array->Buffer();
113
33
  double* fields = static_cast<double*>(ab->GetBackingStore()->Data());
114
115
  // Set the Float64Array elements to be user / system values in microseconds.
116
33
  fields[0] = MICROS_PER_SEC * rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec;
117
33
  fields[1] = MICROS_PER_SEC * rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec;
118
}
119
120
5378
static void Cwd(const FunctionCallbackInfo<Value>& args) {
121
5378
  Environment* env = Environment::GetCurrent(args);
122
5378
  CHECK(env->has_run_bootstrapping_code());
123
  char buf[PATH_MAX_BYTES];
124
5378
  size_t cwd_len = sizeof(buf);
125
5378
  int err = uv_cwd(buf, &cwd_len);
126
5378
  if (err)
127
13
    return env->ThrowUVException(err, "uv_cwd");
128
129
10730
  Local<String> cwd = String::NewFromUtf8(env->isolate(),
130
                                          buf,
131
                                          NewStringType::kNormal,
132
10730
                                          cwd_len).ToLocalChecked();
133
10730
  args.GetReturnValue().Set(cwd);
134
}
135
136
59
static void Kill(const FunctionCallbackInfo<Value>& args) {
137
59
  Environment* env = Environment::GetCurrent(args);
138
59
  Local<Context> context = env->context();
139
140
59
  if (args.Length() != 2)
141
    return env->ThrowError("Bad argument.");
142
143
  int pid;
144
177
  if (!args[0]->Int32Value(context).To(&pid)) return;
145
  int sig;
146
177
  if (!args[1]->Int32Value(context).To(&sig)) return;
147
148
59
  uv_pid_t own_pid = uv_os_getpid();
149

175
  if (sig > 0 &&
150


142
      (pid == 0 || pid == -1 || pid == own_pid || pid == -own_pid) &&
151
27
      !HasSignalJSHandler(sig)) {
152
    // This is most likely going to terminate this process.
153
    // It's not an exact method but it might be close enough.
154
18
    RunAtExit(env);
155
  }
156
157
59
  int err = uv_kill(pid, sig);
158
118
  args.GetReturnValue().Set(err);
159
}
160
161
527
static void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
162
527
  Environment* env = Environment::GetCurrent(args);
163
164
  size_t rss;
165
527
  int err = uv_resident_set_memory(&rss);
166
527
  if (err)
167
    return env->ThrowUVException(err, "uv_resident_set_memory");
168
169
527
  Isolate* isolate = env->isolate();
170
  // V8 memory usage
171
527
  HeapStatistics v8_heap_stats;
172
527
  isolate->GetHeapStatistics(&v8_heap_stats);
173
174
  NodeArrayBufferAllocator* array_buffer_allocator =
175
527
      env->isolate_data()->node_allocator();
176
177
  // Get the double array pointer from the Float64Array argument.
178
1054
  CHECK(args[0]->IsFloat64Array());
179
1054
  Local<Float64Array> array = args[0].As<Float64Array>();
180
527
  CHECK_EQ(array->Length(), 5);
181
527
  Local<ArrayBuffer> ab = array->Buffer();
182
527
  double* fields = static_cast<double*>(ab->GetBackingStore()->Data());
183
184
527
  fields[0] = rss;
185
527
  fields[1] = v8_heap_stats.total_heap_size();
186
527
  fields[2] = v8_heap_stats.used_heap_size();
187
527
  fields[3] = v8_heap_stats.external_memory();
188
1054
  fields[4] = array_buffer_allocator == nullptr ?
189
527
      0 : array_buffer_allocator->total_mem_usage();
190
}
191
192
9
void RawDebug(const FunctionCallbackInfo<Value>& args) {
193


36
  CHECK(args.Length() == 1 && args[0]->IsString() &&
194
        "must be called with a single string");
195
18
  Utf8Value message(args.GetIsolate(), args[0]);
196
9
  FPrintF(stderr, "%s\n", message);
197
9
  fflush(stderr);
198
9
}
199
200
3881
static void Umask(const FunctionCallbackInfo<Value>& args) {
201
3881
  Environment* env = Environment::GetCurrent(args);
202
3881
  CHECK(env->has_run_bootstrapping_code());
203
3881
  CHECK_EQ(args.Length(), 1);
204

19043
  CHECK(args[0]->IsUndefined() || args[0]->IsUint32());
205
7762
  Mutex::ScopedLock scoped_lock(per_process::umask_mutex);
206
207
  uint32_t old;
208
11643
  if (args[0]->IsUndefined()) {
209
181
    if (env->emit_insecure_umask_warning()) {
210
5
      env->set_emit_insecure_umask_warning(false);
211
10
      if (ProcessEmitDeprecationWarning(
212
              env,
213
              "Calling process.umask() with no arguments is prone to race "
214
              "conditions and is a potential security vulnerability.",
215
              "DEP0139").IsNothing()) {
216
        return;
217
      }
218
    }
219
220
181
    old = umask(0);
221
181
    umask(static_cast<mode_t>(old));
222
  } else {
223
11100
    int oct = args[0].As<Uint32>()->Value();
224
3700
    old = umask(static_cast<mode_t>(oct));
225
  }
226
227
7762
  args.GetReturnValue().Set(old);
228
}
229
230
4
static void Uptime(const FunctionCallbackInfo<Value>& args) {
231
4
  Environment* env = Environment::GetCurrent(args);
232
233
4
  uv_update_time(env->event_loop());
234
  double uptime =
235
4
      static_cast<double>(uv_hrtime() - per_process::node_start_time);
236
4
  Local<Number> result = Number::New(env->isolate(), uptime / NANOS_PER_SEC);
237
8
  args.GetReturnValue().Set(result);
238
4
}
239
240
1
static void GetActiveRequests(const FunctionCallbackInfo<Value>& args) {
241
1
  Environment* env = Environment::GetCurrent(args);
242
243
2
  std::vector<Local<Value>> request_v;
244
13
  for (ReqWrapBase* req_wrap : *env->req_wrap_queue()) {
245
12
    AsyncWrap* w = req_wrap->GetAsyncWrap();
246
24
    if (w->persistent().IsEmpty())
247
      continue;
248
12
    request_v.emplace_back(w->GetOwner());
249
  }
250
251
3
  args.GetReturnValue().Set(
252
      Array::New(env->isolate(), request_v.data(), request_v.size()));
253
1
}
254
255
// Non-static, friend of HandleWrap. Could have been a HandleWrap method but
256
// implemented here for consistency with GetActiveRequests().
257
4
void GetActiveHandles(const FunctionCallbackInfo<Value>& args) {
258
4
  Environment* env = Environment::GetCurrent(args);
259
260
8
  std::vector<Local<Value>> handle_v;
261
24
  for (auto w : *env->handle_wrap_queue()) {
262
20
    if (!HandleWrap::HasRef(w))
263
1
      continue;
264
19
    handle_v.emplace_back(w->GetOwner());
265
  }
266
12
  args.GetReturnValue().Set(
267
      Array::New(env->isolate(), handle_v.data(), handle_v.size()));
268
4
}
269
270
1
static void ResourceUsage(const FunctionCallbackInfo<Value>& args) {
271
1
  Environment* env = Environment::GetCurrent(args);
272
273
  uv_rusage_t rusage;
274
1
  int err = uv_getrusage(&rusage);
275
1
  if (err)
276
    return env->ThrowUVException(err, "uv_getrusage");
277
278
2
  CHECK(args[0]->IsFloat64Array());
279
2
  Local<Float64Array> array = args[0].As<Float64Array>();
280
1
  CHECK_EQ(array->Length(), 16);
281
1
  Local<ArrayBuffer> ab = array->Buffer();
282
1
  double* fields = static_cast<double*>(ab->GetBackingStore()->Data());
283
284
1
  fields[0] = MICROS_PER_SEC * rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec;
285
1
  fields[1] = MICROS_PER_SEC * rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec;
286
1
  fields[2] = rusage.ru_maxrss;
287
1
  fields[3] = rusage.ru_ixrss;
288
1
  fields[4] = rusage.ru_idrss;
289
1
  fields[5] = rusage.ru_isrss;
290
1
  fields[6] = rusage.ru_minflt;
291
1
  fields[7] = rusage.ru_majflt;
292
1
  fields[8] = rusage.ru_nswap;
293
1
  fields[9] = rusage.ru_inblock;
294
1
  fields[10] = rusage.ru_oublock;
295
1
  fields[11] = rusage.ru_msgsnd;
296
1
  fields[12] = rusage.ru_msgrcv;
297
1
  fields[13] = rusage.ru_nsignals;
298
1
  fields[14] = rusage.ru_nvcsw;
299
1
  fields[15] = rusage.ru_nivcsw;
300
}
301
302
#ifdef __POSIX__
303
3
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
304
3
  Environment* env = Environment::GetCurrent(args);
305
306
3
  if (args.Length() != 1) {
307
    return env->ThrowError("Invalid number of arguments.");
308
  }
309
310
6
  CHECK(args[0]->IsNumber());
311
9
  pid_t pid = args[0].As<Integer>()->Value();
312
3
  int r = kill(pid, SIGUSR1);
313
314
3
  if (r != 0) {
315
1
    return env->ThrowErrnoException(errno, "kill");
316
  }
317
}
318
#endif  // __POSIX__
319
320
#ifdef _WIN32
321
static int GetDebugSignalHandlerMappingName(DWORD pid,
322
                                            wchar_t* buf,
323
                                            size_t buf_len) {
324
  return _snwprintf(buf, buf_len, L"node-debug-handler-%u", pid);
325
}
326
327
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
328
  Environment* env = Environment::GetCurrent(args);
329
  Isolate* isolate = args.GetIsolate();
330
331
  if (args.Length() != 1) {
332
    env->ThrowError("Invalid number of arguments.");
333
    return;
334
  }
335
336
  HANDLE process = nullptr;
337
  HANDLE thread = nullptr;
338
  HANDLE mapping = nullptr;
339
  wchar_t mapping_name[32];
340
  LPTHREAD_START_ROUTINE* handler = nullptr;
341
  DWORD pid = 0;
342
343
  auto cleanup = OnScopeLeave([&]() {
344
    if (process != nullptr) CloseHandle(process);
345
    if (thread != nullptr) CloseHandle(thread);
346
    if (handler != nullptr) UnmapViewOfFile(handler);
347
    if (mapping != nullptr) CloseHandle(mapping);
348
  });
349
350
  CHECK(args[0]->IsNumber());
351
  pid = args[0].As<Integer>()->Value();
352
353
  process =
354
      OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION |
355
                      PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ,
356
                  FALSE,
357
                  pid);
358
  if (process == nullptr) {
359
    isolate->ThrowException(
360
        WinapiErrnoException(isolate, GetLastError(), "OpenProcess"));
361
    return;
362
  }
363
364
  if (GetDebugSignalHandlerMappingName(
365
          pid, mapping_name, arraysize(mapping_name)) < 0) {
366
    env->ThrowErrnoException(errno, "sprintf");
367
    return;
368
  }
369
370
  mapping = OpenFileMappingW(FILE_MAP_READ, FALSE, mapping_name);
371
  if (mapping == nullptr) {
372
    isolate->ThrowException(
373
        WinapiErrnoException(isolate, GetLastError(), "OpenFileMappingW"));
374
    return;
375
  }
376
377
  handler = reinterpret_cast<LPTHREAD_START_ROUTINE*>(
378
      MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, sizeof *handler));
379
  if (handler == nullptr || *handler == nullptr) {
380
    isolate->ThrowException(
381
        WinapiErrnoException(isolate, GetLastError(), "MapViewOfFile"));
382
    return;
383
  }
384
385
  thread =
386
      CreateRemoteThread(process, nullptr, 0, *handler, nullptr, 0, nullptr);
387
  if (thread == nullptr) {
388
    isolate->ThrowException(
389
        WinapiErrnoException(isolate, GetLastError(), "CreateRemoteThread"));
390
    return;
391
  }
392
393
  // Wait for the thread to terminate
394
  if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) {
395
    isolate->ThrowException(
396
        WinapiErrnoException(isolate, GetLastError(), "WaitForSingleObject"));
397
    return;
398
  }
399
}
400
#endif  // _WIN32
401
402
5
static void DebugEnd(const FunctionCallbackInfo<Value>& args) {
403
#if HAVE_INSPECTOR
404
5
  Environment* env = Environment::GetCurrent(args);
405
5
  if (env->inspector_agent()->IsListening()) {
406
4
    env->inspector_agent()->Stop();
407
  }
408
#endif
409
5
}
410
411
320
static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
412
320
  Environment* env = Environment::GetCurrent(args);
413
320
  RunAtExit(env);
414
1280
  int code = args[0]->Int32Value(env->context()).FromMaybe(0);
415
320
  env->Exit(code);
416
53
}
417
418
13074
class FastHrtime : public BaseObject {
419
 public:
420
4827
  static Local<Object> New(Environment* env) {
421
    Local<v8::FunctionTemplate> ctor =
422
4827
        v8::FunctionTemplate::New(env->isolate());
423
9654
    ctor->Inherit(BaseObject::GetConstructorTemplate(env));
424
4827
    Local<v8::ObjectTemplate> otmpl = ctor->InstanceTemplate();
425
4827
    otmpl->SetInternalFieldCount(FastHrtime::kInternalFieldCount);
426
427
19308
    auto create_func = [env](auto fast_func, auto slow_func) {
428
9654
      auto cfunc = v8::CFunction::Make(fast_func);
429
19308
      return v8::FunctionTemplate::New(env->isolate(),
430
                                       slow_func,
431
                                       Local<Value>(),
432
                                       Local<v8::Signature>(),
433
                                       0,
434
                                       v8::ConstructorBehavior::kThrow,
435
                                       v8::SideEffectType::kHasNoSideEffect,
436
19308
                                       &cfunc);
437
4827
    };
438
439
19308
    otmpl->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "hrtime"),
440
4827
               create_func(FastNumber, SlowNumber));
441
19308
    otmpl->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "hrtimeBigInt"),
442
4827
               create_func(FastBigInt, SlowBigInt));
443
444
14481
    Local<Object> obj = otmpl->NewInstance(env->context()).ToLocalChecked();
445
446
    Local<ArrayBuffer> ab =
447
        ArrayBuffer::New(env->isolate(),
448
4827
            std::max(sizeof(uint64_t), sizeof(uint32_t) * 3));
449
4827
    new FastHrtime(env, obj, ab);
450
9654
    obj->Set(
451
19308
           env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "buffer"), ab)
452
        .ToChecked();
453
454
4827
    return obj;
455
  }
456
457
 private:
458
4827
  FastHrtime(Environment* env,
459
             Local<Object> object,
460
             Local<ArrayBuffer> ab)
461
4827
      : BaseObject(env, object),
462
        array_buffer_(env->isolate(), ab),
463
9654
        backing_store_(ab->GetBackingStore()) {
464
4827
    MakeWeak();
465
4827
  }
466
467
19
  void MemoryInfo(MemoryTracker* tracker) const override {
468
19
    tracker->TrackField("array_buffer", array_buffer_);
469
19
  }
470
19
  SET_MEMORY_INFO_NAME(FastHrtime)
471
19
  SET_SELF_SIZE(FastHrtime)
472
473
  // This is the legacy version of hrtime before BigInt was introduced in
474
  // JavaScript.
475
  // The value returned by uv_hrtime() is a 64-bit int representing nanoseconds,
476
  // so this function instead fills in an Uint32Array with 3 entries,
477
  // to avoid any integer overflow possibility.
478
  // The first two entries contain the second part of the value
479
  // broken into the upper/lower 32 bits to be converted back in JS,
480
  // because there is no Uint64Array in JS.
481
  // The third entry contains the remaining nanosecond part of the value.
482
127654
  static void FastNumber(FastHrtime* receiver) {
483
127654
    uint64_t t = uv_hrtime();
484
127654
    uint32_t* fields = static_cast<uint32_t*>(receiver->backing_store_->Data());
485
127654
    fields[0] = (t / NANOS_PER_SEC) >> 32;
486
127654
    fields[1] = (t / NANOS_PER_SEC) & 0xffffffff;
487
127654
    fields[2] = t % NANOS_PER_SEC;
488
127654
  }
489
490
127654
  static void SlowNumber(const FunctionCallbackInfo<Value>& args) {
491
127654
    FastNumber(FromJSObject<FastHrtime>(args.Holder()));
492
127654
  }
493
494
761961
  static void FastBigInt(FastHrtime* receiver) {
495
761961
    uint64_t t = uv_hrtime();
496
761961
    uint64_t* fields = static_cast<uint64_t*>(receiver->backing_store_->Data());
497
761961
    fields[0] = t;
498
761961
  }
499
500
761961
  static void SlowBigInt(const FunctionCallbackInfo<Value>& args) {
501
761961
    FastBigInt(FromJSObject<FastHrtime>(args.Holder()));
502
761961
  }
503
504
  v8::Global<ArrayBuffer> array_buffer_;
505
  std::shared_ptr<BackingStore> backing_store_;
506
};
507
508
4827
static void GetFastAPIs(const FunctionCallbackInfo<Value>& args) {
509
4827
  Environment* env = Environment::GetCurrent(args);
510
4827
  Local<Object> ret = Object::New(env->isolate());
511
9654
  ret->Set(env->context(),
512
           FIXED_ONE_BYTE_STRING(env->isolate(), "hrtime"),
513
24135
           FastHrtime::New(env))
514
      .ToChecked();
515
9654
  args.GetReturnValue().Set(ret);
516
4827
}
517
518
453
static void InitializeProcessMethods(Local<Object> target,
519
                                     Local<Value> unused,
520
                                     Local<Context> context,
521
                                     void* priv) {
522
453
  Environment* env = Environment::GetCurrent(context);
523
524
  // define various internal methods
525
453
  if (env->owns_process_state()) {
526
41
    env->SetMethod(target, "_debugProcess", DebugProcess);
527
41
    env->SetMethod(target, "_debugEnd", DebugEnd);
528
41
    env->SetMethod(target, "abort", Abort);
529
41
    env->SetMethod(target, "causeSegfault", CauseSegfault);
530
41
    env->SetMethod(target, "chdir", Chdir);
531
  }
532
533
453
  env->SetMethod(target, "umask", Umask);
534
453
  env->SetMethod(target, "_rawDebug", RawDebug);
535
453
  env->SetMethod(target, "memoryUsage", MemoryUsage);
536
453
  env->SetMethod(target, "cpuUsage", CPUUsage);
537
453
  env->SetMethod(target, "resourceUsage", ResourceUsage);
538
539
453
  env->SetMethod(target, "_getActiveRequests", GetActiveRequests);
540
453
  env->SetMethod(target, "_getActiveHandles", GetActiveHandles);
541
453
  env->SetMethod(target, "_kill", Kill);
542
543
453
  env->SetMethodNoSideEffect(target, "cwd", Cwd);
544
453
  env->SetMethod(target, "dlopen", binding::DLOpen);
545
453
  env->SetMethod(target, "reallyExit", ReallyExit);
546
453
  env->SetMethodNoSideEffect(target, "uptime", Uptime);
547
453
  env->SetMethod(target, "patchProcessObject", PatchProcessObject);
548
453
  env->SetMethod(target, "getFastAPIs", GetFastAPIs);
549
453
}
550
551
4403
void RegisterProcessMethodsExternalReferences(
552
    ExternalReferenceRegistry* registry) {
553
4403
  registry->Register(DebugProcess);
554
4403
  registry->Register(DebugEnd);
555
4403
  registry->Register(Abort);
556
4403
  registry->Register(CauseSegfault);
557
4403
  registry->Register(Chdir);
558
559
4403
  registry->Register(Umask);
560
4403
  registry->Register(RawDebug);
561
4403
  registry->Register(MemoryUsage);
562
4403
  registry->Register(CPUUsage);
563
4403
  registry->Register(ResourceUsage);
564
565
4403
  registry->Register(GetActiveRequests);
566
4403
  registry->Register(GetActiveHandles);
567
4403
  registry->Register(Kill);
568
569
4403
  registry->Register(Cwd);
570
4403
  registry->Register(binding::DLOpen);
571
4403
  registry->Register(ReallyExit);
572
4403
  registry->Register(Uptime);
573
4403
  registry->Register(PatchProcessObject);
574
4403
  registry->Register(GetFastAPIs);
575
4403
}
576
577
}  // namespace node
578
579
namespace v8 {
580
template <>
581
class WrapperTraits<node::FastHrtime> {
582
 public:
583
4411
  static const void* GetTypeInfo() {
584
    static const int tag = 0;
585
4411
    return reinterpret_cast<const void*>(&tag);
586
  }
587
};
588
}  // namespace v8
589
590
4472
NODE_MODULE_CONTEXT_AWARE_INTERNAL(process_methods,
591
                                   node::InitializeProcessMethods)
592

17822
NODE_MODULE_EXTERNAL_REFERENCE(process_methods,
593
                               node::RegisterProcessMethodsExternalReferences)