Source File
types.go
Belonging Package
os
// Copyright 2009 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package osimport ()// Getpagesize returns the underlying system's memory page size.func () int { return syscall.Getpagesize() }// File represents an open file descriptor.//// The methods of File are safe for concurrent use.type File struct {*file // os specific}// A FileInfo describes a file and is returned by [Stat] and [Lstat].type FileInfo = fs.FileInfo// A FileMode represents a file's mode and permission bits.// The bits have the same definition on all systems, so that// information about files can be moved from one system// to another portably. Not all bits apply to all systems.// The only required bit is [ModeDir] for directories.type FileMode = fs.FileMode// The defined file mode bits are the most significant bits of the [FileMode].// The nine least-significant bits are the standard Unix rwxrwxrwx permissions.// The values of these bits should be considered part of the public API and// may be used in wire protocols or disk representations: they must not be// changed, although new bits might be added.const (// The single letters are the abbreviations// used by the String method's formatting.ModeDir = fs.ModeDir // d: is a directoryModeAppend = fs.ModeAppend // a: append-onlyModeExclusive = fs.ModeExclusive // l: exclusive useModeTemporary = fs.ModeTemporary // T: temporary file; Plan 9 onlyModeSymlink = fs.ModeSymlink // L: symbolic linkModeDevice = fs.ModeDevice // D: device fileModeNamedPipe = fs.ModeNamedPipe // p: named pipe (FIFO)ModeSocket = fs.ModeSocket // S: Unix domain socketModeSetuid = fs.ModeSetuid // u: setuidModeSetgid = fs.ModeSetgid // g: setgidModeCharDevice = fs.ModeCharDevice // c: Unix character device, when ModeDevice is setModeSticky = fs.ModeSticky // t: stickyModeIrregular = fs.ModeIrregular // ?: non-regular file; nothing else is known about this file// Mask for the type bits. For regular files, none will be set.ModeType = fs.ModeTypeModePerm = fs.ModePerm // Unix permission bits, 0o777)func ( *fileStat) () string { return .name }func ( *fileStat) () bool { return .Mode().IsDir() }// 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.// SameFile only applies to results returned by this package's [Stat].// It returns false in other cases.func (, FileInfo) bool {, := .(*fileStat), := .(*fileStat)if ! || ! {return false}return sameFile(, )}
![]() |
The pages are generated with Golds v0.7.9-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |