+
    Bi"                        R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
HtHtHtHt ^ RIHt ^ RIHtHtHt ]! R4      t ! R R4      tR tR	 t ! R
 R]P2                  4      t]R8X  d   ]P8                  ! 4        R# R# )z%Test program for the fcntl C module.
N)cpython_onlyget_pagesizeis_applerequires_subprocessverboseis_emscripten)import_module)TESTFNunlinkmake_bad_fdfcntlc                   ,   a  ] tR t^t o R tR tRtV tR# )BadFilec                    Wn         R # Nfn)selfr   s   &&&/usr/lib/python3.14/test/test_fcntl.py__init__BadFile.__init__   s        c                    V P                   # r   r   r   s   &r   filenoBadFile.fileno   s    wwr   r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s      r   r   c                     \        V R 4      p \        P                  W!4       VP	                  4        R#   \         d     Li ; i  TP	                  4        i ; iwb+N)openr   lockfBlockingIOErrorclosefnamecmdfs   && r   try_lockf_on_other_process_failr/      sJ    UEAA 	
	   	
	s!   5 A A AA Ac                     \        V R 4      p\        P                  W!4       \        P                  V\        P                  4       VP	                  4        R# r%   )r'   r   r(   LOCK_UNr*   r+   s   && r   try_lockf_on_other_processr2   %   s5    UEA	KK	KK5==!GGIr   c                   @  a  ] tR t^+t o R tR t]R 4       tR tR t	R t
]R 4       t]P                  ! ]P                   ! 4       P#                  R4      ;'       d    ]P$                  ! 4       R	8H  ;'       g    ]P$                  ! 4       R
8H  R4      R 4       tR t]P                  ! ]P$                  ! 4       R8H  R4      ]! 4       R 4       4       t]P                  ! ]P$                  ! 4       R8H  R4      ]! 4       R 4       4       t]R 4       t]P                  ! ]P                  R8g  R4      R 4       t]P6                  ! ]! ]R4      ;'       d
    ]! ]R4      R4      ]P                  ! ]R4      R 4       4       t]P6                  ! ]! ]R4      R4      R 4       t Rt!V t"R# ) 	TestFcntlc                    R V n         R # r   r.   r   s   &r   setUpTestFcntl.setUp-   s	    r   c                    V P                   '       d7   V P                   P                  '       g   V P                   P                  4        \        \        4       R # r   )r.   closedr*   r
   r	   r   s   &r   tearDownTestFcntl.tearDown0   s+    666$&&---FFLLNvr   c            
     ^    \         P                   R p \        P                  P                  R
4      '       g   \        '       dc   \        P                  ! R4      ^8X  d   RpRpMRpRp\        P                  ! W,           V,           R,           ^ ^ ^ \        P                  ^ 4      pM\        P                  P                  R4      '       d,   \        P                  ! R^ ^ ^ \        P                  ^ ^ 4      pMy\        P                  R9   d-   \        P                  ! R\        P                  ^ ^ ^ ^ ^ ^ 4      pM8\        P                  ! RV ,           R,           \        P                  ^ ^ ^ ^ ^ 4      pV'       d"   \        '       d   \        R	\        V4      4       V#   \         d    Rp  ELi ; i)qqlllilxxxxhhgnukfreebsdqqihhihhllliizstruct.pack: )netbsdfreebsdopenbsd)zhp-uxB	unixware7)osO_LARGEFILEAttributeErrorsysplatform
startswithr   structcalcsizepackr   F_WRLCKr   printrepr)	start_lenoff_tpid_tlockdatas       r   get_lockdataTestFcntl.get_lockdata5   s<   	NN I LL##$DEExs#q({{5=5#84#?Aq#(==!5H\\$$]33{{8Q1emmQJH\\44{{9emmQ1aANH{{4	>$#6q!QPQSTUHwotH~65  	I	s   F F,+F,c                   \        \        R 4      V n        \        P                  V P                  P	                  4       \        P
                  \        P                  4      p\        '       d   \        RV4       V P                  4       p\        P                  V P                  P	                  4       \        P                  V4      p\        '       d   \        R\        V4      4       V P                  P                  4        R# wbz#Status from fcntl with O_NONBLOCK: z!String from fcntl with F_SETLKW: N)r'   r	   r.   r   r   F_SETFLrK   
O_NONBLOCKr   rU   r[   F_SETLKWrV   r*   r   rvrZ   s   &  r   test_fcntl_filenoTestFcntl.test_fcntl_filenoU   s    fd#[[%--G77<$$&[[%..(C75tBx@r   c                   \        \        R 4      V n        \        P                  V P                  \        P                  \
        P                  4      p\        '       d   \        RV4       V P                  4       p\        P                  V P                  \        P                  V4      p\        '       d   \        R\        V4      4       V P                  P                  4        R# r^   )r'   r	   r.   r   r`   rK   ra   r   rU   r[   rb   rV   r*   rc   s   &  r   test_fcntl_file_descriptor$TestFcntl.test_fcntl_file_descriptora   s    fd#[[>77<$$&[[:75tBx@r   c                   V P                  \        4      ;_uu_ 4        \        P                  R\        P                  \        P
                  4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  \        R4      \        P                  \        P
                  4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  R\        P                  \        P
                  4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  \        R4      \        P                  \        P
                  4       RRR4       R#   + '       g   i     EL0; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)   Nspam)assertRaises
ValueErrorr   r`   rK   ra   r   	TypeErrorr   s   &r   test_fcntl_bad_fileTestFcntl.test_fcntl_bad_filem   s    z**KKEMM2==9 +z**KKU]]BMMB +y))KKr}}= *y))KKF *) +****)))))s/   4E97=F4F 2=F39F
	F	 F0	3G	c                   \        R 4      pVP                  pVP                  pV P                  \        4      ;_uu_ 4        \
        P                  V^,           \
        P                  \        P                  4       RRR4       V P                  \        4      ;_uu_ 4        \
        P                  \        V^,           4      \
        P                  \        P                  4       RRR4       V P                  \        4      ;_uu_ 4        \
        P                  V^,
          \
        P                  \        P                  4       RRR4       V P                  \        4      ;_uu_ 4        \
        P                  \        V^,
          4      \
        P                  \        P                  4       RRR4       R#   + '       g   i     ELE; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i	_testcapiN)
r   INT_MAXINT_MINrn   OverflowErrorr   r`   rK   ra   r   )r   ru   rv   rw   s   &   r   test_fcntl_bad_file_overflow&TestFcntl.test_fcntl_bad_file_overfloww   s   !+.	####}--KK!U]]BMMB .}--KK!,emmR]]K .}--KK!U]]BMMB .}--KK!,emmR]]K .- .---------s2   ;F8!AG
;G*AG28G		G	G/	2H	armLinuxAndroidz6this platform returns EINVAL for F_NOTIFY DN_MULTISHOTc                    \         P                  p\         P                  p\
        P                  ! \
        P                  P                  \
        P                  P                  \        4      4      \
        P                  4      p  \         P                  VX\         P                  4       \         P                  VXX4       \
        P                   ! V4       R#   \         d    T P	                  R 4        Li ; i  \         d;   pTP                  \        P                  8X  d   T P	                  R4        Rp?LRp?ii ; i  \
        P                   ! T4       i ; i)z$F_NOTIFY or DN_MULTISHOT unavailablez*F_NOTIFY not available by this environmentN)r   F_NOTIFYDN_MULTISHOTrM   skipTestrK   r'   pathdirnameabspathr	   O_RDONLY	DN_DELETEOSErrorerrnoEINVALr*   )r   r-   flagsfdexcs   &    r   test_fcntl_64_bitTestFcntl.test_fcntl_64_bit   s    	B..C&&E WWRWW__RWW__V%<=r{{K	PBU__5 KKC'HHRL  	BMM@A	B  P99,MM"NOP
 HHRLsA    C %C= ,E C:9C:=E0D=8E =EE Ec                6   \        \        R 4      V n        V P                  P                  4       p\        P                  V\        P                  4       \        P                  V\        P                  4       \        P                  V P                  \        P                  \        P                  ,          4       \        P                  V P                  \        P                  4       \        P                  V\        P                  4       \        P                  V\        P                  4       V P                  \        \        P
                  R\        P                  4       V P                  \        \        P
                  R\        P                  4       R# )r&   rl   Nrm   )r'   r	   r.   r   r   flockLOCK_SHr1   LOCK_NBLOCK_EXrn   ro   rp   )r   r   s   & r   
test_flockTestFcntl.test_flock   s    fe$FEMM*FEMM*DFFEMMEMM9:DFFEMM*FEMM*FEMM**ekk2u}}E)U[[&%--Hr   AIXzAIX returns PermissionErrorc                   \        \        R 4      V n        \        P                  \        P
                  ,          p\        P                  V P                  V4       \        P                  ! R4      pVP                  \        \        V3R7      pVP                  4        VP                  4        \        P                  V P                  \        P                  4       V P                  VP                  ^ 4       R# r&   spawn)targetargsN)r'   r	   r.   r   r   r   r(   multiprocessingget_contextProcessr/   startjoinr1   assertEqualexitcoder   r-   mpps   &   r   test_lockf_exclusiveTestFcntl.test_lockf_exclusive   s     fe$mmemm+DFFC ((1JJ=VSMJR			DFFEMM*Q'r   c                   \        \        R 4      V n        \        P                  \        P
                  ,          p\        P                  V P                  V4       \        P                  ! R4      pVP                  \        \        V3R7      pVP                  4        VP                  4        \        P                  V P                  \        P                  4       V P                  VP                  ^ 4       R# r   )r'   r	   r.   r   r   r   r(   r   r   r   r2   r   r   r1   r   r   r   s   &   r   test_lockf_shareTestFcntl.test_lockf_share   s     fe$mmemm+DFFC ((1JJ8}JM			DFFEMM*Q'r   c                    \        R 4      pV P                  \        \        P                  VP
                  ^,           \        P                  4       R# rt   )r   rn   rx   r   r   rv   r   )r   ru   s   & r   test_flock_overflowTestFcntl.test_flock_overflow   s6    !+.	-i6G6G6I--	)r   darwinz$F_GETPATH is only available on macosc           	     T   \        \        R 4      V n        \        P                  P                  \        4      P                  R4      p\        P                  V P                  P                  4       \        P                  \        \        V4      4      4      pV P                  W4       R# )r_   zutf-8N)r'   r	   r.   rK   r   r   encoder   r   	F_GETPATHbyteslenr   )r   expectedress   &  r   test_fcntl_f_getpathTestFcntl.test_fcntl_f_getpath   sd    fd#77??6*11':kk$&&--/5??E#h-<PQ'r   F_SETPIPE_SZF_GETPIPE_SZzAF_SETPIPE_SZ and F_GETPIPE_SZ are not available on all platforms.z'Emscripten pipefs doesn't support thesec                H   \         P                  ! 4       w  r \        P                  V\        P                  4      pV^,          p\	        4       pWE8  d   \
        P                  ! R4      h\        P                  V\        P                  V4       V P                  \        P                  V\        P                  4      V4       \         P                  ! V4       \         P                  ! V4       R#   \         P                  ! T4       \         P                  ! T4       i ; i)   z+default pipesize too small to perform test.N)
rK   piper   r   r   unittestSkipTestr   r   r*   )r   test_pipe_rtest_pipe_wpipesize_defaultpipesizepagesize_defaults   &     r   test_fcntl_f_pipesizeTestFcntl.test_fcntl_f_pipesize   s    
 $&779 	"${{;8J8JK'1,H+~*''AC CKKU%7%7BU[[e6H6HI%' HH[!HH[! HH[!HH[!s   B,C3 3.D!F_DUPFDzneed fcntl.F_DUPFDc                   \        4       pV P                  \        4      ;_uu_ 4        \        P                  V\        P                  ^ 4       RRR4       V P                  \        4      ;_uu_ 4        \        P                  V\        P                  R4       RRR4       R#   + '       g   i     L]; i  + '       g   i     R# ; i)    Ns                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   )r   rn   r   r   r   )r   r   s   & r   test_bad_fdTestFcntl.test_bad_fd   su     ]w''KKEMM1- (w''KKEMM<8 (' (''''s   &B#3&B6#B3	6C	r6   N)#r   r   r   r   r7   r;   staticmethodr[   re   rh   rq   r   ry   r   skipIfrO   machinerP   systemr   r   r   r   r   r   rN   r   
skipUnlesshasattrr   r   r   r   r    r!   r"   s   @r   r4   r4   +   s    
  >

G L L __					&	&u	-	N	N(//2Cw2N 	* 	*??	)@B	B(I __X__&%/1NO	(  P	( __X__&%/1NO	(  P	( ) )
 __S\\X-/UV( W( ~&II75.+IKM __]$MN" OM"" 	24HI9 J9r   r4   __main__)__doc__r   r   rO   rK   rQ   rN   r   test.supportr   r   r   r   r   r   test.support.import_helperr   test.support.os_helperr	   r
   r   r   r   r/   r2   TestCaser4   r   main r   r   <module>r      s       	  
   5 > > 	g D9!! D9N zMMO r   