The Pedigree Project 0.1
linux-resource-abi.h
1/*
2 * Copyright (c) 2026, Pedigree Developers
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted.
6 */
7
8#ifndef PEDIGREE_POSIX_LINUX_RESOURCE_ABI_H
9#define PEDIGREE_POSIX_LINUX_RESOURCE_ABI_H
10
11#include <stddef.h>
12#include <stdint.h>
13
15 uint64_t current;
16 uint64_t maximum;
17};
18
20 int64_t userSeconds;
21 int64_t userMicroseconds;
22 int64_t systemSeconds;
23 int64_t systemMicroseconds;
24 int64_t maximumResidentSetSize;
25 int64_t integralSharedMemorySize;
26 int64_t integralUnsharedDataSize;
27 int64_t integralUnsharedStackSize;
28 int64_t pageReclaims;
29 int64_t pageFaults;
30 int64_t swaps;
31 int64_t blockInputs;
32 int64_t blockOutputs;
33 int64_t messagesSent;
34 int64_t messagesReceived;
35 int64_t signalsReceived;
36 int64_t voluntaryContextSwitches;
37 int64_t involuntaryContextSwitches;
38};
39
40static_assert(sizeof(LinuxRlimit64) == 16, "Linux amd64 rlimit64 must remain 16 bytes");
41static_assert(sizeof(LinuxRusage64) == 144, "Linux amd64 rusage must remain 144 bytes");
42static_assert(offsetof(LinuxRusage64, userSeconds) == 0,
43 "Linux amd64 rusage user time offset changed");
44static_assert(offsetof(LinuxRusage64, systemSeconds) == 16,
45 "Linux amd64 rusage system time offset changed");
46static_assert(offsetof(LinuxRusage64, maximumResidentSetSize) == 32,
47 "Linux amd64 rusage maxrss offset changed");
48static_assert(offsetof(LinuxRusage64, involuntaryContextSwitches) == 136,
49 "Linux amd64 rusage nivcsw offset changed");
50
51#endif