The Pedigree Project 0.1
mqueue-state.h
1/* Copyright (c) 2026, Pedigree Developers. */
2#ifndef POSIX_MQUEUE_STATE_H
3#define POSIX_MQUEUE_STATE_H
4
5#include "pedigree/kernel/process/ConditionVariable.h"
6#include "pedigree/kernel/process/Mutex.h"
7#include "pedigree/kernel/utilities/List.h"
8#include "pedigree/kernel/utilities/Pointers.h"
9
10#include "ipc-namespace.h"
11#include "mqueue-syscalls.h"
12#include "net-syscalls.h"
13
15 MqueueNotification() : process(nullptr), pid(0), event(), socket(), cookie() {}
16 Process* process;
17 size_t pid;
18 LinuxMqSigevent event;
20 uint8_t cookie[32];
21 void complete(bool removed);
22};
23
25 uint64_t namespaceId = posix_ipc_namespace_id();
26 struct Message {
27 Message() : next(-1), length(0), priority(0) {}
28 int next;
29 size_t length;
30 unsigned priority;
31 };
32 MqueueState(const String& name, size_t capacity, size_t size, int64_t uid, int64_t gid,
33 unsigned mode);
34 Mutex lock;
35 ConditionVariable readers, writers;
36 String name;
37 size_t capacity, size, count, receiverCount;
38 int64_t uid, gid;
39 unsigned mode;
40 int head, free;
41 UniqueArray<Message> messages;
43 MqueueNotification notification;
44 ReadinessGenerations generations;
45};
46
47extern Mutex g_MqueueRegistryLock;
48extern List<PosixMessageQueue*> g_Mqueues;
49
50#endif
Definition List.h:61
Definition Mutex.h:56