From owner-freebsd-questions@FreeBSD.ORG Wed Jun 11 06:46:16 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8655D37B401 for ; Wed, 11 Jun 2003 06:46:16 -0700 (PDT) Received: from adsl-64-161-78-226.dsl.lsan03.pacbell.net (adsl-64-161-78-226.dsl.lsan03.pacbell.net [64.161.78.226]) by mx1.FreeBSD.org (Postfix) with SMTP id C912F43F85 for ; Wed, 11 Jun 2003 06:46:15 -0700 (PDT) (envelope-from oremanj@adsl-64-161-78-226.dsl.lsan03.pacbell.net) Received: (qmail 99492 invoked by uid 1001); 11 Jun 2003 13:48:00 -0000 Date: Wed, 11 Jun 2003 06:48:00 -0700 From: Joshua Oreman To: "Sharma, Tarun" Message-ID: <20030611134800.GA99412@webserver.get-linux.org> References: <4FB6F321746ED4118A0500508BD8A240021841AA@cinthol.india.ipolicynet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FB6F321746ED4118A0500508BD8A240021841AA@cinthol.india.ipolicynet.com> User-Agent: Mutt/1.4.1i cc: questions@freebsd.org Subject: Re: Fork giving error X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jun 2003 13:46:16 -0000 On Wed, Jun 11, 2003 at 06:30:57PM +0530 or thereabouts, Sharma, Tarun seemed to write: > while running a program I found that fork was giving some error. Can anybody > tell me why fork can give error and whats the solution for not getting this > problem ? Is it your program? If so, do something like this: int kid_pid; /* ... later ... */ switch (kid_pid = fork()) { case -1: perror ("myprogram: fork()"); exit (1); /* ... rest of it ... */ } If not, the program is not giving you enough info :-) You may be able to attach it in gdb and break fork, step until the next line of code after the fork, and print (char *) strerror (errno). HTH, -- Josh > > > Tarun > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"