linux/posix

POSIX declarations used by Linux timing, descriptor, process, pipe, and context-switching helpers.


Constants and schemas

Examples

"linux/posix" use
"control" use

{} () {} [
  EINTR printStack _:;
  WNOHANG printStack _:;
  CLOCK_MONOTONIC printStack _:;
  timespec fieldCount printStack _:;
  itimerspec 1 fieldName printStack _:;
] "main" exportFunction

Expected Output During Compilation

4
1
1
2
"it_value"

Descriptor and context model


Arguments, workflow, and results


Imported functions


Signature examples

Printing imported names during compilation shows exact imported signatures for representative declarations.

"linux/posix" use
"control" use

{} Int32 {} [
  @clock_gettime printStack _:;
  @fcntl printStack _:;
  @pipe printStack _:;
  @waitpid printStack _:;
  @write printStack _:;
  0
] "main" exportFunction

Expected Output During Compilation

{clk_id: Int32; tp: {tv_sec: Intx; tv_nsec: Intx;} Ref;} Int32 {convention: "";} codeRef
{fildes: Int32; cmd: Int32;} Int32 {convention: ""; variadic: TRUE;} codeRef
{filedes: {in: Int32; out: Int32;} Ref;} Int32 {convention: "";} codeRef
{pid: Int32; wstatus: Int32 Ref; options: Int32;} Int32 {convention: "";} codeRef
{fd: Int32; buf: Natx; count: Natx;} Intx {convention: "";} codeRef

Examples

Pipe round-trip

"linux/posix" use
"String" use
"control" use

{} Int32 {} [
  fds: {in: Int32; out: Int32;};
  pipeResult: @fds pipe;
  bytesWritten: 1nx "A" storageAddress fds.out new write;
  byte: 0n8;
  bytesRead: 1nx @byte storageAddress fds.in new read;
  closeIn: fds.in new close;
  closeOut: fds.out new close;
  ("pipe=" pipeResult LF
   "written=" bytesWritten LF
   "read=" bytesRead LF
   "byte=" byte LF
   "closeIn=" closeIn LF
   "closeOut=" closeOut LF) printList
  0
] "main" exportFunction

Expected Output

pipe=0
written=1
read=1
byte=65
closeIn=0
closeOut=0

See also