]> git.proxmox.com Git - mirror_iproute2.git/blame - misc/lnstat.h
ss: Remove useless width specifier in process context print
[mirror_iproute2.git] / misc / lnstat.h
CommitLineData
4677a549
SH
1#ifndef _LNSTAT_H
2#define _LNSTAT_H
3
4#include <limits.h>
dd9cc0ee 5#include <sys/select.h>
4677a549
SH
6
7#define LNSTAT_VERSION "0.02 041002"
8
9#define PROC_NET_STAT "/proc/net/stat"
10
11#define LNSTAT_MAX_FILES 32
12#define LNSTAT_MAX_FIELDS_PER_LINE 32
13#define LNSTAT_MAX_FIELD_NAME_LEN 32
14
15struct lnstat_file;
16
17struct lnstat_field {
18 struct lnstat_file *file;
19 unsigned int num; /* field number in line */
20 char name[LNSTAT_MAX_FIELD_NAME_LEN+1];
21 unsigned long values[2]; /* two buffers for values */
22 unsigned long result;
23};
24
25struct lnstat_file {
26 struct lnstat_file *next;
27 char path[PATH_MAX+1];
28 char basename[NAME_MAX+1];
29 struct timeval last_read; /* last time of read */
30 struct timeval interval; /* interval */
31 int compat; /* 1 == backwards compat mode */
32 FILE *fp;
33 unsigned int num_fields; /* number of fields */
34 struct lnstat_field fields[LNSTAT_MAX_FIELDS_PER_LINE];
35};
36
37
38struct lnstat_file *lnstat_scan_dir(const char *path, const int num_req_files,
39 const char **req_files);
40int lnstat_update(struct lnstat_file *lnstat_files);
41int lnstat_dump(FILE *outfd, struct lnstat_file *lnstat_files);
42struct lnstat_field *lnstat_find_field(struct lnstat_file *lnstat_files,
43 const char *name);
44#endif /* _LNSTAT_H */