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
f4f6d54f
Commit
f4f6d54f
authored
May 13, 2015
by
Hisham Muhammad
Browse files
Fix compilation of OpenVZ support.
Closes #185. Closes #190.
parent
64ecba25
Changes
1
Hide whitespace changes
Inline
Side-by-side
linux/LinuxProcessList.c
View file @
f4f6d54f
...
...
@@ -106,10 +106,6 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
this
->
cpus
[
i
].
totalPeriod
=
1
;
}
#ifdef HAVE_OPENVZ
this
->
flags
|=
PROCESS_FLAG_LINUX_OPENVZ
;
#endif
return
pl
;
}
...
...
@@ -328,19 +324,18 @@ static bool LinuxProcessList_readStatmFile(LinuxProcess* process, const char* di
#ifdef HAVE_OPENVZ
static
void
LinuxProcessList_readOpenVZData
(
ProcessList
*
this
,
Process
*
process
,
const
char
*
dirname
,
const
char
*
name
)
{
if
(
(
!
(
this
->
flags
&
PROCESS_FLAG_LINUX_OPENVZ
))
||
(
access
(
"/proc/vz"
,
R_OK
)
!=
0
))
{
process
->
vpid
=
process
->
pid
;
static
void
LinuxProcessList_readOpenVZData
(
Linux
Process
*
process
,
const
char
*
dirname
,
const
char
*
name
)
{
if
(
(
access
(
"/proc/vz"
,
R_OK
)
!=
0
))
{
process
->
vpid
=
process
->
super
.
pid
;
process
->
ctid
=
0
;
this
->
flags
|=
~
PROCESS_FLAG_LINUX_OPENVZ
;
return
;
}
char
filename
[
MAX_NAME
+
1
];
snprintf
(
filename
,
MAX_NAME
,
"%s/%s/stat"
,
dirname
,
name
);
FILE
*
file
=
fopen
(
filename
,
"r"
);
if
(
!
file
)
if
(
!
file
)
return
;
(
void
)
fscanf
(
file
,
(
void
)
fscanf
(
file
,
"%*32u %*32s %*1c %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
"%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
...
...
@@ -350,6 +345,7 @@ static void LinuxProcessList_readOpenVZData(ProcessList* this, Process* process,
"%*32u %*32u %32u %32u"
,
&
process
->
vpid
,
&
process
->
ctid
);
fclose
(
file
);
return
;
}
#endif
...
...
@@ -551,22 +547,27 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
proc
->
user
=
UsersTable_getRef
(
pl
->
usersTable
,
proc
->
st_uid
);
#ifdef HAVE_OPENVZ
LinuxProcessList_readOpenVZData
(
this
,
lp
,
dirname
,
name
);
if
(
settings
->
flags
&
PROCESS_FLAG_LINUX_OPENVZ
)
{
LinuxProcessList_readOpenVZData
(
lp
,
dirname
,
name
);
}
#endif
#ifdef HAVE_VSERVER
if
(
settings
->
flags
&
PROCESS_FLAG_LINUX_VSERVER
)
if
(
settings
->
flags
&
PROCESS_FLAG_LINUX_VSERVER
)
{
LinuxProcessList_readVServerData
(
lp
,
dirname
,
name
);
}
#endif
if
(
!
LinuxProcessList_readCmdlineFile
(
proc
,
dirname
,
name
))
if
(
!
LinuxProcessList_readCmdlineFile
(
proc
,
dirname
,
name
))
{
goto
errorReadingProcess
;
}
ProcessList_add
(
pl
,
proc
);
}
else
{
if
(
settings
->
updateProcessNames
)
{
if
(
!
LinuxProcessList_readCmdlineFile
(
proc
,
dirname
,
name
))
if
(
!
LinuxProcessList_readCmdlineFile
(
proc
,
dirname
,
name
))
{
goto
errorReadingProcess
;
}
}
}
...
...
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