1- :mod: `fcntl ` --- The :func: ` fcntl ` and :func: ` ioctl ` system calls
2- =================================================================
1+ :mod: `fcntl ` --- The `` fcntl `` and `` ioctl ` ` system calls
2+ =========================================================
33
44.. module :: fcntl
55 :platform: Unix
@@ -17,7 +17,8 @@ interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines.
1717All functions in this module take a file descriptor *fd * as their first
1818argument. This can be an integer file descriptor, such as returned by
1919``sys.stdin.fileno() ``, or a :class: `io.IOBase ` object, such as ``sys.stdin ``
20- itself, which provides a :meth: `fileno ` that returns a genuine file descriptor.
20+ itself, which provides a :meth: `~io.IOBase.fileno ` that returns a genuine file
21+ descriptor.
2122
2223.. versionchanged :: 3.3
2324 Operations in this module used to raise a :exc: `IOError ` where they now
@@ -30,7 +31,8 @@ The module defines the following functions:
3031.. function :: fcntl(fd, op[, arg])
3132
3233 Perform the requested operation on file descriptor *fd * (file objects providing
33- a :meth: `fileno ` method are accepted as well). The operation is defined by *op *
34+ a :meth: `~io.IOBase.fileno ` method are accepted as well). The operation is
35+ defined by *op *
3436 and is operating system dependent. These codes are also found in the
3537 :mod: `fcntl ` module. The argument *arg * is optional, and defaults to the integer
3638 value ``0 ``. When present, it can either be an integer value, or a string.
@@ -50,16 +52,17 @@ The module defines the following functions:
5052
5153.. function :: ioctl(fd, op[, arg[, mutate_flag]])
5254
53- This function is identical to the :func: `fcntl ` function, except that the
54- argument handling is even more complicated.
55+ This function is identical to the :func: `~ fcntl.fcntl ` function, except
56+ that the argument handling is even more complicated.
5557
5658 The op parameter is limited to values that can fit in 32-bits.
5759
5860 The parameter *arg * can be one of an integer, absent (treated identically to the
5961 integer ``0 ``), an object supporting the read-only buffer interface (most likely
6062 a plain Python string) or an object supporting the read-write buffer interface.
6163
62- In all but the last case, behaviour is as for the :func: `fcntl ` function.
64+ In all but the last case, behaviour is as for the :func: `~fcntl.fcntl `
65+ function.
6366
6467 If a mutable buffer is passed, then the behaviour is determined by the value of
6568 the *mutate_flag * parameter.
@@ -94,16 +97,16 @@ The module defines the following functions:
9497.. function :: flock(fd, op)
9598
9699 Perform the lock operation *op * on file descriptor *fd * (file objects providing
97- a :meth: `fileno ` method are accepted as well). See the Unix manual
100+ a :meth: `~io.IOBase. fileno ` method are accepted as well). See the Unix manual
98101 :manpage: `flock(2)` for details. (On some systems, this function is emulated
99102 using :c:func: `fcntl `.)
100103
101104
102105.. function :: lockf(fd, operation, [length, [start, [whence]]])
103106
104- This is essentially a wrapper around the :func: `fcntl ` locking calls. * fd * is
105- the file descriptor of the file to lock or unlock, and *operation * is one of the
106- following values:
107+ This is essentially a wrapper around the :func: `~ fcntl.fcntl ` locking calls.
108+ * fd * is the file descriptor of the file to lock or unlock, and *operation *
109+ is one of the following values:
107110
108111 * :const: `LOCK_UN ` -- unlock
109112 * :const: `LOCK_SH ` -- acquire a shared lock
@@ -118,13 +121,13 @@ The module defines the following functions:
118121 systems, :const: `LOCK_EX ` can only be used if the file descriptor refers to a
119122 file opened for writing.
120123
121- *length * is the number of bytes to lock, *start * is the byte offset at which the
122- lock starts, relative to *whence *, and *whence * is as with :func: ` fileobj.seek `,
123- specifically:
124+ *length * is the number of bytes to lock, *start * is the byte offset at
125+ which the lock starts, relative to *whence *, and *whence * is as with
126+ :func: ` io.IOBase.seek `, specifically:
124127
125- * :const: `0 ` -- relative to the start of the file (:const: ` SEEK_SET `)
126- * :const: `1 ` -- relative to the current buffer position (:const: ` SEEK_CUR `)
127- * :const: `2 ` -- relative to the end of the file (:const: ` SEEK_END `)
128+ * :const: `0 ` -- relative to the start of the file (:data: ` os. SEEK_SET `)
129+ * :const: `1 ` -- relative to the current buffer position (:data: ` os. SEEK_CUR `)
130+ * :const: `2 ` -- relative to the end of the file (:data: ` os. SEEK_END `)
128131
129132 The default for *start * is 0, which means to start at the beginning of the file.
130133 The default for *length * is 0 which means to lock to the end of the file. The
@@ -149,7 +152,8 @@ lay-out for the *lockdata* variable is system dependent --- therefore using the
149152.. seealso ::
150153
151154 Module :mod: `os `
152- If the locking flags :const: `O_SHLOCK ` and :const: `O_EXLOCK ` are present
153- in the :mod: `os ` module (on BSD only), the :func: `os.open ` function
154- provides an alternative to the :func: `lockf ` and :func: `flock ` functions.
155+ If the locking flags :data: `~os.O_SHLOCK ` and :data: `~os.O_EXLOCK ` are
156+ present in the :mod: `os ` module (on BSD only), the :func: `os.open `
157+ function provides an alternative to the :func: `lockf ` and :func: `flock `
158+ functions.
155159
0 commit comments