BSD Port and Linux Differences

Christos Zoulas christos at
Tue Feb 10 08:00:35 PST 2009

On Feb 9,  7:56pm, mvfranz at (Michael Franz) wrote:
-- Subject: BSD Port and Linux Differences

| Hi,
| 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.

NetBSD uses statvfs too.

| Is it better to use one over the other?  Do we really want to use statfs on
| bsd and statvfs on linux?

statvfs should be preferred over statfs because:
1. it is part of POSIX:
2. it is newer and has 64 bit fields where appropriate (in most implementations)

I think we need some #ifdef's there to handle which include is appropriate
for which OS.

| 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?
| This issue exists in jdk/src/solaris/native/java/util/TimeZone_md.c

strl{cpy,cat} should be preferred over strn{cpy,cat}. If that is the only
use though, I say put it back to use strncpy() correctly, since java probably
uses strn{cpy,cat} all over the place and providing portability just for
one use is overkill.

| A previous difference that I have found was in the use of machine/endian.h
| in the BSD port.

This is a more complicated :-) and I will let someone else answer it.


More information about the bsd-port-dev mailing list