Lines Matching +full:5 +full:kd

80 #define KREAD(kd, addr, obj) \  argument
81 (kvm_read(kd, addr, (char *)(obj), sizeof(*obj)) != sizeof(*obj))
105 kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p, in kvm_proclist() argument
138 if (KREAD(kd, (u_long)p, &proc)) { in kvm_proclist()
139 _kvm_err(kd, kd->program, "can't read proc at %p", p); in kvm_proclist()
144 if (KREAD(kd, (u_long)proc.p_ucred, &ucred) == 0) { in kvm_proclist()
158 kvm_read(kd, (u_long)ucred.cr_groups, kp->ki_groups, in kvm_proclist()
161 if (KREAD(kd, (u_long)ucred.cr_prison, &pr)) { in kvm_proclist()
162 _kvm_err(kd, kd->program, in kvm_proclist()
204 _kvm_err(kd, kd->program, "nprocs corrupt"); in kvm_proclist()
221 if (KREAD(kd, (u_long)proc.p_sigacts, &sigacts)) { in kvm_proclist()
222 _kvm_err(kd, kd->program, in kvm_proclist()
231 if (KREAD(kd, (u_long)proc.p_stats, &pstats)) { in kvm_proclist()
232 _kvm_err(kd, kd->program, in kvm_proclist()
254 if (KREAD(kd, (u_long)proc.p_pptr, &pproc)) { in kvm_proclist()
255 _kvm_err(kd, kd->program, in kvm_proclist()
264 if (KREAD(kd, (u_long)proc.p_pgrp, &pgrp)) { in kvm_proclist()
265 _kvm_err(kd, kd->program, "can't read pgrp at %p", in kvm_proclist()
271 if (KREAD(kd, (u_long)pgrp.pg_session, &sess)) { in kvm_proclist()
272 _kvm_err(kd, kd->program, "can't read session at %p", in kvm_proclist()
280 if (KREAD(kd, (u_long)sess.s_ttyp, &tty)) { in kvm_proclist()
281 _kvm_err(kd, kd->program, in kvm_proclist()
286 if (KREAD(kd, (u_long)tty.t_dev, &t_cdev)) { in kvm_proclist()
287 _kvm_err(kd, kd->program, in kvm_proclist()
299 if (KREAD(kd, (u_long)tty.t_pgrp, &pgrp)) { in kvm_proclist()
300 _kvm_err(kd, kd->program, in kvm_proclist()
309 if (KREAD(kd, (u_long)tty.t_session, &sess)) { in kvm_proclist()
310 _kvm_err(kd, kd->program, in kvm_proclist()
322 (void)kvm_read(kd, (u_long)proc.p_vmspace, in kvm_proclist()
356 (void)kvm_read(kd, (u_long)proc.p_sysent, (char *)&sysent, in kvm_proclist()
358 (void)kvm_read(kd, (u_long)sysent.sv_name, (char *)&svname, in kvm_proclist()
375 if (KREAD(kd, (u_long)td, &mtd)) { in kvm_proclist()
376 _kvm_err(kd, kd->program, in kvm_proclist()
385 (void)kvm_read(kd, (u_long)mtd.td_wmesg, in kvm_proclist()
400 (void)kvm_read(kd, in kvm_proclist()
492 kvm_deadprocs(kvm_t *kd, int what, int arg, u_long a_allproc, in kvm_deadprocs() argument
495 struct kinfo_proc *bp = kd->procbase; in kvm_deadprocs()
499 if (KREAD(kd, a_allproc, &p)) { in kvm_deadprocs()
500 _kvm_err(kd, kd->program, "cannot read allproc"); in kvm_deadprocs()
503 acnt = kvm_proclist(kd, what, arg, p, bp, maxcnt); in kvm_deadprocs()
508 if (KREAD(kd, a_zombproc, &p)) { in kvm_deadprocs()
509 _kvm_err(kd, kd->program, "cannot read zombproc"); in kvm_deadprocs()
512 zcnt = kvm_proclist(kd, what, arg, p, bp + acnt, maxcnt - acnt); in kvm_deadprocs()
521 kvm_getprocs(kvm_t *kd, int op, int arg, int *cnt) in kvm_getprocs() argument
527 if (kd->procbase != 0) { in kvm_getprocs()
528 free((void *)kd->procbase); in kvm_getprocs()
533 kd->procbase = 0; in kvm_getprocs()
535 if (ISALIVE(kd)) { in kvm_getprocs()
546 _kvm_syserr(kd, kd->program, "kvm_getprocs"); in kvm_getprocs()
560 * free() on kd->procbase if it isn't NULL, in kvm_getprocs()
565 kd->procbase = _kvm_malloc(kd, 1); in kvm_getprocs()
570 kd->procbase = (struct kinfo_proc *) in kvm_getprocs()
571 _kvm_realloc(kd, kd->procbase, size); in kvm_getprocs()
572 if (kd->procbase == NULL) in kvm_getprocs()
577 kd->procbase, &size, NULL, 0); in kvm_getprocs()
580 _kvm_syserr(kd, kd->program, "kvm_getprocs"); in kvm_getprocs()
590 kd->procbase->ki_structsize != sizeof(struct kinfo_proc)) { in kvm_getprocs()
591 _kvm_err(kd, kd->program, in kvm_getprocs()
594 kd->procbase->ki_structsize); in kvm_getprocs()
598 nprocs = size == 0 ? 0 : size / kd->procbase->ki_structsize; in kvm_getprocs()
608 nl[5].n_name = 0; in kvm_getprocs()
613 if (!kd->arch->ka_native(kd)) { in kvm_getprocs()
614 _kvm_err(kd, kd->program, in kvm_getprocs()
619 if (kvm_nlist(kd, nl) != 0) { in kvm_getprocs()
622 _kvm_err(kd, kd->program, in kvm_getprocs()
626 (void) kvm_nlist(kd, nlz); /* attempt to get zombproc */ in kvm_getprocs()
627 if (KREAD(kd, nl[0].n_value, &nprocs)) { in kvm_getprocs()
628 _kvm_err(kd, kd->program, "can't read nprocs"); in kvm_getprocs()
638 if (KREAD(kd, nl[2].n_value, &ticks)) { in kvm_getprocs()
639 _kvm_err(kd, kd->program, "can't read ticks"); in kvm_getprocs()
642 if (KREAD(kd, nl[3].n_value, &hz)) { in kvm_getprocs()
643 _kvm_err(kd, kd->program, "can't read hz"); in kvm_getprocs()
646 if (KREAD(kd, nl[4].n_value, &cpu_tick_frequency)) { in kvm_getprocs()
647 _kvm_err(kd, kd->program, in kvm_getprocs()
652 kd->procbase = (struct kinfo_proc *)_kvm_malloc(kd, size); in kvm_getprocs()
653 if (kd->procbase == NULL) in kvm_getprocs()
656 nprocs = kvm_deadprocs(kd, op, arg, nl[1].n_value, in kvm_getprocs()
659 _kvm_freeprocs(kd); in kvm_getprocs()
665 kd->procbase = realloc(kd->procbase, size); in kvm_getprocs()
670 return (kd->procbase); in kvm_getprocs()
674 _kvm_freeprocs(kvm_t *kd) in _kvm_freeprocs() argument
677 free(kd->procbase); in _kvm_freeprocs()
678 kd->procbase = NULL; in _kvm_freeprocs()
682 _kvm_realloc(kvm_t *kd, void *p, size_t n) in _kvm_realloc() argument
688 _kvm_err(kd, kd->program, "out of memory"); in _kvm_realloc()
696 kvm_argv(kvm_t *kd, const struct kinfo_proc *kp, int env, int nchr) in kvm_argv() argument
707 if (!ISALIVE(kd)) { in kvm_argv()
708 _kvm_err(kd, kd->program, in kvm_argv()
718 _kvm_err(kd, kd->program, "cannot allocate memory"); in kvm_argv()
726 _kvm_err(kd, kd->program, "cannot allocate memory"); in kvm_argv()
773 kvm_getargv(kvm_t *kd, const struct kinfo_proc *kp, int nchr) in kvm_getargv() argument
775 return (kvm_argv(kd, kp, 0, nchr)); in kvm_getargv()
779 kvm_getenvv(kvm_t *kd, const struct kinfo_proc *kp, int nchr) in kvm_getenvv() argument
781 return (kvm_argv(kd, kp, 1, nchr)); in kvm_getenvv()