Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
eae6543d
Commit
eae6543d
authored
Sep 05, 2008
by
dlezcano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Header code cleanup
parent
b113348e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
96 additions
and
75 deletions
+96
-75
Makefile.am
src/lxc/Makefile.am
+1
-0
destroy.c
src/lxc/destroy.c
+0
-1
lxc.h
src/lxc/lxc.h
+2
-1
lxc_cgroup.c
src/lxc/lxc_cgroup.c
+10
-5
lxc_conf.c
src/lxc/lxc_conf.c
+13
-13
lxc_conf.h
src/lxc/lxc_conf.h
+3
-3
lxc_config.c
src/lxc/lxc_config.c
+7
-7
lxc_monitor.c
src/lxc/lxc_monitor.c
+25
-37
lxc_state.c
src/lxc/lxc_state.c
+0
-1
monitor.c
src/lxc/monitor.c
+23
-6
monitor.h
src/lxc/monitor.h
+11
-0
lxc_create.c
test/lxc_create.c
+1
-1
No files found.
src/lxc/Makefile.am
View file @
eae6543d
...
@@ -2,6 +2,7 @@ INCLUDES= -I$(top_srcdir)/src
...
@@ -2,6 +2,7 @@ INCLUDES= -I$(top_srcdir)/src
lib_LTLIBRARIES
=
liblxc.la
lib_LTLIBRARIES
=
liblxc.la
pkginclude_HEADERS
=
\
pkginclude_HEADERS
=
\
monitor.h
\
lxc.h
\
lxc.h
\
lxc_cgroup.h
\
lxc_cgroup.h
\
lxc_conf.h
\
lxc_conf.h
\
...
...
src/lxc/destroy.c
View file @
eae6543d
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include <sys/param.h>
#include <sys/param.h>
#include <lxc/lxc.h>
#include <lxc/lxc.h>
#include "monitor.h"
static
int
dir_filter
(
const
struct
dirent
*
dirent
)
static
int
dir_filter
(
const
struct
dirent
*
dirent
)
{
{
...
...
src/lxc/lxc.h
View file @
eae6543d
...
@@ -41,6 +41,7 @@ extern "C" {
...
@@ -41,6 +41,7 @@ extern "C" {
#include <lxc/lxc_cgroup.h>
#include <lxc/lxc_cgroup.h>
#include <lxc/lxc_namespace.h>
#include <lxc/lxc_namespace.h>
#include <lxc/lxc_utils.h>
#include <lxc/lxc_utils.h>
#include <lxc/monitor.h>
#define LXCPATH "/var/lxc"
#define LXCPATH "/var/lxc"
#define MAXPIDLEN 20
#define MAXPIDLEN 20
...
@@ -130,7 +131,7 @@ extern int lxc_monitor_open(const char *name);
...
@@ -130,7 +131,7 @@ extern int lxc_monitor_open(const char *name);
* Returns 0 if the monitored container has exited, > 0 if
* Returns 0 if the monitored container has exited, > 0 if
* data was readen, < 0 otherwise
* data was readen, < 0 otherwise
*/
*/
extern
int
lxc_monitor_read
(
int
fd
,
lxc_state_t
*
state
);
extern
int
lxc_monitor_read
(
int
fd
,
struct
lxc_msg
*
msg
);
/*
/*
* Close the fd associated with the monitoring
* Close the fd associated with the monitoring
...
...
src/lxc/lxc_cgroup.c
View file @
eae6543d
...
@@ -104,17 +104,21 @@ int lxc_unlink_nsgroup(const char *name)
...
@@ -104,17 +104,21 @@ int lxc_unlink_nsgroup(const char *name)
int
lxc_cgroup_set_priority
(
const
char
*
name
,
int
priority
)
int
lxc_cgroup_set_priority
(
const
char
*
name
,
int
priority
)
{
{
int
fd
;
int
fd
;
char
*
path
=
NULL
,
*
prio
=
NULL
;
char
path
[
MAXPATHLEN
]
,
*
prio
=
NULL
;
asprintf
(
&
path
,
LXCPATH
"/%s/nsgroup/cpu.shares"
,
name
);
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s/nsgroup/cpu.shares"
,
name
);
fd
=
open
(
path
,
O_WRONLY
);
fd
=
open
(
path
,
O_WRONLY
);
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
lxc_log_syserror
(
"failed to open '%s'"
,
path
);
lxc_log_syserror
(
"failed to open '%s'"
,
path
);
goto
out
;
return
-
1
;
}
}
asprintf
(
&
prio
,
"%d"
,
priority
);
if
(
!
asprintf
(
&
prio
,
"%d"
,
priority
))
{
lxc_log_syserror
(
"not enough memory"
);
goto
out
;
}
if
(
write
(
fd
,
prio
,
strlen
(
prio
)
+
1
)
<
0
)
{
if
(
write
(
fd
,
prio
,
strlen
(
prio
)
+
1
)
<
0
)
{
lxc_log_syserror
(
"failed to write to '%s'"
,
path
);
lxc_log_syserror
(
"failed to write to '%s'"
,
path
);
...
@@ -122,9 +126,10 @@ int lxc_cgroup_set_priority(const char *name, int priority)
...
@@ -122,9 +126,10 @@ int lxc_cgroup_set_priority(const char *name, int priority)
goto
out
;
goto
out
;
}
}
lxc_monitor_send_priority
(
name
,
priority
);
close
(
fd
);
close
(
fd
);
out:
out:
free
(
path
);
free
(
prio
);
free
(
prio
);
return
0
;
return
0
;
}
}
...
...
src/lxc/lxc_conf.c
View file @
eae6543d
...
@@ -404,13 +404,13 @@ static int configure_cgroup(const char *name, struct lxc_cgroup *cgroup)
...
@@ -404,13 +404,13 @@ static int configure_cgroup(const char *name, struct lxc_cgroup *cgroup)
return
0
;
return
0
;
}
}
static
int
configure_
chroot
(
const
char
*
name
,
const
char
*
chroot
)
static
int
configure_
rootfs
(
const
char
*
name
,
const
char
*
rootfs
)
{
{
char
path
[
MAXPATHLEN
];
char
path
[
MAXPATHLEN
];
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s/
chroot
"
,
name
);
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s/
rootfs
"
,
name
);
return
symlink
(
chroot
,
path
);
return
symlink
(
rootfs
,
path
);
}
}
...
@@ -524,12 +524,12 @@ static int unconfigure_cgroup(const char *name)
...
@@ -524,12 +524,12 @@ static int unconfigure_cgroup(const char *name)
return
0
;
return
0
;
}
}
static
int
unconfigure_
chroot
(
const
char
*
name
)
static
int
unconfigure_
rootfs
(
const
char
*
name
)
{
{
char
path
[
MAXPATHLEN
];
char
path
[
MAXPATHLEN
];
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s"
,
name
);
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s"
,
name
);
delete_info
(
path
,
"
chroot
"
);
delete_info
(
path
,
"
rootfs
"
);
return
0
;
return
0
;
}
}
...
@@ -578,11 +578,11 @@ static int setup_utsname(const char *name)
...
@@ -578,11 +578,11 @@ static int setup_utsname(const char *name)
return
0
;
return
0
;
}
}
static
int
setup_
chroot
(
const
char
*
name
)
static
int
setup_
rootfs
(
const
char
*
name
)
{
{
char
path
[
MAXPATHLEN
],
chrt
[
MAXPATHLEN
];
char
path
[
MAXPATHLEN
],
chrt
[
MAXPATHLEN
];
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s/
chroot
"
,
name
);
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s/
rootfs
"
,
name
);
if
(
readlink
(
path
,
chrt
,
MAXPATHLEN
)
>
0
)
{
if
(
readlink
(
path
,
chrt
,
MAXPATHLEN
)
>
0
)
{
...
@@ -889,8 +889,8 @@ int lxc_configure(const char *name, struct lxc_conf *conf)
...
@@ -889,8 +889,8 @@ int lxc_configure(const char *name, struct lxc_conf *conf)
return
-
1
;
return
-
1
;
}
}
if
(
conf
->
chroot
&&
configure_chroot
(
name
,
conf
->
chroot
))
{
if
(
conf
->
rootfs
&&
configure_rootfs
(
name
,
conf
->
rootfs
))
{
lxc_log_error
(
"failed to configure the
chroot
"
);
lxc_log_error
(
"failed to configure the
rootfs
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -913,8 +913,8 @@ int lxc_unconfigure(const char *name)
...
@@ -913,8 +913,8 @@ int lxc_unconfigure(const char *name)
if
(
unconfigure_cgroup
(
name
))
if
(
unconfigure_cgroup
(
name
))
lxc_log_error
(
"failed to cleanup cgroup"
);
lxc_log_error
(
"failed to cleanup cgroup"
);
if
(
conf_has_
chroot
(
name
)
&&
unconfigure_chroot
(
name
))
if
(
conf_has_
rootfs
(
name
)
&&
unconfigure_rootfs
(
name
))
lxc_log_error
(
"failed to cleanup
chroot
"
);
lxc_log_error
(
"failed to cleanup
rootfs
"
);
if
(
conf_has_fstab
(
name
)
&&
unconfigure_mount
(
name
))
if
(
conf_has_fstab
(
name
)
&&
unconfigure_mount
(
name
))
lxc_log_error
(
"failed to cleanup mount"
);
lxc_log_error
(
"failed to cleanup mount"
);
...
@@ -1225,8 +1225,8 @@ int lxc_setup(const char *name)
...
@@ -1225,8 +1225,8 @@ int lxc_setup(const char *name)
return
-
1
;
return
-
1
;
}
}
if
(
conf_has_
chroot
(
name
)
&&
setup_chroot
(
name
))
{
if
(
conf_has_
rootfs
(
name
)
&&
setup_rootfs
(
name
))
{
lxc_log_error
(
"failed to set
chroot
for '%s'"
,
name
);
lxc_log_error
(
"failed to set
rootfs
for '%s'"
,
name
);
return
-
1
;
return
-
1
;
}
}
...
...
src/lxc/lxc_conf.h
View file @
eae6543d
...
@@ -105,13 +105,13 @@ struct lxc_cgroup {
...
@@ -105,13 +105,13 @@ struct lxc_cgroup {
/*
/*
* Defines the global container configuration
* Defines the global container configuration
* @
chroot
: the root directory to run the container
* @
rootfs
: the root directory to run the container
* @mount : the list of mount points
* @mount : the list of mount points
* @network : the network configuration
* @network : the network configuration
* @utsname : the container utsname
* @utsname : the container utsname
*/
*/
struct
lxc_conf
{
struct
lxc_conf
{
char
*
chroot
;
char
*
rootfs
;
char
*
fstab
;
char
*
fstab
;
struct
utsname
*
utsname
;
struct
utsname
*
utsname
;
struct
lxc_cgroup
*
cgroup
;
struct
lxc_cgroup
*
cgroup
;
...
@@ -140,7 +140,7 @@ extern int lxc_setup(const char *name);
...
@@ -140,7 +140,7 @@ extern int lxc_setup(const char *name);
extern
int
conf_has
(
const
char
*
name
,
const
char
*
info
);
extern
int
conf_has
(
const
char
*
name
,
const
char
*
info
);
#define conf_has_fstab(__name) conf_has(__name, "fstab")
#define conf_has_fstab(__name) conf_has(__name, "fstab")
#define conf_has_
chroot(__name) conf_has(__name, "chroot
")
#define conf_has_
rootfs(__name) conf_has(__name, "rootfs
")
#define conf_has_utsname(__name) conf_has(__name, "utsname")
#define conf_has_utsname(__name) conf_has(__name, "utsname")
#define conf_has_network(__name) conf_has(__name, "network")
#define conf_has_network(__name) conf_has(__name, "network")
...
...
src/lxc/lxc_config.c
View file @
eae6543d
...
@@ -38,7 +38,7 @@ typedef int (*file_cb)(char* buffer, void *data);
...
@@ -38,7 +38,7 @@ typedef int (*file_cb)(char* buffer, void *data);
typedef
int
(
*
config_cb
)(
char
*
value
,
struct
lxc_conf
*
lxc_conf
);
typedef
int
(
*
config_cb
)(
char
*
value
,
struct
lxc_conf
*
lxc_conf
);
static
int
config_mount
(
char
*
,
struct
lxc_conf
*
);
static
int
config_mount
(
char
*
,
struct
lxc_conf
*
);
static
int
config_
chroot
(
char
*
,
struct
lxc_conf
*
);
static
int
config_
rootfs
(
char
*
,
struct
lxc_conf
*
);
static
int
config_utsname
(
char
*
,
struct
lxc_conf
*
);
static
int
config_utsname
(
char
*
,
struct
lxc_conf
*
);
static
int
config_network_type
(
char
*
,
struct
lxc_conf
*
);
static
int
config_network_type
(
char
*
,
struct
lxc_conf
*
);
static
int
config_network_flags
(
char
*
,
struct
lxc_conf
*
);
static
int
config_network_flags
(
char
*
,
struct
lxc_conf
*
);
...
@@ -54,12 +54,12 @@ struct config {
...
@@ -54,12 +54,12 @@ struct config {
config_cb
cb
;
config_cb
cb
;
};
};
enum
{
MOUNT
,
CHROOT
,
UTSNAME
,
NETTYPE
,
NETFLAGS
,
NETLINK
,
enum
{
MOUNT
,
ROOTFS
,
UTSNAME
,
NETTYPE
,
NETFLAGS
,
NETLINK
,
NETNAME
,
NETHWADDR
,
NETIPV4
,
NETIPV6
};
NETNAME
,
NETHWADDR
,
NETIPV4
,
NETIPV6
};
struct
config
config
[]
=
{
struct
config
config
[]
=
{
{
"lxc.mount"
,
MOUNT
,
config_mount
},
{
"lxc.mount"
,
MOUNT
,
config_mount
},
{
"lxc.
chroot"
,
CHROOT
,
config_chroot
},
{
"lxc.
rootfs"
,
ROOTFS
,
config_rootfs
},
{
"lxc.utsname"
,
UTSNAME
,
config_utsname
},
{
"lxc.utsname"
,
UTSNAME
,
config_utsname
},
{
"lxc.network.type"
,
NETTYPE
,
config_network_type
},
{
"lxc.network.type"
,
NETTYPE
,
config_network_type
},
{
"lxc.network.flags"
,
NETFLAGS
,
config_network_flags
},
{
"lxc.network.flags"
,
NETFLAGS
,
config_network_flags
},
...
@@ -434,15 +434,15 @@ static int config_mount(char *value, struct lxc_conf *lxc_conf)
...
@@ -434,15 +434,15 @@ static int config_mount(char *value, struct lxc_conf *lxc_conf)
return
0
;
return
0
;
}
}
static
int
config_
chroot
(
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
static
int
config_
rootfs
(
char
*
value
,
struct
lxc_conf
*
lxc_conf
)
{
{
if
(
strlen
(
value
)
>=
MAXPATHLEN
)
{
if
(
strlen
(
value
)
>=
MAXPATHLEN
)
{
lxc_log_error
(
"%s path is too long"
,
value
);
lxc_log_error
(
"%s path is too long"
,
value
);
return
-
1
;
return
-
1
;
}
}
lxc_conf
->
chroot
=
strdup
(
value
);
lxc_conf
->
rootfs
=
strdup
(
value
);
if
(
!
lxc_conf
->
chroot
)
{
if
(
!
lxc_conf
->
rootfs
)
{
lxc_log_syserror
(
"failed to duplicate string %s"
,
value
);
lxc_log_syserror
(
"failed to duplicate string %s"
,
value
);
return
-
1
;
return
-
1
;
}
}
...
@@ -539,7 +539,7 @@ int lxc_config_read(const char *file, struct lxc_conf *conf)
...
@@ -539,7 +539,7 @@ int lxc_config_read(const char *file, struct lxc_conf *conf)
int
lxc_config_init
(
struct
lxc_conf
*
conf
)
int
lxc_config_init
(
struct
lxc_conf
*
conf
)
{
{
conf
->
chroot
=
NULL
;
conf
->
rootfs
=
NULL
;
conf
->
fstab
=
NULL
;
conf
->
fstab
=
NULL
;
conf
->
utsname
=
NULL
;
conf
->
utsname
=
NULL
;
conf
->
cgroup
=
NULL
;
conf
->
cgroup
=
NULL
;
...
...
src/lxc/lxc_monitor.c
View file @
eae6543d
...
@@ -36,10 +36,9 @@ void usage(char *cmd)
...
@@ -36,10 +36,9 @@ void usage(char *cmd)
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
char
opt
;
char
opt
,
*
name
=
NULL
;
char
*
name
=
NULL
;
struct
lxc_msg
msg
;
int
fds
[
2
];
int
fd
;
pid_t
pid
;
while
((
opt
=
getopt
(
argc
,
argv
,
"n:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"n:"
))
!=
-
1
)
{
switch
(
opt
)
{
switch
(
opt
)
{
...
@@ -52,46 +51,35 @@ int main(int argc, char *argv[])
...
@@ -52,46 +51,35 @@ int main(int argc, char *argv[])
if
(
!
name
)
if
(
!
name
)
usage
(
argv
[
0
]);
usage
(
argv
[
0
]);
if
(
pipe
(
fds
))
{
fd
=
lxc_monitor_open
(
name
);
perror
(
"pipe"
);
if
(
fd
<
0
)
{
return
1
;
fprintf
(
stderr
,
"failed to open monitor for '%s'
\n
"
,
name
);
return
-
1
;
}
}
pid
=
fork
();
if
(
pid
<
0
)
{
perror
(
"fork"
);
return
1
;
}
if
(
!
pid
)
{
close
(
fds
[
0
]);
if
(
lxc_monitor
(
name
,
fds
[
1
]))
{
fprintf
(
stderr
,
"failed to monitor %s
\n
"
,
name
);
return
1
;
}
return
0
;
}
close
(
fds
[
1
]);
for
(;;)
{
for
(;;)
{
int
err
,
state
;
if
(
lxc_monitor_read
(
fd
,
&
msg
)
<
0
)
{
fprintf
(
stderr
,
err
=
read
(
fds
[
0
],
&
state
,
sizeof
(
state
));
"failed to read monitor's message for '%s'
\n
"
,
if
(
err
<
0
)
{
name
);
perror
(
"read"
);
return
-
1
;
return
1
;
}
}
if
(
!
err
)
{
switch
(
msg
.
type
)
{
printf
(
"container has been destroyed
\n
"
);
case
lxc_msg_state
:
return
0
;
printf
(
"'%s' changed state to [%s]
\n
"
,
name
,
lxc_state2str
(
msg
.
value
));
break
;
case
lxc_msg_priority
:
printf
(
"'%s' changed priority to [%d]
\n
"
,
name
,
msg
.
value
);
break
;
default:
printf
(
"invalid msg format
\n
"
);
break
;
}
}
printf
(
"container has changed the state to %d - %s
\n
"
,
state
,
lxc_state2str
(
state
));
}
}
return
0
;
return
0
;
}
}
src/lxc/lxc_state.c
View file @
eae6543d
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
#include <sys/file.h>
#include <sys/file.h>
#include <lxc/lxc.h>
#include <lxc/lxc.h>
#include "monitor.h"
static
char
*
strstate
[]
=
{
static
char
*
strstate
[]
=
{
"STOPPED"
,
"STARTING"
,
"RUNNING"
,
"STOPPING"
,
"STOPPED"
,
"STARTING"
,
"RUNNING"
,
"STOPPING"
,
...
...
src/lxc/monitor.c
View file @
eae6543d
...
@@ -101,25 +101,42 @@ out:
...
@@ -101,25 +101,42 @@ out:
return
err
;
return
err
;
}
}
void
lxc_monitor_send_state
(
const
char
*
name
,
lxc_state_t
state
)
static
void
lxc_monitor_send
(
const
char
*
name
,
struct
lxc_msg
*
msg
)
{
{
int
fd
;
int
fd
;
struct
sockaddr_un
addr
;
struct
sockaddr_un
addr
;
fd
=
socket
(
PF_UNIX
,
SOCK_DGRAM
,
0
);
fd
=
socket
(
PF_UNIX
,
SOCK_DGRAM
,
0
);
if
(
fd
<
0
)
if
(
fd
<
0
)
{
lxc_log_syserror
(
"failed to create notification socket"
);
lxc_log_syserror
(
"failed to create notification socket"
);
return
;
}
memset
(
&
addr
,
0
,
sizeof
(
addr
));
memset
(
&
addr
,
0
,
sizeof
(
addr
));
addr
.
sun_family
=
AF_UNIX
;
addr
.
sun_family
=
AF_UNIX
;
snprintf
(
addr
.
sun_path
,
UNIX_PATH_MAX
,
LXCPATH
"/%s/notification"
,
name
);
snprintf
(
addr
.
sun_path
,
UNIX_PATH_MAX
,
LXCPATH
"/%s/notification"
,
name
);
sendto
(
fd
,
&
state
,
sizeof
(
state
),
0
,
sendto
(
fd
,
msg
,
sizeof
(
*
msg
),
0
,
(
const
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
(
const
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
close
(
fd
);
close
(
fd
);
}
}
void
lxc_monitor_send_priority
(
const
char
*
name
,
int
priority
)
{
struct
lxc_msg
msg
=
{
.
type
=
lxc_msg_priority
,
.
value
=
priority
};
lxc_monitor_send
(
name
,
&
msg
);
}
void
lxc_monitor_send_state
(
const
char
*
name
,
lxc_state_t
state
)
{
struct
lxc_msg
msg
=
{
.
type
=
lxc_msg_state
,
.
value
=
state
};
lxc_monitor_send
(
name
,
&
msg
);
}
void
lxc_monitor_cleanup
(
const
char
*
name
)
void
lxc_monitor_cleanup
(
const
char
*
name
)
{
{
char
path
[
UNIX_PATH_MAX
];
char
path
[
UNIX_PATH_MAX
];
...
@@ -153,11 +170,11 @@ int lxc_monitor_open(const char *name)
...
@@ -153,11 +170,11 @@ int lxc_monitor_open(const char *name)
return
fd
;
return
fd
;
}
}
int
lxc_monitor_read
(
int
fd
,
lxc_state_t
*
state
)
int
lxc_monitor_read
(
int
fd
,
struct
lxc_msg
*
msg
)
{
{
int
ret
;
int
ret
;
ret
=
recv
(
fd
,
state
,
sizeof
(
*
state
),
0
);
ret
=
recv
(
fd
,
msg
,
sizeof
(
*
msg
),
0
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
lxc_log_syserror
(
"failed to received state"
);
lxc_log_syserror
(
"failed to received state"
);
return
-
1
;
return
-
1
;
...
...
src/lxc/monitor.h
View file @
eae6543d
...
@@ -23,7 +23,18 @@
...
@@ -23,7 +23,18 @@
#ifndef __monitor_h
#ifndef __monitor_h
#define __monitor_h
#define __monitor_h
typedef
enum
{
lxc_msg_state
,
lxc_msg_priority
,
}
lxc_msg_type_t
;
struct
lxc_msg
{
lxc_msg_type_t
type
;
int
value
;
};
void
lxc_monitor_send_state
(
const
char
*
name
,
lxc_state_t
state
);
void
lxc_monitor_send_state
(
const
char
*
name
,
lxc_state_t
state
);
void
lxc_monitor_send_priority
(
const
char
*
name
,
int
priority
);
void
lxc_monitor_cleanup
(
const
char
*
name
);
void
lxc_monitor_cleanup
(
const
char
*
name
);
#endif
#endif
test/lxc_create.c
View file @
eae6543d
...
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
...
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
struct
lxc_conf
lxc_conf
=
{
struct
lxc_conf
lxc_conf
=
{
.
networks
=
lxc_init_list
(
&
lxc_conf
.
networks
),
.
networks
=
lxc_init_list
(
&
lxc_conf
.
networks
),
.
chroot
=
"/mnt/iso"
,
.
rootfs
=
"/mnt/iso"
,
};
};
lxc_list_add
(
&
phys
.
netdev
,
&
ndlist
);
lxc_list_add
(
&
phys
.
netdev
,
&
ndlist
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment