o
    2h                     @   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   L/var/www/html/chatgem/venv/lib/python3.10/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   W dS 1 s'w   Y  W dS  ty}   zddl}W n tyF   Y Y dS w z|d}W n tyY   Y Y dS w |	d}|	d}z|
|| ||| W Y dS  ty|   Y Y dS w w )	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OSErrorctypesImportErrorCDLLc_ulongprctlAttributeError)name	proc_commr   libcpr_set_namezeror   r   r	   r      s2   
&

r   )__doc__r   r   r
   r   r   r   r   r	   <module>   s
   