xref: /illumos-gate/usr/src/lib/libresolv2/include/port_before.h (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 
7 /*
8  * Copyright (C) 2005-2008  Internet Systems Consortium, Inc. ("ISC")
9  * Copyright (C) 2001  Internet Software Consortium.
10  *
11  * Permission to use, copy, modify, and/or distribute this software for any
12  * purpose with or without fee is hereby granted, provided that the above
13  * copyright notice and this permission notice appear in all copies.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
16  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
18  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
20  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21  * PERFORMANCE OF THIS SOFTWARE.
22  */
23 
24 /* $Id: port_before.h.in,v 1.31 2008/02/28 05:36:10 marka Exp $ */
25 
26 #ifndef port_before_h
27 #define port_before_h
28 /* Solaris-specific changes */
29 #include "sunw_port_before.h"
30 #include <config.h>
31 
32 #ifdef NEED_SUN4PROTOS
33 #define _PARAMS(x) x
34 #endif
35 
36 struct group;           /* silence warning */
37 struct passwd;          /* silence warning */
38 struct timeval;         /* silence warning */
39 struct timezone;        /* silence warning */
40 
41 #ifdef HAVE_SYS_TIMERS_H
42 #include <sys/timers.h>
43 #endif
44 #include <limits.h>
45 
46 #ifdef ISC_PLATFORM_NEEDTIMESPEC
47 #include <time.h>		/* For time_t */
48 struct timespec {
49 	time_t  tv_sec;         /* seconds */
50 	long    tv_nsec;        /* nanoseconds */
51 };
52 #endif
53 #ifndef HAVE_MEMMOVE
54 #define memmove(a,b,c) bcopy(b,a,c)
55 #endif
56 
57 #undef WANT_IRS_GR
58 #undef WANT_IRS_NIS
59 #undef WANT_IRS_PW
60 
61 #define BSD_COMP 1
62 #define USE_POLL 1
63 #define HAVE_MD5 1
64 #define SOLARIS2 1
65 
66 /* DO_PTHREADS is conditionally defined in sunw_port_before.h
67  * #define DO_PTHREADS 1 */
68 #define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups
69 #define GETNETBYADDR_ADDR_T long
70 #define SETPWENT_VOID 1
71 #define SETGRENT_VOID 1
72 
73 #define NET_R_ARGS char *buf, int buflen
74 #define NET_R_BAD NULL
75 #define NET_R_COPY buf, buflen
76 #define NET_R_COPY_ARGS NET_R_ARGS
77 #define NET_R_END_RESULT(x) /*empty*/
78 #define NET_R_END_RETURN void
79 #undef NET_R_ENT_ARGS /*empty*/
80 #define NET_R_OK nptr
81 #define NET_R_RETURN struct netent *
82 #undef NET_R_SET_RESULT /*empty*/
83 #undef NET_R_SETANSWER
84 #define NET_R_SET_RETURN void
85 #undef NETENT_DATA
86 
87 #define GROUP_R_RETURN struct group *
88 #define GROUP_R_SET_RETURN void
89 #undef GROUP_R_SET_RESULT /*empty*/
90 #define GROUP_R_END_RETURN void
91 #define GROUP_R_END_RESULT(x) /*empty*/
92 #define GROUP_R_ARGS char *buf, int buflen
93 #define GROUP_R_ENT_ARGS void
94 #define GROUP_R_OK gptr
95 #define GROUP_R_BAD NULL
96 
97 #define HOST_R_ARGS char *buf, int buflen, int *h_errnop
98 #define HOST_R_BAD NULL
99 #define HOST_R_COPY buf, buflen
100 #define HOST_R_COPY_ARGS char *buf, int buflen
101 #define HOST_R_END_RESULT(x) /*empty*/
102 #define HOST_R_END_RETURN void
103 #undef HOST_R_ENT_ARGS /*empty*/
104 #define HOST_R_ERRNO *h_errnop = h_errno
105 #define HOST_R_OK hptr
106 #define HOST_R_RETURN struct hostent *
107 #undef HOST_R_SETANSWER
108 #undef HOST_R_SET_RESULT
109 #define HOST_R_SET_RETURN void
110 #undef HOSTENT_DATA
111 
112 #define NGR_R_ARGS char *buf, int buflen
113 #define NGR_R_BAD (0)
114 #define NGR_R_COPY buf, buflen
115 #define NGR_R_COPY_ARGS NGR_R_ARGS
116 #define NGR_R_CONST
117 #define NGR_R_END_RESULT(x)  /*empty*/
118 #define NGR_R_END_RETURN void
119 #undef NGR_R_END_ARGS /*empty*/
120 #define NGR_R_OK 1
121 #define NGR_R_RETURN int
122 #define NGR_R_SET_CONST const
123 #undef NGR_R_SET_RESULT /*empty*/
124 #define NGR_R_SET_RETURN void
125 #undef NGR_R_SET_ARGS
126 
127 
128 #if !defined(NGR_R_SET_ARGS) && defined(NGR_R_END_ARGS)
129 #define NGR_R_SET_ARGS NGR_R_END_ARGS
130 #endif
131 
132 #define PROTO_R_ARGS char *buf, int buflen
133 #define PROTO_R_BAD NULL
134 #define PROTO_R_COPY buf, buflen
135 #define PROTO_R_COPY_ARGS PROTO_R_ARGS
136 #define PROTO_R_END_RESULT(x) /*empty*/
137 #define PROTO_R_END_RETURN void
138 #undef PROTO_R_ENT_ARGS /*empty*/
139 #undef PROTO_R_ENT_UNUSED
140 #define PROTO_R_OK pptr
141 #undef PROTO_R_SETANSWER
142 #define PROTO_R_RETURN struct protoent *
143 #undef PROTO_R_SET_RESULT
144 #define PROTO_R_SET_RETURN void
145 #undef PROTOENT_DATA
146 
147 #define PASS_R_ARGS char *buf, int buflen
148 #define PASS_R_BAD NULL
149 #define PASS_R_COPY buf, buflen
150 #define PASS_R_COPY_ARGS PASS_R_ARGS
151 #define PASS_R_END_RESULT(x) /*empty*/
152 #define PASS_R_END_RETURN void
153 #undef PASS_R_ENT_ARGS
154 #define PASS_R_OK pwptr
155 #define PASS_R_RETURN struct passwd *
156 #undef PASS_R_SET_RESULT /*empty*/
157 #define PASS_R_SET_RETURN void
158 
159 #define SERV_R_ARGS char *buf, int buflen
160 #define SERV_R_BAD NULL
161 #define SERV_R_COPY buf, buflen
162 #define SERV_R_COPY_ARGS SERV_R_ARGS
163 #define SERV_R_END_RESULT(x) /*empty*/
164 #define SERV_R_END_RETURN void
165 #undef SERV_R_ENT_ARGS /*empty*/
166 #undef SERV_R_ENT_UNUSED /*empty*/
167 #define SERV_R_OK sptr
168 #undef SERV_R_SETANSWER
169 #define SERV_R_RETURN struct servent *
170 #undef SERV_R_SET_RESULT
171 #define SERV_R_SET_RETURN void
172 
173 
174 
175 #define DE_CONST(konst, var) \
176 	do { \
177 		union { const void *k; void *v; } _u; \
178 		_u.k = konst; \
179 		var = _u.v; \
180 	} while (0)
181 
182 #define UNUSED(x) (x) = (x)
183 
184 #undef NEED_SOLARIS_BITTYPES
185 #define ISC_SOCKLEN_T int
186 
187 #ifdef __GNUC__
188 #define ISC_FORMAT_PRINTF(fmt, args) \
189 	__attribute__((__format__(__printf__, fmt, args)))
190 #else
191 #define ISC_FORMAT_PRINTF(fmt, args)
192 #endif
193 
194 /* Pull in host order macros when _XOPEN_SOURCE_EXTENDED is defined. */
195 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
196 #include <sys/byteorder.h>
197 #endif
198 
199 #endif
200 
201 /*! \file */
202