You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2007/10/17 05:16:40 UTC
svn commit: r585344 - in /apr/apr/branches/1.2.x: CHANGES configure.in
file_io/netware/filestat.c file_io/unix/filestat.c
include/arch/unix/apr_arch_file_io.h
Author: wrowe
Date: Tue Oct 16 20:16:38 2007
New Revision: 585344
URL: http://svn.apache.org/viewvc?rev=585344&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/branches/1.2.x/CHANGES
apr/apr/branches/1.2.x/configure.in
apr/apr/branches/1.2.x/file_io/netware/filestat.c
apr/apr/branches/1.2.x/file_io/unix/filestat.c
apr/apr/branches/1.2.x/include/arch/unix/apr_arch_file_io.h
Modified: apr/apr/branches/1.2.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/CHANGES?rev=585344&r1=585343&r2=585344&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.2.x/CHANGES [utf-8] Tue Oct 16 20:16:38 2007
@@ -1,6 +1,12 @@
-*- coding: utf-8 -*-
Changes for APR 1.2.12
+ *) 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 port and address
is returned through the "from" parameter on Unix and Win32.
[Joe Orton, William Rowe]
Modified: apr/apr/branches/1.2.x/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/configure.in?rev=585344&r1=585343&r2=585344&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/configure.in (original)
+++ apr/apr/branches/1.2.x/configure.in Tue Oct 16 20:16:38 2007
@@ -966,8 +966,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
@@ -1020,6 +1018,7 @@
sys/file.h \
sys/ioctl.h \
sys/mman.h \
+ sys/param.h \
sys/poll.h \
sys/resource.h \
sys/select.h \
@@ -1818,6 +1817,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/branches/1.2.x/file_io/netware/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/file_io/netware/filestat.c?rev=585344&r1=585343&r2=585344&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/file_io/netware/filestat.c (original)
+++ apr/apr/branches/1.2.x/file_io/netware/filestat.c Tue Oct 16 20:16:38 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/branches/1.2.x/file_io/unix/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/file_io/unix/filestat.c?rev=585344&r1=585343&r2=585344&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/file_io/unix/filestat.c (original)
+++ apr/apr/branches/1.2.x/file_io/unix/filestat.c Tue Oct 16 20:16:38 2007
@@ -81,14 +81,34 @@
finfo->device = info->st_dev;
finfo->nlink = info->st_nlink;
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/branches/1.2.x/include/arch/unix/apr_arch_file_io.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/include/arch/unix/apr_arch_file_io.h?rev=585344&r1=585343&r2=585344&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/include/arch/unix/apr_arch_file_io.h (original)
+++ apr/apr/branches/1.2.x/include/arch/unix/apr_arch_file_io.h Tue Oct 16 20:16:38 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