Skip to content

Modeled C: runtime process-global state outside the errno/environ/locale domains (signals, cwd, fd table, rlimits, process group, stdio streams) #1608

Closed

Description

@ehartford

Stage 13 (ruling §52, spec §16.2b.14) gives every runtime foreign call a domain row for the three libc domains the ruling names — errno (thread), environ (process), locale (process). While enumerating the seams, these other pieces of process-global C state the runtime touches were found. They are outside the ruling's named domains, so they got no domain declaration; each is a candidate refined domain (§35) once a safe user surface can hold a view that depends on it.

Runtime seams by C symbol (rt/darwin_aarch64.w, rt/linux_*.w, rt/windows_*.w):

  • signal disposition and mask: sigaction, sigaltstack, sigprocmask, raise, kill (Windows: AddVectoredExceptionHandler).
  • current working directory: chdir, getcwd (Windows: SetCurrentDirectoryW, GetCurrentDirectoryW).
  • file-descriptor table: dup2, fcntl, open/close (a view over a descriptor number is a view of process state).
  • resource limits: setrlimit, getrlimit.
  • process group / children: setpgid, wait4.
  • stdio stream objects: reached as variables, not calls — extern var __stdinp/__stdoutp/__stderrp (Darwin), stdin/stdout/stderr (glibc), __acrt_iob_func (UCRT); buffers behind them are process-global.
  • std.libc additionally exports rand/srand (PRNG state) and setlocale/strerror/perror to migrated corpora; the runtime itself calls none of them (random bytes come from arc4random_buf/getrandom/SystemFunction036/random_get).

What the rows already say: every such call is a row under the three named domains (invalidate by default), so adding, say, a domain cwd process later is a refinement of existing rows, not a new obligation on the audit lane — runtime-domain-audit requires a row per foreign extern, whatever domains the facade declares, and requires the three named ones.

Decision needed (Eric): which of these become declared runtime domains, under what names, and whether the toolchain libc facade (src/compiler/LibcFacade.w) should expose any of them to user programs (e.g. getcwd text borrowed from a cwd domain).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions