summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-08-31 17:19:57 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-08-31 17:19:57 +0200
commit01d049bb82e0de1dd43a3f485d345ceb32874b44 (patch)
tree5e6644baf4aad95a9079d4881cde70def248e422
parent9560d5b72a5349c8a1c37d31f6f105eebd161646 (diff)
downloadextrace-01d049bb82e0de1dd43a3f485d345ceb32874b44.tar.gz
extrace-01d049bb82e0de1dd43a3f485d345ceb32874b44.tar.xz
extrace-01d049bb82e0de1dd43a3f485d345ceb32874b44.zip
style
-rw-r--r--extrace.c20
-rw-r--r--pwait.c22
2 files changed, 21 insertions, 21 deletions
diff --git a/extrace.c b/extrace.c
index 47cbb5d..4d8c27c 100644
--- a/extrace.c
+++ b/extrace.c
@@ -51,9 +51,9 @@
 
 #define _XOPEN_SOURCE 700
 
+#include <linux/cn_proc.h>
 #include <linux/connector.h>
 #include <linux/netlink.h>
-#include <linux/cn_proc.h>
 
 #include <sys/socket.h>
 #include <sys/types.h>
@@ -62,15 +62,15 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <signal.h>
-#include <stdio.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
 
-#define max(x,y) ((y)<(x)?(x):(y))
-#define min(x,y) ((y)>(x)?(x):(y))
+#define max(x, y) ((y) < (x) ? (x) : (y))
+#define min(x, y) ((y) > (x) ? (x) : (y))
 
 #define SEND_MESSAGE_LEN (NLMSG_LENGTH(sizeof (struct cn_msg) + \
                                        sizeof (enum proc_cn_mcast_op)))
@@ -133,7 +133,7 @@ pid_depth(pid_t pid)
 	return d+1;
 }
 
-static const char*
+static const char *
 sig2name(int sig)
 {
 	switch (sig) {
@@ -275,7 +275,7 @@ handle_msg(struct cn_msg *cn_hdr)
 			if (i == PID_DB_SIZE - 1)
 				fprintf(stderr, "extrace: warning pid_db of "
 				    "size %d overflowed\n", PID_DB_SIZE);
-			
+
 			pid_db[i].pid = pid;
 			pid_db[i].depth = d;
 			pid_db[i].start = ev->timestamp_ns;
@@ -354,7 +354,7 @@ handle_msg(struct cn_msg *cn_hdr)
 				break;
 		if (i == PID_DB_SIZE)
 			return;
-		
+
 		pid_db[i].pid = 0;
 		if (!flat)
 			fprintf(output, "%*s",
@@ -411,10 +411,10 @@ main(int argc, char *argv[])
 		}
 
 	if (parent != 1 && optind != argc) {
-	usage:
+usage:
 		fprintf(stderr, "Usage: extrace [-deflq] [-o FILE] [-p PID|CMD...]\n");
 		exit(1);
-  }
+	}
 
 	sk_nl = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
 	if (sk_nl == -1) {
@@ -436,7 +436,7 @@ main(int argc, char *argv[])
 	}
 	nl_hdr = (struct nlmsghdr *)buff;
 	cn_hdr = (struct cn_msg *)NLMSG_DATA(nl_hdr);
-	mcop_msg = (enum proc_cn_mcast_op*)&cn_hdr->data[0];
+	mcop_msg = (enum proc_cn_mcast_op *)&cn_hdr->data[0];
 
 	memset(buff, 0, sizeof buff);
 	*mcop_msg = PROC_CN_MCAST_LISTEN;
diff --git a/pwait.c b/pwait.c
index 8cf7983..1cfc133 100644
--- a/pwait.c
+++ b/pwait.c
@@ -90,12 +90,12 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include <linux/cn_proc.h>
 #include <linux/connector.h>
 #include <linux/netlink.h>
-#include <linux/cn_proc.h>
 
-#define max(x,y) ((y)<(x)?(x):(y))
-#define min(x,y) ((y)>(x)?(x):(y))
+#define max(x, y) ((y) < (x) ? (x) : (y))
+#define min(x, y) ((y) > (x) ? (x) : (y))
 
 #define SEND_MESSAGE_LEN (NLMSG_LENGTH(sizeof (struct cn_msg) + \
 				       sizeof (enum proc_cn_mcast_op)))
@@ -161,7 +161,7 @@ main(int argc, char *argv[])
 		case 'v': verbose = 1; break;
 		default: goto usage;
 		}
-	
+
 	argc -= optind;
 	argv += optind;
 
@@ -207,7 +207,7 @@ usage:
 	}
 	nl_hdr = (struct nlmsghdr *)buff;
 	cn_hdr = (struct cn_msg *)NLMSG_DATA(nl_hdr);
-	mcop_msg = (enum proc_cn_mcast_op*)&cn_hdr->data[0];
+	mcop_msg = (enum proc_cn_mcast_op *)&cn_hdr->data[0];
 
 	memset(buff, 0, sizeof buff);
 	*mcop_msg = PROC_CN_MCAST_LISTEN;
@@ -252,14 +252,14 @@ usage:
 			if (nlh->nlmsg_type == NLMSG_ERROR ||
 			    nlh->nlmsg_type == NLMSG_OVERRUN)
 				break;
-			
+
 			ev = (struct proc_event *)
-			    ((struct cn_msg *) NLMSG_DATA(nlh))->data;
-			
+			    ((struct cn_msg *)NLMSG_DATA(nlh))->data;
+
 			if (ev->what == PROC_EVENT_EXIT) {
 				int status = ev->event_data.exit.exit_code;
 				pid_t pid = ev->event_data.exit.process_pid;
-				
+
 				seen = 0;
 				for (n = 0; n < argc; n++)
 					if (pids[n] == pid) {
@@ -273,12 +273,12 @@ usage:
 							rc = 111;
 					}
 			}
-			
+
 			if (nlh->nlmsg_type == NLMSG_DONE)
 				break;
 			nlh = NLMSG_NEXT(nlh, recv_len);
 		}
-		
+
 		quit = 1;
 		for (n = 0; n < argc; n++)
 			if (pids[n] != 0)