Those platforms support F_GETPATH afaik, which is simpler (it's already
in the patch). Correct me if I'm wrong.
I don't know much about FreeBSD, but [bug 198570 - Add fnctl(F_GETPATH) support to FreeBSD](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198570) is still open. Code search of `F_GETPATH` in FreeBSD trunk doesn't show interesting results, either.