Make cgroup.{cc,hh} linux-only files

Forcing a conditional include, vs making the headers content
conditional, I think is more maintainable.

It is also how the other platform-specific headers (like
`namespaces.hh`) have been adapted.
This commit is contained in:
John Ericson 2024-04-05 12:25:43 -04:00
parent 74130fd1f1
commit 513634ab5b
3 changed files with 1 additions and 9 deletions

View file

@ -14,7 +14,6 @@
#include "topo-sort.hh" #include "topo-sort.hh"
#include "callback.hh" #include "callback.hh"
#include "json-utils.hh" #include "json-utils.hh"
#include "cgroup.hh"
#include "personality.hh" #include "personality.hh"
#include "current-process.hh" #include "current-process.hh"
#include "child.hh" #include "child.hh"
@ -52,6 +51,7 @@
# include <seccomp.h> # include <seccomp.h>
# endif # endif
# define pivot_root(new_root, put_old) (syscall(SYS_pivot_root, new_root, put_old)) # define pivot_root(new_root, put_old) (syscall(SYS_pivot_root, new_root, put_old))
# include "cgroup.hh"
#endif #endif
#if __APPLE__ #if __APPLE__

View file

@ -1,5 +1,3 @@
#if __linux__
#include "cgroup.hh" #include "cgroup.hh"
#include "util.hh" #include "util.hh"
#include "file-system.hh" #include "file-system.hh"
@ -145,5 +143,3 @@ CgroupStats destroyCgroup(const Path & cgroup)
} }
} }
#endif

View file

@ -1,8 +1,6 @@
#pragma once #pragma once
///@file ///@file
#if __linux__
#include <chrono> #include <chrono>
#include <optional> #include <optional>
@ -28,5 +26,3 @@ struct CgroupStats
CgroupStats destroyCgroup(const Path & cgroup); CgroupStats destroyCgroup(const Path & cgroup);
} }
#endif