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