Coverage Report

Created: 2025-12-10 07:58

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