2
1

systemd-uclibc-fix.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. [PATCH] fix build with uClibc
  2. Based on OE patch from Khem Raj:
  3. http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch
  4. But extended to also cover execvpe (OE carries a patch adding execvpe
  5. support to uClibc).
  6. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
  7. ---
  8. src/journal/journal-file.c | 2 ++
  9. src/macro.h | 15 +++++++++++++++
  10. 2 files changed, 17 insertions(+)
  11. Index: systemd-44/src/macro.h
  12. ===================================================================
  13. --- systemd-44.orig/src/macro.h
  14. +++ systemd-44/src/macro.h
  15. @@ -28,6 +28,21 @@
  16. #include <sys/uio.h>
  17. #include <inttypes.h>
  18. +#ifdef __UCLIBC__
  19. +/* uclibc does not implement mkostemp GNU extension */
  20. +#define mkostemp(x,y) mkstemp(x)
  21. +/* uclibc does not implement execvpe GNU extension */
  22. +#ifndef _GNU_SOURCE
  23. +#define _GNU_SOURCE
  24. +#endif
  25. +#include <unistd.h>
  26. +static inline int execvpe(const char *file, char *const argv[],
  27. + char *const envp[])
  28. +{
  29. + environ = (char **)envp;
  30. + return execvp(file, argv);
  31. +}
  32. +#endif
  33. #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
  34. #define _sentinel_ __attribute__ ((sentinel))
  35. #define _noreturn_ __attribute__((noreturn))
  36. Index: systemd-44/src/journal/journal-file.c
  37. ===================================================================
  38. --- systemd-44.orig/src/journal/journal-file.c
  39. +++ systemd-44/src/journal/journal-file.c
  40. @@ -229,11 +229,13 @@
  41. }
  42. }
  43. +#ifndef __UCLIBC__
  44. /* Note that the glibc fallocate() fallback is very
  45. inefficient, hence we try to minimize the allocation area
  46. as we can. */
  47. if (posix_fallocate(f->fd, old_size, new_size - old_size) < 0)
  48. return -errno;
  49. +#endif
  50. if (fstat(f->fd, &f->last_stat) < 0)
  51. return -errno;