From d7f715c0299a0f71c1b07fdda456264d8ad99928 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 6 Feb 2022 15:49:24 +0000 Subject: [PATCH 1/3] shutil Lib enabling sendfile on solaris systems as it supports copy between file descriptors. --- Lib/shutil.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/shutil.py b/Lib/shutil.py index 949e024853c1d2..9704df918bce50 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -42,7 +42,8 @@ COPY_BUFSIZE = 1024 * 1024 if _WINDOWS else 64 * 1024 # This should never be removed, see rationale in: # https://bugs.python.org/issue43743#msg393429 -_USE_CP_SENDFILE = hasattr(os, "sendfile") and sys.platform.startswith("linux") +# senfile on solaris systems is capable of copying on regular file descriptors. +_USE_CP_SENDFILE = hasattr(os, "sendfile") and (sys.platform.startswith("linux") or sys.platform.startswith("sunos")) _HAS_FCOPYFILE = posix and hasattr(posix, "_fcopyfile") # macOS # CMD defaults in Windows 10 @@ -106,7 +107,7 @@ def _fastcopy_fcopyfile(fsrc, fdst, flags): def _fastcopy_sendfile(fsrc, fdst): """Copy data from one regular mmap-like fd to another by using high-performance sendfile(2) syscall. - This should work on Linux >= 2.6.33 only. + This should work on Linux >= 2.6.33 and Solaris systems. """ # Note: copyfileobj() is left alone in order to not introduce any # unexpected breakage. Possible risks by using zero-copy calls From d651b5c679556aa257ced96e7a28de4a6b2ae169 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 6 Feb 2022 15:53:32 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst diff --git a/Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst b/Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst new file mode 100644 index 00000000000000..7076f849dc6ec8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst @@ -0,0 +1 @@ +Enabling ``os.sendfile`` on shlib on Solaris based systems. \ No newline at end of file From db0b714a8ed3822f70a8a6be0129d3c9d445430f Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 13 Feb 2022 06:46:50 +0000 Subject: [PATCH 3/3] changes from feedback --- Lib/shutil.py | 2 +- .../next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/shutil.py b/Lib/shutil.py index 9704df918bce50..66be758757b0ea 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -43,7 +43,7 @@ # This should never be removed, see rationale in: # https://bugs.python.org/issue43743#msg393429 # senfile on solaris systems is capable of copying on regular file descriptors. -_USE_CP_SENDFILE = hasattr(os, "sendfile") and (sys.platform.startswith("linux") or sys.platform.startswith("sunos")) +_USE_CP_SENDFILE = hasattr(os, "sendfile") and sys.platform.startswith(("linux", "sunos")) _HAS_FCOPYFILE = posix and hasattr(posix, "_fcopyfile") # macOS # CMD defaults in Windows 10 diff --git a/Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst b/Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst index 7076f849dc6ec8..c29457c80859ea 100644 --- a/Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst +++ b/Misc/NEWS.d/next/Library/2022-02-06-15-53-30.bpo-46658.oRp0C-.rst @@ -1 +1 @@ -Enabling ``os.sendfile`` on shlib on Solaris based systems. \ No newline at end of file +Enable use of :func:`os.sendfile` in :mod:`shlib` on Solaris based systems. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy