Changeset: 6dcacf96a92d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6dcacf96a92d Modified Files: clients/Tests/exports.stable.out gdk/gdk_utils.c gdk/gdk_utils.h Branch: Dec2023 Log Message:
Implemented registration function for printing info on USR1 signal. diffs (60 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -310,6 +310,7 @@ gdk_return GDKmunmap(void *addr, int mod int GDKnr_threads; void GDKprepareExit(void); void GDKprintinfo(void); +void GDKprintinforegister(void (*func)(void)); void GDKqsort(void *restrict h, void *restrict t, const void *restrict base, size_t n, int hs, int ts, int tpe, bool reverse, bool nilslast); void *GDKrealloc(void *pold, size_t size) __attribute__((__alloc_size__(2))) __attribute__((__warn_unused_result__)); gdk_return GDKrebuild_segment_tree(oid ncount, oid data_size, BAT *st, void **segment_tree, oid **levels_offset, oid *nlevels); diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -2031,6 +2031,27 @@ GDKmremap(const char *path, int mode, vo } /* print some potentially interesting information */ +struct prinfocb { + struct prinfocb *next; + void (*func)(void); +} *prinfocb; + +void +GDKprintinforegister(void (*func)(void)) +{ + struct prinfocb *p = GDKmalloc(sizeof(struct prinfocb)); + if (p == NULL) { + GDKerror("cannot register USR1 printing function.\n"); + return; + } + p->func = func; + p->next = NULL; + struct prinfocb **pp = &prinfocb; + while (*pp != NULL) + pp = &(*pp)->next; + *pp = p; +} + void GDKprintinfo(void) { @@ -2064,4 +2085,6 @@ GDKprintinfo(void) GDKlockstatistics(3); #endif dump_threads(); + for (struct prinfocb *p = prinfocb; p; p = p->next) + (*p->func)(); } diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h --- a/gdk/gdk_utils.h +++ b/gdk/gdk_utils.h @@ -13,6 +13,7 @@ #include <setjmp.h> +gdk_export void GDKprintinforegister(void (*func)(void)); gdk_export void GDKprintinfo(void); gdk_export const char *GDKgetenv(const char *name); _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org