+ get_user_id (run_as_user cfg) >>= setUserID
+
+ -- Now we create the PID file.
+ pid <- getProcessID
+
+ -- The PID file needs to be read-only for anyone but its
+ -- owner. Hopefully the umask accomplishes this!
+ _ <- setFileCreationMask orig_umask
+
+ -- When we later attempt to delete the PID file, it requires
+ -- write permission to the parent directory and not to the PID
+ -- file itself. Therefore, if that's going to work, this has to
+ -- work, even as a limited user.
+ writeFile (pidfile cfg) (show pid)