sys_base_types.h (3154B)
1 /* SPDX-License-Identifier: LGPL-2.1-or-later OR (GPL-2.0-or-later WITH eCos-exception-2.0) */ 2 /* 3 This file is part of GNU libmicrohttpd. 4 Copyright (C) 2024 Evgeny Grin (Karlson2k) 5 6 GNU libmicrohttpd is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 GNU libmicrohttpd is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 Alternatively, you can redistribute GNU libmicrohttpd and/or 17 modify it under the terms of the GNU General Public License as 18 published by the Free Software Foundation; either version 2 of 19 the License, or (at your option) any later version, together 20 with the eCos exception, as follows: 21 22 As a special exception, if other files instantiate templates or 23 use macros or inline functions from this file, or you compile this 24 file and link it with other works to produce a work based on this 25 file, this file does not by itself cause the resulting work to be 26 covered by the GNU General Public License. However the source code 27 for this file must still be made available in accordance with 28 section (3) of the GNU General Public License v2. 29 30 This exception does not invalidate any other reasons why a work 31 based on this file might be covered by the GNU General Public 32 License. 33 34 You should have received copies of the GNU Lesser General Public 35 License and the GNU General Public License along with this library; 36 if not, see <https://www.gnu.org/licenses/>. 37 */ 38 39 /** 40 * @file src/mhd2/sys_base_types.h 41 * @brief The header for basic system types and the NULL constant 42 * @author Karlson2k (Evgeny Grin) 43 * 44 * This header should provide macros or typedefs for uint_fastXX_t, int_fastXX_t 45 * size_t, ssize_t and NULL. 46 */ 47 48 #ifndef MHD_SYS_BASE_TYPES_H 49 #define MHD_SYS_BASE_TYPES_H 1 50 51 #include "mhd_sys_options.h" 52 53 #if defined(HAVE_SYS_TYPES_H) 54 # include <sys/types.h> /* ssize_t */ 55 #elif defined(HAVE_UNISTD_H) 56 # include <unistd.h> /* should provide ssize_t */ 57 #endif 58 #include <stdint.h> /* uint_fast_XXt, int_fast_XXt */ 59 60 #include "sys_null_macro.h" 61 #include "sys_sizet_type.h" 62 63 #ifdef HAVE_CRTDEFS_H 64 # include <crtdefs.h> /* W32-specific header */ 65 #endif 66 #ifdef HAVE_INTTYPES_H 67 # include <inttypes.h> 68 #endif 69 70 #ifndef HAVE_SSIZE_T 71 # if defined(HAVE_PTRDIFF_T) 72 typedef ptrdiff_t ssize_t; 73 # elif defined(HAVE_INTPTR_T) 74 /* Not an ideal choice, the size of the largest allocation may be smaller 75 than the total size of the addressable memory. */ 76 typedef intptr_t ssize_t; 77 # else 78 # error Cannot find suitable 'ssize_t' replacement 79 # endif 80 # define HAVE_SSIZE_T 1 81 # ifdef _WIN32 82 # define _SSIZE_T_DEFINED 83 # endif 84 #endif /* ! HAVE_SSIZE_T */ 85 86 #ifndef PRIuFAST64 87 # ifdef PRIu64 88 # define PRIuFAST64 PRIu64 89 # else 90 # define PRIuFAST64 "llu" 91 # endif 92 #endif 93 94 #endif /* ! MHD_SYS_BASE_TYPES_H */