summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-28 12:09:01 +0000
committerbors <bors@rust-lang.org>2019-11-28 12:09:01 +0000
commit096d868a2fe483e95b7b7f73a98af1782ff8cabb (patch)
treef73ff1fd47db3de9cfe127f4f047b71cee9f8f22
parent88f65876317f6e899cdea7880a4514774632aee4 (diff)
parent412dd4e1b0112c5aa605ef33bc18215fb56edf67 (diff)
downloadrust-libc-096d868a2fe483e95b7b7f73a98af1782ff8cabb.tar.gz
Auto merge of #1584 - psumbera:master, r=gnzlbg
Add support for shared memory operations for solaris/illumos This is needed because Firefox now uses slice-deque rust crate.
-rw-r--r--src/unix/solarish/mod.rs65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 9f0372b20f..06c1a20cf7 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -34,6 +34,7 @@ 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;
+pub type shmatt_t = ::c_ulong;
pub type door_attr_t = ::c_uint;
pub type door_id_t = ::c_ulonglong;
@@ -57,6 +58,16 @@ s! {
pub imr_interface: in_addr,
}
+ pub struct ipc_perm {
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::mode_t,
+ pub seq: ::c_uint,
+ pub key: ::key_t,
+ }
+
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [::c_char; 14],
@@ -206,6 +217,33 @@ s! {
pub ai_next: *mut addrinfo,
}
+ pub struct shmid_ds {
+ pub shm_perm: ipc_perm,
+ pub shm_segsz: ::size_t,
+ #[cfg(target_os = "illumos")]
+ pub shm_amp: *mut ::c_void,
+ #[cfg(target_os = "solaris")]
+ pub shm_flags: ::uintptr_t,
+ pub shm_lkcnt: ::c_ushort,
+ pub shm_lpid: ::pid_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ pub shm_cnattch: ::c_ulong,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ #[cfg(target_os = "illumos")]
+ pub shm_pad4: [i64; 4],
+ #[cfg(target_os = "solaris")]
+ pub shm_amp: *mut ::c_void,
+ #[cfg(target_os = "solaris")]
+ pub shm_gransize: u64,
+ #[cfg(target_os = "solaris")]
+ pub shm_allocated: u64,
+ #[cfg(target_os = "solaris")]
+ pub shm_pad4: [i64; 1],
+ }
+
pub struct sigset_t {
bits: [u32; 4],
}
@@ -1066,6 +1104,7 @@ pub const MAP_PRIVATE: ::c_int = 0x0002;
pub const MAP_FIXED: ::c_int = 0x0010;
pub const MAP_NORESERVE: ::c_int = 0x40;
pub const MAP_ANON: ::c_int = 0x0100;
+pub const MAP_ANONYMOUS: ::c_int = 0x0100;
pub const MAP_RENAME: ::c_int = 0x20;
pub const MAP_ALIGN: ::c_int = 0x200;
pub const MAP_TEXT: ::c_int = 0x400;
@@ -1437,6 +1476,16 @@ pub const IFF_VIRTUAL: ::c_longlong = 0x2000000000; // Cannot send/receive pkts
pub const IFF_DUPLICATE: ::c_longlong = 0x4000000000; // Local address in use
pub const IFF_IPMP: ::c_longlong = 0x8000000000; // IPMP IP interface
+// sys/ipc.h:
+pub const IPC_ALLOC: ::c_int = 0x8000;
+pub const IPC_CREAT: ::c_int = 0x200;
+pub const IPC_EXCL: ::c_int = 0x400;
+pub const IPC_NOWAIT: ::c_int = 0x800;
+pub const IPC_PRIVATE: key_t = 0;
+pub const IPC_RMID: ::c_int = 10;
+pub const IPC_SET: ::c_int = 11;
+pub const IPC_SEAT: ::c_int = 12;
+
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
@@ -2119,6 +2168,22 @@ extern "C" {
advice: ::c_int,
) -> ::c_int;
+ pub fn shmat(
+ shmid: ::c_int,
+ shmaddr: *const ::c_void,
+ shmflg: ::c_int,
+ ) -> *mut ::c_void;
+
+ pub fn shmctl(
+ shmid: ::c_int,
+ cmd: ::c_int,
+ buf: *mut ::shmid_ds,
+ ) -> ::c_int;
+
+ pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
+
+ pub fn shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
+
pub fn shm_open(
name: *const ::c_char,
oflag: ::c_int,