1 |
spock 08/03/25 09:00:16 |
2 |
|
3 |
Added: openrc-strlist-abi.patch |
4 |
Log: |
5 |
Fix breakage caused by openrc ABI change (patch by Roy Marples). |
6 |
(Portage version: 2.1.4.4) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 media-gfx/splashutils/files/openrc-strlist-abi.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/splashutils/files/openrc-strlist-abi.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-gfx/splashutils/files/openrc-strlist-abi.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: openrc-strlist-abi.patch |
15 |
=================================================================== |
16 |
--- splash.c.orig 2008-03-16 15:09:37.000000000 +0000 |
17 |
+++ splash.c 2008-03-16 17:40:24.000000000 +0000 |
18 |
@@ -26,6 +26,18 @@ |
19 |
#include <rc.h> |
20 |
#include <fbsplash.h> |
21 |
|
22 |
+/* Some queue.h implenetations don't have this macro */ |
23 |
+#ifndef TAILQ_CONCAT |
24 |
+#define TAILQ_CONCAT(head1, head2, field) do { \ |
25 |
+ if (!TAILQ_EMPTY(head2)) { \ |
26 |
+ *(head1)->tqh_last = (head2)->tqh_first; \ |
27 |
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ |
28 |
+ (head1)->tqh_last = (head2)->tqh_last; \ |
29 |
+ TAILQ_INIT((head2)); \ |
30 |
+ } \ |
31 |
+} while (0) |
32 |
+#endif |
33 |
+ |
34 |
#define SPLASH_CMD "export SPLASH_XRES='%d'; export SPLASH_YRES='%d';" \ |
35 |
"export SOFTLEVEL='%s'; export BOOTLEVEL='%s';" \ |
36 |
"export DEFAULTLEVEL='%s'; export svcdir=${RC_SVCDIR};" \ |
37 |
@@ -33,8 +45,8 @@ |
38 |
|
39 |
static char *bootlevel = NULL; |
40 |
static char *defaultlevel = NULL; |
41 |
-static char **svcs = NULL; |
42 |
-static char **svcs_done = NULL; |
43 |
+static RC_STRINGLIST *svcs = NULL; |
44 |
+static RC_STRINGLIST *svcs_done = NULL; |
45 |
static int svcs_cnt = 0; |
46 |
static int svcs_done_cnt = 0; |
47 |
static pid_t pid_daemon = 0; |
48 |
@@ -46,37 +58,29 @@ |
49 |
/* |
50 |
* Check whether a strlist contains a specific item. |
51 |
*/ |
52 |
-static bool list_has(char **list, const char *item) |
53 |
+static bool list_has(RC_STRINGLIST *list, const char *item) |
54 |
{ |
55 |
- for (; list && *list; list++) { |
56 |
- if (strcmp(*list, item) == 0) |
57 |
- return true; |
58 |
- } |
59 |
- return false; |
60 |
-} |
61 |
+ RC_STRING *s; |
62 |
|
63 |
-/* |
64 |
- * Merge two strlists keeping them sorted. |
65 |
- */ |
66 |
-static char** strlist_merge_sort(char **dest, char **src) |
67 |
-{ |
68 |
- int i; |
69 |
- |
70 |
- for (i = 0; src && src[i]; i++) { |
71 |
- rc_strlist_addsort(&dest, src[i]); |
72 |
+ if (list) { |
73 |
+ TAILQ_FOREACH(s, list, entries) |
74 |
+ if (strcmp(s->value, item) == 0) |
75 |
+ return true; |
76 |
} |
77 |
- return dest; |
78 |
+ return false; |
79 |
} |
80 |
|
81 |
/* |
82 |
* Count the number of items in a strlist. |
83 |
*/ |
84 |
-static int strlist_count(char **list) |
85 |
+static int strlist_count(RC_STRINGLIST *list) |
86 |
{ |
87 |
- int c; |
88 |
+ RC_STRING *s; |
89 |
+ int c = 0; |
90 |
|
91 |
- for (c = 0; list && *list; list++) |
92 |
- c++; |
93 |
+ if (list) |
94 |
+ TAILQ_FOREACH(s, list, entries) |
95 |
+ c++; |
96 |
|
97 |
return c; |
98 |
} |
99 |
@@ -85,7 +89,7 @@ |
100 |
* Create a strlist from a file pointer. Can be used |
101 |
* to get a list of words printed by an app/script. |
102 |
*/ |
103 |
-static char **get_list_fp(char **list, FILE *fp) |
104 |
+static void get_list_fp(RC_STRINGLIST *list, FILE *fp) |
105 |
{ |
106 |
char buffer[512]; |
107 |
char *p; |
108 |
@@ -109,30 +113,25 @@ |
109 |
|
110 |
while ((p = strsep(&token, " ")) != NULL) { |
111 |
if (strlen(p) > 1) { |
112 |
- rc_strlist_add(&list, p); |
113 |
+ rc_stringlist_add(list, p); |
114 |
} |
115 |
} |
116 |
} |
117 |
- |
118 |
- return list; |
119 |
} |
120 |
|
121 |
/* |
122 |
* Create a strlist from a file. Used for svcs_start/svcs_stop. |
123 |
*/ |
124 |
-static char **get_list(char **list, const char *file) |
125 |
+static void get_list(RC_STRINGLIST *list, const char *file) |
126 |
{ |
127 |
FILE *fp; |
128 |
|
129 |
if (!(fp = fopen(file, "r"))) { |
130 |
ewarn("%s: `%s': %s", __func__, file, strerror(errno)); |
131 |
- return list; |
132 |
+ } else { |
133 |
+ get_list_fp(list, fp); |
134 |
+ fclose(fp); |
135 |
} |
136 |
- |
137 |
- list = get_list_fp(list, fp); |
138 |
- fclose(fp); |
139 |
- |
140 |
- return list; |
141 |
} |
142 |
|
143 |
/* |
144 |
@@ -140,7 +139,7 @@ |
145 |
*/ |
146 |
static int splash_config_gentoo(fbspl_cfg_t *cfg, fbspl_type_t type) |
147 |
{ |
148 |
- char **confd; |
149 |
+ RC_STRINGLIST *confd; |
150 |
char *t; |
151 |
|
152 |
confd = rc_config_load("/etc/conf.d/splash"); |
153 |
@@ -232,7 +231,7 @@ |
154 |
} |
155 |
} |
156 |
|
157 |
- rc_strlist_free(confd); |
158 |
+ rc_stringlist_free(confd); |
159 |
return 0; |
160 |
} |
161 |
|
162 |
@@ -244,7 +243,7 @@ |
163 |
{ |
164 |
char *c; |
165 |
int l; |
166 |
- char *soft = getenv("RC_SOFTLEVEL"); |
167 |
+ char *soft = getenv("RC_RUNLEVEL"); |
168 |
|
169 |
if (!cmd || !soft) |
170 |
return -1; |
171 |
@@ -353,7 +352,7 @@ |
172 |
*/ |
173 |
static int splash_init(bool start) |
174 |
{ |
175 |
- char **tmp; |
176 |
+ RC_STRINGLIST *tmp; |
177 |
|
178 |
config->verbosity = FBSPL_VERB_QUIET; |
179 |
if (fbsplash_check_daemon(&pid_daemon)) { |
180 |
@@ -363,43 +362,61 @@ |
181 |
|
182 |
config->verbosity = FBSPL_VERB_NORMAL; |
183 |
|
184 |
- if (svcs) |
185 |
+ if (svcs) { |
186 |
ewarn("%s: We already have a svcs list!", __func__); |
187 |
+ rc_stringlist_free(svcs); |
188 |
+ } |
189 |
+ svcs = rc_stringlist_new(); |
190 |
|
191 |
/* Booting.. */ |
192 |
if (start) { |
193 |
- svcs = get_list(NULL, FBSPLASH_CACHEDIR"/svcs_start"); |
194 |
+ get_list(svcs, FBSPLASH_CACHEDIR"/svcs_start"); |
195 |
svcs_cnt = strlist_count(svcs); |
196 |
|
197 |
svcs_done = rc_services_in_state(RC_SERVICE_STARTED); |
198 |
|
199 |
tmp = rc_services_in_state(RC_SERVICE_INACTIVE); |
200 |
- svcs_done = strlist_merge_sort(svcs_done, tmp); |
201 |
- rc_strlist_free(tmp); |
202 |
+ if (svcs_done && tmp) { |
203 |
+ TAILQ_CONCAT(svcs_done, tmp, entries); |
204 |
+ free(tmp); |
205 |
+ } else if (tmp) |
206 |
+ svcs_done = tmp; |
207 |
|
208 |
tmp = rc_services_in_state(RC_SERVICE_FAILED); |
209 |
- svcs_done = strlist_merge_sort(svcs_done, tmp); |
210 |
- rc_strlist_free(tmp); |
211 |
+ if (svcs_done && tmp) { |
212 |
+ TAILQ_CONCAT(svcs_done, tmp, entries); |
213 |
+ free(tmp); |
214 |
+ } else if (tmp) |
215 |
+ svcs_done = tmp; |
216 |
|
217 |
tmp = rc_services_in_state(RC_SERVICE_SCHEDULED); |
218 |
- svcs_done = strlist_merge_sort(svcs_done, tmp); |
219 |
- rc_strlist_free(tmp); |
220 |
+ if (svcs_done && tmp) { |
221 |
+ TAILQ_CONCAT(svcs_done, tmp, entries); |
222 |
+ free(tmp); |
223 |
+ } else if (tmp) |
224 |
+ svcs_done = tmp; |
225 |
|
226 |
svcs_done_cnt = strlist_count(svcs_done); |
227 |
/* .. or rebooting? */ |
228 |
} else { |
229 |
- svcs = get_list(NULL, FBSPLASH_CACHEDIR"/svcs_stop"); |
230 |
+ get_list(svcs, FBSPLASH_CACHEDIR"/svcs_stop"); |
231 |
svcs_cnt = strlist_count(svcs); |
232 |
|
233 |
svcs_done = rc_services_in_state(RC_SERVICE_STARTED); |
234 |
|
235 |
tmp = rc_services_in_state(RC_SERVICE_STARTING); |
236 |
- svcs_done = strlist_merge_sort(svcs_done, tmp); |
237 |
- rc_strlist_free(tmp); |
238 |
+ if (svcs_done && tmp) { |
239 |
+ TAILQ_CONCAT(svcs_done, tmp, entries); |
240 |
+ free(tmp); |
241 |
+ } else if (tmp) |
242 |
+ svcs_done = tmp; |
243 |
|
244 |
tmp = rc_services_in_state(RC_SERVICE_INACTIVE); |
245 |
- svcs_done = strlist_merge_sort(svcs_done, tmp); |
246 |
- rc_strlist_free(tmp); |
247 |
+ if (svcs_done && tmp) { |
248 |
+ TAILQ_CONCAT(svcs_done, tmp, entries); |
249 |
+ free(tmp); |
250 |
+ } else if (tmp) |
251 |
+ svcs_done = tmp; |
252 |
|
253 |
svcs_done_cnt = svcs_cnt - strlist_count(svcs_done); |
254 |
} |
255 |
@@ -424,7 +441,7 @@ |
256 |
if (list_has(svcs_done, name)) |
257 |
return 0; |
258 |
|
259 |
- rc_strlist_add(&svcs_done, name); |
260 |
+ rc_stringlist_add(svcs_done, name); |
261 |
svcs_done_cnt++; |
262 |
} |
263 |
|
264 |
@@ -445,10 +462,11 @@ |
265 |
*/ |
266 |
int splash_svcs_start() |
267 |
{ |
268 |
- rc_depinfo_t *deptree; |
269 |
+ RC_DEPTREE *deptree; |
270 |
FILE *fp; |
271 |
- char **t, **deporder, *s, *r; |
272 |
- int i, j, err = 0; |
273 |
+ RC_STRINGLIST *t, *deporder; |
274 |
+ RC_STRING *s, *r; |
275 |
+ int i, err = 0; |
276 |
|
277 |
fp = fopen(FBSPLASH_CACHEDIR"/svcs_start", "w"); |
278 |
if (!fp) { |
279 |
@@ -465,12 +483,13 @@ |
280 |
deporder = rc_deptree_order(deptree, bootlevel, RC_DEP_START); |
281 |
|
282 |
/* Save what we've got so far to the svcs_start. */ |
283 |
- i = 0; |
284 |
- if (deporder && deporder[0]) { |
285 |
- while ((s = deporder[i++])) { |
286 |
- if (i > 1) |
287 |
+ if (deporder) { |
288 |
+ i = 0; |
289 |
+ TAILQ_FOREACH(s, deporder, entries) { |
290 |
+ if (i > 0) |
291 |
fprintf(fp, " "); |
292 |
- fprintf(fp, "%s", s); |
293 |
+ fprintf(fp, "%s", s->value); |
294 |
+ i++; |
295 |
} |
296 |
} |
297 |
|
298 |
@@ -479,21 +498,18 @@ |
299 |
|
300 |
/* Print the new services and skip ones that have already been started |
301 |
* in the 'boot' runlevel. */ |
302 |
- i = 0; |
303 |
- if (deporder && deporder[0]) { |
304 |
- while ((s = deporder[i])) { |
305 |
- j = 0; |
306 |
- while ((r = t[j++])) { |
307 |
- if (!strcmp(deporder[i], r)) |
308 |
- goto next; |
309 |
+ if (deporder) { |
310 |
+ TAILQ_FOREACH(s, deporder, entries) { |
311 |
+ TAILQ_FOREACH(r, t, entries) { |
312 |
+ if (!strcmp(s->value, r->value)) |
313 |
+ break; |
314 |
} |
315 |
- fprintf(fp, " %s", s); |
316 |
-next: i++; |
317 |
+ fprintf(fp, " %s", s->value); |
318 |
} |
319 |
} |
320 |
|
321 |
- rc_strlist_free(deporder); |
322 |
- rc_strlist_free(t); |
323 |
+ rc_stringlist_free(deporder); |
324 |
+ rc_stringlist_free(t); |
325 |
rc_deptree_free(deptree); |
326 |
|
327 |
out: |
328 |
@@ -506,8 +522,9 @@ |
329 |
*/ |
330 |
int splash_svcs_stop(const char *runlevel) |
331 |
{ |
332 |
- rc_depinfo_t *deptree; |
333 |
- char **deporder, *s; |
334 |
+ RC_DEPTREE *deptree; |
335 |
+ RC_STRINGLIST *deporder; |
336 |
+ RC_STRING *s; |
337 |
FILE *fp; |
338 |
int i, err = 0; |
339 |
|
340 |
@@ -524,17 +541,18 @@ |
341 |
} |
342 |
|
343 |
deporder = rc_deptree_order(deptree, runlevel, RC_DEP_STOP); |
344 |
- |
345 |
- i = 0; |
346 |
- if (deporder && deporder[0]) { |
347 |
- while ((s = deporder[i++])) { |
348 |
- if (i > 1) |
349 |
+ |
350 |
+ if (deporder) { |
351 |
+ i = 0; |
352 |
+ TAILQ_FOREACH(s, deporder, entries) { |
353 |
+ if (i > 0) |
354 |
fprintf(fp, " "); |
355 |
- fprintf(fp, "%s", s); |
356 |
+ fprintf(fp, "%s", s->value); |
357 |
+ i++; |
358 |
} |
359 |
} |
360 |
|
361 |
- rc_strlist_free(deporder); |
362 |
+ rc_stringlist_free(deporder); |
363 |
rc_deptree_free(deptree); |
364 |
out: |
365 |
fclose(fp); |
366 |
@@ -547,8 +565,9 @@ |
367 |
static int splash_start(const char *runlevel) |
368 |
{ |
369 |
bool start; |
370 |
- int i, err = 0; |
371 |
+ int err = 0; |
372 |
char buf[2048]; |
373 |
+ RC_STRING *s; |
374 |
|
375 |
/* Get a list of services that we'll have to handle. */ |
376 |
/* We're rebooting/shutting down. */ |
377 |
@@ -592,9 +611,9 @@ |
378 |
return err; |
379 |
|
380 |
/* Set the initial state of all services. */ |
381 |
- for (i = 0; svcs && svcs[i]; i++) { |
382 |
- splash_svc_state(svcs[i], start ? "svc_inactive_start" : "svc_inactive_stop", 0); |
383 |
- } |
384 |
+ if (svcs) |
385 |
+ TAILQ_FOREACH(s, svcs, entries) |
386 |
+ splash_svc_state(s->value, start ? "svc_inactive_start" : "svc_inactive_stop", 0); |
387 |
|
388 |
fbsplash_set_evdev(); |
389 |
fbsplash_send("set autoverbose %d\n", config->autoverbose); |
390 |
@@ -640,7 +659,7 @@ |
391 |
} |
392 |
} |
393 |
|
394 |
-int rc_plugin_hook (rc_hook_t hook, const char *name) |
395 |
+int rc_plugin_hook(RC_HOOK hook, const char *name) |
396 |
{ |
397 |
int i = 0; |
398 |
fbspl_type_t type = fbspl_bootup; |
399 |
@@ -665,18 +684,19 @@ |
400 |
if (name && !strcmp(name, RC_LEVEL_SYSINIT)) { |
401 |
if (hook == RC_HOOK_RUNLEVEL_START_OUT && rc_service_in_runlevel("autoconfig", defaultlevel)) { |
402 |
FILE *fp; |
403 |
- char **list = NULL; |
404 |
- int i; |
405 |
+ RC_STRINGLIST *list; |
406 |
+ RC_STRING *s; |
407 |
|
408 |
fp = popen("if [ -e /etc/init.d/autoconfig ]; then . /etc/init.d/autoconfig ; list_services ; fi", "r"); |
409 |
if (!fp) |
410 |
goto exit; |
411 |
|
412 |
- list = get_list_fp(NULL, fp); |
413 |
- for (i = 0; list && list[i]; i++) { |
414 |
- rc_service_mark(list[i], RC_SERVICE_COLDPLUGGED); |
415 |
- } |
416 |
+ list = rc_stringlist_new(); |
417 |
+ get_list_fp(list, fp); |
418 |
+ TAILQ_FOREACH(s, list, entries) |
419 |
+ rc_service_mark(s->value, RC_SERVICE_COLDPLUGGED); |
420 |
pclose(fp); |
421 |
+ rc_stringlist_free(list); |
422 |
} |
423 |
goto exit; |
424 |
} |
425 |
@@ -920,12 +940,8 @@ |
426 |
break; |
427 |
} |
428 |
|
429 |
- if (svcs) { |
430 |
- rc_strlist_free(svcs); |
431 |
- svcs = NULL; |
432 |
- } |
433 |
- |
434 |
-exit: |
435 |
+exit: |
436 |
+ rc_stringlist_free(svcs); |
437 |
free (runlev); |
438 |
return i; |
439 |
} |
440 |
|
441 |
|
442 |
|
443 |
-- |
444 |
gentoo-commits@l.g.o mailing list |