Last active
June 13, 2019 06:59
-
-
Save cgwxyz/7bcd543367a051dba7e8 to your computer and use it in GitHub Desktop.
python设置当前进程名称(linux ps时显示)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import dl | |
libc = dl.open('/lib/libc.so.6') | |
libc.call('prctl', 15, 'myproc', 0, 0, 0) #执行后ps -A,显示为myproc的进程 | |
#参数2:15 /linux/prctl.h定义 #define PR_SET_NAME 15 | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment