mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 18:38:48 +00:00
Switch back from KERN_PROC2/kinfo_proc2 to KERN_PROC/kinfo_proc now
that we've got name we want for the API we want "ZAP!" deraadt@
This commit is contained in:
parent
48a1169f4e
commit
98d450ac3a
16
procname.c
16
procname.c
@ -34,11 +34,11 @@
|
|||||||
#define is_stopped(p) \
|
#define is_stopped(p) \
|
||||||
((p)->p_stat == SSTOP || (p)->p_stat == SZOMB || (p)->p_stat == SDEAD)
|
((p)->p_stat == SSTOP || (p)->p_stat == SZOMB || (p)->p_stat == SDEAD)
|
||||||
|
|
||||||
struct kinfo_proc2 *cmp_procs(struct kinfo_proc2 *, struct kinfo_proc2 *);
|
struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *);
|
||||||
char *get_proc_name(int, char *);
|
char *get_proc_name(int, char *);
|
||||||
|
|
||||||
struct kinfo_proc2 *
|
struct kinfo_proc *
|
||||||
cmp_procs(struct kinfo_proc2 *p1, struct kinfo_proc2 *p2)
|
cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2)
|
||||||
{
|
{
|
||||||
if (is_runnable(p1) && !is_runnable(p2))
|
if (is_runnable(p1) && !is_runnable(p2))
|
||||||
return (p1);
|
return (p1);
|
||||||
@ -78,11 +78,11 @@ cmp_procs(struct kinfo_proc2 *p1, struct kinfo_proc2 *p2)
|
|||||||
char *
|
char *
|
||||||
get_proc_name(int fd, char *tty)
|
get_proc_name(int fd, char *tty)
|
||||||
{
|
{
|
||||||
int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PGRP, 0,
|
int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PGRP, 0,
|
||||||
sizeof(struct kinfo_proc2), 0 };
|
sizeof(struct kinfo_proc), 0 };
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct kinfo_proc2 *buf, *newbuf, *bestp;
|
struct kinfo_proc *buf, *newbuf, *bestp;
|
||||||
u_int i;
|
u_int i;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ retry:
|
|||||||
goto error;
|
goto error;
|
||||||
buf = newbuf;
|
buf = newbuf;
|
||||||
|
|
||||||
mib[5] = (int)(len / sizeof(struct kinfo_proc2));
|
mib[5] = (int)(len / sizeof(struct kinfo_proc));
|
||||||
if (sysctl(mib, nitems(mib), buf, &len, NULL, 0) == -1) {
|
if (sysctl(mib, nitems(mib), buf, &len, NULL, 0) == -1) {
|
||||||
if (errno == ENOMEM)
|
if (errno == ENOMEM)
|
||||||
goto retry;
|
goto retry;
|
||||||
@ -110,7 +110,7 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bestp = NULL;
|
bestp = NULL;
|
||||||
for (i = 0; i < len / sizeof (struct kinfo_proc2); i++) {
|
for (i = 0; i < len / sizeof (struct kinfo_proc); i++) {
|
||||||
if ((dev_t)buf[i].p_tdev != sb.st_rdev)
|
if ((dev_t)buf[i].p_tdev != sb.st_rdev)
|
||||||
continue;
|
continue;
|
||||||
if (bestp == NULL)
|
if (bestp == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user