Skip to content

Commit aa8e539

Browse files
committed
std.os.linux: clean up a bunch of dead consts
1 parent dc1bc52 commit aa8e539

File tree

16 files changed

+153
-338
lines changed

16 files changed

+153
-338
lines changed

lib/std/os/linux/aarch64.zig

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
const builtin = @import("builtin");
22
const std = @import("../../std.zig");
3-
const maxInt = std.math.maxInt;
4-
const linux = std.os.linux;
5-
const SYS = linux.SYS;
6-
const socklen_t = linux.socklen_t;
7-
const sockaddr = linux.sockaddr;
8-
const iovec = std.posix.iovec;
9-
const iovec_const = std.posix.iovec_const;
10-
const uid_t = linux.uid_t;
11-
const gid_t = linux.gid_t;
12-
const pid_t = linux.pid_t;
13-
const stack_t = linux.stack_t;
14-
const sigset_t = linux.sigset_t;
15-
const timespec = std.os.linux.timespec;
3+
const SYS = std.os.linux.SYS;
164

175
pub fn syscall0(number: SYS) u64 {
186
return asm volatile ("svc #0"
@@ -135,7 +123,7 @@ pub fn clone() callconv(.naked) u64 {
135123
pub const restore = restore_rt;
136124

137125
pub fn restore_rt() callconv(.naked) noreturn {
138-
switch (@import("builtin").zig_backend) {
126+
switch (builtin.zig_backend) {
139127
.stage2_c => asm volatile (
140128
\\ mov x8, %[number]
141129
\\ svc #0
@@ -170,28 +158,28 @@ pub const Stat = extern struct {
170158
ino: ino_t,
171159
mode: mode_t,
172160
nlink: nlink_t,
173-
uid: uid_t,
174-
gid: gid_t,
161+
uid: std.os.linux.uid_t,
162+
gid: std.os.linux.gid_t,
175163
rdev: dev_t,
176164
__pad: u64,
177165
size: off_t,
178166
blksize: blksize_t,
179167
__pad2: i32,
180168
blocks: blkcnt_t,
181-
atim: timespec,
182-
mtim: timespec,
183-
ctim: timespec,
169+
atim: std.os.linux.timespec,
170+
mtim: std.os.linux.timespec,
171+
ctim: std.os.linux.timespec,
184172
__unused: [2]u32,
185173

186-
pub fn atime(self: @This()) timespec {
174+
pub fn atime(self: @This()) std.os.linux.timespec {
187175
return self.atim;
188176
}
189177

190-
pub fn mtime(self: @This()) timespec {
178+
pub fn mtime(self: @This()) std.os.linux.timespec {
191179
return self.mtim;
192180
}
193181

194-
pub fn ctime(self: @This()) timespec {
182+
pub fn ctime(self: @This()) std.os.linux.timespec {
195183
return self.ctim;
196184
}
197185
};

lib/std/os/linux/arm.zig

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1+
const builtin = @import("builtin");
12
const std = @import("../../std.zig");
2-
const maxInt = std.math.maxInt;
3-
const linux = std.os.linux;
4-
const SYS = linux.SYS;
5-
const iovec = std.posix.iovec;
6-
const iovec_const = std.posix.iovec_const;
7-
const socklen_t = linux.socklen_t;
8-
const stack_t = linux.stack_t;
9-
const sigset_t = linux.sigset_t;
10-
const uid_t = linux.uid_t;
11-
const gid_t = linux.gid_t;
12-
const pid_t = linux.pid_t;
13-
const sockaddr = linux.sockaddr;
14-
const timespec = linux.timespec;
3+
const SYS = std.os.linux.SYS;
154

165
pub fn syscall0(number: SYS) u32 {
176
return asm volatile ("svc #0"
@@ -128,7 +117,7 @@ pub fn clone() callconv(.naked) u32 {
128117
}
129118

130119
pub fn restore() callconv(.naked) noreturn {
131-
switch (@import("builtin").zig_backend) {
120+
switch (builtin.zig_backend) {
132121
.stage2_c => asm volatile (
133122
\\ mov r7, %[number]
134123
\\ svc #0
@@ -144,7 +133,7 @@ pub fn restore() callconv(.naked) noreturn {
144133
}
145134

146135
pub fn restore_rt() callconv(.naked) noreturn {
147-
switch (@import("builtin").zig_backend) {
136+
switch (builtin.zig_backend) {
148137
.stage2_c => asm volatile (
149138
\\ mov r7, %[number]
150139
\\ svc #0
@@ -206,27 +195,27 @@ pub const Stat = extern struct {
206195
__ino_truncated: u32,
207196
mode: mode_t,
208197
nlink: nlink_t,
209-
uid: uid_t,
210-
gid: gid_t,
198+
uid: std.os.linux.uid_t,
199+
gid: std.os.linux.gid_t,
211200
rdev: dev_t,
212201
__rdev_padding: u32,
213202
size: off_t,
214203
blksize: blksize_t,
215204
blocks: blkcnt_t,
216-
atim: timespec,
217-
mtim: timespec,
218-
ctim: timespec,
205+
atim: std.os.linux.timespec,
206+
mtim: std.os.linux.timespec,
207+
ctim: std.os.linux.timespec,
219208
ino: ino_t,
220209

221-
pub fn atime(self: @This()) timespec {
210+
pub fn atime(self: @This()) std.os.linux.timespec {
222211
return self.atim;
223212
}
224213

225-
pub fn mtime(self: @This()) timespec {
214+
pub fn mtime(self: @This()) std.os.linux.timespec {
226215
return self.mtim;
227216
}
228217

229-
pub fn ctime(self: @This()) timespec {
218+
pub fn ctime(self: @This()) std.os.linux.timespec {
230219
return self.ctim;
231220
}
232221
};

lib/std/os/linux/hexagon.zig

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
const builtin = @import("builtin");
22
const std = @import("../../std.zig");
3-
const iovec = std.posix.iovec;
4-
const iovec_const = std.posix.iovec_const;
5-
const linux = std.os.linux;
6-
const SYS = linux.SYS;
7-
const uid_t = std.os.linux.uid_t;
8-
const gid_t = std.os.linux.gid_t;
9-
const pid_t = std.os.linux.pid_t;
10-
const sockaddr = linux.sockaddr;
11-
const socklen_t = linux.socklen_t;
12-
const stack_t = linux.stack_t;
13-
const sigset_t = linux.sigset_t;
14-
const timespec = std.os.linux.timespec;
3+
const SYS = std.os.linux.SYS;
154

165
pub fn syscall0(number: SYS) u32 {
176
return asm volatile ("trap0(#1)"
@@ -145,28 +134,28 @@ pub const Stat = extern struct {
145134
ino: ino_t,
146135
mode: mode_t,
147136
nlink: nlink_t,
148-
uid: uid_t,
149-
gid: gid_t,
137+
uid: std.os.linux.uid_t,
138+
gid: std.os.linux.gid_t,
150139
rdev: dev_t,
151140
__pad: u32,
152141
size: off_t,
153142
blksize: blksize_t,
154143
__pad2: i32,
155144
blocks: blkcnt_t,
156-
atim: timespec,
157-
mtim: timespec,
158-
ctim: timespec,
145+
atim: std.os.linux.timespec,
146+
mtim: std.os.linux.timespec,
147+
ctim: std.os.linux.timespec,
159148
__unused: [2]u32,
160149

161-
pub fn atime(self: @This()) timespec {
150+
pub fn atime(self: @This()) std.os.linux.timespec {
162151
return self.atim;
163152
}
164153

165-
pub fn mtime(self: @This()) timespec {
154+
pub fn mtime(self: @This()) std.os.linux.timespec {
166155
return self.mtim;
167156
}
168157

169-
pub fn ctime(self: @This()) timespec {
158+
pub fn ctime(self: @This()) std.os.linux.timespec {
170159
return self.ctim;
171160
}
172161
};

lib/std/os/linux/loongarch64.zig

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
const builtin = @import("builtin");
22
const std = @import("../../std.zig");
3-
const linux = std.os.linux;
4-
const SYS = linux.SYS;
5-
const iovec = std.posix.iovec;
6-
const iovec_const = std.posix.iovec_const;
7-
const uid_t = linux.uid_t;
8-
const gid_t = linux.gid_t;
9-
const stack_t = linux.stack_t;
10-
const sigset_t = linux.sigset_t;
11-
const sockaddr = linux.sockaddr;
12-
const socklen_t = linux.socklen_t;
13-
const timespec = linux.timespec;
3+
const SYS = std.os.linux.SYS;
144

155
pub fn syscall0(number: SYS) u64 {
166
return asm volatile (
@@ -150,28 +140,28 @@ pub const Stat = extern struct {
150140
ino: ino_t,
151141
mode: mode_t,
152142
nlink: nlink_t,
153-
uid: uid_t,
154-
gid: gid_t,
143+
uid: std.os.linux.uid_t,
144+
gid: std.os.linux.gid_t,
155145
rdev: dev_t,
156146
_pad1: u64,
157147
size: off_t,
158148
blksize: blksize_t,
159149
_pad2: i32,
160150
blocks: blkcnt_t,
161-
atim: timespec,
162-
mtim: timespec,
163-
ctim: timespec,
151+
atim: std.os.linux.timespec,
152+
mtim: std.os.linux.timespec,
153+
ctim: std.os.linux.timespec,
164154
_pad3: [2]u32,
165155

166-
pub fn atime(self: @This()) timespec {
156+
pub fn atime(self: @This()) std.os.linux.timespec {
167157
return self.atim;
168158
}
169159

170-
pub fn mtime(self: @This()) timespec {
160+
pub fn mtime(self: @This()) std.os.linux.timespec {
171161
return self.mtim;
172162
}
173163

174-
pub fn ctime(self: @This()) timespec {
164+
pub fn ctime(self: @This()) std.os.linux.timespec {
175165
return self.ctim;
176166
}
177167
};

lib/std/os/linux/m68k.zig

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
const builtin = @import("builtin");
22
const std = @import("../../std.zig");
3-
const iovec = std.posix.iovec;
4-
const iovec_const = std.posix.iovec_const;
5-
const linux = std.os.linux;
6-
const SYS = linux.SYS;
7-
const uid_t = std.os.linux.uid_t;
8-
const gid_t = std.os.linux.uid_t;
9-
const pid_t = std.os.linux.pid_t;
10-
const sockaddr = linux.sockaddr;
11-
const socklen_t = linux.socklen_t;
12-
const timespec = std.os.linux.timespec;
3+
const SYS = std.os.linux.SYS;
134

145
pub fn syscall0(number: SYS) u32 {
156
return asm volatile ("trap #0"
@@ -166,27 +157,27 @@ pub const Stat = extern struct {
166157
__ino_truncated: i32,
167158
mode: mode_t,
168159
nlink: nlink_t,
169-
uid: uid_t,
170-
gid: gid_t,
160+
uid: std.os.linux.uid_t,
161+
gid: std.os.linux.gid_t,
171162
rdev: dev_t,
172163
__pad2: i16,
173164
size: off_t,
174165
blksize: blksize_t,
175166
blocks: blkcnt_t,
176-
atim: timespec,
177-
mtim: timespec,
178-
ctim: timespec,
167+
atim: std.os.linux.timespec,
168+
mtim: std.os.linux.timespec,
169+
ctim: std.os.linux.timespec,
179170
ino: ino_t,
180171

181-
pub fn atime(self: @This()) timespec {
172+
pub fn atime(self: @This()) std.os.linux.timespec {
182173
return self.atim;
183174
}
184175

185-
pub fn mtime(self: @This()) timespec {
176+
pub fn mtime(self: @This()) std.os.linux.timespec {
186177
return self.mtim;
187178
}
188179

189-
pub fn ctime(self: @This()) timespec {
180+
pub fn ctime(self: @This()) std.os.linux.timespec {
190181
return self.ctim;
191182
}
192183
};

lib/std/os/linux/mips.zig

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
const builtin = @import("builtin");
22
const std = @import("../../std.zig");
3-
const maxInt = std.math.maxInt;
4-
const linux = std.os.linux;
5-
const SYS = linux.SYS;
6-
const socklen_t = linux.socklen_t;
7-
const iovec = std.posix.iovec;
8-
const iovec_const = std.posix.iovec_const;
9-
const uid_t = linux.uid_t;
10-
const gid_t = linux.gid_t;
11-
const pid_t = linux.pid_t;
12-
const stack_t = linux.stack_t;
13-
const sigset_t = linux.sigset_t;
14-
const sockaddr = linux.sockaddr;
15-
const timespec = linux.timespec;
3+
const SYS = std.os.linux.SYS;
164

175
pub fn syscall0(number: SYS) u32 {
186
return asm volatile (
@@ -264,39 +252,27 @@ pub const Stat = extern struct {
264252
ino: ino_t,
265253
mode: mode_t,
266254
nlink: nlink_t,
267-
uid: uid_t,
268-
gid: gid_t,
255+
uid: std.os.linux.uid_t,
256+
gid: std.os.linux.gid_t,
269257
rdev: dev_t,
270258
__pad1: [2]u32,
271259
size: off_t,
272-
atim: i32,
273-
atim_nsec: i32,
274-
mtim: i32,
275-
mtim_nsec: i32,
276-
ctim: i32,
277-
ctim_nsec: i32,
260+
atim: std.os.linux.timespec,
261+
mtim: std.os.linux.timespec,
262+
ctim: std.os.linux.timespec,
278263
blksize: blksize_t,
279264
__pad3: u32,
280265
blocks: blkcnt_t,
281266

282-
pub fn atime(self: @This()) timespec {
283-
return .{
284-
.sec = self.atim,
285-
.nsec = self.atim_nsec,
286-
};
267+
pub fn atime(self: @This()) std.os.linux.timespec {
268+
return self.atim;
287269
}
288270

289-
pub fn mtime(self: @This()) timespec {
290-
return .{
291-
.sec = self.mtim,
292-
.nsec = self.mtim_nsec,
293-
};
271+
pub fn mtime(self: @This()) std.os.linux.timespec {
272+
return self.mtim;
294273
}
295274

296-
pub fn ctime(self: @This()) timespec {
297-
return .{
298-
.sec = self.ctim,
299-
.nsec = self.ctim_nsec,
300-
};
275+
pub fn ctime(self: @This()) std.os.linux.timespec {
276+
return self.ctim;
301277
}
302278
};

0 commit comments

Comments
 (0)