Skip to content
GitLab
Menu
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
e940aecf
Commit
e940aecf
authored
Jul 10, 2017
by
Hisham Muhammad
Browse files
Add "no perm" status when other fields fail due to lack of permission.
Thanks @Sworddragon for the heads up. See #88.
parent
1a178ad5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Process.c
View file @
e940aecf
...
...
@@ -262,7 +262,10 @@ void Process_colorNumber(RichString* str, unsigned long long number, bool colori
processShadowColor
=
CRT_colors
[
PROCESS
];
}
if
(
number
>
10000000000
)
{
if
((
long
long
)
number
==
-
1LL
)
{
int
len
=
snprintf
(
buffer
,
13
,
" no perm "
);
RichString_appendn
(
str
,
CRT_colors
[
PROCESS_SHADOW
],
buffer
,
len
);
}
else
if
(
number
>
10000000000
)
{
snprintf
(
buffer
,
13
,
"%11lld "
,
number
/
1000
);
RichString_appendn
(
str
,
largeNumberColor
,
buffer
,
5
);
RichString_appendn
(
str
,
processMegabytesColor
,
buffer
+
5
,
3
);
...
...
linux/LinuxProcessList.c
View file @
e940aecf
...
...
@@ -353,6 +353,15 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
if
(
fd
==
-
1
)
{
process
->
io_rate_read_bps
=
-
1
;
process
->
io_rate_write_bps
=
-
1
;
process
->
io_rchar
=
-
1LL
;
process
->
io_wchar
=
-
1LL
;
process
->
io_syscr
=
-
1LL
;
process
->
io_syscw
=
-
1LL
;
process
->
io_read_bytes
=
-
1LL
;
process
->
io_write_bytes
=
-
1LL
;
process
->
io_cancelled_write_bytes
=
-
1LL
;
process
->
io_rate_read_time
=
-
1LL
;
process
->
io_rate_write_time
=
-
1LL
;
return
;
}
...
...
@@ -529,8 +538,9 @@ static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirn
char
filename
[
MAX_NAME
+
1
];
snprintf
(
filename
,
MAX_NAME
,
"%s/%s/oom_score"
,
dirname
,
name
);
FILE
*
file
=
fopen
(
filename
,
"r"
);
if
(
!
file
)
if
(
!
file
)
{
return
;
}
char
buffer
[
PROC_LINE_LENGTH
+
1
];
if
(
fgets
(
buffer
,
PROC_LINE_LENGTH
,
file
))
{
unsigned
int
oom
;
...
...
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