Thread (2 messages) 2 messages, 2 authors, 2024-07-26

Re: [PATCH bpf 6/6] selftest/bpf: Introduce __attribute__((cleanup)) in create_pair()

From: Michal Luczaj <hidden>
Date: 2024-07-26 20:37:29
Also in: bpf, linux-kselftest

On 7/26/24 19:27, Jakub Sitnicki wrote:
On Wed, Jul 24, 2024 at 01:32 PM +02, Michal Luczaj wrote:
quoted
+#define take_fd(fd)                                                            \
+	({                                                                     \
+		__auto_type __val = (fd);                                      \
+		fd = -EBADF;                                                   \
+		__val;                                                         \
+	})
Probably should operate on a pointer to fd to avoid side effects, like
__get_and_null macro in include/linux/cleanup.h. take_fd is effectively
__get_and_null(fd, -EBADFD).
[...]
OK, I'll just make use of stuff from cleanup.h.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help