From: t_jeang Date: Tue, 6 Jan 2009 12:06:04 +0000 (+0000) Subject: Add a new ioctl to /proc/xen/privcmd which allows SCHEDOP_shutdown to X-Git-Tag: privcmd_hvmop X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2a2f6d4d8690599ccfa635963da9c77b6d3ed165;p=xenclient%2Fkernel.git Add a new ioctl to /proc/xen/privcmd which allows SCHEDOP_shutdown to be applied on restricted fds. --- diff --git a/drivers/xen/privcmd/privcmd.c b/drivers/xen/privcmd/privcmd.c index 637571ed..8d3b81ee 100644 --- a/drivers/xen/privcmd/privcmd.c +++ b/drivers/xen/privcmd/privcmd.c @@ -386,6 +386,18 @@ static long privcmd_ioctl(struct file *file, } break; + case IOCTL_PRIVCMD_SHUTDOWN: { + sched_remote_shutdown_t srs; + + if (copy_from_user(&srs, udata, sizeof(srs))) + return -EFAULT; + if (fdata->restrict_domid != UNRESTRICTED_DOMID && + fdata->restrict_domid != srs.domain_id) + return -EACCES; + ret = HYPERVISOR_sched_op(SCHEDOP_remote_shutdown, &srs); + } + break; + default: ret = -EINVAL; break; diff --git a/include/xen/public/privcmd.h b/include/xen/public/privcmd.h index 20d2e27a..5b048f7b 100644 --- a/include/xen/public/privcmd.h +++ b/include/xen/public/privcmd.h @@ -103,5 +103,7 @@ typedef struct privcmd_hvmop { _IOC(_IOC_NONE, 'P', 5, sizeof(xen_domctl_t)) #define IOCTL_PRIVCMD_HVMOP \ _IOC(_IOC_NONE, 'P', 6, sizeof(privcmd_hvmop_t)) +#define IOCTL_PRIVCMD_SHUTDOWN \ + _IOC(_IOC_NONE, 'P', 7, sizeof(sched_remote_shutdown_t)) #endif /* __LINUX_PUBLIC_PRIVCMD_H__ */