{"id":23898,"library":"ioctl-opt","title":"ioctl-opt","description":"A library providing functions to compute the opt argument for fcntl.ioctl. It helps encode ioctl request codes, supporting type, number, direction, and size. Current version: 1.3.1. Release cadence: infrequent, as needed.","status":"active","version":"1.3.1","language":"python","source_language":"en","source_url":"https://github.com/vpelletier/python-ioctl-opt","tags":["ioctl","fnctl","system-calls","linux"],"install":[{"cmd":"pip install ioctl-opt","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Correct import path uses underscore.","symbol":"IOC","correct":"from ioctl_opt import IOC"},{"note":"Correct import for reading ioctl.","symbol":"IOR","correct":"from ioctl_opt import IOR"},{"note":"Correct import for writing ioctl.","symbol":"IOW","correct":"from ioctl_opt import IOW"},{"note":"Correct import for read-write ioctl.","symbol":"IOWR","correct":"from ioctl_opt import IOWR"}],"quickstart":{"code":"from ioctl_opt import IOC, IOR, IOW, IOWR\n\n# Define ioctl numbers\ntype_num = ord('t')  # example 't'\nnumber = 1\nsize = 256\n\n# Create ioctl request codes\nread_ioctl = IOR(type_num, number, size)\nwrite_ioctl = IOW(type_num, number, size)\nrdwr_ioctl = IOWR(type_num, number, size)\ncustom = IOC(0, type_num, number, size)  # direction 0 (none)\n\nprint(f\"IOR: {read_ioctl:#x}\")\nprint(f\"IOW: {write_ioctl:#x}\")\nprint(f\"IOWR: {rdwr_ioctl:#x}\")","lang":"python","description":"Basic usage: compute ioctl request codes for fcntl.ioctl."},"warnings":[{"fix":"Use 'from ioctl_opt import ...' not 'import ioctl-opt'.","message":"The library name on PyPI is 'ioctl-opt', but the Python import path uses an underscore: 'ioctl_opt'. Many users mistakenly try 'import ioctl_opt' as 'import ioctl-opt', which fails.","severity":"gotcha","affected_versions":"all"},{"fix":"Use IOR, IOW, IOWR for read, write, read-write respectively.","message":"The function 'IOC' with direction argument may be deprecated in future versions; prefer using IOR, IOW, IOWR for clear direction.","severity":"deprecated","affected_versions":"<=1.3.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change import to 'from ioctl_opt import ...'.","cause":"Using hyphen in import statement instead of underscore.","error":"ImportError: No module named 'ioctl-opt'"},{"fix":"Check documentation: IOC(direction, type, number, size). Use IOR/IOW/IOWR for simpler signatures.","cause":"Incorrect number of arguments passed to IOC or incorrect function signature understanding.","error":"TypeError: IOC() missing 2 required positional arguments: 'size' and 'number'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}