> I would appreciate comments on the usefulness of a utility which would
> allow one to detach a process from a TTY.  I imagine the utility would
> be very small and just call daemon(3) and execlp(3).

1) cd /usr/ports/sysutils/detach
have fun...

2)  the  code  itself  is  rather  simple and I wrote such detach.c by
myself  on  FreeBSD  3.4  before  I  had  a  chance to look into ports
collection. Here it is:

/*==========================================================
 * detach.c                                                  
 *---------------------------------------------------------- 
 *      Executes given as arguments programs having          
 *      detached TTY at first.                               
 *                                                           
 * by Poige, [EMAIL PROTECTED]                                     
 *========================================================== 
 */                                                          
                                                             
#include <unistd.h>                                          
#include <sys/types.h>                                       
#include <stdlib.h>                                          
                                                             
    int main(int argc, char **argv)
    {                                                        
        /* executes another programs having detached         
         * tty at first                                      
         */                                                  
                                                             
         return ! (                                          
            argv[1]                                          
            && (fork () == 0)
            && (setsid () > 0)
            && (fork () == 0)
            && (execvp (argv[1], argv + 1) > 0)
         );
    }                                                        

> Would a utility like this be useful?
yes

> Is this functionality already available in a system utility?
in ports...

> Best regards,
> Mike Barcroft

-- 
 Igor                            mailto:[EMAIL PROTECTED]



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to