[PATCH] sample: bpf: syscall_tp_user: print result of verify_map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



syscall_tp only prints the map id and messages when something goes wrong,
but it doesn't print the value passed from bpf map. I think it's better
to show that value to users.

What's more, i also added a 2-second sleep before calling verify_map,
to make the value more obvious.

Signed-off-by: Song Chen <chensong_2000@xxxxxx>
---
 samples/bpf/syscall_tp_user.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/samples/bpf/syscall_tp_user.c b/samples/bpf/syscall_tp_user.c
index a0ebf1833ed3..1faa7f08054e 100644
--- a/samples/bpf/syscall_tp_user.c
+++ b/samples/bpf/syscall_tp_user.c
@@ -36,6 +36,9 @@ static void verify_map(int map_id)
 		fprintf(stderr, "failed: map #%d returns value 0\n", map_id);
 		return;
 	}
+
+	printf("verify map:%d val: %d\n", map_id, val);
+
 	val = 0;
 	if (bpf_map_update_elem(map_id, &key, &val, BPF_ANY) != 0) {
 		fprintf(stderr, "map_update failed: %s\n", strerror(errno));
@@ -98,6 +101,7 @@ static int test(char *filename, int num_progs)
 	}
 	close(fd);
 
+	sleep(2);
 	/* verify the map */
 	for (i = 0; i < num_progs; i++) {
 		verify_map(map0_fds[i]);
-- 
2.25.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux