Re: [PATCH] sysinfo: include availram field in sysinfo struct

Cyrill Gorcunov
2022-01-06T17:27:55Z

On Thu, Jan 06, 2022 at 10:19:55PM +0530, Pintu Agarwal wrote:
> > > diff --git a/include/uapi/linux/sysinfo.h b/include/uapi/linux/sysinfo.h
> > > index 435d5c2..6e77e90 100644
> > > --- a/include/uapi/linux/sysinfo.h
> > > +++ b/include/uapi/linux/sysinfo.h
> > > @@ -12,6 +12,7 @@ struct sysinfo {
> > > __kernel_ulong_t freeram; /* Available memory size */
> > > __kernel_ulong_t sharedram; /* Amount of shared memory */
> > > __kernel_ulong_t bufferram; /* Memory used by buffers */
> > > + __kernel_ulong_t availram; /* Memory available for allocation */
> > > __kernel_ulong_t totalswap; /* Total swap space size */
> > > __kernel_ulong_t freeswap; /* swap space still available */
> > > __u16 procs; /* Number of current processes */
> >
> > Hi! Sorry, but I don't understand -- the sysinfo structure seems to
> > be part of user API, no? Don't we break it up here?
>
> Yes, the corresponding user space header /usr/include/linux/sysinfo.h
> also needs to be updated.
> When we generate the kernel header it will be updated automatically.

Wait. The userspace may pass old structure here, and in result we
return incorrect layout which won't match old one, no? Old binary
code has no clue about this header update.