1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/proc_modules.md

133 lines
2.6 KiB
Markdown
Raw Normal View History

2022-09-06 10:07:19 -07:00
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.proc_modules"></a>
# jc.parsers.proc\_modules
2022-09-06 17:05:14 -07:00
jc - JSON Convert `/proc/modules` file parser
2022-09-06 10:07:19 -07:00
Usage (cli):
$ cat /proc/modules | jc --proc
2022-09-07 12:31:17 -07:00
or
$ jc /proc/modules
2022-09-06 11:42:24 -07:00
or
$ cat /proc/modules | jc --proc-modules
2022-09-06 10:07:19 -07:00
Usage (module):
2022-09-06 11:42:24 -07:00
import jc
result = jc.parse('proc', proc_modules_file)
or
2022-09-06 10:07:19 -07:00
import jc
result = jc.parse('proc_modules', proc_modules_file)
Schema:
[
{
"module": string,
"size": integer,
"used": integer,
"used_by": [
string
],
"status": string,
"location": string
}
]
Examples:
$ cat /proc/modules | jc --proc -p
[
{
"module": "binfmt_misc",
"size": 24576,
"used": 1,
"used_by": [],
"status": "Live",
"location": "0xffffffffc0ab4000"
},
{
"module": "vsock_loopback",
"size": 16384,
"used": 0,
"used_by": [],
"status": "Live",
"location": "0xffffffffc0a14000"
},
{
"module": "vmw_vsock_virtio_transport_common",
"size": 36864,
"used": 1,
"used_by": [
"vsock_loopback"
],
"status": "Live",
"location": "0xffffffffc0a03000"
},
...
]
2022-09-15 16:57:45 -07:00
$ cat /proc/modules | jc --proc_modules -p -r
2022-09-06 10:07:19 -07:00
[
{
"module": "binfmt_misc",
"size": "24576",
"used": "1",
"used_by": [],
"status": "Live",
"location": "0xffffffffc0ab4000"
},
{
"module": "vsock_loopback",
"size": "16384",
"used": "0",
"used_by": [],
"status": "Live",
"location": "0xffffffffc0a14000"
},
{
"module": "vmw_vsock_virtio_transport_common",
"size": "36864",
"used": "1",
"used_by": [
"vsock_loopback"
],
"status": "Live",
"location": "0xffffffffc0a03000"
},
...
]
<a id="jc.parsers.proc_modules.parse"></a>
### parse
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)