Skip to content

Commit 40c73a6

Browse files
committed
Auto merge of #1404 - robertdfrench:solarish-doors, r=gnzlbg
Support calls to the SunOS Doors API Doors are a lightweight IPC mechanism available in libc on Solaris & illumos. They are like unix domain sockets, but faster and more pleasant to work with. * Brief introduction: ["Doors" in SolarisTM: Lightweight RPC using File Descriptors](http://www.kohala.com/start/papers.others/doors.html) * Relevant manual pages: [DOOR_CALL(3C)](https://illumos.org/man/3C/door_call), [DOOR_CREATE(3C)](https://illumos.org/man/3C/door_create) * Tutorial I wrote: ["Revolving Doors": A tutorial on the Illumos Doors API](https://github.com/robertdfrench/revolving-door) Marking this as a draft until I have included the full api.
2 parents 99854f3 + ba459b7 commit 40c73a6

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/unix/solarish/mod.rs

+40
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ pub type mqd_t = *mut ::c_void;
3535
pub type id_t = ::c_int;
3636
pub type idtype_t = ::c_uint;
3737

38+
pub type door_attr_t = ::c_uint;
39+
pub type door_id_t = ::c_ulonglong;
40+
3841
#[cfg_attr(feature = "extra_traits", derive(Debug))]
3942
pub enum timezone {}
4043
impl ::Copy for timezone {}
@@ -338,6 +341,11 @@ s! {
338341
pub portev_object: ::uintptr_t,
339342
pub portev_user: *mut ::c_void,
340343
}
344+
345+
pub struct door_desc_t__d_data__d_desc {
346+
pub d_descriptor: ::c_int,
347+
pub d_id: ::door_id_t
348+
}
341349
}
342350

343351
s_no_extra_traits! {
@@ -401,6 +409,25 @@ s_no_extra_traits! {
401409
pub sigev_notify_attributes: *const ::pthread_attr_t,
402410
__sigev_pad2: ::c_int,
403411
}
412+
413+
pub union door_desc_t__d_data {
414+
pub d_desc: door_desc_t__d_data__d_desc,
415+
d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */
416+
}
417+
418+
pub struct door_desc_t {
419+
pub d_attributes: door_attr_t,
420+
pub d_data: door_desc_t__d_data,
421+
}
422+
423+
pub struct door_arg_t {
424+
pub data_ptr: *const ::c_char,
425+
pub data_size: ::size_t,
426+
pub desc_ptr: *const door_desc_t,
427+
pub dec_num: ::c_uint,
428+
pub rbuf: *const ::c_char,
429+
pub rsize: ::size_t,
430+
}
404431
}
405432

406433
cfg_if! {
@@ -2108,6 +2135,19 @@ extern {
21082135
pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
21092136
pub fn uname(buf: *mut ::utsname) -> ::c_int;
21102137
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
2138+
pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int;
2139+
pub fn door_return(data_ptr: *const ::c_char,
2140+
data_size: ::size_t,
2141+
desc_ptr: *const door_desc_t,
2142+
num_desc: ::c_uint);
2143+
pub fn door_create(server_procedure: extern fn(cookie: *const ::c_void,
2144+
argp: *const ::c_char,
2145+
arg_size: ::size_t,
2146+
dp: *const door_desc_t,
2147+
n_desc: ::c_uint),
2148+
cookie: *const ::c_void,
2149+
attributes: door_attr_t) -> ::c_int;
2150+
pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int;
21112151
}
21122152

21132153
mod compat;

0 commit comments

Comments
 (0)