MonetDB: default - Merge with Jun2023 branch.
Changeset: c038c6971c41 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c038c6971c41 Modified Files: cmake/monetdb-defines.cmake monetdb5/mal/mal_linker.c monetdb_config.h.in sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_scenario.c Branch: default Log Message: Merge with Jun2023 branch. diffs (179 lines): diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -3482,6 +3482,11 @@ main(int argc, char **argv) #endif mnstr_printf(toConsole, "using mapi library %s\n", mapi_get_mapi_version()); + free(dotfile.user); + free(dotfile.passwd); + free(dotfile.dbname); + free(dotfile.host); + free(dotfile.output); return 0; } case 'w': diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -105,6 +105,7 @@ function(monetdb_configure_defines) check_function_exists("setsid" HAVE_SETSID) check_function_exists("shutdown" HAVE_SHUTDOWN) check_function_exists("sigaction" HAVE_SIGACTION) + check_function_exists("siglongjmp" HAVE_SIGLONGJMP) check_symbol_exists("stpcpy" "string.h" HAVE_STPCPY) check_function_exists("strcasestr" HAVE_STRCASESTR) check_symbol_exists("strncasecmp" "strings.h" HAVE_STRNCASECMP) diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c --- a/monetdb5/mal/mal_linker.c +++ b/monetdb5/mal/mal_linker.c @@ -71,7 +71,6 @@ fileexists(const char *path) MALfcn getAddress(const char *modname, const char *fcnname) { - void *dl; MALfcn adr; int idx = 0; static int prev = -1; @@ -103,46 +102,23 @@ getAddress(const char *modname, const ch } } - if (lastfile) { - /* first should be monetdb5 */ - assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0 - || strcmp(filesLoaded[0].modname, "embedded") == 0); - adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname); - if (adr != NULL) { - prev = 0; - return adr; /* found it */ + if (lastfile == 0) { + char *msg = loadLibrary("monetdb5", 1); + if (msg) { + freeException(msg); + return NULL; } - return NULL; } - /* -* Try the program libraries at large or run through all -* loaded files and try to resolve the functionname again. -* -* the first argument must be the same as the base name of the -* library that is created in src/tools */ -#ifdef __APPLE__ - dl = mdlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL); -#else - dl = dlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL); -#endif - if (dl == NULL) - return NULL; - adr = (MALfcn) dlsym(dl, fcnname); - filesLoaded[lastfile].modname = GDKstrdup("libmonetdb5"); - if (filesLoaded[lastfile].modname == NULL) { - dlclose(dl); - return NULL; + /* first should be monetdb5 */ + assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0 + || strcmp(filesLoaded[0].modname, "embedded") == 0); + adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname); + if (adr != NULL) { + prev = 0; + return adr; /* found it */ } - filesLoaded[lastfile].fullname = GDKstrdup("libmonetdb5"); - if (filesLoaded[lastfile].fullname == NULL) { - dlclose(dl); - GDKfree(filesLoaded[lastfile].modname); - return NULL; - } - filesLoaded[lastfile].handle = dl; - lastfile++; - return adr; + return NULL; } /* diff --git a/monetdb_config.h.in b/monetdb_config.h.in --- a/monetdb_config.h.in +++ b/monetdb_config.h.in @@ -157,6 +157,7 @@ #cmakedefine HAVE_SETSID 1 #cmakedefine HAVE_SHUTDOWN 1 #cmakedefine HAVE_SIGACTION 1 +#cmakedefine HAVE_SIGLONGJMP 1 #cmakedefine HAVE_STPCPY 1 #cmakedefine HAVE_STRCASESTR 1 #cmakedefine HAVE_STRNCASECMP 1 diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -1201,8 +1201,6 @@ backend_dumpproc(backend *be, Client c, *be = bebackup; c->curprg = symbackup; m->sa->eb = ebsave; - if (m->sa->eb.enabled) - eb_error(>sa->eb, m->errstr[0] ? m->errstr : be->mb->errors ? be->mb->errors : *GDKerrbuf ? GDKerrbuf : "out of
MonetDB: Jun2023 - Use sigsetjmp/siglongjmp when available, and ...
Changeset: e80aacbcdea1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e80aacbcdea1 Modified Files: cmake/monetdb-defines.cmake monetdb_config.h.in sql/common/exception_buffer.c sql/include/exception_buffer.h Branch: Jun2023 Log Message: Use sigsetjmp/siglongjmp when available, and don't save signal mask. Not saving the mask is default on Linux and the desired behavior, but on the Mac, it is not the default and causes mserver5 to be unstoppable after a call to eb_error (longjmp). diffs (56 lines): diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -106,6 +106,7 @@ function(monetdb_configure_defines) check_function_exists("setsid" HAVE_SETSID) check_function_exists("shutdown" HAVE_SHUTDOWN) check_function_exists("sigaction" HAVE_SIGACTION) + check_function_exists("siglongjmp" HAVE_SIGLONGJMP) check_symbol_exists("stpcpy" "string.h" HAVE_STPCPY) check_function_exists("strcasestr" HAVE_STRCASESTR) check_symbol_exists("strncasecmp" "strings.h" HAVE_STRNCASECMP) diff --git a/monetdb_config.h.in b/monetdb_config.h.in --- a/monetdb_config.h.in +++ b/monetdb_config.h.in @@ -158,6 +158,7 @@ #cmakedefine HAVE_SETSID 1 #cmakedefine HAVE_SHUTDOWN 1 #cmakedefine HAVE_SIGACTION 1 +#cmakedefine HAVE_SIGLONGJMP 1 #cmakedefine HAVE_STPCPY 1 #cmakedefine HAVE_STRCASESTR 1 #cmakedefine HAVE_STRNCASECMP 1 diff --git a/sql/common/exception_buffer.c b/sql/common/exception_buffer.c --- a/sql/common/exception_buffer.c +++ b/sql/common/exception_buffer.c @@ -29,5 +29,9 @@ eb_error( exception_buffer *eb, char *ms eb->code = val; eb->msg = msg; eb->enabled = 0;/* not any longer... */ +#ifdef HAVE_SIGLONGJMP + siglongjmp(eb->state, eb->code); +#else longjmp(eb->state, eb->code); +#endif } diff --git a/sql/include/exception_buffer.h b/sql/include/exception_buffer.h --- a/sql/include/exception_buffer.h +++ b/sql/include/exception_buffer.h @@ -21,10 +21,14 @@ typedef struct exception_buffer { int enabled; } exception_buffer; -extern exception_buffer *eb_init( exception_buffer *eb ); +extern exception_buffer *eb_init(exception_buffer *eb); /* != 0 on when we return to the savepoint */ -#define eb_savepoint(eb) ((eb)->enabled=1,setjmp((eb)->state)) -extern _Noreturn void eb_error( exception_buffer *eb, char *msg, int val ); +#ifdef HAVE_SIGLONGJMP +#define eb_savepoint(eb) ((eb)->enabled = 1, sigsetjmp((eb)->state, 0)) +#else +#define eb_savepoint(eb) ((eb)->enabled = 1, setjmp((eb)->state)) +#endif +extern _Noreturn void eb_error(exception_buffer *eb, char *msg, int val); #endif /* EXCEPTION_BUFFER_H */ ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Give the caller of backend_dumpproc a chance ...
Changeset: 9e464581a7ed for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9e464581a7ed Modified Files: sql/backends/monet5/sql_gencode.c Branch: Jun2023 Log Message: Give the caller of backend_dumpproc a chance to clean up. diffs (12 lines): diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -1201,8 +1201,6 @@ backend_dumpproc(backend *be, Client c, *be = bebackup; c->curprg = symbackup; m->sa->eb = ebsave; - if (m->sa->eb.enabled) - eb_error(>sa->eb, m->errstr[0] ? m->errstr : be->mb->errors ? be->mb->errors : *GDKerrbuf ? GDKerrbuf : "out of memory", 1000); return -1; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Disable longjmp whichever way we exit the fun...
Changeset: 8a5118c6bfeb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8a5118c6bfeb Modified Files: tools/monetdbe/monetdbe.c Branch: Jun2023 Log Message: Disable longjmp whichever way we exit the function. diffs (13 lines): diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c --- a/tools/monetdbe/monetdbe.c +++ b/tools/monetdbe/monetdbe.c @@ -754,8 +754,8 @@ monetdbe_startup(monetdbe_database_inter monetdbe_embedded_url = dbdir?GDKstrdup(dbdir):NULL; if (dbdir && !monetdbe_embedded_url) set_error(mdbe, createException(MAL, "monetdbe.monetdbe_startup", MAL_MALLOC_FAIL)); +cleanup: GDKfataljumpenable = 0; -cleanup: if (mdbe->msg) monetdbe_shutdown_internal(); } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Typo.
Changeset: 2ebf3757955e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2ebf3757955e Modified Files: sql/backends/monet5/sql_scenario.c Branch: Jun2023 Log Message: Typo. diffs (12 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -101,7 +101,7 @@ SQLprelude(Client cntxt, MalBlkPtr mb, M const char *caller_revision = (const char *) (void *) mb; const char *p = mercurial_revision(); if (p && strcmp(p, caller_revision) != 0) { - throw(MAL, "sq;.start", "incompatible versions: caller is %s, GDK is %s\n", caller_revision, p); + throw(MAL, "sql.start", "incompatible versions: caller is %s, GDK is %s\n", caller_revision, p); } } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Reuse code.
Changeset: 4580449c46cd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4580449c46cd Modified Files: monetdb5/mal/mal_linker.c Branch: Jun2023 Log Message: Reuse code. diffs (71 lines): diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c --- a/monetdb5/mal/mal_linker.c +++ b/monetdb5/mal/mal_linker.c @@ -71,7 +71,6 @@ fileexists(const char *path) MALfcn getAddress(const char *modname, const char *fcnname) { - void *dl; MALfcn adr; int idx = 0; static int prev = -1; @@ -103,46 +102,23 @@ getAddress(const char *modname, const ch } } - if (lastfile) { - /* first should be monetdb5 */ - assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0 - || strcmp(filesLoaded[0].modname, "embedded") == 0); - adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname); - if (adr != NULL) { - prev = 0; - return adr; /* found it */ + if (lastfile == 0) { + char *msg = loadLibrary("monetdb5", 1); + if (msg) { + freeException(msg); + return NULL; } - return NULL; } - /* -* Try the program libraries at large or run through all -* loaded files and try to resolve the functionname again. -* -* the first argument must be the same as the base name of the -* library that is created in src/tools */ -#ifdef __APPLE__ - dl = mdlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL); -#else - dl = dlopen(SO_PREFIX "monetdb5" SO_EXT, RTLD_NOW | RTLD_GLOBAL); -#endif - if (dl == NULL) - return NULL; - adr = (MALfcn) dlsym(dl, fcnname); - filesLoaded[lastfile].modname = GDKstrdup("libmonetdb5"); - if (filesLoaded[lastfile].modname == NULL) { - dlclose(dl); - return NULL; + /* first should be monetdb5 */ + assert(strcmp(filesLoaded[0].modname, "monetdb5") == 0 + || strcmp(filesLoaded[0].modname, "embedded") == 0); + adr = (MALfcn) dlsym(filesLoaded[0].handle, fcnname); + if (adr != NULL) { + prev = 0; + return adr; /* found it */ } - filesLoaded[lastfile].fullname = GDKstrdup("libmonetdb5"); - if (filesLoaded[lastfile].fullname == NULL) { - dlclose(dl); - GDKfree(filesLoaded[lastfile].modname); - return NULL; - } - filesLoaded[lastfile].handle = dl; - lastfile++; - return adr; + return NULL; } /* ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Jun2023 - Free memory before exiting.
Changeset: dcb87f7615cd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/dcb87f7615cd Modified Files: clients/mapiclient/mclient.c Branch: Jun2023 Log Message: Free memory before exiting. diffs (15 lines): diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -3482,6 +3482,11 @@ main(int argc, char **argv) #endif mnstr_printf(toConsole, "using mapi library %s\n", mapi_get_mapi_version()); + free(dotfile.user); + free(dotfile.passwd); + free(dotfile.dbname); + free(dotfile.host); + free(dotfile.output); return 0; } case 'w': ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org