summaryrefslogtreecommitdiff
path: root/linuxnamespaces/syscalls.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-05-20 06:37:22 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-05-20 06:37:22 +0200
commitceed94872fb31e766d97426cb05b244782794f84 (patch)
tree80b60ccab2a7e5dbab3459ff21233052957e4d07 /linuxnamespaces/syscalls.py
parent77383a70d81b91d5e0134941028e56a15d0a902c (diff)
downloadpython-linuxnamespaces-ceed94872fb31e766d97426cb05b244782794f84.tar.gz
Revert "add a splice syscall wrapper"
os.splice from Python >= 3.10 is good enough. This reverts commit 056c1f964f55adedc17f8d7bddef1f48c73852c7.
Diffstat (limited to 'linuxnamespaces/syscalls.py')
-rw-r--r--linuxnamespaces/syscalls.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/linuxnamespaces/syscalls.py b/linuxnamespaces/syscalls.py
index 9d2b1ba..dd4a332 100644
--- a/linuxnamespaces/syscalls.py
+++ b/linuxnamespaces/syscalls.py
@@ -352,16 +352,6 @@ class PrctlOption(enum.IntEnum):
PR_CAP_AMBIENT = 47
-class SpliceFlags(enum.IntFlag):
- """This value may be supplied to splice(2) as flags."""
-
- NONE = 0
- MOVE = 1
- NONBLOCK = 2
- MORE = 4
- GIFT = 8
-
-
class UmountFlags(enum.IntFlag):
"""This value may be supplied to umount2(2) as flags."""
@@ -696,48 +686,6 @@ def setns(fd: int, nstype: CloneFlags = CloneFlags.NONE) -> None:
call_libc("setns", fd, int(nstype))
-@dataclasses.dataclass
-class SpliceResult:
- """Return type for splice(2) capturing out arguments."""
-
- copied: int
- off_int: int | None
- off_out: int | None
-
-
-def splice(
- fd_in: int,
- off_in: int | None,
- fd_out: int,
- off_out: int | None,
- length: int,
- flags: SpliceFlags = SpliceFlags.NONE,
-) -> SpliceResult:
- """Python wrapper for splice(2). Unlike the syscall, the offset arguments
- are not output arguments. Instead, they're returned as SpliceResult.
- """
- if fd_in < 0 or fd_out < 0:
- raise ValueError("invalid file descriptor")
- if off_in is None:
- p_off_in = None
- else:
- c_off_in = ctypes.c_int64(off_in)
- p_off_in = ctypes.byref(c_off_in)
- if off_out is None:
- p_off_out = None
- else:
- c_off_out = ctypes.c_int64(off_out)
- p_off_out = ctypes.byref(c_off_out)
- ret = call_libc(
- "splice", fd_in, p_off_in, fd_out, p_off_out, length, int(flags)
- )
- return SpliceResult(
- ret,
- None if off_in is None else c_off_in.value,
- None if off_out is None else c_off_out.value,
- )
-
-
def umount(
path: PathConvertible, flags: UmountFlags = UmountFlags.NONE
) -> None: