apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Huelsmann" <ehu...@gmail.com>
Subject Re: EISDIR / EPERM not categorised in APR_STATUS_IS_* macros
Date Tue, 25 Sep 2007 21:03:08 GMT
On 9/13/07, Joe Orton <jorton@redhat.com> wrote:
> 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)

Not in all cases: in most cases it loops over the list of versioned
items ith the current directory (which are stored in a file). That
list holds the type of the entry that *should* be on disk, but,
ofcourse, that's not a guarantee we'll actually find a file on disk if
the versioned item is a file.

> > 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?

The former (ie the APR_STATUS_* code/macro to check the return value
of apr_file_remove()).



View raw message