micro-utils/libmu/proc_parser.h
2024-07-23 11:33:47 +03:00

48 lines
917 B
C

#ifndef _PROC_PARSER
#define _PROC_PARSER
#include <pwd.h>
#include <grp.h>
#include <limits.h>
struct mu_proc {
/* from status */
uid_t uid;
gid_t gid;
long vmrss;
/* from stat */
pid_t pid;
char cmd[PATH_MAX + 1];
char state;
int ppid;
int pgrp;
int sid;
int tty;
int tpgid;
unsigned flags;
unsigned long minflt;
unsigned long cminflt;
unsigned long majflt;
unsigned long cmajflt;
unsigned long utime;
unsigned long stime;
long cutime;
long cstime;
long priority;
long nice;
long num_threads;
long itrealvalue;
unsigned long long starttime;
unsigned long vsize;
long rss;
/* from cmdline */
char cmdline[PATH_MAX + 1];
};
int mu_proc_status(const char *prog_name, const pid_t pid, struct mu_proc *proc_s);
int mu_proc_stat(const char *prog_name, const pid_t pid, struct mu_proc *proc_s);
int mu_proc_parser(const char *prog_name, const pid_t pid, struct mu_proc *proc_s);
#endif