@@ -2,11 +2,15 @@ const builtin = @import("builtin");
2
2
const std = @import ("../../std.zig" );
3
3
const linux = std .os .linux ;
4
4
const SYS = linux .SYS ;
5
- const iovec = std .os .iovec ;
5
+ const iovec = std .posix .iovec ;
6
+ const iovec_const = std .posix .iovec_const ;
6
7
const uid_t = linux .uid_t ;
7
8
const gid_t = linux .gid_t ;
8
9
const stack_t = linux .stack_t ;
9
10
const sigset_t = linux .sigset_t ;
11
+ const sockaddr = linux .sockaddr ;
12
+ const socklen_t = linux .socklen_t ;
13
+ const timespec = linux .timespec ;
10
14
11
15
pub fn syscall0 (number : SYS ) usize {
12
16
return asm volatile (
@@ -150,6 +154,30 @@ pub fn restore_rt() callconv(.naked) noreturn {
150
154
);
151
155
}
152
156
157
+ pub const msghdr = extern struct {
158
+ name : ? * sockaddr ,
159
+ namelen : socklen_t ,
160
+ iov : [* ]iovec ,
161
+ iovlen : i32 ,
162
+ __pad1 : i32 = 0 ,
163
+ control : ? * anyopaque ,
164
+ controllen : socklen_t ,
165
+ __pad2 : socklen_t = 0 ,
166
+ flags : i32 ,
167
+ };
168
+
169
+ pub const msghdr_const = extern struct {
170
+ name : ? * const sockaddr ,
171
+ namelen : socklen_t ,
172
+ iov : [* ]const iovec_const ,
173
+ iovlen : i32 ,
174
+ __pad1 : i32 = 0 ,
175
+ control : ? * const anyopaque ,
176
+ controllen : socklen_t ,
177
+ __pad2 : socklen_t = 0 ,
178
+ flags : i32 ,
179
+ };
180
+
153
181
pub const blksize_t = i32 ;
154
182
pub const nlink_t = u32 ;
155
183
pub const time_t = i64 ;
@@ -159,6 +187,38 @@ pub const ino_t = u64;
159
187
pub const dev_t = u32 ;
160
188
pub const blkcnt_t = i64 ;
161
189
190
+ // The `stat` definition used by the Linux kernel.
191
+ pub const Stat = extern struct {
192
+ dev : dev_t ,
193
+ ino : ino_t ,
194
+ mode : mode_t ,
195
+ nlink : nlink_t ,
196
+ uid : uid_t ,
197
+ gid : gid_t ,
198
+ rdev : dev_t ,
199
+ _pad1 : u64 ,
200
+ size : off_t ,
201
+ blksize : blksize_t ,
202
+ _pad2 : i32 ,
203
+ blocks : blkcnt_t ,
204
+ atim : timespec ,
205
+ mtim : timespec ,
206
+ ctim : timespec ,
207
+ _pad3 : [2 ]u32 ,
208
+
209
+ pub fn atime (self : @This ()) timespec {
210
+ return self .atim ;
211
+ }
212
+
213
+ pub fn mtime (self : @This ()) timespec {
214
+ return self .mtim ;
215
+ }
216
+
217
+ pub fn ctime (self : @This ()) timespec {
218
+ return self .ctim ;
219
+ }
220
+ };
221
+
162
222
pub const timeval = extern struct {
163
223
tv_sec : time_t ,
164
224
tv_usec : i64 ,
0 commit comments