From owner-freebsd-current Thu Sep 24 23:48:37 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA08855 for freebsd-current-outgoing; Thu, 24 Sep 1998 23:48:37 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from smtp02.primenet.com (smtp02.primenet.com [206.165.6.132]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA08836 for ; Thu, 24 Sep 1998 23:48:34 -0700 (PDT) (envelope-from tlambert@usr01.primenet.com) Received: (from daemon@localhost) by smtp02.primenet.com (8.8.8/8.8.8) id XAA07666; Thu, 24 Sep 1998 23:48:29 -0700 (MST) Received: from usr01.primenet.com(206.165.6.201) via SMTP by smtp02.primenet.com, id smtpd007649; Thu Sep 24 23:48:27 1998 Received: (from tlambert@localhost) by usr01.primenet.com (8.8.5/8.8.5) id XAA15367; Thu, 24 Sep 1998 23:48:19 -0700 (MST) From: Terry Lambert Message-Id: <199809250648.XAA15367@usr01.primenet.com> Subject: Re: Limit 'ps' to show only user's processes To: taob@risc.org (Brian Tao) Date: Fri, 25 Sep 1998 06:48:18 +0000 (GMT) Cc: robert+freebsd@cyrus.watson.org, freebsd-current@FreeBSD.ORG In-Reply-To: from "Brian Tao" at Sep 24, 98 09:43:53 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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