python-treq: bump to version 16.12.0
[buildroot-gz.git] / package / rpcbind / 0003-src-remove-use-of-the-__P-macro.patch
blob72fda880ce3eada3072b0c19ccbd9da4b9e63d4b
1 From 2f7d15304e0544e4c693c86d8ab8b2f08b9e9886 Mon Sep 17 00:00:00 2001
2 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3 Date: Mon, 15 Aug 2016 16:36:40 +0200
4 Subject: [PATCH] src: remove use of the __P() macro
6 The __P() macro is a legacy compatibility macro aimed making pre-ANSI
7 (i.e. K&R) compilers that do not support function prototypes happy,
8 while still allowing such prototypes for ANSI-compliant compilers.
10 Since virtually all compilers have been ANSI-compliant for a few decades
11 now, use of __P() is totally useless.
13 Furthermore, __P() is defined in the non-standard sys/cdefs.h header.
14 This header is present in glibc and uClibc, and both have it included
15 from many of their headers. So, sys/cdefs.h is automagically included in
16 most cases and its macros are available.
18 However, the musl C library does not provide this sys/cdefs.h header.
19 Thus, the build breaks on musl.
21 For all the above reasons, get rid of __P() wherever it is used; just
22 always declare real function prototypes.
24 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
25 Cc: Chuck Lever <chuck.lever@oracle.com>
26 Cc: Steve Dickson <SteveD@redhat.com>
27 ---
28 src/check_bound.c | 2 +-
29 src/pmap_svc.c | 10 +++++-----
30 src/rpcb_svc.c | 10 +++++-----
31 src/rpcb_svc_4.c | 14 ++++++--------
32 src/rpcb_svc_com.c | 46 +++++++++++++++++++++++-----------------------
33 src/rpcbind.c | 12 ++++++------
34 src/util.c | 2 +-
35 src/warmstart.c | 4 ++--
36 8 files changed, 49 insertions(+), 51 deletions(-)
38 diff --git a/src/check_bound.c b/src/check_bound.c
39 index c70b845..92bfd36 100644
40 --- a/src/check_bound.c
41 +++ b/src/check_bound.c
42 @@ -70,7 +70,7 @@ static struct fdlist *fdhead; /* Link list of the check fd's */
43 static struct fdlist *fdtail;
44 static char *nullstring = "";
46 -static bool_t check_bound __P((struct fdlist *, char *uaddr));
47 +static bool_t check_bound(struct fdlist *, char *uaddr);
50 * Returns 1 if the given address is bound for the given addr & transport
51 diff --git a/src/pmap_svc.c b/src/pmap_svc.c
52 index ad28b93..4c744fe 100644
53 --- a/src/pmap_svc.c
54 +++ b/src/pmap_svc.c
55 @@ -60,11 +60,11 @@ static char sccsid[] = "@(#)pmap_svc.c 1.23 89/04/05 Copyr 1984 Sun Micro";
56 #include "rpcbind.h"
57 #include "xlog.h"
58 #include <rpc/svc_soc.h> /* svc_getcaller routine definition */
59 -static struct pmaplist *find_service_pmap __P((rpcprog_t, rpcvers_t,
60 - rpcprot_t));
61 -static bool_t pmapproc_change __P((struct svc_req *, SVCXPRT *, u_long));
62 -static bool_t pmapproc_getport __P((struct svc_req *, SVCXPRT *));
63 -static bool_t pmapproc_dump __P((struct svc_req *, SVCXPRT *));
64 +static struct pmaplist *find_service_pmap(rpcprog_t, rpcvers_t,
65 + rpcprot_t);
66 +static bool_t pmapproc_change(struct svc_req *, SVCXPRT *, u_long);
67 +static bool_t pmapproc_getport(struct svc_req *, SVCXPRT *);
68 +static bool_t pmapproc_dump(struct svc_req *, SVCXPRT *);
71 * Called for all the version 2 inquiries.
72 diff --git a/src/rpcb_svc.c b/src/rpcb_svc.c
73 index bd92201..709e3fb 100644
74 --- a/src/rpcb_svc.c
75 +++ b/src/rpcb_svc.c
76 @@ -53,10 +53,10 @@
77 #include "rpcbind.h"
78 #include "xlog.h"
80 -static void *rpcbproc_getaddr_3_local __P((void *, struct svc_req *, SVCXPRT *,
81 - rpcvers_t));
82 -static void *rpcbproc_dump_3_local __P((void *, struct svc_req *, SVCXPRT *,
83 - rpcvers_t));
84 +static void *rpcbproc_getaddr_3_local(void *, struct svc_req *, SVCXPRT *,
85 + rpcvers_t);
86 +static void *rpcbproc_dump_3_local(void *, struct svc_req *, SVCXPRT *,
87 + rpcvers_t);
90 * Called by svc_getreqset. There is a separate server handle for
91 @@ -75,7 +75,7 @@ rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp)
92 } argument;
93 char *result;
94 xdrproc_t xdr_argument, xdr_result;
95 - void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
96 + void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
97 rpcprog_t setprog = 0;
99 rpcbs_procinfo(RPCBVERS_3_STAT, rqstp->rq_proc);
100 diff --git a/src/rpcb_svc_4.c b/src/rpcb_svc_4.c
101 index b673452..5094879 100644
102 --- a/src/rpcb_svc_4.c
103 +++ b/src/rpcb_svc_4.c
104 @@ -54,13 +54,11 @@
105 #include "rpcbind.h"
106 #include "xlog.h"
108 -static void *rpcbproc_getaddr_4_local __P((void *, struct svc_req *, SVCXPRT *,
109 - rpcvers_t));
110 -static void *rpcbproc_getversaddr_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
111 -static void *rpcbproc_getaddrlist_4_local
112 - __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
113 -static void free_rpcb_entry_list __P((rpcb_entry_list_ptr *));
114 -static void *rpcbproc_dump_4_local __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
115 +static void *rpcbproc_getaddr_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
116 +static void *rpcbproc_getversaddr_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
117 +static void *rpcbproc_getaddrlist_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
118 +static void free_rpcb_entry_list(rpcb_entry_list_ptr *);
119 +static void *rpcbproc_dump_4_local(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
122 * Called by svc_getreqset. There is a separate server handle for
123 @@ -78,7 +76,7 @@ rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp)
124 } argument;
125 char *result;
126 xdrproc_t xdr_argument, xdr_result;
127 - void *(*local) __P((void *, struct svc_req *, SVCXPRT *, rpcvers_t));
128 + void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
129 rpcprog_t setprog = 0;
131 rpcbs_procinfo(RPCBVERS_4_STAT, rqstp->rq_proc);
132 diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
133 index 148fe42..5862c26 100644
134 --- a/src/rpcb_svc_com.c
135 +++ b/src/rpcb_svc_com.c
136 @@ -100,29 +100,29 @@ struct finfo {
137 static struct finfo FINFO[NFORWARD];
140 -static bool_t xdr_encap_parms __P((XDR *, struct encap_parms *));
141 -static bool_t xdr_rmtcall_args __P((XDR *, struct r_rmtcall_args *));
142 -static bool_t xdr_rmtcall_result __P((XDR *, struct r_rmtcall_args *));
143 -static bool_t xdr_opaque_parms __P((XDR *, struct r_rmtcall_args *));
144 -static int find_rmtcallfd_by_netid __P((char *));
145 -static SVCXPRT *find_rmtcallxprt_by_fd __P((int));
146 -static int forward_register __P((u_int32_t, struct netbuf *, int, char *,
147 - rpcproc_t, rpcvers_t, u_int32_t *));
148 -static struct finfo *forward_find __P((u_int32_t));
149 -static int free_slot_by_xid __P((u_int32_t));
150 -static int free_slot_by_index __P((int));
151 -static int netbufcmp __P((struct netbuf *, struct netbuf *));
152 -static struct netbuf *netbufdup __P((struct netbuf *));
153 -static void netbuffree __P((struct netbuf *));
154 -static int check_rmtcalls __P((struct pollfd *, int));
155 -static void xprt_set_caller __P((SVCXPRT *, struct finfo *));
156 -static void send_svcsyserr __P((SVCXPRT *, struct finfo *));
157 -static void handle_reply __P((int, SVCXPRT *));
158 -static void find_versions __P((rpcprog_t, char *, rpcvers_t *, rpcvers_t *));
159 -static rpcblist_ptr find_service __P((rpcprog_t, rpcvers_t, char *));
160 -static char *getowner __P((SVCXPRT *, char *, size_t));
161 -static int add_pmaplist __P((RPCB *));
162 -static int del_pmaplist __P((RPCB *));
163 +static bool_t xdr_encap_parms(XDR *, struct encap_parms *);
164 +static bool_t xdr_rmtcall_args(XDR *, struct r_rmtcall_args *);
165 +static bool_t xdr_rmtcall_result(XDR *, struct r_rmtcall_args *);
166 +static bool_t xdr_opaque_parms(XDR *, struct r_rmtcall_args *);
167 +static int find_rmtcallfd_by_netid(char *);
168 +static SVCXPRT *find_rmtcallxprt_by_fd(int);
169 +static int forward_register(u_int32_t, struct netbuf *, int, char *,
170 + rpcproc_t, rpcvers_t, u_int32_t *);
171 +static struct finfo *forward_find(u_int32_t);
172 +static int free_slot_by_xid(u_int32_t);
173 +static int free_slot_by_index(int);
174 +static int netbufcmp(struct netbuf *, struct netbuf *);
175 +static struct netbuf *netbufdup(struct netbuf *);
176 +static void netbuffree(struct netbuf *);
177 +static int check_rmtcalls(struct pollfd *, int);
178 +static void xprt_set_caller(SVCXPRT *, struct finfo *);
179 +static void send_svcsyserr(SVCXPRT *, struct finfo *);
180 +static void handle_reply(int, SVCXPRT *);
181 +static void find_versions(rpcprog_t, char *, rpcvers_t *, rpcvers_t *);
182 +static rpcblist_ptr find_service(rpcprog_t, rpcvers_t, char *);
183 +static char *getowner(SVCXPRT *, char *, size_t);
184 +static int add_pmaplist(RPCB *);
185 +static int del_pmaplist(RPCB *);
188 * Set a mapping of program, version, netid
189 diff --git a/src/rpcbind.c b/src/rpcbind.c
190 index c4265cd..87ccdc2 100644
191 --- a/src/rpcbind.c
192 +++ b/src/rpcbind.c
193 @@ -136,13 +136,13 @@ char *tcp_uaddr; /* Universal TCP address */
194 static char servname[] = "rpcbind";
195 static char superuser[] = "superuser";
197 -int main __P((int, char *[]));
198 +int main(int, char *[]);
200 -static int init_transport __P((struct netconfig *));
201 -static void rbllist_add __P((rpcprog_t, rpcvers_t, struct netconfig *,
202 - struct netbuf *));
203 -static void terminate __P((int));
204 -static void parseargs __P((int, char *[]));
205 +static int init_transport(struct netconfig *);
206 +static void rbllist_add(rpcprog_t, rpcvers_t, struct netconfig *,
207 + struct netbuf *);
208 +static void terminate(int);
209 +static void parseargs(int, char *[]);
212 main(int argc, char *argv[])
213 diff --git a/src/util.c b/src/util.c
214 index a6c835b..74b0284 100644
215 --- a/src/util.c
216 +++ b/src/util.c
217 @@ -70,7 +70,7 @@ static struct sockaddr_in *local_in4;
218 static struct sockaddr_in6 *local_in6;
219 #endif
221 -static int bitmaskcmp __P((void *, void *, void *, int));
222 +static int bitmaskcmp(void *, void *, void *, int);
225 * For all bits set in "mask", compare the corresponding bits in
226 diff --git a/src/warmstart.c b/src/warmstart.c
227 index b6eb73e..122a058 100644
228 --- a/src/warmstart.c
229 +++ b/src/warmstart.c
230 @@ -58,8 +58,8 @@
231 #define PMAPFILE RPCBIND_STATEDIR "/portmap.xdr"
232 #endif
234 -static bool_t write_struct __P((char *, xdrproc_t, void *));
235 -static bool_t read_struct __P((char *, xdrproc_t, void *));
236 +static bool_t write_struct(char *, xdrproc_t, void *);
237 +static bool_t read_struct(char *, xdrproc_t, void *);
239 static bool_t
240 write_struct(char *filename, xdrproc_t structproc, void *list)
242 2.7.4