Date: Thu, 7 May 1998 16:59:45 +0300 (IDT) From: Eli Zaretskii To: djgpp AT delorie DOT com Subject: Re: DJGPP 2.01 spawnvp problem...... In-Reply-To: <6irudc$34i$1@nnrp1.dejanews.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Thu, 7 May 1998 leetonks AT hotmail DOT com wrote: > The program runs another DJGPP program using a call to spawnvp, but this call > just doesn't want to work for some reason. > > The line is : > result=spawnvp(P_WAIT,prog,par); Did you remember to make prog the first element of par as well? This is by far the most frequent problem with using spawnXX functions. > where prog is a null-terminated char array and par is an array of pointers to > the parameters to be passed. par[0] should be the same string as prog, or it won't work. Also, the last member of par[] should be a NULL pointer. If the above hints don't help, post the fragment of your code where you invoke spawnvp, showing the strings you pass in prog and par[] variables. > error is the same either way. Under DOS, an extra error value is reported on > the screen which says it is error 4. According to the DJGPP docs this is > EACCES - Permission Denied. What does this mean? :-( I think you are mixing the error code associated with the SIGSEGV exception and error code of file operations. When SIGSEGV prints error code 4, it means that you are accessing memory using illegal pointer or address. The DJGPP FAQ explains how to convert the crash traceback into human-readable info in section 9.2 (the FAQ is available as v2/faq210b.zip from the same place you get DJGPP). After this conversion, you should be able to see where in your code does it blow up, which makes debugging easier. Also, please note that for efficient help, it is advisable to post the entire stack traceback printed when your program crashes (after passing it through `symify', see the above-mentioned section of the FAQ). > I'm 99% confident there isn't a problem in the code as it worked just fine > under Borland. Borland, as the rest of real-mode compilers, are much more tolerant to illegal memory accesses than DJGPP programs which run in protected mode. > I've also tried recompiling libc to allow 50 open files as > opposed to 20 (as mentioned in a similar but different problem on the DJGPP > bug database) and that hasn't done any good either. DJGPP supports up to 255 open files, limited only by the value of FILES= directive on your CONFIG.SYS. You don't need to recompile the library, this feature is enabled by default. Whoever submitted that report to the bug-tracker was dead wrong.