@zigc/lib 0.17.0-dev.9 → 0.17.0-dev.93
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.
- package/c/fcntl.zig +6 -1
- package/c/inttypes.zig +0 -10
- package/c/math.zig +46 -122
- package/c/search.zig +1 -27
- package/c/stdlib/drand48.zig +0 -57
- package/c/stdlib.zig +0 -100
- package/c/string.zig +0 -7
- package/c/strings.zig +0 -38
- package/c/unistd.zig +27 -26
- package/c.zig +1 -2
- package/compiler/aro/aro/CodeGen.zig +3 -2
- package/compiler/aro/aro/Compilation.zig +15 -12
- package/compiler/aro/aro/Driver.zig +9 -6
- package/compiler/aro/aro/Parser.zig +18 -12
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor.zig +9 -6
- package/compiler/aro/aro/pragmas/message.zig +3 -2
- package/compiler/aro/aro/text_literal.zig +3 -2
- package/compiler/aro/assembly_backend/x86_64.zig +3 -2
- package/compiler/build_runner.zig +0 -2
- package/compiler/test_runner.zig +1 -1
- package/compiler/translate-c/Translator.zig +4 -0
- package/compiler_rt/cos.zig +0 -2
- package/compiler_rt/divmodei4.zig +40 -17
- package/compiler_rt/exp.zig +1 -6
- package/compiler_rt/exp2.zig +1 -6
- package/compiler_rt/exp_f128.zig +377 -0
- package/compiler_rt/fabs.zig +0 -2
- package/compiler_rt/fma.zig +0 -2
- package/compiler_rt/fmax.zig +0 -2
- package/compiler_rt/fmin.zig +0 -2
- package/compiler_rt/fmod.zig +0 -2
- package/compiler_rt/limb64.zig +876 -15
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/mulXi3.zig +1 -1
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +0 -2
- package/compiler_rt/sincos.zig +0 -2
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/ssp.zig +1 -1
- package/compiler_rt/tan.zig +0 -2
- package/compiler_rt/trunc.zig +0 -2
- package/compiler_rt/udivmodei4.zig +28 -0
- package/fuzzer.zig +2 -0
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/package.json +1 -1
- package/std/Build/Step/Compile.zig +0 -1
- package/std/Build.zig +0 -3
- package/std/Io/Dispatch.zig +3 -13
- package/std/Io/Semaphore.zig +112 -17
- package/std/Io/Threaded.zig +167 -33
- package/std/Io/Uring.zig +12 -14
- package/std/Io/Writer.zig +46 -42
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +89 -25
- package/std/Target.zig +50 -5
- package/std/builtin.zig +4 -0
- package/std/c/haiku.zig +3 -0
- package/std/c/serenity.zig +1 -6
- package/std/c.zig +59 -6
- package/std/debug.zig +4 -3
- package/std/fmt.zig +7 -2
- package/std/fs/path.zig +6 -4
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap.zig +2 -126
- package/std/http/Client.zig +21 -24
- package/std/os/linux/aarch64.zig +41 -12
- package/std/os/linux/arc.zig +41 -12
- package/std/os/linux/arm.zig +41 -12
- package/std/os/linux/hexagon.zig +33 -11
- package/std/os/linux/loongarch32.zig +41 -13
- package/std/os/linux/loongarch64.zig +41 -12
- package/std/os/linux/m68k.zig +41 -13
- package/std/os/linux/mips.zig +67 -36
- package/std/os/linux/mips64.zig +60 -29
- package/std/os/linux/mipsn32.zig +60 -29
- package/std/os/linux/or1k.zig +41 -12
- package/std/os/linux/powerpc.zig +41 -12
- package/std/os/linux/powerpc64.zig +41 -12
- package/std/os/linux/riscv32.zig +41 -12
- package/std/os/linux/riscv64.zig +41 -12
- package/std/os/linux/s390x.zig +44 -7
- package/std/os/linux/sparc64.zig +83 -52
- package/std/os/linux/thumb.zig +52 -36
- package/std/os/linux/x32.zig +41 -12
- package/std/os/linux/x86.zig +42 -13
- package/std/os/linux/x86_64.zig +41 -12
- package/std/os/linux.zig +398 -434
- package/std/os.zig +41 -0
- package/std/sort.zig +3 -3
- package/std/zig/AstGen.zig +22 -92
- package/std/zig/AstRlAnnotate.zig +0 -11
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/LibCInstallation.zig +1 -0
- package/std/zig/Zir.zig +50 -63
- package/std/zig/ZonGen.zig +5 -4
- package/std/zig/llvm/Builder.zig +12 -12
- package/std/zig.zig +0 -10
- package/zig.h +340 -1
- package/libc/mingw/math/fdiml.c +0 -24
- package/libc/musl/src/linux/tee.c +0 -8
- package/libc/musl/src/math/fdimf.c +0 -10
- package/libc/musl/src/math/fdiml.c +0 -18
- package/libc/musl/src/unistd/dup2.c +0 -20
- package/libc/musl/src/unistd/dup3.c +0 -26
package/std/os/linux.zig
CHANGED
|
@@ -59,6 +59,7 @@ const arch_bits = switch (native_arch) {
|
|
|
59
59
|
|
|
60
60
|
const syscall_bits = if (native_arch.isThumb()) @import("linux/thumb.zig") else arch_bits;
|
|
61
61
|
|
|
62
|
+
pub const syscall_arg_t = syscall_bits.syscall_arg_t;
|
|
62
63
|
pub const syscall0 = syscall_bits.syscall0;
|
|
63
64
|
pub const syscall1 = syscall_bits.syscall1;
|
|
64
65
|
pub const syscall2 = syscall_bits.syscall2;
|
|
@@ -78,9 +79,9 @@ pub fn clone(
|
|
|
78
79
|
stack: usize,
|
|
79
80
|
flags: u32,
|
|
80
81
|
arg: usize,
|
|
81
|
-
ptid: ?*
|
|
82
|
+
ptid: ?*pid_t,
|
|
82
83
|
tp: usize, // aka tls
|
|
83
|
-
ctid: ?*
|
|
84
|
+
ctid: ?*pid_t,
|
|
84
85
|
) usize {
|
|
85
86
|
// Can't directly call a naked function; cast to C calling convention first.
|
|
86
87
|
return @as(*const fn (
|
|
@@ -88,9 +89,9 @@ pub fn clone(
|
|
|
88
89
|
usize,
|
|
89
90
|
u32,
|
|
90
91
|
usize,
|
|
91
|
-
?*
|
|
92
|
+
?*pid_t,
|
|
92
93
|
usize,
|
|
93
|
-
?*
|
|
94
|
+
?*pid_t,
|
|
94
95
|
) callconv(.c) usize, @ptrCast(&syscall_bits.clone))(func, stack, flags, arg, ptid, tp, ctid);
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -98,6 +99,8 @@ pub const ARCH = arch_bits.ARCH;
|
|
|
98
99
|
pub const HWCAP = arch_bits.HWCAP;
|
|
99
100
|
pub const SC = arch_bits.SC;
|
|
100
101
|
pub const VDSO = arch_bits.VDSO;
|
|
102
|
+
pub const user_desc = arch_bits.user_desc;
|
|
103
|
+
|
|
101
104
|
pub const blkcnt_t = u64;
|
|
102
105
|
pub const blksize_t = u32;
|
|
103
106
|
pub const dev_t = u64;
|
|
@@ -105,8 +108,13 @@ pub const ino_t = u64;
|
|
|
105
108
|
pub const mode_t = u32;
|
|
106
109
|
pub const nlink_t = u32;
|
|
107
110
|
pub const off_t = i64;
|
|
111
|
+
pub const pid_t = i32;
|
|
112
|
+
pub const fd_t = i32;
|
|
113
|
+
pub const socket_t = fd_t;
|
|
114
|
+
pub const uid_t = u32;
|
|
115
|
+
pub const gid_t = u32;
|
|
116
|
+
pub const clock_t = isize;
|
|
108
117
|
pub const time_t = arch_bits.time_t;
|
|
109
|
-
pub const user_desc = arch_bits.user_desc;
|
|
110
118
|
|
|
111
119
|
pub const tls = @import("linux/tls.zig");
|
|
112
120
|
pub const BPF = @import("linux/bpf.zig");
|
|
@@ -566,9 +574,11 @@ fn getauxvalImpl(index: usize) callconv(.c) usize {
|
|
|
566
574
|
// in a even-aligned register pair.
|
|
567
575
|
const require_aligned_register_pair =
|
|
568
576
|
builtin.cpu.arch.isArm() or
|
|
577
|
+
builtin.cpu.arch == .csky or
|
|
569
578
|
builtin.cpu.arch == .hexagon or
|
|
570
579
|
builtin.cpu.arch.isMIPS32() or
|
|
571
|
-
builtin.cpu.arch.isPowerPC32()
|
|
580
|
+
builtin.cpu.arch.isPowerPC32() or
|
|
581
|
+
builtin.cpu.arch.isXtensa();
|
|
572
582
|
|
|
573
583
|
// Split a 64bit value into a {LSB,MSB} pair.
|
|
574
584
|
// The LE/BE variants specify the endianness to assume.
|
|
@@ -611,13 +621,13 @@ pub fn brk(addr: usize) usize {
|
|
|
611
621
|
return syscall1(.brk, addr);
|
|
612
622
|
}
|
|
613
623
|
|
|
614
|
-
pub fn dup(old:
|
|
615
|
-
return syscall1(.dup, @as(
|
|
624
|
+
pub fn dup(old: fd_t) usize {
|
|
625
|
+
return syscall1(.dup, @as(u32, @bitCast(old)));
|
|
616
626
|
}
|
|
617
627
|
|
|
618
|
-
pub fn dup2(old:
|
|
628
|
+
pub fn dup2(old: fd_t, new: fd_t) usize {
|
|
619
629
|
if (@hasField(SYS, "dup2")) {
|
|
620
|
-
return syscall2(.dup2, @as(
|
|
630
|
+
return syscall2(.dup2, @as(u32, @bitCast(old)), @as(u32, @bitCast(new)));
|
|
621
631
|
} else {
|
|
622
632
|
if (old == new) {
|
|
623
633
|
if (std.debug.runtime_safety) {
|
|
@@ -626,13 +636,13 @@ pub fn dup2(old: i32, new: i32) usize {
|
|
|
626
636
|
}
|
|
627
637
|
return @as(usize, @intCast(old));
|
|
628
638
|
} else {
|
|
629
|
-
return syscall3(.dup3, @as(
|
|
639
|
+
return syscall3(.dup3, @as(u32, @bitCast(old)), @as(u32, @bitCast(new)), 0);
|
|
630
640
|
}
|
|
631
641
|
}
|
|
632
642
|
}
|
|
633
643
|
|
|
634
|
-
pub fn dup3(old:
|
|
635
|
-
return syscall3(.dup3, @as(
|
|
644
|
+
pub fn dup3(old: fd_t, new: fd_t, flags: u32) usize {
|
|
645
|
+
return syscall3(.dup3, @as(u32, @bitCast(old)), @as(u32, @bitCast(new)), flags);
|
|
636
646
|
}
|
|
637
647
|
|
|
638
648
|
pub fn chdir(path: [*:0]const u8) usize {
|
|
@@ -640,7 +650,7 @@ pub fn chdir(path: [*:0]const u8) usize {
|
|
|
640
650
|
}
|
|
641
651
|
|
|
642
652
|
pub fn fchdir(fd: fd_t) usize {
|
|
643
|
-
return syscall1(.fchdir, @as(
|
|
653
|
+
return syscall1(.fchdir, @as(u32, @bitCast(fd)));
|
|
644
654
|
}
|
|
645
655
|
|
|
646
656
|
pub fn chroot(path: [*:0]const u8) usize {
|
|
@@ -662,7 +672,7 @@ pub const EXECVEAT = packed struct(u32) {
|
|
|
662
672
|
};
|
|
663
673
|
|
|
664
674
|
pub fn execveat(dirfd: fd_t, path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8, flags: EXECVEAT) usize {
|
|
665
|
-
return syscall5(.execveat,
|
|
675
|
+
return syscall5(.execveat, @as(u32, @bitCast(dirfd)), @intFromPtr(path), @intFromPtr(argv), @intFromPtr(envp), @as(u32, @bitCast(flags)));
|
|
666
676
|
}
|
|
667
677
|
|
|
668
678
|
pub fn fork() usize {
|
|
@@ -675,37 +685,28 @@ pub fn fork() usize {
|
|
|
675
685
|
}
|
|
676
686
|
}
|
|
677
687
|
|
|
678
|
-
|
|
679
|
-
/// child does a return it will clobber the parent's stack.
|
|
680
|
-
/// It is advised to avoid this function and use clone instead, because
|
|
681
|
-
/// the compiler is not aware of how vfork affects control flow and you may
|
|
682
|
-
/// see different results in optimized builds.
|
|
683
|
-
pub inline fn vfork() usize {
|
|
684
|
-
return @call(.always_inline, syscall0, .{.vfork});
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
pub fn futimens(fd: i32, times: ?*const [2]timespec) usize {
|
|
688
|
+
pub fn futimens(fd: fd_t, times: ?*const [2]timespec) usize {
|
|
688
689
|
return utimensat(fd, null, times, 0);
|
|
689
690
|
}
|
|
690
691
|
|
|
691
|
-
pub fn utimensat(dirfd:
|
|
692
|
+
pub fn utimensat(dirfd: fd_t, path: ?[*:0]const u8, times: ?*const [2]timespec, flags: u32) usize {
|
|
692
693
|
return syscall4(
|
|
693
694
|
if (@hasField(SYS, "utimensat") and native_arch != .hexagon) .utimensat else .utimensat_time64,
|
|
694
|
-
@as(
|
|
695
|
+
@as(u32, @bitCast(dirfd)),
|
|
695
696
|
@intFromPtr(path),
|
|
696
697
|
@intFromPtr(times),
|
|
697
698
|
flags,
|
|
698
699
|
);
|
|
699
700
|
}
|
|
700
701
|
|
|
701
|
-
pub fn fallocate(fd:
|
|
702
|
-
if (
|
|
702
|
+
pub fn fallocate(fd: fd_t, mode: mode_t, offset: off_t, length: off_t) usize {
|
|
703
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
|
|
703
704
|
const offset_halves = splitValue64(offset);
|
|
704
705
|
const length_halves = splitValue64(length);
|
|
705
706
|
return syscall6(
|
|
706
707
|
.fallocate,
|
|
707
|
-
@as(
|
|
708
|
-
|
|
708
|
+
@as(u32, @bitCast(fd)),
|
|
709
|
+
mode,
|
|
709
710
|
offset_halves[0],
|
|
710
711
|
offset_halves[1],
|
|
711
712
|
length_halves[0],
|
|
@@ -714,8 +715,8 @@ pub fn fallocate(fd: i32, mode: i32, offset: i64, length: i64) usize {
|
|
|
714
715
|
} else {
|
|
715
716
|
return syscall4(
|
|
716
717
|
.fallocate,
|
|
717
|
-
@as(
|
|
718
|
-
|
|
718
|
+
@as(u32, @bitCast(fd)),
|
|
719
|
+
mode,
|
|
719
720
|
@as(u64, @bitCast(offset)),
|
|
720
721
|
@as(u64, @bitCast(length)),
|
|
721
722
|
);
|
|
@@ -886,21 +887,21 @@ pub fn getcwd(buf: [*]u8, size: usize) usize {
|
|
|
886
887
|
return syscall2(.getcwd, @intFromPtr(buf), size);
|
|
887
888
|
}
|
|
888
889
|
|
|
889
|
-
pub fn getdents(fd:
|
|
890
|
+
pub fn getdents(fd: fd_t, dirp: [*]u8, len: c_uint) usize {
|
|
890
891
|
return syscall3(
|
|
891
892
|
.getdents,
|
|
892
|
-
@as(
|
|
893
|
+
@as(u32, @bitCast(fd)),
|
|
893
894
|
@intFromPtr(dirp),
|
|
894
|
-
|
|
895
|
+
len,
|
|
895
896
|
);
|
|
896
897
|
}
|
|
897
898
|
|
|
898
|
-
pub fn getdents64(fd:
|
|
899
|
+
pub fn getdents64(fd: fd_t, dirp: [*]u8, len: c_uint) usize {
|
|
899
900
|
return syscall3(
|
|
900
901
|
.getdents64,
|
|
901
|
-
@as(
|
|
902
|
+
@as(u32, @bitCast(fd)),
|
|
902
903
|
@intFromPtr(dirp),
|
|
903
|
-
|
|
904
|
+
len,
|
|
904
905
|
);
|
|
905
906
|
}
|
|
906
907
|
|
|
@@ -908,12 +909,12 @@ pub fn inotify_init1(flags: u32) usize {
|
|
|
908
909
|
return syscall1(.inotify_init1, flags);
|
|
909
910
|
}
|
|
910
911
|
|
|
911
|
-
pub fn inotify_add_watch(fd:
|
|
912
|
-
return syscall3(.inotify_add_watch, @as(
|
|
912
|
+
pub fn inotify_add_watch(fd: fd_t, pathname: [*:0]const u8, mask: u32) usize {
|
|
913
|
+
return syscall3(.inotify_add_watch, @as(u32, @bitCast(fd)), @intFromPtr(pathname), mask);
|
|
913
914
|
}
|
|
914
915
|
|
|
915
|
-
pub fn inotify_rm_watch(fd:
|
|
916
|
-
return syscall2(.inotify_rm_watch, @as(
|
|
916
|
+
pub fn inotify_rm_watch(fd: fd_t, wd: fd_t) usize {
|
|
917
|
+
return syscall2(.inotify_rm_watch, @as(u32, @bitCast(fd)), @as(u32, @bitCast(wd)));
|
|
917
918
|
}
|
|
918
919
|
|
|
919
920
|
pub fn fanotify_init(flags: fanotify.InitFlags, event_f_flags: u32) usize {
|
|
@@ -927,24 +928,24 @@ pub fn fanotify_mark(
|
|
|
927
928
|
dirfd: fd_t,
|
|
928
929
|
pathname: ?[*:0]const u8,
|
|
929
930
|
) usize {
|
|
930
|
-
if (
|
|
931
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
|
|
931
932
|
const mask_halves = splitValue64(@bitCast(mask));
|
|
932
933
|
return syscall6(
|
|
933
934
|
.fanotify_mark,
|
|
934
|
-
@
|
|
935
|
+
@as(u32, @bitCast(fd)),
|
|
935
936
|
@as(u32, @bitCast(flags)),
|
|
936
937
|
mask_halves[0],
|
|
937
938
|
mask_halves[1],
|
|
938
|
-
@
|
|
939
|
+
@as(u32, @bitCast(dirfd)),
|
|
939
940
|
@intFromPtr(pathname),
|
|
940
941
|
);
|
|
941
942
|
} else {
|
|
942
943
|
return syscall5(
|
|
943
944
|
.fanotify_mark,
|
|
944
|
-
@
|
|
945
|
+
@as(u32, @bitCast(fd)),
|
|
945
946
|
@as(u32, @bitCast(flags)),
|
|
946
|
-
@bitCast(mask),
|
|
947
|
-
@
|
|
947
|
+
@as(u64, @bitCast(mask)),
|
|
948
|
+
@as(u32, @bitCast(dirfd)),
|
|
948
949
|
@intFromPtr(pathname),
|
|
949
950
|
);
|
|
950
951
|
}
|
|
@@ -953,7 +954,7 @@ pub fn fanotify_mark(
|
|
|
953
954
|
pub fn name_to_handle_at(
|
|
954
955
|
dirfd: fd_t,
|
|
955
956
|
pathname: [*:0]const u8,
|
|
956
|
-
handle: *
|
|
957
|
+
handle: *file_handle,
|
|
957
958
|
mount_id: *i32,
|
|
958
959
|
flags: u32,
|
|
959
960
|
) usize {
|
|
@@ -971,27 +972,27 @@ pub fn readlink(noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: us
|
|
|
971
972
|
if (@hasField(SYS, "readlink")) {
|
|
972
973
|
return syscall3(.readlink, @intFromPtr(path), @intFromPtr(buf_ptr), buf_len);
|
|
973
974
|
} else {
|
|
974
|
-
return syscall4(.readlinkat, @as(
|
|
975
|
+
return syscall4(.readlinkat, @as(u32, @bitCast(@as(i32, AT.FDCWD))), @intFromPtr(path), @intFromPtr(buf_ptr), buf_len);
|
|
975
976
|
}
|
|
976
977
|
}
|
|
977
978
|
|
|
978
|
-
pub fn readlinkat(dirfd:
|
|
979
|
-
return syscall4(.readlinkat, @as(
|
|
979
|
+
pub fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize {
|
|
980
|
+
return syscall4(.readlinkat, @as(u32, @bitCast(dirfd)), @intFromPtr(path), @intFromPtr(buf_ptr), buf_len);
|
|
980
981
|
}
|
|
981
982
|
|
|
982
983
|
pub fn mkdir(path: [*:0]const u8, mode: mode_t) usize {
|
|
983
984
|
if (@hasField(SYS, "mkdir")) {
|
|
984
985
|
return syscall2(.mkdir, @intFromPtr(path), mode);
|
|
985
986
|
} else {
|
|
986
|
-
return syscall3(.mkdirat, @as(
|
|
987
|
+
return syscall3(.mkdirat, @as(u32, @bitCast(@as(i32, AT.FDCWD))), @intFromPtr(path), mode);
|
|
987
988
|
}
|
|
988
989
|
}
|
|
989
990
|
|
|
990
|
-
pub fn mkdirat(dirfd:
|
|
991
|
-
return syscall3(.mkdirat, @as(
|
|
991
|
+
pub fn mkdirat(dirfd: fd_t, path: [*:0]const u8, mode: mode_t) usize {
|
|
992
|
+
return syscall3(.mkdirat, @as(u32, @bitCast(dirfd)), @intFromPtr(path), mode);
|
|
992
993
|
}
|
|
993
994
|
|
|
994
|
-
pub fn mknod(path: [*:0]const u8, mode:
|
|
995
|
+
pub fn mknod(path: [*:0]const u8, mode: mode_t, dev: dev_t) usize {
|
|
995
996
|
if (@hasField(SYS, "mknod")) {
|
|
996
997
|
return syscall3(.mknod, @intFromPtr(path), mode, dev);
|
|
997
998
|
} else {
|
|
@@ -999,8 +1000,8 @@ pub fn mknod(path: [*:0]const u8, mode: u32, dev: u32) usize {
|
|
|
999
1000
|
}
|
|
1000
1001
|
}
|
|
1001
1002
|
|
|
1002
|
-
pub fn mknodat(dirfd:
|
|
1003
|
-
return syscall4(.mknodat, @as(
|
|
1003
|
+
pub fn mknodat(dirfd: dev_t, path: [*:0]const u8, mode: mode_t, dev: dev_t) usize {
|
|
1004
|
+
return syscall4(.mknodat, @as(u32, @bitCast(dirfd)), @intFromPtr(path), mode, dev);
|
|
1004
1005
|
}
|
|
1005
1006
|
|
|
1006
1007
|
pub fn mount(special: ?[*:0]const u8, dir: [*:0]const u8, fstype: ?[*:0]const u8, flags: u32, data: usize) usize {
|
|
@@ -1036,7 +1037,14 @@ pub const MOVE_MOUNT = packed struct(u32) {
|
|
|
1036
1037
|
};
|
|
1037
1038
|
|
|
1038
1039
|
pub fn move_mount(from_dirfd: fd_t, from_path: [*:0]const u8, to_dirfd: fd_t, to_path: [*:0]const u8, flags: MOVE_MOUNT) usize {
|
|
1039
|
-
return syscall5(
|
|
1040
|
+
return syscall5(
|
|
1041
|
+
.move_mount,
|
|
1042
|
+
@as(u32, @bitCast(from_dirfd)),
|
|
1043
|
+
@intFromPtr(from_path),
|
|
1044
|
+
@as(u32, @bitCast(to_dirfd)),
|
|
1045
|
+
@intFromPtr(to_path),
|
|
1046
|
+
@as(u32, @bitCast(flags)),
|
|
1047
|
+
);
|
|
1040
1048
|
}
|
|
1041
1049
|
|
|
1042
1050
|
pub const MOUNT_ATTR = packed struct(u32) {
|
|
@@ -1068,7 +1076,7 @@ pub const MOUNT_ATTR = packed struct(u32) {
|
|
|
1068
1076
|
};
|
|
1069
1077
|
|
|
1070
1078
|
pub fn mount_setattr(dirfd: fd_t, path: [*:0]const u8, flags: MOUNT_ATTR) usize {
|
|
1071
|
-
return syscall3(.mount_setattr,
|
|
1079
|
+
return syscall3(.mount_setattr, @as(u32, @bitCast(dirfd)), @intFromPtr(path), @as(u32, @bitCast(flags)));
|
|
1072
1080
|
}
|
|
1073
1081
|
|
|
1074
1082
|
pub const FSOPEN = packed struct(u32) {
|
|
@@ -1101,7 +1109,7 @@ pub const FSCONFIG_CMD = enum(u32) {
|
|
|
1101
1109
|
};
|
|
1102
1110
|
|
|
1103
1111
|
pub fn fsconfig(fd: fd_t, cmd: FSCONFIG_CMD, key: ?[*:0]const u8, value: ?[*:0]const u8, aux: u32) usize {
|
|
1104
|
-
return syscall5(.fsconfig,
|
|
1112
|
+
return syscall5(.fsconfig, @as(u32, @bitCast(fd)), @intFromEnum(cmd), @intFromPtr(key), @intFromPtr(value), aux);
|
|
1105
1113
|
}
|
|
1106
1114
|
|
|
1107
1115
|
pub const FSMOUNT = packed struct(u32) {
|
|
@@ -1111,7 +1119,7 @@ pub const FSMOUNT = packed struct(u32) {
|
|
|
1111
1119
|
};
|
|
1112
1120
|
|
|
1113
1121
|
pub fn fsmount(fsfd: fd_t, flags: FSMOUNT, attr_flags: MOUNT_ATTR) usize {
|
|
1114
|
-
return syscall3(.fsmount,
|
|
1122
|
+
return syscall3(.fsmount, @as(u32, @bitCast(fsfd)), @as(u32, @bitCast(flags)), @as(u32, @bitCast(attr_flags)));
|
|
1115
1123
|
}
|
|
1116
1124
|
|
|
1117
1125
|
pub const FSPICK = packed struct(u32) {
|
|
@@ -1124,7 +1132,7 @@ pub const FSPICK = packed struct(u32) {
|
|
|
1124
1132
|
};
|
|
1125
1133
|
|
|
1126
1134
|
pub fn fspick(dirfd: fd_t, path: [*:0]const u8, flags: FSPICK) usize {
|
|
1127
|
-
return syscall3(.fspick,
|
|
1135
|
+
return syscall3(.fspick, @as(u32, @bitCast(dirfd)), @intFromPtr(path), @as(u32, @bitCast(flags)));
|
|
1128
1136
|
}
|
|
1129
1137
|
|
|
1130
1138
|
pub fn pivot_root(new_root: [*:0]const u8, put_old: [*:0]const u8) usize {
|
|
@@ -1139,7 +1147,7 @@ fn mmap2Unit() u64 {
|
|
|
1139
1147
|
};
|
|
1140
1148
|
}
|
|
1141
1149
|
|
|
1142
|
-
pub fn mmap(address: ?[*]u8, length: usize, prot: PROT, flags: MAP, fd:
|
|
1150
|
+
pub fn mmap(address: ?[*]u8, length: usize, prot: PROT, flags: MAP, fd: fd_t, offset: off_t) usize {
|
|
1143
1151
|
if (@hasField(SYS, "mmap2")) {
|
|
1144
1152
|
return syscall6(
|
|
1145
1153
|
.mmap2,
|
|
@@ -1147,7 +1155,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: PROT, flags: MAP, fd: i32, off
|
|
|
1147
1155
|
length,
|
|
1148
1156
|
@as(u32, @bitCast(prot)),
|
|
1149
1157
|
@as(u32, @bitCast(flags)),
|
|
1150
|
-
@
|
|
1158
|
+
@as(u32, @bitCast(fd)),
|
|
1151
1159
|
@truncate(@as(u64, @bitCast(offset)) / mmap2Unit()),
|
|
1152
1160
|
);
|
|
1153
1161
|
} else {
|
|
@@ -1160,7 +1168,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: PROT, flags: MAP, fd: i32, off
|
|
|
1160
1168
|
length,
|
|
1161
1169
|
@as(u32, @bitCast(prot)),
|
|
1162
1170
|
@as(u32, @bitCast(flags)),
|
|
1163
|
-
@
|
|
1171
|
+
@as(u32, @bitCast(fd)),
|
|
1164
1172
|
@as(u64, @bitCast(offset)),
|
|
1165
1173
|
}),
|
|
1166
1174
|
) else syscall6(
|
|
@@ -1169,7 +1177,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: PROT, flags: MAP, fd: i32, off
|
|
|
1169
1177
|
length,
|
|
1170
1178
|
@as(u32, @bitCast(prot)),
|
|
1171
1179
|
@as(u32, @bitCast(flags)),
|
|
1172
|
-
@
|
|
1180
|
+
@as(u32, @bitCast(fd)),
|
|
1173
1181
|
@as(u64, @bitCast(offset)),
|
|
1174
1182
|
);
|
|
1175
1183
|
}
|
|
@@ -1276,70 +1284,142 @@ pub fn ppoll(fds: [*]pollfd, n: nfds_t, timeout: ?*timespec, sigmask: ?*const si
|
|
|
1276
1284
|
);
|
|
1277
1285
|
}
|
|
1278
1286
|
|
|
1279
|
-
pub fn read(fd:
|
|
1280
|
-
return syscall3(.read, @as(
|
|
1287
|
+
pub fn read(fd: fd_t, buf: [*]u8, count: usize) usize {
|
|
1288
|
+
return syscall3(.read, @as(u32, @bitCast(fd)), @intFromPtr(buf), count);
|
|
1281
1289
|
}
|
|
1282
1290
|
|
|
1283
|
-
pub fn
|
|
1291
|
+
pub fn pread(fd: fd_t, buf: [*]u8, count: usize, offset: off_t) usize {
|
|
1292
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
|
|
1293
|
+
const offset_halves = splitValue64(offset);
|
|
1294
|
+
if (require_aligned_register_pair) {
|
|
1295
|
+
return syscall6(
|
|
1296
|
+
.pread64,
|
|
1297
|
+
@as(u32, @bitCast(fd)),
|
|
1298
|
+
@intFromPtr(buf),
|
|
1299
|
+
count,
|
|
1300
|
+
0,
|
|
1301
|
+
offset_halves[0],
|
|
1302
|
+
offset_halves[1],
|
|
1303
|
+
);
|
|
1304
|
+
} else {
|
|
1305
|
+
return syscall5(
|
|
1306
|
+
.pread64,
|
|
1307
|
+
@as(u32, @bitCast(fd)),
|
|
1308
|
+
@intFromPtr(buf),
|
|
1309
|
+
count,
|
|
1310
|
+
offset_halves[0],
|
|
1311
|
+
offset_halves[1],
|
|
1312
|
+
);
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
return syscall4(
|
|
1316
|
+
.pread64,
|
|
1317
|
+
@as(u32, @bitCast(fd)),
|
|
1318
|
+
@intFromPtr(buf),
|
|
1319
|
+
count,
|
|
1320
|
+
@as(u64, @bitCast(offset)),
|
|
1321
|
+
);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
pub fn readv(fd: fd_t, iov: [*]const iovec, count: usize) usize {
|
|
1326
|
+
return syscall3(.readv, @as(u32, @bitCast(fd)), @intFromPtr(iov), count);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
pub fn preadv(fd: fd_t, iov: [*]const iovec, count: usize, offset: off_t) usize {
|
|
1284
1330
|
const offset_u: u64 = @bitCast(offset);
|
|
1285
1331
|
return syscall5(
|
|
1286
1332
|
.preadv,
|
|
1287
|
-
@as(
|
|
1333
|
+
@as(u32, @bitCast(fd)),
|
|
1288
1334
|
@intFromPtr(iov),
|
|
1289
1335
|
count,
|
|
1290
1336
|
// Kernel expects the offset is split into largest natural word-size.
|
|
1291
1337
|
// See following link for detail:
|
|
1292
1338
|
// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=601cc11d054ae4b5e9b5babec3d8e4667a2cb9b5
|
|
1293
|
-
@
|
|
1294
|
-
if (
|
|
1339
|
+
@truncate(offset_u),
|
|
1340
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) @truncate(offset_u >> 32) else 0,
|
|
1295
1341
|
);
|
|
1296
1342
|
}
|
|
1297
1343
|
|
|
1298
|
-
pub fn preadv2(fd:
|
|
1344
|
+
pub fn preadv2(fd: fd_t, iov: [*]const iovec, count: usize, offset: off_t, flags: kernel_rwf) usize {
|
|
1299
1345
|
const offset_u: u64 = @bitCast(offset);
|
|
1300
1346
|
return syscall6(
|
|
1301
1347
|
.preadv2,
|
|
1302
|
-
@as(
|
|
1348
|
+
@as(u32, @bitCast(fd)),
|
|
1303
1349
|
@intFromPtr(iov),
|
|
1304
1350
|
count,
|
|
1305
1351
|
// See comments in preadv
|
|
1306
|
-
@
|
|
1307
|
-
if (
|
|
1352
|
+
@truncate(offset_u),
|
|
1353
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) @truncate(offset_u >> 32) else 0,
|
|
1308
1354
|
flags,
|
|
1309
1355
|
);
|
|
1310
1356
|
}
|
|
1311
1357
|
|
|
1312
|
-
pub fn
|
|
1313
|
-
return syscall3(.
|
|
1358
|
+
pub fn write(fd: fd_t, buf: [*]const u8, count: usize) usize {
|
|
1359
|
+
return syscall3(.write, @as(u32, @bitCast(fd)), @intFromPtr(buf), count);
|
|
1314
1360
|
}
|
|
1315
1361
|
|
|
1316
|
-
pub fn
|
|
1317
|
-
|
|
1362
|
+
pub fn pwrite(fd: fd_t, buf: [*]const u8, count: usize, offset: off_t) usize {
|
|
1363
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
|
|
1364
|
+
const offset_halves = splitValue64(offset);
|
|
1365
|
+
if (require_aligned_register_pair) {
|
|
1366
|
+
return syscall6(
|
|
1367
|
+
.pwrite64,
|
|
1368
|
+
@as(u32, @bitCast(fd)),
|
|
1369
|
+
@intFromPtr(buf),
|
|
1370
|
+
count,
|
|
1371
|
+
0,
|
|
1372
|
+
offset_halves[0],
|
|
1373
|
+
offset_halves[1],
|
|
1374
|
+
);
|
|
1375
|
+
} else {
|
|
1376
|
+
return syscall5(
|
|
1377
|
+
.pwrite64,
|
|
1378
|
+
@as(u32, @bitCast(fd)),
|
|
1379
|
+
@intFromPtr(buf),
|
|
1380
|
+
count,
|
|
1381
|
+
offset_halves[0],
|
|
1382
|
+
offset_halves[1],
|
|
1383
|
+
);
|
|
1384
|
+
}
|
|
1385
|
+
} else {
|
|
1386
|
+
return syscall4(
|
|
1387
|
+
.pwrite64,
|
|
1388
|
+
@as(u32, @bitCast(fd)),
|
|
1389
|
+
@intFromPtr(buf),
|
|
1390
|
+
count,
|
|
1391
|
+
@as(u64, @bitCast(offset)),
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
pub fn writev(fd: fd_t, iov: [*]const iovec_const, count: usize) usize {
|
|
1397
|
+
return syscall3(.writev, @as(u32, @bitCast(fd)), @intFromPtr(iov), count);
|
|
1318
1398
|
}
|
|
1319
1399
|
|
|
1320
|
-
pub fn pwritev(fd:
|
|
1400
|
+
pub fn pwritev(fd: fd_t, iov: [*]const iovec_const, count: usize, offset: off_t) usize {
|
|
1321
1401
|
const offset_u: u64 = @bitCast(offset);
|
|
1322
1402
|
return syscall5(
|
|
1323
1403
|
.pwritev,
|
|
1324
|
-
@as(
|
|
1404
|
+
@as(u32, @bitCast(fd)),
|
|
1325
1405
|
@intFromPtr(iov),
|
|
1326
1406
|
count,
|
|
1327
1407
|
// See comments in preadv
|
|
1328
|
-
@
|
|
1329
|
-
if (
|
|
1408
|
+
@truncate(offset_u),
|
|
1409
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) @truncate(offset_u >> 32) else 0,
|
|
1330
1410
|
);
|
|
1331
1411
|
}
|
|
1332
1412
|
|
|
1333
|
-
pub fn pwritev2(fd:
|
|
1413
|
+
pub fn pwritev2(fd: fd_t, iov: [*]const iovec_const, count: usize, offset: off_t, flags: kernel_rwf) usize {
|
|
1334
1414
|
const offset_u: u64 = @bitCast(offset);
|
|
1335
1415
|
return syscall6(
|
|
1336
1416
|
.pwritev2,
|
|
1337
|
-
@as(
|
|
1417
|
+
@as(u32, @bitCast(fd)),
|
|
1338
1418
|
@intFromPtr(iov),
|
|
1339
1419
|
count,
|
|
1340
1420
|
// See comments in preadv
|
|
1341
|
-
@
|
|
1342
|
-
if (
|
|
1421
|
+
@truncate(offset_u),
|
|
1422
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) @truncate(offset_u >> 32) else 0,
|
|
1343
1423
|
flags,
|
|
1344
1424
|
);
|
|
1345
1425
|
}
|
|
@@ -1348,7 +1428,7 @@ pub fn rmdir(path: [*:0]const u8) usize {
|
|
|
1348
1428
|
if (@hasField(SYS, "rmdir")) {
|
|
1349
1429
|
return syscall1(.rmdir, @intFromPtr(path));
|
|
1350
1430
|
} else {
|
|
1351
|
-
return syscall3(.unlinkat, @as(
|
|
1431
|
+
return syscall3(.unlinkat, @as(u32, @bitCast(@as(i32, AT.FDCWD))), @intFromPtr(path), AT.REMOVEDIR);
|
|
1352
1432
|
}
|
|
1353
1433
|
}
|
|
1354
1434
|
|
|
@@ -1356,54 +1436,15 @@ pub fn symlink(existing: [*:0]const u8, new: [*:0]const u8) usize {
|
|
|
1356
1436
|
if (@hasField(SYS, "symlink")) {
|
|
1357
1437
|
return syscall2(.symlink, @intFromPtr(existing), @intFromPtr(new));
|
|
1358
1438
|
} else {
|
|
1359
|
-
return syscall3(.symlinkat, @intFromPtr(existing), @as(
|
|
1439
|
+
return syscall3(.symlinkat, @intFromPtr(existing), @as(u32, @bitCast(@as(i32, AT.FDCWD))), @intFromPtr(new));
|
|
1360
1440
|
}
|
|
1361
1441
|
}
|
|
1362
1442
|
|
|
1363
|
-
pub fn symlinkat(existing: [*:0]const u8, newfd:
|
|
1364
|
-
return syscall3(.symlinkat, @intFromPtr(existing), @as(
|
|
1443
|
+
pub fn symlinkat(existing: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8) usize {
|
|
1444
|
+
return syscall3(.symlinkat, @intFromPtr(existing), @as(u32, @bitCast(newfd)), @intFromPtr(newpath));
|
|
1365
1445
|
}
|
|
1366
1446
|
|
|
1367
|
-
pub fn
|
|
1368
|
-
if (@hasField(SYS, "pread64") and usize_bits < 64) {
|
|
1369
|
-
const offset_halves = splitValue64(offset);
|
|
1370
|
-
if (require_aligned_register_pair) {
|
|
1371
|
-
return syscall6(
|
|
1372
|
-
.pread64,
|
|
1373
|
-
@as(usize, @bitCast(@as(isize, fd))),
|
|
1374
|
-
@intFromPtr(buf),
|
|
1375
|
-
count,
|
|
1376
|
-
0,
|
|
1377
|
-
offset_halves[0],
|
|
1378
|
-
offset_halves[1],
|
|
1379
|
-
);
|
|
1380
|
-
} else {
|
|
1381
|
-
return syscall5(
|
|
1382
|
-
.pread64,
|
|
1383
|
-
@as(usize, @bitCast(@as(isize, fd))),
|
|
1384
|
-
@intFromPtr(buf),
|
|
1385
|
-
count,
|
|
1386
|
-
offset_halves[0],
|
|
1387
|
-
offset_halves[1],
|
|
1388
|
-
);
|
|
1389
|
-
}
|
|
1390
|
-
} else {
|
|
1391
|
-
// Some architectures (eg. 64bit SPARC) pread is called pread64.
|
|
1392
|
-
const syscall_number = if (!@hasField(SYS, "pread") and @hasField(SYS, "pread64"))
|
|
1393
|
-
.pread64
|
|
1394
|
-
else
|
|
1395
|
-
.pread;
|
|
1396
|
-
return syscall4(
|
|
1397
|
-
syscall_number,
|
|
1398
|
-
@as(usize, @bitCast(@as(isize, fd))),
|
|
1399
|
-
@intFromPtr(buf),
|
|
1400
|
-
count,
|
|
1401
|
-
@as(u64, @bitCast(offset)),
|
|
1402
|
-
);
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
pub fn access(path: [*:0]const u8, mode: u32) usize {
|
|
1447
|
+
pub fn access(path: [*:0]const u8, mode: mode_t) usize {
|
|
1407
1448
|
if (@hasField(SYS, "access")) {
|
|
1408
1449
|
return syscall2(.access, @intFromPtr(path), mode);
|
|
1409
1450
|
} else {
|
|
@@ -1411,19 +1452,19 @@ pub fn access(path: [*:0]const u8, mode: u32) usize {
|
|
|
1411
1452
|
}
|
|
1412
1453
|
}
|
|
1413
1454
|
|
|
1414
|
-
pub fn faccessat(dirfd:
|
|
1455
|
+
pub fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: mode_t, flags: u32) usize {
|
|
1415
1456
|
if (flags == 0) {
|
|
1416
|
-
return syscall3(.faccessat, @as(
|
|
1457
|
+
return syscall3(.faccessat, @as(u32, @bitCast(dirfd)), @intFromPtr(path), mode);
|
|
1417
1458
|
}
|
|
1418
|
-
return syscall4(.faccessat2, @as(
|
|
1459
|
+
return syscall4(.faccessat2, @as(u32, @bitCast(dirfd)), @intFromPtr(path), mode, flags);
|
|
1419
1460
|
}
|
|
1420
1461
|
|
|
1421
1462
|
pub fn acct(path: [*:0]const u8) usize {
|
|
1422
1463
|
return syscall1(.acct, @intFromPtr(path));
|
|
1423
1464
|
}
|
|
1424
1465
|
|
|
1425
|
-
pub fn pipe(fd: *[2]
|
|
1426
|
-
if (
|
|
1466
|
+
pub fn pipe(fd: *[2]fd_t) usize {
|
|
1467
|
+
if (native_arch.isMIPS() or native_arch.isSPARC()) {
|
|
1427
1468
|
return syscall_pipe(fd);
|
|
1428
1469
|
} else if (@hasField(SYS, "pipe")) {
|
|
1429
1470
|
return syscall1(.pipe, @intFromPtr(fd));
|
|
@@ -1432,21 +1473,17 @@ pub fn pipe(fd: *[2]i32) usize {
|
|
|
1432
1473
|
}
|
|
1433
1474
|
}
|
|
1434
1475
|
|
|
1435
|
-
pub fn pipe2(fd: *[2]
|
|
1476
|
+
pub fn pipe2(fd: *[2]fd_t, flags: O) usize {
|
|
1436
1477
|
return syscall2(.pipe2, @intFromPtr(fd), @as(u32, @bitCast(flags)));
|
|
1437
1478
|
}
|
|
1438
1479
|
|
|
1439
|
-
pub fn
|
|
1440
|
-
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
pub fn ftruncate(fd: i32, length: i64) usize {
|
|
1444
|
-
if (@hasField(SYS, "ftruncate64") and usize_bits < 64) {
|
|
1480
|
+
pub fn ftruncate(fd: fd_t, length: off_t) usize {
|
|
1481
|
+
if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
|
|
1445
1482
|
const length_halves = splitValue64(length);
|
|
1446
1483
|
if (require_aligned_register_pair) {
|
|
1447
1484
|
return syscall4(
|
|
1448
1485
|
.ftruncate64,
|
|
1449
|
-
@as(
|
|
1486
|
+
@as(u32, @bitCast(fd)),
|
|
1450
1487
|
0,
|
|
1451
1488
|
length_halves[0],
|
|
1452
1489
|
length_halves[1],
|
|
@@ -1454,7 +1491,7 @@ pub fn ftruncate(fd: i32, length: i64) usize {
|
|
|
1454
1491
|
} else {
|
|
1455
1492
|
return syscall3(
|
|
1456
1493
|
.ftruncate64,
|
|
1457
|
-
@as(
|
|
1494
|
+
@as(u32, @bitCast(fd)),
|
|
1458
1495
|
length_halves[0],
|
|
1459
1496
|
length_halves[1],
|
|
1460
1497
|
);
|
|
@@ -1462,48 +1499,8 @@ pub fn ftruncate(fd: i32, length: i64) usize {
|
|
|
1462
1499
|
} else {
|
|
1463
1500
|
return syscall2(
|
|
1464
1501
|
.ftruncate,
|
|
1465
|
-
@as(
|
|
1466
|
-
@as(
|
|
1467
|
-
);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize {
|
|
1472
|
-
if (@hasField(SYS, "pwrite64") and usize_bits < 64) {
|
|
1473
|
-
const offset_halves = splitValue64(offset);
|
|
1474
|
-
|
|
1475
|
-
if (require_aligned_register_pair) {
|
|
1476
|
-
return syscall6(
|
|
1477
|
-
.pwrite64,
|
|
1478
|
-
@as(usize, @bitCast(@as(isize, fd))),
|
|
1479
|
-
@intFromPtr(buf),
|
|
1480
|
-
count,
|
|
1481
|
-
0,
|
|
1482
|
-
offset_halves[0],
|
|
1483
|
-
offset_halves[1],
|
|
1484
|
-
);
|
|
1485
|
-
} else {
|
|
1486
|
-
return syscall5(
|
|
1487
|
-
.pwrite64,
|
|
1488
|
-
@as(usize, @bitCast(@as(isize, fd))),
|
|
1489
|
-
@intFromPtr(buf),
|
|
1490
|
-
count,
|
|
1491
|
-
offset_halves[0],
|
|
1492
|
-
offset_halves[1],
|
|
1493
|
-
);
|
|
1494
|
-
}
|
|
1495
|
-
} else {
|
|
1496
|
-
// Some architectures (eg. 64bit SPARC) pwrite is called pwrite64.
|
|
1497
|
-
const syscall_number = if (!@hasField(SYS, "pwrite") and @hasField(SYS, "pwrite64"))
|
|
1498
|
-
.pwrite64
|
|
1499
|
-
else
|
|
1500
|
-
.pwrite;
|
|
1501
|
-
return syscall4(
|
|
1502
|
-
syscall_number,
|
|
1503
|
-
@as(usize, @bitCast(@as(isize, fd))),
|
|
1504
|
-
@intFromPtr(buf),
|
|
1505
|
-
count,
|
|
1506
|
-
@as(u64, @bitCast(offset)),
|
|
1502
|
+
@as(u32, @bitCast(fd)),
|
|
1503
|
+
@as(u64, @bitCast(length)),
|
|
1507
1504
|
);
|
|
1508
1505
|
}
|
|
1509
1506
|
}
|
|
@@ -1514,50 +1511,50 @@ pub fn rename(old: [*:0]const u8, new: [*:0]const u8) usize {
|
|
|
1514
1511
|
} else if (@hasField(SYS, "renameat")) {
|
|
1515
1512
|
return syscall4(
|
|
1516
1513
|
.renameat,
|
|
1517
|
-
@as(
|
|
1514
|
+
@as(u32, @bitCast(@as(i32, AT.FDCWD))),
|
|
1518
1515
|
@intFromPtr(old),
|
|
1519
|
-
@as(
|
|
1516
|
+
@as(u32, @bitCast(@as(i32, AT.FDCWD))),
|
|
1520
1517
|
@intFromPtr(new),
|
|
1521
1518
|
);
|
|
1522
1519
|
} else {
|
|
1523
1520
|
return syscall5(
|
|
1524
1521
|
.renameat2,
|
|
1525
|
-
@as(
|
|
1522
|
+
@as(u32, @bitCast(@as(i32, AT.FDCWD))),
|
|
1526
1523
|
@intFromPtr(old),
|
|
1527
|
-
@as(
|
|
1524
|
+
@as(u32, @bitCast(@as(i32, AT.FDCWD))),
|
|
1528
1525
|
@intFromPtr(new),
|
|
1529
1526
|
0,
|
|
1530
1527
|
);
|
|
1531
1528
|
}
|
|
1532
1529
|
}
|
|
1533
1530
|
|
|
1534
|
-
pub fn renameat(oldfd:
|
|
1531
|
+
pub fn renameat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8) usize {
|
|
1535
1532
|
if (@hasField(SYS, "renameat")) {
|
|
1536
1533
|
return syscall4(
|
|
1537
1534
|
.renameat,
|
|
1538
|
-
@as(
|
|
1535
|
+
@as(u32, @bitCast(oldfd)),
|
|
1539
1536
|
@intFromPtr(oldpath),
|
|
1540
|
-
@as(
|
|
1537
|
+
@as(u32, @bitCast(newfd)),
|
|
1541
1538
|
@intFromPtr(newpath),
|
|
1542
1539
|
);
|
|
1543
1540
|
} else {
|
|
1544
1541
|
return syscall5(
|
|
1545
1542
|
.renameat2,
|
|
1546
|
-
@as(
|
|
1543
|
+
@as(u32, @bitCast(oldfd)),
|
|
1547
1544
|
@intFromPtr(oldpath),
|
|
1548
|
-
@as(
|
|
1545
|
+
@as(u32, @bitCast(newfd)),
|
|
1549
1546
|
@intFromPtr(newpath),
|
|
1550
1547
|
0,
|
|
1551
1548
|
);
|
|
1552
1549
|
}
|
|
1553
1550
|
}
|
|
1554
1551
|
|
|
1555
|
-
pub fn renameat2(oldfd:
|
|
1552
|
+
pub fn renameat2(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: RENAME) usize {
|
|
1556
1553
|
return syscall5(
|
|
1557
1554
|
.renameat2,
|
|
1558
|
-
@as(
|
|
1555
|
+
@as(u32, @bitCast(oldfd)),
|
|
1559
1556
|
@intFromPtr(oldpath),
|
|
1560
|
-
@as(
|
|
1557
|
+
@as(u32, @bitCast(newfd)),
|
|
1561
1558
|
@intFromPtr(newpath),
|
|
1562
1559
|
@as(u32, @bitCast(flags)),
|
|
1563
1560
|
);
|
|
@@ -1569,7 +1566,7 @@ pub fn open(path: [*:0]const u8, flags: O, perm: mode_t) usize {
|
|
|
1569
1566
|
} else {
|
|
1570
1567
|
return syscall4(
|
|
1571
1568
|
.openat,
|
|
1572
|
-
@bitCast(@as(
|
|
1569
|
+
@as(u32, @bitCast(@as(i32, AT.FDCWD))),
|
|
1573
1570
|
@intFromPtr(path),
|
|
1574
1571
|
@as(u32, @bitCast(flags)),
|
|
1575
1572
|
perm,
|
|
@@ -1581,13 +1578,13 @@ pub fn create(path: [*:0]const u8, perm: mode_t) usize {
|
|
|
1581
1578
|
return syscall2(.creat, @intFromPtr(path), perm);
|
|
1582
1579
|
}
|
|
1583
1580
|
|
|
1584
|
-
pub fn openat(dirfd:
|
|
1581
|
+
pub fn openat(dirfd: fd_t, path: [*:0]const u8, flags: O, mode: mode_t) usize {
|
|
1585
1582
|
// dirfd could be negative, for example AT.FDCWD is -100
|
|
1586
|
-
return syscall4(.openat, @
|
|
1583
|
+
return syscall4(.openat, @as(u32, @bitCast(dirfd)), @intFromPtr(path), @as(u32, @bitCast(flags)), mode);
|
|
1587
1584
|
}
|
|
1588
1585
|
|
|
1589
1586
|
/// See also `clone` (from the arch-specific include)
|
|
1590
|
-
pub fn clone5(flags: usize, child_stack_ptr: usize, parent_tid: *
|
|
1587
|
+
pub fn clone5(flags: usize, child_stack_ptr: usize, parent_tid: *pid_t, child_tid: *pid_t, newtls: usize) usize {
|
|
1591
1588
|
return syscall5(.clone, flags, child_stack_ptr, @intFromPtr(parent_tid), @intFromPtr(child_tid), newtls);
|
|
1592
1589
|
}
|
|
1593
1590
|
|
|
@@ -1602,7 +1599,7 @@ pub fn set_tid_address(tidptr: ?*pid_t) pid_t {
|
|
|
1602
1599
|
}
|
|
1603
1600
|
|
|
1604
1601
|
pub fn close(fd: fd_t) usize {
|
|
1605
|
-
return syscall1(.close, @as(
|
|
1602
|
+
return syscall1(.close, @as(u32, @bitCast(fd)));
|
|
1606
1603
|
}
|
|
1607
1604
|
|
|
1608
1605
|
pub const CLOSE_RANGE = packed struct(u32) {
|
|
@@ -1614,11 +1611,11 @@ pub const CLOSE_RANGE = packed struct(u32) {
|
|
|
1614
1611
|
};
|
|
1615
1612
|
|
|
1616
1613
|
pub fn close_range(first: fd_t, last: fd_t, flags: CLOSE_RANGE) usize {
|
|
1617
|
-
return syscall3(.close_range,
|
|
1614
|
+
return syscall3(.close_range, @as(u32, @bitCast(first)), @as(u32, @bitCast(last)), @as(u32, @bitCast(flags)));
|
|
1618
1615
|
}
|
|
1619
1616
|
|
|
1620
|
-
pub fn fchmod(fd:
|
|
1621
|
-
return syscall2(.fchmod, @as(
|
|
1617
|
+
pub fn fchmod(fd: fd_t, mode: mode_t) usize {
|
|
1618
|
+
return syscall2(.fchmod, @as(u32, @bitCast(fd)), mode);
|
|
1622
1619
|
}
|
|
1623
1620
|
|
|
1624
1621
|
pub fn chmod(path: [*:0]const u8, mode: mode_t) usize {
|
|
@@ -1629,16 +1626,16 @@ pub fn chmod(path: [*:0]const u8, mode: mode_t) usize {
|
|
|
1629
1626
|
}
|
|
1630
1627
|
}
|
|
1631
1628
|
|
|
1632
|
-
pub fn fchown(fd:
|
|
1629
|
+
pub fn fchown(fd: fd_t, owner: uid_t, group: gid_t) usize {
|
|
1633
1630
|
if (@hasField(SYS, "fchown32")) {
|
|
1634
|
-
return syscall3(.fchown32, @as(
|
|
1631
|
+
return syscall3(.fchown32, @as(u32, @bitCast(fd)), owner, group);
|
|
1635
1632
|
} else {
|
|
1636
|
-
return syscall3(.fchown, @as(
|
|
1633
|
+
return syscall3(.fchown, @as(u32, @bitCast(fd)), owner, group);
|
|
1637
1634
|
}
|
|
1638
1635
|
}
|
|
1639
1636
|
|
|
1640
|
-
pub fn fchownat(fd:
|
|
1641
|
-
return syscall5(.fchownat, @as(
|
|
1637
|
+
pub fn fchownat(fd: fd_t, path: [*:0]const u8, owner: uid_t, group: gid_t, flags: u32) usize {
|
|
1638
|
+
return syscall5(.fchownat, @as(u32, @bitCast(fd)), @intFromPtr(path), owner, group, flags);
|
|
1642
1639
|
}
|
|
1643
1640
|
|
|
1644
1641
|
pub fn chown(path: [*:0]const u8, owner: uid_t, group: gid_t) usize {
|
|
@@ -1661,40 +1658,40 @@ pub fn lchown(path: [*:0]const u8, owner: uid_t, group: gid_t) usize {
|
|
|
1661
1658
|
}
|
|
1662
1659
|
}
|
|
1663
1660
|
|
|
1664
|
-
pub fn fchmodat(fd:
|
|
1665
|
-
return syscall3(.fchmodat, @
|
|
1661
|
+
pub fn fchmodat(fd: fd_t, path: [*:0]const u8, mode: mode_t) usize {
|
|
1662
|
+
return syscall3(.fchmodat, @as(u32, @bitCast(fd)), @intFromPtr(path), mode);
|
|
1666
1663
|
}
|
|
1667
1664
|
|
|
1668
|
-
pub fn fchmodat2(fd:
|
|
1669
|
-
return syscall4(.fchmodat2, @
|
|
1665
|
+
pub fn fchmodat2(fd: fd_t, path: [*:0]const u8, mode: mode_t, flags: u32) usize {
|
|
1666
|
+
return syscall4(.fchmodat2, @as(u32, @bitCast(fd)), @intFromPtr(path), mode, flags);
|
|
1670
1667
|
}
|
|
1671
1668
|
|
|
1672
1669
|
/// Can only be called on 32 bit systems. For 64 bit see `lseek`.
|
|
1673
|
-
pub fn llseek(fd:
|
|
1670
|
+
pub fn llseek(fd: fd_t, offset: off_t, result: ?*off_t, whence: u32) usize {
|
|
1674
1671
|
// NOTE: The offset parameter splitting is independent from the target
|
|
1675
1672
|
// endianness.
|
|
1676
1673
|
return syscall5(
|
|
1677
1674
|
.llseek,
|
|
1678
|
-
@as(
|
|
1679
|
-
@as(
|
|
1680
|
-
@as(
|
|
1675
|
+
@as(u32, @bitCast(fd)),
|
|
1676
|
+
@truncate(@as(u64, @bitCast(offset >> 32))),
|
|
1677
|
+
@truncate(@as(u64, @bitCast(offset))),
|
|
1681
1678
|
@intFromPtr(result),
|
|
1682
1679
|
whence,
|
|
1683
1680
|
);
|
|
1684
1681
|
}
|
|
1685
1682
|
|
|
1686
1683
|
/// Can only be called on 64 bit systems. For 32 bit see `llseek`.
|
|
1687
|
-
pub fn lseek(fd:
|
|
1688
|
-
return syscall3(.lseek, @as(
|
|
1684
|
+
pub fn lseek(fd: fd_t, offset: off_t, whence: u32) usize {
|
|
1685
|
+
return syscall3(.lseek, @as(u32, @bitCast(fd)), @as(u64, @bitCast(offset)), whence);
|
|
1689
1686
|
}
|
|
1690
1687
|
|
|
1691
1688
|
pub fn exit(status: i32) noreturn {
|
|
1692
|
-
_ = syscall1(.exit, @as(
|
|
1689
|
+
_ = syscall1(.exit, @as(u32, @bitCast(status)));
|
|
1693
1690
|
unreachable;
|
|
1694
1691
|
}
|
|
1695
1692
|
|
|
1696
1693
|
pub fn exit_group(status: i32) noreturn {
|
|
1697
|
-
_ = syscall1(.exit_group, @as(
|
|
1694
|
+
_ = syscall1(.exit_group, @as(u32, @bitCast(status)));
|
|
1698
1695
|
unreachable;
|
|
1699
1696
|
}
|
|
1700
1697
|
|
|
@@ -1760,15 +1757,15 @@ pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize {
|
|
|
1760
1757
|
}
|
|
1761
1758
|
|
|
1762
1759
|
pub fn kill(pid: pid_t, sig: SIG) usize {
|
|
1763
|
-
return syscall2(.kill, @as(
|
|
1760
|
+
return syscall2(.kill, @as(u32, @bitCast(pid)), @intFromEnum(sig));
|
|
1764
1761
|
}
|
|
1765
1762
|
|
|
1766
1763
|
pub fn tkill(tid: pid_t, sig: SIG) usize {
|
|
1767
|
-
return syscall2(.tkill, @as(
|
|
1764
|
+
return syscall2(.tkill, @as(u32, @bitCast(tid)), @intFromEnum(sig));
|
|
1768
1765
|
}
|
|
1769
1766
|
|
|
1770
1767
|
pub fn tgkill(tgid: pid_t, tid: pid_t, sig: SIG) usize {
|
|
1771
|
-
return syscall3(.tgkill, @as(
|
|
1768
|
+
return syscall3(.tgkill, @as(u32, @bitCast(tgid)), @as(u32, @bitCast(tid)), @intFromEnum(sig));
|
|
1772
1769
|
}
|
|
1773
1770
|
|
|
1774
1771
|
pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8) usize {
|
|
@@ -1781,9 +1778,9 @@ pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8) usize {
|
|
|
1781
1778
|
} else {
|
|
1782
1779
|
return syscall5(
|
|
1783
1780
|
.linkat,
|
|
1784
|
-
@as(
|
|
1781
|
+
@as(u32, @bitCast(@as(i32, AT.FDCWD))),
|
|
1785
1782
|
@intFromPtr(oldpath),
|
|
1786
|
-
@as(
|
|
1783
|
+
@as(u32, @bitCast(@as(i32, AT.FDCWD))),
|
|
1787
1784
|
@intFromPtr(newpath),
|
|
1788
1785
|
0,
|
|
1789
1786
|
);
|
|
@@ -1793,9 +1790,9 @@ pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8) usize {
|
|
|
1793
1790
|
pub fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: u32) usize {
|
|
1794
1791
|
return syscall5(
|
|
1795
1792
|
.linkat,
|
|
1796
|
-
@as(
|
|
1793
|
+
@as(u32, @bitCast(oldfd)),
|
|
1797
1794
|
@intFromPtr(oldpath),
|
|
1798
|
-
@as(
|
|
1795
|
+
@as(u32, @bitCast(newfd)),
|
|
1799
1796
|
@intFromPtr(newpath),
|
|
1800
1797
|
flags,
|
|
1801
1798
|
);
|
|
@@ -1805,33 +1802,33 @@ pub fn unlink(path: [*:0]const u8) usize {
|
|
|
1805
1802
|
if (@hasField(SYS, "unlink")) {
|
|
1806
1803
|
return syscall1(.unlink, @intFromPtr(path));
|
|
1807
1804
|
} else {
|
|
1808
|
-
return syscall3(.unlinkat, @as(
|
|
1805
|
+
return syscall3(.unlinkat, @as(u32, @bitCast(@as(i32, AT.FDCWD))), @intFromPtr(path), 0);
|
|
1809
1806
|
}
|
|
1810
1807
|
}
|
|
1811
1808
|
|
|
1812
|
-
pub fn unlinkat(dirfd:
|
|
1813
|
-
return syscall3(.unlinkat, @as(
|
|
1809
|
+
pub fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: u32) usize {
|
|
1810
|
+
return syscall3(.unlinkat, @as(u32, @bitCast(dirfd)), @intFromPtr(path), flags);
|
|
1814
1811
|
}
|
|
1815
1812
|
|
|
1816
|
-
pub fn waitpid(pid: pid_t, status: *
|
|
1817
|
-
return syscall4(.wait4, @as(
|
|
1813
|
+
pub fn waitpid(pid: pid_t, status: *i32, flags: u32) usize {
|
|
1814
|
+
return syscall4(.wait4, @as(u32, @bitCast(pid)), @intFromPtr(status), flags, 0);
|
|
1818
1815
|
}
|
|
1819
1816
|
|
|
1820
|
-
pub fn wait4(pid: pid_t, status: *
|
|
1817
|
+
pub fn wait4(pid: pid_t, status: *i32, flags: u32, usage: ?*rusage) usize {
|
|
1821
1818
|
return syscall4(
|
|
1822
1819
|
.wait4,
|
|
1823
|
-
@as(
|
|
1820
|
+
@as(u32, @bitCast(pid)),
|
|
1824
1821
|
@intFromPtr(status),
|
|
1825
1822
|
flags,
|
|
1826
1823
|
@intFromPtr(usage),
|
|
1827
1824
|
);
|
|
1828
1825
|
}
|
|
1829
1826
|
|
|
1830
|
-
pub fn waitid(id_type: P, id:
|
|
1827
|
+
pub fn waitid(id_type: P, id: pid_t, infop: *siginfo_t, flags: u32, usage: ?*rusage) usize {
|
|
1831
1828
|
return syscall5(
|
|
1832
1829
|
.waitid,
|
|
1833
1830
|
@intFromEnum(id_type),
|
|
1834
|
-
@as(
|
|
1831
|
+
@as(u32, @bitCast(id)),
|
|
1835
1832
|
@intFromPtr(infop),
|
|
1836
1833
|
flags,
|
|
1837
1834
|
@intFromPtr(usage),
|
|
@@ -1930,14 +1927,14 @@ pub const Flock = extern struct {
|
|
|
1930
1927
|
|
|
1931
1928
|
pub fn fcntl(fd: fd_t, cmd: i32, arg: usize) usize {
|
|
1932
1929
|
if (@hasField(SYS, "fcntl64")) {
|
|
1933
|
-
return syscall3(.fcntl64, @as(
|
|
1930
|
+
return syscall3(.fcntl64, @as(u32, @bitCast(fd)), @as(u32, @bitCast(cmd)), arg);
|
|
1934
1931
|
} else {
|
|
1935
|
-
return syscall3(.fcntl, @as(
|
|
1932
|
+
return syscall3(.fcntl, @as(u32, @bitCast(fd)), @as(u32, @bitCast(cmd)), arg);
|
|
1936
1933
|
}
|
|
1937
1934
|
}
|
|
1938
1935
|
|
|
1939
1936
|
pub fn flock(fd: fd_t, operation: i32) usize {
|
|
1940
|
-
return syscall2(.flock, @as(
|
|
1937
|
+
return syscall2(.flock, @as(u32, @bitCast(fd)), @as(u32, @bitCast(operation)));
|
|
1941
1938
|
}
|
|
1942
1939
|
|
|
1943
1940
|
pub const Elf_Symndx = if (native_arch == .s390x) u64 else u32;
|
|
@@ -1977,7 +1974,7 @@ fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.c) usize {
|
|
|
1977
1974
|
pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize {
|
|
1978
1975
|
return syscall2(
|
|
1979
1976
|
if (@hasField(SYS, "clock_getres") and native_arch != .hexagon) .clock_getres else .clock_getres_time64,
|
|
1980
|
-
@
|
|
1977
|
+
@intFromEnum(clk_id),
|
|
1981
1978
|
@intFromPtr(tp),
|
|
1982
1979
|
);
|
|
1983
1980
|
}
|
|
@@ -1985,7 +1982,7 @@ pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize {
|
|
|
1985
1982
|
pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) usize {
|
|
1986
1983
|
return syscall2(
|
|
1987
1984
|
if (@hasField(SYS, "clock_settime") and native_arch != .hexagon) .clock_settime else .clock_settime64,
|
|
1988
|
-
@
|
|
1985
|
+
@intFromEnum(clk_id),
|
|
1989
1986
|
@intFromPtr(tp),
|
|
1990
1987
|
);
|
|
1991
1988
|
}
|
|
@@ -2139,11 +2136,11 @@ pub fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) usize {
|
|
|
2139
2136
|
}
|
|
2140
2137
|
|
|
2141
2138
|
pub fn setpgid(pid: pid_t, pgid: pid_t) usize {
|
|
2142
|
-
return syscall2(.setpgid, @
|
|
2139
|
+
return syscall2(.setpgid, @as(u32, @bitCast(pid)), @as(u32, @bitCast(pgid)));
|
|
2143
2140
|
}
|
|
2144
2141
|
|
|
2145
2142
|
pub fn getpgid(pid: pid_t) usize {
|
|
2146
|
-
return syscall1(.getpgid, @
|
|
2143
|
+
return syscall1(.getpgid, @as(u32, @bitCast(pid)));
|
|
2147
2144
|
}
|
|
2148
2145
|
|
|
2149
2146
|
pub fn getgroups(size: usize, list: ?[*]gid_t) usize {
|
|
@@ -2167,7 +2164,7 @@ pub fn setsid() usize {
|
|
|
2167
2164
|
}
|
|
2168
2165
|
|
|
2169
2166
|
pub fn getsid(pid: pid_t) usize {
|
|
2170
|
-
return syscall1(.getsid, @
|
|
2167
|
+
return syscall1(.getsid, @as(u32, @bitCast(pid)));
|
|
2171
2168
|
}
|
|
2172
2169
|
|
|
2173
2170
|
pub fn getpid() pid_t {
|
|
@@ -2238,8 +2235,6 @@ pub fn sigaction(sig: SIG, noalias act: ?*const Sigaction, noalias oact: ?*Sigac
|
|
|
2238
2235
|
return 0;
|
|
2239
2236
|
}
|
|
2240
2237
|
|
|
2241
|
-
const usize_bits = @typeInfo(usize).int.bits;
|
|
2242
|
-
|
|
2243
2238
|
/// Defined as one greater than the largest defined signal number.
|
|
2244
2239
|
pub const NSIG = if (is_mips) 128 else 65;
|
|
2245
2240
|
|
|
@@ -2300,18 +2295,18 @@ pub fn sigismember(set: *const sigset_t, sig: SIG) bool {
|
|
|
2300
2295
|
return ((set.*)[index.word] & index.mask) != 0;
|
|
2301
2296
|
}
|
|
2302
2297
|
|
|
2303
|
-
pub fn getsockname(fd:
|
|
2298
|
+
pub fn getsockname(fd: fd_t, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
|
|
2304
2299
|
if (native_arch == .x86) {
|
|
2305
|
-
return socketcall(SC.getsockname, &[3]usize{ @as(
|
|
2300
|
+
return socketcall(SC.getsockname, &[3]usize{ @as(u32, @bitCast(fd)), @intFromPtr(addr), @intFromPtr(len) });
|
|
2306
2301
|
}
|
|
2307
|
-
return syscall3(.getsockname, @as(
|
|
2302
|
+
return syscall3(.getsockname, @as(u32, @bitCast(fd)), @intFromPtr(addr), @intFromPtr(len));
|
|
2308
2303
|
}
|
|
2309
2304
|
|
|
2310
|
-
pub fn getpeername(fd:
|
|
2305
|
+
pub fn getpeername(fd: fd_t, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
|
|
2311
2306
|
if (native_arch == .x86) {
|
|
2312
|
-
return socketcall(SC.getpeername, &[3]usize{ @as(
|
|
2307
|
+
return socketcall(SC.getpeername, &[3]usize{ @as(u32, @bitCast(fd)), @intFromPtr(addr), @intFromPtr(len) });
|
|
2313
2308
|
}
|
|
2314
|
-
return syscall3(.getpeername, @as(
|
|
2309
|
+
return syscall3(.getpeername, @as(u32, @bitCast(fd)), @intFromPtr(addr), @intFromPtr(len));
|
|
2315
2310
|
}
|
|
2316
2311
|
|
|
2317
2312
|
pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize {
|
|
@@ -2321,58 +2316,52 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize {
|
|
|
2321
2316
|
return syscall3(.socket, domain, socket_type, protocol);
|
|
2322
2317
|
}
|
|
2323
2318
|
|
|
2324
|
-
pub fn setsockopt(fd:
|
|
2319
|
+
pub fn setsockopt(fd: fd_t, level: i32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize {
|
|
2325
2320
|
if (native_arch == .x86) {
|
|
2326
|
-
return socketcall(SC.setsockopt, &[5]usize{ @as(
|
|
2321
|
+
return socketcall(SC.setsockopt, &[5]usize{ @as(u32, @bitCast(fd)), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @as(usize, @intCast(optlen)) });
|
|
2327
2322
|
}
|
|
2328
|
-
return syscall5(.setsockopt, @as(
|
|
2323
|
+
return syscall5(.setsockopt, @as(u32, @bitCast(fd)), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @as(usize, @intCast(optlen)));
|
|
2329
2324
|
}
|
|
2330
2325
|
|
|
2331
|
-
pub fn getsockopt(fd:
|
|
2326
|
+
pub fn getsockopt(fd: fd_t, level: i32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize {
|
|
2332
2327
|
if (native_arch == .x86) {
|
|
2333
|
-
return socketcall(SC.getsockopt, &[5]usize{ @as(
|
|
2328
|
+
return socketcall(SC.getsockopt, &[5]usize{ @as(u32, @bitCast(fd)), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @intFromPtr(optlen) });
|
|
2334
2329
|
}
|
|
2335
|
-
return syscall5(.getsockopt, @as(
|
|
2330
|
+
return syscall5(.getsockopt, @as(u32, @bitCast(fd)), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @intFromPtr(optlen));
|
|
2336
2331
|
}
|
|
2337
2332
|
|
|
2338
|
-
pub fn sendmsg(fd:
|
|
2339
|
-
const fd_usize = @as(usize, @bitCast(@as(isize, fd)));
|
|
2340
|
-
const msg_usize = @intFromPtr(msg);
|
|
2333
|
+
pub fn sendmsg(fd: fd_t, msg: *const msghdr_const, flags: u32) usize {
|
|
2341
2334
|
if (native_arch == .x86) {
|
|
2342
|
-
return socketcall(SC.sendmsg, &[3]usize{
|
|
2335
|
+
return socketcall(SC.sendmsg, &[3]usize{ @as(u32, @bitCast(fd)), @intFromPtr(msg), flags });
|
|
2343
2336
|
} else {
|
|
2344
|
-
return syscall3(.sendmsg,
|
|
2337
|
+
return syscall3(.sendmsg, @as(u32, @bitCast(fd)), @intFromPtr(msg), flags);
|
|
2345
2338
|
}
|
|
2346
2339
|
}
|
|
2347
2340
|
|
|
2348
|
-
pub fn sendmmsg(fd:
|
|
2349
|
-
return syscall4(.sendmmsg, @as(
|
|
2341
|
+
pub fn sendmmsg(fd: fd_t, msgvec: [*]mmsghdr, vlen: u32, flags: u32) usize {
|
|
2342
|
+
return syscall4(.sendmmsg, @as(u32, @bitCast(fd)), @intFromPtr(msgvec), vlen, flags);
|
|
2350
2343
|
}
|
|
2351
2344
|
|
|
2352
|
-
pub fn connect(fd:
|
|
2353
|
-
const fd_usize = @as(usize, @bitCast(@as(isize, fd)));
|
|
2354
|
-
const addr_usize = @intFromPtr(addr);
|
|
2345
|
+
pub fn connect(fd: fd_t, addr: *const anyopaque, len: socklen_t) usize {
|
|
2355
2346
|
if (native_arch == .x86) {
|
|
2356
|
-
return socketcall(SC.connect, &[3]usize{
|
|
2347
|
+
return socketcall(SC.connect, &[3]usize{ @as(u32, @bitCast(fd)), @intFromPtr(addr), len });
|
|
2357
2348
|
} else {
|
|
2358
|
-
return syscall3(.connect,
|
|
2349
|
+
return syscall3(.connect, @as(u32, @bitCast(fd)), @intFromPtr(addr), len);
|
|
2359
2350
|
}
|
|
2360
2351
|
}
|
|
2361
2352
|
|
|
2362
|
-
pub fn recvmsg(fd:
|
|
2363
|
-
const fd_usize = @as(usize, @bitCast(@as(isize, fd)));
|
|
2364
|
-
const msg_usize = @intFromPtr(msg);
|
|
2353
|
+
pub fn recvmsg(fd: fd_t, msg: *msghdr, flags: u32) usize {
|
|
2365
2354
|
if (native_arch == .x86) {
|
|
2366
|
-
return socketcall(SC.recvmsg, &[3]usize{
|
|
2355
|
+
return socketcall(SC.recvmsg, &[3]usize{ @as(u32, @bitCast(fd)), @intFromPtr(msg), flags });
|
|
2367
2356
|
} else {
|
|
2368
|
-
return syscall3(.recvmsg,
|
|
2357
|
+
return syscall3(.recvmsg, @as(u32, @bitCast(fd)), @intFromPtr(msg), flags);
|
|
2369
2358
|
}
|
|
2370
2359
|
}
|
|
2371
2360
|
|
|
2372
|
-
pub fn recvmmsg(fd:
|
|
2361
|
+
pub fn recvmmsg(fd: fd_t, msgvec: ?[*]mmsghdr, vlen: u32, flags: u32, timeout: ?*timespec) usize {
|
|
2373
2362
|
return syscall5(
|
|
2374
2363
|
if (@hasField(SYS, "recvmmsg") and native_arch != .hexagon) .recvmmsg else .recvmmsg_time64,
|
|
2375
|
-
@as(
|
|
2364
|
+
@as(u32, @bitCast(fd)),
|
|
2376
2365
|
@intFromPtr(msgvec),
|
|
2377
2366
|
vlen,
|
|
2378
2367
|
flags,
|
|
@@ -2381,43 +2370,39 @@ pub fn recvmmsg(fd: i32, msgvec: ?[*]mmsghdr, vlen: u32, flags: u32, timeout: ?*
|
|
|
2381
2370
|
}
|
|
2382
2371
|
|
|
2383
2372
|
pub fn recvfrom(
|
|
2384
|
-
fd:
|
|
2373
|
+
fd: fd_t,
|
|
2385
2374
|
noalias buf: [*]u8,
|
|
2386
2375
|
len: usize,
|
|
2387
2376
|
flags: u32,
|
|
2388
2377
|
noalias addr: ?*sockaddr,
|
|
2389
2378
|
noalias alen: ?*socklen_t,
|
|
2390
2379
|
) usize {
|
|
2391
|
-
const fd_usize = @as(usize, @bitCast(@as(isize, fd)));
|
|
2392
|
-
const buf_usize = @intFromPtr(buf);
|
|
2393
|
-
const addr_usize = @intFromPtr(addr);
|
|
2394
|
-
const alen_usize = @intFromPtr(alen);
|
|
2395
2380
|
if (native_arch == .x86) {
|
|
2396
|
-
return socketcall(SC.recvfrom, &[6]usize{
|
|
2381
|
+
return socketcall(SC.recvfrom, &[6]usize{ @as(u32, @bitCast(fd)), @intFromPtr(buf), len, flags, @intFromPtr(addr), @intFromPtr(alen) });
|
|
2397
2382
|
} else {
|
|
2398
|
-
return syscall6(.recvfrom,
|
|
2383
|
+
return syscall6(.recvfrom, @as(u32, @bitCast(fd)), @intFromPtr(buf), len, flags, @intFromPtr(addr), @intFromPtr(alen));
|
|
2399
2384
|
}
|
|
2400
2385
|
}
|
|
2401
2386
|
|
|
2402
|
-
pub fn shutdown(fd:
|
|
2387
|
+
pub fn shutdown(fd: fd_t, how: i32) usize {
|
|
2403
2388
|
if (native_arch == .x86) {
|
|
2404
|
-
return socketcall(SC.shutdown, &[2]usize{ @as(
|
|
2389
|
+
return socketcall(SC.shutdown, &[2]usize{ @as(u32, @bitCast(fd)), @as(u32, @bitCast(how)) });
|
|
2405
2390
|
}
|
|
2406
|
-
return syscall2(.shutdown, @as(
|
|
2391
|
+
return syscall2(.shutdown, @as(u32, @bitCast(fd)), @as(u32, @bitCast(how)));
|
|
2407
2392
|
}
|
|
2408
2393
|
|
|
2409
|
-
pub fn bind(fd:
|
|
2394
|
+
pub fn bind(fd: fd_t, addr: *const sockaddr, len: socklen_t) usize {
|
|
2410
2395
|
if (native_arch == .x86) {
|
|
2411
|
-
return socketcall(SC.bind, &[3]usize{ @as(
|
|
2396
|
+
return socketcall(SC.bind, &[3]usize{ @as(u32, @bitCast(fd)), @intFromPtr(addr), len });
|
|
2412
2397
|
}
|
|
2413
|
-
return syscall3(.bind, @as(
|
|
2398
|
+
return syscall3(.bind, @as(u32, @bitCast(fd)), @intFromPtr(addr), len);
|
|
2414
2399
|
}
|
|
2415
2400
|
|
|
2416
|
-
pub fn listen(fd:
|
|
2401
|
+
pub fn listen(fd: fd_t, backlog: u32) usize {
|
|
2417
2402
|
if (native_arch == .x86) {
|
|
2418
|
-
return socketcall(SC.listen, &[2]usize{ @as(
|
|
2403
|
+
return socketcall(SC.listen, &[2]usize{ @as(u32, @bitCast(fd)), backlog });
|
|
2419
2404
|
}
|
|
2420
|
-
return syscall2(.listen, @as(
|
|
2405
|
+
return syscall2(.listen, @as(u32, @bitCast(fd)), backlog);
|
|
2421
2406
|
}
|
|
2422
2407
|
|
|
2423
2408
|
pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize {
|
|
@@ -2427,51 +2412,41 @@ pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const s
|
|
|
2427
2412
|
return syscall6(.sendto, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(buf), len, flags, @intFromPtr(addr), @as(usize, @intCast(alen)));
|
|
2428
2413
|
}
|
|
2429
2414
|
|
|
2430
|
-
pub fn sendfile(outfd:
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
);
|
|
2439
|
-
} else {
|
|
2440
|
-
return syscall4(
|
|
2441
|
-
.sendfile,
|
|
2442
|
-
@as(usize, @bitCast(@as(isize, outfd))),
|
|
2443
|
-
@as(usize, @bitCast(@as(isize, infd))),
|
|
2444
|
-
@intFromPtr(offset),
|
|
2445
|
-
count,
|
|
2446
|
-
);
|
|
2447
|
-
}
|
|
2415
|
+
pub fn sendfile(outfd: fd_t, infd: fd_t, offset: ?*off_t, count: usize) usize {
|
|
2416
|
+
return syscall4(
|
|
2417
|
+
if (@hasField(SYS, "sendfile64")) .sendfile64 else .sendfile,
|
|
2418
|
+
@as(u32, @bitCast(outfd)),
|
|
2419
|
+
@as(u32, @bitCast(infd)),
|
|
2420
|
+
@intFromPtr(offset),
|
|
2421
|
+
count,
|
|
2422
|
+
);
|
|
2448
2423
|
}
|
|
2449
2424
|
|
|
2450
|
-
pub fn socketpair(domain: u32, socket_type: u32, protocol: u32, fd: *[2]
|
|
2425
|
+
pub fn socketpair(domain: u32, socket_type: u32, protocol: u32, fd: *[2]fd_t) usize {
|
|
2451
2426
|
if (native_arch == .x86) {
|
|
2452
2427
|
return socketcall(SC.socketpair, &[4]usize{ domain, socket_type, protocol, @intFromPtr(fd) });
|
|
2453
2428
|
}
|
|
2454
2429
|
return syscall4(.socketpair, domain, socket_type, protocol, @intFromPtr(fd));
|
|
2455
2430
|
}
|
|
2456
2431
|
|
|
2457
|
-
pub fn accept(fd:
|
|
2432
|
+
pub fn accept(fd: fd_t, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize {
|
|
2458
2433
|
if (native_arch == .x86) {
|
|
2459
|
-
return socketcall(SC.accept, &[4]usize{ @as(
|
|
2434
|
+
return socketcall(SC.accept, &[4]usize{ @as(u32, @bitCast(fd)), @intFromPtr(addr), @intFromPtr(len), 0 });
|
|
2460
2435
|
}
|
|
2461
2436
|
return accept4(fd, addr, len, 0);
|
|
2462
2437
|
}
|
|
2463
2438
|
|
|
2464
|
-
pub fn accept4(fd:
|
|
2439
|
+
pub fn accept4(fd: fd_t, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize {
|
|
2465
2440
|
if (native_arch == .x86) {
|
|
2466
|
-
return socketcall(SC.accept4, &[4]usize{ @as(
|
|
2441
|
+
return socketcall(SC.accept4, &[4]usize{ @as(u32, @bitCast(fd)), @intFromPtr(addr), @intFromPtr(len), flags });
|
|
2467
2442
|
}
|
|
2468
|
-
return syscall4(.accept4, @as(
|
|
2443
|
+
return syscall4(.accept4, @as(u32, @bitCast(fd)), @intFromPtr(addr), @intFromPtr(len), flags);
|
|
2469
2444
|
}
|
|
2470
2445
|
|
|
2471
|
-
pub fn statx(dirfd:
|
|
2446
|
+
pub fn statx(dirfd: fd_t, path: [*:0]const u8, flags: u32, mask: STATX, statx_buf: *Statx) usize {
|
|
2472
2447
|
return syscall5(
|
|
2473
2448
|
.statx,
|
|
2474
|
-
@as(
|
|
2449
|
+
@as(u32, @bitCast(dirfd)),
|
|
2475
2450
|
@intFromPtr(path),
|
|
2476
2451
|
flags,
|
|
2477
2452
|
@as(u32, @bitCast(mask)),
|
|
@@ -2488,7 +2463,7 @@ pub fn llistxattr(path: [*:0]const u8, list: [*]u8, size: usize) usize {
|
|
|
2488
2463
|
}
|
|
2489
2464
|
|
|
2490
2465
|
pub fn flistxattr(fd: fd_t, list: [*]u8, size: usize) usize {
|
|
2491
|
-
return syscall3(.flistxattr, @as(
|
|
2466
|
+
return syscall3(.flistxattr, @as(u32, @bitCast(fd)), @intFromPtr(list), size);
|
|
2492
2467
|
}
|
|
2493
2468
|
|
|
2494
2469
|
pub fn getxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: usize) usize {
|
|
@@ -2500,7 +2475,7 @@ pub fn lgetxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: u
|
|
|
2500
2475
|
}
|
|
2501
2476
|
|
|
2502
2477
|
pub fn fgetxattr(fd: fd_t, name: [*:0]const u8, value: [*]u8, size: usize) usize {
|
|
2503
|
-
return syscall4(.fgetxattr, @as(
|
|
2478
|
+
return syscall4(.fgetxattr, @as(u32, @bitCast(fd)), @intFromPtr(name), @intFromPtr(value), size);
|
|
2504
2479
|
}
|
|
2505
2480
|
|
|
2506
2481
|
pub fn setxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]const u8, size: usize, flags: usize) usize {
|
|
@@ -2512,7 +2487,7 @@ pub fn lsetxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]const u8, s
|
|
|
2512
2487
|
}
|
|
2513
2488
|
|
|
2514
2489
|
pub fn fsetxattr(fd: fd_t, name: [*:0]const u8, value: [*]const u8, size: usize, flags: usize) usize {
|
|
2515
|
-
return syscall5(.fsetxattr, @as(
|
|
2490
|
+
return syscall5(.fsetxattr, @as(u32, @bitCast(fd)), @intFromPtr(name), @intFromPtr(value), size, flags);
|
|
2516
2491
|
}
|
|
2517
2492
|
|
|
2518
2493
|
pub fn removexattr(path: [*:0]const u8, name: [*:0]const u8) usize {
|
|
@@ -2523,8 +2498,8 @@ pub fn lremovexattr(path: [*:0]const u8, name: [*:0]const u8) usize {
|
|
|
2523
2498
|
return syscall2(.lremovexattr, @intFromPtr(path), @intFromPtr(name));
|
|
2524
2499
|
}
|
|
2525
2500
|
|
|
2526
|
-
pub fn fremovexattr(fd:
|
|
2527
|
-
return syscall2(.fremovexattr, fd, @intFromPtr(name));
|
|
2501
|
+
pub fn fremovexattr(fd: fd_t, name: [*:0]const u8) usize {
|
|
2502
|
+
return syscall2(.fremovexattr, @as(u32, @bitCast(fd)), @intFromPtr(name));
|
|
2528
2503
|
}
|
|
2529
2504
|
|
|
2530
2505
|
pub const sched_param = extern struct {
|
|
@@ -2554,27 +2529,27 @@ pub const SCHED = packed struct(i32) {
|
|
|
2554
2529
|
};
|
|
2555
2530
|
|
|
2556
2531
|
pub fn sched_setparam(pid: pid_t, param: *const sched_param) usize {
|
|
2557
|
-
return syscall2(.sched_setparam, @as(
|
|
2532
|
+
return syscall2(.sched_setparam, @as(u32, @bitCast(pid)), @intFromPtr(param));
|
|
2558
2533
|
}
|
|
2559
2534
|
|
|
2560
2535
|
pub fn sched_getparam(pid: pid_t, param: *sched_param) usize {
|
|
2561
|
-
return syscall2(.sched_getparam, @as(
|
|
2536
|
+
return syscall2(.sched_getparam, @as(u32, @bitCast(pid)), @intFromPtr(param));
|
|
2562
2537
|
}
|
|
2563
2538
|
|
|
2564
2539
|
pub fn sched_setscheduler(pid: pid_t, policy: SCHED, param: *const sched_param) usize {
|
|
2565
|
-
return syscall3(.sched_setscheduler, @as(
|
|
2540
|
+
return syscall3(.sched_setscheduler, @as(u32, @bitCast(pid)), @as(u32, @bitCast(policy)), @intFromPtr(param));
|
|
2566
2541
|
}
|
|
2567
2542
|
|
|
2568
2543
|
pub fn sched_getscheduler(pid: pid_t) usize {
|
|
2569
|
-
return syscall1(.sched_getscheduler, @as(
|
|
2544
|
+
return syscall1(.sched_getscheduler, @as(u32, @bitCast(pid)));
|
|
2570
2545
|
}
|
|
2571
2546
|
|
|
2572
2547
|
pub fn sched_get_priority_max(policy: SCHED) usize {
|
|
2573
|
-
return syscall1(.sched_get_priority_max, @
|
|
2548
|
+
return syscall1(.sched_get_priority_max, @as(u32, @bitCast(policy)));
|
|
2574
2549
|
}
|
|
2575
2550
|
|
|
2576
2551
|
pub fn sched_get_priority_min(policy: SCHED) usize {
|
|
2577
|
-
return syscall1(.sched_get_priority_min, @
|
|
2552
|
+
return syscall1(.sched_get_priority_min, @as(u32, @bitCast(policy)));
|
|
2578
2553
|
}
|
|
2579
2554
|
|
|
2580
2555
|
pub fn getcpu(cpu: ?*usize, node: ?*usize) usize {
|
|
@@ -2593,24 +2568,24 @@ pub const sched_attr = extern struct {
|
|
|
2593
2568
|
period: u64 = 0,
|
|
2594
2569
|
};
|
|
2595
2570
|
|
|
2596
|
-
pub fn sched_setattr(pid: pid_t, attr: *const sched_attr, flags:
|
|
2597
|
-
return syscall3(.sched_setattr, @as(
|
|
2571
|
+
pub fn sched_setattr(pid: pid_t, attr: *const sched_attr, flags: u32) usize {
|
|
2572
|
+
return syscall3(.sched_setattr, @as(u32, @bitCast(pid)), @intFromPtr(attr), flags);
|
|
2598
2573
|
}
|
|
2599
2574
|
|
|
2600
|
-
pub fn sched_getattr(pid: pid_t, attr: *sched_attr, size:
|
|
2601
|
-
return syscall4(.sched_getattr, @as(
|
|
2575
|
+
pub fn sched_getattr(pid: pid_t, attr: *sched_attr, size: u32, flags: u32) usize {
|
|
2576
|
+
return syscall4(.sched_getattr, @as(u32, @bitCast(pid)), @intFromPtr(attr), size, flags);
|
|
2602
2577
|
}
|
|
2603
2578
|
|
|
2604
2579
|
pub fn sched_rr_get_interval(pid: pid_t, tp: *timespec) usize {
|
|
2605
|
-
return syscall2(.sched_rr_get_interval, @as(
|
|
2580
|
+
return syscall2(.sched_rr_get_interval, @as(u32, @bitCast(pid)), @intFromPtr(tp));
|
|
2606
2581
|
}
|
|
2607
2582
|
|
|
2608
2583
|
pub fn sched_yield() usize {
|
|
2609
2584
|
return syscall0(.sched_yield);
|
|
2610
2585
|
}
|
|
2611
2586
|
|
|
2612
|
-
pub fn sched_getaffinity(pid: pid_t, size:
|
|
2613
|
-
const rc = syscall3(.sched_getaffinity, @as(
|
|
2587
|
+
pub fn sched_getaffinity(pid: pid_t, size: u32, set: *cpu_set_t) usize {
|
|
2588
|
+
const rc = syscall3(.sched_getaffinity, @as(u32, @bitCast(pid)), size, @intFromPtr(set));
|
|
2614
2589
|
if (@as(isize, @bitCast(rc)) < 0) return rc;
|
|
2615
2590
|
if (rc < size) @memset(@as([*]u8, @ptrCast(set))[rc..size], 0);
|
|
2616
2591
|
return 0;
|
|
@@ -2618,7 +2593,7 @@ pub fn sched_getaffinity(pid: pid_t, size: usize, set: *cpu_set_t) usize {
|
|
|
2618
2593
|
|
|
2619
2594
|
pub fn sched_setaffinity(pid: pid_t, set: *const cpu_set_t) !void {
|
|
2620
2595
|
const size = @sizeOf(cpu_set_t);
|
|
2621
|
-
const rc = syscall3(.sched_setaffinity, @as(
|
|
2596
|
+
const rc = syscall3(.sched_setaffinity, @as(u32, @bitCast(pid)), size, @intFromPtr(set));
|
|
2622
2597
|
|
|
2623
2598
|
switch (errno(rc)) {
|
|
2624
2599
|
.SUCCESS => return,
|
|
@@ -2630,25 +2605,25 @@ pub fn epoll_create() usize {
|
|
|
2630
2605
|
return epoll_create1(0);
|
|
2631
2606
|
}
|
|
2632
2607
|
|
|
2633
|
-
pub fn epoll_create1(flags:
|
|
2608
|
+
pub fn epoll_create1(flags: u32) usize {
|
|
2634
2609
|
return syscall1(.epoll_create1, flags);
|
|
2635
2610
|
}
|
|
2636
2611
|
|
|
2637
|
-
pub fn epoll_ctl(epoll_fd:
|
|
2638
|
-
return syscall4(.epoll_ctl, @as(
|
|
2612
|
+
pub fn epoll_ctl(epoll_fd: fd_t, op: u32, fd: fd_t, ev: ?*epoll_event) usize {
|
|
2613
|
+
return syscall4(.epoll_ctl, @as(u32, @bitCast(epoll_fd)), op, @as(u32, @bitCast(fd)), @intFromPtr(ev));
|
|
2639
2614
|
}
|
|
2640
2615
|
|
|
2641
|
-
pub fn epoll_wait(epoll_fd:
|
|
2616
|
+
pub fn epoll_wait(epoll_fd: fd_t, events: [*]epoll_event, maxevents: u32, timeout: i32) usize {
|
|
2642
2617
|
return epoll_pwait(epoll_fd, events, maxevents, timeout, null);
|
|
2643
2618
|
}
|
|
2644
2619
|
|
|
2645
|
-
pub fn epoll_pwait(epoll_fd:
|
|
2620
|
+
pub fn epoll_pwait(epoll_fd: fd_t, events: [*]epoll_event, maxevents: u32, timeout: i32, sigmask: ?*const sigset_t) usize {
|
|
2646
2621
|
return syscall6(
|
|
2647
2622
|
.epoll_pwait,
|
|
2648
|
-
@as(
|
|
2623
|
+
@as(u32, @bitCast(epoll_fd)),
|
|
2649
2624
|
@intFromPtr(events),
|
|
2650
|
-
|
|
2651
|
-
@as(
|
|
2625
|
+
maxevents,
|
|
2626
|
+
@as(u32, @bitCast(timeout)),
|
|
2652
2627
|
@intFromPtr(sigmask),
|
|
2653
2628
|
NSIG / 8,
|
|
2654
2629
|
);
|
|
@@ -2671,18 +2646,18 @@ pub const itimerspec = extern struct {
|
|
|
2671
2646
|
it_value: timespec,
|
|
2672
2647
|
};
|
|
2673
2648
|
|
|
2674
|
-
pub fn timerfd_gettime(fd:
|
|
2649
|
+
pub fn timerfd_gettime(fd: fd_t, curr_value: *itimerspec) usize {
|
|
2675
2650
|
return syscall2(
|
|
2676
2651
|
if (@hasField(SYS, "timerfd_gettime") and native_arch != .hexagon) .timerfd_gettime else .timerfd_gettime64,
|
|
2677
|
-
@
|
|
2652
|
+
@as(u32, @bitCast(fd)),
|
|
2678
2653
|
@intFromPtr(curr_value),
|
|
2679
2654
|
);
|
|
2680
2655
|
}
|
|
2681
2656
|
|
|
2682
|
-
pub fn timerfd_settime(fd:
|
|
2657
|
+
pub fn timerfd_settime(fd: fd_t, flags: TFD.TIMER, new_value: *const itimerspec, old_value: ?*itimerspec) usize {
|
|
2683
2658
|
return syscall4(
|
|
2684
2659
|
if (@hasField(SYS, "timerfd_settime") and native_arch != .hexagon) .timerfd_settime else .timerfd_settime64,
|
|
2685
|
-
@
|
|
2660
|
+
@as(u32, @bitCast(fd)),
|
|
2686
2661
|
@as(u32, @bitCast(flags)),
|
|
2687
2662
|
@intFromPtr(new_value),
|
|
2688
2663
|
@intFromPtr(old_value),
|
|
@@ -2697,11 +2672,11 @@ pub const ITIMER = enum(i32) {
|
|
|
2697
2672
|
};
|
|
2698
2673
|
|
|
2699
2674
|
pub fn getitimer(which: i32, curr_value: *itimerspec) usize {
|
|
2700
|
-
return syscall2(.getitimer, @as(
|
|
2675
|
+
return syscall2(.getitimer, @as(u32, @bitCast(which)), @intFromPtr(curr_value));
|
|
2701
2676
|
}
|
|
2702
2677
|
|
|
2703
2678
|
pub fn setitimer(which: i32, new_value: *const itimerspec, old_value: ?*itimerspec) usize {
|
|
2704
|
-
return syscall3(.setitimer, @as(
|
|
2679
|
+
return syscall3(.setitimer, @as(u32, @bitCast(which)), @intFromPtr(new_value), @intFromPtr(old_value));
|
|
2705
2680
|
}
|
|
2706
2681
|
|
|
2707
2682
|
pub fn unshare(flags: usize) usize {
|
|
@@ -2709,7 +2684,7 @@ pub fn unshare(flags: usize) usize {
|
|
|
2709
2684
|
}
|
|
2710
2685
|
|
|
2711
2686
|
pub fn setns(fd: fd_t, flags: u32) usize {
|
|
2712
|
-
return syscall2(.setns, @as(
|
|
2687
|
+
return syscall2(.setns, @as(u32, @bitCast(fd)), flags);
|
|
2713
2688
|
}
|
|
2714
2689
|
|
|
2715
2690
|
pub fn capget(hdrp: *cap_user_header_t, datap: *cap_user_data_t) usize {
|
|
@@ -2732,12 +2707,12 @@ pub fn io_uring_setup(entries: u32, p: *io_uring_params) usize {
|
|
|
2732
2707
|
return syscall2(.io_uring_setup, entries, @intFromPtr(p));
|
|
2733
2708
|
}
|
|
2734
2709
|
|
|
2735
|
-
pub fn io_uring_enter(fd:
|
|
2736
|
-
return syscall6(.io_uring_enter, @as(
|
|
2710
|
+
pub fn io_uring_enter(fd: fd_t, to_submit: u32, min_complete: u32, flags: u32, sig: ?*sigset_t) usize {
|
|
2711
|
+
return syscall6(.io_uring_enter, @as(u32, @bitCast(fd)), to_submit, min_complete, flags, @intFromPtr(sig), NSIG / 8);
|
|
2737
2712
|
}
|
|
2738
2713
|
|
|
2739
|
-
pub fn io_uring_register(fd:
|
|
2740
|
-
return syscall4(.io_uring_register, @as(
|
|
2714
|
+
pub fn io_uring_register(fd: fd_t, opcode: IORING_REGISTER, arg: ?*const anyopaque, nr_args: u32) usize {
|
|
2715
|
+
return syscall4(.io_uring_register, @as(u32, @bitCast(fd)), @intFromEnum(opcode), @intFromPtr(arg), nr_args);
|
|
2741
2716
|
}
|
|
2742
2717
|
|
|
2743
2718
|
pub fn memfd_create(name: [*:0]const u8, flags: u32) usize {
|
|
@@ -2745,43 +2720,43 @@ pub fn memfd_create(name: [*:0]const u8, flags: u32) usize {
|
|
|
2745
2720
|
}
|
|
2746
2721
|
|
|
2747
2722
|
pub fn getrusage(who: i32, usage: *rusage) usize {
|
|
2748
|
-
return syscall2(.getrusage, @as(
|
|
2723
|
+
return syscall2(.getrusage, @as(u32, @bitCast(who)), @intFromPtr(usage));
|
|
2749
2724
|
}
|
|
2750
2725
|
|
|
2751
2726
|
pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize {
|
|
2752
|
-
return syscall3(.ioctl, @as(
|
|
2727
|
+
return syscall3(.ioctl, @as(u32, @bitCast(fd)), T.CGETS, @intFromPtr(termios_p));
|
|
2753
2728
|
}
|
|
2754
2729
|
|
|
2755
2730
|
pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize {
|
|
2756
|
-
return syscall3(.ioctl, @as(
|
|
2731
|
+
return syscall3(.ioctl, @as(u32, @bitCast(fd)), T.CSETS + @intFromEnum(optional_action), @intFromPtr(termios_p));
|
|
2757
2732
|
}
|
|
2758
2733
|
|
|
2759
2734
|
pub fn tcgetpgrp(fd: fd_t, pgrp: *pid_t) usize {
|
|
2760
|
-
return syscall3(.ioctl, @as(
|
|
2735
|
+
return syscall3(.ioctl, @as(u32, @bitCast(fd)), T.IOCGPGRP, @intFromPtr(pgrp));
|
|
2761
2736
|
}
|
|
2762
2737
|
|
|
2763
2738
|
pub fn tcsetpgrp(fd: fd_t, pgrp: *const pid_t) usize {
|
|
2764
|
-
return syscall3(.ioctl, @as(
|
|
2739
|
+
return syscall3(.ioctl, @as(u32, @bitCast(fd)), T.IOCSPGRP, @intFromPtr(pgrp));
|
|
2765
2740
|
}
|
|
2766
2741
|
|
|
2767
2742
|
pub fn tcdrain(fd: fd_t) usize {
|
|
2768
|
-
return syscall3(.ioctl, @as(
|
|
2743
|
+
return syscall3(.ioctl, @as(u32, @bitCast(fd)), T.CSBRK, 1);
|
|
2769
2744
|
}
|
|
2770
2745
|
|
|
2771
2746
|
pub fn ioctl(fd: fd_t, request: u32, arg: usize) usize {
|
|
2772
|
-
return syscall3(.ioctl, @as(
|
|
2747
|
+
return syscall3(.ioctl, @as(u32, @bitCast(fd)), request, arg);
|
|
2773
2748
|
}
|
|
2774
2749
|
|
|
2775
2750
|
pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) usize {
|
|
2776
|
-
return syscall4(.signalfd4, @as(
|
|
2751
|
+
return syscall4(.signalfd4, @as(u32, @bitCast(fd)), @intFromPtr(mask), NSIG / 8, flags);
|
|
2777
2752
|
}
|
|
2778
2753
|
|
|
2779
|
-
pub fn copy_file_range(fd_in: fd_t, off_in: ?*
|
|
2754
|
+
pub fn copy_file_range(fd_in: fd_t, off_in: ?*off_t, fd_out: fd_t, off_out: ?*off_t, len: usize, flags: u32) usize {
|
|
2780
2755
|
return syscall6(
|
|
2781
2756
|
.copy_file_range,
|
|
2782
|
-
@as(
|
|
2757
|
+
@as(u32, @bitCast(fd_in)),
|
|
2783
2758
|
@intFromPtr(off_in),
|
|
2784
|
-
@as(
|
|
2759
|
+
@as(u32, @bitCast(fd_out)),
|
|
2785
2760
|
@intFromPtr(off_out),
|
|
2786
2761
|
len,
|
|
2787
2762
|
flags,
|
|
@@ -2797,19 +2772,19 @@ pub fn sync() void {
|
|
|
2797
2772
|
}
|
|
2798
2773
|
|
|
2799
2774
|
pub fn syncfs(fd: fd_t) usize {
|
|
2800
|
-
return syscall1(.syncfs, @as(
|
|
2775
|
+
return syscall1(.syncfs, @as(u32, @bitCast(fd)));
|
|
2801
2776
|
}
|
|
2802
2777
|
|
|
2803
2778
|
pub fn fsync(fd: fd_t) usize {
|
|
2804
|
-
return syscall1(.fsync, @as(
|
|
2779
|
+
return syscall1(.fsync, @as(u32, @bitCast(fd)));
|
|
2805
2780
|
}
|
|
2806
2781
|
|
|
2807
2782
|
pub fn fdatasync(fd: fd_t) usize {
|
|
2808
|
-
return syscall1(.fdatasync, @as(
|
|
2783
|
+
return syscall1(.fdatasync, @as(u32, @bitCast(fd)));
|
|
2809
2784
|
}
|
|
2810
2785
|
|
|
2811
2786
|
pub fn prctl(option: i32, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
|
|
2812
|
-
return syscall5(.prctl, @as(
|
|
2787
|
+
return syscall5(.prctl, @as(u32, @bitCast(option)), arg2, arg3, arg4, arg5);
|
|
2813
2788
|
}
|
|
2814
2789
|
|
|
2815
2790
|
pub fn getrlimit(resource: rlimit_resource, rlim: *rlimit) usize {
|
|
@@ -2825,8 +2800,8 @@ pub fn setrlimit(resource: rlimit_resource, rlim: *const rlimit) usize {
|
|
|
2825
2800
|
pub fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: ?*const rlimit, old_limit: ?*rlimit) usize {
|
|
2826
2801
|
return syscall4(
|
|
2827
2802
|
.prlimit64,
|
|
2828
|
-
@as(
|
|
2829
|
-
@as(
|
|
2803
|
+
@as(u32, @bitCast(pid)),
|
|
2804
|
+
@as(u32, @bitCast(@as(i32, @intFromEnum(resource)))),
|
|
2830
2805
|
@intFromPtr(new_limit),
|
|
2831
2806
|
@intFromPtr(old_limit),
|
|
2832
2807
|
);
|
|
@@ -2841,14 +2816,14 @@ pub fn madvise(address: [*]u8, len: usize, advice: u32) usize {
|
|
|
2841
2816
|
}
|
|
2842
2817
|
|
|
2843
2818
|
pub fn pidfd_open(pid: pid_t, flags: u32) usize {
|
|
2844
|
-
return syscall2(.pidfd_open, @as(
|
|
2819
|
+
return syscall2(.pidfd_open, @as(u32, @bitCast(pid)), flags);
|
|
2845
2820
|
}
|
|
2846
2821
|
|
|
2847
2822
|
pub fn pidfd_getfd(pidfd: fd_t, targetfd: fd_t, flags: u32) usize {
|
|
2848
2823
|
return syscall3(
|
|
2849
2824
|
.pidfd_getfd,
|
|
2850
|
-
@as(
|
|
2851
|
-
@as(
|
|
2825
|
+
@as(u32, @bitCast(pidfd)),
|
|
2826
|
+
@as(u32, @bitCast(targetfd)),
|
|
2852
2827
|
flags,
|
|
2853
2828
|
);
|
|
2854
2829
|
}
|
|
@@ -2856,7 +2831,7 @@ pub fn pidfd_getfd(pidfd: fd_t, targetfd: fd_t, flags: u32) usize {
|
|
|
2856
2831
|
pub fn pidfd_send_signal(pidfd: fd_t, sig: SIG, info: ?*siginfo_t, flags: u32) usize {
|
|
2857
2832
|
return syscall4(
|
|
2858
2833
|
.pidfd_send_signal,
|
|
2859
|
-
@as(
|
|
2834
|
+
@as(u32, @bitCast(pidfd)),
|
|
2860
2835
|
@intFromEnum(sig),
|
|
2861
2836
|
@intFromPtr(info),
|
|
2862
2837
|
flags,
|
|
@@ -2866,7 +2841,7 @@ pub fn pidfd_send_signal(pidfd: fd_t, sig: SIG, info: ?*siginfo_t, flags: u32) u
|
|
|
2866
2841
|
pub fn process_vm_readv(pid: pid_t, local: []const iovec, remote: []const iovec_const, flags: usize) usize {
|
|
2867
2842
|
return syscall6(
|
|
2868
2843
|
.process_vm_readv,
|
|
2869
|
-
@as(
|
|
2844
|
+
@as(u32, @bitCast(pid)),
|
|
2870
2845
|
@intFromPtr(local.ptr),
|
|
2871
2846
|
local.len,
|
|
2872
2847
|
@intFromPtr(remote.ptr),
|
|
@@ -2878,7 +2853,7 @@ pub fn process_vm_readv(pid: pid_t, local: []const iovec, remote: []const iovec_
|
|
|
2878
2853
|
pub fn process_vm_writev(pid: pid_t, local: []const iovec_const, remote: []const iovec_const, flags: usize) usize {
|
|
2879
2854
|
return syscall6(
|
|
2880
2855
|
.process_vm_writev,
|
|
2881
|
-
@as(
|
|
2856
|
+
@as(u32, @bitCast(pid)),
|
|
2882
2857
|
@intFromPtr(local.ptr),
|
|
2883
2858
|
local.len,
|
|
2884
2859
|
@intFromPtr(remote.ptr),
|
|
@@ -2888,50 +2863,43 @@ pub fn process_vm_writev(pid: pid_t, local: []const iovec_const, remote: []const
|
|
|
2888
2863
|
}
|
|
2889
2864
|
|
|
2890
2865
|
pub fn fadvise(fd: fd_t, offset: i64, len: i64, advice: usize) usize {
|
|
2891
|
-
if (
|
|
2892
|
-
//
|
|
2893
|
-
// register
|
|
2866
|
+
if (native_arch.isMIPS32()) {
|
|
2867
|
+
// MIPS O32 weirdly differs from the other architectures that require
|
|
2868
|
+
// aligned register pairs for this specific syscall.
|
|
2894
2869
|
|
|
2895
2870
|
const offset_halves = splitValue64(offset);
|
|
2896
2871
|
const length_halves = splitValue64(len);
|
|
2897
2872
|
|
|
2898
|
-
return
|
|
2899
|
-
.
|
|
2900
|
-
@as(
|
|
2901
|
-
|
|
2873
|
+
return syscall7(
|
|
2874
|
+
.fadvise64,
|
|
2875
|
+
@as(u32, @bitCast(fd)),
|
|
2876
|
+
0,
|
|
2902
2877
|
offset_halves[0],
|
|
2903
2878
|
offset_halves[1],
|
|
2904
2879
|
length_halves[0],
|
|
2905
2880
|
length_halves[1],
|
|
2881
|
+
advice,
|
|
2906
2882
|
);
|
|
2907
|
-
} else if (
|
|
2908
|
-
// MIPS O32 does not deal with the register alignment issue, so pass a dummy value.
|
|
2909
|
-
|
|
2883
|
+
} else if (require_aligned_register_pair) {
|
|
2910
2884
|
const offset_halves = splitValue64(offset);
|
|
2911
2885
|
const length_halves = splitValue64(len);
|
|
2912
2886
|
|
|
2913
|
-
return
|
|
2914
|
-
.
|
|
2915
|
-
@as(
|
|
2916
|
-
|
|
2887
|
+
return syscall6(
|
|
2888
|
+
.fadvise64_64,
|
|
2889
|
+
@as(u32, @bitCast(fd)),
|
|
2890
|
+
advice,
|
|
2917
2891
|
offset_halves[0],
|
|
2918
2892
|
offset_halves[1],
|
|
2919
2893
|
length_halves[0],
|
|
2920
2894
|
length_halves[1],
|
|
2921
|
-
advice,
|
|
2922
2895
|
);
|
|
2923
|
-
} else if (
|
|
2924
|
-
// Other 32-bit architectures do not require register alignment.
|
|
2925
|
-
|
|
2896
|
+
} else if (@sizeOf(syscall_arg_t) < @sizeOf(u64)) {
|
|
2926
2897
|
const offset_halves = splitValue64(offset);
|
|
2927
2898
|
const length_halves = splitValue64(len);
|
|
2928
2899
|
|
|
2929
2900
|
return syscall6(
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
else => .fadvise64_64,
|
|
2933
|
-
},
|
|
2934
|
-
@as(usize, @bitCast(@as(isize, fd))),
|
|
2901
|
+
.fadvise64_64,
|
|
2902
|
+
@as(u32, @bitCast(fd)),
|
|
2935
2903
|
offset_halves[0],
|
|
2936
2904
|
offset_halves[1],
|
|
2937
2905
|
length_halves[0],
|
|
@@ -2939,14 +2907,11 @@ pub fn fadvise(fd: fd_t, offset: i64, len: i64, advice: usize) usize {
|
|
|
2939
2907
|
advice,
|
|
2940
2908
|
);
|
|
2941
2909
|
} else {
|
|
2942
|
-
// On 64-bit architectures, fadvise64_64 and fadvise64 are the same. Generally, older ports
|
|
2943
|
-
// call it fadvise64 (x86, PowerPC, etc), while newer ports call it fadvise64_64 (RISC-V,
|
|
2944
|
-
// LoongArch, etc). SPARC is the odd one out because it has both.
|
|
2945
2910
|
return syscall4(
|
|
2946
|
-
|
|
2947
|
-
@as(
|
|
2948
|
-
@as(
|
|
2949
|
-
@as(
|
|
2911
|
+
.fadvise64,
|
|
2912
|
+
@as(u32, @bitCast(fd)),
|
|
2913
|
+
@as(u64, @bitCast(offset)),
|
|
2914
|
+
@as(u64, @bitCast(len)),
|
|
2950
2915
|
advice,
|
|
2951
2916
|
);
|
|
2952
2917
|
}
|
|
@@ -2962,9 +2927,9 @@ pub fn perf_event_open(
|
|
|
2962
2927
|
return syscall5(
|
|
2963
2928
|
.perf_event_open,
|
|
2964
2929
|
@intFromPtr(attr),
|
|
2965
|
-
@as(
|
|
2966
|
-
@as(
|
|
2967
|
-
@as(
|
|
2930
|
+
@as(u32, @bitCast(pid)),
|
|
2931
|
+
@as(u32, @bitCast(cpu)),
|
|
2932
|
+
@as(u32, @bitCast(group_fd)),
|
|
2968
2933
|
flags,
|
|
2969
2934
|
);
|
|
2970
2935
|
}
|
|
@@ -2983,7 +2948,7 @@ pub fn ptrace(
|
|
|
2983
2948
|
return syscall5(
|
|
2984
2949
|
.ptrace,
|
|
2985
2950
|
req,
|
|
2986
|
-
@as(
|
|
2951
|
+
@as(u32, @bitCast(pid)),
|
|
2987
2952
|
addr,
|
|
2988
2953
|
data,
|
|
2989
2954
|
addr2,
|
|
@@ -3005,17 +2970,27 @@ pub fn cachestat(
|
|
|
3005
2970
|
) usize {
|
|
3006
2971
|
return syscall4(
|
|
3007
2972
|
.cachestat,
|
|
3008
|
-
@as(
|
|
2973
|
+
@as(u32, @bitCast(fd)),
|
|
3009
2974
|
@intFromPtr(cstat_range),
|
|
3010
2975
|
@intFromPtr(cstat),
|
|
3011
2976
|
flags,
|
|
3012
2977
|
);
|
|
3013
2978
|
}
|
|
3014
2979
|
|
|
3015
|
-
pub fn map_shadow_stack(addr:
|
|
2980
|
+
pub fn map_shadow_stack(addr: usize, size: usize, flags: u32) usize {
|
|
3016
2981
|
return syscall3(.map_shadow_stack, addr, size, flags);
|
|
3017
2982
|
}
|
|
3018
2983
|
|
|
2984
|
+
pub fn tee(src: fd_t, dest: fd_t, len: usize, flags: u32) usize {
|
|
2985
|
+
return syscall4(
|
|
2986
|
+
.tee,
|
|
2987
|
+
@as(u32, @bitCast(src)),
|
|
2988
|
+
@as(u32, @bitCast(dest)),
|
|
2989
|
+
len,
|
|
2990
|
+
flags,
|
|
2991
|
+
);
|
|
2992
|
+
}
|
|
2993
|
+
|
|
3019
2994
|
pub const Sysinfo = switch (native_abi) {
|
|
3020
2995
|
.gnux32, .muslx32 => extern struct {
|
|
3021
2996
|
/// Seconds since boot
|
|
@@ -3676,13 +3651,6 @@ pub const E = switch (native_arch) {
|
|
|
3676
3651
|
},
|
|
3677
3652
|
};
|
|
3678
3653
|
|
|
3679
|
-
pub const pid_t = i32;
|
|
3680
|
-
pub const fd_t = i32;
|
|
3681
|
-
pub const socket_t = i32;
|
|
3682
|
-
pub const uid_t = u32;
|
|
3683
|
-
pub const gid_t = u32;
|
|
3684
|
-
pub const clock_t = isize;
|
|
3685
|
-
|
|
3686
3654
|
pub const NAME_MAX = 255;
|
|
3687
3655
|
pub const PATH_MAX = 4096;
|
|
3688
3656
|
pub const IOV_MAX = 1024;
|
|
@@ -10174,7 +10142,3 @@ pub const cmsghdr = extern struct {
|
|
|
10174
10142
|
level: i32,
|
|
10175
10143
|
type: i32,
|
|
10176
10144
|
};
|
|
10177
|
-
|
|
10178
|
-
inline fn fd_to_usize(fd: fd_t) usize {
|
|
10179
|
-
return @as(usize, @bitCast(@as(isize, fd)));
|
|
10180
|
-
}
|