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