Skip to content

Commit d745b60

Browse files
authored
gh-143474: Add os.RWF_ATOMIC constant (GH-143475)
1 parent 71119a1 commit d745b60

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

Doc/library/os.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,15 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15561556
.. versionadded:: 3.15
15571557

15581558

1559+
.. data:: RWF_ATOMIC
1560+
1561+
Write data atomically. Requires alignment to the device's atomic write unit.
1562+
1563+
.. availability:: Linux >= 6.11
1564+
1565+
.. versionadded:: next
1566+
1567+
15591568
.. function:: ptsname(fd, /)
15601569

15611570
Return the name of the slave pseudo-terminal device associated with the
@@ -1598,6 +1607,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15981607
- :data:`RWF_SYNC`
15991608
- :data:`RWF_APPEND`
16001609
- :data:`RWF_DONTCACHE`
1610+
- :data:`RWF_ATOMIC`
16011611

16021612
Return the total number of bytes actually written.
16031613

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

Modules/clinic/posixmodule.c.h

Lines changed: 2 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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12863,14 +12863,15 @@ The flags argument contains a bitwise OR of zero or more of the following flags:
1286312863
- RWF_SYNC
1286412864
- RWF_APPEND
1286512865
- RWF_DONTCACHE
12866+
- RWF_ATOMIC
1286612867

1286712868
Using non-zero flags requires Linux 4.7 or newer.
1286812869
[clinic start generated code]*/
1286912870

1287012871
static Py_ssize_t
1287112872
os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
1287212873
int flags)
12873-
/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=664a67626d485665]*/
12874+
/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=7de72245873f56bf]*/
1287412875
{
1287512876
Py_ssize_t cnt;
1287612877
Py_ssize_t result;
@@ -18120,6 +18121,9 @@ all_ins(PyObject *m)
1812018121
#ifdef RWF_DONTCACHE
1812118122
if (PyModule_AddIntConstant(m, "RWF_DONTCACHE", RWF_DONTCACHE)) return -1;
1812218123
#endif
18124+
#ifdef RWF_ATOMIC
18125+
if (PyModule_AddIntConstant(m, "RWF_ATOMIC", RWF_ATOMIC)) return -1;
18126+
#endif
1812318127
#ifdef RWF_APPEND
1812418128
if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1;
1812518129
#endif

0 commit comments

Comments
 (0)