From owner-freebsd-hackers@freebsd.org Mon Dec 5 23:43:13 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 911BBC693A7 for ; Mon, 5 Dec 2016 23:43:13 +0000 (UTC) (envelope-from torek@torek.net) Received: from elf.torek.net (mail.torek.net [96.90.199.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E4191249 for ; Mon, 5 Dec 2016 23:43:12 +0000 (UTC) (envelope-from torek@torek.net) Received: from elf.torek.net (localhost [127.0.0.1]) by elf.torek.net (8.14.9/8.14.9) with ESMTP id uB5Nh5Dm078198 for ; Mon, 5 Dec 2016 15:43:06 -0800 (PST) (envelope-from torek@torek.net) Message-Id: <201612052343.uB5Nh5Dm078198@elf.torek.net> From: Chris Torek To: freebsd-hackers@freebsd.org Subject: kernel ioctl aggregator script, might be generally useful MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <78196.1480981385.1@elf.torek.net> Content-Transfer-Encoding: quoted-printable Date: Mon, 05 Dec 2016 15:43:05 -0800 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (elf.torek.net [127.0.0.1]); Mon, 05 Dec 2016 15:43:06 -0800 (PST) X-Mailman-Approved-At: Tue, 06 Dec 2016 00:16:21 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2016 23:43:13 -0000 I wrote a little Python script to let me view existing kernel _IO*(group, number, type) ioctls. Here's a sample of the kind of data it prints: group 'F': 0: _IOR('F', 0, struct fbtype) sys/fbio.h:106 2: _IOR('F', 2, struct fbinfo) sys/fbio.h:178 3: _IOW('F', 3, struct fbcmap) sys/fbio.h:191 4: _IOW('F', 4, struct fbcmap) sys/fbio.h:192 5: _IOW('F', 5, struct fbsattr) sys/fbio.h:216 6: _IOR('F', 6, struct fbgattr) sys/fbio.h:217 [snip] group 'I': 0: _IOWR('I', 0, struct iodev_pio_req) dev/io/iodev.h:42 1: _IOR('I', 1, struct iscsi_daemon_request) dev/iscsi/iscsi_ioctl.h:125 _IOR('I', 1, struct autofs_daemon_request) fs/autofs/autofs_ioctl.h:1= 12 _IOWR('I', 1, struct iodev_efivar_req) ia64/include/iodev.h:53 2: _IOW('I', 2, struct iscsi_daemon_handoff) dev/iscsi/iscsi_ioctl.h:126 _IOW('I', 2, struct autofs_daemon_done_101) fs/autofs/autofs_ioctl.h:= 113 3: _IOW('I', 3, struct iscsi_daemon_fail) dev/iscsi/iscsi_ioctl.h:127 _IOW('I', 3, struct autofs_daemon_done) fs/autofs/autofs_ioctl.h:114 4: _IOWR('I', 4, struct iscsi_daemon_connect) dev/iscsi/iscsi_ioctl.h:17= 9 [snip] which lets us see that there are overlapping uses of some of the group-'I' ioctls (overlapping uses are OK as long as they don't really collide, of course, this just lets you check for potential issues). (Also it does not know about #ifdef so it finds things like these: group r: 60: _IOW(r, 60, struct ipfobj) contrib/ipfilter/netinet/ip_fi= l.h:88 which is inside the "#else" part of a __STDC__ ifdef.) Anyway, if anyone wants it for whatever purpose, I put it up for public access at https://github.com/chris3torek/scripts (https://raw.githubusercontent.com/chris3torek/scripts/master/sysioctl.py) Chris