-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathShowProcHandler
More file actions
executable file
·45 lines (32 loc) · 946 Bytes
/
ShowProcHandler
File metadata and controls
executable file
·45 lines (32 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
"""
Show the handler routine for the indicated /proc/net file, if there is one
"""
import sys
import ProcHandlers
PBR = ProcHandlers.PBR
if sys.platform == "darwin":
print "MacOS doesn't have a '/proc' filesystem, quitting."
sys.exit(0)
QUALIFY = ""
if len(sys.argv) > 1:
TARGET = sys.argv[1]
if len(sys.argv) > 2:
QUALIFY = sys.argv[2]
else:
TARGET = "tcp"
if TARGET == "all":
PBR.show_proc_file_handlers()
else:
HANDLER = ProcHandlers.GET_HANDLER(TARGET)
if QUALIFY != "":
ACTIVE = HANDLER(QUALIFY)
else:
ACTIVE = HANDLER(TARGET)
if QUALIFY != "":
TARGET = "{dir}/{file}".format(dir=TARGET, file=QUALIFY)
# Looks like 'pylint' can't figure this one out...
# pylint: disable=E1103
print "File {file} handled by {name:s} from {mod}".format(file=TARGET,
name=HANDLER.__name__, mod=HANDLER.__module__)
# pylint: enable=E1103