abla/fs/secure
Generated from source.
Import with import "abla/fs/secure".
Source: abla/fs/secure/entry.ab
SecureDirectory (class)
resource class SecureDirectory(var descriptor: int)
Owns a directory descriptor for relative filesystem operations, with a negative descriptor indicating failure.
SecureDirectory.drop (method)
trusted fun drop(): void
Releases the owned directory descriptor and marks it closed.
SecureFile (class)
resource class SecureFile(var descriptor: int)
Owns a file descriptor for bounded I/O, with a negative descriptor indicating failure.
SecureFile.drop (method)
trusted fun drop(): void
Releases the owned file descriptor and marks it closed.
secureDirectory (fun)
fun secureDirectory(path: string): SecureDirectory
The caller chooses and trusts the path's parent; its final component is not followed.
SecureDirectory.openDirectory (extension fun)
trusted fun SecureDirectory.openDirectory(name: string): SecureDirectory
Returns the named child directory without following links, or a negative descriptor for an invalid name, handle, or failed open.
SecureDirectory.openFile (extension fun)
trusted fun SecureDirectory.openFile(name: string): SecureFile
Returns a read-only handle to the named child without following links, or a negative descriptor for an invalid name, handle, or failed open.
SecureDirectory.createFile (extension fun)
trusted fun SecureDirectory.createFile(name: string, mode: int = 0o600): SecureFile
Returns a writable handle to a newly created file, or a negative descriptor if it already exists or creation fails.
SecureDirectory.createDirectory (extension fun)
fun SecureDirectory.createDirectory(name: string, mode: int = 0o700): bool
Returns true if the named child directory was created with the requested mode, or false if validation or creation fails.
SecureDirectory.createDirectoryStatus (extension fun)
trusted fun SecureDirectory.createDirectoryStatus(name: string, mode: int = 0o700): int
Zero on success, otherwise a negative errno.
SecureDirectory.renameNoReplace (extension fun)
trusted fun SecureDirectory.renameNoReplace(name: string, target: SecureDirectory, newName: string): int
Returns zero or negative errno; unsupported platforms/filesystems fail closed.
SecureDirectory.replaceSymlink (extension fun)
trusted fun SecureDirectory.replaceSymlink(name: string, temporary: string, target: string): bool
Creates a new temporary link exclusively, then atomically replaces name. A no-follow stat refuses an existing non-symlink. This check is not atomic with the rename: the parent must be trusted and not writable by hostile actors.
SecureDirectory.remove (extension fun)
trusted fun SecureDirectory.remove(name: string, directory: bool = false): bool
Returns true if the named entry was removed, or false for an invalid name, handle, or failed removal.
SecureDirectory.sync (extension fun)
trusted fun SecureDirectory.sync(): bool
Returns true if changes to the directory were flushed, or false for an invalid descriptor or sync error.
SecureDirectory.syncChecked (extension fun)
trusted fun SecureDirectory.syncChecked(): string
Flushes directory changes and returns an empty string on success or invalid, disk_full, or sync on failure.
SecureFile.sync (extension fun)
trusted fun SecureFile.sync(): bool
Returns true if file changes were flushed, or false for an invalid descriptor or sync error.
SecureFile.syncChecked (extension fun)
trusted fun SecureFile.syncChecked(): string
Flushes file changes and returns an empty string on success or invalid, disk_full, or sync on failure.
SecureFile.write (extension fun)
fun SecureFile.write(contents: string): bool
Returns true if all bytes were written at the current offset, or false for an invalid descriptor or write failure.
SecureFile.writeChecked (extension fun)
trusted fun SecureFile.writeChecked(contents: string): string
An empty result means success; disk-full includes quota exhaustion.
SecureFile.setPermissions (extension fun)
trusted fun SecureFile.setPermissions(mode: int): bool
Returns true if the file's permission bits were set, or false for a mode outside 0..0o777, an invalid descriptor, or an OS error.
SecureDirectory.setPermissions (extension fun)
trusted fun SecureDirectory.setPermissions(mode: int): bool
Returns true if the directory's permission bits were set, or false for a mode outside 0..0o777, an invalid descriptor, or an OS error.
SecureFile.setPermissionsChecked (extension fun)
trusted fun SecureFile.setPermissionsChecked(mode: int): string
Sets the file's permission bits and returns an empty string on success or invalid, disk_full, or permissions on failure.
SecureDirectory.setPermissionsChecked (extension fun)
trusted fun SecureDirectory.setPermissionsChecked(mode: int): string
Sets the directory's permission bits and returns an empty string on success or invalid, disk_full, or permissions on failure.
SecureFile.close (extension fun)
trusted fun SecureFile.close(): bool
Closes and invalidates the file descriptor, returning true if it was already closed or if close succeeds.
SecureDirectory.close (extension fun)
trusted fun SecureDirectory.close(): bool
Closes and invalidates the directory descriptor, returning true if it was already closed or if close succeeds.
SecureReadResult (class)
class SecureReadResult(val data: string, val error: string)
Reads from the handle's current offset through EOF, with a caller-provided byte limit. A one-byte probe detects overflow without trusting a stat size.
SecureChunkResult (class)
class SecureChunkResult(val data: string, val eof: bool, val error: string)
Holds bytes from one bounded read, with EOF marked separately and an empty error string on success.
SecureFile.readChunk (extension fun)
trusted fun SecureFile.readChunk(maxBytes: int): SecureChunkResult
A bounded read advances the open handle; EOF is reported on a zero-byte read.
SecureFile.rewind (extension fun)
trusted fun SecureFile.rewind(): bool
Returns true if the file offset was reset to zero, or false for an invalid or nonseekable descriptor.
SecureFile.duplicate (extension fun)
trusted fun SecureFile.duplicate(): SecureFile
The duplicate has its own lifetime and close-on-exec, but shares the file offset.
SecureFile.read (extension fun)
trusted fun SecureFile.read(maxBytes: int): SecureReadResult
Returns all bytes from the current offset through EOF, or empty data with invalid, read, or limit on failure.
SecureDirectory.openRegularFile (extension fun)
trusted fun SecureDirectory.openRegularFile(name: string): SecureFile
A no-follow open followed by fstat of the opened descriptor. Nonblocking avoids waiting on a planted FIFO before it can be rejected as non-regular.
SecureListResult (class)
class SecureListResult(val names: array<string>, val error: string)
Holds names from one directory scan and an empty error string when the scan succeeds.
SecureDirectory.list (extension fun)
trusted fun SecureDirectory.list(maxEntries: int, maxNameBytes: int): SecureListResult
Opens an independent scan handle, so repeated calls do not consume the caller's directory position. Errors never masquerade as an empty directory.
SecureDirectory.entryKind (extension fun)
trusted fun SecureDirectory.entryKind(name: string): string
A no-follow snapshot only. Open the entry via openRegularFile/openDirectory before using it, because the name may change after this check.
SecureFile.size (extension fun)
trusted fun SecureFile.size(): int
This is only a snapshot; callers must still enforce limits while reading.
SecureFile.permissions (extension fun)
trusted fun SecureFile.permissions(): int
Returns permission and special bits of the opened file, or -1 on error.
SecureDirectory.permissions (extension fun)
trusted fun SecureDirectory.permissions(): int
Returns permission and special bits of the opened directory, or -1 on error.
SecureFile.isRegular (extension fun)
trusted fun SecureFile.isRegular(): bool
The descriptor itself is checked, so replacing the original name cannot turn this into a symlink-following check.
Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.