GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/node_constants.cc Lines: 334 334 100.0 %
Date: 2019-01-07 12:15:22 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 "node_constants.h"
23
#include "node_internals.h"
24
25
#include "zlib.h"
26
27
#include <errno.h>
28
#if !defined(_MSC_VER)
29
#include <unistd.h>
30
#endif
31
#include <fcntl.h>
32
#include <signal.h>
33
#include <sys/types.h>
34
#include <sys/stat.h>
35
#include <limits>
36
37
#if HAVE_OPENSSL
38
# include <openssl/ec.h>
39
# include <openssl/ssl.h>
40
# ifndef OPENSSL_NO_ENGINE
41
#  include <openssl/engine.h>
42
# endif  // !OPENSSL_NO_ENGINE
43
#endif
44
45
#if defined(__POSIX__)
46
#include <dlfcn.h>
47
#endif
48
49
namespace node {
50
51
using v8::Local;
52
using v8::Object;
53
54
namespace {
55
56
3661
void DefineErrnoConstants(Local<Object> target) {
57
#ifdef E2BIG
58
14644
  NODE_DEFINE_CONSTANT(target, E2BIG);
59
#endif
60
61
#ifdef EACCES
62
14644
  NODE_DEFINE_CONSTANT(target, EACCES);
63
#endif
64
65
#ifdef EADDRINUSE
66
14644
  NODE_DEFINE_CONSTANT(target, EADDRINUSE);
67
#endif
68
69
#ifdef EADDRNOTAVAIL
70
14644
  NODE_DEFINE_CONSTANT(target, EADDRNOTAVAIL);
71
#endif
72
73
#ifdef EAFNOSUPPORT
74
14644
  NODE_DEFINE_CONSTANT(target, EAFNOSUPPORT);
75
#endif
76
77
#ifdef EAGAIN
78
14644
  NODE_DEFINE_CONSTANT(target, EAGAIN);
79
#endif
80
81
#ifdef EALREADY
82
14644
  NODE_DEFINE_CONSTANT(target, EALREADY);
83
#endif
84
85
#ifdef EBADF
86
14644
  NODE_DEFINE_CONSTANT(target, EBADF);
87
#endif
88
89
#ifdef EBADMSG
90
14644
  NODE_DEFINE_CONSTANT(target, EBADMSG);
91
#endif
92
93
#ifdef EBUSY
94
14644
  NODE_DEFINE_CONSTANT(target, EBUSY);
95
#endif
96
97
#ifdef ECANCELED
98
14644
  NODE_DEFINE_CONSTANT(target, ECANCELED);
99
#endif
100
101
#ifdef ECHILD
102
14644
  NODE_DEFINE_CONSTANT(target, ECHILD);
103
#endif
104
105
#ifdef ECONNABORTED
106
14644
  NODE_DEFINE_CONSTANT(target, ECONNABORTED);
107
#endif
108
109
#ifdef ECONNREFUSED
110
14644
  NODE_DEFINE_CONSTANT(target, ECONNREFUSED);
111
#endif
112
113
#ifdef ECONNRESET
114
14644
  NODE_DEFINE_CONSTANT(target, ECONNRESET);
115
#endif
116
117
#ifdef EDEADLK
118
14644
  NODE_DEFINE_CONSTANT(target, EDEADLK);
119
#endif
120
121
#ifdef EDESTADDRREQ
122
14644
  NODE_DEFINE_CONSTANT(target, EDESTADDRREQ);
123
#endif
124
125
#ifdef EDOM
126
14644
  NODE_DEFINE_CONSTANT(target, EDOM);
127
#endif
128
129
#ifdef EDQUOT
130
14644
  NODE_DEFINE_CONSTANT(target, EDQUOT);
131
#endif
132
133
#ifdef EEXIST
134
14644
  NODE_DEFINE_CONSTANT(target, EEXIST);
135
#endif
136
137
#ifdef EFAULT
138
14644
  NODE_DEFINE_CONSTANT(target, EFAULT);
139
#endif
140
141
#ifdef EFBIG
142
14644
  NODE_DEFINE_CONSTANT(target, EFBIG);
143
#endif
144
145
#ifdef EHOSTUNREACH
146
14644
  NODE_DEFINE_CONSTANT(target, EHOSTUNREACH);
147
#endif
148
149
#ifdef EIDRM
150
14644
  NODE_DEFINE_CONSTANT(target, EIDRM);
151
#endif
152
153
#ifdef EILSEQ
154
14644
  NODE_DEFINE_CONSTANT(target, EILSEQ);
155
#endif
156
157
#ifdef EINPROGRESS
158
14644
  NODE_DEFINE_CONSTANT(target, EINPROGRESS);
159
#endif
160
161
#ifdef EINTR
162
14644
  NODE_DEFINE_CONSTANT(target, EINTR);
163
#endif
164
165
#ifdef EINVAL
166
14644
  NODE_DEFINE_CONSTANT(target, EINVAL);
167
#endif
168
169
#ifdef EIO
170
14644
  NODE_DEFINE_CONSTANT(target, EIO);
171
#endif
172
173
#ifdef EISCONN
174
14644
  NODE_DEFINE_CONSTANT(target, EISCONN);
175
#endif
176
177
#ifdef EISDIR
178
14644
  NODE_DEFINE_CONSTANT(target, EISDIR);
179
#endif
180
181
#ifdef ELOOP
182
14644
  NODE_DEFINE_CONSTANT(target, ELOOP);
183
#endif
184
185
#ifdef EMFILE
186
14644
  NODE_DEFINE_CONSTANT(target, EMFILE);
187
#endif
188
189
#ifdef EMLINK
190
14644
  NODE_DEFINE_CONSTANT(target, EMLINK);
191
#endif
192
193
#ifdef EMSGSIZE
194
14644
  NODE_DEFINE_CONSTANT(target, EMSGSIZE);
195
#endif
196
197
#ifdef EMULTIHOP
198
14644
  NODE_DEFINE_CONSTANT(target, EMULTIHOP);
199
#endif
200
201
#ifdef ENAMETOOLONG
202
14644
  NODE_DEFINE_CONSTANT(target, ENAMETOOLONG);
203
#endif
204
205
#ifdef ENETDOWN
206
14644
  NODE_DEFINE_CONSTANT(target, ENETDOWN);
207
#endif
208
209
#ifdef ENETRESET
210
14644
  NODE_DEFINE_CONSTANT(target, ENETRESET);
211
#endif
212
213
#ifdef ENETUNREACH
214
14644
  NODE_DEFINE_CONSTANT(target, ENETUNREACH);
215
#endif
216
217
#ifdef ENFILE
218
14644
  NODE_DEFINE_CONSTANT(target, ENFILE);
219
#endif
220
221
#ifdef ENOBUFS
222
14644
  NODE_DEFINE_CONSTANT(target, ENOBUFS);
223
#endif
224
225
#ifdef ENODATA
226
14644
  NODE_DEFINE_CONSTANT(target, ENODATA);
227
#endif
228
229
#ifdef ENODEV
230
14644
  NODE_DEFINE_CONSTANT(target, ENODEV);
231
#endif
232
233
#ifdef ENOENT
234
14644
  NODE_DEFINE_CONSTANT(target, ENOENT);
235
#endif
236
237
#ifdef ENOEXEC
238
14644
  NODE_DEFINE_CONSTANT(target, ENOEXEC);
239
#endif
240
241
#ifdef ENOLCK
242
14644
  NODE_DEFINE_CONSTANT(target, ENOLCK);
243
#endif
244
245
#ifdef ENOLINK
246
14644
  NODE_DEFINE_CONSTANT(target, ENOLINK);
247
#endif
248
249
#ifdef ENOMEM
250
14644
  NODE_DEFINE_CONSTANT(target, ENOMEM);
251
#endif
252
253
#ifdef ENOMSG
254
14644
  NODE_DEFINE_CONSTANT(target, ENOMSG);
255
#endif
256
257
#ifdef ENOPROTOOPT
258
14644
  NODE_DEFINE_CONSTANT(target, ENOPROTOOPT);
259
#endif
260
261
#ifdef ENOSPC
262
14644
  NODE_DEFINE_CONSTANT(target, ENOSPC);
263
#endif
264
265
#ifdef ENOSR
266
14644
  NODE_DEFINE_CONSTANT(target, ENOSR);
267
#endif
268
269
#ifdef ENOSTR
270
14644
  NODE_DEFINE_CONSTANT(target, ENOSTR);
271
#endif
272
273
#ifdef ENOSYS
274
14644
  NODE_DEFINE_CONSTANT(target, ENOSYS);
275
#endif
276
277
#ifdef ENOTCONN
278
14644
  NODE_DEFINE_CONSTANT(target, ENOTCONN);
279
#endif
280
281
#ifdef ENOTDIR
282
14644
  NODE_DEFINE_CONSTANT(target, ENOTDIR);
283
#endif
284
285
#ifdef ENOTEMPTY
286
14644
  NODE_DEFINE_CONSTANT(target, ENOTEMPTY);
287
#endif
288
289
#ifdef ENOTSOCK
290
14644
  NODE_DEFINE_CONSTANT(target, ENOTSOCK);
291
#endif
292
293
#ifdef ENOTSUP
294
14644
  NODE_DEFINE_CONSTANT(target, ENOTSUP);
295
#endif
296
297
#ifdef ENOTTY
298
14644
  NODE_DEFINE_CONSTANT(target, ENOTTY);
299
#endif
300
301
#ifdef ENXIO
302
14644
  NODE_DEFINE_CONSTANT(target, ENXIO);
303
#endif
304
305
#ifdef EOPNOTSUPP
306
14644
  NODE_DEFINE_CONSTANT(target, EOPNOTSUPP);
307
#endif
308
309
#ifdef EOVERFLOW
310
14644
  NODE_DEFINE_CONSTANT(target, EOVERFLOW);
311
#endif
312
313
#ifdef EPERM
314
14644
  NODE_DEFINE_CONSTANT(target, EPERM);
315
#endif
316
317
#ifdef EPIPE
318
14644
  NODE_DEFINE_CONSTANT(target, EPIPE);
319
#endif
320
321
#ifdef EPROTO
322
14644
  NODE_DEFINE_CONSTANT(target, EPROTO);
323
#endif
324
325
#ifdef EPROTONOSUPPORT
326
14644
  NODE_DEFINE_CONSTANT(target, EPROTONOSUPPORT);
327
#endif
328
329
#ifdef EPROTOTYPE
330
14644
  NODE_DEFINE_CONSTANT(target, EPROTOTYPE);
331
#endif
332
333
#ifdef ERANGE
334
14644
  NODE_DEFINE_CONSTANT(target, ERANGE);
335
#endif
336
337
#ifdef EROFS
338
14644
  NODE_DEFINE_CONSTANT(target, EROFS);
339
#endif
340
341
#ifdef ESPIPE
342
14644
  NODE_DEFINE_CONSTANT(target, ESPIPE);
343
#endif
344
345
#ifdef ESRCH
346
14644
  NODE_DEFINE_CONSTANT(target, ESRCH);
347
#endif
348
349
#ifdef ESTALE
350
14644
  NODE_DEFINE_CONSTANT(target, ESTALE);
351
#endif
352
353
#ifdef ETIME
354
14644
  NODE_DEFINE_CONSTANT(target, ETIME);
355
#endif
356
357
#ifdef ETIMEDOUT
358
14644
  NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
359
#endif
360
361
#ifdef ETXTBSY
362
14644
  NODE_DEFINE_CONSTANT(target, ETXTBSY);
363
#endif
364
365
#ifdef EWOULDBLOCK
366
14644
  NODE_DEFINE_CONSTANT(target, EWOULDBLOCK);
367
#endif
368
369
#ifdef EXDEV
370
14644
  NODE_DEFINE_CONSTANT(target, EXDEV);
371
#endif
372
3661
}
373
374
3661
void DefineWindowsErrorConstants(Local<Object> target) {
375
#ifdef WSAEINTR
376
  NODE_DEFINE_CONSTANT(target, WSAEINTR);
377
#endif
378
379
#ifdef WSAEBADF
380
  NODE_DEFINE_CONSTANT(target, WSAEBADF);
381
#endif
382
383
#ifdef WSAEACCES
384
  NODE_DEFINE_CONSTANT(target, WSAEACCES);
385
#endif
386
387
#ifdef WSAEFAULT
388
  NODE_DEFINE_CONSTANT(target, WSAEFAULT);
389
#endif
390
391
#ifdef WSAEINVAL
392
  NODE_DEFINE_CONSTANT(target, WSAEINVAL);
393
#endif
394
395
#ifdef WSAEMFILE
396
  NODE_DEFINE_CONSTANT(target, WSAEMFILE);
397
#endif
398
399
#ifdef WSAEWOULDBLOCK
400
  NODE_DEFINE_CONSTANT(target, WSAEWOULDBLOCK);
401
#endif
402
403
#ifdef WSAEINPROGRESS
404
  NODE_DEFINE_CONSTANT(target, WSAEINPROGRESS);
405
#endif
406
407
#ifdef WSAEALREADY
408
  NODE_DEFINE_CONSTANT(target, WSAEALREADY);
409
#endif
410
411
#ifdef WSAENOTSOCK
412
  NODE_DEFINE_CONSTANT(target, WSAENOTSOCK);
413
#endif
414
415
#ifdef WSAEDESTADDRREQ
416
  NODE_DEFINE_CONSTANT(target, WSAEDESTADDRREQ);
417
#endif
418
419
#ifdef WSAEMSGSIZE
420
  NODE_DEFINE_CONSTANT(target, WSAEMSGSIZE);
421
#endif
422
423
#ifdef WSAEPROTOTYPE
424
  NODE_DEFINE_CONSTANT(target, WSAEPROTOTYPE);
425
#endif
426
427
#ifdef WSAENOPROTOOPT
428
  NODE_DEFINE_CONSTANT(target, WSAENOPROTOOPT);
429
#endif
430
431
#ifdef WSAEPROTONOSUPPORT
432
  NODE_DEFINE_CONSTANT(target, WSAEPROTONOSUPPORT);
433
#endif
434
435
#ifdef WSAESOCKTNOSUPPORT
436
  NODE_DEFINE_CONSTANT(target, WSAESOCKTNOSUPPORT);
437
#endif
438
439
#ifdef WSAEOPNOTSUPP
440
  NODE_DEFINE_CONSTANT(target, WSAEOPNOTSUPP);
441
#endif
442
443
#ifdef WSAEPFNOSUPPORT
444
  NODE_DEFINE_CONSTANT(target, WSAEPFNOSUPPORT);
445
#endif
446
447
#ifdef WSAEAFNOSUPPORT
448
  NODE_DEFINE_CONSTANT(target, WSAEAFNOSUPPORT);
449
#endif
450
451
#ifdef WSAEADDRINUSE
452
  NODE_DEFINE_CONSTANT(target, WSAEADDRINUSE);
453
#endif
454
455
#ifdef WSAEADDRNOTAVAIL
456
  NODE_DEFINE_CONSTANT(target, WSAEADDRNOTAVAIL);
457
#endif
458
459
#ifdef WSAENETDOWN
460
  NODE_DEFINE_CONSTANT(target, WSAENETDOWN);
461
#endif
462
463
#ifdef WSAENETUNREACH
464
  NODE_DEFINE_CONSTANT(target, WSAENETUNREACH);
465
#endif
466
467
#ifdef WSAENETRESET
468
  NODE_DEFINE_CONSTANT(target, WSAENETRESET);
469
#endif
470
471
#ifdef WSAECONNABORTED
472
  NODE_DEFINE_CONSTANT(target, WSAECONNABORTED);
473
#endif
474
475
#ifdef WSAECONNRESET
476
  NODE_DEFINE_CONSTANT(target, WSAECONNRESET);
477
#endif
478
479
#ifdef WSAENOBUFS
480
  NODE_DEFINE_CONSTANT(target, WSAENOBUFS);
481
#endif
482
483
#ifdef WSAEISCONN
484
  NODE_DEFINE_CONSTANT(target, WSAEISCONN);
485
#endif
486
487
#ifdef WSAENOTCONN
488
  NODE_DEFINE_CONSTANT(target, WSAENOTCONN);
489
#endif
490
491
#ifdef WSAESHUTDOWN
492
  NODE_DEFINE_CONSTANT(target, WSAESHUTDOWN);
493
#endif
494
495
#ifdef WSAETOOMANYREFS
496
  NODE_DEFINE_CONSTANT(target, WSAETOOMANYREFS);
497
#endif
498
499
#ifdef WSAETIMEDOUT
500
  NODE_DEFINE_CONSTANT(target, WSAETIMEDOUT);
501
#endif
502
503
#ifdef WSAECONNREFUSED
504
  NODE_DEFINE_CONSTANT(target, WSAECONNREFUSED);
505
#endif
506
507
#ifdef WSAELOOP
508
  NODE_DEFINE_CONSTANT(target, WSAELOOP);
509
#endif
510
511
#ifdef WSAENAMETOOLONG
512
  NODE_DEFINE_CONSTANT(target, WSAENAMETOOLONG);
513
#endif
514
515
#ifdef WSAEHOSTDOWN
516
  NODE_DEFINE_CONSTANT(target, WSAEHOSTDOWN);
517
#endif
518
519
#ifdef WSAEHOSTUNREACH
520
  NODE_DEFINE_CONSTANT(target, WSAEHOSTUNREACH);
521
#endif
522
523
#ifdef WSAENOTEMPTY
524
  NODE_DEFINE_CONSTANT(target, WSAENOTEMPTY);
525
#endif
526
527
#ifdef WSAEPROCLIM
528
  NODE_DEFINE_CONSTANT(target, WSAEPROCLIM);
529
#endif
530
531
#ifdef WSAEUSERS
532
  NODE_DEFINE_CONSTANT(target, WSAEUSERS);
533
#endif
534
535
#ifdef WSAEDQUOT
536
  NODE_DEFINE_CONSTANT(target, WSAEDQUOT);
537
#endif
538
539
#ifdef WSAESTALE
540
  NODE_DEFINE_CONSTANT(target, WSAESTALE);
541
#endif
542
543
#ifdef WSAEREMOTE
544
  NODE_DEFINE_CONSTANT(target, WSAEREMOTE);
545
#endif
546
547
#ifdef WSASYSNOTREADY
548
  NODE_DEFINE_CONSTANT(target, WSASYSNOTREADY);
549
#endif
550
551
#ifdef WSAVERNOTSUPPORTED
552
  NODE_DEFINE_CONSTANT(target, WSAVERNOTSUPPORTED);
553
#endif
554
555
#ifdef WSANOTINITIALISED
556
  NODE_DEFINE_CONSTANT(target, WSANOTINITIALISED);
557
#endif
558
559
#ifdef WSAEDISCON
560
  NODE_DEFINE_CONSTANT(target, WSAEDISCON);
561
#endif
562
563
#ifdef WSAENOMORE
564
  NODE_DEFINE_CONSTANT(target, WSAENOMORE);
565
#endif
566
567
#ifdef WSAECANCELLED
568
  NODE_DEFINE_CONSTANT(target, WSAECANCELLED);
569
#endif
570
571
#ifdef WSAEINVALIDPROCTABLE
572
  NODE_DEFINE_CONSTANT(target, WSAEINVALIDPROCTABLE);
573
#endif
574
575
#ifdef WSAEINVALIDPROVIDER
576
  NODE_DEFINE_CONSTANT(target, WSAEINVALIDPROVIDER);
577
#endif
578
579
#ifdef WSAEPROVIDERFAILEDINIT
580
  NODE_DEFINE_CONSTANT(target, WSAEPROVIDERFAILEDINIT);
581
#endif
582
583
#ifdef WSASYSCALLFAILURE
584
  NODE_DEFINE_CONSTANT(target, WSASYSCALLFAILURE);
585
#endif
586
587
#ifdef WSASERVICE_NOT_FOUND
588
  NODE_DEFINE_CONSTANT(target, WSASERVICE_NOT_FOUND);
589
#endif
590
591
#ifdef WSATYPE_NOT_FOUND
592
  NODE_DEFINE_CONSTANT(target, WSATYPE_NOT_FOUND);
593
#endif
594
595
#ifdef WSA_E_NO_MORE
596
  NODE_DEFINE_CONSTANT(target, WSA_E_NO_MORE);
597
#endif
598
599
#ifdef WSA_E_CANCELLED
600
  NODE_DEFINE_CONSTANT(target, WSA_E_CANCELLED);
601
#endif
602
603
#ifdef WSAEREFUSED
604
  NODE_DEFINE_CONSTANT(target, WSAEREFUSED);
605
#endif
606
3661
}
607
608
3661
void DefineSignalConstants(Local<Object> target) {
609
#ifdef SIGHUP
610
14644
  NODE_DEFINE_CONSTANT(target, SIGHUP);
611
#endif
612
613
#ifdef SIGINT
614
14644
  NODE_DEFINE_CONSTANT(target, SIGINT);
615
#endif
616
617
#ifdef SIGQUIT
618
14644
  NODE_DEFINE_CONSTANT(target, SIGQUIT);
619
#endif
620
621
#ifdef SIGILL
622
14644
  NODE_DEFINE_CONSTANT(target, SIGILL);
623
#endif
624
625
#ifdef SIGTRAP
626
14644
  NODE_DEFINE_CONSTANT(target, SIGTRAP);
627
#endif
628
629
#ifdef SIGABRT
630
14644
  NODE_DEFINE_CONSTANT(target, SIGABRT);
631
#endif
632
633
#ifdef SIGIOT
634
14644
  NODE_DEFINE_CONSTANT(target, SIGIOT);
635
#endif
636
637
#ifdef SIGBUS
638
14644
  NODE_DEFINE_CONSTANT(target, SIGBUS);
639
#endif
640
641
#ifdef SIGFPE
642
14644
  NODE_DEFINE_CONSTANT(target, SIGFPE);
643
#endif
644
645
#ifdef SIGKILL
646
14644
  NODE_DEFINE_CONSTANT(target, SIGKILL);
647
#endif
648
649
#ifdef SIGUSR1
650
14644
  NODE_DEFINE_CONSTANT(target, SIGUSR1);
651
#endif
652
653
#ifdef SIGSEGV
654
14644
  NODE_DEFINE_CONSTANT(target, SIGSEGV);
655
#endif
656
657
#ifdef SIGUSR2
658
14644
  NODE_DEFINE_CONSTANT(target, SIGUSR2);
659
#endif
660
661
#ifdef SIGPIPE
662
14644
  NODE_DEFINE_CONSTANT(target, SIGPIPE);
663
#endif
664
665
#ifdef SIGALRM
666
14644
  NODE_DEFINE_CONSTANT(target, SIGALRM);
667
#endif
668
669
14644
  NODE_DEFINE_CONSTANT(target, SIGTERM);
670
671
#ifdef SIGCHLD
672
14644
  NODE_DEFINE_CONSTANT(target, SIGCHLD);
673
#endif
674
675
#ifdef SIGSTKFLT
676
14644
  NODE_DEFINE_CONSTANT(target, SIGSTKFLT);
677
#endif
678
679
680
#ifdef SIGCONT
681
14644
  NODE_DEFINE_CONSTANT(target, SIGCONT);
682
#endif
683
684
#ifdef SIGSTOP
685
14644
  NODE_DEFINE_CONSTANT(target, SIGSTOP);
686
#endif
687
688
#ifdef SIGTSTP
689
14644
  NODE_DEFINE_CONSTANT(target, SIGTSTP);
690
#endif
691
692
#ifdef SIGBREAK
693
  NODE_DEFINE_CONSTANT(target, SIGBREAK);
694
#endif
695
696
#ifdef SIGTTIN
697
14644
  NODE_DEFINE_CONSTANT(target, SIGTTIN);
698
#endif
699
700
#ifdef SIGTTOU
701
14644
  NODE_DEFINE_CONSTANT(target, SIGTTOU);
702
#endif
703
704
#ifdef SIGURG
705
14644
  NODE_DEFINE_CONSTANT(target, SIGURG);
706
#endif
707
708
#ifdef SIGXCPU
709
14644
  NODE_DEFINE_CONSTANT(target, SIGXCPU);
710
#endif
711
712
#ifdef SIGXFSZ
713
14644
  NODE_DEFINE_CONSTANT(target, SIGXFSZ);
714
#endif
715
716
#ifdef SIGVTALRM
717
14644
  NODE_DEFINE_CONSTANT(target, SIGVTALRM);
718
#endif
719
720
#ifdef SIGPROF
721
14644
  NODE_DEFINE_CONSTANT(target, SIGPROF);
722
#endif
723
724
#ifdef SIGWINCH
725
14644
  NODE_DEFINE_CONSTANT(target, SIGWINCH);
726
#endif
727
728
#ifdef SIGIO
729
14644
  NODE_DEFINE_CONSTANT(target, SIGIO);
730
#endif
731
732
#ifdef SIGPOLL
733
14644
  NODE_DEFINE_CONSTANT(target, SIGPOLL);
734
#endif
735
736
#ifdef SIGLOST
737
  NODE_DEFINE_CONSTANT(target, SIGLOST);
738
#endif
739
740
#ifdef SIGPWR
741
14644
  NODE_DEFINE_CONSTANT(target, SIGPWR);
742
#endif
743
744
#ifdef SIGINFO
745
  NODE_DEFINE_CONSTANT(target, SIGINFO);
746
#endif
747
748
#ifdef SIGSYS
749
14644
  NODE_DEFINE_CONSTANT(target, SIGSYS);
750
#endif
751
752
#ifdef SIGUNUSED
753
14644
  NODE_DEFINE_CONSTANT(target, SIGUNUSED);
754
#endif
755
3661
}
756
757
3661
void DefinePriorityConstants(Local<Object> target) {
758
#ifdef UV_PRIORITY_LOW
759
# define PRIORITY_LOW UV_PRIORITY_LOW
760
14644
  NODE_DEFINE_CONSTANT(target, PRIORITY_LOW);
761
# undef PRIORITY_LOW
762
#endif
763
764
#ifdef UV_PRIORITY_BELOW_NORMAL
765
# define PRIORITY_BELOW_NORMAL UV_PRIORITY_BELOW_NORMAL
766
14644
  NODE_DEFINE_CONSTANT(target, PRIORITY_BELOW_NORMAL);
767
# undef PRIORITY_BELOW_NORMAL
768
#endif
769
770
#ifdef UV_PRIORITY_NORMAL
771
# define PRIORITY_NORMAL UV_PRIORITY_NORMAL
772
14644
  NODE_DEFINE_CONSTANT(target, PRIORITY_NORMAL);
773
# undef PRIORITY_NORMAL
774
#endif
775
776
#ifdef UV_PRIORITY_ABOVE_NORMAL
777
# define PRIORITY_ABOVE_NORMAL UV_PRIORITY_ABOVE_NORMAL
778
14644
  NODE_DEFINE_CONSTANT(target, PRIORITY_ABOVE_NORMAL);
779
# undef PRIORITY_ABOVE_NORMAL
780
#endif
781
782
#ifdef UV_PRIORITY_HIGH
783
# define PRIORITY_HIGH UV_PRIORITY_HIGH
784
14644
  NODE_DEFINE_CONSTANT(target, PRIORITY_HIGH);
785
# undef PRIORITY_HIGH
786
#endif
787
788
#ifdef UV_PRIORITY_HIGHEST
789
# define PRIORITY_HIGHEST UV_PRIORITY_HIGHEST
790
14644
  NODE_DEFINE_CONSTANT(target, PRIORITY_HIGHEST);
791
# undef PRIORITY_HIGHEST
792
#endif
793
3661
}
794
795
3661
void DefineOpenSSLConstants(Local<Object> target) {
796
#ifdef OPENSSL_VERSION_NUMBER
797
14644
    NODE_DEFINE_CONSTANT(target, OPENSSL_VERSION_NUMBER);
798
#endif
799
800
#ifdef SSL_OP_ALL
801
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALL);
802
#endif
803
804
#ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
805
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION);
806
#endif
807
808
#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
809
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_CIPHER_SERVER_PREFERENCE);
810
#endif
811
812
#ifdef SSL_OP_CISCO_ANYCONNECT
813
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_CISCO_ANYCONNECT);
814
#endif
815
816
#ifdef SSL_OP_COOKIE_EXCHANGE
817
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_COOKIE_EXCHANGE);
818
#endif
819
820
#ifdef SSL_OP_CRYPTOPRO_TLSEXT_BUG
821
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_CRYPTOPRO_TLSEXT_BUG);
822
#endif
823
824
#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
825
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
826
#endif
827
828
#ifdef SSL_OP_EPHEMERAL_RSA
829
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_EPHEMERAL_RSA);
830
#endif
831
832
#ifdef SSL_OP_LEGACY_SERVER_CONNECT
833
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_LEGACY_SERVER_CONNECT);
834
#endif
835
836
#ifdef SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
837
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER);
838
#endif
839
840
#ifdef SSL_OP_MICROSOFT_SESS_ID_BUG
841
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_MICROSOFT_SESS_ID_BUG);
842
#endif
843
844
#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING
845
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_MSIE_SSLV2_RSA_PADDING);
846
#endif
847
848
#ifdef SSL_OP_NETSCAPE_CA_DN_BUG
849
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CA_DN_BUG);
850
#endif
851
852
#ifdef SSL_OP_NETSCAPE_CHALLENGE_BUG
853
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_CHALLENGE_BUG);
854
#endif
855
856
#ifdef SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
857
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
858
#endif
859
860
#ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
861
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG);
862
#endif
863
864
#ifdef SSL_OP_NO_COMPRESSION
865
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_COMPRESSION);
866
#endif
867
868
#ifdef SSL_OP_NO_QUERY_MTU
869
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_QUERY_MTU);
870
#endif
871
872
#ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
873
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
874
#endif
875
876
#ifdef SSL_OP_NO_SSLv2
877
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv2);
878
#endif
879
880
#ifdef SSL_OP_NO_SSLv3
881
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_SSLv3);
882
#endif
883
884
#ifdef SSL_OP_NO_TICKET
885
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TICKET);
886
#endif
887
888
#ifdef SSL_OP_NO_TLSv1
889
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1);
890
#endif
891
892
#ifdef SSL_OP_NO_TLSv1_1
893
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_1);
894
#endif
895
896
#ifdef SSL_OP_NO_TLSv1_2
897
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_NO_TLSv1_2);
898
#endif
899
900
#ifdef SSL_OP_PKCS1_CHECK_1
901
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_1);
902
#endif
903
904
#ifdef SSL_OP_PKCS1_CHECK_2
905
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_PKCS1_CHECK_2);
906
#endif
907
908
#ifdef SSL_OP_SINGLE_DH_USE
909
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_DH_USE);
910
#endif
911
912
#ifdef SSL_OP_SINGLE_ECDH_USE
913
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_SINGLE_ECDH_USE);
914
#endif
915
916
#ifdef SSL_OP_SSLEAY_080_CLIENT_DH_BUG
917
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLEAY_080_CLIENT_DH_BUG);
918
#endif
919
920
#ifdef SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
921
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG);
922
#endif
923
924
#ifdef SSL_OP_TLS_BLOCK_PADDING_BUG
925
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_BLOCK_PADDING_BUG);
926
#endif
927
928
#ifdef SSL_OP_TLS_D5_BUG
929
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_D5_BUG);
930
#endif
931
932
#ifdef SSL_OP_TLS_ROLLBACK_BUG
933
14644
    NODE_DEFINE_CONSTANT(target, SSL_OP_TLS_ROLLBACK_BUG);
934
#endif
935
936
# ifndef OPENSSL_NO_ENGINE
937
938
# ifdef ENGINE_METHOD_RSA
939
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RSA);
940
# endif
941
942
# ifdef ENGINE_METHOD_DSA
943
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DSA);
944
# endif
945
946
# ifdef ENGINE_METHOD_DH
947
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DH);
948
# endif
949
950
# ifdef ENGINE_METHOD_RAND
951
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_RAND);
952
# endif
953
954
# ifdef ENGINE_METHOD_EC
955
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_EC);
956
# endif
957
958
# ifdef ENGINE_METHOD_CIPHERS
959
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_CIPHERS);
960
# endif
961
962
# ifdef ENGINE_METHOD_DIGESTS
963
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_DIGESTS);
964
# endif
965
966
# ifdef ENGINE_METHOD_PKEY_METHS
967
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_METHS);
968
# endif
969
970
# ifdef ENGINE_METHOD_PKEY_ASN1_METHS
971
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_PKEY_ASN1_METHS);
972
# endif
973
974
# ifdef ENGINE_METHOD_ALL
975
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_ALL);
976
# endif
977
978
# ifdef ENGINE_METHOD_NONE
979
14644
    NODE_DEFINE_CONSTANT(target, ENGINE_METHOD_NONE);
980
# endif
981
982
# endif  // !OPENSSL_NO_ENGINE
983
984
#ifdef DH_CHECK_P_NOT_SAFE_PRIME
985
14644
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_SAFE_PRIME);
986
#endif
987
988
#ifdef DH_CHECK_P_NOT_PRIME
989
14644
    NODE_DEFINE_CONSTANT(target, DH_CHECK_P_NOT_PRIME);
990
#endif
991
992
#ifdef DH_UNABLE_TO_CHECK_GENERATOR
993
14644
    NODE_DEFINE_CONSTANT(target, DH_UNABLE_TO_CHECK_GENERATOR);
994
#endif
995
996
#ifdef DH_NOT_SUITABLE_GENERATOR
997
14644
    NODE_DEFINE_CONSTANT(target, DH_NOT_SUITABLE_GENERATOR);
998
#endif
999
1000
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
1001
#define ALPN_ENABLED 1
1002
14644
    NODE_DEFINE_CONSTANT(target, ALPN_ENABLED);
1003
#endif
1004
1005
#ifdef RSA_PKCS1_PADDING
1006
14644
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PADDING);
1007
#endif
1008
1009
#ifdef RSA_SSLV23_PADDING
1010
14644
    NODE_DEFINE_CONSTANT(target, RSA_SSLV23_PADDING);
1011
#endif
1012
1013
#ifdef RSA_NO_PADDING
1014
14644
    NODE_DEFINE_CONSTANT(target, RSA_NO_PADDING);
1015
#endif
1016
1017
#ifdef RSA_PKCS1_OAEP_PADDING
1018
14644
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_OAEP_PADDING);
1019
#endif
1020
1021
#ifdef RSA_X931_PADDING
1022
14644
    NODE_DEFINE_CONSTANT(target, RSA_X931_PADDING);
1023
#endif
1024
1025
#ifdef RSA_PKCS1_PSS_PADDING
1026
14644
    NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PSS_PADDING);
1027
#endif
1028
1029
#ifdef RSA_PSS_SALTLEN_DIGEST
1030
14644
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_DIGEST);
1031
#endif
1032
1033
#ifdef RSA_PSS_SALTLEN_MAX_SIGN
1034
14644
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_MAX_SIGN);
1035
#endif
1036
1037
#ifdef RSA_PSS_SALTLEN_AUTO
1038
14644
    NODE_DEFINE_CONSTANT(target, RSA_PSS_SALTLEN_AUTO);
1039
#endif
1040
1041
#if HAVE_OPENSSL
1042
  // NOTE: These are not defines
1043
14644
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_COMPRESSED);
1044
1045
14644
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_UNCOMPRESSED);
1046
1047
14644
  NODE_DEFINE_CONSTANT(target, POINT_CONVERSION_HYBRID);
1048
#endif
1049
3661
}
1050
1051
3661
void DefineSystemConstants(Local<Object> target) {
1052
14644
  NODE_DEFINE_CONSTANT(target, UV_FS_SYMLINK_DIR);
1053
14644
  NODE_DEFINE_CONSTANT(target, UV_FS_SYMLINK_JUNCTION);
1054
  // file access modes
1055
14644
  NODE_DEFINE_CONSTANT(target, O_RDONLY);
1056
14644
  NODE_DEFINE_CONSTANT(target, O_WRONLY);
1057
14644
  NODE_DEFINE_CONSTANT(target, O_RDWR);
1058
1059
  // file types from readdir
1060
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_UNKNOWN);
1061
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_FILE);
1062
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_DIR);
1063
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_LINK);
1064
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_FIFO);
1065
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_SOCKET);
1066
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_CHAR);
1067
14644
  NODE_DEFINE_CONSTANT(target, UV_DIRENT_BLOCK);
1068
1069
14644
  NODE_DEFINE_CONSTANT(target, S_IFMT);
1070
14644
  NODE_DEFINE_CONSTANT(target, S_IFREG);
1071
14644
  NODE_DEFINE_CONSTANT(target, S_IFDIR);
1072
14644
  NODE_DEFINE_CONSTANT(target, S_IFCHR);
1073
#ifdef S_IFBLK
1074
14644
  NODE_DEFINE_CONSTANT(target, S_IFBLK);
1075
#endif
1076
1077
#ifdef S_IFIFO
1078
14644
  NODE_DEFINE_CONSTANT(target, S_IFIFO);
1079
#endif
1080
1081
#ifdef S_IFLNK
1082
14644
  NODE_DEFINE_CONSTANT(target, S_IFLNK);
1083
#endif
1084
1085
#ifdef S_IFSOCK
1086
14644
  NODE_DEFINE_CONSTANT(target, S_IFSOCK);
1087
#endif
1088
1089
#ifdef O_CREAT
1090
14644
  NODE_DEFINE_CONSTANT(target, O_CREAT);
1091
#endif
1092
1093
#ifdef O_EXCL
1094
14644
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1095
#endif
1096
1097
#ifdef O_NOCTTY
1098
14644
  NODE_DEFINE_CONSTANT(target, O_NOCTTY);
1099
#endif
1100
1101
#ifdef O_TRUNC
1102
14644
  NODE_DEFINE_CONSTANT(target, O_TRUNC);
1103
#endif
1104
1105
#ifdef O_APPEND
1106
14644
  NODE_DEFINE_CONSTANT(target, O_APPEND);
1107
#endif
1108
1109
#ifdef O_DIRECTORY
1110
14644
  NODE_DEFINE_CONSTANT(target, O_DIRECTORY);
1111
#endif
1112
1113
#ifdef O_EXCL
1114
14644
  NODE_DEFINE_CONSTANT(target, O_EXCL);
1115
#endif
1116
1117
#ifdef O_NOATIME
1118
14644
  NODE_DEFINE_CONSTANT(target, O_NOATIME);
1119
#endif
1120
1121
#ifdef O_NOFOLLOW
1122
14644
  NODE_DEFINE_CONSTANT(target, O_NOFOLLOW);
1123
#endif
1124
1125
#ifdef O_SYNC
1126
14644
  NODE_DEFINE_CONSTANT(target, O_SYNC);
1127
#endif
1128
1129
#ifdef O_DSYNC
1130
14644
  NODE_DEFINE_CONSTANT(target, O_DSYNC);
1131
#endif
1132
1133
1134
#ifdef O_SYMLINK
1135
  NODE_DEFINE_CONSTANT(target, O_SYMLINK);
1136
#endif
1137
1138
#ifdef O_DIRECT
1139
14644
  NODE_DEFINE_CONSTANT(target, O_DIRECT);
1140
#endif
1141
1142
#ifdef O_NONBLOCK
1143
14644
  NODE_DEFINE_CONSTANT(target, O_NONBLOCK);
1144
#endif
1145
1146
#ifdef S_IRWXU
1147
14644
  NODE_DEFINE_CONSTANT(target, S_IRWXU);
1148
#endif
1149
1150
#ifdef S_IRUSR
1151
14644
  NODE_DEFINE_CONSTANT(target, S_IRUSR);
1152
#endif
1153
1154
#ifdef S_IWUSR
1155
14644
  NODE_DEFINE_CONSTANT(target, S_IWUSR);
1156
#endif
1157
1158
#ifdef S_IXUSR
1159
14644
  NODE_DEFINE_CONSTANT(target, S_IXUSR);
1160
#endif
1161
1162
#ifdef S_IRWXG
1163
14644
  NODE_DEFINE_CONSTANT(target, S_IRWXG);
1164
#endif
1165
1166
#ifdef S_IRGRP
1167
14644
  NODE_DEFINE_CONSTANT(target, S_IRGRP);
1168
#endif
1169
1170
#ifdef S_IWGRP
1171
14644
  NODE_DEFINE_CONSTANT(target, S_IWGRP);
1172
#endif
1173
1174
#ifdef S_IXGRP
1175
14644
  NODE_DEFINE_CONSTANT(target, S_IXGRP);
1176
#endif
1177
1178
#ifdef S_IRWXO
1179
14644
  NODE_DEFINE_CONSTANT(target, S_IRWXO);
1180
#endif
1181
1182
#ifdef S_IROTH
1183
14644
  NODE_DEFINE_CONSTANT(target, S_IROTH);
1184
#endif
1185
1186
#ifdef S_IWOTH
1187
14644
  NODE_DEFINE_CONSTANT(target, S_IWOTH);
1188
#endif
1189
1190
#ifdef S_IXOTH
1191
14644
  NODE_DEFINE_CONSTANT(target, S_IXOTH);
1192
#endif
1193
1194
#ifdef F_OK
1195
14644
  NODE_DEFINE_CONSTANT(target, F_OK);
1196
#endif
1197
1198
#ifdef R_OK
1199
14644
  NODE_DEFINE_CONSTANT(target, R_OK);
1200
#endif
1201
1202
#ifdef W_OK
1203
14644
  NODE_DEFINE_CONSTANT(target, W_OK);
1204
#endif
1205
1206
#ifdef X_OK
1207
14644
  NODE_DEFINE_CONSTANT(target, X_OK);
1208
#endif
1209
1210
#ifdef UV_FS_COPYFILE_EXCL
1211
# define COPYFILE_EXCL UV_FS_COPYFILE_EXCL
1212
14644
  NODE_DEFINE_CONSTANT(target, UV_FS_COPYFILE_EXCL);
1213
14644
  NODE_DEFINE_CONSTANT(target, COPYFILE_EXCL);
1214
# undef COPYFILE_EXCL
1215
#endif
1216
1217
#ifdef UV_FS_COPYFILE_FICLONE
1218
# define COPYFILE_FICLONE UV_FS_COPYFILE_FICLONE
1219
14644
  NODE_DEFINE_CONSTANT(target, UV_FS_COPYFILE_FICLONE);
1220
14644
  NODE_DEFINE_CONSTANT(target, COPYFILE_FICLONE);
1221
# undef COPYFILE_FICLONE
1222
#endif
1223
1224
#ifdef UV_FS_COPYFILE_FICLONE_FORCE
1225
# define COPYFILE_FICLONE_FORCE UV_FS_COPYFILE_FICLONE_FORCE
1226
14644
  NODE_DEFINE_CONSTANT(target, UV_FS_COPYFILE_FICLONE_FORCE);
1227
14644
  NODE_DEFINE_CONSTANT(target, COPYFILE_FICLONE_FORCE);
1228
# undef COPYFILE_FICLONE_FORCE
1229
#endif
1230
3661
}
1231
1232
3661
void DefineCryptoConstants(Local<Object> target) {
1233
#if HAVE_OPENSSL
1234
21966
  NODE_DEFINE_STRING_CONSTANT(target,
1235
                              "defaultCoreCipherList",
1236
                              DEFAULT_CIPHER_LIST_CORE);
1237
21966
  NODE_DEFINE_STRING_CONSTANT(target,
1238
                              "defaultCipherList",
1239
                              per_process_opts->tls_cipher_list.c_str());
1240
1241
14644
  NODE_DEFINE_CONSTANT(target, TLS1_VERSION);
1242
14644
  NODE_DEFINE_CONSTANT(target, TLS1_1_VERSION);
1243
14644
  NODE_DEFINE_CONSTANT(target, TLS1_2_VERSION);
1244
#endif
1245
14644
  NODE_DEFINE_CONSTANT(target, INT_MAX);
1246
3661
}
1247
1248
3661
void DefineDLOpenConstants(Local<Object> target) {
1249
#ifdef RTLD_LAZY
1250
14644
  NODE_DEFINE_CONSTANT(target, RTLD_LAZY);
1251
#endif
1252
1253
#ifdef RTLD_NOW
1254
14644
  NODE_DEFINE_CONSTANT(target, RTLD_NOW);
1255
#endif
1256
1257
#ifdef RTLD_GLOBAL
1258
14644
  NODE_DEFINE_CONSTANT(target, RTLD_GLOBAL);
1259
#endif
1260
1261
#ifdef RTLD_LOCAL
1262
14644
  NODE_DEFINE_CONSTANT(target, RTLD_LOCAL);
1263
#endif
1264
1265
#ifdef RTLD_DEEPBIND
1266
14644
  NODE_DEFINE_CONSTANT(target, RTLD_DEEPBIND);
1267
#endif
1268
3661
}
1269
1270
3661
void DefineTraceConstants(Local<Object> target) {
1271
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_BEGIN);
1272
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_END);
1273
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_COMPLETE);
1274
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_INSTANT);
1275
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_BEGIN);
1276
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_STEP_INTO);
1277
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_STEP_PAST);
1278
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ASYNC_END);
1279
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN);
1280
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_NESTABLE_ASYNC_END);
1281
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT);
1282
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_FLOW_BEGIN);
1283
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_FLOW_STEP);
1284
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_FLOW_END);
1285
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_METADATA);
1286
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_COUNTER);
1287
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_SAMPLE);
1288
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_CREATE_OBJECT);
1289
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_SNAPSHOT_OBJECT);
1290
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_DELETE_OBJECT);
1291
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_MEMORY_DUMP);
1292
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_MARK);
1293
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_CLOCK_SYNC);
1294
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_ENTER_CONTEXT);
1295
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_LEAVE_CONTEXT);
1296
14644
  NODE_DEFINE_CONSTANT(target, TRACE_EVENT_PHASE_LINK_IDS);
1297
3661
}
1298
1299
}  // anonymous namespace
1300
1301
3661
void DefineConstants(v8::Isolate* isolate, Local<Object> target) {
1302
3661
  Environment* env = Environment::GetCurrent(isolate);
1303
1304
3661
  Local<Object> os_constants = Object::New(isolate);
1305
14644
  CHECK(os_constants->SetPrototype(env->context(),
1306
                                   Null(env->isolate())).FromJust());
1307
1308
3661
  Local<Object> err_constants = Object::New(isolate);
1309
14644
  CHECK(err_constants->SetPrototype(env->context(),
1310
                                    Null(env->isolate())).FromJust());
1311
1312
3661
  Local<Object> sig_constants = Object::New(isolate);
1313
14644
  CHECK(sig_constants->SetPrototype(env->context(),
1314
                                    Null(env->isolate())).FromJust());
1315
1316
3661
  Local<Object> priority_constants = Object::New(isolate);
1317
14644
  CHECK(priority_constants->SetPrototype(env->context(),
1318
                                         Null(env->isolate())).FromJust());
1319
1320
3661
  Local<Object> fs_constants = Object::New(isolate);
1321
14644
  CHECK(fs_constants->SetPrototype(env->context(),
1322
                                   Null(env->isolate())).FromJust());
1323
1324
3661
  Local<Object> crypto_constants = Object::New(isolate);
1325
14644
  CHECK(crypto_constants->SetPrototype(env->context(),
1326
                                       Null(env->isolate())).FromJust());
1327
1328
3661
  Local<Object> zlib_constants = Object::New(isolate);
1329
14644
  CHECK(zlib_constants->SetPrototype(env->context(),
1330
                                     Null(env->isolate())).FromJust());
1331
1332
3661
  Local<Object> dlopen_constants = Object::New(isolate);
1333
14644
  CHECK(dlopen_constants->SetPrototype(env->context(),
1334
                                       Null(env->isolate())).FromJust());
1335
1336
3661
  Local<Object> trace_constants = Object::New(isolate);
1337
14644
  CHECK(trace_constants->SetPrototype(env->context(),
1338
                                      Null(env->isolate())).FromJust());
1339
1340
3661
  DefineErrnoConstants(err_constants);
1341
3661
  DefineWindowsErrorConstants(err_constants);
1342
3661
  DefineSignalConstants(sig_constants);
1343
3661
  DefinePriorityConstants(priority_constants);
1344
3661
  DefineSystemConstants(fs_constants);
1345
3661
  DefineOpenSSLConstants(crypto_constants);
1346
3661
  DefineCryptoConstants(crypto_constants);
1347
3661
  DefineZlibConstants(zlib_constants);
1348
3661
  DefineDLOpenConstants(dlopen_constants);
1349
3661
  DefineTraceConstants(trace_constants);
1350
1351
  // Define libuv constants.
1352
14644
  NODE_DEFINE_CONSTANT(os_constants, UV_UDP_REUSEADDR);
1353
1354
  os_constants->Set(env->context(),
1355
                    OneByteString(isolate, "dlopen"),
1356
14644
                    dlopen_constants).FromJust();
1357
  os_constants->Set(env->context(),
1358
                    OneByteString(isolate, "errno"),
1359
14644
                    err_constants).FromJust();
1360
  os_constants->Set(env->context(),
1361
                    OneByteString(isolate, "signals"),
1362
14644
                    sig_constants).FromJust();
1363
  os_constants->Set(env->context(),
1364
                    OneByteString(isolate, "priority"),
1365
14644
                    priority_constants).FromJust();
1366
  target->Set(env->context(),
1367
              OneByteString(isolate, "os"),
1368
14644
              os_constants).FromJust();
1369
  target->Set(env->context(),
1370
              OneByteString(isolate, "fs"),
1371
14644
              fs_constants).FromJust();
1372
  target->Set(env->context(),
1373
              OneByteString(isolate, "crypto"),
1374
14644
              crypto_constants).FromJust();
1375
  target->Set(env->context(),
1376
              OneByteString(isolate, "zlib"),
1377
14644
              zlib_constants).FromJust();
1378
  target->Set(env->context(),
1379
              OneByteString(isolate, "trace"),
1380
14644
              trace_constants).FromJust();
1381
3661
}
1382
1383
}  // namespace node