xref: /titanic_52/usr/src/lib/libnsl/rpc/rpc_mt.h (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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  * Copyright 1986-2003 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 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * declaration to private interfaces in rpc library
45  */
46 
47 extern int svc_npollfds;
48 extern int svc_npollfds_set;
49 extern int svc_pollfd_allocd;
50 extern rwlock_t svc_fd_lock;
51 
52 /*
53  * macros to handle pollfd array; ***** Note that the macro takes
54  * address of the array ( &array[0] ) always not the address of an
55  * element *****.
56  */
57 
58 #define	MASKVAL	(POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)
59 #define	POLLFD_EXTEND		64
60 #define	POLLFD_SHRINK		(2 * POLLFD_EXTEND)
61 #define	POLLFD_SET(x, y)	{ \
62 					(y)[(x)].fd = (x); \
63 					(y)[(x)].events = MASKVAL; \
64 				}
65 #define	POLLFD_CLR(x, y)	{ \
66 					(y)[(x)].fd = -1; \
67 					(y)[(x)].events = 0; \
68 					(y)[(x)].revents = 0; \
69 				}
70 #define	POLLFD_ISSET(x, y)	((y)[(x)].fd >= 0)
71 
72 
73 extern int __rpc_use_pollfd_done;
74 extern int __rpc_rlim_max(void);
75 
76 /* Following functions create and manipulates the dgfd lock object */
77 
78 extern void *rpc_fd_init(void);
79 extern int rpc_fd_lock(const void *handle, int fd);
80 extern void rpc_fd_unlock(const void *handle, int fd);
81 
82 #define	RPC_FD_NOTIN_FDSET(x)	(!__rpc_use_pollfd_done && (x) >= FD_SETSIZE)
83 #define	FD_INCREMENT FD_SETSIZE
84 
85 /*
86  * External functions without prototypes.  This is somewhat crufty, but
87  * there is no other header file for this directory.  One should probably
88  * be created and this stuff moved there if there turns out to be no better
89  * way to avoid the warnings.
90  */
91 
92 struct stat;
93 
94 extern unsigned	_sleep(unsigned);
95 extern int	_fstat(int, struct stat *);
96 extern int	_stat(const char *, struct stat *);
97 extern int	_fcntl(int, int, ...);
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	__tli_sys_strerror(char *, size_t, int, int);
103 
104 #ifdef	__cplusplus
105 }
106 #endif
107 
108 #endif	/* !_RPC_MT_H */
109