@@ -1082,20 +1082,81 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
10821082 .. versionadded :: 3.3
10831083
10841084
1085- .. function :: pread(fd, buffersize , offset)
1085+ .. function :: pread(fd, n , offset)
10861086
1087- Read from a file descriptor, *fd *, at a position of *offset *. It will read up
1088- to *buffersize * number of bytes. The file offset remains unchanged.
1087+ Read at most *n * bytes from file descriptor *fd * at a position of *offset *,
1088+ leaving the file offset unchanged.
1089+
1090+ Return a bytestring containing the bytes read. If the end of the file
1091+ referred to by *fd * has been reached, an empty bytes object is returned.
10891092
10901093 Availability: Unix.
10911094
10921095 .. versionadded :: 3.3
10931096
10941097
1098+ .. function :: preadv(fd, buffers, offset, flags=0)
1099+
1100+ Read from a file descriptor *fd * at a position of *offset * into mutable
1101+ :term: `bytes-like objects <bytes-like object> ` *buffers *, leaving the file
1102+ offset unchanged. Transfer data into each buffer until it is full and then
1103+ move on to the next buffer in the sequence to hold the rest of the data.
1104+
1105+ The flags argument contains a bitwise OR of zero or more of the following
1106+ flags:
1107+
1108+ - :data: `RWF_HIPRI `
1109+ - :data: `RWF_NOWAIT `
1110+
1111+ Return the total number of bytes actually read which can be less than the
1112+ total capacity of all the objects.
1113+
1114+ The operating system may set a limit (:func: `sysconf ` value
1115+ ``'SC_IOV_MAX' ``) on the number of buffers that can be used.
1116+
1117+ Combine the functionality of :func: `os.readv ` and :func: `os.pread `.
1118+
1119+ Availability: Linux 2.6.30 and newer, FreeBSD 6.0 and newer,
1120+ OpenBSD 2.7 and newer. Using flags requires Linux 4.6 or newer.
1121+
1122+ .. versionadded :: 3.7
1123+
1124+
1125+ .. data :: RWF_NOWAIT
1126+
1127+ Do not wait for data which is not immediately available. If this flag is
1128+ specified, the system call will return instantly if it would have to read
1129+ data from the backing storage or wait for a lock.
1130+
1131+ If some data was successfully read, it will return the number of bytes read.
1132+ If no bytes were read, it will return ``-1 `` and set errno to
1133+ :data: `errno.EAGAIN `.
1134+
1135+ Availability: Linux 4.14 and newer.
1136+
1137+ .. versionadded :: 3.7
1138+
1139+
1140+ .. data :: RWF_HIPRI
1141+
1142+ High priority read/write. Allows block-based filesystems to use polling
1143+ of the device, which provides lower latency, but may use additional
1144+ resources.
1145+
1146+ Currently, on Linux, this feature is usable only on a file descriptor opened
1147+ using the :data: `O_DIRECT ` flag.
1148+
1149+ Availability: Linux 4.6 and newer.
1150+
1151+ .. versionadded :: 3.7
1152+
1153+
10951154.. function :: pwrite(fd, str, offset)
10961155
1097- Write *bytestring * to a file descriptor, *fd *, from *offset *,
1098- leaving the file offset unchanged.
1156+ Write the bytestring in *str * to file descriptor *fd * at position of
1157+ *offset *, leaving the file offset unchanged.
1158+
1159+ Return the number of bytes actually written.
10991160
11001161 Availability: Unix.
11011162
@@ -1104,54 +1165,57 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
11041165
11051166.. function :: pwritev(fd, buffers, offset, flags=0)
11061167
1107- Combines the functionality of :func: `os.writev ` and :func: `os.pwrite `. It
1108- writes the contents of *buffers * to file descriptor *fd * at offset *offset *.
1109- *buffers * must be a sequence of :term: `bytes-like objects <bytes-like object> `.
1110- Buffers are processed in array order. Entire contents of first buffer is written
1111- before proceeding to second, and so on. The operating system may set a limit
1112- (sysconf() value SC_IOV_MAX) on the number of buffers that can be used.
1113- :func: `~os.pwritev ` writes the contents of each object to the file descriptor
1114- and returns the total number of bytes written.
1168+ Write the *buffers * contents to file descriptor *fd * at a offset *offset *,
1169+ leaving the file offset unchanged. *buffers * must be a sequence of
1170+ :term: `bytes-like objects <bytes-like object> `. Buffers are processed in
1171+ array order. Entire contents of the first buffer is written before
1172+ proceeding to the second, and so on.
11151173
1116- The * flags * argument contains a bitwise OR of zero or more of the following
1174+ The flags argument contains a bitwise OR of zero or more of the following
11171175 flags:
11181176
1119- - RWF_DSYNC
1120- - RWF_SYNC
1177+ - :data: ` RWF_DSYNC `
1178+ - :data: ` RWF_SYNC `
11211179
1122- Using non-zero flags requires Linux 4.7 or newer .
1180+ Return the total number of bytes actually written .
11231181
1124- Availability: Linux (version 2.6.30), FreeBSD 6.0 and newer,
1125- OpenBSD (version 2.7 and newer).
1182+ The operating system may set a limit (:func: `sysconf ` value
1183+ ``'SC_IOV_MAX' ``) on the number of buffers that can be used.
1184+
1185+ Combine the functionality of :func: `os.writev ` and :func: `os.pwrite `.
1186+
1187+ Availability: Linux 2.6.30 and newer, FreeBSD 6.0 and newer,
1188+ OpenBSD 2.7 and newer. Using flags requires Linux 4.7 or newer.
11261189
11271190 .. versionadded :: 3.7
11281191
1192+
11291193.. data :: RWF_DSYNC
11301194
1131- Provide a per-write equivalent of the O_DSYNC open(2) flag. This flag
1132- is meaningful only for pwritev2(), and its effect applies only to the
1133- data range written by the system call.
1195+ Provide a per-write equivalent of the :data: `O_DSYNC ` ``open(2) `` flag. This
1196+ flag effect applies only to the data range written by the system call.
11341197
1135- Availability: Linux (version 4.7) .
1198+ Availability: Linux 4.7 and newer .
11361199
11371200 .. versionadded :: 3.7
11381201
1202+
11391203.. data :: RWF_SYNC
11401204
1141- Provide a per-write equivalent of the O_SYNC open(2) flag. This flag is
1142- meaningful only for pwritev2(), and its effect applies only to the data
1143- range written by the system call.
1205+ Provide a per-write equivalent of the :data: `O_SYNC ` ``open(2) `` flag. This
1206+ flag effect applies only to the data range written by the system call.
11441207
1145- Availability: Linux (version 4.7) .
1208+ Availability: Linux 4.7 and newer .
11461209
11471210 .. versionadded :: 3.7
11481211
11491212
11501213.. function :: read(fd, n)
11511214
1152- Read at most *n * bytes from file descriptor *fd *. Return a bytestring containing the
1153- bytes read. If the end of the file referred to by *fd * has been reached, an
1154- empty bytes object is returned.
1215+ Read at most *n * bytes from file descriptor *fd *.
1216+
1217+ Return a bytestring containing the bytes read. If the end of the file
1218+ referred to by *fd * has been reached, an empty bytes object is returned.
11551219
11561220 .. note ::
11571221
@@ -1230,66 +1294,19 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
12301294.. function :: readv(fd, buffers)
12311295
12321296 Read from a file descriptor *fd * into a number of mutable :term: `bytes-like
1233- objects <bytes-like object> ` *buffers *. :func: `~os.readv ` will transfer data
1234- into each buffer until it is full and then move on to the next buffer in the
1235- sequence to hold the rest of the data. :func: `~os.readv ` returns the total
1236- number of bytes read (which may be less than the total capacity of all the
1237- objects).
1297+ objects <bytes-like object> ` *buffers *. Transfer data into each buffer until
1298+ it is full and then move on to the next buffer in the sequence to hold the
1299+ rest of the data.
12381300
1239- Availability: Unix.
1240-
1241- .. versionadded :: 3.3
1301+ Return the total number of bytes actually read which can be less than the
1302+ total capacity of all the objects.
12421303
1304+ The operating system may set a limit (:func: `sysconf ` value
1305+ ``'SC_IOV_MAX' ``) on the number of buffers that can be used.
12431306
1244- .. function :: preadv(fd, buffers, offset, flags=0)
1245-
1246- Combines the functionality of :func: `os.readv ` and :func: `os.pread `. It
1247- reads from a file descriptor *fd * into a number of mutable :term: `bytes-like
1248- objects <bytes-like object> ` *buffers *. As :func: `os.readv `, it will transfer
1249- data into each buffer until it is full and then move on to the next buffer in
1250- the sequence to hold the rest of the data. Its fourth argument, *offset *,
1251- specifies the file offset at which the input operation is to be performed.
1252- :func: `~os.preadv ` return the total number of bytes read (which can be less than
1253- the total capacity of all the objects).
1254-
1255- The flags argument contains a bitwise OR of zero or more of the following
1256- flags:
1257-
1258- - RWF_HIPRI
1259- - RWF_NOWAIT
1260-
1261- Using non-zero flags requires Linux 4.6 or newer.
1262-
1263- Availability: Linux (version 2.6.30), FreeBSD 6.0 and newer,
1264- OpenBSD (version 2.7 and newer).
1265-
1266- .. versionadded :: 3.7
1267-
1268-
1269- .. data :: RWF_HIPRI
1270-
1271- High priority read/write. Allows block-based filesystems to use polling
1272- of the device, which provides lower latency, but may use additional
1273- resources. (Currently, this feature is usable only on a file descriptor
1274- opened using the O_DIRECT flag.)
1275-
1276- Availability: Linux (version 4.6).
1277-
1278- .. versionadded :: 3.7
1279-
1280-
1281- .. data :: RWF_NOWAIT
1282-
1283- Do not wait for data which is not immediately available. If this flag
1284- is specified, the preadv2() system call will return instantly
1285- if it would have to read data from the backing storage or wait for a lock.
1286- If some data was successfully read, it will return the number of bytes
1287- read. If no bytes were read, it will return -1 and set errno to EAGAIN.
1288- Currently, this flag is meaningful only for preadv2().
1289-
1290- Availability: Linux (version 4.14).
1307+ Availability: Unix.
12911308
1292- .. versionadded :: 3.7
1309+ .. versionadded :: 3.3
12931310
12941311
12951312.. function :: tcgetpgrp(fd)
@@ -1319,8 +1336,9 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
13191336
13201337.. function :: write(fd, str)
13211338
1322- Write the bytestring in *str * to file descriptor *fd *. Return the number of
1323- bytes actually written.
1339+ Write the bytestring in *str * to file descriptor *fd *.
1340+
1341+ Return the number of bytes actually written.
13241342
13251343 .. note ::
13261344
@@ -1338,14 +1356,15 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
13381356
13391357.. function :: writev(fd, buffers)
13401358
1341- Write the contents of *buffers * to file descriptor *fd *. *buffers * must be a
1342- sequence of :term: `bytes-like objects <bytes-like object> `. Buffers are
1343- processed in array order. Entire contents of first buffer is written before
1344- proceeding to second, and so on. The operating system may set a limit
1345- (sysconf() value SC_IOV_MAX) on the number of buffers that can be used.
1359+ Write the contents of *buffers * to file descriptor *fd *. *buffers * must be
1360+ a sequence of :term: `bytes-like objects <bytes-like object> `. Buffers are
1361+ processed in array order. Entire contents of the first buffer is written
1362+ before proceeding to the second, and so on.
1363+
1364+ Returns the total number of bytes actually written.
13461365
1347- :func: ` ~os.writev ` writes the contents of each object to the file descriptor
1348- and returns the total number of bytes written .
1366+ The operating system may set a limit ( :func: ` sysconf ` value
1367+ `` 'SC_IOV_MAX' ``) on the number of buffers that can be used .
13491368
13501369 Availability: Unix.
13511370
0 commit comments