xref: /titanic_44/usr/src/lib/libnsl/rpc/rpc_mt.h (revision 06e1a7147edd272b7296f208141627a5b1191731)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  *	Contains the mt libraries include definitions
29  */
30 
31 #ifndef	_RPC_MT_H
32 #define	_RPC_MT_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/types.h>
37 #include <rpc/rpc.h>
38 #include <netconfig.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 #define	RPC_MINFD	3
94 
95 #define	RPC_RAISEFD(fd)		if (fd < RPC_MINFD) \
96 					fd = __rpc_raise_fd(fd)
97 
98 extern int	__getpublickey_cached(char *, char *, int *);
99 extern void	__getpublickey_flush(const char *);
100 extern int	__can_use_af(sa_family_t);
101 extern int	__rpc_raise_fd(int);
102 extern void	__rpc_set_mac_options(int, const struct netconfig *,
103 	rpcprog_t);
104 extern void	__tli_sys_strerror(char *, size_t, int, int);
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* !_RPC_MT_H */
111