diff options
author | anthk <anthk@texto-plano.xyz> | 2021-02-05 22:54:33 +0000 |
---|---|---|
committer | anthk <anthk@texto-plano.xyz> | 2021-02-05 22:54:33 +0000 |
commit | d252394bc86670e39f8a9c5c52875b13645764af (patch) | |
tree | 0f6ffaa9c162af9f2ff42445491edf62941ea2cd | |
parent | 5221ce1b7ce6170070c350d50b95ed893d795a09 (diff) | |
download | cpulimit-d252394bc86670e39f8a9c5c52875b13645764af.tar.gz |
initial OpenBSD support
-rw-r--r-- | src/process_iterator_openbsd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/process_iterator_openbsd.c b/src/process_iterator_openbsd.c index d6f1206..18bce96 100644 --- a/src/process_iterator_openbsd.c +++ b/src/process_iterator_openbsd.c @@ -41,11 +41,12 @@ int init_process_iterator(struct process_iterator *it, struct process_filter *fi static int kproc2proc(kvm_t *kd, struct kinfo_proc *kproc, struct process *proc) { proc->pid = kproc->p_pid; proc->ppid = kproc->p_ppid; - proc->cputime = ( kproc->p_uutime_sec + kproc->p_ustime_sec ) / 1000000 ; + proc->cputime = kproc->p_rtime_sec * 10 + (double)kproc->p_rtime_usec; proc->starttime = kproc->p_ustart_sec; char **args = kvm_getargv(kd, kproc, sizeof(proc->command)); - if (args == NULL) return -1; + if (args == NULL) return -1; memcpy(proc->command, args[0], strlen(args[0]) + 1); + return 0; } |