MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_cid

Function get_cid

Lib/test/test_socket.py:92–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90 return decorator
91
92def get_cid():
93 if fcntl is None:
94 return None
95 if not hasattr(socket, 'IOCTL_VM_SOCKETS_GET_LOCAL_CID'):
96 return None
97 try:
98 with open("/dev/vsock", "rb") as f:
99 r = fcntl.ioctl(f, socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID, " ")
100 except OSError:
101 return None
102 else:
103 return struct.unpack("I", r)[0]
104
105def _have_socket_can():
106 """Check whether CAN sockets are supported on this host."""

Callers 2

_have_socket_vsockFunction · 0.85
clientSetUpMethod · 0.85

Calls 4

hasattrFunction · 0.85
ioctlMethod · 0.80
openFunction · 0.50
unpackMethod · 0.45

Tested by

no test coverage detected