apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r585343 - in /apr/apr/trunk: CHANGES configure.in file_io/netware/filestat.c file_io/unix/filestat.c include/arch/unix/apr_arch_file_io.h
Date Wed, 17 Oct 2007 03:13:56 GMT
Author: wrowe
Date: Tue Oct 16 20:13:55 2007
New Revision: 585343

URL: http://svn.apache.org/viewvc?rev=585343&view=rev
Log:
Fill in apr_fileinfo_t member st_csize on Netware and Unix

And refine the file times down to apr_time_t resolution if supported
by a st_atimensec or st_atim.tv_nsec value by the OS.  Additional
msec implementations are possible if exposed through autoconf.

PR: 41678
Authored by: William Rowe, Nicklas Edmundsson <nikke acc.umu.se>



Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/configure.in
    apr/apr/trunk/file_io/netware/filestat.c
    apr/apr/trunk/file_io/unix/filestat.c
    apr/apr/trunk/include/arch/unix/apr_arch_file_io.h

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=585343&r1=585342&r2=585343&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Tue Oct 16 20:13:55 2007
@@ -1,6 +1,12 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.3.0
 
+  *) Fill in apr_fileinfo_t member st_csize on Netware and Unix (PR 41678),
+     and refine the file times down to apr_time_t resolution if supported
+     by a st_atimensec or st_atim.tv_nsec value by the OS.  Additional
+     msec implementations are possible if exposed through autoconf.
+     [William Rowe, Nicklas Edmundsson <nikke acc.umu.se>]
+
   *) Fix apr_socket_recvfrom() to ensure the peer's address is returned
      through the "from" parameter on Win32.  [William Rowe]
 

Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=585343&r1=585342&r2=585343&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Tue Oct 16 20:13:55 2007
@@ -1063,8 +1063,6 @@
 AC_SUBST(have_memmove)
 
 APR_CHECK_SIGWAIT_ONE_ARG
-APR_CHECK_DIRENT_INODE
-APR_CHECK_DIRENT_TYPE
 
 dnl ----------------------------- Checks for Any required Headers
 AC_HEADER_STDC
@@ -1118,6 +1116,7 @@
     sys/file.h		\
     sys/ioctl.h         \
     sys/mman.h		\
+    sys/param.h         \
     sys/poll.h		\
     sys/resource.h	\
     sys/select.h	\
@@ -1951,6 +1950,24 @@
 fi
 
 AC_SUBST(rand)
+
+dnl ----------------------------- Checking for File Info Support 
+echo "${nl}Checking for File Info Support..."
+AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_atimensec,
+struct stat.st_ctimensec, struct stat.st_mtimensec, struct stat.st_atim.tv_nsec,
+struct stat.st_ctim.tv_nsec, struct stat.st_mtim.tv_nsec],,,[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif])
+
+APR_CHECK_DIRENT_INODE
+APR_CHECK_DIRENT_TYPE
 
 dnl ----------------------------- Checking for UUID Support 
 echo "${nl}Checking for OS UUID Support..."

Modified: apr/apr/trunk/file_io/netware/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/netware/filestat.c?rev=585343&r1=585342&r2=585343&view=diff
==============================================================================
--- apr/apr/trunk/file_io/netware/filestat.c (original)
+++ apr/apr/trunk/file_io/netware/filestat.c Tue Oct 16 20:13:55 2007
@@ -58,6 +58,7 @@
 { 
     finfo->valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK 
                     | APR_FINFO_OWNER | APR_FINFO_PROT;
+
     finfo->protection = apr_unix_mode2perms(info->st_mode);
     finfo->filetype = filetype_from_mode(info->st_mode);
     finfo->user = info->st_uid;
@@ -66,15 +67,19 @@
     finfo->inode = info->st_ino;
     finfo->device = info->st_dev;
     finfo->nlink = info->st_nlink;
+
     apr_time_ansi_put(&finfo->atime, info->st_atime.tv_sec);
     apr_time_ansi_put(&finfo->mtime, info->st_mtime.tv_sec);
     apr_time_ansi_put(&finfo->ctime, info->st_ctime.tv_sec);
-    /* ### needs to be revisited  
-     * if (wanted & APR_FINFO_CSIZE) {
-     *   finfo->csize = info->st_blocks * 512;
-     *   finfo->valid |= APR_FINFO_CSIZE;
-     * }
-     */
+
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+#ifdef DEV_BSIZE
+    finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)DEV_BSIZE;
+#else
+    finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)512;
+#endif
+    finfo->valid |= APR_FINFO_CSIZE;
+#endif
 }
 
 apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,

Modified: apr/apr/trunk/file_io/unix/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/filestat.c?rev=585343&r1=585342&r2=585343&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/filestat.c (original)
+++ apr/apr/trunk/file_io/unix/filestat.c Tue Oct 16 20:13:55 2007
@@ -90,14 +90,34 @@
     }
 
     apr_time_ansi_put(&finfo->atime, info->st_atime);
+#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+    finfo->atime += info->st_atim.tv_nsec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
+    finfo->atime += info->st_atimensec / APR_TIME_C(1000);
+#endif
+
     apr_time_ansi_put(&finfo->mtime, info->st_mtime);
+#ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+    finfo->mtime += info->st_mtim.tv_nsec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
+    finfo->mtime += info->st_mtimensec / APR_TIME_C(1000);
+#endif
+
     apr_time_ansi_put(&finfo->ctime, info->st_ctime);
-    /* ### needs to be revisited  
-     * if (wanted & APR_FINFO_CSIZE) {
-     *   finfo->csize = info->st_blocks * 512;
-     *   finfo->valid |= APR_FINFO_CSIZE;
-     * }
-     */
+#ifdef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC
+    finfo->ctime += info->st_ctim.tv_nsec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC)
+    finfo->ctime += info->st_ctimensec / APR_TIME_C(1000);
+#endif
+
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+#ifdef DEV_BSIZE
+    finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)DEV_BSIZE;
+#else
+    finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)512;
+#endif
+    finfo->valid |= APR_FINFO_CSIZE;
+#endif
 }
 
 apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,

Modified: apr/apr/trunk/include/arch/unix/apr_arch_file_io.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/unix/apr_arch_file_io.h?rev=585343&r1=585342&r2=585343&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/unix/apr_arch_file_io.h (original)
+++ apr/apr/trunk/include/arch/unix/apr_arch_file_io.h Tue Oct 16 20:13:55 2007
@@ -70,6 +70,10 @@
 #ifdef BEOS
 #include <kernel/OS.h>
 #endif
+/* Hunting down DEV_BSIZE if not from dirent.h, sys/stat.h etc */
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 
 #if BEOS_BONE
 # ifndef BONE7



Mime
View raw message