Skip to content

Commit 722db94

Browse files
committed
VxWorks
1. Rename Schedparam to match other unix platforms 2. Add Pthread functions and constants
1 parent fbec928 commit 722db94

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/vxworks/mod.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ s! {
253253
}
254254

255255
// b_struct__Sched_param.h
256-
pub struct _Sched_param {
256+
pub struct sched_param {
257257
pub sched_priority: ::c_int, /* scheduling priority */
258258
pub sched_ss_low_priority: ::c_int, /* low scheduling priority */
259259
pub sched_ss_repl_period: ::_Timespec, /* replenishment period */
@@ -274,7 +274,7 @@ s! {
274274
pub threadAttrSchedpolicy : ::c_int,
275275
pub threadAttrName : *mut ::c_char,
276276
pub threadAttrOptions : ::c_int,
277-
pub threadAttrSchedparam : ::_Sched_param,
277+
pub threadAttrSchedparam : ::sched_param,
278278
}
279279

280280
// signal.h
@@ -613,6 +613,12 @@ pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
613613
pub const PTHREAD_STACK_MIN: usize = 4096;
614614
pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30;
615615

616+
pub const SCHED_FIFO: ::c_int = 0x01;
617+
pub const SCHED_RR: ::c_int = 0x02;
618+
pub const SCHED_OTHER: ::c_int = 0x04;
619+
pub const SCHED_SPORADIC: ::c_int = 0x08;
620+
pub const PRIO_PROCESS: ::c_uint = 0;
621+
616622
// ERRNO STUFF
617623
pub const ERROR: ::c_int = -1;
618624
pub const OK: ::c_int = 0;
@@ -1789,6 +1795,21 @@ extern "C" {
17891795
__oset: *mut sigset_t,
17901796
) -> ::c_int;
17911797

1798+
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
1799+
pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
1800+
1801+
pub fn pthread_setschedparam(
1802+
native: ::pthread_t,
1803+
policy: ::c_int,
1804+
param: *const ::sched_param,
1805+
) -> ::c_int;
1806+
1807+
pub fn pthread_getschedparam(
1808+
native: ::pthread_t,
1809+
policy: *mut ::c_int,
1810+
param: *mut ::sched_param,
1811+
) -> ::c_int;
1812+
17921813
// signal.h for user
17931814
pub fn kill(__pid: pid_t, __signo: ::c_int) -> ::c_int;
17941815

0 commit comments

Comments
 (0)