#include <iostream>
#include <mutex>
#include <string>
+#include <unordered_map>
#include "arch/utility.hh"
#include "base/chunk_generator.hh"
SyscallReturn
ignoreFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
{
- if (desc->needWarning()) {
- warn("ignoring syscall %s(...)%s", desc->name(), desc->warnOnce() ?
- "\n (further warnings will be suppressed)" : "");
+ warn("ignoring syscall %s(...)", desc->name());
+ return 0;
+}
+
+SyscallReturn
+ignoreWarnOnceFunc(SyscallDesc *desc, int num, ThreadContext *tc)
+{
+ static std::unordered_map<SyscallDesc *, bool> bool_map;
+
+ bool &warned = bool_map[desc];
+ if (!warned) {
+ warn("ignoring syscall %s(...)\n"
+ " (further warnings will be suppressed)", desc->name());
+ warned = true;
}
return 0;
/// Handler for unimplemented syscalls that we never intend to
/// implement (signal handling, etc.) and should not affect the correct
-/// behavior of the program. Print a warning only if the appropriate
-/// trace flag is enabled. Return success to the target program.
+/// behavior of the program. Prints a warning. Return success to the target
+/// program.
SyscallReturn ignoreFunc(SyscallDesc *desc, int num, ThreadContext *tc);
+/// Like above, but only prints a warning once per syscall desc it's used with.
+SyscallReturn
+ignoreWarnOnceFunc(SyscallDesc *desc, int num, ThreadContext *tc);
// Target fallocateFunc() handler.
SyscallReturn fallocateFunc(SyscallDesc *desc, int num, ThreadContext *tc);