OmaPhoto 1.0.0: the Linux port of Compositor
A layered image editor for Linux and Omarchy, ported from Compositor (github.com/robbietilton/Compositor), whose Swift source is its specification. It reads and writes Compositor's .comp projects. Packages for Ubuntu, Fedora and Arch come from the release workflow; scripts/install/ holds one install script per distribution family, and flake.nix serves NixOS. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
c864304695
564 files changed
+100804
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include <QFile>
|
||||
#include <QLibraryInfo>
|
||||
#include <QVersionNumber>
|
||||
#include <stdexcept>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// While alive, the process may map only `margin` more bytes.
|
||||
class AddressSpaceLimit {
|
||||
public:
|
||||
explicit AddressSpaceLimit(qint64 margin)
|
||||
{
|
||||
QFile statm("/proc/self/statm");
|
||||
if (!statm.open(QIODevice::ReadOnly) || getrlimit(RLIMIT_AS, &m_previous) != 0)
|
||||
throw std::runtime_error("cannot read the address space in use");
|
||||
const qint64 mapped = statm.readAll().split(' ').first().toLongLong() * sysconf(_SC_PAGESIZE);
|
||||
rlimit tight = m_previous;
|
||||
tight.rlim_cur = rlim_t(mapped + margin);
|
||||
if (setrlimit(RLIMIT_AS, &tight) != 0)
|
||||
throw std::runtime_error("cannot lower RLIMIT_AS");
|
||||
}
|
||||
~AddressSpaceLimit() { setrlimit(RLIMIT_AS, &m_previous); }
|
||||
AddressSpaceLimit(const AddressSpaceLimit &) = delete;
|
||||
AddressSpaceLimit &operator=(const AddressSpaceLimit &) = delete;
|
||||
|
||||
private:
|
||||
rlimit m_previous;
|
||||
};
|
||||
|
||||
// Failure points are placed by Qt 6.4's own allocations.
|
||||
inline bool placesStarvation()
|
||||
{
|
||||
return QLibraryInfo::version().majorVersion() == 6 && QLibraryInfo::version().minorVersion() == 4;
|
||||
}
|
||||
Reference in new issue
Block a user