009-modutils.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 7cf41b6e281c42fb7f2117927a8ff7f476103e76 Mon Sep 17 00:00:00 2001
  2. From: Waldemar Brodkorb <wbx@openadk.org>
  3. Date: Sun, 25 Dec 2016 16:53:32 +0100
  4. Subject: [PATCH] modutils: remove special handling of uClibc
  5. Commit 3a45b87ac36f (modutils: support finit_module syscall) introduced
  6. macro finit_module. But it is not defined for uClibc.
  7. The compilation for busybox fails for MIPS with:
  8. With uClibc, we get following build errors:
  9. modutils/lib.a(modutils.o): In function `bb_init_module':
  10. modutils.c:(.text.bb_init_module+0x94): undefined reference to `finit_module'
  11. modutils.c:(.text.bb_init_module+0xa0): undefined reference to `finit_module'
  12. We can just use syscall() without any need for the
  13. uClibc wrappers.
  14. Newer versions of uClibc-ng (>1.0.20) will remove the
  15. module syscall wrappers.
  16. Found via Buildroot autobuilders:
  17. http://autobuild.buildroot.net/results/556/55655daef23788fb3967f801ec8b79e9bed7122b/build-end.log
  18. Reported-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
  19. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
  20. ---
  21. modutils/modprobe-small.c | 4 ++--
  22. modutils/modutils.c | 15 +++++----------
  23. 2 files changed, 7 insertions(+), 12 deletions(-)
  24. diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
  25. index 652ff4d..0fc9ea4 100644
  26. --- a/modutils/modprobe-small.c
  27. +++ b/modutils/modprobe-small.c
  28. @@ -39,8 +39,8 @@
  29. #include <fnmatch.h>
  30. #include <sys/syscall.h>
  31. -extern int init_module(void *module, unsigned long len, const char *options);
  32. -extern int delete_module(const char *module, unsigned flags);
  33. +#define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
  34. +#define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
  35. #ifdef __NR_finit_module
  36. # define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
  37. #endif
  38. diff --git a/modutils/modutils.c b/modutils/modutils.c
  39. index d36caaf..d56bfc8 100644
  40. --- a/modutils/modutils.c
  41. +++ b/modutils/modutils.c
  42. @@ -7,17 +7,12 @@
  43. */
  44. #include "modutils.h"
  45. -#ifdef __UCLIBC__
  46. -extern int init_module(void *module, unsigned long len, const char *options);
  47. -extern int delete_module(const char *module, unsigned int flags);
  48. -#else
  49. -# include <sys/syscall.h>
  50. -# define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
  51. -# if defined(__NR_finit_module)
  52. -# define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
  53. -# endif
  54. -# define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
  55. +#include <sys/syscall.h>
  56. +#define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
  57. +#if defined(__NR_finit_module)
  58. +# define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
  59. #endif
  60. +#define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
  61. static module_entry *helper_get_module(module_db *db, const char *module, int create)
  62. {
  63. --
  64. 2.1.4