delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/22/05:46:06

Date: Wed, 22 Jan 1997 12:33:25 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: peter DOT gerwinski AT uni-essen DOT de
cc: djgpp AT delorie DOT com
Subject: Re: `access' function and `prn' etc.
In-Reply-To: <5c2fls$a3s@sun3.uni-essen.de>
Message-ID: <Pine.SUN.3.91.970122122253.101A-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019