Documentation
¶
Index ¶
- Constants
- func Nice() (int, error)
- func Renice(_ int) error
- func SameDevice(fi1, fi2 FileInfo) bool
- func SameDevices(name1, name2 string) bool
- func SameFile(fi1, fi2 FileInfo) bool
- func SameFiles(name1, name2 string) bool
- func Supports(function SupportedType) bool
- type FileInfo
- type InvalidNiceError
- type NiceError
- type ReniceError
- type SupportedType
Constants ¶
const ( // MaxNice is the maximum value returned by Nice(). MaxNice = 19 // MinNice is the minimum value returned by Nice(). MinNice = -20 )
Variables ¶
This section is empty.
Functions ¶
func Nice ¶ added in v0.2.0
Nice gets the CPU process priority. The return value is in a range from -20 (least nice), to 19 (most nice), even on non-Unix systems such as Windows, plan9, etc. If not supported by the operating system, -1 is returned.
func Renice ¶ added in v0.2.0
Renice sets the CPU process priority. The nice parameter can range from -20 (least nice), to 19 (most nice), even on non-Unix systems such as Windows, plan9, etc.
func SameDevice ¶
SameDevice reports whether fi1 and fi2 describe files on the same device. For example, on Unix this means that the device fields of the two underlying structures are identical; on other systems the decision may be based on the path names. SameDevice only applies to results returned by this package's Stat. It returns false in other cases.
func SameDevices ¶
SameDevices reports whether name1 and name2 are files on the same device. The function follow symlinks.
func SameFile ¶
SameFile reports whether fi1 and fi2 describe the same file. For example, on Unix this means that the device and inode fields of the two underlying structures are identical; on other systems the decision may be based on the path names. SameDevice only applies to results returned by this package's Stat. It returns false in other cases.
func SameFiles ¶
SameFiles reports whether name1 and name2 are the same file. The function follow symlinks.
func Supports ¶
func Supports(function SupportedType) bool
Supports returns whether function is supported by the operating system.
Types ¶
type FileInfo ¶
type FileInfo interface {
Name() string // base name of the file
Size() int64 // length in bytes for regular files; system-dependent for others
Mode() os.FileMode // file mode bits
ModTime() time.Time // last modified time
IsDir() bool // abbreviation for Mode().IsDir()
Sys() any // underlying data source
DeviceID() uint64 // device ID
FileID() uint64 // file ID
Links() uint64 // number of hard links, or 0 if unsupported
ATime() time.Time // last accessed time, or 0 if unsupported
BTime() time.Time // birth (created) time, or 0 if unsupported
CTime() time.Time // last changed time, or 0 if unsupported
MTime() time.Time // last modified time (alias)
UID() uint64 // user ID, or 0 if unsupported
GID() uint64 // group ID, or 0 if unsupported
}
A FileInfo describes a file and is returned by Stat. See https://github.com/golang/go/blob/ad7a6f81/src/io/fs/fs.go#L158
func Lstat ¶
Lstat returns a FileInfo describing the named file. If the file is a symbolic link, the returned FileInfo describes the symbolic link. Lstat makes no attempt to follow the link. If there is an error, it will be of type [*PathError].
On Windows, if the file is a reparse point that is a surrogate for another named entity (such as a symbolic link or mounted folder), the returned FileInfo describes the reparse point, and makes no attempt to resolve it.
type InvalidNiceError ¶ added in v0.2.0
type InvalidNiceError struct {
// contains filtered or unexported fields
}
InvalidNiceError is returned when the niceness value passed by the user is invalid.
func (*InvalidNiceError) Error ¶ added in v0.2.0
func (e *InvalidNiceError) Error() string
type NiceError ¶ added in v0.2.0
type NiceError struct {
// contains filtered or unexported fields
}
NiceError is returned when system call failed.
type ReniceError ¶ added in v0.2.0
type ReniceError struct {
// contains filtered or unexported fields
}
ReniceError is returned when the system failed to set the OS's niceness level.
func (*ReniceError) Error ¶ added in v0.2.0
func (e *ReniceError) Error() string
type SupportedType ¶ added in v0.2.0
type SupportedType uint
SupportedType defines a bitmask that identifies if the OS supports specific fields, or not.
const ( // Links defines if FileInfo's Links() function is supported by the OS. // Links() returns the number of hard links to the file. Links SupportedType = 1 << iota // ATime defines if FileInfo's ATime() function is supported by the OS. // ATime() returns the time the file was last accessed. ATime // BTime defines if FileInfo's BTime() function is supported by the OS. // BTime() returns the time the file was created (or "birthed"). BTime // CTime defines if FileInfo's CTime() function is supported by the OS. // CTime() returns the time the file's metadata was last changed. CTime // UID defines if FileInfo's UID() function is supported by the OS. // UID() returns the user ID of the file's owner. UID // GID defines if FileInfo's GID() function is supported by the OS. // GID() returns the group ID of the file's group. GID )