top(1): garbage collect
- remove a now-unused function - remove needless indirection of handle type
This commit is contained in:
parent
d9cf8a13ca
commit
8caf462ef6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335551
@ -871,13 +871,12 @@ get_process_info(struct system_info *si, struct process_select *sel,
|
|||||||
static char fmt[512]; /* static area where result is built */
|
static char fmt[512]; /* static area where result is built */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
format_next_process(void* xhandle, char *(*get_userid)(int), int flags)
|
format_next_process(struct handle * xhandle, char *(*get_userid)(int), int flags)
|
||||||
{
|
{
|
||||||
struct kinfo_proc *pp;
|
struct kinfo_proc *pp;
|
||||||
const struct kinfo_proc *oldp;
|
const struct kinfo_proc *oldp;
|
||||||
long cputime;
|
long cputime;
|
||||||
double pct;
|
double pct;
|
||||||
struct handle *hp;
|
|
||||||
char status[22];
|
char status[22];
|
||||||
int cpu;
|
int cpu;
|
||||||
size_t state;
|
size_t state;
|
||||||
@ -891,9 +890,8 @@ format_next_process(void* xhandle, char *(*get_userid)(int), int flags)
|
|||||||
const int cmdlen = 128;
|
const int cmdlen = 128;
|
||||||
|
|
||||||
/* find and remember the next proc structure */
|
/* find and remember the next proc structure */
|
||||||
hp = (struct handle *)xhandle;
|
pp = *(xhandle->next_proc++);
|
||||||
pp = *(hp->next_proc++);
|
xhandle->remaining--;
|
||||||
hp->remaining--;
|
|
||||||
|
|
||||||
/* get the process's command name */
|
/* get the process's command name */
|
||||||
if ((pp->ki_flag & P_INMEM) == 0) {
|
if ((pp->ki_flag & P_INMEM) == 0) {
|
||||||
@ -1545,28 +1543,6 @@ int (*compares[])(const void *arg1, const void *arg2) = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* proc_owner(pid) - returns the uid that owns process "pid", or -1 if
|
|
||||||
* the process does not exist.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
proc_owner(int pid)
|
|
||||||
{
|
|
||||||
int cnt;
|
|
||||||
struct kinfo_proc **prefp;
|
|
||||||
struct kinfo_proc *pp;
|
|
||||||
|
|
||||||
prefp = pref;
|
|
||||||
cnt = pref_len;
|
|
||||||
while (--cnt >= 0) {
|
|
||||||
pp = *prefp++;
|
|
||||||
if (pp->ki_pid == (pid_t)pid)
|
|
||||||
return ((int)pp->ki_ruid);
|
|
||||||
}
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
swapmode(int *retavail, int *retfree)
|
swapmode(int *retavail, int *retfree)
|
||||||
{
|
{
|
||||||
|
@ -78,13 +78,14 @@ struct process_select
|
|||||||
|
|
||||||
/* routines defined by the machine dependent module */
|
/* routines defined by the machine dependent module */
|
||||||
|
|
||||||
|
struct handle;
|
||||||
|
|
||||||
char *format_header(const char *uname_field);
|
char *format_header(const char *uname_field);
|
||||||
char *format_next_process(void* handle, char *(*get_userid)(int),
|
char *format_next_process(struct handle* handle, char *(*get_userid)(int),
|
||||||
int flags);
|
int flags);
|
||||||
void toggle_pcpustats(void);
|
void toggle_pcpustats(void);
|
||||||
void get_system_info(struct system_info *si);
|
void get_system_info(struct system_info *si);
|
||||||
int machine_init(struct statics *statics);
|
int machine_init(struct statics *statics);
|
||||||
int proc_owner(int pid);
|
|
||||||
|
|
||||||
/* non-int routines typically used by the machine dependent module */
|
/* non-int routines typically used by the machine dependent module */
|
||||||
extern struct process_select ps;
|
extern struct process_select ps;
|
||||||
|
Loading…
Reference in New Issue
Block a user