Path: utzoo!attcan!uunet!cs.utexas.edu!usc!wuarchive!texbell!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.arch Subject: Re: vfork (was Re: Paging page tables) Message-ID: Date: 20 Jul 90 15:24:00 GMT References: <920@dgis.dtic.dla.mil> <5830@titcce.cc.titech.ac.jp> <5DL4SPD@xds13.ferranti.com> <5855@titcce.cc.titech.ac.jp> <5893@titcce.cc.titech.ac.jp> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 31 In article <5893@titcce.cc.titech.ac.jp> mohta@necom830.cc.titech.ac.jp (Masataka Ohta) writes: > In spite of my request to actually show a "rational definition of spawn", > no one has ever shown it. OK, what capabilities in the child process need to be modified by the parent process, but can not be non-destructively changed by the parent. In UNIX the most important parts are current directory, user ID, open files, and environment variables. Environment variables are already explicitly passed by exec*e. User ID (and related attributes such as umask) can be set and restored by the parent process in modern UNIX (setting user ID in a root process is no longer a one-way street). That leaves current directory and open files. Open files can be handled by passing a vector of fds to be stuck into the child's file descriptord. Current directory is a bit more complex. I would prefer that current directory become a restorable object (as in AmigaDOS, where it's represented by a file token... so you can !oldcd = CurrentDir(newcd); do_something; CurrentDir(oldcd);!), but if that's too worrisome for some obscure security reason (if it had to be derived via !open(filename, O_DIRECTORY);! that should be a non-problem) then you can always pass a path name. That means that spawn*() should have two more arguments than exec*: spawnl(dir, fd_vec, prog, arg0, arg1, ..., (char *)NULL); spawnle(dir, fd_vec, prog, arg0, arg1, ..., (char *)NULL, envp); spawnv(dir, fd_vec, prog, argv); spawnve(dir, fd_vec, prog, argv, envp); You can even add spawnlp and friends. -- Peter da Silva. `-_-' +1 713 274 5180. 'U`