summaryrefslogtreecommitdiffstats
path: root/source/lib/system.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-06-09 06:58:06 +0000
committerAndrew Tridgell <tridge@samba.org>2000-06-09 06:58:06 +0000
commit70dcc791b45ac64fc536ef449e4e6b53b2b68fd4 (patch)
treef031ccc483e128f739c8c3d4b7a5d3e4a74f9bac /source/lib/system.c
parent2a3c994a96dc96f379c4cffbcc3ca314c3d6d292 (diff)
downloadsamba-70dcc791b45ac64fc536ef449e4e6b53b2b68fd4.tar.gz
samba-70dcc791b45ac64fc536ef449e4e6b53b2b68fd4.tar.xz
samba-70dcc791b45ac64fc536ef449e4e6b53b2b68fd4.zip
clean up oplock capability code ready for Linux code
Diffstat (limited to 'source/lib/system.c')
-rw-r--r--source/lib/system.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/source/lib/system.c b/source/lib/system.c
index 80a968b634c..3a9cca6a729 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -438,13 +438,12 @@ struct hostent *sys_gethostbyname(const char *name)
}
+#if defined(HAVE_IRIX_SPECIFIC_CAPABILITIES)
/**************************************************************************
Try and abstract process capabilities (for systems that have them).
****************************************************************************/
-
-BOOL set_process_capability( uint32 cap_flag, BOOL enable )
+static BOOL set_process_capability( uint32 cap_flag, BOOL enable )
{
-#if defined(HAVE_IRIX_SPECIFIC_CAPABILITIES)
if(cap_flag == KERNEL_OPLOCK_CAPABILITY)
{
cap_t cap = cap_get_proc();
@@ -471,7 +470,6 @@ BOOL set_process_capability( uint32 cap_flag, BOOL enable )
DEBUG(10,("set_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
}
-#endif
return True;
}
@@ -479,9 +477,8 @@ BOOL set_process_capability( uint32 cap_flag, BOOL enable )
Try and abstract inherited process capabilities (for systems that have them).
****************************************************************************/
-BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
+static BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
{
-#if defined(HAVE_IRIX_SPECIFIC_CAPABILITIES)
if(cap_flag == KERNEL_OPLOCK_CAPABILITY)
{
cap_t cap = cap_get_proc();
@@ -508,9 +505,20 @@ BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
DEBUG(10,("set_inherited_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
}
-#endif
return True;
}
+#endif
+
+/****************************************************************************
+gain the oplock capability from the kernel if possible
+****************************************************************************/
+void oplock_set_capability(BOOL this_process, BOOL inherit)
+{
+#if HAVE_KERNEL_OPLOCKS_IRIX
+ set_process_capability(KERNEL_OPLOCK_CAPABILITY,this_process);
+ set_inherited_process_capability(KERNEL_OPLOCK_CAPABILITY,inherit);
+#endif
+}
/**************************************************************************
Wrapper for random().