doc
csync_lock.h
Go to the documentation of this file.
1 /*
2  * libcsync -- a library to sync a directory with another
3  *
4  * Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (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 Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _CSYNC_LOCK_H
22 #define _CSYNC_LOCK_H
23 
24 /**
25  * @file csync_lock.h
26  *
27  * @brief File locking
28  *
29  * This prevents csync to start the same synchronization task twice which could
30  * lead to several problems.
31  *
32  * @defgroup csyncLockingInternals csync file lockling internals
33  * @ingroup csyncInternalAPI
34  *
35  * @{
36  */
37 
38 /**
39  * @brief Lock the client if possible.
40  *
41  * This functiion tries to lock the client with a lock file.
42  *
43  * @param lockfile The lock file to create.
44  *
45  * @return 0 if the lock was successfull, less than 0 if the lock file
46  * couldn't be created or if it is already locked.
47  */
48 int csync_lock(const char *lockfile);
49 
50 /**
51  * @brief Remove the lockfile
52  *
53  * Only our own lock can be removed. This function can't remove a lock from
54  * another client.
55  *
56  * @param lockfile The lock file to remove.
57  */
58 void csync_lock_remove(const char *lockfile);
59 
60 /**
61  * }@
62  */
63 #endif /* _CSYNC_LOCK_H */
64 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */