这真的只是为了满足我的好奇心。虽然我现在正在使用另一种解决方案,但最初的问题似乎归结为tiocget没有实现,我想知道一点原因。
遗憾的是,我没有找到太多有用的信息,只是通过谷歌,我发现tty-ioctl的人网页(第一个结果)相当难以穿透。
那么,TOCMGET到底是什么,它是在哪里实现的,mono可能在哪里寻找它而没有找到它?
最佳答案
它在drivers/tty/tty_io.c
中实现,具有以下实现:
/**
* tty_tiocmget - get modem status
* @tty: tty device
* @file: user file pointer
* @p: pointer to result
*
* Obtain the modem status bits from the tty driver if the feature
* is supported. Return -EINVAL if it is not available.
*
* Locking: none (up to the driver)
*/
static int tty_tiocmget(struct tty_struct *tty, int __user *p)
{
int retval = -EINVAL;
if (tty->ops->tiocmget) {
retval = tty->ops->tiocmget(tty);
if (retval >= 0)
retval = put_user(retval, p);
}
return retval;
}
正如您将从注释和代码中注意到的,它只在底层终端驱动程序支持它并且返回
EINVAL
时才工作。有许多驱动程序支持它,例如
isdn4linux
和各种GSM调制解调器驱动程序,但是普通终端不会这样做,因为它们不是调制解调器。关于linux - TIOCMGET应该在哪里实现?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14830739/