Print this page
10076 make usr/src/test smatch clean
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/test/os-tests/tests/i386/ldt.c
+++ new/usr/src/test/os-tests/tests/i386/ldt.c
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright 2018 Joyent, Inc.
14 14 */
15 15
16 16 #include <sys/types.h>
17 17 #include <sys/sysi86.h>
18 18 #include <sys/segments.h>
19 19 #include <sys/segment.h>
20 20 #include <unistd.h>
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21 #include <string.h>
22 22 #include <errno.h>
23 23 #include <pthread.h>
24 24 #include <err.h>
25 25
26 26 char foo[4096];
27 27
28 28 static void *
29 29 donothing(void *nothing)
30 30 {
31 - sleep(5);
31 + (void) sleep(5);
32 32 return (NULL);
33 33 }
34 34
35 35 int
36 36 main(void)
37 37 {
38 38 pthread_t tid;
39 39
40 40 /*
41 41 * This first is similar to what sbcl does in some variants. Note the
42 42 * SDT_MEMRW (not SDT_MEMRWA) so we check that the kernel is forcing the
43 43 * 'accessed' bit too.
44 44 */
45 45 int sel = SEL_LDT(7);
46 46
47 47 struct ssd ssd = { sel, (unsigned long)&foo, 4096,
48 48 SDT_MEMRW | (SEL_UPL << 5) | (1 << 7), 0x4 };
49 49
50 50 if (sysi86(SI86DSCR, &ssd) < 0)
51 51 err(-1, "failed to setup segment");
52 52
53 53 __asm__ __volatile__("mov %0, %%fs" : : "r" (sel));
54 54
55 55 ssd.acc1 = 0;
56 56
57 57 if (sysi86(SI86DSCR, &ssd) == 0)
58 58 errx(-1, "removed in-use segment?");
59 59
60 60 __asm__ __volatile__("mov %0, %%fs" : : "r" (0));
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
61 61
62 62 if (sysi86(SI86DSCR, &ssd) < 0)
63 63 err(-1, "failed to remove segment");
64 64
65 65 for (int i = 0; i < MAXNLDT; i++) {
66 66 ssd.sel = SEL_LDT(i);
67 67 (void) sysi86(SI86DSCR, &ssd);
68 68 }
69 69
70 70 for (int i = 0; i < 10; i++)
71 - pthread_create(&tid, NULL, donothing, NULL);
71 + (void) pthread_create(&tid, NULL, donothing, NULL);
72 72
73 73 if (forkall() == 0) {
74 - sleep(2);
74 + (void) sleep(2);
75 75 _exit(0);
76 76 }
77 77
78 - sleep(6);
78 + (void) sleep(6);
79 79 return (0);
80 80 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX