
    0Vh                     $    d Z ddlZddlZd Zd Zy)zFA tiny stand alone library to change the kernel process name on Linux.    Nc                  v    t        t        j                  j                  t        j
                  d                y)zDSets the process name to something better than 'python' if possible.r   N)set_kernel_process_nameospathbasenamesysargv     A/home/dcms/DCMS/lib/python3.12/site-packages/absl/command_name.pymake_process_name_usefulr      s!    "''**388A;78r   c                    t        | t              s| j                  dd      } 	 t        dd      5 }|j	                  | dd        ddd       y# 1 sw Y   yxY w# t
        $ r 	 ddl}n# t        $ r Y Y yw xY w	 |j                  d      }n# t
        $ r Y Y yw xY w|j                  d      }|j                  d      }	 |j                  || |||       Y y# t        $ r Y Y yw xY ww xY 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zeros         r   r   r      s     
D%	 ;;w	*D		& !)ood3Bi ! ! !	  [[%d ..$K>>!D
jjdD$5 s   A AA AA A 	C'$A)(C')	A62C'5A66C':BC'	BC'B%C'?C	C#C'"C##C')__doc__r   r   r   r   r
   r   r   <module>r%      s    M 	 
9
"r   