The Pedigree Project
0.1
src
modules
subsys
posix
mqueue-syscalls.h
1
/* Copyright (c) 2026, Pedigree Developers. */
2
#ifndef POSIX_MQUEUE_SYSCALLS_H
3
#define POSIX_MQUEUE_SYSCALLS_H
4
5
#include "pedigree/kernel/process/Readiness.h"
6
#include "pedigree/kernel/processor/types.h"
7
#include "pedigree/kernel/utilities/SharedPointer.h"
8
#include "pedigree/kernel/utilities/String.h"
9
10
class
FileDescriptor
;
11
class
Process
;
12
struct
MqueueState
;
13
14
struct
LinuxMqAttr
{
15
int64_t flags, maxMessages, messageSize, currentMessages, reserved[4];
16
};
17
struct
LinuxMqTimespec
{
18
int64_t seconds, nanoseconds;
19
};
20
struct
LinuxMqSigevent
{
21
uint64_t value;
22
int32_t signal, notify;
23
uint8_t reserved[48];
24
};
25
static_assert
(
sizeof
(
LinuxMqAttr
) == 64 &&
sizeof
(
LinuxMqSigevent
) == 64,
26
"Linux amd64 message queue ABI"
);
27
28
class
EXPORTED_PUBLIC
PosixMessageQueue
final :
public
ReadinessSource
{
29
public
:
30
PosixMessageQueue
(
const
String
& name,
size_t
maxMessages,
size_t
messageSize, int64_t uid,
31
int64_t gid,
unsigned
mode);
32
~PosixMessageQueue
()
override
;
33
34
int
send(
const
char
* data,
size_t
length,
unsigned
priority,
bool
nonblock,
35
const
LinuxMqTimespec
* timeout);
36
int
receive(
char
* data,
size_t
length,
unsigned
* priority,
bool
nonblock,
37
const
LinuxMqTimespec
* timeout);
38
int
attributes(
FileDescriptor
& descriptor,
const
LinuxMqAttr
* requested,
LinuxMqAttr
* previous);
39
int
notify(
const
LinuxMqSigevent
* event);
40
void
cancelNotification(
size_t
pid);
41
void
clockChanged();
42
bool
mayOpen(
Process
* process,
int
flags)
const
;
43
bool
mayUnlink(
Process
* process)
const
;
44
const
String
& name()
const
;
45
ReadyMask queryReady();
46
ReadinessGenerations
readinessGenerations
()
override
;
47
48
private
:
49
MqueueState
* m_State;
50
};
51
52
int
posix_mq_open(
const
char
* name,
int
flags,
unsigned
mode,
const
LinuxMqAttr
* attr);
53
int
posix_mq_unlink(
const
char
* name);
54
int
posix_mq_timedsend(
int
fd,
const
char
* data,
size_t
length,
unsigned
priority,
55
const
LinuxMqTimespec
* timeout);
56
int
posix_mq_timedreceive(
int
fd,
char
* data,
size_t
length,
unsigned
* priority,
57
const
LinuxMqTimespec
* timeout);
58
int
posix_mq_notify(
int
fd,
const
LinuxMqSigevent
* event);
59
int
posix_mq_getsetattr(
int
fd,
const
LinuxMqAttr
* requested,
LinuxMqAttr
* previous);
60
void
posix_mqueue_close(
PosixMessageQueue
* queue,
size_t
pid);
61
void
posix_mqueue_process_exit(
size_t
pid);
62
void
posix_mqueue_clock_changed();
63
64
#endif
FileDescriptor
Definition
FileDescriptor.h:53
PosixMessageQueue
Definition
mqueue-syscalls.h:28
Process
Definition
Process.h:73
ReadinessSource
Definition
Readiness.h:86
ReadinessSource::readinessGenerations
virtual ReadinessGenerations readinessGenerations()
Definition
Readiness.cc:177
String
Definition
String.h:49
LinuxMqAttr
Definition
mqueue-syscalls.h:14
LinuxMqSigevent
Definition
mqueue-syscalls.h:20
LinuxMqTimespec
Definition
mqueue-syscalls.h:17
MqueueState
Definition
mqueue-state.h:23
ReadinessGenerations
Definition
Readiness.h:31
Generated on Tue Sep 22 2026 06:05:42 for The Pedigree Project by
1.9.8