Sun Nov 8 02:46:53 2015 UTC ()
Only do the compat cruft if we are compiling libc.


(christos)
diff -r1.13 -r1.14 src/lib/libc/rpc/rpc_commondata.c
diff -r1.10 -r1.11 src/lib/libc/rpc/svc_fdset.c
diff -r1.3 -r1.4 src/lib/libc/rpc/svc_fdset.h

cvs diff -r1.13 -r1.14 src/lib/libc/rpc/rpc_commondata.c (expand / switch to unified diff)

--- src/lib/libc/rpc/rpc_commondata.c 2015/11/07 14:21:32 1.13
+++ src/lib/libc/rpc/rpc_commondata.c 2015/11/08 02:46:53 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rpc_commondata.c,v 1.13 2015/11/07 14:21:32 christos Exp $ */ 1/* $NetBSD: rpc_commondata.c,v 1.14 2015/11/08 02:46:53 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2010, Oracle America, Inc. 4 * Copyright (c) 2010, Oracle America, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above 12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following 13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials 14 * disclaimer in the documentation and/or other materials
@@ -26,33 +26,35 @@ @@ -26,33 +26,35 @@
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35#if defined(LIBC_SCCS) && !defined(lint) 35#if defined(LIBC_SCCS) && !defined(lint)
36#if 0 36#if 0
37static char *sccsid = "@(#)rpc_commondata.c 2.1 88/07/29 4.0 RPCSRC"; 37static char *sccsid = "@(#)rpc_commondata.c 2.1 88/07/29 4.0 RPCSRC";
38#else 38#else
39__RCSID("$NetBSD: rpc_commondata.c,v 1.13 2015/11/07 14:21:32 christos Exp $"); 39__RCSID("$NetBSD: rpc_commondata.c,v 1.14 2015/11/08 02:46:53 christos Exp $");
40#endif 40#endif
41#endif 41#endif
42 42
43#include <rpc/rpc.h> 43#include <rpc/rpc.h>
44#include "svc_fdset.h" 44#include "svc_fdset.h"
45 45
46/* 46/*
47 * This file should only contain common data (global data) that is exported 47 * This file should only contain common data (global data) that is exported
48 * by public interfaces  48 * by public interfaces
49 */ 49 */
50struct opaque_auth _null_auth; 50struct opaque_auth _null_auth;
 51#ifdef _LIBC
51#undef svc_fdset 52#undef svc_fdset
52__fd_set_256 svc_fdset; 53__fd_set_256 svc_fdset;
53#undef svc_maxfd 54#undef svc_maxfd
54int svc_maxfd = -1; 55int svc_maxfd = -1;
 56#endif
55#ifndef _REENTRANT 57#ifndef _REENTRANT
56#undef rpc_createerr 58#undef rpc_createerr
57struct rpc_createerr rpc_createerr; 59struct rpc_createerr rpc_createerr;
58#endif 60#endif

cvs diff -r1.10 -r1.11 src/lib/libc/rpc/svc_fdset.c (expand / switch to unified diff)

--- src/lib/libc/rpc/svc_fdset.c 2015/11/07 23:17:09 1.10
+++ src/lib/libc/rpc/svc_fdset.c 2015/11/08 02:46:53 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: svc_fdset.c,v 1.10 2015/11/07 23:17:09 christos Exp $ */ 1/* $NetBSD: svc_fdset.c,v 1.11 2015/11/08 02:46:53 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 The NetBSD Foundation, Inc. 4 * Copyright (c) 2015 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,50 +20,52 @@ @@ -20,50 +20,52 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__RCSID("$NetBSD: svc_fdset.c,v 1.10 2015/11/07 23:17:09 christos Exp $"); 33__RCSID("$NetBSD: svc_fdset.c,v 1.11 2015/11/08 02:46:53 christos Exp $");
34 34
35 35
36#include "reentrant.h" 36#include "reentrant.h"
37 37
38#include <sys/fd_set.h> 38#include <sys/fd_set.h>
39 39
40#include <rpc/rpc.h> 40#include <rpc/rpc.h>
41 41
42#ifdef FDSET_DEBUG 42#ifdef FDSET_DEBUG
43#include <stdio.h> 43#include <stdio.h>
44#include <stdarg.h> 44#include <stdarg.h>
45#include <unistd.h> 45#include <unistd.h>
46#include <lwp.h> 46#include <lwp.h>
47#endif 47#endif
48#include <stdlib.h> 48#include <stdlib.h>
49#include <string.h> 49#include <string.h>
50#include <poll.h> 50#include <poll.h>
51 51
52#include "svc_fdset.h" 52#include "svc_fdset.h"
53 53
54#undef svc_fdset 54#undef svc_fdset
55#undef svc_maxfd 55#undef svc_maxfd
 56#ifdef _LIBC
56extern __fd_set_256 svc_fdset; 57extern __fd_set_256 svc_fdset;
 58#endif
57extern int svc_maxfd; 59extern int svc_maxfd;
58int __svc_flags; 60int __svc_flags;
59 61
60struct svc_fdset { 62struct svc_fdset {
61 /* select */ 63 /* select */
62 fd_set *fdset; 64 fd_set *fdset;
63 int fdmax; 65 int fdmax;
64 int fdsize; 66 int fdsize;
65 /* poll */ 67 /* poll */
66 struct pollfd *fdp; 68 struct pollfd *fdp;
67 int fdnum; 69 int fdnum;
68 int fdused; 70 int fdused;
69}; 71};
@@ -122,31 +124,33 @@ svc_print(const char *func, size_t line, @@ -122,31 +124,33 @@ svc_print(const char *func, size_t line,
122#else 124#else
123 125
124#define DPRINTF(...) 126#define DPRINTF(...)
125#define DPRINTF_FDSET(...) 127#define DPRINTF_FDSET(...)
126 128
127#endif 129#endif
128 130
129 131
130static inline void 132static inline void
131svc_fdset_sanitize(struct svc_fdset *fds) 133svc_fdset_sanitize(struct svc_fdset *fds)
132{ 134{
133 while (fds->fdmax >= 0 && !FD_ISSET(fds->fdmax, fds->fdset)) 135 while (fds->fdmax >= 0 && !FD_ISSET(fds->fdmax, fds->fdset))
134 fds->fdmax--; 136 fds->fdmax--;
 137#ifdef _LIBC
135 /* Compat update */ 138 /* Compat update */
136 if (fds == &__svc_fdset) { 139 if (fds == &__svc_fdset) {
137 svc_fdset = *(__fd_set_256 *)__svc_fdset.fdset; 140 svc_fdset = *(__fd_set_256 *)__svc_fdset.fdset;
138 svc_maxfd = __svc_fdset.fdmax; 141 svc_maxfd = __svc_fdset.fdmax;
139 } 142 }
 143#endif
140} 144}
141 145
142static void 146static void
143svc_fdset_free(void *v) 147svc_fdset_free(void *v)
144{ 148{
145 struct svc_fdset *fds = v; 149 struct svc_fdset *fds = v;
146 DPRINTF_FDSET(fds, "free"); 150 DPRINTF_FDSET(fds, "free");
147 151
148 free(fds->fdp); 152 free(fds->fdp);
149 free(fds->fdset); 153 free(fds->fdset);
150 free(fds); 154 free(fds);
151} 155}
152 156

cvs diff -r1.3 -r1.4 src/lib/libc/rpc/svc_fdset.h (expand / switch to unified diff)

--- src/lib/libc/rpc/svc_fdset.h 2015/11/07 00:42:04 1.3
+++ src/lib/libc/rpc/svc_fdset.h 2015/11/08 02:46:53 1.4
@@ -1,22 +1,24 @@ @@ -1,22 +1,24 @@
1/* $NetBSD: svc_fdset.h,v 1.3 2015/11/07 00:42:04 christos Exp $ */ 1/* $NetBSD: svc_fdset.h,v 1.4 2015/11/08 02:46:53 christos Exp $ */
2 2
3# ifdef RUMP_RPC 3# ifdef RUMP_RPC
4# include <rump/rump.h> 4# include <rump/rump.h>
5# include <rump/rump_syscalls.h> 5# include <rump/rump_syscalls.h>
6# undef close 6# undef close
7# define close(a) rump_sys_close(a) 7# define close(a) rump_sys_close(a)
8# undef fcntl 8# undef fcntl
9# define fcntl(a, b, c) rump_sys_fcntl(a, b, c) 9# define fcntl(a, b, c) rump_sys_fcntl(a, b, c)
10# undef read 10# undef read
11# define read(a, b, c) rump_sys_read(a, b, c) 11# define read(a, b, c) rump_sys_read(a, b, c)
12# undef write 12# undef write
13# define write(a, b, c) rump_sys_write(a, b, c) 13# define write(a, b, c) rump_sys_write(a, b, c)
14# undef pollts 14# undef pollts
15# define pollts(a, b, c, d) rump_sys_pollts(a, b, c, d) 15# define pollts(a, b, c, d) rump_sys_pollts(a, b, c, d)
16# undef select 16# undef select
17# define select(a, b, c, d, e) rump_sys_select(a, b, c, d, e) 17# define select(a, b, c, d, e) rump_sys_select(a, b, c, d, e)
18# endif 18# endif
19 19
 20#ifdef _LIBC
20typedef struct __fd_set_256 { 21typedef struct __fd_set_256 {
21 __fd_mask fds_bits[__NFD_LEN(256)]; 22 __fd_mask fds_bits[__NFD_LEN(256)];
22} __fd_set_256; 23} __fd_set_256;
 24#endif