direct-io.hg

view tools/domain_builder/dom_kill.c @ 204:0e45b167992d

bitkeeper revision 1.65 (3e536858YdNPGFSv3J35Fl8zAGLJjQ)

sched.h, xen_block.c, domain.c:
Now have per-domain IO completion queue.
author kaf24@labyrinth.cl.cam.ac.uk
date Wed Feb 19 11:19:52 2003 +0000 (2003-02-19)
parents 9713c0d10ee7
children de6e697bb960
line source
1 /*
2 * A very(!) simple program to kill a domain. (c) Boris Dragovic
3 * Usage: <executable> <mem_kb> <os image> <num_vifs>
4 */
6 #include <unistd.h>
7 #include <stdio.h>
8 #include <errno.h>
9 #include <fcntl.h>
10 #include <sys/stat.h>
11 #include <sys/types.h>
13 #include "dom0_ops.h"
14 #include "dom0_defs.h"
16 #define PERR_STRING "Xen Domain Killer"
18 static int do_kill_domain(int dom_id)
19 {
20 char cmd_path[MAX_PATH];
21 dom0_op_t dop;
22 int cmd_fd;
24 dop.cmd = DOM0_KILLDOMAIN;
25 dop.u.killdomain.domain = dom_id;
27 /* open the /proc command interface */
28 sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
29 cmd_fd = open(cmd_path, O_WRONLY);
30 if(cmd_fd < 0){
31 perror(PERR_STRING);
32 return -1;
33 }
35 write(cmd_fd, &dop, sizeof(dom0_op_t));
36 close(cmd_fd);
38 return 0;
39 }
41 int main(int argc, char **argv)
42 {
43 int ret;
45 if(argc < 2){
46 printf("Usage: kill_domain <domain_id>\n");
47 ret = -1;
48 goto out;
49 }
51 ret = do_kill_domain(atoi(argv[1]));
53 out:
54 return ret;
55 }