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-2013 by Andreas Schneider <asn@cryptomilk.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, 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(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(const char *lockfile);
61 
62 /**
63  * }@
64  */
65 #endif /* _CSYNC_LOCK_H */
66 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
Application developer interface for csync.
int csync_lock(const char *lockfile)
Lock the client if possible.
void csync_lock_remove(const char *lockfile)
Remove the lockfile.