Skip to content

Commit a6b8d23

Browse files
committed
proc_fuse: add disable_uptime feature
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
1 parent 454e426 commit a6b8d23

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/bindings.c

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "utils.h"
4242

4343
feature_t per_instance_features[63] = {
44+
{ .name = "disable_uptime", },
4445
{ }
4546
};
4647

src/bindings.h

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ struct pidns_store {
165165
/* Do not free on liblxcfs reload (contains useful persistent data) */
166166
bool keep_on_reload;
167167

168+
#define LXCFS_FEATURES_DISABLE_UPTIME (1 << 0)
168169
/* bit mask for per-instance configuration options (on/off) */
169170
__u64 features;
170171
};

src/proc_fuse.c

+3
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,9 @@ static int proc_uptime_read(char *buf, size_t size, off_t offset,
942942
return total_len;
943943
}
944944

945+
if (check_set_lxcfs_feature(fc->pid, LXCFS_FEATURE_CHECK, LXCFS_FEATURES_DISABLE_UPTIME))
946+
return read_file_fuse("/proc/uptime", buf, size, d);
947+
945948
reaperage = get_reaper_age(fc->pid);
946949
/*
947950
* To understand why this is done, please read the comment to the

0 commit comments

Comments
 (0)