net: add sock_set_priority

Add a helper to directly set the SO_PRIORITY sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christoph Hellwig
2020-05-28 07:12:11 +02:00
committed by David S. Miller
parent c433594c07
commit 6e43496745
4 changed files with 15 additions and 24 deletions

View File

@@ -729,6 +729,14 @@ void sock_no_linger(struct sock *sk)
}
EXPORT_SYMBOL(sock_no_linger);
void sock_set_priority(struct sock *sk, u32 priority)
{
lock_sock(sk);
sk->sk_priority = priority;
release_sock(sk);
}
EXPORT_SYMBOL(sock_set_priority);
/*
* This is meant for all protocols to use and covers goings on
* at the socket level. Everything here is generic.