aboutsummaryrefslogtreecommitdiffstats
path: root/tools/internal/xi_stop.c
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-07-12 22:26:07 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-07-12 22:26:07 +0000
commit6bf073980b8479bae7c94ecd925c4cecef6e5414 (patch)
tree766f6ff4c90654e80f4f0053822b421c6524f46b /tools/internal/xi_stop.c
parent7a68631223523fd53038da61cdf337d3f14c8593 (diff)
downloadxen-6bf073980b8479bae7c94ecd925c4cecef6e5414.tar.gz
xen-6bf073980b8479bae7c94ecd925c4cecef6e5414.tar.bz2
xen-6bf073980b8479bae7c94ecd925c4cecef6e5414.zip
bitkeeper revision 1.339.1.1 (3f108aff8cNSEyxZFIWHZ-zZtSTT2w)
Many files: new file Clean up dom0 proc interfaces. Implemented ioremap and /dev/mem. .del-dom0_block.c~63815c1974691c1c: Delete: xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_block.c .del-sched_ops.c~20807e5c2ed6b51: Delete: xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/sched_ops.c .del-xi_list~49abab167156959: Delete: tools/internal/xi_list .del-xl_physdisk_proc.c~49451bc26a40fcb2: Delete: xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c .del-mmu.h~6bc56547519b6f96: Delete: xenolinux-2.4.21-sparse/include/asm-xeno/mmu.h .del-dom0.h~6fb656bb4a0c52e1: Delete: xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h .del-dom0_ops.h~fb19960d77217740: Delete: tools/internal/dom0_ops.h .del-dom0_ops.h~5c52b016e619bd2d: Delete: xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_ops.h .del-dom0_memory.c~c72c6e5f7fd65d38: Delete: xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_memory.c .del-direct_map.c~d2fedc686b334f2a: Delete: xenolinux-2.4.21-sparse/arch/xeno/mm/direct_map.c direct_map.c: Rename: xenolinux-2.4.21-sparse/arch/xeno/mm/get_unmapped_area.c -> xenolinux-2.4.21-sparse/arch/xeno/mm/direct_map.c
Diffstat (limited to 'tools/internal/xi_stop.c')
-rw-r--r--tools/internal/xi_stop.c73
1 files changed, 15 insertions, 58 deletions
diff --git a/tools/internal/xi_stop.c b/tools/internal/xi_stop.c
index 6f2437ca14..5cd732df3a 100644
--- a/tools/internal/xi_stop.c
+++ b/tools/internal/xi_stop.c
@@ -1,79 +1,36 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-
-#include "dom0_ops.h"
+#include "hypervisor-ifs/dom0_ops.h"
#include "dom0_defs.h"
#include "mem_defs.h"
-/***********************************************************************/
-
static char *argv0 = "internal_domain_stop";
-static void ERROR (char *message)
-{
- fprintf (stderr, "%s: %s\n", argv0, message);
- exit (-1);
-}
-
-static void PERROR (char *message)
-{
- fprintf (stderr, "%s: %s (%s)\n", argv0, message, strerror(errno));
- exit (-1);
-}
-
-/***********************************************************************/
-
static int stop_domain(int id)
{
- dom0_newdomain_t * dom_data;
- char cmd_path[MAX_PATH];
- char dom_id_path[MAX_PATH];
- dom0_op_t dop;
- int cmd_fd;
- int id_fd;
+ int err;
+ dom0_op_t op;
- /* Set up the DOM0_STOPDOMAIN command */
- dop.cmd = DOM0_STOPDOMAIN;
- dop.u.meminfo.domain = id;
-
- /* open the /proc command interface */
- sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
- cmd_fd = open(cmd_path, O_WRONLY);
- if(cmd_fd < 0){
- PERROR ("Count not open PROC_CMD interface");
- }
+ op.cmd = DOM0_STOPDOMAIN;
+ op.u.meminfo.domain = id;
- /* Issue the command */
- write(cmd_fd, &dop, sizeof(dom0_op_t));
- close(cmd_fd);
+ err = do_dom0_op(&op);
- return 0;
+ return (err < 0) ? -1 : 0;
}
-/***********************************************************************/
-
int main(int argc, char **argv)
{
- int rc;
+ int rc;
- if (argv[0] != NULL)
- {
- argv0 = argv[0];
- }
+ if ( argv[0] != NULL )
+ argv0 = argv[0];
- if(argc != 2)
+ if ( argc != 2 )
{
- fprintf (stderr, "Usage: %s <domain-id>\n", argv0);
- return -1;
+ fprintf(stderr, "Usage: %s <domain-id>\n", argv0);
+ return 1;
}
- rc = stop_domain(atol(argv[1]));
+ rc = stop_domain(atol(argv[1]));
- return rc;
+ return (rc != 0) ? 1 : 0;
}