Fork giving error
Joshua Oreman
oremanj at webserver.get-linux.org
Wed Jun 11 06:46:16 PDT 2003
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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions
mailing list