From patchwork Sun Jan 29 02:37:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Hajdaj X-Patchwork-Id: 138425 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C79F1B6EFF for ; Sun, 29 Jan 2012 13:38:20 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752350Ab2A2Chz (ORCPT ); Sat, 28 Jan 2012 21:37:55 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:38714 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751500Ab2A2Chy (ORCPT ); Sat, 28 Jan 2012 21:37:54 -0500 Received: by werb13 with SMTP id b13so2517240wer.19 for ; Sat, 28 Jan 2012 18:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=x/RSfCN0qQ4lqmmJJMeCmlPKJU9+OIcoT1LAxG/6GXA=; b=sZzieg51yrmdNKq/PaAv5p+1Rfc4p6sBjhDreqNOhduBhfq8GNUvBQudP9og0/ytUM fPw2htxXa0lHnLYbPnTYUMjBWCD9NwQOFVOGEfcSsqSKfFLPiJtzb/gt4qSf18amqWQU HJ10sDa4FGHGxsuSE6saJ1e7vxxPX4KIYL+cE= MIME-Version: 1.0 Received: by 10.216.131.78 with SMTP id l56mr6427133wei.56.1327804672804; Sat, 28 Jan 2012 18:37:52 -0800 (PST) Received: by 10.180.106.167 with HTTP; Sat, 28 Jan 2012 18:37:52 -0800 (PST) Date: Sat, 28 Jan 2012 21:37:52 -0500 Message-ID: Subject: [PATCH 001/001] net: Add tx_queue/rx_queue info to /proc/net/unix From: Ryan Hajdaj To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ryan Hajdaj Add tx_queue/rx_queue info to /proc/net/unix (unix_seq_show) Signed-off-by: Ryan Hajdaj Tested-by: Ryan Hajdaj --- tx_queue/rx_queue info is useful in systems with multiple processes using Unix Domain sockets to communicate, as it can be used to check process health "at a glance". Unit tested on Unix stream and datagram sockets. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-3.3-rc1/net/unix/af_unix.c.orig 2012-01-28 20:36:33.000000000 +0000 +++ linux-3.3-rc1/net/unix/af_unix.c 2012-01-28 19:09:18.000000000 +0000 @@ -2286,13 +2286,14 @@ static int unix_seq_show(struct seq_file if (v == SEQ_START_TOKEN) seq_puts(seq, "Num RefCount Protocol Flags Type St " - "Inode Path\n"); + "tx_queue rx_queue Inode Path\n"); else { struct sock *s = v; struct unix_sock *u = unix_sk(s); unix_state_lock(s); - seq_printf(seq, "%pK: %08X %08X %08X %04X %02X %5lu", + seq_printf(seq, + "%pK: %08X %08X %08X %04X %02X %08lX %08lX %5lu", s, atomic_read(&s->sk_refcnt), 0, @@ -2301,6 +2302,8 @@ static int unix_seq_show(struct seq_file s->sk_socket ? (s->sk_state == TCP_ESTABLISHED ? SS_CONNECTED : SS_UNCONNECTED) : (s->sk_state == TCP_ESTABLISHED ? SS_CONNECTING : SS_DISCONNECTING), + unix_outq_len(s), + (unix_inq_len(s) < 0 ? 0 : unix_inq_len(s)), sock_i_ino(s)); if (u->addr) {