Where can I find the set of exit codes that may be returned by dvd+rw-mediainfo

81 views Asked by At

Running on redhat 7.9. I will be using dvd+rw-mediainfo wrapped by either ProcBuilder from apache or the ProcessBuilder from java 11 to query the state of media inserted into an optical drive. I'd like information about the possible exit values dvd+rw-mediainfo can produce. Empirically I have determined that 251 means there is no disc inserted into the drive and 130 means there is no drive matching the argument to the command. Are there any other exit codes I should be aware of? I looked at the c source I found at https://sources.debian.org/src/dvd+rw-tools/7.1-3/dvd+rw-mediainfo.cpp/ but there is no definition of the return codes in there. There are not a lot of included h files. I was unable to find stddef.h on my system which I sort of suspected might be the location.

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

I'm not very adept at c++ (strictly java) but I was hoping to find a h file that defined the exit codes. They are not listed in the man page entries for the command. Where I see exit called in the source it is not clear to me where the values are defined.

  if ((err=cmd.transport(READ,inq,36)))
    sperror ("INQUIRY",err),
    exit (FATAL_START(errno));

I don't see where the value of errno is set. I also can't find the definitation of FATAL_START. Also one exit calls uses a constant that I can't find defined anywhere.

exit (FATAL_START(EINVAL));
1

There are 1 answers

0
Jukka Matilainen On

For the errno values, see errno.h (and other files included from therein), which on a RedHat-based system you will find in /usr/include/errno.h, provided by package glibc-headers.

Looking at your link to the source code, the macro FATAL_START seems to be defined in the header file transport.hxx, and it just sets bit 7:

#define FATAL_START(er) (0x80|(er))

So, exit code 251 = 128 + 123 would correspond to this:

#define ENOMEDIUM       123     /* No medium found */

And 130 = 128 + 2 corresponds to this:

#define ENOENT           2      /* No such file or directory */