mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
202 Additional newline in a group of imports. I100 Import statements are in the wrong order. Signed-off-by: Andrei Vagin <avagin@gmail.com>
29 lines
630 B
Python
Executable File
29 lines
630 B
Python
Executable File
import ctypes
|
|
import os
|
|
libc = ctypes.CDLL(None)
|
|
|
|
|
|
def memfd_create(name, flags):
|
|
return libc.memfd_create(name.encode('utf8'), flags)
|
|
|
|
|
|
def create_fds():
|
|
def create_memfd_pair(name):
|
|
fd = memfd_create(name, 0)
|
|
fw = open('/proc/self/fd/{}'.format(fd), 'wb')
|
|
fr = open('/proc/self/fd/{}'.format(fd), 'rb')
|
|
os.close(fd)
|
|
return (fw, fr)
|
|
|
|
return [create_memfd_pair("name{}".format(i)) for i in range(10)]
|
|
|
|
|
|
def filename(f):
|
|
name = os.readlink('/proc/self/fd/{}'.format(f.fileno()))
|
|
name = name.replace(' (deleted)', '')
|
|
return name
|
|
|
|
|
|
def dump_opts(sockf):
|
|
return []
|