BSD Port and Linux Differences

Andrew Haley aph at
Tue Feb 10 02:17:12 PST 2009

Michael Franz wrote:

> I am still working through the issues to get the bsd-port repo to
> compile on Linux and have run into these issues. 
> BSD is using statfs instead of statvfs.  Both are available on Linux and
> OS X.  The difference is how they are included.  Linux uses either
> sys/statfs.h or sys/statfs.h while OS X (and I assume other BSDs) are
> use sys/param.h,sys/mount.h or sys/statvfs.h.  See
> jdk/src/solaris/native/java/io/UnixFileSystem_md.c for more details.
> Is it better to use one over the other?  Do we really want to use statfs
> on bsd and statvfs on linux?

statvfs is standard POSIX, whereas statfs isn't.  The Linux statfs is
based on BSD's but it's not the same.  We surely should use standard

> I have run into a similar issue with strncpy vs strlcpy.  The bsd port
> is using strlcpy, as far as I can tell, strlcpy does not exist on
> linux.  Both have strncpy, should this be used instead?

If it's safe, yes.  Assuming the strncpy version is correct, we should
use that.

> This issue exists in jdk/src/solaris/native/java/util/TimeZone_md.c
> A previous difference that I have found was in the use of
> machine/endian.h in the BSD port. 

Is it really needed?


More information about the bsd-port-dev mailing list