libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
other.hxx
1#pragma once
2
3// clues
4#include <clues/SystemCall.hxx>
5#include <clues/items/items.hxx>
6#include <clues/items/limits.hxx>
7#include <clues/items/process.hxx>
8#include <clues/sysnrs/generic.hxx>
9
10namespace clues {
11
12struct CLUES_API UnknownSystemCall :
13 public SystemCall {
14 explicit UnknownSystemCall(const SystemCallNr nr) :
15 SystemCall{nr},
16 result{"result", ""} {
17 setReturnItem(result);
18 addParameters(item);
19 }
20
21 item::ReturnValue result;
23};
24
25// This covers both getrlimit() and setrlimit() which use the same data structures
26template <SystemCallNr LIMIT_SYS_NR>
27struct CLUES_API LimitSystemCallT :
28 public SystemCall {
29
30 LimitSystemCallT() :
31 SystemCall{LIMIT_SYS_NR},
32 limit{LIMIT_SYS_NR == SystemCallNr::GETRLIMIT ?
34 setReturnItem(result);
35 setParameters(type, limit);
36 }
37
41};
42
43using GetRlimitSystemCall = LimitSystemCallT<SystemCallNr::GETRLIMIT>;
44using SetRlimitSystemCall = LimitSystemCallT<SystemCallNr::SETRLIMIT>;
45
46struct CLUES_API Prlimit64SystemCall :
47 public SystemCall {
48
49 Prlimit64SystemCall() :
50 SystemCall{SystemCallNr::PRLIMIT64},
51 pid{ItemType::PARAM_IN, "target process"},
52 limit{ItemType::PARAM_IN},
53 old_limit{ItemType::PARAM_OUT, "old_limit"} {
54 setReturnItem(result);
55 setParameters(pid, type, limit, old_limit);
56 }
57
61 item::ResourceLimit old_limit;
63};
64
65struct CLUES_API RestartSystemCall :
66 public SystemCall {
67
68 RestartSystemCall() :
69 SystemCall{SystemCallNr::RESTART_SYSCALL} {
70 setReturnItem(result);
71 }
72
74};
75
76struct CLUES_API ExitGroupSystemCall :
77 public SystemCall {
78
79 ExitGroupSystemCall() :
80 SystemCall{SystemCallNr::EXIT_GROUP},
81 status{ItemType::PARAM_IN, "exit code"} {
82 setReturnItem(result);
83 setParameters(status);
84 }
85
87 item::SuccessResult result; // actually it never returns
88};
89
90} // end ns
void setReturnItem(SystemCallItem &ret)
Sets the return value system call item.
SystemCall(const SystemCallNr nr)
Instantiates a new SystemCall object with given properties.
A resource kind specification as used in getrlimit & friends.
Definition limits.hxx:20
Base class for a system call return values.
Definition items.hxx:17
An always-success return value.
Definition error.hxx:15
@ PARAM_OUT
An output parameter filled by in by the system call.
@ PARAM_IN
An input parameter to the system call.
SystemCallNr
Abstract system call number usable across architectures and ABIs.
Definition generic.hxx:29
Item used together with UnknownSystemCall.
Definition items.hxx:319