From owner-freebsd-questions Wed Sep 29 8: 8: 4 1999 Delivered-To: freebsd-questions@freebsd.org Received: from mail.cs.tu-berlin.de (mail.cs.tu-berlin.de [130.149.17.13]) by hub.freebsd.org (Postfix) with ESMTP id 403DC15890 for ; Wed, 29 Sep 1999 08:06:54 -0700 (PDT) (envelope-from wosch@cs.tu-berlin.de) Received: from freno.cs.tu-berlin.de (wosch@freno.cs.tu-berlin.de [130.149.17.167]) by mail.cs.tu-berlin.de (8.9.1/8.9.1) with ESMTP id RAA19177 for ; Wed, 29 Sep 1999 17:03:57 +0200 (MET DST) Received: (from wosch@localhost) by freno.cs.tu-berlin.de (8.9.1/8.9.0) id RAA03493 for questions@freebsd.org; Wed, 29 Sep 1999 17:03:56 +0200 (MET DST) Date: Wed, 29 Sep 1999 17:03:56 +0200 From: Wolfram Schneider To: questions@freebsd.org Subject: [bytong@yahoo.com: (no subject)] Message-ID: <19990929170355.A3481@freno.cs.tu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG ----- Forwarded message from bytong ----- Date: Wed, 29 Sep 1999 22:20:02 +0800 From: bytong Reply-To: bytong@yahoo.com To: wosch@FreeBSD.org Subject: (no subject) Dear : please find the following c program main() { int i; while ((i=fork())==-1); if (i) printf("It's parent process,process id %d parent id %d\n",getpid(),getppid()); else printf("It's child process,process id %d parent id %d\n",getpid(),getppid()); } It's very simple ,but the result amaze me.The parent process return 246,181 which express the process id and its parent process id,the problem is child process which return 247,1 ,child process id is 247,but its parent's process id is 1 not 246,why? The parent process is just a child process "forked" by another process,on the result of above example,i think,getppid() should always return 1. My freebsd is freebsd 2.2.8 Please tell me why? My email address: bytong@yahoo.com Thanks and best regards! ----- End forwarded message ----- -- Wolfram Schneider http://wolfram.schneider.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message