]>
Commit | Line | Data |
---|---|---|
e0043e17 DL |
1 | /* BZ #19408 linux personality syscall wrapper test. |
2 | ||
04277e02 | 3 | Copyright (C) 2015-2019 Free Software Foundation, Inc. |
e0043e17 DL |
4 | This file is part of the GNU C Library. |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public | |
17 | License along with the GNU C Library; if not, see | |
18 | <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #include <errno.h> | |
21 | #include <sys/personality.h> | |
22 | ||
23 | static int | |
24 | do_test (void) | |
25 | { | |
26 | int rc = 0; | |
27 | unsigned int test_persona = -EINVAL; | |
28 | unsigned int saved_persona; | |
29 | ||
30 | errno = 0xdefaced; | |
31 | saved_persona = personality (0xffffffff); | |
32 | ||
c5f65462 JM |
33 | if (personality (test_persona) != saved_persona |
34 | || personality (0xffffffff) == -1 | |
35 | || personality (PER_LINUX) == -1 | |
36 | || personality (0xffffffff) != PER_LINUX | |
37 | || 0xdefaced != errno) | |
e0043e17 DL |
38 | rc = 1; |
39 | ||
40 | (void) personality (saved_persona); | |
41 | return rc; | |
42 | } | |
43 | ||
44 | #define TEST_FUNCTION do_test () | |
45 | #include "../test-skeleton.c" |