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

14535
}  // namespace node