about summary refs log tree commit diff homepage
path: root/runtime/POSIX/fd_32.c
diff options
context:
space:
mode:
authorGleb Popov <6yearold@gmail.com>2019-03-30 16:34:03 +0400
committerMartinNowack <martin.nowack@gmail.com>2019-04-02 09:12:56 +0100
commit0b33d74f465991e94d8dafb6eeaf4b69af0a1887 (patch)
tree3d01d954d2b7f00d55d0a695c22d67698f68dc5a /runtime/POSIX/fd_32.c
parentf0aa7d884697597a717361a82976d181abaf245a (diff)
downloadklee-0b33d74f465991e94d8dafb6eeaf4b69af0a1887.tar.gz
POSIX runtime fixes for FreeBSD.
Diffstat (limited to 'runtime/POSIX/fd_32.c')
-rw-r--r--runtime/POSIX/fd_32.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/POSIX/fd_32.c b/runtime/POSIX/fd_32.c
index 36c5d41f..efd10404 100644
--- a/runtime/POSIX/fd_32.c
+++ b/runtime/POSIX/fd_32.c
@@ -29,7 +29,9 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/time.h>
+#ifndef __FreeBSD__
 #include <sys/vfs.h>
+#endif
 #include <fcntl.h>
 #include <stdarg.h>
 #include <assert.h>
@@ -165,7 +167,11 @@ int statfs(const char *path, struct statfs *buf32) {
 
 /* Based on uclibc version. We use getdents64 and then rewrite the
    results over themselves, as dirent32s. */
+#ifndef __FreeBSD__
 ssize_t getdents(int fd, struct dirent *dirp, size_t nbytes) {
+#else
+int getdents(int fd, char *dirp, int nbytes) {
+#endif
   struct dirent64 *dp64 = (struct dirent64*) dirp;
   ssize_t res = __fd_getdents(fd, dp64, nbytes);
 
@@ -176,7 +182,9 @@ ssize_t getdents(int fd, struct dirent *dirp, size_t nbytes) {
       size_t name_len = (dp64->d_reclen - 
                            (size_t) &((struct dirent64*) 0)->d_name);
       dp->d_ino = dp64->d_ino;
+#ifdef _DIRENT_HAVE_D_OFF
       dp->d_off = dp64->d_off;
+#endif
       dp->d_reclen = dp64->d_reclen;
       dp->d_type = dp64->d_type;
       memmove(dp->d_name, dp64->d_name, name_len);