aboutsummaryrefslogtreecommitdiff
path: root/lib/std/c/linux.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-01 15:52:54 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-01 15:52:54 -0700
commitc89dd15e1be4959800dc7092d7dd4375253db7bc (patch)
treeca184ae53592efa21e67128a5f891d642d7f1118 /lib/std/c/linux.zig
parent5466e87fce581f2ef90ac23bb80b1dbc05836fc6 (diff)
parent2360f8c490f3ec684ed64ff28e8c1fade249070b (diff)
downloadzig-c89dd15e1be4959800dc7092d7dd4375253db7bc.tar.gz
zig-c89dd15e1be4959800dc7092d7dd4375253db7bc.zip
Merge remote-tracking branch 'origin/master' into llvm14
Diffstat (limited to 'lib/std/c/linux.zig')
-rw-r--r--lib/std/c/linux.zig33
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/std/c/linux.zig b/lib/std/c/linux.zig
index db55b5d850..d0a3590257 100644
--- a/lib/std/c/linux.zig
+++ b/lib/std/c/linux.zig
@@ -30,6 +30,7 @@ pub const MAP = struct {
/// Only used by libc to communicate failure.
pub const FAILED = @intToPtr(*anyopaque, maxInt(usize));
};
+pub const MSF = linux.MSF;
pub const MMAP2_UNIT = linux.MMAP2_UNIT;
pub const MSG = linux.MSG;
pub const NAME_MAX = linux.NAME_MAX;
@@ -114,16 +115,17 @@ pub const _errno = switch (native_abi) {
};
pub const Stat = switch (native_arch) {
- .sparcv9 => extern struct {
+ .sparc64 => extern struct {
dev: u64,
+ __pad1: u16,
ino: ino_t,
mode: u32,
- nlink: usize,
+ nlink: u32,
uid: u32,
gid: u32,
rdev: u64,
- __pad0: u32,
+ __pad2: u16,
size: off_t,
blksize: isize,
@@ -132,7 +134,7 @@ pub const Stat = switch (native_arch) {
atim: timespec,
mtim: timespec,
ctim: timespec,
- __unused: [2]isize,
+ __reserved: [2]usize,
pub fn atime(self: @This()) timespec {
return self.atim;
@@ -261,7 +263,11 @@ pub extern "c" fn inotify_rm_watch(fd: fd_t, wd: c_int) c_int;
/// See std.elf for constants for this
pub extern "c" fn getauxval(__type: c_ulong) c_ulong;
-pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
+pub const dl_iterate_phdr_callback = switch (builtin.zig_backend) {
+ .stage1 => fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int,
+ else => *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int,
+};
+
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
@@ -339,7 +345,7 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (native_abi) {
.gnu, .gnuabin32, .gnuabi64, .gnueabi, .gnueabihf, .gnux32 => switch (native_arch) {
.aarch64 => 48,
.x86_64 => if (native_abi == .gnux32) 40 else 32,
- .mips64, .powerpc64, .powerpc64le, .sparcv9 => 40,
+ .mips64, .powerpc64, .powerpc64le, .sparc64 => 40,
else => if (@sizeOf(usize) == 8) 40 else 24,
},
.android => if (@sizeOf(usize) == 8) 40 else 4,
@@ -358,3 +364,18 @@ pub const RTLD = struct {
pub const GLOBAL = 256;
pub const LOCAL = 0;
};
+
+pub const dirent = struct {
+ d_ino: c_uint,
+ d_off: c_uint,
+ d_reclen: c_ushort,
+ d_type: u8,
+ d_name: [256]u8,
+};
+pub const dirent64 = struct {
+ d_ino: c_ulong,
+ d_off: c_ulong,
+ d_reclen: c_ushort,
+ d_type: u8,
+ d_name: [256]u8,
+};