]>
Commit | Line | Data |
---|---|---|
12788f63 MT |
1 | 2011-09-15 Andreas Schwab <schwab@redhat.com> |
2 | ||
3 | * sysdeps/pthread/list.h: Define only list_t if __need_list_t is | |
4 | defined. | |
5 | (list_add): Add atomic_write_barrier. | |
6 | * descr.h: Define __need_list_t before including <list.h>. | |
7 | * nptl-init.c: Include <list.h> | |
8 | * allocatestack.c: Likewise. | |
9 | ||
10 | 2011-09-15 Andreas Schwab <schwab@redhat.com> | |
11 | ||
12 | * thread_dbP.h: Include <list.h> | |
13 | ||
14 | Index: glibc-2.12-2-gc4ccff1/nptl/allocatestack.c | |
15 | =================================================================== | |
16 | --- glibc-2.12-2-gc4ccff1.orig/nptl/allocatestack.c | |
17 | +++ glibc-2.12-2-gc4ccff1/nptl/allocatestack.c | |
18 | @@ -27,6 +27,7 @@ | |
19 | #include <sys/param.h> | |
20 | #include <dl-sysdep.h> | |
21 | #include <tls.h> | |
22 | +#include <list.h> | |
23 | #include <lowlevellock.h> | |
24 | #include <kernel-features.h> | |
25 | ||
26 | Index: glibc-2.12-2-gc4ccff1/nptl/descr.h | |
27 | =================================================================== | |
28 | --- glibc-2.12-2-gc4ccff1.orig/nptl/descr.h | |
29 | +++ glibc-2.12-2-gc4ccff1/nptl/descr.h | |
30 | @@ -26,6 +26,7 @@ | |
31 | #include <stdbool.h> | |
32 | #include <sys/types.h> | |
33 | #include <hp-timing.h> | |
34 | +#define __need_list_t | |
35 | #include <list.h> | |
36 | #include <lowlevellock.h> | |
37 | #include <pthreaddef.h> | |
38 | Index: glibc-2.12-2-gc4ccff1/nptl/nptl-init.c | |
39 | =================================================================== | |
40 | --- glibc-2.12-2-gc4ccff1.orig/nptl/nptl-init.c | |
41 | +++ glibc-2.12-2-gc4ccff1/nptl/nptl-init.c | |
42 | @@ -29,6 +29,7 @@ | |
43 | #include <atomic.h> | |
44 | #include <ldsodefs.h> | |
45 | #include <tls.h> | |
46 | +#include <list.h> | |
47 | #include <fork.h> | |
48 | #include <version.h> | |
49 | #include <shlib-compat.h> | |
50 | Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/list.h | |
51 | =================================================================== | |
52 | --- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/pthread/list.h | |
53 | +++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/list.h | |
54 | @@ -18,27 +18,39 @@ | |
55 | 02111-1307 USA. */ | |
56 | ||
57 | #ifndef _LIST_H | |
58 | -#define _LIST_H 1 | |
59 | + | |
60 | +#ifndef __need_list_t | |
61 | +# define _LIST_H 1 | |
62 | +#endif | |
63 | ||
64 | /* The definitions of this file are adopted from those which can be | |
65 | found in the Linux kernel headers to enable people familiar with | |
66 | the latter find their way in these sources as well. */ | |
67 | ||
68 | ||
69 | +#if defined __need_list_t || defined _LIST_H | |
70 | +# ifndef __list_t_defined | |
71 | +# define __list_t_defined | |
72 | /* Basic type for the double-link list. */ | |
73 | typedef struct list_head | |
74 | { | |
75 | struct list_head *next; | |
76 | struct list_head *prev; | |
77 | } list_t; | |
78 | +# endif | |
79 | +# undef __need_list_t | |
80 | +#endif | |
81 | + | |
82 | +#ifdef _LIST_H | |
83 | ||
84 | +# include <atomic.h> | |
85 | ||
86 | /* Define a variable with the head and tail of the list. */ | |
87 | -#define LIST_HEAD(name) \ | |
88 | +# define LIST_HEAD(name) \ | |
89 | list_t name = { &(name), &(name) } | |
90 | ||
91 | /* Initialize a new list head. */ | |
92 | -#define INIT_LIST_HEAD(ptr) \ | |
93 | +# define INIT_LIST_HEAD(ptr) \ | |
94 | (ptr)->next = (ptr)->prev = (ptr) | |
95 | ||
96 | ||
97 | @@ -49,6 +61,7 @@ list_add (list_t *newp, list_t *head) | |
98 | newp->next = head->next; | |
99 | newp->prev = head; | |
100 | head->next->prev = newp; | |
101 | + atomic_write_barrier (); | |
102 | head->next = newp; | |
103 | } | |
104 | ||
105 | @@ -78,26 +91,28 @@ list_splice (list_t *add, list_t *head) | |
106 | ||
107 | ||
108 | /* Get typed element from list at a given position. */ | |
109 | -#define list_entry(ptr, type, member) \ | |
110 | +# define list_entry(ptr, type, member) \ | |
111 | ((type *) ((char *) (ptr) - (unsigned long) (&((type *) 0)->member))) | |
112 | ||
113 | ||
114 | ||
115 | /* Iterate forward over the elements of the list. */ | |
116 | -#define list_for_each(pos, head) \ | |
117 | +# define list_for_each(pos, head) \ | |
118 | for (pos = (head)->next; pos != (head); pos = pos->next) | |
119 | ||
120 | ||
121 | /* Iterate forward over the elements of the list. */ | |
122 | -#define list_for_each_prev(pos, head) \ | |
123 | +# define list_for_each_prev(pos, head) \ | |
124 | for (pos = (head)->prev; pos != (head); pos = pos->prev) | |
125 | ||
126 | ||
127 | /* Iterate backwards over the elements list. The list elements can be | |
128 | removed from the list while doing this. */ | |
129 | -#define list_for_each_prev_safe(pos, p, head) \ | |
130 | +# define list_for_each_prev_safe(pos, p, head) \ | |
131 | for (pos = (head)->prev, p = pos->prev; \ | |
132 | pos != (head); \ | |
133 | pos = p, p = pos->prev) | |
134 | ||
135 | +#endif /* _LIST_H */ | |
136 | + | |
137 | #endif /* list.h */ | |
138 | Index: glibc-2.12-2-gc4ccff1/nptl_db/thread_dbP.h | |
139 | =================================================================== | |
140 | --- glibc-2.12-2-gc4ccff1.orig/nptl_db/thread_dbP.h | |
141 | +++ glibc-2.12-2-gc4ccff1/nptl_db/thread_dbP.h | |
142 | @@ -29,6 +29,7 @@ | |
143 | #include "proc_service.h" | |
144 | #include "thread_db.h" | |
145 | #include "../nptl/pthreadP.h" /* This is for *_BITMASK only. */ | |
146 | +#include <list.h> | |
147 | ||
148 | /* Indeces for the symbol names. */ | |
149 | enum |