Are all bits in (struct proc).p_flag set?
chris mcdonald
chris at bilby.cs.uwa.oz.au
Wed May 1 09:00:00 AEST 1991
The following program (I presume) should find all the login shells running
on my SPARC-1 4.0.3, but it appears that the SLOGIN bit of p_flag is not
set on any process. Comment out the SLOGIN line to see all processes.
Any ideas?
Chris McDonald. _--_|\
University of Western Australia, ARPA: chris%budgie.cs.uwa.oz.au at uunet.uu.net
#include <kvm.h>
#include <sys/fcntl.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/proc.h>
main(argc, argv) int argc; char **argv;
{
kvm_t *kd;
struct proc *aproc;
struct proc theproc;
struct user *u;
kd = kvm_open(NULL, NULL, NULL, O_RDONLY, argv[0]);
for(;;) {
aproc = kvm_nextproc(kd);
if(!aproc)
break;
theproc = *aproc;
if((theproc.p_flag) & SLOGIN)
(void)printf("%6d%6d%6d\t0x%07x\n",
theproc.p_pid,theproc.p_uid,theproc.p_ppid,theproc.p_flag);
/*
u = kvm_getu(kd, &theproc);
*/
}
(void)kvm_close(kd);
exit(0);
}
More information about the Comp.sys.sun
mailing list