Calling L{sendmsg} with SOL_SOCKET, SCM_RIGHTS, and a platform-endian packed file descriptor number should send that file descriptor to a different process, where it can be retrieved by using L{recv1msg}.
(self)
| 275 | |
| 276 | @inlineCallbacks |
| 277 | def test_sendSubProcessFD(self): |
| 278 | """ |
| 279 | Calling L{sendmsg} with SOL_SOCKET, SCM_RIGHTS, and a platform-endian |
| 280 | packed file descriptor number should send that file descriptor to a |
| 281 | different process, where it can be retrieved by using L{recv1msg}. |
| 282 | """ |
| 283 | sspp = _spawn("pullpipe", self.output.fileno()) |
| 284 | yield sspp.started |
| 285 | pipeOut, pipeIn = _makePipe() |
| 286 | self.addCleanup(pipeOut.close) |
| 287 | self.addCleanup(pipeIn.close) |
| 288 | |
| 289 | with pipeIn: |
| 290 | sendmsg( |
| 291 | self.input, |
| 292 | b"blonk", |
| 293 | [(SOL_SOCKET, SCM_RIGHTS, pack("i", pipeIn.fileno()))], |
| 294 | ) |
| 295 | |
| 296 | yield sspp.stopped |
| 297 | self.assertEqual(read(pipeOut.fileno(), 1024), b"Test fixture data: blonk.\n") |
| 298 | # Make sure that the pipe is actually closed now. |
| 299 | self.assertEqual(read(pipeOut.fileno(), 1024), b"") |
| 300 | |
| 301 | |
| 302 | @skipIf(nonUNIXSkip, "Platform does not support AF_UNIX sockets") |
nothing calls this directly
no test coverage detected