Commit 103a2fc0 by Serge Hallyn

concurrent: take lxc template to use as argument

parent 84bce17b
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#define NTHREADS 5 #define NTHREADS 5
char *template = "busybox";
struct thread_args { struct thread_args {
int thread_id; int thread_id;
int return_code; int return_code;
...@@ -40,7 +42,7 @@ void * concurrent(void *arguments) { ...@@ -40,7 +42,7 @@ void * concurrent(void *arguments) {
args->return_code = 1; args->return_code = 1;
if (strcmp(args->mode, "create") == 0) { if (strcmp(args->mode, "create") == 0) {
if (!c->is_defined(c)) { if (!c->is_defined(c)) {
if (!c->create(c, "busybox", NULL, NULL, 1, NULL)) { if (!c->create(c, template, NULL, NULL, 1, NULL)) {
fprintf(stderr, "Creating the container (%s) failed...\n", name); fprintf(stderr, "Creating the container (%s) failed...\n", name);
goto out; goto out;
} }
...@@ -91,6 +93,9 @@ int main(int argc, char *argv[]) { ...@@ -91,6 +93,9 @@ int main(int argc, char *argv[]) {
char *modes[] = {"create", "start", "stop", "destroy", NULL}; char *modes[] = {"create", "start", "stop", "destroy", NULL};
if (argc > 1)
template = argv[1];
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment