
    i                     6    e d           ZddlZ e d          ZddlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ ej        Zg d
Z ee e            e ee                     d Zej        Zd Zej        Zd Zd Zej        Zd Zej        ZddZdS )os    Nsocket)S_ISREG)greenio)	get_errno)greenthread)hubs)slurp_properties)fdopenreadwritewaitwaitpidopen)ignoresrckeysc                     t          | t                    st          d| z            	 t          j        | g|R i |S # t
          $ r}t          |j         d}~ww xY w)zrfdopen(fd [, mode='r' [, bufsize]]) -> file_object

    Return an open file object connected to a file descriptor.zfd should be int, not %rN)
isinstanceint	TypeErrorr   	GreenPipeOSErrorargs)fdr   kwes       </usr/local/lib/python3.11/dist-packages/eventlet/green/os.pyr   r      s|     b# 92R7888 1d111b111   qvs   > 
AAAc                    	 t                               |           j        }t          |          s.	 t	          j        | d           n# t          j        $ r Y dS w xY w	 t          | |          S # t          $ rK}t          |          t          j        k    rY d}~dS t          |          t          j        k    r Y d}~nd}~ww xY w)z;read(fd, buffersize) -> string

    Read a file descriptor.T)r    N)os_origstatst_moder   r	   
trampolineIOClosed__original_read__r   r   errnoEPIPEEAGAIN)r   nr"   r   s       r   r   r   %   s     ,,r""*w 	.....=   rr	$R+++ 	 	 	||u{**rrrrr||u|++ ,++++	s/   A AAA/ /
C9B?B??Cc                 ^   	 t                               |           j        }t          |          s.	 t	          j        | d           n# t          j        $ r Y dS w xY w	 t          | |          S # t          $ r2}t          |          t          j        t          j        fvr Y d}~nd}~ww xY w)zPwrite(fd, string) -> byteswritten

    Write a string to a file descriptor.
    T)r   r   N)r    r!   r"   r   r	   r#   r$   __original_write__r   r   r&   r(   r'   )r   str"   r   s       r   r   r   ?   s    
 ,,r""*w 	$/////=   qq	%b"--- 	 	 	||EL%+#>>> ?>>>>	s)   A AAA/ /
B+9(B&&B+c                  "    t          dd          S )zDwait() -> (pid, status)

    Wait for completion of a child process.r   )r        r   r   r   U   s     1a==r/   c                     |t           j        z  dk    rt          | |          S |t           j        z  }	 t          | |          \  }}|r
|dk    r||fS t          j        d           4)zjwaitpid(...)
    waitpid(pid, options) -> (pid, status)

    Wait for completion of a given child process.r   Tg{Gz?)r    WNOHANG__original_waitpid__r   sleep)pidoptionsnew_optionsrpidstatuss        r   r   r   _   sz    
  A%%#C111/	$/[AALD& $!V|#d###		$r/     c                     t          |           j        dk    r|||df\  } }}}|t          | |||          }nt          | ||          }t          j        |           |S )zt Wrap os.open
        This behaves identically, but collaborates with
        the hub's notify_opened protocol.
    _NormalAccessorN)dir_fd)type__name____original_open__r	   notify_opened)fileflagsmoder<   r   s        r   r   r   r   su     Dzz///$)4$=!eT6tUD@@@tUD11rIr/   )r9   N)
__import__r    r&   r   r!   r   eventletr   eventlet.supportr   r   r	   eventlet.patcherr
   __all____patched__globalsdirr   r   r%   r   r+   r   r   r2   r   r?   r.   r/   r   <module>rL      so  
*T

 	H		             & & & & & &                   - - - - - -
/DDD  GIICLL	   	 	 	 L   . ]   ,    $ $ $  L      r/   