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
86771628
Commit
86771628
authored
Mar 28, 2018
by
Guy M. Broome
Committed by
Hisham Muhammad
Apr 06, 2018
Browse files
Solaris: add warning about proc_walk_f callback function
parent
475798e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
solaris/SolarisProcessList.c
View file @
86771628
...
@@ -236,6 +236,12 @@ void ProcessList_delete(ProcessList* this) {
...
@@ -236,6 +236,12 @@ void ProcessList_delete(ProcessList* this) {
free
(
this
);
free
(
this
);
}
}
/* NOTE: the following is a callback function of type proc_walk_f
* and MUST conform to the appropriate definition in order
* to work. See libproc(3LIB) on a Solaris or Illumos
* system for more info.
*/
int
SolarisProcessList_walkproc
(
psinfo_t
*
_psinfo
,
lwpsinfo_t
*
_lwpsinfo
,
void
*
listptr
)
{
int
SolarisProcessList_walkproc
(
psinfo_t
*
_psinfo
,
lwpsinfo_t
*
_lwpsinfo
,
void
*
listptr
)
{
struct
timeval
tv
;
struct
timeval
tv
;
struct
tm
date
;
struct
tm
date
;
...
@@ -320,7 +326,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
...
@@ -320,7 +326,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
// See note above (in common section) about this BINARY FRACTION
// See note above (in common section) about this BINARY FRACTION
proc
->
percent_cpu
=
((
uint16_t
)
_psinfo
->
pr_pctcpu
/
(
double
)
32768
)
*
(
double
)
100
.
0
;
proc
->
percent_cpu
=
((
uint16_t
)
_psinfo
->
pr_pctcpu
/
(
double
)
32768
)
*
(
double
)
100
.
0
;
proc
->
time
=
_psinfo
->
pr_time
.
tv_sec
;
proc
->
time
=
_psinfo
->
pr_time
.
tv_sec
;
if
(
!
preExisting
)
{
// Tasks done only for NEW processes
if
(
!
preExisting
P
)
{
// Tasks done only for NEW processes
sproc
->
is_lwp
=
false
;
sproc
->
is_lwp
=
false
;
proc
->
starttime_ctime
=
_psinfo
->
pr_start
.
tv_sec
;
proc
->
starttime_ctime
=
_psinfo
->
pr_start
.
tv_sec
;
}
}
...
@@ -343,7 +349,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
...
@@ -343,7 +349,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
}
else
{
// We are not in the master LWP, so jump to the LWP handling code
}
else
{
// We are not in the master LWP, so jump to the LWP handling code
lwp
->
percent_cpu
=
((
uint16_t
)
_lwpsinfo
->
pr_pctcpu
/
(
double
)
32768
)
*
(
double
)
100
.
0
;
lwp
->
percent_cpu
=
((
uint16_t
)
_lwpsinfo
->
pr_pctcpu
/
(
double
)
32768
)
*
(
double
)
100
.
0
;
lwp
->
time
=
_lwpsinfo
->
pr_time
.
tv_sec
;
lwp
->
time
=
_lwpsinfo
->
pr_time
.
tv_sec
;
if
(
!
preExisting
)
{
// Tasks done only for NEW LWPs
if
(
!
preExisting
L
)
{
// Tasks done only for NEW LWPs
slwp
->
is_lwp
=
true
;
slwp
->
is_lwp
=
true
;
lwp
->
basenameOffset
=
-
1
;
lwp
->
basenameOffset
=
-
1
;
lwp
->
ppid
=
proc
->
pid
;
lwp
->
ppid
=
proc
->
pid
;
...
...
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