/* Unix SMB/CIFS implementation. kernel oplock processing for Linux Copyright (C) Andrew Tridgell 2000 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define DBGC_CLASS DBGC_LOCKING #include #include #include #include #include #include #include typedef unsigned int uint32; /* these can be removed when they are in glibc headers */ struct cap_user_header { uint32 version; int pid; } header; struct cap_user_data { uint32 effective; uint32 permitted; uint32 inheritable; } data; extern int capget(struct cap_user_header * hdrp, struct cap_user_data * datap); extern int capset(struct cap_user_header * hdrp, const struct cap_user_data * datap); #ifndef F_SETLEASE #define F_SETLEASE 1024 #endif #ifndef F_GETLEASE #define F_GETLEASE 1025 #endif #ifndef CAP_LEASE #define CAP_LEASE 28 #endif #ifndef RT_SIGNAL_LEASE #define RT_SIGNAL_LEASE (SIGRTMIN+1) #endif #ifndef F_SETSIG #define F_SETSIG 10 #endif /**************************************************************************** Try to gain a linux capability. ****************************************************************************/ static void set_capability(unsigned capability) { #ifndef _LINUX_CAPABILITY_VERSION #define _LINUX_CAPABILITY_VERSION 0x19980330 #endif header.version = _LINUX_CAPABILITY_VERSION; header.pid = 0; if (capget(&header, &data) == -1) { printf("Unable to get kernel capabilities (%s)\n", strerror(errno)); return; } data.effective |= (1<