apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: EISDIR / EPERM not categorised in APR_STATUS_IS_* macros
Date Thu, 13 Sep 2007 08:00:25 GMT
On Tue, Sep 11, 2007 at 11:25:20PM +0200, Erik Huelsmann wrote:
> While working on changing some of the working copy library in
> Subversion, I'm trying to eliminate stat() calls (apr_stat()) in order
> to speed up overall operation.
> Very often, Subversion libsvn_wc uses this pattern:
> svn_io_check_path() -> retrieves a path kind using apr_stat()
> if (kind == directory)
>   do_dir_thing();
> else
>   do_file_thing();
> Where dir and file thing could be just removal.
> The common case in the routines I'm looking at happens to be file
> removal. So, to reduce the number of stats, I want to replace the
> stat()+unlink() with a single unlink(), checking the result for
> certain types of failure.

Is this when dealing with files discovered by use apr_dir_*()?  (i.e. 
why isn't the filetype hint used)

> Reading the man 2 unlink page, EPERM is returned for POSIXy unices
> when deleting a directory, whereas EISDIR is returned on Linux. (MSDN
> isn't quite clear about Win32 behaviour...)
> Neither EPERM nor EISDIR have been categorised in any of the
> APR_STATUS_IS_* macros. I searched the mailing list archives at MARC,
> but found only an old mail by Branko which suggests this part of the
> error codes is unfinished business. Now, before I start working up any
> patches:  Is that true, or is this missing with intent?

Hmm, what exactly are you looking for here?  An APR_STATUS_* code which 
means exactly "this apr_status_t value if returned by apr_file_remove() 
means the file is a directory"?  Or just an APR_STATUS_IS_ESDIR() 
wrapper which is 0 #ifndef EISDIR?



View raw message