syscall: Implementation of the ftruncate64 system call.
This commit is contained in:
parent
7cdd5316ab
commit
c32d919bc0
|
@ -404,6 +404,22 @@ ftruncateFunc(SyscallDesc *desc, int num,
|
||||||
return (result == -1) ? -errno : result;
|
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
|
SyscallReturn
|
||||||
umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,6 +260,11 @@ SyscallReturn ftruncateFunc(SyscallDesc *desc, int num,
|
||||||
LiveProcess *p, ThreadContext *tc);
|
LiveProcess *p, ThreadContext *tc);
|
||||||
|
|
||||||
|
|
||||||
|
/// Target ftruncate64() handler.
|
||||||
|
SyscallReturn ftruncate64Func(SyscallDesc *desc, int num,
|
||||||
|
LiveProcess *p, ThreadContext *tc);
|
||||||
|
|
||||||
|
|
||||||
/// Target umask() handler.
|
/// Target umask() handler.
|
||||||
SyscallReturn umaskFunc(SyscallDesc *desc, int num,
|
SyscallReturn umaskFunc(SyscallDesc *desc, int num,
|
||||||
LiveProcess *p, ThreadContext *tc);
|
LiveProcess *p, ThreadContext *tc);
|
||||||
|
|
Loading…
Reference in a new issue