The Pedigree Project 0.1
memfd-file.h
1/* Copyright (c) 2026, Pedigree Developers. */
2#ifndef POSIX_MEMFD_FILE_H
3#define POSIX_MEMFD_FILE_H
4
6
7namespace LinuxMemFd {
8constexpr unsigned CloseOnExec = 1, AllowSealing = 2;
9constexpr unsigned Seal = 1, Shrink = 2, Grow = 4, Write = 8, FutureWrite = 16;
10constexpr unsigned AllSeals = Seal | Shrink | Grow | Write | FutureWrite;
11constexpr size_t MaximumNameLength = 249;
12} // namespace LinuxMemFd
13
14class EXPORTED_PUBLIC MemFdFile final : public RamFile {
15 public:
16 MemFdFile(const String& name, bool allowSealing, size_t uid, size_t gid);
17 ~MemFdFile() override = default;
18
19 static MemFdFile* fromFile(File* file);
20 Attributes getAttributes() const override;
21 int getSeals();
22 int addSeals(unsigned seals);
23 bool allowMapping(bool shared, bool writeRequested, bool& mayWrite) override;
24
25 protected:
26 bool prepareWrite(uint64_t location, uint64_t size) override;
27 bool allowResize(size_t oldSize, size_t newSize) override;
28
29 private:
30 unsigned m_Seals;
31};
32
33#endif
An in-RAM filesystem.
Definition File.h:74
virtual bool allowMapping(bool shared, bool writeRequested, bool &mayWrite)
Definition File.cc:1093