PatB
PatB

Reputation: 516

Unable to find out what return code of -11 means

I am writing a tool which is written in python and C. The python script reads a configuration file, performs some validation makes several calls to the C program.

system: RHE 5.7, python: 2.7.6, gcc: 4.5.2

Some of the parameters to the called C program are the paths of input files. There is one case where the input file path is the same for several C program invocations. In this case only the first call succeeds, and the returncode from the python subprocess module is '-11'.

I am not sure how to progress this. For a start, I cannot find documentation indicating what '-11' might mean as an exit status. It does not appear to be in the 'standard' codes in /usr/include/sysexits.h. I am guessing that the code could also be interpreted as 0xf5 or 245, since exit codes are I believe really signed 8-bit values.

I have added debug to the start of the C program to print out the arguments it was called with, but nothing appears for the failed invocations. I can understand how the C might fail re-opening a file which was read on the previous invocation (perhaps), but the code doesn't even get that far!

So, where is the exit code coming from? Is it from the (bash) environment which the python subprocess module presumably uses to invoke the C program? Is it from the C runtime for the C program before it even reaches main?

I suppose I could progress this by moving the 'loop' down into the C, so that it only gets called once for each input file path, but that still does not explain this behaviour. Could someone please explain how I can determine the cause of this error? Thanks.

(FWIW) calling from python:

try:
  subprocess.check_call( args )
except subprocess.CalledProcessError as e:
  print e

Entry to the C:

printf( "\n--- swizzle\n\nargs:\n" );
for ( int i = 0; i < argc; i++ ) printf( "- %s\n", argv[ i ]);

Error output:

Command '[..]' returned non-zero exit status -11

Upvotes: 14

Views: 13027

Answers (1)

sth
sth

Reputation: 229593

Return code -11 means "segmentation fault". A negative return code usually means that the process was terminated by a signal. Return code -11 means it was signal 11, which is SIGSEGV.

Upvotes: 27

Related Questions