Skip to content

Commit e0b62ec

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

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
@@ -46,6 +46,7 @@
4646
#define ROOTDIR "/lxcfs/root"
4747

4848
feature_t per_instance_features[63] = {
49+
{ .name = "disable_uptime", },
4950
{ }
5051
};
5152

src/bindings.h

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

164+
#define LXCFS_FEATURES_DISABLE_UPTIME (1 << 0)
164165
/* bit mask for per-instance configuration options (on/off) */
165166
__u64 features;
166167
};

src/proc_fuse.c

+3
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,9 @@ static int proc_uptime_read(char *buf, size_t size, off_t offset,
948948
return total_len;
949949
}
950950

951+
if (check_set_lxcfs_feature(fc->pid, LXCFS_FEATURE_CHECK, LXCFS_FEATURES_DISABLE_UPTIME))
952+
return read_file_fuse("/proc/uptime", buf, size, d);
953+
951954
reaperage = get_reaper_age(fc->pid);
952955
/*
953956
* To understand why this is done, please read the comment to the

0 commit comments

Comments
 (0)