client, bankd: Add SIGUSR1 handling for talloc context debugging

Change-Id: I9153f4cc89b3911a4f9ea4f02fe1b108420d2eed
changes/97/13497/1
Harald Welte 4 years ago
parent 75f560338c
commit ce638d8fd7
  1. 9
      src/remsim_client.c
  2. 9
      src/server/remsim_server.c
  3. 7
      src/simtrace2-remsim_client.c

@ -22,6 +22,7 @@
#include <errno.h>
#include <string.h>
#include <signal.h>
#define _GNU_SOURCE
#include <getopt.h>
@ -158,6 +159,12 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu)
return 0;
}
static void handle_sig_usr1(int signal)
{
OSMO_ASSERT(signal == SIGUSR1);
talloc_report(g_tall_ctx, stderr);
}
static void printf_help()
{
printf(
@ -236,6 +243,8 @@ int main(int argc, char **argv)
handle_options(argc, argv);
signal(SIGUSR1, handle_sig_usr1);
rc = server_conn_fsm_alloc(g_client, srvc);
if (rc < 0) {
fprintf(stderr, "Unable to create Server conn FSM: %s\n", strerror(errno));

@ -1,4 +1,5 @@
#include <unistd.h>
#include <signal.h>
#include <sys/eventfd.h>
@ -16,6 +17,12 @@ struct rspro_server *g_rps;
void *g_tall_ctx;
struct osmo_fd g_event_ofd;
static void handle_sig_usr1(int signal)
{
OSMO_ASSERT(signal == SIGUSR1);
talloc_report(g_tall_ctx, stderr);
}
int main(int argc, char **argv)
{
int rc;
@ -43,6 +50,8 @@ int main(int argc, char **argv)
osmo_fd_setup(&g_event_ofd, rc, BSC_FD_READ, event_fd_cb, g_rps, 0);
osmo_fd_register(&g_event_ofd);
signal(SIGUSR1, handle_sig_usr1);
rc = rest_api_init(9997);
if (rc < 0)
goto out_eventfd;

@ -650,6 +650,11 @@ static int srvc_handle_rx(struct rspro_server_conn *srvc, const RsproPDU_t *pdu)
return 0;
}
static void handle_sig_usr1(int signal)
{
OSMO_ASSERT(signal == SIGUSR1);
talloc_report(g_tall_ctx, stderr);
}
static void print_welcome(void)
{
@ -772,6 +777,8 @@ int main(int argc, char **argv)
goto do_exit;
}
signal(SIGUSR1, handle_sig_usr1);
rc = libusb_init(NULL);
if (rc < 0) {
fprintf(stderr, "libusb initialization failed\n");

Loading…
Cancel
Save