Skip to content

Commit e163fbd

Browse files
authored
fixes gh-139090: add os.RWF_DONTCACHE (#139091)
1 parent 9b35f7c commit e163fbd

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

Doc/library/os.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15011501

15021502
- :data:`RWF_HIPRI`
15031503
- :data:`RWF_NOWAIT`
1504+
- :data:`RWF_DONTCACHE`
15041505

15051506
Return the total number of bytes actually read which can be less than the
15061507
total capacity of all the objects.
@@ -1546,6 +1547,15 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15461547
.. versionadded:: 3.7
15471548

15481549

1550+
.. data:: RWF_DONTCACHE
1551+
1552+
Use uncached buffered IO.
1553+
1554+
.. availability:: Linux >= 6.14
1555+
1556+
.. versionadded:: next
1557+
1558+
15491559
.. function:: ptsname(fd, /)
15501560

15511561
Return the name of the slave pseudo-terminal device associated with the
@@ -1587,6 +1597,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15871597
- :data:`RWF_DSYNC`
15881598
- :data:`RWF_SYNC`
15891599
- :data:`RWF_APPEND`
1600+
- :data:`RWF_DONTCACHE`
15901601

15911602
Return the total number of bytes actually written.
15921603

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add :data:`os.RWF_DONTCACHE` constant for Linux 6.14+.

Modules/clinic/posixmodule.c.h

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11756,14 +11756,15 @@ The flags argument contains a bitwise OR of zero or more of the following flags:
1175611756
1175711757
- RWF_HIPRI
1175811758
- RWF_NOWAIT
11759+
- RWF_DONTCACHE
1175911760
1176011761
Using non-zero flags requires Linux 4.6 or newer.
1176111762
[clinic start generated code]*/
1176211763

1176311764
static Py_ssize_t
1176411765
os_preadv_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
1176511766
int flags)
11766-
/*[clinic end generated code: output=26fc9c6e58e7ada5 input=c1f876866fcd9d41]*/
11767+
/*[clinic end generated code: output=26fc9c6e58e7ada5 input=34fb3b9ca06f7ba7]*/
1176711768
{
1176811769
Py_ssize_t cnt, n;
1176911770
int async_err = 0;
@@ -12413,14 +12414,15 @@ The flags argument contains a bitwise OR of zero or more of the following flags:
1241312414
- RWF_DSYNC
1241412415
- RWF_SYNC
1241512416
- RWF_APPEND
12417+
- RWF_DONTCACHE
1241612418
1241712419
Using non-zero flags requires Linux 4.7 or newer.
1241812420
[clinic start generated code]*/
1241912421

1242012422
static Py_ssize_t
1242112423
os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
1242212424
int flags)
12423-
/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=99d8a21493ff76ca]*/
12425+
/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=664a67626d485665]*/
1242412426
{
1242512427
Py_ssize_t cnt;
1242612428
Py_ssize_t result;
@@ -17646,6 +17648,9 @@ all_ins(PyObject *m)
1764617648
#ifdef RWF_NOWAIT
1764717649
if (PyModule_AddIntConstant(m, "RWF_NOWAIT", RWF_NOWAIT)) return -1;
1764817650
#endif
17651+
#ifdef RWF_DONTCACHE
17652+
if (PyModule_AddIntConstant(m, "RWF_DONTCACHE", RWF_DONTCACHE)) return -1;
17653+
#endif
1764917654
#ifdef RWF_APPEND
1765017655
if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1;
1765117656
#endif

0 commit comments

Comments
 (0)