Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90479
b: refs/heads/master
c: fd4e7b5
h: refs/heads/master
i:
  90477: 7dbddb7
  90475: 338bd7f
  90471: 70a7c10
  90463: f53cb9b
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Apr 1, 2008
1 parent d810825 commit 74fe0c0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0538ca3554a3985c09921903cf8f5e38fa56123
refs/heads/master: fd4e7b50455330403ed5b1060055f9d411ecdc57
41 changes: 34 additions & 7 deletions trunk/net/ipv4/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,62 @@
*/
static int sockstat_seq_show(struct seq_file *seq, void *v)
{
struct net *net = seq->private;

socket_seq_show(seq);
seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n",
sock_prot_inuse_get(&init_net, &tcp_prot),
sock_prot_inuse_get(net, &tcp_prot),
atomic_read(&tcp_orphan_count),
tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated),
atomic_read(&tcp_memory_allocated));
seq_printf(seq, "UDP: inuse %d mem %d\n",
sock_prot_inuse_get(&init_net, &udp_prot),
sock_prot_inuse_get(net, &udp_prot),
atomic_read(&udp_memory_allocated));
seq_printf(seq, "UDPLITE: inuse %d\n",
sock_prot_inuse_get(&init_net, &udplite_prot));
sock_prot_inuse_get(net, &udplite_prot));
seq_printf(seq, "RAW: inuse %d\n",
sock_prot_inuse_get(&init_net, &raw_prot));
sock_prot_inuse_get(net, &raw_prot));
seq_printf(seq, "FRAG: inuse %d memory %d\n",
ip_frag_nqueues(&init_net), ip_frag_mem(&init_net));
ip_frag_nqueues(net), ip_frag_mem(net));
return 0;
}

static int sockstat_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, sockstat_seq_show, NULL);
int err;
struct net *net;

err = -ENXIO;
net = get_proc_net(inode);
if (net == NULL)
goto err_net;

err = single_open(file, sockstat_seq_show, net);
if (err < 0)
goto err_open;

return 0;

err_open:
put_net(net);
err_net:
return err;
}

static int sockstat_seq_release(struct inode *inode, struct file *file)
{
struct net *net = ((struct seq_file *)file->private_data)->private;

put_net(net);
return single_release(inode, file);
}

static const struct file_operations sockstat_seq_fops = {
.owner = THIS_MODULE,
.open = sockstat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.release = sockstat_seq_release,
};

/* snmp items */
Expand Down

0 comments on commit 74fe0c0

Please sign in to comment.