From: Lucas De Marchi Date: Tue, 9 Apr 2013 07:16:57 +0000 (-0300) Subject: libkmod: Move finit_module() definition to missing.h X-Git-Tag: v13~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55112d19f7067dff89b1481d5bd8cc49139c4ecb;p=platform%2Fupstream%2Fkmod.git libkmod: Move finit_module() definition to missing.h Check for finit_module() and don't use our own static inline function if there's such function in libc (or another lib). In testsuite we need to unconditionally define HAVE_FINIT_MODULE because we want to override this function, and never use the static inline one in missing.h --- diff --git a/configure.ac b/configure.ac index 1c6c793..066515c 100644 --- a/configure.ac +++ b/configure.ac @@ -40,6 +40,7 @@ PKG_PROG_PKG_CONFIG AC_CHECK_FUNCS_ONCE(__xstat) AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv]) +AC_CHECK_FUNCS_ONCE([finit_module]) # dietlibc doesn't have st.st_mtim struct member AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include ]) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index f701d47..47d12ad 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -768,14 +768,6 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, extern long init_module(const void *mem, unsigned long len, const char *args); -#ifndef __NR_finit_module -# define __NR_finit_module -1 -#endif -static inline int finit_module(int fd, const char *uargs, int flags) -{ - return syscall(__NR_finit_module, fd, uargs, flags); -} - /** * kmod_module_insert_module: * @mod: kmod module diff --git a/libkmod/missing.h b/libkmod/missing.h index 6ff754f..edb88b9 100644 --- a/libkmod/missing.h +++ b/libkmod/missing.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + #ifdef HAVE_LINUX_MODULE_H #include #endif @@ -11,3 +14,14 @@ #ifndef MODULE_INIT_IGNORE_VERMAGIC # define MODULE_INIT_IGNORE_VERMAGIC 2 #endif + +#ifndef __NR_finit_module +# define __NR_finit_module -1 +#endif + +#ifndef HAVE_FINIT_MODULE +static inline int finit_module(int fd, const char *uargs, int flags) +{ + return syscall(__NR_finit_module, fd, uargs, flags); +} +#endif diff --git a/testsuite/init_module.c b/testsuite/init_module.c index ca9f84c..d60ca96 100644 --- a/testsuite/init_module.c +++ b/testsuite/init_module.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef HAVE_FINIT_MODULE +#define HAVE_FINIT_MODULE 1 +#endif + #include #include #include