From b25e3be8d9a5e193c9af75ccaf1cd317fd470e1d Mon Sep 17 00:00:00 2001 From: "R. Matthew Emerson" Date: Thu, 15 Mar 2018 21:27:16 +0000 Subject: [PATCH 1/2] Recent FreeBSD has st_mtim instead of st_mtimespec in struct stat --- level-1/linux-files.lisp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/level-1/linux-files.lisp b/level-1/linux-files.lisp index 18234f754..1305d9198 100644 --- a/level-1/linux-files.lisp +++ b/level-1/linux-files.lisp @@ -391,17 +391,17 @@ given is that of a group to which the current user belongs." (pref stat :stat.st_mode) (pref stat :stat.st_size) #+android-target (pref stat :stat.st_mtime) - #+(or (and linux-target (not android-target)) solaris-target) + #+(or freebsd-target (and linux-target (not android-target)) solaris-target) (pref stat :stat.st_mtim.tv_sec) - #-(or linux-target solaris-target) + #-(or freebsd-target linux-target solaris-target) (pref stat :stat.st_mtimespec.tv_sec) (pref stat :stat.st_ino) (pref stat :stat.st_uid) (pref stat :stat.st_blksize) - #+(or linux-target solaris-target) + #+(or freebsd-target linux-target solaris-target) (round (pref stat #-android-target :stat.st_mtim.tv_nsec #+android-target :stat.st_mtime_nsec) 1000) - #-(or linux-target solaris-target) + #-(or freebsd-target linux-target solaris-target) (round (pref stat :stat.st_mtimespec.tv_nsec) 1000) (pref stat :stat.st_gid) (pref stat :stat.st_dev) From 7e1528565e48dc1796a797887173856a9ea3ee36 Mon Sep 17 00:00:00 2001 From: "R. Matthew Emerson" Date: Thu, 15 Mar 2018 04:01:23 +0000 Subject: [PATCH 2/2] Revert "Add workarounds to make the lisp buildable on FreeBSD 12" This reverts commit 8b675fc72b739f1deb936955502c9d2f01f120ce. --- lisp-kernel/unix-calls.c | 114 --------------------------------------- 1 file changed, 114 deletions(-) diff --git a/lisp-kernel/unix-calls.c b/lisp-kernel/unix-calls.c index 16d0b1611..64bc2ea50 100644 --- a/lisp-kernel/unix-calls.c +++ b/lisp-kernel/unix-calls.c @@ -30,18 +30,6 @@ #endif #include #include -#if __FreeBSD_version >= 1200031 -/* - * ino_t, dev_t, nlink_t were extended to 64 bits (thereby changing - * struct stat). struct dirent changed also. - * - * Make the old versions available as freebsd11_stat and freebsd11_dirent. - * XXX - this should go away when FreeBSD 12 headers are generated - */ -#define _WANT_FREEBSD11_STAT -#define _WANT_FREEBSD11_DIRENT -#include -#endif #include #include #include @@ -96,81 +84,6 @@ lisp_ftruncate(int fd, off_t length) return ftruncate(fd,length); } -#if __FreeBSD_version >= 1200031 -/* - * struct stat has changed. As a temporary workaround until - * we can generate headers for FreeBSD 12, return stat(2) data in - * the old version of struct stat that the lisp expects. - */ -void -populate_old_stat(struct stat *sb, struct freebsd11_stat *sb11) -{ - memset(sb11, 0, sizeof(*sb11)); - sb11->st_dev = sb->st_dev; - sb11->st_ino = sb->st_ino; - sb11->st_mode = sb->st_mode; - sb11->st_nlink = sb->st_nlink; - sb11->st_uid = sb->st_uid; - sb11->st_gid = sb->st_gid; - sb11->st_rdev = sb->st_rdev; - sb11->st_atim = sb->st_atim; - sb11->st_mtim = sb->st_mtim; - sb11->st_ctim = sb->st_ctim; - sb11->st_size = sb->st_size; - sb11->st_blocks = sb->st_blocks; - sb11->st_blksize = sb->st_blksize; - sb11->st_flags = sb->st_flags; - sb11->st_gen = sb->st_gen; - sb11->st_birthtim = sb->st_birthtim; -} - -int -lisp_stat(char *path, void *buf) -{ - struct stat sb; - int ret; - - ret = stat(path, &sb); - if (ret == 0) { - populate_old_stat(&sb, buf); - return 0; - } else { - return -1; - } -} - -int -lisp_fstat(int fd, void *buf) -{ - struct stat sb; - int ret; - - ret = fstat(fd, &sb); - if (ret == 0) { - populate_old_stat(&sb, buf); - return 0; - } else { - return -1; - } -} - -int -lisp_lstat(char *path, void *buf) -{ - struct stat sb; - int ret; - - ret = lstat(path, &sb); - if (ret == 0) { - populate_old_stat(&sb, buf); - return 0; - } else { - return -1; - } -} - -#else - int lisp_stat(char *path, void *buf) { @@ -188,7 +101,6 @@ lisp_lstat(char *path, void *buf) { return lstat(path, buf); } -#endif int lisp_futex(int *uaddr, int op, int val, void *timeout, int *uaddr2, int val3) @@ -207,37 +119,11 @@ lisp_opendir(char *path) return opendir(path); } -#if __FreeBSD_version >= 1200031 -/* - * struct dirent has changed. Lisp only cares about :dirent.d_name, - * so make that available in the old struct dirent. - * Again, this will all go away when we generate new interfaces for - * FreeBSD 12. - */ -static __thread struct freebsd11_dirent old_dirent; - -struct freebsd11_dirent * -lisp_readdir(DIR *dir) -{ - struct dirent *dp; - struct freebsd11_dirent d11; - - dp = readdir(dir); - if (dp != NULL) { - memset(&old_dirent, 0, sizeof(old_dirent)); - strcpy(old_dirent.d_name, dp->d_name); - return &old_dirent; - } else { - return NULL; - } -} -#else struct dirent * lisp_readdir(DIR *dir) { return readdir(dir); } -#endif int lisp_closedir(DIR *dir)