ULOS Manual Pages - process(2) | Back
NAME
  process - user-facing process management API
DESCRIPTION
  process is the Cynosure userspace process management API.  Information about running processes is mostly available from /sys/proc.
FUNCTIONS
  spawn(args:table): number
    Spawns a new process.  args may contain any of the following fields (func and name are required):
      {
        func = function,
        name = string,
        stdin = FILE*,
        stdout = FILE*,
        stderr = FILE*,
        input = FILE*,
        output = FILE*
      }
    Returns the process ID of the newly created process.
  kill(pid:number, signal:number): boolean
    If the current user has permission, sends the provided signal to the process whose PID is pid.
  list(): table
    Returns a list of all process IDs.
  await(pid:number): number, string
    Halts the current process until the specified pid no longer exists, then returns its exit status and exit reason.
  message(pid:number, ...)
    Adds the provided message to the process's signal queue.  The message's length must be greater than zero.  This message will be prefixed with "ipc" and the sending process's PID, both for security reasons (otherwise users could spoof arbitrary events to other processes!) and to avoid requiring specification for this in individual process's protocols.
  info([pid:number]): table
    Returns a table of information about the process with the specified pid, defaulting to the current process if a pid is not specified.
      {
        pid = number,
        name = string,
        waiting = boolean,
        stopped = boolean,
        deadline = number,
        n_threads = number,
        status = string,
        cputime = number,
        owner = number
      }
    If the pid points to the current process or is unspecified (and thus has defaulted to the current process), then there will be an additional table field, data:
      {
        io = table,
        self = process,
        handles = table,
        coroutine = table,
        env = table
      }
    Of note is data.env, the process's environment.  The other methods should be fairly self-explanatory.
SIGNALS
  process.signals = {
    hangup = number,
    interrupt = number,
    kill = number,
    stop = number,
    kbdstop = number,
    continue = number
  }
  The kill, stop, and continue signals are not blockable.  All other signals may be overridden.
COPYRIGHT
  Cynosure kernel copyright (c) 2021 Ocawesome101 under the DSLv2.
REPORTING BUGS
  Bugs should be reported at https://github.com/ocawesome101/oc-cynosure/issues.