syscall: Implementation of the ftruncate64 system call.
This commit is contained in:
parent
7cdd5316ab
commit
c32d919bc0
2 changed files with 21 additions and 0 deletions
|
@ -404,6 +404,22 @@ ftruncateFunc(SyscallDesc *desc, int num,
|
|||
return (result == -1) ? -errno : result;
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
ftruncate64Func(SyscallDesc *desc, int num,
|
||||
LiveProcess *process, ThreadContext *tc)
|
||||
{
|
||||
int fd = process->sim_fd(process->getSyscallArg(tc, 0));
|
||||
|
||||
if (fd < 0)
|
||||
return -EBADF;
|
||||
|
||||
// I'm not sure why, but the length argument is in arg reg 3
|
||||
loff_t length = process->getSyscallArg(tc, 3);
|
||||
|
||||
int result = ftruncate64(fd, length);
|
||||
return (result == -1) ? -errno : result;
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
||||
{
|
||||
|
|
|
@ -260,6 +260,11 @@ SyscallReturn ftruncateFunc(SyscallDesc *desc, int num,
|
|||
LiveProcess *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target ftruncate64() handler.
|
||||
SyscallReturn ftruncate64Func(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
|
||||
|
||||
/// Target umask() handler.
|
||||
SyscallReturn umaskFunc(SyscallDesc *desc, int num,
|
||||
LiveProcess *p, ThreadContext *tc);
|
||||
|
|
Loading…
Reference in a new issue