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