Changeset: 803d2aa8de78 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=803d2aa8de78
Modified Files:
gdk/gdk_utils.c
tools/merovingian/daemon/controlrunner.c
Branch: default
Log Message:
Merged with Oct2020
diffs (211 lines):
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -70,7 +70,6 @@ function(monetdb_configure_defines)
# Linux specific, in the future, it might be ported to other platforms
check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE)
check_function_exists("fcntl" HAVE_FCNTL)
- check_symbol_exists("F_GETLK" "fcntl.h" HAVE_F_GETLK)
check_symbol_exists("fork" "unistd.h" HAVE_FORK)
check_symbol_exists("fsync" "unistd.h" HAVE_FSYNC)
check_symbol_exists("ftime" "sys/timeb.h" HAVE_FTIME)
@@ -181,13 +180,7 @@ macro(monetdb_macro_variables)
if(HAVE_GETOPT_H)
set(HAVE_GETOPT 1)
endif()
- # Check with STATIC_CODE_ANALYSIS
# compiler options, profiling (google perf tools), valgrind
- set(ENABLE_STATIC_ANALYSIS
- "NO"
- CACHE
- STRING
- "Configure for static code analysis (use only if you know what you are
doing)")
# Check that posix regex is available when pcre is not found
# "monetdb5/module/mal/pcre.c" assumes the regex library is available
# as an alternative without checking this in the C code.
diff --git a/cmake/monetdb-options.cmake b/cmake/monetdb-options.cmake
--- a/cmake/monetdb-options.cmake
+++ b/cmake/monetdb-options.cmake
@@ -17,41 +17,41 @@ else()
set(DEVELOPMENT FALSE)
endif()
-option(TESTING
+option(TESTING
"Enable support for testing"
ON)
-cmake_dependent_option(CINTEGRATION
+cmake_dependent_option(CINTEGRATION
"Enable support for C UDFs (default=ON)"
ON
"NOT WIN32"
OFF)
-option(PY3INTEGRATION
+option(PY3INTEGRATION
"Enable support for Python 3 integration into MonetDB (default=ON)"
ON)
-option(RINTEGRATION
+option(RINTEGRATION
"Enable support for R integration into MonetDB (default=ON)"
ON)
-option(FITS
+option(FITS
"Enable support for FITS (default=ON)"
ON)
option(GEOM
"Enable support for geom module (default=ON)"
- ON)
+ ON)
-option(INT128
+option(INT128
"Enable support for 128-bit integers (default=ON)"
- ON)
-
-option(NETCDF
- "Enable support for netcdf (default=ON)"
ON)
-option(ODBC
+option(NETCDF
+ "Enable support for netcdf (default=ON)"
+ ON)
+
+option(ODBC
"Compile the MonetDB ODBC driver (default=ON)"
ON)
@@ -61,15 +61,19 @@ cmake_dependent_option(SHP
"GEOM"
OFF)
-option(SANITIZER
+option(SANITIZER
"Enable support for the GCC address sanitizer (default=OFF)"
OFF)
-option(STRICT
+option(STATIC_CODE_ANALYSIS
+ "configure for static code analysis (use only if you know what you are
doing) (default=OFF)"
+ OFF)
+
+option(STRICT
"Enable strict compiler flags (default=ON for development sources, OFF for
tarball installation)"
"${DEVELOPMENT}")
-option(ASSERT
+option(ASSERT
"Enable asserts (default=ON for development sources, OFF for tarball
installation)"
"${DEVELOPMENT}")
diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -681,39 +681,6 @@ msab_getMyStatus(sabdb** ret)
#define MAINTENANCEFILE ".maintenance"
-#ifndef WIN32
-/* returns pid of the process holding the gdk lock, or 0 if that is not
possible.
- * 'not possible' could be for a variety of reasons.
- */
-static pid_t
-MT_get_locking_pid(const char *filename)
-{
-#if !defined(HAVE_FCNTL) || !defined(HAVE_F_GETLK)
- (void)filename;
- return 0;
-#else
- int fd;
- struct flock fl = {
- .l_type = F_WRLCK,
- .l_whence = SEEK_SET,
- .l_start = 4,
- .l_len = 1,
- };
- pid_t pid = 0;
-
- fd = open(filename, O_RDONLY | O_CLOEXEC, 0);
- if (fd < 0)
- return 0;
-
- if (fcntl(fd, F_GETLK, &fl) == 0)
- pid = fl.l_pid;
-
- close(fd);
- return pid;
-#endif
-}
-#endif
-
static sabdb *
msab_getSingleStatus(const char *pathbuf, const char *dbname, sabdb *next)
{
@@ -732,11 +699,9 @@ msab_getSingleStatus(const char *pathbuf
return next;
sdb = malloc(sizeof(sabdb));
- *sdb = (sabdb) { 0 };
- sdb->uplog = NULL;
- sdb->uri = NULL;
- sdb->secret = NULL;
- sdb->next = next;
+ *sdb = (sabdb) {
+ .next = next,
+ };
/* store the database name */
snprintf(buf, sizeof(buf), "%s/%s", pathbuf, dbname);
@@ -788,8 +753,13 @@ msab_getSingleStatus(const char *pathbuf
sdb->state = SABdbInactive;
} else if (fd == -1) {
#ifndef WIN32
- /* file is locked, so mserver is running. can we find it? */
- sdb->pid = MT_get_locking_pid(buf);
+ /* extract process ID from lock file */
+ if ((f = fopen(buf, "r")) != NULL) {
+ int pid;
+ if (fscanf(f, "USR=%*d PID=%d TIME=", &pid) == 1)
+ sdb->pid = pid;
+ fclose(f);
+ }
#endif
/* see if the database has finished starting */
snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
STARTEDFILE);
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1184,7 +1184,7 @@ GDKlockHome(int farmid)
assert(BBPfarms[farmid].dirname != NULL);
assert(BBPfarms[farmid].lock_file == NULL);
- if(!(gdklockpath = GDKfilepath(farmid, NULL, GDKLOCK, NULL))) {
+ if ((gdklockpath = GDKfilepath(farmid, NULL, GDKLOCK, NULL)) == NULL) {
return GDK_FAIL;
}
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -116,7 +116,6 @@
#cmakedefine HAVE_DISPATCH_SEMAPHORE_CREATE 1
#cmakedefine HAVE_FALLOCATE 1
#cmakedefine HAVE_FCNTL 1
-#cmakedefine HAVE_F_GETLK 1
#cmakedefine HAVE_FORK 1
#cmakedefine HAVE_FSYNC 1
#cmakedefine HAVE_FTIME 1
@@ -215,6 +214,8 @@
#cmakedefine LIBDIR "@LIBDIR@"
#cmakedefine LOCALSTATEDIR "@LOCALSTATEDIR@"
+#cmakedefine STATIC_CODE_ANALYSIS 1
+
// End Section: monetdb macro variables
// Section: monetdb configure misc
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list