Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more posix message queue functions for Linux and all for solarish #1388

Merged
merged 2 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2294,10 +2294,20 @@ extern {
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint) -> ::ssize_t;
pub fn mq_timedreceive(mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
abs_timeout: *const ::timespec) -> ::ssize_t;
pub fn mq_send(mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint) -> ::c_int;
pub fn mq_timedsend(mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
abs_timeout: *const ::timespec) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
pub fn mq_setattr(mqd: ::mqd_t,
newattr: *const ::mq_attr,
Expand Down
34 changes: 34 additions & 0 deletions src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub type pthread_t = ::c_uint;
pub type pthread_key_t = ::c_uint;
pub type blksize_t = ::c_int;
pub type nl_item = ::c_int;
pub type mqd_t = *mut ::c_void;
pub type id_t = ::c_int;
pub type idtype_t = ::c_uint;

Expand Down Expand Up @@ -331,6 +332,14 @@ s! {
pub if_name: *mut ::c_char,
}

pub struct mq_attr {
pub mq_flags: ::c_long,
pub mq_maxmsg: ::c_long,
pub mq_msgsize: ::c_long,
pub mq_curmsgs: ::c_long,
_pad: [::c_int; 4]
}

pub struct port_event {
pub portev_events: ::c_int,
pub portev_source: ::c_ushort,
Expand Down Expand Up @@ -1937,6 +1946,31 @@ extern {
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;

pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
pub fn mq_receive(mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint) -> ::ssize_t;
pub fn mq_timedreceive(mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
abs_timeout: *const ::timespec) -> ::ssize_t;
pub fn mq_send(mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint) -> ::c_int;
pub fn mq_timedsend(mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
abs_timeout: *const ::timespec) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
pub fn mq_setattr(mqd: ::mqd_t,
newattr: *const ::mq_attr,
oldattr: *mut ::mq_attr) -> ::c_int;
pub fn port_create() -> ::c_int;
pub fn port_associate(port: ::c_int, source: ::c_int, object: ::uintptr_t,
events: ::c_int, user: *mut ::c_void) -> ::c_int;
Expand Down