annotate common/linuxlockfile.h @ 1315:12ed0b72e9f5

(issue162) Change DO_RELEASE_BUILD to IS_TAG_BUILD to determine g_debug initializatation
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 13 Oct 2014 16:19:28 +0200
parents a974b61a5cce
children
rev   line source
1160
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
2 * Software engineering by Intevation GmbH
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
3 *
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
6 * See LICENSE.txt for details.
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
7 */
a974b61a5cce (issue108) Add missing license headers
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
8
782
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
9 /**
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
10 * @file linuxlockfile.h
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
11 * @brief Linux specific functions for lock file handling.
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
12 * @details Functions to handle procsss specific lock files, these are
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
13 * only used on GNU Linux as on windows different mechanisms are
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
14 * utilized to ensure only a single instance runs at a time.
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
15 */
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
16
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
17 #ifndef LINUXLOCKFILE_H
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
18 #define LINUXLOCKFILE_H
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
19
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
20 #ifdef __cplusplus
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21 extern "C" {
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
22 #endif
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
23
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
24 /**
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
25 * @brief create a lockfile
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
26 * @details create and lock a lockfile containing the pid of the
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
27 * current process. fcntl is used for locking, to work in most cases
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
28 * (e.g. NFS).
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
29 * @param[in] path to the lockfile
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
30 * @returns the file descriptor of the lockfile or -1 on error
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
31 */
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
32 int open_lockfile(char *path);
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
33
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
34 /**
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
35 * @brief close a lockfile
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
36 * @details unlock and close a lockfile for the given file descriptor.
1053
78798d3af8f0 Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 782
diff changeset
37 * @param[in] fd TODO
782
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
38 * @returns the file descriptor of the lockfile or -1 on error
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
39 */
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
40 void close_lockfile(int fd);
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
41
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
42 #ifdef __cplusplus
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
43 }
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
44 #endif
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
45
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
46 #endif

http://wald.intevation.org/projects/trustbridge/