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

14316
}  // namespace node