Linux kernel represents an opened file as an entry in the file descriptor table, an entry in the v-node table, and an entry in the open file table.
Does Linux kernel represent an opened directory in the same way?
It might be not, because I was wondering why an directory is opened by:
DIR *opendir(const char *pathname);
while a file is opened by:
int open(const char *path, int oﬂag, ... /* mode_t mode */ );
It might be yes, because
DIR *fdopendir(int fd);
converts an open ﬁle descriptor into a DIR structure. So is there some function (
open()?) which can open a directory just like a file, and return a file descriptor
opendir() implemented by first using
open() to get a file descriptor of a directory, and then calling
fdopendir() or some equivalence on the file descriptor?