Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libresolv2/include/port_after.h
          +++ new/usr/src/lib/libresolv2/include/port_after.h
   1    1  /*
   2      - * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
        2 + * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   3    3   * Use is subject to license terms.
   4    4   */
   5    5  
   6      -#pragma ident   "%Z%%M% %I%     %E% SMI"
   7    6  
   8      -#ifndef PORT_AFTER_H
   9      -#define PORT_AFTER_H
  10      -#include "os_version.h"
        7 +/*
        8 + * Copyright (C) 2004-2008  Internet Systems Consortium, Inc. ("ISC")
        9 + * Copyright (C) 2001-2003  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 + */
  11   23  
  12      -#undef HAVE_SA_LEN
  13      -#define USE_POSIX
  14      -#define POSIX_SIGNALS
  15      -#define NETREAD_BROKEN
  16      -#define USE_WAITPID
  17      -#define HAVE_FCHMOD
  18      -#define NEED_PSELECT
  19      -#define SETGRENT_VOID
  20      -#define SETPWENT_VOID
  21      -#define SIOCGIFCONF_ADDR
  22      -#define IP_OPT_BUF_SIZE 40
  23      -#define HAVE_CHROOT
  24      -#define CAN_CHANGE_ID
  25      -#define POSIX_GETPWNAM_R
  26      -#define POSIX_GETPWUID_R
  27      -#define POSIX_GETGRGID_R
  28      -#define POSIX_GETGRNAM_R
  29      -#define NEED_SECURE_DIRECTORY
  30      -#define HAVE_DEV_RANDOM
  31      -#define NO_MSG_CONTROL
       24 +/* $Id: port_after.h.in,v 1.60 2008/02/28 05:34:17 marka Exp $ */
  32   25  
  33      -#define PORT_NONBLOCK   O_NONBLOCK
  34      -#define PORT_WOULDBLK   EWOULDBLOCK
  35      -#define WAIT_T          int
  36      -#ifndef SUNW_LIBNSL
  37      -#define INADDR_NONE     0xffffffff
  38      -#endif
       26 +#ifndef port_after_h
       27 +#define port_after_h
  39   28  
       29 +#include <stdio.h>
  40   30  #include <sys/types.h>
  41   31  #include <sys/socket.h>
  42   32  #include <sys/param.h>
       33 +#include <sys/time.h>
  43   34  #if (!defined(BSD)) || (BSD < 199306)
  44   35  #include <sys/bitypes.h>
  45   36  #endif
  46      -#include <sys/time.h>
       37 +#ifdef HAVE_INTTYPES_H
       38 +#include <inttypes.h>
       39 +#endif
       40 +#ifdef HAVE_SYS_SELECT_H
       41 +#include <sys/select.h>
       42 +#endif /* HAVE_SYS_SELECT_H */
  47   43  
  48      -#ifndef MIN
  49      -#define MIN(x, y)       ((x > y) ?y :x)
       44 +#ifdef REENABLE_SEND
       45 +#undef send
  50   46  #endif
  51      -#ifndef MAX
  52      -#define MAX(x, y)       ((x > y) ?x :y)
       47 +
       48 +#undef NEED_PSELECT
       49 +#undef HAVE_SA_LEN
       50 +#undef HAVE_MINIMUM_IFREQ
       51 +#define NEED_DAEMON 1
       52 +#undef NEED_STRSEP
       53 +#undef NEED_STRERROR
       54 +#ifdef NEED_STRERROR
       55 +const char *isc_strerror(int);
       56 +#define strerror isc_strerror
  53   57  #endif
       58 +/* HAS_INET6_STRUCTS and HAVE_SIN6_SCOPE_ID are defined by port_ipv6.h
       59 + * #define HAS_INET6_STRUCTS 1
       60 + * #define HAVE_SIN6_SCOPE_ID 1
       61 + */
       62 +#include <port_ipv6.h>
  54   63  
       64 +#undef NEED_IN6ADDR_ANY
       65 +#undef HAS_IN_ADDR6
       66 +#define HAVE_SOCKADDR_STORAGE 1
       67 +#undef NEED_GETTIMEOFDAY
       68 +#undef HAVE_STRNDUP
       69 +#undef USE_FIONBIO_IOCTL
       70 +#undef INNETGR_ARGS
       71 +
       72 +#undef USE_IFNAMELINKID
       73 +#define PORT_NONBLOCK O_NONBLOCK
       74 +
       75 +#ifndef _POSIX_PATH_MAX
       76 +#define _POSIX_PATH_MAX 255
       77 +#endif
       78 +#ifndef PATH_MAX
       79 +#define PATH_MAX _POSIX_PATH_MAX
       80 +#endif
       81 +
  55   82  /*
  56   83   * We need to know the IPv6 address family number even on IPv4-only systems.
  57   84   * Note that this is NOT a protocol constant, and that if the system has its
  58   85   * own AF_INET6, different from ours below, all of BIND's libraries and
  59   86   * executables will need to be recompiled after the system <sys/socket.h>
  60   87   * has had this type added.  The type number below is correct on most BSD-
  61   88   * derived systems for which AF_INET6 is defined.
  62   89   */
  63   90  #ifndef AF_INET6
  64      -#define AF_INET6        24
       91 +#define AF_INET6        24
  65   92  #endif
  66   93  
  67      -#ifndef PF_INET6
  68      -#define PF_INET6        AF_INET6
       94 +#ifndef PF_INET6
       95 +#define PF_INET6        AF_INET6
  69   96  #endif
  70      -#include <port_ipv6.h>
  71   97  
       98 +#ifdef HAS_IN_ADDR6
       99 +/* Map to pre-RFC structure. */
      100 +#define in6_addr in_addr6
      101 +#endif
      102 +
  72  103  #ifndef HAS_INET6_STRUCTS
  73  104  /* Replace with structure from later rev of O/S if known. */
  74  105  struct in6_addr {
  75      -        u_int8_t        s6_addr[16];
      106 +        u_int8_t        s6_addr[16];
  76  107  };
  77  108  
      109 +#define IN6ADDR_ANY_INIT \
      110 +        {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
      111 +           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
      112 +
      113 +#define IN6ADDR_LOOPBACK_INIT \
      114 +        {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
      115 +           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
      116 +
  78  117  /* Replace with structure from later rev of O/S if known. */
  79  118  struct sockaddr_in6 {
  80      -#ifdef  HAVE_SA_LEN
  81      -        u_int8_t        sin6_len;       /* length of this struct */
  82      -        u_int8_t        sin6_family;    /* AF_INET6 */
      119 +#ifdef  HAVE_SA_LEN
      120 +        u_int8_t        sin6_len;       /* length of this struct */
      121 +        u_int8_t        sin6_family;    /* AF_INET6 */
  83  122  #else
  84      -        u_int16_t       sin6_family;    /* AF_INET6 */
      123 +        u_int16_t       sin6_family;    /* AF_INET6 */
  85  124  #endif
  86      -        u_int16_t       sin6_port;      /* transport layer port # */
  87      -        u_int32_t       sin6_flowinfo;  /* IPv6 flow information */
  88      -        struct in6_addr sin6_addr;      /* IPv6 address */
  89      -        u_int32_t       sin6_scope_id;  /* set of interfaces for a scope */
      125 +        u_int16_t       sin6_port;      /* transport layer port # */
      126 +        u_int32_t       sin6_flowinfo;  /* IPv6 flow information */
      127 +        struct in6_addr sin6_addr;      /* IPv6 address */
      128 +        u_int32_t       sin6_scope_id;  /* set of interfaces for a scope */
  90  129  };
      130 +#endif  /* HAS_INET6_STRUCTS */
  91  131  
      132 +#ifdef BROKEN_IN6ADDR_INIT_MACROS
      133 +#undef IN6ADDR_ANY_INIT
      134 +#undef IN6ADDR_LOOPBACK_INIT
      135 +#endif
      136 +
      137 +#ifdef _AIX
  92  138  #ifndef IN6ADDR_ANY_INIT
  93      -#define IN6ADDR_ANY_INIT        {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
      139 +#define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0 }}}
  94  140  #endif
  95  141  #ifndef IN6ADDR_LOOPBACK_INIT
  96      -#define IN6ADDR_LOOPBACK_INIT   {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}}
      142 +#if BYTE_ORDER == BIG_ENDIAN
      143 +#define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 1 }}}
      144 +#else
      145 +#define IN6ADDR_LOOPBACK_INIT {{{0, 0, 0, 0x01000000}}}
  97  146  #endif
  98      -#endif  /* HAS_INET6_STRUCTS */
      147 +#endif
      148 +#endif
  99  149  
 100      -#if defined(NEED_SOCKADDR_STORAGE) || !defined(HAS_INET6_STRUCTS)
 101      -#define __SS_MAXSIZE 128
 102      -#define __SS_ALLIGSIZE (sizeof (long))
      150 +#ifndef IN6ADDR_ANY_INIT
      151 +#ifdef s6_addr
      152 +#define IN6ADDR_ANY_INIT \
      153 +        {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
      154 +            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
      155 +#else
      156 +#define IN6ADDR_ANY_INIT \
      157 +        {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
      158 +           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
      159 +#endif
 103  160  
      161 +#endif
      162 +#ifndef IN6ADDR_LOOPBACK_INIT
      163 +#ifdef s6_addr
      164 +#define IN6ADDR_LOOPBACK_INIT \
      165 +        {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
      166 +            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
      167 +#else
      168 +#define IN6ADDR_LOOPBACK_INIT \
      169 +        {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
      170 +           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
      171 +#endif
      172 +#endif
      173 +
      174 +#ifndef HAVE_SOCKADDR_STORAGE
      175 +#define __SS_MAXSIZE 128
      176 +#define __SS_ALLIGSIZE (sizeof (long))
      177 +
 104  178  struct sockaddr_storage {
 105  179  #ifdef  HAVE_SA_LEN
 106      -        u_int8_t        ss_len; /* address length */
 107      -        u_int8_t        ss_family;      /* address family */
 108      -        char            __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof (u_int8_t)];
 109      -        long            __ss_align;
 110      -        char            __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
      180 +        u_int8_t        ss_len;       /* address length */
      181 +        u_int8_t        ss_family;    /* address family */
      182 +        char            __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof(u_int8_t)];
      183 +        long            __ss_align;
      184 +        char            __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
 111  185  #else
 112      -        u_int16_t       ss_family;      /* address family */
 113      -        char            __ss_pad1[__SS_ALLIGSIZE - sizeof (u_int16_t)];
 114      -        long            __ss_align;
 115      -        char            __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
      186 +        u_int16_t       ss_family;    /* address family */
      187 +        char            __ss_pad1[__SS_ALLIGSIZE - sizeof(u_int16_t)];
      188 +        long            __ss_align;
      189 +        char            __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
 116  190  #endif
 117  191  };
 118  192  #endif
 119  193  
 120  194  
 121  195  #if !defined(HAS_INET6_STRUCTS) || defined(NEED_IN6ADDR_ANY)
 122      -#define in6addr_any isc_in6addr_any
      196 +#define in6addr_any isc_in6addr_any
 123  197  extern const struct in6_addr in6addr_any;
 124  198  #endif
 125  199  
      200 +/*
      201 + * IN6_ARE_ADDR_EQUAL, IN6_IS_ADDR_UNSPECIFIED, IN6_IS_ADDR_V4COMPAT and
      202 + * IN6_IS_ADDR_V4MAPPED are broken in glibc 2.1.
      203 + */
      204 +#ifdef __GLIBC__
      205 +#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
      206 +#undef IN6_ARE_ADDR_EQUAL
      207 +#undef IN6_IS_ADDR_UNSPECIFIED
      208 +#undef IN6_IS_ADDR_V4COMPAT
      209 +#undef IN6_IS_ADDR_V4MAPPED
      210 +#endif
      211 +#endif
      212 +
 126  213  #ifndef IN6_ARE_ADDR_EQUAL
 127      -#define IN6_ARE_ADDR_EQUAL(a, b) \
 128      -    (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) == 0)
      214 +#define IN6_ARE_ADDR_EQUAL(a,b) \
      215 +   (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
 129  216  #endif
 130  217  
 131  218  #ifndef IN6_IS_ADDR_UNSPECIFIED
 132      -#define IN6_IS_ADDR_UNSPECIFIED(a)      \
      219 +#define IN6_IS_ADDR_UNSPECIFIED(a)      \
 133  220          IN6_ARE_ADDR_EQUAL(a, &in6addr_any)
 134  221  #endif
 135  222  
 136  223  #ifndef IN6_IS_ADDR_LOOPBACK
 137  224  extern const struct in6_addr isc_in6addr_loopback;
 138      -#define IN6_IS_ADDR_LOOPBACK(a)         \
      225 +#define IN6_IS_ADDR_LOOPBACK(a) \
 139  226          IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback)
 140  227  #endif
 141  228  
 142      -#ifndef IN6_IS_ADDR_V4COMPAT
 143      -#define IN6_IS_ADDR_V4COMPAT(a)         \
 144      -        ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \
 145      -        (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \
 146      -        (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \
 147      -        (a)->s6_addr[6] == 0x00 && (a)->s6_addr[7] == 0x00 && \
 148      -        (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \
 149      -        (a)->s6_addr[10] == 0x00 && (a)->s6_addr[11] == 0x00 && \
 150      -        ((a)->s6_addr[12] != 0x00 || (a)->s6_addr[13] != 0x00 || \
 151      -        (a)->s6_addr[14] != 0x00 || \
 152      -        ((a)->s6_addr[15] != 0x00 && (a)->s6_addr[15] != 1)))
 153      -#endif
 154      -
 155  229  #ifndef IN6_IS_ADDR_V4MAPPED
 156      -#define IN6_IS_ADDR_V4MAPPED(a)         \
      230 +#define IN6_IS_ADDR_V4MAPPED(a) \
 157  231          ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \
 158  232          (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \
 159  233          (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \
 160      -        (a)->s6_addr[6] == 0x00 && (a)->s6_addr[7] == 0x00 && \
      234 +        (a)->s6_addr[6] == 0x00 && (a)->s6_addr[9] == 0x00 && \
 161  235          (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \
 162  236          (a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff)
 163  237  #endif
 164  238  
 165  239  #ifndef IN6_IS_ADDR_SITELOCAL
 166      -#define IN6_IS_ADDR_SITELOCAL(a)        \
      240 +#define IN6_IS_ADDR_SITELOCAL(a)        \
 167  241          (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
 168  242  #endif
 169  243  
 170  244  #ifndef IN6_IS_ADDR_LINKLOCAL
 171      -#define IN6_IS_ADDR_LINKLOCAL(a)        \
      245 +#define IN6_IS_ADDR_LINKLOCAL(a)        \
 172  246          (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
 173  247  #endif
 174  248  
 175  249  #ifndef IN6_IS_ADDR_MULTICAST
 176      -#define IN6_IS_ADDR_MULTICAST(a)        ((a)->s6_addr[0] == 0xff)
      250 +#define IN6_IS_ADDR_MULTICAST(a)        ((a)->s6_addr[0] == 0xff)
 177  251  #endif
 178  252  
 179  253  #ifndef __IPV6_ADDR_MC_SCOPE
 180      -#define __IPV6_ADDR_MC_SCOPE(a)         ((a)->s6_addr[1] & 0x0f)
      254 +#define __IPV6_ADDR_MC_SCOPE(a)         ((a)->s6_addr[1] & 0x0f)
 181  255  #endif
 182  256  
 183  257  #ifndef __IPV6_ADDR_SCOPE_SITELOCAL
 184      -#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
      258 +#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
 185  259  #endif
 186      -
 187  260  #ifndef __IPV6_ADDR_SCOPE_ORGLOCAL
 188      -#define __IPV6_ADDR_SCOPE_ORGLOCAL  0x08
      261 +#define __IPV6_ADDR_SCOPE_ORGLOCAL  0x08
 189  262  #endif
 190  263  
 191  264  #ifndef IN6_IS_ADDR_MC_SITELOCAL
 192      -#define IN6_IS_ADDR_MC_SITELOCAL(a)     \
      265 +#define IN6_IS_ADDR_MC_SITELOCAL(a)     \
 193  266          (IN6_IS_ADDR_MULTICAST(a) &&    \
 194      -        (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
      267 +         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
 195  268  #endif
 196  269  
 197  270  #ifndef IN6_IS_ADDR_MC_ORGLOCAL
 198      -#define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
      271 +#define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
 199  272          (IN6_IS_ADDR_MULTICAST(a) &&    \
 200      -        (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
      273 +         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
 201  274  #endif
 202  275  
 203      -#ifndef INET6_ADDRSTRLEN
 204      -#define INET6_ADDRSTRLEN 46
      276 +#ifndef INADDR_NONE
      277 +#define INADDR_NONE 0xffffffff
 205  278  #endif
 206  279  
 207      -/*
 208      - * Prior to 2.6, Solaris needs a prototype for gethostname().
 209      - */
 210      -#if (OS_MAJOR == 5 && OS_MINOR < 6)
 211      -extern int gethostname(char *, size_t);
      280 +#ifndef MAXHOSTNAMELEN
      281 +#define MAXHOSTNAMELEN 256
 212  282  #endif
 213      -/*
 214      - * gethostid() was not available until 2.5
 215      - * setsockopt(SO_REUSEADDR) fails on unix domain sockets before 2.5
 216      - * use ioctl(FIONBIO) rather than fcntl() calls to set/clear non-blocking i/o.
 217      - */
 218      -#if (OS_MAJOR == 5 && OS_MINOR < 5)
 219      -#define GET_HOST_ID_MISSING
 220      -#define NO_UNIX_REUSEADDR
 221      -#define USE_FIONBIO_IOCTL
      283 +
      284 +#ifndef INET6_ADDRSTRLEN
      285 +/* sizeof("aaaa:bbbb:cccc:dddd:eeee:ffff:123.123.123.123") */
      286 +#define INET6_ADDRSTRLEN 46
 222  287  #endif
 223  288  
 224      -#define NEED_STRSEP
 225      -extern char *strsep(char **, const char *);
      289 +#ifndef MIN
      290 +#define MIN(x,y) (((x) <= (y)) ? (x) : (y))
      291 +#endif
 226  292  
 227      -#define NEED_DAEMON
      293 +#ifndef MAX
      294 +#define MAX(x,y) (((x) >= (y)) ? (x) : (y))
      295 +#endif
      296 +
      297 +#ifdef NEED_DAEMON
 228  298  int daemon(int nochdir, int noclose);
      299 +#endif
 229  300  
 230      -/*
 231      - * Solaris defines this in <netdb.h> instead of in <sys/param.h>.  We don't
 232      - * define it in our <netdb.h>, so we define it here.
 233      - */
 234      -#ifndef MAXHOSTNAMELEN
 235      -#define MAXHOSTNAMELEN 256
      301 +#ifdef NEED_STRSEP
      302 +char * strsep(char **stringp, const char *delim);
 236  303  #endif
 237  304  
 238      -/*
 239      - * Solaris 2.5 and later have getrlimit(), setrlimit() and getrusage().
 240      - */
 241      -#if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 5))
 242      -#include <sys/resource.h>
 243      -#define HAVE_GETRUSAGE
 244      -#define RLIMIT_TYPE rlim_t
 245      -#define RLIMIT_FILE_INFINITY
      305 +#ifndef ALIGN
      306 +#define ALIGN(p) (((uintptr_t)(p) + (sizeof(long) - 1)) & ~(sizeof(long) - 1))
 246  307  #endif
 247  308  
 248      -#include <resolv_mt.h>
 249      -#include <netdb_private.h>
 250      -#include <inet_private.h>
 251      -#include <ctype.h>
 252      -#include <sunw_dst_init.h>
 253      -#include <sunw_irs_init.h>
      309 +#ifdef NEED_SETGROUPENT
      310 +int setgroupent(int stayopen);
      311 +#endif
 254  312  
 255      -#ifdef  ORIGINAL_ISC_CODE
 256      -const char *isc_strerror(int errnum);
 257      -#define strerror isc_strerror
      313 +#ifdef NEED_GETGROUPLIST
      314 +int getgrouplist(GETGROUPLIST_ARGS);
 258  315  #endif
 259  316  
 260      -#ifndef ISC_FACILITY
 261      -#define ISC_FACILITY LOG_DAEMON
      317 +#ifdef POSIX_GETGRNAM_R
      318 +int
      319 +__posix_getgrnam_r(const char *, struct group *, char *, int, struct group **);
 262  320  #endif
 263  321  
 264      -/* res_mkquery.c refers explicitly to __putlong and __putshort */
 265      -#define __putlong       putlong
 266      -#define __putshort      putshort
      322 +#ifdef NEED_GETGRNAM_R
      323 +int
      324 +getgrnam_r(const char *,  struct group *, char *, size_t, struct group **);
      325 +#endif
 267  326  
 268      -/*
 269      - * If one wanted to use isc__gettimeofday for Solaris, they would
 270      - * need to define NEED_GETTIMEOFDAY (common/bsd/gettimeofday.c),
 271      - * which is not defined for Solaris. Hence there is no reason to
 272      - * change the current definition of gettimeofday which currently
 273      - * comes from libc and we comment the following out.
 274      - */
 275      -#ifdef  ORIGINAL_ISC_CODE
 276      -int isc__gettimeofday(struct timeval *, struct timezone *);
 277      -#define gettimeofday isc__gettimeofday
      327 +#ifdef POSIX_GETGRGID_R
      328 +int
      329 +__posix_getgrgid_r(gid_t, struct group *, char *, int, struct group **) ;
 278  330  #endif
 279  331  
 280      -/*
 281      - * Solaris 8 has if_nametoindex().
 282      - */
 283      -#if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 8))
 284      -#define USE_IFNAMELINKID
      332 +#ifdef NEED_GETGRGID_R
      333 +int
      334 +getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
 285  335  #endif
 286      - 
 287      -#define UNUSED(x) (x) = (x)
 288      -#define DE_CONST(konst, var) \
 289      -        do { \
 290      -                union { const void *k; void *v; } _u; \
 291      -                _u.k = konst; \
 292      -                var = _u.v; \
 293      -        } while (0)
 294  336  
 295      -#ifndef ALIGN
 296      -#if (OS_MAJOR == 5 && OS_MINOR > 8)
 297      -#define ALIGN(x) (((uintptr_t)(x) + (sizeof(char*) - 1UL)) & ~(sizeof(char*) - 1UL))
      337 +#ifdef NEED_GETGRENT_R
      338 +GROUP_R_RETURN getgrent_r(struct group *gptr, GROUP_R_ARGS);
      339 +#endif
      340 +
      341 +#ifdef NEED_SETGRENT_R
      342 +GROUP_R_SET_RETURN setgrent_r(GROUP_R_ENT_ARGS);
      343 +#endif
      344 +
      345 +#ifdef NEED_ENDGRENT_R
      346 +GROUP_R_END_RETURN endgrent_r(GROUP_R_ENT_ARGS);
      347 +#endif
      348 +
      349 +#if defined(NEED_INNETGR_R) && defined(NGR_R_RETURN)
      350 +NGR_R_RETURN
      351 +innetgr_r(const char *, const char *, const char *, const char *);
      352 +#endif
      353 +
      354 +#ifdef NEED_SETNETGRENT_R
      355 +#ifdef NGR_R_SET_ARGS
      356 +NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS);
 298  357  #else
 299      -#define ALIGN(x) (((unsigned long)(x) + (sizeof(char*) - 1UL)) & ~(sizeof(char*) - 1UL))
      358 +NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup);
 300  359  #endif
 301  360  #endif
 302  361  
 303      -#endif /* ! PORT_AFTER_H */
      362 +#ifdef NEED_ENDNETGRENT_R
      363 +#ifdef NGR_R_END_ARGS
      364 +NGR_R_END_RETURN endnetgrent_r(NGR_R_END_ARGS);
      365 +#else
      366 +NGR_R_END_RETURN endnetgrent_r(void);
      367 +#endif
      368 +#endif
      369 +
      370 +#ifdef POSIX_GETPWNAM_R
      371 +int
      372 +__posix_getpwnam_r(const char *login,  struct passwd *pwptr,
      373 +                char *buf, size_t buflen, struct passwd **result);
      374 +#endif
      375 +
      376 +#ifdef NEED_GETPWNAM_R
      377 +int
      378 +getpwnam_r(const char *login,  struct passwd *pwptr,
      379 +                char *buf, size_t buflen, struct passwd **result);
      380 +#endif
      381 +
      382 +#ifdef POSIX_GETPWUID_R
      383 +int
      384 +__posix_getpwuid_r(uid_t uid, struct passwd *pwptr,
      385 +                char *buf, int buflen, struct passwd **result);
      386 +#endif
      387 +
      388 +#ifdef NEED_GETPWUID_R
      389 +int
      390 +getpwuid_r(uid_t uid, struct passwd *pwptr,
      391 +                char *buf, size_t buflen, struct passwd **result);
      392 +#endif
      393 +
      394 +#ifdef NEED_SETPWENT_R
      395 +#ifdef PASS_R_ENT_ARGS
      396 +PASS_R_SET_RETURN setpwent_r(PASS_R_ENT_ARGS);
      397 +#else
      398 +PASS_R_SET_RETURN setpwent_r(void);
      399 +#endif
      400 +
      401 +#endif
      402 +
      403 +#ifdef NEED_SETPASSENT_R
      404 +#ifdef PASS_R_ENT_ARGS
      405 +PASS_R_SET_RETURN setpassent_r(int stayopen, PASS_R_ENT_ARGS);
      406 +#else
      407 +PASS_R_SET_RETURN setpassent_r(int stayopen);
      408 +#endif
      409 +#endif
      410 +
      411 +#ifdef NEED_GETPWENT_R
      412 +PASS_R_RETURN getpwent_r(struct passwd *pwptr, PASS_R_ARGS);
      413 +#endif
      414 +
      415 +#ifdef NEED_ENDPWENT_R
      416 +void endpwent_r(void);
      417 +#endif
      418 +
      419 +#ifdef NEED_SETPASSENT
      420 +int setpassent(int stayopen);
      421 +#endif
      422 +
      423 +#define gettimeofday isc__gettimeofday
      424 +#ifdef NEED_GETTIMEOFDAY
      425 +int isc__gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp);
      426 +#else
      427 +int isc__gettimeofday(struct timeval *tp, struct timezone *tzp);
      428 +#endif
      429 +
      430 +int getnetgrent(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
      431 +                NGR_R_CONST char **domainp);
      432 +
      433 +#ifdef NGR_R_ARGS
      434 +int getnetgrent_r(NGR_R_CONST char **machinep, NGR_R_CONST char **userp,
      435 +                  NGR_R_CONST char **domainp, NGR_R_ARGS);
      436 +#endif
      437 +
      438 +/* setnetgrent and endnetgrent are defined in sunw_port_after.h 
      439 +#ifdef SETNETGRENT_ARGS
      440 +void setnetgrent(SETNETGRENT_ARGS);
      441 +#else
      442 +void setnetgrent(const char *netgroup);
      443 +#endif
      444 +
      445 +void endnetgrent(void);
      446 +*/
      447 +
      448 +#ifdef INNETGR_ARGS
      449 +int innetgr(INNETGR_ARGS);
      450 +#else
      451 +int innetgr(const char *netgroup, const char *machine,
      452 +            const char *user, const char *domain);
      453 +#endif
      454 +
      455 +#ifdef NGR_R_SET_ARGS
      456 +NGR_R_SET_RETURN
      457 +setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS);
      458 +#else
      459 +NGR_R_SET_RETURN
      460 +setnetgrent_r(NGR_R_SET_CONST char *netgroup);
      461 +#endif
      462 +
      463 +#ifdef NEED_STRTOUL
      464 +unsigned long strtoul(const char *, char **, int);
      465 +#endif
      466 +
      467 +#ifdef NEED_SUN4PROTOS
      468 +#include <stdarg.h>
      469 +#ifndef __SIZE_TYPE__
      470 +#define __SIZE_TYPE__ int
      471 +#endif
      472 +struct sockaddr;
      473 +struct iovec;
      474 +struct timeval;
      475 +struct timezone;
      476 +int fprintf(FILE *, const char *, ...);
      477 +int getsockname(int, struct sockaddr *, int *);
      478 +int getpeername(int, struct sockaddr *, int *);
      479 +int socket(int, int, int);
      480 +int connect(int, const struct sockaddr *, int);
      481 +int writev(int, struct iovec *, int);
      482 +int readv(int, struct iovec *, int);
      483 +int send(int, const char *, int, int);
      484 +void bzero(char *, int);
      485 +int recvfrom(int, char *, int, int, struct sockaddr *, int *);
      486 +int syslog(int, const char *, ... );
      487 +int printf(const char *, ...);
      488 +__SIZE_TYPE__ fread(void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
      489 +__SIZE_TYPE__ fwrite(const void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
      490 +int fclose(FILE *);
      491 +int ungetc(int, FILE *);
      492 +int scanf(const char *, ...);
      493 +int sscanf(const char *, const char *, ... );
      494 +int tolower(int);
      495 +int toupper(int);
      496 +int strcasecmp(const char *, const char *);
      497 +int strncasecmp(const char *, const char *, int);
      498 +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
      499 +#ifdef gettimeofday
      500 +#undef gettimeofday
      501 +int gettimeofday(struct timeval *, struct timezone *);
      502 +#define gettimeofday isc__gettimeofday
      503 +#else
      504 +int gettimeofday(struct timeval *, struct timezone *);
      505 +#endif
      506 +long strtol(const char*, char **, int);
      507 +int fseek(FILE *, long, int);
      508 +int setsockopt(int, int, int, const char *, int);
      509 +int bind(int, const struct sockaddr *, int);
      510 +void bcopy(char *, char *, int);
      511 +int fputc(char, FILE *);
      512 +int listen(int, int);
      513 +int accept(int, struct sockaddr *, int *);
      514 +int getsockopt(int, int, int, char *, int *);
      515 +int vfprintf(FILE *, const char *, va_list);
      516 +int fflush(FILE *);
      517 +int fgetc(FILE *);
      518 +int fputs(const char *, FILE *);
      519 +int fchown(int, int, int);
      520 +void setbuf(FILE *, char *);
      521 +int gethostname(char *, int);
      522 +int rename(const char *, const char *);
      523 +time_t time(time_t *);
      524 +int fscanf(FILE *, const char *, ...);
      525 +int sscanf(const char *, const char *, ...);
      526 +int ioctl(int, int, caddr_t);
      527 +void perror(const char *);
      528 +
      529 +#if !defined(__USE_FIXED_PROTOTYPES__) && !defined(__cplusplus) && !defined(__STRICT_ANSI__)
      530 +/*
      531 + * 'gcc -ansi' changes the prototype for vsprintf().
      532 + * Use this prototype when 'gcc -ansi' is not in effect.
      533 + */
      534 +char *vsprintf(char *, const char *, va_list);
      535 +#endif
      536 +#endif
      537 +
      538 +/* Solaris-specific changes */
      539 +#include "sunw_port_after.h"
      540 +
      541 +#endif
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX