mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-14 11:25:52 +08:00
* syscall.c (cb_syscall) <case CB_SYS_lstat>: New case.
* callback.c (os_lstat): New function.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2004-12-13 Hans-Peter Nilsson <hp@axis.com>
|
||||||
|
|
||||||
|
* syscall.c (cb_syscall) <case CB_SYS_lstat>: New case.
|
||||||
|
* callback.c (os_lstat): New function.
|
||||||
|
|
||||||
2004-12-08 Hans-Peter Nilsson <hp@axis.com>
|
2004-12-08 Hans-Peter Nilsson <hp@axis.com>
|
||||||
|
|
||||||
* run.1: Document --sysroot=filepath.
|
* run.1: Document --sysroot=filepath.
|
||||||
|
@ -407,6 +407,16 @@ os_fstat (p, fd, buf)
|
|||||||
return wrap (p, fstat (fdmap (p, fd), buf));
|
return wrap (p, fstat (fdmap (p, fd), buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
os_lstat (p, file, buf)
|
||||||
|
host_callback *p;
|
||||||
|
const char *file;
|
||||||
|
struct stat *buf;
|
||||||
|
{
|
||||||
|
/* NOTE: hpn/2004-12-12: Same issue here as with os_fstat. */
|
||||||
|
return wrap (p, lstat (file, buf));
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
os_ftruncate (p, fd, len)
|
os_ftruncate (p, fd, len)
|
||||||
host_callback *p;
|
host_callback *p;
|
||||||
@ -589,6 +599,7 @@ host_callback default_callback =
|
|||||||
|
|
||||||
os_stat,
|
os_stat,
|
||||||
os_fstat,
|
os_fstat,
|
||||||
|
os_lstat,
|
||||||
|
|
||||||
os_ftruncate,
|
os_ftruncate,
|
||||||
os_truncate,
|
os_truncate,
|
||||||
|
@ -471,6 +471,50 @@ cb_syscall (cb, sc)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CB_SYS_lstat :
|
||||||
|
{
|
||||||
|
char *path, *buf;
|
||||||
|
int buflen;
|
||||||
|
struct stat statbuf;
|
||||||
|
TADDR addr = sc->arg2;
|
||||||
|
|
||||||
|
errcode = get_path (cb, sc, sc->arg1, &path);
|
||||||
|
if (errcode != 0)
|
||||||
|
{
|
||||||
|
result = -1;
|
||||||
|
goto FinishSyscall;
|
||||||
|
}
|
||||||
|
result = (*cb->lstat) (cb, path, &statbuf);
|
||||||
|
free (path);
|
||||||
|
if (result < 0)
|
||||||
|
goto ErrorFinish;
|
||||||
|
|
||||||
|
buflen = cb_host_to_target_stat (cb, NULL, NULL);
|
||||||
|
buf = xmalloc (buflen);
|
||||||
|
if (cb_host_to_target_stat (cb, &statbuf, buf) != buflen)
|
||||||
|
{
|
||||||
|
/* The translation failed. This is due to an internal
|
||||||
|
host program error, not the target's fault.
|
||||||
|
Unfortunately, it's hard to test this case, so there's no
|
||||||
|
test-case for this execution path. */
|
||||||
|
free (buf);
|
||||||
|
errcode = ENOSYS;
|
||||||
|
result = -1;
|
||||||
|
goto FinishSyscall;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*sc->write_mem) (cb, sc, addr, buf, buflen) != buflen)
|
||||||
|
{
|
||||||
|
free (buf);
|
||||||
|
errcode = EINVAL;
|
||||||
|
result = -1;
|
||||||
|
goto FinishSyscall;
|
||||||
|
}
|
||||||
|
|
||||||
|
free (buf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case CB_SYS_time :
|
case CB_SYS_time :
|
||||||
{
|
{
|
||||||
/* FIXME: May wish to change CB_SYS_time to something else.
|
/* FIXME: May wish to change CB_SYS_time to something else.
|
||||||
|
Reference in New Issue
Block a user