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
b1027831
Commit
b1027831
authored
Feb 14, 2016
by
Bernard Spil
Browse files
Merge branch 'master' of
https://github.com/hishamhm/htop
parents
d0d14da8
35657208
Changes
7
Hide whitespace changes
Inline
Side-by-side
MetersPanel.c
View file @
b1027831
...
...
@@ -50,7 +50,10 @@ static void MetersPanel_delete(Object* object) {
void
MetersPanel_setMoving
(
MetersPanel
*
this
,
bool
moving
)
{
Panel
*
super
=
(
Panel
*
)
this
;
this
->
moving
=
moving
;
((
ListItem
*
)
Panel_getSelected
(
super
))
->
moving
=
moving
;
ListItem
*
selected
=
(
ListItem
*
)
Panel_getSelected
(
super
);
if
(
selected
)
{
selected
->
moving
=
moving
;
}
if
(
!
moving
)
{
Panel_setSelectionColor
(
super
,
CRT_colors
[
PANEL_SELECTION_FOCUS
]);
Panel_setDefaultBar
(
super
);
...
...
darwin/DarwinProcess.c
View file @
b1027831
...
...
@@ -327,8 +327,8 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess *proc, DarwinProcessList
proc
->
super
.
time
=
(
pti
.
pti_total_system
+
pti
.
pti_total_user
)
/
10000000
;
proc
->
super
.
nlwp
=
pti
.
pti_threadnum
;
proc
->
super
.
m_size
=
pti
.
pti_virtual_size
/
1024
;
proc
->
super
.
m_resident
=
pti
.
pti_resident_size
/
1024
;
proc
->
super
.
m_size
=
pti
.
pti_virtual_size
/
1024
/
PAGE_SIZE_KB
;
proc
->
super
.
m_resident
=
pti
.
pti_resident_size
/
1024
/
PAGE_SIZE_KB
;
proc
->
super
.
majflt
=
pti
.
pti_faults
;
proc
->
super
.
percent_mem
=
(
double
)
pti
.
pti_resident_size
*
100
.
0
/
(
double
)
dpl
->
host_info
.
max_mem
;
...
...
freebsd/FreeBSDProcess.c
View file @
b1027831
...
...
@@ -115,7 +115,7 @@ void FreeBSDProcess_writeField(Process* this, RichString* str, ProcessField fiel
char
buffer
[
256
];
buffer
[
255
]
=
'\0'
;
int
attr
=
CRT_colors
[
DEFAULT_COLOR
];
int
n
=
sizeof
(
buffer
)
-
1
;
switch
(
field
)
{
switch
(
(
int
)
field
)
{
// add FreeBSD-specific fields here
case
JID
:
snprintf
(
buffer
,
n
,
Process_pidFormat
,
fp
->
jid
);
break
;
case
JAIL
:{
...
...
@@ -143,7 +143,7 @@ long FreeBSDProcess_compare(const void* v1, const void* v2) {
p2
=
(
FreeBSDProcess
*
)
v1
;
p1
=
(
FreeBSDProcess
*
)
v2
;
}
switch
(
settings
->
sortKey
)
{
switch
(
(
int
)
settings
->
sortKey
)
{
// add FreeBSD-specific fields here
case
JID
:
return
(
p1
->
jid
-
p2
->
jid
);
...
...
linux/LinuxProcess.c
View file @
b1027831
...
...
@@ -268,13 +268,20 @@ io_priority = (cpu_nice + 20) / 5. -- From ionice(1) man page
#define LinuxProcess_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->super.nice + 20) / 5) : p_->ioPriority)
IOPriority
LinuxProcess_updateIOPriority
(
LinuxProcess
*
this
)
{
IOPriority
ioprio
=
syscall
(
SYS_ioprio_get
,
IOPRIO_WHO_PROCESS
,
this
->
super
.
pid
);
IOPriority
ioprio
=
0
;
// Other OSes masquerading as Linux (NetBSD?) don't have this syscall
#ifdef SYS_ioprio_get
ioprio
=
syscall
(
SYS_ioprio_get
,
IOPRIO_WHO_PROCESS
,
this
->
super
.
pid
);
#endif
this
->
ioPriority
=
ioprio
;
return
ioprio
;
}
bool
LinuxProcess_setIOPriority
(
LinuxProcess
*
this
,
IOPriority
ioprio
)
{
// Other OSes masquerading as Linux (NetBSD?) don't have this syscall
#ifdef SYS_ioprio_set
syscall
(
SYS_ioprio_set
,
IOPRIO_WHO_PROCESS
,
this
->
super
.
pid
,
ioprio
);
#endif
return
(
LinuxProcess_updateIOPriority
(
this
)
==
ioprio
);
}
...
...
linux/LinuxProcessList.c
View file @
b1027831
...
...
@@ -446,7 +446,7 @@ static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirn
}
static
void
setCommand
(
Process
*
process
,
const
char
*
command
,
int
len
)
{
if
(
process
->
comm
&&
process
->
commLen
<
=
len
)
{
if
(
process
->
comm
&&
process
->
commLen
>
=
len
)
{
strncpy
(
process
->
comm
,
command
,
len
+
1
);
}
else
{
free
(
process
->
comm
);
...
...
unsupported/Platform.c
View file @
b1027831
...
...
@@ -19,9 +19,16 @@ in the source distribution for its full text.
/*{
#include "Action.h"
#include "BatteryMeter.h"
#include "SignalsPanel.h"
#include "UnsupportedProcess.h"
}*/
SignalItem
Platform_signals
[]
=
{
{
.
name
=
" 0 Cancel"
,
.
number
=
0
},
};
unsigned
int
Platform_numberOfSignals
=
sizeof
(
Platform_signals
)
/
sizeof
(
SignalItem
);
ProcessField
Platform_defaultFields
[]
=
{
PID
,
USER
,
PRIORITY
,
NICE
,
M_SIZE
,
M_RESIDENT
,
STATE
,
PERCENT_CPU
,
PERCENT_MEM
,
TIME
,
COMM
,
0
};
ProcessFieldData
Process_fields
[]
=
{
...
...
@@ -79,7 +86,12 @@ void Platform_setBindings(Htop_Action* keys) {
}
int
Platform_numberOfFields
=
100
;
char
*
Process_pidFormat
=
"%7u "
;
extern
char
Process_pidFormat
[
20
];
ProcessPidColumn
Process_pidColumns
[]
=
{
{
.
id
=
0
,
.
label
=
NULL
},
};
int
Platform_getUptime
()
{
return
0
;
...
...
@@ -95,42 +107,26 @@ int Platform_getMaxPid() {
return
1
;
}
void
Process_setupColumnWidths
()
{
int
maxPid
=
Platform_getMaxPid
();
if
(
maxPid
==
-
1
)
return
;
if
(
maxPid
>
99999
)
{
Process_fields
[
PID
].
title
=
" PID "
;
Process_fields
[
PPID
].
title
=
" PPID "
;
Process_fields
[
TPGID
].
title
=
" TPGID "
;
Process_fields
[
TGID
].
title
=
" TGID "
;
Process_fields
[
PGRP
].
title
=
" PGRP "
;
Process_fields
[
SESSION
].
title
=
" SESN "
;
Process_pidFormat
=
"%7u "
;
}
else
{
Process_fields
[
PID
].
title
=
" PID "
;
Process_fields
[
PPID
].
title
=
" PPID "
;
Process_fields
[
TPGID
].
title
=
"TPGID "
;
Process_fields
[
TGID
].
title
=
" TGID "
;
Process_fields
[
PGRP
].
title
=
" PGRP "
;
Process_fields
[
SESSION
].
title
=
" SESN "
;
Process_pidFormat
=
"%5u "
;
}
}
double
Platform_setCPUValues
(
Meter
*
this
,
int
cpu
)
{
return
0
.
0
;
(
void
)
this
;
(
void
)
cpu
;
return
0
.
0
;
}
void
Platform_setMemoryValues
(
Meter
*
this
)
{
(
void
)
this
;
}
void
Platform_setSwapValues
(
Meter
*
this
)
{
(
void
)
this
;
}
bool
Process_isThread
(
Process
*
this
)
{
(
void
)
this
;
return
false
;
}
char
*
Platform_getProcessEnv
(
pid_t
pid
)
{
(
void
)
pid
;
return
NULL
;
}
unsupported/Platform.h
View file @
b1027831
...
...
@@ -12,8 +12,13 @@ in the source distribution for its full text.
#include "Action.h"
#include "BatteryMeter.h"
#include "SignalsPanel.h"
#include "UnsupportedProcess.h"
extern
SignalItem
Platform_signals
[];
extern
unsigned
int
Platform_numberOfSignals
;
extern
ProcessField
Platform_defaultFields
[];
extern
ProcessFieldData
Process_fields
[];
...
...
@@ -23,7 +28,10 @@ extern MeterClass* Platform_meterTypes[];
void
Platform_setBindings
(
Htop_Action
*
keys
);
extern
int
Platform_numberOfFields
;
extern
char
*
Process_pidFormat
;
extern
char
Process_pidFormat
[
20
];
extern
ProcessPidColumn
Process_pidColumns
[];
int
Platform_getUptime
();
...
...
@@ -31,8 +39,6 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen);
int
Platform_getMaxPid
();
void
Process_setupColumnWidths
();
double
Platform_setCPUValues
(
Meter
*
this
,
int
cpu
);
void
Platform_setMemoryValues
(
Meter
*
this
);
...
...
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