8 bit os_f handles

Daniel Ellis dre at mssl.ucl.ac.uk
Fri Mar 31 10:12:21 BST 2000


Jonathan Coxhead writes:
 >    Even if you only save 8 bits of file handle in your assembler 
 > client of FileSwitch, your code is not going to corrupt memory, 
 > though it's going to fail with wide handles. The situation is the 
 > same with C code that continues to use |os_f| with wide handles: it 
 > won't work if it actually gets a wide handle, but it won't corrupt 
 > memory either. In both cases, the fault can only be fixed by 
 > recompiling/assembling.

I must say you have a point here: one solution potentially causes
writes to non-existent file handles, the other causes obscure memory
corruption.  I think there's no question that the latter is more
dangerous.  And of course offending code can be identified by
defining os_f as junk - which maybe ought to be done by default as
soon as os_w is written.  Should the chance be taken to make sure
there aren't any other unwarranted 8-bit assumptions?  Surely there's
no reason font-handles should be 8-bit...

It's definitely all food for thought!  This is getting a bit OT now,
but maybe, bearing this discussion in mind, maybe filehandles should be
allocated in blocks of 255 with the upper 24-bits being unique to the
task (or CAO) for which the handle was allocated.  That way the
hypothetical new OS could check that if all top 24-bits were zero then
it would assume that the caller wanted the call to apply to the
CAO, and would have a good chance of working while still
giving access to many more file handles, and still (if it really is
desirable) allowing access to all filehandles from other CAOs.  (Maybe
I really do mean task instead of CAO here?)

Seeing as someone as knowledgable as yourself assumed 8-bit
filehandles, it's not beyond the bounds of probability that other
software might also have this assumption coded in (even if not
justified by the published API), so a degree of backward compatibility
built into any such new feature would surely only be judicious... in
fact you could even go so far as to say that it would be biting one's
nose off to spite one's face not to.

Now, back to measuring the thickness of the polar ice caps....

-- 
Dan Ellis
Software Engineer
Climate Physics Group
Mulard Space Science Laboratory



More information about the oslib-user mailing list