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

respect MAKE, properly test for mincore, fdatasync is in <unistd.h> #672

Closed
wants to merge 3 commits into from
Closed

Conversation

madroach
Copy link
Contributor

@madroach madroach commented Mar 9, 2019

  • directly calling make will break on systems where GNU make is called gmake and make actually is BSD make.

  • fdatasync is defined in <unistd.h> on OpenBSD. According to https://linux.die.net/man/2/fdatasync the same is true for linux.

  • I found out about d791b9b only after I adjusted discover.ml to check for availability of mincore. I'd suggest to rather test for the actual feature than to test for OS. Only tested on OpenBSD, where mincore is not available. So testing on Linux and maybe some other BSD, maybe Cygwin should still be done.

Christopher Zimmermann added 2 commits March 9, 2019 23:02
@aantron
Copy link
Collaborator

aantron commented Mar 11, 2019

The first two commits look good. Does the third solve a problem you are having? The new check is failing on another BSD(-ish system), namely macOS.

To make the #ifdefs easier to understand, I'd suggest specifically testing for mincore only, and then testing the argument types. So, I suggest inserting a new test, rather than complicating the existing test for argument types.

mincore was only tested for the type of its vector argument,
not whether it was actually available. Now use two tests for
"char" and "unsigned char".
@madroach
Copy link
Contributor Author

Well, it does solve the same problem as d791b9b, but since d791b9b is OS-specific I'm offering my take on it as an alternative. You may cherry-pick whatever you like of this pull request :).

@aantron
Copy link
Collaborator

aantron commented Mar 12, 2019

Ok :) I cherry-picked the first two commits.

On the third, there is an argument to be made for discovery, but I think this case is not yet clear, and I prefer not to risk accidentally breaking Lwt on some obscure system for this. If we have a problem with additional OSes not supporting mincore, we can revisit the commit. As you saw, you have to do a product of all the various argument types that mincore can have, and it's not clear that this is better than checking some ifdefs, at least not to me right now. In other words, both solutions are a little bit dubious.

Actually, you can probably discover the array argument type by just trying to call mincore, as that will abstract away whether you have void or const void in the other argument. But still, I think we can get by for now.

Thanks for your work!

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

Successfully merging this pull request may close these issues.

2 participants