î
yË XÐ  ã               @   sÈ   d  d l  Z  d  d l Z d  d l Z y d  d l Z d  d l Z Wn e k
 rZ e ‚ Yn Xd Z e j d k  s e j	 e k rŽ e d ƒ ‚ n  e j
 e j j d	 ƒ d
 d ƒZ e j Z d d „  Z d S)é    NÚdarwinÚfreebsdÚ	dragonflyÚlinux2é   é   z)sendfile isn't supported on this platformÚcÚ	use_errnoTc       
      C   s+  t  j d k rÎ t j t j t j t j t j ƒ t j t j g t _ t j | ƒ } t | |  | | d  d ƒ } | d k rÇ t j	 ƒ  } | t
 j k r¬ | j d  k	 r¬ | j St | t j | ƒ ƒ ‚ n  | j St  j d k r¢t j t j t j t j t j t j t j ƒ t j g t _ t j ƒ  } t | |  | | d  | d ƒ } | d k r›t j	 ƒ  } | t
 j k r€| j d  k	 r€| j St | t j | ƒ ƒ ‚ n  | j St j t j t j t j ƒ t j g t _ t j | ƒ } t |  | | | ƒ }	 |	 d	 k r#t j	 ƒ  } t | t j | ƒ ƒ ‚ n  |	 Sd  S)
Nr   r   é   r   r   éÿÿÿÿ)r   r   r   r   )ÚsysÚplatformÚctypesÚc_intÚc_uint64ÚPOINTERÚc_voidpÚ	_sendfileÚargtypesÚ	get_errnoÚerrnoÚEAGAINÚvalueÚOSErrorÚosÚstrerrorÚc_size_t)
ÚfdoutZfdinÚoffsetÚnbytesZ_nbytesÚresultÚeZ_sbytesÚ_offsetZsent© r#   úG/home/ubuntu/projects/ifolica/build/gunicorn/gunicorn/http/_sendfile.pyÚsendfile    s@    r%   )zdarwinzfreebsdz	dragonflyr   )r   r   )r   r   r   r   Úctypes.utilÚMemoryErrorÚImportErrorZSUPPORTED_PLATFORMSÚversion_infor   ÚCDLLÚutilÚfind_libraryZ_libcr%   r   r#   r#   r#   r$   Ú<module>   s"      !	