nc/platform/linux-types/uapi/linux/
mqueue.rs

1// Copyright (c) 2020 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
2// Use of this source is governed by Apache-2.0 License that can be found
3// in the LICENSE file.
4
5//! From `include/uapi/linux/mqueue.h`
6
7pub const MQ_PRIO_MAX: i32 = 32768;
8/// per-uid limit of kernel memory used by mqueue, in bytes
9pub const MQ_BYTES_MAX: i32 = 819_200;
10
11#[repr(C)]
12#[derive(Debug, Default, Clone)]
13pub struct mq_attr_t {
14    /// message queue flags
15    pub mq_flags: isize,
16    /// maximum number of messages
17    pub mq_maxmsg: isize,
18    /// maximum message size
19    pub mq_msgsize: isize,
20    /// number of messages currently queued
21    pub mq_curmsgs: isize,
22    /// ignored for input, zeroed for output
23    reserved: [isize; 4],
24}
25
26/// `SIGEV_THREAD` implementation:
27///
28/// `SIGEV_THREAD` must be implemented in user space. If `SIGEV_THREAD` is passed
29/// to `mq_notify`, then
30/// - `sigev_signo` must be the file descriptor of an `AF_NETLINK` socket. It's not
31///   necessary that the socket is bound.
32/// - `sigev_value.sival_ptr` must point to a cookie that is `NOTIFY_COOKIE_LEN` bytes long.
33///
34/// If the notification is triggered, then the cookie is sent to the netlink
35/// socket. The last byte of the cookie is replaced with the `NOTIFY_??` codes:
36/// `NOTIFY_WOKENUP` if the notification got triggered, `NOTIFY_REMOVED` if it was
37/// removed, either due to a `close()` on the message queue fd or due to a
38/// `mq_notify()` that removed the notification.
39pub const NOTIFY_NONE: i32 = 0;
40pub const NOTIFY_WOKENUP: i32 = 1;
41pub const NOTIFY_REMOVED: i32 = 2;
42
43pub const NOTIFY_COOKIE_LEN: i32 = 32;