include/gdb:

* callback.h (struct host_callback_struct): New members ftruncate
        and truncate.
gdb:
sim/common:
        * callback.c (os_ftruncate, os_truncate): New functions.
        (default_callback): Initialize ftruncate and truncate members.
sim/sh:
        * syscall.h (SYS_truncate, SYS_ftruncate): Define.
        * interp.c (trap): Add support for SYS_ftruncate and SYS_truncate.
This commit is contained in:
Joern Rennecke 2003-10-15 12:30:47 +00:00
parent cdc9c0bc96
commit 8822d0016c
5 changed files with 50 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2003-10-15 J"orn Rennecke <joern.rennecke@superh.com>
* callback.c (os_ftruncate, os_truncate): New functions.
(default_callback): Initialize ftruncate and truncate members.
2003-09-08 Dave Brolley <brolley@redhat.com>
On behalf of Doug Evans <dje@sebabeach.org>

View File

@ -399,6 +399,30 @@ os_fstat (p, fd, buf)
return wrap (p, fstat (fdmap (p, fd), buf));
}
static int
os_ftruncate (p, fd, len)
host_callback *p;
int fd;
long len;
{
int result;
result = fdbad (p, fd);
if (result)
return result;
result = wrap (p, ftruncate (fdmap (p, fd), len));
return result;
}
static int
os_truncate (p, file, len)
host_callback *p;
const char *file;
long len;
{
return wrap (p, stat (file, len));
}
static int
os_shutdown (p)
host_callback *p;
@ -538,6 +562,9 @@ host_callback default_callback =
os_stat,
os_fstat,
os_ftruncate,
os_truncate,
os_poll_quit,
os_shutdown,

View File

@ -1,3 +1,8 @@
2003-10-15 J"orn Rennecke <joern.rennecke@superh.com>
* syscall.h (SYS_truncate, SYS_ftruncate): Define.
* interp.c (trap): Add support for SYS_ftruncate and SYS_truncate.
2003-08-11 Shrinivas Atre <shrinivasa@KPITCummins.com>
* sim/sh/gencode.c ( tab[] ): Addition of MAC.L handler and
correction for MAC.W handler

View File

@ -1153,6 +1153,17 @@ trap (i, regs, insn_ptr, memory, maskl, maskw, endianw)
case SYS_time:
regs[0] = get_now ();
break;
case SYS_ftruncate:
regs[0] = callback->ftruncate (callback, regs[5], regs[6]);
break;
case SYS_truncate:
{
int len = strswaplen (regs[5]);
strnswap (regs[5], len);
regs[0] = callback->truncate (callback, ptr (regs[5]), regs[6]);
strnswap (regs[5], len);
break;
}
default:
regs[0] = -1;
break;

View File

@ -27,6 +27,8 @@
#define SYS_stat 38
#define SYS_pipe 42
#define SYS_execve 59
#define SYS_truncate 129
#define SYS_ftruncate 130
#define SYS_argc 172
#define SYS_argnlen 173
#define SYS_argn 174