apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko Čibej <br...@xbc.nu>
Subject Re: setting timestamps
Date Tue, 08 Jul 2003 06:15:47 GMT
Ben Collins-Sussman wrote:

>Branko Čibej <brane@xbc.nu> writes:
>
>  
>
>>This interface looks sane, and I can cobble up a Windows implementation
>>in two eyeblinks. As for the patch itself: utimes() is a BSDism and may
>>not be available on all systems. The Unix implementation needs to check
>>for this, and use utime() instead if utimes() isn't available.
>>    
>>
>
>Branko, I just committed your & Matt's patches for
>apr_file_mtime_set().  Your test passes for me.
>
>Can you give me a clue about how to "check for utimes()" on unix
>platforms?
>  
>
Configury, my man!

Find an appropriate place in configure.in, then:

    AC_CHECK_FUNCS(utime, utimes)

That'll get HAVE_UTIME and/or HAVE_UTIMES defined in
include/arch/unix/apr_private.h. Then you just condinitonalize the code
on those defines, giving utimes (which has the more precise interface)
priority; e.g.,

    #if HAVE_UTIMES
    ...use utimes...
    #elif HAVE_UTIME
    ...use utime...
    #else
    return APR_ENOTIMPL:
    #endif

Not that there's much chance that any Unix wouldn't have at least utime().

I don't think you have to tweak apr.h.in. There's no reason to export
which syscall we're using. You do have to put in dummy implementations
that return APR_ENOTIMPL for OS/2 and Netware, though.


-- 
Brane Čibej   <brane@xbc.nu>   http://www.xbc.nu/brane/


Mime
View raw message