python - python的fcntl.ioctl中的 'op'是什么意思?

标签 python linux python-2.7 fcntl

根据fcntl documentation fcntl.ioctl的用法如下:

 fcntl.ioctl(fd, op[, arg[, mutate_flag]])

op定义为

The operation is defined by op and is operating system dependent. These codes are also found in the fcntl module. 

它不回答“什么”操作。它是一个整数吗?字符串?一个结构?如何能够正确使用此命令,例如在 Linux 平台上?

最佳答案

与 fcntl 和 os 模块中的许多其他函数一样,ioctl 是同名操作系统系统调用的薄包装器。如果咨询the manpage for that system call你会看到它是一个整数。

ioctl 的附加参数(在 op 之后)可以是任何东西。 ioctl 具有众所周知的可变参数,这些参数完全取决于请求是什么,甚至取决于内核或驱动程序代码的哪一部分接收和处理请求。差异驱动程序甚至可以重用 op 的整数值来表示不同的事物(尽管鼓励它们进行协调以避免这种重复)。

关于python - python的fcntl.ioctl中的 'op'是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14628333/

相关文章:

python - 如何使用一列覆盖另一列并在 NaN 时采用另一列值?

Python - 使用 Numpy、ValueError 生成随机 dna 序列

python - @staticmethod 和@classmethod 如何作用于python 中的变量?

linux - 同时启动多个程序

python-2.7 - python : What is the simples way to compare two numbers (in tuple) returned by a function?

python - argparse.print_help() 不打印完整消息

Python/Pandas - 将 pandas DataFrame 划分为 10 个不相交、大小相等的子集

php - mkdir() 不修改目录

linux - Linux 文件系统是如何创建的?

visual-studio - 需要 Microsoft Visual C++ 9.0