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

366
}  // namespace node