equal
deleted
inserted
replaced
3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others |
3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others |
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from __future__ import absolute_import |
8 from __future__ import absolute_import, division |
9 |
9 |
10 import ctypes |
10 import ctypes |
11 import ctypes.util |
11 import ctypes.util |
12 import os |
12 import os |
13 import socket |
13 import socket |
147 return [] |
147 return [] |
148 if (cmsg.cmsg_level != socket.SOL_SOCKET or |
148 if (cmsg.cmsg_level != socket.SOL_SOCKET or |
149 cmsg.cmsg_type != _SCM_RIGHTS): |
149 cmsg.cmsg_type != _SCM_RIGHTS): |
150 return [] |
150 return [] |
151 rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int)) |
151 rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int)) |
152 rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) / |
152 rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) // |
153 ctypes.sizeof(ctypes.c_int)) |
153 ctypes.sizeof(ctypes.c_int)) |
154 return [rfds[i] for i in pycompat.xrange(rfdscount)] |
154 return [rfds[i] for i in pycompat.xrange(rfdscount)] |
155 |
155 |
156 else: |
156 else: |
157 import msvcrt |
157 import msvcrt |