17c478bd9Sstevel@tonic-gate /*
2*23a1cceaSRoger A. Faulkner  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
37c478bd9Sstevel@tonic-gate  */
47c478bd9Sstevel@tonic-gate 
59525b14bSRao Shoaib /*
69525b14bSRao Shoaib  * Copyright (C) 2004-2008  Internet Systems Consortium, Inc. ("ISC")
79525b14bSRao Shoaib  * Copyright (C) 2001-2003  Internet Software Consortium.
89525b14bSRao Shoaib  *
99525b14bSRao Shoaib  * Permission to use, copy, modify, and/or distribute this software for any
109525b14bSRao Shoaib  * purpose with or without fee is hereby granted, provided that the above
119525b14bSRao Shoaib  * copyright notice and this permission notice appear in all copies.
129525b14bSRao Shoaib  *
139525b14bSRao Shoaib  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
149525b14bSRao Shoaib  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
159525b14bSRao Shoaib  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
169525b14bSRao Shoaib  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
179525b14bSRao Shoaib  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
189525b14bSRao Shoaib  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
199525b14bSRao Shoaib  * PERFORMANCE OF THIS SOFTWARE.
209525b14bSRao Shoaib  */
217c478bd9Sstevel@tonic-gate 
229525b14bSRao Shoaib /* $Id: port_after.h.in,v 1.60 2008/02/28 05:34:17 marka Exp $ */
239525b14bSRao Shoaib 
249525b14bSRao Shoaib #ifndef port_after_h
259525b14bSRao Shoaib #define port_after_h
267c478bd9Sstevel@tonic-gate 
279525b14bSRao Shoaib #include <stdio.h>
287c478bd9Sstevel@tonic-gate #include <sys/types.h>
297c478bd9Sstevel@tonic-gate #include <sys/socket.h>
307c478bd9Sstevel@tonic-gate #include <sys/param.h>
319525b14bSRao Shoaib #include <sys/time.h>
327c478bd9Sstevel@tonic-gate #if (!defined(BSD)) || (BSD < 199306)
337c478bd9Sstevel@tonic-gate #include <sys/bitypes.h>
347c478bd9Sstevel@tonic-gate #endif
359525b14bSRao Shoaib #ifdef HAVE_INTTYPES_H
369525b14bSRao Shoaib #include <inttypes.h>
379525b14bSRao Shoaib #endif
389525b14bSRao Shoaib #ifdef HAVE_SYS_SELECT_H
399525b14bSRao Shoaib #include <sys/select.h>
409525b14bSRao Shoaib #endif /* HAVE_SYS_SELECT_H */
417c478bd9Sstevel@tonic-gate 
429525b14bSRao Shoaib #ifdef REENABLE_SEND
439525b14bSRao Shoaib #undef send
447c478bd9Sstevel@tonic-gate #endif
459525b14bSRao Shoaib 
469525b14bSRao Shoaib #undef NEED_PSELECT
479525b14bSRao Shoaib #undef HAVE_SA_LEN
489525b14bSRao Shoaib #undef HAVE_MINIMUM_IFREQ
499525b14bSRao Shoaib #undef NEED_STRSEP
509525b14bSRao Shoaib #undef NEED_STRERROR
519525b14bSRao Shoaib #ifdef NEED_STRERROR
529525b14bSRao Shoaib const char *isc_strerror(int);
539525b14bSRao Shoaib #define strerror isc_strerror
549525b14bSRao Shoaib #endif
559525b14bSRao Shoaib /* HAS_INET6_STRUCTS and HAVE_SIN6_SCOPE_ID are defined by port_ipv6.h
569525b14bSRao Shoaib  * #define HAS_INET6_STRUCTS 1
579525b14bSRao Shoaib  * #define HAVE_SIN6_SCOPE_ID 1
589525b14bSRao Shoaib  */
599525b14bSRao Shoaib #include <port_ipv6.h>
609525b14bSRao Shoaib 
619525b14bSRao Shoaib #undef NEED_IN6ADDR_ANY
629525b14bSRao Shoaib #undef HAS_IN_ADDR6
639525b14bSRao Shoaib #define HAVE_SOCKADDR_STORAGE 1
649525b14bSRao Shoaib #undef NEED_GETTIMEOFDAY
65*23a1cceaSRoger A. Faulkner #define HAVE_STRNDUP
669525b14bSRao Shoaib #undef USE_FIONBIO_IOCTL
679525b14bSRao Shoaib #undef INNETGR_ARGS
689525b14bSRao Shoaib 
699525b14bSRao Shoaib #undef USE_IFNAMELINKID
709525b14bSRao Shoaib #define PORT_NONBLOCK O_NONBLOCK
719525b14bSRao Shoaib 
729525b14bSRao Shoaib #ifndef _POSIX_PATH_MAX
739525b14bSRao Shoaib #define _POSIX_PATH_MAX 255
749525b14bSRao Shoaib #endif
759525b14bSRao Shoaib #ifndef PATH_MAX
769525b14bSRao Shoaib #define PATH_MAX _POSIX_PATH_MAX
777c478bd9Sstevel@tonic-gate #endif
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * We need to know the IPv6 address family number even on IPv4-only systems.
817c478bd9Sstevel@tonic-gate  * Note that this is NOT a protocol constant, and that if the system has its
827c478bd9Sstevel@tonic-gate  * own AF_INET6, different from ours below, all of BIND's libraries and
837c478bd9Sstevel@tonic-gate  * executables will need to be recompiled after the system <sys/socket.h>
847c478bd9Sstevel@tonic-gate  * has had this type added.  The type number below is correct on most BSD-
857c478bd9Sstevel@tonic-gate  * derived systems for which AF_INET6 is defined.
867c478bd9Sstevel@tonic-gate  */
877c478bd9Sstevel@tonic-gate #ifndef AF_INET6
889525b14bSRao Shoaib #define AF_INET6        24
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
919525b14bSRao Shoaib #ifndef PF_INET6
929525b14bSRao Shoaib #define PF_INET6        AF_INET6
939525b14bSRao Shoaib #endif
949525b14bSRao Shoaib 
959525b14bSRao Shoaib #ifdef HAS_IN_ADDR6
969525b14bSRao Shoaib /* Map to pre-RFC structure. */
979525b14bSRao Shoaib #define in6_addr in_addr6
987c478bd9Sstevel@tonic-gate #endif
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate #ifndef HAS_INET6_STRUCTS
1017c478bd9Sstevel@tonic-gate /* Replace with structure from later rev of O/S if known. */
1027c478bd9Sstevel@tonic-gate struct in6_addr {
1039525b14bSRao Shoaib 	u_int8_t        s6_addr[16];
1047c478bd9Sstevel@tonic-gate };
1057c478bd9Sstevel@tonic-gate 
1069525b14bSRao Shoaib #define IN6ADDR_ANY_INIT \
1079525b14bSRao Shoaib 	{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
1089525b14bSRao Shoaib 	   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
1099525b14bSRao Shoaib 
1109525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT \
1119525b14bSRao Shoaib 	{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
1129525b14bSRao Shoaib 	   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
1139525b14bSRao Shoaib 
1147c478bd9Sstevel@tonic-gate /* Replace with structure from later rev of O/S if known. */
1157c478bd9Sstevel@tonic-gate struct sockaddr_in6 {
1169525b14bSRao Shoaib #ifdef  HAVE_SA_LEN
1179525b14bSRao Shoaib 	u_int8_t        sin6_len;       /* length of this struct */
1189525b14bSRao Shoaib 	u_int8_t        sin6_family;    /* AF_INET6 */
1197c478bd9Sstevel@tonic-gate #else
1209525b14bSRao Shoaib 	u_int16_t       sin6_family;    /* AF_INET6 */
1217c478bd9Sstevel@tonic-gate #endif
1229525b14bSRao Shoaib 	u_int16_t       sin6_port;      /* transport layer port # */
1239525b14bSRao Shoaib 	u_int32_t       sin6_flowinfo;  /* IPv6 flow information */
1249525b14bSRao Shoaib 	struct in6_addr sin6_addr;      /* IPv6 address */
1259525b14bSRao Shoaib 	u_int32_t       sin6_scope_id;  /* set of interfaces for a scope */
1267c478bd9Sstevel@tonic-gate };
1279525b14bSRao Shoaib #endif  /* HAS_INET6_STRUCTS */
1289525b14bSRao Shoaib 
1299525b14bSRao Shoaib #ifdef BROKEN_IN6ADDR_INIT_MACROS
1309525b14bSRao Shoaib #undef IN6ADDR_ANY_INIT
1319525b14bSRao Shoaib #undef IN6ADDR_LOOPBACK_INIT
1329525b14bSRao Shoaib #endif
1337c478bd9Sstevel@tonic-gate 
1349525b14bSRao Shoaib #ifdef _AIX
1357c478bd9Sstevel@tonic-gate #ifndef IN6ADDR_ANY_INIT
1369525b14bSRao Shoaib #define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0 }}}
1377c478bd9Sstevel@tonic-gate #endif
1387c478bd9Sstevel@tonic-gate #ifndef IN6ADDR_LOOPBACK_INIT
1399525b14bSRao Shoaib #if BYTE_ORDER == BIG_ENDIAN
1409525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 1 }}}
1419525b14bSRao Shoaib #else
1429525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT {{{0, 0, 0, 0x01000000}}}
1439525b14bSRao Shoaib #endif
1449525b14bSRao Shoaib #endif
1457c478bd9Sstevel@tonic-gate #endif
1467c478bd9Sstevel@tonic-gate 
1479525b14bSRao Shoaib #ifndef IN6ADDR_ANY_INIT
1489525b14bSRao Shoaib #ifdef s6_addr
1499525b14bSRao Shoaib #define IN6ADDR_ANY_INIT \
1509525b14bSRao Shoaib 	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
1519525b14bSRao Shoaib 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
1529525b14bSRao Shoaib #else
1539525b14bSRao Shoaib #define IN6ADDR_ANY_INIT \
1549525b14bSRao Shoaib 	{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
1559525b14bSRao Shoaib 	   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
1569525b14bSRao Shoaib #endif
1579525b14bSRao Shoaib 
1589525b14bSRao Shoaib #endif
1599525b14bSRao Shoaib #ifndef IN6ADDR_LOOPBACK_INIT
1609525b14bSRao Shoaib #ifdef s6_addr
1619525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT \
1629525b14bSRao Shoaib 	{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
1639525b14bSRao Shoaib 	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
1649525b14bSRao Shoaib #else
1659525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT \
1669525b14bSRao Shoaib 	{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
1679525b14bSRao Shoaib 	   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
1689525b14bSRao Shoaib #endif
1699525b14bSRao Shoaib #endif
1709525b14bSRao Shoaib 
1719525b14bSRao Shoaib #ifndef HAVE_SOCKADDR_STORAGE
1729525b14bSRao Shoaib #define __SS_MAXSIZE 128
1739525b14bSRao Shoaib #define __SS_ALLIGSIZE (sizeof (long))
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate struct sockaddr_storage {
1767c478bd9Sstevel@tonic-gate #ifdef  HAVE_SA_LEN
1779525b14bSRao Shoaib 	u_int8_t        ss_len;       /* address length */
1789525b14bSRao Shoaib 	u_int8_t        ss_family;    /* address family */
1799525b14bSRao Shoaib 	char            __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof(u_int8_t)];
1809525b14bSRao Shoaib 	long            __ss_align;
1819525b14bSRao Shoaib 	char            __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
1827c478bd9Sstevel@tonic-gate #else
1839525b14bSRao Shoaib 	u_int16_t       ss_family;    /* address family */
1849525b14bSRao Shoaib 	char            __ss_pad1[__SS_ALLIGSIZE - sizeof(u_int16_t)];
1859525b14bSRao Shoaib 	long            __ss_align;
1869525b14bSRao Shoaib 	char            __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
1877c478bd9Sstevel@tonic-gate #endif
1887c478bd9Sstevel@tonic-gate };
1897c478bd9Sstevel@tonic-gate #endif
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate #if !defined(HAS_INET6_STRUCTS) || defined(NEED_IN6ADDR_ANY)
1939525b14bSRao Shoaib #define in6addr_any isc_in6addr_any
1947c478bd9Sstevel@tonic-gate extern const struct in6_addr in6addr_any;
1957c478bd9Sstevel@tonic-gate #endif
1967c478bd9Sstevel@tonic-gate 
1979525b14bSRao Shoaib /*
1989525b14bSRao Shoaib  * IN6_ARE_ADDR_EQUAL, IN6_IS_ADDR_UNSPECIFIED, IN6_IS_ADDR_V4COMPAT and
1999525b14bSRao Shoaib  * IN6_IS_ADDR_V4MAPPED are broken in glibc 2.1.
2009525b14bSRao Shoaib  */
2019525b14bSRao Shoaib #ifdef __GLIBC__
2029525b14bSRao Shoaib #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
2039525b14bSRao Shoaib #undef IN6_ARE_ADDR_EQUAL
2049525b14bSRao Shoaib #undef IN6_IS_ADDR_UNSPECIFIED
2059525b14bSRao Shoaib #undef IN6_IS_ADDR_V4COMPAT
2069525b14bSRao Shoaib #undef IN6_IS_ADDR_V4MAPPED
2079525b14bSRao Shoaib #endif
2089525b14bSRao Shoaib #endif
2099525b14bSRao Shoaib 
2107c478bd9Sstevel@tonic-gate #ifndef IN6_ARE_ADDR_EQUAL
2119525b14bSRao Shoaib #define IN6_ARE_ADDR_EQUAL(a,b) \
2129525b14bSRao Shoaib    (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
2137c478bd9Sstevel@tonic-gate #endif
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_UNSPECIFIED
2169525b14bSRao Shoaib #define IN6_IS_ADDR_UNSPECIFIED(a)      \
2177c478bd9Sstevel@tonic-gate 	IN6_ARE_ADDR_EQUAL(a, &in6addr_any)
2187c478bd9Sstevel@tonic-gate #endif
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_LOOPBACK
2217c478bd9Sstevel@tonic-gate extern const struct in6_addr isc_in6addr_loopback;
2229525b14bSRao Shoaib #define IN6_IS_ADDR_LOOPBACK(a) \
2237c478bd9Sstevel@tonic-gate 	IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback)
2247c478bd9Sstevel@tonic-gate #endif
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_V4MAPPED
2279525b14bSRao Shoaib #define IN6_IS_ADDR_V4MAPPED(a)	\
2287c478bd9Sstevel@tonic-gate 	((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \
2297c478bd9Sstevel@tonic-gate 	(a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \
2307c478bd9Sstevel@tonic-gate 	(a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \
2319525b14bSRao Shoaib 	(a)->s6_addr[6] == 0x00 && (a)->s6_addr[9] == 0x00 && \
2327c478bd9Sstevel@tonic-gate 	(a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \
2337c478bd9Sstevel@tonic-gate 	(a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff)
2347c478bd9Sstevel@tonic-gate #endif
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_SITELOCAL
2379525b14bSRao Shoaib #define IN6_IS_ADDR_SITELOCAL(a)        \
2387c478bd9Sstevel@tonic-gate 	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
2397c478bd9Sstevel@tonic-gate #endif
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_LINKLOCAL
2429525b14bSRao Shoaib #define IN6_IS_ADDR_LINKLOCAL(a)        \
2437c478bd9Sstevel@tonic-gate 	(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
2447c478bd9Sstevel@tonic-gate #endif
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MULTICAST
2479525b14bSRao Shoaib #define IN6_IS_ADDR_MULTICAST(a)        ((a)->s6_addr[0] == 0xff)
2487c478bd9Sstevel@tonic-gate #endif
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_MC_SCOPE
2519525b14bSRao Shoaib #define __IPV6_ADDR_MC_SCOPE(a)         ((a)->s6_addr[1] & 0x0f)
2527c478bd9Sstevel@tonic-gate #endif
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_SCOPE_SITELOCAL
2559525b14bSRao Shoaib #define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
2567c478bd9Sstevel@tonic-gate #endif
2577c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_SCOPE_ORGLOCAL
2589525b14bSRao Shoaib #define __IPV6_ADDR_SCOPE_ORGLOCAL  0x08
2597c478bd9Sstevel@tonic-gate #endif
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MC_SITELOCAL
2629525b14bSRao Shoaib #define IN6_IS_ADDR_MC_SITELOCAL(a)     \
2637c478bd9Sstevel@tonic-gate 	(IN6_IS_ADDR_MULTICAST(a) &&    \
2649525b14bSRao Shoaib 	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
2657c478bd9Sstevel@tonic-gate #endif
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MC_ORGLOCAL
2689525b14bSRao Shoaib #define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
2697c478bd9Sstevel@tonic-gate 	(IN6_IS_ADDR_MULTICAST(a) &&    \
2709525b14bSRao Shoaib 	 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
2717c478bd9Sstevel@tonic-gate #endif
2727c478bd9Sstevel@tonic-gate 
2739525b14bSRao Shoaib #ifndef INADDR_NONE
2749525b14bSRao Shoaib #define INADDR_NONE 0xffffffff
2757c478bd9Sstevel@tonic-gate #endif
2767c478bd9Sstevel@tonic-gate 
2779525b14bSRao Shoaib #ifndef MAXHOSTNAMELEN
2789525b14bSRao Shoaib #define MAXHOSTNAMELEN 256
2797c478bd9Sstevel@tonic-gate #endif
2809525b14bSRao Shoaib 
2819525b14bSRao Shoaib #ifndef INET6_ADDRSTRLEN
2829525b14bSRao Shoaib /* sizeof("aaaa:bbbb:cccc:dddd:eeee:ffff:123.123.123.123") */
2839525b14bSRao Shoaib #define INET6_ADDRSTRLEN 46
2849525b14bSRao Shoaib #endif
2859525b14bSRao Shoaib 
2869525b14bSRao Shoaib #ifndef MIN
2879525b14bSRao Shoaib #define MIN(x,y) (((x) <= (y)) ? (x) : (y))
2887c478bd9Sstevel@tonic-gate #endif
2897c478bd9Sstevel@tonic-gate 
2909525b14bSRao Shoaib #ifndef MAX
2919525b14bSRao Shoaib #define MAX(x,y) (((x) >= (y)) ? (x) : (y))
2929525b14bSRao Shoaib #endif
2937c478bd9Sstevel@tonic-gate 
2949525b14bSRao Shoaib #ifdef NEED_STRSEP
2959525b14bSRao Shoaib char * strsep(char **stringp, const char *delim);
2967c478bd9Sstevel@tonic-gate #endif
2977c478bd9Sstevel@tonic-gate 
2989525b14bSRao Shoaib #ifndef ALIGN
2999525b14bSRao Shoaib #define ALIGN(p) (((uintptr_t)(p) + (sizeof(long) - 1)) & ~(sizeof(long) - 1))
3007c478bd9Sstevel@tonic-gate #endif
3017c478bd9Sstevel@tonic-gate 
3029525b14bSRao Shoaib #ifdef NEED_SETGROUPENT
3039525b14bSRao Shoaib int setgroupent(int stayopen);
3049525b14bSRao Shoaib #endif
3057c478bd9Sstevel@tonic-gate 
3069525b14bSRao Shoaib #ifdef NEED_GETGROUPLIST
3079525b14bSRao Shoaib int getgrouplist(GETGROUPLIST_ARGS);
3087c478bd9Sstevel@tonic-gate #endif
3097c478bd9Sstevel@tonic-gate 
3109525b14bSRao Shoaib #ifdef POSIX_GETGRNAM_R
3119525b14bSRao Shoaib int
3129525b14bSRao Shoaib __posix_getgrnam_r(const char *, struct group *, char *, int, struct group **);
3137c478bd9Sstevel@tonic-gate #endif
3147c478bd9Sstevel@tonic-gate 
3159525b14bSRao Shoaib #ifdef NEED_GETGRNAM_R
3169525b14bSRao Shoaib int
3179525b14bSRao Shoaib getgrnam_r(const char *,  struct group *, char *, size_t, struct group **);
3189525b14bSRao Shoaib #endif
3197c478bd9Sstevel@tonic-gate 
3209525b14bSRao Shoaib #ifdef POSIX_GETGRGID_R
3219525b14bSRao Shoaib int
3229525b14bSRao Shoaib __posix_getgrgid_r(gid_t, struct group *, char *, int, struct group **) ;
3237c478bd9Sstevel@tonic-gate #endif
3247c478bd9Sstevel@tonic-gate 
3259525b14bSRao Shoaib #ifdef NEED_GETGRGID_R
3269525b14bSRao Shoaib int
3279525b14bSRao Shoaib getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
3289525b14bSRao Shoaib #endif
3296a1c6faaSanay 
3309525b14bSRao Shoaib #ifdef NEED_GETGRENT_R
3319525b14bSRao Shoaib GROUP_R_RETURN getgrent_r(struct group *gptr, GROUP_R_ARGS);
3329525b14bSRao Shoaib #endif
3339525b14bSRao Shoaib 
3349525b14bSRao Shoaib #ifdef NEED_SETGRENT_R
3359525b14bSRao Shoaib GROUP_R_SET_RETURN setgrent_r(GROUP_R_ENT_ARGS);
3369525b14bSRao Shoaib #endif
3379525b14bSRao Shoaib 
3389525b14bSRao Shoaib #ifdef NEED_ENDGRENT_R
3399525b14bSRao Shoaib GROUP_R_END_RETURN endgrent_r(GROUP_R_ENT_ARGS);
3409525b14bSRao Shoaib #endif
3419525b14bSRao Shoaib 
3429525b14bSRao Shoaib #if defined(NEED_INNETGR_R) && defined(NGR_R_RETURN)
3439525b14bSRao Shoaib NGR_R_RETURN
3449525b14bSRao Shoaib innetgr_r(const char *, const char *, const char *, const char *);
3459525b14bSRao Shoaib #endif
3469525b14bSRao Shoaib 
3479525b14bSRao Shoaib #ifdef NEED_SETNETGRENT_R
3489525b14bSRao Shoaib #ifdef NGR_R_SET_ARGS
3499525b14bSRao Shoaib NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS);
3509525b14bSRao Shoaib #else
3519525b14bSRao Shoaib NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup);
3529525b14bSRao Shoaib #endif
3539525b14bSRao Shoaib #endif
3549525b14bSRao Shoaib 
3559525b14bSRao Shoaib #ifdef NEED_ENDNETGRENT_R
3569525b14bSRao Shoaib #ifdef NGR_R_END_ARGS
3579525b14bSRao Shoaib NGR_R_END_RETURN endnetgrent_r(NGR_R_END_ARGS);
3586a1c6faaSanay #else
3599525b14bSRao Shoaib NGR_R_END_RETURN endnetgrent_r(void);
3606a1c6faaSanay #endif
3616a1c6faaSanay #endif
3626a1c6faaSanay 
3639525b14bSRao Shoaib #ifdef POSIX_GETPWNAM_R
3649525b14bSRao Shoaib int
3659525b14bSRao Shoaib __posix_getpwnam_r(const char *login,  struct passwd *pwptr,
3669525b14bSRao Shoaib 		char *buf, size_t buflen, struct passwd **result);
3679525b14bSRao Shoaib #endif
3689525b14bSRao Shoaib 
3699525b14bSRao Shoaib #ifdef NEED_GETPWNAM_R
3709525b14bSRao Shoaib int
3719525b14bSRao Shoaib getpwnam_r(const char *login,  struct passwd *pwptr,
3729525b14bSRao Shoaib 		char *buf, size_t buflen, struct passwd **result);
3739525b14bSRao Shoaib #endif
3749525b14bSRao Shoaib 
3759525b14bSRao Shoaib #ifdef POSIX_GETPWUID_R
3769525b14bSRao Shoaib int
3779525b14bSRao Shoaib __posix_getpwuid_r(uid_t uid, struct passwd *pwptr,
3789525b14bSRao Shoaib 		char *buf, int buflen, struct passwd **result);
3799525b14bSRao Shoaib #endif
3809525b14bSRao Shoaib 
3819525b14bSRao Shoaib #ifdef NEED_GETPWUID_R
3829525b14bSRao Shoaib int
3839525b14bSRao Shoaib getpwuid_r(uid_t uid, struct passwd *pwptr,
3849525b14bSRao Shoaib 		char *buf, size_t buflen, struct passwd **result);
3859525b14bSRao Shoaib #endif
3869525b14bSRao Shoaib 
3879525b14bSRao Shoaib #ifdef NEED_SETPWENT_R
3889525b14bSRao Shoaib #ifdef PASS_R_ENT_ARGS
3899525b14bSRao Shoaib PASS_R_SET_RETURN setpwent_r(PASS_R_ENT_ARGS);
3909525b14bSRao Shoaib #else
3919525b14bSRao Shoaib PASS_R_SET_RETURN setpwent_r(void);
3929525b14bSRao Shoaib #endif
3939525b14bSRao Shoaib 
3949525b14bSRao Shoaib #endif
3959525b14bSRao Shoaib 
3969525b14bSRao Shoaib #ifdef NEED_SETPASSENT_R
3979525b14bSRao Shoaib #ifdef PASS_R_ENT_ARGS
3989525b14bSRao Shoaib PASS_R_SET_RETURN setpassent_r(int stayopen, PASS_R_ENT_ARGS);
3999525b14bSRao Shoaib #else
4009525b14bSRao Shoaib PASS_R_SET_RETURN setpassent_r(int stayopen);
4019525b14bSRao Shoaib #endif
4029525b14bSRao Shoaib #endif
4039525b14bSRao Shoaib 
4049525b14bSRao Shoaib #ifdef NEED_GETPWENT_R
4059525b14bSRao Shoaib PASS_R_RETURN getpwent_r(struct passwd *pwptr, PASS_R_ARGS);
4069525b14bSRao Shoaib #endif
4079525b14bSRao Shoaib 
4089525b14bSRao Shoaib #ifdef NEED_ENDPWENT_R
4099525b14bSRao Shoaib void endpwent_r(void);
4109525b14bSRao Shoaib #endif
4119525b14bSRao Shoaib 
4129525b14bSRao Shoaib #ifdef NEED_SETPASSENT
4139525b14bSRao Shoaib int setpassent(int stayopen);
4149525b14bSRao Shoaib #endif
4159525b14bSRao Shoaib 
4169525b14bSRao Shoaib #define gettimeofday isc__gettimeofday
4179525b14bSRao Shoaib #ifdef NEED_GETTIMEOFDAY
4189525b14bSRao Shoaib int isc__gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp);
4199525b14bSRao Shoaib #else
4209525b14bSRao Shoaib int isc__gettimeofday(struct timeval *tp, struct timezone *tzp);
4219525b14bSRao Shoaib #endif
4229525b14bSRao Shoaib 
4239525b14bSRao Shoaib int getnetgrent(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
4249525b14bSRao Shoaib 		NGR_R_CONST char **domainp);
4259525b14bSRao Shoaib 
4269525b14bSRao Shoaib #ifdef NGR_R_ARGS
4279525b14bSRao Shoaib int getnetgrent_r(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
4289525b14bSRao Shoaib 		  NGR_R_CONST char **domainp, NGR_R_ARGS);
4299525b14bSRao Shoaib #endif
4309525b14bSRao Shoaib 
4319525b14bSRao Shoaib /* setnetgrent and endnetgrent are defined in sunw_port_after.h
4329525b14bSRao Shoaib #ifdef SETNETGRENT_ARGS
4339525b14bSRao Shoaib void setnetgrent(SETNETGRENT_ARGS);
4349525b14bSRao Shoaib #else
4359525b14bSRao Shoaib void setnetgrent(const char *netgroup);
4369525b14bSRao Shoaib #endif
4379525b14bSRao Shoaib 
4389525b14bSRao Shoaib void endnetgrent(void);
4399525b14bSRao Shoaib */
4409525b14bSRao Shoaib 
4419525b14bSRao Shoaib #ifdef INNETGR_ARGS
4429525b14bSRao Shoaib int innetgr(INNETGR_ARGS);
4439525b14bSRao Shoaib #else
4449525b14bSRao Shoaib int innetgr(const char *netgroup, const char *machine,
4459525b14bSRao Shoaib 	    const char *user, const char *domain);
4469525b14bSRao Shoaib #endif
4479525b14bSRao Shoaib 
4489525b14bSRao Shoaib #ifdef NGR_R_SET_ARGS
4499525b14bSRao Shoaib NGR_R_SET_RETURN
4509525b14bSRao Shoaib setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS);
4519525b14bSRao Shoaib #else
4529525b14bSRao Shoaib NGR_R_SET_RETURN
4539525b14bSRao Shoaib setnetgrent_r(NGR_R_SET_CONST char *netgroup);
4549525b14bSRao Shoaib #endif
4559525b14bSRao Shoaib 
4569525b14bSRao Shoaib #ifdef NEED_STRTOUL
4579525b14bSRao Shoaib unsigned long strtoul(const char *, char **, int);
4589525b14bSRao Shoaib #endif
4599525b14bSRao Shoaib 
4609525b14bSRao Shoaib #ifdef NEED_SUN4PROTOS
4619525b14bSRao Shoaib #include <stdarg.h>
4629525b14bSRao Shoaib #ifndef __SIZE_TYPE__
4639525b14bSRao Shoaib #define __SIZE_TYPE__ int
4649525b14bSRao Shoaib #endif
4659525b14bSRao Shoaib struct sockaddr;
4669525b14bSRao Shoaib struct iovec;
4679525b14bSRao Shoaib struct timeval;
4689525b14bSRao Shoaib struct timezone;
4699525b14bSRao Shoaib int fprintf(FILE *, const char *, ...);
4709525b14bSRao Shoaib int getsockname(int, struct sockaddr *, int *);
4719525b14bSRao Shoaib int getpeername(int, struct sockaddr *, int *);
4729525b14bSRao Shoaib int socket(int, int, int);
4739525b14bSRao Shoaib int connect(int, const struct sockaddr *, int);
4749525b14bSRao Shoaib int writev(int, struct iovec *, int);
4759525b14bSRao Shoaib int readv(int, struct iovec *, int);
4769525b14bSRao Shoaib int send(int, const char *, int, int);
4779525b14bSRao Shoaib void bzero(char *, int);
4789525b14bSRao Shoaib int recvfrom(int, char *, int, int, struct sockaddr *, int *);
4799525b14bSRao Shoaib int syslog(int, const char *, ... );
4809525b14bSRao Shoaib int printf(const char *, ...);
4819525b14bSRao Shoaib __SIZE_TYPE__ fread(void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
4829525b14bSRao Shoaib __SIZE_TYPE__ fwrite(const void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
4839525b14bSRao Shoaib int fclose(FILE *);
4849525b14bSRao Shoaib int ungetc(int, FILE *);
4859525b14bSRao Shoaib int scanf(const char *, ...);
4869525b14bSRao Shoaib int sscanf(const char *, const char *, ... );
4879525b14bSRao Shoaib int tolower(int);
4889525b14bSRao Shoaib int toupper(int);
4899525b14bSRao Shoaib int strcasecmp(const char *, const char *);
4909525b14bSRao Shoaib int strncasecmp(const char *, const char *, int);
4919525b14bSRao Shoaib int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
4929525b14bSRao Shoaib #ifdef gettimeofday
4939525b14bSRao Shoaib #undef gettimeofday
4949525b14bSRao Shoaib int gettimeofday(struct timeval *, struct timezone *);
4959525b14bSRao Shoaib #define gettimeofday isc__gettimeofday
4969525b14bSRao Shoaib #else
4979525b14bSRao Shoaib int gettimeofday(struct timeval *, struct timezone *);
4989525b14bSRao Shoaib #endif
4999525b14bSRao Shoaib long strtol(const char*, char **, int);
5009525b14bSRao Shoaib int fseek(FILE *, long, int);
5019525b14bSRao Shoaib int setsockopt(int, int, int, const char *, int);
5029525b14bSRao Shoaib int bind(int, const struct sockaddr *, int);
5039525b14bSRao Shoaib void bcopy(char *, char *, int);
5049525b14bSRao Shoaib int fputc(char, FILE *);
5059525b14bSRao Shoaib int listen(int, int);
5069525b14bSRao Shoaib int accept(int, struct sockaddr *, int *);
5079525b14bSRao Shoaib int getsockopt(int, int, int, char *, int *);
5089525b14bSRao Shoaib int vfprintf(FILE *, const char *, va_list);
5099525b14bSRao Shoaib int fflush(FILE *);
5109525b14bSRao Shoaib int fgetc(FILE *);
5119525b14bSRao Shoaib int fputs(const char *, FILE *);
5129525b14bSRao Shoaib int fchown(int, int, int);
5139525b14bSRao Shoaib void setbuf(FILE *, char *);
5149525b14bSRao Shoaib int gethostname(char *, int);
5159525b14bSRao Shoaib int rename(const char *, const char *);
5169525b14bSRao Shoaib time_t time(time_t *);
5179525b14bSRao Shoaib int fscanf(FILE *, const char *, ...);
5189525b14bSRao Shoaib int sscanf(const char *, const char *, ...);
5199525b14bSRao Shoaib int ioctl(int, int, caddr_t);
5209525b14bSRao Shoaib void perror(const char *);
5219525b14bSRao Shoaib 
5229525b14bSRao Shoaib #if !defined(__USE_FIXED_PROTOTYPES__) && !defined(__cplusplus) && !defined(__STRICT_ANSI__)
5239525b14bSRao Shoaib /*
5249525b14bSRao Shoaib  * 'gcc -ansi' changes the prototype for vsprintf().
5259525b14bSRao Shoaib  * Use this prototype when 'gcc -ansi' is not in effect.
5269525b14bSRao Shoaib  */
5279525b14bSRao Shoaib char *vsprintf(char *, const char *, va_list);
5289525b14bSRao Shoaib #endif
5299525b14bSRao Shoaib #endif
5309525b14bSRao Shoaib 
5319525b14bSRao Shoaib /* Solaris-specific changes */
5329525b14bSRao Shoaib #include "sunw_port_after.h"
5339525b14bSRao Shoaib 
534*23a1cceaSRoger A. Faulkner #endif	/* port_after_h */
535