AlkantarClanX12

Your IP : 3.146.178.81


Current Path : /opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/multiprocessing/__pycache__/forkserver.cpython-312.opt-1.pyc

�

�Q�ff/��b�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddlm
Z
ddl	mZddl	mZddl	mZgd	�Zd
Zej&d�ZGd�d
e�Zdd�Zd�Zd�Zd�Ze�Zej8Zej:Zej<Zej>Zy)�N�)�
connection)�process)�	reduction)�resource_tracker)�spawn)�util)�ensure_running�get_inherited_fds�connect_to_new_process�set_forkserver_preload��qc�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�
ForkServerc�~�d|_d|_d|_d|_t	j
�|_dg|_y)N�__main__)�_forkserver_address�_forkserver_alive_fd�_forkserver_pid�_inherited_fds�	threading�Lock�_lock�_preload_modules��selfs �A/opt/alt/python312/lib64/python3.12/multiprocessing/forkserver.py�__init__zForkServer.__init__"s:��#'�� �$(��!�#���"����^�^�%��
�!+����c�f�|j5|j�ddd�y#1swYyxYw�N)r�_stop_unlockedrs r�_stopzForkServer._stop*s��
�Z�Z����!��Z�Z�s�'�0c�B�|j�ytj|j�d|_tj|jd�d|_tj|j�stj|j�d|_y)Nr)	r�os�closer�waitpidr	�is_abstract_socket_namespacer�unlinkrs rr#zForkServer._stop_unlocked/sw�����'��	����*�*�+�$(��!�
�
�
�4�'�'��+�#����0�0��1I�1I�J��I�I�d�.�.�/�#'�� r c�L�td�|D��std��||_y)z>Set list of module names to try to load in forkserver process.c3�>K�|]}t|�tu���y�wr")�type�str)�.0�mods  r�	<genexpr>z4ForkServer.set_forkserver_preload.<locals>.<genexpr>@s����=�}��4��9��#�}�s�z&module_names must be a list of stringsN)�all�	TypeErrorr)r�
modules_namess  rr
z!ForkServer.set_forkserver_preload>s$���=�}�=�=��D�E�E� -��r c��|jS)z�Return list of fds inherited from parent process.

        This returns None if the current process was not started by fork
        server.
        )rrs rrzForkServer.get_inherited_fdsDs���"�"�"r c��|j�t|�dztk\rtd��t	jtj
�5}|j
|j�tj�\}}tj�\}}|||jtj�g}||z
}	tj||�||ftj|�tj|�cddd�S#tj|�tj|��xYw#tj|�tj|�wxYw#1swYyxYw)a;Request forkserver to create a child process.

        Returns a pair of fds (status_r, data_w).  The calling process can read
        the child process's pid and (eventually) its returncode from status_r.
        The calling process should write to data_w the pickled preparation and
        process data.
        �ztoo many fdsN)r
�len�MAXFDS_TO_SEND�
ValueError�socket�AF_UNIX�connectrr&�piperr�getfdr�sendfdsr')r�fds�client�parent_r�child_w�child_r�parent_w�allfdss        rrz!ForkServer.connect_to_new_processLs��	
�����s�8�a�<�>�)��^�,�,�
�]�]�6�>�>�
*�f��N�N�4�3�3�4� "���	��H�g� "���	��G�X��w��(A�(A�&�,�,�.�0�F��c�M�F�	
"��!�!�&�&�1���)�����!�����!�!	"�	"��
�����"�����"�������!�����!��!+�
*�s1�A1E2�D�*E2�-E�E�,E/�/E2�2E;c�4�|j5tj�|j�qt	j
|jtj�\}}|s
	ddd�yt	j|j�d|_	d|_d|_d}|jrBddh}tjd�}|j�D��cic]
\}}||vs�||��}}}ni}tjtj�5}t!j"d�}	|j%|	�t'j(|	�st	j*|	d�|j-�t	j.�\}
}	|j1�|
g}||j1�|
|j|fz}tj2�}
|
gt'j4�z}|d|gz
}t'j6|
||�}	t	j|
�|	|_	||_||_ddd�ddd�ycc}}w#t	j|��xYw#t	j|
�wxYw#1swY�MxYw#1swYyxYw)	z�Make sure that a fork server is running.

        This can be called from any process.  Note that usually a child
        process will just reuse the forkserver started by its parent, so
        ensure_running() will do nothing.
        NzCfrom multiprocessing.forkserver import main; main(%d, %d, %r, **%r)�	main_path�sys_path�ignorer<i�z-c)rrr
rr&r(�WNOHANGr'rrrr�get_preparation_data�itemsr;r<r�arbitrary_address�bindr	r)�chmod�listenr>�fileno�get_executable�_args_from_interpreter_flags�spawnv_passfds)r�pid�status�cmd�desired_keys�data�x�y�listener�address�alive_r�alive_w�fds_to_pass�exe�argss               rr
zForkServer.ensure_runningis)���Z�Z��+�+�-��#�#�/� �j�j��)=�)=�r�z�z�J���V���1	+�1	+�����2�2�3�+/��(�,0��)�'+��$�,�C��$�$� +�Z�8���1�1�(�;��)-����K����A��l�9J��1����K������v�~�~�.�(�$�6�6�y�A���
�
�g�&��8�8��A��H�H�W�e�,����!�$&�7�7�9� ���&�#+�?�?�#4�g�">�K��H�O�O�-�w��8M�8M� �"�"�C��.�.�0�C��5�4�#D�#D�#F�F�D��T�3�K�'�D��-�-�c�4��E�C�
�H�H�W�%�+2��(�,3��)�'*��$�3/�1�Z��(L��,��H�H�W�%����H�H�W�%��-/�.��1�Z�si�AJ�+A.J�I�&I�+)J�A9J�A=I
�*J�6J�J�
I%�%I(�(I?�?J�J	�J�JN)
�__name__�
__module__�__qualname__rr$r#r
rrr
�r rrr s%��-�"�

(�.�#�"�:8+r rc
�
�|r\d|vrE|�Cdtj�_	tj|�tj�`|D]}	t|��tj�tj�\}}tj|d�tj|d�d�}tj|tjtji}	|	j!�D�
�cic]\}
}|
tj|
|���}}
}tj"|�i}
t%j$t$j&|��5}t)j*�5}|j-�t._|j3|t(j4�|j3|t(j4�|j3|t(j4�			|j7�D��cgc]\}}|j8��}}}|rn�0||vrt:�||vr�tj<|d�		tj>dtj@�\}}|d	k(rne|
jE|d�}|�8tjF|�}	tI||�tjL|�ntOjPd
|z���||v�rK|jS�d	5}tUjV|tXdz�}t[|�tXkDr#t]dj_t[|����|^}}}|jM�tj`�}|d	k(rld}	|jM�|jM�||||g}|jc|
je��tg||||�}tjt|�nC	tI||�||
|<tjL|�|D]}tjL|��ddd���<#tj�`wxYw#t$rY���wxYwcc}}
wcc}}w#tB$rY���wxYw#tJ$rY���wxYw#th$rFtkjltkjn��tjjpjs�Y��wxYw#tjt|�wxYw#tJ$rY��
wxYw#1swY��xYw#tv$r)}|jxtxjzk7r�Yd}~��d}~wwxYw#1swYnxYw	ddd�y#1swYyxYw)
zRun forkserver.rNTFc��yr"rh)�_unuseds r�sigchld_handlerzmain.<locals>.sigchld_handler�s��r )rSi���rz.forkserver: waitpid returned unexpected pid %drzToo many ({0:n}) fds to send)>r�current_process�_inheritingr�import_main_path�
__import__�ImportErrorr	�_close_stdinr&r>�set_blocking�signal�SIGCHLD�SIGINT�SIG_IGNrN�
set_wakeup_fdr;r<�	selectors�DefaultSelector�getsockname�_forkserverr�register�
EVENT_READ�select�fileobj�
SystemExit�readr(rL�ChildProcessError�pop�waitstatus_to_exitcode�write_signed�BrokenPipeErrorr'�warnings�warn�acceptr�recvfdsr9r8�RuntimeError�format�fork�extend�values�
_serve_one�	Exception�sys�
excepthook�exc_info�stderr�flush�_exit�OSError�errno�ECONNABORTED)�listener_fdr`�preloadrIrJ�modname�sig_r�sig_wrl�handlers�sig�val�old_handlers�	pid_to_fdr^�selector�key�events�rfdsrW�stsrD�
returncode�srArE�code�
unused_fds�fd�es                              r�mainr��s������ �Y�%:�48�G�#�#�%�1�
:��&�&�y�1��+�+�-�9��G�
��7�#��	�����7�7�9�L�E�5��O�O�E�5�!��O�O�E�5�!�
�	�����
�
�v�~�~�	
�H�'/�n�n�&6�8�&6�
��c�����s�C�0�0�&6��8�������I�	���v�~�~�k�	:�h�	�	"�	"�	$��*2�*>�*>�*@��'����(�I�$8�$8�9����'�9�#7�#7�8����%��!5�!5�6��P
��=E�_�_�=N�O�=N�M�S�&�C�K�K�=N�D�O����
�d�?�%�$��D�=��G�G�E�5�)��"�')�z�z�"�b�j�j�'A�H�C���!�8�!�"+�-�-��T�":��"�.�)+�)B�)B�3�)G�J�%� ,�W�j� A��H�H�W�-�%�M�M�+>�@C�+D�E�+�0�t�#�!���*�1�-��'�/�/��>�A�3E�F���s�8�n�4�".� >� E� E�$'��H�!.�#/�/�25�.���3����	� �g�g�i���!�8�#$�D�/� (��� 0� (��� 0�.5�w��u�-M�
� *� 1� 1�)�2B�2B�2D� E�'1�'�3�2<�2>�(@��!#�����%� ,�W�c� :�.5�I�c�N��H�H�W�-�&)�� "�����'*�G.�S��Q�+�+�-�9���
��
��&8��(P��  1�"�!�"��$3�%� $�%��@$-�3� #������� ?� #�
�
� 0� 0� 2�3��!#������
$3�%� $�%��=.�-��L�
��7�7�e�0�0�0��1��
��m
%�	$��	$�
;�	:�	:�s6�P(�Q�<!Q�U�1A;T:�-T�Q
�,T�'Q�+/T�Q-�'AT�.BS9�2AQ=�S9�S)�(6S9�T�&T:�(P>�	Q�
Q�T�	Q*�&T�)Q*�*T�-	Q:�6T�9Q:�:T�=AS	�S�S	�S�S&	�&S9�)	S6	�2S9�5S6	�6S9�9T�>T�	T7�T2�,T:�2T7�7T:�:U	�?U�Uc�n�tjd�|j�D]\}}tj||��|D]}tj|��|^t
_tj_	t
_
tj|�}tj||�}|S)Nrm)ruryrNr&r'r}rr�_resource_tracker�_fdr�dupr�_main)	rErAr�r�r�r�r��parent_sentinelr�s	         rr�r�+s���
������N�N�$���S��
�
�c�3��%���
������
%(�"�[�%��'�'�+�� ��f�f�W�o�O��;�;�w��0�D��Kr c��d}tj}t|�|krCtj||t|�z
�}|std��||z
}t|�|kr�Ctj
|�dS)Nr zunexpected EOFr)�
SIGNED_STRUCT�sizer8r&r��EOFError�unpack)r�r[�lengthr�s    r�read_signedr�Bsu���D�
�
�
�F�

�d�)�f�
��G�G�B���T��*�+����+�,�,���	��	�d�)�f�
�
����%�a�(�(r c��tj|�}|r/tj||�}|dk(rt	d��||d}|r�.yy)Nrzshould not get here)r��packr&�writer�)r��n�msg�nbytess    rr�r�LsH��
�
�
�Q�
�C�

����"�c�"���Q�;��4�5�5��&�'�l��	r )NN) r�r&rzrur;�structr�rr��rr�contextrrrr	�__all__r9�Structr��objectrr�r�r�r�r}r
rrr
rhr r�<module>r�s����	��
�
�
�
���������%������
�
�c�"�
�A+��A+�NA�H�.)���l���+�+���1�1��$�;�;��$�;�;�r