linux: add mknod and mknodat syscalls

This commit is contained in:
Mahdi Khanalizadeh 2021-07-13 15:35:23 +02:00 committed by Andrew Kelley
parent f5d9d739d7
commit 15bec20b00

View File

@ -253,6 +253,18 @@ pub fn mkdirat(dirfd: i32, path: [*:0]const u8, mode: u32) usize {
return syscall3(.mkdirat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), mode);
}
pub fn mknod(path: [*:0]const u8, mode: u32, dev: u32) usize {
if (@hasField(SYS, "mknod")) {
return syscall3(.mknod, @ptrToInt(path), mode, dev);
} else {
return mknodat(AT_FDCWD, path, mode, dev);
}
}
pub fn mknodat(dirfd: i32, path: [*:0]const u8, mode: u32, dev: u32) usize {
return syscall4(.mknodat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), mode, dev);
}
pub fn mount(special: [*:0]const u8, dir: [*:0]const u8, fstype: [*:0]const u8, flags: u32, data: usize) usize {
return syscall5(.mount, @ptrToInt(special), @ptrToInt(dir), @ptrToInt(fstype), flags, data);
}