2 * Validate syscallent.h file.
4 * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
5 * Copyright (c) 2015-2017 The strace developers.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #include <asm/unistd.h>
58 static const struct_sysent syscallent[] = {
59 #include "syscallent.h"
62 typedef const char *pstr_t;
63 static const pstr_t ksyslist[] = {
73 for (i = 0; i < ARRAY_SIZE(ksyslist); ++i) {
76 if (i >= ARRAY_SIZE(syscallent) || !syscallent[i].sys_name) {
77 fprintf(stderr, "warning: \"%s\" syscall #%u"
78 " is missing in syscallent.h\n",
82 #ifdef SYS_socket_nsubcalls
83 if (i >= SYS_socket_subcall &&
84 i < SYS_socket_subcall + SYS_socket_nsubcalls) {
85 fprintf(stderr, "error: \"%s\" syscall #%u"
86 " is a socket subcall in syscallent.h\n",
92 #ifdef SYS_ipc_nsubcalls
93 if (i >= SYS_ipc_subcall &&
94 i < SYS_ipc_subcall + SYS_ipc_nsubcalls) {
95 fprintf(stderr, "error: \"%s\" syscall #%u"
96 " is an ipc subcall in syscallent.h\n",
102 if (strcmp(ksyslist[i], syscallent[i].sys_name)) {
103 fprintf(stderr, "error: \"%s\" syscall #%u"
104 " is \"%s\" in syscallent.h\n",
105 ksyslist[i], i, syscallent[i].sys_name);
111 for (i = 0; i < ARRAY_SIZE(syscallent); ++i) {
112 if (!syscallent[i].sys_name
113 #ifdef SYS_socket_nsubcalls
114 || (i >= SYS_socket_subcall &&
115 i < SYS_socket_subcall + SYS_socket_nsubcalls)
117 #ifdef SYS_ipc_nsubcalls
118 || (i >= SYS_ipc_subcall &&
119 i < SYS_ipc_subcall + SYS_ipc_nsubcalls)
121 #ifdef ARM_FIRST_SHUFFLED_SYSCALL
122 || (i >= ARM_FIRST_SHUFFLED_SYSCALL &&
123 i <= ARM_FIRST_SHUFFLED_SYSCALL +
124 ARM_LAST_SPECIAL_SYSCALL + 1)
128 if (i >= ARRAY_SIZE(ksyslist) || !ksyslist[i]) {
129 fprintf(stderr, "note: unknown syscall #%u"
130 " is \"%s\" in syscallent.h\n",
131 i, syscallent[i].sys_name);