• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License version 2.
4  *
5  *  This program is distributed in the hope that it will be useful,
6  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
7  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8  *  GNU General Public License for more details.
9  *
10  * Test that the mlockall() function set errno = EINVAL if the flags argument
11  * includes unimplemented flags.
12  */
13 
14 #include <sys/mman.h>
15 #include <stdio.h>
16 #include <errno.h>
17 #include "posixtest.h"
18 
main(void)19 int main(void)
20 {
21 	int result;
22 
23 	result = mlockall(~(MCL_CURRENT | MCL_FUTURE));
24 
25 	if (result == -1 && errno == EINVAL) {
26 		printf("Test PASSED\n");
27 		return PTS_PASS;
28 	} else if (result != -1) {
29 		printf("mlockall() return %i instead of -1.\n", result);
30 		return PTS_FAIL;
31 	} else {
32 		perror("Unexpected error");
33 		return PTS_FAIL;
34 	}
35 }
36