ustat(2) says: ustat() is deprecated and has only been provided for compatibility. All new programs should use statfs(2) instead.
Detect if ustat() is deprecated by checking that errno is ENOSYS, and end with TCONF in that case. Signed-off-by: Jan Stancek <jstan...@redhat.com> --- testcases/kernel/syscalls/ustat/ustat01.c | 4 ++++ testcases/kernel/syscalls/ustat/ustat02.c | 5 +++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/testcases/kernel/syscalls/ustat/ustat01.c b/testcases/kernel/syscalls/ustat/ustat01.c index 7d9c636..f8d8734 100644 --- a/testcases/kernel/syscalls/ustat/ustat01.c +++ b/testcases/kernel/syscalls/ustat/ustat01.c @@ -55,6 +55,10 @@ int main(int argc, char *argv[]) TEST(ustat(dev_num, &ubuf)); if (TEST_RETURN == -1) { + if (TEST_ERRNO == ENOSYS) + tst_brkm(TCONF, cleanup, + "ustat() not supported"); + TEST_ERROR_LOG(TEST_ERRNO); tst_resm(TFAIL, "ustat(2) failed and set" "the errno to %d : %s", diff --git a/testcases/kernel/syscalls/ustat/ustat02.c b/testcases/kernel/syscalls/ustat/ustat02.c index 90dad14..ad51860 100644 --- a/testcases/kernel/syscalls/ustat/ustat02.c +++ b/testcases/kernel/syscalls/ustat/ustat02.c @@ -97,6 +97,7 @@ int main(int ac, char **av) static void setup(void) { struct stat buf; + static dev_t dev_num; tst_sig(NOFORK, DEF_HANDLER, cleanup); @@ -107,6 +108,10 @@ static void setup(void) /* Find a valid device number */ SAFE_STAT(cleanup, "/", &buf); + TEST(ustat(dev_num, &ubuf)); + if (TEST_RETURN == -1 && TEST_ERRNO == ENOSYS) + tst_brkm(TCONF, cleanup, "ustat() not supported"); + root_dev = buf.st_dev; } -- 1.7.1 ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list