Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jun 2003 06:48:00 -0700
From:      Joshua Oreman <oremanj@webserver.get-linux.org>
To:        "Sharma, Tarun" <tsharma@iPolicyNet.COM>
Cc:        questions@freebsd.org
Subject:   Re: Fork giving error
Message-ID:  <20030611134800.GA99412@webserver.get-linux.org>
In-Reply-To: <4FB6F321746ED4118A0500508BD8A240021841AA@cinthol.india.ipolicynet.com>
References:  <4FB6F321746ED4118A0500508BD8A240021841AA@cinthol.india.ipolicynet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030611134800.GA99412>