anchor.diff:  
   (optimization-settings)
   
  +(define-once-global %extant-fds% (make-hash-table)
  +  (:documentation
  +   "The set of fds that are currently alive."))
  +(define-once-global %extant-fds-lock% (make-recursive-lock)
  +  (:documentation
  +   "The lock protecting `%extant-fds%'."))
  +
  +(defmacro with-safe-fd-manipulation (&body body)
  +  (let ((fd (gensym "FD")))
  +    `(with-recursive-lock-held (%extant-fds-lock%)
  +       (labels
  +           ((track (,fd)
  +              (debug-log status "TRACK ~A" ,fd)
  +              (setf (gethash ,fd %extant-fds%) t)
  +              ,fd)
  +            (forget (,fd)
  +              (debug-log status "FORGET ~A" ,fd)
  +              (remhash ,fd %extant-fds%)
  +              (values)))
  +         (declare (dynamic-extent #'track #'forget))
  +         (declare (ignorable #'track #'forget))
  +         ,@body))))
  +
   (define-once-global %fd-retain-count-table% (make-hash-table)
     (:documentation
      "This table tracks how many outstanding retains each file
   descriptor has."))
  -(define-once-global %fd-retain-count-table-lock% (make-recursive-lock)
  -  (:documentation
  -   "This lock protects `%fd-retain-count-table-lock%'."))
   
   (defparameter *autorelease-fd-scope* nil
     "The collection of file descriptors that should be released when the
  
positive.code: 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-recursive-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 dup-retained (fd)
    (with-recursive-lock-held (%fd-retain-count-table-lock%)
      (let ((new-fd (dup fd)))
        (debug-log status "DUP ~A = ~A" new-fd fd)
        (%manage-new-fd new-fd))))
  
  (defun open-retained (pathname flags &optional 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-recursive-lock-held (%fd-retain-count-table-lock%)
      (let ((fd (posix-open pathname flags mode)))
        (debug-log status "OPEN ~A = ~A" fd pathname)
        (%manage-new-fd fd))))
  
  (defun openat-retained (dir-fd pathname flags &optional mode)
    (with-recursive-lock-held (%fd-retain-count-table-lock%)
      (let ((fd (openat dir-fd pathname flags mode)))
        (debug-log status "OPENAT ~A, ~A = ~A" dir-fd fd pathname)
        (%manage-new-fd fd))))
  
  (defun pipe-retained ()
    "This is a wrapper around the posix pipe function which atomically
  
negative.code:   "Decrement the retain count for the given fd.
  
  If the retain count reaches 0, then it will be closed immediately."
    (with-safe-fd-manipulation
      (%fd-release fd)))
  
  (defun release-fd-bindings (fd-bindings)
    (with-safe-fd-manipulation
      (fset:do-map (key-fd value-fd fd-bindings)
        (declare (ignore key-fd))
        (when (%fd-managed-p value-fd)
  