]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: Introduce __attribute__((cleanup)) in create_pair()
authorMichal Luczaj <mhal@rbox.co>
Wed, 31 Jul 2024 10:01:31 +0000 (12:01 +0200)
committerMartin KaFai Lau <martin.lau@kernel.org>
Mon, 19 Aug 2024 23:43:40 +0000 (16:43 -0700)
commit86149b4f5a2d535279096946b6ef8d41911a9b5a
treedda0d6606e0189128243ae9cfdef4f7c25a2b584
parentc9c70b28face7b156960f53649bec9ace5601b85
selftests/bpf: Introduce __attribute__((cleanup)) in create_pair()

Rewrite function to have (unneeded) socket descriptors automatically
close()d when leaving the scope. Make sure the "ownership" of fds is
correctly passed via take_fd(); i.e. descriptor returned to caller will
remain valid.

Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Tested-by: Jakub Sitnicki <jakub@cloudflare.com>
Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Link: https://lore.kernel.org/r/20240731-selftest-sockmap-fixes-v2-6-08a0c73abed2@rbox.co
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h