GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/node_internals.h Lines: 76 154 49.4 %
Date: 2019-01-07 12:15:22 Branches: 35 123 28.5 %

Line Branch Exec Source
1
// Copyright Joyent, Inc. and other Node contributors.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a
4
// copy of this software and associated documentation files (the
5
// "Software"), to deal in the Software without restriction, including
6
// without limitation the rights to use, copy, modify, merge, publish,
7
// distribute, sublicense, and/or sell copies of the Software, and to permit
8
// persons to whom the Software is furnished to do so, subject to the
9
// following conditions:
10
//
11
// The above copyright notice and this permission notice shall be included
12
// in all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22
#ifndef SRC_NODE_INTERNALS_H_
23
#define SRC_NODE_INTERNALS_H_
24
25
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
27
#include "env-inl.h"
28
#include "node.h"
29
#include "node_binding.h"
30
#include "node_mutex.h"
31
#include "node_persistent.h"
32
#include "tracing/trace_event.h"
33
#include "util-inl.h"
34
#include "uv.h"
35
#include "v8.h"
36
37
#include <stdint.h>
38
#include <stdlib.h>
39
40
#include <string>
41
#include <vector>
42
43
// Custom constants used by both node_constants.cc and node_zlib.cc
44
#define Z_MIN_WINDOWBITS 8
45
#define Z_MAX_WINDOWBITS 15
46
#define Z_DEFAULT_WINDOWBITS 15
47
// Fewer than 64 bytes per chunk is not recommended.
48
// Technically it could work with as few as 8, but even 64 bytes
49
// is low.  Usually a MB or more is best.
50
#define Z_MIN_CHUNK 64
51
#define Z_MAX_CHUNK std::numeric_limits<double>::infinity()
52
#define Z_DEFAULT_CHUNK (16 * 1024)
53
#define Z_MIN_MEMLEVEL 1
54
#define Z_MAX_MEMLEVEL 9
55
#define Z_DEFAULT_MEMLEVEL 8
56
#define Z_MIN_LEVEL -1
57
#define Z_MAX_LEVEL 9
58
#define Z_DEFAULT_LEVEL Z_DEFAULT_COMPRESSION
59
60
struct sockaddr;
61
62
// Variation on NODE_DEFINE_CONSTANT that sets a String value.
63
#define NODE_DEFINE_STRING_CONSTANT(target, name, constant)                   \
64
  do {                                                                        \
65
    v8::Isolate* isolate = target->GetIsolate();                              \
66
    v8::Local<v8::String> constant_name =                                     \
67
        v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal)    \
68
            .ToLocalChecked();                                                \
69
    v8::Local<v8::String> constant_value =                                    \
70
        v8::String::NewFromUtf8(isolate, constant, v8::NewStringType::kNormal)\
71
            .ToLocalChecked();                                                \
72
    v8::PropertyAttribute constant_attributes =                               \
73
        static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete);    \
74
    target->DefineOwnProperty(isolate->GetCurrentContext(),                   \
75
                              constant_name,                                  \
76
                              constant_value,                                 \
77
                              constant_attributes).FromJust();                \
78
  } while (0)
79
80
namespace node {
81
82
namespace native_module {
83
class NativeModuleLoader;
84
}
85
86
extern Mutex process_mutex;
87
extern Mutex environ_mutex;
88
89
// Tells whether it is safe to call v8::Isolate::GetCurrent().
90
extern bool v8_initialized;
91
92
extern Mutex per_process_opts_mutex;
93
extern std::shared_ptr<PerProcessOptions> per_process_opts;
94
95
// Forward declaration
96
class Environment;
97
98
// Convert a struct sockaddr to a { address: '1.2.3.4', port: 1234 } JS object.
99
// Sets address and port properties on the info object and returns it.
100
// If |info| is omitted, a new object is returned.
101
v8::Local<v8::Object> AddressToJS(
102
    Environment* env,
103
    const sockaddr* addr,
104
    v8::Local<v8::Object> info = v8::Local<v8::Object>());
105
106
template <typename T, int (*F)(const typename T::HandleType*, sockaddr*, int*)>
107
3461
void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
108
  T* wrap;
109

6922
  ASSIGN_OR_RETURN_UNWRAP(&wrap,
110
                          args.Holder(),
111
                          args.GetReturnValue().Set(UV_EBADF));
112

6922
  CHECK(args[0]->IsObject());
113
  sockaddr_storage storage;
114
3461
  int addrlen = sizeof(storage);
115
3461
  sockaddr* const addr = reinterpret_cast<sockaddr*>(&storage);
116
3461
  const int err = F(&wrap->handle_, addr, &addrlen);
117

3461
  if (err == 0)
118
6912
    AddressToJS(wrap->env(), addr, args[0].As<v8::Object>());
119
6922
  args.GetReturnValue().Set(err);
120
}
121
122
void Exit(const v8::FunctionCallbackInfo<v8::Value>& args);
123
void SignalExit(int signo);
124
#ifdef __POSIX__
125
void RegisterSignalHandler(int signal,
126
                           void (*handler)(int signal),
127
                           bool reset_handler = false);
128
#endif
129
130
v8::Local<v8::Object> CreateEnvVarProxy(v8::Local<v8::Context> context,
131
                                        v8::Isolate* isolate,
132
                                        v8::Local<v8::Value> data);
133
134
std::string GetHumanReadableProcessName();
135
void GetHumanReadableProcessName(char (*name)[1024]);
136
137
template <typename T, size_t N>
138
1760484
constexpr size_t arraysize(const T(&)[N]) { return N; }
139
140
#ifndef ROUND_UP
141
# define ROUND_UP(a, b) ((a) % (b) ? ((a) + (b)) - ((a) % (b)) : (a))
142
#endif
143
144
#ifdef __GNUC__
145
# define MUST_USE_RESULT __attribute__((warn_unused_result))
146
#else
147
# define MUST_USE_RESULT
148
#endif
149
150
13703
class SlicedArguments {
151
 public:
152
  inline explicit SlicedArguments(
153
      const v8::FunctionCallbackInfo<v8::Value>& args,
154
      size_t start = 0);
155
13762
  inline size_t size() const { return size_; }
156
13762
  inline v8::Local<v8::Value>* data() { return data_; }
157
158
 private:
159
  size_t size_;
160
  v8::Local<v8::Value>* data_;
161
  v8::Local<v8::Value> fixed_[64];
162
  std::vector<v8::Local<v8::Value>> dynamic_;
163
};
164
165
13705
SlicedArguments::SlicedArguments(
166
    const v8::FunctionCallbackInfo<v8::Value>& args,
167
890825
    size_t start) : size_(0), data_(fixed_) {
168
13705
  const size_t length = static_cast<size_t>(args.Length());
169
27410
  if (start >= length) return;
170
13675
  const size_t size = length - start;
171
172
13675
  if (size > arraysize(fixed_)) {
173
    dynamic_.resize(size);
174
    data_ = dynamic_.data();
175
  }
176
177
33459
  for (size_t i = 0; i < size; ++i)
178
39568
    data_[i] = args[i + start];
179
180
13675
  size_ = size;
181
}
182
183
namespace task_queue {
184
void PromiseRejectCallback(v8::PromiseRejectMessage message);
185
}  // namespace task_queue
186
187
v8::Maybe<bool> ProcessEmitWarning(Environment* env, const char* fmt, ...);
188
v8::Maybe<bool> ProcessEmitDeprecationWarning(Environment* env,
189
                                              const char* warning,
190
                                              const char* deprecation_code);
191
192
void SetupProcessObject(Environment* env,
193
                        const std::vector<std::string>& args,
194
                        const std::vector<std::string>& exec_args);
195
196
enum Endianness {
197
  kLittleEndian,  // _Not_ LITTLE_ENDIAN, clashes with endian.h.
198
  kBigEndian
199
};
200
201
7482
inline enum Endianness GetEndianness() {
202
  // Constant-folded by the compiler.
203
  const union {
204
    uint8_t u8[2];
205
    uint16_t u16;
206
  } u = {
207
    { 1, 0 }
208
7482
  };
209
7482
  return u.u16 == 1 ? kLittleEndian : kBigEndian;
210
}
211
212
1
inline bool IsLittleEndian() {
213
1
  return GetEndianness() == kLittleEndian;
214
}
215
216
7481
inline bool IsBigEndian() {
217
7481
  return GetEndianness() == kBigEndian;
218
}
219
220
10404
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
221
 public:
222
3673
  inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
223
224
  virtual void* Allocate(size_t size);  // Defined in src/node.cc
225
5991
  virtual void* AllocateUninitialized(size_t size)
226
5991
    { return node::UncheckedMalloc(size); }
227
402124
  virtual void Free(void* data, size_t) { free(data); }
228
229
 private:
230
  uint32_t zero_fill_field_ = 1;  // Boolean but exposed as uint32 to JS land.
231
};
232
233
namespace Buffer {
234
v8::MaybeLocal<v8::Object> Copy(Environment* env, const char* data, size_t len);
235
v8::MaybeLocal<v8::Object> New(Environment* env, size_t size);
236
// Takes ownership of |data|.
237
v8::MaybeLocal<v8::Object> New(Environment* env,
238
                               char* data,
239
                               size_t length,
240
                               void (*callback)(char* data, void* hint),
241
                               void* hint);
242
// Takes ownership of |data|.  Must allocate |data| with malloc() or realloc()
243
// because ArrayBufferAllocator::Free() deallocates it again with free().
244
// Mixing operator new and free() is undefined behavior so don't do that.
245
v8::MaybeLocal<v8::Object> New(Environment* env, char* data, size_t length);
246
247
inline
248
23639
v8::MaybeLocal<v8::Uint8Array> New(Environment* env,
249
                                   v8::Local<v8::ArrayBuffer> ab,
250
                                   size_t byte_offset,
251
                                   size_t length) {
252
23639
  v8::Local<v8::Uint8Array> ui = v8::Uint8Array::New(ab, byte_offset, length);
253
  v8::Maybe<bool> mb =
254
70917
      ui->SetPrototype(env->context(), env->buffer_prototype_object());
255
23639
  if (mb.IsNothing())
256
    return v8::MaybeLocal<v8::Uint8Array>();
257
23639
  return ui;
258
}
259
260
// Construct a Buffer from a MaybeStackBuffer (and also its subclasses like
261
// Utf8Value and TwoByteValue).
262
// If |buf| is invalidated, an empty MaybeLocal is returned, and nothing is
263
// changed.
264
// If |buf| contains actual data, this method takes ownership of |buf|'s
265
// underlying buffer. However, |buf| itself can be reused even after this call,
266
// but its capacity, if increased through AllocateSufficientStorage, is not
267
// guaranteed to stay the same.
268
template <typename T>
269
519
static v8::MaybeLocal<v8::Object> New(Environment* env,
270
                                      MaybeStackBuffer<T>* buf) {
271
  v8::MaybeLocal<v8::Object> ret;
272
519
  char* src = reinterpret_cast<char*>(buf->out());
273
519
  const size_t len_in_bytes = buf->length() * sizeof(buf->out()[0]);
274
275

519
  if (buf->IsAllocated())
276
2
    ret = New(env, src, len_in_bytes);
277

517
  else if (!buf->IsInvalidated())
278
517
    ret = Copy(env, src, len_in_bytes);
279
280

519
  if (ret.IsEmpty())
281
    return ret;
282
283

519
  if (buf->IsAllocated())
284
2
    buf->Release();
285
286
519
  return ret;
287
}
288
}  // namespace Buffer
289
290
v8::MaybeLocal<v8::Value> InternalMakeCallback(
291
    Environment* env,
292
    v8::Local<v8::Object> recv,
293
    const v8::Local<v8::Function> callback,
294
    int argc,
295
    v8::Local<v8::Value> argv[],
296
    async_context asyncContext);
297
298
class InternalCallbackScope {
299
 public:
300
  // Tell the constructor whether its `object` parameter may be empty or not.
301
  enum ResourceExpectation { kRequireResource, kAllowEmptyResource };
302
  InternalCallbackScope(Environment* env,
303
                        v8::Local<v8::Object> object,
304
                        const async_context& asyncContext,
305
                        ResourceExpectation expect = kRequireResource);
306
  // Utility that can be used by AsyncWrap classes.
307
  explicit InternalCallbackScope(AsyncWrap* async_wrap);
308
  ~InternalCallbackScope();
309
  void Close();
310
311
1461710
  inline bool Failed() const { return failed_; }
312
66
  inline void MarkAsFailed() { failed_ = true; }
313
314
 private:
315
  Environment* env_;
316
  async_context async_context_;
317
  v8::Local<v8::Object> object_;
318
  Environment::AsyncCallbackScope callback_scope_;
319
  bool failed_ = false;
320
  bool pushed_ids_ = false;
321
  bool closed_ = false;
322
};
323
324
class ThreadPoolWork {
325
 public:
326
1959
  explicit inline ThreadPoolWork(Environment* env) : env_(env) {
327
1959
    CHECK_NOT_NULL(env);
328
1959
  }
329
1854
  inline virtual ~ThreadPoolWork() = default;
330
331
  inline void ScheduleWork();
332
  inline int CancelWork();
333
334
  virtual void DoThreadPoolWork() = 0;
335
  virtual void AfterThreadPoolWork(int status) = 0;
336
337
 private:
338
  Environment* env_;
339
  uv_work_t work_req_;
340
};
341
342
8132
void ThreadPoolWork::ScheduleWork() {
343
8132
  env_->IncreaseWaitingRequestCounter();
344
  int status = uv_queue_work(
345
      env_->event_loop(),
346
      &work_req_,
347
24394
      [](uv_work_t* req) {
348
8131
        ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
349
8131
        self->DoThreadPoolWork();
350
24394
      },
351
24396
      [](uv_work_t* req, int status) {
352
8132
        ThreadPoolWork* self = ContainerOf(&ThreadPoolWork::work_req_, req);
353
8132
        self->env_->DecreaseWaitingRequestCounter();
354
8132
        self->AfterThreadPoolWork(status);
355
32527
      });
356
8132
  CHECK_EQ(status, 0);
357
8132
}
358
359
1
int ThreadPoolWork::CancelWork() {
360
1
  return uv_cancel(reinterpret_cast<uv_req_t*>(&work_req_));
361
}
362
363
tracing::AgentWriterHandle* GetTracingAgentWriter();
364
365
4
static inline const char* errno_string(int errorno) {
366
#define ERRNO_CASE(e)  case e: return #e;
367



















4
  switch (errorno) {
368
#ifdef EACCES
369
  ERRNO_CASE(EACCES);
370
#endif
371
372
#ifdef EADDRINUSE
373
  ERRNO_CASE(EADDRINUSE);
374
#endif
375
376
#ifdef EADDRNOTAVAIL
377
  ERRNO_CASE(EADDRNOTAVAIL);
378
#endif
379
380
#ifdef EAFNOSUPPORT
381
  ERRNO_CASE(EAFNOSUPPORT);
382
#endif
383
384
#ifdef EAGAIN
385
  ERRNO_CASE(EAGAIN);
386
#endif
387
388
#ifdef EWOULDBLOCK
389
# if EAGAIN != EWOULDBLOCK
390
  ERRNO_CASE(EWOULDBLOCK);
391
# endif
392
#endif
393
394
#ifdef EALREADY
395
  ERRNO_CASE(EALREADY);
396
#endif
397
398
#ifdef EBADF
399
  ERRNO_CASE(EBADF);
400
#endif
401
402
#ifdef EBADMSG
403
  ERRNO_CASE(EBADMSG);
404
#endif
405
406
#ifdef EBUSY
407
  ERRNO_CASE(EBUSY);
408
#endif
409
410
#ifdef ECANCELED
411
  ERRNO_CASE(ECANCELED);
412
#endif
413
414
#ifdef ECHILD
415
1
  ERRNO_CASE(ECHILD);
416
#endif
417
418
#ifdef ECONNABORTED
419
  ERRNO_CASE(ECONNABORTED);
420
#endif
421
422
#ifdef ECONNREFUSED
423
  ERRNO_CASE(ECONNREFUSED);
424
#endif
425
426
#ifdef ECONNRESET
427
  ERRNO_CASE(ECONNRESET);
428
#endif
429
430
#ifdef EDEADLK
431
  ERRNO_CASE(EDEADLK);
432
#endif
433
434
#ifdef EDESTADDRREQ
435
  ERRNO_CASE(EDESTADDRREQ);
436
#endif
437
438
#ifdef EDOM
439
  ERRNO_CASE(EDOM);
440
#endif
441
442
#ifdef EDQUOT
443
  ERRNO_CASE(EDQUOT);
444
#endif
445
446
#ifdef EEXIST
447
  ERRNO_CASE(EEXIST);
448
#endif
449
450
#ifdef EFAULT
451
  ERRNO_CASE(EFAULT);
452
#endif
453
454
#ifdef EFBIG
455
  ERRNO_CASE(EFBIG);
456
#endif
457
458
#ifdef EHOSTUNREACH
459
  ERRNO_CASE(EHOSTUNREACH);
460
#endif
461
462
#ifdef EIDRM
463
  ERRNO_CASE(EIDRM);
464
#endif
465
466
#ifdef EILSEQ
467
  ERRNO_CASE(EILSEQ);
468
#endif
469
470
#ifdef EINPROGRESS
471
  ERRNO_CASE(EINPROGRESS);
472
#endif
473
474
#ifdef EINTR
475
  ERRNO_CASE(EINTR);
476
#endif
477
478
#ifdef EINVAL
479
  ERRNO_CASE(EINVAL);
480
#endif
481
482
#ifdef EIO
483
  ERRNO_CASE(EIO);
484
#endif
485
486
#ifdef EISCONN
487
  ERRNO_CASE(EISCONN);
488
#endif
489
490
#ifdef EISDIR
491
  ERRNO_CASE(EISDIR);
492
#endif
493
494
#ifdef ELOOP
495
  ERRNO_CASE(ELOOP);
496
#endif
497
498
#ifdef EMFILE
499
  ERRNO_CASE(EMFILE);
500
#endif
501
502
#ifdef EMLINK
503
  ERRNO_CASE(EMLINK);
504
#endif
505
506
#ifdef EMSGSIZE
507
  ERRNO_CASE(EMSGSIZE);
508
#endif
509
510
#ifdef EMULTIHOP
511
  ERRNO_CASE(EMULTIHOP);
512
#endif
513
514
#ifdef ENAMETOOLONG
515
  ERRNO_CASE(ENAMETOOLONG);
516
#endif
517
518
#ifdef ENETDOWN
519
  ERRNO_CASE(ENETDOWN);
520
#endif
521
522
#ifdef ENETRESET
523
  ERRNO_CASE(ENETRESET);
524
#endif
525
526
#ifdef ENETUNREACH
527
  ERRNO_CASE(ENETUNREACH);
528
#endif
529
530
#ifdef ENFILE
531
  ERRNO_CASE(ENFILE);
532
#endif
533
534
#ifdef ENOBUFS
535
  ERRNO_CASE(ENOBUFS);
536
#endif
537
538
#ifdef ENODATA
539
  ERRNO_CASE(ENODATA);
540
#endif
541
542
#ifdef ENODEV
543
  ERRNO_CASE(ENODEV);
544
#endif
545
546
#ifdef ENOENT
547
  ERRNO_CASE(ENOENT);
548
#endif
549
550
#ifdef ENOEXEC
551
  ERRNO_CASE(ENOEXEC);
552
#endif
553
554
#ifdef ENOLINK
555
  ERRNO_CASE(ENOLINK);
556
#endif
557
558
#ifdef ENOLCK
559
# if ENOLINK != ENOLCK
560
  ERRNO_CASE(ENOLCK);
561
# endif
562
#endif
563
564
#ifdef ENOMEM
565
  ERRNO_CASE(ENOMEM);
566
#endif
567
568
#ifdef ENOMSG
569
  ERRNO_CASE(ENOMSG);
570
#endif
571
572
#ifdef ENOPROTOOPT
573
  ERRNO_CASE(ENOPROTOOPT);
574
#endif
575
576
#ifdef ENOSPC
577
  ERRNO_CASE(ENOSPC);
578
#endif
579
580
#ifdef ENOSR
581
  ERRNO_CASE(ENOSR);
582
#endif
583
584
#ifdef ENOSTR
585
  ERRNO_CASE(ENOSTR);
586
#endif
587
588
#ifdef ENOSYS
589
  ERRNO_CASE(ENOSYS);
590
#endif
591
592
#ifdef ENOTCONN
593
  ERRNO_CASE(ENOTCONN);
594
#endif
595
596
#ifdef ENOTDIR
597
  ERRNO_CASE(ENOTDIR);
598
#endif
599
600
#ifdef ENOTEMPTY
601
# if ENOTEMPTY != EEXIST
602
  ERRNO_CASE(ENOTEMPTY);
603
# endif
604
#endif
605
606
#ifdef ENOTSOCK
607
  ERRNO_CASE(ENOTSOCK);
608
#endif
609
610
#ifdef ENOTSUP
611
  ERRNO_CASE(ENOTSUP);
612
#else
613
# ifdef EOPNOTSUPP
614
  ERRNO_CASE(EOPNOTSUPP);
615
# endif
616
#endif
617
618
#ifdef ENOTTY
619
  ERRNO_CASE(ENOTTY);
620
#endif
621
622
#ifdef ENXIO
623
  ERRNO_CASE(ENXIO);
624
#endif
625
626
627
#ifdef EOVERFLOW
628
  ERRNO_CASE(EOVERFLOW);
629
#endif
630
631
#ifdef EPERM
632
2
  ERRNO_CASE(EPERM);
633
#endif
634
635
#ifdef EPIPE
636
  ERRNO_CASE(EPIPE);
637
#endif
638
639
#ifdef EPROTO
640
  ERRNO_CASE(EPROTO);
641
#endif
642
643
#ifdef EPROTONOSUPPORT
644
  ERRNO_CASE(EPROTONOSUPPORT);
645
#endif
646
647
#ifdef EPROTOTYPE
648
  ERRNO_CASE(EPROTOTYPE);
649
#endif
650
651
#ifdef ERANGE
652
  ERRNO_CASE(ERANGE);
653
#endif
654
655
#ifdef EROFS
656
  ERRNO_CASE(EROFS);
657
#endif
658
659
#ifdef ESPIPE
660
  ERRNO_CASE(ESPIPE);
661
#endif
662
663
#ifdef ESRCH
664
1
  ERRNO_CASE(ESRCH);
665
#endif
666
667
#ifdef ESTALE
668
  ERRNO_CASE(ESTALE);
669
#endif
670
671
#ifdef ETIME
672
  ERRNO_CASE(ETIME);
673
#endif
674
675
#ifdef ETIMEDOUT
676
  ERRNO_CASE(ETIMEDOUT);
677
#endif
678
679
#ifdef ETXTBSY
680
  ERRNO_CASE(ETXTBSY);
681
#endif
682
683
#ifdef EXDEV
684
  ERRNO_CASE(EXDEV);
685
#endif
686
687
  default: return "";
688
  }
689
}
690
691
#define TRACING_CATEGORY_NODE "node"
692
#define TRACING_CATEGORY_NODE1(one)                                           \
693
    TRACING_CATEGORY_NODE ","                                                 \
694
    TRACING_CATEGORY_NODE "." #one
695
#define TRACING_CATEGORY_NODE2(one, two)                                      \
696
    TRACING_CATEGORY_NODE ","                                                 \
697
    TRACING_CATEGORY_NODE "." #one ","                                        \
698
    TRACING_CATEGORY_NODE "." #one "." #two
699
700
// Functions defined in node.cc that are exposed via the bootstrapper object
701
702
extern double prog_start_time;
703
704
void RawDebug(const v8::FunctionCallbackInfo<v8::Value>& args);
705
706
void DebugPortGetter(v8::Local<v8::Name> property,
707
                     const v8::PropertyCallbackInfo<v8::Value>& info);
708
void DebugPortSetter(v8::Local<v8::Name> property,
709
                     v8::Local<v8::Value> value,
710
                     const v8::PropertyCallbackInfo<void>& info);
711
712
void GetParentProcessId(v8::Local<v8::Name> property,
713
                        const v8::PropertyCallbackInfo<v8::Value>& info);
714
715
void ProcessTitleGetter(v8::Local<v8::Name> property,
716
                        const v8::PropertyCallbackInfo<v8::Value>& info);
717
void ProcessTitleSetter(v8::Local<v8::Name> property,
718
                        v8::Local<v8::Value> value,
719
                        const v8::PropertyCallbackInfo<void>& info);
720
721
#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__)
722
#define NODE_IMPLEMENTS_POSIX_CREDENTIALS 1
723
#endif  // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__)
724
725
namespace credentials {
726
bool SafeGetenv(const char* key, std::string* text);
727
}  // namespace credentials
728
729
void DefineZlibConstants(v8::Local<v8::Object> target);
730
731
void RunBootstrapping(Environment* env);
732
void StartExecution(Environment* env);
733
734
}  // namespace node
735
736
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
737
738
#endif  // SRC_NODE_INTERNALS_H_