Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
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
iproute2
Commits
a221d621
Commit
a221d621
authored
Feb 12, 2015
by
Bryton Lee
Committed by
Stephen Hemminger
Feb 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent the read ahead of /proc/slabinfo in ss
Signed-off-by:
Bryton Lee
<
brytonlee01@gmail.com
>
parent
11ba90fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
misc/ss.c
misc/ss.c
+11
-3
No files found.
misc/ss.c
View file @
a221d621
...
...
@@ -618,7 +618,7 @@ struct slabstat
int
skbs
;
};
struct
slabstat
slabstat
;
st
atic
st
ruct
slabstat
slabstat
;
static
const
char
*
slabstat_ids
[]
=
{
...
...
@@ -634,6 +634,10 @@ static int get_slabstat(struct slabstat *s)
char
buf
[
256
];
FILE
*
fp
;
int
cnt
;
static
int
slabstat_valid
;
if
(
slabstat_valid
)
return
0
;
memset
(
s
,
0
,
sizeof
(
*
s
));
...
...
@@ -657,6 +661,8 @@ static int get_slabstat(struct slabstat *s)
break
;
}
slabstat_valid
=
1
;
fclose
(
fp
);
return
0
;
}
...
...
@@ -2297,6 +2303,8 @@ static int tcp_show(struct filter *f, int socktype)
* it is able to give us some memory for snapshot.
*/
if
(
1
)
{
get_slabstat
(
&
slabstat
);
int
guess
=
slabstat
.
socks
+
slabstat
.
tcp_syns
;
if
(
f
->
states
&
(
1
<<
SS_TIME_WAIT
))
guess
+=
slabstat
.
tcp_tws
;
...
...
@@ -3234,6 +3242,8 @@ static int print_summary(void)
if
(
get_snmp_int
(
"Tcp:"
,
"CurrEstab"
,
&
sn
.
tcp_estab
)
<
0
)
perror
(
"ss: get_snmpstat"
);
get_slabstat
(
&
slabstat
);
printf
(
"Total: %d (kernel %d)
\n
"
,
s
.
socks
,
slabstat
.
socks
);
printf
(
"TCP: %d (estab %d, closed %d, orphaned %d, synrecv %d, timewait %d/%d), ports %d
\n
"
,
...
...
@@ -3587,8 +3597,6 @@ int main(int argc, char *argv[])
argc
-=
optind
;
argv
+=
optind
;
get_slabstat
(
&
slabstat
);
if
(
do_summary
)
{
print_summary
();
if
(
do_default
&&
argc
==
0
)
...
...
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