Enumerations
enum AccessType
| Name | Value |
|---|---|
| Read | 0 |
| Write | 1 |
Defined at line 558 of file ../../src/starnix/tests/syscalls/cpp/test_helper.h
Records
-
class CloneHelper -
class EventFdSem -
class ForkHelper -
class ForkResult -
class Holder -
class MemoryMapping -
class MemoryMappingExt -
class MountInfo -
class NetlinkEncoder -
class Poker -
class Rendezvous -
class ScopedLoopDevice -
class ScopedMMap -
class ScopedMount -
class ScopedPerfEventParanoid -
class ScopedPipe -
class ScopedTempDir -
class ScopedTempFD -
class ScopedTempSymlink -
class ScopedUinputDevice -
class SignalMaskHelper
Functions
-
void DropAllCapabilities ()Drops all capabilities from the effective, permitted, and inheritable sets.
Defined at line 18 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
bool HasCapability (int cap)Checks if a capability is in the effective set.
Defined at line 27 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void UnsetCapability (int cap)Unsets a capability from the effective set.
Defined at line 30 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
bool HasCapabilityEffective (int cap)Checks whether a capability is in the thread's effective set.
Defined at line 33 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
bool HasCapabilityPermitted (int cap)Checks whether a capability is in the thread's permitted set.
Defined at line 43 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
bool HasCapabilityInheritable (int cap)Checks whether a capability is in the thread's inheritable set.
Defined at line 53 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
bool HasCapabilityAmbient (int cap)Checks whether a capability is in the thread's ambient set.
Defined at line 62 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
bool HasCapabilityBounding (int cap)Checks whether a capability is in the thread's bounding set.
Defined at line 66 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void UnsetCapabilityEffective (int cap)Removes a capability from the thread's effective set.
Defined at line 69 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void UnsetCapabilityPermitted (int cap)Removes a capability from the thread's permitted set.
Defined at line 80 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void UnsetCapabilityInheritable (int cap)Removes a capability from the thread's inheritable set.
Defined at line 91 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void UnsetCapabilityAmbient (int cap)Removes a capability from the thread's ambient set.
Defined at line 102 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void UnsetCapabilityBounding (int cap)Removes a capability from the thread's bounded set.
Defined at line 107 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void DropAllAmbientCapabilities ()Drops all capabilities from the ambient set.
Defined at line 147 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void SetCapabilityEffective (int cap)Sets a capability in the thread's effective set.
Defined at line 110 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void SetCapabilityPermitted (int cap)Sets a capability in the thread's permitted set.
Defined at line 121 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void SetCapabilityInheritable (int cap)Sets a capability in the thread's inheritable set.
Defined at line 132 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void SetCapabilityAmbient (int cap)Sets a capability in the thread's ambient set.
Defined at line 143 of file ../../src/starnix/tests/syscalls/cpp/capabilities_helper.cc
-
void SetCapabilityBounding (int cap)Sets a capability in the thread's bounding set.
-
void waitForChildSucceeds (unsigned intwaitFlag,intcloneFlags,int (*)(void *)childRunFunction,int (*)(void *)parentRunFunction)Defined at line 340 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
void waitForChildFails (unsigned intwaitFlag,intcloneFlags,int (*)(void *)childRunFunction,int (*)(void *)parentRunFunction)Defined at line 356 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::string get_tmp_path ()Defined at line 370 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::string GetSystemDynamicLinkerPath ()Returns the path to the system dynamic linker requested by /proc/self/exe.
Defined at line 380 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::string GetTestResourcePath (const std::string & resource)Returns the path to a test resource named `resource`, which should be in
"data" relative to the current working directory.
Defined at line 412 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::ostream & operator<< (std::ostream & os, const MemoryMappingExt & mapping)Defined at line 548 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::optional<size_t> parse_field_in_kb (std::string_view value)Defined at line 465 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
fit::result<int> SetCasefold (const std::string & path, bool enable)Defined at line 839 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::optional<MemoryMapping> find_memory_mapping (fit::function<bool (const MemoryMapping &)> match, std::string_view maps)Returns the first memory mapping that matches the given predicate.
Defined at line 479 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::optional<MemoryMapping> find_memory_mapping (uintptr_t addr, std::string_view maps)Defined at line 496 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::optional<MemoryMappingExt> find_memory_mapping_ext (fit::function<bool (const MemoryMappingExt &)> match, std::string_view maps)Same as above, but with info from smaps
Defined at line 502 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::optional<MemoryMappingExt> find_memory_mapping_ext (uintptr_t addr, std::string_view maps)Defined at line 540 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::string RandomHexString (size_t length)Returns a random hex string of the given length.
Defined at line 564 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
bool HasSysAdmin ()Returns true if running with sysadmin capabilities.
Defined at line 576 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
bool HasCapability (uint32_t cap)Returns true if running with the given capability.
-
bool IsStarnix ()Returns true if running on Starnix. This is likely only necessary when there are known bugs.
Defined at line 578 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
bool IsKernelVersionAtLeast (int min_major, int min_minor)Returns true if reported kernel version is equal or greater than a given one.
Defined at line 583 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
void RecursiveUnmountAndRemove (const std::string & path)Unmount anything mounted at or under `path` and remove it.
Defined at line 595 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
bool TryRead (uintptr_t addr)Attempts to read a byte from the given memory address.
Returns whether the read succeeded or not.
Defined at line 666 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
bool TryWrite (uintptr_t addr)Attempts to write a zero byte to the given memory address.
Returns whether the write succeeded or not.
Defined at line 675 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
int MemFdCreate (const char * name, unsigned int flags)Wrapper for the memfd_create system call.
Defined at line 656 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
int PidFdOpen (pid_t pid, unsigned int flags)Wrapper for the pidfd_open system call.
Defined at line 660 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
testing::AssertionResult WaitUntilBlocked (pid_t target, bool ignore_tracer)Wait until the target process indicates a sleeping (S) or traced sleeping (t) state.
Defined at line 682 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
testing::AssertionResult WaitUntilZombie (pid_t target)Wait until the target process indicates a zombie (Z) state.
Defined at line 688 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::optional<std::string_view> GetTaskState (std::string_view stat)Extracts the task state (R, S, T, Z, etc.) from the contents of /proc/
<pid
>/task/
<tid
>/stat.
Defined at line 693 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
testing::AssertionResult WaitForTaskState (pid_tpid,pid_ttid,fit::function<bool (std::string_view)>predicate)Loop until the target task's process state in /proc/
<pid
>/task/
<tid
>/stat satisfies the given
predicate function. The string passed to the predicate is the task state (R, S, T, Z, etc.).
Defined at line 704 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
testing::AssertionResult TestThatAccessSegfaults (void * test_address, AccessType type)Checks whether the provided access segfaults.
Defined at line 725 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
Rendezvous MakeRendezvous ()Constructs a new pipe-backed `Poker`-`Holder` pair for synchronization of two
threads or processes.
Defined at line 915 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
Rendezvous MakeRendezvous (ScopedPipe pipe)Constructs a `Poker`-`Holder` pair from an existing pipe.
Defined at line 917 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
fit::result<int, std::vector<MountInfo>> ReadMountInfo ()Reads and parses "/proc/self/mountinfo".
Defined at line 924 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::optional<MountInfo> ReadMountInfoLine (const std::string & path)Reads "/proc/self/mountinfo" and returns the info for the mount at `path`.
If no such mount is found, or the file cannot be read, the result will be an empty optional.
Defined at line 970 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
fit::result<int, std::set<std::string>> ListDirectory (const char * dir)Returns the set of file names in `dir`. `.` and `..` are not included.
If `dir` does not exist or cannot be opened, returns an error (e.g. ENOENT).
Defined at line 985 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
std::vector<std::string> WaitForDevice (const std::set<std::string> & ls_before)Polls `/dev/input` for up to 10 seconds until new device entries appear that were
not present in `ls_before`.
Returns a vector of newly appeared device names. If the poll times out and no
new devices appeared, the returned vector will be empty. Note that more than one
device name may be returned if multiple devices appeared.
Defined at line 1003 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
-
bool WaitForDevicesRemoved (const std::set<std::string> & baseline)Polls `/dev/input` for up to 10 seconds until it only contains entries that are in
`baseline`, i.e. until every device created after `baseline` was taken has been removed.
Pre-existing devices (e.g. real input hardware) in `baseline` are allowed to remain.
Returns true if all such devices were removed (or `/dev/input` does not exist), and false
on timeout or error.
Defined at line 1024 of file ../../src/starnix/tests/syscalls/cpp/test_helper.cc
Variables
const char[37] kPerfEventParanoidPath
Defined at line 212 of file ../../src/starnix/tests/syscalls/cpp/test_helper.h