]>
Commit | Line | Data |
---|---|---|
1f5596dd CB |
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
2 | ||
3b5a3233 CB |
3 | #ifndef __LXCFS_BINDINGS_H |
4 | #define __LXCFS_BINDINGS_H | |
5 | ||
1f5596dd CB |
6 | #ifndef _GNU_SOURCE |
7 | #define _GNU_SOURCE | |
8 | #endif | |
9 | ||
10 | #ifndef FUSE_USE_VERSION | |
11 | #define FUSE_USE_VERSION 26 | |
12 | #endif | |
13 | ||
14 | #define _FILE_OFFSET_BITS 64 | |
15 | ||
16 | #include <fuse.h> | |
2aa59b2e | 17 | #include <stdbool.h> |
1f5596dd CB |
18 | #include <stdio.h> |
19 | #include <stdlib.h> | |
20 | #include <sys/stat.h> | |
21 | #include <sys/types.h> | |
22 | #include <unistd.h> | |
23 | ||
2aa59b2e | 24 | #include "cgroup_fuse.h" |
1f5596dd | 25 | #include "config.h" |
17e0e368 | 26 | #include "macro.h" |
1f5596dd CB |
27 | #include "proc_cpuview.h" |
28 | #include "proc_fuse.h" | |
29 | #include "proc_loadavg.h" | |
71f17cd2 | 30 | #include "sysfs_fuse.h" |
17e0e368 | 31 | |
237e200e | 32 | /* directory under which we mount the controllers - /run/lxcfs/controllers */ |
cc97d34c | 33 | #define BASEDIR RUNTIME_PATH "/lxcfs/controllers" |
8cb31294 | 34 | #define ROOTDIR RUNTIME_PATH "/lxcfs/root" |
237e200e | 35 | |
71f17cd2 YB |
36 | /* Maximum number for 64 bit integer is a string with 21 digits: 2^64 - 1 = 21 */ |
37 | #define LXCFS_NUMSTRLEN64 21 | |
38 | ||
71f17cd2 YB |
39 | enum lxcfs_virt_t { |
40 | LXC_TYPE_CGDIR, | |
41 | LXC_TYPE_CGFILE, | |
42 | LXC_TYPE_PROC_MEMINFO, | |
43 | LXC_TYPE_PROC_CPUINFO, | |
44 | LXC_TYPE_PROC_UPTIME, | |
45 | LXC_TYPE_PROC_STAT, | |
46 | LXC_TYPE_PROC_DISKSTATS, | |
47 | LXC_TYPE_PROC_SWAPS, | |
48 | LXC_TYPE_PROC_LOADAVG, | |
49 | LXC_TYPE_SYS_DEVICES, | |
50 | LXC_TYPE_SYS_DEVICES_SYSTEM, | |
51 | LXC_TYPE_SYS_DEVICES_SYSTEM_CPU, | |
52 | LXC_TYPE_SYS_DEVICES_SYSTEM_CPU_ONLINE, | |
53 | }; | |
54 | ||
55 | struct file_info { | |
56 | char *controller; | |
57 | char *cgroup; | |
58 | char *file; | |
59 | int type; | |
99b183fb | 60 | char *buf; /* unused */ |
71f17cd2 | 61 | int buflen; |
99b183fb | 62 | int size; /*actual data size */ |
71f17cd2 YB |
63 | int cached; |
64 | }; | |
65 | ||
7e60aa1b | 66 | struct lxcfs_opts { |
67 | bool swap_off; | |
2aa59b2e | 68 | bool use_pidfd; |
0274438c | 69 | bool use_cfs; |
7e60aa1b | 70 | }; |
71 | ||
71f17cd2 | 72 | extern pid_t lookup_initpid_in_store(pid_t qpid); |
71f17cd2 | 73 | extern void prune_init_slice(char *cg); |
2aa59b2e | 74 | extern bool supports_pidfd(void); |
71f17cd2 | 75 | |
17e0e368 | 76 | #endif /* __LXCFS_BINDINGS_H */ |