Changeset: e81837ef1851 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e81837ef1851
Modified Files:
        CMakeLists.txt
        gdk/gdk_storage.c
Branch: Dec2025
Log Message:

Port to FreeBSD.


diffs (39 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,6 +75,14 @@ endif()
 monetdb_configure_sizes()
 
 include(GNUInstallDirs)
+# work around FreeBSD forcing CMAKE_INSTALL_FULL_LOCALSTATEDIR to /var
+# we keep whatever FreeBSD comes up with (/var) if the prefix is / or
+# starts with /usr or /opt, but for other prefixes (e.g. home directory)
+# we set the variable to prefix + var.
+if(CMAKE_SYSTEM_NAME MATCHES "^FreeBSD$" AND NOT "${CMAKE_INSTALL_PREFIX}" 
STREQUAL "/" AND NOT "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr$" AND NOT 
"${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/" AND NOT "${CMAKE_INSTALL_PREFIX}" 
MATCHES "^/opt/")
+  set(CMAKE_INSTALL_FULL_LOCALSTATEDIR 
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALSTATEDIR}")
+endif()
+
 # The documentation is unclear on what is the best location to install
 # the configuration for the exported targets, especially when building
 # the packages (deb/rpm). For now set the variable to a reasonable value
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -375,10 +375,13 @@ GDKextendf(int fd, size_t size, const ch
 #ifdef HAVE_POSIX_FALLOCATE
                /* posix_fallocate returns error number on failure,
                 * not -1 :-( */
-               if ((rt = posix_fallocate(fd, stb.st_size, (off_t) size - 
stb.st_size)) == EINVAL)
-                       /* on Solaris/OpenIndiana, this may mean that
-                        * the underlying file system doesn't support
-                        * the operation, so just resize the file */
+               rt = posix_fallocate(fd, stb.st_size, (off_t) size - 
stb.st_size);
+               if (rt != 0)
+                       errno = rt;
+               if (rt == EINVAL || rt == EOPNOTSUPP)
+                       /* some systems seem to return EINVAL and others
+                        * EOPNOTSUPP if the file system doesn't support
+                        * this operation */
 #endif
 #endif
                        /* we get here when (posix_)fallocate fails
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to