source: branches/samba-3.0/source/smbd/oplock_irix.c@ 112

Last change on this file since 112 was 1, checked in by Paul Smedley, 19 years ago

Initial code import

File size: 8.1 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 IRIX kernel oplock processing
4 Copyright (C) Andrew Tridgell 1992-1998
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#define DBGC_CLASS DBGC_LOCKING
22#include "includes.h"
23
24#if HAVE_KERNEL_OPLOCKS_IRIX
25
26static int oplock_pipe_write = -1;
27static int oplock_pipe_read = -1;
28
29/****************************************************************************
30 Test to see if IRIX kernel oplocks work.
31****************************************************************************/
32
33static BOOL irix_oplocks_available(void)
34{
35 int fd;
36 int pfd[2];
37 pstring tmpname;
38
39 set_effective_capability(KERNEL_OPLOCK_CAPABILITY);
40
41 slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(),
42 (int)sys_getpid());
43
44 if(pipe(pfd) != 0) {
45 DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error "
46 "was %s\n",
47 strerror(errno) ));
48 return False;
49 }
50
51 if((fd = sys_open(tmpname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600)) < 0) {
52 DEBUG(0,("check_kernel_oplocks: Unable to open temp test file "
53 "%s. Error was %s\n",
54 tmpname, strerror(errno) ));
55 unlink( tmpname );