mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.os.linux: clean up a bunch of dead consts
This commit is contained in:
parent
dc1bc52dd6
commit
aa8e53908a
16 changed files with 153 additions and 338 deletions
|
|
@ -1,18 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const timespec = std.os.linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u64 {
|
pub fn syscall0(number: SYS) u64 {
|
||||||
return asm volatile ("svc #0"
|
return asm volatile ("svc #0"
|
||||||
|
|
@ -135,7 +123,7 @@ pub fn clone() callconv(.naked) u64 {
|
||||||
pub const restore = restore_rt;
|
pub const restore = restore_rt;
|
||||||
|
|
||||||
pub fn restore_rt() callconv(.naked) noreturn {
|
pub fn restore_rt() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ mov x8, %[number]
|
\\ mov x8, %[number]
|
||||||
\\ svc #0
|
\\ svc #0
|
||||||
|
|
@ -170,28 +158,28 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__pad: u64,
|
__pad: u64,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
__pad2: i32,
|
__pad2: i32,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [2]u32,
|
__unused: [2]u32,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
return asm volatile ("svc #0"
|
return asm volatile ("svc #0"
|
||||||
|
|
@ -128,7 +117,7 @@ pub fn clone() callconv(.naked) u32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn restore() callconv(.naked) noreturn {
|
pub fn restore() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ mov r7, %[number]
|
\\ mov r7, %[number]
|
||||||
\\ svc #0
|
\\ svc #0
|
||||||
|
|
@ -144,7 +133,7 @@ pub fn restore() callconv(.naked) noreturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn restore_rt() callconv(.naked) noreturn {
|
pub fn restore_rt() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ mov r7, %[number]
|
\\ mov r7, %[number]
|
||||||
\\ svc #0
|
\\ svc #0
|
||||||
|
|
@ -206,27 +195,27 @@ pub const Stat = extern struct {
|
||||||
__ino_truncated: u32,
|
__ino_truncated: u32,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__rdev_padding: u32,
|
__rdev_padding: u32,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const iovec = std.posix.iovec;
|
const SYS = std.os.linux.SYS;
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const uid_t = std.os.linux.uid_t;
|
|
||||||
const gid_t = std.os.linux.gid_t;
|
|
||||||
const pid_t = std.os.linux.pid_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const timespec = std.os.linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
return asm volatile ("trap0(#1)"
|
return asm volatile ("trap0(#1)"
|
||||||
|
|
@ -145,28 +134,28 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__pad: u32,
|
__pad: u32,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
__pad2: i32,
|
__pad2: i32,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [2]u32,
|
__unused: [2]u32,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const linux = std.os.linux;
|
const SYS = std.os.linux.SYS;
|
||||||
const SYS = linux.SYS;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u64 {
|
pub fn syscall0(number: SYS) u64 {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|
@ -150,28 +140,28 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
_pad1: u64,
|
_pad1: u64,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
_pad2: i32,
|
_pad2: i32,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
_pad3: [2]u32,
|
_pad3: [2]u32,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const iovec = std.posix.iovec;
|
const SYS = std.os.linux.SYS;
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const uid_t = std.os.linux.uid_t;
|
|
||||||
const gid_t = std.os.linux.uid_t;
|
|
||||||
const pid_t = std.os.linux.pid_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const timespec = std.os.linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
return asm volatile ("trap #0"
|
return asm volatile ("trap #0"
|
||||||
|
|
@ -166,27 +157,27 @@ pub const Stat = extern struct {
|
||||||
__ino_truncated: i32,
|
__ino_truncated: i32,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__pad2: i16,
|
__pad2: i16,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|
@ -264,39 +252,27 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__pad1: [2]u32,
|
__pad1: [2]u32,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
atim: i32,
|
atim: std.os.linux.timespec,
|
||||||
atim_nsec: i32,
|
mtim: std.os.linux.timespec,
|
||||||
mtim: i32,
|
ctim: std.os.linux.timespec,
|
||||||
mtim_nsec: i32,
|
|
||||||
ctim: i32,
|
|
||||||
ctim_nsec: i32,
|
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
__pad3: u32,
|
__pad3: u32,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return .{
|
return self.atim;
|
||||||
.sec = self.atim,
|
|
||||||
.nsec = self.atim_nsec,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return .{
|
return self.mtim;
|
||||||
.sec = self.mtim,
|
|
||||||
.nsec = self.mtim_nsec,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return .{
|
return self.ctim;
|
||||||
.sec = self.ctim,
|
|
||||||
.nsec = self.ctim_nsec,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u64 {
|
pub fn syscall0(number: SYS) u64 {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|
@ -243,8 +231,8 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__pad1: [2]u32, // -1 because our dev_t is u64 (kernel dev_t is really u32).
|
__pad1: [2]u32, // -1 because our dev_t is u64 (kernel dev_t is really u32).
|
||||||
size: off_t,
|
size: off_t,
|
||||||
|
|
@ -258,21 +246,21 @@ pub const Stat = extern struct {
|
||||||
__pad3: u32,
|
__pad3: u32,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return .{
|
return .{
|
||||||
.sec = self.atim,
|
.sec = self.atim,
|
||||||
.nsec = self.atim_nsec,
|
.nsec = self.atim_nsec,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return .{
|
return .{
|
||||||
.sec = self.mtim,
|
.sec = self.mtim,
|
||||||
.nsec = self.mtim_nsec,
|
.nsec = self.mtim_nsec,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return .{
|
return .{
|
||||||
.sec = self.ctim,
|
.sec = self.ctim,
|
||||||
.nsec = self.ctim_nsec,
|
.nsec = self.ctim_nsec,
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
// r0 is both an input register and a clobber. musl and glibc achieve this with
|
// r0 is both an input register and a clobber. musl and glibc achieve this with
|
||||||
|
|
@ -247,7 +235,7 @@ pub fn clone() callconv(.naked) u32 {
|
||||||
pub const restore = restore_rt;
|
pub const restore = restore_rt;
|
||||||
|
|
||||||
pub fn restore_rt() callconv(.naked) noreturn {
|
pub fn restore_rt() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ li 0, %[number]
|
\\ li 0, %[number]
|
||||||
\\ sc
|
\\ sc
|
||||||
|
|
@ -282,27 +270,27 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__rdev_padding: i16,
|
__rdev_padding: i16,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [2]u32,
|
__unused: [2]u32,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u64 {
|
pub fn syscall0(number: SYS) u64 {
|
||||||
// r0 is both an input register and a clobber. musl and glibc achieve this with
|
// r0 is both an input register and a clobber. musl and glibc achieve this with
|
||||||
|
|
@ -232,7 +220,7 @@ pub fn clone() callconv(.naked) u64 {
|
||||||
pub const restore = restore_rt;
|
pub const restore = restore_rt;
|
||||||
|
|
||||||
pub fn restore_rt() callconv(.naked) noreturn {
|
pub fn restore_rt() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ li 0, %[number]
|
\\ li 0, %[number]
|
||||||
\\ sc
|
\\ sc
|
||||||
|
|
@ -267,26 +255,26 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [3]u64,
|
__unused: [3]u64,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const iovec = std.posix.iovec;
|
const SYS = std.os.linux.SYS;
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const uid_t = std.os.linux.uid_t;
|
|
||||||
const gid_t = std.os.linux.gid_t;
|
|
||||||
const pid_t = std.os.linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const timespec = std.os.linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
return asm volatile ("ecall"
|
return asm volatile ("ecall"
|
||||||
|
|
@ -150,28 +139,28 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__pad: u32,
|
__pad: u32,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
__pad2: i32,
|
__pad2: i32,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [2]u32,
|
__unused: [2]u32,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const iovec = std.posix.iovec;
|
const SYS = std.os.linux.SYS;
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const uid_t = std.os.linux.uid_t;
|
|
||||||
const gid_t = std.os.linux.gid_t;
|
|
||||||
const pid_t = std.os.linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const timespec = std.os.linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u64 {
|
pub fn syscall0(number: SYS) u64 {
|
||||||
return asm volatile ("ecall"
|
return asm volatile ("ecall"
|
||||||
|
|
@ -150,28 +139,28 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__pad: u64,
|
__pad: u64,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
__pad2: i32,
|
__pad2: i32,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [2]u32,
|
__unused: [2]u32,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const iovec = std.posix.iovec;
|
const SYS = std.os.linux.SYS;
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const uid_t = std.os.linux.uid_t;
|
|
||||||
const gid_t = std.os.linux.gid_t;
|
|
||||||
const pid_t = std.os.linux.pid_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const timespec = std.os.linux.timespec;
|
|
||||||
const stack_t = std.os.linux.stack_t;
|
|
||||||
const sigset_t = std.os.linux.sigset_t;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u64 {
|
pub fn syscall0(number: SYS) u64 {
|
||||||
return asm volatile ("svc 0"
|
return asm volatile ("svc 0"
|
||||||
|
|
@ -172,26 +161,26 @@ pub const Stat = extern struct {
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
__unused: [3]c_ulong,
|
__unused: [3]c_ulong,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const clock_t = linux.clock_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
|
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall_pipe(fd: *[2]i32) u64 {
|
pub fn syscall_pipe(fd: *[2]i32) u64 {
|
||||||
return asm volatile (
|
return asm volatile (
|
||||||
|
|
@ -252,34 +239,35 @@ pub const blkcnt_t = i64;
|
||||||
|
|
||||||
// The `stat64` definition used by the kernel.
|
// The `stat64` definition used by the kernel.
|
||||||
pub const Stat = extern struct {
|
pub const Stat = extern struct {
|
||||||
dev: u64,
|
dev: dev_t,
|
||||||
ino: u64,
|
ino: ino_t,
|
||||||
nlink: u64,
|
nlink: nlink_t,
|
||||||
|
_pad: i32,
|
||||||
|
|
||||||
mode: u32,
|
mode: mode_t,
|
||||||
uid: u32,
|
uid: std.os.linux.uid_t,
|
||||||
gid: u32,
|
gid: std.os.linux.gid_t,
|
||||||
__pad0: u32,
|
__pad0: u32,
|
||||||
|
|
||||||
rdev: u64,
|
rdev: dev_t,
|
||||||
size: i64,
|
size: i64,
|
||||||
blksize: i64,
|
blksize: blksize_t,
|
||||||
blocks: i64,
|
blocks: blkcnt_t,
|
||||||
|
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [3]u64,
|
__unused: [3]u64,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@
|
||||||
//! Save and restore r7 around the syscall without touching the stack pointer not
|
//! Save and restore r7 around the syscall without touching the stack pointer not
|
||||||
//! to break the frame chain.
|
//! to break the frame chain.
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const linux = std.os.linux;
|
const SYS = std.os.linux.SYS;
|
||||||
const SYS = linux.SYS;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
var buf: [2]u32 = .{ @intFromEnum(number), undefined };
|
var buf: [2]u32 = .{ @intFromEnum(number), undefined };
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u32 {
|
pub fn syscall0(number: SYS) u32 {
|
||||||
return asm volatile ("int $0x80"
|
return asm volatile ("int $0x80"
|
||||||
|
|
@ -169,7 +157,7 @@ pub fn clone() callconv(.naked) u32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn restore() callconv(.naked) noreturn {
|
pub fn restore() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ movl %[number], %%eax
|
\\ movl %[number], %%eax
|
||||||
\\ int $0x80
|
\\ int $0x80
|
||||||
|
|
@ -185,7 +173,7 @@ pub fn restore() callconv(.naked) noreturn {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn restore_rt() callconv(.naked) noreturn {
|
pub fn restore_rt() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ movl %[number], %%eax
|
\\ movl %[number], %%eax
|
||||||
\\ int $0x80
|
\\ int $0x80
|
||||||
|
|
@ -221,27 +209,27 @@ pub const Stat = extern struct {
|
||||||
__ino_truncated: u32,
|
__ino_truncated: u32,
|
||||||
mode: mode_t,
|
mode: mode_t,
|
||||||
nlink: nlink_t,
|
nlink: nlink_t,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
__rdev_padding: u32,
|
__rdev_padding: u32,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: blksize_t,
|
blksize: blksize_t,
|
||||||
blocks: blkcnt_t,
|
blocks: blkcnt_t,
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
ino: ino_t,
|
ino: ino_t,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,6 @@
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../../std.zig");
|
const std = @import("../../std.zig");
|
||||||
const maxInt = std.math.maxInt;
|
const SYS = std.os.linux.SYS;
|
||||||
const linux = std.os.linux;
|
|
||||||
const SYS = linux.SYS;
|
|
||||||
const iovec = std.posix.iovec;
|
|
||||||
const iovec_const = std.posix.iovec_const;
|
|
||||||
|
|
||||||
const pid_t = linux.pid_t;
|
|
||||||
const uid_t = linux.uid_t;
|
|
||||||
const gid_t = linux.gid_t;
|
|
||||||
const clock_t = linux.clock_t;
|
|
||||||
const stack_t = linux.stack_t;
|
|
||||||
const sigset_t = linux.sigset_t;
|
|
||||||
const sockaddr = linux.sockaddr;
|
|
||||||
const socklen_t = linux.socklen_t;
|
|
||||||
const timespec = linux.timespec;
|
|
||||||
|
|
||||||
pub fn syscall0(number: SYS) u64 {
|
pub fn syscall0(number: SYS) u64 {
|
||||||
return asm volatile ("syscall"
|
return asm volatile ("syscall"
|
||||||
|
|
@ -131,7 +117,7 @@ pub fn clone() callconv(.naked) u64 {
|
||||||
pub const restore = restore_rt;
|
pub const restore = restore_rt;
|
||||||
|
|
||||||
pub fn restore_rt() callconv(.naked) noreturn {
|
pub fn restore_rt() callconv(.naked) noreturn {
|
||||||
switch (@import("builtin").zig_backend) {
|
switch (builtin.zig_backend) {
|
||||||
.stage2_c => asm volatile (
|
.stage2_c => asm volatile (
|
||||||
\\ movl %[number], %%eax
|
\\ movl %[number], %%eax
|
||||||
\\ syscall
|
\\ syscall
|
||||||
|
|
@ -177,28 +163,28 @@ pub const Stat = extern struct {
|
||||||
nlink: u64,
|
nlink: u64,
|
||||||
|
|
||||||
mode: u32,
|
mode: u32,
|
||||||
uid: uid_t,
|
uid: std.os.linux.uid_t,
|
||||||
gid: gid_t,
|
gid: std.os.linux.gid_t,
|
||||||
__pad0: u32,
|
__pad0: u32,
|
||||||
rdev: dev_t,
|
rdev: dev_t,
|
||||||
size: off_t,
|
size: off_t,
|
||||||
blksize: i64,
|
blksize: i64,
|
||||||
blocks: i64,
|
blocks: i64,
|
||||||
|
|
||||||
atim: timespec,
|
atim: std.os.linux.timespec,
|
||||||
mtim: timespec,
|
mtim: std.os.linux.timespec,
|
||||||
ctim: timespec,
|
ctim: std.os.linux.timespec,
|
||||||
__unused: [3]i64,
|
__unused: [3]i64,
|
||||||
|
|
||||||
pub fn atime(self: @This()) timespec {
|
pub fn atime(self: @This()) std.os.linux.timespec {
|
||||||
return self.atim;
|
return self.atim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mtime(self: @This()) timespec {
|
pub fn mtime(self: @This()) std.os.linux.timespec {
|
||||||
return self.mtim;
|
return self.mtim;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctime(self: @This()) timespec {
|
pub fn ctime(self: @This()) std.os.linux.timespec {
|
||||||
return self.ctim;
|
return self.ctim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue