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
f54a37b4
Commit
f54a37b4
authored
May 03, 2014
by
Hisham Muhammad
Browse files
Update values for fields whose columns may appear later. Fixes #80.
parent
c3e66b2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Process.c
View file @
f54a37b4
...
...
@@ -663,9 +663,9 @@ static void Process_display(Object* cast, RichString* out) {
void
Process_delete
(
Object
*
cast
)
{
Process
*
this
=
(
Process
*
)
cast
;
assert
(
this
!=
NULL
);
if
(
this
->
comm
)
free
(
this
->
comm
);
free
(
this
->
comm
);
#ifdef HAVE_CGROUP
if
(
this
->
cgroup
)
free
(
this
->
cgroup
);
free
(
this
->
cgroup
);
#endif
free
(
this
);
}
...
...
ProcessList.c
View file @
f54a37b4
...
...
@@ -242,8 +242,13 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
this
->
flags
=
0
;
for
(
int
i
=
0
;
defaultHeaders
[
i
];
i
++
)
{
this
->
fields
[
i
]
=
defaultHeaders
[
i
];
this
->
f
ields
[
i
]
|=
Process_fieldFlags
[
defaultHeaders
[
i
]];
this
->
f
lags
|=
Process_fieldFlags
[
defaultHeaders
[
i
]];
}
#ifdef HAVE_OPENVZ
this
->
flags
|=
PROCESS_FLAG_OPENVZ
;
#endif
this
->
sortKey
=
PERCENT_CPU
;
this
->
direction
=
1
;
this
->
hideThreads
=
false
;
...
...
@@ -580,9 +585,10 @@ static bool ProcessList_readStatmFile(Process* process, const char* dirname, con
#ifdef HAVE_OPENVZ
static
void
ProcessList_readOpenVZData
(
Process
*
process
,
const
char
*
dirname
,
const
char
*
name
)
{
if
(
access
(
"/proc/vz"
,
R_OK
)
!=
0
)
{
if
(
(
!
(
this
->
flags
&
PROCESS_FLAG_OPENVZ
))
||
(
access
(
"/proc/vz"
,
R_OK
)
!=
0
)
)
{
process
->
vpid
=
process
->
pid
;
process
->
ctid
=
0
;
this
->
flags
|=
~
PROCESS_FLAG_OPENVZ
;
return
;
}
char
filename
[
MAX_NAME
+
1
];
...
...
@@ -806,23 +812,13 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
process
->
user
=
UsersTable_getRef
(
this
->
usersTable
,
process
->
st_uid
);
#ifdef HAVE_OPENVZ
if
(
this
->
flags
&
PROCESS_FLAG_OPENVZ
)
ProcessList_readOpenVZData
(
process
,
dirname
,
name
);
#endif
#ifdef HAVE_CGROUP
if
(
this
->
flags
&
PROCESS_FLAG_CGROUP
)
ProcessList_readCGroupFile
(
process
,
dirname
,
name
);
ProcessList_readOpenVZData
(
process
,
dirname
,
name
);
#endif
#ifdef HAVE_VSERVER
if
(
this
->
flags
&
PROCESS_FLAG_VSERVER
)
ProcessList_readVServerData
(
process
,
dirname
,
name
);
#endif
#ifdef HAVE_OOM
ProcessList_readOomData
(
process
,
dirname
,
name
);
#endif
if
(
!
ProcessList_readCmdlineFile
(
process
,
dirname
,
name
))
goto
errorReadingProcess
;
...
...
@@ -835,6 +831,15 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
}
}
#ifdef HAVE_CGROUP
if
(
this
->
flags
&
PROCESS_FLAG_CGROUP
)
ProcessList_readCGroupFile
(
process
,
dirname
,
name
);
#endif
#ifdef HAVE_OOM
ProcessList_readOomData
(
process
,
dirname
,
name
);
#endif
if
(
process
->
state
==
'Z'
)
{
free
(
process
->
comm
);
process
->
basenameOffset
=
-
1
;
...
...
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