freepdfeditor/spike/E_sandbox/DocumentProcess.h

24 lines
979 B
C++

// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2025 ai-ad4 and the FreePDFEditor contributors
//
// DocumentProcess.h — the sandboxed document process side of Spike E. It
// installs the seccomp filter, then runs a Cap'n Proto RPC loop answering
// ParseRequest messages from the UI process. This is the trivial parser the
// §14 step 8 spike uses to measure the process-split cost: the "parse"
// operation counts the bytes it was handed and returns the count.
#ifndef FREEPDFEDITOR_SPIKE_E_DOCUMENTPROCESS_H
#define FREEPDFEDITOR_SPIKE_E_DOCUMENTPROCESS_H
#include <string>
namespace freepdfeditor::spike::e {
// Run the document process on the given fd (one end of a socketpair). Installs
// the sandbox, then serves Parse requests until the UI process closes the
// channel. Returns 0 on clean exit, non-zero on error.
int run_document_process(int fd);
} // namespace freepdfeditor::spike::e
#endif // FREEPDFEDITOR_SPIKE_E_DOCUMENTPROCESS_H