[CRIU] [PATCH 2/4] prctl: kerndat -- Add kerndat_prctl_may_use_mm_map helper

Cyrill Gorcunov gorcunov at gmail.com
Tue Aug 5 23:49:57 PDT 2014


On Wed, Aug 06, 2014 at 10:43:30AM +0400, Pavel Emelyanov wrote:
> On 07/25/2014 06:12 PM, Cyrill Gorcunov wrote:
> > 
> > It tests if new prctl interface is present in the kernel
> > and will be used on restore and check procedures.
> > 
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  include/kerndat.h |  2 ++
> >  kerndat.c         | 18 ++++++++++++++++++
> >  2 files changed, 20 insertions(+)
> > 
> > +int kerndat_prctl_may_use_mm_map(void)
> > +{
> > +	static int prctl_may_use_mm_map = -1;
> > +
> > +	if (prctl_may_use_mm_map == -1) {
> 
> Why not just in the pie code do
> 
> if (prlctl(NEWAPI) == EOPNOTSUPP))
> 	prlctl(OLDAPI);

This allows to not call prctl syscall twice. I mean -- we call it
only once here and then we reuse the prctl_may_use_mm_map variable
status. That's the only reason. cr-restore.c uses it.


More information about the CRIU mailing list