[CRIU] [PATCH] test/inhfd: use os.fdopen instead of a home-made class
Andrey Vagin
avagin at openvz.org
Wed Dec 23 05:33:23 PST 2015
From: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/inhfd/pipe.py | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/test/inhfd/pipe.py b/test/inhfd/pipe.py
index b355af8..6e44528 100755
--- a/test/inhfd/pipe.py
+++ b/test/inhfd/pipe.py
@@ -1,28 +1,8 @@
import os
-class pipef:
- def __init__(self, fd):
- self.__fd = fd
-
- def read(self, blen):
- return os.read(self.__fd, blen)
-
- def write(self, msg):
- return os.write(self.__fd, msg)
-
- def flush(self):
- pass
-
- def close(self):
- os.close(self.__fd)
- self.__fd = -1
-
- def fileno(self):
- return self.__fd
-
def create_fds():
(fd1, fd2) = os.pipe()
- return (pipef(fd2), pipef(fd1))
+ return (os.fdopen(fd2, "w"), os.fdopen(fd1, "r"))
def filename(pipef):
return 'pipe:[%d]' % os.fstat(pipef.fileno()).st_ino
--
2.4.3
More information about the CRIU
mailing list