Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation
3 * Copyright (c) 2017 ARM Ltd
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS_TYPES_H_
9#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS_TYPES_H_
10
11#include <stdint.h>
12#include <sys/_types.h>
13
14typedef unsigned int mode_t;
15
16#if !defined(__ssize_t_defined)
17#define __ssize_t_defined
18
19/* Static code analysis tool can raise a violation
20 * in the line below where name of macro 'unsigned' is the same
21 * as keyword. It is made on purpose, deliberated deviation.
22 *
23 * We trick compiler to make sure the type of ssize_t won't be unsigned long.
24 * As otherwise the type of ssize_t will be unsigned long
25 * which is not correct. More details view in commit b889120
26 */
27#define unsigned signed /* parasoft-suppress MISRAC2012-RULE_20_4-a MISRAC2012-RULE_20_4-b */
28typedef __SIZE_TYPE__ ssize_t;
29#undef unsigned
30
31#endif
32
33#if !defined(__off_t_defined)
34#define __off_t_defined
35
36#if defined(__i386) || defined(__x86_64) || defined(__ARC64__)
37typedef long int off_t; /* "long" works for all of i386, X32 and true 64 bit */
38#elif defined(__ARM_ARCH)
39typedef int off_t;
40#elif defined(__arc__)
41typedef int off_t;
42#elif defined(__NIOS2__)
43typedef int off_t;
44#elif defined(__riscv)
45typedef int off_t;
46#elif defined(__XTENSA__)
47typedef int off_t;
48#elif defined(__sparc__)
49typedef int off_t;
50#else
51#error "The minimal libc library does not recognize the architecture!\n"
52#endif
53
54#endif
55
56#if !defined(__time_t_defined)
57#define __time_t_defined
58typedef _TIME_T_ time_t;
59#endif
60
61#if !defined(__suseconds_t_defined)
62#define __suseconds_t_defined
63typedef _SUSECONDS_T_ suseconds_t;
64#endif
65
66#if !defined(__mem_word_t_defined)
67#define __mem_word_t_defined
68
69/*
70 * The mem_word_t should match the optimal memory access word width
71 * on the target platform. Here we defaults it to uintptr_t.
72 */
73
75
76#define Z_MEM_WORD_T_WIDTH __INTPTR_WIDTH__
77
78#endif
79
80#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS_TYPES_H_ */
uintptr_t mem_word_t
Definition: types.h:74
__SIZE_TYPE__ ssize_t
Definition: types.h:28
_TIME_T_ time_t
Definition: types.h:58
_SUSECONDS_T_ suseconds_t
Definition: types.h:63
unsigned int mode_t
Definition: types.h:14
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:75