andre@1160: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
andre@1160:  * Software engineering by Intevation GmbH
andre@1160:  *
andre@1160:  * This file is Free Software under the GNU GPL (v>=2)
andre@1160:  * and comes with ABSOLUTELY NO WARRANTY!
andre@1160:  * See LICENSE.txt for details.
andre@1160:  */
andre@1160: 
wilde@782: /**
wilde@782:  * @file  linuxlockfile.h
wilde@782:  * @brief Linux specific functions for lock file handling.
wilde@782:  * @details Functions to handle procsss specific lock files, these are
wilde@782:  * only used on GNU Linux as on windows different mechanisms are
wilde@782:  * utilized to ensure only a single instance runs at a time.
wilde@782:  */
wilde@782: 
wilde@782: #ifndef LINUXLOCKFILE_H
wilde@782: #define LINUXLOCKFILE_H
wilde@782: 
wilde@782: #ifdef __cplusplus
wilde@782: extern "C" {
wilde@782: #endif
wilde@782: 
wilde@782: /**
wilde@782:  * @brief create a lockfile
wilde@782:  * @details create and lock a lockfile containing the pid of the
wilde@782:  * current process.  fcntl is used for locking, to work in most cases
wilde@782:  * (e.g. NFS).
wilde@782:  * @param[in] path to the lockfile
wilde@782:  * @returns the file descriptor of the lockfile or -1 on error
wilde@782:  */
wilde@782: int open_lockfile(char *path);
wilde@782: 
wilde@782: /**
wilde@782:  * @brief close a lockfile
wilde@782:  * @details unlock and close a lockfile for the given file descriptor.
emanuel@1053:  * @param[in] fd TODO
wilde@782:  * @returns the file descriptor of the lockfile or -1 on error
wilde@782:  */
wilde@782: void close_lockfile(int fd);
wilde@782: 
wilde@782: #ifdef __cplusplus
wilde@782: }
wilde@782: #endif
wilde@782: 
wilde@782: #endif