add Getwd, Fchdir, tests
R=r
DELTA=215 (186 added, 0 deleted, 29 changed)
OCL=28968
CL=28995
diff --git a/src/lib/os/file.go b/src/lib/os/file.go
index d658073..7aa6632 100644
--- a/src/lib/os/file.go
+++ b/src/lib/os/file.go
@@ -284,6 +284,13 @@
return ErrnoToError(e);
}
+// Chdir changes the current working directory to the file,
+// which must be a directory.
+func (f *File) Chdir() Error {
+ r, e := syscall.Fchdir(f.fd);
+ return ErrnoToError(e);
+}
+
// Remove removes the named file or directory.
func Remove(name string) Error {
// System call interface forces us to know