mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 09:58:19 +08:00
* cris/traps.c (TARGET_SYS_access, TARGET_R_OK, TARGET_W_OK)
(TARGET_X_OK, TARGET_F_OK): Define. (cris_break_13_handler) <case TARGET_SYS_access>: New case.
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
2009-01-03 Hans-Peter Nilsson <hp@axis.com>
|
2009-01-03 Hans-Peter Nilsson <hp@axis.com>
|
||||||
|
|
||||||
|
* cris/traps.c (TARGET_SYS_access, TARGET_R_OK, TARGET_W_OK)
|
||||||
|
(TARGET_X_OK, TARGET_F_OK): Define.
|
||||||
|
(cris_break_13_handler) <case TARGET_SYS_access>: New case.
|
||||||
|
|
||||||
* cris/semcrisv32f-switch.c: Regenerate.
|
* cris/semcrisv32f-switch.c: Regenerate.
|
||||||
|
|
||||||
2008-12-30 Hans-Peter Nilsson <hp@axis.com>
|
2008-12-30 Hans-Peter Nilsson <hp@axis.com>
|
||||||
|
@ -65,6 +65,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
#define TARGET_SYS_time 13
|
#define TARGET_SYS_time 13
|
||||||
#define TARGET_SYS_lseek 19
|
#define TARGET_SYS_lseek 19
|
||||||
#define TARGET_SYS_getpid 20
|
#define TARGET_SYS_getpid 20
|
||||||
|
#define TARGET_SYS_access 33
|
||||||
#define TARGET_SYS_kill 37
|
#define TARGET_SYS_kill 37
|
||||||
#define TARGET_SYS_rename 38
|
#define TARGET_SYS_rename 38
|
||||||
#define TARGET_SYS_pipe 42
|
#define TARGET_SYS_pipe 42
|
||||||
@ -244,6 +245,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
/* From linux/limits.h. */
|
/* From linux/limits.h. */
|
||||||
#define TARGET_PIPE_BUF 4096
|
#define TARGET_PIPE_BUF 4096
|
||||||
|
|
||||||
|
/* From unistd.h. */
|
||||||
|
#define TARGET_R_OK 4
|
||||||
|
#define TARGET_W_OK 2
|
||||||
|
#define TARGET_X_OK 1
|
||||||
|
#define TARGET_F_OK 0
|
||||||
|
|
||||||
static const char stat_map[] =
|
static const char stat_map[] =
|
||||||
"st_dev,2:space,10:space,4:st_mode,4:st_nlink,4:st_uid,4"
|
"st_dev,2:space,10:space,4:st_mode,4:st_nlink,4:st_uid,4"
|
||||||
":st_gid,4:st_rdev,2:space,10:st_size,8:st_blksize,4:st_blocks,4"
|
":st_gid,4:st_rdev,2:space,10:st_size,8:st_blksize,4:st_blocks,4"
|
||||||
@ -2648,6 +2655,56 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TARGET_SYS_access:
|
||||||
|
{
|
||||||
|
SI path = arg1;
|
||||||
|
SI mode = arg2;
|
||||||
|
char *pbuf = xmalloc (SIM_PATHMAX);
|
||||||
|
int i;
|
||||||
|
int o = 0;
|
||||||
|
int hmode = 0;
|
||||||
|
|
||||||
|
if (sim_core_read_unaligned_1 (current_cpu, pc, 0, path) == '/')
|
||||||
|
{
|
||||||
|
strcpy (pbuf, simulator_sysroot);
|
||||||
|
o += strlen (simulator_sysroot);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i + o < SIM_PATHMAX; i++)
|
||||||
|
{
|
||||||
|
pbuf[i + o]
|
||||||
|
= sim_core_read_unaligned_1 (current_cpu, pc, 0, path + i);
|
||||||
|
if (pbuf[i + o] == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i + o == SIM_PATHMAX)
|
||||||
|
{
|
||||||
|
retval = -cb_host_to_target_errno (cb, ENAMETOOLONG);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Assert that we don't get calls for files for which we
|
||||||
|
don't have support. */
|
||||||
|
if (strncmp (pbuf + strlen (simulator_sysroot),
|
||||||
|
"/proc/", 6) == 0)
|
||||||
|
abort ();
|
||||||
|
#define X_AFLAG(x) if (mode & TARGET_ ## x) hmode |= x
|
||||||
|
X_AFLAG (R_OK);
|
||||||
|
X_AFLAG (W_OK);
|
||||||
|
X_AFLAG (X_OK);
|
||||||
|
X_AFLAG (F_OK);
|
||||||
|
#undef X_AFLAG
|
||||||
|
|
||||||
|
if (access (pbuf, hmode) != 0)
|
||||||
|
retval = -cb_host_to_target_errno (cb, errno);
|
||||||
|
else
|
||||||
|
retval = 0;
|
||||||
|
|
||||||
|
free (pbuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case TARGET_SYS_readlink:
|
case TARGET_SYS_readlink:
|
||||||
{
|
{
|
||||||
SI path = arg1;
|
SI path = arg1;
|
||||||
|
Reference in New Issue
Block a user