On Sunday 24 June 2007 00:11:01 Denis Vlasenko wrote:
> static int bb_ioctl(int fd, int request, void *argp, ...)
> > {
> > va_list p;
> > char *string;
> > va_start(p, request);
> > string = va_arg(va_list p, (char *));
> >
> > int e = ioctl(fd, request, argp);
> > if (e && string)
> > bb_perror_msg(" %s", string);
>
> Use
> bb_vperror_msg((string ? string : "ioctl"), p);
> xfunc_die();
Hi,
after doing a little testing it seems to me that the va_list solution
is not doable as there is no way to determine:
string ? string : "ioctl"
this is due to the fact that with va_arg:
If there is no next argument, random errors will occur.
Another easier solution giving at least a hint of what ioctl failed could be:
void xioctl(int fd, int request, void *argp)
{
if (ioctl(fd, request, argp) < 0)
bb_perror_msg("ioctl %#x failed", request);
}
in this case with deallocvt.c,
int deallocvt_main(int argc, char **argv)
{
/* num = 0 deallocate all unused consoles */
int num = 0;
switch (argc) {
case 2:
num = xatoul_range(argv[1], 1, 63);
/* Fallthrough */
case 1:
break;
default:
bb_show_usage();
}
xioctl(get_console_fd(), VT_DISALLOCATE, (void *)num);
return EXIT_SUCCESS;
}
the output is:
deallocvt: ioctl 0X5608 failed: Device or resource busy
Just an idea.
Ciao,
Tito
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox