Date: Fri, 25 Sep 1998 06:48:18 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: taob@risc.org (Brian Tao) Cc: robert+freebsd@cyrus.watson.org, freebsd-current@FreeBSD.ORG Subject: Re: Limit 'ps' to show only user's processes Message-ID: <199809250648.XAA15367@usr01.primenet.com> In-Reply-To: <Pine.GSO.3.96.980924094103.16314b-100000@tor-dev1.nbc.netcom.ca> from "Brian Tao" at Sep 24, 98 09:43:53 am
next in thread | previous in thread | raw e-mail | index | archive | help
> > I don't think there is any way to hide the existence of other
> > processes -- a process that performs:
> >
> > int i, lasti;
> > while (1) {
> > i = fork();
> > if (!i) {
> > exit(0);
> > }
> > if (i != lasti + 1) {
> >
> > ....
>
> On a slightly different track, using randomized pid's would limit
> the usefulness of such a scan, although with a fast enough fork(), you
> could still map the entire pid space and find the "holes".
pid_t i;
int st;
pid_t me = getpid();
for( i = 0; i < MAX_INT; i++) {
st = kill( i, 0);
if( st != -1)
printf( "pid %d exists and is yours...\n", i);
else if( errno == EPERM)
printf( "pid %d exists and is NOT yours...\n", i);
}
Terry Lambert
terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809250648.XAA15367>
