Re: system() call causes core dump

2009-10-31 Thread Kris Kennaway
Peter Steele wrote: I have an application running a number of threads. I've had recent instances where the code below is causing a core dump to occur: char fstatCmd[200]; char *fstatOut = "/tmp/fstat.out"; sprintf(fstatCmd, "fstat | grep -v USER | wc -l >%s", fstatOut); rc = system(fstatCmd);

RE: system() call causes core dump

2009-10-31 Thread Peter Steele
>In UNIX it is not safe to perform arbitrary actions after forking a >multi-threaded process. You're basically expected to call exec soon after the >fork, although >you can do certain other work if you are very careful. >The reason for this is that after the fork, only one thread will be runnin

Re: system() call causes core dump

2009-11-01 Thread usleepless
On Sat, Oct 31, 2009 at 4:55 PM, Kris Kennaway wrote: > Peter Steele wrote: > >> I have an application running a number of threads. I've had recent >> instances where the code below is causing a core dump to occur: >> >> char fstatCmd[200]; >> char *fstatOut = "/tmp/fstat.out"; >> sprintf(fstatCm

Re: system() call causes core dump

2009-11-03 Thread Mel Flynn
On Saturday 31 October 2009 21:52:37 Peter Steele wrote: > >In UNIX it is not safe to perform arbitrary actions after forking a > > multi-threaded process. You're basically expected to call exec soon > > after the fork, although you can do certain other work if you are very > > careful. > > > >The