about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-02-11 19:39:42 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-02-11 19:39:42 +0100
commitf85466578d77ccb99fe1f00f41f95756175a82aa (patch)
tree8ff0da2124e75803da6ac69687505c28715526e8
parent80204a5e0a2cacdaac2b2f78c2609aa56c067ec0 (diff)
downloadextrace-f85466578d77ccb99fe1f00f41f95756175a82aa.tar.gz
extrace-f85466578d77ccb99fe1f00f41f95756175a82aa.tar.xz
extrace-f85466578d77ccb99fe1f00f41f95756175a82aa.zip
extrace: print errors when we lost data
Proposed by "Chris West (Faux)" <git@goeswhere.com>.
-rw-r--r--extrace.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/extrace.c b/extrace.c
index 47146b6..bf1ce52 100644
--- a/extrace.c
+++ b/extrace.c
@@ -284,7 +284,9 @@ handle_msg(struct cn_msg *cn_hdr)
 		int i = 0;
 		int proc_dir_fd = open_proc_dir(pid);
 		if (proc_dir_fd < 0) {
-			/* TODO: warn we dropped something? */
+			fprintf(stderr,
+			    "extrace: process vanished before notification: pid %d\n",
+			    pid);
 			return;
 		}
 
@@ -308,6 +310,15 @@ handle_msg(struct cn_msg *cn_hdr)
 
 		d = pid_depth(pid);
 		if (d < 0) {
+			if (*cmdline) {
+				fprintf(stderr,
+				    "extrace: process vanished before we found its parent: pid %d: %s\n",
+				    pid, cmdline);
+			} else {
+				fprintf(stderr,
+				    "extrace: process vanished without a name: pid %d\n",
+				    pid);
+			}
 			close(proc_dir_fd);
 			return;
 		}
@@ -317,7 +328,7 @@ handle_msg(struct cn_msg *cn_hdr)
 				if (pid_db[i].pid == 0)
 					break;
 			if (i == PID_DB_SIZE - 1)
-				fprintf(stderr, "extrace: warning pid_db of "
+				fprintf(stderr, "extrace: warning: pid_db of "
 				    "size %d overflowed\n", PID_DB_SIZE);
 
 			pid_db[i].pid = pid;