Introduction to fcntl and ioctl system calls

Introduction to fcntl and ioctl system calls

Introduction to fcntl and ioctl system calls:

when we want to control the files and the io, we should use the fcntl module. It is basically one interface to the fcntl() and ioctl() Unix routines.

All methods in this module takes one integer or io.IOBase file-descriptor as their first argument.

To use this module, we should import it using.

import fcntl

There are some  of the functions ntl module, these are %u2212

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

This method is used to perform the operation on the file using file descriptor. The operation is defined by op. The third argument is optional. It can be either integer type value or string type value. When the argument is integer type, the return value will be the value of C fcntl() call. When it is string, it represents binary structure. When this function fails, it raises an IOError.

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

This method is identical to the fcntl() method, but in this case the argument handling is more complex. In the argument, if the mutable buffer is passed, then its behavior will depend on the mutate_flag. When it is true, the buffer can be mutable, otherwise it will act like read-only buffer.

next we will discuss some more functions



  • Akshit
    29-Jun-2021 12:45:21 PM

    how do you get views sir?