NetBSD added an ioctl implementation manual page back in 1999, but it
was never brought over to FreeBSD. Import NetBSD's page and make a few
minor changes for FreeBSD.
Sponsored by: NIKSUN, Inc.
Differential D46181
man9: Add ioctl implementation guide jfree on Jul 29 2024, 11:28 PM. Authored by Tags Referenced Files
Details
Diff Detail
Event TimelineComment Actions The ioctl subsystem section was not modified from NetBSD's manual page, so it may be inaccurate for FreeBSD. Any help adding FreeBSD-specific subsystem character codes would be great.
Comment Actions Agree with most of what markj has said. The best practices for ioctl has definitely evolved since 1999... Comment Actions (Please forgive my perhaps snarky comments in places. I'm not a huge fan of the style of the original document.) The automatic copying in/zeroing and copying out performed in sys_ioctl needs to be documented. It's one of the things that most commonly trips people up with ioctl. @def recently fixed some bugs due to wrong types that are partially due to this code. There are also some weird edge cases in the implementation that probably should be discussed somewhere (e.g. size=0 and IOV_VOID means the third arguments is an integer, not a pointer). Some assorted off-the-cuff advice:
|