Commit cf6300c3 by dlezcano

Remove the kill container processes code

From: Daniel Lezcano <dlezcano@fr.ibm.com> Remove the kill container processes code because it can be implemented with a very few scripting lines Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent e7aa295e
......@@ -18,7 +18,6 @@ liblxc_la_SOURCES = \
start.c \
stop.c \
monitor.c monitor.h \
kill.c \
freezer.c \
checkpoint.c \
restart.c \
......@@ -54,7 +53,6 @@ bin_PROGRAMS = \
lxc-monitor \
lxc-wait \
lxc-console \
lxc-kill \
lxc-freeze \
lxc-info \
lxc-cgroup \
......@@ -93,9 +91,6 @@ lxc_console_LDADD = liblxc.la
lxc_info_SOURCES = lxc_info.c
lxc_info_LDADD = liblxc.la
lxc_kill_SOURCES = lxc_kill.c
lxc_kill_LDADD = liblxc.la
lxc_freeze_SOURCES = lxc_freeze.c
lxc_freeze_LDADD = liblxc.la
......
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <dlezcano at fr.ibm.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define _GNU_SOURCE
#include <stdio.h>
#undef _GNU_SOURCE
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/param.h>
#include <lxc/lxc.h>
int lxc_kill(const char *name, int signum)
{
char freezer[MAXPATHLEN], *signal = NULL;
int fd = -1, ret = -1;
if (signum < SIGHUP || signum > SIGRTMAX) {
lxc_log_error("bad signal value %d", signum);
return -1;
}
snprintf(freezer, MAXPATHLEN, LXCPATH "/%s/nsgroup/freezer.kill", name);
if (!asprintf(&signal, "%d", signum)) {
lxc_log_syserror("not enough memory");
return -1;
}
fd = open(freezer, O_WRONLY);
if (fd < 0) {
lxc_log_syserror("failed to open %s for %s", freezer, name);
goto out;
}
if (write(fd, &signal, strlen(signal)) < 0) {
lxc_log_syserror("failed to write to %s", freezer);
goto out;
}
ret = 0;
out:
close(fd);
free(signal);
return ret;
}
......@@ -147,16 +147,6 @@ extern int lxc_unfreeze(const char *name);
extern lxc_state_t lxc_state(const char *name);
/*
* Send a signal to all processes of the container. This is the same
* behavior of the well-known 'killpg' command except it is related
* to all tasks belonging to a container.
* @name : the name of the container
* @signum : the signal number to be sent
* Returns 0 on success, < 0 otherwise
*/
extern int lxc_kill(const char *name, int signum);
/*
* Set a specified value for a specified subsystem. The specified
* subsystem must be fully specified, eg. "cpu.shares"
* @name : the name of the container
......
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <dlezcano at fr.ibm.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <lxc/lxc.h>
int main(int argc, char *argv[])
{
return 0;
}
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