compiler_filesystem.l0
Module: compiler_filesystem
Source: compiler/stage2_l0/src/compiler_filesystem.l0 Language: Dea/L0
Imports / Includes
std.vectorutil.diagstd.textstd.timestd.systemstd.stringstd.arraysys.rt
Symbols
- CFS_PATH_ABSENT
- CFS_PATH_REGULAR
- CFS_PATH_DIRECTORY
- CFS_PATH_OTHER
- l0c_fs_mkdir
- l0c_fs_join_child
- l0c_fs_path_kind_nofollow
- l0c_fs_path_kind_follow
- l0c_fs_remove_regular_file
- l0c_fs_remove_empty_dir
- l0c_fs_resolve_trusted_temp_parent
- cfs_error
- cfs_path_kind
- cfs_path_kind_follow
- cfs_join_child
- cfs_mkdir
- cfs_remove_regular_file
- cfs_remove_empty_dir
- cfs_resolve_trusted_temp_parent
- cfs_select_temp_parent_from_values
- cfs_select_temp_parent
- cfs_workspace_free
- cfs_workspace_child
- cfs_workspace_create_for_identity
- cfs_workspace_create
- cfs_workspace_cleanup
- cfs_apply_cleanup_status
- CompilerWorkspace
Variable CFS_PATH_ABSENT
1
let CFS_PATH_ABSENT: int = 0
No filesystem object exists at the path.
Variable CFS_PATH_REGULAR
1
let CFS_PATH_REGULAR: int = 1
A regular file exists at the path.
Variable CFS_PATH_DIRECTORY
1
let CFS_PATH_DIRECTORY: int = 2
A directory exists at the path.
Variable CFS_PATH_OTHER
1
let CFS_PATH_OTHER: int = 3
A symlink, reparse point, or other unsupported object exists at the path.
Function l0c_fs_mkdir
1
extern func l0c_fs_mkdir(path: byte*, path_len: int, mode: int) -> int
Function l0c_fs_join_child
1
extern func l0c_fs_join_child(parent: byte*, parent_len: int, child: byte*, child_len: int, output: byte*?, output_capacity: int) -> int
Function l0c_fs_path_kind_nofollow
1
extern func l0c_fs_path_kind_nofollow(path: byte*, path_len: int) -> int
Function l0c_fs_path_kind_follow
1
extern func l0c_fs_path_kind_follow(path: byte*, path_len: int) -> int
Function l0c_fs_remove_regular_file
1
extern func l0c_fs_remove_regular_file(path: byte*, path_len: int) -> int
Function l0c_fs_remove_empty_dir
1
extern func l0c_fs_remove_empty_dir(path: byte*, path_len: int) -> int
Function l0c_fs_resolve_trusted_temp_parent
1
extern func l0c_fs_resolve_trusted_temp_parent(path: byte*, path_len: int, output: byte*?, output_capacity: int) -> int
Function cfs_error
1
func cfs_error(diags: DiagCollector*, code: string, message: string, path: string)
Emit one compiler-filesystem diagnostic without source coordinates.
Function cfs_path_kind
1
func cfs_path_kind(path: string) -> int
Call the compiler-internal no-follow path classifier.
Function cfs_path_kind_follow
1
func cfs_path_kind_follow(path: string) -> int
Call the compiler-internal follow path classifier.
Function cfs_join_child
1
func cfs_join_child(parent: string, child: string) -> string
Join a trusted parent and internal child using actual-host separators.
Function cfs_mkdir
1
func cfs_mkdir(path: string, mode: int) -> int
Create one directory using the compiler-internal raw-byte ABI.
Function cfs_remove_regular_file
1
func cfs_remove_regular_file(path: string) -> int
Remove one regular file without following a substituted path.
Function cfs_remove_empty_dir
1
func cfs_remove_empty_dir(path: string) -> int
Remove one empty real directory through the compiler-internal ABI.
Function cfs_resolve_trusted_temp_parent
1
func cfs_resolve_trusted_temp_parent(path: string) -> string?
Resolve and validate one selected temporary parent.
The support ABI determines the actual host. POSIX validates the complete resolved owner/sticky-bit chain; Windows retains the trusted-parent ACL assumption. Platform-alias environment variables are deliberately ignored.
Parameters:
path: Selected existing directory.
Returns: Canonical trusted path, or null on failure.
Function cfs_select_temp_parent_from_values
1
func cfs_select_temp_parent_from_values(tmpdir: string?, temp: string?, tmp: string?, system_tmp: string, fallback: string, diags: DiagCollector*) -> string?
Select a temporary parent from explicit candidate values.
Empty values, absent paths, and non-directories fall through. Inspection errors are fatal; once a directory is selected, canonical resolution and trust validation are also authoritative.
The explicit system_tmp and fallback parameters are an internal test seam. Production supplies /tmp and . respectively.
Function cfs_select_temp_parent
1
func cfs_select_temp_parent(diags: DiagCollector*) -> string?
Return the first existing temporary-parent directory by stable precedence.
Function cfs_workspace_free
1
func cfs_workspace_free(self: CompilerWorkspace*)
Release a workspace path bundle after explicit cleanup.
Function cfs_workspace_child
1
func cfs_workspace_child(workspace: CompilerWorkspace*, leaf: string) -> string
Register and return one fixed driver-selected workspace child.
Parameters:
workspace: Workspace that owns the child.leaf: Fixed child filename.
Returns: Joined child path.
Function cfs_workspace_create_for_identity
1
func cfs_workspace_create_for_identity(parent_path: string, tag: string, pid: int, sec: int, nsec: int, diags: DiagCollector*) -> CompilerWorkspace*?
Exclusively reserve one workspace from a deterministic identity tuple.
Pre-existing candidates are skipped and no unchecked fallback is returned.
Function cfs_workspace_create
1
func cfs_workspace_create(tag: string, diags: DiagCollector*) -> CompilerWorkspace*?
Select, resolve, validate, and exclusively reserve one compiler workspace.
Function cfs_workspace_cleanup
1
func cfs_workspace_cleanup(workspace: CompilerWorkspace*, diags: DiagCollector*) -> bool
Remove only known regular children, then the empty owned directory.
Cleanup first verifies the workspace root without following aliases. An unexpected child or substituted path retains the workspace for inspection.
Function cfs_apply_cleanup_status
1
func cfs_apply_cleanup_status(primary_status: int, cleanup_ok: bool) -> int
Apply cleanup failure to a command’s already-determined status.
Cleanup turns success into status 1, while an existing failure or program status remains authoritative.
Struct CompilerWorkspace
Invocation-owned native build/run workspace.
CompilerWorkspace Field root
1
root: string
CompilerWorkspace Field children
1
children: StringVector*