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

Dmitry V. Levin ldv at altlinux.org
Sat Jan 17 01:48:36 UTC 2015


On Thu, Jan 15, 2015 at 08:32:30PM +0100, Gabriel Laskar wrote:
> 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"

All constants used by xlat files must be defined before xlat files are
included.

> +
>  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;

_IOC_DIR(arg) needs to be checked just in case.

In this case, _IOC_SIZE(arg) also needs to be checked,
to avoid collisions with ATMIOC numbers.  


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150117/631eab35/attachment.bin>


More information about the Strace-devel mailing list