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

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

 



On 7/26/24 19:27, Jakub Sitnicki wrote:
> On Wed, Jul 24, 2024 at 01:32 PM +02, Michal Luczaj wrote:
>> +#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.





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux