https://github.com/rdbo/libproc
Linux API to abstract information from /proc (WIP)
https://github.com/rdbo/libproc
api c linux process procfs
Last synced: 5 months ago
JSON representation
Linux API to abstract information from /proc (WIP)
- Host: GitHub
- URL: https://github.com/rdbo/libproc
- Owner: rdbo
- License: mit
- Created: 2021-09-19T05:41:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-19T22:03:48.000Z (over 4 years ago)
- Last Synced: 2025-04-10T01:15:01.192Z (10 months ago)
- Topics: api, c, linux, process, procfs
- Language: C
- Homepage:
- Size: 14.6 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libproc
Linux API to abstract information from /proc (WIP)
## Usage
- Include `libproc/libproc.h`
- Compile `libproc/libproc.c`
## Example
The following example shows how to get the name of the current process
through `struct proc`, which contains valuable information about the process,
such as command line, absolute path, ppid, tracer pid, state, environment
variables and much more.
For more examples, look at `tests/tests.c`
```c
#include
int main()
{
struct proc proc;
if (proc_openproc(getpid(), &proc)) {
printf("Error!\n");
return -1;
}
printf("Process name: %s\n", proc.name);
proc_closeproc(&proc);
return 0;
}
```
## Requirements
- Linux headers
- GCC/clang (may work on other compilers too)
## License
Read `LICENSE`