aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroscar.medina@motorola.com <oscar.medina@motorola.com>2009-06-29 23:25:39 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-05 22:16:11 -0400
commit6650613d3387dcc30685e2781818ea7d0f840027 (patch)
tree395be1b4fe613f8016d306f5ba39b98630360740
parentaf794c74240d8d788058bdfee339512e7ac029b2 (diff)
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>
-rw-r--r--include/linux/tipc.h2
-rw-r--r--net/tipc/socket.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index bea469455a0c..3d92396639de 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -209,5 +209,7 @@ struct sockaddr_tipc {
209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */ 209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */
210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ 210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ 211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
212#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
213#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */
212 214
213#endif 215#endif
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,
1748 value = jiffies_to_msecs(sk->sk_rcvtimeo); 1748 value = jiffies_to_msecs(sk->sk_rcvtimeo);
1749 /* no need to set "res", since already 0 at this point */ 1749 /* no need to set "res", since already 0 at this point */
1750 break; 1750 break;
1751 case TIPC_NODE_RECVQ_DEPTH:
1752 value = (u32)atomic_read(&tipc_queue_size);
1753 break;
1754 case TIPC_SOCK_RECVQ_DEPTH:
1755 value = skb_queue_len(&sk->sk_receive_queue);
1756 break;
1751 default: 1757 default:
1752 res = -EINVAL; 1758 res = -EINVAL;
1753 } 1759 }