dillon@CORY.BERKELEY.EDU (Matt Dillon) (10/09/86)
Not that I'm about to tackle exec myself ... only someone with full BCPL startup specs would be able to do that. However, I see no reason why you couldn't deallocate your segment first, then allocate the new program's segment (after checking to be sure it's a proper executable), simply AllocMem some memory and place the execstrap in it.. then have it unload the first program, load and execute the second, and then free itself/ kill itself (I believe you can specify certain memory to be Free'd automatically on exit) Without Fork I don't see what use a UNIX exec will be, though. -Matt
lwall@sdcrdcf.UUCP (Larry Wall) (10/10/86)
(Purists stop reading here.) Fork may be impossible, but how about vfork? You wouldn't have to do any relocation, just establish a separate thread of execution. And some way to tell from exec which thread you were running, so you know whether to start up a new process or not. Yeah, I know it's gross, but it would handle 90% or so of forks people do. Larry Wall {allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!lwall