Page MenuHomeFreeBSD

libusb: implement libusb_free_pollfds
ClosedPublic

Authored by aokblast on Jul 9 2025, 7:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jul 28, 6:23 PM
Unknown Object (File)
Mon, Jul 28, 4:43 PM
Unknown Object (File)
Mon, Jul 28, 3:46 PM
Unknown Object (File)
Mon, Jul 28, 2:39 PM
Unknown Object (File)
Mon, Jul 28, 2:33 PM
Unknown Object (File)
Mon, Jul 28, 11:31 AM
Unknown Object (File)
Mon, Jul 28, 8:33 AM
Unknown Object (File)
Mon, Jul 28, 8:22 AM

Details

Summary

The libusb has a API that free the storage for pollfds whatever the
content is. There is no check on if the fd inside is closed.

Sponsored by: FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Looks ok to me with the man page nits fixed.

lib/libusb/libusb.3
781
782
lib/libusb/libusb10_io.c
847

It's weird that this is const, but I see it is the same upstream as well.

850

free(NULL) is ok too, you don't really need this check, but it's fine either way.

  • In the function prototypes the asterisks for pointers should all be consistent without a space next to the identifier. All "* ctx" should be "*ctx".
  • There is no need to cast the argument of free(), since it takes a ptr-to-void and they are assignment compatible to any pointer.
This revision is now accepted and ready to land.Fri, Jul 11, 4:41 PM
  • In the function prototypes the asterisks for pointers should all be consistent without a space next to the identifier. All "* ctx" should be "*ctx".
  • There is no need to cast the argument of free(), since it takes a ptr-to-void and they are assignment compatible to any pointer.

Hello schweikh, thanks for your review!

The asterisks is not from me but the previous work. I am thinking about submit a patch about doing clang-format on libusb.h. However, it is unrelated to this patch.

lib/libusb/libusb10_io.c
847

Yes, I would like to follow the upstream interface to prevent the compile warning or error (if werror-all enable).

This revision now requires review to proceed.Tue, Jul 15, 7:23 AM

Approved, with the one style nit fixed.

lib/libusb/libusb.h
577

Please keep the indentation consistent, it looks like there should be a tab after void here.

This revision is now accepted and ready to land.Tue, Jul 15, 1:36 PM
This revision was automatically updated to reflect the committed changes.