apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject svn commit: r538263 - in /apr/apr/branches/1.2.x: file_io/netware/filestat.c include/arch/netware/apr_arch_file_io.h
Date Tue, 15 May 2007 17:49:58 GMT
Author: bnicholes
Date: Tue May 15 10:49:58 2007
New Revision: 538263

URL: http://svn.apache.org/viewvc?view=rev&rev=538263
Log:
Add the missing file locking APIs and macros to the NetWare build

Modified:
    apr/apr/branches/1.2.x/file_io/netware/filestat.c
    apr/apr/branches/1.2.x/include/arch/netware/apr_arch_file_io.h

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?view=diff&rev=538263&r1=538262&r2=538263
==============================================================================
--- apr/apr/branches/1.2.x/file_io/netware/filestat.c (original)
+++ apr/apr/branches/1.2.x/file_io/netware/filestat.c Tue May 15 10:49:58 2007
@@ -77,6 +77,28 @@
      */
 }
 
+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/1.2.x/include/arch/netware/apr_arch_file_io.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/include/arch/netware/apr_arch_file_io.h?view=diff&rev=538263&r1=538262&r2=538263
==============================================================================
--- apr/apr/branches/1.2.x/include/arch/netware/apr_arch_file_io.h (original)
+++ apr/apr/branches/1.2.x/include/arch/netware/apr_arch_file_io.h Tue May 15 10:49:58 2007
@@ -71,6 +71,20 @@
 
 #define APR_FILE_BUFSIZE 4096
 
+#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
+
 #if APR_HAS_LARGE_FILES
 #define lseek(f,o,w) lseek64(f,o,w)
 #define ftruncate(f,l) ftruncate64(f,l)
@@ -146,6 +160,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 */
 



Mime
View raw message