Skip to content

Commit 53ce57e

Browse files
committed
Add support for shared memory operations for solaris/illumos
This is needed because Firefox now uses slice-deque rust crate.
1 parent 13d4a5d commit 53ce57e

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/unix/solarish/mod.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub type nl_item = ::c_int;
3434
pub type mqd_t = *mut ::c_void;
3535
pub type id_t = ::c_int;
3636
pub type idtype_t = ::c_uint;
37+
pub type shmatt_t = ::c_ulong;
3738

3839
pub type door_attr_t = ::c_uint;
3940
pub type door_id_t = ::c_ulonglong;
@@ -57,6 +58,16 @@ s! {
5758
pub imr_interface: in_addr,
5859
}
5960

61+
pub struct ipc_perm {
62+
pub uid: ::uid_t,
63+
pub gid: ::gid_t,
64+
pub cuid: ::uid_t,
65+
pub cgid: ::gid_t,
66+
pub mode: ::mode_t,
67+
pub seq: ::c_uint,
68+
pub key: ::key_t,
69+
}
70+
6071
pub struct sockaddr {
6172
pub sa_family: sa_family_t,
6273
pub sa_data: [::c_char; 14],
@@ -206,6 +217,24 @@ s! {
206217
pub ai_next: *mut addrinfo,
207218
}
208219

220+
pub struct shmid_ds {
221+
pub shm_perm: ipc_perm,
222+
pub shm_segsz: ::size_t,
223+
pub shm_flags: ::uintptr_t,
224+
pub shm_lkcnt: ::c_ushort,
225+
pub shm_lpid: ::pid_t,
226+
pub shm_cpid: ::pid_t,
227+
pub shm_nattch: ::shmatt_t,
228+
pub shm_cnattch: ::c_ulong,
229+
pub shm_atime: ::time_t,
230+
pub shm_dtime: ::time_t,
231+
pub shm_ctime: ::time_t,
232+
pub shm_amp: *mut ::c_void,
233+
pub shm_gransize: u64,
234+
pub shm_allocated: u64,
235+
pub shm_pad4: [i64; 1],
236+
}
237+
209238
pub struct sigset_t {
210239
bits: [u32; 4],
211240
}
@@ -1352,6 +1381,16 @@ pub const IFF_VIRTUAL: ::c_longlong = 0x2000000000; // Cannot send/receive pkts
13521381
pub const IFF_DUPLICATE: ::c_longlong = 0x4000000000; // Local address in use
13531382
pub const IFF_IPMP: ::c_longlong = 0x8000000000; // IPMP IP interface
13541383

1384+
// sys/ipc.h:
1385+
pub const IPC_ALLOC: ::c_int = 0x8000;
1386+
pub const IPC_CREAT: ::c_int = 0x200;
1387+
pub const IPC_EXCL: ::c_int = 0x400;
1388+
pub const IPC_NOWAIT: ::c_int = 0x800;
1389+
pub const IPC_PRIVATE: key_t = 0;
1390+
pub const IPC_RMID: ::c_int = 10;
1391+
pub const IPC_SET: ::c_int = 11;
1392+
pub const IPC_SEAT: ::c_int = 12;
1393+
13551394
pub const SHUT_RD: ::c_int = 0;
13561395
pub const SHUT_WR: ::c_int = 1;
13571396
pub const SHUT_RDWR: ::c_int = 2;
@@ -2011,6 +2050,16 @@ extern "C" {
20112050
advice: ::c_int,
20122051
) -> ::c_int;
20132052

2053+
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void,
2054+
shmflg: ::c_int) -> *mut ::c_void;
2055+
2056+
pub fn shmctl(shmid: ::c_int, cmd: ::c_int,
2057+
buf: *mut ::shmid_ds) -> ::c_int;
2058+
2059+
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
2060+
2061+
pub fn shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
2062+
20142063
pub fn shm_open(
20152064
name: *const ::c_char,
20162065
oflag: ::c_int,

0 commit comments

Comments
 (0)