comparison mercurial/pure/osutil.py @ 27512:e2aa9c4030c4

osutil: c_ssize_t is only available in Python >= 2.7
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 22 Dec 2015 21:38:06 -0800
parents e517a89c24e1
children 051b0dcec98b
comparison
equal deleted inserted replaced
27511:44a596a8bed1 27512:e2aa9c4030c4
103 ('cmsg_data', ctypes.c_ubyte * 0), 103 ('cmsg_data', ctypes.c_ubyte * 0),
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 = _libc.recvmsg
108 _recvmsg.restype = ctypes.c_ssize_t 108 _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
109 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr), ctypes.c_int) 109 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr), ctypes.c_int)
110 110
111 def _CMSG_FIRSTHDR(msgh): 111 def _CMSG_FIRSTHDR(msgh):
112 if msgh.msg_controllen < ctypes.sizeof(_cmsghdr): 112 if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
113 return 113 return