summaryrefslogtreecommitdiff
path: root/arch/um/drivers/xterm_kern.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-07-02 20:21:19 +0300
committerJohannes Berg <johannes.berg@intel.com>2024-07-03 13:24:25 +0300
commit5cde6096a4dd114b7dc5ac37a71778ea68507938 (patch)
treea52d892bcf61e64b70d93a11fb86b50dca5d2a59 /arch/um/drivers/xterm_kern.c
parent6555acdefc758a4dae7038c3f2301f311e287218 (diff)
downloadlinux-5cde6096a4dd114b7dc5ac37a71778ea68507938.tar.xz
um: generalize os_rcv_fd
Change os_rcv_fd() to os_rcv_fd_msg() that can more generally receive any number of FDs in any kind of message. Link: https://patch.msgid.link/20240702192118.40b78b2bfe4e.Ic6ec12d72630e5bcae1e597d6bd5c6f29f441563@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'arch/um/drivers/xterm_kern.c')
-rw-r--r--arch/um/drivers/xterm_kern.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/um/drivers/xterm_kern.c b/arch/um/drivers/xterm_kern.c
index 8011e51993d5..3971252cb1a6 100644
--- a/arch/um/drivers/xterm_kern.c
+++ b/arch/um/drivers/xterm_kern.c
@@ -21,12 +21,19 @@ struct xterm_wait {
static irqreturn_t xterm_interrupt(int irq, void *data)
{
struct xterm_wait *xterm = data;
- int fd;
+ int fd = -1, n_fds = 1;
+ ssize_t ret;
- fd = os_rcv_fd(xterm->fd, &xterm->pid);
- if (fd == -EAGAIN)
+ ret = os_rcv_fd_msg(xterm->fd, &fd, n_fds,
+ &xterm->pid, sizeof(xterm->pid));
+ if (ret == -EAGAIN)
return IRQ_NONE;
+ if (ret < 0)
+ fd = ret;
+ else if (ret != sizeof(xterm->pid))
+ fd = -EMSGSIZE;
+
xterm->new_fd = fd;
complete(&xterm->ready);