diff options
Diffstat (limited to 'lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/pullpipe.py')
-rwxr-xr-x | lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/pullpipe.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/pullpipe.py b/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/pullpipe.py deleted file mode 100755 index e6066627..00000000 --- a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/pullpipe.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/python -# -*- test-case-name: twisted.python.test.test_sendmsg -*- -# Copyright (c) Twisted Matrix Laboratories. -# See LICENSE for details. - -import sys, os -from struct import unpack - -# This makes me sad. Why aren't things nice? -sys.path.insert(0, __file__.rsplit('/', 4)[0]) - -from twisted.python.sendmsg import recv1msg - -def recvfd(socketfd): - """ - Receive a file descriptor from a L{send1msg} message on the given C{AF_UNIX} - socket. - - @param socketfd: An C{AF_UNIX} socket, attached to another process waiting - to send sockets via the ancillary data mechanism in L{send1msg}. - - @param fd: C{int} - - @return: a 2-tuple of (new file descriptor, description). - - @rtype: 2-tuple of (C{int}, C{str}) - """ - data, flags, ancillary = recv1msg(socketfd) - [(cmsg_level, cmsg_type, packedFD)] = ancillary - # cmsg_level and cmsg_type really need to be SOL_SOCKET / SCM_RIGHTS, but - # since those are the *only* standard values, there's not much point in - # checking. - [unpackedFD] = unpack("i", packedFD) - return (unpackedFD, data) - - -if __name__ == '__main__': - fd, description = recvfd(int(sys.argv[1])) - os.write(fd, "Test fixture data: %s.\n" % (description,)) - os.close(fd) |