GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/node_constants.cc Lines: 331 331 100.0 %
Date: 2019-05-05 22:32:45 Branches: 9 18 50.0 %

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
#include "node_constants.h"
23
#include "node_internals.h"
24
25
#include "zlib.h"
26
27
#if !defined(_MSC_VER)
28
#include <unistd.h>
29
#endif
30
31
#include <fcntl.h>
32
#include <sys/types.h>
33
#include <sys/stat.h>
34
35
36
#if HAVE_OPENSSL
37
#include <openssl/ec.h>
38
#include <openssl/ssl.h>
39
#ifndef OPENSSL_NO_ENGINE
40
#include <openssl/engine.h>
41
#endif  // !OPENSSL_NO_ENGINE
42
#endif  // HAVE_OPENSSL
43
44
#if defined(__POSIX__)
45
#include <dlfcn.h>
46
#endif
47
48
#include <cerrno>
49
#include <csignal>
50
#include <limits>
51
52
namespace node {
53
54
using v8::Local;
55
using v8::Object;
56
57
namespace {
58
59
4649
void DefineErrnoConstants(Local<Object> target) {
60
#ifdef E2BIG
61
18596
  NODE_DEFINE_CONSTANT(target, E2BIG);
62
#endif
63
64
#ifdef EACCES
65
18596
  NODE_DEFINE_CONSTANT(target, EACCES);
66
#endif
67
68
#ifdef EADDRINUSE
69
18596
  NODE_DEFINE_CONSTANT(target, EADDRINUSE);
70
#endif
71
72
#ifdef EADDRNOTAVAIL
73
18596
  NODE_DEFINE_CONSTANT(target, EADDRNOTAVAIL);
74
#endif
75
76
#ifdef EAFNOSUPPORT
77
18596
  NODE_DEFINE_CONSTANT(target, EAFNOSUPPORT);
78
#endif
79
80
#ifdef EAGAIN
81
18596
  NODE_DEFINE_CONSTANT(target, EAGAIN);
82
#endif
83
84
#ifdef EALREADY
85
18596
  NODE_DEFINE_CONSTANT(target, EALREADY);
86
#endif
87
88
#ifdef EBADF
89
18596
  NODE_DEFINE_CONSTANT(target, EBADF);
90
#endif
91
92
#ifdef EBADMSG
93
18596
  NODE_DEFINE_CONSTANT(target, EBADMSG);
94
#endif
95
96
#ifdef EBUSY
97
18596
  NODE_DEFINE_CONSTANT(target, EBUSY);
98
#endif
99
100
#ifdef ECANCELED
101
18596
  NODE_DEFINE_CONSTANT(target, ECANCELED);
102
#endif
103
104
#ifdef ECHILD
105
18596
  NODE_DEFINE_CONSTANT(target, ECHILD);
106
#endif
107
108
#ifdef ECONNABORTED
109
18596
  NODE_DEFINE_CONSTANT(target, ECONNABORTED);
110
#endif
111
112
#ifdef ECONNREFUSED
113
18596
  NODE_DEFINE_CONSTANT(target, ECONNREFUSED);
114
#endif
115
116
#ifdef ECONNRESET
117
18596
  NODE_DEFINE_CONSTANT(target, ECONNRESET);
118
#endif
119
120
#ifdef EDEADLK
121
18596
  NODE_DEFINE_CONSTANT(target, EDEADLK);
122
#endif
123
124
#ifdef EDESTADDRREQ
125
18596
  NODE_DEFINE_CONSTANT(target, EDESTADDRREQ);
126
#endif
127
128
#ifdef EDOM
129
18596
  NODE_DEFINE_CONSTANT(target, EDOM);
130
#endif
131
132
#ifdef EDQUOT
133
18596
  NODE_DEFINE_CONSTANT(target, EDQUOT);
134
#endif
135
136
#ifdef EEXIST
137
18596
  NODE_DEFINE_CONSTANT(target, EEXIST);
138
#endif
139
140
#ifdef EFAULT
141
18596
  NODE_DEFINE_CONSTANT(target, EFAULT);
142
#endif
143
144
#ifdef EFBIG
145
18596
  NODE_DEFINE_CONSTANT(target, EFBIG);
146
#endif
147
148
#ifdef EHOSTUNREACH
149
18596
  NODE_DEFINE_CONSTANT(target, EHOSTUNREACH);
150
#endif
151
152
#ifdef EIDRM
153
18596
  NODE_DEFINE_CONSTANT(target, EIDRM);
154
#endif
155
156
#ifdef EILSEQ
157
18596
  NODE_DEFINE_CONSTANT(target, EILSEQ);
158
#endif
159
160
#ifdef EINPROGRESS
161
18596
  NODE_DEFINE_CONSTANT(target, EINPROGRESS);
162
#endif
163
164
#ifdef EINTR
165
18596
  NODE_DEFINE_CONSTANT(target, EINTR);
166
#endif
167
168
#ifdef EINVAL
169
18596
  NODE_DEFINE_CONSTANT(target, EINVAL);
170
#endif
171
172
#ifdef EIO
173
18596
  NODE_DEFINE_CONSTANT(target, EIO);
174
#endif
175
176
#ifdef EISCONN
177
18596
  NODE_DEFINE_CONSTANT(target, EISCONN);
178
#endif
179
180
#ifdef EISDIR
181
18596
  NODE_DEFINE_CONSTANT(target, EISDIR);
182
#endif
183
184
#ifdef ELOOP
185
18596
  NODE_DEFINE_CONSTANT(target, ELOOP);
186
#endif
187
188
#ifdef EMFILE
189
18596
  NODE_DEFINE_CONSTANT(target, EMFILE);
190
#endif
191
192
#ifdef EMLINK
193
18596
  NODE_DEFINE_CONSTANT(target, EMLINK);
194
#endif
195
196
#ifdef EMSGSIZE
197
18596
  NODE_DEFINE_CONSTANT(target, EMSGSIZE);
198
#endif
199
200
#ifdef EMULTIHOP
201
18596
  NODE_DEFINE_CONSTANT(target, EMULTIHOP);
202
#endif
203
204
#ifdef ENAMETOOLONG
205
18596
  NODE_DEFINE_CONSTANT(target, ENAMETOOLONG);
206
#endif
207
208
#ifdef ENETDOWN
209
18596
  NODE_DEFINE_CONSTANT(target, ENETDOWN);
210
#endif
211
212
#ifdef ENETRESET
213
18596
  NODE_DEFINE_CONSTANT(target, ENETRESET);
214
#endif
215
216
#ifdef ENETUNREACH
217
18596
  NODE_DEFINE_CONSTANT(target, ENETUNREACH);
218
#endif
219
220
#ifdef ENFILE
221
18596
  NODE_DEFINE_CONSTANT(target, ENFILE);
222
#endif
223
224
#ifdef ENOBUFS
225
18596
  NODE_DEFINE_CONSTANT(target, ENOBUFS);
226
#endif
227
228
#ifdef ENODATA
229
18596
  NODE_DEFINE_CONSTANT(target, ENODATA);
230
#endif
231
232
#ifdef ENODEV
233
18596
  NODE_DEFINE_CONSTANT(target, ENODEV);
234
#endif
235
236
#ifdef ENOENT
237
18596
  NODE_DEFINE_CONSTANT(target, ENOENT);
238
#endif
239
240
#ifdef ENOEXEC
241
18596
  NODE_DEFINE_CONSTANT(target, ENOEXEC);
242
#endif
243
244
#ifdef ENOLCK
245
18596
  NODE_DEFINE_CONSTANT(target, ENOLCK);
246
#endif
247
248
#ifdef ENOLINK
249
18596
  NODE_DEFINE_CONSTANT(target, ENOLINK);
250
#endif
251
252
#ifdef ENOMEM
253
18596
  NODE_DEFINE_CONSTANT(target, ENOMEM);
254
#endif
255
256
#ifdef ENOMSG
257
18596
  NODE_DEFINE_CONSTANT(target, ENOMSG);
258
#endif
259
260
#ifdef ENOPROTOOPT
261
18596
  NODE_DEFINE_CONSTANT(target, ENOPROTOOPT);
262
#endif
263
264
#ifdef ENOSPC
265
18596
  NODE_DEFINE_CONSTANT(target, ENOSPC);
266
#endif
267
268
#ifdef ENOSR
269
18596
  NODE_DEFINE_CONSTANT(target, ENOSR);
270
#endif
271
272
#ifdef ENOSTR
273
18596
  NODE_DEFINE_CONSTANT(target, ENOSTR);
274
#endif
275
276
#ifdef ENOSYS
277
18596
  NODE_DEFINE_CONSTANT(target, ENOSYS);
278
#endif
279
280
#ifdef ENOTCONN
281
18596
  NODE_DEFINE_CONSTANT(target, ENOTCONN);
282
#endif
283
284
#ifdef ENOTDIR
285
18596
  NODE_DEFINE_CONSTANT(target, ENOTDIR);
286
#endif
287
288
#ifdef ENOTEMPTY
289
18596
  NODE_DEFINE_CONSTANT(target, ENOTEMPTY);
290
#endif
291
292
#ifdef ENOTSOCK
293
18596
  NODE_DEFINE_CONSTANT(target, ENOTSOCK);
294
#endif
295
296
#ifdef ENOTSUP
297
18596
  NODE_DEFINE_CONSTANT(target, ENOTSUP);
298
#endif
299
300
#ifdef ENOTTY
301
18596
  NODE_DEFINE_CONSTANT(target, ENOTTY);
302
#endif
303
304
#ifdef ENXIO
305
18596
  NODE_DEFINE_CONSTANT(target, ENXIO);
306
#endif
307
308
#ifdef EOPNOTSUPP
309
18596
  NODE_DEFINE_CONSTANT(target, EOPNOTSUPP);
310
#endif
311
312
#ifdef EOVERFLOW
313
18596
  NODE_DEFINE_CONSTANT(target, EOVERFLOW);
314
#endif
315
316
#ifdef EPERM
317
18596
  NODE_DEFINE_CONSTANT(target, EPERM);
318
#endif
319
320
#ifdef EPIPE
321
18596
  NODE_DEFINE_CONSTANT(target, EPIPE);
322
#endif
323
324
#ifdef EPROTO
325
18596
  NODE_DEFINE_CONSTANT(target, EPROTO);
326
#endif
327
328
#ifdef EPROTONOSUPPORT
329
18596
  NODE_DEFINE_CONSTANT(target, EPROTONOSUPPORT);
330
#endif
331
332
#ifdef EPROTOTYPE
333
18596
  NODE_DEFINE_CONSTANT(target, EPROTOTYPE);
334
#endif
335
336
#ifdef ERANGE
337
18596
  NODE_DEFINE_CONSTANT(target, ERANGE);
338
#endif
339
340
#ifdef EROFS
341
18596
  NODE_DEFINE_CONSTANT(target, EROFS);
342
#endif
343
344
#ifdef ESPIPE
345
18596
  NODE_DEFINE_CONSTANT(target, ESPIPE);
346
#endif
347
348
#ifdef ESRCH
349
18596
  NODE_DEFINE_CONSTANT(target, ESRCH);
350
#endif
351
352
#ifdef ESTALE
353
18596
  NODE_DEFINE_CONSTANT(target, ESTALE);
354
#endif
355
356
#ifdef ETIME
357
18596
  NODE_DEFINE_CONSTANT(target, ETIME);
358
#endif
359
360
#ifdef ETIMEDOUT
361
18596
  NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
362
#endif
363
364
#ifdef ETXTBSY
365
18596
  NODE_DEFINE_CONSTANT(target, ETXTBSY);
366
#endif
367
368
#ifdef EWOULDBLOCK
369
18596
  NODE_DEFINE_CONSTANT(target, EWOULDBLOCK);
370
#endif
371
372
#ifdef EXDEV
373
18596
  NODE_DEFINE_CONSTANT(target, EXDEV);
374
#endif
375
4649
}
376
377
4649
void DefineWindowsErrorConstants(Local<Object> target) {
378
#ifdef WSAEINTR
379
  NODE_DEFINE_CONSTANT(target, WSAEINTR);
380
#endif
381
382
#ifdef WSAEBADF
383
  NODE_DEFINE_CONSTANT(target, WSAEBADF);
384
#endif
385
386
#ifdef WSAEACCES
387
  NODE_DEFINE_CONSTANT(target, WSAEACCES);
388
#endif
389
390
#ifdef WSAEFAULT
391
  NODE_DEFINE_CONSTANT(target, WSAEFAULT);
392
#endif
393
394
#ifdef WSAEINVAL
395
  NODE_DEFINE_CONSTANT(target, WSAEINVAL);
396
#endif
397
398
#ifdef WSAEMFILE
399
  NODE_DEFINE_CONSTANT(target, WSAEMFILE);
400
#endif
401
402
#ifdef WSAEWOULDBLOCK
403
  NODE_DEFINE_CONSTANT(target, WSAEWOULDBLOCK);
404
#endif
405
406
#ifdef WSAEINPROGRESS
407
  NODE_DEFINE_CONSTANT(target, WSAEINPROGRESS);
408
#endif
409
410
#ifdef WSAEALREADY
411
  NODE_DEFINE_CONSTANT(target, WSAEALREADY);
412
#endif
413
414
#ifdef WSAENOTSOCK
415
  NODE_DEFINE_CONSTANT(target, WSAENOTSOCK);
416
#endif
417
418
#ifdef WSAEDESTADDRREQ
419
  NODE_DEFINE_CONSTANT(target, WSAEDESTADDRREQ);
420
#endif
421
422
#ifdef WSAEMSGSIZE
423
  NODE_DEFINE_CONSTANT(target, WSAEMSGSIZE);
424
#endif
425
426
#ifdef WSAEPROTOTYPE
427
  NODE_DEFINE_CONSTANT(target, WSAEPROTOTYPE);
428
#endif
429
430
#ifdef WSAENOPROTOOPT
431
  NODE_DEFINE_CONSTANT(target, WSAENOPROTOOPT);
432
#endif
433
434
#ifdef WSAEPROTONOSUPPORT
435
  NODE_DEFINE_CONSTANT(target, WSAEPROTONOSUPPORT);
436
#endif
437
438
#ifdef WSAESOCKTNOSUPPORT
439
  NODE_DEFINE_CONSTANT(target, WSAESOCKTNOSUPPORT);
440
#endif
441
442
#ifdef WSAEOPNOTSUPP
443
  NODE_DEFINE_CONSTANT(target, WSAEOPNOTSUPP);
444
#endif
445
446
#ifdef WSAEPFNOSUPPORT
447
  NODE_DEFINE_CONSTANT(target, WSAEPFNOSUPPORT);
448
#endif
449
450
#ifdef WSAEAFNOSUPPORT
451
  NODE_DEFINE_CONSTANT(target, WSAEAFNOSUPPORT);
452
#endif
453
454
#ifdef WSAEADDRINUSE
455
  NODE_DEFINE_CONSTANT(target, WSAEADDRINUSE);
456
#endif
457
458
#ifdef WSAEADDRNOTAVAIL
459
  NODE_DEFINE_CONSTANT(target, WSAEADDRNOTAVAIL);
460
#endif
461
462
#ifdef WSAENETDOWN
463
  NODE_DEFINE_CONSTANT(target, WSAENETDOWN);
464
#endif
465
466
#ifdef WSAENETUNREACH
467
  NODE_DEFINE_CONSTANT(target, WSAENETUNREACH);
468
#endif
469
470
#ifdef WSAENETRESET
471
  NODE_DEFINE_CONSTANT(target, WSAENETRESET);
472
#endif
473
474
#ifdef WSAECONNABORTED
475
  NODE_DEFINE_CONSTANT(target, WSAECONNABORTED);
476
#endif
477
478
#ifdef WSAECONNRESET
479
  NODE_DEFINE_CONSTANT(target, WSAECONNRESET);
480
#endif
481
482
#ifdef WSAENOBUFS
483
  NODE_DEFINE_CONSTANT(target, WSAENOBUFS);
484
#endif
485
486
#ifdef WSAEISCONN
487
  NODE_DEFINE_CONSTANT(target, WSAEISCONN);
488
#endif
489
490
#ifdef WSAENOTCONN
491
  NODE_DEFINE_CONSTANT(target, WSAENOTCONN);
492
#endif
493
494
#ifdef WSAESHUTDOWN
495
  NODE_DEFINE_CONSTANT(target, WSAESHUTDOWN);
496
#endif
497
498
#ifdef WSAETOOMANYREFS
499
  NODE_DEFINE_CONSTANT(target, WSAETOOMANYREFS);
500
#endif
501
502
#ifdef WSAETIMEDOUT
503
  NODE_DEFINE_CONSTANT(target, WSAETIMEDOUT);
504
#endif
505
506
#ifdef WSAECONNREFUSED
507
  NODE_DEFINE_CONSTANT(target, WSAECONNREFUSED);
508
#endif
509
510
#ifdef WSAELOOP
511
  NODE_DEFINE_CONSTANT(target, WSAELOOP);
512
#endif
513
514
#ifdef WSAENAMETOOLONG
515
  NODE_DEFINE_CONSTANT(target, WSAENAMETOOLONG);
516
#endif
517
518
#ifdef WSAEHOSTDOWN
519
  NODE_DEFINE_CONSTANT(target, WSAEHOSTDOWN);
520
#endif
521
522
#ifdef WSAEHOSTUNREACH
523
  NODE_DEFINE_CONSTANT(target, WSAEHOSTUNREACH);
524
#endif
525
526
#ifdef WSAENOTEMPTY
527
  NODE_DEFINE_CONSTANT(target, WSAENOTEMPTY);
528
#endif
529
530
#ifdef WSAEPROCLIM
531
  NODE_DEFINE_CONSTANT(target, WSAEPROCLIM);
532
#endif
533
534
#ifdef WSAEUSERS
535
  NODE_DEFINE_CONSTANT(target, WSAEUSERS);
536
#endif
537
538
#ifdef WSAEDQUOT
539
  NODE_DEFINE_CONSTANT(target, WSAEDQUOT);
540
#endif
541
542
#ifdef WSAESTALE
543
  NODE_DEFINE_CONSTANT(target, WSAESTALE);
544
#endif
545
546
#ifdef WSAEREMOTE
547
  NODE_DEFINE_CONSTANT(target, WSAEREMOTE);
548
#endif
549
550
#ifdef WSASYSNOTREADY
551
  NODE_DEFINE_CONSTANT(target, WSASYSNOTREADY);
552
#endif
553
554
#ifdef WSAVERNOTSUPPORTED
555
  NODE_DEFINE_CONSTANT(target, WSAVERNOTSUPPORTED);
556
#endif
557
558
#ifdef WSANOTINITIALISED
559
  NODE_DEFINE_CONSTANT(target, WSANOTINITIALISED);
560
#endif
561
562
#ifdef WSAEDISCON
563
  NODE_DEFINE_CONSTANT(target, WSAEDISCON);
564
#endif
565
566
#ifdef WSAENOMORE
567
  NODE_DEFINE_CONSTANT(target, WSAENOMORE);
568
#endif
569
570
#ifdef WSAECANCELLED
571
  NODE_DEFINE_CONSTANT(target, WSAECANCELLED);
572
#endif
573
574
#ifdef WSAEINVALIDPROCTABLE
575
  NODE_DEFINE_CONSTANT(target, WSAEINVALIDPROCTABLE);
576
#endif
577
578
#ifdef WSAEINVALIDPROVIDER
579
  NODE_DEFINE_CONSTANT(target, WSAEINVALIDPROVIDER);
580
#endif
581
582
#ifdef WSAEPROVIDERFAILEDINIT
583
  NODE_DEFINE_CONSTANT(target, WSAEPROVIDERFAILEDINIT);
584
#endif
585
586
#ifdef WSASYSCALLFAILURE
587
  NODE_DEFINE_CONSTANT(target, WSASYSCALLFAILURE);
588
#endif
589
590
#ifdef WSASERVICE_NOT_FOUND
591
  NODE_DEFINE_CONSTANT(target, WSASERVICE_NOT_FOUND);
592
#endif
593
594
#ifdef WSATYPE_NOT_FOUND
595
  NODE_DEFINE_CONSTANT(target, WSATYPE_NOT_FOUND);
596
#endif
597
598
#ifdef WSA_E_NO_MORE
599
  NODE_DEFINE_CONSTANT(target, WSA_E_NO_MORE);
600
#endif
601
602
#ifdef WSA_E_CANCELLED
603
  NODE_DEFINE_CONSTANT(target, WSA_E_CANCELLED);
604
#endif
605
606
#ifdef WSAEREFUSED
607
  NODE_DEFINE_CONSTANT(target, WSAEREFUSED);
608
#endif
609
4649
}
610
611
4649
void DefineSignalConstants(Local<Object> target) {
612
#ifdef SIGHUP
613
18596
  NODE_DEFINE_CONSTANT(target, SIGHUP);
614
#endif
615
616
#ifdef SIGINT
617
18596
  NODE_DEFINE_CONSTANT(target, SIGINT);
618
#endif
619
620
#ifdef SIGQUIT
621
18596
  NODE_DEFINE_CONSTANT(target, SIGQUIT);
622
#endif
623
624
#ifdef SIGILL
625
18596
  NODE_DEFINE_CONSTANT(target, SIGILL);
626
#endif
627
628
#ifdef SIGTRAP
629
18596
  NODE_DEFINE_CONSTANT(target, SIGTRAP);
630
#endif
631
632
#ifdef SIGABRT
633
18596
  NODE_DEFINE_CONSTANT(target, SIGABRT);
634
#endif
635
636
#ifdef SIGIOT
637
18596
  NODE_DEFINE_CONSTANT(target, SIGIOT);
638
#endif
639
640
#ifdef SIGBUS
641
18596
  NODE_DEFINE_CONSTANT(target, SIGBUS);
642
#endif
643
644
#ifdef SIGFPE
645
18596
  NODE_DEFINE_CONSTANT(target, SIGFPE);
646
#endif
647
648
#ifdef SIGKILL
649
18596
  NODE_DEFINE_CONSTANT(target, SIGKILL);
650
#endif
651
652
#ifdef SIGUSR1
653
18596
  NODE_DEFINE_CONSTANT(target, SIGUSR1);
654
#endif
655
656
#ifdef SIGSEGV
657
18596
  NODE_DEFINE_CONSTANT(target, SIGSEGV);
658
#endif
659
660
#ifdef SIGUSR2
661
18596
  NODE_DEFINE_CONSTANT(target, SIGUSR2);
662
#endif
663
664
#ifdef SIGPIPE
665
18596
  NODE_DEFINE_CONSTANT(target, SIGPIPE);
666
#endif
667
668
#ifdef SIGALRM
669
18596
  NODE_DEFINE_CONSTANT(target, SIGALRM);
670
#endif
671
672
18596
  NODE_DEFINE_CONSTANT(target, SIGTERM);
673
674
#ifdef SIGCHLD
675
18596
  NODE_DEFINE_CONSTANT(target, SIGCHLD);
676
#endif
677
678
#ifdef SIGSTKFLT
679
18596
  NODE_DEFINE_CONSTANT(target, SIGSTKFLT);
680
#endif
681
682
683
#ifdef SIGCONT
684
18596
  NODE_DEFINE_CONSTANT(target, SIGCONT);
685
#endif
686
687
#ifdef SIGSTOP
688
18596
  NODE_DEFINE_CONSTANT(target, SIGSTOP);
689
#endif
690
691
#ifdef SIGTSTP
692
18596
  NODE_DEFINE_CONSTANT(target, SIGTSTP);
693
#endif
694
695
#ifdef SIGBREAK
696
  NODE_DEFINE_CONSTANT(target, SIGBREAK);
697
#endif
698
699
#ifdef SIGTTIN
700
18596
  NODE_DEFINE_CONSTANT(target, SIGTTIN);
701
#endif
702
703
#ifdef SIGTTOU
704
18596
  NODE_DEFINE_CONSTANT(target, SIGTTOU);
705
#endif
706
707
#ifdef SIGURG
708
18596
  NODE_DEFINE_CONSTANT(target, SIGURG);
709
#endif
710
711
#ifdef SIGXCPU
712
18596
  NODE_DEFINE_CONSTANT(target, SIGXCPU);
713
#endif
714
715
#ifdef SIGXFSZ
716
18596
  NODE_DEFINE_CONSTANT(target, SIGXFSZ);
717
#endif
718
719
#ifdef SIGVTALRM
720
18596
  NODE_DEFINE_CONSTANT(target, SIGVTALRM);
721
#endif
722
723
#ifdef SIGPROF
724
18596
  NODE_DEFINE_CONSTANT(target, SIGPROF);
725
#endif
726
727
#ifdef SIGWINCH
728
18596
  NODE_DEFINE_CONSTANT(target, SIGWINCH);
729
#endif
730
731
#ifdef SIGIO
732
18596
  NODE_DEFINE_CONSTANT(target, SIGIO);
733
#endif
734
735
#ifdef SIGPOLL
736
18596
  NODE_DEFINE_CONSTANT(target, SIGPOLL);
737
#endif
738
739
#ifdef SIGLOST
740
  NODE_DEFINE_CONSTANT(target, SIGLOST);
741
#endif
742
743
#ifdef SIGPWR
744
18596
  NODE_DEFINE_CONSTANT(target, SIGPWR);
745
#endif
746
747
#ifdef SIGINFO
748
  NODE_DEFINE_CONSTANT(target, SIGINFO);
749
#endif
750
751
#ifdef SIGSYS
752
18596
  NODE_DEFINE_CONSTANT(target, SIGSYS);
753
#endif
754
755
#ifdef SIGUNUSED
756
18596
  NODE_DEFINE_CONSTANT(target, SIGUNUSED);
757
#endif
758
4649
}
759
760
4649
void DefinePriorityConstants(Local<Object> target) {
761
#ifdef UV_PRIORITY_LOW
762
# define PRIORITY_LOW UV_PRIORITY_LOW
763
18596
  NODE_DEFINE_CONSTANT(target, PRIORITY_LOW);
764
# undef PRIORITY_LOW
765
#endif
766
767
#ifdef UV_PRIORITY_BELOW_NORMAL
768
# define PRIORITY_BELOW_NORMAL UV_PRIORITY_BELOW_NORMAL
769
18596
  NODE_DEFINE_CONSTANT(target, PRIORITY_BELOW_NORMAL);
770
# undef PRIORITY_BELOW_NORMAL
771
#endif
772
773
#ifdef UV_PRIORITY_NORMAL
774
# define PRIORITY_NORMAL UV_PRIORITY_NORMAL
775
18596
  NODE_DEFINE_CONSTANT(target, PRIORITY_NORMAL);
776
# undef PRIORITY_NORMAL
777
#endif
778
779
#ifdef UV_PRIORITY_ABOVE_NORMAL
780
# define PRIORITY_ABOVE_NORMAL UV_PRIORITY_ABOVE_NORMAL
781
18596
  NODE_DEFINE_CONSTANT(target, PRIORITY_ABOVE_NORMAL);
782
# undef PRIORITY_ABOVE_NORMAL
783
#endif
784
785
#ifdef UV_PRIORITY_HIGH
786
# define PRIORITY_HIGH UV_PRIORITY_HIGH
787
18596
  NODE_DEFINE_CONSTANT(target, PRIORITY_HIGH);
788
# undef PRIORITY_HIGH
789
#endif
790
791
#ifdef UV_PRIORITY_HIGHEST
792
# define PRIORITY_HIGHEST UV_PRIORITY_HIGHEST
793
18596
  NODE_DEFINE_CONSTANT(target, PRIORITY_HIGHEST);
794
# undef PRIORITY_HIGHEST
795
#endif
796
4649
}
797
798
4649
void DefineCryptoConstants(Local<Object> target) {
799
#ifdef OPENSSL_VERSION_NUMBER
800
18596
    NODE_DEFINE_CONSTANT(target, OPENSSL_VERSION_NUMBER);
801
#endif
802
803
#ifdef SSL_OP_ALL
804
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALL);
805
#endif
806
807
#ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
808
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION);
809
#endif
810
811
#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
812
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_CIPHER_SERVER_PREFERENCE);
813
#endif
814
815
#ifdef SSL_OP_CISCO_ANYCONNECT
816
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_CISCO_ANYCONNECT);
817
#endif
818
819
#ifdef SSL_OP_COOKIE_EXCHANGE
820
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_COOKIE_EXCHANGE);
821
#endif
822
823
#ifdef SSL_OP_CRYPTOPRO_TLSEXT_BUG
824
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_CRYPTOPRO_TLSEXT_BUG);
825
#endif
826
827
#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
828
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
829
#endif
830
831
#ifdef SSL_OP_EPHEMERAL_RSA
832
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_EPHEMERAL_RSA);
833
#endif
834
835
#ifdef SSL_OP_LEGACY_SERVER_CONNECT
836
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_LEGACY_SERVER_CONNECT);
837
#endif
838
839
#ifdef SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
840
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER);
841
#endif
842
843
#ifdef SSL_OP_MICROSOFT_SESS_ID_BUG
844
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_SESS_ID_BUG);
845
#endif
846
847
#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING
848
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_MSIE_SSLV2_RSA_PADDING);
849
#endif
850
851
#ifdef SSL_OP_NETSCAPE_CA_DN_BUG
852
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CA_DN_BUG);
853
#endif
854
855
#ifdef SSL_OP_NETSCAPE_CHALLENGE_BUG
856
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CHALLENGE_BUG);
857
#endif
858
859
#ifdef SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
860
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
861
#endif
862
863
#ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
864
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG);
865
#endif
866
867
#ifdef SSL_OP_NO_COMPRESSION
868
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_COMPRESSION);
869
#endif
870
871
#ifdef SSL_OP_NO_QUERY_MTU
872
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_QUERY_MTU);
873
#endif
874
875
#ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
876
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
877
#endif
878
879
#ifdef SSL_OP_NO_SSLv2
880
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv2);
881
#endif
882
883
#ifdef SSL_OP_NO_SSLv3
884
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv3);
885
#endif
886
887
#ifdef SSL_OP_NO_TICKET
888
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TICKET);
889
#endif
890
891
#ifdef SSL_OP_NO_TLSv1
892
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1);
893
#endif
894
895
#ifdef SSL_OP_NO_TLSv1_1
896
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_1);
897
#endif
898
899
#ifdef SSL_OP_NO_TLSv1_2
900
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_2);
901
#endif
902
903
#ifdef SSL_OP_PKCS1_CHECK_1
904
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_1);
905
#endif
906
907
#ifdef SSL_OP_PKCS1_CHECK_2
908
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_2);
909
#endif
910
911
#ifdef SSL_OP_SINGLE_DH_USE
912
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_DH_USE);
913
#endif
914
915
#ifdef SSL_OP_SINGLE_ECDH_USE
916
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_ECDH_USE);
917
#endif
918
919
#ifdef SSL_OP_SSLEAY_080_CLIENT_DH_BUG
920
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLEAY_080_CLIENT_DH_BUG);
921
#endif
922
923
#ifdef SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
924
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG);
925
#endif
926
927
#ifdef SSL_OP_TLS_BLOCK_PADDING_BUG
928
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_BLOCK_PADDING_BUG);
929
#endif
930
931
#ifdef SSL_OP_TLS_D5_BUG
932
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_D5_BUG);
933
#endif
934
935
#ifdef SSL_OP_TLS_ROLLBACK_BUG
936
18596
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_ROLLBACK_BUG);
937
#endif
938
939
# ifndef OPENSSL_NO_ENGINE
940
941
# ifdef ENGINE_METHOD_RSA
942
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RSA);
943
# endif
944
945
# ifdef ENGINE_METHOD_DSA
946
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DSA);
947
# endif
948
949
# ifdef ENGINE_METHOD_DH
950
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DH);
951
# endif
952
953
# ifdef ENGINE_METHOD_RAND
954
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RAND);
955
# endif
956
957
# ifdef ENGINE_METHOD_EC
958
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_EC);
959
# endif
960
961
# ifdef ENGINE_METHOD_CIPHERS
962
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_CIPHERS);
963
# endif
964
965
# ifdef ENGINE_METHOD_DIGESTS
966
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DIGESTS);
967
# endif
968
969
# ifdef ENGINE_METHOD_PKEY_METHS
970
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_METHS);
971
# endif
972
973
# ifdef ENGINE_METHOD_PKEY_ASN1_METHS
974
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_ASN1_METHS);
975
# endif
976
977
# ifdef ENGINE_METHOD_ALL
978
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ALL);
979
# endif
980
981
# ifdef ENGINE_METHOD_NONE
982
18596
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_NONE);
983
# endif
984
985
# endif  // !OPENSSL_NO_ENGINE
986
987
#ifdef DH_CHECK_P_NOT_SAFE_PRIME
988
18596
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_SAFE_PRIME);
989
#endif
990
991
#ifdef DH_CHECK_P_NOT_PRIME
992
18596
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_PRIME);
993
#endif
994
995
#ifdef DH_UNABLE_TO_CHECK_GENERATOR
996
18596
    NODE_DEFINE_CONSTANT(target, DH_UNABLE_TO_CHECK_GENERATOR);
997
#endif
998
999
#ifdef DH_NOT_SUITABLE_GENERATOR
1000
18596
    NODE_DEFINE_CONSTANT(target, DH_NOT_SUITABLE_GENERATOR);
1001
#endif
1002
1003
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
1004
#define ALPN_ENABLED 1
1005
18596
    NODE_DEFINE_CONSTANT(target, ALPN_ENABLED);
1006
#endif
1007
1008
#ifdef RSA_PKCS1_PADDING
1009
18596
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PADDING);
1010
#endif
1011
1012
#ifdef RSA_SSLV23_PADDING
1013
18596
    NODE_DEFINE_CONSTANT(target, RSA_SSLV23_PADDING);
1014
#endif
1015
1016
#ifdef RSA_NO_PADDING
1017
18596
    NODE_DEFINE_CONSTANT(target, RSA_NO_PADDING);
1018
#endif
1019
1020
#ifdef RSA_PKCS1_OAEP_PADDING
1021
18596
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_OAEP_PADDING);
1022
#endif
1023
1024
#ifdef RSA_X931_PADDING
1025
18596
    NODE_DEFINE_CONSTANT(target, RSA_X931_PADDING);
1026
#endif
1027
1028
#ifdef RSA_PKCS1_PSS_PADDING
1029
18596
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PSS_PADDING);
1030
#endif
1031
1032
#ifdef RSA_PSS_SALTLEN_DIGEST
1033
18596
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_DIGEST);
1034
#endif
1035
1036
#ifdef RSA_PSS_SALTLEN_MAX_SIGN
1037
18596
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_MAX_SIGN);
1038
#endif
1039
1040
#ifdef RSA_PSS_SALTLEN_AUTO
1041
18596
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_AUTO);
1042
#endif
1043
1044
#ifdef DEFAULT_CIPHER_LIST_CORE
1045
27894
  NODE_DEFINE_STRING_CONSTANT(target,
1046
                              "defaultCoreCipherList",
1047
                              DEFAULT_CIPHER_LIST_CORE);
1048
#endif
1049
1050
#ifdef TLS1_VERSION
1051
18596
  NODE_DEFINE_CONSTANT(target, TLS1_VERSION);
1052
#endif
1053
1054
#ifdef TLS1_1_VERSION
1055
18596
  NODE_DEFINE_CONSTANT(target, TLS1_1_VERSION);
1056
#endif
1057
1058
#ifdef TLS1_2_VERSION
1059
18596
  NODE_DEFINE_CONSTANT(target, TLS1_2_VERSION);
1060
#endif
1061
1062
#ifdef TLS1_3_VERSION
1063
18596
  NODE_DEFINE_CONSTANT(target, TLS1_3_VERSION);
1064
#endif
1065
1066
#if HAVE_OPENSSL
1067
  // NOTE: These are not defines
1068
18596
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_COMPRESSED);
1069
1070
18596
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_UNCOMPRESSED);
1071
1072
18596
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_HYBRID);
1073
1074
27894
  NODE_DEFINE_STRING_CONSTANT(
1075
      target,
1076
      "defaultCipherList",
1077
      per_process::cli_options->tls_cipher_list.c_str());
1078
1079
#endif
1080
4649
}
1081
1082
4649
void DefineSystemConstants(Local<Object> target) {
1083
18596
  NODE_DEFINE_CONSTANT(target, UV_FS_SYMLINK_DIR);
1084
18596
  NODE_DEFINE_CONSTANT(target, UV_FS_SYMLINK_JUNCTION);
1085
  // file access modes
1086
18596
  NODE_DEFINE_CONSTANT(target, O_RDONLY);
1087
18596
  NODE_DEFINE_CONSTANT(target, O_WRONLY);
1088
18596
  NODE_DEFINE_CONSTANT(target, O_RDWR);
1089
1090
  // file types from readdir
1091
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_UNKNOWN);
1092
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_FILE);
1093
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_DIR);
1094
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_LINK);
1095
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_FIFO);
1096
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_SOCKET);
1097
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_CHAR);
1098
18596
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_BLOCK);
1099
1100
18596
  NODE_DEFINE_CONSTANT(target, S_IFMT);
1101
18596
  NODE_DEFINE_CONSTANT(target, S_IFREG);
1102
18596
  NODE_DEFINE_CONSTANT(target, S_IFDIR);
1103
18596
  NODE_DEFINE_CONSTANT(target, S_IFCHR);
1104
#ifdef S_IFBLK
1105
18596
  NODE_DEFINE_CONSTANT(target, S_IFBLK);
1106
#endif
1107
1108
#ifdef S_IFIFO
1109
18596
  NODE_DEFINE_CONSTANT(target, S_IFIFO);
1110
#endif
1111
1112
#ifdef S_IFLNK
1113
18596
  NODE_DEFINE_CONSTANT(target, S_IFLNK);
1114
#endif
1115
1116
#ifdef S_IFSOCK
1117
18596
  NODE_DEFINE_CONSTANT(target, S_IFSOCK);
1118
#endif
1119
1120
#ifdef O_CREAT
1121
18596
  NODE_DEFINE_CONSTANT(target, O_CREAT);
1122
#endif
1123
1124
#ifdef O_EXCL
1125
18596
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1126
#endif
1127
1128
#ifdef O_NOCTTY
1129
18596
  NODE_DEFINE_CONSTANT(target, O_NOCTTY);
1130
#endif
1131
1132
#ifdef O_TRUNC
1133
18596
  NODE_DEFINE_CONSTANT(target, O_TRUNC);
1134
#endif
1135
1136
#ifdef O_APPEND
1137
18596
  NODE_DEFINE_CONSTANT(target, O_APPEND);
1138
#endif
1139
1140
#ifdef O_DIRECTORY
1141
18596
  NODE_DEFINE_CONSTANT(target, O_DIRECTORY);
1142
#endif
1143
1144
#ifdef O_EXCL
1145
18596
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1146
#endif
1147
1148
#ifdef O_NOATIME
1149
18596
  NODE_DEFINE_CONSTANT(target, O_NOATIME);
1150
#endif
1151
1152
#ifdef O_NOFOLLOW
1153
18596
  NODE_DEFINE_CONSTANT(target, O_NOFOLLOW);
1154
#endif
1155
1156
#ifdef O_SYNC
1157
18596
  NODE_DEFINE_CONSTANT(target, O_SYNC);
1158
#endif
1159
1160
#ifdef O_DSYNC
1161
18596
  NODE_DEFINE_CONSTANT(target, O_DSYNC);
1162
#endif
1163
1164
1165
#ifdef O_SYMLINK
1166
  NODE_DEFINE_CONSTANT(target, O_SYMLINK);
1167
#endif
1168
1169
#ifdef O_DIRECT
1170
18596
  NODE_DEFINE_CONSTANT(target, O_DIRECT);
1171
#endif
1172
1173
#ifdef O_NONBLOCK
1174
18596
  NODE_DEFINE_CONSTANT(target, O_NONBLOCK);
1175
#endif
1176
1177
#ifdef S_IRWXU
1178
18596
  NODE_DEFINE_CONSTANT(target, S_IRWXU);
1179
#endif
1180
1181
#ifdef S_IRUSR
1182
18596
  NODE_DEFINE_CONSTANT(target, S_IRUSR);
1183
#endif
1184
1185
#ifdef S_IWUSR
1186
18596
  NODE_DEFINE_CONSTANT(target, S_IWUSR);
1187
#endif
1188
1189
#ifdef S_IXUSR
1190
18596
  NODE_DEFINE_CONSTANT(target, S_IXUSR);
1191
#endif
1192
1193
#ifdef S_IRWXG
1194
18596
  NODE_DEFINE_CONSTANT(target, S_IRWXG);
1195
#endif
1196
1197
#ifdef S_IRGRP
1198
18596
  NODE_DEFINE_CONSTANT(target, S_IRGRP);
1199
#endif
1200
1201
#ifdef S_IWGRP
1202
18596
  NODE_DEFINE_CONSTANT(target, S_IWGRP);
1203
#endif
1204
1205
#ifdef S_IXGRP
1206
18596
  NODE_DEFINE_CONSTANT(target, S_IXGRP);
1207
#endif
1208
1209
#ifdef S_IRWXO
1210
18596
  NODE_DEFINE_CONSTANT(target, S_IRWXO);
1211
#endif
1212
1213
#ifdef S_IROTH
1214
18596
  NODE_DEFINE_CONSTANT(target, S_IROTH);
1215
#endif
1216
1217
#ifdef S_IWOTH
1218
18596
  NODE_DEFINE_CONSTANT(target, S_IWOTH);
1219
#endif
1220
1221
#ifdef S_IXOTH
1222
18596
  NODE_DEFINE_CONSTANT(target, S_IXOTH);
1223
#endif
1224
1225
#ifdef F_OK
1226
18596
  NODE_DEFINE_CONSTANT(target, F_OK);
1227
#endif
1228
1229
#ifdef R_OK
1230
18596
  NODE_DEFINE_CONSTANT(target, R_OK);
1231
#endif
1232
1233
#ifdef W_OK
1234
18596
  NODE_DEFINE_CONSTANT(target, W_OK);
1235
#endif
1236
1237
#ifdef X_OK
1238
18596
  NODE_DEFINE_CONSTANT(target, X_OK);
1239
#endif
1240
1241
#ifdef UV_FS_COPYFILE_EXCL
1242
# define COPYFILE_EXCL UV_FS_COPYFILE_EXCL
1243
18596
  NODE_DEFINE_CONSTANT(target, UV_FS_COPYFILE_EXCL);
1244
18596
  NODE_DEFINE_CONSTANT(target, COPYFILE_EXCL);
1245
# undef COPYFILE_EXCL
1246
#endif
1247
1248
#ifdef UV_FS_COPYFILE_FICLONE
1249
# define COPYFILE_FICLONE UV_FS_COPYFILE_FICLONE
1250
18596
  NODE_DEFINE_CONSTANT(target, UV_FS_COPYFILE_FICLONE);
1251
18596
  NODE_DEFINE_CONSTANT(target, COPYFILE_FICLONE);
1252
# undef COPYFILE_FICLONE
1253
#endif
1254
1255
#ifdef UV_FS_COPYFILE_FICLONE_FORCE
1256
# define COPYFILE_FICLONE_FORCE UV_FS_COPYFILE_FICLONE_FORCE
1257
18596
  NODE_DEFINE_CONSTANT(target, UV_FS_COPYFILE_FICLONE_FORCE);
1258
18596
  NODE_DEFINE_CONSTANT(target, COPYFILE_FICLONE_FORCE);
1259
# undef COPYFILE_FICLONE_FORCE
1260
#endif
1261
4649
}
1262
1263
4649
void DefineDLOpenConstants(Local<Object> target) {
1264
#ifdef RTLD_LAZY
1265
18596
  NODE_DEFINE_CONSTANT(target, RTLD_LAZY);
1266
#endif
1267
1268
#ifdef RTLD_NOW
1269
18596
  NODE_DEFINE_CONSTANT(target, RTLD_NOW);
1270
#endif
1271
1272
#ifdef RTLD_GLOBAL
1273
18596
  NODE_DEFINE_CONSTANT(target, RTLD_GLOBAL);
1274
#endif
1275
1276
#ifdef RTLD_LOCAL
1277
18596
  NODE_DEFINE_CONSTANT(target, RTLD_LOCAL);
1278
#endif
1279
1280
#ifdef RTLD_DEEPBIND
1281
18596
  NODE_DEFINE_CONSTANT(target, RTLD_DEEPBIND);
1282
#endif
1283
4649
}
1284
1285
4649
void DefineTraceConstants(Local<Object> target) {
1286
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_BEGIN);
1287
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_END);
1288
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_COMPLETE);
1289
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_INSTANT);
1290
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_BEGIN);
1291
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_STEP_INTO);
1292
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_STEP_PAST);
1293
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_END);
1294
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN);
1295
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_NESTABLE_ASYNC_END);
1296
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT);
1297
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_FLOW_BEGIN);
1298
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_FLOW_STEP);
1299
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_FLOW_END);
1300
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_METADATA);
1301
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_COUNTER);
1302
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_SAMPLE);
1303
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_CREATE_OBJECT);
1304
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_SNAPSHOT_OBJECT);
1305
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_DELETE_OBJECT);
1306
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_MEMORY_DUMP);
1307
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_MARK);
1308
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_CLOCK_SYNC);
1309
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ENTER_CONTEXT);
1310
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_LEAVE_CONTEXT);
1311
18596
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_LINK_IDS);
1312
4649
}
1313
1314
}  // anonymous namespace
1315
1316
4649
void DefineConstants(v8::Isolate* isolate, Local<Object> target) {
1317
4649
  Environment* env = Environment::GetCurrent(isolate);
1318
1319
4649
  Local<Object> os_constants = Object::New(isolate);
1320
18596
  CHECK(os_constants->SetPrototype(env->context(),
1321
                                   Null(env->isolate())).FromJust());
1322
1323
4649
  Local<Object> err_constants = Object::New(isolate);
1324
18596
  CHECK(err_constants->SetPrototype(env->context(),
1325
                                    Null(env->isolate())).FromJust());
1326
1327
4649
  Local<Object> sig_constants = Object::New(isolate);
1328
18596
  CHECK(sig_constants->SetPrototype(env->context(),
1329
                                    Null(env->isolate())).FromJust());
1330
1331
4649
  Local<Object> priority_constants = Object::New(isolate);
1332
18596
  CHECK(priority_constants->SetPrototype(env->context(),
1333
                                         Null(env->isolate())).FromJust());
1334
1335
4649
  Local<Object> fs_constants = Object::New(isolate);
1336
18596
  CHECK(fs_constants->SetPrototype(env->context(),
1337
                                   Null(env->isolate())).FromJust());
1338
1339
4649
  Local<Object> crypto_constants = Object::New(isolate);
1340
18596
  CHECK(crypto_constants->SetPrototype(env->context(),
1341
                                       Null(env->isolate())).FromJust());
1342
1343
4649
  Local<Object> zlib_constants = Object::New(isolate);
1344
18596
  CHECK(zlib_constants->SetPrototype(env->context(),
1345
                                     Null(env->isolate())).FromJust());
1346
1347
4649
  Local<Object> dlopen_constants = Object::New(isolate);
1348
18596
  CHECK(dlopen_constants->SetPrototype(env->context(),
1349
                                       Null(env->isolate())).FromJust());
1350
1351
4649
  Local<Object> trace_constants = Object::New(isolate);
1352
18596
  CHECK(trace_constants->SetPrototype(env->context(),
1353
                                      Null(env->isolate())).FromJust());
1354
1355
4649
  DefineErrnoConstants(err_constants);
1356
4649
  DefineWindowsErrorConstants(err_constants);
1357
4649
  DefineSignalConstants(sig_constants);
1358
4649
  DefinePriorityConstants(priority_constants);
1359
4649
  DefineSystemConstants(fs_constants);
1360
4649
  DefineCryptoConstants(crypto_constants);
1361
4649
  DefineZlibConstants(zlib_constants);
1362
4649
  DefineDLOpenConstants(dlopen_constants);
1363
4649
  DefineTraceConstants(trace_constants);
1364
1365
  // Define libuv constants.
1366
18596
  NODE_DEFINE_CONSTANT(os_constants, UV_UDP_REUSEADDR);
1367
1368
  os_constants->Set(env->context(),
1369
                    OneByteString(isolate, "dlopen"),
1370
18596
                    dlopen_constants).Check();
1371
  os_constants->Set(env->context(),
1372
                    OneByteString(isolate, "errno"),
1373
18596
                    err_constants).Check();
1374
  os_constants->Set(env->context(),
1375
                    OneByteString(isolate, "signals"),
1376
18596
                    sig_constants).Check();
1377
  os_constants->Set(env->context(),
1378
                    OneByteString(isolate, "priority"),
1379
18596
                    priority_constants).Check();
1380
  target->Set(env->context(),
1381
              OneByteString(isolate, "os"),
1382
18596
              os_constants).Check();
1383
  target->Set(env->context(),
1384
              OneByteString(isolate, "fs"),
1385
18596
              fs_constants).Check();
1386
  target->Set(env->context(),
1387
              OneByteString(isolate, "crypto"),
1388
18596
              crypto_constants).Check();
1389
  target->Set(env->context(),
1390
              OneByteString(isolate, "zlib"),
1391
18596
              zlib_constants).Check();
1392
  target->Set(env->context(),
1393
              OneByteString(isolate, "trace"),
1394
18596
              trace_constants).Check();
1395
4649
}
1396
1397
}  // namespace node