scsh-users
[Top] [All Lists]

Re: fork vs. spawn

To: scsh@martigny.ai.mit.edu
Subject: Re: fork vs. spawn
From: Dave Mason <dmason@jupiter.scs.ryerson.ca>
Date: 09 Aug 1996 18:55:07 -0400
Organization: Ryerson Polytechnic University
Sean Doran <smd@chops.icp.net> writes:

> wilson@cs.utexas.edu (Paul Wilson) writes:
> 
> > Why not?  Can't spawn be implemented in terms of fork, but
> > not vice versa?

Yes, although VMS did a very weird fake of fork using
spawn... unfortunately the semantics were not quite preserved :-(

Spawn certainly should be more portable than fork.  I know VMS only
(really) has spawn, and I think one or more of the Microsoft
``Operating Systems'' only has spawn too.

> You will have to cough up a spawn manpage for me;
> I use 4.4 and 4.3-reno derived systems, with the
> occasional painful foray into StunOS, and none of
> these have spawn.

It looks like (this is a fake, cons'ed up from fork and execv:

spawn(2)                   System Calls                    spawn(2)

NAME
     spawn, spawn1 - create a new process

SYNOPSIS
     #include <sys/types.h>
     #include <unistd.h>

     pid_t spawn(const char *path, const char *arg0, ...,
          const char *argn, char * /*NULL*/);(char *);


DESCRIPTION
     spawn() causes creation of a new process.  The new process (child
     process) will be executing the program described in path, as if a
     fork immediately followed by execv had been executed.  Possible
     errors are the union of those provided by fork and those provided
     by execv.  The child process inherits the following attributes
     from the parent process:
.....blah...blah...blah...

../Dave

<Prev in Thread] Current Thread [Next in Thread>