AlkantarClanX12

Your IP : 3.145.57.5


Current Path : /opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/multiprocessing/__pycache__/forkserver.cpython-311.pyc

�

c��ff/��D�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddlm
Z
ddl	mZddl	mZddl	mZgd	�Zd
Zejd��ZGd�d
e��Zdd�Zd�Zd�Zd�Ze��ZejZejZejZejZdS)�N�)�
connection)�process)�	reduction)�resource_tracker)�spawn)�util)�ensure_running�get_inherited_fds�connect_to_new_process�set_forkserver_preload��qc�8�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dS)	�
ForkServerc�~�d|_d|_d|_d|_t	j��|_dg|_dS)N�__main__)�_forkserver_address�_forkserver_alive_fd�_forkserver_pid�_inherited_fds�	threading�Lock�_lock�_preload_modules��selfs �A/opt/alt/python311/lib64/python3.11/multiprocessing/forkserver.py�__init__zForkServer.__init__"sA��#'�� �$(��!�#���"����^�%�%��
�!+������c�n�|j5|���ddd��dS#1swxYwYdS�N)r�_stop_unlockedrs r�_stopzForkServer._stop*s���
�Z�	"�	"����!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s�*�.�.c��|j�dStj|j��d|_tj|jd��d|_tj|j��stj|j��d|_dS)Nr)	r�os�closer�waitpidr	�is_abstract_socket_namespacer�unlinkrs rr#zForkServer._stop_unlocked/s�����'��F�	���*�+�+�+�$(��!�
�
�4�'��+�+�+�#����0��1I�J�J�	0��I�d�.�/�/�/�#'�� � � r c�d�td�|D����std���||_dS)z>Set list of module names to try to load in forkserver process.c3�BK�|]}t|��tuV��dSr")�type�str)�.0�mods  r�	<genexpr>z4ForkServer.set_forkserver_preload.<locals>.<genexpr>@s-����=�=��4��9�9��#�=�=�=�=�=�=r z&module_names must be a list of stringsN)�all�	TypeErrorr)r�
modules_namess  rr
z!ForkServer.set_forkserver_preload>s?���=�=�}�=�=�=�=�=�	F��D�E�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��|���t|��dztkrtd���t	jtj��5}|�|j��tj	��\}}tj	��\}}|||j
tj��g}||z
}	tj||��||ftj|��tj|��cddd��S#tj|��tj|���xYw#tj|��tj|��wxYw#1swxYwYdS)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�8�a�<�>�)�)��^�,�,�,�
�]�6�>�
*�
*�	"�f��N�N�4�3�4�4�4� "��	�	��H�g� "��	�	��G�X��w��(A�&�,�.�.�0�F��c�M�F�	
"��!�&�&�1�1�1���)����!�!�!����!�!�!�!	"�	"�	"�	"�	"�	"�	"�	"��
����"�"�"����"�"�"���������!�!�!����!�!�!�!����!	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s7�A(E.�D�(E.�+D>�>E�*E+�+E.�.E2�5E2c����|j5tj��|j�et	j|jtj��\}}|s	ddd��dSt	j|j��d|_	d|_d|_d}|j
r9ddh�tjd��}�fd�|�
��D��}ni}tjtj��5}t!jd��}|�|��t'j|��st	j|d��|���t	j��\}}	|���|g}	||���||j
|fz}tj��}
|
gt'j��z}|d	|gz
}t'j|
||	��}n#t	j|���xYw	t	j|��n#t	j|��wxYw||_	||_||_ddd��n#1swxYwYddd��dS#1swxYwYdS)
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�ignorec�$��i|]\}}|�v�	||��
S�rM)r/�x�y�desired_keyss   �r�
<dictcomp>z-ForkServer.ensure_running.<locals>.<dictcomp>�s)���K�K�K���A��l�9J�9J��1�9J�9J�9Jr r<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�data�listener�address�alive_r�alive_w�fds_to_pass�exe�argsrPs
            @rr
zForkServer.ensure_runningis����Z�1	+�1	+��+�-�-�-��#�/� �j��)=�r�z�J�J���V����1	+�1	+�1	+�1	+�1	+�1	+�1	+�1	+����2�3�3�3�+/��(�,0��)�'+��$�,�C��$�
� +�Z�8���1�(�;�;��K�K�K�K������K�K�K�������v�~�.�.�
+�(�$�6�y�A�A���
�
�g�&�&�&��8��A�A�-��H�W�e�,�,�,����!�!�!�$&�7�9�9� ���&�#+�?�?�#4�#4�g�">�K��H�O�O�-�-�w��8M� �"�"�C��.�0�0�C��5�4�#D�#F�#F�F�D��T�3�K�'�D��-�c�4��E�E�C�C����H�W�%�%�%������
�H�W�%�%�%�%��B�H�W�%�%�%�%����+2��(�,3��)�'*��$�3
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+�11	+�1	+�1	+�1	+�1	+�1	+�1	+�1	+�1	+�1	+�1	+�1	+����1	+�1	+�1	+�1	+�1	+�1	+si�AI)�BI)�+A=I�)A=G'�&H�'G>�>H�I�H-�-I�I)�I	�I)�I	�I)�)I-�0I-N)
�__name__�
__module__�__qualname__rr$r#r
rrr
rMr rrr s}������-�-�-�"�"�"�

(�
(�
(�.�.�.�#�#�#�"�"�"�:8+�8+�8+�8+�8+r rc
��
�|r�d|vr[|�Ydtj��_	tj|��tj��`n#tj��`wxYw|D]"}	t|���#t$rY�wxYwtj��tj
��\}}tj|d��tj|d��d�}tj
|tjtji}	d�|	���D��}
tj|��i}t%jt$j|���5}t)j��5}
|���t._|
�|t(j��|
�|t(j��|
�|t(j��			d�|
���D��}|rn�"||vr*tj|d	��d
ks
Jd���t:�||vr�tj|d��		tjd
tj��\}}n#t@$rYn�wxYw|dkrn{|�!|d��}|�Ktj"|��}	tG||��n#tH$rYnwxYwtj%|��ntMj'd|z����||v�r|�(��d5}tSj*|tVd	z��}tY|��tVkr/t[d�.tY|�������|^}}}|�%��tj/��}|dkr�d	}	|�%��|
�%��||||g}|�0|�1����te||||
��}nM#tf$r@tij5tij6���thj7�8��YnwxYwtj9|��nm#tj9|��wxYw	tG||��n#tH$rYnwxYw|||<tj%|��|D]}tj%|���ddd��n#1swxYwYn-#tt$r }|j;tvj<kr�Yd}~nd}~wwxYw��Y#1swxYwYddd��dS#1swxYwYdS)zRun forkserver.rNTFc��dSr"rM)�_unuseds r�sigchld_handlerzmain.<locals>.sigchld_handler�s���r c�@�i|]\}}|tj||����SrM)�signal)r/�sig�vals   rrQzmain.<locals>.<dictcomp>�s:��8�8�8�"��c����s�C�0�0�8�8�8r )rYc�"�g|]\}}|j��
SrM)�fileobj)r/�key�eventss   r�
<listcomp>zmain.<locals>.<listcomp>�s��O�O�O�M�S�&�C�K�O�O�Or rr zNot at EOF?i���rz.forkserver: waitpid returned unexpected pid %dzToo many ({0:n}) fds to send)=r�current_process�_inheritingr�import_main_path�
__import__�ImportErrorr	�_close_stdinr&r>�set_blockingrp�SIGCHLD�SIGINT�SIG_IGNrT�
set_wakeup_fdr;r<�	selectors�DefaultSelector�getsockname�_forkserverr�register�
EVENT_READ�select�read�
SystemExitr(rR�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_fdrc�preloadrIrJ�modname�sig_r�sig_wrn�handlers�old_handlers�	pid_to_fdra�selector�rfdsr]�stsrD�
returncode�srArE�code�
unused_fds�fd�es                          r�mainr��s������� � �Y�%:�48�G�#�%�%�1�
:��&�y�1�1�1��+�-�-�9�9��G�+�-�-�9�9�9�9�9��	�	�G�
��7�#�#�#�#���
�
�
���
����	������7�9�9�L�E�5��O�E�5�!�!�!��O�E�5�!�!�!�
�
�
�	����
�v�~�	
�H�8�8�&.�n�n�&6�&6�8�8�8�L��������I�	��v�~�k�	:�	:�	:�Y�h�	�	"�	$�	$�Y�(0�*2�*>�*>�*@�*@��'����(�I�$8�9�9�9����'�9�#7�8�8�8����%��!5�6�6�6�Q	�P
��O�O�X�_�_�=N�=N�O�O�O�D�����
�d�?�?��7�7�A�.�.�#�5�5�5�}�5�5�5�$�$��D�=�=��G�E�5�)�)�)�E�"�')�z�"�b�j�'A�'A�H�C����0�"�"�"�!�E�"�����!�8�8�!�"+�-�-��T�":�":��"�.�)+�)B�3�)G�)G�J�%� ,�W�j� A� A� A� A��#2�%�%�%� $��%�����H�W�-�-�-�-�%�M�+>�@C�+D�E�E�E�+E�0�t�#�#�!���*�*�1�-�$-��'�/��>�A�3E�F�F���s�8�8�n�4�4�".� >� E� E�$'��H�H�!.�!.�#/�#/�/�25�.���3����	�	�	� �g�i�i���!�8�8�#$�D�/� (��� 0� 0� 0� (��� 0� 0� 0�.5�w��u�-M�
� *� 1� 1�)�2B�2B�2D�2D� E� E� E�'1�'�3�2<�2>�(@�(@����$-�3�3�3� #������ ?� ?� #�
� 0� 0� 2� 2� 2� 2� 2�3����!#������������������%� ,�W�c� :� :� :� :��#2�%�%�%� $��%����.5�I�c�N��H�W�-�-�-�&)�-�-�� "�������I$-�$-�$-�$-�$-�$-�$-�$-�$-�$-�$-����$-�$-�$-�$-���L�
�
�
��7�e�0�0�0��1�0�0�0�0�����
����_Q	�Y�Y�Y�Y����Y�Y�Y�Y�Y�Y�Y�Y�Y�Y�Y�Y�Y�Y�Y�Y����Y�Y�Y�Y�Y�YsC�A
�
A�'A7�7
B�B�U�)BU�*A+T�"I9�8T�9
J�T�J�6T�=K�
T�
K�T�K�AT�*BT�A'P,�+R�,AQ6	�3R�5Q6	�6R�9T�R$	�$T�(R9�8T�9
S	�T�S	�5T�;T�T�T�T�T�U�
T=�T8�3U�8T=�=U�U	�U�	U	�
U�U�!Uc�`�tjd��|���D]\}}tj||���|D]}tj|���|^t
_tj_	t
_
tj|��}tj
||��}|S)Nrx)rpr�rTr&r'r�rr�_resource_tracker�_fdr�dupr�_main)	rErAr�r�rqrrr��parent_sentinelr�s	         rr�r�+s���
�������N�N�$�$� � ���S��
�c�3���������
�������%(�"�[�%��'�+�� ��f�W�o�o�O��;�w��0�0�D��Kr c� �d}tj}t|��|krNtj||t|��z
��}|std���||z
}t|��|k�Nt�|��dS)Nr zunexpected EOFr)�
SIGNED_STRUCT�sizer8r&r��EOFError�unpack)r�r`�lengthr�s    r�read_signedr�Bs����D�
�
�F�

�d�)�)�f�
�
��G�B���T���*�+�+���	-��+�,�,�,���	��	�d�)�)�f�
�
�
����%�%�a�(�(r c��t�|��}|r8tj||��}|dkrt	d���||d�}|�6dSdS)Nrzshould not get here)r��packr&�writer�)r��n�msg�nbytess    rr�r�Lsq��
�
�
�Q�
�
�C�

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