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