Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readdir() doesn't support d_type #9

Open
afalkenhahn opened this issue Apr 14, 2018 · 3 comments
Open

readdir() doesn't support d_type #9

afalkenhahn opened this issue Apr 14, 2018 · 3 comments

Comments

@afalkenhahn
Copy link

Would be nice to have readdir() support d_type so that it is possible to distinguish between files and directories in a portable way.

@sba1
Copy link
Contributor

sba1 commented Apr 20, 2018

Upcoming gcc 8 will also take advantage of readdir() with d_type support. @obarthel do you think that there are any problems with extending struct dirent with d_type?

@obarthel
Copy link
Contributor

No, this should be both "harmless" and beneficial.

If I recall my Unix history correctly, only the smallest common subset of the vendor-specific dirent structure members was standardized in Unix/POSIX, which to this day makes it necessary to use readdir() with stat() and lstat(). The standard only guarantees the presence of a name and an inode number.

And we always thought that a 'struct FileInfoBlock' had its limitations ;-)

@ksdhans
Copy link

ksdhans commented Jan 18, 2019

I just encountered this (with GCC 8.1.0). Newlib supports d_type, but not clib2. Given the current encouragement to switch from newlib to clib2, it would be great if this could be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants