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: 251 269 93.3 %
Date: 2020-12-12 04:11:07 Branches: 60 88 68.2 %

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::ApiObject;
38
using v8::Array;
39
using v8::ArrayBuffer;
40
using v8::BackingStore;
41
using v8::CFunction;
42
using v8::ConstructorBehavior;
43
using v8::Context;
44
using v8::Float64Array;
45
using v8::FunctionCallbackInfo;
46
using v8::FunctionTemplate;
47
using v8::Global;
48
using v8::HeapStatistics;
49
using v8::Integer;
50
using v8::Isolate;
51
using v8::Local;
52
using v8::NewStringType;
53
using v8::Number;
54
using v8::Object;
55
using v8::ObjectTemplate;
56
using v8::SideEffectType;
57
using v8::Signature;
58
using v8::String;
59
using v8::Uint32;
60
using v8::Value;
61
62
namespace per_process {
63
4691
Mutex umask_mutex;
64
}   // namespace per_process
65
66
// Microseconds in a second, as a float, used in CPUUsage() below
67
#define MICROS_PER_SEC 1e6
68
// used in Hrtime() and Uptime() below
69
#define NANOS_PER_SEC 1000000000
70
71
static void Abort(const FunctionCallbackInfo<Value>& args) {
72
  Abort();
73
}
74
75
// For internal testing only, not exposed to userland.
76
static void CauseSegfault(const FunctionCallbackInfo<Value>& args) {
77
  // This should crash hard all platforms.
78
  volatile void** d = static_cast<volatile void**>(nullptr);
79
  *d = nullptr;
80
}
81
82
431
static void Chdir(const FunctionCallbackInfo<Value>& args) {
83
431
  Environment* env = Environment::GetCurrent(args);
84
431
  CHECK(env->owns_process_state());
85
86
431
  CHECK_EQ(args.Length(), 1);
87
1293
  CHECK(args[0]->IsString());
88
861
  Utf8Value path(env->isolate(), args[0]);
89
431
  int err = uv_chdir(*path);
90
431
  if (err) {
91
    // Also include the original working directory, since that will usually
92
    // be helpful information when debugging a `chdir()` failure.
93
    char buf[PATH_MAX_BYTES];
94
1
    size_t cwd_len = sizeof(buf);
95
1
    uv_cwd(buf, &cwd_len);
96
1
    return env->ThrowUVException(err, "chdir", nullptr, buf, *path);
97
  }
98
}
99
100
561
inline Local<ArrayBuffer> get_fields_array_buffer(
101
    const FunctionCallbackInfo<Value>& args,
102
    size_t index,
103
    size_t array_length) {
104
1683
  CHECK(args[index]->IsFloat64Array());
105
1683
  Local<Float64Array> arr = args[index].As<Float64Array>();
106
561
  CHECK_EQ(arr->Length(), array_length);
107
561
  return arr->Buffer();
108
}
109
110
// CPUUsage use libuv's uv_getrusage() this-process resource usage accessor,
111
// to access ru_utime (user CPU time used) and ru_stime (system CPU time used),
112
// which are uv_timeval_t structs (long tv_sec, long tv_usec).
113
// Returns those values as Float64 microseconds in the elements of the array
114
// passed to the function.
115
33
static void CPUUsage(const FunctionCallbackInfo<Value>& args) {
116
33
  Environment* env = Environment::GetCurrent(args);
117
  uv_rusage_t rusage;
118
119
  // Call libuv to get the values we'll return.
120
33
  int err = uv_getrusage(&rusage);
121
33
  if (err)
122
    return env->ThrowUVException(err, "uv_getrusage");
123
124
  // Get the double array pointer from the Float64Array argument.
125
33
  Local<ArrayBuffer> ab = get_fields_array_buffer(args, 0, 2);
126
33
  double* fields = static_cast<double*>(ab->GetBackingStore()->Data());
127
128
  // Set the Float64Array elements to be user / system values in microseconds.
129
33
  fields[0] = MICROS_PER_SEC * rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec;
130
33
  fields[1] = MICROS_PER_SEC * rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec;
131
}
132
133
5554
static void Cwd(const FunctionCallbackInfo<Value>& args) {
134
5554
  Environment* env = Environment::GetCurrent(args);
135
5554
  CHECK(env->has_run_bootstrapping_code());
136
  char buf[PATH_MAX_BYTES];
137
5554
  size_t cwd_len = sizeof(buf);
138
5554
  int err = uv_cwd(buf, &cwd_len);
139
5554
  if (err)
140
13
    return env->ThrowUVException(err, "uv_cwd");
141
142
11082
  Local<String> cwd = String::NewFromUtf8(env->isolate(),
143
                                          buf,
144
                                          NewStringType::kNormal,
145
11082
                                          cwd_len).ToLocalChecked();
146
11082
  args.GetReturnValue().Set(cwd);
147
}
148
149
62
static void Kill(const FunctionCallbackInfo<Value>& args) {
150
62
  Environment* env = Environment::GetCurrent(args);
151
62
  Local<Context> context = env->context();
152
153
62
  if (args.Length() < 2) {
154
    THROW_ERR_MISSING_ARGS(env, "Bad argument.");
155
  }
156
157
  int pid;
158
186
  if (!args[0]->Int32Value(context).To(&pid)) return;
159
  int sig;
160
186
  if (!args[1]->Int32Value(context).To(&sig)) return;
161
162
62
  uv_pid_t own_pid = uv_os_getpid();
163

184
  if (sig > 0 &&
164


149
      (pid == 0 || pid == -1 || pid == own_pid || pid == -own_pid) &&
165
28
      !HasSignalJSHandler(sig)) {
166
    // This is most likely going to terminate this process.
167
    // It's not an exact method but it might be close enough.
168
19
    RunAtExit(env);
169
  }
170
171
62
  int err = uv_kill(pid, sig);
172
124
  args.GetReturnValue().Set(err);
173
}
174
175
527
static void MemoryUsage(const FunctionCallbackInfo<Value>& args) {
176
527
  Environment* env = Environment::GetCurrent(args);
177
178
  size_t rss;
179
527
  int err = uv_resident_set_memory(&rss);
180
527
  if (err)
181
    return env->ThrowUVException(err, "uv_resident_set_memory");
182
183
527
  Isolate* isolate = env->isolate();
184
  // V8 memory usage
185
527
  HeapStatistics v8_heap_stats;
186
527
  isolate->GetHeapStatistics(&v8_heap_stats);
187
188
  NodeArrayBufferAllocator* array_buffer_allocator =
189
527
      env->isolate_data()->node_allocator();
190
191
  // Get the double array pointer from the Float64Array argument.
192
527
  Local<ArrayBuffer> ab = get_fields_array_buffer(args, 0, 5);
193
527
  double* fields = static_cast<double*>(ab->GetBackingStore()->Data());
194
195
527
  fields[0] = rss;
196
527
  fields[1] = v8_heap_stats.total_heap_size();
197
527
  fields[2] = v8_heap_stats.used_heap_size();
198
527
  fields[3] = v8_heap_stats.external_memory();
199
1054
  fields[4] = array_buffer_allocator == nullptr ?
200
527
      0 : array_buffer_allocator->total_mem_usage();
201
}
202
203
12
void RawDebug(const FunctionCallbackInfo<Value>& args) {
204


48
  CHECK(args.Length() == 1 && args[0]->IsString() &&
205
        "must be called with a single string");
206
24
  Utf8Value message(args.GetIsolate(), args[0]);
207
12
  FPrintF(stderr, "%s\n", message);
208
12
  fflush(stderr);
209
12
}
210
211
4064
static void Umask(const FunctionCallbackInfo<Value>& args) {
212
4064
  Environment* env = Environment::GetCurrent(args);
213
4064
  CHECK(env->has_run_bootstrapping_code());
214
4064
  CHECK_EQ(args.Length(), 1);
215

19980
  CHECK(args[0]->IsUndefined() || args[0]->IsUint32());
216
8128
  Mutex::ScopedLock scoped_lock(per_process::umask_mutex);
217
218
  uint32_t old;
219
12192
  if (args[0]->IsUndefined()) {
220
170
    old = umask(0);
221
170
    umask(static_cast<mode_t>(old));
222
  } else {
223
11682
    int oct = args[0].As<Uint32>()->Value();
224
3894
    old = umask(static_cast<mode_t>(oct));
225
  }
226
227
8128
  args.GetReturnValue().Set(old);
228
4064
}
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
1
  Local<ArrayBuffer> ab = get_fields_array_buffer(args, 0, 16);
279
1
  double* fields = static_cast<double*>(ab->GetBackingStore()->Data());
280
281
1
  fields[0] = MICROS_PER_SEC * rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec;
282
1
  fields[1] = MICROS_PER_SEC * rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec;
283
1
  fields[2] = rusage.ru_maxrss;
284
1
  fields[3] = rusage.ru_ixrss;
285
1
  fields[4] = rusage.ru_idrss;
286
1
  fields[5] = rusage.ru_isrss;
287
1
  fields[6] = rusage.ru_minflt;
288
1
  fields[7] = rusage.ru_majflt;
289
1
  fields[8] = rusage.ru_nswap;
290
1
  fields[9] = rusage.ru_inblock;
291
1
  fields[10] = rusage.ru_oublock;
292
1
  fields[11] = rusage.ru_msgsnd;
293
1
  fields[12] = rusage.ru_msgrcv;
294
1
  fields[13] = rusage.ru_nsignals;
295
1
  fields[14] = rusage.ru_nvcsw;
296
1
  fields[15] = rusage.ru_nivcsw;
297
}
298
299
#ifdef __POSIX__
300
3
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
301
3
  Environment* env = Environment::GetCurrent(args);
302
303
3
  if (args.Length() < 1) {
304
    return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments.");
305
  }
306
307
6
  CHECK(args[0]->IsNumber());
308
9
  pid_t pid = args[0].As<Integer>()->Value();
309
3
  int r = kill(pid, SIGUSR1);
310
311
3
  if (r != 0) {
312
1
    return env->ThrowErrnoException(errno, "kill");
313
  }
314
}
315
#endif  // __POSIX__
316
317
#ifdef _WIN32
318
static int GetDebugSignalHandlerMappingName(DWORD pid,
319
                                            wchar_t* buf,
320
                                            size_t buf_len) {
321
  return _snwprintf(buf, buf_len, L"node-debug-handler-%u", pid);
322
}
323
324
static void DebugProcess(const FunctionCallbackInfo<Value>& args) {
325
  Environment* env = Environment::GetCurrent(args);
326
  Isolate* isolate = args.GetIsolate();
327
328
  if (args.Length() < 1) {
329
    return THROW_ERR_MISSING_ARGS(env, "Invalid number of arguments.");
330
  }
331
332
  HANDLE process = nullptr;
333
  HANDLE thread = nullptr;
334
  HANDLE mapping = nullptr;
335
  wchar_t mapping_name[32];
336
  LPTHREAD_START_ROUTINE* handler = nullptr;
337
  DWORD pid = 0;
338
339
  auto cleanup = OnScopeLeave([&]() {
340
    if (process != nullptr) CloseHandle(process);
341
    if (thread != nullptr) CloseHandle(thread);
342
    if (handler != nullptr) UnmapViewOfFile(handler);
343
    if (mapping != nullptr) CloseHandle(mapping);
344
  });
345
346
  CHECK(args[0]->IsNumber());
347
  pid = args[0].As<Integer>()->Value();
348
349
  process =
350
      OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION |
351
                      PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ,
352
                  FALSE,
353
                  pid);
354
  if (process == nullptr) {
355
    isolate->ThrowException(
356
        WinapiErrnoException(isolate, GetLastError(), "OpenProcess"));
357
    return;
358
  }
359
360
  if (GetDebugSignalHandlerMappingName(
361
          pid, mapping_name, arraysize(mapping_name)) < 0) {
362
    env->ThrowErrnoException(errno, "sprintf");
363
    return;
364
  }
365
366
  mapping = OpenFileMappingW(FILE_MAP_READ, FALSE, mapping_name);
367
  if (mapping == nullptr) {
368
    isolate->ThrowException(
369
        WinapiErrnoException(isolate, GetLastError(), "OpenFileMappingW"));
370
    return;
371
  }
372
373
  handler = reinterpret_cast<LPTHREAD_START_ROUTINE*>(
374
      MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, sizeof *handler));
375
  if (handler == nullptr || *handler == nullptr) {
376
    isolate->ThrowException(
377
        WinapiErrnoException(isolate, GetLastError(), "MapViewOfFile"));
378
    return;
379
  }
380
381
  thread =
382
      CreateRemoteThread(process, nullptr, 0, *handler, nullptr, 0, nullptr);
383
  if (thread == nullptr) {
384
    isolate->ThrowException(
385
        WinapiErrnoException(isolate, GetLastError(), "CreateRemoteThread"));
386
    return;
387
  }
388
389
  // Wait for the thread to terminate
390
  if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) {
391
    isolate->ThrowException(
392
        WinapiErrnoException(isolate, GetLastError(), "WaitForSingleObject"));
393
    return;
394
  }
395
}
396
#endif  // _WIN32
397
398
5
static void DebugEnd(const FunctionCallbackInfo<Value>& args) {
399
#if HAVE_INSPECTOR
400
5
  Environment* env = Environment::GetCurrent(args);
401
5
  if (env->inspector_agent()->IsListening()) {
402
4
    env->inspector_agent()->Stop();
403
  }
404
#endif
405
5
}
406
407
314
static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
408
314
  Environment* env = Environment::GetCurrent(args);
409
314
  RunAtExit(env);
410
1256
  int code = args[0]->Int32Value(env->context()).FromMaybe(0);
411
314
  env->Exit(code);
412
54
}
413
414
13633
class FastHrtime : public BaseObject {
415
 public:
416
5017
  static Local<Object> New(Environment* env) {
417
5017
    Local<FunctionTemplate> ctor = FunctionTemplate::New(env->isolate());
418
10034
    ctor->Inherit(BaseObject::GetConstructorTemplate(env));
419
5017
    Local<ObjectTemplate> otmpl = ctor->InstanceTemplate();
420
5017
    otmpl->SetInternalFieldCount(FastHrtime::kInternalFieldCount);
421
422
20068
    auto create_func = [env](auto fast_func, auto slow_func) {
423
10034
      auto cfunc = CFunction::Make(fast_func);
424
20068
      return FunctionTemplate::New(env->isolate(),
425
                                   slow_func,
426
                                   Local<Value>(),
427
                                   Local<Signature>(),
428
                                   0,
429
                                   ConstructorBehavior::kThrow,
430
                                   SideEffectType::kHasNoSideEffect,
431
20068
                                   &cfunc);
432
5017
    };
433
434
20068
    otmpl->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "hrtime"),
435
5017
               create_func(FastNumber, SlowNumber));
436
20068
    otmpl->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "hrtimeBigInt"),
437
5017
               create_func(FastBigInt, SlowBigInt));
438
439
15051
    Local<Object> obj = otmpl->NewInstance(env->context()).ToLocalChecked();
440
441
    Local<ArrayBuffer> ab =
442
        ArrayBuffer::New(env->isolate(),
443
5017
            std::max(sizeof(uint64_t), sizeof(uint32_t) * 3));
444
5017
    new FastHrtime(env, obj, ab);
445
10034
    obj->Set(
446
20068
           env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "buffer"), ab)
447
        .ToChecked();
448
449
5017
    return obj;
450
  }
451
452
 private:
453
5017
  FastHrtime(Environment* env,
454
             Local<Object> object,
455
             Local<ArrayBuffer> ab)
456
5017
      : BaseObject(env, object),
457
        array_buffer_(env->isolate(), ab),
458
10034
        backing_store_(ab->GetBackingStore()) {
459
5017
    MakeWeak();
460
5017
  }
461
462
22
  void MemoryInfo(MemoryTracker* tracker) const override {
463
22
    tracker->TrackField("array_buffer", array_buffer_);
464
22
  }
465
22
  SET_MEMORY_INFO_NAME(FastHrtime)
466
22
  SET_SELF_SIZE(FastHrtime)
467
468
  static FastHrtime* FromV8ApiObject(ApiObject api_object) {
469
    Object* v8_object = reinterpret_cast<Object*>(&api_object);
470
    return static_cast<FastHrtime*>(
471
        v8_object->GetAlignedPointerFromInternalField(BaseObject::kSlot));
472
  }
473
474
  // This is the legacy version of hrtime before BigInt was introduced in
475
  // JavaScript.
476
  // The value returned by uv_hrtime() is a 64-bit int representing nanoseconds,
477
  // so this function instead fills in an Uint32Array with 3 entries,
478
  // to avoid any integer overflow possibility.
479
  // The first two entries contain the second part of the value
480
  // broken into the upper/lower 32 bits to be converted back in JS,
481
  // because there is no Uint64Array in JS.
482
  // The third entry contains the remaining nanosecond part of the value.
483
259703
  static void NumberImpl(FastHrtime* receiver) {
484
259703
    uint64_t t = uv_hrtime();
485
259703
    uint32_t* fields = static_cast<uint32_t*>(receiver->backing_store_->Data());
486
259703
    fields[0] = (t / NANOS_PER_SEC) >> 32;
487
259703
    fields[1] = (t / NANOS_PER_SEC) & 0xffffffff;
488
259703
    fields[2] = t % NANOS_PER_SEC;
489
259703
  }
490
491
  static void FastNumber(ApiObject receiver) {
492
    NumberImpl(FromV8ApiObject(receiver));
493
  }
494
495
259703
  static void SlowNumber(const FunctionCallbackInfo<Value>& args) {
496
259703
    NumberImpl(FromJSObject<FastHrtime>(args.Holder()));
497
259703
  }
498
499
346558
  static void BigIntImpl(FastHrtime* receiver) {
500
346558
    uint64_t t = uv_hrtime();
501
346558
    uint64_t* fields = static_cast<uint64_t*>(receiver->backing_store_->Data());
502
346558
    fields[0] = t;
503
346558
  }
504
505
  static void FastBigInt(ApiObject receiver) {
506
    BigIntImpl(FromV8ApiObject(receiver));
507
  }
508
509
346558
  static void SlowBigInt(const FunctionCallbackInfo<Value>& args) {
510
346558
    BigIntImpl(FromJSObject<FastHrtime>(args.Holder()));
511
346558
  }
512
513
  Global<ArrayBuffer> array_buffer_;
514
  std::shared_ptr<BackingStore> backing_store_;
515
};
516
517
5017
static void GetFastAPIs(const FunctionCallbackInfo<Value>& args) {
518
5017
  Environment* env = Environment::GetCurrent(args);
519
5017
  Local<Object> ret = Object::New(env->isolate());
520
10034
  ret->Set(env->context(),
521
           FIXED_ONE_BYTE_STRING(env->isolate(), "hrtime"),
522
25085
           FastHrtime::New(env))
523
      .ToChecked();
524
10034
  args.GetReturnValue().Set(ret);
525
5017
}
526
527
444
static void InitializeProcessMethods(Local<Object> target,
528
                                     Local<Value> unused,
529
                                     Local<Context> context,
530
                                     void* priv) {
531
444
  Environment* env = Environment::GetCurrent(context);
532
533
  // define various internal methods
534
444
  if (env->owns_process_state()) {
535
50
    env->SetMethod(target, "_debugProcess", DebugProcess);
536
50
    env->SetMethod(target, "_debugEnd", DebugEnd);
537
50
    env->SetMethod(target, "abort", Abort);
538
50
    env->SetMethod(target, "causeSegfault", CauseSegfault);
539
50
    env->SetMethod(target, "chdir", Chdir);
540
  }
541
542
444
  env->SetMethod(target, "umask", Umask);
543
444
  env->SetMethod(target, "_rawDebug", RawDebug);
544
444
  env->SetMethod(target, "memoryUsage", MemoryUsage);
545
444
  env->SetMethod(target, "cpuUsage", CPUUsage);
546
444
  env->SetMethod(target, "resourceUsage", ResourceUsage);
547
548
444
  env->SetMethod(target, "_getActiveRequests", GetActiveRequests);
549
444
  env->SetMethod(target, "_getActiveHandles", GetActiveHandles);
550
444
  env->SetMethod(target, "_kill", Kill);
551
552
444
  env->SetMethodNoSideEffect(target, "cwd", Cwd);
553
444
  env->SetMethod(target, "dlopen", binding::DLOpen);
554
444
  env->SetMethod(target, "reallyExit", ReallyExit);
555
444
  env->SetMethodNoSideEffect(target, "uptime", Uptime);
556
444
  env->SetMethod(target, "patchProcessObject", PatchProcessObject);
557
444
  env->SetMethod(target, "getFastAPIs", GetFastAPIs);
558
444
}
559
560
4614
void RegisterProcessMethodsExternalReferences(
561
    ExternalReferenceRegistry* registry) {
562
4614
  registry->Register(DebugProcess);
563
4614
  registry->Register(DebugEnd);
564
4614
  registry->Register(Abort);
565
4614
  registry->Register(CauseSegfault);
566
4614
  registry->Register(Chdir);
567
568
4614
  registry->Register(Umask);
569
4614
  registry->Register(RawDebug);
570
4614
  registry->Register(MemoryUsage);
571
4614
  registry->Register(CPUUsage);
572
4614
  registry->Register(ResourceUsage);
573
574
4614
  registry->Register(GetActiveRequests);
575
4614
  registry->Register(GetActiveHandles);
576
4614
  registry->Register(Kill);
577
578
4614
  registry->Register(Cwd);
579
4614
  registry->Register(binding::DLOpen);
580
4614
  registry->Register(ReallyExit);
581
4614
  registry->Register(Uptime);
582
4614
  registry->Register(PatchProcessObject);
583
4614
  registry->Register(GetFastAPIs);
584
4614
}
585
586
}  // namespace node
587
588
4683
NODE_MODULE_CONTEXT_AWARE_INTERNAL(process_methods,
589
                                   node::InitializeProcessMethods)
590

18687
NODE_MODULE_EXTERNAL_REFERENCE(process_methods,
591
                               node::RegisterProcessMethodsExternalReferences)