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 #define NEED_DAEMON 1 509525b14bSRao Shoaib #undef NEED_STRSEP 519525b14bSRao Shoaib #undef NEED_STRERROR 529525b14bSRao Shoaib #ifdef NEED_STRERROR 539525b14bSRao Shoaib const char *isc_strerror(int); 549525b14bSRao Shoaib #define strerror isc_strerror 559525b14bSRao Shoaib #endif 569525b14bSRao Shoaib /* HAS_INET6_STRUCTS and HAVE_SIN6_SCOPE_ID are defined by port_ipv6.h 579525b14bSRao Shoaib * #define HAS_INET6_STRUCTS 1 589525b14bSRao Shoaib * #define HAVE_SIN6_SCOPE_ID 1 599525b14bSRao Shoaib */ 609525b14bSRao Shoaib #include <port_ipv6.h> 619525b14bSRao Shoaib 629525b14bSRao Shoaib #undef NEED_IN6ADDR_ANY 639525b14bSRao Shoaib #undef HAS_IN_ADDR6 649525b14bSRao Shoaib #define HAVE_SOCKADDR_STORAGE 1 659525b14bSRao Shoaib #undef NEED_GETTIMEOFDAY 66*23a1cceaSRoger A. Faulkner #define HAVE_STRNDUP 679525b14bSRao Shoaib #undef USE_FIONBIO_IOCTL 689525b14bSRao Shoaib #undef INNETGR_ARGS 699525b14bSRao Shoaib 709525b14bSRao Shoaib #undef USE_IFNAMELINKID 719525b14bSRao Shoaib #define PORT_NONBLOCK O_NONBLOCK 729525b14bSRao Shoaib 739525b14bSRao Shoaib #ifndef _POSIX_PATH_MAX 749525b14bSRao Shoaib #define _POSIX_PATH_MAX 255 759525b14bSRao Shoaib #endif 769525b14bSRao Shoaib #ifndef PATH_MAX 779525b14bSRao Shoaib #define PATH_MAX _POSIX_PATH_MAX 787c478bd9Sstevel@tonic-gate #endif 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate /* 817c478bd9Sstevel@tonic-gate * We need to know the IPv6 address family number even on IPv4-only systems. 827c478bd9Sstevel@tonic-gate * Note that this is NOT a protocol constant, and that if the system has its 837c478bd9Sstevel@tonic-gate * own AF_INET6, different from ours below, all of BIND's libraries and 847c478bd9Sstevel@tonic-gate * executables will need to be recompiled after the system <sys/socket.h> 857c478bd9Sstevel@tonic-gate * has had this type added. The type number below is correct on most BSD- 867c478bd9Sstevel@tonic-gate * derived systems for which AF_INET6 is defined. 877c478bd9Sstevel@tonic-gate */ 887c478bd9Sstevel@tonic-gate #ifndef AF_INET6 899525b14bSRao Shoaib #define AF_INET6 24 907c478bd9Sstevel@tonic-gate #endif 917c478bd9Sstevel@tonic-gate 929525b14bSRao Shoaib #ifndef PF_INET6 939525b14bSRao Shoaib #define PF_INET6 AF_INET6 949525b14bSRao Shoaib #endif 959525b14bSRao Shoaib 969525b14bSRao Shoaib #ifdef HAS_IN_ADDR6 979525b14bSRao Shoaib /* Map to pre-RFC structure. */ 989525b14bSRao Shoaib #define in6_addr in_addr6 997c478bd9Sstevel@tonic-gate #endif 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate #ifndef HAS_INET6_STRUCTS 1027c478bd9Sstevel@tonic-gate /* Replace with structure from later rev of O/S if known. */ 1037c478bd9Sstevel@tonic-gate struct in6_addr { 1049525b14bSRao Shoaib u_int8_t s6_addr[16]; 1057c478bd9Sstevel@tonic-gate }; 1067c478bd9Sstevel@tonic-gate 1079525b14bSRao Shoaib #define IN6ADDR_ANY_INIT \ 1089525b14bSRao Shoaib {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 1099525b14bSRao Shoaib 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }} 1109525b14bSRao Shoaib 1119525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT \ 1129525b14bSRao Shoaib {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 1139525b14bSRao Shoaib 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }} 1149525b14bSRao Shoaib 1157c478bd9Sstevel@tonic-gate /* Replace with structure from later rev of O/S if known. */ 1167c478bd9Sstevel@tonic-gate struct sockaddr_in6 { 1179525b14bSRao Shoaib #ifdef HAVE_SA_LEN 1189525b14bSRao Shoaib u_int8_t sin6_len; /* length of this struct */ 1199525b14bSRao Shoaib u_int8_t sin6_family; /* AF_INET6 */ 1207c478bd9Sstevel@tonic-gate #else 1219525b14bSRao Shoaib u_int16_t sin6_family; /* AF_INET6 */ 1227c478bd9Sstevel@tonic-gate #endif 1239525b14bSRao Shoaib u_int16_t sin6_port; /* transport layer port # */ 1249525b14bSRao Shoaib u_int32_t sin6_flowinfo; /* IPv6 flow information */ 1259525b14bSRao Shoaib struct in6_addr sin6_addr; /* IPv6 address */ 1269525b14bSRao Shoaib u_int32_t sin6_scope_id; /* set of interfaces for a scope */ 1277c478bd9Sstevel@tonic-gate }; 1289525b14bSRao Shoaib #endif /* HAS_INET6_STRUCTS */ 1299525b14bSRao Shoaib 1309525b14bSRao Shoaib #ifdef BROKEN_IN6ADDR_INIT_MACROS 1319525b14bSRao Shoaib #undef IN6ADDR_ANY_INIT 1329525b14bSRao Shoaib #undef IN6ADDR_LOOPBACK_INIT 1339525b14bSRao Shoaib #endif 1347c478bd9Sstevel@tonic-gate 1359525b14bSRao Shoaib #ifdef _AIX 1367c478bd9Sstevel@tonic-gate #ifndef IN6ADDR_ANY_INIT 1379525b14bSRao Shoaib #define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0 }}} 1387c478bd9Sstevel@tonic-gate #endif 1397c478bd9Sstevel@tonic-gate #ifndef IN6ADDR_LOOPBACK_INIT 1409525b14bSRao Shoaib #if BYTE_ORDER == BIG_ENDIAN 1419525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 1 }}} 1429525b14bSRao Shoaib #else 1439525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT {{{0, 0, 0, 0x01000000}}} 1449525b14bSRao Shoaib #endif 1459525b14bSRao Shoaib #endif 1467c478bd9Sstevel@tonic-gate #endif 1477c478bd9Sstevel@tonic-gate 1489525b14bSRao Shoaib #ifndef IN6ADDR_ANY_INIT 1499525b14bSRao Shoaib #ifdef s6_addr 1509525b14bSRao Shoaib #define IN6ADDR_ANY_INIT \ 1519525b14bSRao Shoaib {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 1529525b14bSRao Shoaib 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} 1539525b14bSRao Shoaib #else 1549525b14bSRao Shoaib #define IN6ADDR_ANY_INIT \ 1559525b14bSRao Shoaib {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 1569525b14bSRao Shoaib 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }} 1579525b14bSRao Shoaib #endif 1589525b14bSRao Shoaib 1599525b14bSRao Shoaib #endif 1609525b14bSRao Shoaib #ifndef IN6ADDR_LOOPBACK_INIT 1619525b14bSRao Shoaib #ifdef s6_addr 1629525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT \ 1639525b14bSRao Shoaib {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 1649525b14bSRao Shoaib 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} 1659525b14bSRao Shoaib #else 1669525b14bSRao Shoaib #define IN6ADDR_LOOPBACK_INIT \ 1679525b14bSRao Shoaib {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 1689525b14bSRao Shoaib 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }} 1699525b14bSRao Shoaib #endif 1709525b14bSRao Shoaib #endif 1719525b14bSRao Shoaib 1729525b14bSRao Shoaib #ifndef HAVE_SOCKADDR_STORAGE 1739525b14bSRao Shoaib #define __SS_MAXSIZE 128 1749525b14bSRao Shoaib #define __SS_ALLIGSIZE (sizeof (long)) 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate struct sockaddr_storage { 1777c478bd9Sstevel@tonic-gate #ifdef HAVE_SA_LEN 1789525b14bSRao Shoaib u_int8_t ss_len; /* address length */ 1799525b14bSRao Shoaib u_int8_t ss_family; /* address family */ 1809525b14bSRao Shoaib char __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof(u_int8_t)]; 1819525b14bSRao Shoaib long __ss_align; 1829525b14bSRao Shoaib char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE]; 1837c478bd9Sstevel@tonic-gate #else 1849525b14bSRao Shoaib u_int16_t ss_family; /* address family */ 1859525b14bSRao Shoaib char __ss_pad1[__SS_ALLIGSIZE - sizeof(u_int16_t)]; 1869525b14bSRao Shoaib long __ss_align; 1879525b14bSRao Shoaib char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE]; 1887c478bd9Sstevel@tonic-gate #endif 1897c478bd9Sstevel@tonic-gate }; 1907c478bd9Sstevel@tonic-gate #endif 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate #if !defined(HAS_INET6_STRUCTS) || defined(NEED_IN6ADDR_ANY) 1949525b14bSRao Shoaib #define in6addr_any isc_in6addr_any 1957c478bd9Sstevel@tonic-gate extern const struct in6_addr in6addr_any; 1967c478bd9Sstevel@tonic-gate #endif 1977c478bd9Sstevel@tonic-gate 1989525b14bSRao Shoaib /* 1999525b14bSRao Shoaib * IN6_ARE_ADDR_EQUAL, IN6_IS_ADDR_UNSPECIFIED, IN6_IS_ADDR_V4COMPAT and 2009525b14bSRao Shoaib * IN6_IS_ADDR_V4MAPPED are broken in glibc 2.1. 2019525b14bSRao Shoaib */ 2029525b14bSRao Shoaib #ifdef __GLIBC__ 2039525b14bSRao Shoaib #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) 2049525b14bSRao Shoaib #undef IN6_ARE_ADDR_EQUAL 2059525b14bSRao Shoaib #undef IN6_IS_ADDR_UNSPECIFIED 2069525b14bSRao Shoaib #undef IN6_IS_ADDR_V4COMPAT 2079525b14bSRao Shoaib #undef IN6_IS_ADDR_V4MAPPED 2089525b14bSRao Shoaib #endif 2099525b14bSRao Shoaib #endif 2109525b14bSRao Shoaib 2117c478bd9Sstevel@tonic-gate #ifndef IN6_ARE_ADDR_EQUAL 2129525b14bSRao Shoaib #define IN6_ARE_ADDR_EQUAL(a,b) \ 2139525b14bSRao Shoaib (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0) 2147c478bd9Sstevel@tonic-gate #endif 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_UNSPECIFIED 2179525b14bSRao Shoaib #define IN6_IS_ADDR_UNSPECIFIED(a) \ 2187c478bd9Sstevel@tonic-gate IN6_ARE_ADDR_EQUAL(a, &in6addr_any) 2197c478bd9Sstevel@tonic-gate #endif 2207c478bd9Sstevel@tonic-gate 2217c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_LOOPBACK 2227c478bd9Sstevel@tonic-gate extern const struct in6_addr isc_in6addr_loopback; 2239525b14bSRao Shoaib #define IN6_IS_ADDR_LOOPBACK(a) \ 2247c478bd9Sstevel@tonic-gate IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback) 2257c478bd9Sstevel@tonic-gate #endif 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_V4MAPPED 2289525b14bSRao Shoaib #define IN6_IS_ADDR_V4MAPPED(a) \ 2297c478bd9Sstevel@tonic-gate ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \ 2307c478bd9Sstevel@tonic-gate (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \ 2317c478bd9Sstevel@tonic-gate (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \ 2329525b14bSRao Shoaib (a)->s6_addr[6] == 0x00 && (a)->s6_addr[9] == 0x00 && \ 2337c478bd9Sstevel@tonic-gate (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \ 2347c478bd9Sstevel@tonic-gate (a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff) 2357c478bd9Sstevel@tonic-gate #endif 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_SITELOCAL 2389525b14bSRao Shoaib #define IN6_IS_ADDR_SITELOCAL(a) \ 2397c478bd9Sstevel@tonic-gate (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) 2407c478bd9Sstevel@tonic-gate #endif 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_LINKLOCAL 2439525b14bSRao Shoaib #define IN6_IS_ADDR_LINKLOCAL(a) \ 2447c478bd9Sstevel@tonic-gate (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) 2457c478bd9Sstevel@tonic-gate #endif 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MULTICAST 2489525b14bSRao Shoaib #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) 2497c478bd9Sstevel@tonic-gate #endif 2507c478bd9Sstevel@tonic-gate 2517c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_MC_SCOPE 2529525b14bSRao Shoaib #define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) 2537c478bd9Sstevel@tonic-gate #endif 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_SCOPE_SITELOCAL 2569525b14bSRao Shoaib #define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 2577c478bd9Sstevel@tonic-gate #endif 2587c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_SCOPE_ORGLOCAL 2599525b14bSRao Shoaib #define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 2607c478bd9Sstevel@tonic-gate #endif 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MC_SITELOCAL 2639525b14bSRao Shoaib #define IN6_IS_ADDR_MC_SITELOCAL(a) \ 2647c478bd9Sstevel@tonic-gate (IN6_IS_ADDR_MULTICAST(a) && \ 2659525b14bSRao Shoaib (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) 2667c478bd9Sstevel@tonic-gate #endif 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MC_ORGLOCAL 2699525b14bSRao Shoaib #define IN6_IS_ADDR_MC_ORGLOCAL(a) \ 2707c478bd9Sstevel@tonic-gate (IN6_IS_ADDR_MULTICAST(a) && \ 2719525b14bSRao Shoaib (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) 2727c478bd9Sstevel@tonic-gate #endif 2737c478bd9Sstevel@tonic-gate 2749525b14bSRao Shoaib #ifndef INADDR_NONE 2759525b14bSRao Shoaib #define INADDR_NONE 0xffffffff 2767c478bd9Sstevel@tonic-gate #endif 2777c478bd9Sstevel@tonic-gate 2789525b14bSRao Shoaib #ifndef MAXHOSTNAMELEN 2799525b14bSRao Shoaib #define MAXHOSTNAMELEN 256 2807c478bd9Sstevel@tonic-gate #endif 2819525b14bSRao Shoaib 2829525b14bSRao Shoaib #ifndef INET6_ADDRSTRLEN 2839525b14bSRao Shoaib /* sizeof("aaaa:bbbb:cccc:dddd:eeee:ffff:123.123.123.123") */ 2849525b14bSRao Shoaib #define INET6_ADDRSTRLEN 46 2859525b14bSRao Shoaib #endif 2869525b14bSRao Shoaib 2879525b14bSRao Shoaib #ifndef MIN 2889525b14bSRao Shoaib #define MIN(x,y) (((x) <= (y)) ? (x) : (y)) 2897c478bd9Sstevel@tonic-gate #endif 2907c478bd9Sstevel@tonic-gate 2919525b14bSRao Shoaib #ifndef MAX 2929525b14bSRao Shoaib #define MAX(x,y) (((x) >= (y)) ? (x) : (y)) 2939525b14bSRao Shoaib #endif 2947c478bd9Sstevel@tonic-gate 2959525b14bSRao Shoaib #ifdef NEED_DAEMON 2967c478bd9Sstevel@tonic-gate int daemon(int nochdir, int noclose); 2979525b14bSRao Shoaib #endif 2987c478bd9Sstevel@tonic-gate 2999525b14bSRao Shoaib #ifdef NEED_STRSEP 3009525b14bSRao Shoaib char * strsep(char **stringp, const char *delim); 3017c478bd9Sstevel@tonic-gate #endif 3027c478bd9Sstevel@tonic-gate 3039525b14bSRao Shoaib #ifndef ALIGN 3049525b14bSRao Shoaib #define ALIGN(p) (((uintptr_t)(p) + (sizeof(long) - 1)) & ~(sizeof(long) - 1)) 3057c478bd9Sstevel@tonic-gate #endif 3067c478bd9Sstevel@tonic-gate 3079525b14bSRao Shoaib #ifdef NEED_SETGROUPENT 3089525b14bSRao Shoaib int setgroupent(int stayopen); 3099525b14bSRao Shoaib #endif 3107c478bd9Sstevel@tonic-gate 3119525b14bSRao Shoaib #ifdef NEED_GETGROUPLIST 3129525b14bSRao Shoaib int getgrouplist(GETGROUPLIST_ARGS); 3137c478bd9Sstevel@tonic-gate #endif 3147c478bd9Sstevel@tonic-gate 3159525b14bSRao Shoaib #ifdef POSIX_GETGRNAM_R 3169525b14bSRao Shoaib int 3179525b14bSRao Shoaib __posix_getgrnam_r(const char *, struct group *, char *, int, struct group **); 3187c478bd9Sstevel@tonic-gate #endif 3197c478bd9Sstevel@tonic-gate 3209525b14bSRao Shoaib #ifdef NEED_GETGRNAM_R 3219525b14bSRao Shoaib int 3229525b14bSRao Shoaib getgrnam_r(const char *, struct group *, char *, size_t, struct group **); 3239525b14bSRao Shoaib #endif 3247c478bd9Sstevel@tonic-gate 3259525b14bSRao Shoaib #ifdef POSIX_GETGRGID_R 3269525b14bSRao Shoaib int 3279525b14bSRao Shoaib __posix_getgrgid_r(gid_t, struct group *, char *, int, struct group **) ; 3287c478bd9Sstevel@tonic-gate #endif 3297c478bd9Sstevel@tonic-gate 3309525b14bSRao Shoaib #ifdef NEED_GETGRGID_R 3319525b14bSRao Shoaib int 3329525b14bSRao Shoaib getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); 3339525b14bSRao Shoaib #endif 3346a1c6faaSanay 3359525b14bSRao Shoaib #ifdef NEED_GETGRENT_R 3369525b14bSRao Shoaib GROUP_R_RETURN getgrent_r(struct group *gptr, GROUP_R_ARGS); 3379525b14bSRao Shoaib #endif 3389525b14bSRao Shoaib 3399525b14bSRao Shoaib #ifdef NEED_SETGRENT_R 3409525b14bSRao Shoaib GROUP_R_SET_RETURN setgrent_r(GROUP_R_ENT_ARGS); 3419525b14bSRao Shoaib #endif 3429525b14bSRao Shoaib 3439525b14bSRao Shoaib #ifdef NEED_ENDGRENT_R 3449525b14bSRao Shoaib GROUP_R_END_RETURN endgrent_r(GROUP_R_ENT_ARGS); 3459525b14bSRao Shoaib #endif 3469525b14bSRao Shoaib 3479525b14bSRao Shoaib #if defined(NEED_INNETGR_R) && defined(NGR_R_RETURN) 3489525b14bSRao Shoaib NGR_R_RETURN 3499525b14bSRao Shoaib innetgr_r(const char *, const char *, const char *, const char *); 3509525b14bSRao Shoaib #endif 3519525b14bSRao Shoaib 3529525b14bSRao Shoaib #ifdef NEED_SETNETGRENT_R 3539525b14bSRao Shoaib #ifdef NGR_R_SET_ARGS 3549525b14bSRao Shoaib NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS); 3559525b14bSRao Shoaib #else 3569525b14bSRao Shoaib NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup); 3579525b14bSRao Shoaib #endif 3589525b14bSRao Shoaib #endif 3599525b14bSRao Shoaib 3609525b14bSRao Shoaib #ifdef NEED_ENDNETGRENT_R 3619525b14bSRao Shoaib #ifdef NGR_R_END_ARGS 3629525b14bSRao Shoaib NGR_R_END_RETURN endnetgrent_r(NGR_R_END_ARGS); 3636a1c6faaSanay #else 3649525b14bSRao Shoaib NGR_R_END_RETURN endnetgrent_r(void); 3656a1c6faaSanay #endif 3666a1c6faaSanay #endif 3676a1c6faaSanay 3689525b14bSRao Shoaib #ifdef POSIX_GETPWNAM_R 3699525b14bSRao Shoaib int 3709525b14bSRao Shoaib __posix_getpwnam_r(const char *login, struct passwd *pwptr, 3719525b14bSRao Shoaib char *buf, size_t buflen, struct passwd **result); 3729525b14bSRao Shoaib #endif 3739525b14bSRao Shoaib 3749525b14bSRao Shoaib #ifdef NEED_GETPWNAM_R 3759525b14bSRao Shoaib int 3769525b14bSRao Shoaib getpwnam_r(const char *login, struct passwd *pwptr, 3779525b14bSRao Shoaib char *buf, size_t buflen, struct passwd **result); 3789525b14bSRao Shoaib #endif 3799525b14bSRao Shoaib 3809525b14bSRao Shoaib #ifdef POSIX_GETPWUID_R 3819525b14bSRao Shoaib int 3829525b14bSRao Shoaib __posix_getpwuid_r(uid_t uid, struct passwd *pwptr, 3839525b14bSRao Shoaib char *buf, int buflen, struct passwd **result); 3849525b14bSRao Shoaib #endif 3859525b14bSRao Shoaib 3869525b14bSRao Shoaib #ifdef NEED_GETPWUID_R 3879525b14bSRao Shoaib int 3889525b14bSRao Shoaib getpwuid_r(uid_t uid, struct passwd *pwptr, 3899525b14bSRao Shoaib char *buf, size_t buflen, struct passwd **result); 3909525b14bSRao Shoaib #endif 3919525b14bSRao Shoaib 3929525b14bSRao Shoaib #ifdef NEED_SETPWENT_R 3939525b14bSRao Shoaib #ifdef PASS_R_ENT_ARGS 3949525b14bSRao Shoaib PASS_R_SET_RETURN setpwent_r(PASS_R_ENT_ARGS); 3959525b14bSRao Shoaib #else 3969525b14bSRao Shoaib PASS_R_SET_RETURN setpwent_r(void); 3979525b14bSRao Shoaib #endif 3989525b14bSRao Shoaib 3999525b14bSRao Shoaib #endif 4009525b14bSRao Shoaib 4019525b14bSRao Shoaib #ifdef NEED_SETPASSENT_R 4029525b14bSRao Shoaib #ifdef PASS_R_ENT_ARGS 4039525b14bSRao Shoaib PASS_R_SET_RETURN setpassent_r(int stayopen, PASS_R_ENT_ARGS); 4049525b14bSRao Shoaib #else 4059525b14bSRao Shoaib PASS_R_SET_RETURN setpassent_r(int stayopen); 4069525b14bSRao Shoaib #endif 4079525b14bSRao Shoaib #endif 4089525b14bSRao Shoaib 4099525b14bSRao Shoaib #ifdef NEED_GETPWENT_R 4109525b14bSRao Shoaib PASS_R_RETURN getpwent_r(struct passwd *pwptr, PASS_R_ARGS); 4119525b14bSRao Shoaib #endif 4129525b14bSRao Shoaib 4139525b14bSRao Shoaib #ifdef NEED_ENDPWENT_R 4149525b14bSRao Shoaib void endpwent_r(void); 4159525b14bSRao Shoaib #endif 4169525b14bSRao Shoaib 4179525b14bSRao Shoaib #ifdef NEED_SETPASSENT 4189525b14bSRao Shoaib int setpassent(int stayopen); 4199525b14bSRao Shoaib #endif 4209525b14bSRao Shoaib 4219525b14bSRao Shoaib #define gettimeofday isc__gettimeofday 4229525b14bSRao Shoaib #ifdef NEED_GETTIMEOFDAY 4239525b14bSRao Shoaib int isc__gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp); 4249525b14bSRao Shoaib #else 4259525b14bSRao Shoaib int isc__gettimeofday(struct timeval *tp, struct timezone *tzp); 4269525b14bSRao Shoaib #endif 4279525b14bSRao Shoaib 4289525b14bSRao Shoaib int getnetgrent(NGR_R_CONST char **machinep, NGR_R_CONST char **userp, 4299525b14bSRao Shoaib NGR_R_CONST char **domainp); 4309525b14bSRao Shoaib 4319525b14bSRao Shoaib #ifdef NGR_R_ARGS 4329525b14bSRao Shoaib int getnetgrent_r(NGR_R_CONST char **machinep, NGR_R_CONST char **userp, 4339525b14bSRao Shoaib NGR_R_CONST char **domainp, NGR_R_ARGS); 4349525b14bSRao Shoaib #endif 4359525b14bSRao Shoaib 4369525b14bSRao Shoaib /* setnetgrent and endnetgrent are defined in sunw_port_after.h 4379525b14bSRao Shoaib #ifdef SETNETGRENT_ARGS 4389525b14bSRao Shoaib void setnetgrent(SETNETGRENT_ARGS); 4399525b14bSRao Shoaib #else 4409525b14bSRao Shoaib void setnetgrent(const char *netgroup); 4419525b14bSRao Shoaib #endif 4429525b14bSRao Shoaib 4439525b14bSRao Shoaib void endnetgrent(void); 4449525b14bSRao Shoaib */ 4459525b14bSRao Shoaib 4469525b14bSRao Shoaib #ifdef INNETGR_ARGS 4479525b14bSRao Shoaib int innetgr(INNETGR_ARGS); 4489525b14bSRao Shoaib #else 4499525b14bSRao Shoaib int innetgr(const char *netgroup, const char *machine, 4509525b14bSRao Shoaib const char *user, const char *domain); 4519525b14bSRao Shoaib #endif 4529525b14bSRao Shoaib 4539525b14bSRao Shoaib #ifdef NGR_R_SET_ARGS 4549525b14bSRao Shoaib NGR_R_SET_RETURN 4559525b14bSRao Shoaib setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS); 4569525b14bSRao Shoaib #else 4579525b14bSRao Shoaib NGR_R_SET_RETURN 4589525b14bSRao Shoaib setnetgrent_r(NGR_R_SET_CONST char *netgroup); 4599525b14bSRao Shoaib #endif 4609525b14bSRao Shoaib 4619525b14bSRao Shoaib #ifdef NEED_STRTOUL 4629525b14bSRao Shoaib unsigned long strtoul(const char *, char **, int); 4639525b14bSRao Shoaib #endif 4649525b14bSRao Shoaib 4659525b14bSRao Shoaib #ifdef NEED_SUN4PROTOS 4669525b14bSRao Shoaib #include <stdarg.h> 4679525b14bSRao Shoaib #ifndef __SIZE_TYPE__ 4689525b14bSRao Shoaib #define __SIZE_TYPE__ int 4699525b14bSRao Shoaib #endif 4709525b14bSRao Shoaib struct sockaddr; 4719525b14bSRao Shoaib struct iovec; 4729525b14bSRao Shoaib struct timeval; 4739525b14bSRao Shoaib struct timezone; 4749525b14bSRao Shoaib int fprintf(FILE *, const char *, ...); 4759525b14bSRao Shoaib int getsockname(int, struct sockaddr *, int *); 4769525b14bSRao Shoaib int getpeername(int, struct sockaddr *, int *); 4779525b14bSRao Shoaib int socket(int, int, int); 4789525b14bSRao Shoaib int connect(int, const struct sockaddr *, int); 4799525b14bSRao Shoaib int writev(int, struct iovec *, int); 4809525b14bSRao Shoaib int readv(int, struct iovec *, int); 4819525b14bSRao Shoaib int send(int, const char *, int, int); 4829525b14bSRao Shoaib void bzero(char *, int); 4839525b14bSRao Shoaib int recvfrom(int, char *, int, int, struct sockaddr *, int *); 4849525b14bSRao Shoaib int syslog(int, const char *, ... ); 4859525b14bSRao Shoaib int printf(const char *, ...); 4869525b14bSRao Shoaib __SIZE_TYPE__ fread(void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *); 4879525b14bSRao Shoaib __SIZE_TYPE__ fwrite(const void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *); 4889525b14bSRao Shoaib int fclose(FILE *); 4899525b14bSRao Shoaib int ungetc(int, FILE *); 4909525b14bSRao Shoaib int scanf(const char *, ...); 4919525b14bSRao Shoaib int sscanf(const char *, const char *, ... ); 4929525b14bSRao Shoaib int tolower(int); 4939525b14bSRao Shoaib int toupper(int); 4949525b14bSRao Shoaib int strcasecmp(const char *, const char *); 4959525b14bSRao Shoaib int strncasecmp(const char *, const char *, int); 4969525b14bSRao Shoaib int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 4979525b14bSRao Shoaib #ifdef gettimeofday 4989525b14bSRao Shoaib #undef gettimeofday 4999525b14bSRao Shoaib int gettimeofday(struct timeval *, struct timezone *); 5009525b14bSRao Shoaib #define gettimeofday isc__gettimeofday 5019525b14bSRao Shoaib #else 5029525b14bSRao Shoaib int gettimeofday(struct timeval *, struct timezone *); 5039525b14bSRao Shoaib #endif 5049525b14bSRao Shoaib long strtol(const char*, char **, int); 5059525b14bSRao Shoaib int fseek(FILE *, long, int); 5069525b14bSRao Shoaib int setsockopt(int, int, int, const char *, int); 5079525b14bSRao Shoaib int bind(int, const struct sockaddr *, int); 5089525b14bSRao Shoaib void bcopy(char *, char *, int); 5099525b14bSRao Shoaib int fputc(char, FILE *); 5109525b14bSRao Shoaib int listen(int, int); 5119525b14bSRao Shoaib int accept(int, struct sockaddr *, int *); 5129525b14bSRao Shoaib int getsockopt(int, int, int, char *, int *); 5139525b14bSRao Shoaib int vfprintf(FILE *, const char *, va_list); 5149525b14bSRao Shoaib int fflush(FILE *); 5159525b14bSRao Shoaib int fgetc(FILE *); 5169525b14bSRao Shoaib int fputs(const char *, FILE *); 5179525b14bSRao Shoaib int fchown(int, int, int); 5189525b14bSRao Shoaib void setbuf(FILE *, char *); 5199525b14bSRao Shoaib int gethostname(char *, int); 5209525b14bSRao Shoaib int rename(const char *, const char *); 5219525b14bSRao Shoaib time_t time(time_t *); 5229525b14bSRao Shoaib int fscanf(FILE *, const char *, ...); 5239525b14bSRao Shoaib int sscanf(const char *, const char *, ...); 5249525b14bSRao Shoaib int ioctl(int, int, caddr_t); 5259525b14bSRao Shoaib void perror(const char *); 5269525b14bSRao Shoaib 5279525b14bSRao Shoaib #if !defined(__USE_FIXED_PROTOTYPES__) && !defined(__cplusplus) && !defined(__STRICT_ANSI__) 5289525b14bSRao Shoaib /* 5299525b14bSRao Shoaib * 'gcc -ansi' changes the prototype for vsprintf(). 5309525b14bSRao Shoaib * Use this prototype when 'gcc -ansi' is not in effect. 5319525b14bSRao Shoaib */ 5329525b14bSRao Shoaib char *vsprintf(char *, const char *, va_list); 5339525b14bSRao Shoaib #endif 5349525b14bSRao Shoaib #endif 5359525b14bSRao Shoaib 5369525b14bSRao Shoaib /* Solaris-specific changes */ 5379525b14bSRao Shoaib #include "sunw_port_after.h" 5389525b14bSRao Shoaib 539*23a1cceaSRoger A. Faulkner #endif /* port_after_h */ 540