Skip to content

Commit

Permalink
proc_fuse: add disable_uptime feature
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
  • Loading branch information
mihalicyn committed Jun 10, 2024
1 parent 9e9b297 commit e0b62ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#define ROOTDIR "/lxcfs/root"

feature_t per_instance_features[63] = {
{ .name = "disable_uptime", },
{ }
};

Expand Down
1 change: 1 addition & 0 deletions src/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ struct pidns_store {
/* Do not free on liblxcfs reload (contains useful persistent data) */
bool keep_on_reload;

#define LXCFS_FEATURES_DISABLE_UPTIME (1 << 0)
/* bit mask for per-instance configuration options (on/off) */
__u64 features;
};
Expand Down
3 changes: 3 additions & 0 deletions src/proc_fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,9 @@ static int proc_uptime_read(char *buf, size_t size, off_t offset,
return total_len;
}

if (check_set_lxcfs_feature(fc->pid, LXCFS_FEATURE_CHECK, LXCFS_FEATURES_DISABLE_UPTIME))
return read_file_fuse("/proc/uptime", buf, size, d);

reaperage = get_reaper_age(fc->pid);
/*
* To understand why this is done, please read the comment to the
Expand Down

0 comments on commit e0b62ec

Please sign in to comment.