This is an archive of the discontinued LLVM Phabricator instance.

Skip attempts to access /proc/self/fd on FreeBSD
ClosedPublic

Authored by mjguzik on Mar 27 2022, 8:55 AM.

Details

Summary

In contrast to Linux it does not provide entries which can be readlinked -- these are just regular files, not giving the expected outcome. That's on top of procfs not being mounted by default to begin with.

This is probably the case on other BSDs as well, so I expect there will be more ifdefs added down the road.

Diff Detail

Event Timeline

mjguzik created this revision.Mar 27 2022, 8:55 AM
mjguzik requested review of this revision.Mar 27 2022, 8:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2022, 8:55 AM
mjguzik edited the summary of this revision. (Show Details)Mar 27 2022, 8:55 AM
mjguzik edited the summary of this revision. (Show Details)Mar 27 2022, 8:57 AM
mjguzik updated this revision to Diff 418456.Mar 27 2022, 9:01 AM
  • change multiline comment to '//' instead of /* */
mjguzik added a comment.EditedMar 27 2022, 9:09 AM

Side note that hasProcSelfFD should get dropped -- the code can go straight for readlink and fallback if that fails. The access() call performed by hasProcSelfFD adds nothing really. Maybe I'll submit a patch later. Note that even in this case the readlink would have to be made conditional on FreeBSD.

dim added a reviewer: emaste.Mar 27 2022, 9:50 AM
dim accepted this revision.Mar 27 2022, 10:04 AM
This revision is now accepted and ready to land.Mar 27 2022, 10:04 AM
emaste accepted this revision.Mar 27 2022, 10:15 AM
mjguzik retitled this revision from Skip attemps to access /proc/self/fd on FreeBSD to Skip attempts to access /proc/self/fd on FreeBSD.Mar 27 2022, 10:42 AM
This revision was landed with ongoing or failed builds.Mar 27 2022, 11:20 AM
This revision was automatically updated to reflect the committed changes.