# K

`+Key`
  Prefix class for maintaining unique indexes to `+relation`s, a subclass of `+index`. Accepts an optional argument for a `+Hook` attribute. See also Database.

      (rel nr (+Need +Key +Number))  # Mandatory, unique Customer/Supplier number

`(key ['cnt]) -> sym`
  Returns the next character from standard input as a single-character transient symbol. The console is set to raw mode. While waiting for a key press, a `select` system call is executed for all file descriptors and timers in the `VAL` of the global variable `*Run`. If `cnt` is non-`NIL`, that amount of milliseconds is waited maximally, and `NIL` is returned upon timeout. See also `raw` and `wait`.

      : (key)           # Wait for a key
      -> "a"            # 'a' pressed

`(kids) -> lst`
  Returns a list of process IDs of all running child processes. See also `fork`, `pipe`, `tell`, `proc` and `kill`.

      : (unless (fork) (wait 60000) (bye))
      -> NIL
      : (unless (fork) (wait 60000) (bye))
      -> NIL

      : (proc 'pil)
        PID  PPID  STARTED  SIZE %CPU WCHAN  CMD
       2205 22853 19:45:24  1336  0.1 -      /usr/bin/picolisp /usr/lib/picolisp/lib.l /usr/bin/pil +
       2266  2205 19:45:30  1336  0.0 -        /usr/bin/picolisp /usr/lib/picolisp/lib.l /usr/bin/pil +
       2300  2205 19:45:33  1336  0.0 -        /usr/bin/picolisp /usr/lib/picolisp/lib.l /usr/bin/pil +
      -> T

      : (kids)
      -> (2300 2266)

`(kill 'pid ['cnt]) -> flg`
  Sends a signal with the signal number `cnt` (or SIGTERM if `cnt` is not given) to the process with the ID `pid`. Returns `T` if successful.

      : (kill *Pid 20)                                # Stop current process

      [2]+  Stopped               pil +               # Unix shell
      $ fg                                            # Job control: Foreground
      pil +
      -> T                                            # 'kill' was successful