[PATCH 1/3] linux/ioctlent.sh: discover paths via exported-headers method
Mike Frysinger
vapier at gentoo.org
Fri Feb 20 17:56:47 UTC 2009
Rather than hard coding the subdirs to search for ioctls, discover them
dynamically with newer kernel trees by working off of the exported header
mechanism. If the kernel does not have this mechanism, we fall back to
the old method of hard coding the list.
This fixes issues where the current hard coded list does not contain all
headers which get exported to userspace (like the mtd ioctls).
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
linux/ioctlent.sh | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/linux/ioctlent.sh b/linux/ioctlent.sh
index cff6145..479eed4 100644
--- a/linux/ioctlent.sh
+++ b/linux/ioctlent.sh
@@ -68,7 +68,19 @@ lookup_ioctls '7[12]' linux/videotext.h
lookup_ioctls 89 $asm/sockios.h linux/sockios.h
lookup_ioctls 8B linux/wireless.h
-files="linux/* $asm/* scsi/* sound/*"
+if [ -e $dir/Kbuild ] ; then
+ # kernel has exported user space headers, so query only them
+ files=$(
+ cd $dir
+ find . -mindepth 2 -name Kbuild | \
+ sed -e 's:^\./::' -e 's:/Kbuild:/*:' | \
+ grep -v '^asm-'
+ echo "$asm/* asm-generic/*"
+ )
+else
+ # older kernel so just assume some headers
+ files="linux/* $asm/* scsi/* sound/*"
+fi
# Build the list of all ioctls
regexp='^[[:space:]]*#[[:space:]]*define[[:space:]]\+[A-Z][A-Z0-9_]*[[:space:]]\+_S\?\(IO\|IOW\|IOR\|IOWR\)\>'
--
1.6.1.3
More information about the Strace-devel
mailing list