What's a quick shell script, Python script, or C program that can be written to cause it to exit with error code 77 i.e. EBADFD? I don't want to just say for example exit 77, I want it to do something to cause that error to actually be generated.
How to cause an error 77 EBADFD in Linux
shell script;scripting;error handling
EBADFD is an error code that can be returned in the errno variable by some system calls in Linux. Anything you use in a shell's exit 123 or exit(123) in a C program sets the exit status of your program.Those aren't the same, usually a program will not exit with the error code of a system call, but something more generic, like just 1, or with a value defined by the program itself. E.g. GNU ls returns 2 if there is an error with the files named on the command line, and a 1 if there is an error with other files encountered; sox on the other hand will return a 1 if the command line arguments are in error, and a 2 if it faces an error with files.As for EBADFD, it doesn't seem to be very common, mostly used in some drivers, with sound drivers seemingly being a somewhat prominent user (see here). (EBADF would be common, of course.)