jnr/jnr-posix — pull request #7 by jeremyevans (2012-02-23 18:30:55+00:00)
Title: Fix FileStat on OpenBSD

There are a couple of issues here. First, OpenBSDPOSIX used
FreeBSDHeapFileStat instead of OpenBSDHeapFileStat, so that
needs to be fixed first. Second, OpenBSDHeapFileStat does
have the correct layout causing fields after st_mode to be
incorrect. The big changes here were making mode and nlink
32-bit instead of 16-bit, and making time_t 32-bit instead
of long, since according to the OpenBSD system headers:

/usr/include/sys/stat.h: nlink_t st_nlink; /* number of hard links */
/usr/include/sys/types.h:typedef __nlink_t nlink_t; /* link count */
/usr/include/sys/_types.h:typedef __uint32_t __nlink_t; /* link count */

/usr/include/sys/stat.h: mode_t st_mode; /* inode protection mode */
/usr/include/sys/types.h:typedef __mode_t mode_t; /* permissions */
/usr/include/sys/_types.h:typedef __uint32_t __mode_t; /* permissions */

/usr/include/sys/types.h:typedef __time_t time_t;
/usr/include/i386/_types.h:typedef int __time_t;
/usr/include/amd64/_types.h:typedef int __time_t;

On OpenBSD amd64, long is 64-bit, not 32-bit.

I checked the other entries in struct stat and found that
many were unsigned, not signed, so I fixed those as well.