summaryrefslogtreecommitdiff
path: root/src/lib/syscall/file_linux.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-02-08 10:18:50 -0800
committerRob Pike <r@golang.org>2009-02-08 10:18:50 -0800
commit09c50da40220227bd34dcc9cb28100434305174f (patch)
treeb4c649682549e6ef2355f4b82bbb3e326e229925 /src/lib/syscall/file_linux.go
parent0eb337046a6602996dbc169ff12f4d4fb81fded1 (diff)
downloadgolang-09c50da40220227bd34dcc9cb28100434305174f.tar.gz
First pass at reading directories.
Syscall support. Readdirnames returns array of strings of contents of directory. R=rsc DELTA=216 (201 added, 0 deleted, 15 changed) OCL=24642 CL=24655
Diffstat (limited to 'src/lib/syscall/file_linux.go')
-rw-r--r--src/lib/syscall/file_linux.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/syscall/file_linux.go b/src/lib/syscall/file_linux.go
index 52c1e9040..ceb0a85d7 100644
--- a/src/lib/syscall/file_linux.go
+++ b/src/lib/syscall/file_linux.go
@@ -40,6 +40,11 @@ func Write(fd int64, buf *byte, nbytes int64) (ret int64, errno int64) {
return r1, err;
}
+func Seek(fd int64, offset int64, whence int64) (ret int64, errno int64) {
+ r1, r2, err := Syscall(SYS_LSEEK, fd, offset, whence);
+ return r1, err;
+}
+
func Pipe(fds *[2]int64) (ret int64, errno int64) {
var t [2] int32;
r1, r2, err := Syscall(SYS_PIPE, int64(uintptr(unsafe.Pointer(&t[0]))), 0, 0);
@@ -90,3 +95,8 @@ func Dup2(fd1, fd2 int64) (ret int64, errno int64) {
return r1, err;
}
+func Getdents(fd int64, buf *Dirent, nbytes int64) (ret int64, errno int64) {
+ r1, r2, err := Syscall(SYS_GETDENTS64, fd, int64(uintptr(unsafe.Pointer(buf))), nbytes);
+ return r1, err;
+}
+