Skip to content
Snippets Groups Projects
Commit f7d0c28d authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

osutil: do not abort loading pure module just because libc has no recvmsg()

On Solaris, recvmsg() is provided by libsocket.so. We could try hard to look
for the library which provides 'recvmsg' symbol, but it would make little sense
now since recvfds() won't work anyway on Solaris. So this patch just disables
_recvmsg() on such platforms.

Thanks to FUJIWARA Katsunori for spotting this problem.
parent 3d23700c
No related branches found
No related tags found
No related merge requests found
......@@ -104,9 +104,15 @@
]
_libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
_recvmsg = _libc.recvmsg
_recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
_recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr), ctypes.c_int)
_recvmsg = getattr(_libc, 'recvmsg', None)
if _recvmsg:
_recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
_recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr),
ctypes.c_int)
else:
# recvmsg isn't always provided by libc; such systems are unsupported
def _recvmsg(sockfd, msg, flags):
raise NotImplementedError('unsupported platform')
def _CMSG_FIRSTHDR(msgh):
if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment