| ... | @@ -106,12 +106,22 @@ pub fn getcwd(buf: [*]u8, size: usize) usize { | ... | @@ -106,12 +106,22 @@ pub fn getcwd(buf: [*]u8, size: usize) usize { |
| 106 | return syscall2(SYS_getcwd, @ptrToInt(buf), size); | 106 | return syscall2(SYS_getcwd, @ptrToInt(buf), size); |
| 107 | } | 107 | } |
| 108 | | 108 | |
| 109 | pub fn getdents(fd: i32, dirp: [*]u8, count: usize) usize { | 109 | pub fn getdents(fd: i32, dirp: [*]u8, len: usize) usize { |
| 110 | return syscall3(SYS_getdents, @bitCast(usize, isize(fd)), @ptrToInt(dirp), count); | 110 | return syscall3( |
| | 111 | SYS_getdents, |
| | 112 | @bitCast(usize, isize(fd)), |
| | 113 | @ptrToInt(dirp), |
| | 114 | std.math.min(len, maxInt(c_int)), |
| | 115 | ); |
| 111 | } | 116 | } |
| 112 | | 117 | |
| 113 | pub fn getdents64(fd: i32, dirp: [*]u8, count: usize) usize { | 118 | pub fn getdents64(fd: i32, dirp: [*]u8, len: usize) usize { |
| 114 | return syscall3(SYS_getdents64, @bitCast(usize, isize(fd)), @ptrToInt(dirp), count); | 119 | return syscall3( |
| | 120 | SYS_getdents64, |
| | 121 | @bitCast(usize, isize(fd)), |
| | 122 | @ptrToInt(dirp), |
| | 123 | std.math.min(len, maxInt(c_int)), |
| | 124 | ); |
| 115 | } | 125 | } |
| 116 | | 126 | |
| 117 | pub fn inotify_init1(flags: u32) usize { | 127 | pub fn inotify_init1(flags: u32) usize { |