annotate common/linuxlockfile.h @ 1142:148014db2f3b static-libc

(issue126) Commit WIP on static linking libc
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 18 Sep 2014 10:29:38 +0200
parents 78798d3af8f0
children a974b61a5cce
rev   line source
782
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
1 /**
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
2 * @file linuxlockfile.h
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
3 * @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
4 * @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
5 * 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
6 * 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
7 */
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
8
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
9 #ifndef LINUXLOCKFILE_H
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
10 #define LINUXLOCKFILE_H
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
11
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
12 #ifdef __cplusplus
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
13 extern "C" {
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
14 #endif
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 * @brief create a lockfile
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
18 * @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
19 * 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
20 * (e.g. NFS).
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21 * @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
22 * @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
23 */
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
24 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
25
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
26 /**
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
27 * @brief close a lockfile
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
28 * @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
29 * @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
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 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
33
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
34 #ifdef __cplusplus
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
35 }
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
36 #endif
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
37
20ca94680003 Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
38 #endif

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