Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Aug 2001 11:01:32 +0800
From:      Igor Podlesny <poige@morning.ru>
To:        Mike Barcroft <mike@FreeBSD.ORG>
Cc:        hackers@FreeBSD.ORG, Peter da Silva <peter@baileynm.com>
Subject:   Re: Proposed Utility - detach(1)
Message-ID:  <792042206.20010830110132@morning.ru>
In-Reply-To: <20010824141955.B64018@coffee.q9media.com>
References:  <20010824141955.B64018@coffee.q9media.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> 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, poige@nm.ru                                     
 *========================================================== 
 */                                                          
                                                             
#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:poige@morning.ru



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?792042206.20010830110132>