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

Re: mlockall(2) _really_ locks up



On Wednesday, Jun 11, 2003, at 20:19 Europe/Amsterdam, Srebrenko Sehic 
wrote:

> 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?

This bug 
<http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=3267> 
was fixed May 20th.

	-Otto

> #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);
> }