MCPcopy Index your code
hub / github.com/python/cpython / sendfds

Function sendfds

Lib/multiprocessing/reduction.py:142–148  ·  view source on GitHub ↗

Send an array of fds over an AF_UNIX socket.

(sock, fds)

Source from the content-addressed store, hash-verified

140 import array
141
142 def sendfds(sock, fds):
143 '''Send an array of fds over an AF_UNIX socket.'''
144 fds = array.array('i', fds)
145 msg = bytes([len(fds) % 256])
146 sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)])
147 if sock.recv(1) != b'A':
148 raise RuntimeError('did not receive acknowledgement of fd')
149
150 def recvfds(sock, size):
151 '''Receive an array of fds over an AF_UNIX socket.'''

Callers 1

send_handleFunction · 0.85

Calls 2

sendmsgMethod · 0.80
recvMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…