apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suss...@apache.org
Subject cvs commit: apr/file_io/unix filestat.c
Date Tue, 08 Jul 2003 16:03:38 GMT
sussman     2003/07/08 09:03:38

  Modified:    .        configure.in
               file_io/netware filestat.c
               file_io/os2 filestat.c
               file_io/unix filestat.c
  Log:
  Finish the new timestamp-setting API, thanks to helpful tips from
  Brane and Cliff.  Hopefully this will go out in httpd-2.0.48, and then
  subversion can make use of it.
  
  * configure.in:  use AC_CHECK_FUNCS to look for utimes() and utime().
  
  * file_io/unix/filestat.c (apr_file_mtime_set):  use the new constants.
  
  * file_io/netware/filestat.c (apr_file_mtime_set):  add dummy placeholder.
  
  * file_io/os2/filestat.c (apr_file_mtime_set):  add dummy placeholder.
  
  Revision  Changes    Path
  1.530     +1 -0      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.529
  retrieving revision 1.530
  diff -u -r1.529 -r1.530
  --- configure.in	11 Jun 2003 15:20:33 -0000	1.529
  +++ configure.in	8 Jul 2003 16:03:36 -0000	1.530
  @@ -788,6 +788,7 @@
   sendfile="0"
   AC_CHECK_LIB(sendfile, sendfilev)
   AC_CHECK_FUNCS(sendfile send_file sendfilev, [ sendfile="1" ])
  +AC_CHECK_FUNCS(utime utimes)
   
   dnl THIS MUST COME AFTER THE THREAD TESTS - FreeBSD doesn't always have a
   dnl threaded poll() and we don't want to use sendfile on early FreeBSD 
  
  
  
  1.30      +8 -0      apr/file_io/netware/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/filestat.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- filestat.c	24 May 2003 10:30:40 -0000	1.29
  +++ filestat.c	8 Jul 2003 16:03:37 -0000	1.30
  @@ -387,3 +387,11 @@
       return apr_stat(finfo, fname, wanted | APR_FINFO_LINK, pool);
   }
   
  +
  +/* ### Somebody please write this! */
  +APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
  +                                              apr_time_t mtime,
  +                                              apr_pool_t *pool)
  +{
  +  return APR_ENOTIMPL;
  +}
  
  
  
  1.37      +9 -0      apr/file_io/os2/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/filestat.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- filestat.c	24 May 2003 10:30:40 -0000	1.36
  +++ filestat.c	8 Jul 2003 16:03:37 -0000	1.37
  @@ -255,3 +255,12 @@
   
       return APR_FROM_OS_ERROR(rc);
   }
  +
  +
  +/* ### Somebody please write this! */
  +APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
  +                                              apr_time_t mtime,
  +                                              apr_pool_t *pool)
  +{
  +  return APR_ENOTIMPL;
  +}
  
  
  
  1.68      +26 -7     apr/file_io/unix/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/filestat.c,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- filestat.c	7 Jul 2003 22:44:10 -0000	1.67
  +++ filestat.c	8 Jul 2003 16:03:37 -0000	1.68
  @@ -220,21 +220,40 @@
   {
       apr_status_t status;
       apr_finfo_t finfo;
  -    struct timeval tvp[2];
   
       status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool);
       if (!APR_STATUS_IS_SUCCESS(status)) {
           return status;
       }
   
  -    tvp[0].tv_sec = apr_time_sec(finfo.atime);
  -    tvp[0].tv_usec = apr_time_usec(finfo.atime);
  -    tvp[1].tv_sec = apr_time_sec(mtime);
  -    tvp[1].tv_usec = apr_time_usec(mtime);
  -
  -    if (utimes(fname, tvp) == -1) {
  +#ifdef HAVE_UTIMES
  +    {
  +      struct timeval tvp[2];
  +    
  +      tvp[0].tv_sec = apr_time_sec(finfo.atime);
  +      tvp[0].tv_usec = apr_time_usec(finfo.atime);
  +      tvp[1].tv_sec = apr_time_sec(mtime);
  +      tvp[1].tv_usec = apr_time_usec(mtime);
  +      
  +      if (utimes(fname, tvp) == -1) {
  +        return errno;
  +      }
  +    }
  +#elif defined(HAVE_UTIME)
  +    {
  +      struct utimbuf buf;
  +      
  +      buf.actime = (time_t) (finfo.atime / APR_USEC_PER_SEC);
  +      buf.modtime = (time_t) (mtime / APR_USEC_PER_SEC);
  +      
  +      if (utime(fname, &buf) == -1) {
           return errno;
  +      }
       }
  +#else
  +    return APR_ENOTIMPL;
  +#endif
  +
       return APR_SUCCESS;
   }
   
  
  
  

Mime
View raw message