diff options
author | kib <kib@FreeBSD.org> | 2010-08-17 09:42:50 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-08-17 09:42:50 +0000 |
commit | 2c928d3c3488d246a387cc7399707f0bd2e28626 (patch) | |
tree | baa5e1681b763f8c091e675952b64853d42fb60b /tools | |
parent | 8d54dbc4591e4b62384caa7d630faa4299ee25b5 (diff) | |
download | FreeBSD-src-2c928d3c3488d246a387cc7399707f0bd2e28626.zip FreeBSD-src-2c928d3c3488d246a387cc7399707f0bd2e28626.tar.gz |
Add simple test to check the functioning of retrieval of
pagesize()/pagesizes() after change to use aux vector. Note that
public function getosreldate() is different from libc-internal
__getosreldate() and does not use aux to fetch osreldate value.
MFC after: 1 month
Diffstat (limited to 'tools')
-rw-r--r-- | tools/test/auxinfo/Makefile | 7 | ||||
-rw-r--r-- | tools/test/auxinfo/auxinfo.c | 58 |
2 files changed, 65 insertions, 0 deletions
diff --git a/tools/test/auxinfo/Makefile b/tools/test/auxinfo/Makefile new file mode 100644 index 0000000..e6e5768 --- /dev/null +++ b/tools/test/auxinfo/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +PROG= auxinfo +NO_MAN= +WARNS?= 6 + +.include <bsd.prog.mk> diff --git a/tools/test/auxinfo/auxinfo.c b/tools/test/auxinfo/auxinfo.c new file mode 100644 index 0000000..374bed8 --- /dev/null +++ b/tools/test/auxinfo/auxinfo.c @@ -0,0 +1,58 @@ +/* + * This file is in public domain. + * Written by Konstantin Belousov <kib@freebsd.org> + * + * $FreeBSD$ + */ + +#include <sys/mman.h> +#include <err.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdio.h> +#include <unistd.h> + +static void +test_pagesizes(void) +{ + size_t *ps; + int i, nelem; + + nelem = getpagesizes(NULL, 0); + if (nelem == -1) + err(1, "getpagesizes(NULL, 0)"); + ps = malloc(nelem * sizeof(size_t)); + if (ps == NULL) + err(1, "malloc"); + nelem = getpagesizes(ps, nelem); + if (nelem == -1) + err(1, "getpagesizes"); + printf("Supported page sizes:"); + for (i = 0; i < nelem; i++) + printf(" %jd", (intmax_t)ps[i]); + printf("\n"); +} + +static void +test_pagesize(void) +{ + + printf("Pagesize: %d\n", getpagesize()); +} + +static void +test_osreldate(void) +{ + + printf("OSRELDATE: %d\n", getosreldate()); +} + +int +main(int argc __unused, char *argv[] __unused) +{ + + test_pagesizes(); + test_pagesize(); + test_osreldate(); + return (0); +} |