a
    Sic                     @   s(   d Z ddlZddlZdd Zdd ZdS )zFA tiny stand alone library to change the kernel process name on Linux.    Nc                   C   s   t tjtjd  dS )zDSets the process name to something better than 'python' if possible.r   N)set_kernel_process_nameospathbasenamesysargv r   r   M/var/www/html/django/DPS/env/lib/python3.9/site-packages/absl/command_name.pymake_process_name_useful   s    r
   c                 C   s   t | ts| dd} z@tdd"}|| dd  W d   n1 sJ0    Y  W n t y   zddl}W n ty   Y Y dS 0 z|d}W n ty   Y Y dS 0 |	d}|	d}z|
|| ||| W n ty   Y Y dS 0 Y n0 dS )	a  Changes the Kernel's /proc/self/status process name on Linux.

  The kernel name is NOT what will be shown by the ps or top command.
  It is a 15 character string stored in the kernel's process table that
  is included in the kernel log when a process is OOM killed.
  The first 15 bytes of name are used.  Non-ASCII unicode is replaced with '?'.

  Does nothing if /proc/self/comm cannot be written or prctl() fails.

  Args:
    name: bytes|unicode, the Linux kernel's command name to set.
  asciireplacez/proc/self/commwbN   r   z	libc.so.6)
isinstancebytesencodeopenwriteEnvironmentErrorctypesImportErrorCDLLc_ulongZprctlAttributeError)nameZ	proc_commr   libcZpr_set_namezeror   r   r	   r      s(    
4



r   )__doc__r   r   r
   r   r   r   r   r	   <module>   s   