anchor.diff:    (:documentation
      "This table tracks how many outstanding retains each file
   descriptor has."))
  -(define-once-global %fd-retain-count-table-lock% (make-lock)
  +(define-once-global %fd-retain-count-table-lock% (make-recursive-lock)
     (:documentation
      "This lock protects `%fd-retain-count-table-lock%'."))
   
  
positive.code: 
  The given fd will not be closed in the shell process until the retain
  count reaches 0.  See `fd-release'."
    (with-lock-held (%fd-retain-count-table-lock%)
      (%fd-retain fd)))
  
  (defun retain-fd-bindings (fd-bindings)
    (with-lock-held (%fd-retain-count-table-lock%))
    (fset:do-map (key-fd value-fd fd-bindings)
      (declare (ignore key-fd))
      (when (%fd-managed-p value-fd)
        (%fd-retain value-fd))))
  
  (defun copy-fd-bindings ()
    "Take the current state of the fd bindings and preserve it for later re-hydration with `with-fd-scope'.
  
negative.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))))
  