You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2007/05/15 23:17:14 UTC
svn commit: r538322 - in /apr/apr/branches/0.9.x: file_io/netware/filestat.c
include/arch/netware/apr_arch_file_io.h
Author: bojan
Date: Tue May 15 14:17:13 2007
New Revision: 538322
URL: http://svn.apache.org/viewvc?view=rev&rev=538322
Log:
Backport 538266 from the trunk.
Add the missing file locking APIs and macros to the NetWare build.
Modified:
apr/apr/branches/0.9.x/file_io/netware/filestat.c
apr/apr/branches/0.9.x/include/arch/netware/apr_arch_file_io.h
Modified: apr/apr/branches/0.9.x/file_io/netware/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/file_io/netware/filestat.c?view=diff&rev=538322&r1=538321&r2=538322
==============================================================================
--- apr/apr/branches/0.9.x/file_io/netware/filestat.c (original)
+++ apr/apr/branches/0.9.x/file_io/netware/filestat.c Tue May 15 14:17:13 2007
@@ -77,6 +77,29 @@
*/
}
+apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo,
+ apr_int32_t wanted,
+ apr_file_t *thefile)
+{
+ struct stat info;
+
+ if (thefile->buffered) {
+ apr_status_t rv = apr_file_flush_locked(thefile);
+ if (rv != APR_SUCCESS)
+ return rv;
+ }
+
+ if (fstat(thefile->filedes, &info) == 0) {
+ finfo->pool = thefile->pool;
+ finfo->fname = thefile->fname;
+ fill_out_finfo(finfo, &info, wanted);
+ return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
+ }
+ else {
+ return errno;
+ }
+}
+
APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo,
apr_int32_t wanted,
apr_file_t *thefile)
Modified: apr/apr/branches/0.9.x/include/arch/netware/apr_arch_file_io.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/include/arch/netware/apr_arch_file_io.h?view=diff&rev=538322&r1=538321&r2=538322
==============================================================================
--- apr/apr/branches/0.9.x/include/arch/netware/apr_arch_file_io.h (original)
+++ apr/apr/branches/0.9.x/include/arch/netware/apr_arch_file_io.h Tue May 15 14:17:13 2007
@@ -93,6 +93,20 @@
#endif
};
+#if APR_HAS_THREADS
+#define file_lock(f) do { \
+ if ((f)->thlock) \
+ apr_thread_mutex_lock((f)->thlock); \
+ } while (0)
+#define file_unlock(f) do { \
+ if ((f)->thlock) \
+ apr_thread_mutex_unlock((f)->thlock); \
+ } while (0)
+#else
+#define file_lock(f) do {} while (0)
+#define file_unlock(f) do {} while (0)
+#endif
+
struct apr_dir_t {
apr_pool_t *pool;
char *dirname;
@@ -135,6 +149,10 @@
apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p);
apr_status_t apr_unix_file_cleanup(void *);
+
+apr_status_t apr_file_flush_locked(apr_file_t *thefile);
+apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
+ apr_file_t *thefile);
#endif /* ! FILE_IO_H */