fsutil

package
v0.0.0-...-799fb6b Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fsutil contains filesystem utilities that can be shared between the sentry and other sandbox components.

Index

Constants

This section is empty.

Variables

View Source
var UnixDirentMaxSize = int(unsafe.Sizeof(unix.Dirent{}))

UnixDirentMaxSize is the maximum size of unix.Dirent in bytes.

Functions

func DirentNames

func DirentNames(dirfd int) ([]string, error)

DirentNames retrieves all dirents from dirfd using getdents64(2) and returns all the recorded dirent names.

func ForEachDirent

func ForEachDirent(dirfd int, handleDirent DirentHandler) error

ForEachDirent retrieves all dirents from dirfd using getdents64(2) and invokes handleDirent on them.

func ParseDirents

func ParseDirents(buf []byte, handleDirent DirentHandler)

ParseDirents parses dirents from buf. buf must have been populated by getdents64(2) syscall. It calls the handleDirent callback for each dirent.

func RenameAt

func RenameAt(oldDirFD int, oldName string, newDirFD int, newName string) error

RenameAt is a convenience wrapper to make the renameat(2) syscall. It additionally handles empty names.

func StatAt

func StatAt(dirFd int, name string) (unix.Stat_t, error)

StatAt is a convenience wrapper around newfstatat(2).

func Utimensat

func Utimensat(dirFd int, name string, times [2]unix.Timespec, flags int) error

Utimensat is a convenience wrapper to make the utimensat(2) syscall. It additionally handles empty name.

Types

type DirentHandler

type DirentHandler func(ino uint64, off int64, ftype uint8, name string, reclen uint16)

DirentHandler is a function that handles a dirent.

Jump to

Keyboard shortcuts

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