summaryrefslogtreecommitdiff
path: root/net/tipc
diff options
context:
space:
mode:
authoroscar.medina@motorola.com <oscar.medina@motorola.com>2009-06-30 03:25:39 +0000
committerDavid S. Miller <davem@davemloft.net>2009-07-05 19:16:11 -0700
commit6650613d3387dcc30685e2781818ea7d0f840027 (patch)
tree395be1b4fe613f8016d306f5ba39b98630360740 /net/tipc
parentaf794c74240d8d788058bdfee339512e7ac029b2 (diff)
downloadlinux-exynos-6650613d3387dcc30685e2781818ea7d0f840027.tar.gz
linux-exynos-6650613d3387dcc30685e2781818ea7d0f840027.tar.bz2
linux-exynos-6650613d3387dcc30685e2781818ea7d0f840027.zip
tipc: Add socket options to get number of queued messages
This patch allows a TIPC application to determine the number of messages currently waiting in a socket's receive queue (TIPC_SOCK_RECVQ_DEPTH) or in all TIPC socket receive queues (TIPC_NODE_RECVQ_DEPTH). Signed-off-by: Oscar Medina <oscar.medina@motorola.com> Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/socket.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 1848693ebb82..e8254e809b79 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1748,6 +1748,12 @@ static int getsockopt(struct socket *sock,
value = jiffies_to_msecs(sk->sk_rcvtimeo);
/* no need to set "res", since already 0 at this point */
break;
+ case TIPC_NODE_RECVQ_DEPTH:
+ value = (u32)atomic_read(&tipc_queue_size);
+ break;
+ case TIPC_SOCK_RECVQ_DEPTH:
+ value = skb_queue_len(&sk->sk_receive_queue);
+ break;
default:
res = -EINVAL;
}