[PATCH] D30010: Improve the robustness of mmap
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 08:18:43 PST 2017
labath added a comment.
================
Comment at: llvm/lib/Support/Unix/Path.inc:68
#include <sys/types.h>
-#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__)
+#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && \
+ !defined(__ANDROID__)
----------------
labath wrote:
> krytarowski wrote:
> > zturner wrote:
> > > krytarowski wrote:
> > > > Is this equivalent to `defined(__linux__) || defined(__NetBSD__)`? If so it might look easier to parse presented this in the way of what system is used for this.
> > > If you scroll down the file about 30 lines you'll see this:
> > >
> > > ```
> > > #if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \
> > > defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) || \
> > > defined(__linux__) || defined(__CYGWIN__) || defined(__DragonFly__) || \
> > > defined(_AIX)
> > > ```
> > >
> > > I don't know the ins and outs of all these definitions, but I'm pretty sure at least some of them will fall into this `#if` branch. And there could even be other ones that are not listed here but which define other platforms. So I'm not entirely sure what the inverse of this conditional is.
> > Yes I saw this switch and I was thinking how many OS'es are really used there. Other than that NetBSD platform part looks fine. I will test build it.
> I guess the proper solution here would be to do a check at cmake-time for the appropriate symbols, and then branch here based on that.
This does not compile on linux. `struct statvfs` does not have the f_type field. I guess you need to use the `struct statfs` branch on linux.
https://reviews.llvm.org/D30010
More information about the llvm-commits
mailing list