Skip to contentSkip to conversation

Fix 'make check': undeclared __NR_finit_module

PATCH In review Chengwei Yang 2 participants 3 messages May 7, 2013 – May 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix 'make check': undeclared __NR_finit_module

This issue introduced by a fix for syscall(-1, ...) is invalid on some arch. The error thrown by 'make check' likes below.

testsuite/init_module.c: In function 'syscall':
testsuite/init_module.c:317:17: error: '__NR_finit_module' undeclared (first use in this function) testsuite/init_module.c:317:17: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [testsuite/init_module.lo] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1

---
 libkmod/missing.h |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
libkmod/missing.h +10 -6
index b31af84..52dbcc7 100644
@@ -12,6 +12,10 @@
 # define MODULE_INIT_IGNORE_MODVERSIONS 1
 #endif
 
+#ifndef __NR_finit_module
+# define __NR_finit_module -1
+#endif
+
 #ifndef MODULE_INIT_IGNORE_VERMAGIC
 # define MODULE_INIT_IGNORE_VERMAGIC 2
 #endif
@@ -19,11 +23,11 @@
 #ifndef HAVE_FINIT_MODULE
 static inline int finit_module(int fd, const char *uargs, int flags)
 {
-#ifndef __NR_finit_module
-	errno = ENOSYS;
-	return -1;
-#else
-	return syscall(__NR_finit_module, fd, uargs, flags);
-#endif
+	if (__NR_finit_module == -1) {
+		errno = ENOSYS;
+		return -1;
+	} else {
+		return syscall(__NR_finit_module, fd, uargs, flags);
+	}
 }
 #endif
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 36 lines · Chengwei Yang

This issue introduced by a fix for syscall(-1, ...) is invalid on some arch. The error thrown by 'make check' likes below.

testsuite/init_module.c: In function 'syscall':
testsuite/init_module.c:317:17: error: '__NR_finit_module' undeclared (first use in this function) testsuite/init_module.c:317:17: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [testsuite/init_module.lo] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1

---
 libkmod/missing.h |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
libkmod/missing.h +4 -2
index b31af84..52dbcc7 100644
@@ -12,6 +12,10 @@
 # define MODULE_INIT_IGNORE_MODVERSIONS 1
 #endif
 
+#ifndef __NR_finit_module
+# define __NR_finit_module -1
+#endif
+
 #ifndef MODULE_INIT_IGNORE_VERMAGIC
 # define MODULE_INIT_IGNORE_VERMAGIC 2
 #endif
@@ -19,11 +23,11 @@
 #ifndef HAVE_FINIT_MODULE
 static inline int finit_module(int fd, const char *uargs, int flags)
 {
-#ifndef __NR_finit_module
-       errno = ENOSYS;

libkmod/missing.h line 31

Quoted 10 lines
libkmod/missing.h +6 -4
-       return -1;
-#else
-       return syscall(__NR_finit_module, fd, uargs, flags);
-#endif
+       if (__NR_finit_module == -1) {
+               errno = ENOSYS;
+               return -1;
+       } else {
+               return syscall(__NR_finit_module, fd, uargs, flags);
+       }

humn... my bad not applying it to testsuite.

But I would expect the same fix being applied to testsuite instead of changing the check to runtime.

Lucas De Marchi

#2 lore raw
Quoted 50 lines · Lucas De Marchi
Quoted 36 lines · Chengwei Yang

This issue introduced by a fix for syscall(-1, ...) is invalid on some arch. The error thrown by 'make check' likes below.

testsuite/init_module.c: In function 'syscall':
testsuite/init_module.c:317:17: error: '__NR_finit_module' undeclared (first use in this function) testsuite/init_module.c:317:17: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [testsuite/init_module.lo] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1

---
 libkmod/missing.h |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
libkmod/missing.h +4 -2
index b31af84..52dbcc7 100644
@@ -12,6 +12,10 @@
 # define MODULE_INIT_IGNORE_MODVERSIONS 1
 #endif
 
+#ifndef __NR_finit_module
+# define __NR_finit_module -1
+#endif
+
 #ifndef MODULE_INIT_IGNORE_VERMAGIC
 # define MODULE_INIT_IGNORE_VERMAGIC 2
 #endif
@@ -19,11 +23,11 @@
 #ifndef HAVE_FINIT_MODULE
 static inline int finit_module(int fd, const char *uargs, int flags)
 {
-#ifndef __NR_finit_module
-       errno = ENOSYS;

libkmod/missing.h line 31

Quoted 10 lines
libkmod/missing.h +6 -4
-       return -1;
-#else
-       return syscall(__NR_finit_module, fd, uargs, flags);
-#endif
+       if (__NR_finit_module == -1) {
+               errno = ENOSYS;
+               return -1;
+       } else {
+               return syscall(__NR_finit_module, fd, uargs, flags);
+       }

humn... my bad not applying it to testsuite.

Quoted 2 lines

But I would expect the same fix being applied to testsuite instead of changing the check to runtime.

Agreed, I'll upload v2 later.

--
Thanks,
Chengwei

Quoted 2 lines

Lucas De Marchi