Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/internet/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pyc

ó
[³XMc@sÖdZddlZddlZyddlZWnek
rGdZnXddlmZmZddl	m
Z
d„Zd„Zedkrœd„Z
Znd„Z
d	„Zd
„Zd„Zdd
ddgZdS(s<
Utility functions for dealing with POSIX file descriptors.
iÿÿÿÿN(tCONNECTION_LOSTtCONNECTION_DONE(tplatformTypecCs<tj|tjƒ}|tjB}tj|tj|ƒdS(s.
    Make a file descriptor non-blocking.
    N(tfcntltF_GETFLtost
O_NONBLOCKtF_SETFL(tfdtflags((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pytsetNonBlockings
cCs=tj|tjƒ}|tj@}tj|tj|ƒdS(s*
    Make a file descriptor blocking.
    N(RRRRR(RR	((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pytsetBlockingscCsdS(N(tNone(R((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pyt<lambda>*scCs<tj|tjƒ}|tjB}tj|tj|ƒdS(s7
        Make a file descriptor close-on-exec.
        N(RtF_GETFDt
FD_CLOEXECtF_SETFD(RR	((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pyt_setCloseOnExec,s
cCs=tj|tjƒ}|tj@}tj|tj|ƒdS(s7
        Make a file descriptor close-on-exec.
        N(RRRR(RR	((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pyt_unsetCloseOnExec5scCsqytj|dƒ}Wn@ttfk
rX}|jdtjtjfkrQdStSnX|sct	S||ƒdS(s
    Read from file descriptor, calling callback with resulting data.

    If successful, call 'callback' with a single argument: the
    resulting data.

    Returns same thing FileDescriptor.doRead would: CONNECTION_LOST,
    CONNECTION_DONE, or None.

    @type fd: C{int}
    @param fd: non-blocking file descriptor to be read from.
    @param callback: a callable which accepts a single argument. If
    data is read from the file descriptor it will be called with this
    data. Handling exceptions from calling the callback is up to the
    caller.

    Note that if the descriptor is still connected but no data is read,
    None will be returned but callback will not be called.

    @return: CONNECTION_LOST on error, CONNECTION_DONE when fd is
    closed, otherwise None.
    i iN(
RtreadtOSErrortIOErrortargsterrnotEAGAINtEINTRRR(Rtcallbacktoutputtioe((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pyt
readFromFD>scCsTytj||ƒSWn9ttfk
rO}|jtjtjfkrKdStSXdS(s>
    Write data to file descriptor.

    Returns same thing FileDescriptor.writeSomeData would.

    @type fd: C{int}
    @param fd: non-blocking file descriptor to be written to.
    @type data: C{str} or C{buffer}
    @param data: bytes to write to fd.

    @return: number of bytes written, or CONNECTION_LOST.
    iN(RtwriteRRRRRR(Rtdatatio((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pyt	writeToFDas
R
RRR!(t__doc__RRRtImportErrorRttwisted.internet.mainRRttwisted.python.runtimeRR
RRRRR!t__all__(((s:/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.pyt<module>s"

									#