Re: C function - other process - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: C function - other process
Date
Msg-id 20050422200150.GA93845@winnie.fuhr.org
Whole thread Raw
In response to Re: C function - other process  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: C function - other process  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
On Fri, Apr 22, 2005 at 03:39:55PM -0400, Tom Lane wrote:
> Jakub Woźny <kubaw@o2.pl> writes:
> > I wrote a simple function:
> 
> >     signal(SIGCHLD,SIG_IGN);
> >     switch(fork())
> 
> This will NOT work.  It WILL corrupt your database.  You do not get to
> randomly introduce new processes into the backend set.

What about fork() followed by exec*(), either explicitly or via
popen(), system(), etc.?  Should these be avoided as well, or is
there a safe way to do them?  I'm thinking of the case where a
user-defined function wants to invoke some external command -- I've
done that in experiments but I've never been sure how safe it was.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: C function - other process
Next
From: Tom Lane
Date:
Subject: Re: C function - other process