From 8654bc18104d64c7a7f9f80bdba75ed4e0c005fa Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 20 Apr 2017 02:26:36 -0400 Subject: delete test_artifacts directory when tests complete * add std.os.deleteTree * add std.os.deleteDir * add std.os.page_size * add std.os API for iterating over directories * refactor duplication in build.zig * update documentation on how to run tests --- std/os/linux.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'std/os/linux.zig') diff --git a/std/os/linux.zig b/std/os/linux.zig index 7c841fafad..1ebade3baf 100644 --- a/std/os/linux.zig +++ b/std/os/linux.zig @@ -241,6 +241,15 @@ pub const AF_NFC = PF_NFC; pub const AF_VSOCK = PF_VSOCK; pub const AF_MAX = PF_MAX; +pub const DT_UNKNOWN = 0; +pub const DT_FIFO = 1; +pub const DT_CHR = 2; +pub const DT_DIR = 4; +pub const DT_BLK = 6; +pub const DT_REG = 8; +pub const DT_LNK = 10; +pub const DT_SOCK = 12; +pub const DT_WHT = 14; fn unsigned(s: i32) -> u32 { *@ptrcast(&u32, &s) } fn signed(s: u32) -> i32 { *@ptrcast(&i32, &s) } @@ -273,6 +282,10 @@ pub fn getcwd(buf: &u8, size: usize) -> usize { arch.syscall2(arch.SYS_getcwd, usize(buf), size) } +pub fn getdents(fd: i32, dirp: &u8, count: usize) -> usize { + arch.syscall3(arch.SYS_getdents, usize(fd), usize(dirp), usize(count)) +} + pub fn mkdir(path: &const u8, mode: usize) -> usize { arch.syscall2(arch.SYS_mkdir, usize(path), mode) } @@ -291,6 +304,10 @@ pub fn read(fd: i32, buf: &u8, count: usize) -> usize { arch.syscall3(arch.SYS_read, usize(fd), usize(buf), count) } +pub fn rmdir(path: &const u8) -> usize { + arch.syscall1(arch.SYS_rmdir, usize(path)) +} + pub fn symlink(existing: &const u8, new: &const u8) -> usize { arch.syscall2(arch.SYS_symlink, usize(existing), usize(new)) } -- cgit v1.2.3