SyscallReturn getcwdFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
-/// Target unlink() handler.
+/// Target readlink() handler.
+SyscallReturn readlinkFunc(SyscallDesc *desc, int num,
+ LiveProcess *p, ThreadContext *tc,
+ int index = 0);
SyscallReturn readlinkFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
/// Target access() handler
SyscallReturn accessFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
+SyscallReturn accessFunc(SyscallDesc *desc, int num,
+ LiveProcess *p, ThreadContext *tc,
+ int index);
/// Futex system call
/// Implemented by Daniel Sanchez
return openFunc<OS>(desc, callnum, process, tc, 1);
}
+/// Target facessat() handler
+template <class OS>
+SyscallReturn
+faccessatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+ ThreadContext *tc)
+{
+ int index = 0;
+ int dirfd = process->getSyscallArg(tc, index);
+ if (dirfd != OS::TGT_AT_FDCWD)
+ warn("faccessat: first argument not AT_FDCWD; unlikely to work");
+ return accessFunc(desc, callnum, process, tc, 1);
+}
+
+/// Target readlinkat() handler
+template <class OS>
+SyscallReturn
+readlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+ ThreadContext *tc)
+{
+ int index = 0;
+ int dirfd = process->getSyscallArg(tc, index);
+ if (dirfd != OS::TGT_AT_FDCWD)
+ warn("openat: first argument not AT_FDCWD; unlikely to work");
+ return readlinkFunc(desc, callnum, process, tc, 1);
+}
+
/// Target sysinfo() handler.
template <class OS>
SyscallReturn
if (use_provided_address)
provided_address = process->getSyscallArg(tc, index);
- if ((start % TheISA::VMPageSize != 0) ||
- (new_length % TheISA::VMPageSize != 0) ||
- (provided_address % TheISA::VMPageSize != 0)) {
+ if ((start % TheISA::PageBytes != 0) ||
+ (new_length % TheISA::PageBytes != 0) ||
+ (provided_address % TheISA::PageBytes != 0)) {
warn("mremap failing: arguments not page aligned");
return -EINVAL;
}
}
}
- if ((start % TheISA::VMPageSize) != 0 ||
- (length % TheISA::VMPageSize) != 0) {
+ if ((start % TheISA::PageBytes) != 0 ||
+ (length % TheISA::PageBytes) != 0) {
warn("mmap failing: arguments not page-aligned: "
"start 0x%x length 0x%x",
start, length);