MCPcopy Index your code
hub / github.com/python/cpython / _sendfile

Function _sendfile

Lib/pathlib/_os.py:87–98  ·  view source on GitHub ↗

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.

(source_fd, target_fd)

Source from the content-addressed store, hash-verified

85
86if hasattr(os, 'sendfile'):
87 def _sendfile(source_fd, target_fd):
88 """Copy data from one regular mmap-like fd to another by using
89 high-performance sendfile(2) syscall.
90 This should work on Linux >= 2.6.33 only.
91 """
92 blocksize = _get_copy_blocksize(source_fd)
93 offset = 0
94 while True:
95 sent = os.sendfile(target_fd, source_fd, offset, blocksize)
96 if sent == 0:
97 break # EOF
98 offset += sent
99else:
100 _sendfile = None
101

Callers 1

copyfileobjFunction · 0.85

Calls 2

_get_copy_blocksizeFunction · 0.85
sendfileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…