diff options
14 files changed, 1300 insertions, 7 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch b/meta/recipes-core/systemd/systemd/0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch new file mode 100644 index 0000000000..35599d44c2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From 3ca5326485cb19e775af6de615c17be66e44e472 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 24 Oct 2017 23:08:24 -0700 | ||
| 4 | Subject: [PATCH] Define _PATH_WTMPX and _PATH_UTMPX if not defined | ||
| 5 | |||
| 6 | Musl needs these defines | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | src/shared/utmp-wtmp.c | 8 ++++++++ | ||
| 13 | 1 file changed, 8 insertions(+) | ||
| 14 | |||
| 15 | diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c | ||
| 16 | index 9750dcd81..bd55d74a1 100644 | ||
| 17 | --- a/src/shared/utmp-wtmp.c | ||
| 18 | +++ b/src/shared/utmp-wtmp.c | ||
| 19 | @@ -27,6 +27,7 @@ | ||
| 20 | #include <sys/time.h> | ||
| 21 | #include <sys/utsname.h> | ||
| 22 | #include <unistd.h> | ||
| 23 | +#include <utmp.h> | ||
| 24 | #include <utmpx.h> | ||
| 25 | |||
| 26 | #include "alloc-util.h" | ||
| 27 | @@ -41,6 +42,13 @@ | ||
| 28 | #include "util.h" | ||
| 29 | #include "utmp-wtmp.h" | ||
| 30 | |||
| 31 | +#if defined _PATH_UTMP && !defined _PATH_UTMPX | ||
| 32 | +# define _PATH_UTMPX _PATH_UTMP | ||
| 33 | +#endif | ||
| 34 | +#if defined _PATH_WTMP && !defined _PATH_WTMPX | ||
| 35 | +# define _PATH_WTMPX _PATH_WTMP | ||
| 36 | +#endif | ||
| 37 | + | ||
| 38 | int utmp_get_runlevel(int *runlevel, int *previous) { | ||
| 39 | struct utmpx *found, lookup = { .ut_type = RUN_LVL }; | ||
| 40 | int r; | ||
| 41 | -- | ||
| 42 | 2.14.3 | ||
| 43 | |||
diff --git a/meta/recipes-core/systemd/systemd/0001-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0001-add-fallback-parse_printf_format-implementation.patch new file mode 100644 index 0000000000..e2f7458abe --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-add-fallback-parse_printf_format-implementation.patch | |||
| @@ -0,0 +1,433 @@ | |||
| 1 | From 0933ca6251808f856b92b0ce8da8696d5febc333 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Emil Renner Berthing <systemd@esmil.dk> | ||
| 3 | Date: Mon, 23 Oct 2017 10:41:39 -0700 | ||
| 4 | Subject: [PATCH 01/12] add fallback parse_printf_format implementation | ||
| 5 | |||
| 6 | Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> | ||
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 8 | --- | ||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | Makefile.am | 4 + | ||
| 12 | configure.ac | 2 + | ||
| 13 | src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++++++++++ | ||
| 14 | src/basic/parse-printf-format.h | 57 +++++++++ | ||
| 15 | src/basic/stdio-util.h | 2 +- | ||
| 16 | src/journal/journal-send.c | 2 +- | ||
| 17 | 6 files changed, 338 insertions(+), 2 deletions(-) | ||
| 18 | create mode 100644 src/basic/parse-printf-format.c | ||
| 19 | create mode 100644 src/basic/parse-printf-format.h | ||
| 20 | |||
| 21 | diff --git a/Makefile.am b/Makefile.am | ||
| 22 | index 692d7bb95..3cc8f3451 100644 | ||
| 23 | --- a/Makefile.am | ||
| 24 | +++ b/Makefile.am | ||
| 25 | @@ -997,6 +997,10 @@ libbasic_la_SOURCES = \ | ||
| 26 | src/basic/journal-importer.h \ | ||
| 27 | src/basic/journal-importer.c | ||
| 28 | |||
| 29 | +if !HAVE_PRINTF_H | ||
| 30 | +libbasic_la_SOURCES += src/basic/parse-printf-format.c | ||
| 31 | +endif | ||
| 32 | + | ||
| 33 | nodist_libbasic_la_SOURCES = \ | ||
| 34 | src/basic/errno-from-name.h \ | ||
| 35 | src/basic/errno-to-name.h \ | ||
| 36 | diff --git a/configure.ac b/configure.ac | ||
| 37 | index 60e7df5ee..efcdc6c16 100644 | ||
| 38 | --- a/configure.ac | ||
| 39 | +++ b/configure.ac | ||
| 40 | @@ -308,8 +308,10 @@ AC_CHECK_HEADERS([uchar.h], [], []) | ||
| 41 | AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) | ||
| 42 | AC_CHECK_HEADERS([linux/btrfs.h], [], []) | ||
| 43 | AC_CHECK_HEADERS([linux/memfd.h], [], []) | ||
| 44 | +AC_CHECK_HEADERS([printf.h], [], []) | ||
| 45 | AC_CHECK_HEADERS([linux/vm_sockets.h], [], [], [#include <sys/socket.h>]) | ||
| 46 | |||
| 47 | +AM_CONDITIONAL(HAVE_PRINTF_H, [test "x$ac_cv_header_printf_h" = xyes]) | ||
| 48 | # unconditionally pull-in librt with old glibc versions | ||
| 49 | AC_SEARCH_LIBS([clock_gettime], [rt], [], []) | ||
| 50 | |||
| 51 | diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c | ||
| 52 | new file mode 100644 | ||
| 53 | index 000000000..49437e544 | ||
| 54 | --- /dev/null | ||
| 55 | +++ b/src/basic/parse-printf-format.c | ||
| 56 | @@ -0,0 +1,273 @@ | ||
| 57 | +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ | ||
| 58 | + | ||
| 59 | +/*** | ||
| 60 | + This file is part of systemd. | ||
| 61 | + | ||
| 62 | + Copyright 2014 Emil Renner Berthing <systemd@esmil.dk> | ||
| 63 | + | ||
| 64 | + With parts from the musl C library | ||
| 65 | + Copyright 2005-2014 Rich Felker, et al. | ||
| 66 | + | ||
| 67 | + systemd is free software; you can redistribute it and/or modify it | ||
| 68 | + under the terms of the GNU Lesser General Public License as published by | ||
| 69 | + the Free Software Foundation; either version 2.1 of the License, or | ||
| 70 | + (at your option) any later version. | ||
| 71 | + | ||
| 72 | + systemd is distributed in the hope that it will be useful, but | ||
| 73 | + WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 74 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 75 | + Lesser General Public License for more details. | ||
| 76 | + | ||
| 77 | + You should have received a copy of the GNU Lesser General Public License | ||
| 78 | + along with systemd; If not, see <http://www.gnu.org/licenses/>. | ||
| 79 | +***/ | ||
| 80 | + | ||
| 81 | +#include <stddef.h> | ||
| 82 | +#include <string.h> | ||
| 83 | + | ||
| 84 | +#include "parse-printf-format.h" | ||
| 85 | + | ||
| 86 | +static const char *consume_nonarg(const char *fmt) | ||
| 87 | +{ | ||
| 88 | + do { | ||
| 89 | + if (*fmt == '\0') | ||
| 90 | + return fmt; | ||
| 91 | + } while (*fmt++ != '%'); | ||
| 92 | + return fmt; | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +static const char *consume_num(const char *fmt) | ||
| 96 | +{ | ||
| 97 | + for (;*fmt >= '0' && *fmt <= '9'; fmt++) | ||
| 98 | + /* do nothing */; | ||
| 99 | + return fmt; | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +static const char *consume_argn(const char *fmt, size_t *arg) | ||
| 103 | +{ | ||
| 104 | + const char *p = fmt; | ||
| 105 | + size_t val = 0; | ||
| 106 | + | ||
| 107 | + if (*p < '1' || *p > '9') | ||
| 108 | + return fmt; | ||
| 109 | + do { | ||
| 110 | + val = 10*val + (*p++ - '0'); | ||
| 111 | + } while (*p >= '0' && *p <= '9'); | ||
| 112 | + | ||
| 113 | + if (*p != '$') | ||
| 114 | + return fmt; | ||
| 115 | + *arg = val; | ||
| 116 | + return p+1; | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +static const char *consume_flags(const char *fmt) | ||
| 120 | +{ | ||
| 121 | + while (1) { | ||
| 122 | + switch (*fmt) { | ||
| 123 | + case '#': | ||
| 124 | + case '0': | ||
| 125 | + case '-': | ||
| 126 | + case ' ': | ||
| 127 | + case '+': | ||
| 128 | + case '\'': | ||
| 129 | + case 'I': | ||
| 130 | + fmt++; | ||
| 131 | + continue; | ||
| 132 | + } | ||
| 133 | + return fmt; | ||
| 134 | + } | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +enum state { | ||
| 138 | + BARE, | ||
| 139 | + LPRE, | ||
| 140 | + LLPRE, | ||
| 141 | + HPRE, | ||
| 142 | + HHPRE, | ||
| 143 | + BIGLPRE, | ||
| 144 | + ZTPRE, | ||
| 145 | + JPRE, | ||
| 146 | + STOP | ||
| 147 | +}; | ||
| 148 | + | ||
| 149 | +enum type { | ||
| 150 | + NONE, | ||
| 151 | + PTR, | ||
| 152 | + INT, | ||
| 153 | + UINT, | ||
| 154 | + ULLONG, | ||
| 155 | + LONG, | ||
| 156 | + ULONG, | ||
| 157 | + SHORT, | ||
| 158 | + USHORT, | ||
| 159 | + CHAR, | ||
| 160 | + UCHAR, | ||
| 161 | + LLONG, | ||
| 162 | + SIZET, | ||
| 163 | + IMAX, | ||
| 164 | + UMAX, | ||
| 165 | + PDIFF, | ||
| 166 | + UIPTR, | ||
| 167 | + DBL, | ||
| 168 | + LDBL, | ||
| 169 | + MAXTYPE | ||
| 170 | +}; | ||
| 171 | + | ||
| 172 | +static const short pa_types[MAXTYPE] = { | ||
| 173 | + [NONE] = PA_INT, | ||
| 174 | + [PTR] = PA_POINTER, | ||
| 175 | + [INT] = PA_INT, | ||
| 176 | + [UINT] = PA_INT, | ||
| 177 | + [ULLONG] = PA_INT | PA_FLAG_LONG_LONG, | ||
| 178 | + [LONG] = PA_INT | PA_FLAG_LONG, | ||
| 179 | + [ULONG] = PA_INT | PA_FLAG_LONG, | ||
| 180 | + [SHORT] = PA_INT | PA_FLAG_SHORT, | ||
| 181 | + [USHORT] = PA_INT | PA_FLAG_SHORT, | ||
| 182 | + [CHAR] = PA_CHAR, | ||
| 183 | + [UCHAR] = PA_CHAR, | ||
| 184 | + [LLONG] = PA_INT | PA_FLAG_LONG_LONG, | ||
| 185 | + [SIZET] = PA_INT | PA_FLAG_LONG, | ||
| 186 | + [IMAX] = PA_INT | PA_FLAG_LONG_LONG, | ||
| 187 | + [UMAX] = PA_INT | PA_FLAG_LONG_LONG, | ||
| 188 | + [PDIFF] = PA_INT | PA_FLAG_LONG_LONG, | ||
| 189 | + [UIPTR] = PA_INT | PA_FLAG_LONG, | ||
| 190 | + [DBL] = PA_DOUBLE, | ||
| 191 | + [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE | ||
| 192 | +}; | ||
| 193 | + | ||
| 194 | +#define S(x) [(x)-'A'] | ||
| 195 | +#define E(x) (STOP + (x)) | ||
| 196 | + | ||
| 197 | +static const unsigned char states[]['z'-'A'+1] = { | ||
| 198 | + { /* 0: bare types */ | ||
| 199 | + S('d') = E(INT), S('i') = E(INT), | ||
| 200 | + S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT), | ||
| 201 | + S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), | ||
| 202 | + S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), | ||
| 203 | + S('c') = E(CHAR),S('C') = E(INT), | ||
| 204 | + S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR), | ||
| 205 | + S('m') = E(NONE), | ||
| 206 | + S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, | ||
| 207 | + S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE | ||
| 208 | + }, { /* 1: l-prefixed */ | ||
| 209 | + S('d') = E(LONG), S('i') = E(LONG), | ||
| 210 | + S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG), | ||
| 211 | + S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), | ||
| 212 | + S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), | ||
| 213 | + S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR), | ||
| 214 | + S('l') = LLPRE | ||
| 215 | + }, { /* 2: ll-prefixed */ | ||
| 216 | + S('d') = E(LLONG), S('i') = E(LLONG), | ||
| 217 | + S('o') = E(ULLONG),S('u') = E(ULLONG), | ||
| 218 | + S('x') = E(ULLONG),S('X') = E(ULLONG), | ||
| 219 | + S('n') = E(PTR) | ||
| 220 | + }, { /* 3: h-prefixed */ | ||
| 221 | + S('d') = E(SHORT), S('i') = E(SHORT), | ||
| 222 | + S('o') = E(USHORT),S('u') = E(USHORT), | ||
| 223 | + S('x') = E(USHORT),S('X') = E(USHORT), | ||
| 224 | + S('n') = E(PTR), | ||
| 225 | + S('h') = HHPRE | ||
| 226 | + }, { /* 4: hh-prefixed */ | ||
| 227 | + S('d') = E(CHAR), S('i') = E(CHAR), | ||
| 228 | + S('o') = E(UCHAR),S('u') = E(UCHAR), | ||
| 229 | + S('x') = E(UCHAR),S('X') = E(UCHAR), | ||
| 230 | + S('n') = E(PTR) | ||
| 231 | + }, { /* 5: L-prefixed */ | ||
| 232 | + S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL), | ||
| 233 | + S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL), | ||
| 234 | + S('n') = E(PTR) | ||
| 235 | + }, { /* 6: z- or t-prefixed (assumed to be same size) */ | ||
| 236 | + S('d') = E(PDIFF),S('i') = E(PDIFF), | ||
| 237 | + S('o') = E(SIZET),S('u') = E(SIZET), | ||
| 238 | + S('x') = E(SIZET),S('X') = E(SIZET), | ||
| 239 | + S('n') = E(PTR) | ||
| 240 | + }, { /* 7: j-prefixed */ | ||
| 241 | + S('d') = E(IMAX), S('i') = E(IMAX), | ||
| 242 | + S('o') = E(UMAX), S('u') = E(UMAX), | ||
| 243 | + S('x') = E(UMAX), S('X') = E(UMAX), | ||
| 244 | + S('n') = E(PTR) | ||
| 245 | + } | ||
| 246 | +}; | ||
| 247 | + | ||
| 248 | +size_t parse_printf_format(const char *fmt, size_t n, int *types) | ||
| 249 | +{ | ||
| 250 | + size_t i = 0; | ||
| 251 | + size_t last = 0; | ||
| 252 | + | ||
| 253 | + memset(types, 0, n); | ||
| 254 | + | ||
| 255 | + while (1) { | ||
| 256 | + size_t arg; | ||
| 257 | + unsigned int state; | ||
| 258 | + | ||
| 259 | + fmt = consume_nonarg(fmt); | ||
| 260 | + if (*fmt == '\0') | ||
| 261 | + break; | ||
| 262 | + if (*fmt == '%') { | ||
| 263 | + fmt++; | ||
| 264 | + continue; | ||
| 265 | + } | ||
| 266 | + arg = 0; | ||
| 267 | + fmt = consume_argn(fmt, &arg); | ||
| 268 | + /* flags */ | ||
| 269 | + fmt = consume_flags(fmt); | ||
| 270 | + /* width */ | ||
| 271 | + if (*fmt == '*') { | ||
| 272 | + size_t warg = 0; | ||
| 273 | + fmt = consume_argn(fmt+1, &warg); | ||
| 274 | + if (warg == 0) | ||
| 275 | + warg = ++i; | ||
| 276 | + if (warg > last) | ||
| 277 | + last = warg; | ||
| 278 | + if (warg <= n && types[warg-1] == NONE) | ||
| 279 | + types[warg-1] = INT; | ||
| 280 | + } else | ||
| 281 | + fmt = consume_num(fmt); | ||
| 282 | + /* precision */ | ||
| 283 | + if (*fmt == '.') { | ||
| 284 | + fmt++; | ||
| 285 | + if (*fmt == '*') { | ||
| 286 | + size_t parg = 0; | ||
| 287 | + fmt = consume_argn(fmt+1, &parg); | ||
| 288 | + if (parg == 0) | ||
| 289 | + parg = ++i; | ||
| 290 | + if (parg > last) | ||
| 291 | + last = parg; | ||
| 292 | + if (parg <= n && types[parg-1] == NONE) | ||
| 293 | + types[parg-1] = INT; | ||
| 294 | + } else { | ||
| 295 | + if (*fmt == '-') | ||
| 296 | + fmt++; | ||
| 297 | + fmt = consume_num(fmt); | ||
| 298 | + } | ||
| 299 | + } | ||
| 300 | + /* length modifier and conversion specifier */ | ||
| 301 | + state = BARE; | ||
| 302 | + do { | ||
| 303 | + unsigned char c = *fmt++; | ||
| 304 | + | ||
| 305 | + if (c < 'A' || c > 'z') | ||
| 306 | + continue; | ||
| 307 | + state = states[state]S(c); | ||
| 308 | + if (state == 0) | ||
| 309 | + continue; | ||
| 310 | + } while (state < STOP); | ||
| 311 | + | ||
| 312 | + if (state == E(NONE)) | ||
| 313 | + continue; | ||
| 314 | + | ||
| 315 | + if (arg == 0) | ||
| 316 | + arg = ++i; | ||
| 317 | + if (arg > last) | ||
| 318 | + last = arg; | ||
| 319 | + if (arg <= n) | ||
| 320 | + types[arg-1] = state - STOP; | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + if (last > n) | ||
| 324 | + last = n; | ||
| 325 | + for (i = 0; i < last; i++) | ||
| 326 | + types[i] = pa_types[types[i]]; | ||
| 327 | + | ||
| 328 | + return last; | ||
| 329 | +} | ||
| 330 | diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h | ||
| 331 | new file mode 100644 | ||
| 332 | index 000000000..4371177b0 | ||
| 333 | --- /dev/null | ||
| 334 | +++ b/src/basic/parse-printf-format.h | ||
| 335 | @@ -0,0 +1,57 @@ | ||
| 336 | +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ | ||
| 337 | + | ||
| 338 | +/*** | ||
| 339 | + This file is part of systemd. | ||
| 340 | + | ||
| 341 | + Copyright 2014 Emil Renner Berthing <systemd@esmil.dk> | ||
| 342 | + | ||
| 343 | + With parts from the GNU C Library | ||
| 344 | + Copyright 1991-2014 Free Software Foundation, Inc. | ||
| 345 | + | ||
| 346 | + systemd is free software; you can redistribute it and/or modify it | ||
| 347 | + under the terms of the GNU Lesser General Public License as published by | ||
| 348 | + the Free Software Foundation; either version 2.1 of the License, or | ||
| 349 | + (at your option) any later version. | ||
| 350 | + | ||
| 351 | + systemd is distributed in the hope that it will be useful, but | ||
| 352 | + WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 353 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 354 | + Lesser General Public License for more details. | ||
| 355 | + | ||
| 356 | + You should have received a copy of the GNU Lesser General Public License | ||
| 357 | + along with systemd; If not, see <http://www.gnu.org/licenses/>. | ||
| 358 | +***/ | ||
| 359 | + | ||
| 360 | +#pragma once | ||
| 361 | + | ||
| 362 | +#include "config.h" | ||
| 363 | + | ||
| 364 | +#ifdef HAVE_PRINTF_H | ||
| 365 | +#include <printf.h> | ||
| 366 | +#else | ||
| 367 | + | ||
| 368 | +#include <stddef.h> | ||
| 369 | + | ||
| 370 | +enum { /* C type: */ | ||
| 371 | + PA_INT, /* int */ | ||
| 372 | + PA_CHAR, /* int, cast to char */ | ||
| 373 | + PA_WCHAR, /* wide char */ | ||
| 374 | + PA_STRING, /* const char *, a '\0'-terminated string */ | ||
| 375 | + PA_WSTRING, /* const wchar_t *, wide character string */ | ||
| 376 | + PA_POINTER, /* void * */ | ||
| 377 | + PA_FLOAT, /* float */ | ||
| 378 | + PA_DOUBLE, /* double */ | ||
| 379 | + PA_LAST | ||
| 380 | +}; | ||
| 381 | + | ||
| 382 | +/* Flag bits that can be set in a type returned by `parse_printf_format'. */ | ||
| 383 | +#define PA_FLAG_MASK 0xff00 | ||
| 384 | +#define PA_FLAG_LONG_LONG (1 << 8) | ||
| 385 | +#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG | ||
| 386 | +#define PA_FLAG_LONG (1 << 9) | ||
| 387 | +#define PA_FLAG_SHORT (1 << 10) | ||
| 388 | +#define PA_FLAG_PTR (1 << 11) | ||
| 389 | + | ||
| 390 | +size_t parse_printf_format(const char *fmt, size_t n, int *types); | ||
| 391 | + | ||
| 392 | +#endif /* HAVE_PRINTF_H */ | ||
| 393 | diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h | ||
| 394 | index bd1144b4c..c9c95eb54 100644 | ||
| 395 | --- a/src/basic/stdio-util.h | ||
| 396 | +++ b/src/basic/stdio-util.h | ||
| 397 | @@ -19,12 +19,12 @@ | ||
| 398 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | ||
| 399 | ***/ | ||
| 400 | |||
| 401 | -#include <printf.h> | ||
| 402 | #include <stdarg.h> | ||
| 403 | #include <stdio.h> | ||
| 404 | #include <sys/types.h> | ||
| 405 | |||
| 406 | #include "macro.h" | ||
| 407 | +#include "parse-printf-format.h" | ||
| 408 | |||
| 409 | #define xsprintf(buf, fmt, ...) \ | ||
| 410 | assert_message_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf), "xsprintf: " #buf "[] must be big enough") | ||
| 411 | diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c | ||
| 412 | index 440fba67c..0236c43c4 100644 | ||
| 413 | --- a/src/journal/journal-send.c | ||
| 414 | +++ b/src/journal/journal-send.c | ||
| 415 | @@ -19,7 +19,6 @@ | ||
| 416 | |||
| 417 | #include <errno.h> | ||
| 418 | #include <fcntl.h> | ||
| 419 | -#include <printf.h> | ||
| 420 | #include <stddef.h> | ||
| 421 | #include <sys/socket.h> | ||
| 422 | #include <sys/un.h> | ||
| 423 | @@ -38,6 +37,7 @@ | ||
| 424 | #include "stdio-util.h" | ||
| 425 | #include "string-util.h" | ||
| 426 | #include "util.h" | ||
| 427 | +#include "parse-printf-format.h" | ||
| 428 | |||
| 429 | #define SNDBUF_SIZE (8*1024*1024) | ||
| 430 | |||
| 431 | -- | ||
| 432 | 2.14.2 | ||
| 433 | |||
diff --git a/meta/recipes-core/systemd/systemd/0002-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0002-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 0000000000..94c136b0d9 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-src-basic-missing.h-check-for-missing-strndupa.patch | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | From 585abd891a56409915314304101cac26b42c076b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Emil Renner Berthing <systemd@esmil.dk> | ||
| 3 | Date: Mon, 23 Oct 2017 10:45:46 -0700 | ||
| 4 | Subject: [PATCH 02/12] src/basic/missing.h: check for missing strndupa | ||
| 5 | |||
| 6 | include missing.h for definition of strndupa | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | configure.ac | 1 + | ||
| 13 | src/basic/missing.h | 11 +++++++++++ | ||
| 14 | src/basic/mkdir.c | 1 + | ||
| 15 | src/basic/parse-util.c | 1 + | ||
| 16 | src/shared/pager.c | 1 + | ||
| 17 | src/shared/uid-range.c | 1 + | ||
| 18 | 6 files changed, 16 insertions(+) | ||
| 19 | |||
| 20 | diff --git a/configure.ac b/configure.ac | ||
| 21 | index efcdc6c16..cd035a971 100644 | ||
| 22 | --- a/configure.ac | ||
| 23 | +++ b/configure.ac | ||
| 24 | @@ -329,6 +329,7 @@ AC_CHECK_DECLS([ | ||
| 25 | pivot_root, | ||
| 26 | name_to_handle_at, | ||
| 27 | setns, | ||
| 28 | + strndupa, | ||
| 29 | renameat2, | ||
| 30 | kcmp, | ||
| 31 | keyctl, | ||
| 32 | diff --git a/src/basic/missing.h b/src/basic/missing.h | ||
| 33 | index 04912bf52..8009888ad 100644 | ||
| 34 | --- a/src/basic/missing.h | ||
| 35 | +++ b/src/basic/missing.h | ||
| 36 | @@ -1104,6 +1104,17 @@ typedef int32_t key_serial_t; | ||
| 37 | #define KEYCTL_DESCRIBE 6 | ||
| 38 | #endif | ||
| 39 | |||
| 40 | +#if !HAVE_DECL_STRNDUPA | ||
| 41 | +#define strndupa(s, n) \ | ||
| 42 | + ({ \ | ||
| 43 | + const char *__old = (s); \ | ||
| 44 | + size_t __len = strnlen(__old, (n)); \ | ||
| 45 | + char *__new = (char *)alloca(__len + 1); \ | ||
| 46 | + __new[__len] = '\0'; \ | ||
| 47 | + (char *)memcpy(__new, __old, __len); \ | ||
| 48 | + }) | ||
| 49 | +#endif | ||
| 50 | + | ||
| 51 | #ifndef KEYCTL_READ | ||
| 52 | #define KEYCTL_READ 11 | ||
| 53 | #endif | ||
| 54 | diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c | ||
| 55 | index 6b1a98402..d1388df48 100644 | ||
| 56 | --- a/src/basic/mkdir.c | ||
| 57 | +++ b/src/basic/mkdir.c | ||
| 58 | @@ -28,6 +28,7 @@ | ||
| 59 | #include "path-util.h" | ||
| 60 | #include "stat-util.h" | ||
| 61 | #include "user-util.h" | ||
| 62 | +#include "missing.h" | ||
| 63 | |||
| 64 | int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkdir_func_t _mkdir) { | ||
| 65 | struct stat st; | ||
| 66 | diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c | ||
| 67 | index 4532f222c..7a30a0e06 100644 | ||
| 68 | --- a/src/basic/parse-util.c | ||
| 69 | +++ b/src/basic/parse-util.c | ||
| 70 | @@ -30,6 +30,7 @@ | ||
| 71 | #include "parse-util.h" | ||
| 72 | #include "process-util.h" | ||
| 73 | #include "string-util.h" | ||
| 74 | +#include "missing.h" | ||
| 75 | |||
| 76 | int parse_boolean(const char *v) { | ||
| 77 | assert(v); | ||
| 78 | diff --git a/src/shared/pager.c b/src/shared/pager.c | ||
| 79 | index 4d7b02c63..854efc0c9 100644 | ||
| 80 | --- a/src/shared/pager.c | ||
| 81 | +++ b/src/shared/pager.c | ||
| 82 | @@ -38,6 +38,7 @@ | ||
| 83 | #include "string-util.h" | ||
| 84 | #include "strv.h" | ||
| 85 | #include "terminal-util.h" | ||
| 86 | +#include "missing.h" | ||
| 87 | |||
| 88 | static pid_t pager_pid = 0; | ||
| 89 | |||
| 90 | diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c | ||
| 91 | index b6ec47439..91ce9fb7f 100644 | ||
| 92 | --- a/src/shared/uid-range.c | ||
| 93 | +++ b/src/shared/uid-range.c | ||
| 94 | @@ -24,6 +24,7 @@ | ||
| 95 | #include "macro.h" | ||
| 96 | #include "uid-range.h" | ||
| 97 | #include "user-util.h" | ||
| 98 | +#include "missing.h" | ||
| 99 | |||
| 100 | static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { | ||
| 101 | assert(range); | ||
| 102 | -- | ||
| 103 | 2.14.2 | ||
| 104 | |||
diff --git a/meta/recipes-core/systemd/systemd/0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch new file mode 100644 index 0000000000..9a2d2c8e0a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | |||
| @@ -0,0 +1,157 @@ | |||
| 1 | From 5bbbc2a08a3b4283ec04af0e77e25fb205aa8b82 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Emil Renner Berthing <systemd@esmil.dk> | ||
| 3 | Date: Mon, 23 Oct 2017 10:50:14 -0700 | ||
| 4 | Subject: [PATCH 03/12] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not | ||
| 5 | defined | ||
| 6 | |||
| 7 | If the standard library doesn't provide brace | ||
| 8 | expansion users just won't get it. | ||
| 9 | |||
| 10 | Dont use GNU GLOB extentions on non-glibc systems | ||
| 11 | |||
| 12 | Conditionalize use of GLOB_ALTDIRFUNC | ||
| 13 | |||
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 15 | --- | ||
| 16 | Upstream-Status: Pending | ||
| 17 | |||
| 18 | src/basic/glob-util.c | 20 +++++++++++++++++--- | ||
| 19 | src/test/test-glob-util.c | 17 +++++++++++++++-- | ||
| 20 | src/tmpfiles/tmpfiles.c | 8 ++++++++ | ||
| 21 | 3 files changed, 40 insertions(+), 5 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c | ||
| 24 | index f611c42e4..ad6e2be8d 100644 | ||
| 25 | --- a/src/basic/glob-util.c | ||
| 26 | +++ b/src/basic/glob-util.c | ||
| 27 | @@ -27,13 +27,18 @@ | ||
| 28 | #include "macro.h" | ||
| 29 | #include "path-util.h" | ||
| 30 | #include "strv.h" | ||
| 31 | +/* Don't fail if the standard library | ||
| 32 | + * doesn't provide brace expansion */ | ||
| 33 | +#ifndef GLOB_BRACE | ||
| 34 | +#define GLOB_BRACE 0 | ||
| 35 | +#endif | ||
| 36 | |||
| 37 | int safe_glob(const char *path, int flags, glob_t *pglob) { | ||
| 38 | int k; | ||
| 39 | |||
| 40 | +#ifdef GLOB_ALTDIRFUNC | ||
| 41 | /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ | ||
| 42 | assert(!(flags & GLOB_ALTDIRFUNC)); | ||
| 43 | - | ||
| 44 | if (!pglob->gl_closedir) | ||
| 45 | pglob->gl_closedir = (void (*)(void *)) closedir; | ||
| 46 | if (!pglob->gl_readdir) | ||
| 47 | @@ -44,10 +49,13 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { | ||
| 48 | pglob->gl_lstat = lstat; | ||
| 49 | if (!pglob->gl_stat) | ||
| 50 | pglob->gl_stat = stat; | ||
| 51 | - | ||
| 52 | +#endif | ||
| 53 | errno = 0; | ||
| 54 | +#ifdef GLOB_ALTDIRFUNC | ||
| 55 | k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob); | ||
| 56 | - | ||
| 57 | +#else | ||
| 58 | + k = glob(path, flags, NULL, pglob); | ||
| 59 | +#endif | ||
| 60 | if (k == GLOB_NOMATCH) | ||
| 61 | return -ENOENT; | ||
| 62 | if (k == GLOB_NOSPACE) | ||
| 63 | @@ -60,6 +68,12 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { | ||
| 64 | return 0; | ||
| 65 | } | ||
| 66 | |||
| 67 | +/* Don't fail if the standard library | ||
| 68 | + * doesn't provide brace expansion */ | ||
| 69 | +#ifndef GLOB_BRACE | ||
| 70 | +#define GLOB_BRACE 0 | ||
| 71 | +#endif | ||
| 72 | + | ||
| 73 | int glob_exists(const char *path) { | ||
| 74 | _cleanup_globfree_ glob_t g = {}; | ||
| 75 | int k; | ||
| 76 | diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c | ||
| 77 | index af866e004..3afa09ada 100644 | ||
| 78 | --- a/src/test/test-glob-util.c | ||
| 79 | +++ b/src/test/test-glob-util.c | ||
| 80 | @@ -29,6 +29,11 @@ | ||
| 81 | #include "glob-util.h" | ||
| 82 | #include "macro.h" | ||
| 83 | #include "rm-rf.h" | ||
| 84 | +/* Don't fail if the standard library | ||
| 85 | + * doesn't provide brace expansion */ | ||
| 86 | +#ifndef GLOB_BRACE | ||
| 87 | +#define GLOB_BRACE 0 | ||
| 88 | +#endif | ||
| 89 | |||
| 90 | static void test_glob_exists(void) { | ||
| 91 | char name[] = "/tmp/test-glob_exists.XXXXXX"; | ||
| 92 | @@ -51,25 +56,33 @@ static void test_glob_exists(void) { | ||
| 93 | static void test_glob_no_dot(void) { | ||
| 94 | char template[] = "/tmp/test-glob-util.XXXXXXX"; | ||
| 95 | const char *fn; | ||
| 96 | - | ||
| 97 | _cleanup_globfree_ glob_t g = { | ||
| 98 | +#ifdef GLOB_ALTDIRFUNC | ||
| 99 | .gl_closedir = (void (*)(void *)) closedir, | ||
| 100 | .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot, | ||
| 101 | .gl_opendir = (void *(*)(const char *)) opendir, | ||
| 102 | .gl_lstat = lstat, | ||
| 103 | .gl_stat = stat, | ||
| 104 | +#endif | ||
| 105 | }; | ||
| 106 | - | ||
| 107 | int r; | ||
| 108 | |||
| 109 | assert_se(mkdtemp(template)); | ||
| 110 | |||
| 111 | fn = strjoina(template, "/*"); | ||
| 112 | +#ifdef GLOB_ALTDIRFUNC | ||
| 113 | r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g); | ||
| 114 | +#else | ||
| 115 | + r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g); | ||
| 116 | +#endif | ||
| 117 | assert_se(r == GLOB_NOMATCH); | ||
| 118 | |||
| 119 | fn = strjoina(template, "/.*"); | ||
| 120 | +#ifdef GLOB_ALTDIRFUNC | ||
| 121 | r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g); | ||
| 122 | +#else | ||
| 123 | + r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g); | ||
| 124 | +#endif | ||
| 125 | assert_se(r == GLOB_NOMATCH); | ||
| 126 | |||
| 127 | (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); | ||
| 128 | diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c | ||
| 129 | index 9419c99e2..07027a765 100644 | ||
| 130 | --- a/src/tmpfiles/tmpfiles.c | ||
| 131 | +++ b/src/tmpfiles/tmpfiles.c | ||
| 132 | @@ -71,6 +71,12 @@ | ||
| 133 | #include "umask-util.h" | ||
| 134 | #include "user-util.h" | ||
| 135 | #include "util.h" | ||
| 136 | +/* Don't fail if the standard library | ||
| 137 | + * doesn't provide brace expansion */ | ||
| 138 | +#ifndef GLOB_BRACE | ||
| 139 | +#define GLOB_BRACE 0 | ||
| 140 | +#endif | ||
| 141 | + | ||
| 142 | |||
| 143 | /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates | ||
| 144 | * them in the file system. This is intended to be used to create | ||
| 145 | @@ -1092,7 +1098,9 @@ static int item_do_children(Item *i, const char *path, action_t action) { | ||
| 146 | |||
| 147 | static int glob_item(Item *i, action_t action, bool recursive) { | ||
| 148 | _cleanup_globfree_ glob_t g = { | ||
| 149 | +#ifdef GLOB_ALTDIRFUNC | ||
| 150 | .gl_opendir = (void *(*)(const char *)) opendir_nomod, | ||
| 151 | +#endif | ||
| 152 | }; | ||
| 153 | int r = 0, k; | ||
| 154 | char **fn; | ||
| 155 | -- | ||
| 156 | 2.14.2 | ||
| 157 | |||
diff --git a/meta/recipes-core/systemd/systemd/0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch b/meta/recipes-core/systemd/systemd/0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch new file mode 100644 index 0000000000..cb5ae99a46 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From c850b654e71677e0d6292f1345207b9b5acffc33 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Emil Renner Berthing <systemd@esmil.dk> | ||
| 3 | Date: Mon, 23 Oct 2017 11:31:03 -0700 | ||
| 4 | Subject: [PATCH 04/12] src/basic/missing.h: check for missing __compar_fn_t | ||
| 5 | typedef | ||
| 6 | |||
| 7 | include missing.h for missing __compar_fn_t | ||
| 8 | |||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | Upstream-Status: Pending | ||
| 12 | |||
| 13 | src/basic/missing.h | 5 +++++ | ||
| 14 | src/basic/strbuf.c | 1 + | ||
| 15 | 2 files changed, 6 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/src/basic/missing.h b/src/basic/missing.h | ||
| 18 | index 8009888ad..671f341c6 100644 | ||
| 19 | --- a/src/basic/missing.h | ||
| 20 | +++ b/src/basic/missing.h | ||
| 21 | @@ -1063,6 +1063,11 @@ struct input_mask { | ||
| 22 | #define RENAME_NOREPLACE (1 << 0) | ||
| 23 | #endif | ||
| 24 | |||
| 25 | +#ifndef __COMPAR_FN_T | ||
| 26 | +#define __COMPAR_FN_T | ||
| 27 | +typedef int (*__compar_fn_t)(const void *, const void *); | ||
| 28 | +#endif | ||
| 29 | + | ||
| 30 | #ifndef KCMP_FILE | ||
| 31 | #define KCMP_FILE 0 | ||
| 32 | #endif | ||
| 33 | diff --git a/src/basic/strbuf.c b/src/basic/strbuf.c | ||
| 34 | index 00aaf9e62..9dc4a584a 100644 | ||
| 35 | --- a/src/basic/strbuf.c | ||
| 36 | +++ b/src/basic/strbuf.c | ||
| 37 | @@ -23,6 +23,7 @@ | ||
| 38 | |||
| 39 | #include "alloc-util.h" | ||
| 40 | #include "strbuf.h" | ||
| 41 | +#include "missing.h" | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Strbuf stores given strings in a single continuous allocated memory | ||
| 45 | -- | ||
| 46 | 2.14.2 | ||
| 47 | |||
diff --git a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch new file mode 100644 index 0000000000..55887ee823 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | From 21080b6a40d0a4ddd2db8f0fa37686f6fa885d1c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Oct 2017 11:38:33 -0700 | ||
| 4 | Subject: [PATCH 06/12] Include netinet/if_ether.h | ||
| 5 | |||
| 6 | Fixes | ||
| 7 | /mnt/a/oe/build/tmp/work/mips32r2-bec-linux-musl/systemd/1_234-r0/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr' | ||
| 8 | struct ethhdr { | ||
| 9 | ^~~~~~ | ||
| 10 | |||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | --- | ||
| 13 | Upstream-Status: Pending | ||
| 14 | |||
| 15 | src/libsystemd/sd-netlink/netlink-types.c | 1 + | ||
| 16 | src/network/netdev/tuntap.c | 1 + | ||
| 17 | src/network/networkd-brvlan.c | 1 + | ||
| 18 | src/udev/net/ethtool-util.c | 2 +- | ||
| 19 | src/udev/udev-builtin-net_setup_link.c | 2 +- | ||
| 20 | 5 files changed, 5 insertions(+), 2 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c | ||
| 23 | index 923f7dd10..b95b1e4b2 100644 | ||
| 24 | --- a/src/libsystemd/sd-netlink/netlink-types.c | ||
| 25 | +++ b/src/libsystemd/sd-netlink/netlink-types.c | ||
| 26 | @@ -19,6 +19,7 @@ | ||
| 27 | |||
| 28 | #include <stdint.h> | ||
| 29 | #include <sys/socket.h> | ||
| 30 | +#include <netinet/if_ether.h> | ||
| 31 | #include <linux/netlink.h> | ||
| 32 | #include <linux/rtnetlink.h> | ||
| 33 | #include <linux/can/netlink.h> | ||
| 34 | diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c | ||
| 35 | index 3d6280884..40e58c38f 100644 | ||
| 36 | --- a/src/network/netdev/tuntap.c | ||
| 37 | +++ b/src/network/netdev/tuntap.c | ||
| 38 | @@ -18,6 +18,7 @@ | ||
| 39 | ***/ | ||
| 40 | |||
| 41 | #include <fcntl.h> | ||
| 42 | +#include <netinet/if_ether.h> | ||
| 43 | #include <linux/if_tun.h> | ||
| 44 | #include <net/if.h> | ||
| 45 | #include <netinet/if_ether.h> | ||
| 46 | diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c | ||
| 47 | index fa5d3ee7f..e0828962a 100644 | ||
| 48 | --- a/src/network/networkd-brvlan.c | ||
| 49 | +++ b/src/network/networkd-brvlan.c | ||
| 50 | @@ -18,6 +18,7 @@ | ||
| 51 | ***/ | ||
| 52 | |||
| 53 | #include <netinet/in.h> | ||
| 54 | +#include <netinet/if_ether.h> | ||
| 55 | #include <linux/if_bridge.h> | ||
| 56 | #include <stdbool.h> | ||
| 57 | |||
| 58 | diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c | ||
| 59 | index 201fc2343..5f7cc2a0a 100644 | ||
| 60 | --- a/src/udev/net/ethtool-util.c | ||
| 61 | +++ b/src/udev/net/ethtool-util.c | ||
| 62 | @@ -16,7 +16,7 @@ | ||
| 63 | You should have received a copy of the GNU Lesser General Public License | ||
| 64 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | ||
| 65 | ***/ | ||
| 66 | - | ||
| 67 | +#include <netinet/if_ether.h> | ||
| 68 | #include <net/if.h> | ||
| 69 | #include <sys/ioctl.h> | ||
| 70 | #include <linux/ethtool.h> | ||
| 71 | diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c | ||
| 72 | index 8e4777513..d01fff2a4 100644 | ||
| 73 | --- a/src/udev/udev-builtin-net_setup_link.c | ||
| 74 | +++ b/src/udev/udev-builtin-net_setup_link.c | ||
| 75 | @@ -16,7 +16,7 @@ | ||
| 76 | You should have received a copy of the GNU Lesser General Public License | ||
| 77 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | ||
| 78 | ***/ | ||
| 79 | - | ||
| 80 | +#include <netinet/if_ether.h> | ||
| 81 | #include "alloc-util.h" | ||
| 82 | #include "link-config.h" | ||
| 83 | #include "log.h" | ||
| 84 | -- | ||
| 85 | 2.14.2 | ||
| 86 | |||
diff --git a/meta/recipes-core/systemd/systemd/0007-check-for-missing-canonicalize_file_name.patch b/meta/recipes-core/systemd/systemd/0007-check-for-missing-canonicalize_file_name.patch new file mode 100644 index 0000000000..5234c59a78 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0007-check-for-missing-canonicalize_file_name.patch | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | From 05dffe67919ffc72be5c017bc6cf82f164b2e8f9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Emil Renner Berthing <systemd@esmil.dk> | ||
| 3 | Date: Mon, 23 Oct 2017 11:42:03 -0700 | ||
| 4 | Subject: [PATCH 07/12] check for missing canonicalize_file_name | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | Upstream-Status: Pending | ||
| 9 | |||
| 10 | configure.ac | 2 ++ | ||
| 11 | src/basic/missing.h | 1 + | ||
| 12 | src/basic/missing_syscall.h | 6 ++++++ | ||
| 13 | 3 files changed, 9 insertions(+) | ||
| 14 | |||
| 15 | diff --git a/configure.ac b/configure.ac | ||
| 16 | index cd035a971..3674190fb 100644 | ||
| 17 | --- a/configure.ac | ||
| 18 | +++ b/configure.ac | ||
| 19 | @@ -333,6 +333,7 @@ AC_CHECK_DECLS([ | ||
| 20 | renameat2, | ||
| 21 | kcmp, | ||
| 22 | keyctl, | ||
| 23 | + canonicalize_file_name, | ||
| 24 | LO_FLAGS_PARTSCAN, | ||
| 25 | copy_file_range, | ||
| 26 | explicit_bzero], | ||
| 27 | @@ -343,6 +344,7 @@ AC_CHECK_DECLS([ | ||
| 28 | #include <fcntl.h> | ||
| 29 | #include <sched.h> | ||
| 30 | #include <string.h> | ||
| 31 | +#include <stdlib.h> | ||
| 32 | #include <linux/loop.h> | ||
| 33 | ]]) | ||
| 34 | |||
| 35 | diff --git a/src/basic/missing.h b/src/basic/missing.h | ||
| 36 | index 671f341c6..8ae4964e1 100644 | ||
| 37 | --- a/src/basic/missing.h | ||
| 38 | +++ b/src/basic/missing.h | ||
| 39 | @@ -1246,3 +1246,4 @@ struct ethtool_link_settings { | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #include "missing_syscall.h" | ||
| 43 | + | ||
| 44 | diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h | ||
| 45 | index 898116c7b..4d44ee4fa 100644 | ||
| 46 | --- a/src/basic/missing_syscall.h | ||
| 47 | +++ b/src/basic/missing_syscall.h | ||
| 48 | @@ -28,6 +28,12 @@ static inline int pivot_root(const char *new_root, const char *put_old) { | ||
| 49 | } | ||
| 50 | #endif | ||
| 51 | |||
| 52 | +#if !HAVE_DECL_CANONICALIZE_FILE_NAME | ||
| 53 | +static inline char *canonicalize_file_name(const char *path) { | ||
| 54 | + return realpath(path, NULL); | ||
| 55 | +} | ||
| 56 | +#endif | ||
| 57 | + | ||
| 58 | /* ======================================================================= */ | ||
| 59 | |||
| 60 | #if !HAVE_DECL_MEMFD_CREATE | ||
| 61 | -- | ||
| 62 | 2.14.2 | ||
| 63 | |||
diff --git a/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests.patch b/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests.patch new file mode 100644 index 0000000000..67a4f8e03e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0008-Do-not-enable-nss-tests.patch | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | From 48e7c0f5b2f5d777a16ac5584dc4f50f1dfa832c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Oct 2017 12:27:53 -0700 | ||
| 4 | Subject: [PATCH 08/12] Do not enable nss tests | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | Upstream-Status: Pending | ||
| 9 | |||
| 10 | Makefile.am | 2 +- | ||
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/Makefile.am b/Makefile.am | ||
| 14 | index 3cc8f3451..df20a9a11 100644 | ||
| 15 | --- a/Makefile.am | ||
| 16 | +++ b/Makefile.am | ||
| 17 | @@ -5290,6 +5290,7 @@ EXTRA_DIST += \ | ||
| 18 | src/timesync/timesyncd.conf.in | ||
| 19 | |||
| 20 | # ------------------------------------------------------------------------------ | ||
| 21 | +if ENABLE_NSS_SYSTEMD | ||
| 22 | test_nss_SOURCES = \ | ||
| 23 | src/test/test-nss.c | ||
| 24 | |||
| 25 | @@ -5302,7 +5303,6 @@ manual_tests += \ | ||
| 26 | test-nss | ||
| 27 | |||
| 28 | # ------------------------------------------------------------------------------ | ||
| 29 | -if ENABLE_NSS_SYSTEMD | ||
| 30 | libnss_systemd_la_SOURCES = \ | ||
| 31 | src/nss-systemd/nss-systemd.sym \ | ||
| 32 | src/nss-systemd/nss-systemd.c | ||
| 33 | -- | ||
| 34 | 2.14.2 | ||
| 35 | |||
diff --git a/meta/recipes-core/systemd/systemd/0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch b/meta/recipes-core/systemd/systemd/0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch new file mode 100644 index 0000000000..d3694dcbd5 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | From 75f4e7f167de533a160ee1af2a03fba4c5a5ffc6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Oct 2017 12:33:22 -0700 | ||
| 4 | Subject: [PATCH 09/12] test-hexdecoct.c: Include missing.h form strndupa | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | Upstream-Status: Pending | ||
| 9 | |||
| 10 | src/test/test-hexdecoct.c | 1 + | ||
| 11 | 1 file changed, 1 insertion(+) | ||
| 12 | |||
| 13 | diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c | ||
| 14 | index fcae427e7..5eb5e2ed7 100644 | ||
| 15 | --- a/src/test/test-hexdecoct.c | ||
| 16 | +++ b/src/test/test-hexdecoct.c | ||
| 17 | @@ -21,6 +21,7 @@ | ||
| 18 | #include "hexdecoct.h" | ||
| 19 | #include "macro.h" | ||
| 20 | #include "string-util.h" | ||
| 21 | +#include "missing.h" | ||
| 22 | |||
| 23 | static void test_hexchar(void) { | ||
| 24 | assert_se(hexchar(0xa) == 'a'); | ||
| 25 | -- | ||
| 26 | 2.14.2 | ||
| 27 | |||
diff --git a/meta/recipes-core/systemd/systemd/0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch new file mode 100644 index 0000000000..808c83aba3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From 6e9d2bcaa6f886b2384c1c35a04e4ebc148aea68 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Oct 2017 12:40:25 -0700 | ||
| 4 | Subject: [PATCH 10/12] test-sizeof.c: Disable tests for missing typedefs in | ||
| 5 | musl | ||
| 6 | |||
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 8 | --- | ||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | src/test/test-sizeof.c | 5 ++++- | ||
| 12 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
| 13 | |||
| 14 | diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c | ||
| 15 | index 269adfd18..ba7855dff 100644 | ||
| 16 | --- a/src/test/test-sizeof.c | ||
| 17 | +++ b/src/test/test-sizeof.c | ||
| 18 | @@ -18,7 +18,6 @@ | ||
| 19 | ***/ | ||
| 20 | |||
| 21 | #include <stdio.h> | ||
| 22 | - | ||
| 23 | #include "time-util.h" | ||
| 24 | |||
| 25 | /* Print information about various types. Useful when diagnosing | ||
| 26 | @@ -48,8 +47,10 @@ int main(void) { | ||
| 27 | info(unsigned); | ||
| 28 | info(long unsigned); | ||
| 29 | info(long long unsigned); | ||
| 30 | +#ifdef __GLIBC__ | ||
| 31 | info(__syscall_ulong_t); | ||
| 32 | info(__syscall_slong_t); | ||
| 33 | +#endif | ||
| 34 | |||
| 35 | info(float); | ||
| 36 | info(double); | ||
| 37 | @@ -59,7 +60,9 @@ int main(void) { | ||
| 38 | info(ssize_t); | ||
| 39 | info(time_t); | ||
| 40 | info(usec_t); | ||
| 41 | +#ifdef __GLIBC__ | ||
| 42 | info(__time_t); | ||
| 43 | +#endif | ||
| 44 | |||
| 45 | info(enum Enum); | ||
| 46 | info(enum BigEnum); | ||
| 47 | -- | ||
| 48 | 2.14.2 | ||
| 49 | |||
diff --git a/meta/recipes-core/systemd/systemd/0011-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0011-don-t-use-glibc-specific-qsort_r.patch new file mode 100644 index 0000000000..7cfe829e85 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0011-don-t-use-glibc-specific-qsort_r.patch | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | From 2eb45f5a0a8bfb8bdca084587ad28e5001f3cc4b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Emil Renner Berthing <systemd@esmil.dk> | ||
| 3 | Date: Thu, 18 Sep 2014 15:24:56 +0200 | ||
| 4 | Subject: [PATCH 11/12] don't use glibc-specific qsort_r | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | --- | ||
| 8 | Upstream-Status: Pending | ||
| 9 | |||
| 10 | src/hwdb/hwdb.c | 18 +++++++++++------- | ||
| 11 | src/udev/udevadm-hwdb.c | 16 ++++++++++------ | ||
| 12 | 2 files changed, 21 insertions(+), 13 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c | ||
| 15 | index 793398ca6..669b00818 100644 | ||
| 16 | --- a/src/hwdb/hwdb.c | ||
| 17 | +++ b/src/hwdb/hwdb.c | ||
| 18 | @@ -151,13 +151,12 @@ static void trie_free(struct trie *trie) { | ||
| 19 | |||
| 20 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); | ||
| 21 | |||
| 22 | -static int trie_values_cmp(const void *v1, const void *v2, void *arg) { | ||
| 23 | +static struct trie *trie_node_add_value_trie; | ||
| 24 | +static int trie_values_cmp(const void *v1, const void *v2) { | ||
| 25 | const struct trie_value_entry *val1 = v1; | ||
| 26 | const struct trie_value_entry *val2 = v2; | ||
| 27 | - struct trie *trie = arg; | ||
| 28 | - | ||
| 29 | - return strcmp(trie->strings->buf + val1->key_off, | ||
| 30 | - trie->strings->buf + val2->key_off); | ||
| 31 | + return strcmp(trie_node_add_value_trie->strings->buf + val1->key_off, | ||
| 32 | + trie_node_add_value_trie->strings->buf + val2->key_off); | ||
| 33 | } | ||
| 34 | |||
| 35 | static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
| 36 | @@ -182,7 +181,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
| 37 | .value_off = v, | ||
| 38 | }; | ||
| 39 | |||
| 40 | - val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); | ||
| 41 | + trie_node_add_value_trie = trie; | ||
| 42 | + val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); | ||
| 43 | + trie_node_add_value_trie = NULL; | ||
| 44 | + | ||
| 45 | if (val) { | ||
| 46 | /* At this point we have 2 identical properties on the same match-string. | ||
| 47 | * Since we process files in order, we just replace the previous value. | ||
| 48 | @@ -207,7 +209,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
| 49 | node->values[node->values_count].file_priority = file_priority; | ||
| 50 | node->values[node->values_count].line_number = line_number; | ||
| 51 | node->values_count++; | ||
| 52 | - qsort_r(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); | ||
| 53 | + trie_node_add_value_trie = trie; | ||
| 54 | + qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); | ||
| 55 | + trie_node_add_value_trie = NULL; | ||
| 56 | return 0; | ||
| 57 | } | ||
| 58 | |||
| 59 | diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c | ||
| 60 | index 69b0b9025..fbd213300 100644 | ||
| 61 | --- a/src/udev/udevadm-hwdb.c | ||
| 62 | +++ b/src/udev/udevadm-hwdb.c | ||
| 63 | @@ -128,13 +128,13 @@ static void trie_node_cleanup(struct trie_node *node) { | ||
| 64 | free(node); | ||
| 65 | } | ||
| 66 | |||
| 67 | -static int trie_values_cmp(const void *v1, const void *v2, void *arg) { | ||
| 68 | +static struct trie *trie_node_add_value_trie; | ||
| 69 | +static int trie_values_cmp(const void *v1, const void *v2) { | ||
| 70 | const struct trie_value_entry *val1 = v1; | ||
| 71 | const struct trie_value_entry *val2 = v2; | ||
| 72 | - struct trie *trie = arg; | ||
| 73 | |||
| 74 | - return strcmp(trie->strings->buf + val1->key_off, | ||
| 75 | - trie->strings->buf + val2->key_off); | ||
| 76 | + return strcmp(trie_node_add_value_trie->strings->buf + val1->key_off, | ||
| 77 | + trie_node_add_value_trie->strings->buf + val2->key_off); | ||
| 78 | } | ||
| 79 | |||
| 80 | static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
| 81 | @@ -155,7 +155,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
| 82 | .value_off = v, | ||
| 83 | }; | ||
| 84 | |||
| 85 | - val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); | ||
| 86 | + trie_node_add_value_trie = trie; | ||
| 87 | + val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); | ||
| 88 | + trie_node_add_value_trie = NULL; | ||
| 89 | if (val) { | ||
| 90 | /* replace existing earlier key with new value */ | ||
| 91 | val->value_off = v; | ||
| 92 | @@ -172,7 +174,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, | ||
| 93 | node->values[node->values_count].key_off = k; | ||
| 94 | node->values[node->values_count].value_off = v; | ||
| 95 | node->values_count++; | ||
| 96 | - qsort_r(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); | ||
| 97 | + trie_node_add_value_trie = trie; | ||
| 98 | + qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); | ||
| 99 | + trie_node_add_value_trie = NULL; | ||
| 100 | return 0; | ||
| 101 | } | ||
| 102 | |||
| 103 | -- | ||
| 104 | 2.14.2 | ||
| 105 | |||
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch new file mode 100644 index 0000000000..1a6db654f8 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | From 9621618c701a2d5eb3e26f40c68354d4dfb8f872 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andre McCurdy <armccurdy@gmail.com> | ||
| 3 | Date: Tue, 10 Oct 2017 14:33:30 -0700 | ||
| 4 | Subject: [PATCH 12/12] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() | ||
| 5 | |||
| 6 | Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right | ||
| 7 | thing to do and it's not portable (not supported by musl). See: | ||
| 8 | |||
| 9 | http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html | ||
| 10 | http://www.openwall.com/lists/musl/2015/02/05/2 | ||
| 11 | |||
| 12 | Note that laccess() is never passing AT_EACCESS so a lot of the | ||
| 13 | discussion in the links above doesn't apply. Note also that | ||
| 14 | (currently) all systemd callers of laccess() pass mode as F_OK, so | ||
| 15 | only check for existence of a file, not access permissions. | ||
| 16 | Therefore, in this case, the only distiction between faccessat() | ||
| 17 | with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour | ||
| 18 | for broken symlinks; laccess() on a broken symlink will succeed with | ||
| 19 | (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). | ||
| 20 | |||
| 21 | The laccess() macros was added to systemd some time ago and it's not | ||
| 22 | clear if or why it needs to return success for broken symlinks. Maybe | ||
| 23 | just historical and not actually necessary or desired behaviour? | ||
| 24 | |||
| 25 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> | ||
| 26 | --- | ||
| 27 | Upstream-Status: Pending | ||
| 28 | |||
| 29 | src/basic/fs-util.h | 22 +++++++++++++++++++++- | ||
| 30 | src/shared/base-filesystem.c | 6 +++--- | ||
| 31 | 2 files changed, 24 insertions(+), 4 deletions(-) | ||
| 32 | |||
| 33 | diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h | ||
| 34 | index 094acf179..cdbc0ae72 100644 | ||
| 35 | --- a/src/basic/fs-util.h | ||
| 36 | +++ b/src/basic/fs-util.h | ||
| 37 | @@ -48,7 +48,27 @@ int fchmod_umask(int fd, mode_t mode); | ||
| 38 | |||
| 39 | int fd_warn_permissions(const char *path, int fd); | ||
| 40 | |||
| 41 | -#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) | ||
| 42 | +/* | ||
| 43 | + Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to | ||
| 44 | + do and it's not portable (not supported by musl). See: | ||
| 45 | + | ||
| 46 | + http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html | ||
| 47 | + http://www.openwall.com/lists/musl/2015/02/05/2 | ||
| 48 | + | ||
| 49 | + Note that laccess() is never passing AT_EACCESS so a lot of the discussion in | ||
| 50 | + the links above doesn't apply. Note also that (currently) all systemd callers | ||
| 51 | + of laccess() pass mode as F_OK, so only check for existence of a file, not | ||
| 52 | + access permissions. Therefore, in this case, the only distiction between | ||
| 53 | + faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the | ||
| 54 | + behaviour for broken symlinks; laccess() on a broken symlink will succeed | ||
| 55 | + with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). | ||
| 56 | + | ||
| 57 | + The laccess() macros was added to systemd some time ago and it's not clear if | ||
| 58 | + or why it needs to return success for broken symlinks. Maybe just historical | ||
| 59 | + and not actually necessary or desired behaviour? | ||
| 60 | +*/ | ||
| 61 | + | ||
| 62 | +#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) | ||
| 63 | |||
| 64 | int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); | ||
| 65 | int touch(const char *path); | ||
| 66 | diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c | ||
| 67 | index 903a18786..2f6052ee7 100644 | ||
| 68 | --- a/src/shared/base-filesystem.c | ||
| 69 | +++ b/src/shared/base-filesystem.c | ||
| 70 | @@ -70,7 +70,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { | ||
| 71 | return log_error_errno(errno, "Failed to open root file system: %m"); | ||
| 72 | |||
| 73 | for (i = 0; i < ELEMENTSOF(table); i ++) { | ||
| 74 | - if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) | ||
| 75 | + if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) | ||
| 76 | continue; | ||
| 77 | |||
| 78 | if (table[i].target) { | ||
| 79 | @@ -78,7 +78,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { | ||
| 80 | |||
| 81 | /* check if one of the targets exists */ | ||
| 82 | NULSTR_FOREACH(s, table[i].target) { | ||
| 83 | - if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0) | ||
| 84 | + if (faccessat(fd, s, F_OK, 0) < 0) | ||
| 85 | continue; | ||
| 86 | |||
| 87 | /* check if a specific file exists at the target path */ | ||
| 88 | @@ -89,7 +89,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { | ||
| 89 | if (!p) | ||
| 90 | return log_oom(); | ||
| 91 | |||
| 92 | - if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0) | ||
| 93 | + if (faccessat(fd, p, F_OK, 0) < 0) | ||
| 94 | continue; | ||
| 95 | } | ||
| 96 | |||
| 97 | -- | ||
| 98 | 2.14.2 | ||
| 99 | |||
diff --git a/meta/recipes-core/systemd/systemd/0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch b/meta/recipes-core/systemd/systemd/0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch new file mode 100644 index 0000000000..e219981ab0 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From 4b6733544beb662a0f77310302fae1fb7b76d167 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 12 Sep 2015 18:53:31 +0000 | ||
| 4 | Subject: [PATCH 13/13] comparison_fn_t is glibc specific, use raw signature in | ||
| 5 | function pointer | ||
| 6 | |||
| 7 | make it work with musl where comparison_fn_t is not provided | ||
| 8 | |||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | Upstream-Status: Pending | ||
| 12 | |||
| 13 | src/basic/util.h | 2 +- | ||
| 14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/src/basic/util.h b/src/basic/util.h | ||
| 17 | index c7da6c39b..87f62b891 100644 | ||
| 18 | --- a/src/basic/util.h | ||
| 19 | +++ b/src/basic/util.h | ||
| 20 | @@ -98,7 +98,7 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, | ||
| 21 | * Normal qsort requires base to be nonnull. Here were require | ||
| 22 | * that only if nmemb > 0. | ||
| 23 | */ | ||
| 24 | -static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_fn_t compar) { | ||
| 25 | +static inline void qsort_safe(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { | ||
| 26 | if (nmemb <= 1) | ||
| 27 | return; | ||
| 28 | |||
| 29 | -- | ||
| 30 | 2.14.2 | ||
| 31 | |||
diff --git a/meta/recipes-core/systemd/systemd_234.bb b/meta/recipes-core/systemd/systemd_234.bb index 971226ff7c..bcb683f10a 100644 --- a/meta/recipes-core/systemd/systemd_234.bb +++ b/meta/recipes-core/systemd/systemd_234.bb | |||
| @@ -10,7 +10,7 @@ SECTION = "base/shell" | |||
| 10 | 10 | ||
| 11 | inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext bash-completion manpages | 11 | inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext bash-completion manpages |
| 12 | 12 | ||
| 13 | SRC_URI += " \ | 13 | SRC_URI = "git://github.com/systemd/systemd.git;protocol=git \ |
| 14 | file://touchscreen.rules \ | 14 | file://touchscreen.rules \ |
| 15 | file://00-create-volatile.conf \ | 15 | file://00-create-volatile.conf \ |
| 16 | file://init \ | 16 | file://init \ |
| @@ -27,6 +27,19 @@ SRC_URI += " \ | |||
| 27 | file://0017-remove-duplicate-include-uchar.h.patch \ | 27 | file://0017-remove-duplicate-include-uchar.h.patch \ |
| 28 | file://0018-check-for-uchar.h-in-configure.patch \ | 28 | file://0018-check-for-uchar.h-in-configure.patch \ |
| 29 | file://0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \ | 29 | file://0019-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \ |
| 30 | file://0001-add-fallback-parse_printf_format-implementation.patch \ | ||
| 31 | file://0002-src-basic-missing.h-check-for-missing-strndupa.patch \ | ||
| 32 | file://0003-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ | ||
| 33 | file://0004-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch \ | ||
| 34 | file://0006-Include-netinet-if_ether.h.patch \ | ||
| 35 | file://0007-check-for-missing-canonicalize_file_name.patch \ | ||
| 36 | file://0008-Do-not-enable-nss-tests.patch \ | ||
| 37 | file://0009-test-hexdecoct.c-Include-missing.h-form-strndupa.patch \ | ||
| 38 | file://0010-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ | ||
| 39 | file://0011-don-t-use-glibc-specific-qsort_r.patch \ | ||
| 40 | file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ | ||
| 41 | file://0013-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ | ||
| 42 | file://0001-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch \ | ||
| 30 | " | 43 | " |
| 31 | SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" | 44 | SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch" |
| 32 | 45 | ||
| @@ -47,7 +60,8 @@ PACKAGECONFIG ??= "xz \ | |||
| 47 | vconsole \ | 60 | vconsole \ |
| 48 | quotacheck \ | 61 | quotacheck \ |
| 49 | hostnamed \ | 62 | hostnamed \ |
| 50 | ${@bb.utils.contains('TCLIBC', 'glibc', 'myhostname sysusers', '', d)} \ | 63 | ${@bb.utils.contains('TCLIBC', 'glibc', 'myhostname sysusers utmp', '', d)} \ |
| 64 | nss \ | ||
| 51 | hibernate \ | 65 | hibernate \ |
| 52 | timedated \ | 66 | timedated \ |
| 53 | timesyncd \ | 67 | timesyncd \ |
| @@ -56,13 +70,16 @@ PACKAGECONFIG ??= "xz \ | |||
| 56 | smack \ | 70 | smack \ |
| 57 | logind \ | 71 | logind \ |
| 58 | firstboot \ | 72 | firstboot \ |
| 59 | utmp \ | ||
| 60 | polkit \ | 73 | polkit \ |
| 61 | resolved \ | 74 | resolved \ |
| 62 | networkd \ | 75 | networkd \ |
| 63 | " | 76 | " |
| 64 | PACKAGECONFIG_remove_libc-musl = "selinux" | 77 | PACKAGECONFIG_remove_libc-musl = "selinux" |
| 65 | PACKAGECONFIG_remove_libc-musl = "smack" | 78 | PACKAGECONFIG_remove_libc-musl = "smack" |
| 79 | PACKAGECONFIG_remove_libc-musl = "resolved" | ||
| 80 | PACKAGECONFIG_remove_libc-musl = "nss" | ||
| 81 | PACKAGECONFIG_remove_libc-musl = "localed" | ||
| 82 | PACKAGECONFIG_remove_libc-musl = "ldconfig" | ||
| 66 | 83 | ||
| 67 | # Use the upstream systemd serial-getty@.service and rely on | 84 | # Use the upstream systemd serial-getty@.service and rely on |
| 68 | # systemd-getty-generator instead of using the OE-core specific | 85 | # systemd-getty-generator instead of using the OE-core specific |
| @@ -83,6 +100,7 @@ PACKAGECONFIG[vconsole] = "--enable-vconsole,--disable-vconsole,,${PN}-vconsole- | |||
| 83 | PACKAGECONFIG[quotacheck] = "--enable-quotacheck,--disable-quotacheck" | 100 | PACKAGECONFIG[quotacheck] = "--enable-quotacheck,--disable-quotacheck" |
| 84 | PACKAGECONFIG[hostnamed] = "--enable-hostnamed,--disable-hostnamed" | 101 | PACKAGECONFIG[hostnamed] = "--enable-hostnamed,--disable-hostnamed" |
| 85 | PACKAGECONFIG[myhostname] = "--enable-myhostname,--disable-myhostname" | 102 | PACKAGECONFIG[myhostname] = "--enable-myhostname,--disable-myhostname" |
| 103 | PACKAGECONFIG[nss] = "--enable-nss-systemd,--disable-nss-systemd" | ||
| 86 | PACKAGECONFIG[rfkill] = "--enable-rfkill,--disable-rfkill" | 104 | PACKAGECONFIG[rfkill] = "--enable-rfkill,--disable-rfkill" |
| 87 | PACKAGECONFIG[hibernate] = "--enable-hibernate,--disable-hibernate" | 105 | PACKAGECONFIG[hibernate] = "--enable-hibernate,--disable-hibernate" |
| 88 | PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated" | 106 | PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated" |
| @@ -612,8 +630,4 @@ pkg_prerm_udev-hwdb () { | |||
| 612 | python () { | 630 | python () { |
| 613 | if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): | 631 | if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): |
| 614 | raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") | 632 | raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") |
| 615 | |||
| 616 | import re | ||
| 617 | if re.match('.*musl*', d.getVar('TARGET_OS')) != None: | ||
| 618 | raise bb.parse.SkipPackage("Not _yet_ supported on musl based targets") | ||
| 619 | } | 633 | } |
