File: //opt/alt/python311/lib/python3.11/site-packages/shellingham/posix/__pycache__/proc.cpython-311.pyc
�
�;fc
� � � d dl Z d dlZd dlZd dlZddlmZ dZdZ ej d� � Z d� Z
d� Zd � Zd
� Z
G d� de� � Zdd�ZdS )� N� )�Process� � z
\(.+\)|\S+c �� � t j � � } dD ]Q}t j � t j � dt | � � |� � � � r|c S �Rt
d� � �)z�Detect /proc filesystem style.
This checks the /proc/{pid} directory for possible formats. Returns one of
the following as str:
* `stat`: Linux-style, i.e. ``/proc/{pid}/stat``.
* `status`: BSD-style, i.e. ``/proc/{pid}/status``.
)�stat�status�/proczunsupported proc format)�os�getpid�path�exists�join�str�ProcFormatError)�pid�names �I/opt/alt/python311/lib/python3.11/site-packages/shellingham/posix/proc.py�detect_procr si � �
�)�+�+�C�"� � ��
�7�>�>�"�'�,�,�w��C���$�?�?�@�@� ��K�K�K� �
�3�
4�
4�4� c �~ � t j � � j � � � dv S # t $ r Y dS w xY w)N)�freebsd�netbsd� dragonflyF)r �uname�sysname�lower� Exception� r r �_use_bsd_stat_formatr # sJ � ���x�z�z�!�'�'�)�)�-O�O�O��� � � ��u�u����s �+. �
<�<c �d � t j � dt | � � |� � }t j |dd�� � 5 }t � |� � � � � }d d d � � n# 1 swxY w Y t � � r
|t S |t S )Nr
�ascii�replace��encoding�errors)r r
r r �io�open�STAT_PATTERN�findall�readr �
BSD_STAT_PPID�LINUX_STAT_PPID)r r r
�f�partss r � _get_ppidr0 * s� � �
�7�<�<���S���4�0�0�D� ���� � :� :� :� /�a��$�$�Q�V�V�X�X�.�.��/� /� /� /� /� /� /� /� /� /� /���� /� /� /� /� ��� $��]�#�#���!�!s �-A?�?B�Bc �b � t j � dt | � � d� � }t j � � pd}t
j ||d�� � 5 }t |� � � �
d� � d d� � � cd d d � � S # 1 swxY w Y d S )Nr
�cmdlinezutf-8r# r$ � ���)r r
r r �sys�getfilesystemencodingr'