1/* 2 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 3 * 4 * SPDX-License-Identifier: MPL-2.0 5 * 6 * This Source Code Form is subject to the terms of the Mozilla Public 7 * License, v. 2.0. If a copy of the MPL was not distributed with this 8 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 9 * 10 * See the COPYRIGHT file distributed with this work for additional 11 * information regarding copyright ownership. 12 */ 13 14#ifndef ISC_PLATFORM_H 15#define ISC_PLATFORM_H 1 16 17/***** 18 ***** Platform-dependent defines. 19 *****/ 20 21#if _MSC_VER > 1400 22#define HAVE_TLS 1 23#define HAVE___DECLSPEC_THREAD 1 24#endif 25 26/* 27 * Some compatibility cludges 28 */ 29 30#if defined(_WIN32) || defined(_WIN64) 31/* We are on Windows */ 32# define strtok_r strtok_s 33 34#define ISC_STRERRORSIZE 128 35 36#ifndef strtoull 37#define strtoull _strtoui64 38#endif 39 40#include <stdint.h> 41#if _MSC_VER < 1914 42typedef uint32_t socklen_t; 43#endif 44 45#endif 46 47#define __builtin_unreachable() __assume(0) 48 49/* 50 * Remove __attribute__ ((foo)) on Windows 51 */ 52 53#define __attribute__(attribute) /* do nothing */ 54 55/* 56 * Limits 57 */ 58 59#ifndef NAME_MAX 60#define NAME_MAX _MAX_FNAME 61#endif 62 63#ifndef PATH_MAX 64#define PATH_MAX _MAX_PATH 65#endif 66 67/*** 68 *** Network. 69 ***/ 70 71#undef MSG_TRUNC 72 73typedef uint16_t sa_family_t; 74 75/* 76 * Define if the platform has <sys/un.h>. 77 */ 78#undef ISC_PLATFORM_HAVESYSUNH 79 80/* 81 * Defines for the noreturn attribute. 82 */ 83#define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn) 84#define ISC_PLATFORM_NORETURN_POST 85 86/* 87 * Set up a macro for importing and exporting from the DLL 88 */ 89 90#ifdef LIBISC_EXPORTS 91#define LIBISC_EXTERNAL_DATA __declspec(dllexport) 92#else 93#define LIBISC_EXTERNAL_DATA __declspec(dllimport) 94#endif 95 96#ifdef LIBDNS_EXPORTS 97#define LIBDNS_EXTERNAL_DATA __declspec(dllexport) 98#else 99#define LIBDNS_EXTERNAL_DATA __declspec(dllimport) 100#endif 101 102#ifdef LIBISCCC_EXPORTS 103#define LIBISCCC_EXTERNAL_DATA __declspec(dllexport) 104#else 105#define LIBISCCC_EXTERNAL_DATA __declspec(dllimport) 106#endif 107 108#ifdef LIBISCCFG_EXPORTS 109#define LIBISCCFG_EXTERNAL_DATA __declspec(dllexport) 110#else 111#define LIBISCCFG_EXTERNAL_DATA __declspec(dllimport) 112#endif 113 114#ifdef LIBNS_EXPORTS 115#define LIBNS_EXTERNAL_DATA __declspec(dllexport) 116#else 117#define LIBNS_EXTERNAL_DATA __declspec(dllimport) 118#endif 119 120#ifdef LIBBIND9_EXPORTS 121#define LIBBIND9_EXTERNAL_DATA __declspec(dllexport) 122#else 123#define LIBBIND9_EXTERNAL_DATA __declspec(dllimport) 124#endif 125 126#ifdef LIBTESTS_EXPORTS 127#define LIBTESTS_EXTERNAL_DATA __declspec(dllexport) 128#else 129#define LIBTESTS_EXTERNAL_DATA __declspec(dllimport) 130#endif 131 132#endif /* ISC_PLATFORM_H */ 133