From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,2a278b4da5a63dde X-Google-Attributes: gid1164f8,public From: sapsadeb@UHSFIN.UHSA.UH.EDU (David Bratton) Subject: Re: "fork" in OpenVMS C compiler Date: 1996/03/09 Message-ID: <4hr635$iig@masala.cc.uh.edu>#1/1 X-Deja-AN: 142215969 distribution: world references: <4hk71r$76o@graph24.unipv.it> <4hq7p6$nv0@blixen.aquilagroup.com> organization: University of Houston System reply-to: sapsadeb@UHSFIN.UHSA.UH.EDU newsgroups: comp.sys.dec In article <4hq7p6$nv0@blixen.aquilagroup.com>, wombat@barq.aquilagroup.com (Christopher M. Conway) writes: > >About 5 or so years back, I was doing a very similar thing-- porting a shell >interpreter from a Sun running SunOS 4.1 to a VMS 5.3 system. > >I went through *hell* with getting child processes going, and never did >get them in a way I was happy. VMS (at least at the time, 6.x may be >different) really didn't like to spawn new processes. > >I ended up having to right my own fork function, using their degenerate >one, as I recall. I believe the end result was that I had to run a >system(2) call on "spawn/detach program.exe" to get a new program forked. >I then had to open a pipe to it to pass execution information on. It was >really ugly and slow as molasses-- took as much as 3-4 *seconds* to spawn a >new process. > >If you just want a forked copy of the parent process, with the same >environment, you're basically out of luck. > >Again, this is as of VMS 5.3. Things may have changed; hopefully some >VMS wizard will tell me/you of some really simple and efficient way to >do it, but I doubt it. VMS just doesn't like process spawning. > >I'd be happy to dig up my old code for you if you like. Like I said, it's >not pretty, but it worked. > >-- >Christopher M. Conway wombat@aquilagroup.com > >Don't Tread on Me If you had bothered to pick up and read an RTL manual you would have saved yourself a lot of frustration. The library routine to create a sub-process is LIB$SPAWN. To do it from DCL the command is SPAWN. The /NOWAIT or /DETACH qualifiers are used to get the two processes to run asynchrously. Most environment information is inherited by the new process. Logical names created with the /JOB qualifier are shared between parent and child process via a common logical name table. You can also create processes via Decnet - ie. nodename"userid password"::TASK=command-procedure. You can also RUN SYS$SYSTEM:LOGINOUT.EXE/lots-of-qualifiers. You can also use the system service $CREPRC. SHEESH!!! Did you really have trouble with this? David Bratton University of Houston System DBratton@uh.edu ------------------------------------------------------------------------------ David Bratton University of Houston System DBratton@uh.edu