From: RUANG (James Roy) Date: Thu, 24 Apr 2025 21:06:42 +0000 (+0800) Subject: gh-127385: Add F_DUPFD_QUERY to fcntl (GH-127386) X-Git-Tag: v3.14.0b1~317 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e18a9dce2af361d9974812e6ffa22bf3970d057;p=thirdparty%2FPython%2Fcpython.git gh-127385: Add F_DUPFD_QUERY to fcntl (GH-127386) --- diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst index a9fbab3d0bbf..b4ea3e7e31bd 100644 --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -79,6 +79,10 @@ descriptor. On macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` and ``F_SETNOSIGPIPE`` constant. +.. versionchanged:: next + On Linux >= 6.1, the :mod:`!fcntl` module exposes the ``F_DUPFD_QUERY`` + to query a file descriptor pointing to the same file. + The module defines the following functions: diff --git a/Misc/NEWS.d/next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst b/Misc/NEWS.d/next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst new file mode 100644 index 000000000000..3770d586ba46 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst @@ -0,0 +1 @@ +Add the ``F_DUPFD_QUERY`` constant to the :mod:`fcntl` module. diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index 81a1e1c22c8a..7e14e6bc3a52 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -559,6 +559,9 @@ all_ins(PyObject* m) #ifdef F_NOTIFY if (PyModule_AddIntMacro(m, F_NOTIFY)) return -1; #endif +#ifdef F_DUPFD_QUERY + if (PyModule_AddIntMacro(m, F_DUPFD_QUERY)) return -1; +#endif /* Old BSD flock(). */ #ifdef F_EXLCK if (PyModule_AddIntMacro(m, F_EXLCK)) return -1;