fsutil

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package fsutil provides durable filesystem helpers shared by the agent library and the agent commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileSHA256 added in v0.13.0

func FileSHA256(path string) ([sha256.Size]byte, error)

FileSHA256 returns the SHA-256 digest of the file at path.

func InstallFile

func InstallFile(source, target string, mode os.FileMode) (err error)

InstallFile streams source onto target atomically. Large executables are copied rather than buffered in memory.

func MountedNoexec added in v0.13.0

func MountedNoexec(path string) (bool, error)

MountedNoexec reports whether the filesystem holding path is mounted without permission to run programs from it, so a binary placed there cannot run.

func SyncDir

func SyncDir(path string) error

SyncDir persists a directory entry so newly written names survive a crash.

func SyncFilesystems

func SyncFilesystems(paths ...string) error

SyncFilesystems persists every filesystem backing the given paths.

func SyncOpenFilesystems

func SyncOpenFilesystems(files []*os.File, syncfs func(int) error) error

SyncOpenFilesystems synchronizes each distinct filesystem once, using open handles that stay valid after teardown removes their paths.

func WriteFileDurable

func WriteFileDurable(path string, data []byte, mode os.FileMode) error

WriteFileDurable also persists newly created parent directories, so the written file cannot outlive the directory entries needed to reach it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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