mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-10 22:41:51 +02:00
add proc-pid-mountinfo parser (initial)
This commit is contained in:
@@ -7,15 +7,15 @@ jc - JSON Convert `/proc/<pid>/io` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat /proc/<pid>/io | jc --proc
|
||||
$ cat /proc/1/io | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ jc /proc/<pid>/io
|
||||
$ jc /proc/1/io
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/<pid>/io | jc --proc-pid-io
|
||||
$ cat /proc/1/io | jc --proc-pid-io
|
||||
|
||||
Usage (module):
|
||||
|
||||
|
132
docs/parsers/proc_pid_mountinfo.md
Normal file
132
docs/parsers/proc_pid_mountinfo.md
Normal file
@@ -0,0 +1,132 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.proc_pid_mountinfo"></a>
|
||||
|
||||
# jc.parsers.proc\_pid\_mountinfo
|
||||
|
||||
jc - JSON Convert `/proc/<pid>/mountinfo` file parser
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ cat /proc/1/mountinfo | jc --proc
|
||||
|
||||
or
|
||||
|
||||
$ jc /proc/1/mountinfo
|
||||
|
||||
or
|
||||
|
||||
$ cat /proc/1/mountinfo | jc --proc-pid-mountinfo
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc', proc_pid_mountinfo_file)
|
||||
|
||||
or
|
||||
|
||||
import jc
|
||||
result = jc.parse('proc_pid_mountinfo', proc_pid_mountinfo_file)
|
||||
|
||||
Schema:
|
||||
|
||||
[
|
||||
{
|
||||
"module": string,
|
||||
"size": integer,
|
||||
"used": integer,
|
||||
"used_by": [
|
||||
string
|
||||
],
|
||||
"status": string,
|
||||
"location": string
|
||||
}
|
||||
]
|
||||
|
||||
Examples:
|
||||
|
||||
$ cat /proc/1/mountinfo | 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"
|
||||
},
|
||||
...
|
||||
]
|
||||
|
||||
$ cat /proc/1/mountinfo | jc --proc_pid-mountinfo -p -r
|
||||
[
|
||||
{
|
||||
"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_pid_mountinfo.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)
|
Reference in New Issue
Block a user