diff --git a/Doc/library/os.rst b/Doc/library/os.rst index dfe5ef0726ff7d..e1da9e5d70aaf0 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1589,6 +1589,7 @@ or `the MSDN `_ on Windo - :data:`RWF_DSYNC` - :data:`RWF_SYNC` - :data:`RWF_APPEND` + - :data:`RWF_ATOMIC` Return the total number of bytes actually written. @@ -1638,6 +1639,16 @@ or `the MSDN `_ on Windo .. versionadded:: 3.10 +.. data:: RWF_ATOMIC + + Ensure the atomicity of :func:`os.pwritev` write operation. The behavior of + :data:`RWF_ATOMIC` will not take effect on unsupported hardware or file systems. + + .. availability:: Linux >= 6.11. + + .. versionadded:: next + + .. function:: read(fd, n, /) Read at most *n* bytes from file descriptor *fd*. diff --git a/Misc/NEWS.d/next/Library/2024-12-13-21-55-13.gh-issue-127921.ESmy45.rst b/Misc/NEWS.d/next/Library/2024-12-13-21-55-13.gh-issue-127921.ESmy45.rst new file mode 100644 index 00000000000000..4bf0a71cb094b7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-12-13-21-55-13.gh-issue-127921.ESmy45.rst @@ -0,0 +1 @@ +Add the :data:`~os.RWF_ATOMIC` constant to the :mod:`os` module. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6eb7054b566e3f..6b0393b81794f3 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -17468,6 +17468,9 @@ all_ins(PyObject *m) #ifdef RWF_APPEND if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1; #endif +#ifdef RWF_ATOMIC + if (PyModule_AddIntConstant(m, "RWF_ATOMIC", RWF_ATOMIC)) return -1; +#endif /* constants for splice */ #if defined(HAVE_SPLICE) && defined(__linux__)