TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Jonathan de Boyne Pollard
date: 1997-01-06 20:03:08
subject: File Handles

PE>
  > PE> Ok, so how do you do this properly?  for (x = 0; x <
  > PE> ULONG_MAX; x++) DosClose(x);
  >
  > JdeBP> I'd use the value obtained by DosQueryRelMaxFH (with a delta of
  > JdeBP> zero) as the highest file handle.  Other than that, yes.
  >
  > Ok, you've convinced me.  Now, can you tell me whether what
  > Peter said (which was "wrong"), is actually right in a
  > difference context? BFN.  Paul.
  >
  > PF> I'll bet it has nothing to do with cvp directly (someone else up the
  > PF> parent tree is using those file handles already),  but has to do with
  > PF> the equivalent of a "start /i".
  >
  > PF> What happens if you start a session with "start /i"
and run your
  > PF> compile from there?
PE>

  I'm not sure of the context of the original discussion, but the /I flag
  to the START command results in the SSF_INHERITOPT_SHELL flag being used
  in the call to DosStartSession, rather than the SSF_INHERITOPT_PARENT
  flag.

  This means that the spawned process is a child of the "shell", rather
  than a child of the process that called DosStartSession.  As a result,
  it inherits the open file handles of the "shell", rather than those of
  the invoking process.

  The internal mechanics of this are obscure.  I assume that there is,
  somewhere, a privileged means of communication between the
  DosStartSession system call and the "shell" process.  (Anyone know?)

  Crank up your favourite process viewer, and watch what happens to the
  process tree when you run different programs with START /I.

  > JdeBP <
___
 X MegaMail 2.10 #0:

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 54/99 270/101 620/243 625/0 160 711/409 410 413 430 808 809
SEEN-BY: 711/934 955 712/311 407 505 506 517 623 624 704 841 713/317 800/1
@PATH: 440/4 141/209 270/101 712/624 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.