comparison mercurial/cext/osutil.pyi @ 49275:c6a3243567b6

chg: replace mercurial.util.recvfds() by simpler pure Python implementation On Python 3, we have socket.socket.recvmsg(). This makes it possible to receive FDs in pure Python code. The new code behaves like the previous implementations, except that it’s more strict about the format of the ancillary data. This works because we know in which format the FDs are passed. Because the code is (and always has been) specific to chg (payload is 1 byte, number of passed FDs is limited) and we now have only one implementation and the code is very short, I decided to stop exposing a function in mercurial.util. Note on terminology: The SCM_RIGHTS mechanism is used to share open file descriptions to another process over a socket. The sending side passes an array of file descriptors and the receiving side receives an array of file descriptors. The file descriptors are different in general on both sides but refer to the same open file descriptions. The two terms are often conflated, even in the official documentation. That’s why I used “FD” above, which could mean both “file descriptor” and “file description”.
author Manuel Jacob <me@manueljacob.de>
date Thu, 02 Jun 2022 23:57:56 +0200
parents 8dca9051a859
children b6fc602e074a
comparison
equal deleted inserted replaced
49273:34020d1f1635 49275:c6a3243567b6
16 st_ctime: int 16 st_ctime: int
17 17
18 def listdir(path: bytes, st: bool, skip: bool) -> List[stat]: ... 18 def listdir(path: bytes, st: bool, skip: bool) -> List[stat]: ...
19 def posixfile(name: AnyStr, mode: bytes, buffering: int) -> IO: ... 19 def posixfile(name: AnyStr, mode: bytes, buffering: int) -> IO: ...
20 def statfiles(names: Sequence[bytes]) -> List[stat]: ... 20 def statfiles(names: Sequence[bytes]) -> List[stat]: ...
21 def recvfds(sockfd: int) -> List[int]: ...
22 def setprocname(name: bytes) -> None: ... 21 def setprocname(name: bytes) -> None: ...
23 def getfstype(path: bytes) -> bytes: ... 22 def getfstype(path: bytes) -> bytes: ...
24 def getfsmountpoint(path: bytes) -> bytes: ... 23 def getfsmountpoint(path: bytes) -> bytes: ...
25 def unblocksignal(sig: int) -> None: ... 24 def unblocksignal(sig: int) -> None: ...
26 def isgui() -> bool: ... 25 def isgui() -> bool: ...