rubycc 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +56 -0
- data/LICENSE.txt +21 -0
- data/NOTICE +52 -0
- data/README.md +208 -0
- data/data/README.md +117 -0
- data/data/r10_corpus_scan.json +4082 -0
- data/data/r10_manual_classification.json +5342 -0
- data/data/r10_verification_m4a.json +1531 -0
- data/data/r10_verification_m4b.json +1818 -0
- data/data/r10_verification_m4c.json +1489 -0
- data/data/r10_verification_m4d.json +318 -0
- data/data/r10_verification_rbs.json +192 -0
- data/data/verified_gems.json +397 -0
- data/exe/rmake +16 -0
- data/exe/rubycc +9 -0
- data/exe/rubycc-ar +114 -0
- data/exe/rubycc-doctor +14 -0
- data/exe/rubycc-pkgconf +8 -0
- data/include/float.h +87 -0
- data/include/iso646.h +18 -0
- data/include/libc/alloca.h +18 -0
- data/include/libc/arpa/inet.h +61 -0
- data/include/libc/assert.h +43 -0
- data/include/libc/dirent.h +72 -0
- data/include/libc/dlfcn.h +58 -0
- data/include/libc/features.h +205 -0
- data/include/libc/glibc/aarch64/ctype.h +108 -0
- data/include/libc/glibc/aarch64/endian.h +54 -0
- data/include/libc/glibc/aarch64/errno.h +154 -0
- data/include/libc/glibc/aarch64/fcntl.h +144 -0
- data/include/libc/glibc/aarch64/inttypes.h +182 -0
- data/include/libc/glibc/aarch64/limits.h +63 -0
- data/include/libc/glibc/aarch64/pthread.h +131 -0
- data/include/libc/glibc/aarch64/setjmp.h +84 -0
- data/include/libc/glibc/aarch64/stdint.h +174 -0
- data/include/libc/glibc/aarch64/sys/epoll.h +88 -0
- data/include/libc/glibc/aarch64/sys/fcntl.h +19 -0
- data/include/libc/glibc/aarch64/sys/select.h +75 -0
- data/include/libc/glibc/aarch64/sys/stat.h +136 -0
- data/include/libc/glibc/aarch64/sys/syscall.h +167 -0
- data/include/libc/glibc/aarch64/sys/time.h +74 -0
- data/include/libc/glibc/aarch64/sys/types.h +127 -0
- data/include/libc/glibc/aarch64/time.h +113 -0
- data/include/libc/glibc/x86_64/ctype.h +108 -0
- data/include/libc/glibc/x86_64/endian.h +54 -0
- data/include/libc/glibc/x86_64/errno.h +154 -0
- data/include/libc/glibc/x86_64/fcntl.h +134 -0
- data/include/libc/glibc/x86_64/inttypes.h +182 -0
- data/include/libc/glibc/x86_64/limits.h +61 -0
- data/include/libc/glibc/x86_64/pthread.h +111 -0
- data/include/libc/glibc/x86_64/setjmp.h +82 -0
- data/include/libc/glibc/x86_64/stdint.h +163 -0
- data/include/libc/glibc/x86_64/sys/epoll.h +91 -0
- data/include/libc/glibc/x86_64/sys/fcntl.h +19 -0
- data/include/libc/glibc/x86_64/sys/select.h +75 -0
- data/include/libc/glibc/x86_64/sys/stat.h +130 -0
- data/include/libc/glibc/x86_64/sys/syscall.h +188 -0
- data/include/libc/glibc/x86_64/sys/time.h +74 -0
- data/include/libc/glibc/x86_64/sys/types.h +123 -0
- data/include/libc/glibc/x86_64/time.h +113 -0
- data/include/libc/grp.h +50 -0
- data/include/libc/langinfo.h +126 -0
- data/include/libc/link.h +18 -0
- data/include/libc/locale.h +83 -0
- data/include/libc/math.h +191 -0
- data/include/libc/netinet/in.h +126 -0
- data/include/libc/netinet/tcp.h +44 -0
- data/include/libc/poll.h +46 -0
- data/include/libc/pwd.h +58 -0
- data/include/libc/regex.h +53 -0
- data/include/libc/sched.h +35 -0
- data/include/libc/signal.h +204 -0
- data/include/libc/stdio.h +157 -0
- data/include/libc/stdlib.h +92 -0
- data/include/libc/string.h +74 -0
- data/include/libc/strings.h +25 -0
- data/include/libc/sys/cdefs.h +126 -0
- data/include/libc/sys/inotify.h +111 -0
- data/include/libc/sys/ioctl.h +36 -0
- data/include/libc/sys/mman.h +65 -0
- data/include/libc/sys/param.h +41 -0
- data/include/libc/sys/resource.h +109 -0
- data/include/libc/sys/socket.h +167 -0
- data/include/libc/sys/statfs.h +82 -0
- data/include/libc/sys/timerfd.h +55 -0
- data/include/libc/sys/uio.h +40 -0
- data/include/libc/sys/un.h +25 -0
- data/include/libc/sys/utsname.h +35 -0
- data/include/libc/sys/wait.h +135 -0
- data/include/libc/termios.h +179 -0
- data/include/libc/unistd.h +194 -0
- data/include/stdalign.h +16 -0
- data/include/stdarg.h +31 -0
- data/include/stdatomic.h +158 -0
- data/include/stdbool.h +15 -0
- data/include/stdckdint.h +28 -0
- data/include/stddef.h +60 -0
- data/include/stdnoreturn.h +18 -0
- data/include/x86intrin.h +16 -0
- data/lib/rubycc/backend/aarch64.rb +1724 -0
- data/lib/rubycc/backend/x86_64.rb +1369 -0
- data/lib/rubycc/compile_error.rb +36 -0
- data/lib/rubycc/compiler.rb +305 -0
- data/lib/rubycc/doctor/builder.rb +151 -0
- data/lib/rubycc/doctor/cli.rb +190 -0
- data/lib/rubycc/doctor/fetcher.rb +84 -0
- data/lib/rubycc/doctor/gemfile.rb +115 -0
- data/lib/rubycc/doctor/verified_gems.rb +114 -0
- data/lib/rubycc/doctor.rb +16 -0
- data/lib/rubycc/driver.rb +463 -0
- data/lib/rubycc/front/ast.rb +528 -0
- data/lib/rubycc/front/constant_evaluator.rb +631 -0
- data/lib/rubycc/front/initializer_resolver.rb +592 -0
- data/lib/rubycc/front/lexeme_reader.rb +460 -0
- data/lib/rubycc/front/lexer.rb +232 -0
- data/lib/rubycc/front/parser.rb +4122 -0
- data/lib/rubycc/front/token.rb +49 -0
- data/lib/rubycc/ir/call_convention.rb +486 -0
- data/lib/rubycc/ir/generator.rb +6036 -0
- data/lib/rubycc/ir/ir.rb +417 -0
- data/lib/rubycc/link/compat_runtime.rb +89 -0
- data/lib/rubycc/link/errors.rb +13 -0
- data/lib/rubycc/link/executable_linker.rb +405 -0
- data/lib/rubycc/link/library_resolver.rb +437 -0
- data/lib/rubycc/link/partial_linker.rb +546 -0
- data/lib/rubycc/link/shared_linker.rb +1732 -0
- data/lib/rubycc/mkmf_shim.rb +83 -0
- data/lib/rubycc/objfile/ar_archive.rb +437 -0
- data/lib/rubycc/objfile/elf_reader.rb +646 -0
- data/lib/rubycc/objfile/elf_writer.rb +891 -0
- data/lib/rubycc/objfile/relocatable_writer.rb +376 -0
- data/lib/rubycc/pkgconf/cli.rb +139 -0
- data/lib/rubycc/pkgconf/errors.rb +39 -0
- data/lib/rubycc/pkgconf/model.rb +28 -0
- data/lib/rubycc/pkgconf/parser.rb +109 -0
- data/lib/rubycc/pkgconf/pkgconf.rb +15 -0
- data/lib/rubycc/pkgconf/resolver.rb +70 -0
- data/lib/rubycc/pkgconf/search_path.rb +38 -0
- data/lib/rubycc/pkgconf/system_path_filter.rb +131 -0
- data/lib/rubycc/preprocess/constant_expression.rb +219 -0
- data/lib/rubycc/preprocess/glibc_version.rb +124 -0
- data/lib/rubycc/preprocess/pp_token.rb +62 -0
- data/lib/rubycc/preprocess/preprocessor.rb +2020 -0
- data/lib/rubycc/preprocess/scanner.rb +290 -0
- data/lib/rubycc/preprocess/token_converter.rb +157 -0
- data/lib/rubycc/rmake/cli.rb +143 -0
- data/lib/rubycc/rmake/errors.rb +71 -0
- data/lib/rubycc/rmake/executor.rb +818 -0
- data/lib/rubycc/rmake/expander.rb +251 -0
- data/lib/rubycc/rmake/makefile.rb +352 -0
- data/lib/rubycc/rmake/model.rb +137 -0
- data/lib/rubycc/rmake/parser.rb +226 -0
- data/lib/rubycc/rmake/rmake.rb +15 -0
- data/lib/rubycc/type.rb +1236 -0
- data/lib/rubycc/version.rb +5 -0
- data/lib/rubycc.rb +36 -0
- data/lib/rubygems_plugin.rb +102 -0
- metadata +219 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/* rubycc bundled <sys/stat.h>: struct stat and the file-mode macros (POSIX).
|
|
2
|
+
Provenance: clean room against the Linux aarch64 kernel ABI, not derived from
|
|
3
|
+
musl. struct stat is pinned to that ABI, which differs from x86-64's: it is
|
|
4
|
+
128 bytes (not 144), st_mode precedes st_nlink, nlink_t/blksize_t are 32-bit,
|
|
5
|
+
and glibc reserves three slots to reach that size -- an 8-byte __pad1 after
|
|
6
|
+
st_rdev (a second dev_t's worth of space), a 4-byte __pad2 after st_blksize,
|
|
7
|
+
and a trailing int __glibc_reserved[2]. The measured field offsets are st_dev
|
|
8
|
+
0, st_ino 8, st_mode 16, st_nlink 20, st_uid 24, st_gid 28, st_rdev 32,
|
|
9
|
+
st_size 48, st_blksize 56, st_blocks 64, st_atim 72, st_mtim 88, st_ctim 104.
|
|
10
|
+
Both the layout and the S_IF* octal values are ABI facts reproduced by
|
|
11
|
+
measurement, not copied text (see docs/HEADER-LICENSING.md). The S_IF* values
|
|
12
|
+
are the kernel ABI, identical to x86-64. Placed in the glibc/aarch64 layer
|
|
13
|
+
because they are kernel-ABI specific. */
|
|
14
|
+
|
|
15
|
+
#ifndef _RUBYCC_SYS_STAT_H
|
|
16
|
+
#define _RUBYCC_SYS_STAT_H
|
|
17
|
+
|
|
18
|
+
#ifndef _RUBYCC_DEV_T
|
|
19
|
+
#define _RUBYCC_DEV_T
|
|
20
|
+
typedef unsigned long dev_t;
|
|
21
|
+
#endif
|
|
22
|
+
#ifndef _RUBYCC_INO_T
|
|
23
|
+
#define _RUBYCC_INO_T
|
|
24
|
+
typedef unsigned long ino_t;
|
|
25
|
+
#endif
|
|
26
|
+
#ifndef _RUBYCC_NLINK_T
|
|
27
|
+
#define _RUBYCC_NLINK_T
|
|
28
|
+
typedef unsigned int nlink_t;
|
|
29
|
+
#endif
|
|
30
|
+
#ifndef _RUBYCC_MODE_T
|
|
31
|
+
#define _RUBYCC_MODE_T
|
|
32
|
+
typedef unsigned int mode_t;
|
|
33
|
+
#endif
|
|
34
|
+
#ifndef _RUBYCC_UID_T
|
|
35
|
+
#define _RUBYCC_UID_T
|
|
36
|
+
typedef unsigned int uid_t;
|
|
37
|
+
#endif
|
|
38
|
+
#ifndef _RUBYCC_GID_T
|
|
39
|
+
#define _RUBYCC_GID_T
|
|
40
|
+
typedef unsigned int gid_t;
|
|
41
|
+
#endif
|
|
42
|
+
#ifndef _RUBYCC_OFF_T
|
|
43
|
+
#define _RUBYCC_OFF_T
|
|
44
|
+
typedef long off_t;
|
|
45
|
+
#endif
|
|
46
|
+
#ifndef _RUBYCC_TIME_T
|
|
47
|
+
#define _RUBYCC_TIME_T
|
|
48
|
+
typedef long time_t;
|
|
49
|
+
#endif
|
|
50
|
+
#ifndef _RUBYCC_BLKSIZE_T
|
|
51
|
+
#define _RUBYCC_BLKSIZE_T
|
|
52
|
+
typedef int blksize_t;
|
|
53
|
+
#endif
|
|
54
|
+
#ifndef _RUBYCC_BLKCNT_T
|
|
55
|
+
#define _RUBYCC_BLKCNT_T
|
|
56
|
+
typedef long blkcnt_t;
|
|
57
|
+
#endif
|
|
58
|
+
#ifndef _STRUCT_TIMESPEC
|
|
59
|
+
#define _STRUCT_TIMESPEC 1
|
|
60
|
+
struct timespec {
|
|
61
|
+
time_t tv_sec;
|
|
62
|
+
long tv_nsec;
|
|
63
|
+
};
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
struct stat {
|
|
67
|
+
dev_t st_dev; /* 0 */
|
|
68
|
+
ino_t st_ino; /* 8 */
|
|
69
|
+
mode_t st_mode; /* 16 (precedes st_nlink on aarch64) */
|
|
70
|
+
nlink_t st_nlink; /* 20 (32-bit) */
|
|
71
|
+
uid_t st_uid; /* 24 */
|
|
72
|
+
gid_t st_gid; /* 28 */
|
|
73
|
+
dev_t st_rdev; /* 32 */
|
|
74
|
+
dev_t __pad1; /* 40 (reserved dev_t slot) */
|
|
75
|
+
off_t st_size; /* 48 */
|
|
76
|
+
blksize_t st_blksize; /* 56 (32-bit) */
|
|
77
|
+
int __pad2; /* 60 */
|
|
78
|
+
blkcnt_t st_blocks; /* 64 */
|
|
79
|
+
struct timespec st_atim; /* 72 */
|
|
80
|
+
struct timespec st_mtim; /* 88 */
|
|
81
|
+
struct timespec st_ctim; /* 104 */
|
|
82
|
+
int __glibc_reserved[2]; /* 120, filling out to 128 */
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/* POSIX.1-2008 second-resolution aliases onto the timespec fields. */
|
|
86
|
+
#define st_atime st_atim.tv_sec
|
|
87
|
+
#define st_mtime st_mtim.tv_sec
|
|
88
|
+
#define st_ctime st_ctim.tv_sec
|
|
89
|
+
|
|
90
|
+
/* File type bits (octal, kernel ABI). */
|
|
91
|
+
#define S_IFMT 0170000
|
|
92
|
+
#define S_IFDIR 0040000
|
|
93
|
+
#define S_IFCHR 0020000
|
|
94
|
+
#define S_IFBLK 0060000
|
|
95
|
+
#define S_IFREG 0100000
|
|
96
|
+
#define S_IFIFO 0010000
|
|
97
|
+
#define S_IFLNK 0120000
|
|
98
|
+
#define S_IFSOCK 0140000
|
|
99
|
+
|
|
100
|
+
#define S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
|
|
101
|
+
#define S_ISDIR(mode) S_ISTYPE((mode), S_IFDIR)
|
|
102
|
+
#define S_ISCHR(mode) S_ISTYPE((mode), S_IFCHR)
|
|
103
|
+
#define S_ISBLK(mode) S_ISTYPE((mode), S_IFBLK)
|
|
104
|
+
#define S_ISREG(mode) S_ISTYPE((mode), S_IFREG)
|
|
105
|
+
#define S_ISFIFO(mode) S_ISTYPE((mode), S_IFIFO)
|
|
106
|
+
#define S_ISLNK(mode) S_ISTYPE((mode), S_IFLNK)
|
|
107
|
+
#define S_ISSOCK(mode) S_ISTYPE((mode), S_IFSOCK)
|
|
108
|
+
|
|
109
|
+
/* Permission bits. */
|
|
110
|
+
#define S_ISUID 04000
|
|
111
|
+
#define S_ISGID 02000
|
|
112
|
+
#define S_ISVTX 01000
|
|
113
|
+
#define S_IRUSR 0400
|
|
114
|
+
#define S_IWUSR 0200
|
|
115
|
+
#define S_IXUSR 0100
|
|
116
|
+
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
|
117
|
+
#define S_IRGRP (S_IRUSR >> 3)
|
|
118
|
+
#define S_IWGRP (S_IWUSR >> 3)
|
|
119
|
+
#define S_IXGRP (S_IXUSR >> 3)
|
|
120
|
+
#define S_IRWXG (S_IRWXU >> 3)
|
|
121
|
+
#define S_IROTH (S_IRGRP >> 3)
|
|
122
|
+
#define S_IWOTH (S_IWGRP >> 3)
|
|
123
|
+
#define S_IXOTH (S_IXGRP >> 3)
|
|
124
|
+
#define S_IRWXO (S_IRWXG >> 3)
|
|
125
|
+
|
|
126
|
+
int stat(const char *__restrict __file, struct stat *__restrict __buf);
|
|
127
|
+
int fstat(int __fd, struct stat *__buf);
|
|
128
|
+
int lstat(const char *__restrict __file, struct stat *__restrict __buf);
|
|
129
|
+
int fstatat(int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag);
|
|
130
|
+
int chmod(const char *__file, mode_t __mode);
|
|
131
|
+
int fchmod(int __fd, mode_t __mode);
|
|
132
|
+
int mkdir(const char *__path, mode_t __mode);
|
|
133
|
+
int mkfifo(const char *__path, mode_t __mode);
|
|
134
|
+
mode_t umask(mode_t __mask);
|
|
135
|
+
|
|
136
|
+
#endif /* _RUBYCC_SYS_STAT_H */
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* rubycc bundled <sys/syscall.h> (aarch64): the system-call numbers, as the
|
|
2
|
+
SYS_ names callers pass to syscall(2). Provenance: clean room against the
|
|
3
|
+
Linux kernel's aarch64 (asm-generic) system-call table, not derived from
|
|
4
|
+
musl or glibc source. Every number below was printed from the glibc oracle
|
|
5
|
+
under the cross toolchain and qemu (an ABI fact, not copied text -- see
|
|
6
|
+
docs/HEADER-LICENSING.md sec. 4).
|
|
7
|
+
|
|
8
|
+
Arch layer, necessarily: aarch64 uses the modern asm-generic numbering
|
|
9
|
+
while x86-64 keeps its own historical table, and measured side by side the
|
|
10
|
+
two disagree on essentially every entry -- SYS_read is 63 here and 0
|
|
11
|
+
there, SYS_write 64 vs 1, SYS_openat 56 vs 257, SYS_epoll_ctl 21 vs 233.
|
|
12
|
+
The x86-64 sibling carries the same set of names with its own numbers; the
|
|
13
|
+
only entries where the two agree are the io_uring trio (425/426/427),
|
|
14
|
+
allocated from the shared modern range. See that file's header note for
|
|
15
|
+
the __NR_/SYS_ two-level spelling and the scope rule (only names present
|
|
16
|
+
on both targets, so the legacy x86-64-only entry points -- open, poll,
|
|
17
|
+
select, pipe, dup2 and their kin, which the asm-generic table simply does
|
|
18
|
+
not have -- are left out on both sides).
|
|
19
|
+
|
|
20
|
+
Like glibc's, this header does not declare syscall() itself; the prototype
|
|
21
|
+
belongs to <unistd.h>. */
|
|
22
|
+
|
|
23
|
+
#ifndef _RUBYCC_SYS_SYSCALL_H
|
|
24
|
+
#define _RUBYCC_SYS_SYSCALL_H
|
|
25
|
+
|
|
26
|
+
/* Basic file I/O. */
|
|
27
|
+
#define __NR_read 63
|
|
28
|
+
#define __NR_write 64
|
|
29
|
+
#define __NR_close 57
|
|
30
|
+
#define __NR_lseek 62
|
|
31
|
+
#define __NR_openat 56
|
|
32
|
+
#define __NR_readlinkat 78
|
|
33
|
+
#define __NR_faccessat 48
|
|
34
|
+
#define __NR_ioctl 29
|
|
35
|
+
#define __NR_fcntl 25
|
|
36
|
+
#define __NR_pipe2 59
|
|
37
|
+
#define __NR_dup3 24
|
|
38
|
+
|
|
39
|
+
/* Filesystem statistics (the calls behind <sys/statfs.h>). */
|
|
40
|
+
#define __NR_statfs 43
|
|
41
|
+
#define __NR_fstatfs 44
|
|
42
|
+
|
|
43
|
+
/* Memory. */
|
|
44
|
+
#define __NR_mmap 222
|
|
45
|
+
#define __NR_mprotect 226
|
|
46
|
+
#define __NR_munmap 215
|
|
47
|
+
|
|
48
|
+
/* Processes, threads and signals. */
|
|
49
|
+
#define __NR_clone 220
|
|
50
|
+
#define __NR_exit 93
|
|
51
|
+
#define __NR_exit_group 94
|
|
52
|
+
#define __NR_getpid 172
|
|
53
|
+
#define __NR_gettid 178
|
|
54
|
+
#define __NR_kill 129
|
|
55
|
+
#define __NR_tgkill 131
|
|
56
|
+
#define __NR_rt_sigaction 134
|
|
57
|
+
#define __NR_rt_sigprocmask 135
|
|
58
|
+
#define __NR_futex 98
|
|
59
|
+
#define __NR_sched_yield 124
|
|
60
|
+
#define __NR_getcpu 168
|
|
61
|
+
#define __NR_membarrier 283
|
|
62
|
+
#define __NR_getrandom 278
|
|
63
|
+
|
|
64
|
+
/* Time. */
|
|
65
|
+
#define __NR_nanosleep 101
|
|
66
|
+
#define __NR_clock_gettime 113
|
|
67
|
+
#define __NR_clock_nanosleep 115
|
|
68
|
+
|
|
69
|
+
/* Event notification: the file-descriptor-based interfaces libev drives
|
|
70
|
+
through raw syscalls when the libc wrappers are not available. */
|
|
71
|
+
#define __NR_epoll_create1 20
|
|
72
|
+
#define __NR_epoll_ctl 21
|
|
73
|
+
#define __NR_epoll_pwait 22
|
|
74
|
+
#define __NR_ppoll 73
|
|
75
|
+
#define __NR_pselect6 72
|
|
76
|
+
#define __NR_eventfd2 19
|
|
77
|
+
#define __NR_signalfd4 74
|
|
78
|
+
#define __NR_inotify_init1 26
|
|
79
|
+
#define __NR_inotify_add_watch 27
|
|
80
|
+
#define __NR_inotify_rm_watch 28
|
|
81
|
+
#define __NR_timerfd_create 85
|
|
82
|
+
#define __NR_timerfd_settime 86
|
|
83
|
+
#define __NR_timerfd_gettime 87
|
|
84
|
+
|
|
85
|
+
/* Asynchronous I/O: the legacy linux-aio calls and io_uring. These have no
|
|
86
|
+
libc wrappers at all, which is why libev issues them by number. The aio
|
|
87
|
+
five sit at 0..4 here, the very start of the asm-generic table. */
|
|
88
|
+
#define __NR_io_setup 0
|
|
89
|
+
#define __NR_io_destroy 1
|
|
90
|
+
#define __NR_io_submit 2
|
|
91
|
+
#define __NR_io_cancel 3
|
|
92
|
+
#define __NR_io_getevents 4
|
|
93
|
+
#define __NR_io_uring_setup 425
|
|
94
|
+
#define __NR_io_uring_enter 426
|
|
95
|
+
#define __NR_io_uring_register 427
|
|
96
|
+
|
|
97
|
+
/* Sockets. */
|
|
98
|
+
#define __NR_socket 198
|
|
99
|
+
#define __NR_setsockopt 208
|
|
100
|
+
|
|
101
|
+
/* The SYS_ spellings: aliases of the __NR_ names above, which is the
|
|
102
|
+
relationship measured against the real header. */
|
|
103
|
+
#define SYS_read __NR_read
|
|
104
|
+
#define SYS_write __NR_write
|
|
105
|
+
#define SYS_close __NR_close
|
|
106
|
+
#define SYS_lseek __NR_lseek
|
|
107
|
+
#define SYS_openat __NR_openat
|
|
108
|
+
#define SYS_readlinkat __NR_readlinkat
|
|
109
|
+
#define SYS_faccessat __NR_faccessat
|
|
110
|
+
#define SYS_ioctl __NR_ioctl
|
|
111
|
+
#define SYS_fcntl __NR_fcntl
|
|
112
|
+
#define SYS_pipe2 __NR_pipe2
|
|
113
|
+
#define SYS_dup3 __NR_dup3
|
|
114
|
+
|
|
115
|
+
#define SYS_statfs __NR_statfs
|
|
116
|
+
#define SYS_fstatfs __NR_fstatfs
|
|
117
|
+
|
|
118
|
+
#define SYS_mmap __NR_mmap
|
|
119
|
+
#define SYS_mprotect __NR_mprotect
|
|
120
|
+
#define SYS_munmap __NR_munmap
|
|
121
|
+
|
|
122
|
+
#define SYS_clone __NR_clone
|
|
123
|
+
#define SYS_exit __NR_exit
|
|
124
|
+
#define SYS_exit_group __NR_exit_group
|
|
125
|
+
#define SYS_getpid __NR_getpid
|
|
126
|
+
#define SYS_gettid __NR_gettid
|
|
127
|
+
#define SYS_kill __NR_kill
|
|
128
|
+
#define SYS_tgkill __NR_tgkill
|
|
129
|
+
#define SYS_rt_sigaction __NR_rt_sigaction
|
|
130
|
+
#define SYS_rt_sigprocmask __NR_rt_sigprocmask
|
|
131
|
+
#define SYS_futex __NR_futex
|
|
132
|
+
#define SYS_sched_yield __NR_sched_yield
|
|
133
|
+
#define SYS_getcpu __NR_getcpu
|
|
134
|
+
#define SYS_membarrier __NR_membarrier
|
|
135
|
+
#define SYS_getrandom __NR_getrandom
|
|
136
|
+
|
|
137
|
+
#define SYS_nanosleep __NR_nanosleep
|
|
138
|
+
#define SYS_clock_gettime __NR_clock_gettime
|
|
139
|
+
#define SYS_clock_nanosleep __NR_clock_nanosleep
|
|
140
|
+
|
|
141
|
+
#define SYS_epoll_create1 __NR_epoll_create1
|
|
142
|
+
#define SYS_epoll_ctl __NR_epoll_ctl
|
|
143
|
+
#define SYS_epoll_pwait __NR_epoll_pwait
|
|
144
|
+
#define SYS_ppoll __NR_ppoll
|
|
145
|
+
#define SYS_pselect6 __NR_pselect6
|
|
146
|
+
#define SYS_eventfd2 __NR_eventfd2
|
|
147
|
+
#define SYS_signalfd4 __NR_signalfd4
|
|
148
|
+
#define SYS_inotify_init1 __NR_inotify_init1
|
|
149
|
+
#define SYS_inotify_add_watch __NR_inotify_add_watch
|
|
150
|
+
#define SYS_inotify_rm_watch __NR_inotify_rm_watch
|
|
151
|
+
#define SYS_timerfd_create __NR_timerfd_create
|
|
152
|
+
#define SYS_timerfd_settime __NR_timerfd_settime
|
|
153
|
+
#define SYS_timerfd_gettime __NR_timerfd_gettime
|
|
154
|
+
|
|
155
|
+
#define SYS_io_setup __NR_io_setup
|
|
156
|
+
#define SYS_io_destroy __NR_io_destroy
|
|
157
|
+
#define SYS_io_getevents __NR_io_getevents
|
|
158
|
+
#define SYS_io_submit __NR_io_submit
|
|
159
|
+
#define SYS_io_cancel __NR_io_cancel
|
|
160
|
+
#define SYS_io_uring_setup __NR_io_uring_setup
|
|
161
|
+
#define SYS_io_uring_enter __NR_io_uring_enter
|
|
162
|
+
#define SYS_io_uring_register __NR_io_uring_register
|
|
163
|
+
|
|
164
|
+
#define SYS_socket __NR_socket
|
|
165
|
+
#define SYS_setsockopt __NR_setsockopt
|
|
166
|
+
|
|
167
|
+
#endif /* _RUBYCC_SYS_SYSCALL_H */
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* rubycc bundled <sys/time.h>: struct timeval and the BSD time calls (POSIX).
|
|
2
|
+
Derived from musl's <sys/time.h> shape; struct timeval's members are pinned to
|
|
3
|
+
the glibc x86-64 ABI (time_t and suseconds_t are both `long`, giving a 16-byte
|
|
4
|
+
layout, measured). The struct guard reuses glibc's __timeval_defined. ABI
|
|
5
|
+
switch layer: the member widths are arch specific. */
|
|
6
|
+
|
|
7
|
+
#ifndef _RUBYCC_SYS_TIME_H
|
|
8
|
+
#define _RUBYCC_SYS_TIME_H
|
|
9
|
+
|
|
10
|
+
#ifndef _RUBYCC_TIME_T
|
|
11
|
+
#define _RUBYCC_TIME_T
|
|
12
|
+
typedef long time_t;
|
|
13
|
+
#endif
|
|
14
|
+
#ifndef _RUBYCC_SUSECONDS_T
|
|
15
|
+
#define _RUBYCC_SUSECONDS_T
|
|
16
|
+
typedef long suseconds_t;
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#ifndef __timeval_defined
|
|
20
|
+
#define __timeval_defined 1
|
|
21
|
+
struct timeval {
|
|
22
|
+
time_t tv_sec;
|
|
23
|
+
suseconds_t tv_usec;
|
|
24
|
+
};
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
struct timezone {
|
|
28
|
+
int tz_minuteswest;
|
|
29
|
+
int tz_dsttime;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
struct itimerval {
|
|
33
|
+
struct timeval it_interval;
|
|
34
|
+
struct timeval it_value;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
#define ITIMER_REAL 0
|
|
38
|
+
#define ITIMER_VIRTUAL 1
|
|
39
|
+
#define ITIMER_PROF 2
|
|
40
|
+
|
|
41
|
+
int gettimeofday(struct timeval *__restrict __tv, void *__restrict __tz);
|
|
42
|
+
int settimeofday(const struct timeval *__tv, const struct timezone *__tz);
|
|
43
|
+
int getitimer(int __which, struct itimerval *__value);
|
|
44
|
+
int setitimer(int __which, const struct itimerval *__restrict __new,
|
|
45
|
+
struct itimerval *__restrict __old);
|
|
46
|
+
int utimes(const char *__file, const struct timeval __tvp[2]);
|
|
47
|
+
|
|
48
|
+
/* Convenience timeval arithmetic macros (glibc/BSD, under _DEFAULT_SOURCE). */
|
|
49
|
+
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
|
|
50
|
+
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
|
|
51
|
+
#define timercmp(a, b, CMP) \
|
|
52
|
+
(((a)->tv_sec == (b)->tv_sec) ? \
|
|
53
|
+
((a)->tv_usec CMP (b)->tv_usec) : \
|
|
54
|
+
((a)->tv_sec CMP (b)->tv_sec))
|
|
55
|
+
#define timeradd(a, b, result) \
|
|
56
|
+
do { \
|
|
57
|
+
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
|
|
58
|
+
(result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
|
|
59
|
+
if ((result)->tv_usec >= 1000000) { \
|
|
60
|
+
++(result)->tv_sec; \
|
|
61
|
+
(result)->tv_usec -= 1000000; \
|
|
62
|
+
} \
|
|
63
|
+
} while (0)
|
|
64
|
+
#define timersub(a, b, result) \
|
|
65
|
+
do { \
|
|
66
|
+
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
|
|
67
|
+
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
|
|
68
|
+
if ((result)->tv_usec < 0) { \
|
|
69
|
+
--(result)->tv_sec; \
|
|
70
|
+
(result)->tv_usec += 1000000; \
|
|
71
|
+
} \
|
|
72
|
+
} while (0)
|
|
73
|
+
|
|
74
|
+
#endif /* _RUBYCC_SYS_TIME_H */
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/* rubycc bundled <sys/types.h>: the width-critical POSIX typedefs. Derived from
|
|
2
|
+
musl's <sys/types.h> shape; every width and signedness is pinned to the glibc
|
|
3
|
+
aarch64 LP64 ABI (measured): off_t/time_t/ssize_t are `long`, pid_t is `int`,
|
|
4
|
+
dev_t/ino_t are `unsigned long`. Two typedefs are narrower here than in the
|
|
5
|
+
x86-64 layer: aarch64 glibc makes nlink_t `unsigned int` and blksize_t `int`
|
|
6
|
+
(both 32-bit), where x86-64 makes them 64-bit. Each typedef is guarded by a
|
|
7
|
+
shared _RUBYCC_* tag so the other bundled headers that also spell these types
|
|
8
|
+
agree rather than redefine (in particular <sys/stat.h> in this same layer,
|
|
9
|
+
which must pin nlink_t/blksize_t to the identical widths). ABI switch layer:
|
|
10
|
+
the widths are arch specific. */
|
|
11
|
+
|
|
12
|
+
#ifndef _RUBYCC_SYS_TYPES_H
|
|
13
|
+
#define _RUBYCC_SYS_TYPES_H
|
|
14
|
+
|
|
15
|
+
#ifndef _RUBYCC_SIZE_T
|
|
16
|
+
#define _RUBYCC_SIZE_T
|
|
17
|
+
typedef unsigned long size_t;
|
|
18
|
+
#endif
|
|
19
|
+
#ifndef _RUBYCC_SSIZE_T
|
|
20
|
+
#define _RUBYCC_SSIZE_T
|
|
21
|
+
typedef long ssize_t;
|
|
22
|
+
#endif
|
|
23
|
+
#ifndef _RUBYCC_OFF_T
|
|
24
|
+
#define _RUBYCC_OFF_T
|
|
25
|
+
typedef long off_t;
|
|
26
|
+
#endif
|
|
27
|
+
typedef long off64_t;
|
|
28
|
+
typedef long loff_t;
|
|
29
|
+
#ifndef _RUBYCC_PID_T
|
|
30
|
+
#define _RUBYCC_PID_T
|
|
31
|
+
typedef int pid_t;
|
|
32
|
+
#endif
|
|
33
|
+
#ifndef _RUBYCC_UID_T
|
|
34
|
+
#define _RUBYCC_UID_T
|
|
35
|
+
typedef unsigned int uid_t;
|
|
36
|
+
#endif
|
|
37
|
+
#ifndef _RUBYCC_GID_T
|
|
38
|
+
#define _RUBYCC_GID_T
|
|
39
|
+
typedef unsigned int gid_t;
|
|
40
|
+
#endif
|
|
41
|
+
#ifndef _RUBYCC_MODE_T
|
|
42
|
+
#define _RUBYCC_MODE_T
|
|
43
|
+
typedef unsigned int mode_t;
|
|
44
|
+
#endif
|
|
45
|
+
#ifndef _RUBYCC_INO_T
|
|
46
|
+
#define _RUBYCC_INO_T
|
|
47
|
+
typedef unsigned long ino_t;
|
|
48
|
+
#endif
|
|
49
|
+
typedef unsigned long ino64_t;
|
|
50
|
+
#ifndef _RUBYCC_DEV_T
|
|
51
|
+
#define _RUBYCC_DEV_T
|
|
52
|
+
typedef unsigned long dev_t;
|
|
53
|
+
#endif
|
|
54
|
+
#ifndef _RUBYCC_NLINK_T
|
|
55
|
+
#define _RUBYCC_NLINK_T
|
|
56
|
+
typedef unsigned int nlink_t;
|
|
57
|
+
#endif
|
|
58
|
+
#ifndef _RUBYCC_BLKSIZE_T
|
|
59
|
+
#define _RUBYCC_BLKSIZE_T
|
|
60
|
+
typedef int blksize_t;
|
|
61
|
+
#endif
|
|
62
|
+
#ifndef _RUBYCC_BLKCNT_T
|
|
63
|
+
#define _RUBYCC_BLKCNT_T
|
|
64
|
+
typedef long blkcnt_t;
|
|
65
|
+
#endif
|
|
66
|
+
typedef long blkcnt64_t;
|
|
67
|
+
#ifndef _RUBYCC_FSBLKCNT_T
|
|
68
|
+
#define _RUBYCC_FSBLKCNT_T
|
|
69
|
+
typedef unsigned long fsblkcnt_t;
|
|
70
|
+
#endif
|
|
71
|
+
typedef unsigned long fsblkcnt64_t;
|
|
72
|
+
#ifndef _RUBYCC_FSFILCNT_T
|
|
73
|
+
#define _RUBYCC_FSFILCNT_T
|
|
74
|
+
typedef unsigned long fsfilcnt_t;
|
|
75
|
+
#endif
|
|
76
|
+
typedef unsigned long fsfilcnt64_t;
|
|
77
|
+
#ifndef _RUBYCC_TIME_T
|
|
78
|
+
#define _RUBYCC_TIME_T
|
|
79
|
+
typedef long time_t;
|
|
80
|
+
#endif
|
|
81
|
+
#ifndef _RUBYCC_CLOCK_T
|
|
82
|
+
#define _RUBYCC_CLOCK_T
|
|
83
|
+
typedef long clock_t;
|
|
84
|
+
#endif
|
|
85
|
+
#ifndef _RUBYCC_CLOCKID_T
|
|
86
|
+
#define _RUBYCC_CLOCKID_T
|
|
87
|
+
typedef int clockid_t;
|
|
88
|
+
#endif
|
|
89
|
+
#ifndef _RUBYCC_TIMER_T
|
|
90
|
+
#define _RUBYCC_TIMER_T
|
|
91
|
+
typedef void *timer_t;
|
|
92
|
+
#endif
|
|
93
|
+
#ifndef _RUBYCC_SUSECONDS_T
|
|
94
|
+
#define _RUBYCC_SUSECONDS_T
|
|
95
|
+
typedef long suseconds_t;
|
|
96
|
+
#endif
|
|
97
|
+
#ifndef _RUBYCC_USECONDS_T
|
|
98
|
+
#define _RUBYCC_USECONDS_T
|
|
99
|
+
typedef unsigned int useconds_t;
|
|
100
|
+
#endif
|
|
101
|
+
#ifndef _RUBYCC_ID_T
|
|
102
|
+
#define _RUBYCC_ID_T
|
|
103
|
+
typedef unsigned int id_t;
|
|
104
|
+
#endif
|
|
105
|
+
#ifndef _RUBYCC_KEY_T
|
|
106
|
+
#define _RUBYCC_KEY_T
|
|
107
|
+
typedef int key_t;
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
typedef long register_t;
|
|
111
|
+
typedef int daddr_t;
|
|
112
|
+
typedef char *caddr_t;
|
|
113
|
+
|
|
114
|
+
/* BSD short-hand integer names (glibc exposes them under _DEFAULT_SOURCE). */
|
|
115
|
+
typedef unsigned char u_char;
|
|
116
|
+
typedef unsigned short u_short;
|
|
117
|
+
typedef unsigned int u_int;
|
|
118
|
+
typedef unsigned long u_long;
|
|
119
|
+
typedef unsigned char ushort;
|
|
120
|
+
typedef unsigned int uint;
|
|
121
|
+
typedef unsigned long ulong;
|
|
122
|
+
typedef unsigned char u_int8_t;
|
|
123
|
+
typedef unsigned short u_int16_t;
|
|
124
|
+
typedef unsigned int u_int32_t;
|
|
125
|
+
typedef unsigned long u_int64_t;
|
|
126
|
+
|
|
127
|
+
#endif /* _RUBYCC_SYS_TYPES_H */
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* rubycc bundled <time.h>: the calendar/clock types and declarations (ISO C
|
|
2
|
+
7.27, POSIX). Derived from musl's <time.h> shape; time_t is pinned to `long`
|
|
3
|
+
and `struct tm` carries glibc's tm_gmtoff/tm_zone extension so its 56-byte
|
|
4
|
+
layout matches the reference ABI (measured). The struct guards reuse glibc's
|
|
5
|
+
(__struct_tm_defined, _STRUCT_TIMESPEC) so a host header coexisting on the
|
|
6
|
+
path does not redefine. ABI switch layer: time_t width and struct tm layout
|
|
7
|
+
are arch specific. */
|
|
8
|
+
|
|
9
|
+
#ifndef _RUBYCC_TIME_H
|
|
10
|
+
#define _RUBYCC_TIME_H
|
|
11
|
+
|
|
12
|
+
#ifndef NULL
|
|
13
|
+
#define NULL ((void*)0)
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#ifndef _RUBYCC_SIZE_T
|
|
17
|
+
#define _RUBYCC_SIZE_T
|
|
18
|
+
typedef unsigned long size_t;
|
|
19
|
+
#endif
|
|
20
|
+
#ifndef _RUBYCC_TIME_T
|
|
21
|
+
#define _RUBYCC_TIME_T
|
|
22
|
+
typedef long time_t;
|
|
23
|
+
#endif
|
|
24
|
+
#ifndef _RUBYCC_CLOCK_T
|
|
25
|
+
#define _RUBYCC_CLOCK_T
|
|
26
|
+
typedef long clock_t;
|
|
27
|
+
#endif
|
|
28
|
+
#ifndef _RUBYCC_CLOCKID_T
|
|
29
|
+
#define _RUBYCC_CLOCKID_T
|
|
30
|
+
typedef int clockid_t;
|
|
31
|
+
#endif
|
|
32
|
+
#ifndef _RUBYCC_TIMER_T
|
|
33
|
+
#define _RUBYCC_TIMER_T
|
|
34
|
+
typedef void *timer_t;
|
|
35
|
+
#endif
|
|
36
|
+
#ifndef _RUBYCC_PID_T
|
|
37
|
+
#define _RUBYCC_PID_T
|
|
38
|
+
typedef int pid_t;
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#define CLOCKS_PER_SEC ((clock_t) 1000000)
|
|
42
|
+
#define TIME_UTC 1
|
|
43
|
+
|
|
44
|
+
/* POSIX clock ids. */
|
|
45
|
+
#define CLOCK_REALTIME 0
|
|
46
|
+
#define CLOCK_MONOTONIC 1
|
|
47
|
+
#define CLOCK_PROCESS_CPUTIME_ID 2
|
|
48
|
+
#define CLOCK_THREAD_CPUTIME_ID 3
|
|
49
|
+
#define CLOCK_MONOTONIC_RAW 4
|
|
50
|
+
#define CLOCK_REALTIME_COARSE 5
|
|
51
|
+
#define CLOCK_MONOTONIC_COARSE 6
|
|
52
|
+
#define CLOCK_BOOTTIME 7
|
|
53
|
+
#define TIMER_ABSTIME 1
|
|
54
|
+
|
|
55
|
+
#ifndef _STRUCT_TIMESPEC
|
|
56
|
+
#define _STRUCT_TIMESPEC 1
|
|
57
|
+
struct timespec {
|
|
58
|
+
time_t tv_sec;
|
|
59
|
+
long tv_nsec;
|
|
60
|
+
};
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
#ifndef __struct_tm_defined
|
|
64
|
+
#define __struct_tm_defined 1
|
|
65
|
+
struct tm {
|
|
66
|
+
int tm_sec;
|
|
67
|
+
int tm_min;
|
|
68
|
+
int tm_hour;
|
|
69
|
+
int tm_mday;
|
|
70
|
+
int tm_mon;
|
|
71
|
+
int tm_year;
|
|
72
|
+
int tm_wday;
|
|
73
|
+
int tm_yday;
|
|
74
|
+
int tm_isdst;
|
|
75
|
+
long tm_gmtoff;
|
|
76
|
+
const char *tm_zone;
|
|
77
|
+
};
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
struct itimerspec {
|
|
81
|
+
struct timespec it_interval;
|
|
82
|
+
struct timespec it_value;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
clock_t clock(void);
|
|
86
|
+
time_t time(time_t *__timer);
|
|
87
|
+
double difftime(time_t __time1, time_t __time0);
|
|
88
|
+
time_t mktime(struct tm *__tp);
|
|
89
|
+
size_t strftime(char *__restrict __s, size_t __maxsize,
|
|
90
|
+
const char *__restrict __format, const struct tm *__restrict __tp);
|
|
91
|
+
struct tm *gmtime(const time_t *__timer);
|
|
92
|
+
struct tm *localtime(const time_t *__timer);
|
|
93
|
+
struct tm *gmtime_r(const time_t *__restrict __timer, struct tm *__restrict __tp);
|
|
94
|
+
struct tm *localtime_r(const time_t *__restrict __timer, struct tm *__restrict __tp);
|
|
95
|
+
char *asctime(const struct tm *__tp);
|
|
96
|
+
char *ctime(const time_t *__timer);
|
|
97
|
+
char *asctime_r(const struct tm *__restrict __tp, char *__restrict __buf);
|
|
98
|
+
char *ctime_r(const time_t *__restrict __timer, char *__restrict __buf);
|
|
99
|
+
char *strptime(const char *__restrict __s, const char *__restrict __fmt, struct tm *__tp);
|
|
100
|
+
|
|
101
|
+
int nanosleep(const struct timespec *__requested_time, struct timespec *__remaining);
|
|
102
|
+
int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
|
|
103
|
+
int clock_settime(clockid_t __clock_id, const struct timespec *__tp);
|
|
104
|
+
int clock_getres(clockid_t __clock_id, struct timespec *__res);
|
|
105
|
+
time_t timegm(struct tm *__tp);
|
|
106
|
+
time_t timelocal(struct tm *__tp);
|
|
107
|
+
|
|
108
|
+
extern char *tzname[2];
|
|
109
|
+
extern long timezone;
|
|
110
|
+
extern int daylight;
|
|
111
|
+
void tzset(void);
|
|
112
|
+
|
|
113
|
+
#endif /* _RUBYCC_TIME_H */
|