Closed bartoldeman closed 6 years ago
Hello @bartoldeman ,
Thank you!
Now that you mention O_TRUNC
, I now think the special case of int $0x21
with %ah == 0x40
, %cx == 0
should probably be factored out into a separate function -- perhaps an ftruncate ( )
function -- and then O_TRUNC
changed to use that.
Then we can modify _write ( )
so that write (
..., 0)
has the correct POSIX-ish semantics (i.e. it does nothing or just checks for errors).
I will merge your changes first, and then try to make this change.
Indeed. There is also the issue of naming: in Borland compilers and DJGPP, _open(), _write(), and a few other functions are not the same as open() and co but simpler functions that just wrap int21, with DJGPP doing a little bit more too. MSVC and (Open)Watcom, and also DJGPP, use _dos_open and co for this purpose.
It just happened that the initial implementation of libgloss/ia16 _open, _write and co pretty much matched the Borland style implementation but this was by accident I presume.
See e.g. http://www.delorie.com/djgpp/doc/libc/libc_601.html
Perhaps the libgloss "BSP" functions should use open, write etc then (with two underscores) for DOS compiler compatibility?
Hello @bartoldeman ,
Hmm... my thinking (at least for now) is that _dos_open
and friends might be useful to have. But I am not sure if they should be used to underlie the functions open
, write
, etc. --- or if it might be better to put them into, say, a separate library of DOS-specific functions.
Thank you!
Implement O_CREAT, O_TRUNC, O_EXCL, O_APPEND in _open, and do proper prototyping via _COMPILING_NEWLIB.