mercurial/pure/osutil.py
changeset 43077 687b865b95ad
parent 43076 2372284d9457
child 43089 c59eb1560c44
equal deleted inserted replaced
43076:2372284d9457 43077:687b865b95ad
    72     posixfile = open
    72     posixfile = open
    73 
    73 
    74     _SCM_RIGHTS = 0x01
    74     _SCM_RIGHTS = 0x01
    75     _socklen_t = ctypes.c_uint
    75     _socklen_t = ctypes.c_uint
    76 
    76 
    77     if pycompat.sysplatform.startswith('linux'):
    77     if pycompat.sysplatform.startswith(b'linux'):
    78         # socket.h says "the type should be socklen_t but the definition of
    78         # socket.h says "the type should be socklen_t but the definition of
    79         # the kernel is incompatible with this."
    79         # the kernel is incompatible with this."
    80         _cmsg_len_t = ctypes.c_size_t
    80         _cmsg_len_t = ctypes.c_size_t
    81         _msg_controllen_t = ctypes.c_size_t
    81         _msg_controllen_t = ctypes.c_size_t
    82         _msg_iovlen_t = ctypes.c_size_t
    82         _msg_iovlen_t = ctypes.c_size_t
   120             ctypes.c_int,
   120             ctypes.c_int,
   121         )
   121         )
   122     else:
   122     else:
   123         # recvmsg isn't always provided by libc; such systems are unsupported
   123         # recvmsg isn't always provided by libc; such systems are unsupported
   124         def _recvmsg(sockfd, msg, flags):
   124         def _recvmsg(sockfd, msg, flags):
   125             raise NotImplementedError('unsupported platform')
   125             raise NotImplementedError(b'unsupported platform')
   126 
   126 
   127     def _CMSG_FIRSTHDR(msgh):
   127     def _CMSG_FIRSTHDR(msgh):
   128         if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
   128         if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
   129             return
   129             return
   130         cmsgptr = ctypes.cast(msgh.msg_control, ctypes.POINTER(_cmsghdr))
   130         cmsgptr = ctypes.cast(msgh.msg_control, ctypes.POINTER(_cmsghdr))