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 
14 typedef 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 */
28 typedef __SIZE_TYPE__ ssize_t;
29 #undef unsigned
30 
31 #endif
32 
33 #if !defined(__off_t_defined)
34 #define __off_t_defined
35 /* off_t is defined such that it matches the size of a pointer */
36 typedef __INTPTR_TYPE__ off_t;
37 #endif
38 
39 #if !defined(__time_t_defined)
40 #define __time_t_defined
41 typedef _TIME_T_ time_t;
42 #endif
43 
44 #if !defined(__suseconds_t_defined)
45 #define __suseconds_t_defined
46 typedef _SUSECONDS_T_ suseconds_t;
47 #endif
48 
49 #if !defined(__mem_word_t_defined)
50 #define __mem_word_t_defined
51 
52 /*
53  * The mem_word_t should match the optimal memory access word width
54  * on the target platform. Here we defaults it to uintptr_t.
55  */
56 
57 typedef uintptr_t mem_word_t;
58 
59 #define Z_MEM_WORD_T_WIDTH __INTPTR_WIDTH__
60 
61 #endif
62 
63 #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS_TYPES_H_ */
64