xref: /relibc/src/platform/types.rs (revision be35961d82cd98f2a2e61c4f1869271b9f4af571)
1 use core::i32;
2 
3 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
4 // more optimization opportunities around it recognizing things like
5 // malloc/free.
6 #[repr(u8)]
7 pub enum c_void {
8     // Two dummy variants so the #[repr] attribute can be used.
9     #[doc(hidden)]
10     __variant1,
11     #[doc(hidden)]
12     __variant2,
13 }
14 
15 pub type int8_t = i8;
16 pub type int16_t = i16;
17 pub type int32_t = i32;
18 pub type int64_t = i64;
19 pub type uint8_t = u8;
20 pub type uint16_t = u16;
21 pub type uint32_t = u32;
22 pub type uint64_t = u64;
23 
24 pub type c_schar = i8;
25 pub type c_uchar = u8;
26 pub type c_short = i16;
27 pub type c_ushort = u16;
28 pub type c_int = i32;
29 pub type c_uint = u32;
30 pub type c_float = f32;
31 pub type c_double = f64;
32 pub type c_longlong = i64;
33 pub type c_ulonglong = u64;
34 pub type intmax_t = i64;
35 pub type uintmax_t = u64;
36 
37 pub type size_t = usize;
38 pub type ptrdiff_t = isize;
39 pub type intptr_t = isize;
40 pub type uintptr_t = usize;
41 pub type ssize_t = isize;
42 
43 pub type c_char = i8;
44 #[cfg(target_pointer_width = "32")]
45 pub type c_long = i32;
46 #[cfg(target_pointer_width = "32")]
47 pub type c_ulong = u32;
48 #[cfg(target_pointer_width = "64")]
49 pub type c_long = i64;
50 #[cfg(target_pointer_width = "64")]
51 pub type c_ulong = u64;
52 
53 pub type wchar_t = i32;
54 pub type wint_t = u32;
55 
56 pub type regoff_t = size_t;
57 pub type off_t = c_longlong;
58 pub type mode_t = c_int;
59 pub type time_t = c_longlong;
60 pub type pid_t = c_int;
61 pub type id_t = c_uint;
62 pub type gid_t = c_int;
63 pub type uid_t = c_int;
64 pub type dev_t = c_long;
65 pub type ino_t = c_ulong;
66 pub type nlink_t = c_ulong;
67 pub type blksize_t = c_long;
68 pub type blkcnt_t = c_ulong;
69 
70 pub type fsblkcnt_t = c_ulong;
71 pub type fsfilcnt_t = c_ulong;
72 
73 pub type useconds_t = c_uint;
74 pub type suseconds_t = c_int;
75 
76 pub type clock_t = c_long;
77 pub type clockid_t = c_int;
78 pub type timer_t = *mut c_void;
79