os: implement file.Seek, add smoke test

This commit is contained in:
Dan Kegel
2022-01-01 07:51:31 -08:00
committed by Ron Evans
parent 84279ab2ec
commit 998f01608c
7 changed files with 91 additions and 5 deletions
+10 -2
View File
@@ -176,9 +176,17 @@ func (f *File) Readdirnames(n int) (names []string, err error) {
return nil, &PathError{"readdirnames", f.name, ErrNotImplemented}
}
// Seek is a stub, not yet implemented
// Seek sets the offset for the next Read or Write on file to offset, interpreted
// according to whence: 0 means relative to the origin of the file, 1 means
// relative to the current offset, and 2 means relative to the end.
// It returns the new offset and an error, if any.
// The behavior of Seek on a file opened with O_APPEND is not specified.
//
// If f is a directory, the behavior of Seek varies by operating
// system; you can seek to the beginning of the directory on Unix-like
// operating systems, but not on Windows.
func (f *File) Seek(offset int64, whence int) (ret int64, err error) {
return 0, &PathError{"seek", f.name, ErrNotImplemented}
return f.handle.Seek(offset, whence)
}
// Stat is a stub, not yet implemented