diff options
author | David Phillips <david@sighup.nz> | 2018-06-27 22:24:35 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-06-27 22:24:35 +1200 |
commit | ee4b21dbeb516c06453c2ac6d78b7e02c1b485ce (patch) | |
tree | 6b785ebdcedd16ec5d482ed5035bba79fb66f961 /alarm-tools | |
parent | 85e52fd4eaa0de7a98f294dd8e8c952cc3eaf758 (diff) | |
download | alarmd-ee4b21dbeb516c06453c2ac6d78b7e02c1b485ce.tar.xz |
Record pid of process regsitering alarm
Diffstat (limited to 'alarm-tools')
-rw-r--r-- | alarm-tools/alarms-show.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/alarm-tools/alarms-show.c b/alarm-tools/alarms-show.c index 65d0e91..8418ee8 100644 --- a/alarm-tools/alarms-show.c +++ b/alarm-tools/alarms-show.c @@ -19,6 +19,7 @@ int dump_alarms(int sock) uint32_t packet_type = 0; uint8_t is_raised = 0; char buffer[128]; + pid_t owner = 0; packet_type = htonl(ALARMD_PACKET_TYPE_QUERY); @@ -50,7 +51,11 @@ int dump_alarms(int sock) perror("recv"); break; } - printf("[%s] %s\n", is_raised ? "\x1b[1;31mRAISE\x1b[0m" : "\x1b[1;32mCLEAR\x1b[0m", buffer); + if (recv(sock, &owner, sizeof(owner), 0) != sizeof(owner)) { + perror("recv"); + break; + } + printf("[%s] [pid %d] %s\n", is_raised ? "\x1b[1;31mRAISE\x1b[0m" : "\x1b[1;32mCLEAR\x1b[0m", owner, buffer); } if (count == 0) { |