xref: /titanic_52/usr/src/lib/libnsl/rpc/rpc_mt.h (revision fb3fb4f3d76d55b64440afd0af72775dfad3bd1d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 /*
29  *	Contains the mt libraries include definitions
30  */
31 
32 #ifndef	_RPC_MT_H
33 #define	_RPC_MT_H
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 #include <sys/types.h>
38 #include <rpc/rpc.h>
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * declaration to private interfaces in rpc library
46  */
47 
48 extern int svc_npollfds;
49 extern int svc_npollfds_set;
50 extern int svc_pollfd_allocd;
51 extern rwlock_t svc_fd_lock;
52 
53 /*
54  * macros to handle pollfd array; ***** Note that the macro takes
55  * address of the array ( &array[0] ) always not the address of an
56  * element *****.
57  */
58 
59 #define	MASKVAL	(POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)
60 #define	POLLFD_EXTEND		64
61 #define	POLLFD_SHRINK		(2 * POLLFD_EXTEND)
62 #define	POLLFD_SET(x, y)	{ \
63 					(y)[(x)].fd = (x); \
64 					(y)[(x)].events = MASKVAL; \
65 				}
66 #define	POLLFD_CLR(x, y)	{ \
67 					(y)[(x)].fd = -1; \
68 					(y)[(x)].events = 0; \
69 					(y)[(x)].revents = 0; \
70 				}
71 #define	POLLFD_ISSET(x, y)	((y)[(x)].fd >= 0)
72 
73 
74 extern int __rpc_use_pollfd_done;
75 extern int __rpc_rlim_max(void);
76 
77 /* Following functions create and manipulates the dgfd lock object */
78 
79 extern void *rpc_fd_init(void);
80 extern int rpc_fd_lock(const void *handle, int fd);
81 extern void rpc_fd_unlock(const void *handle, int fd);
82 
83 #define	RPC_FD_NOTIN_FDSET(x)	(!__rpc_use_pollfd_done && (x) >= FD_SETSIZE)
84 #define	FD_INCREMENT FD_SETSIZE
85 
86 /*
87  * External functions without prototypes.  This is somewhat crufty, but
88  * there is no other header file for this directory.  One should probably
89  * be created and this stuff moved there if there turns out to be no better
90  * way to avoid the warnings.
91  */
92 
93 extern int	__getpublickey_cached(char *, char *, int *);
94 extern void	__getpublickey_flush(const char *);
95 extern int	__can_use_af(sa_family_t);
96 extern int	__rpc_raise_fd(int);
97 extern void	__tli_sys_strerror(char *, size_t, int, int);
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif	/* !_RPC_MT_H */
104