From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 23 20:49:46 2007 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 572B816A418 for ; Mon, 23 Jul 2007 20:49:46 +0000 (UTC) (envelope-from jaj@hcl-club.lu) Received: from 0b10111.de (hcl-club.lu [62.75.155.129]) by mx1.freebsd.org (Postfix) with ESMTP id 2C63F13C457 for ; Mon, 23 Jul 2007 20:49:46 +0000 (UTC) (envelope-from jaj@hcl-club.lu) Received: from spaceman.my.domain (d90-129-9-224.cust.tele2.lu [90.129.9.224]) by 0b10111.de (Postfix) with ESMTP id 37D75872C2D0; Mon, 23 Jul 2007 22:16:24 +0200 (CEST) Date: Mon, 23 Jul 2007 22:16:19 +0200 From: Jona Joachim To: Garrett Cooper Message-ID: <20070723221619.2f336beb@spaceman.my.domain> In-Reply-To: <46A46910.9080901@u.washington.edu> References: <46A46910.9080901@u.washington.edu> X-Mailer: Claws Mail 2.9.2 (GTK+ 2.10.12; x86_64-unknown-openbsd4.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 23 Jul 2007 21:07:39 +0000 Cc: hackers@freebsd.org Subject: Re: How do I daemonize a process? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2007 20:49:46 -0000 On Mon, 23 Jul 2007 01:38:40 -0700 Garrett Cooper wrote: > As the subject suggests I'm trying to determine how I can > daemonize a C process, outside of using the rc infrastructure, so > that it won't exit when the TTY exists. Does anyone know any quick > references or examples? Thanks, The daemonize() function in this small program of mine: http://hcl-club.lu/svn/development/c/console%20c/fetchiterd/fetchiterd.c is the right portable way to do it according to "Advanced Programming in the UNIX Environment" by Stevens and Rago. (I love that book) Regards, Jona