Add System V message queue bindings for Linux (glibc/musl)
This commit is contained in:
parent
836cda9893
commit
7590565993
3
libc-test/Cargo.lock
generated
3
libc-test/Cargo.lock
generated
@ -94,4 +94,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
|
@ -160,6 +160,7 @@ fn main() {
|
||||
cfg.header("sys/signalfd.h");
|
||||
cfg.header("sys/xattr.h");
|
||||
cfg.header("sys/ipc.h");
|
||||
cfg.header("sys/msg.h");
|
||||
cfg.header("sys/shm.h");
|
||||
cfg.header("pty.h");
|
||||
}
|
||||
@ -332,7 +333,8 @@ fn main() {
|
||||
// kernel regardless
|
||||
"RLIMIT_NLIMITS" |
|
||||
"TCP_COOKIE_TRANSACTIONS" |
|
||||
"RLIMIT_RTTIME" if musl => true,
|
||||
"RLIMIT_RTTIME" |
|
||||
"MSG_COPY" if musl => true,
|
||||
// work around super old mips toolchain
|
||||
"SCHED_IDLE" | "SHM_NORESERVE" => mips,
|
||||
|
||||
|
@ -129,6 +129,32 @@ s! {
|
||||
__unused5: ::c_ulong
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
#[cfg(target_endian = "big")]
|
||||
__glibc_reserved1: ::c_ulong,
|
||||
pub msg_stime: ::time_t,
|
||||
#[cfg(target_endian = "little")]
|
||||
__glibc_reserved1: ::c_ulong,
|
||||
#[cfg(target_endian = "big")]
|
||||
__glibc_reserved2: ::c_ulong,
|
||||
pub msg_rtime: ::time_t,
|
||||
#[cfg(target_endian = "little")]
|
||||
__glibc_reserved2: ::c_ulong,
|
||||
#[cfg(target_endian = "big")]
|
||||
__glibc_reserved3: ::c_ulong,
|
||||
pub msg_ctime: ::time_t,
|
||||
#[cfg(target_endian = "little")]
|
||||
__glibc_reserved3: ::c_ulong,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__glibc_reserved4: ::c_ulong,
|
||||
__glibc_reserved5: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::c_long,
|
||||
pub f_bsize: ::c_long,
|
||||
|
@ -116,6 +116,20 @@ s! {
|
||||
__unused5: ::c_ulong
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
pub msg_rtime: ::time_t,
|
||||
pub msg_ctime: ::time_t,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__glibc_reserved4: ::c_ulong,
|
||||
__glibc_reserved5: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::c_long,
|
||||
pub f_bsize: ::c_long,
|
||||
|
@ -11,9 +11,10 @@ pub type ino64_t = u64;
|
||||
pub type off64_t = i64;
|
||||
pub type blkcnt64_t = i64;
|
||||
pub type rlim64_t = u64;
|
||||
pub type key_t = ::c_int;
|
||||
pub type shmatt_t = ::c_ulong;
|
||||
pub type mqd_t = ::c_int;
|
||||
pub type msgqnum_t = ::c_ulong;
|
||||
pub type msglen_t = ::c_ulong;
|
||||
pub type nfds_t = ::c_ulong;
|
||||
pub type nl_item = ::c_int;
|
||||
|
||||
@ -190,6 +191,17 @@ s! {
|
||||
pub if_name: *mut ::c_char,
|
||||
}
|
||||
|
||||
// System V IPC
|
||||
pub struct msginfo {
|
||||
pub msgpool: ::c_int,
|
||||
pub msgmap: ::c_int,
|
||||
pub msgmax: ::c_int,
|
||||
pub msgmnb: ::c_int,
|
||||
pub msgmni: ::c_int,
|
||||
pub msgssz: ::c_int,
|
||||
pub msgtql: ::c_int,
|
||||
pub msgseg: ::c_ushort,
|
||||
}
|
||||
}
|
||||
|
||||
pub const ABDAY_1: ::nl_item = 0x20000;
|
||||
@ -430,6 +442,9 @@ pub const SCHED_RR: ::c_int = 2;
|
||||
pub const SCHED_BATCH: ::c_int = 3;
|
||||
pub const SCHED_IDLE: ::c_int = 5;
|
||||
|
||||
// System V IPC
|
||||
pub const IPC_PRIVATE: ::key_t = 0;
|
||||
|
||||
pub const IPC_CREAT: ::c_int = 0o1000;
|
||||
pub const IPC_EXCL: ::c_int = 0o2000;
|
||||
pub const IPC_NOWAIT: ::c_int = 0o4000;
|
||||
@ -438,6 +453,12 @@ pub const IPC_RMID: ::c_int = 0;
|
||||
pub const IPC_SET: ::c_int = 1;
|
||||
pub const IPC_STAT: ::c_int = 2;
|
||||
pub const IPC_INFO: ::c_int = 3;
|
||||
pub const MSG_STAT: ::c_int = 11;
|
||||
pub const MSG_INFO: ::c_int = 12;
|
||||
|
||||
pub const MSG_NOERROR: ::c_int = 0o10000;
|
||||
pub const MSG_EXCEPT: ::c_int = 0o20000;
|
||||
pub const MSG_COPY: ::c_int = 0o40000;
|
||||
|
||||
pub const SHM_R: ::c_int = 0o400;
|
||||
pub const SHM_W: ::c_int = 0o200;
|
||||
@ -522,6 +543,8 @@ extern {
|
||||
pub fn getpwent() -> *mut passwd;
|
||||
pub fn shm_open(name: *const c_char, oflag: ::c_int,
|
||||
mode: mode_t) -> ::c_int;
|
||||
|
||||
// System V IPC
|
||||
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
|
||||
pub fn shmat(shmid: ::c_int,
|
||||
shmaddr: *const ::c_void,
|
||||
@ -530,6 +553,14 @@ extern {
|
||||
pub fn shmctl(shmid: ::c_int,
|
||||
cmd: ::c_int,
|
||||
buf: *mut ::shmid_ds) -> ::c_int;
|
||||
pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
|
||||
pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
|
||||
pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
|
||||
pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
|
||||
msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t;
|
||||
pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
|
||||
msgflg: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
|
||||
-> ::c_int;
|
||||
pub fn __errno_location() -> *mut ::c_int;
|
||||
|
@ -68,6 +68,23 @@ s! {
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
__unused1: ::c_int,
|
||||
pub msg_rtime: ::time_t,
|
||||
__unused2: ::c_int,
|
||||
pub msg_ctime: ::time_t,
|
||||
__unused3: ::c_int,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__pad1: ::c_ulong,
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::c_ulong,
|
||||
pub f_bsize: ::c_ulong,
|
||||
|
@ -68,6 +68,23 @@ s! {
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
__unused1: ::c_int,
|
||||
pub msg_rtime: ::time_t,
|
||||
__unused2: ::c_int,
|
||||
pub msg_ctime: ::time_t,
|
||||
__unused3: ::c_int,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__pad1: ::c_ulong,
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::c_ulong,
|
||||
pub f_bsize: ::c_ulong,
|
||||
|
@ -67,6 +67,32 @@ s! {
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
#[cfg(target_endian = "big")]
|
||||
__unused1: ::c_int,
|
||||
pub msg_stime: ::time_t,
|
||||
#[cfg(target_endian = "little")]
|
||||
__unused1: ::c_int,
|
||||
#[cfg(target_endian = "big")]
|
||||
__unused2: ::c_int,
|
||||
pub msg_rtime: ::time_t,
|
||||
#[cfg(target_endian = "little")]
|
||||
__unused2: ::c_int,
|
||||
#[cfg(target_endian = "big")]
|
||||
__unused3: ::c_int,
|
||||
pub msg_ctime: ::time_t,
|
||||
#[cfg(target_endian = "little")]
|
||||
__unused3: ::c_int,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__pad1: ::c_ulong,
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::c_ulong,
|
||||
pub f_bsize: ::c_ulong,
|
||||
|
@ -68,6 +68,23 @@ s! {
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
__unused1: ::c_int,
|
||||
pub msg_rtime: ::time_t,
|
||||
__unused2: ::c_int,
|
||||
pub msg_ctime: ::time_t,
|
||||
__unused3: ::c_int,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__pad1: ::c_ulong,
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::c_ulong,
|
||||
pub f_bsize: ::c_ulong,
|
||||
|
@ -73,6 +73,20 @@ s! {
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
pub msg_rtime: ::time_t,
|
||||
pub msg_ctime: ::time_t,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__pad1: ::c_ulong,
|
||||
__pad2: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::c_ulong,
|
||||
pub f_bsize: ::c_ulong,
|
||||
|
@ -53,6 +53,23 @@ s! {
|
||||
__unused4: ::c_ulong,
|
||||
__unused5: ::c_ulong
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
__glibc_reserved1: ::c_ulong,
|
||||
pub msg_rtime: ::time_t,
|
||||
__glibc_reserved2: ::c_ulong,
|
||||
pub msg_ctime: ::time_t,
|
||||
__glibc_reserved3: ::c_ulong,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__glibc_reserved4: ::c_ulong,
|
||||
__glibc_reserved5: ::c_ulong,
|
||||
}
|
||||
}
|
||||
|
||||
pub const O_DIRECT: ::c_int = 0x10000;
|
||||
|
@ -53,6 +53,23 @@ s! {
|
||||
__glibc_reserved5: ::c_ulong,
|
||||
__glibc_reserved6: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
__glibc_reserved1: ::c_uint,
|
||||
pub msg_stime: ::time_t,
|
||||
__glibc_reserved2: ::c_uint,
|
||||
pub msg_rtime: ::time_t,
|
||||
__glibc_reserved3: ::c_uint,
|
||||
pub msg_ctime: ::time_t,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__glibc_reserved4: ::c_ulong,
|
||||
__glibc_reserved5: ::c_ulong,
|
||||
}
|
||||
}
|
||||
|
||||
pub const O_DIRECT: ::c_int = 0x20000;
|
||||
|
@ -87,6 +87,23 @@ s! {
|
||||
__unused4: ::c_ulong,
|
||||
__unused5: ::c_ulong
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
__glibc_reserved1: ::c_ulong,
|
||||
pub msg_rtime: ::time_t,
|
||||
__glibc_reserved2: ::c_ulong,
|
||||
pub msg_ctime: ::time_t,
|
||||
__glibc_reserved3: ::c_ulong,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__glibc_reserved4: ::c_ulong,
|
||||
__glibc_reserved5: ::c_ulong,
|
||||
}
|
||||
}
|
||||
|
||||
pub const O_DIRECT: ::c_int = 0x4000;
|
||||
|
@ -31,6 +31,20 @@ s! {
|
||||
pub mem_unit: ::c_uint,
|
||||
pub _f: [::c_char; 0],
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
pub msg_stime: ::time_t,
|
||||
pub msg_rtime: ::time_t,
|
||||
pub msg_ctime: ::time_t,
|
||||
__msg_cbytes: ::c_ulong,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
__glibc_reserved4: ::c_ulong,
|
||||
__glibc_reserved5: ::c_ulong,
|
||||
}
|
||||
}
|
||||
|
||||
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
|
||||
|
@ -6,6 +6,7 @@ pub type speed_t = ::c_uint;
|
||||
pub type tcflag_t = ::c_uint;
|
||||
pub type loff_t = ::c_longlong;
|
||||
pub type clockid_t = ::c_int;
|
||||
pub type key_t = ::c_int;
|
||||
pub type id_t = ::c_uint;
|
||||
|
||||
pub enum timezone {}
|
||||
|
Loading…
Reference in New Issue
Block a user