[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210211000043.136979-1-rao.shoaib@oracle.com>
Date: Wed, 10 Feb 2021 16:00:43 -0800
From: rao.shoaib@...cle.com
To: linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
davem@...emloft.net, kuba@...nel.org, andy.rudoff@...el.com
Cc: willy@...radead.org, Rao Shoaib <rao.shoaib@...cle.com>
Subject: [PATCH v2 1/1] af_unix: Allow Unix sockets to raise SIGURG
From: Rao Shoaib <rao.shoaib@...cle.com>
TCP sockets allow SIGURG to be sent to the process holding the other
end of the socket. Extend Unix sockets to have the same ability
but only if the data length is zero.
The API is the same in that the sender uses sendmsg() with MSG_OOB to
raise SIGURG. Unix sockets behave in the same way as TCP sockets with
SO_OOBINLINE set.
SIGURG is ignored by default, so applications which do not know about this
feature will be unaffected. In addition to installing a SIGURG handler,
the receiving application must call F_SETOWN or F_SETOWN_EX to indicate
which process or thread should receive the signal.
Signed-off-by: Rao Shoaib <rao.shoaib@...cle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
---
net/unix/af_unix.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 92784e5..65f6179 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1840,7 +1840,8 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
return err;
err = -EOPNOTSUPP;
- if (msg->msg_flags&MSG_OOB)
+
+ if (len && (msg->msg_flags & MSG_OOB))
goto out_err;
if (msg->msg_namelen) {
@@ -1856,6 +1857,9 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
if (sk->sk_shutdown & SEND_SHUTDOWN)
goto pipe_err;
+ if (msg->msg_flags & MSG_OOB)
+ sk_send_sigurg(other);
+
while (sent < len) {
size = len - sent;
--
1.8.3.1
Powered by blists - more mailing lists