summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2006-11-09 20:29:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:43 -0500
commit4fe70bcee2ec8515f123d8c826631b54bbf793e7 (patch)
tree0fb5daec6104c03c3cd9f9d5521506564d2af6cd /source3/lib
parente513fb27d61d31cdc1a0e723c5345a659cc2caf2 (diff)
downloadsamba-4fe70bcee2ec8515f123d8c826631b54bbf793e7.tar.gz
samba-4fe70bcee2ec8515f123d8c826631b54bbf793e7.tar.bz2
samba-4fe70bcee2ec8515f123d8c826631b54bbf793e7.zip
r19647: Add some GPFS support in a vfs mod. Also adds the kernel flock op to
the vfs layer, since gpfs supports it. Thanks to Volker, Christian, Mathias, Chetan, and Peter. (This used to be commit 0620658890fa9c68a9848538728023192319c81a)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/system.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index a440ece410..9ee3f7cc26 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -379,6 +379,31 @@ FILE *sys_fopen(const char *path, const char *type)
#endif
}
+
+/*******************************************************************
+ A flock() wrapper that will perform the kernel flock.
+********************************************************************/
+
+void kernel_flock(int fd, uint32 share_mode)
+{
+#if HAVE_KERNEL_SHARE_MODES
+ int kernel_mode = 0;
+ if (share_mode == FILE_SHARE_WRITE) {
+ kernel_mode = LOCK_MAND|LOCK_WRITE;
+ } else if (share_mode == FILE_SHARE_READ) {
+ kernel_mode = LOCK_MAND|LOCK_READ;
+ } else if (share_mode == FILE_SHARE_NONE) {
+ kernel_mode = LOCK_MAND;
+ }
+ if (kernel_mode) {
+ flock(fd, kernel_mode);
+ }
+#endif
+ ;
+}
+
+
+
/*******************************************************************
An opendir wrapper that will deal with 64 bit filesizes.
********************************************************************/