view common/linuxlockfile.h @ 1306:845048d4a69f

(issue159) Use user specific appdata directory for nss list with simple rights. Using the ProgramData folder with resticted access rights failed in case the process was not elevated.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 13 Oct 2014 12:31:37 +0200
parents a974b61a5cce
children
line wrap: on
line source
/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */

/**
 * @file  linuxlockfile.h
 * @brief Linux specific functions for lock file handling.
 * @details Functions to handle procsss specific lock files, these are
 * only used on GNU Linux as on windows different mechanisms are
 * utilized to ensure only a single instance runs at a time.
 */

#ifndef LINUXLOCKFILE_H
#define LINUXLOCKFILE_H

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief create a lockfile
 * @details create and lock a lockfile containing the pid of the
 * current process.  fcntl is used for locking, to work in most cases
 * (e.g. NFS).
 * @param[in] path to the lockfile
 * @returns the file descriptor of the lockfile or -1 on error
 */
int open_lockfile(char *path);

/**
 * @brief close a lockfile
 * @details unlock and close a lockfile for the given file descriptor.
 * @param[in] fd TODO
 * @returns the file descriptor of the lockfile or -1 on error
 */
void close_lockfile(int fd);

#ifdef __cplusplus
}
#endif

#endif

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