What does the ENT
mean in ENOENT
?
Shouldn't the error:
No such file or directory
just be named by ENOFILE
?
Is there any story or reason?
What does the ENT
mean in ENOENT
?
Shouldn't the error:
No such file or directory
just be named by ENOFILE
?
Is there any story or reason?
It's an abbreviation of Error NO ENTry (or Error NO ENTity), and can actually be used for more than files/directories.
It's abbreviated because C compilers at the dawn of time didn't support more than 8 characters in symbols.
It's simply “No such directory entry”. Since directory entries can be directories or files (or symlinks, or sockets, or pipes, or devices), the name ENOFILE
would have been too narrow in its meaning.
For a full list of all the codes and a better description of what each one means see errno.h This is an include file that is part of the C standard library and the comments clarify what the error is about. In this case:
#define ENOENT 2 /* No such file or directory */
In linux(Ubuntu)
File: /usr/include/asm-generic/errno-base.h
6: #define ENOENT 2 /* No such file or directory */
7:
https://man7.org/linux/man-pages/man3/errno.3.html
errno 2
return:
ENOENT 2 No such file or directory
open group: https://pubs.opengroup.org/onlinepubs/009604599/functions/xsh_chap02_03.html
[ENOENT]
No such file or directory. A component of a specified pathname does not exist, or the pathname is an empty string.
Glibc:
https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
Macro: int ENOENT
"No such file or directory." This is a “file doesn’t exist” error for ordinary files that are referenced in contexts where they are
expected to already exist.