From: Bang Nguyen Date: Mon, 25 Feb 2013 17:18:17 +0000 (-0800) Subject: Add SIOCRDSGETTOS to get the current TOS for the socket X-Git-Tag: v4.1.12-92~293^2^2~71 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cf7fb4c3d4b0b7b7de39b198900d931ac61bd46f;p=users%2Fjedix%2Flinux-maple.git Add SIOCRDSGETTOS to get the current TOS for the socket Orabug: 16397197 Signed-off-by: Bang Nguyen (cherry picked from commit 201e2362694aab25b4ef6b11e5bd62b75b2a0e17) --- diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h index ec0a19475a3b9..1caffb379c3eb 100644 --- a/include/uapi/linux/rds.h +++ b/include/uapi/linux/rds.h @@ -63,6 +63,7 @@ * ioctl commands for SOL_RDS */ #define SIOCRDSSETTOS (SIOCPROTOPRIVATE) +#define SIOCRDSGETTOS (SIOCPROTOPRIVATE + 1) typedef u_int8_t rds_tos_t; diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c index 48406609889c2..5869a0434fe1d 100644 --- a/net/rds/af_rds.c +++ b/net/rds/af_rds.c @@ -227,6 +227,13 @@ static int rds_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) rs->rs_tos = tos; spin_unlock_bh(&rds_sock_lock); break; + case SIOCRDSGETTOS: + spin_lock_bh(&rds_sock_lock); + tos = rs->rs_tos; + spin_unlock_bh(&rds_sock_lock); + if (put_user(tos, (rds_tos_t __user *)arg)) + return -EFAULT; + break; default: return -ENOIOCTLCMD; }