Skip to content

Commit ed537ac

Browse files
committed
Add posix message queue types and functions for solarish
1 parent 94406f9 commit ed537ac

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/unix/solarish/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub type pthread_t = ::c_uint;
3131
pub type pthread_key_t = ::c_uint;
3232
pub type blksize_t = ::c_int;
3333
pub type nl_item = ::c_int;
34+
pub type mqd_t = *mut ::c_void;
3435
pub type id_t = ::c_int;
3536
pub type idtype_t = ::c_uint;
3637

@@ -331,6 +332,14 @@ s! {
331332
pub if_name: *mut ::c_char,
332333
}
333334

335+
pub struct mq_attr {
336+
pub mq_flags: ::c_long,
337+
pub mq_maxmsg: ::c_long,
338+
pub mq_msgsize: ::c_long,
339+
pub mq_curmsgs: ::c_long,
340+
_pad: [::c_int; 4]
341+
}
342+
334343
pub struct port_event {
335344
pub portev_events: ::c_int,
336345
pub portev_source: ::c_ushort,
@@ -1937,6 +1946,31 @@ extern {
19371946
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
19381947
-> ::ssize_t;
19391948

1949+
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
1950+
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
1951+
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
1952+
pub fn mq_receive(mqd: ::mqd_t,
1953+
msg_ptr: *mut ::c_char,
1954+
msg_len: ::size_t,
1955+
msq_prio: *mut ::c_uint) -> ::ssize_t;
1956+
pub fn mq_timedreceive(mqd: ::mqd_t,
1957+
msg_ptr: *mut ::c_char,
1958+
msg_len: ::size_t,
1959+
msq_prio: *mut ::c_uint,
1960+
abs_timeout: *const ::timespec) -> ::ssize_t;
1961+
pub fn mq_send(mqd: ::mqd_t,
1962+
msg_ptr: *const ::c_char,
1963+
msg_len: ::size_t,
1964+
msq_prio: ::c_uint) -> ::c_int;
1965+
pub fn mq_timedsend(mqd: ::mqd_t,
1966+
msg_ptr: *const ::c_char,
1967+
msg_len: ::size_t,
1968+
msq_prio: ::c_uint,
1969+
abs_timeout: *const ::timespec) -> ::c_int;
1970+
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
1971+
pub fn mq_setattr(mqd: ::mqd_t,
1972+
newattr: *const ::mq_attr,
1973+
oldattr: *mut ::mq_attr) -> ::c_int;
19401974
pub fn port_create() -> ::c_int;
19411975
pub fn port_associate(port: ::c_int, source: ::c_int, object: ::uintptr_t,
19421976
events: ::c_int, user: *mut ::c_void) -> ::c_int;

0 commit comments

Comments
 (0)