apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject apr_buckets_file.c:file_read + XTHREAD
Date Wed, 28 Nov 2001 00:45:11 GMT
if file_read() cannot mmap the the file, it does this:

#if APR_HAS_THREADS && !APR_HAS_XTHREAD_FILES
    if ((flags = apr_file_flags_get(f)) & APR_XTHREAD) {
        /* this file descriptor is shared across multiple threads and
         * this OS doesn't support that natively, so as a workaround
         * we must reopen the file into a->readpool */
        const char *fname;
        apr_file_name_get(&fname, f);

        rv = apr_file_open(&f, fname, (flags & ~APR_XTHREAD), 0, a->readpool);
        if (rv != APR_SUCCESS)
            return rv;

        a->fd = f;
    }
#endif

in the case above does the file get re-opened everytime file_read() is
called or just once per-request?  if not the latter, any reason why it
can't be that way?  looks like the XTHREAD thinger is only used by
mod_file_cache.c, shouldn't its handler take care of re-opening the file
instead of file_read()?

re-open and apr_file_seek() for every file_read() doesn't seem right.
and i don't see why apr_file_seek() should happen if the file isn't being
re-opened, but it currently happens regardless of the XTHREAD flag.


Mime
View raw message