Skip to content

Commit 0a51042

Browse files
authored
Merge pull request #1645 from Wind-River/master
VxWorks: add functions for message queue
2 parents b030ee4 + e2eb0a6 commit 0a51042

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,7 @@ fn test_vxworks(target: &str) {
20062006
"errno.h",
20072007
"sys/mman.h",
20082008
"pathLib.h",
2009+
"mqueue.h",
20092010
}
20102011
/* Fix me */
20112012
cfg.skip_const(move |name| match name {

src/vxworks/mod.rs

+47
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ pub type _Vx_ticks64_t = ::c_ulonglong;
100100

101101
pub type sa_family_t = ::c_uchar;
102102

103+
// mqueue.h
104+
pub type mqd_t = ::c_int;
105+
103106
#[cfg_attr(feature = "extra_traits", derive(Debug))]
104107
pub enum _Vx_semaphore {}
105108
impl ::Copy for _Vx_semaphore {}
@@ -379,6 +382,13 @@ s! {
379382
pub dli_sname: *const ::c_char,
380383
pub dli_saddr: *mut ::c_void,
381384
}
385+
386+
pub struct mq_attr {
387+
pub mq_maxmsg: ::c_long,
388+
pub mq_msgsize: ::c_long,
389+
pub mq_flags: ::c_long,
390+
pub mq_curmsgs: ::c_long,
391+
}
382392
}
383393

384394
s_no_extra_traits! {
@@ -1972,6 +1982,43 @@ extern "C" {
19721982
pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int;
19731983
pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int;
19741984
pub fn randSecure() -> c_int;
1985+
1986+
// mqueue.h
1987+
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
1988+
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
1989+
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
1990+
pub fn mq_receive(
1991+
mqd: ::mqd_t,
1992+
msg_ptr: *mut ::c_char,
1993+
msg_len: ::size_t,
1994+
msg_prio: *mut ::c_uint,
1995+
) -> ::ssize_t;
1996+
pub fn mq_timedreceive(
1997+
mqd: ::mqd_t,
1998+
msg_ptr: *mut ::c_char,
1999+
msg_len: ::size_t,
2000+
msg_prio: *mut ::c_uint,
2001+
abs_timeout: *const ::timespec,
2002+
) -> ::ssize_t;
2003+
pub fn mq_send(
2004+
mqd: ::mqd_t,
2005+
msg_ptr: *const ::c_char,
2006+
msg_len: ::size_t,
2007+
msg_prio: ::c_uint,
2008+
) -> ::c_int;
2009+
pub fn mq_timedsend(
2010+
mqd: ::mqd_t,
2011+
msg_ptr: *const ::c_char,
2012+
msg_len: ::size_t,
2013+
msg_prio: ::c_uint,
2014+
abs_timeout: *const ::timespec,
2015+
) -> ::c_int;
2016+
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
2017+
pub fn mq_setattr(
2018+
mqd: ::mqd_t,
2019+
newattr: *const ::mq_attr,
2020+
oldattr: *mut ::mq_attr,
2021+
) -> ::c_int;
19752022
}
19762023

19772024
//Dummy functions, these don't really exist in VxWorks.

0 commit comments

Comments
 (0)