##// END OF EJS Templates
osutil: do not abort loading pure module just because libc has no recvmsg()...
Yuya Nishihara -
r27971:f7d0c28d stable
parent child Browse files
Show More
@@ -104,9 +104,15 b" if os.name != 'nt':"
104 ]
104 ]
105
105
106 _libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
106 _libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
107 _recvmsg = _libc.recvmsg
107 _recvmsg = getattr(_libc, 'recvmsg', None)
108 _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
108 if _recvmsg:
109 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr), ctypes.c_int)
109 _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
110 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr),
111 ctypes.c_int)
112 else:
113 # recvmsg isn't always provided by libc; such systems are unsupported
114 def _recvmsg(sockfd, msg, flags):
115 raise NotImplementedError('unsupported platform')
110
116
111 def _CMSG_FIRSTHDR(msgh):
117 def _CMSG_FIRSTHDR(msgh):
112 if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
118 if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
General Comments 0
You need to be logged in to leave comments. Login now