Documentation
¶
Index ¶
- Variables
- func CopyRegularFileByPath(src, dst string) error
- func CopyRegularFileByRelativePath(srcName string, dstDir *os.File, dstName string) error
- func CreateAt(dir *os.File, relativePath string) (*os.File, error)
- func Dup(file *os.File) (*os.File, error)
- func IsDirEmpty(pathname string) (bool, error)
- func IsRegularFile(name string) (bool, error)
- func MkdirAllAtExist(dir *os.File, relativePath string, perm fs.FileMode) error
- func MkdirAt(dir *os.File, relativePath string, perm fs.FileMode) error
- func MkdirAtExist(dir *os.File, relativePath string, perm fs.FileMode) error
- func NewProtectedReader(data []byte) io.ReaderAt
- func OpenAt(dir *os.File, relativePath string, flags int, perm fs.FileMode) (*os.File, error)
- func OpenExistingDir(p string) (*os.File, error)
- func RemoveAt(dir *os.File, relativePath string, flags int) error
- func RenameAt(olddir *os.File, oldpath string, newdir *os.File, newpath string) error
Constants ¶
This section is empty.
Variables ¶
var ErrMemoryAccess = errors.New("invalid memory access")
Functions ¶
func CopyRegularFileByPath ¶
CopyRegularFileByPath copies a file from src to dst
func CopyRegularFileByRelativePath ¶
CopyRegularFileByRelativePath copies a file from src to dst, where destination is relative to a given directory. This function needs needed capabilities to be set before it is called.
func CreateAt ¶
CreateAt implements the same logic as os.Create using directory FD and relative path.
func IsDirEmpty ¶
IsDirEmpty returns true if directory contains no files
func IsRegularFile ¶
IsRegularFile checks if the given file name points to a regular file
func MkdirAllAtExist ¶
MkdirAllAtExist recursively creates a directory and all necessary parents using mkdirat, ignoring EEXIST errors.
func MkdirAtExist ¶
MkdirAtExist is a wrapper function to the `mkdirat` syscall using golang types, ignoring EEXIST error.
func NewProtectedReader ¶
NewProtectedReader returns an io.ReaderAt that wraps around a byte slice. Unlike the reader returned from bytes.NewReader(), this reader protects the reading function from fatal errors caused by invalid memory accesses to the underlying byte slice. If a fatal error occurs (e.g. SIGBUS or SIGSEGV), the read simply fails with an error that indicates a bad memory access. This is intended for reading from mmap'ed files, where a change to the file on disk can cause areas of the mapped memory to become invalid, resulting in a SIGBUS when accessing them.
func OpenExistingDir ¶
OpenExistingDir open a directory with given path, and return the os.File of it.
Types ¶
This section is empty.