apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject svn commit: r538266 - in /apr/apr/trunk: file_io/netware/filestat.c include/arch/netware/apr_arch_file_io.h
Date Tue, 15 May 2007 17:51:35 GMT
Author: bnicholes
Date: Tue May 15 10:51:34 2007
New Revision: 538266

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

Modified:
    apr/apr/trunk/file_io/netware/filestat.c
    apr/apr/trunk/include/arch/netware/apr_arch_file_io.h

Modified: apr/apr/trunk/file_io/netware/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/netware/filestat.c?view=diff&rev=538266&r1=538265&r2=538266
==============================================================================
--- apr/apr/trunk/file_io/netware/filestat.c (original)
+++ apr/apr/trunk/file_io/netware/filestat.c Tue May 15 10:51:34 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/trunk/include/arch/netware/apr_arch_file_io.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/netware/apr_arch_file_io.h?view=diff&rev=538266&r1=538265&r2=538266
==============================================================================
--- apr/apr/trunk/include/arch/netware/apr_arch_file_io.h (original)
+++ apr/apr/trunk/include/arch/netware/apr_arch_file_io.h Tue May 15 10:51:34 2007
@@ -73,6 +73,20 @@
 /* For backwards compat */
 #define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE
 
+#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)
@@ -150,6 +164,10 @@
 
 apr_status_t apr_unix_file_cleanup(void *);
 apr_status_t apr_unix_child_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