diff options
author | Jim McDonough <jmcd@samba.org> | 2006-11-09 20:29:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:15:43 -0500 |
commit | 0620658890fa9c68a9848538728023192319c81a (patch) | |
tree | 22cdd87983c019addb51b61a20ba50627c6f6567 /source/lib/system.c | |
parent | 4ec896cdbe441b17d91895a50ac9be61efe2f9c1 (diff) | |
download | samba-0620658890fa9c68a9848538728023192319c81a.tar.gz |
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.
Diffstat (limited to 'source/lib/system.c')
-rw-r--r-- | source/lib/system.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/lib/system.c b/source/lib/system.c index a440ece410a..9ee3f7cc26a 100644 --- a/source/lib/system.c +++ b/source/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. ********************************************************************/ |