-
Notifications
You must be signed in to change notification settings - Fork 398
/
Copy pathomrport.h
3160 lines (2940 loc) · 212 KB
/
omrport.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
#if !defined(OMRPORT_H_)
#define OMRPORT_H_
/*
* @ddr_namespace: map_to_type=J9PortLibrary
*/
#include "omrcfg.h"
/* NOTE: omrportlib.h include is at the bottom of this file until its dependencies on this file can be relaxed */
/* fix for linux s390 32bit stdint vs unistd.h definition of intptr_t (see CMVC 73850) */
#if defined(LINUX) && defined(S390)
#include <stdint.h>
#endif
#include <stdarg.h> /* for va_list */
#include <stdio.h> /* For FILE */
#include <signal.h>
#include "omrcomp.h"
#include "omrthread.h"
#include "omrmemcategories.h"
#include "omrporterror.h"
#include "omrportsock.h"
#if defined(OMR_OPT_CUDA)
#include "omrcuda.h"
#endif /* OMR_OPT_CUDA */
#if defined(OMRZTPF)
#include "omrgcconsts.h"
#endif /* defined(OMRZTPF) */
#if !defined(OMR_OS_WINDOWS)
#include <unistd.h>
#endif /* !defined(OMR_OS_WINDOWS) */
#if defined(J9ZOS390)
#define PORT_ABEND_CODE 0xDED
#define PORT_ABEND_REASON_CODE 20
#define PORT_ABEND_CLEANUP_CODE 1 /* allow for normal enclave termination/cleanup processing */
#endif
/**
* @name Port library access
* @anchor PortAccess
* Macros for accessing port library.
* @{
*/
#define OMRPORT_ACCESS_FROM_OMRPORT(_omrPortLib) OMRPortLibrary *privateOmrPortLibrary = (_omrPortLib)
/** @} */
#define OMRPORTLIB privateOmrPortLibrary
/**
* @name File Operations
* @anchor PortFileOperations
* File operation modifiers.
* @{
*/
#ifdef SEEK_SET
#define EsSeekSet SEEK_SET /* Values for EsFileSeek */
#else
#define EsSeekSet 0
#endif
#ifdef SEEK_CUR
#define EsSeekCur SEEK_CUR
#else
#define EsSeekCur 1
#endif
#ifdef SEEK_END
#define EsSeekEnd SEEK_END
#else
#define EsSeekEnd 2
#endif
#define EsOpenRead 0x1 /* Values for EsFileOpen */
#define EsOpenWrite 0x2
#define EsOpenCreate 0x4
#define EsOpenTruncate 0x8
#define EsOpenAppend 0x10
#define EsOpenText 0x20
#define EsOpenCreateNew 0x40 /* Use this flag with EsOpenCreate, if this flag is specified then trying to create an existing file will fail */
#define EsOpenSync 0x80
#define EsOpenForMapping 0x100 /* Required for WinCE for file memory mapping, ignored on other platforms. WINCE is not supported so this flag is obsolete now. */
#define EsOpenForInherit 0x200 /* Use this flag such that returned handle can be inherited by child processes */
#define EsOpenCreateAlways 0x400 /* Always creates a new file, an existing file will be overwritten */
#define EsOpenCreateNoTag 0x800 /* Used for zOS only, to disable USS file tagging on JVM-generated files */
#define EsOpenShareDelete 0x1000 /* used only for windows to allow a file to be renamed while it is still open */
#define EsOpenAsynchronous 0x2000 /* used only for windows to allow a file to be opened asynchronously */
#define EsIsDir 0 /* Return values for EsFileAttr */
#define EsIsFile 1
/* Invalid file descriptor */
#define OMRPORT_INVALID_FD -1
/* Filestream Buffering modes */
#define OMRPORT_FILESTREAM_FULL_BUFFERING _IOFBF
#define OMRPORT_FILESTREAM_LINE_BUFFERING _IOLBF
#define OMRPORT_FILESTREAM_NO_BUFFERING _IONBF
/** EsMaxPath was chosen from unix MAXPATHLEN. Override in platform
* specific omrfile implementations if needed.
*/
#define EsMaxPath 1024
/** @} */
/**
* @name Sysinfo get limit success flags
* @anchor PortSharedMemorySuccessFlags
* Return codes related to sysinfo get limit operations.
* @{
* @internal OMRPORT_LIMIT* range from at 120 to 129 to avoid overlap
*/
#define OMRPORT_LIMIT_BASE 120
#define OMRPORT_LIMIT_UNLIMITED (OMRPORT_LIMIT_BASE)
#define OMRPORT_LIMIT_UNKNOWN (OMRPORT_LIMIT_BASE+1)
#define OMRPORT_LIMIT_LIMITED (OMRPORT_LIMIT_BASE+2)
/** @} */
/**
* @name Sysinfo Limits
* Flags used to indicate type of operation for omrsysinfo_get_limit
* @{
*/
#define OMRPORT_LIMIT_SOFT ((uintptr_t) 0x0)
#define OMRPORT_LIMIT_HARD ((uintptr_t) 0x80000000)
#define OMRPORT_RESOURCE_SHARED_MEMORY ((uintptr_t) 1)
#define OMRPORT_RESOURCE_ADDRESS_SPACE ((uintptr_t) 2)
#define OMRPORT_RESOURCE_CORE_FILE ((uintptr_t) 3)
#define OMRPORT_RESOURCE_CORE_FLAGS ((uintptr_t) 4)
#define OMRPORT_RESOURCE_FILE_DESCRIPTORS ((uintptr_t) 5)
#define OMRPORT_RESOURCE_DATA ((uintptr_t) 6)
/** @} */
/**
* @name Sysinfo Limits - return values
* These values are returned by omrsysinfo_get_limit in the limit parameter for the corresponding return codes.
* If a value has been determined for a limit, it is the value reurned in the limit parameter.
* @{
*/
#define OMRPORT_LIMIT_UNLIMITED_VALUE (J9CONST64(0xffffffffffffffff))
#define OMRPORT_LIMIT_UNKNOWN_VALUE (J9CONST64(0xffffffffffffffff))
/** @} */
/**
* @name OMRSIG support (optional)
* OMRSIG
* @{
*/
#if defined(OMRPORT_OMRSIG_SUPPORT)
#define OMRSIG_SIGNAL(signum, handler) omrsig_primary_signal(signum, handler)
#define OMRSIG_SIGACTION(signum, act, oldact) omrsig_primary_sigaction(signum, act, oldact)
#else /* defined(OMRPORT_OMRSIG_SUPPORT) */
#define OMRSIG_SIGNAL(signum, handler) signal(signum, handler)
#define OMRSIG_SIGACTION(signum, act, oldact) sigaction(signum, act, oldact)
#endif /* defined(OMRPORT_OMRSIG_SUPPORT) */
/** @} */
/**
* @deprecated
*
* @name Native Language Support
* Native Language Support
* @{
* @internal standards require that all VM messages be prefixed with JVM.
*/
#define J9NLS_COMMON_PREFIX "JVM"
#define J9NLS_ERROR_PREFIX ""
#define J9NLS_WARNING_PREFIX ""
#define J9NLS_INFO_PREFIX ""
#define J9NLS_ERROR_SUFFIX "E"
#define J9NLS_WARNING_SUFFIX "W"
#define J9NLS_INFO_SUFFIX "I"
/** @internal these macros construct in string literals from message ids. */
#define J9NLS_MESSAGE(id, message) ("" J9NLS_COMMON_PREFIX "" id##__PREFIX " " message)
#define J9NLS_ERROR_MESSAGE(id, message) ("" J9NLS_ERROR_PREFIX "" J9NLS_COMMON_PREFIX "" id##__PREFIX "" J9NLS_ERROR_SUFFIX " " message)
#define J9NLS_INFO_MESSAGE(id, message) ("" J9NLS_INFO_PREFIX "" J9NLS_COMMON_PREFIX "" id##__PREFIX "" J9NLS_INFO_SUFFIX " " message)
#define J9NLS_WARNING_MESSAGE(id, message) ("" J9NLS_WARNING_PREFIX "" J9NLS_COMMON_PREFIX "" id##__PREFIX "" J9NLS_WARNING_SUFFIX " " message)
/** @} */
/**
* @name Virtual Memory Access
* Flags used to describe type of the page for the virtual memory
* @{
*/
#define OMRPORT_VMEM_PAGE_FLAG_NOT_USED 0x1
#define OMRPORT_VMEM_PAGE_FLAG_FIXED 0x2
#define OMRPORT_VMEM_PAGE_FLAG_PAGEABLE 0x4
#define OMRPORT_VMEM_PAGE_FLAG_SUPERPAGE_ANY 0x8
#define OMRPORT_VMEM_PAGE_FLAG_PAGEABLE_PREFERABLE 0x10
#define OMRPORT_VMEM_PAGE_FLAG_TYPE_MASK 0x1F
/** @} */
/**
* @name Virtual Memory Access
* Flags used to create bitmap indicating memory access
* @{
*/
#define OMRPORT_VMEM_MEMORY_MODE_READ 0x00000001
#define OMRPORT_VMEM_MEMORY_MODE_WRITE 0x00000002
#define OMRPORT_VMEM_MEMORY_MODE_EXECUTE 0x00000004
#define OMRPORT_VMEM_MEMORY_MODE_COMMIT 0x00000008
#define OMRPORT_VMEM_MEMORY_MODE_VIRTUAL 0x00000010
#define OMRPORT_VMEM_MEMORY_MODE_SHARE_FILE_OPEN 0x000000200
#define OMRPORT_VMEM_MEMORY_MODE_MMAP_HUGE_PAGES 0x000000400
#define OMRPORT_VMEM_MEMORY_MODE_DOUBLE_MAP_AVAILABLE 0x000000800
#define OMRPORT_VMEM_ALLOCATE_TOP_DOWN 0x00000020
#define OMRPORT_VMEM_ALLOCATE_PERSIST 0x00000040
#define OMRPORT_VMEM_NO_AFFINITY 0x00000080
/** @} */
/**
* @name Timer Resolution
* @anchor timerResolution
* Define resolution requested in @ref omrtime::omrtime_hires_delta
* @{
*/
#define OMRPORT_TIME_DELTA_IN_SECONDS ((uint64_t) 1)
#define OMRPORT_TIME_DELTA_IN_MILLISECONDS ((uint64_t) 1000)
#define OMRPORT_TIME_DELTA_IN_MICROSECONDS ((uint64_t) 1000000)
#define OMRPORT_TIME_DELTA_IN_NANOSECONDS ((uint64_t) 1000000000)
/** @} */
#if defined(S390) || defined(J9ZOS390)
/**
* @name Constants to calculate time from high-resolution timer
* @anchor hiresConstants
* High-resolution timer can be converted into millisecond timer or nanosecond timer through appropriate
* division or multiplication (respectively). For example, 390 high-resolution timer provides accuracy to
* 1/2048 of a microsecond so, to convert hires timer to
* - nanoseconds, multiply it by 125/256
* - microseconds, divide it by 2,048
* - milliseconds, divide it by 2,048,000
* @{
*/
#define OMRPORT_TIME_HIRES_NANOTIME_NUMERATOR ((uint64_t) 125)
#define OMRPORT_TIME_HIRES_NANOTIME_DENOMINATOR ((uint64_t) 256)
#define OMRPORT_TIME_HIRES_MICROTIME_DIVISOR ((uint64_t) 2048)
#define OMRPORT_TIME_HIRES_MILLITIME_DIVISOR ((uint64_t) 2048000)
#define OMRTIME_HIRES_CLOCK_FREQUENCY ((uint64_t) 2048000000) /* Frequency is microseconds / second */
#else /* defined(S390) || defined(J9ZOS390) */
#define OMRPORT_TIME_HIRES_NANOTIME_NUMERATOR ((uint64_t) 0)
#define OMRPORT_TIME_HIRES_NANOTIME_DENOMINATOR ((uint64_t) 0)
#define OMRPORT_TIME_HIRES_MICROTIME_DIVISOR ((uint64_t) 0)
#define OMRPORT_TIME_HIRES_MILLITIME_DIVISOR ((uint64_t) 0)
#endif /* defined(S390) || defined(J9ZOS390) */
/** @} */
#if defined(LINUX) && !defined(OMRZTPF)
#define OMR_CONFIGURABLE_SUSPEND_SIGNAL
#endif /* defined(LINUX) */
/**
* @name Time Unit Conversion
* Constants used to convert between units of time.
* @{
*/
#define OMRPORT_TIME_NS_PER_MS ((uint64_t) 1000000) /* nanoseconds per millisecond */
#define OMRPORT_TIME_US_PER_SEC ((uint64_t) 1000000) /* microseconds per second */
/** @} */
/**
* @name Shared Semaphore
* Flags used to indicate type of operation for omrshsem_post/omrshsem_wait
* @{
*/
#define OMRPORT_SHSEM_MODE_DEFAULT ((uintptr_t) 0)
#define OMRPORT_SHSEM_MODE_UNDO ((uintptr_t) 1)
#define OMRPORT_SHSEM_MODE_NOWAIT ((uintptr_t) 2)
/** @} */
/**
* @name Shared Semaphore Success flags
* @anchor PortSharedSemaphoreSuccessFlags
* Success codes related to shared semaphore operations.
* @{
* @internal OMRPORT_INFO_SHSEM* range from at 100 to 109 to avoid overlap
*/
#define OMRPORT_INFO_SHSEM_BASE 100
#define OMRPORT_INFO_SHSEM_CREATED (OMRPORT_INFO_SHSEM_BASE)
#define OMRPORT_INFO_SHSEM_OPENED (OMRPORT_INFO_SHSEM_BASE+1)
#define OMRPORT_INFO_SHSEM_OPEN_UNLINKED (OMRPORT_INFO_SHSEM_BASE+2)
#define OMRPORT_INFO_SHSEM_OPENED_STALE (OMRPORT_INFO_SHSEM_BASE+3)
#define OMRPORT_INFO_SHSEM_PARTIAL (OMRPORT_INFO_SHSEM_BASE+4)
#define OMRPORT_INFO_SHSEM_STAT_PASSED (OMRPORT_INFO_SHSEM_BASE+5)
/** @} */
#define OMRSH_MAXPATH EsMaxPath
#define OMRSH_SEMAPHORE_ID "_semaphore_"
#define OMRSH_MEMORY_ID "_memory_"
#define OMRSH_DIRPERM_ABSENT ((uintptr_t)-2)
#define OMRSH_DIRPERM (0777)
#define OMRSH_PARENTDIRPERM (01777)
#define OMRSH_DIRPERM_DEFAULT (0000)
#define OMRSH_DIRPERM_DEFAULT_WITH_STICKYBIT (01000)
#define OMRSH_BASEFILEPERM (0644)
#define OMRSH_BASEFILEPERM_GROUP_RW_ACCESS (0664)
#define OMRSH_SHMEM_PERM_READ (0444)
#define OMRSH_SHMEM_PERM_READ_WRITE (0644)
#define OMRSH_SYSV_REGULAR_CONTROL_FILE 0
#define OMRSH_SYSV_OLDER_CONTROL_FILE 1
#define OMRSH_SYSV_OLDER_EMPTY_CONTROL_FILE 2
/* Flags passed to "flag" argument of omrshsem_deprecated_open(). */
#define OMRSHSEM_NO_FLAGS 0x0
#define OMRSHSEM_OPEN_FOR_STATS 0x1
#define OMRSHSEM_OPEN_FOR_DESTROY 0x2
#define OMRSHSEM_OPEN_DO_NOT_CREATE 0x4
/*
* Flags passed to "flag" argument of omrshmem_open(). Should be of type uintptr_t.
* High order 4 bits are reserved for passing the storage key testing value to omrshmem.
*/
#define OMRSHMEM_NO_FLAGS 0x0
#define OMRSHMEM_OPEN_FOR_STATS 0x1
#define OMRSHMEM_OPEN_FOR_DESTROY 0x2
#define OMRSHMEM_PRINT_STORAGE_KEY_WARNING 0x4
#define OMRSHMEM_STORAGE_KEY_TESTING 0x8
#define OMRSHMEM_OPEN_DO_NOT_CREATE 0x10
#define OMRSHMEM_STORAGE_KEY_TESTING_SHIFT ((sizeof(uintptr_t)*8)-4)
#define OMRSHMEM_STORAGE_KEY_TESTING_MASK 0xF
/* Flags passed to "flags" argument of omrshmem_getDir(). */
#define OMRSHMEM_GETDIR_APPEND_BASEDIR 0x1
#define OMRSHMEM_GETDIR_USE_USERHOME 0x2
#ifdef WIN32
#define OMRSH_BASEDIR "omrsharedresources\\"
#else
#define OMRSH_BASEDIR "omrsharedresources/"
#endif
/**
* @name Shared Memory Success flags
* @anchor PortSharedMemorySuccessFlags
* Success codes related to shared memory semaphore operations.
* @{
* @internal OMRPORT_INFO_SHMEM* range from at 110 to 119 to avoid overlap
*/
#define OMRPORT_INFO_SHMEM_BASE 110
#define OMRPORT_INFO_SHMEM_CREATED (OMRPORT_INFO_SHMEM_BASE)
#define OMRPORT_INFO_SHMEM_OPENED (OMRPORT_INFO_SHMEM_BASE+1)
#define OMRPORT_INFO_SHMEM_OPEN_UNLINKED (OMRPORT_INFO_SHMEM_BASE+2)
#define OMRPORT_INFO_SHMEM_OPENED_STALE (OMRPORT_INFO_SHMEM_BASE+3)
#define OMRPORT_INFO_SHMEM_PARTIAL (OMRPORT_INFO_SHMEM_BASE+4)
#define OMRPORT_INFO_SHMEM_STAT_PASSED (OMRPORT_INFO_SHMEM_BASE+5)
/** @} */
/**
* @name Shared Memory Eyecatcher
* @anchor PortSharedMemoryEyecatcher
* Eyecatcher written to start of a shared classes cache to identify the shared memory segment as such a cache
* @{
*/
#define OMRPORT_SHMEM_EYECATCHER "OMRSC"
#define OMRPORT_SHMEM_EYECATCHER_LENGTH 5
/** @} */
#define ROUND_UP_TO_POWEROF2(value, powerof2) (((value) + ((powerof2) - 1)) & (UDATA)~((powerof2) - 1))
#define ROUND_DOWN_TO_POWEROF2(value, powerof2) ((value) & (UDATA)~((powerof2) - 1))
typedef struct J9Permission {
uint32_t isUserWriteable : 1;
uint32_t isUserReadable : 1;
uint32_t isGroupWriteable : 1;
uint32_t isGroupReadable : 1;
uint32_t isOtherWriteable : 1;
uint32_t isOtherReadable : 1;
uint32_t : 26; /* future use */
} J9Permission;
typedef struct OMRPortShmemStatistic {
uintptr_t shmid;
uintptr_t nattach;
uintptr_t key;
uintptr_t ouid;
uintptr_t ogid;
uintptr_t cuid;
uintptr_t cgid;
char* file;
uintptr_t size;
int64_t lastAttachTime;
int64_t lastDetachTime;
int64_t lastChangeTime;
char* controlDir;
J9Permission perm;
} OMRPortShmemStatistic;
typedef struct OMRPortShsemStatistic {
uintptr_t semid;
uintptr_t ouid;
uintptr_t ogid;
uintptr_t cuid;
uintptr_t cgid;
int64_t lastOpTime;
int64_t lastChangeTime;
int32_t nsems;
J9Permission perm;
} OMRPortShsemStatistic;
/**
* Holds properties relating to a file. Can be added to in the future
* if needed.
* Note that the ownerUid and ownerGid fields are 0 on Windows.
*/
typedef struct J9FileStat {
uint32_t isFile : 1;
uint32_t isDir : 1;
uint32_t isFixed : 1;
uint32_t isRemote : 1;
uint32_t isRemovable : 1;
uint32_t : 27; /* future use */
J9Permission perm;
uintptr_t ownerUid;
uintptr_t ownerGid;
} J9FileStat;
/**
* Holds properties relating to a file system.
*/
typedef struct J9FileStatFilesystem {
uint64_t freeSizeBytes;
uint64_t totalSizeBytes;
} J9FileStatFilesystem;
/**
* A handle to a filestream.
* Private, platform specific implementation.
*/
typedef FILE OMRFileStream;
/* It is the responsibility of the user to create the storage for J9PortVMemParams.
* The structure is only needed for the lifetime of the call to omrvmem_reserve_memory_ex
* This structure must be initialized using @ref omrvmem_vmem_params_init
*/
typedef struct J9PortVmemParams {
/* Upon success we will attempt to return a pointer within [startAddress, endAddress]
* in a best effort manner unless the OMRPORT_VMEM_STRICT_ADDRESS flag is specified
* endAddress is the last address at which the user wishes the returned pointer to
* be assigned regardless of the byteAmount
* startAddress must be <= endAddress or omrvmem_reserve_memory_ex will fail
* and cause the generation of a trace assertion
*/
void *startAddress;
void *endAddress;
/* This value must be aligned to pageSize when passing this structure to omrvmem_reserve_memory_ex() */
uintptr_t byteAmount;
/* Size of the page requested, a value returned by @ref omrvmem_supported_page_sizes */
uintptr_t pageSize;
/* Flags describing type of the page requested */
uintptr_t pageFlags;
/* @mode Bitmap indicating how memory is to be reserved. Expected values combination of:
* \arg OMRPORT_VMEM_MEMORY_MODE_READ memory is readable
* \arg OMRPORT_VMEM_MEMORY_MODE_WRITE memory is writable
* \arg OMRPORT_VMEM_MEMORY_MODE_EXECUTE memory is executable
* \arg OMRPORT_VMEM_MEMORY_MODE_COMMIT commits memory as part of the reserve
* \arg OMRPORT_VMEM_MEMORY_MODE_VIRTUAL used only on z/OS
* - used to allocate memory in 4K pages using system macros instead of malloc() or __malloc31() routines
* - on 64-bit, this mode rounds up byteAmount to be aligned to 1M boundary.*
*/
uintptr_t mode;
/* [Optional] Bitmap indicating direction to follow when trying to allocate memory in a range.
* \arg OMRPORT_VMEM_ALLOC_DIR_BOTTOM_UP start at lower address and proceed towards higher one
* \arg OMRPORT_VMEM_ALLOC_DIR_TOP_DOWN start at higher address and proceed towards lower one
* \arg OMRPORT_VMEM_STRICT_ADDRESS fail if requested address is unavailable
* \arg OMRPORT_VMEM_STRICT_PAGE_SIZE fail if requested page size is unavailable
* \arg OMRPORT_VMEM_ZOS_USE2TO32G_AREA
* - applies to z/OS only, ignored on all other platforms
* - use allocator that exclusively requests memory in 2to32G region if set
* - do not use allocator that requests memory exclusively in 2to32G region if not set
* - if this flag is set and the 2to32G support is not there omrvmem_reserve_memory_ex will return failure
* \arg OMRPORT_VMEM_ALLOC_QUICK
* - enabled for Linux only
* - If set, information from /proc/self/maps is used to decide quickly if a request
* can be satisfied. If not, NULL is returned without doing a linear search.
* - If not set, do a linear search for a memory block.
* \arg OMRPORT_VMEM_ADDRESS_HINT
* - enabled for Linux and default page allocations only (has no effect on large page allocations)
* - If not set, search memory in linear scan method
* - If set, return whatever mmap gives us (only one allocation attempt)
* - this option is based on the observation that mmap would take the given address as a hint about where to place the mapping
* - this option does not apply to large page allocations as the allocation is done with shmat instead of mmap
*/
uintptr_t options;
/* Memory allocation category for storage */
uint32_t category;
/* the lowest common multiple of alignmentInBytes and pageSize should be used to determine the base address */
uintptr_t alignmentInBytes;
} J9PortVmemParams;
typedef enum J9VMemMemoryQuery {
OMRPORT_VMEM_PROCESS_PHYSICAL,
OMRPORT_VMEM_PROCESS_PRIVATE,
OMRPORT_VMEM_PROCESS_VIRTUAL,
OMRPORT_VMEM_PROCESS_EnsureWideEnum = 0x1000000
} J9VMemMemoryQuery;
#if defined(LINUX)
typedef struct OMRCgroupEntry {
int32_t hierarchyId; /**< cgroup hierarch ID*/
char *subsystem; /**< name of the subsystem*/
char *cgroup; /**< name of the cgroup*/
uint64_t flag; /**< a bit-wise flag of type OMR_CGROUP_SUBSYSTEM_* representing the cgroup*/
struct OMRCgroupEntry *next; /**< pointer to next OMRCgroupEntry*/
} OMRCgroupEntry;
#endif /* defined(LINUX) */
typedef struct OMRCgroupMetricElement {
const char *units;
char value[128];
} OMRCgroupMetricElement;
typedef struct OMRCgroupMetricIteratorState {
uint32_t count;
uint32_t numElements;
uint64_t subsystemid;
int32_t fileMetricCounter;
char *fileContent;
} OMRCgroupMetricIteratorState;
/**
* @name Virtual Memory Options
* Flags used to create bitmap indicating vmem options
* See J9PortVmemParams.options
*
*/
#define OMRPORT_VMEM_ALLOC_DIR_BOTTOM_UP 1
#define OMRPORT_VMEM_ALLOC_DIR_TOP_DOWN 2
#define OMRPORT_VMEM_STRICT_ADDRESS 4
#define OMRPORT_VMEM_STRICT_PAGE_SIZE 8
#define OMRPORT_VMEM_ZOS_USE2TO32G_AREA 16
#define OMRPORT_VMEM_ALLOC_QUICK 32
#define OMRPORT_VMEM_ZTPF_USE_31BIT_MALLOC 64
#define OMRPORT_VMEM_ADDRESS_HINT 128
/**
* @name Virtual Memory Address
* highest memory address on platform
*
*/
#if defined(J9ZOS390) && !defined(OMR_ENV_DATA64)
/* z/OS 31-bit uses signed pointer comparison so this UDATA_MAX maximum address becomes -1 which is less than the minimum address of 0 so use IDATA_MAX instead */
#define OMRPORT_VMEM_MAX_ADDRESS ((void *) IDATA_MAX)
#else /* defined(J9ZOS390) && !defined(OMR_ENV_DATA64) */
#define OMRPORT_VMEM_MAX_ADDRESS ((void *) UDATA_MAX)
#endif /* defined(J9ZOS390) && !defined(OMR_ENV_DATA64) */
/**
* @name Memory Tagging
* Eye catcher and header/footer used for tagging omrmem allocation blocks
*
*/
#define J9MEMTAG_TAG_CORRUPTION 0xFFFFFFFF
#define J9MEMTAG_VERSION 0
#define J9MEMTAG_EYECATCHER_ALLOC_HEADER 0xB1234567
#define J9MEMTAG_EYECATCHER_ALLOC_FOOTER 0xB7654321
#define J9MEMTAG_EYECATCHER_FREED_HEADER 0xBADBAD67
#define J9MEMTAG_EYECATCHER_FREED_FOOTER 0xBADBAD21
#define J9MEMTAG_PADDING_BYTE 0xDD
typedef struct J9MemTag {
uint32_t eyeCatcher;
uint32_t sumCheck;
uintptr_t allocSize;
const char *callSite;
OMRMemCategory *category;
#if !defined(OMR_ENV_DATA64)
/* omrmem_allocate_memory should return addresses aligned to 8 bytes for
* performance reasons. On 32 bit platforms we have to pad to achieve this.
*/
uint8_t padding[4];
#endif
} J9MemTag;
#if defined(LINUX) || defined(OSX)
/**
* @name Linux OS Dump Eyecatcher
*
*/
#define J9OSDUMP_EYECATCHER 0x19810924
#if defined(OMR_ENV_DATA64)
#define J9OSDUMP_SIZE (192 * 1024)
#else
#define J9OSDUMP_SIZE (128 * 1024)
#endif
#endif /* defined(LINUX) || defined(OSX) */
/* omrfile_chown takes unsigned arguments for user/group IDs, but uses -1 to indicate that group/user id are not to be changed */
#define OMRPORT_FILE_IGNORE_ID UDATA_MAX
/* Used by omrsysinfo_limit_iterator_init/next functions */
typedef struct J9SysinfoUserLimitElement {
/* Null terminated string */
const char *name;
uint64_t softValue;
uint64_t hardValue;
/** 1. If the OS indicates a limit is set to unlimited, the corresponding soft/hard value will be set to
* OMRPORT_LIMIT_UNLIMITED
* 2. There may not be the notion of a hard value on some platforms (for example Windows), in which case
* the hard value will be set to OMRPORT_LIMIT_UNLIMITED.
*/
} J9SysinfoUserLimitElement;
typedef struct J9SysinfoLimitIteratorState {
uint32_t count;
uint32_t numElements;
} J9SysinfoLimitIteratorState;
/* Used by omrsysinfo_env_iterator_init/next functions */
typedef struct J9SysinfoEnvElement {
/* Null terminated string in format "name=value" */
const char *nameAndValue;
} J9SysinfoEnvElement;
typedef struct J9SysinfoEnvIteratorState {
void *current; /* to be used exclusively by the port library */
void *buffer; /* caller-allocated buffer. This can be freed by the caller once they have finished using the iterator. */
uintptr_t bufferSizeBytes; /* size of @ref buffer */
} J9SysinfoEnvIteratorState;
/* Used by omrsysinfo_get_CPU_utilization() */
typedef struct J9SysinfoCPUTime {
int64_t timestamp; /* time in nanoseconds from a fixed but arbitrary point in time */
int64_t cpuTime; /* cumulative CPU utilization (sum of system and user time in nanoseconds) of all CPUs on the system. */
int32_t numberOfCpus; /* number of CPUs as reported by the operating system */
} J9SysinfoCPUTime;
/* Key memory categories are copied here for DDR access */
/* Special memory category for memory allocated for unknown categories */
#define OMRMEM_CATEGORY_UNKNOWN 0x80000000
/* Special memory category for memory allocated for the port library itself */
#define OMRMEM_CATEGORY_PORT_LIBRARY 0x80000001
/* Special memory category for *unused* sections of regions allocated for <32bit allocations on 64 bit.
* The used sections will be accounted for under the categories they are used by. */
#define OMRMEM_CATEGORY_PORT_LIBRARY_UNUSED_ALLOCATE32_REGIONS 0x80000009
#define J9MEM_CATEGORIES_KEEP_ITERATING 0
#define J9MEM_CATEGORIES_STOP_ITERATING 1
/**
* State data for memory category walk
* @see omrmem_walk_categories(
*/
typedef struct OMRMemCategoryWalkState {
/**
* Callback function called from omrmemory_walk_categories with memory category data.
*
* @param [in] categoryCode Code identifying memory category
* @param [in] categoryName Name of category
* @param [in] liveBytes Bytes outstanding (allocated but not freed) for this category
* @param [in] liveAllocations Number of allocations outstanding (not freed) for this category
* @param [in] isRoot True if this node is a root (i.e. does not have a parent)
* @param [in] parentCategoryCode Code identifying the parent of this category. Ignore if isRoot==TRUE
* @param [in] state Walk state record.
* @return J9MEM_CATEGORIES_KEEP_INTERATING or J9MEM_CATEGORIES_STOP_ITERATING
*/
uintptr_t (*walkFunction)(uint32_t categoryCode, const char *categoryName, uintptr_t liveBytes, uintptr_t liveAllocations, BOOLEAN isRoot, uint32_t parentCategoryCode, struct OMRMemCategoryWalkState *state);
void *userData1;
void *userData2;
} OMRMemCategoryWalkState;
typedef enum J9MemoryState {J9NUMA_PREFERRED, J9NUMA_ALLOWED, J9NUMA_DENIED} J9MemoryState;
typedef struct J9MemoryNodeDetail {
uintptr_t j9NodeNumber; /**< The 1-indexed number used outside of Port and Thread to describe this node */
J9MemoryState memoryPolicy; /**< Whether the memory on this node is preferred, allowed, or denied use by this process under the current NUMA policy */
uintptr_t computationalResourcesAvailable; /**< The number of computational resources on this node which are currently available for use under the current NUMA policy */
} J9MemoryNodeDetail;
/* Stores memory usage statistics snapshot sampled at a time 'timestamp'.
*
* @see omrsysinfo_get_memory_info
*
* If one of these parameters is not available on a particular platform, this is set to the
* default OMRPORT_MEMINFO_NOT_AVAILABLE.
*/
typedef struct J9MemoryInfo {
uint64_t totalPhysical; /* Total physical memory in the system (in bytes). */
uint64_t availPhysical; /* Available physical memory in the system (in bytes). */
uint64_t totalVirtual; /* Total virtual memory addressable by the process (in bytes). */
uint64_t availVirtual; /* Virtual memory available to the process (in bytes). */
uint64_t totalSwap; /* Total swap memory (in bytes). */
uint64_t availSwap; /* Total swap memory free (in bytes). */
uint64_t cached; /* The physical RAM used as cache memory (in bytes). */
uint64_t buffered; /* The physical RAM used for file buffers (in bytes). */
int64_t timestamp; /* Sampling timestamp (in microseconds). */
/* Available physical memory on the host (in bytes) when process is in a cgroup.
* When not in a cgroup, this will be identical to 'availPhysical' field above.
*/
uint64_t hostAvailPhysical;
/* The physical RAM used as cache memory (in bytes) when process is in a cgroup.
* When not in a cgroup, this will be identical to 'cached' field above.
*/
uint64_t hostCached;
/* The physical RAM used for file buffers (in bytes) when process is in a cgroup.
* When not in a cgroup, this will be identical to 'buffered' field above.
*/
uint64_t hostBuffered;
} J9MemoryInfo;
#define OMRPORT_MEMINFO_NOT_AVAILABLE ((uint64_t) -1)
/**
* Stores usage information on a per-processor basis. These parameters are the ones that generic
* whereas, operating system specific parameters are not saved here. If one of these parameters is
* not available on a particular platform, this is set to OMRPORT_PROCINFO_NOT_AVAILABLE.
*/
typedef struct J9ProcessorInfo {
uint64_t userTime; /* Time spent in user mode (in microseconds). */
uint64_t systemTime; /* Time spent in system mode (in microseconds). */
uint64_t idleTime; /* Time spent sitting idle (in microseconds). */
uint64_t waitTime; /* Time spent over IO wait (in microseconds). */
uint64_t busyTime; /* Time spent over useful work (in microseconds). */
int32_t proc_id; /* This processor's id. */
/* Was current CPU online when last sampled (OMRPORT_PROCINFO_PROC_ONLINE if online,
* OMRPORT_PROCINFO_PROC_OFFLINE if not).
*/
int32_t online;
} J9ProcessorInfo;
/**
* Structure collects the usage statistics for each of the processors that is online at the
* time of sampling.
*
* @see omrsysinfo_get_processor_info, omrsysinfo_destroy_processor_info
*
* The array holds an entry for each logical processor on the system plus a one for the aggregates.
* However, the particular record shall hold valid usage samples only if the processor were online,
* else the individual fields shall be set to OMRPORT_PROCINFO_NOT_AVAILABLE.
*/
typedef struct J9ProcessorInfos {
int32_t totalProcessorCount; /* Number of logical processors on the machine. */
J9ProcessorInfo *procInfoArray; /* Array of processors, of 'totalProcessorCount + 1'. */
int64_t timestamp; /* Sampling timestamp (in microseconds). */
} J9ProcessorInfos;
#define OMRPORT_PROCINFO_NOT_AVAILABLE ((uint64_t) -1)
/* Processor status. */
#define OMRPORT_PROCINFO_PROC_OFFLINE ((int32_t)0)
#define OMRPORT_PROCINFO_PROC_ONLINE ((int32_t)1)
#define NANOSECS_PER_USEC 1000
#define OMRPORT_ENABLE_ENSURE_CAP32 0
#define OMRPORT_DISABLE_ENSURE_CAP32 1
#define FLG_ACQUIRE_LOCK_WAIT 0x00000001
#define FLG_ACQUIRE_LOCK_NOWAIT 0x00000002
/* Lock Status values - the current status of a lock. */
#define LS_UNINITIALIZED 0
#define LS_INITIALIZED 1
#define LS_INITIALIZING 2
#define LS_LOCKED 3
/* omrsysinfo_get_number_CPUs_by_type flags */
#define OMRPORT_CPU_PHYSICAL 1
#define OMRPORT_CPU_ONLINE 2
#define OMRPORT_CPU_BOUND 3
#define OMRPORT_CPU_TARGET 4
#define OMRPORT_SL_FOUND 0
#define OMRPORT_SL_NOT_FOUND 1
#define OMRPORT_SL_INVALID 2
#define OMRPORT_SL_UNSUPPORTED 3
#define OMRPORT_SL_UNKNOWN 4 /* Unknown Shared Library related error. */
#define OMRPORT_SLOPEN_DECORATE 1 /* Note this value must remain 1, in order for legacy callers using TRUE and FALSE to control decoration */
#if !defined(OMRZTPF)
#define OMRPORT_SLOPEN_LAZY 2
#else /* !defined(OMRZTPF) */
#define OMRPORT_SLOPEN_LAZY 0
#endif /* defined(OMRZTPF) */
#define OMRPORT_SLOPEN_NO_LOOKUP_MSG_FOR_NOT_FOUND 4
#define OMRPORT_SLOPEN_OPEN_EXECUTABLE 8 /* Can be ORed without affecting existing flags. */
#define OMRPORT_ARCH_X86 "x86"
#define OMRPORT_ARCH_PPC "ppc" /* in line with IBM JDK 1.22 and above for AIX and Linux/PPC */
#define OMRPORT_ARCH_PPC64 "ppc64"
#define OMRPORT_ARCH_PPC64LE "ppc64le"
#define OMRPORT_ARCH_S390 "s390"
#define OMRPORT_ARCH_S390X "s390x"
#define OMRPORT_ARCH_HAMMER "amd64"
#define OMRPORT_ARCH_ARM "arm"
#define OMRPORT_ARCH_AARCH64 "aarch64"
#define OMRPORT_ARCH_RISCV "riscv"
#define OMRPORT_TTY_IN 0
#define OMRPORT_TTY_OUT 1
#define OMRPORT_TTY_ERR 2
#define OMRPORT_STREAM_IN stdin
#define OMRPORT_STREAM_OUT stdout
#define OMRPORT_STREAM_ERR stderr
#define OMRPORT_CTLDATA_SIG_FLAGS "SIG_FLAGS"
#define OMRPORT_CTLDATA_TRACE_START "TRACE_START"
#define OMRPORT_CTLDATA_TRACE_STOP "TRACE_STOP"
#define OMRPORT_CTLDATA_VMEM_NUMA_IN_USE "VMEM_NUMA_IN_USE"
#define OMRPORT_CTLDATA_VMEM_NUMA_ENABLE "VMEM_NUMA_IN_ENABLE"
#define OMRPORT_CTLDATA_VMEM_NUMA_INTERLEAVE_MEM "VMEM_NUMA_INTERLEAVE"
#define OMRPORT_CTLDATA_SYSLOG_OPEN "SYSLOG_OPEN"
#define OMRPORT_CTLDATA_SYSLOG_CLOSE "SYSLOG_CLOSE"
#define OMRPORT_CTLDATA_NOIPT "NOIPT"
#define OMRPORT_CTLDATA_TIME_CLEAR_TICK_TOCK "TIME_CLEAR_TICK_TOCK"
#define OMRPORT_CTLDATA_MEM_CATEGORIES_SET "MEM_CATEGORIES_SET"
#define OMRPORT_CTLDATA_AIX_PROC_ATTR "AIX_PROC_ATTR"
#define OMRPORT_CTLDATA_ALLOCATE32_COMMIT_SIZE "ALLOCATE32_COMMIT_SIZE"
#define OMRPORT_CTLDATA_NOSUBALLOC32BITMEM "NOSUBALLOC32BITMEM"
#define OMRPORT_CTLDATA_VMEM_ADVISE_OS_ONFREE "VMEM_ADVISE_OS_ONFREE"
#define OMRPORT_CTLDATA_VECTOR_REGS_SUPPORT_ON "VECTOR_REGS_SUPPORT_ON"
#define OMRPORT_CTLDATA_NLS_DISABLE "NLS_DISABLE"
#define OMRPORT_CTLDATA_VMEM_ADVISE_HUGEPAGE "VMEM_ADVISE_HUGEPAGE"
#define OMRPORT_CTLDATA_VMEM_PERFORM_FULL_MEMORY_SEARCH "VMEM_PERFORM_FULL_SEARCH"
#define OMRPORT_CTLDATA_VMEM_HUGE_PAGES_MMAP_ENABLED "VMEM_HUGE_PAGES_MMAP_ENABLED"
#define OMRPORT_FILE_READ_LOCK 1
#define OMRPORT_FILE_WRITE_LOCK 2
#define OMRPORT_FILE_WAIT_FOR_LOCK 4
#define OMRPORT_FILE_NOWAIT_FOR_LOCK 8
#define OMRPORT_MMAP_CAPABILITY_COPYONWRITE 1
#define OMRPORT_MMAP_CAPABILITY_READ 2
#define OMRPORT_MMAP_CAPABILITY_WRITE 4
#define OMRPORT_MMAP_CAPABILITY_UMAP_REQUIRES_SIZE 8
#define OMRPORT_MMAP_CAPABILITY_MSYNC 16
#define OMRPORT_MMAP_CAPABILITY_PROTECT 32
#define OMRPORT_MMAP_FLAG_CREATE_FILE 1
#define OMRPORT_MMAP_FLAG_READ 2
#define OMRPORT_MMAP_FLAG_WRITE 4
#define OMRPORT_MMAP_FLAG_COPYONWRITE 8
#define OMRPORT_MMAP_FLAG_EXECUTABLE 16
#define OMRPORT_MMAP_FLAG_SHARED 32
#define OMRPORT_MMAP_FLAG_PRIVATE 64
#define OMRPORT_MMAP_SYNC_WAIT 0x80
#define OMRPORT_MMAP_SYNC_ASYNC 0x100
#define OMRPORT_MMAP_SYNC_INVALIDATE 0x200
/* Signal classification bits. */
#define OMRPORT_SIG_FLAG_MAY_RETURN ((uint32_t)0x01)
#define OMRPORT_SIG_FLAG_MAY_CONTINUE_EXECUTION ((uint32_t)0x02)
#define OMRPORT_SIG_FLAG_IS_ASYNC ((uint32_t)0x04)
#define OMRPORT_SIG_FLAG_IS_SYNC ((uint32_t)0x08)
#define OMRPORT_SIG_FLAG_CONTROL_BITS_MASK ((uint32_t)0x0F)
#if defined(OMR_OS_WINDOWS) || defined(OMRZTPF)
/* The below macros support the [win32|win64amd|ztpf]/omrsignal.c implementations, which are used on Windows and z/TPF. */
#define OMRPORT_SIG_SMALLEST_SIGNAL_FLAG 0x4
#define OMRPORT_SIG_FLAG_SIGSEGV 0x4
#define OMRPORT_SIG_FLAG_SIGBUS 0x8
#define OMRPORT_SIG_FLAG_SIGILL 0x10
#define OMRPORT_SIG_FLAG_SIGFPE 0x20
#define OMRPORT_SIG_FLAG_SIGTRAP 0x40
#define OMRPORT_SIG_FLAG_SIGABEND 0x80
#define OMRPORT_SIG_FLAG_SIGPIPE 0x100
#define OMRPORT_SIG_FLAG_SIGALRM 0x200
#define OMRPORT_SIG_FLAG_SIGQUIT 0x400
#define OMRPORT_SIG_FLAG_SIGABRT 0x800
#define OMRPORT_SIG_FLAG_SIGTERM 0x1000
#define OMRPORT_SIG_FLAG_SIGRECONFIG 0x2000
#define OMRPORT_SIG_FLAG_SIGINT 0x4000
#define OMRPORT_SIG_FLAG_SIGXFSZ 0x8000
#define OMRPORT_SIG_FLAG_SIGCHLD 0x10000
#define OMRPORT_SIG_FLAG_SIGTSTP 0x20000
#define OMRPORT_SIG_FLAG_SIGFPE_DIV_BY_ZERO (OMRPORT_SIG_FLAG_SIGFPE | 0x40000)
#define OMRPORT_SIG_FLAG_SIGFPE_INT_DIV_BY_ZERO (OMRPORT_SIG_FLAG_SIGFPE | 0x80000)
#define OMRPORT_SIG_FLAG_SIGFPE_INT_OVERFLOW (OMRPORT_SIG_FLAG_SIGFPE | 0x100000)
#define OMRPORT_SIG_FLAG_SIGIO 0x200000
#define OMRPORT_SIG_FLAG_SIGHUP 0x400000
#define OMRPORT_SIG_FLAG_SIGCONT 0x800000
#define OMRPORT_SIG_FLAG_SIGWINCH 0x1000000
#define OMRPORT_SIG_FLAG_SIGUSR1 0x2000000
#define OMRPORT_SIG_FLAG_SIGUSR2 0x4000000
#define OMRPORT_SIG_FLAG_SIGURG 0x8000000
#define OMRPORT_SIG_FLAG_SIGXCPU 0x10000000
#define OMRPORT_SIG_FLAG_SIGVTALRM 0x20000000
#define OMRPORT_SIG_FLAG_SIGPROF 0x40000000
#define OMRPORT_SIG_FLAG_SIGSYS 0x80000000
#define OMRPORT_SIG_FLAG_SIGALLASYNC \
( OMRPORT_SIG_FLAG_SIGQUIT | OMRPORT_SIG_FLAG_SIGABRT | OMRPORT_SIG_FLAG_SIGTERM | OMRPORT_SIG_FLAG_SIGRECONFIG \
| OMRPORT_SIG_FLAG_SIGXFSZ | OMRPORT_SIG_FLAG_SIGINT | OMRPORT_SIG_FLAG_SIGHUP | OMRPORT_SIG_FLAG_SIGCONT \
| OMRPORT_SIG_FLAG_SIGWINCH | OMRPORT_SIG_FLAG_SIGPIPE | OMRPORT_SIG_FLAG_SIGALRM | OMRPORT_SIG_FLAG_SIGCHLD \
| OMRPORT_SIG_FLAG_SIGTSTP | OMRPORT_SIG_FLAG_SIGUSR1 | OMRPORT_SIG_FLAG_SIGUSR2 | OMRPORT_SIG_FLAG_SIGURG \
| OMRPORT_SIG_FLAG_SIGXCPU | OMRPORT_SIG_FLAG_SIGVTALRM | OMRPORT_SIG_FLAG_SIGPROF | OMRPORT_SIG_FLAG_SIGIO \
| OMRPORT_SIG_FLAG_SIGSYS )
#else /* defined(OMR_OS_WINDOWS) || defined(OMRZTPF) */
/* The below macros support the unix/omrsignal.c implementation, used everywhere but windows and z/TPF. */
/* All signal codes include exactly one of OMRPORT_SIG_FLAG_IS_SYNC or OMRPORT_SIG_FLAG_IS_ASYNC
* plus a multiple of this.
*/
#define OMRPORT_SIG_SMALLEST_SIGNAL_FLAG ((uint32_t)0x10)
/* The API can accommodate up to 19 more synchronous signals and up to 7 more asynchronous signals:
*
* #define OMRPORT_SIG_FLAG_MAX_SYNC ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 27) | OMRPORT_SIG_FLAG_IS_SYNC)
* #define OMRPORT_SIG_FLAG_MAX_ASYNC ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 27) | OMRPORT_SIG_FLAG_IS_ASYNC)
*/
/* Synchronous signals. */
#define OMRPORT_SIG_FLAG_SIGSEGV ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 0) | OMRPORT_SIG_FLAG_IS_SYNC)
#define OMRPORT_SIG_FLAG_SIGBUS ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 1) | OMRPORT_SIG_FLAG_IS_SYNC)
#define OMRPORT_SIG_FLAG_SIGILL ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 2) | OMRPORT_SIG_FLAG_IS_SYNC)
#define OMRPORT_SIG_FLAG_SIGFPE ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 3) | OMRPORT_SIG_FLAG_IS_SYNC)
#define OMRPORT_SIG_FLAG_SIGTRAP ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 4) | OMRPORT_SIG_FLAG_IS_SYNC)
#define OMRPORT_SIG_FLAG_SIGABEND ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 5) | OMRPORT_SIG_FLAG_IS_SYNC)
#define OMRPORT_SIG_FLAG_SIGFPE_DIV_BY_ZERO ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 6) | OMRPORT_SIG_FLAG_SIGFPE)
#define OMRPORT_SIG_FLAG_SIGFPE_INT_DIV_BY_ZERO ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 7) | OMRPORT_SIG_FLAG_SIGFPE)
#define OMRPORT_SIG_FLAG_SIGFPE_INT_OVERFLOW ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 8) | OMRPORT_SIG_FLAG_SIGFPE)
/* Asynchronous signals. */
#define OMRPORT_SIG_FLAG_SIGALRM ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 0) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGQUIT ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 1) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGABRT ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 2) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGTERM ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 3) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGRECONFIG ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 4) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGINT ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 5) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGXFSZ ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 6) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGCHLD ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 7) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGTSTP ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 8) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGIO ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 9) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGHUP ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 10) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGCONT ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 11) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGWINCH ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 12) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGUSR1 ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 13) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGUSR2 ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 14) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGURG ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 15) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGXCPU ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 16) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGVTALRM ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 17) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGPROF ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 18) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGPIPE ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 19) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGSYS ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 20) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGTTIN ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 21) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGTTOU ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 22) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGINFO ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 23) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGIOT ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 24) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGPOLL ((OMRPORT_SIG_SMALLEST_SIGNAL_FLAG << 25) | OMRPORT_SIG_FLAG_IS_ASYNC)
#define OMRPORT_SIG_FLAG_SIGALLASYNC \
( OMRPORT_SIG_FLAG_SIGALRM | OMRPORT_SIG_FLAG_SIGQUIT | OMRPORT_SIG_FLAG_SIGABRT | OMRPORT_SIG_FLAG_SIGTERM \
| OMRPORT_SIG_FLAG_SIGRECONFIG | OMRPORT_SIG_FLAG_SIGINT | OMRPORT_SIG_FLAG_SIGXFSZ | OMRPORT_SIG_FLAG_SIGCHLD \
| OMRPORT_SIG_FLAG_SIGTSTP | OMRPORT_SIG_FLAG_SIGIO | OMRPORT_SIG_FLAG_SIGHUP | OMRPORT_SIG_FLAG_SIGCONT \
| OMRPORT_SIG_FLAG_SIGWINCH | OMRPORT_SIG_FLAG_SIGUSR1 | OMRPORT_SIG_FLAG_SIGUSR2 | OMRPORT_SIG_FLAG_SIGURG \