1 /* @(#)utypes.h 1.38 21/07/11 Copyright 1997-2021 J. Schilling */ 2 /* 3 * Definitions for some user defined types 4 * 5 * Copyright (c) 1997-2021 J. Schilling 6 */ 7 /* 8 * The contents of this file are subject to the terms of the 9 * Common Development and Distribution License, Version 1.0 only 10 * (the "License"). You may not use this file except in compliance 11 * with the License. 12 * 13 * See the file CDDL.Schily.txt in this distribution for details. 14 * A copy of the CDDL is also available via the Internet at 15 * http://www.opensource.org/licenses/cddl1.txt 16 * 17 * When distributing Covered Code, include this CDDL HEADER in each 18 * file and include the License file CDDL.Schily.txt from this distribution. 19 */ 20 21 #ifndef _SCHILY_UTYPES_H 22 #define _SCHILY_UTYPES_H 23 24 #ifndef _SCHILY_MCONFIG_H 25 #include <schily/mconfig.h> 26 #endif 27 28 /* 29 * uypes.h is based on inttypes.h 30 */ 31 #ifndef _SCHILY_INTTYPES_H 32 #include <schily/inttypes.h> 33 #endif 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /* 40 * Several unsigned cardinal types 41 */ 42 typedef unsigned long Ulong; 43 typedef unsigned int Uint; 44 typedef unsigned short Ushort; 45 typedef unsigned char Uchar; 46 47 /* 48 * The IBM AIX C-compiler seems to be the only compiler on the world 49 * which does not allow to use unsigned char bit fields as a hint 50 * for packed bit fields. Define a pesical type to avoid warnings. 51 * The packed attribute is honored wit unsigned int in this case too. 52 * 53 * The z/OS compiler acts like the AIX compiler with regards to 54 * packed bit fields. __MVS__ is the internal #define from c99 on OS390. 55 */ 56 #if (defined(_AIX) || defined(OS390) || defined(__MVS__)) && \ 57 !defined(__GNUC__) 58 59 typedef unsigned int Ucbit; 60 61 #else 62 63 typedef unsigned char Ucbit; 64 65 #endif 66 67 #ifdef __BAD_CHAR_SIGNED__ /* From <schily/stdint.h> */ 68 #undef CHAR_MIN /* Solaris is wrong */ 69 #undef CHAR_MAX 70 #endif 71 72 #ifndef CHAR_MIN 73 #define CHAR_MIN TYPE_MINVAL(char) 74 #endif 75 #ifndef CHAR_MAX 76 #define CHAR_MAX TYPE_MAXVAL(char) 77 #endif 78 #ifndef UCHAR_MAX 79 #define UCHAR_MAX TYPE_MAXVAL(unsigned char) 80 #endif 81 82 #ifndef SHRT_MIN 83 #define SHRT_MIN TYPE_MINVAL(short) 84 #endif 85 #ifndef SHRT_MAX 86 #define SHRT_MAX TYPE_MAXVAL(short) 87 #endif 88 #ifndef USHRT_MAX 89 #define USHRT_MAX TYPE_MAXVAL(unsigned short) 90 #endif 91 92 #ifndef INT_MIN 93 #define INT_MIN TYPE_MINVAL(int) 94 #endif 95 #ifndef INT_MAX 96 #define INT_MAX TYPE_MAXVAL(int) 97 #endif 98 #ifndef UINT_MAX 99 #define UINT_MAX TYPE_MAXVAL(unsigned int) 100 #endif 101 102 #ifndef LONG_MIN 103 #define LONG_MIN TYPE_MINVAL(long) 104 #endif 105 #ifndef LONG_MAX 106 #define LONG_MAX TYPE_MAXVAL(long) 107 #endif 108 #ifndef ULONG_MAX 109 #define ULONG_MAX TYPE_MAXVAL(unsigned long) 110 #endif 111 112 #define OFF_T_MIN TYPE_MINVAL(off_t) 113 #define OFF_T_MAX TYPE_MAXVAL(off_t) 114 115 #define UID_T_MIN TYPE_MINVAL(uid_t) 116 #define UID_T_MAX TYPE_MAXVAL(uid_t) 117 118 #define GID_T_MIN TYPE_MINVAL(gid_t) 119 #define GID_T_MAX TYPE_MAXVAL(gid_t) 120 121 #define PID_T_MIN TYPE_MINVAL(pid_t) 122 #define PID_T_MAX TYPE_MAXVAL(pid_t) 123 124 #define MODE_T_MIN TYPE_MINVAL(mode_t) 125 #define MODE_T_MAX TYPE_MAXVAL(mode_t) 126 127 #define TIME_T_MIN TYPE_MINVAL(time_t) 128 #define TIME_T_MAX TYPE_MAXVAL(time_t) 129 130 #define CADDR_T_MIN TYPE_MINVAL(caddr_t) 131 #define CADDR_T_MAX TYPE_MAXVAL(caddr_t) 132 133 #define DADDR_T_MIN TYPE_MINVAL(daddr_t) 134 #define DADDR_T_MAX TYPE_MAXVAL(daddr_t) 135 136 #define DEV_T_MIN TYPE_MINVAL(dev_t) 137 #define DEV_T_MAX TYPE_MAXVAL(dev_t) 138 139 #define MAJOR_T_MIN TYPE_MINVAL(major_t) 140 #define MAJOR_T_MAX TYPE_MAXVAL(major_t) 141 142 #define MINOR_T_MIN TYPE_MINVAL(minor_t) 143 #define MINOR_T_MAX TYPE_MAXVAL(minor_t) 144 145 #define INO_T_MIN TYPE_MINVAL(ino_t) 146 #define INO_T_MAX TYPE_MAXVAL(ino_t) 147 148 #define NLINK_T_MIN TYPE_MINVAL(nlink_t) 149 #define NLINK_T_MAX TYPE_MAXVAL(nlink_t) 150 151 #define BLKSIZE_T_MIN TYPE_MINVAL(blksize_t) 152 #define BLKSIZE_T_MAX TYPE_MAXVAL(blksize_t) 153 154 #define BLKCNT_T_MIN TYPE_MINVAL(blkcnt_t) 155 #define BLKCNT_T_MAX TYPE_MAXVAL(blkcnt_t) 156 157 #define CLOCK_T_MIN TYPE_MINVAL(clock_t) 158 #define CLOCK_T_MAX TYPE_MAXVAL(clock_t) 159 160 #define SOCKLEN_T_MIN TYPE_MINVAL(socklen_t) 161 #define SOCKLEN_T_MAX TYPE_MAXVAL(socklen_t) 162 163 #ifdef __cplusplus 164 } 165 #endif 166 167 #endif /* _SCHILY_UTYPES_H */ 168