os

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package os implements a subset of the Go "os" package. See https://godoc.org/os for details.

Note that the current implementation is blocking. This limitation should be removed in a future version.

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdin  = &File{0, "/dev/stdin"}
	Stdout = &File{1, "/dev/stdout"}
	Stderr = &File{2, "/dev/stderr"}
)

Stdin, Stdout, and Stderr are open Files pointing to the standard input, standard output, and standard error file descriptors.

View Source
var (
	ErrUnsupported = errors.New("operation not supported")
)

Portable analogs of some common system call errors.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File represents an open file descriptor.

func NewFile

func NewFile(fd uintptr, name string) *File

NewFile returns a new File with the given file descriptor and name.

func (*File) Close

func (f *File) Close() error

Close closes the File, rendering it unusable for I/O.

func (*File) Fd

func (f *File) Fd() uintptr

Fd returns the integer Unix file descriptor referencing the open file. The file descriptor is valid only until f.Close is called.

func (*File) Read

func (f *File) Read(b []byte) (n int, err error)

Read reads up to len(b) bytes from the File. It returns the number of bytes read and any error encountered. At end of file, Read returns 0, io.EOF.

func (*File) Write

func (f *File) Write(b []byte) (n int, err error)

Write writes len(b) bytes to the File. It returns the number of bytes written and an error, if any. Write returns a non-nil error when n != len(b).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL