blob: 1d099177ff6dd7caf74f5e0861006dfc6feaed0c [file] [log] [blame]
Dmitry V. Levinbab4ef42015-12-10 02:06:25 +00001/*
2 * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include "defs.h"
29#include "syscall.h"
30
31#define TD 0
32#define TF 0
33#define TI 0
34#define TN 0
35#define TP 0
36#define TS 0
37#define TM 0
38#define NF 0
39#define MA 0
40#define SI 0
41#define SE 0
42#define SEN(arg) 0,0
43
44static const struct_sysent syscallent[] = {
45#include "syscallent.h"
46};
47
48typedef const char const *pstr_t;
49static const pstr_t ksyslist[] = {
50#include "ksysent.h"
51};
52
53int
54main(void)
55{
56 int rc = 0;
57 unsigned int i;
58
59 for (i = 0; i < ARRAY_SIZE(ksyslist); ++i) {
60 if (!ksyslist[i])
61 continue;
62 if (i >= ARRAY_SIZE(syscallent) || !syscallent[i].sys_name) {
63 fprintf(stderr, "warning: \"%s\" syscall #%u"
64 " is missing in syscallent.h\n",
65 ksyslist[i], i);
66 continue;
67 }
68#ifdef SYS_socket_nsubcalls
69 if (i >= SYS_socket_subcall &&
70 i < SYS_socket_subcall + SYS_socket_nsubcalls) {
71 fprintf(stderr, "error: \"%s\" syscall #%u"
72 " is a socket subcall in syscallent.h\n",
73 ksyslist[i], i);
74 rc = 1;
75 continue;
76 }
77#endif
78#ifdef SYS_ipc_nsubcalls
79 if (i >= SYS_ipc_subcall &&
80 i < SYS_ipc_subcall + SYS_ipc_nsubcalls) {
81 fprintf(stderr, "error: \"%s\" syscall #%u"
82 " is an ipc subcall in syscallent.h\n",
83 ksyslist[i], i);
84 rc = 1;
85 continue;
86 }
87#endif
88 if (strcmp(ksyslist[i], syscallent[i].sys_name)) {
89 fprintf(stderr, "error: \"%s\" syscall #%u"
90 " is \"%s\" in syscallent.h\n",
91 ksyslist[i], i, syscallent[i].sys_name);
92 rc = 1;
93 continue;
94 }
95 }
96
97 for (i = 0; i < ARRAY_SIZE(syscallent); ++i) {
98 if (!syscallent[i].sys_name
99#ifdef SYS_socket_nsubcalls
100 || (i >= SYS_socket_subcall &&
101 i < SYS_socket_subcall + SYS_socket_nsubcalls)
102#endif
103#ifdef SYS_ipc_nsubcalls
104 || (i >= SYS_ipc_subcall &&
105 i < SYS_ipc_subcall + SYS_ipc_nsubcalls)
106#endif
107#ifdef ARM_FIRST_SHUFFLED_SYSCALL
108 || (i >= ARM_FIRST_SHUFFLED_SYSCALL &&
109 i <= ARM_FIRST_SHUFFLED_SYSCALL +
110 ARM_LAST_SPECIAL_SYSCALL + 1)
111#endif
112 )
113 continue;
114 if (i >= ARRAY_SIZE(ksyslist) || !ksyslist[i]) {
115 fprintf(stderr, "note: unknown syscall #%u"
116 " is \"%s\" in syscallent.h\n",
117 i, syscallent[i].sys_name);
118 }
119 }
120
121 return rc;
122}