From a87279a578c9e8afd3fba67ec363bc4194fbb815 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 18 Apr 2015 16:36:12 +0200 Subject: siginfo: mds-clipboard, mds-echo, mds-kkbd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-clipboard.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/mds-echo.c | 16 ++++++++++++++++ src/mds-kkbd.c | 27 +++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) (limited to 'src') diff --git a/src/mds-clipboard.c b/src/mds-clipboard.c index d4c17c4..0880f73 100644 --- a/src/mds-clipboard.c +++ b/src/mds-clipboard.c @@ -909,3 +909,53 @@ int clipboard_get_size(int level, const char* recv_client_id, const char* recv_m return -1; } + +/** + * This function is called when a signal that + * signals that the system to dump state information + * and statistics has been received + * + * @param signo The signal that has been received + */ +void received_info(int signo) +{ + clipitem_t clipitem; + size_t i, j, n; + struct timespec now; + (void) signo; + if (monotone(&now) < 0) + iprint("(unable to get current time)"); + else + iprintf("current time: %ji.%09li", (intmax_t)(now.tv_sec), (long)(now.tv_nsec)); + iprintf("next message ID: %" PRIu32, message_id); + iprintf("connected: %s", connected ? "yes" : "no"); + for (i = 0; i < CLIPBOARD_LEVELS; i++) + { + n = clipboard_used[i]; + iprintf("clipstack %zu: allocated: %zu", i, clipboard_size[i]); + iprintf("clipstack %zu: used: %zu", i, n); + for (j = 0; j < n; j++) + { + clipitem = clipboard[i][j]; + iprintf("clipstack %zu: item %zu:", i, j); + iprintf(" autopurge: %s", + clipitem.autopurge == CLIPITEM_AUTOPURGE_NEVER ? "as needed" : + clipitem.autopurge == CLIPITEM_AUTOPURGE_UPON_DEATH ? "upon death or as needed" : + clipitem.autopurge == CLIPITEM_AUTOPURGE_UPON_CLOCK ? "timeout or as needed" : + clipitem.autopurge == CLIPITEM_AUTOPURGE_UPON_DEATH_OR_CLOCK ? "upon death, timeout or as needed" : + "unrecognised rule, something is wrong here!"); + iprintf(" client: %" PRIu32 ":%" PRIu32, + (uint32_t)(clipitem.client >> 32), + (uint32_t)(clipitem.client)); + if (clipitem.autopurge & CLIPITEM_AUTOPURGE_UPON_CLOCK) + iprintf(" timeout: %ji.%09li", + (intmax_t)(clipitem.dethklok.tv_sec), + (long)(clipitem.dethklok.tv_nsec)); + iprintf(" butes: %zu", clipitem.length); + iprintf(" content (possibily truncated): %.*s", + (int)strnlen(clipitem.content, clipitem.length > 50 ? (size_t)50 : clipitem.length), + clipitem.content); + } + } +} + diff --git a/src/mds-echo.c b/src/mds-echo.c index dbd8a81..6baf8a8 100644 --- a/src/mds-echo.c +++ b/src/mds-echo.c @@ -361,3 +361,19 @@ int full_send(const char* message, size_t length) return -1; } + +/** + * This function is called when a signal that + * signals that the system to dump state information + * and statistics has been received + * + * @param signo The signal that has been received + */ +void received_info(int signo) +{ + (void) signo; + iprintf("next message ID: %" PRIu32, message_id); + iprintf("connected: %s", connected ? "yes" : "no"); + iprintf("echo buffer size: %zu bytes", echo_buffer_size); +} + diff --git a/src/mds-kkbd.c b/src/mds-kkbd.c index 24eb4d2..01e98f1 100644 --- a/src/mds-kkbd.c +++ b/src/mds-kkbd.c @@ -1505,3 +1505,30 @@ void shrink_map(void) } } +/** + * This function is called when a signal that + * signals that the system to dump state information + * and statistics has been received + * + * @param signo The signal that has been received + */ +void received_info(int signo) +{ + size_t i; + (void) signo; + iprintf("next message ID: %" PRIu32, message_id); + iprintf("connected: %s", connected ? "yes" : "no"); + iprintf("LED FD: %i", ledfd); + iprintf("saved LED:s: %i", saved_leds); + iprintf("scancode buffer: %i, %i, %i", scancode_buf[0], scancode_buf[1], scancode_buf[2]); + iprintf("scancode buffer pointer: %i", scancode_ptr); + iprintf("saved keyboard mode: %i", saved_kbd_mode); + iprintf("send buffer size: %zu bytes", send_buffer_size); + iprintf("keyboard thread started: %s", connected ? "yes" : "no"); + iprintf("keycode remapping tabel size: %zu", mapping_size); + iprint("keycode remapping tabel:"); + for (i = 0; i < mapping_size; i++) + if ((int)i != mapping[i]) + iprintf(" %zu -> %i", i, mapping[i]); +} + -- cgit v1.2.3-70-g09d2