EBADF
EBADF, short for Bad File Descriptor, is an error code used by Unix-like operating systems to indicate that a file descriptor passed to a system call is invalid for the requested operation. It is part of the errno set defined by POSIX. When a program calls an I/O function such as read, write, or close with a descriptor that is not open or not valid, the call typically fails with -1 and errno set to EBADF. This contrasts with errors like EINVAL, which indicate an invalid argument to the call even if the descriptor is valid; EBADF means the descriptor itself is not valid.
Causes include using a descriptor after it has been closed, duplicating or transferring descriptors improperly, or
Value: The specific numeric value of EBADF is implementation-defined; on many Unix-like systems it is 9, and