Commit 92e19ad6 authored by David S. Miller's avatar David S. Miller

Merge master.kernel.org:/home/acme/BK/net-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents 7c1b1fec ce4982c9
...@@ -164,13 +164,11 @@ int snmp_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -164,13 +164,11 @@ int snmp_get_info(char *buffer, char **start, off_t offset, int length)
/* /*
* Output /proc/net/netstat * Output /proc/net/netstat
*/ */
static int netstat_seq_show(struct seq_file *seq, void *v)
int netstat_get_info(char *buffer, char **start, off_t offset, int length)
{ {
int len, i; int i;
len = sprintf(buffer, seq_puts(seq, "TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed"
"TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed"
" EmbryonicRsts PruneCalled RcvPruned OfoPruned" " EmbryonicRsts PruneCalled RcvPruned OfoPruned"
" OutOfWindowIcmps LockDroppedIcmps ArpFilter" " OutOfWindowIcmps LockDroppedIcmps ArpFilter"
" TW TWRecycled TWKilled" " TW TWRecycled TWKilled"
...@@ -196,31 +194,37 @@ int netstat_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -196,31 +194,37 @@ int netstat_get_info(char *buffer, char **start, off_t offset, int length)
" TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger" " TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger"
" TCPAbortFailed TCPMemoryPressures\n" " TCPAbortFailed TCPMemoryPressures\n"
"TcpExt:"); "TcpExt:");
for (i=0; i<offsetof(struct linux_mib, __pad)/sizeof(unsigned long); i++) for (i = 0;
len += sprintf(buffer+len, " %lu", fold_field((unsigned long*)net_statistics, sizeof(struct linux_mib), i)); i < offsetof(struct linux_mib, __pad) / sizeof(unsigned long);
i++)
len += sprintf (buffer + len, "\n"); seq_printf(seq, " %lu",
fold_field((unsigned long *)net_statistics,
if (offset >= len) sizeof(struct linux_mib), i));
{ seq_putc(seq, '\n');
*start = buffer;
return 0; return 0;
}
*start = buffer + offset;
len -= offset;
if (len > length)
len = length;
if (len < 0)
len = 0;
return len;
} }
static int netstat_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, netstat_seq_show, NULL);
}
static struct file_operations netstat_seq_fops = {
.open = netstat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
int __init ip_misc_proc_init(void) int __init ip_misc_proc_init(void)
{ {
int rc = 0; int rc = 0;
struct proc_dir_entry *p = create_proc_entry("netstat", S_IRUGO, proc_net);
if (!proc_net_create("netstat", 0, netstat_get_info)) if (!p)
goto out_netstat; goto out_netstat;
p->proc_fops = &netstat_seq_fops;
if (!proc_net_create("snmp", 0, snmp_get_info)) if (!proc_net_create("snmp", 0, snmp_get_info))
goto out_snmp; goto out_snmp;
if (!proc_net_create("sockstat", 0, afinet_get_info)) if (!proc_net_create("sockstat", 0, afinet_get_info))
...@@ -230,7 +234,7 @@ int __init ip_misc_proc_init(void) ...@@ -230,7 +234,7 @@ int __init ip_misc_proc_init(void)
out_sockstat: out_sockstat:
proc_net_remove("snmp"); proc_net_remove("snmp");
out_snmp: out_snmp:
proc_net_remove("netstat"); remove_proc_entry("netstat", proc_net);
out_netstat: out_netstat:
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment