anchor.diff:                (%fd-release ,fd)))))))
   
   (defmacro with-living-fds ((fd-list-sym) &body body)
  +  "Lock the fd table and list all managed file descriptors.
  +
  +Since this locks the fd table, it is very important to minimize the
  +amount of work done in the body of this macro.  Ideally, you would
  +do nothing exept spawn a new process."
     `(with-lock-held (%fd-retain-count-table-lock%)
        (let ((,fd-list-sym (hash-table-keys %fd-retain-count-table%)))
          (declare (dynamic-extent ,fd-list-sym))
          ,@body)))
   
   (defun open-retained (pathname flags mode)
  +  "This is a wrapper around the posix open function which
  +atomically adds the new fd to the fd table and gives it a +1 retain
  +count."
     (with-lock-held (%fd-retain-count-table-lock%)
       (let ((fd (sb-posix:open pathname flags mode)))
         (debug-log 'status "OPEN ~A = ~A" fd pathname)
         (%manage-new-fd fd))))
   
   (defun pipe-retained ()
  +  "This is a wrapper around the posix pipe function which atomically
  +adds the new fds to the fd table and gives them +1 retain counts.
  +
  +Returns two values: the read-end of the pipe and the write end of the
  +pipe."
     (with-lock-held (%fd-retain-count-table-lock%)
       (multiple-value-bind (read-end write-end) (sb-posix:pipe)
         (debug-log 'status "PIPE ~A -> ~A" write-end read-end)
         (values (%manage-new-fd read-end) (%manage-new-fd write-end)))))
   
   (defmacro with-pipe ((read-end write-end) &body body)
  +  "Introduce a pipe into the retain table (as if with `pipe-retained')
  +with a +0 retain count.
  +
  +That is, you do not need to release the file descriptors produced by
  +this macro.  You must balance any retains you perform on the given
  +file descriptors."
     (let ((raw-read-end (gensym "RAW-READ-END"))
           (raw-write-end (gensym "RAW-WRITE-END")))
       `(multiple-value-bind (,raw-read-end ,raw-write-end) (pipe-retained)
  
positive.code: (optimization-settings)
  
  (defparameter *umask*
    (logior sb-posix:s-irusr sb-posix:s-iwusr sb-posix:s-irgrp sb-posix:s-iroth))
  
  (define-condition not-implemented (warning error)
    ((message
  
negative.code:   (:report (lambda (c s) (format s "Can't enter FD ~A into retain/release management again" (fd-already-managed-fd c)))))
  
  (defun %manage-new-fd (fd)
    "Enter the given fd into the retain/release table."
    (when (gethash fd %fd-retain-count-table%)
      (error 'fd-already-managed :fd fd))
    (setf (gethash fd %fd-retain-count-table%) 1)
  