Skip to content

Commit 5522106

Browse files
Add more items from include/linux/sched.h header
1 parent e673aaa commit 5522106

File tree

1 file changed

+83
-10
lines changed
  • src/unix/linux_like/linux

1 file changed

+83
-10
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,17 @@ s_no_extra_traits! {
878878
pub d_type: ::c_uchar,
879879
pub d_name: [::c_char; 256],
880880
}
881+
882+
pub struct sched_attr {
883+
pub size: ::__u32,
884+
pub sched_policy: ::__u32,
885+
pub sched_flags: ::__u64,
886+
pub sched_nice: ::__s32,
887+
pub sched_priority: ::__u32,
888+
pub sched_runtime: ::__u64,
889+
pub sched_deadline: ::__u64,
890+
pub sched_period: ::__u64,
891+
}
881892
}
882893

883894
s_no_extra_traits! {
@@ -1343,6 +1354,46 @@ cfg_if! {
13431354
self.rx_filter.hash(state);
13441355
}
13451356
}
1357+
1358+
impl ::fmt::Debug for sched_attr {
1359+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1360+
f.debug_struct("sched_attr")
1361+
.field("size", &self.size)
1362+
.field("sched_policy", &self.sched_policy)
1363+
.field("sched_flags", &self.sched_flags)
1364+
.field("sched_nice", &self.sched_nice)
1365+
.field("sched_priority", &self.sched_priority)
1366+
.field("sched_runtime", &self.sched_runtime)
1367+
.field("sched_deadline", &self.sched_deadline)
1368+
.field("sched_period", &self.sched_period)
1369+
.finish()
1370+
}
1371+
}
1372+
impl PartialEq for sched_attr {
1373+
fn eq(&self, other: &sched_attr) -> bool {
1374+
self.size == other.size &&
1375+
self.sched_policy == other.sched_policy &&
1376+
self.sched_flags == other.sched_flags &&
1377+
self.sched_nice == other.sched_nice &&
1378+
self.sched_priority == other.sched_priority &&
1379+
self.sched_runtime == other.sched_runtime &&
1380+
self.sched_deadline == other.sched_deadline &&
1381+
self.sched_period == other.sched_period
1382+
}
1383+
}
1384+
impl Eq for sched_attr {}
1385+
impl ::hash::Hash for sched_attr {
1386+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1387+
self.size.hash(state);
1388+
self.sched_policy.hash(state);
1389+
self.sched_flags.hash(state);
1390+
self.sched_nice.hash(state);
1391+
self.sched_priority.hash(state);
1392+
self.sched_runtime.hash(state);
1393+
self.sched_deadline.hash(state);
1394+
self.sched_period.hash(state);
1395+
}
1396+
}
13461397
}
13471398
}
13481399

@@ -2032,16 +2083,6 @@ pub const RENAME_NOREPLACE: ::c_uint = 1;
20322083
pub const RENAME_EXCHANGE: ::c_uint = 2;
20332084
pub const RENAME_WHITEOUT: ::c_uint = 4;
20342085

2035-
pub const SCHED_OTHER: ::c_int = 0;
2036-
pub const SCHED_FIFO: ::c_int = 1;
2037-
pub const SCHED_RR: ::c_int = 2;
2038-
pub const SCHED_BATCH: ::c_int = 3;
2039-
pub const SCHED_IDLE: ::c_int = 5;
2040-
2041-
pub const SCHED_RESET_ON_FORK: ::c_int = 0x40000000;
2042-
2043-
pub const CLONE_PIDFD: ::c_int = 0x1000;
2044-
20452086
// netinet/in.h
20462087
// NOTE: These are in addition to the constants defined in src/unix/mod.rs
20472088

@@ -4588,6 +4629,38 @@ pub const PF_NO_SETAFFINITY: ::c_int = 0x04000000;
45884629
pub const PF_MCE_EARLY: ::c_int = 0x08000000;
45894630
pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000;
45904631

4632+
pub const CSIGNAL: ::c_int = 0x000000ff;
4633+
4634+
pub const SCHED_NORMAL: ::c_int = 0;
4635+
pub const SCHED_OTHER: ::c_int = 0;
4636+
pub const SCHED_FIFO: ::c_int = 1;
4637+
pub const SCHED_RR: ::c_int = 2;
4638+
pub const SCHED_BATCH: ::c_int = 3;
4639+
pub const SCHED_IDLE: ::c_int = 5;
4640+
pub const SCHED_DEADLINE: ::c_int = 6;
4641+
4642+
pub const SCHED_RESET_ON_FORK: ::c_int = 0x40000000;
4643+
4644+
pub const CLONE_PIDFD: ::c_int = 0x1000;
4645+
4646+
pub const SCHED_FLAG_RESET_ON_FORK: ::c_int = 0x01;
4647+
pub const SCHED_FLAG_RECLAIM: ::c_int = 0x02;
4648+
pub const SCHED_FLAG_DL_OVERRUN: ::c_int = 0x04;
4649+
pub const SCHED_FLAG_KEEP_POLICY: ::c_int = 0x08;
4650+
pub const SCHED_FLAG_KEEP_PARAMS: ::c_int = 0x10;
4651+
pub const SCHED_FLAG_UTIL_CLAMP_MIN: ::c_int = 0x20;
4652+
pub const SCHED_FLAG_UTIL_CLAMP_MAX: ::c_int = 0x40;
4653+
4654+
pub const SCHED_FLAG_KEEP_ALL: ::c_int = SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS;
4655+
4656+
pub const SCHED_FLAG_UTIL_CLAMP: ::c_int = SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX;
4657+
4658+
pub const SCHED_FLAG_ALL: ::c_int = SCHED_FLAG_RESET_ON_FORK
4659+
| SCHED_FLAG_RECLAIM
4660+
| SCHED_FLAG_DL_OVERRUN
4661+
| SCHED_FLAG_KEEP_ALL
4662+
| SCHED_FLAG_UTIL_CLAMP;
4663+
45914664
f! {
45924665
pub fn NLA_ALIGN(len: ::c_int) -> ::c_int {
45934666
return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1)

0 commit comments

Comments
 (0)