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

Made 'file_posix.cc' POSIX compatible #4967

Closed

Conversation

siepkes
Copy link
Contributor

@siepkes siepkes commented Apr 5, 2018

The d_type field is not part of the POSIX specification. Added a compile time check to see if we can use it. When not present fallback to a (slightly more expensive) call to 'stat'.

The reason why I need this is because I'm trying to port Bazel to a POSIX compliant platform. Even though my porting effort might fail miserably ;-) I think having a POSIX implementation which is POSIX compliant would be of benefit to the Bazel project.

Besides the POSIX spec I've based the implementation on information I found here:

The 'd_type' field is not part of the POSIX specification. Added a
compile time check to see if we can use it. When not present fallback to
a (slightly more expensive) call to 'stat'.
is_directory = S_ISDIR(buf.st_mode);
} else {
// 'd_type' field isn't part of the POSIX spec.
#ifdef _DIRENT_HAVE_D_TYPE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in #4969 -- is the motivation here to compile Bazel on some POSIX system or just theoretical POSIX compatibility?

bazel-io pushed a commit that referenced this pull request Apr 9, 2018
The 'd_type' field is not part of the POSIX specification. Added a compile time check to see if we can use it. When not present fallback to a (slightly more expensive) call to 'stat'.

This PR is similar to my other PR #4967. It's part of an effort to port Bazel to an POSIX compliant platform. Even though my porting effort may fail I think POSIX compliance could be beneficiary to Bazel either way.

Closes #4969.

PiperOrigin-RevId: 192096587
@bazel-io bazel-io closed this in f3de7d5 Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants