MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _fastcopy_fcopyfile

Function _fastcopy_fcopyfile

tools/python-3.11.9-amd64/Lib/shutil.py:86–104  ·  view source on GitHub ↗

Copy a regular file content or metadata by using high-performance fcopyfile(3) syscall (macOS).

(fsrc, fdst, flags)

Source from the content-addressed store, hash-verified

84 """
85
86def _fastcopy_fcopyfile(fsrc, fdst, flags):
87 """Copy a regular file content or metadata by using high-performance
88 fcopyfile(3) syscall (macOS).
89 """
90 try:
91 infd = fsrc.fileno()
92 outfd = fdst.fileno()
93 except Exception as err:
94 raise _GiveupOnFastCopy(err) # not a regular file
95
96 try:
97 posix._fcopyfile(infd, outfd, flags)
98 except OSError as err:
99 err.filename = fsrc.name
100 err.filename2 = fdst.name
101 if err.errno in {errno.EINVAL, errno.ENOTSUP}:
102 raise _GiveupOnFastCopy(err)
103 else:
104 raise err from None
105
106def _fastcopy_sendfile(fsrc, fdst):
107 """Copy data from one regular mmap-like fd to another by using

Callers 1

copyfileFunction · 0.85

Calls 2

_GiveupOnFastCopyClass · 0.85
filenoMethod · 0.45

Tested by

no test coverage detected