lib/cloner.c: add ltp_clone7() and fix build

The seven argument clone breaks compilation on older distributions
(SLES10, RHEL4, etc.). It was introduced by commit 5f5cb63b7ddb.

This commit adds a configure check and ltp_clone7() library function.

Now the ltp_clone() is the same old ltp_clone() with five arguments and
ltp_clone7() is the new one with eight arguments (but it calls clone
with seven arguments, thus the name).

Tests that does not need the additional arguments should call the
ltp_clone() the rest should call ltp_clone7(). If seven argument clone
is not supproted the ltp_clone7() will return -1 and set errno to
ENOSYS.

Note that we need to use __clone2() on ia64 instead and unfortunately
the prototype for the function was never exported. On the other hand
the __clone2() has gained support for eight arguments in glibc commit:

commit 625f22fc7f8e0d61e3e6cff2c65468b91dbad426
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Mon Mar 3 19:53:27 2003 +0000

That was firstly introduced in glibc-2.3.3 which is old enough to
just assume that __clone2() takes eight arguments.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
5 files changed