LXC
lxclock.h
Go to the documentation of this file.
1 
23 #ifndef __LXC_LXCLOCK_H
24 #define __LXC_LXCLOCK_H
25 
26 #include <fcntl.h> /* For O_* constants */
27 #include <sys/stat.h> /* For mode constants */
28 #include <sys/file.h>
29 #include <semaphore.h>
30 #include <string.h>
31 #include <time.h>
32 
33 #define LXC_LOCK_ANON_SEM 1
34 #define LXC_LOCK_FLOCK 2
36 /* private */
37 
40 struct lxc_lock {
41  short type;
43  union {
44  sem_t *sem;
46  struct {
47  int fd;
48  char *fname;
49  } f;
50  } u;
51 };
52 
81 extern struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name);
82 
99 extern int lxclock(struct lxc_lock *lock, int timeout);
100 
109 extern int lxcunlock(struct lxc_lock *lock);
110 
116 extern void lxc_putlock(struct lxc_lock *lock);
117 
121 extern void process_lock(void);
122 
126 extern void process_unlock(void);
127 
128 struct lxc_container;
129 
137 extern int container_mem_lock(struct lxc_container *c);
138 
144 extern void container_mem_unlock(struct lxc_container *c);
145 
154 extern int container_disk_lock(struct lxc_container *c);
155 
162 extern void container_disk_unlock(struct lxc_container *c);
163 
164 #endif
Definition: lxccontainer.h:63
void container_disk_unlock(struct lxc_container *c)
Unlock the containers disk data.
int fd
Definition: lxclock.h:47
sem_t * sem
Definition: lxclock.h:44
int container_disk_lock(struct lxc_container *c)
Lock the containers disk data.
struct lxc_lock * lxc_newlock(const char *lxcpath, const char *name)
Create a new (unlocked) lock.
char * fname
Definition: lxclock.h:48
short type
Definition: lxclock.h:41
struct lxc_lock::@4::@5 f
union lxc_lock::@4 u
void container_mem_unlock(struct lxc_container *c)
Unlock the containers memory.
Definition: lxclock.h:40
void process_unlock(void)
Unlock the current process.
int container_mem_lock(struct lxc_container *c)
Lock the containers memory.
void process_lock(void)
Lock the current process.
int lxclock(struct lxc_lock *lock, int timeout)
Take an existing lock.
int lxcunlock(struct lxc_lock *lock)
Unlock specified lock previously locked using lxclock().
void lxc_putlock(struct lxc_lock *lock)
Free a lock created by lxc_newlock().