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