1 use crate::prelude::*;
2 
3 /// L4Re specifics
4 /// This module contains definitions required by various L4Re libc backends.
5 /// Some of them are formally not part of the libc, but are a dependency of the
6 /// libc and hence we should provide them here.
7 
8 pub type l4_umword_t = c_ulong; // Unsigned machine word.
9 pub type pthread_t = *mut c_void;
10 
11 s! {
12     /// CPU sets.
13     pub struct l4_sched_cpu_set_t {
14         // from the L4Re docs
15         /// Combination of granularity and offset.
16         ///
17         /// The granularity defines how many CPUs each bit in map describes.
18         /// The offset is the number of the first CPU described by the first
19         /// bit in the bitmap.
20         /// offset must be a multiple of 2^graularity.
21         ///
22         /// | MSB              |                 LSB |
23         /// | ---------------- | ------------------- |
24         /// | 8bit granularity | 24bit offset ..     |
25         gran_offset: l4_umword_t,
26         /// Bitmap of CPUs.
27         map: l4_umword_t,
28     }
29 }
30 
31 #[allow(missing_debug_implementations)]
32 pub struct pthread_attr_t {
33     pub __detachstate: c_int,
34     pub __schedpolicy: c_int,
35     pub __schedparam: super::__sched_param,
36     pub __inheritsched: c_int,
37     pub __scope: c_int,
38     pub __guardsize: size_t,
39     pub __stackaddr_set: c_int,
40     pub __stackaddr: *mut c_void, // better don't use it
41     pub __stacksize: size_t,
42     // L4Re specifics
43     pub affinity: l4_sched_cpu_set_t,
44     pub create_flags: c_uint,
45 }
46 
47 // L4Re requires a min stack size of 64k; that isn't defined in uClibc, but
48 // somewhere in the core libraries. uClibc wants 16k, but that's not enough.
49 pub const PTHREAD_STACK_MIN: usize = 65536;
50 
51 // Misc other constants required for building.
52 pub const SIGIO: c_int = 29;
53 pub const B19200: crate::speed_t = 0o000016;
54 pub const B38400: crate::speed_t = 0o000017;
55