Use an if instead of a case statemente. If __NR_finit_module is not
defined in system headers we define it to -1, causing a "duplicate case
value" error. Yet, we don't want to actually call our finit_module()
function if -1 is passed.
This also fix errno being set with negative value.
When we don't have finit_module() in libc (most likely because as of
today glibc didn't add it yet), we end up using
syscall(__NR_finit_module, ...). In this case we would not wrap the
function in the testsuite and thus having some tests failing:
TESTSUITE: ERR: could not insert module: Operation not permitted
This implementation relies on the fact that this is the only caller of
syscall(2), because we can't call libc's syscall(). There's an abort()
in place to be future safe: as soon as we need more calls to syscall(),
we can detect (and decide what to do).
Now we have all tests passing in the testsuite again.
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
We need to cope with the case in which a 32 bits machine is opening a 64
bits kernel module and vice-versa. The offset in `struct module' are
different and do not depend on the architecture we are running, but
rather on the architecture they were created for.
This fixes `make check' in 32 bits machines (since we are shipping 64
bits modules for testing)
Autofoo make the dist dir as readonly. If we copy it, tools needing to
create sysfs entries will not be able to do so, because they can't
create the needed directories/files.
It would be much better if autofoo allowed to let the files as is
instead of converting them to read-only.