Unix Platform Modules

fcntl

Unix descriptor-control interface for fcntl, ioctl and file locking. Commands and argument layouts depend on operating system and device. Avoid guessed ioctl numbers or buffer layouts. Use high-level APIs when available; the example queries flags on an isolated temporary file without changing them.

Formal Syntax & Structure

python syntaxpython
import fcntl

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import fcntlfrom tempfile import TemporaryFilewith TemporaryFile() as f:    flags = fcntl.fcntl(f, fcntl.F_GETFD)    print(isinstance(flags, int))
Python Reference