Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
a4b03e88
Commit
a4b03e88
authored
10 years ago
by
Hisham Muhammad
Browse files
Options
Download
Email Patches
Plain Diff
Improve reading of cgroups.
parent
39a725ab
master
darwin-cpu-average
fixedgray
freebsd
linear-graph-scan
lua
next
perfcounters
pkgconfig-on-linux
solaris
sreclaimable
travis-ci
wip
3.0.0beta5
3.0.0beta4
3.0.0beta3
3.0.0beta2
3.0.0beta1
2.2.0
2.1.0
2.0.2
2.0.1
2.0.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
linux/LinuxProcessList.c
+18
-13
linux/LinuxProcessList.c
with
18 additions
and
13 deletions
+18
-13
linux/LinuxProcessList.c
View file @
a4b03e88
...
...
@@ -312,22 +312,27 @@ static void LinuxProcessList_readCGroupFile(Process* process, const char* dirnam
process
->
cgroup
=
strdup
(
""
);
return
;
}
char
buffer
[
256
];
char
*
ok
=
fgets
(
buffer
,
255
,
file
);
if
(
ok
)
{
char
*
trimmed
=
String_trim
(
buffer
);
int
nFields
;
char
**
fields
=
String_split
(
trimmed
,
':'
,
&
nFields
);
free
(
trimmed
);
free
(
process
->
cgroup
);
if
(
nFields
>=
3
)
{
process
->
cgroup
=
strndup
(
fields
[
2
]
+
1
,
10
);
}
else
{
process
->
cgroup
=
strdup
(
""
);
char
output
[
256
];
output
[
0
]
=
'\0'
;
char
*
at
=
output
;
int
left
=
255
;
while
(
!
feof
(
file
)
&&
left
>
0
)
{
char
buffer
[
256
];
char
*
ok
=
fgets
(
buffer
,
255
,
file
);
if
(
!
ok
)
break
;
char
*
group
=
strchr
(
buffer
,
':'
);
if
(
!
group
)
break
;
if
(
at
!=
output
)
{
*
at
=
';'
;
at
++
;
left
--
;
}
String_freeArray
(
fields
);
int
wrote
=
snprintf
(
at
,
left
,
"%s"
,
group
);
left
-=
wrote
;
}
fclose
(
file
);
free
(
process
->
cgroup
);
process
->
cgroup
=
strdup
(
output
);
}
#endif
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help