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>
configure: Add mkdirat() detection, fix build

Build failure is caused by adding the ex4 features tests into the
default build which exposes code which uses mkdirat().

This patch adds configure check for mkdirat() and ifdefs around the
code in create_long_dirs.c and create_short_dirs.c.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
lib: tst_get_unused_uid, tst_get_unused_gid

Implemented functions which return the first unused
uid and gid.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
setregid02, setresuid03: inval_user fix

Since there is no guarantee that (USHRT_MAX - 2) uid/gid is free
on the platform it would be better to use special functions:

 * tst_get_unused_uid
 * tst_get_unused_gid

wrapped for 16-bit compatibility: if on the host there is no free uid/gid
in between [0; 0xFFFE] the 16-bit test case should return TBROK.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
doc: Add test writing guidelines

This document contains general guidelines for writing LTP testcases as
well as basic LTP lib documentation.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
utils: sctp: Fix build for prefixed architectures

Commit 6f22494d19b605ded308dc0fa713e91cb873f44a
"Move sctp to utils and bump it to 1.0.15"

introduced a build failure for the prefixed architectures.
We need to take into consideration the __USER_LABEL_PREFIX__
for architectures that define it when creating symbol aliases.

The following upstream patch (0600c8968cc2dea04cbf13ec739216e2939d08fe)
fixes the build for the Meta(metag) architecture

[...]
utils/sctp/func_tests/test_connectx.c:151: undefined reference to `_sctp_connectx'
utils/sctp/func_tests/test_connectx.c:163: undefined reference to `_sctp_connectx'
[...]

Build tested on x86_64 and metag.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>