diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-03-31 22:43:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-31 22:43:18 -0400 |
commit | fd4e7b50455330403ed5b1060055f9d411ecdc57 (patch) | |
tree | a5cd0e7156354f37f28569efc63a42de85c361b7 /net/ipv4/proc.c | |
parent | d0538ca3554a3985c09921903cf8f5e38fa56123 (diff) |
[IPV4][NETNS]: Display per-net info in sockstat file.
Besides, now we can see per-net fragments statistics in the
same file, since this stats is already per-net.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/proc.c')
-rw-r--r-- | net/ipv4/proc.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 24ae23bb5124..552169b41b16 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -51,27 +51,54 @@ | |||
51 | */ | 51 | */ |
52 | static int sockstat_seq_show(struct seq_file *seq, void *v) | 52 | static int sockstat_seq_show(struct seq_file *seq, void *v) |
53 | { | 53 | { |
54 | struct net *net = seq->private; | ||
55 | |||
54 | socket_seq_show(seq); | 56 | socket_seq_show(seq); |
55 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", | 57 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", |
56 | sock_prot_inuse_get(&init_net, &tcp_prot), | 58 | sock_prot_inuse_get(net, &tcp_prot), |
57 | atomic_read(&tcp_orphan_count), | 59 | atomic_read(&tcp_orphan_count), |
58 | tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated), | 60 | tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated), |
59 | atomic_read(&tcp_memory_allocated)); | 61 | atomic_read(&tcp_memory_allocated)); |
60 | seq_printf(seq, "UDP: inuse %d mem %d\n", | 62 | seq_printf(seq, "UDP: inuse %d mem %d\n", |
61 | sock_prot_inuse_get(&init_net, &udp_prot), | 63 | sock_prot_inuse_get(net, &udp_prot), |
62 | atomic_read(&udp_memory_allocated)); | 64 | atomic_read(&udp_memory_allocated)); |
63 | seq_printf(seq, "UDPLITE: inuse %d\n", | 65 | seq_printf(seq, "UDPLITE: inuse %d\n", |
64 | sock_prot_inuse_get(&init_net, &udplite_prot)); | 66 | sock_prot_inuse_get(net, &udplite_prot)); |
65 | seq_printf(seq, "RAW: inuse %d\n", | 67 | seq_printf(seq, "RAW: inuse %d\n", |
66 | sock_prot_inuse_get(&init_net, &raw_prot)); | 68 | sock_prot_inuse_get(net, &raw_prot)); |
67 | seq_printf(seq, "FRAG: inuse %d memory %d\n", | 69 | seq_printf(seq, "FRAG: inuse %d memory %d\n", |
68 | ip_frag_nqueues(&init_net), ip_frag_mem(&init_net)); | 70 | ip_frag_nqueues(net), ip_frag_mem(net)); |
69 | return 0; | 71 | return 0; |
70 | } | 72 | } |
71 | 73 | ||
72 | static int sockstat_seq_open(struct inode *inode, struct file *file) | 74 | static int sockstat_seq_open(struct inode *inode, struct file *file) |
73 | { | 75 | { |
74 | return single_open(file, sockstat_seq_show, NULL); | 76 | int err; |
77 | struct net *net; | ||
78 | |||
79 | err = -ENXIO; | ||
80 | net = get_proc_net(inode); | ||
81 | if (net == NULL) | ||
82 | goto err_net; | ||
83 | |||
84 | err = single_open(file, sockstat_seq_show, net); | ||
85 | if (err < 0) | ||
86 | goto err_open; | ||
87 | |||
88 | return 0; | ||
89 | |||
90 | err_open: | ||
91 | put_net(net); | ||
92 | err_net: | ||
93 | return err; | ||
94 | } | ||
95 | |||
96 | static int sockstat_seq_release(struct inode *inode, struct file *file) | ||
97 | { | ||
98 | struct net *net = ((struct seq_file *)file->private_data)->private; | ||
99 | |||
100 | put_net(net); | ||
101 | return single_release(inode, file); | ||
75 | } | 102 | } |
76 | 103 | ||
77 | static const struct file_operations sockstat_seq_fops = { | 104 | static const struct file_operations sockstat_seq_fops = { |
@@ -79,7 +106,7 @@ static const struct file_operations sockstat_seq_fops = { | |||
79 | .open = sockstat_seq_open, | 106 | .open = sockstat_seq_open, |
80 | .read = seq_read, | 107 | .read = seq_read, |
81 | .llseek = seq_lseek, | 108 | .llseek = seq_lseek, |
82 | .release = single_release, | 109 | .release = sockstat_seq_release, |
83 | }; | 110 | }; |
84 | 111 | ||
85 | /* snmp items */ | 112 | /* snmp items */ |