*/
#define _GNU_SOURCE
-#include "lxclock.h"
#include <malloc.h>
#include <stdio.h>
#include <errno.h>
#include <lxc/lxccontainer.h>
+#include "lxclock.h"
#include "utils.h"
#include "log.h"
if ((ret = pthread_mutex_lock(l)) != 0) {
fprintf(stderr, "pthread_mutex_lock returned:%d %s\n", ret, strerror(ret));
dump_stacktrace();
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if ((ret = pthread_mutex_unlock(l)) != 0) {
fprintf(stderr, "pthread_mutex_unlock returned:%d %s\n", ret, strerror(ret));
dump_stacktrace();
- exit(1);
+ exit(EXIT_FAILURE);
}
}
ret = -2;
if (timeout) {
ERROR("Error: timeout not supported with flock");
- ret = -2;
goto out;
}
if (!l->u.f.fname) {
ERROR("Error: filename not set for flock");
- ret = -2;
goto out;
}
if (l->u.f.fd == -1) {
* will be placed in \c l->u.sem.
*
* If \ref lxcpath and \ref name are given (both must be given if either is
- * given) then a lockfile is created as \c $lxcpath/$lxcname/locks/$name.
+ * given) then a lockfile is created as \c /run/lxc/lock/$lxcpath/.$name if root,
+ * or \c $XDG_RUNTIME_DIR/lxc/lock/$lxcpath/.$name if non-root.
* The lock is used to protect the containers on-disk representation.
*
* \internal This function allocates the pathname for the given lock in memory
* indefinite wait).
*
* \return \c 0 if lock obtained, \c -2 on failure to set timeout,
- * or \c -1 on any other error (\c errno will be set by \c sem_wait(3)).
+ * or \c -1 on any other error (\c errno will be set by \c sem_wait(3)
+ * or \c fcntl(2)).
*
* \note \p timeout is (currently?) only supported for privlock, not
* for slock. Since currently there is not a single use of the timeout
* \param lock \ref lxc_lock.
*
* \return \c 0 on success, \c -2 if provided lock was not already held,
- * otherwise \c -1 with \c errno saved from \c flock(2) or sem_post function.
+ * otherwise \c -1 with \c errno saved from \c fcntl(2) or sem_post function.
*/
extern int lxcunlock(struct lxc_lock *lock);
/*!
* \brief Unlock the containers disk data.
+ *
+ * \param c Container.
+ *
*/
extern void container_disk_unlock(struct lxc_container *c);