LXC
Loading...
Searching...
No Matches
lxclock.h
1/* SPDX-License-Identifier: LGPL-2.1+ */
2
3#ifndef __LXC_LXCLOCK_H
4#define __LXC_LXCLOCK_H
5
6#include "config.h"
7
8#include <fcntl.h>
9#include <semaphore.h>
10#include <string.h>
11#include <sys/file.h>
12#include <sys/stat.h>
13#include <time.h>
14#include <unistd.h>
15
16#include "compiler.h"
17
18#ifndef F_OFD_GETLK
19#define F_OFD_GETLK 36
20#endif
21
22#ifndef F_OFD_SETLK
23#define F_OFD_SETLK 37
24#endif
25
26#ifndef F_OFD_SETLKW
27#define F_OFD_SETLKW 38
28#endif
29
30#define LXC_LOCK_ANON_SEM 1
31#define LXC_LOCK_FLOCK 2
33/* private */
37struct lxc_lock {
38 short type;
40 union {
41 sem_t *sem;
43 struct {
44 int fd;
45 char *fname;
46 } f;
47 } u;
48};
49
78__hidden extern struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name);
79
96__hidden extern int lxclock(struct lxc_lock *lock, int timeout);
97
106__hidden extern int lxcunlock(struct lxc_lock *lock);
107
113__hidden extern void lxc_putlock(struct lxc_lock *lock);
114
118__hidden extern void process_lock(void);
119
123__hidden extern void process_unlock(void);
124
125struct lxc_container;
126
134__hidden extern int container_mem_lock(struct lxc_container *c);
135
141__hidden extern void container_mem_unlock(struct lxc_container *c);
142
151__hidden extern int container_disk_lock(struct lxc_container *c);
152
159__hidden extern void container_disk_unlock(struct lxc_container *c);
160
161#endif
Definition lxccontainer.h:50
Definition lxclock.h:37
union lxc_lock::@4 u
int fd
Definition lxclock.h:44
sem_t * sem
Definition lxclock.h:41
struct lxc_lock::@4::@5 f
char * fname
Definition lxclock.h:45
short type
Definition lxclock.h:38