]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/test/auxinfo/auxinfo.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / test / auxinfo / auxinfo.c
1 /*
2  * This file is in public domain.
3  * Written by Konstantin Belousov <kib@freebsd.org>
4  *
5  * $FreeBSD$
6  */
7
8 #include <sys/mman.h>
9 #include <err.h>
10 #include <stdlib.h>
11 #include <stdint.h>
12 #include <stdio.h>
13 #include <unistd.h>
14
15 static void
16 test_pagesizes(void)
17 {
18         size_t *ps;
19         int i, nelem;
20
21         nelem = getpagesizes(NULL, 0);
22         if (nelem == -1)
23                 err(1, "getpagesizes(NULL, 0)");
24         ps = malloc(nelem * sizeof(size_t));
25         if (ps == NULL)
26                 err(1, "malloc");
27         nelem = getpagesizes(ps, nelem);
28         if (nelem == -1)
29                 err(1, "getpagesizes");
30         printf("Supported page sizes:");
31         for (i = 0; i < nelem; i++)
32                 printf(" %jd", (intmax_t)ps[i]);
33         printf("\n");
34 }
35
36 static void
37 test_pagesize(void)
38 {
39
40         printf("Pagesize: %d\n", getpagesize());
41 }
42
43 static void
44 test_osreldate(void)
45 {
46
47         printf("OSRELDATE: %d\n", getosreldate());
48 }
49
50 static void
51 test_ncpus(void)
52 {
53
54         printf("NCPUs: %ld\n", sysconf(_SC_NPROCESSORS_CONF));
55 }
56
57 int
58 main(int argc __unused, char *argv[] __unused)
59 {
60
61         test_pagesizes();
62         test_pagesize();
63         test_osreldate();
64         test_ncpus();
65         return (0);
66 }