target_ulong buf, uint32_t len);
typedef uint32_t sys_readfn(ARMCPU *cpu, GuestFD *gf,
target_ulong buf, uint32_t len);
+typedef uint32_t sys_isattyfn(ARMCPU *cpu, GuestFD *gf);
static uint32_t host_closefn(ARMCPU *cpu, GuestFD *gf)
{
return len - ret;
}
+static uint32_t host_isattyfn(ARMCPU *cpu, GuestFD *gf)
+{
+ return isatty(gf->hostfd);
+}
+
static uint32_t gdb_closefn(ARMCPU *cpu, GuestFD *gf)
{
return arm_gdb_syscall(cpu, arm_semi_cb, "close,%x", gf->hostfd);
gf->hostfd, buf, len);
}
+static uint32_t gdb_isattyfn(ARMCPU *cpu, GuestFD *gf)
+{
+ return arm_gdb_syscall(cpu, arm_semi_cb, "isatty,%x", gf->hostfd);
+}
+
typedef struct GuestFDFunctions {
sys_closefn *closefn;
sys_writefn *writefn;
sys_readfn *readfn;
+ sys_isattyfn *isattyfn;
} GuestFDFunctions;
static const GuestFDFunctions guestfd_fns[] = {
.closefn = host_closefn,
.writefn = host_writefn,
.readfn = host_readfn,
+ .isattyfn = host_isattyfn,
},
[GuestFDGDB] = {
.closefn = gdb_closefn,
.writefn = gdb_writefn,
.readfn = gdb_readfn,
+ .isattyfn = gdb_isattyfn,
},
};
return set_swi_errno(env, -1);
}
- if (use_gdb_syscalls()) {
- return arm_gdb_syscall(cpu, arm_semi_cb, "isatty,%x", gf->hostfd);
- } else {
- return isatty(gf->hostfd);
- }
+ return guestfd_fns[gf->type].isattyfn(cpu, gf);
case TARGET_SYS_SEEK:
GET_ARG(0);
GET_ARG(1);