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

13995
}  // namespace node