[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mlockall(2) _really_ locks up



Following code will lock x86-current (3 weeks old) machine. It needs to
be run as root. Running it as unprivliged user doesn't have the same
effect.

I discovered this while trying to compile an app that runs this test in
it's configure script.

Any clues why this happens?

#include <sys/types.h>
#include <sys/mman.h>
#include <errno.h>
#ifndef HAVE_ERRNO_DEF
extern  int     errno;
#endif

int
main()
{
        if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) {
                if (errno == EINVAL || errno ==  ENOMEM ||
                    errno == EPERM  || errno ==  EACCES)
                        exit(0);
                exit(-1);
        }
        exit(0);
}