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 #include "csync.h"
25 
26 /**
27  * @file csync_lock.h
28  *
29  * @brief File locking
30  *
31  * This prevents csync to start the same synchronization task twice which could
32  * lead to several problems.
33  *
34  * @defgroup csyncLockingInternals csync file lockling internals
35  * @ingroup csyncInternalAPI
36  *
37  * @{
38  */
39 
40 /**
41  * @brief Lock the client if possible.
42  *
43  * This functiion tries to lock the client with a lock file.
44  *
45  * @param lockfile The lock file to create.
46  *
47  * @return 0 if the lock was successfull, less than 0 if the lock file
48  * couldn't be created or if it is already locked.
49  */
50 int csync_lock(CSYNC *ctx, const char *lockfile);
51 
52 /**
53  * @brief Remove the lockfile
54  *
55  * Only our own lock can be removed. This function can't remove a lock from
56  * another client.
57  *
58  * @param lockfile The lock file to remove.
59  */
60 void csync_lock_remove(CSYNC *ctx, const char *lockfile);
61 
62 /**
63  * }@
64  */
65 #endif /* _CSYNC_LOCK_H */
66 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */