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

13323
}  // namespace node