17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 37c478bd9Sstevel@tonic-gate * Use is subject to license terms. 47c478bd9Sstevel@tonic-gate */ 57c478bd9Sstevel@tonic-gate 67c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 77c478bd9Sstevel@tonic-gate 87c478bd9Sstevel@tonic-gate #ifndef PORT_AFTER_H 97c478bd9Sstevel@tonic-gate #define PORT_AFTER_H 107c478bd9Sstevel@tonic-gate #include "os_version.h" 117c478bd9Sstevel@tonic-gate 127c478bd9Sstevel@tonic-gate #undef HAVE_SA_LEN 137c478bd9Sstevel@tonic-gate #define USE_POSIX 147c478bd9Sstevel@tonic-gate #define POSIX_SIGNALS 157c478bd9Sstevel@tonic-gate #define NETREAD_BROKEN 167c478bd9Sstevel@tonic-gate #define USE_WAITPID 177c478bd9Sstevel@tonic-gate #define HAVE_FCHMOD 187c478bd9Sstevel@tonic-gate #define NEED_PSELECT 197c478bd9Sstevel@tonic-gate #define SETGRENT_VOID 207c478bd9Sstevel@tonic-gate #define SETPWENT_VOID 217c478bd9Sstevel@tonic-gate #define SIOCGIFCONF_ADDR 227c478bd9Sstevel@tonic-gate #define IP_OPT_BUF_SIZE 40 237c478bd9Sstevel@tonic-gate #define HAVE_CHROOT 247c478bd9Sstevel@tonic-gate #define CAN_CHANGE_ID 257c478bd9Sstevel@tonic-gate #define POSIX_GETPWNAM_R 267c478bd9Sstevel@tonic-gate #define POSIX_GETPWUID_R 277c478bd9Sstevel@tonic-gate #define POSIX_GETGRGID_R 287c478bd9Sstevel@tonic-gate #define POSIX_GETGRNAM_R 297c478bd9Sstevel@tonic-gate #define NEED_SECURE_DIRECTORY 307c478bd9Sstevel@tonic-gate #define HAVE_DEV_RANDOM 317c478bd9Sstevel@tonic-gate #define NO_MSG_CONTROL 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #define PORT_NONBLOCK O_NONBLOCK 347c478bd9Sstevel@tonic-gate #define PORT_WOULDBLK EWOULDBLOCK 357c478bd9Sstevel@tonic-gate #define WAIT_T int 367c478bd9Sstevel@tonic-gate #ifndef SUNW_LIBNSL 377c478bd9Sstevel@tonic-gate #define INADDR_NONE 0xffffffff 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #include <sys/types.h> 417c478bd9Sstevel@tonic-gate #include <sys/socket.h> 427c478bd9Sstevel@tonic-gate #include <sys/param.h> 437c478bd9Sstevel@tonic-gate #if (!defined(BSD)) || (BSD < 199306) 447c478bd9Sstevel@tonic-gate #include <sys/bitypes.h> 457c478bd9Sstevel@tonic-gate #endif 467c478bd9Sstevel@tonic-gate #include <sys/time.h> 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #ifndef MIN 497c478bd9Sstevel@tonic-gate #define MIN(x, y) ((x > y) ?y :x) 507c478bd9Sstevel@tonic-gate #endif 517c478bd9Sstevel@tonic-gate #ifndef MAX 527c478bd9Sstevel@tonic-gate #define MAX(x, y) ((x > y) ?x :y) 537c478bd9Sstevel@tonic-gate #endif 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * We need to know the IPv6 address family number even on IPv4-only systems. 577c478bd9Sstevel@tonic-gate * Note that this is NOT a protocol constant, and that if the system has its 587c478bd9Sstevel@tonic-gate * own AF_INET6, different from ours below, all of BIND's libraries and 597c478bd9Sstevel@tonic-gate * executables will need to be recompiled after the system <sys/socket.h> 607c478bd9Sstevel@tonic-gate * has had this type added. The type number below is correct on most BSD- 617c478bd9Sstevel@tonic-gate * derived systems for which AF_INET6 is defined. 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate #ifndef AF_INET6 647c478bd9Sstevel@tonic-gate #define AF_INET6 24 657c478bd9Sstevel@tonic-gate #endif 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate #ifndef PF_INET6 687c478bd9Sstevel@tonic-gate #define PF_INET6 AF_INET6 697c478bd9Sstevel@tonic-gate #endif 707c478bd9Sstevel@tonic-gate #include <port_ipv6.h> 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate #ifndef HAS_INET6_STRUCTS 737c478bd9Sstevel@tonic-gate /* Replace with structure from later rev of O/S if known. */ 747c478bd9Sstevel@tonic-gate struct in6_addr { 757c478bd9Sstevel@tonic-gate u_int8_t s6_addr[16]; 767c478bd9Sstevel@tonic-gate }; 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate /* Replace with structure from later rev of O/S if known. */ 797c478bd9Sstevel@tonic-gate struct sockaddr_in6 { 807c478bd9Sstevel@tonic-gate #ifdef HAVE_SA_LEN 817c478bd9Sstevel@tonic-gate u_int8_t sin6_len; /* length of this struct */ 827c478bd9Sstevel@tonic-gate u_int8_t sin6_family; /* AF_INET6 */ 837c478bd9Sstevel@tonic-gate #else 847c478bd9Sstevel@tonic-gate u_int16_t sin6_family; /* AF_INET6 */ 857c478bd9Sstevel@tonic-gate #endif 867c478bd9Sstevel@tonic-gate u_int16_t sin6_port; /* transport layer port # */ 877c478bd9Sstevel@tonic-gate u_int32_t sin6_flowinfo; /* IPv6 flow information */ 887c478bd9Sstevel@tonic-gate struct in6_addr sin6_addr; /* IPv6 address */ 897c478bd9Sstevel@tonic-gate u_int32_t sin6_scope_id; /* set of interfaces for a scope */ 907c478bd9Sstevel@tonic-gate }; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #ifndef IN6ADDR_ANY_INIT 937c478bd9Sstevel@tonic-gate #define IN6ADDR_ANY_INIT {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} 947c478bd9Sstevel@tonic-gate #endif 957c478bd9Sstevel@tonic-gate #ifndef IN6ADDR_LOOPBACK_INIT 967c478bd9Sstevel@tonic-gate #define IN6ADDR_LOOPBACK_INIT {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}} 977c478bd9Sstevel@tonic-gate #endif 987c478bd9Sstevel@tonic-gate #endif /* HAS_INET6_STRUCTS */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #if defined(NEED_SOCKADDR_STORAGE) || !defined(HAS_INET6_STRUCTS) 1017c478bd9Sstevel@tonic-gate #define __SS_MAXSIZE 128 1027c478bd9Sstevel@tonic-gate #define __SS_ALLIGSIZE (sizeof (long)) 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate struct sockaddr_storage { 1057c478bd9Sstevel@tonic-gate #ifdef HAVE_SA_LEN 1067c478bd9Sstevel@tonic-gate u_int8_t ss_len; /* address length */ 1077c478bd9Sstevel@tonic-gate u_int8_t ss_family; /* address family */ 1087c478bd9Sstevel@tonic-gate char __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof (u_int8_t)]; 1097c478bd9Sstevel@tonic-gate long __ss_align; 1107c478bd9Sstevel@tonic-gate char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE]; 1117c478bd9Sstevel@tonic-gate #else 1127c478bd9Sstevel@tonic-gate u_int16_t ss_family; /* address family */ 1137c478bd9Sstevel@tonic-gate char __ss_pad1[__SS_ALLIGSIZE - sizeof (u_int16_t)]; 1147c478bd9Sstevel@tonic-gate long __ss_align; 1157c478bd9Sstevel@tonic-gate char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE]; 1167c478bd9Sstevel@tonic-gate #endif 1177c478bd9Sstevel@tonic-gate }; 1187c478bd9Sstevel@tonic-gate #endif 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate #if !defined(HAS_INET6_STRUCTS) || defined(NEED_IN6ADDR_ANY) 1227c478bd9Sstevel@tonic-gate #define in6addr_any isc_in6addr_any 1237c478bd9Sstevel@tonic-gate extern const struct in6_addr in6addr_any; 1247c478bd9Sstevel@tonic-gate #endif 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate #ifndef IN6_ARE_ADDR_EQUAL 1277c478bd9Sstevel@tonic-gate #define IN6_ARE_ADDR_EQUAL(a, b) \ 1287c478bd9Sstevel@tonic-gate (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) == 0) 1297c478bd9Sstevel@tonic-gate #endif 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_UNSPECIFIED 1327c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_UNSPECIFIED(a) \ 1337c478bd9Sstevel@tonic-gate IN6_ARE_ADDR_EQUAL(a, &in6addr_any) 1347c478bd9Sstevel@tonic-gate #endif 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_LOOPBACK 1377c478bd9Sstevel@tonic-gate extern const struct in6_addr isc_in6addr_loopback; 1387c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_LOOPBACK(a) \ 1397c478bd9Sstevel@tonic-gate IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback) 1407c478bd9Sstevel@tonic-gate #endif 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_V4COMPAT 1437c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_V4COMPAT(a) \ 1447c478bd9Sstevel@tonic-gate ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \ 1457c478bd9Sstevel@tonic-gate (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \ 1467c478bd9Sstevel@tonic-gate (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \ 1477c478bd9Sstevel@tonic-gate (a)->s6_addr[6] == 0x00 && (a)->s6_addr[7] == 0x00 && \ 1487c478bd9Sstevel@tonic-gate (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \ 1497c478bd9Sstevel@tonic-gate (a)->s6_addr[10] == 0x00 && (a)->s6_addr[11] == 0x00 && \ 1507c478bd9Sstevel@tonic-gate ((a)->s6_addr[12] != 0x00 || (a)->s6_addr[13] != 0x00 || \ 1517c478bd9Sstevel@tonic-gate (a)->s6_addr[14] != 0x00 || \ 1527c478bd9Sstevel@tonic-gate ((a)->s6_addr[15] != 0x00 && (a)->s6_addr[15] != 1))) 1537c478bd9Sstevel@tonic-gate #endif 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_V4MAPPED 1567c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_V4MAPPED(a) \ 1577c478bd9Sstevel@tonic-gate ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \ 1587c478bd9Sstevel@tonic-gate (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \ 1597c478bd9Sstevel@tonic-gate (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \ 1607c478bd9Sstevel@tonic-gate (a)->s6_addr[6] == 0x00 && (a)->s6_addr[7] == 0x00 && \ 1617c478bd9Sstevel@tonic-gate (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \ 1627c478bd9Sstevel@tonic-gate (a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff) 1637c478bd9Sstevel@tonic-gate #endif 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_SITELOCAL 1667c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_SITELOCAL(a) \ 1677c478bd9Sstevel@tonic-gate (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) 1687c478bd9Sstevel@tonic-gate #endif 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_LINKLOCAL 1717c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_LINKLOCAL(a) \ 1727c478bd9Sstevel@tonic-gate (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) 1737c478bd9Sstevel@tonic-gate #endif 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MULTICAST 1767c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) 1777c478bd9Sstevel@tonic-gate #endif 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_MC_SCOPE 1807c478bd9Sstevel@tonic-gate #define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) 1817c478bd9Sstevel@tonic-gate #endif 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_SCOPE_SITELOCAL 1847c478bd9Sstevel@tonic-gate #define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 1857c478bd9Sstevel@tonic-gate #endif 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #ifndef __IPV6_ADDR_SCOPE_ORGLOCAL 1887c478bd9Sstevel@tonic-gate #define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 1897c478bd9Sstevel@tonic-gate #endif 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MC_SITELOCAL 1927c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_MC_SITELOCAL(a) \ 1937c478bd9Sstevel@tonic-gate (IN6_IS_ADDR_MULTICAST(a) && \ 1947c478bd9Sstevel@tonic-gate (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) 1957c478bd9Sstevel@tonic-gate #endif 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate #ifndef IN6_IS_ADDR_MC_ORGLOCAL 1987c478bd9Sstevel@tonic-gate #define IN6_IS_ADDR_MC_ORGLOCAL(a) \ 1997c478bd9Sstevel@tonic-gate (IN6_IS_ADDR_MULTICAST(a) && \ 2007c478bd9Sstevel@tonic-gate (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) 2017c478bd9Sstevel@tonic-gate #endif 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate #ifndef INET6_ADDRSTRLEN 2047c478bd9Sstevel@tonic-gate #define INET6_ADDRSTRLEN 46 2057c478bd9Sstevel@tonic-gate #endif 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate /* 2087c478bd9Sstevel@tonic-gate * Prior to 2.6, Solaris needs a prototype for gethostname(). 2097c478bd9Sstevel@tonic-gate */ 2107c478bd9Sstevel@tonic-gate #if (OS_MAJOR == 5 && OS_MINOR < 6) 2117c478bd9Sstevel@tonic-gate extern int gethostname(char *, size_t); 2127c478bd9Sstevel@tonic-gate #endif 2137c478bd9Sstevel@tonic-gate /* 2147c478bd9Sstevel@tonic-gate * gethostid() was not available until 2.5 2157c478bd9Sstevel@tonic-gate * setsockopt(SO_REUSEADDR) fails on unix domain sockets before 2.5 2167c478bd9Sstevel@tonic-gate * use ioctl(FIONBIO) rather than fcntl() calls to set/clear non-blocking i/o. 2177c478bd9Sstevel@tonic-gate */ 2187c478bd9Sstevel@tonic-gate #if (OS_MAJOR == 5 && OS_MINOR < 5) 2197c478bd9Sstevel@tonic-gate #define GET_HOST_ID_MISSING 2207c478bd9Sstevel@tonic-gate #define NO_UNIX_REUSEADDR 2217c478bd9Sstevel@tonic-gate #define USE_FIONBIO_IOCTL 2227c478bd9Sstevel@tonic-gate #endif 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate #define NEED_STRSEP 2257c478bd9Sstevel@tonic-gate extern char *strsep(char **, const char *); 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate #define NEED_DAEMON 2287c478bd9Sstevel@tonic-gate int daemon(int nochdir, int noclose); 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate /* 2317c478bd9Sstevel@tonic-gate * Solaris defines this in <netdb.h> instead of in <sys/param.h>. We don't 2327c478bd9Sstevel@tonic-gate * define it in our <netdb.h>, so we define it here. 2337c478bd9Sstevel@tonic-gate */ 2347c478bd9Sstevel@tonic-gate #ifndef MAXHOSTNAMELEN 2357c478bd9Sstevel@tonic-gate #define MAXHOSTNAMELEN 256 2367c478bd9Sstevel@tonic-gate #endif 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate /* 2397c478bd9Sstevel@tonic-gate * Solaris 2.5 and later have getrlimit(), setrlimit() and getrusage(). 2407c478bd9Sstevel@tonic-gate */ 2417c478bd9Sstevel@tonic-gate #if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 5)) 2427c478bd9Sstevel@tonic-gate #include <sys/resource.h> 2437c478bd9Sstevel@tonic-gate #define HAVE_GETRUSAGE 2447c478bd9Sstevel@tonic-gate #define RLIMIT_TYPE rlim_t 2457c478bd9Sstevel@tonic-gate #define RLIMIT_FILE_INFINITY 2467c478bd9Sstevel@tonic-gate #endif 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate #include <resolv_mt.h> 2497c478bd9Sstevel@tonic-gate #include <netdb_private.h> 2507c478bd9Sstevel@tonic-gate #include <inet_private.h> 2517c478bd9Sstevel@tonic-gate #include <ctype.h> 2527c478bd9Sstevel@tonic-gate #include <sunw_dst_init.h> 2537c478bd9Sstevel@tonic-gate #include <sunw_irs_init.h> 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate #ifdef ORIGINAL_ISC_CODE 2567c478bd9Sstevel@tonic-gate const char *isc_strerror(int errnum); 2577c478bd9Sstevel@tonic-gate #define strerror isc_strerror 2587c478bd9Sstevel@tonic-gate #endif 2597c478bd9Sstevel@tonic-gate 2607c478bd9Sstevel@tonic-gate #ifndef ISC_FACILITY 2617c478bd9Sstevel@tonic-gate #define ISC_FACILITY LOG_DAEMON 2627c478bd9Sstevel@tonic-gate #endif 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate /* res_mkquery.c refers explicitly to __putlong and __putshort */ 2657c478bd9Sstevel@tonic-gate #define __putlong putlong 2667c478bd9Sstevel@tonic-gate #define __putshort putshort 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate /* 2697c478bd9Sstevel@tonic-gate * If one wanted to use isc__gettimeofday for Solaris, they would 2707c478bd9Sstevel@tonic-gate * need to define NEED_GETTIMEOFDAY (common/bsd/gettimeofday.c), 2717c478bd9Sstevel@tonic-gate * which is not defined for Solaris. Hence there is no reason to 2727c478bd9Sstevel@tonic-gate * change the current definition of gettimeofday which currently 2737c478bd9Sstevel@tonic-gate * comes from libc and we comment the following out. 2747c478bd9Sstevel@tonic-gate */ 2757c478bd9Sstevel@tonic-gate #ifdef ORIGINAL_ISC_CODE 2767c478bd9Sstevel@tonic-gate int isc__gettimeofday(struct timeval *, struct timezone *); 2777c478bd9Sstevel@tonic-gate #define gettimeofday isc__gettimeofday 2787c478bd9Sstevel@tonic-gate #endif 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate /* 2817c478bd9Sstevel@tonic-gate * Solaris 8 has if_nametoindex(). 2827c478bd9Sstevel@tonic-gate */ 2837c478bd9Sstevel@tonic-gate #if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 8)) 2847c478bd9Sstevel@tonic-gate #define USE_IFNAMELINKID 2857c478bd9Sstevel@tonic-gate #endif 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate #define UNUSED(x) (x) = (x) 2887c478bd9Sstevel@tonic-gate #define DE_CONST(konst, var) \ 2897c478bd9Sstevel@tonic-gate do { \ 2907c478bd9Sstevel@tonic-gate union { const void *k; void *v; } _u; \ 2917c478bd9Sstevel@tonic-gate _u.k = konst; \ 2927c478bd9Sstevel@tonic-gate var = _u.v; \ 2937c478bd9Sstevel@tonic-gate } while (0) 294*6a1c6faaSanay 295*6a1c6faaSanay #ifndef ALIGN 296*6a1c6faaSanay #if (OS_MAJOR == 5 && OS_MINOR > 8) 297*6a1c6faaSanay #define ALIGN(x) (((uintptr_t)(x) + (sizeof(char*) - 1UL)) & ~(sizeof(char*) - 1UL)) 298*6a1c6faaSanay #else 299*6a1c6faaSanay #define ALIGN(x) (((unsigned long)(x) + (sizeof(char*) - 1UL)) & ~(sizeof(char*) - 1UL)) 300*6a1c6faaSanay #endif 301*6a1c6faaSanay #endif 302*6a1c6faaSanay 3037c478bd9Sstevel@tonic-gate #endif /* ! PORT_AFTER_H */ 304