17c478bd9Sstevel@tonic-gate /*
2*9525b14bSRao Shoaib  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate 
7*9525b14bSRao Shoaib /*
8*9525b14bSRao Shoaib  * Copyright (C) 2005-2008  Internet Systems Consortium, Inc. ("ISC")
9*9525b14bSRao Shoaib  * Copyright (C) 2001  Internet Software Consortium.
10*9525b14bSRao Shoaib  *
11*9525b14bSRao Shoaib  * Permission to use, copy, modify, and/or distribute this software for any
12*9525b14bSRao Shoaib  * purpose with or without fee is hereby granted, provided that the above
13*9525b14bSRao Shoaib  * copyright notice and this permission notice appear in all copies.
14*9525b14bSRao Shoaib  *
15*9525b14bSRao Shoaib  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
16*9525b14bSRao Shoaib  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17*9525b14bSRao Shoaib  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
18*9525b14bSRao Shoaib  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19*9525b14bSRao Shoaib  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
20*9525b14bSRao Shoaib  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21*9525b14bSRao Shoaib  * PERFORMANCE OF THIS SOFTWARE.
22*9525b14bSRao Shoaib  */
23*9525b14bSRao Shoaib 
24*9525b14bSRao Shoaib /* $Id: port_before.h.in,v 1.31 2008/02/28 05:36:10 marka Exp $ */
25*9525b14bSRao Shoaib 
26*9525b14bSRao Shoaib #ifndef port_before_h
27*9525b14bSRao Shoaib #define port_before_h
28*9525b14bSRao Shoaib /* Solaris-specific changes */
29*9525b14bSRao Shoaib #include "sunw_port_before.h"
30*9525b14bSRao Shoaib #include <config.h>
31*9525b14bSRao Shoaib 
32*9525b14bSRao Shoaib #ifdef NEED_SUN4PROTOS
33*9525b14bSRao Shoaib #define _PARAMS(x) x
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
36*9525b14bSRao Shoaib struct group;           /* silence warning */
37*9525b14bSRao Shoaib struct passwd;          /* silence warning */
38*9525b14bSRao Shoaib struct timeval;         /* silence warning */
39*9525b14bSRao Shoaib struct timezone;        /* silence warning */
40*9525b14bSRao Shoaib 
41*9525b14bSRao Shoaib #ifdef HAVE_SYS_TIMERS_H
42*9525b14bSRao Shoaib #include <sys/timers.h>
437c478bd9Sstevel@tonic-gate #endif
44*9525b14bSRao Shoaib #include <limits.h>
45*9525b14bSRao Shoaib 
46*9525b14bSRao Shoaib #ifdef ISC_PLATFORM_NEEDTIMESPEC
47*9525b14bSRao Shoaib #include <time.h>		/* For time_t */
48*9525b14bSRao Shoaib struct timespec {
49*9525b14bSRao Shoaib 	time_t  tv_sec;         /* seconds */
50*9525b14bSRao Shoaib 	long    tv_nsec;        /* nanoseconds */
51*9525b14bSRao Shoaib };
527c478bd9Sstevel@tonic-gate #endif
53*9525b14bSRao Shoaib #ifndef HAVE_MEMMOVE
54*9525b14bSRao Shoaib #define memmove(a,b,c) bcopy(b,a,c)
557c478bd9Sstevel@tonic-gate #endif
567c478bd9Sstevel@tonic-gate 
57*9525b14bSRao Shoaib #undef WANT_IRS_GR
58*9525b14bSRao Shoaib #undef WANT_IRS_NIS
59*9525b14bSRao Shoaib #undef WANT_IRS_PW
60*9525b14bSRao Shoaib 
61*9525b14bSRao Shoaib #define BSD_COMP 1
62*9525b14bSRao Shoaib #define USE_POLL 1
63*9525b14bSRao Shoaib #define HAVE_MD5 1
64*9525b14bSRao Shoaib #define SOLARIS2 1
65*9525b14bSRao Shoaib 
66*9525b14bSRao Shoaib /* DO_PTHREADS is conditionally defined in sunw_port_before.h
67*9525b14bSRao Shoaib  * #define DO_PTHREADS 1 */
68*9525b14bSRao Shoaib #define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups
69*9525b14bSRao Shoaib #define GETNETBYADDR_ADDR_T long
70*9525b14bSRao Shoaib #define SETPWENT_VOID 1
71*9525b14bSRao Shoaib #define SETGRENT_VOID 1
72*9525b14bSRao Shoaib 
73*9525b14bSRao Shoaib #define NET_R_ARGS char *buf, int buflen
74*9525b14bSRao Shoaib #define NET_R_BAD NULL
75*9525b14bSRao Shoaib #define NET_R_COPY buf, buflen
76*9525b14bSRao Shoaib #define NET_R_COPY_ARGS NET_R_ARGS
77*9525b14bSRao Shoaib #define NET_R_END_RESULT(x) /*empty*/
78*9525b14bSRao Shoaib #define NET_R_END_RETURN void
79*9525b14bSRao Shoaib #undef NET_R_ENT_ARGS /*empty*/
80*9525b14bSRao Shoaib #define NET_R_OK nptr
81*9525b14bSRao Shoaib #define NET_R_RETURN struct netent *
82*9525b14bSRao Shoaib #undef NET_R_SET_RESULT /*empty*/
83*9525b14bSRao Shoaib #undef NET_R_SETANSWER
84*9525b14bSRao Shoaib #define NET_R_SET_RETURN void
85*9525b14bSRao Shoaib #undef NETENT_DATA
86*9525b14bSRao Shoaib 
877c478bd9Sstevel@tonic-gate #define GROUP_R_RETURN struct group *
887c478bd9Sstevel@tonic-gate #define GROUP_R_SET_RETURN void
897c478bd9Sstevel@tonic-gate #undef GROUP_R_SET_RESULT /*empty*/
907c478bd9Sstevel@tonic-gate #define GROUP_R_END_RETURN void
91*9525b14bSRao Shoaib #define GROUP_R_END_RESULT(x) /*empty*/
927c478bd9Sstevel@tonic-gate #define GROUP_R_ARGS char *buf, int buflen
93*9525b14bSRao Shoaib #define GROUP_R_ENT_ARGS void
947c478bd9Sstevel@tonic-gate #define GROUP_R_OK gptr
957c478bd9Sstevel@tonic-gate #define GROUP_R_BAD NULL
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate #define HOST_R_ARGS char *buf, int buflen, int *h_errnop
98*9525b14bSRao Shoaib #define HOST_R_BAD NULL
997c478bd9Sstevel@tonic-gate #define HOST_R_COPY buf, buflen
1007c478bd9Sstevel@tonic-gate #define HOST_R_COPY_ARGS char *buf, int buflen
101*9525b14bSRao Shoaib #define HOST_R_END_RESULT(x) /*empty*/
102*9525b14bSRao Shoaib #define HOST_R_END_RETURN void
103*9525b14bSRao Shoaib #undef HOST_R_ENT_ARGS /*empty*/
1047c478bd9Sstevel@tonic-gate #define HOST_R_ERRNO *h_errnop = h_errno
1057c478bd9Sstevel@tonic-gate #define HOST_R_OK hptr
106*9525b14bSRao Shoaib #define HOST_R_RETURN struct hostent *
107*9525b14bSRao Shoaib #undef HOST_R_SETANSWER
108*9525b14bSRao Shoaib #undef HOST_R_SET_RESULT
109*9525b14bSRao Shoaib #define HOST_R_SET_RETURN void
110*9525b14bSRao Shoaib #undef HOSTENT_DATA
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate #define NGR_R_ARGS char *buf, int buflen
113*9525b14bSRao Shoaib #define NGR_R_BAD (0)
1147c478bd9Sstevel@tonic-gate #define NGR_R_COPY buf, buflen
1157c478bd9Sstevel@tonic-gate #define NGR_R_COPY_ARGS NGR_R_ARGS
116*9525b14bSRao Shoaib #define NGR_R_CONST
117*9525b14bSRao Shoaib #define NGR_R_END_RESULT(x)  /*empty*/
118*9525b14bSRao Shoaib #define NGR_R_END_RETURN void
119*9525b14bSRao Shoaib #undef NGR_R_END_ARGS /*empty*/
1207c478bd9Sstevel@tonic-gate #define NGR_R_OK 1
121*9525b14bSRao Shoaib #define NGR_R_RETURN int
122*9525b14bSRao Shoaib #define NGR_R_SET_CONST const
123*9525b14bSRao Shoaib #undef NGR_R_SET_RESULT /*empty*/
124*9525b14bSRao Shoaib #define NGR_R_SET_RETURN void
125*9525b14bSRao Shoaib #undef NGR_R_SET_ARGS
126*9525b14bSRao Shoaib 
127*9525b14bSRao Shoaib 
128*9525b14bSRao Shoaib #if !defined(NGR_R_SET_ARGS) && defined(NGR_R_END_ARGS)
129*9525b14bSRao Shoaib #define NGR_R_SET_ARGS NGR_R_END_ARGS
130*9525b14bSRao Shoaib #endif
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate #define PROTO_R_ARGS char *buf, int buflen
133*9525b14bSRao Shoaib #define PROTO_R_BAD NULL
1347c478bd9Sstevel@tonic-gate #define PROTO_R_COPY buf, buflen
1357c478bd9Sstevel@tonic-gate #define PROTO_R_COPY_ARGS PROTO_R_ARGS
136*9525b14bSRao Shoaib #define PROTO_R_END_RESULT(x) /*empty*/
137*9525b14bSRao Shoaib #define PROTO_R_END_RETURN void
138*9525b14bSRao Shoaib #undef PROTO_R_ENT_ARGS /*empty*/
139*9525b14bSRao Shoaib #undef PROTO_R_ENT_UNUSED
1407c478bd9Sstevel@tonic-gate #define PROTO_R_OK pptr
141*9525b14bSRao Shoaib #undef PROTO_R_SETANSWER
142*9525b14bSRao Shoaib #define PROTO_R_RETURN struct protoent *
143*9525b14bSRao Shoaib #undef PROTO_R_SET_RESULT
144*9525b14bSRao Shoaib #define PROTO_R_SET_RETURN void
145*9525b14bSRao Shoaib #undef PROTOENT_DATA
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate #define PASS_R_ARGS char *buf, int buflen
148*9525b14bSRao Shoaib #define PASS_R_BAD NULL
1497c478bd9Sstevel@tonic-gate #define PASS_R_COPY buf, buflen
1507c478bd9Sstevel@tonic-gate #define PASS_R_COPY_ARGS PASS_R_ARGS
151*9525b14bSRao Shoaib #define PASS_R_END_RESULT(x) /*empty*/
152*9525b14bSRao Shoaib #define PASS_R_END_RETURN void
153*9525b14bSRao Shoaib #undef PASS_R_ENT_ARGS
1547c478bd9Sstevel@tonic-gate #define PASS_R_OK pwptr
155*9525b14bSRao Shoaib #define PASS_R_RETURN struct passwd *
156*9525b14bSRao Shoaib #undef PASS_R_SET_RESULT /*empty*/
157*9525b14bSRao Shoaib #define PASS_R_SET_RETURN void
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate #define SERV_R_ARGS char *buf, int buflen
160*9525b14bSRao Shoaib #define SERV_R_BAD NULL
1617c478bd9Sstevel@tonic-gate #define SERV_R_COPY buf, buflen
1627c478bd9Sstevel@tonic-gate #define SERV_R_COPY_ARGS SERV_R_ARGS
163*9525b14bSRao Shoaib #define SERV_R_END_RESULT(x) /*empty*/
164*9525b14bSRao Shoaib #define SERV_R_END_RETURN void
165*9525b14bSRao Shoaib #undef SERV_R_ENT_ARGS /*empty*/
166*9525b14bSRao Shoaib #undef SERV_R_ENT_UNUSED /*empty*/
1677c478bd9Sstevel@tonic-gate #define SERV_R_OK sptr
168*9525b14bSRao Shoaib #undef SERV_R_SETANSWER
169*9525b14bSRao Shoaib #define SERV_R_RETURN struct servent *
170*9525b14bSRao Shoaib #undef SERV_R_SET_RESULT
171*9525b14bSRao Shoaib #define SERV_R_SET_RETURN void
172*9525b14bSRao Shoaib 
173*9525b14bSRao Shoaib 
1747c478bd9Sstevel@tonic-gate 
175*9525b14bSRao Shoaib #define DE_CONST(konst, var) \
176*9525b14bSRao Shoaib 	do { \
177*9525b14bSRao Shoaib 		union { const void *k; void *v; } _u; \
178*9525b14bSRao Shoaib 		_u.k = konst; \
179*9525b14bSRao Shoaib 		var = _u.v; \
180*9525b14bSRao Shoaib 	} while (0)
1817c478bd9Sstevel@tonic-gate 
182*9525b14bSRao Shoaib #define UNUSED(x) (x) = (x)
183*9525b14bSRao Shoaib 
184*9525b14bSRao Shoaib #undef NEED_SOLARIS_BITTYPES
185*9525b14bSRao Shoaib #define ISC_SOCKLEN_T int
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate #ifdef __GNUC__
1887c478bd9Sstevel@tonic-gate #define ISC_FORMAT_PRINTF(fmt, args) \
1897c478bd9Sstevel@tonic-gate 	__attribute__((__format__(__printf__, fmt, args)))
1907c478bd9Sstevel@tonic-gate #else
1917c478bd9Sstevel@tonic-gate #define ISC_FORMAT_PRINTF(fmt, args)
1927c478bd9Sstevel@tonic-gate #endif
1937c478bd9Sstevel@tonic-gate 
194*9525b14bSRao Shoaib /* Pull in host order macros when _XOPEN_SOURCE_EXTENDED is defined. */
195*9525b14bSRao Shoaib #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
196*9525b14bSRao Shoaib #include <sys/byteorder.h>
197*9525b14bSRao Shoaib #endif
1987c478bd9Sstevel@tonic-gate 
199*9525b14bSRao Shoaib #endif
2007c478bd9Sstevel@tonic-gate 
201*9525b14bSRao Shoaib /*! \file */
202