]>
Commit | Line | Data |
---|---|---|
bb330e25 AF |
1 | diff -pruN glibc-2.17-c758a686/nptl/Makefile glibc-2.17-c758a686.new/nptl/Makefile |
2 | --- glibc-2.17-c758a686/nptl/Makefile 2013-07-31 11:51:24.882747234 +0530 | |
3 | +++ glibc-2.17-c758a686.new/nptl/Makefile 2013-07-31 11:58:55.964731526 +0530 | |
4 | @@ -276,10 +276,7 @@ gen-as-const-headers = pthread-errnos.sy | |
5 | LDFLAGS-tst-cond24 = -lrt | |
6 | LDFLAGS-tst-cond25 = -lrt | |
7 | ||
8 | -# The size is 1MB + 4KB. The extra 4KB has been added to prevent allocatestack | |
9 | -# from resizing the input size to avoid the 64K aliasing conflict on Intel | |
10 | -# processors. | |
11 | -DEFAULT_STACKSIZE=1052672 | |
12 | +DEFAULT_STACKSIZE=1048576 | |
13 | CFLAGS-tst-default-attr.c = -DDEFAULT_STACKSIZE=$(DEFAULT_STACKSIZE) | |
14 | tst-default-attr-ENV = GLIBC_PTHREAD_STACKSIZE=$(DEFAULT_STACKSIZE) | |
15 | ||
16 | diff -pruN glibc-2.17-c758a686/nptl/tst-default-attr.c glibc-2.17-c758a686.new/nptl/tst-default-attr.c | |
17 | --- glibc-2.17-c758a686/nptl/tst-default-attr.c 2013-07-31 11:51:24.885747234 +0530 | |
18 | +++ glibc-2.17-c758a686.new/nptl/tst-default-attr.c 2013-07-31 12:18:10.016691337 +0530 | |
19 | @@ -38,6 +38,7 @@ | |
20 | ||
21 | /* DEFAULT_STACKSIZE macro is defined in the Makefile. */ | |
22 | static size_t stacksize = DEFAULT_STACKSIZE; | |
23 | +long int pagesize; | |
24 | ||
25 | static int | |
26 | verify_stacksize_result (pthread_attr_t *attr) | |
27 | @@ -46,12 +47,20 @@ verify_stacksize_result (pthread_attr_t | |
28 | ||
29 | RETURN_IF_FAIL (pthread_attr_getstacksize, attr, &stack); | |
30 | ||
31 | - if (stacksize != stack) | |
32 | + /* pthread_create perturbs the stack size by a page if it aligns to 64K to | |
33 | + avoid the 64K aliasing conflict. We cannot simply add 4K to the size in | |
34 | + the Makefile because it breaks the test on powerpc since the page size | |
35 | + there is 64K, resulting in a resize in __pthread_initialize_minimal. | |
36 | + Hence, our check is to ensure that the stack size is not more than a page | |
37 | + more than the requested size. */ | |
38 | + if (stack < stacksize || stack > stacksize + pagesize) | |
39 | { | |
40 | printf ("failed to set default stacksize (%zu, %zu)\n", stacksize, stack); | |
41 | return 1; | |
42 | } | |
43 | ||
44 | + printf ("Requested %zu and got %zu\n", stacksize, stack); | |
45 | + | |
46 | return 0; | |
47 | } | |
48 | ||
49 | @@ -101,6 +110,15 @@ run_threads (void) | |
50 | static int | |
51 | do_test (void) | |
52 | { | |
53 | + pthread_attr_t attr; | |
54 | + | |
55 | + pagesize = sysconf (_SC_PAGESIZE); | |
56 | + if (pagesize < 0) | |
57 | + { | |
58 | + printf ("sysconf failed: %s\n", strerror (errno)); | |
59 | + return 1; | |
60 | + } | |
61 | + | |
62 | RETURN_IF_FAIL (run_threads); | |
63 | return 0; | |
64 | } |