apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@xbc.nu>
Subject Re: [time to move on I guess] APR_TMP_DIRECTORY
Date Tue, 17 Dec 2002 01:19:27 GMT
David Reid wrote:

>Actually my memory is that we don't any form of agreement on how this should
>be implemented or even what problem the discussion was trying to solve -
>that's why I haven't written anything yet. I was all set to write the code
>but the discussion and feeling expressed mean I won't now.
>It'll be nice if we ever do it as it means that apache might build on beos
>again :)

O.K., let's restate what we want:

1) A function that creates and opens a temporary file, accepting a
template name.

    We have that, it's called apr_file_mktemp.

2) A function that gives us the name of a directory where temporary
files may be created; this name would be used to create template names
for apr_file_mktemp.

    We don't have that, but need it. Applying the keep-it-simple
    principle, the definitiona would be

    const char *apr_filepath_temp_dir_get (apr_pool_t *pool);

    The implementation should use any system-specific APIs and/or
    conventions to find a directory that a) is customarily used for
    creating temporary files, and b) is writable by the current process.
    We /may/ want to qualify if the temp dir should be such that files
    in it survive a reboot or not.

3) [I'm not sure we need this, but I'm adding it for completeness] A
function that creates a temporary directory, accepting a template name.

    This would be symmetric to apr_file_mktemp:

    apr_status_t apr_dir_mktemp (const char **real_name,
                                 const char *templ,
                                 apr_int32_t flags,
                                 apr_pool_t *pool);

    It would use the same method as apr_file_mktemp to create a unique
    name, then create the directory and return that name. Unlike
    apr_file_mktemp, it would not automaticlaly remove the directory, of
    course. The caller must still use apr_filepath_temp_dir_get to
    create the template for a name that's within the temporary directory.

There. The implementation is an exercise for the reader. I volunteer to
write the Windows-specific apr_filepath_temp_dir_get when the time comes.

Brane ─îibej   <brane@xbc.nu>   http://www.xbc.nu/brane/

View raw message