From owner-freebsd-questions Thu Feb 20 10:08:13 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id KAA27219 for questions-outgoing; Thu, 20 Feb 1997 10:08:13 -0800 (PST) Received: from accessld.com (sparky.accessld.com [206.71.65.2]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id KAA27214 for ; Thu, 20 Feb 1997 10:08:10 -0800 (PST) Received: from lancez.accessld.com ([206.71.64.131]) by sparky.accessld.com with SMTP id <28678-1>; Thu, 20 Feb 1997 10:54:10 -0700 Message-Id: <2.2.16.19970220111650.ee6f68bc@accessld.com> X-Sender: lancez@accessld.com X-Mailer: Windows Eudora Pro Version 2.2 (16) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: freebsd-questions@freebsd.org From: Lance Subject: Replace system() with fork() and exec() ? Date: Thu, 20 Feb 1997 10:54:08 -0700 Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, there: I have a process which executes different user programs depending on the given parameters. Right now I am using system() to start those user programs. I am thinking about replaing system() with fork() and exec() (or its variants.), so it would be more fast and efficient. And I'd like to keep MY process running all the time. What's the general way to do this? Where to call exec(), in my parent process or the child one? Could I just fork a child, call exec(), and then exits, while the parent process is still running, or, I could let the child does all this stuff, and let parent process dies? There are six different exec() functions. Which one is best to use in this case? Appreciate your reply! lance lancez@accessld.com