Problem with ioctl command TCGETS

From: Ozan Eren Bilgen
Date: Sat Nov 27 2004 - 19:23:54 EST


--- Please CC me your responses ---


Hi,

While tracking KPPP and modem interaction, I experienced a problem with
TCGETS ioctl command, which is defined as constant number 0x5401 in
"include/asm/ioctls.h". If you decode TCGETS, you will obtain:

type: 'T'
direction: _IOC_NONE
number: 1
size: 0

but applications (like KPPP) cause indirectly that the modem descriptor
is ioctl'd by passing a string, as the example in
http://www.ussg.iu.edu/hypermail/linux/kernel/9904.0/0371.html shows:

fd = open("/dev/ttyS1", O_RDWR|O_NONBLOCK)
fcntl(fd, F_GETFD)
fcntl(fd, F_SETFD, FD_CLOEXEC)
fcntl(fd, F_GETFL)
ioctl(fd, TCGETS, {B9600 opost isig icanon echo ...}) = 0

CMIIW, TCGETS ioctl command should not interest with its argp, but
drivers/char/tty_ioctl.c does.

case TCGETS:
if (kernel_termios_to_user_termios((struct termios __user *)arg,
real_tty->termios))
return -EFAULT;
return 0;

I have a few questions:

1. Is it nice to break _IO macros?
2. If it has a historical reason, shall I forget to trust to the
informations that I decoded using _IO* macros?
3. Is there a list of such amazing commands?



Thanks in advance,
Ozan Eren BILGEN


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/