403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/tornado/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/tornado/__pycache__/process.cpython-311.pyc
�

��b�1��>�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZddl
mZddlmZddlmZddlZddlmZmZmZejrdd	lmZejZd
efd�Zdd�Zda	dd
eedeed
efd�Zd
eefd�ZGd�de ��Z!dS)z�Utilities for working with multiple processes, including both forking
the server into multiple processes and managing subprocesses.
�N)�hexlify)�Future�"future_set_result_unless_cancelled�%future_set_exception_unless_cancelled)�ioloop)�PipeIOStream)�gen_log)�Optional�Any�Callable)�List�returnc���t�dS	tj��S#t$rYnwxYw	tjd��S#t
tf$rYnwxYwtjd��dS)z1Returns the number of processors on this machine.N��SC_NPROCESSORS_CONFz1Could not detect number of processors; assuming 1)	�multiprocessing�	cpu_count�NotImplementedError�os�sysconf�AttributeError�
ValueErrorr	�error���1/usr/lib/python3/dist-packages/tornado/process.pyrr0s������q�
��(�*�*�*���
�
�
���
����
��z�/�0�0�0���J�'�
�
�
���
�����M�E�F�F�F��1s��
+�+�A�A�Ac�H�dtjvrdSddl}	tt	tjd����d��}nG#t$r:ttj��dz��tj	��z}YnwxYw|�
|��dS)N�randomr�i�)�sys�modulesr�intrr�urandomr�time�getpid�seed)rr&s  r�_reseed_randomr'@s����s�{�"�"����M�M�M�
5��7�2�:�b�>�>�*�*�B�/�/�����5�5�5��4�9�;�;��%�&�&�����4����5����
�K�K������s�/A�AB
�	B
�
num_processes�max_restartsc�R�	�tjdkrtd���|�d}t�J�|�|dkrt	��}tjd|��i�	dtdttf�	fd	�}t|��D]}||��}|�|cS�d}�	r�tj��\}}|�	vr��	�|��}tj
|��r*tjd
||tj|����nYtj|��dkr*tjd||tj|����ntjd||����|d
z
}||krt#d���||��}|�|S�	��tjd��dS)aqStarts multiple worker processes.

    If ``num_processes`` is None or <= 0, we detect the number of cores
    available on this machine and fork that number of child
    processes. If ``num_processes`` is given and > 0, we fork that
    specific number of sub-processes.

    Since we use processes and not threads, there is no shared memory
    between any server code.

    Note that multiple processes are not compatible with the autoreload
    module (or the ``autoreload=True`` option to `tornado.web.Application`
    which defaults to True when ``debug=True``).
    When using multiple processes, no IOLoops can be created or
    referenced until after the call to ``fork_processes``.

    In each child process, ``fork_processes`` returns its *task id*, a
    number between 0 and ``num_processes``.  Processes that exit
    abnormally (due to a signal or non-zero exit status) are restarted
    with the same id (up to ``max_restarts`` times).  In the parent
    process, ``fork_processes`` calls ``sys.exit(0)`` after all child
    processes have exited normally.

    max_restarts defaults to 100.

    Availability: Unix
    �win32zfork not available on windowsN�drzStarting %d processes�irc�h��tj��}|dkrt��|a|S|�|<dS�Nr)r�forkr'�_task_id)r-�pid�childrens  �r�start_childz#fork_processes.<locals>.start_child~s;����g�i�i���!�8�8������H��H��H�S�M��4rz1child %d (pid %d) killed by signal %d, restartingz3child %d (pid %d) exited with status %d, restartingz!child %d (pid %d) exited normallyrz"Too many child restarts, giving up)r �platform�	Exceptionr1rr	�infor"r
�ranger�wait�pop�WIFSIGNALED�warning�WTERMSIG�WEXITSTATUS�RuntimeError�exit)
r(r)r4r-�id�num_restartsr2�status�new_idr3s
         @r�fork_processesrERs���<�|�w����7�8�8�8�����������
�� 2� 2�!���
��L�(�-�8�8�8��H�
�s�
�x��}�
�
�
�
�
�
��=�
!�
!����
�[��^�^��
�>��I�I�I���L�
���g�i�i���V��h����
�\�\�#�
�
��
�>�&�!�!�	��O�C�����F�#�#�	
�
�
�
��^�F�
#�
#�q�
(�
(��O�E�����v�&�&�	
�
�
�
�
�L�<�b�#�F�F�F�������,�&�&��C�D�D�D���R�������M�7��@�H�Q�K�K�K�K�Krc��tS)zpReturns the current task id, if any.

    Returns None if this process was not created by `fork_processes`.
    )r1rrr�task_idrG�s	���Orc���eZdZdZe��ZdZiZdZde	de	ddfd�Z
deegdfddfd	�Z
ddeddfd
�Zedd���Zedd���Zedd���Zededdfd���Zdeddfd�ZdS)�
Subprocessa Wraps ``subprocess.Popen`` with IOStream support.

    The constructor is the same as ``subprocess.Popen`` with the following
    additions:

    * ``stdin``, ``stdout``, and ``stderr`` may have the value
      ``tornado.process.Subprocess.STREAM``, which will make the corresponding
      attribute of the resulting Subprocess a `.PipeIOStream`. If this option
      is used, the caller is responsible for closing the streams when done
      with them.

    The ``Subprocess.STREAM`` option and the ``set_exit_callback`` and
    ``wait_for_exit`` methods do not work on Windows. There is
    therefore no reason to use this class instead of
    ``subprocess.Popen`` on that platform.

    .. versionchanged:: 5.0
       The ``io_loop`` argument (deprecated since version 4.1) has been removed.

    FN�args�kwargsrc	��tj���|_g}g}|�d��t
jur[tj��\}}||d<|�	||f��|�
|��t|��|_|�d��t
jur[tj��\}}||d<|�	||f��|�
|��t|��|_
|�d��t
jur[tj��\}	}
|
|d<|�	|	|
f��|�
|
��t|	��|_	tj|i|��|_n#|D]}tj|����xYw|D]}tj|���|jj|_dD]6}t)||��s$t+||t-|j|�����7d|_d|_dS)N�stdin�stdout�stderr)rMrNrO)r�IOLoop�current�io_loop�getrI�STREAMr�pipe�extend�appendrrMrNrO�
subprocess�Popen�proc�closer2�hasattr�setattr�getattr�_exit_callback�
returncode)
�selfrJrK�pipe_fds�to_close�in_r�in_w�out_r�out_w�err_r�err_w�fd�attrs
             r�__init__zSubprocess.__init__�s$���}�,�,�.�.��������:�:�g���*�"3�3�3�����J�D�$�"�F�7�O��O�O�T�4�L�)�)�)��O�O�D�!�!�!�%�d�+�+�D�J��:�:�h���:�#4�4�4��7�9�9�L�E�5�$�F�8���O�O�U�E�N�+�+�+��O�O�E�"�"�"�&�u�-�-�D�K��:�:�h���:�#4�4�4��7�9�9�L�E�5�$�F�8���O�O�U�E�N�+�+�+��O�O�E�"�"�"�&�u�-�-�D�K�	�"�(�$�9�&�9�9�D�I�I��	��
�
��������������	�	�B��H�R�L�L�L�L��9�=���1�	>�	>�D��4��&�&�
>���d�G�D�I�t�$<�$<�=�=�=��"�������s�F4�4G�callbackc��||_t���|tj|j<t�|j��dS)a�Runs ``callback`` when this process exits.

        The callback takes one argument, the return code of the process.

        This method uses a ``SIGCHLD`` handler, which is a global setting
        and may conflict if you have other libraries trying to handle the
        same signal.  If you are using more than one ``IOLoop`` it may
        be necessary to call `Subprocess.initialize` first to designate
        one ``IOLoop`` to run the signal handlers.

        In many cases a close callback on the stdout or stderr streams
        can be used as an alternative to an exit callback if the
        signal handler is causing a problem.

        Availability: Unix
        N)r_rI�
initialize�_waitingr2�_try_cleanup_process)rarms  r�set_exit_callbackzSubprocess.set_exit_callback�sI��"'���������(,�
��D�H�%��'�'���1�1�1�1�1rT�raise_errorzFuture[int]c�p���t���dtddf��fd�}|�|���S)a2Returns a `.Future` which resolves when the process exits.

        Usage::

            ret = yield proc.wait_for_exit()

        This is a coroutine-friendly alternative to `set_exit_callback`
        (and a replacement for the blocking `subprocess.Popen.wait`).

        By default, raises `subprocess.CalledProcessError` if the process
        has a non-zero exit status. Use ``wait_for_exit(raise_error=False)``
        to suppress this behavior and return the exit status without raising.

        .. versionadded:: 4.2

        Availability: Unix
        �retrNc�x��|dkr"�r t�t|d����dSt�|��dS)Nr�unknown)r�CalledProcessErrorr)ru�futurerss ��rrmz*Subprocess.wait_for_exit.<locals>.callback(sT����a�x�x�K�x�5��.�s�I�>�>������3�6�3�?�?�?�?�?r)rr"rr)rarsrmrys ` @r�
wait_for_exitzSubprocess.wait_for_exitsd����$����	@�#�	@�$�	@�	@�	@�	@�	@�	@�	@�	
���x�(�(�(��
rc�����jrdStj����t	jtj��fd����_d�_dS)a�Initializes the ``SIGCHLD`` handler.

        The signal handler is run on an `.IOLoop` to avoid locking issues.
        Note that the `.IOLoop` used for signal handling need not be the
        same one used by individual Subprocess objects (as long as the
        ``IOLoops`` are each running in separate threads).

        .. versionchanged:: 5.0
           The ``io_loop`` argument (deprecated since version 4.1) has been
           removed.

        Availability: Unix
        Nc�8�����j��S�N)�add_callback_from_signal�_cleanup)�sig�frame�clsrRs  ��r�<lambda>z'Subprocess.initialize.<locals>.<lambda>Hs���w�?�?���M�M�rT)�_initializedrrPrQ�signal�SIGCHLD�_old_sigchld)r�rRs`@rrozSubprocess.initialize4sa������	��F��-�'�'�)�)��!�=��N�M�M�M�M�M�
�
��� ����rc�n�|jsdStjtj|j��d|_dS)z Removes the ``SIGCHLD`` handler.NF)r�r�r�r�)r�s r�uninitializezSubprocess.uninitializeLs9����	��F��
�f�n�c�&6�7�7�7� ����rc��t|j�����D]}|�|���dSr})�listrp�keysrq)r�r2s  rrzSubprocess._cleanupTsH�����)�)�+�+�,�,�	*�	*�C��$�$�S�)�)�)�)�	*�	*rr2c��	tj|tj��\}}n#t$rYdSwxYw|dkrdS||ksJ�|j�|��}|j�|j|��dSr/)	r�waitpid�WNOHANG�ChildProcessErrorrpr:rRr~�_set_returncode)r�r2�ret_pidrC�subprocs     rrqzSubprocess._try_cleanup_processYs���	� �j��b�j�9�9�O�G�V�V�� �	�	�	��F�F�	�����a�<�<��F��#�~�~�~�~��,�"�"�3�'�'����0�0��1H�&�Q�Q�Q�Q�Qs�"%�
3�3rCc�b�tjdkrd|_n^tj|��rtj|��|_n/tj|��sJ�tj|��|_|j|j_|j	r |j	}d|_	||j��dSdS)Nr+���)
r r5r`rr;r=�	WIFEXITEDr>rZr_)rarCrms   rr�zSubprocess._set_returncodees����<�7�"�"� �D�O�O��~�f�%�%�
9�#%�;�v�#6�#6�"6�����|�F�+�+�+�+�+�"$�.��"8�"8��� $���	����	&��*�H�"&�D���H�T�_�%�%�%�%�%�	&�	&r)T�rN)�__name__�
__module__�__qualname__�__doc__�objectrTr�rpr�rrlrr"rr�boolrz�classmethodror�rrqr�rrrrIrI�so��������*�V�X�X�F��L��H��L�%�c�%�S�%�T�%�%�%�%�N2�(�C�5�$�;�*?�2�D�2�2�2�2�,���������@� � � ��[� �.�!�!�!��[�!��*�*�*��[�*��	R�s�	R�t�	R�	R�	R��[�	R�&�c�&�d�&�&�&�&�&�&rrIr�r})"r�rrr�rXr r$�binasciir�tornado.concurrentrrr�tornador�tornado.iostreamr�tornado.logr	�typingr
rr�
TYPE_CHECKINGr
rxr"rr'r1rErGr�rIrrr�<module>r�s��� ��
�	�	�	�����
�
�
�
�����
�
�
�
���������������������
������)�)�)�)�)�)�������
�
�
�
�*�*�*�*�*�*�*�*�*�*�	��������� �2��

�3�

�

�

�

� ������AE�]�]��C�=�]�08��
�]��]�]�]�]�@��#������z&�z&�z&�z&�z&��z&�z&�z&�z&�z&r

Youez - 2016 - github.com/yon3zu
LinuXploit