REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.00 KB
Close
//lib/python3.6/site-packages/iotop/genetlink.py
Text
Base64
''' Netlink message generation/parsing Copyright 2007 Johannes Berg <johannes@sipsolutions.net> GPLv2+; See copying for details. ''' import struct from iotop.netlink import NLM_F_REQUEST, NLMSG_MIN_TYPE, Message, parse_attributes from iotop.netlink import NulStrAttr, Connection, NETLINK_GENERIC CTRL_CMD_UNSPEC = 0 CTRL_CMD_NEWFAMILY = 1 CTRL_CMD_DELFAMILY = 2 CTRL_CMD_GETFAMILY = 3 CTRL_CMD_NEWOPS = 4 CTRL_CMD_DELOPS = 5 CTRL_CMD_GETOPS = 6 CTRL_ATTR_UNSPEC = 0 CTRL_ATTR_FAMILY_ID = 1 CTRL_ATTR_FAMILY_NAME = 2 CTRL_ATTR_VERSION = 3 CTRL_ATTR_HDRSIZE = 4 CTRL_ATTR_MAXATTR = 5 CTRL_ATTR_OPS = 6 class GenlHdr: def __init__(self, cmd, version = 0): self.cmd = cmd self.version = version def _dump(self): return struct.pack("BBxx", self.cmd, self.version) def _genl_hdr_parse(data): return GenlHdr(*struct.unpack("BBxx", data)) GENL_ID_CTRL = NLMSG_MIN_TYPE class GeNlMessage(Message): def __init__(self, family, cmd, attrs=[], flags=0): self.cmd = cmd self.attrs = attrs self.family = family Message.__init__(self, family, flags=flags, payload=[GenlHdr(self.cmd)]+attrs) @staticmethod def recv(conn): msg = conn.recv() packet = msg.payload hdr = _genl_hdr_parse(packet[:4]) genlmsg = GeNlMessage(msg.type, hdr.cmd, [], msg.flags) genlmsg.attrs = parse_attributes(packet[4:]) genlmsg.version = hdr.version return genlmsg class Controller: def __init__(self, conn): self.conn = conn def get_family_id(self, family): a = NulStrAttr(CTRL_ATTR_FAMILY_NAME, family) m = GeNlMessage(GENL_ID_CTRL, CTRL_CMD_GETFAMILY, flags=NLM_F_REQUEST, attrs=[a]) m.send(self.conn) m = GeNlMessage.recv(self.conn) return m.attrs[CTRL_ATTR_FAMILY_ID].u16() connection = Connection(NETLINK_GENERIC) controller = Controller(connection)
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2024-06-15 07:05:44
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
data.py
15.09 KB
lrw-r--r--
2024-04-06 14:56:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
genetlink.py
2.00 KB
lrw-r--r--
2013-05-26 22:44:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ioprio.py
5.37 KB
lrw-r--r--
2013-05-26 22:44:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
netlink.py
7.71 KB
lrw-r--r--
2013-05-26 22:44:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ui.py
24.67 KB
lrw-r--r--
2024-04-06 14:56:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
version.py
16 B
lrw-r--r--
2013-05-26 22:44:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
vmstat.py
1.52 KB
lrw-r--r--
2013-05-26 22:44:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
0 B
lrw-r--r--
2013-05-26 22:44:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).