]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * lxc: linux Container library | |
3 | * | |
4 | * (C) Copyright IBM Corp. 2007, 2010 | |
5 | * | |
6 | * Authors: | |
7 | * Daniel Lezcano <dlezcano at fr.ibm.com> | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License as published by the Free Software Foundation; either | |
12 | * version 2.1 of the License, or (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public | |
20 | * License along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | */ | |
23 | ||
24 | #include "config.h" | |
25 | ||
26 | #include <stdio.h> | |
27 | #undef _GNU_SOURCE | |
28 | #include <string.h> | |
29 | #include <stdlib.h> | |
30 | #include <errno.h> | |
31 | #include <unistd.h> | |
32 | ||
33 | #include <lxc/log.h> | |
34 | #include <lxc/start.h> /* for struct lxc_handler */ | |
35 | #include <lxc/utils.h> | |
36 | #include <lxc/error.h> | |
37 | ||
38 | lxc_log_define(lxc_restart, lxc); | |
39 | ||
40 | struct restart_args { | |
41 | int sfd; | |
42 | int flags; | |
43 | }; | |
44 | ||
45 | static int restart(struct lxc_handler *handler, void* data) | |
46 | { | |
47 | struct restart_args *arg __attribute__ ((unused)) = data; | |
48 | ||
49 | ERROR("'restart' function not implemented"); | |
50 | return -1; | |
51 | } | |
52 | ||
53 | static int post_restart(struct lxc_handler *handler, void* data) | |
54 | { | |
55 | struct restart_args *arg __attribute__ ((unused)) = data; | |
56 | ||
57 | NOTICE("'%s' container restarting with pid '%d'", handler->name, | |
58 | handler->pid); | |
59 | return 0; | |
60 | } | |
61 | ||
62 | static struct lxc_operations restart_ops = { | |
63 | .start = restart, | |
64 | .post_start = post_restart | |
65 | }; | |
66 | ||
67 | int lxc_restart(const char *name, int sfd, struct lxc_conf *conf, int flags) | |
68 | { | |
69 | struct restart_args restart_arg = { | |
70 | .sfd = sfd, | |
71 | .flags = flags | |
72 | }; | |
73 | /* TODO - make lxcpath a cmdline arg */ | |
74 | const char *lxcpath = NULL; | |
75 | ||
76 | if (lxc_check_inherited(conf, sfd)) | |
77 | return -1; | |
78 | ||
79 | return __lxc_start(name, conf, &restart_ops, &restart_arg, lxcpath); | |
80 | } |