compiler/stage2_l0/src/compiler_filesystem.l0

Module compiler_filesystem

Overview Symbols grouped by source file: compiler/stage2_l0/src/compiler_filesystem.l0

Module: compiler_filesystem

Source: compiler/stage2_l0/src/compiler_filesystem.l0 Language: Dea/L0

Imports / Includes

  • std.vector
  • util.diag
  • std.text
  • std.time
  • std.system
  • std.string
  • std.array
  • sys.rt

Symbols

Variable CFS_PATH_ABSENT

let CFS_PATH_ABSENT: int = 0

No filesystem object exists at the path.

Variable CFS_PATH_REGULAR

let CFS_PATH_REGULAR: int = 1

A regular file exists at the path.

Variable CFS_PATH_DIRECTORY

let CFS_PATH_DIRECTORY: int = 2

A directory exists at the path.

Variable CFS_PATH_OTHER

let CFS_PATH_OTHER: int = 3

A symlink, reparse point, or other unsupported object exists at the path.

Function l0c_fs_mkdir

extern func l0c_fs_mkdir(path: byte*, path_len: int, mode: int) -> int

Function l0c_fs_join_child

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

extern func l0c_fs_path_kind_nofollow(path: byte*, path_len: int) -> int

Function l0c_fs_path_kind_follow

extern func l0c_fs_path_kind_follow(path: byte*, path_len: int) -> int

Function l0c_fs_remove_regular_file

extern func l0c_fs_remove_regular_file(path: byte*, path_len: int) -> int

Function l0c_fs_remove_empty_dir

extern func l0c_fs_remove_empty_dir(path: byte*, path_len: int) -> int

Function l0c_fs_resolve_trusted_temp_parent

extern func l0c_fs_resolve_trusted_temp_parent(path: byte*, path_len: int, output: byte*?, output_capacity: int) -> int

Function cfs_error

func cfs_error(diags: DiagCollector*, code: string, message: string, path: string)

Emit one compiler-filesystem diagnostic without source coordinates.

Function cfs_path_kind

func cfs_path_kind(path: string) -> int

Call the compiler-internal no-follow path classifier.

Function cfs_path_kind_follow

func cfs_path_kind_follow(path: string) -> int

Call the compiler-internal follow path classifier.

Function cfs_join_child

func cfs_join_child(parent: string, child: string) -> string

Join a trusted parent and internal child using actual-host separators.

Function cfs_mkdir

func cfs_mkdir(path: string, mode: int) -> int

Create one directory using the compiler-internal raw-byte ABI.

Function cfs_remove_regular_file

func cfs_remove_regular_file(path: string) -> int

Remove one regular file without following a substituted path.

Function cfs_remove_empty_dir

func cfs_remove_empty_dir(path: string) -> int

Remove one empty real directory through the compiler-internal ABI.

Function cfs_resolve_trusted_temp_parent

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

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

func cfs_select_temp_parent(diags: DiagCollector*) -> string?

Return the first existing temporary-parent directory by stable precedence.

Function cfs_workspace_free

func cfs_workspace_free(self: CompilerWorkspace*)

Release a workspace path bundle after explicit cleanup.

Function cfs_workspace_child

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

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

func cfs_workspace_create(tag: string, diags: DiagCollector*) -> CompilerWorkspace*?

Select, resolve, validate, and exclusively reserve one compiler workspace.

Function cfs_workspace_cleanup

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

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

root: string

CompilerWorkspace Field children

children: StringVector*