Mercurial > trustbridge
diff common/util.h @ 1332:8362e30f7b55
(issue139) Check that pid is not running if the lock can be aquired
If the lock on the lockfile can be aquired it might still be
possible that another process is running. So we read the
pid from the lockfile and check if another process with the
same installation prefix as us is running.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 15 Oct 2014 14:19:46 +0200 |
parents | 0a803c3fb5a6 |
children |
line wrap: on
line diff
--- a/common/util.h Wed Oct 15 13:24:59 2014 +0200 +++ b/common/util.h Wed Oct 15 14:19:46 2014 +0200 @@ -69,6 +69,22 @@ */ char * get_install_dir(); +#ifndef WIN32 +/**@brief Get the directory in which the process proc resides in + * + * Look up the directory in which the process proc is placed. + * If the path is longer then MAX_PATH NULL is returned. + * + * Returns a utf-8 encoded string that has to be freed by the caller + * on linux the path is returned as is including the last /. + * + * @param[in] A process id or special name from the proc file system. + * + * @returns The directory of the process + */ +char * get_proc_install_dir(const char *proc); +#endif + #ifdef WIN32 /**@brief Get a copy of the processes owner sid *