[comp.sys.atari.st] Fsfirst and error codes

apratt@atari.UUCP (Allan Pratt) (10/05/89)

neubauer@tubsibr.uucp (Frank Neubauer) writes:
>apratt@atari.UUCP (Allan Pratt) writes:
>>Old TOS put pointers to its directory tree in the DTA after Fsfirst
>>or Fsnext, but TOS 1.4 does not.  You can do as many Fsfirst calls
>>as you like; no OS resources are tied up after the call.
>
>What exactly does TOS store in the DTA?  If it is information pointing to
>the disk, how does TOS know it is still valid when Fsnext is called?
>(The directory might have been deleted and the cluster reused in the
>meantime...)  What error codes must be expected?

You pays yer money and you takes yer chances.  The semantics of the DTA
mean you can't be sure of anything.  If each process had a dedicated
place where Fsfirst-type information was kept, the OS could invalidate
it or update it or whatever.  As it stands, Fsfirst/Fsnext is a big
lose.  Basically, you shouldn't do any file or directory
creation/deletion  calls and assume your DTA is still worth anything.

The last question, however, gives me a chance to address something I've
been noticing lately: people expecting only CERTAIN error codes from
certain calls.  ANY (long) NEGATIVE VALUE returned from GEMDOS
indicates an error.  Don't just check against the error codes you
"expect" -- check for ANY negative value.  If you don't, your program
won't work when we change GEMDOS for something like a network: what if
you didn't "expect" to get "EFLOCKED" (file is locked)?

You can certainly report errors any way you want, and a different
message for each error is not a bad idea, but you must be sure to treat
any negative value as an error -- the "unknown error" alert is better
than proceeding like there wasn't an error at all.

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt