| ... | ... | @@ -0,0 +1,642 @@ |
| 1 | // i386-specific declarations that are intended to be imported into the POSIX namespace. |
| 2 | // This does include Linux-only APIs. |
| 3 | |
| 4 | const std = @import("../../../std.zig"); |
| 5 | const linux = std.os.linux; |
| 6 | const socklen_t = linux.socklen_t; |
| 7 | const iovec = linux.iovec; |
| 8 | const iovec_const = linux.iovec_const; |
| 9 | const uid_t = linux.uid_t; |
| 10 | const gid_t = linux.gid_t; |
| 11 | const stack_t = linux.stack_t; |
| 12 | const sigset_t = linux.sigset_t; |
| 13 | |
| 14 | pub const SYS_restart_syscall = 0; |
| 15 | pub const SYS_exit = 1; |
| 16 | pub const SYS_fork = 2; |
| 17 | pub const SYS_read = 3; |
| 18 | pub const SYS_write = 4; |
| 19 | pub const SYS_open = 5; |
| 20 | pub const SYS_close = 6; |
| 21 | pub const SYS_waitpid = 7; |
| 22 | pub const SYS_creat = 8; |
| 23 | pub const SYS_link = 9; |
| 24 | pub const SYS_unlink = 10; |
| 25 | pub const SYS_execve = 11; |
| 26 | pub const SYS_chdir = 12; |
| 27 | pub const SYS_time = 13; |
| 28 | pub const SYS_mknod = 14; |
| 29 | pub const SYS_chmod = 15; |
| 30 | pub const SYS_lchown = 16; |
| 31 | pub const SYS_break = 17; |
| 32 | pub const SYS_oldstat = 18; |
| 33 | pub const SYS_lseek = 19; |
| 34 | pub const SYS_getpid = 20; |
| 35 | pub const SYS_mount = 21; |
| 36 | pub const SYS_umount = 22; |
| 37 | pub const SYS_setuid = 23; |
| 38 | pub const SYS_getuid = 24; |
| 39 | pub const SYS_stime = 25; |
| 40 | pub const SYS_ptrace = 26; |
| 41 | pub const SYS_alarm = 27; |
| 42 | pub const SYS_oldfstat = 28; |
| 43 | pub const SYS_pause = 29; |
| 44 | pub const SYS_utime = 30; |
| 45 | pub const SYS_stty = 31; |
| 46 | pub const SYS_gtty = 32; |
| 47 | pub const SYS_access = 33; |
| 48 | pub const SYS_nice = 34; |
| 49 | pub const SYS_ftime = 35; |
| 50 | pub const SYS_sync = 36; |
| 51 | pub const SYS_kill = 37; |
| 52 | pub const SYS_rename = 38; |
| 53 | pub const SYS_mkdir = 39; |
| 54 | pub const SYS_rmdir = 40; |
| 55 | pub const SYS_dup = 41; |
| 56 | pub const SYS_pipe = 42; |
| 57 | pub const SYS_times = 43; |
| 58 | pub const SYS_prof = 44; |
| 59 | pub const SYS_brk = 45; |
| 60 | pub const SYS_setgid = 46; |
| 61 | pub const SYS_getgid = 47; |
| 62 | pub const SYS_signal = 48; |
| 63 | pub const SYS_geteuid = 49; |
| 64 | pub const SYS_getegid = 50; |
| 65 | pub const SYS_acct = 51; |
| 66 | pub const SYS_umount2 = 52; |
| 67 | pub const SYS_lock = 53; |
| 68 | pub const SYS_ioctl = 54; |
| 69 | pub const SYS_fcntl = 55; |
| 70 | pub const SYS_mpx = 56; |
| 71 | pub const SYS_setpgid = 57; |
| 72 | pub const SYS_ulimit = 58; |
| 73 | pub const SYS_oldolduname = 59; |
| 74 | pub const SYS_umask = 60; |
| 75 | pub const SYS_chroot = 61; |
| 76 | pub const SYS_ustat = 62; |
| 77 | pub const SYS_dup2 = 63; |
| 78 | pub const SYS_getppid = 64; |
| 79 | pub const SYS_getpgrp = 65; |
| 80 | pub const SYS_setsid = 66; |
| 81 | pub const SYS_sigaction = 67; |
| 82 | pub const SYS_sgetmask = 68; |
| 83 | pub const SYS_ssetmask = 69; |
| 84 | pub const SYS_setreuid = 70; |
| 85 | pub const SYS_setregid = 71; |
| 86 | pub const SYS_sigsuspend = 72; |
| 87 | pub const SYS_sigpending = 73; |
| 88 | pub const SYS_sethostname = 74; |
| 89 | pub const SYS_setrlimit = 75; |
| 90 | pub const SYS_getrlimit = 76; |
| 91 | pub const SYS_getrusage = 77; |
| 92 | pub const SYS_gettimeofday = 78; |
| 93 | pub const SYS_settimeofday = 79; |
| 94 | pub const SYS_getgroups = 80; |
| 95 | pub const SYS_setgroups = 81; |
| 96 | pub const SYS_select = 82; |
| 97 | pub const SYS_symlink = 83; |
| 98 | pub const SYS_oldlstat = 84; |
| 99 | pub const SYS_readlink = 85; |
| 100 | pub const SYS_uselib = 86; |
| 101 | pub const SYS_swapon = 87; |
| 102 | pub const SYS_reboot = 88; |
| 103 | pub const SYS_readdir = 89; |
| 104 | pub const SYS_mmap = 90; |
| 105 | pub const SYS_munmap = 91; |
| 106 | pub const SYS_truncate = 92; |
| 107 | pub const SYS_ftruncate = 93; |
| 108 | pub const SYS_fchmod = 94; |
| 109 | pub const SYS_fchown = 95; |
| 110 | pub const SYS_getpriority = 96; |
| 111 | pub const SYS_setpriority = 97; |
| 112 | pub const SYS_profil = 98; |
| 113 | pub const SYS_statfs = 99; |
| 114 | pub const SYS_fstatfs = 100; |
| 115 | pub const SYS_ioperm = 101; |
| 116 | pub const SYS_socketcall = 102; |
| 117 | pub const SYS_syslog = 103; |
| 118 | pub const SYS_setitimer = 104; |
| 119 | pub const SYS_getitimer = 105; |
| 120 | pub const SYS_stat = 106; |
| 121 | pub const SYS_lstat = 107; |
| 122 | pub const SYS_fstat = 108; |
| 123 | pub const SYS_olduname = 109; |
| 124 | pub const SYS_iopl = 110; |
| 125 | pub const SYS_vhangup = 111; |
| 126 | pub const SYS_idle = 112; |
| 127 | pub const SYS_vm86old = 113; |
| 128 | pub const SYS_wait4 = 114; |
| 129 | pub const SYS_swapoff = 115; |
| 130 | pub const SYS_sysinfo = 116; |
| 131 | pub const SYS_ipc = 117; |
| 132 | pub const SYS_fsync = 118; |
| 133 | pub const SYS_sigreturn = 119; |
| 134 | pub const SYS_clone = 120; |
| 135 | pub const SYS_setdomainname = 121; |
| 136 | pub const SYS_uname = 122; |
| 137 | pub const SYS_modify_ldt = 123; |
| 138 | pub const SYS_adjtimex = 124; |
| 139 | pub const SYS_mprotect = 125; |
| 140 | pub const SYS_sigprocmask = 126; |
| 141 | pub const SYS_create_module = 127; |
| 142 | pub const SYS_init_module = 128; |
| 143 | pub const SYS_delete_module = 129; |
| 144 | pub const SYS_get_kernel_syms = 130; |
| 145 | pub const SYS_quotactl = 131; |
| 146 | pub const SYS_getpgid = 132; |
| 147 | pub const SYS_fchdir = 133; |
| 148 | pub const SYS_bdflush = 134; |
| 149 | pub const SYS_sysfs = 135; |
| 150 | pub const SYS_personality = 136; |
| 151 | pub const SYS_afs_syscall = 137; |
| 152 | pub const SYS_setfsuid = 138; |
| 153 | pub const SYS_setfsgid = 139; |
| 154 | pub const SYS__llseek = 140; |
| 155 | pub const SYS_getdents = 141; |
| 156 | pub const SYS__newselect = 142; |
| 157 | pub const SYS_flock = 143; |
| 158 | pub const SYS_msync = 144; |
| 159 | pub const SYS_readv = 145; |
| 160 | pub const SYS_writev = 146; |
| 161 | pub const SYS_getsid = 147; |
| 162 | pub const SYS_fdatasync = 148; |
| 163 | pub const SYS__sysctl = 149; |
| 164 | pub const SYS_mlock = 150; |
| 165 | pub const SYS_munlock = 151; |
| 166 | pub const SYS_mlockall = 152; |
| 167 | pub const SYS_munlockall = 153; |
| 168 | pub const SYS_sched_setparam = 154; |
| 169 | pub const SYS_sched_getparam = 155; |
| 170 | pub const SYS_sched_setscheduler = 156; |
| 171 | pub const SYS_sched_getscheduler = 157; |
| 172 | pub const SYS_sched_yield = 158; |
| 173 | pub const SYS_sched_get_priority_max = 159; |
| 174 | pub const SYS_sched_get_priority_min = 160; |
| 175 | pub const SYS_sched_rr_get_interval = 161; |
| 176 | pub const SYS_nanosleep = 162; |
| 177 | pub const SYS_mremap = 163; |
| 178 | pub const SYS_setresuid = 164; |
| 179 | pub const SYS_getresuid = 165; |
| 180 | pub const SYS_vm86 = 166; |
| 181 | pub const SYS_query_module = 167; |
| 182 | pub const SYS_poll = 168; |
| 183 | pub const SYS_nfsservctl = 169; |
| 184 | pub const SYS_setresgid = 170; |
| 185 | pub const SYS_getresgid = 171; |
| 186 | pub const SYS_prctl = 172; |
| 187 | pub const SYS_rt_sigreturn = 173; |
| 188 | pub const SYS_rt_sigaction = 174; |
| 189 | pub const SYS_rt_sigprocmask = 175; |
| 190 | pub const SYS_rt_sigpending = 176; |
| 191 | pub const SYS_rt_sigtimedwait = 177; |
| 192 | pub const SYS_rt_sigqueueinfo = 178; |
| 193 | pub const SYS_rt_sigsuspend = 179; |
| 194 | pub const SYS_pread64 = 180; |
| 195 | pub const SYS_pwrite64 = 181; |
| 196 | pub const SYS_chown = 182; |
| 197 | pub const SYS_getcwd = 183; |
| 198 | pub const SYS_capget = 184; |
| 199 | pub const SYS_capset = 185; |
| 200 | pub const SYS_sigaltstack = 186; |
| 201 | pub const SYS_sendfile = 187; |
| 202 | pub const SYS_getpmsg = 188; |
| 203 | pub const SYS_putpmsg = 189; |
| 204 | pub const SYS_vfork = 190; |
| 205 | pub const SYS_ugetrlimit = 191; |
| 206 | pub const SYS_mmap2 = 192; |
| 207 | pub const SYS_truncate64 = 193; |
| 208 | pub const SYS_ftruncate64 = 194; |
| 209 | pub const SYS_stat64 = 195; |
| 210 | pub const SYS_lstat64 = 196; |
| 211 | pub const SYS_fstat64 = 197; |
| 212 | pub const SYS_lchown32 = 198; |
| 213 | pub const SYS_getuid32 = 199; |
| 214 | pub const SYS_getgid32 = 200; |
| 215 | pub const SYS_geteuid32 = 201; |
| 216 | pub const SYS_getegid32 = 202; |
| 217 | pub const SYS_setreuid32 = 203; |
| 218 | pub const SYS_setregid32 = 204; |
| 219 | pub const SYS_getgroups32 = 205; |
| 220 | pub const SYS_setgroups32 = 206; |
| 221 | pub const SYS_fchown32 = 207; |
| 222 | pub const SYS_setresuid32 = 208; |
| 223 | pub const SYS_getresuid32 = 209; |
| 224 | pub const SYS_setresgid32 = 210; |
| 225 | pub const SYS_getresgid32 = 211; |
| 226 | pub const SYS_chown32 = 212; |
| 227 | pub const SYS_setuid32 = 213; |
| 228 | pub const SYS_setgid32 = 214; |
| 229 | pub const SYS_setfsuid32 = 215; |
| 230 | pub const SYS_setfsgid32 = 216; |
| 231 | pub const SYS_pivot_root = 217; |
| 232 | pub const SYS_mincore = 218; |
| 233 | pub const SYS_madvise = 219; |
| 234 | pub const SYS_getdents64 = 220; |
| 235 | pub const SYS_fcntl64 = 221; |
| 236 | pub const SYS_gettid = 224; |
| 237 | pub const SYS_readahead = 225; |
| 238 | pub const SYS_setxattr = 226; |
| 239 | pub const SYS_lsetxattr = 227; |
| 240 | pub const SYS_fsetxattr = 228; |
| 241 | pub const SYS_getxattr = 229; |
| 242 | pub const SYS_lgetxattr = 230; |
| 243 | pub const SYS_fgetxattr = 231; |
| 244 | pub const SYS_listxattr = 232; |
| 245 | pub const SYS_llistxattr = 233; |
| 246 | pub const SYS_flistxattr = 234; |
| 247 | pub const SYS_removexattr = 235; |
| 248 | pub const SYS_lremovexattr = 236; |
| 249 | pub const SYS_fremovexattr = 237; |
| 250 | pub const SYS_tkill = 238; |
| 251 | pub const SYS_sendfile64 = 239; |
| 252 | pub const SYS_futex = 240; |
| 253 | pub const SYS_sched_setaffinity = 241; |
| 254 | pub const SYS_sched_getaffinity = 242; |
| 255 | pub const SYS_set_thread_area = 243; |
| 256 | pub const SYS_get_thread_area = 244; |
| 257 | pub const SYS_io_setup = 245; |
| 258 | pub const SYS_io_destroy = 246; |
| 259 | pub const SYS_io_getevents = 247; |
| 260 | pub const SYS_io_submit = 248; |
| 261 | pub const SYS_io_cancel = 249; |
| 262 | pub const SYS_fadvise64 = 250; |
| 263 | pub const SYS_exit_group = 252; |
| 264 | pub const SYS_lookup_dcookie = 253; |
| 265 | pub const SYS_epoll_create = 254; |
| 266 | pub const SYS_epoll_ctl = 255; |
| 267 | pub const SYS_epoll_wait = 256; |
| 268 | pub const SYS_remap_file_pages = 257; |
| 269 | pub const SYS_set_tid_address = 258; |
| 270 | pub const SYS_timer_create = 259; |
| 271 | pub const SYS_timer_settime = SYS_timer_create + 1; |
| 272 | pub const SYS_timer_gettime = SYS_timer_create + 2; |
| 273 | pub const SYS_timer_getoverrun = SYS_timer_create + 3; |
| 274 | pub const SYS_timer_delete = SYS_timer_create + 4; |
| 275 | pub const SYS_clock_settime = SYS_timer_create + 5; |
| 276 | pub const SYS_clock_gettime = SYS_timer_create + 6; |
| 277 | pub const SYS_clock_getres = SYS_timer_create + 7; |
| 278 | pub const SYS_clock_nanosleep = SYS_timer_create + 8; |
| 279 | pub const SYS_statfs64 = 268; |
| 280 | pub const SYS_fstatfs64 = 269; |
| 281 | pub const SYS_tgkill = 270; |
| 282 | pub const SYS_utimes = 271; |
| 283 | pub const SYS_fadvise64_64 = 272; |
| 284 | pub const SYS_vserver = 273; |
| 285 | pub const SYS_mbind = 274; |
| 286 | pub const SYS_get_mempolicy = 275; |
| 287 | pub const SYS_set_mempolicy = 276; |
| 288 | pub const SYS_mq_open = 277; |
| 289 | pub const SYS_mq_unlink = SYS_mq_open + 1; |
| 290 | pub const SYS_mq_timedsend = SYS_mq_open + 2; |
| 291 | pub const SYS_mq_timedreceive = SYS_mq_open + 3; |
| 292 | pub const SYS_mq_notify = SYS_mq_open + 4; |
| 293 | pub const SYS_mq_getsetattr = SYS_mq_open + 5; |
| 294 | pub const SYS_kexec_load = 283; |
| 295 | pub const SYS_waitid = 284; |
| 296 | pub const SYS_add_key = 286; |
| 297 | pub const SYS_request_key = 287; |
| 298 | pub const SYS_keyctl = 288; |
| 299 | pub const SYS_ioprio_set = 289; |
| 300 | pub const SYS_ioprio_get = 290; |
| 301 | pub const SYS_inotify_init = 291; |
| 302 | pub const SYS_inotify_add_watch = 292; |
| 303 | pub const SYS_inotify_rm_watch = 293; |
| 304 | pub const SYS_migrate_pages = 294; |
| 305 | pub const SYS_openat = 295; |
| 306 | pub const SYS_mkdirat = 296; |
| 307 | pub const SYS_mknodat = 297; |
| 308 | pub const SYS_fchownat = 298; |
| 309 | pub const SYS_futimesat = 299; |
| 310 | pub const SYS_fstatat64 = 300; |
| 311 | pub const SYS_unlinkat = 301; |
| 312 | pub const SYS_renameat = 302; |
| 313 | pub const SYS_linkat = 303; |
| 314 | pub const SYS_symlinkat = 304; |
| 315 | pub const SYS_readlinkat = 305; |
| 316 | pub const SYS_fchmodat = 306; |
| 317 | pub const SYS_faccessat = 307; |
| 318 | pub const SYS_pselect6 = 308; |
| 319 | pub const SYS_ppoll = 309; |
| 320 | pub const SYS_unshare = 310; |
| 321 | pub const SYS_set_robust_list = 311; |
| 322 | pub const SYS_get_robust_list = 312; |
| 323 | pub const SYS_splice = 313; |
| 324 | pub const SYS_sync_file_range = 314; |
| 325 | pub const SYS_tee = 315; |
| 326 | pub const SYS_vmsplice = 316; |
| 327 | pub const SYS_move_pages = 317; |
| 328 | pub const SYS_getcpu = 318; |
| 329 | pub const SYS_epoll_pwait = 319; |
| 330 | pub const SYS_utimensat = 320; |
| 331 | pub const SYS_signalfd = 321; |
| 332 | pub const SYS_timerfd_create = 322; |
| 333 | pub const SYS_eventfd = 323; |
| 334 | pub const SYS_fallocate = 324; |
| 335 | pub const SYS_timerfd_settime = 325; |
| 336 | pub const SYS_timerfd_gettime = 326; |
| 337 | pub const SYS_signalfd4 = 327; |
| 338 | pub const SYS_eventfd2 = 328; |
| 339 | pub const SYS_epoll_create1 = 329; |
| 340 | pub const SYS_dup3 = 330; |
| 341 | pub const SYS_pipe2 = 331; |
| 342 | pub const SYS_inotify_init1 = 332; |
| 343 | pub const SYS_preadv = 333; |
| 344 | pub const SYS_pwritev = 334; |
| 345 | pub const SYS_rt_tgsigqueueinfo = 335; |
| 346 | pub const SYS_perf_event_open = 336; |
| 347 | pub const SYS_recvmmsg = 337; |
| 348 | pub const SYS_fanotify_init = 338; |
| 349 | pub const SYS_fanotify_mark = 339; |
| 350 | pub const SYS_prlimit64 = 340; |
| 351 | pub const SYS_name_to_handle_at = 341; |
| 352 | pub const SYS_open_by_handle_at = 342; |
| 353 | pub const SYS_clock_adjtime = 343; |
| 354 | pub const SYS_syncfs = 344; |
| 355 | pub const SYS_sendmmsg = 345; |
| 356 | pub const SYS_setns = 346; |
| 357 | pub const SYS_process_vm_readv = 347; |
| 358 | pub const SYS_process_vm_writev = 348; |
| 359 | pub const SYS_kcmp = 349; |
| 360 | pub const SYS_finit_module = 350; |
| 361 | pub const SYS_sched_setattr = 351; |
| 362 | pub const SYS_sched_getattr = 352; |
| 363 | pub const SYS_renameat2 = 353; |
| 364 | pub const SYS_seccomp = 354; |
| 365 | pub const SYS_getrandom = 355; |
| 366 | pub const SYS_memfd_create = 356; |
| 367 | pub const SYS_bpf = 357; |
| 368 | pub const SYS_execveat = 358; |
| 369 | pub const SYS_socket = 359; |
| 370 | pub const SYS_socketpair = 360; |
| 371 | pub const SYS_bind = 361; |
| 372 | pub const SYS_connect = 362; |
| 373 | pub const SYS_listen = 363; |
| 374 | pub const SYS_accept4 = 364; |
| 375 | pub const SYS_getsockopt = 365; |
| 376 | pub const SYS_setsockopt = 366; |
| 377 | pub const SYS_getsockname = 367; |
| 378 | pub const SYS_getpeername = 368; |
| 379 | pub const SYS_sendto = 369; |
| 380 | pub const SYS_sendmsg = 370; |
| 381 | pub const SYS_recvfrom = 371; |
| 382 | pub const SYS_recvmsg = 372; |
| 383 | pub const SYS_shutdown = 373; |
| 384 | pub const SYS_userfaultfd = 374; |
| 385 | pub const SYS_membarrier = 375; |
| 386 | pub const SYS_mlock2 = 376; |
| 387 | pub const SYS_copy_file_range = 377; |
| 388 | pub const SYS_preadv2 = 378; |
| 389 | pub const SYS_pwritev2 = 379; |
| 390 | pub const SYS_pkey_mprotect = 380; |
| 391 | pub const SYS_pkey_alloc = 381; |
| 392 | pub const SYS_pkey_free = 382; |
| 393 | pub const SYS_statx = 383; |
| 394 | pub const SYS_arch_prctl = 384; |
| 395 | pub const SYS_io_pgetevents = 385; |
| 396 | pub const SYS_rseq = 386; |
| 397 | pub const SYS_semget = 393; |
| 398 | pub const SYS_semctl = 394; |
| 399 | pub const SYS_shmget = 395; |
| 400 | pub const SYS_shmctl = 396; |
| 401 | pub const SYS_shmat = 397; |
| 402 | pub const SYS_shmdt = 398; |
| 403 | pub const SYS_msgget = 399; |
| 404 | pub const SYS_msgsnd = 400; |
| 405 | pub const SYS_msgrcv = 401; |
| 406 | pub const SYS_msgctl = 402; |
| 407 | pub const SYS_clock_gettime64 = 403; |
| 408 | pub const SYS_clock_settime64 = 404; |
| 409 | pub const SYS_clock_adjtime64 = 405; |
| 410 | pub const SYS_clock_getres_time64 = 406; |
| 411 | pub const SYS_clock_nanosleep_time64 = 407; |
| 412 | pub const SYS_timer_gettime64 = 408; |
| 413 | pub const SYS_timer_settime64 = 409; |
| 414 | pub const SYS_timerfd_gettime64 = 410; |
| 415 | pub const SYS_timerfd_settime64 = 411; |
| 416 | pub const SYS_utimensat_time64 = 412; |
| 417 | pub const SYS_pselect6_time64 = 413; |
| 418 | pub const SYS_ppoll_time64 = 414; |
| 419 | pub const SYS_io_pgetevents_time64 = 416; |
| 420 | pub const SYS_recvmmsg_time64 = 417; |
| 421 | pub const SYS_mq_timedsend_time64 = 418; |
| 422 | pub const SYS_mq_timedreceive_time64 = 419; |
| 423 | pub const SYS_semtimedop_time64 = 420; |
| 424 | pub const SYS_rt_sigtimedwait_time64 = 421; |
| 425 | pub const SYS_futex_time64 = 422; |
| 426 | pub const SYS_sched_rr_get_interval_time64 = 423; |
| 427 | pub const SYS_pidfd_send_signal = 424; |
| 428 | pub const SYS_io_uring_setup = 425; |
| 429 | pub const SYS_io_uring_enter = 426; |
| 430 | pub const SYS_io_uring_register = 427; |
| 431 | pub const SYS_open_tree = 428; |
| 432 | pub const SYS_move_mount = 429; |
| 433 | pub const SYS_fsopen = 430; |
| 434 | pub const SYS_fsconfig = 431; |
| 435 | pub const SYS_fsmount = 432; |
| 436 | pub const SYS_fspick = 433; |
| 437 | |
| 438 | pub const O_CREAT = 0o100; |
| 439 | pub const O_EXCL = 0o200; |
| 440 | pub const O_NOCTTY = 0o400; |
| 441 | pub const O_TRUNC = 0o1000; |
| 442 | pub const O_APPEND = 0o2000; |
| 443 | pub const O_NONBLOCK = 0o4000; |
| 444 | pub const O_DSYNC = 0o10000; |
| 445 | pub const O_SYNC = 0o4010000; |
| 446 | pub const O_RSYNC = 0o4010000; |
| 447 | pub const O_DIRECTORY = 0o200000; |
| 448 | pub const O_NOFOLLOW = 0o400000; |
| 449 | pub const O_CLOEXEC = 0o2000000; |
| 450 | |
| 451 | pub const O_ASYNC = 0o20000; |
| 452 | pub const O_DIRECT = 0o40000; |
| 453 | pub const O_LARGEFILE = 0o100000; |
| 454 | pub const O_NOATIME = 0o1000000; |
| 455 | pub const O_PATH = 0o10000000; |
| 456 | pub const O_TMPFILE = 0o20200000; |
| 457 | pub const O_NDELAY = O_NONBLOCK; |
| 458 | |
| 459 | pub const F_DUPFD = 0; |
| 460 | pub const F_GETFD = 1; |
| 461 | pub const F_SETFD = 2; |
| 462 | pub const F_GETFL = 3; |
| 463 | pub const F_SETFL = 4; |
| 464 | |
| 465 | pub const F_SETOWN = 8; |
| 466 | pub const F_GETOWN = 9; |
| 467 | pub const F_SETSIG = 10; |
| 468 | pub const F_GETSIG = 11; |
| 469 | |
| 470 | pub const F_GETLK = 12; |
| 471 | pub const F_SETLK = 13; |
| 472 | pub const F_SETLKW = 14; |
| 473 | |
| 474 | pub const F_SETOWN_EX = 15; |
| 475 | pub const F_GETOWN_EX = 16; |
| 476 | |
| 477 | pub const F_GETOWNER_UIDS = 17; |
| 478 | |
| 479 | pub const MAP_NORESERVE = 0x4000; |
| 480 | pub const MAP_GROWSDOWN = 0x0100; |
| 481 | pub const MAP_DENYWRITE = 0x0800; |
| 482 | pub const MAP_EXECUTABLE = 0x1000; |
| 483 | pub const MAP_LOCKED = 0x2000; |
| 484 | pub const MAP_32BIT = 0x40; |
| 485 | |
| 486 | pub const MMAP2_UNIT = 4096; |
| 487 | |
| 488 | pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; |
| 489 | pub const VDSO_CGT_VER = "LINUX_2.6"; |
| 490 | |
| 491 | pub const msghdr = extern struct { |
| 492 | msg_name: ?*sockaddr, |
| 493 | msg_namelen: socklen_t, |
| 494 | msg_iov: [*]iovec, |
| 495 | msg_iovlen: i32, |
| 496 | msg_control: ?*c_void, |
| 497 | msg_controllen: socklen_t, |
| 498 | msg_flags: i32, |
| 499 | }; |
| 500 | |
| 501 | pub const msghdr_const = extern struct { |
| 502 | msg_name: ?*const sockaddr, |
| 503 | msg_namelen: socklen_t, |
| 504 | msg_iov: [*]iovec_const, |
| 505 | msg_iovlen: i32, |
| 506 | msg_control: ?*c_void, |
| 507 | msg_controllen: socklen_t, |
| 508 | msg_flags: i32, |
| 509 | }; |
| 510 | |
| 511 | pub const blksize_t = i32; |
| 512 | pub const nlink_t = u32; |
| 513 | pub const time_t = isize; |
| 514 | pub const mode_t = u32; |
| 515 | pub const off_t = i64; |
| 516 | pub const ino_t = u64; |
| 517 | pub const dev_t = u64; |
| 518 | pub const blkcnt_t = i64; |
| 519 | |
| 520 | /// Renamed to Stat to not conflict with the stat function. |
| 521 | /// atime, mtime, and ctime have functions to return `timespec`, |
| 522 | /// because although this is a POSIX API, the layout and names of |
| 523 | /// the structs are inconsistent across operating systems, and |
| 524 | /// in C, macros are used to hide the differences. Here we use |
| 525 | /// methods to accomplish this. |
| 526 | pub const Stat = extern struct { |
| 527 | dev: dev_t, |
| 528 | __dev_padding: u32, |
| 529 | __ino_truncated: u32, |
| 530 | mode: mode_t, |
| 531 | nlink: nlink_t, |
| 532 | uid: uid_t, |
| 533 | gid: gid_t, |
| 534 | rdev: dev_t, |
| 535 | __rdev_padding: u32, |
| 536 | size: off_t, |
| 537 | blksize: blksize_t, |
| 538 | blocks: blkcnt_t, |
| 539 | atim: timespec, |
| 540 | mtim: timespec, |
| 541 | ctim: timespec, |
| 542 | ino: ino_t, |
| 543 | |
| 544 | pub fn atime(self: Stat) timespec { |
| 545 | return self.atim; |
| 546 | } |
| 547 | |
| 548 | pub fn mtime(self: Stat) timespec { |
| 549 | return self.mtim; |
| 550 | } |
| 551 | |
| 552 | pub fn ctime(self: Stat) timespec { |
| 553 | return self.ctim; |
| 554 | } |
| 555 | }; |
| 556 | |
| 557 | pub const timespec = extern struct { |
| 558 | tv_sec: i32, |
| 559 | tv_nsec: i32, |
| 560 | }; |
| 561 | |
| 562 | pub const timeval = extern struct { |
| 563 | tv_sec: i32, |
| 564 | tv_usec: i32, |
| 565 | }; |
| 566 | |
| 567 | pub const timezone = extern struct { |
| 568 | tz_minuteswest: i32, |
| 569 | tz_dsttime: i32, |
| 570 | }; |
| 571 | |
| 572 | pub const mcontext_t = extern struct { |
| 573 | gregs: [19]usize, |
| 574 | fpregs: [*]u8, |
| 575 | oldmask: usize, |
| 576 | cr2: usize, |
| 577 | }; |
| 578 | |
| 579 | pub const REG_GS = 0; |
| 580 | pub const REG_FS = 1; |
| 581 | pub const REG_ES = 2; |
| 582 | pub const REG_DS = 3; |
| 583 | pub const REG_EDI = 4; |
| 584 | pub const REG_ESI = 5; |
| 585 | pub const REG_EBP = 6; |
| 586 | pub const REG_ESP = 7; |
| 587 | pub const REG_EBX = 8; |
| 588 | pub const REG_EDX = 9; |
| 589 | pub const REG_ECX = 10; |
| 590 | pub const REG_EAX = 11; |
| 591 | pub const REG_TRAPNO = 12; |
| 592 | pub const REG_ERR = 13; |
| 593 | pub const REG_EIP = 14; |
| 594 | pub const REG_CS = 15; |
| 595 | pub const REG_EFL = 16; |
| 596 | pub const REG_UESP = 17; |
| 597 | pub const REG_SS = 18; |
| 598 | |
| 599 | pub const ucontext_t = extern struct { |
| 600 | flags: usize, |
| 601 | link: *ucontext_t, |
| 602 | stack: stack_t, |
| 603 | mcontext: mcontext_t, |
| 604 | sigmask: sigset_t, |
| 605 | regspace: [64]u64, |
| 606 | }; |
| 607 | |
| 608 | pub const Elf_Symndx = u32; |
| 609 | |
| 610 | pub const user_desc = packed struct { |
| 611 | entry_number: u32, |
| 612 | base_addr: u32, |
| 613 | limit: u32, |
| 614 | seg_32bit: u1, |
| 615 | contents: u2, |
| 616 | read_exec_only: u1, |
| 617 | limit_in_pages: u1, |
| 618 | seg_not_present: u1, |
| 619 | useable: u1, |
| 620 | }; |
| 621 | |
| 622 | // socketcall() call numbers |
| 623 | pub const SC_socket = 1; |
| 624 | pub const SC_bind = 2; |
| 625 | pub const SC_connect = 3; |
| 626 | pub const SC_listen = 4; |
| 627 | pub const SC_accept = 5; |
| 628 | pub const SC_getsockname = 6; |
| 629 | pub const SC_getpeername = 7; |
| 630 | pub const SC_socketpair = 8; |
| 631 | pub const SC_send = 9; |
| 632 | pub const SC_recv = 10; |
| 633 | pub const SC_sendto = 11; |
| 634 | pub const SC_recvfrom = 12; |
| 635 | pub const SC_shutdown = 13; |
| 636 | pub const SC_setsockopt = 14; |
| 637 | pub const SC_getsockopt = 15; |
| 638 | pub const SC_sendmsg = 16; |
| 639 | pub const SC_recvmsg = 17; |
| 640 | pub const SC_accept4 = 18; |
| 641 | pub const SC_recvmmsg = 19; |
| 642 | pub const SC_sendmmsg = 20; |