B s `D @sLdZddlmZddlmZddlmZddlZddlZddZdd ZdS) zFA tiny stand alone library to change the kernel process name on Linux.)absolute_import)division)print_functionNcCsttjtjddS)zDSets the process name to something better than 'python' if possible.rN)set_kernel_process_nameospathbasenamesysargvr r 5/tmp/pip-unpacked-wheel-00lyeop_/absl/command_name.pymake_process_name_usefulsr c Cst|ts|dd}y,tdd}||ddWdQRXWntk ry ddl}Wntk rrdSXy|d}Wntk rdSX| d}| d}y| |||||Wnt k rdSXYnXdS) aChanges 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. asciireplacez/proc/self/commwbNrz libc.so.6) isinstancebytesencodeopenwriteEnvironmentErrorctypes ImportErrorCDLLc_ulongZprctlAttributeError)nameZ proc_commrlibcZ pr_set_nameZzeror r r r!s(       r) __doc__ __future__rrrrr r rr r r r s