to what is done in daemon(3), which we can not use directly in this context. Reviewed by: pjd MFC after: 2 weeks