[PATCH 3/5] Add Decoding support for android ioctls
Gabriel Laskar
gabriel at lse.epita.fr
Thu Jan 15 19:32:28 UTC 2015
Android exposes 6 ioctls APIs, but they are placed in
drivers/staging/android/uapi/. Moreover, binder ioctls are defined in an
enum and with a define.
* linux/ioctlent.h: Add parsing support for android ioctls.
Signed-off-by: Gabriel Laskar <gabriel at lse.epita.fr>
---
linux/ioctlent.sh | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/linux/ioctlent.sh b/linux/ioctlent.sh
index 3c7d3fc..d780c62 100755
--- a/linux/ioctlent.sh
+++ b/linux/ioctlent.sh
@@ -77,7 +77,7 @@ if [ -e $dir/Kbuild ]; then
echo "$asm/* asm-generic/*"
)
# special case: some headers aren't exported directly
- files="${files} media/* net/bluetooth/* pcmcia/*"
+ files="${files} media/* net/bluetooth/* pcmcia/* ../drivers/staging/android/uapi/*"
else
# older kernel tree or headers_install'ed tree, just assume some headers
files="linux/* $asm/* asm-generic/* drm/* mtd/* rdma/* scsi/* sound/* video/* xen/*"
@@ -109,6 +109,15 @@ lookup_named_ioctls DRM
lookup_named_ioctls OMAP
lookup_named_ioctls HSC
+# look for ioctls in binder
+regexp='^[[:space:]]*[A-Z][A-Za-z0-9_]\+[[:space:]]*=[[:space:]]*_IO'
+(cd $dir && grep $regexp $files 2>/dev/null) | \
+ sed -n \
+ -e "s,$asm/,asm/,g" \
+ -e 's/^\(.*\):[[:space:]]*\([A-Z0-9_]*\)[[:space:]]*=[[:space:]]*_I.*(\([^[,]*\)[[:space:]]*,[[:space:]]*\([^,)]*\).*/ { "\1", "\2", _IOC(_IOC_NONE,\3,\4,0) },/p' \
+ >> ioctls.h
+
+
# Strip uapi/ prefix
sed -i 's|"uapi/|"|' ioctls.h
@@ -121,10 +130,10 @@ sort -u -o ioctls.h ioctls.h
# Some use a special base to offset their ioctls on. Extract that as well.
# Some use 2 defines: _IOC(_IOC_NONE,DM_IOCTL,DM_LIST_DEVICES_CMD,....)
bases=$((sed -n \
- -e 's/.*_IOC_NONE.*,[[:space:]]*\([A-Z][A-Za-z0-9_]\+\)[[:space:]]*,[[:space:]]*\([A-Z][A-Za-z0-9_]\+\)[[:space:]+,].*/\1\n\2/p' \
- -e 's/.*_IOC_NONE.*,[[:space:]]*\([A-Z][A-Za-z0-9_]\+\)[[:space:]+,].*/\1/p' \
+ -e 's/.*_IOC_NONE.*,[[:space:]]*\([A-Z_][A-Za-z0-9_]\+\)[[:space:]]*,[[:space:]]*\([A-Z][A-Za-z0-9_]\+\)[[:space:]+,].*/\1\n\2/p' \
+ -e 's/.*_IOC_NONE.*,[[:space:]]*\([A-Z_][A-Za-z0-9_]\+\)[[:space:]+,].*/\1/p' \
ioctls.h ; \
- sed -n -e 's/.*_IOC_NONE.*,[[:space:]]*[A-Z][A-Za-z0-9_]\+[[:space:]+,]\+[A-Z][A-Za-z0-9_]\+[[:space:]]*+[[:space:]]*\([A-Z][A-Za-z0-9_]*\).*/\1/p' \
+ sed -n -e 's/.*_IOC_NONE.*,[[:space:]]*[A-Z_][A-Za-z0-9_]\+[[:space:]+,]\+[A-Z][A-Za-z0-9_]\+[[:space:]]*+[[:space:]]*\([A-Z][A-Za-z0-9_]*\).*/\1/p' \
ioctls.h) | sort -u)
for base in $bases; do
--
2.2.2
More information about the Strace-devel
mailing list