2 m4_dnl (part of complex test harness, not of the library)
5 m4_dnl This file is part of adns, which is Copyright Ian Jackson
6 m4_dnl and contributors (see the file INSTALL for full details).
8 m4_dnl This program is free software; you can redistribute it and/or modify
9 m4_dnl it under the terms of the GNU General Public License as published by
10 m4_dnl the Free Software Foundation; either version 3, or (at your option)
11 m4_dnl any later version.
13 m4_dnl This program is distributed in the hope that it will be useful,
14 m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 m4_dnl GNU General Public License for more details.
18 m4_dnl You should have received a copy of the GNU General Public License
19 m4_dnl along with this program; if not, write to the Free Software Foundation.
21 m4_define(`hm_args_massage',
31 m4_patsubst(m4_patsubst(m4_patsubst(m4_translit($1, `
32 ',` '), `\(hm_comma *\)*$', `'), `^\( *hm_comma\)*', `'),
33 `\( *hm_comma *\)+',` hm_comma ')m4_dnl
36 m4_define(`hm_create_nothing', `
38 m4_define(`hm_arg_nullptr', `')
39 m4_define(`hm_arg_int', `')
40 m4_define(`hm_arg_fdset_io', `')
41 m4_define(`hm_arg_pollfds_io', `')
42 m4_define(`hm_arg_timeval_in_rel_null',`')
43 m4_define(`hm_arg_must', `')
44 m4_define(`hm_arg_socktype',`')
45 m4_define(`hm_arg_addrfam',`')
46 m4_define(`hm_arg_ign', `')
47 m4_define(`hm_arg_fd', `')
48 m4_define(`hm_arg_fcntl_cmd_arg',`')
49 m4_define(`hm_arg_addr_in', `')
50 m4_define(`hm_arg_bytes_in', `')
51 m4_define(`hm_arg_bytes_out', `')
52 m4_define(`hm_arg_addr_out', `')
53 m4_define(`hm_rv_must', `')
54 m4_define(`hm_rv_any', `')
55 m4_define(`hm_rv_fd', `')
56 m4_define(`hm_rv_succfail', `')
57 m4_define(`hm_rv_len', `')
58 m4_define(`hm_rv_wlen', `hm_rv_any')
59 m4_define(`hm_rv_fcntl', `')
60 m4_define(`hm_rv_select', `hm_rv_any')
61 m4_define(`hm_rv_poll', `hm_rv_any')
64 m4_define(`hm_create_proto_h',`
65 m4_define(`hm_na', `hm_comma')
66 m4_define(`hm_arg_nullptr', `$'`1 $'`2')
67 m4_define(`hm_arg_int', `int $'`1')
68 m4_define(`hm_arg_fdset_io', `fd_set *$'`1')
69 m4_define(`hm_arg_pollfds_io', `struct pollfd *$'`1 hm_comma int $'`2')
70 m4_define(`hm_arg_timeval_in_rel_null', `struct timeval *$'`1')
71 m4_define(`hm_arg_must', `$'`1 $'`2')
72 m4_define(`hm_arg_socktype', `int $'`1')
73 m4_define(`hm_arg_addrfam', `int $'`1')
74 m4_define(`hm_arg_ign', `$'`1 $'`2')
75 m4_define(`hm_arg_fd', `int $'`1')
76 m4_define(`hm_arg_fcntl_cmd_arg', `int $'`1 hm_comma ...')
77 m4_define(`hm_arg_addr_in', `const struct sockaddr *$'`1 hm_comma int $'`2')
78 m4_define(`hm_arg_bytes_in', `const $'`1 *$'`2 hm_comma $'`3 $'`4')
79 m4_define(`hm_arg_bytes_out', `$'`1 *$'`2 hm_comma $'`3 $'`4')
80 m4_define(`hm_arg_addr_out', `struct sockaddr *$'`1 hm_comma int *$'`2')
83 m4_define(`hm_create_proto_q',`
85 m4_define(`hm_arg_nullptr', `')
86 m4_define(`hm_arg_fdset_io', `const fd_set *$'`1')
87 m4_define(`hm_arg_pollfds_io', `const struct pollfd *$'`1 hm_comma int $'`2')
88 m4_define(`hm_arg_must', `')
89 m4_define(`hm_arg_ign', `')
90 m4_define(`hm_arg_fcntl_cmd_arg', `int $'`1 hm_comma long $'`2')
91 m4_define(`hm_arg_bytes_out', `$'`3 $'`4')
92 m4_define(`hm_arg_addr_out', `int $'`2')
95 m4_define(`hm_create_hqcall_vars',`
97 m4_define(`hm_arg_fcntl_cmd_arg',`va_list al; long $'`2;')
100 m4_define(`hm_create_hqcall_init',`
102 m4_define(`hm_arg_nullptr', `Tmust("$1","$'`2",!$'`2);')
103 m4_define(`hm_arg_must', `Tmust("$1","$'`2",$'`2==$'`3);')
104 m4_define(`hm_arg_socktype',`
105 Tmust("$1","$'`1",$'`1==SOCK_STREAM || $'`1==SOCK_DGRAM);')
106 m4_define(`hm_arg_addrfam',`
107 Tmust("$1","$'`1",$'`1==AF_INET || $'`1==AF_INET6);')
108 m4_define(`hm_arg_fcntl_cmd_arg',`
109 Tmust("$1","$'`1",$'`1==F_SETFL || $'`1==F_GETFL);
110 if ($'`1 == F_SETFL) {
111 va_start(al,$'`1); $'`2= va_arg(al,int); va_end(al);
115 m4_define(`hm_arg_addr_out',`Tmust("$1","*$'`2",*$'`2>=sizeof(struct sockaddr_in));')
118 m4_define(`hm_create_realcall_args',`
119 m4_define(`hm_na',`hm_comma')
120 m4_define(`hm_arg_nullptr', `0')
121 m4_define(`hm_arg_int', `$'`1')
122 m4_define(`hm_arg_fdset_io', `$'`1')
123 m4_define(`hm_arg_pollfds_io', `$'`1 hm_comma $'`2')
124 m4_define(`hm_arg_timeval_in_rel_null', `$'`1')
125 m4_define(`hm_arg_must', `$'`2')
126 m4_define(`hm_arg_socktype', `$'`1')
127 m4_define(`hm_arg_addrfam', `$'`1')
128 m4_define(`hm_arg_ign', `$'`2')
129 m4_define(`hm_arg_fd', `$'`1')
130 m4_define(`hm_arg_fcntl_cmd_arg', `$'`1 hm_comma $'`2')
131 m4_define(`hm_arg_addr_in', `$'`1 hm_comma $'`2')
132 m4_define(`hm_arg_bytes_in', `$'`2 hm_comma $'`4')
133 m4_define(`hm_arg_bytes_out', `$'`2 hm_comma $'`4')
134 m4_define(`hm_arg_addr_out', `$'`1 hm_comma $'`2')
137 m4_define(`hm_create_hqcall_args',`
138 hm_create_realcall_args
139 m4_define(`hm_arg_nullptr', `')
140 m4_define(`hm_arg_must', `')
141 m4_define(`hm_arg_ign', `')
142 m4_define(`hm_arg_bytes_in', `$'`2 hm_comma $'`4')
143 m4_define(`hm_arg_bytes_out', `$'`4')
144 m4_define(`hm_arg_addr_out', `*$'`2')
147 m4_define(`hm_fr_syscall_ident',`
148 static const char sync_expect[sizeof("$1")]= "$1\xee";