gpt4 book ai didi

linux - TIOCMGET 应该在哪里实现?

转载 作者:太空宇宙 更新时间:2023-11-04 11:25:53 25 4
gpt4 key购买 nike

这真的只是为了满足我对this的好奇心问题。虽然我现在使用替代解决方案,但最初的问题似乎归结为未实现 TIOCMGET 这一事实,我想了解一下为什么会这样。

遗憾的是,我没有通过谷歌搜索找到太多有用的信息,而且我发现 tty_ioctl 手册页(第一个结果)非常难以理解。

那么,TIOCMGET 到底是什么,它是在哪里实现的,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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com