* Exec, Spawn, Objects in VMS @ 1993-05-25 10:18 Chetan Mistry 1993-05-25 15:21 ` Paul S. Winalski 1993-05-25 16:12 ` jeh 0 siblings, 2 replies; 5+ messages in thread From: Chetan Mistry @ 1993-05-25 10:18 UTC (permalink / raw) Whats the best way to exec another program with another program. ? I have a DECnet object which listens for connections and then opens "SYS$NET" channel to read information about which server it has to fire off. The server program should use the same channel (ie. "SYS$NET") to talk to the remote program. Questions :- 1. If I use one of the 6 exec routines (execl, execvp, etc) will I be able to reopen the "SYS$NET" channel from within the server?? 2. Is it possible to do something like this from lib$spawn ?? 3. Is it possible to kill off the original object after it has started server TIA Chet [email: chetanm@visionware.co.uk] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exec, Spawn, Objects in VMS 1993-05-25 10:18 Exec, Spawn, Objects in VMS Chetan Mistry @ 1993-05-25 15:21 ` Paul S. Winalski 1993-05-26 14:27 ` Jan Vorbrueggen 1993-05-26 20:14 ` jeh 1993-05-25 16:12 ` jeh 1 sibling, 2 replies; 5+ messages in thread From: Paul S. Winalski @ 1993-05-25 15:21 UTC (permalink / raw) In article <1993May25.101807.8847@visionware.co.uk>, chetanm@visionware.co.uk (Chetan Mistry) writes: |> |> Whats the best way to exec another program with another program. ? |>I have a DECnet object which listens for connections and then opens |>"SYS$NET" channel to read information about which server it has to fire off. |>The server program should use the same channel (ie. "SYS$NET") to talk to |>the remote program. This is not the way that DECnet-VAX is designed to operate. The way you're supposed to use it is to define a separate object for each server. The Unix inetd model is not the DECnet paradigm. In trying to do something like this, you're faced with two major problems: 1) One and only one I/O channel can be opened on SYS$NET:. All DECnet communications have to take place over that channel. In particular, a subprocess cannot access its parent's DECnet link. 2) Once you close SYS$NET:, the DECnet link is broken. This means that if you open SYS$NET: from within a program (i.e., in user mode), you cannot run another program in that process and have it talk over the DECnet channel (because I/O rundown of the first program will close the DECnet link). The easiest way around these difficulties is to open SYS$NET: for read and write access from DCL. Define your DECnet object to run a command procedure. Within the procedure, accept the logical link using a DCL OPEN statement: $ OPEN/READ/WRITE NETCHAN SYS$NET: You now have the DECnet link open as a process-permanent file, which means that it won't be closed upon exit of a user-mode program. You can now access it from within programs using logical name NETCHAN. Your program that reads the info about which server to fire off can then use LIB$RUN_PROGRAM to run the correct server. --PSW ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exec, Spawn, Objects in VMS 1993-05-25 15:21 ` Paul S. Winalski @ 1993-05-26 14:27 ` Jan Vorbrueggen 1993-05-26 20:14 ` jeh 1 sibling, 0 replies; 5+ messages in thread From: Jan Vorbrueggen @ 1993-05-26 14:27 UTC (permalink / raw) In article <1993May25.152103.6262@dbased.nuo.dec.com> winalski@adserv.enet.dec.com (Paul S. Winalski) writes: This is not the way that DECnet-VAX is designed to operate. The way you're supposed to use it is to define a separate object for each server. The Unix inetd model is not the DECnet paradigm. Well, I've always thought that with DECnet-VAX, the NETACP plays a role quite similar to inetd, with the NETACP object database replacing /etc/inetd.conf. The real problem in this application seems to be that the Unix approach to file descriptors/sockets, which are made available to spawned processes, is incompatible how _VMS_ behaves in this respect. This approach actually works in other network settings under VMS, e.g., with PSI. Jan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exec, Spawn, Objects in VMS 1993-05-25 15:21 ` Paul S. Winalski 1993-05-26 14:27 ` Jan Vorbrueggen @ 1993-05-26 20:14 ` jeh 1 sibling, 0 replies; 5+ messages in thread From: jeh @ 1993-05-26 20:14 UTC (permalink / raw) In article <1993May25.152103.6262@dbased.nuo.dec.com>, winalski@adserv.enet.dec.com (Paul S. Winalski) writes: > 1) One and only one I/O channel can be opened on SYS$NET:. All DECnet > communications have to take place over that channel. In particular, a > subprocess cannot access its parent's DECnet link. As some might see a conflict between my and Paul's responses in this thread, I thought I'd post a clarification: Paul is correct here. The reason is that the $ASSIGN channel to SYS$NET is "special". The reason it's special is that the equivalence name of SYS$NET is not just a device name; it's the network connect block that will tell DECnet which inbound connect request you're confirming. The channel ends up being assigned to a pseudo-device called NETnnnn, but that device isn't ready for use until after the $ASSIGN to SYS$NET has been done, confirming the link. (It may not even exist until that $ASSIGN is done, I haven't checked.) You can also confirm the link by $ASSIGNing to NET0:, which gets you a channel to a NETnnnn, picking the NCB out of SYS$NET's equivalence name, and passing the NCB to NETnnnn with a $QIO IO$_ACCESS; this is part of non-transparent programming. You can't assign a second channel to SYS$NET because once you've assigned the first one, the connect request which SYS$NET describes has already been confirmed! (You might think of SYS$NET has having been "used up".) Someone is no doubt wondering what happens if you $ASSIGN to SYS$NET, then do a $GETDVI on the channel to recover the NETnnnn device name, then try to $ASSIGN a second channel to that device name. I was, so I tried it. The second $ASSIGN will complete without error but the resulting channel can't be used to talk to the DECNet link, because the WCB pointer in the channel control block isn't filled in. I suppose this could be patched up via a little bit of kernel-mode code. All of this is a little afield of the original question. The questioner wanted (I think) to have a process (we'll call it the "switcher") declare its name to DECnet via IO$_ACPCONTROL, receive multiple inbound connect requests (via a mailbox associated with the channel used to do the ACPCONTROL), and pass them off to other processes. Such a process CAN pass the NCBs read from the mailbox to other processes, and let the other processes confirm the links. But this doesn't contradict Paul's assertion, as it does not involve multiple $ASSIGNs to SYS$NET; SYS$NET won't be involved at all in this technique, except perhaps for the first incoming connect to the "switcher" process (and that connect cannot be handed off to another process). If you want the "switcher" process to confirm the links and read something from the link to determine what image to run in another process to service the link.... you can't do that, because it would require assigning two different channels to the link (one in the "switcher" process and one in the "server" that it creates). But you CAN use non-transparent programming to send the "server selection" information in the Network Connect Block; the "switcher" can then examine the NCB received in the mailbox message to determine what image to run in the server, and the server can confirm the link. --- Jamie Hanrahan, Kernel Mode Systems, San Diego CA drivers, internals, networks, applications, and training for VMS and Windows NT uucp 'g' protocol guru and release coordinator, VMSnet (DECUS uucp) W.G., and Chair, Programming and Internals Working Group, U.S. DECUS VMS Systems SIG Internet: jeh@cmkrnl.com Uucp: uunet!cmkrnl!jeh CIS: 74140,2055 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Exec, Spawn, Objects in VMS 1993-05-25 10:18 Exec, Spawn, Objects in VMS Chetan Mistry 1993-05-25 15:21 ` Paul S. Winalski @ 1993-05-25 16:12 ` jeh 1 sibling, 0 replies; 5+ messages in thread From: jeh @ 1993-05-25 16:12 UTC (permalink / raw) In article <1993May25.101807.8847@visionware.co.uk>, chetanm@visionware.co.uk (Chetan Mistry) writes: > Whats the best way to exec another program with another program. ? > I have a DECnet object which listens for connections and then opens > "SYS$NET" channel to read information about which server it has to fire off. > The server program should use the same channel (ie. "SYS$NET") to talk to > the remote program. > Questions :- > 1. If I use one of the 6 exec routines (execl, execvp, etc) will I > be able to reopen the "SYS$NET" channel from within the server?? By your DECnet object listening for connections I presume you mean that it's assigned a channel to NET0:, declared its name, and is reading from a mailbox associated with NET0:. If you are talking about one server receiving multiple inbound connects (looks like you are), you don't use SYS$NET. SYS$NET is a process-specific logical name. Newly-created network processes (target tasks) are created with SYS$NET pointing to the DECnet logical link which they were created to service. Subsequent attempts to create logical links to the same process have no way of reaching into the process logical name table and defining a new equivalence name for SYS$NET. (Well, actually this IS possible with special kernel ASTs, but anyway, DECnet doesn't do that.) Here's how it's supposed to go: After getting a mailbox message indicating an inbound connect attempt, you assign another channel to NET0: (which yields a channel assigned to some other NETnnn: device), then issue a $QIO IO$_ACCESS with a P2 argument containing the NCB which you read from the mailbox. From then on IOs to this new channel are communicating with the new logical link. If you want the various "connections" to be served by different processes you can certainly execxxx() or LIB$SPAWN another process, pass the NCB to it via a mailbox or a job-wide logical name or whatever, and let it do the $QIO IO$_ACCESS. > 3. Is it possible to kill off the original object after it has started > server If you mean kill off the process that was listening to the mailbox, yes, as long as the process it creates (the server) isn't a subprocess. (If it is, it'll die as soon as its creator dies.) --- Jamie Hanrahan, Kernel Mode Systems, San Diego CA drivers, internals, networks, applications, and training for VMS and Windows NT uucp 'g' protocol guru and release coordinator, VMSnet (DECUS uucp) W.G., and Chair, Programming and Internals Working Group, U.S. DECUS VMS Systems SIG Internet: jeh@cmkrnl.com Uucp: uunet!cmkrnl!jeh CIS: 74140,2055 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1993-05-26 20:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1993-05-25 10:18 Exec, Spawn, Objects in VMS Chetan Mistry 1993-05-25 15:21 ` Paul S. Winalski 1993-05-26 14:27 ` Jan Vorbrueggen 1993-05-26 20:14 ` jeh 1993-05-25 16:12 ` jeh
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox