Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/os/file_anyos.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ func init() {
// Stdin, Stdout, and Stderr are open Files pointing to the standard input,
// standard output, and standard error file descriptors.
var (
Stdin = NewFile(unixFileHandle(syscall.Stdin), "/dev/stdin")
Stdout = NewFile(unixFileHandle(syscall.Stdout), "/dev/stdout")
Stderr = NewFile(unixFileHandle(syscall.Stderr), "/dev/stderr")
Stdin = NewFile(uintptr(syscall.Stdin), "/dev/stdin")
Stdout = NewFile(uintptr(syscall.Stdout), "/dev/stdout")
Stderr = NewFile(uintptr(syscall.Stderr), "/dev/stderr")
)

const DevNull = "/dev/null"
Expand Down Expand Up @@ -87,9 +87,9 @@ func (fs unixFilesystem) Remove(path string) error {
return &PathError{Op: "remove", Path: path, Err: e}
}

func (fs unixFilesystem) OpenFile(path string, flag int, perm FileMode) (FileHandle, error) {
func (fs unixFilesystem) OpenFile(path string, flag int, perm FileMode) (uintptr, error) {
fp, err := syscall.Open(path, flag, uint32(perm))
return unixFileHandle(fp), handleSyscallError(err)
return uintptr(fp), handleSyscallError(err)
}

// unixFileHandle is a Unix file pointer with associated methods that implement
Expand Down
10 changes: 5 additions & 5 deletions src/os/file_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
// Stdin, Stdout, and Stderr are open Files pointing to the standard input,
// standard output, and standard error file descriptors.
var (
Stdin = NewFile(stdioFileHandle(0), "/dev/stdin")
Stdout = NewFile(stdioFileHandle(1), "/dev/stdout")
Stderr = NewFile(stdioFileHandle(2), "/dev/stderr")
Stdin = NewFile(0, "/dev/stdin")
Stdout = NewFile(1, "/dev/stdout")
Stderr = NewFile(2, "/dev/stderr")
)

// isOS indicates whether we're running on a real operating system with
Expand All @@ -32,8 +32,8 @@ type file struct {
name string
}

func NewFile(fd FileHandle, name string) *File {
return &File{&file{fd, name}}
func NewFile(fd uintptr, name string) *File {
return &File{&file{stdioFileHandle(fd), name}}
}

// Read is unsupported on this system.
Expand Down
8 changes: 4 additions & 4 deletions src/os/file_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type file struct {
dirinfo *dirInfo // nil unless directory being read
}

func NewFile(fd FileHandle, name string) *File {
return &File{&file{fd, name, nil}}
func NewFile(fd uintptr, name string) *File {
return &File{&file{unixFileHandle(fd), name, nil}}
}

func Pipe() (r *File, w *File, err error) {
Expand All @@ -48,8 +48,8 @@ func Pipe() (r *File, w *File, err error) {
if err != nil {
return
}
r = NewFile(unixFileHandle(p[0]), "|0")
w = NewFile(unixFileHandle(p[1]), "|1")
r = NewFile(uintptr(p[0]), "|0")
w = NewFile(uintptr(p[1]), "|1")
return
}

Expand Down
14 changes: 4 additions & 10 deletions src/os/file_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type file struct {
name string
}

func NewFile(fd FileHandle, name string) *File {
return &File{&file{fd, name}}
func NewFile(fd uintptr, name string) *File {
return &File{&file{unixFileHandle(fd), name}}
}

func Pipe() (r *File, w *File, err error) {
Expand All @@ -48,14 +48,8 @@ func Pipe() (r *File, w *File, err error) {
if e != nil {
return nil, nil, err
}
r = NewFile(
unixFileHandle(p[0]),
"|0",
)
w = NewFile(
unixFileHandle(p[1]),
"|1",
)
r = NewFile(uintptr(p[0]), "|0")
w = NewFile(uintptr(p[1]), "|1")
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/os/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type mountPoint struct {
// WARNING: this interface is not finalized and may change in a future version.
type Filesystem interface {
// OpenFile opens the named file.
OpenFile(name string, flag int, perm FileMode) (FileHandle, error)
OpenFile(name string, flag int, perm FileMode) (uintptr, error)

// Mkdir creates a new directoy with the specified permission (before
// umask). Some filesystems may not support directories or permissions.
Expand Down