chris@bilby.cs.uwa.oz.au (chris mcdonald) (05/01/91)
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@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); }