2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00
criu/test/inhfd/socket.py
Andrei Vagin 5aa72e7237 py: Reformat everything into pep8 style
As discussed on the mailing list, current .py files formatting does not
conform to the world standard, so we should better reformat it. For this
the yapf tool is used. The command I used was

  yapf -i $(find -name *.py)

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2019-09-07 15:59:56 +03:00

22 lines
512 B
Python
Executable File

import socket
import os
def create_fds():
(sk1, sk2) = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
(sk3, sk4) = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
return [(sk1.makefile("wb"), sk2.makefile("rb")),
(sk3.makefile("wb"), sk4.makefile("rb"))]
def __sock_ino(sockf):
return os.fstat(sockf.fileno()).st_ino
def filename(sockf):
return 'socket:[%d]' % __sock_ino(sockf)
def dump_opts(sockf):
return ['--external', 'unix[%d]' % __sock_ino(sockf)]