[PATCH] watchdog add settimeout ioctl
Darius
augulis.darius at gmail.com
Wed Aug 6 07:16:58 UTC 2008
> Hi Darius,
>
> Please remove the last argument as there is some preprocessor magic
> in in libbb.h that will add it automagically depending on the setting
> of f ENABLE_IOCTL_HEX2STR_ERROR
but it does not compile if ENABLE_IOCTL_HEX2STR_ERROR is set, because then bb_ioctl_or_warn() needs more arguments.
if ENABLE_IOCTL_HEX2STR_ERROR is not set, ioctl name is replaced with hex number, what is not good readable.
>
> #if ENABLE_IOCTL_HEX2STR_ERROR
> int bb_ioctl_or_warn(int fd, unsigned request, void *argp, const char *ioctl_name) FAST_FUNC;
> int bb_xioctl(int fd, unsigned request, void *argp, const char *ioctl_name) FAST_FUNC;
> #define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp,#request)
> #define xioctl(fd,request,argp) bb_xioctl(fd,request,argp,#request)
> #else
> int bb_ioctl_or_warn(int fd, unsigned request, void *argp) FAST_FUNC;
> int bb_xioctl(int fd, unsigned request, void *argp) FAST_FUNC;
> #define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp)
> #define xioctl(fd,request,argp) bb_xioctl(fd,request,argp)
> #endif
>
>
> + bb_ioctl_or_warn(3, WDIOC_SETTIMEOUT, &htimer_duration, "error setting hardware timer");
> + bb_ioctl_or_warn(3, WDIOC_GETTIMEOUT, &htimer_duration, "error getting timer value");
>
>
> so you should change the calls to:
> + ioctl_or_warn(3, WDIOC_SETTIMEOUT, &htimer_duration);
> + ioctl_or_warn(3, WDIOC_GETTIMEOUT, &htimer_duration);
>
> They will print the following error message depending on ENABLE_IOCTL_HEX2STR_ERROR:
>
> ioctl WDIOC_SETTIMEOUT failed
>
> or
>
> ioctl 0x0000 failed
>
> if you want to use your custom error messages you can use:
>
> ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...)
>
> but this will increase size.
>
> Sorry for the inconvenience as i mislead a bit you with my first
> mail but i forgot about this magic stuff.
>
> Ciao,
> Tito
More information about the busybox
mailing list