def getChildren(parentPid):
process_listing = commands.getoutput('ls /proc').split('\n')
children = []
for entry in process_listing:
try:
filename = '/proc/'+entry+'/status'
fp = open(filename,'r')
stuff=fp.read()
fp.close()
rows = stuff.split('\n')
for row in rows:
if row[:4]=='PPid':
PPid = int(row.split(':')[1][1:])
if PPid == parentPid:
children.append(int(entry))
break
except:
continue
return children
test_01_DeviceManager.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录