]> xenbits.xensource.com Git - libvirt.git/commit
lxcProcReadMeminfo: Fix case when @offset != 0
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 28 Feb 2022 15:30:08 +0000 (16:30 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 7 Mar 2022 13:01:48 +0000 (14:01 +0100)
commit030faee28d14ebcf4d48919b890d2f1e4ebc9e12
tree212a9c93d791a35be296371c428559e1864bc872
parent2de984a26e6dd2648602726d3311aec4117912a9
lxcProcReadMeminfo: Fix case when @offset != 0

The idea behind lxcProcReadMeminfo() is that we read the host's
/proc/meminfo and copy it line by line producing the content for
container, changing only those lines we need. Thus, when a
process inside container opens the file and lseek()-s to a
different position (or reads the content in small chunks), we
mirror the seek in host's /proc/meminfo. But this doesn't work
really. We are not guaranteed to end up aligned on the beginning
of new line. It's better if we construct the new content and then
mimic seeking in it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/lxc/lxc_fuse.c