The Pedigree Project 0.1
ResolvedPath.h
1/* Copyright (c) 2026, Pedigree Developers. */
2#ifndef POSIX_RESOLVEDPATH_H
3#define POSIX_RESOLVEDPATH_H
4#include "pedigree/kernel/process/FilesystemContext.h"
5#include "pedigree/kernel/process/TerminationDeferral.h"
6#include "pedigree/kernel/utilities/utility.h"
7
8// Syscall-local ownership; stored process and OFD paths remain inert references.
9class EXPORTED_PUBLIC ResolvedPath {
10 public:
12 File* get() const {
13 return m_Path ? m_Path->node() : nullptr;
14 }
15 explicit operator bool() const {
16 return static_cast<bool>(m_Path);
17 }
18 const FilesystemPathRef& path() const {
19 return m_Path;
20 }
21 void retain(const FilesystemPathRef& path);
22 void reset();
23 void swap(ResolvedPath& other) {
24 auto temporary = pedigree_std::move(m_Path);
25 m_Path = pedigree_std::move(other.m_Path);
26 other.m_Path = pedigree_std::move(temporary);
27 }
28
29 private:
30 TerminationDeferral m_Lifetime;
31 FilesystemPathRef m_Path;
32};
33#endif
Definition File.h:74