Linux 为什么 ENOENT 的意思是“没有这样的文件或目录”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19902828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why does ENOENT mean "No such file or directory"?
提问by mingchaoyan
What does the ENT
mean in ENOENT
?
是什么ENT
意思ENOENT
?
Shouldn't the error:
不应该是错误:
No such file or directory
无此文件或目录
just be named by ENOFILE
?
只是被命名ENOFILE
?
Is there any story or reason?
有什么故事或原因吗?
采纳答案by Some programmer dude
It's an abbreviation of Error NO ENTry (or Error NO ENTity), and can actually be used for more than files/directories.
它是 Error NO ENTry(或 Error NO ENTity)的缩写,实际上不仅可以用于文件/目录。
It's abbreviated because C compilers at the dawn of time didn't support more than 8 characters in symbols.
它被缩写是因为早期的 C 编译器不支持超过 8 个字符的符号。
回答by Roland Illig
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.
它只是“没有这样的目录条目”。由于目录条目可以是目录或文件(或符号链接、套接字、管道或设备),因此该名称ENOFILE
的含义过于狭窄。