HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/thread-self/root/lib/python3/dist-packages/twisted/internet/__pycache__/fdesc.cpython-38.pyc
U


W[��@s�dZddlZddlZzddlZWnek
r8dZYnXddlmZmZdd�Zdd�Z	edkrpdd	�Z
Znd
d�Z
dd
�Zdd�Zdd�Z
ddddgZdS)z<
Utility functions for dealing with POSIX file descriptors.
�N)�CONNECTION_LOST�CONNECTION_DONEcCs,t�|tj�}|tjB}t�|tj|�dS)zP
    Set the file description of the given file descriptor to non-blocking.
    N��fcntlZF_GETFL�os�
O_NONBLOCKZF_SETFL��fd�flags�r�8/usr/lib/python3/dist-packages/twisted/internet/fdesc.py�setNonBlockings
r
cCs.t�|tj�}|tj@}t�|tj|�dS)zL
    Set the file description of the given file descriptor to blocking.
    Nrrrrr�setBlockingsrcCsdS)Nr)r	rrr�<lambda>*�rcCs,t�|tj�}|tjB}t�|tj|�dS�z7
        Make a file descriptor close-on-exec.
        N�rZF_GETFDZ
FD_CLOEXECZF_SETFDrrrr�_setCloseOnExec,s
rcCs.t�|tj�}|tj@}t�|tj|�dSrrrrrr�_unsetCloseOnExec5src
Csxzt�|d�}WnRttfk
rb}z0|jdtjtjfkrFWY�dStWY�SW5d}~XYnX|slt	S||�dS)a
    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 rN)
r�read�OSError�IOError�args�errno�EAGAIN�EINTRrr)r	�callback�outputZioerrr�
readFromFD>s
rc
Cs^zt�||�WSttfk
rX}z(|jtjtjfkr@WY�dStWY�Sd}~XYnXdS)a>
    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.
    rN)r�writerrrrrr)r	�data�iorrr�	writeToFDas

r")�__doc__rrr�ImportErrorZtwisted.internet.mainrrr
rrrrr"�__all__rrrr�<module>s 
				#