1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate 
6*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
7*7c478bd9Sstevel@tonic-gate 
8*7c478bd9Sstevel@tonic-gate #ifdef SUNW_OPTIONS
9*7c478bd9Sstevel@tonic-gate #include "conf/sunoptions.h"
10*7c478bd9Sstevel@tonic-gate #endif
11*7c478bd9Sstevel@tonic-gate 
12*7c478bd9Sstevel@tonic-gate #define __EXTENSIONS__
13*7c478bd9Sstevel@tonic-gate /* #define SVR4 */
14*7c478bd9Sstevel@tonic-gate #ifdef	WANT_IRS_NIS
15*7c478bd9Sstevel@tonic-gate #undef	WANT_IRS_NIS
16*7c478bd9Sstevel@tonic-gate #endif
17*7c478bd9Sstevel@tonic-gate #undef WANT_IRS_PW
18*7c478bd9Sstevel@tonic-gate #undef WANT_IRS_GR
19*7c478bd9Sstevel@tonic-gate #define SIG_FN void
20*7c478bd9Sstevel@tonic-gate #define ISC_SOCKLEN_T int
21*7c478bd9Sstevel@tonic-gate #include "os_version.h"
22*7c478bd9Sstevel@tonic-gate #if (OS_MAJOR == 5 && OS_MINOR < 5)
23*7c478bd9Sstevel@tonic-gate #undef HAS_PTHREADS
24*7c478bd9Sstevel@tonic-gate #else
25*7c478bd9Sstevel@tonic-gate #define HAS_PTHREADS
26*7c478bd9Sstevel@tonic-gate #endif
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate #if defined(HAS_PTHREADS) && defined(_REENTRANT)
29*7c478bd9Sstevel@tonic-gate #define DO_PTHREADS
30*7c478bd9Sstevel@tonic-gate #endif
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #define GROUP_R_RETURN struct group *
33*7c478bd9Sstevel@tonic-gate #define GROUP_R_SET_RETURN void
34*7c478bd9Sstevel@tonic-gate #undef GROUP_R_SET_RESULT /*empty*/
35*7c478bd9Sstevel@tonic-gate #define GROUP_R_END_RETURN void
36*7c478bd9Sstevel@tonic-gate #undef GROUP_R_END_RESULT  /*empty*/
37*7c478bd9Sstevel@tonic-gate #define GROUP_R_ARGS char *buf, int buflen
38*7c478bd9Sstevel@tonic-gate #undef GROUP_R_ENT_ARGS /*empty*/
39*7c478bd9Sstevel@tonic-gate #define GROUP_R_OK gptr
40*7c478bd9Sstevel@tonic-gate #define GROUP_R_BAD NULL
41*7c478bd9Sstevel@tonic-gate #define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, \
42*7c478bd9Sstevel@tonic-gate 		      int *ngroups
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate #define HOST_R_RETURN struct hostent *
45*7c478bd9Sstevel@tonic-gate #define HOST_R_SET_RETURN void
46*7c478bd9Sstevel@tonic-gate #undef HOST_R_SET_RESULT /*empty*/
47*7c478bd9Sstevel@tonic-gate #define HOST_R_END_RETURN void
48*7c478bd9Sstevel@tonic-gate #define HOST_R_END_RESULT(x)	/*empty*/
49*7c478bd9Sstevel@tonic-gate #define HOST_R_ARGS char *buf, int buflen, int *h_errnop
50*7c478bd9Sstevel@tonic-gate #undef HOST_R_ENT_ARGS /*empty*/
51*7c478bd9Sstevel@tonic-gate #define HOST_R_COPY buf, buflen
52*7c478bd9Sstevel@tonic-gate #define HOST_R_COPY_ARGS char *buf, int buflen
53*7c478bd9Sstevel@tonic-gate #define HOST_R_ERRNO *h_errnop = h_errno
54*7c478bd9Sstevel@tonic-gate #define HOST_R_OK hptr
55*7c478bd9Sstevel@tonic-gate #define HOST_R_BAD NULL
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate #define NET_R_RETURN struct netent *
58*7c478bd9Sstevel@tonic-gate #define NET_R_SET_RETURN void
59*7c478bd9Sstevel@tonic-gate #undef NET_R_SET_RESULT /*empty*/
60*7c478bd9Sstevel@tonic-gate #define NET_R_END_RETURN void
61*7c478bd9Sstevel@tonic-gate #define NET_R_END_RESULT(x)  /*empty*/
62*7c478bd9Sstevel@tonic-gate #define NET_R_ARGS char *buf, int buflen
63*7c478bd9Sstevel@tonic-gate #undef NET_R_ENT_ARGS /*empty*/
64*7c478bd9Sstevel@tonic-gate #define NET_R_COPY buf, buflen
65*7c478bd9Sstevel@tonic-gate #define NET_R_COPY_ARGS NET_R_ARGS
66*7c478bd9Sstevel@tonic-gate #define NET_R_OK nptr
67*7c478bd9Sstevel@tonic-gate #define NET_R_BAD NULL
68*7c478bd9Sstevel@tonic-gate 
69*7c478bd9Sstevel@tonic-gate #define NGR_R_RETURN int
70*7c478bd9Sstevel@tonic-gate #define NGR_R_SET_RETURN void
71*7c478bd9Sstevel@tonic-gate #undef NGR_R_SET_RESULT /*empty*/
72*7c478bd9Sstevel@tonic-gate #define NGR_R_END_RETURN void
73*7c478bd9Sstevel@tonic-gate #ifdef	ORIGINAL_ISC_CODE
74*7c478bd9Sstevel@tonic-gate #undef NGR_R_END_RESULT  /*empty*/
75*7c478bd9Sstevel@tonic-gate #else
76*7c478bd9Sstevel@tonic-gate #define NGR_R_END_RESULT(x)  /*empty*/
77*7c478bd9Sstevel@tonic-gate #endif
78*7c478bd9Sstevel@tonic-gate #define NGR_R_ARGS char *buf, int buflen
79*7c478bd9Sstevel@tonic-gate #undef NGR_R_ENT_ARGS /*empty*/
80*7c478bd9Sstevel@tonic-gate #define NGR_R_COPY buf, buflen
81*7c478bd9Sstevel@tonic-gate #define NGR_R_COPY_ARGS NGR_R_ARGS
82*7c478bd9Sstevel@tonic-gate #define NGR_R_OK 1
83*7c478bd9Sstevel@tonic-gate #define NGR_R_BAD (0)
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate #define PROTO_R_RETURN struct protoent *
86*7c478bd9Sstevel@tonic-gate #define PROTO_R_SET_RETURN void
87*7c478bd9Sstevel@tonic-gate #undef PROTO_R_SET_RESULT /*empty*/
88*7c478bd9Sstevel@tonic-gate #define PROTO_R_END_RETURN void
89*7c478bd9Sstevel@tonic-gate #define PROTO_R_END_RESULT(x)  /*empty*/
90*7c478bd9Sstevel@tonic-gate #define PROTO_R_ARGS char *buf, int buflen
91*7c478bd9Sstevel@tonic-gate #undef PROTO_R_ENT_ARGS /*empty*/
92*7c478bd9Sstevel@tonic-gate #define PROTO_R_COPY buf, buflen
93*7c478bd9Sstevel@tonic-gate #define PROTO_R_COPY_ARGS PROTO_R_ARGS
94*7c478bd9Sstevel@tonic-gate #define PROTO_R_OK pptr
95*7c478bd9Sstevel@tonic-gate #define PROTO_R_BAD NULL
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate #define PASS_R_RETURN struct passwd *
98*7c478bd9Sstevel@tonic-gate #define PASS_R_SET_RETURN void
99*7c478bd9Sstevel@tonic-gate #undef PASS_R_SET_RESULT /*empty*/
100*7c478bd9Sstevel@tonic-gate #define PASS_R_END_RETURN void
101*7c478bd9Sstevel@tonic-gate #undef PASS_R_END_RESULT  /*empty*/
102*7c478bd9Sstevel@tonic-gate #define PASS_R_ARGS char *buf, int buflen
103*7c478bd9Sstevel@tonic-gate #undef PASS_R_ENT_ARGS /*empty*/
104*7c478bd9Sstevel@tonic-gate #define PASS_R_COPY buf, buflen
105*7c478bd9Sstevel@tonic-gate #define PASS_R_COPY_ARGS PASS_R_ARGS
106*7c478bd9Sstevel@tonic-gate #define PASS_R_OK pwptr
107*7c478bd9Sstevel@tonic-gate #define PASS_R_BAD NULL
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate #define SERV_R_RETURN struct servent *
110*7c478bd9Sstevel@tonic-gate #define SERV_R_SET_RETURN void
111*7c478bd9Sstevel@tonic-gate #undef SERV_R_SET_RESULT /*empty*/
112*7c478bd9Sstevel@tonic-gate #define SERV_R_END_RETURN void
113*7c478bd9Sstevel@tonic-gate #define SERV_R_END_RESULT(x)  /*empty*/
114*7c478bd9Sstevel@tonic-gate #define SERV_R_ARGS char *buf, int buflen
115*7c478bd9Sstevel@tonic-gate #undef SERV_R_ENT_ARGS /*empty*/
116*7c478bd9Sstevel@tonic-gate #define SERV_R_COPY buf, buflen
117*7c478bd9Sstevel@tonic-gate #define SERV_R_COPY_ARGS SERV_R_ARGS
118*7c478bd9Sstevel@tonic-gate #define SERV_R_OK sptr
119*7c478bd9Sstevel@tonic-gate #define SERV_R_BAD NULL
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate /* make #include <sys/ioctl.h> also #include <sys/sockio.h> */
122*7c478bd9Sstevel@tonic-gate #define BSD_COMP
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate #include <limits.h>	/* _POSIX_PATH_MAX */
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate #ifdef __GNUC__
127*7c478bd9Sstevel@tonic-gate #define ISC_FORMAT_PRINTF(fmt, args) \
128*7c478bd9Sstevel@tonic-gate 	__attribute__((__format__(__printf__, fmt, args)))
129*7c478bd9Sstevel@tonic-gate #else
130*7c478bd9Sstevel@tonic-gate #define ISC_FORMAT_PRINTF(fmt, args)
131*7c478bd9Sstevel@tonic-gate #endif
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate /*
134*7c478bd9Sstevel@tonic-gate  * Several files in the ISC distribution use an ALIGN macro which doesn't
135*7c478bd9Sstevel@tonic-gate  * appear to be defined anywhere. From the context, it's intended to round
136*7c478bd9Sstevel@tonic-gate  * up its argument to the nearest suitable boundary. We'll guess that eight
137*7c478bd9Sstevel@tonic-gate  * byte alignment is sufficient.
138*7c478bd9Sstevel@tonic-gate  */
139*7c478bd9Sstevel@tonic-gate #define	ALIGN(p)	(uint64_t)(((uintptr_t)(p) + (sizeof (uint64_t) - 1)) \
140*7c478bd9Sstevel@tonic-gate 			& ~(sizeof (uint64_t) - 1))
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate #ifdef SUNW_SYNONYMS
143*7c478bd9Sstevel@tonic-gate #include "synonyms.h"
144*7c478bd9Sstevel@tonic-gate #endif
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate /*
147*7c478bd9Sstevel@tonic-gate  * Remove compiler warnings without modifying ISC source by including
148*7c478bd9Sstevel@tonic-gate  * various headers here, mostly to get function prototypes.
149*7c478bd9Sstevel@tonic-gate  */
150*7c478bd9Sstevel@tonic-gate #include <string.h>
151*7c478bd9Sstevel@tonic-gate #include <strings.h>
152*7c478bd9Sstevel@tonic-gate #include <unistd.h>
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
155*7c478bd9Sstevel@tonic-gate #include "sys/bitypes.h"
156*7c478bd9Sstevel@tonic-gate #include "sys/cdefs.h"
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate #define	HAS_INET6_STRUCTS
159*7c478bd9Sstevel@tonic-gate #define	H_ERRNO_IS_FUNCTION
160