anchor.diff:  	       (unsigned-byte
   		(or (passwd-uid user)
   		    (error "Unknown userid: ~S" user)))))
  +	(gid (typecase group
  +	       (string 
  +		(group-gid 
  +		 (or (getgrnam group)
  +		     (error "Unknown groupname: ~S" group))))
  +	       (unsigned-byte
  +		(if (getgrgid group)
  +		    group
  +		    (error "Unknown groupid: ~S" group)))))
   	(pid (fork)))
  -    (declare (ignorable uid))
       (cond ((zerop pid)
   	   ;; Child
  -	   #-allegro
  -	   (unless (eql t (setsid))
  -	     (exit))
   	   (umask umask)
  -	   (close-fd-streams)
  +	   (detouch-terminal :input input :output output :error error)
  +	   (when gid
  +	     (setgid gid))
  +	   (when uid 
  +	     (setuid uid))
   	   (let* ((out (make-two-way-stream 
   			(make-concatenated-stream)
   			(make-broadcast-stream))))
  
positive.code: 	  ccl::*terminal-output* ccl::*stdout*
  	  ccl::*terminal-io* (make-two-way-stream 
  			      ccl::*terminal-input* ccl::*terminal-output*))
      (let ((write (popen "/dev/null" *o-rdonly*)))
        (dup2 write 0)
        (dup2 write 2))
      (dup2 (popen "/dev/null" (logior *o-wronly*
  				     *o-append*)) 1))
    #+allegro 
    (excl.osi:detach-from-terminal))
  
  (defun daemonize (&key input output error (umask +default-mask+) pidfile
  		  exit-parent (exit-hook t) (disable-debugger t)
  		  user group
  		  sigabrt sighup sigint sigterm)
    (declare (ignorable input output error pidfile exit-hook disable-debugger group sigabrt sighup sigint sigterm))
    (let ((uid (typecase user
  	       (string
  		(or (passwd-uid (getpwnam user))
  
negative.code:   #+allegro (excl.osi:getuid)
    #+ccl (#.(read-from-string "#_getuid")))
  
  (defun getgrnam (name)
    #+sbcl (sb-posix:getgrnam name)
    #+allegro (excl.osi:getgrnam name)
    #+ccl (ccl::with-cstrs ((cstr name)) (#.(read-from-string "#_getgrnam") cstr)))
  
  (defun setgid (gid)
    #+sbcl (sb-posix:setgid gid)
    #+allegro (excl.osi:setgid gid)
    #+ccl (#.(read-from-string "#_setgid") gid))
  
  (defun getgrgid (gid)
    #+sbcl (sb-posix:getgrgid gid)
    #+allegro (excl.osi:getgrgid gid)
    #+ccl (#.(read-from-string "#_getgrgid") gid))
  
  (defun group-gid (grp)
    #+sbcl (sb-posix:group-gid grp)
    #+allegro (excl.osi:grent-gid grp)
    #+ccl (unless (ccl:%null-ptr-p grp) (ccl:pref grp :group.gr_gid)))
  
  (defun getpwnam (name)
    #+sbcl (sb-posix:getpwnam name)
    #+allegro (excl.osi:getpwnam name)
  