[PATCH 5/5] Add ioctl decoding for android_alarm.

Gabriel Laskar gabriel at lse.epita.fr
Thu Jan 15 19:32:30 UTC 2015


Android Alarms are parametered by the alarm type. This change add the
output with the correct string.

* ioctl.c (evdev_decode_number): Add android_alarm_decode_number call and implementation.
* xlat/android_alarm_type.in: New file.

Signed-off-by: Gabriel Laskar <gabriel at lse.epita.fr>
---
 ioctl.c                    | 24 ++++++++++++++++++++++++
 xlat/android_alarm_type.in |  6 ++++++
 2 files changed, 30 insertions(+)
 create mode 100644 xlat/android_alarm_type.in

diff --git a/ioctl.c b/ioctl.c
index 050ec28..2833df3 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -31,6 +31,8 @@
 #include "defs.h"
 #include <asm/ioctl.h>
 
+#include "xlat/android_alarm_type.h"
+
 static int
 compare(const void *a, const void *b)
 {
@@ -70,6 +72,26 @@ ioctl_next_match(const struct_ioctlent *iop)
 }
 
 int
+android_alarm_decode_number(unsigned long arg)
+{
+	switch (_IOC_NR(arg) >> 4) {
+		case 2:
+			tprintf("ANDROID_ALARM_SET(type=%lu)", _IOC_NR(arg & 0xf));
+			return 1;
+		case 3:
+			tprintf("ANDROID_ALARM_SET_AND_WAIT(type=%lu)", _IOC_NR(arg & 0xf));
+			return 1;
+		case 4:
+			tprints("ANDROID_ALARM_GET_TIME(");
+			printxval(android_alarm_type, _IOC_NR(arg & 0xf), "invalid alarm type");
+			tprints(")");
+			return 1;
+		default:
+			return 0;
+	}
+}
+
+int
 evdev_decode_number(unsigned long arg)
 {
 	unsigned long nr = _IOC_NR(arg);
@@ -150,6 +172,8 @@ int
 ioctl_decode_number(unsigned long arg)
 {
 	switch (_IOC_TYPE(arg)) {
+		case 'a':
+			return android_alarm_decode_number(arg);
 		case 'E':
 			return evdev_decode_number(arg);
 		case 'H':
diff --git a/xlat/android_alarm_type.in b/xlat/android_alarm_type.in
new file mode 100644
index 0000000..a9499b5
--- /dev/null
+++ b/xlat/android_alarm_type.in
@@ -0,0 +1,6 @@
+ANDROID_ALARM_RTC_WAKEUP
+ANDROID_ALARM_RTC
+ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP
+ANDROID_ALARM_ELAPSED_REALTIME
+ANDROID_ALARM_SYSTEMTIME
+ANDROID_ALARM_TYPE_COUNT
-- 
2.2.2





More information about the Strace-devel mailing list