1 /* 2 * locks.h: 3 * Various means of locking files. 4 * 5 * Copyright (c) 2001 Chris Lightfoot. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef __LOCKS_H_ /* include guard */ 23 #define __LOCKS_H_ 24 25 #ifdef HAVE_CONFIG_H 26 #include "configuration.h" 27 #endif /* HAVE_CONFIG.H */ 28 29 #ifdef MBOX_BSD 30 31 #if !defined(WITH_FCNTL_LOCKING) && !defined(WITH_FLOCK_LOCKING) && !defined(WITH_DOTFILE_LOCKING) 32 # warning "No locking scheme defined; using dotfiles and flock(2)." 33 # define WITH_FCNTL_LOCKING 34 # define WITH_DOTFILE_LOCKING 35 #endif 36 37 #ifdef WITH_FCNTL_LOCKING 38 int fcntl_lock(int); 39 int fcntl_unlock(int); 40 #endif 41 42 #if defined(WITH_FLOCK_LOCKING) || (defined(WITH_CCLIENT_LOCKING) && !defined(CCLIENT_USES_FCNTL)) 43 int flock_lock(int); 44 int flock_unlock(int); 45 #endif 46 47 #ifdef WITH_DOTFILE_LOCKING 48 int dotfile_lock(const char*); 49 int dotfile_unlock(const char *); 50 #endif 51 52 #ifdef WITH_CCLIENT_LOCKING 53 int cclient_steal_lock(int); 54 #endif 55 56 #endif /* MBOX_BSD */ 57 58 #endif /* __LOCKS_H_ */ 59