Article View: comp.sys.sun
Article #7685Are all bits in (struct proc).p_flag set?
From: chris mcdonald
Date: Tue, 30 Apr 1991 23:00
Date: Tue, 30 Apr 1991 23:00
37 lines
1543 bytes
1543 bytes
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);
}
Technical Details
Message-ID:
<2741@brchh104.bnr.ca>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: chris@bilby.cs.uwa.oz.au (chris mcdonald) Newsgroups: comp.sys.sun Subject: Are all bits in (struct proc).p_flag set? Keywords: Miscellaneous Message-ID: <2741@brchh104.bnr.ca> Date: 30 Apr 91 23:00:00 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 38 Approved: Sun-Spots@rice.edu X-Original-Date: 29 Apr 91 07:36:09 GMT X-Sun-Spots-Digest: Volume 10, Issue 99, message 5 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu