我正在移植一些将tty_ldisc_ops.ioctl()定义为:

static int ...ldisc_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)

current spec是:

static int ...ldisc_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)

关于"文件"的争论发生了什么?我查找了更改日志(log)和来源.


我从(https://mirrors.edge.kernel.org/pub/linux/kernel/v2.1/)中随机抓取了一个较旧的内核.

int n_tty_ioctl(struct tty_struct * tty, struct file * file,
                       unsigned int cmd, unsigned long arg) { ... tty->driver.ioctl(tty, file, cmd, arg); ...

tty.h, struct tty_struct { ... struct tty_driver driver; ...

tty_driver.h: struct tty_driver { ... int  (*ioctl)(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg); ...

然后线索就断了.

推荐答案

通过浏览Linux内核项目的Git历史,您可能会发现v5.17是第一个删除该文件的版本.This commit个人制造了这种情况发生.根据它的说法,你需要寻找之前的补丁,one of which似乎解释了为什么会这样做:

The only user of 'file' parameter in tty_mode_ioctl is a BUG_ON check. Provided it never crashed for anyone, it's an overkill to pass the parameter to tty_mode_ioctl only for this check.

因此,换句话说,它从未用于与TTY层相关的任何东西,因此已被移除.

C++相关问答推荐

想了解 struct 指针和空指针转换

如何判断宏参数是否为C语言中的整型文字

如果我释放其他内容,返回值就会出错

C是否用0填充多维数组的其余部分?

为什么即使在强制转换时,此代码也会溢出?

C++中矢量类型定义和数据保护的高效解决方案

_泛型控制表达式涉及数组碰撞警告的L值转换错误?

初始变量重置后,char[]的赋值将消失

如何仅使用软件重新初始化STM32微控制器中的USB枚举?

为什么Fread()函数会读取内容,然后光标会跳到随机位置?

错误...的多个定义(&Q)首先在这里定义&

如何将C中的两个字符串与从文件接收的字符串中的字符数进行比较

理解bzip2的BZ2_解压缩函数中的状态重新分配

条件跳转或移动取决于未初始化值(S)/未初始化值由堆分配创建(Realloc)

try 查找带有指针的数组的最小值和最大值

如何在C中处理流水线中的a、n命令?

';malloc():损坏的顶部大小';分配超过20万整数后

通过修改c中的合并排序对数组的偶数索引进行排序

创建 makefile 来编译位于不同目录中的多个源文件

malloc:损坏的顶部大小无法找出问题