Mail Archives: djgpp/1997/01/22/05:46:06
On 21 Jan 1997, Peter Gerwinski wrote:
> when applying the `access' function to DOS device files like `prn'
> or `lpt1', it returns "not writeable":
This is due to the fact that DOS fails the `_chmod' function
(Int 21h/AX=4300h) on devices.
> Is this intended, or is it a bug in the C library (or in my
> configuration)? It causes that you cannot print at all with
> GNU Pascal because GPC's run time library always calls "access"
> before opening a file.
I'm not sure this isn't a bug in the GPC library. Why would they need to
call `access' before writing to something? If it needs to be that way on
Unix, maybe the people who ported GPC should install a DOS-specific
change that doesn't call `access' on devices?
The truth is it is not at all trivial to fix that in the DJGPP library,
because `access' is a function which is used a lot in GNU tools, and it
must be fast and as small as possible (so it can't call `stat', which
does know about devices, but is very large and relatively slow). Another
problem is that DOS doesn't return enough info about devices, so even if
the devices won't fail `access', their access bits need to be faked
because DOS doesn't say which are read-only and which are writeable.
- Raw text -