Sender: vheyndri AT rug DOT ac DOT be Message-Id: <3503D9F5.1D0E@rug.ac.be> Date: Mon, 09 Mar 1998 13:00:53 +0100 From: Vik Heyndrickx Mime-Version: 1.0 To: Eli Zaretskii Cc: djgpp-workers AT delorie DOT com Subject: Re: Temporary files considered unsafe References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Eli Zaretskii wrote: > On Mon, 9 Mar 1998, Vik Heyndrickx wrote: > > The most > > sensible mode precisely seems DENY_ALL, but I'll need to test that. > > ``Sensible''? Since when do we trust Microsoft to do sensible things? :-) > > The > > importance for being able to open a file in a particular sharing mode > > seems low. > > It's another safeguard, that's all. What other program could want to open our file for writing? > > > and the place where DOS puts it (we want it to go to $TMPDIR, for > > > example). > > > > IIRC this can be controlled through the DOS call. > Which one is that? The same I was referring to above, you pass a path and DOS appends the filename for the newly created temp-file. > > > Won't all first-level programs in different DOS boxes on Windows have the > > > same PSP address? > > > > I though the DOS conventional memory was common to all DOS boxes, or am > > I so wrong? > > It is not common, it is mapped into all DOS boxes, but it is kept > separate. Windows twiddles the memory page directory when it multi-tasks > DOS apps, so that each DOS app gets a separate address space, but the > real-mode addresses are the same. I don't understand "mapped into all DOS boxes" vs. "kept separate". Either any DOS program has a different "below 640Kb + UMB" address space, or it has the same. You imply the first? The same offsets, different linear addresses, but the same real-mode addresses for conventional (mapped) memory. So, this means that any DOS prg runs in the same "below 1Mb" address space? Meaning that a PSP-segment IS unique? > > If you are right, what about getpid()? > > DJGPP's `getpid' doesn't use the PSP address. It reads the BIOS clock > tick count the first time it is invoked in the given program, then caches > the value and returns it hence. Then it most certainly not suits what I want as a unique value, since two programs can be started in the same 1/18.2s period. > > > AFAIK, this is the max number of unique names we can *potentially* > > > generate. > > > > Meaning, in the example above 86400 * X ? > > What's X? Is it the total number of segments below 1MB mark? X was the counter value (equivalent to the current counter in tempnam[e]). This value should prevent from different names to be generated during the same second by one program. Because a program cannot create more than X values during the same second I feel like setting MAX_TEMPNAM = X, but the program potentially can create 86400 * X in one day. That is why I am so careful about not setting it to 24 * 60 * 60 * X. > And how do you account for the truncation to 8+3 namespace? I simply create filenames that ARE 8+3 (and don't contain '~' BTW), I don't know why I should make things more complicated? -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/