Skip to content

Commit b5d9955

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

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

src/vxworks/mod.rs

Lines changed: 30 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;
@@ -1388,6 +1394,28 @@ extern "C" {
13881394
value: *mut ::c_void,
13891395
) -> ::c_int;
13901396

1397+
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
1398+
pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
1399+
1400+
pub fn pthread_setschedparam(
1401+
native: ::pthread_t,
1402+
policy: ::c_int,
1403+
param: *const ::sched_param,
1404+
) -> ::c_int;
1405+
1406+
pub fn pthread_getschedparam(
1407+
native: ::pthread_t,
1408+
policy: *mut ::c_int,
1409+
param: *mut ::sched_param,
1410+
) -> ::c_int;
1411+
1412+
pub fn pthread_attr_setinheritsched(
1413+
attr: *mut ::pthread_attr_t,
1414+
inheritsched: ::c_int,
1415+
) -> ::c_int;
1416+
1417+
pub fn pthread_attr_setschedpolicy(attr: *mut ::pthread_attr_t, policy: ::c_int) -> ::c_int;
1418+
13911419
// pthread.h
13921420
pub fn pthread_attr_destroy(thread: *mut ::pthread_attr_t) -> ::c_int;
13931421

0 commit comments

Comments
 (0)