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