summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/acct/Makefile
diff options
context:
space:
mode:
authorYiyang Chen <cyyzero16@gmail.com>2026-07-13 01:13:31 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-07-29 19:10:17 -0700
commitd4bc5202d4a43d1301b0b6b047823efe2abece5e (patch)
tree2a70150ec38e63f457cef1b3cafc868f6432bd8a /tools/testing/selftests/acct/Makefile
parenta691ef2ca10916212f9bd4cd54b0f84e0d7b663b (diff)
downloadlinux-next-d4bc5202d4a43d1301b0b6b047823efe2abece5e.tar.gz
linux-next-d4bc5202d4a43d1301b0b6b047823efe2abece5e.zip
selftests/acct: share netlink helpers
Extract the duplicated generic netlink boilerplate (netlink_open, send_request, get_family_id, and NLA walker macros) from cgroupstats.c and taskstats_fill_stats_tgid.c into a shared netlink_helper.{h,c}. Link: https://lore.kernel.org/a2adf27308b5cd90d50b59e8519b87da49486bee.1783876192.git.cyyzero16@gmail.com Signed-off-by: Yiyang Chen <cyyzero16@gmail.com> Suggested-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Balbir Singh <balbirs@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/testing/selftests/acct/Makefile')
-rw-r--r--tools/testing/selftests/acct/Makefile10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/acct/Makefile b/tools/testing/selftests/acct/Makefile
index db88d65f5581..93a11a28a636 100644
--- a/tools/testing/selftests/acct/Makefile
+++ b/tools/testing/selftests/acct/Makefile
@@ -3,7 +3,17 @@ TEST_GEN_PROGS := acct_syscall
TEST_GEN_PROGS += taskstats_fill_stats_tgid
TEST_GEN_PROGS += cgroupstats
+NETLINK_HELPER_PROGS := cgroupstats taskstats_fill_stats_tgid
+
CFLAGS += -Wall
LDLIBS += -lpthread
include ../lib.mk
+
+$(NETLINK_HELPER_PROGS): %: %.c netlink_helper.c netlink_helper.h
+ $(call msg,CC,,$@)
+ $(Q)$(LINK.c) $< netlink_helper.c $(LDLIBS) -o $@
+
+$(addprefix $(OUTPUT)/,$(NETLINK_HELPER_PROGS)): $(OUTPUT)/%: %.c netlink_helper.c netlink_helper.h
+ $(call msg,CC,,$@)
+ $(Q)$(LINK.c) $< netlink_helper.c $(LDLIBS) -o $@