From: Dmitry V. Levin Date: Wed, 6 Jan 2016 10:00:44 +0000 (+0000) Subject: tests/mlock2.c: use libtests X-Git-Tag: v4.12~711 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f03712ef1a79e7a2bdf86033340add5bbadcb6ec;p=strace tests/mlock2.c: use libtests * tests/mlock2.c: Use SKIP_MAIN_UNDEFINED. (main): Use assert. --- diff --git a/tests/mlock2.c b/tests/mlock2.c index 4b0b97ea..4e850fdb 100644 --- a/tests/mlock2.c +++ b/tests/mlock2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Dmitry V. Levin + * Copyright (c) 2015-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,24 +26,27 @@ */ #include "tests.h" -#include -#include -#include #include +#ifdef __NR_mlock2 + +# include +# include +# include +# include + int main(void) { -#ifdef __NR_mlock2 - if (syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff) != -1) - return 77; - printf("mlock2(0xdeadbeef, 233811181, MLOCK_ONFAULT|0xfffe) = -1 %s\n", - errno == ENOSYS ? - "ENOSYS (Function not implemented)" : - "EINVAL (Invalid argument)"); + assert(syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff) == -1); + printf("mlock2(0xdeadbeef, 233811181, MLOCK_ONFAULT|0xfffe)" + " = -1 %s (%m)\n", errno == ENOSYS ? "ENOSYS" : "EINVAL"); puts("+++ exited with 0 +++"); return 0; +} + #else - return 77; + +SKIP_MAIN_UNDEFINED("__NR_mlock2") + #endif -}