summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-08-28 15:16:36 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-08-28 15:16:36 (GMT)
commit30021a95793bbbcd1a7e1ea6c2ccad33f75dbca6 (patch)
tree52709326907f3c0c8ab3e6aa03f94f71be4867de /src/H5private.h
parent9e50696cbde187023027b01cf62c6661fb431291 (diff)
downloadhdf5-30021a95793bbbcd1a7e1ea6c2ccad33f75dbca6.zip
hdf5-30021a95793bbbcd1a7e1ea6c2ccad33f75dbca6.tar.gz
hdf5-30021a95793bbbcd1a7e1ea6c2ccad33f75dbca6.tar.bz2
[svn-r27604] Added (putative) Windows and fcntl-based flock implementations.
Fixes SWMR-18 Tested on: jam and emu (Windows pending CMake changes)
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/H5private.h b/src/H5private.h
index f65f2e7..e5e6cae 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -737,7 +737,8 @@ typedef struct {
#ifndef HDfclose
#define HDfclose(F) fclose(F)
#endif /* HDfclose */
-/* fcntl() variable arguments */
+#ifdef H5_HAVE_FCNTL
+ #ifndef HDfcntl(F,C,...) fcntl(F,C,__VA_ARGS__)
#ifndef HDfdopen
#define HDfdopen(N,S) fdopen(N,S)
#endif /* HDfdopen */
@@ -763,13 +764,19 @@ typedef struct {
#define HDfileno(F) fileno(F)
#endif /* HDfileno */
#ifndef HDflock
- /* Flock is not present on all POSIX systems. When it is not present,
- * do nothing (locking is advisory only).
+ /* NOTE: flock(2) is not present on all POSIX systems.
+ * If it is not present, we try a flock() equivalent based on
+ * fcntl(2), then fall back to a function that always fails if
+ * it is not present at all.
*/
- #ifdef H5_HAVE_FLOCK
+ #if defined(H5_HAVE_FLOCK)
#define HDflock(F,L) flock(F,L)
+ #elif defined(H5_HAVE_FCNTL)
+ H5_DLL int Pflock(int fd, int operation);
+ #define HDflock(F,L) Pflock(F,L)
#else
- #define HDflock(F,L) 0
+ H5_DLL int Nflock(int fd, int operation);
+ #define HDflock(F,L) Nflock(F,L)
#endif /* H5_HAVE_FLOCK */
#endif /* HDflock */
#ifndef HDfloor