static int posix_signal(struct xseg *xseg, uint32_t portno)
{
struct pid *pid;
- struct xseg_port *port = &xseg->ports[portno];
struct task_struct *task;
int ret = -ENOENT;
+ struct xseg_port *port = xseg_get_port(xseg, portno);
+ if (!port)
+ return -1;
+
rcu_read_lock();
/* XXX Security: xseg peers can kill anyone */
static int posix_prepare_wait(struct xseg *xseg, uint32_t portno)
{
- struct xseg_port *port = &xseg->ports[portno];
+ struct xseg_port *port = xseg_get_port(xseg, portno);
+ if (!port)
+ return -1;
port->waitcue = pid;
return 0;
}
static int posix_cancel_wait(struct xseg *xseg, uint32_t portno)
{
- struct xseg_port *port = &xseg->ports[portno];
+ struct xseg_port *port = xseg_get_port(xseg, portno);
+ if (!port)
+ return -1;
port->waitcue = 0;
return 0;
}
static int posix_signal(struct xseg *xseg, uint32_t portno)
{
- struct xseg_port *port = &xseg->ports[portno];
+ struct xseg_port *port = xseg_get_port(xseg, portno);
+ if (!port)
+ return -1;
pid_t cue = (pid_t)port->waitcue;
if (!cue)
return 0;