Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ce4982c9
Commit
ce4982c9
authored
Nov 11, 2002
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o ipv4: convert /proc/net/netstat to seq_file
parent
5be2bc3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
23 deletions
+27
-23
net/ipv4/proc.c
net/ipv4/proc.c
+27
-23
No files found.
net/ipv4/proc.c
View file @
ce4982c9
...
...
@@ -164,13 +164,11 @@ int snmp_get_info(char *buffer, char **start, off_t offset, int length)
/*
* Output /proc/net/netstat
*/
int
netstat_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
static
int
netstat_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
int
len
,
i
;
int
i
;
len
=
sprintf
(
buffer
,
"TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed"
seq_puts
(
seq
,
"TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed"
" EmbryonicRsts PruneCalled RcvPruned OfoPruned"
" OutOfWindowIcmps LockDroppedIcmps ArpFilter"
" TW TWRecycled TWKilled"
...
...
@@ -196,31 +194,37 @@ int netstat_get_info(char *buffer, char **start, off_t offset, int length)
" TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger"
" TCPAbortFailed TCPMemoryPressures
\n
"
"TcpExt:"
);
for
(
i
=
0
;
i
<
offsetof
(
struct
linux_mib
,
__pad
)
/
sizeof
(
unsigned
long
);
i
++
)
len
+=
sprintf
(
buffer
+
len
,
" %lu"
,
fold_field
((
unsigned
long
*
)
net_statistics
,
sizeof
(
struct
linux_mib
),
i
));
len
+=
sprintf
(
buffer
+
len
,
"
\n
"
);
for
(
i
=
0
;
i
<
offsetof
(
struct
linux_mib
,
__pad
)
/
sizeof
(
unsigned
long
);
i
++
)
seq_printf
(
seq
,
" %lu"
,
fold_field
((
unsigned
long
*
)
net_statistics
,
sizeof
(
struct
linux_mib
),
i
));
seq_putc
(
seq
,
'\n'
);
return
0
;
}
if
(
offset
>=
len
)
{
*
start
=
buffer
;
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
rc
=
0
;
struct
proc_dir_entry
*
p
=
create_proc_entry
(
"netstat"
,
S_IRUGO
,
proc_net
);
if
(
!
p
roc_net_create
(
"netstat"
,
0
,
netstat_get_info
)
)
if
(
!
p
)
goto
out_netstat
;
p
->
proc_fops
=
&
netstat_seq_fops
;
if
(
!
proc_net_create
(
"snmp"
,
0
,
snmp_get_info
))
goto
out_snmp
;
if
(
!
proc_net_create
(
"sockstat"
,
0
,
afinet_get_info
))
...
...
@@ -230,7 +234,7 @@ int __init ip_misc_proc_init(void)
out_sockstat:
proc_net_remove
(
"snmp"
);
out_snmp:
proc_net_remove
(
"netstat"
);
remove_proc_entry
(
"netstat"
,
proc_net
);
out_netstat:
rc
=
-
ENOMEM
;
goto
out
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment