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 #include <sys/types.h> 35 #include <rpc/rpc.h> 36 #include <netconfig.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /* 43 * declaration to private interfaces in rpc library 44 */ 45 46 extern int svc_npollfds; 47 extern int svc_npollfds_set; 48 extern int svc_pollfd_allocd; 49 extern rwlock_t svc_fd_lock; 50 51 /* 52 * macros to handle pollfd array; ***** Note that the macro takes 53 * address of the array ( &array[0] ) always not the address of an 54 * element *****. 55 */ 56 57 #define MASKVAL (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND) 58 #define POLLFD_EXTEND 64 59 #define POLLFD_SHRINK (2 * POLLFD_EXTEND) 60 #define POLLFD_SET(x, y) { \ 61 (y)[(x)].fd = (x); \ 62 (y)[(x)].events = MASKVAL; \ 63 } 64 #define POLLFD_CLR(x, y) { \ 65 (y)[(x)].fd = -1; \ 66 (y)[(x)].events = 0; \ 67 (y)[(x)].revents = 0; \ 68 } 69 #define POLLFD_ISSET(x, y) ((y)[(x)].fd >= 0) 70 71 72 extern int __rpc_use_pollfd_done; 73 extern int __rpc_rlim_max(void); 74 75 /* Following functions create and manipulates the dgfd lock object */ 76 77 extern void *rpc_fd_init(void); 78 extern int rpc_fd_lock(const void *handle, int fd); 79 extern void rpc_fd_unlock(const void *handle, int fd); 80 81 #define RPC_FD_NOTIN_FDSET(x) (!__rpc_use_pollfd_done && (x) >= FD_SETSIZE) 82 #define FD_INCREMENT FD_SETSIZE 83 84 /* 85 * External functions without prototypes. This is somewhat crufty, but 86 * there is no other header file for this directory. One should probably 87 * be created and this stuff moved there if there turns out to be no better 88 * way to avoid the warnings. 89 */ 90 91 #define RPC_MINFD 3 92 93 #define RPC_RAISEFD(fd) if (fd < RPC_MINFD) \ 94 fd = __rpc_raise_fd(fd) 95 96 extern int __getpublickey_cached(char *, char *, int *); 97 extern void __getpublickey_flush(const char *); 98 extern int __can_use_af(sa_family_t); 99 extern int __rpc_raise_fd(int); 100 extern void __rpc_set_mac_options(int, const struct netconfig *, 101 rpcprog_t); 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