target: Use size_t instead of unsigned in syscall interface.
This commit is contained in:
parent
26fab877da
commit
ab06243e93
|
@ -29,25 +29,26 @@ int gdb_main_loop(struct target_controller *, bool in_syscall);
|
||||||
int hostio_reply(struct target_controller *tc, char *pbuf, int len)
|
int hostio_reply(struct target_controller *tc, char *pbuf, int len)
|
||||||
{
|
{
|
||||||
(void)len;
|
(void)len;
|
||||||
int retcode, items;
|
int retcode, items, errno_;
|
||||||
char c, *p;
|
char c, *p;
|
||||||
if (pbuf[1] == '-')
|
if (pbuf[1] == '-')
|
||||||
p = &pbuf[2];
|
p = &pbuf[2];
|
||||||
else
|
else
|
||||||
p = &pbuf[1];
|
p = &pbuf[1];
|
||||||
items = sscanf(p, "%x,%x,%c", &retcode, &tc->errno_, &c);
|
items = sscanf(p, "%x,%x,%c", &retcode, &errno_, &c);
|
||||||
if (pbuf[1] == '-')
|
if (pbuf[1] == '-')
|
||||||
retcode = -retcode;
|
retcode = -retcode;
|
||||||
|
|
||||||
/* if break is requested */
|
/* if break is requested */
|
||||||
tc->interrupted = items == 3 && c == 'C';
|
tc->interrupted = items == 3 && c == 'C';
|
||||||
|
tc->errno_ = errno_;
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interface to host system calls */
|
/* Interface to host system calls */
|
||||||
int hostio_open(struct target_controller *tc,
|
int hostio_open(struct target_controller *tc,
|
||||||
target_addr path, unsigned path_len,
|
target_addr path, size_t path_len,
|
||||||
enum target_open_flags flags, mode_t mode)
|
enum target_open_flags flags, mode_t mode)
|
||||||
{
|
{
|
||||||
gdb_putpacket_f("Fopen,%08X/%X,%08X,%08X", path, path_len, flags, mode);;;;
|
gdb_putpacket_f("Fopen,%08X/%X,%08X,%08X", path, path_len, flags, mode);;;;
|
||||||
|
@ -82,8 +83,8 @@ long hostio_lseek(struct target_controller *tc,
|
||||||
}
|
}
|
||||||
|
|
||||||
int hostio_rename(struct target_controller *tc,
|
int hostio_rename(struct target_controller *tc,
|
||||||
target_addr oldpath, unsigned old_len,
|
target_addr oldpath, size_t old_len,
|
||||||
target_addr newpath, unsigned new_len)
|
target_addr newpath, size_t new_len)
|
||||||
{
|
{
|
||||||
gdb_putpacket_f("Frename,%08X/%X,%08X/%X",
|
gdb_putpacket_f("Frename,%08X/%X,%08X/%X",
|
||||||
oldpath, old_len, newpath, new_len);
|
oldpath, old_len, newpath, new_len);
|
||||||
|
@ -91,14 +92,14 @@ int hostio_rename(struct target_controller *tc,
|
||||||
}
|
}
|
||||||
|
|
||||||
int hostio_unlink(struct target_controller *tc,
|
int hostio_unlink(struct target_controller *tc,
|
||||||
target_addr path, unsigned path_len)
|
target_addr path, size_t path_len)
|
||||||
{
|
{
|
||||||
gdb_putpacket_f("Funlink,%08X/%X", path, path_len);
|
gdb_putpacket_f("Funlink,%08X/%X", path, path_len);
|
||||||
return gdb_main_loop(tc, true);
|
return gdb_main_loop(tc, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hostio_stat(struct target_controller *tc,
|
int hostio_stat(struct target_controller *tc,
|
||||||
target_addr path, unsigned path_len, target_addr buf)
|
target_addr path, size_t path_len, target_addr buf)
|
||||||
{
|
{
|
||||||
gdb_putpacket_f("Fstat,%08X/%X,%08X", path, path_len, buf);
|
gdb_putpacket_f("Fstat,%08X/%X,%08X", path, path_len, buf);
|
||||||
return gdb_main_loop(tc, true);
|
return gdb_main_loop(tc, true);
|
||||||
|
@ -124,7 +125,7 @@ int hostio_isatty(struct target_controller *tc, int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
int hostio_system(struct target_controller *tc,
|
int hostio_system(struct target_controller *tc,
|
||||||
target_addr cmd, unsigned cmd_len)
|
target_addr cmd, size_t cmd_len)
|
||||||
{
|
{
|
||||||
gdb_putpacket_f("Fsystem,%08X/%X", cmd, cmd_len);
|
gdb_putpacket_f("Fsystem,%08X/%X", cmd, cmd_len);
|
||||||
return gdb_main_loop(tc, true);
|
return gdb_main_loop(tc, true);
|
||||||
|
|
|
@ -26,7 +26,7 @@ int hostio_reply(struct target_controller *tc, char *packet, int len);
|
||||||
|
|
||||||
/* Interface to host system calls */
|
/* Interface to host system calls */
|
||||||
int hostio_open(struct target_controller *,
|
int hostio_open(struct target_controller *,
|
||||||
target_addr path, unsigned path_len,
|
target_addr path, size_t path_len,
|
||||||
enum target_open_flags flags, mode_t mode);
|
enum target_open_flags flags, mode_t mode);
|
||||||
int hostio_close(struct target_controller *, int fd);
|
int hostio_close(struct target_controller *, int fd);
|
||||||
int hostio_read(struct target_controller *,
|
int hostio_read(struct target_controller *,
|
||||||
|
@ -36,18 +36,18 @@ int hostio_write(struct target_controller *,
|
||||||
long hostio_lseek(struct target_controller *,
|
long hostio_lseek(struct target_controller *,
|
||||||
int fd, long offset, enum target_seek_flag flag);
|
int fd, long offset, enum target_seek_flag flag);
|
||||||
int hostio_rename(struct target_controller *,
|
int hostio_rename(struct target_controller *,
|
||||||
target_addr oldpath, unsigned old_len,
|
target_addr oldpath, size_t old_len,
|
||||||
target_addr newpath, unsigned new_len);
|
target_addr newpath, size_t new_len);
|
||||||
int hostio_unlink(struct target_controller *,
|
int hostio_unlink(struct target_controller *,
|
||||||
target_addr path, unsigned path_len);
|
target_addr path, size_t path_len);
|
||||||
int hostio_stat(struct target_controller *,
|
int hostio_stat(struct target_controller *,
|
||||||
target_addr path, unsigned path_len, target_addr buf);
|
target_addr path, size_t path_len, target_addr buf);
|
||||||
int hostio_fstat(struct target_controller *, int fd, target_addr buf);
|
int hostio_fstat(struct target_controller *, int fd, target_addr buf);
|
||||||
int hostio_gettimeofday(struct target_controller *,
|
int hostio_gettimeofday(struct target_controller *,
|
||||||
target_addr tv, target_addr tz);
|
target_addr tv, target_addr tz);
|
||||||
int hostio_isatty(struct target_controller *, int fd);
|
int hostio_isatty(struct target_controller *, int fd);
|
||||||
int hostio_system(struct target_controller *,
|
int hostio_system(struct target_controller *,
|
||||||
target_addr cmd, unsigned cmd_len);
|
target_addr cmd, size_t cmd_len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct target_controller {
|
||||||
|
|
||||||
/* Interface to host system calls */
|
/* Interface to host system calls */
|
||||||
int (*open)(struct target_controller *,
|
int (*open)(struct target_controller *,
|
||||||
target_addr path, unsigned path_len,
|
target_addr path, size_t path_len,
|
||||||
enum target_open_flags flags, mode_t mode);
|
enum target_open_flags flags, mode_t mode);
|
||||||
int (*close)(struct target_controller *, int fd);
|
int (*close)(struct target_controller *, int fd);
|
||||||
int (*read)(struct target_controller *,
|
int (*read)(struct target_controller *,
|
||||||
|
@ -89,18 +89,18 @@ struct target_controller {
|
||||||
long (*lseek)(struct target_controller *,
|
long (*lseek)(struct target_controller *,
|
||||||
int fd, long offset, enum target_seek_flag flag);
|
int fd, long offset, enum target_seek_flag flag);
|
||||||
int (*rename)(struct target_controller *,
|
int (*rename)(struct target_controller *,
|
||||||
target_addr oldpath, unsigned old_len,
|
target_addr oldpath, size_t old_len,
|
||||||
target_addr newpath, unsigned new_len);
|
target_addr newpath, size_t new_len);
|
||||||
int (*unlink)(struct target_controller *,
|
int (*unlink)(struct target_controller *,
|
||||||
target_addr path, unsigned path_len);
|
target_addr path, size_t path_len);
|
||||||
int (*stat)(struct target_controller *,
|
int (*stat)(struct target_controller *,
|
||||||
target_addr path, unsigned path_len, target_addr buf);
|
target_addr path, size_t path_len, target_addr buf);
|
||||||
int (*fstat)(struct target_controller *, int fd, target_addr buf);
|
int (*fstat)(struct target_controller *, int fd, target_addr buf);
|
||||||
int (*gettimeofday)(struct target_controller *,
|
int (*gettimeofday)(struct target_controller *,
|
||||||
target_addr tv, target_addr tz);
|
target_addr tv, target_addr tz);
|
||||||
int (*isatty)(struct target_controller *, int fd);
|
int (*isatty)(struct target_controller *, int fd);
|
||||||
int (*system)(struct target_controller *,
|
int (*system)(struct target_controller *,
|
||||||
target_addr cmd, unsigned cmd_len);
|
target_addr cmd, size_t cmd_len);
|
||||||
enum target_errno errno_;
|
enum target_errno errno_;
|
||||||
bool interrupted;
|
bool interrupted;
|
||||||
};
|
};
|
||||||
|
|
|
@ -424,7 +424,7 @@ void tc_printf(target *t, const char *fmt, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interface to host system calls */
|
/* Interface to host system calls */
|
||||||
int tc_open(target *t, target_addr path, unsigned plen,
|
int tc_open(target *t, target_addr path, size_t plen,
|
||||||
enum target_open_flags flags, mode_t mode)
|
enum target_open_flags flags, mode_t mode)
|
||||||
{
|
{
|
||||||
if (t->tc->open == NULL) {
|
if (t->tc->open == NULL) {
|
||||||
|
@ -464,8 +464,8 @@ long tc_lseek(target *t, int fd, long offset, enum target_seek_flag flag)
|
||||||
return t->tc->lseek(t->tc, fd, offset, flag);
|
return t->tc->lseek(t->tc, fd, offset, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tc_rename(target *t, target_addr oldpath, unsigned oldlen,
|
int tc_rename(target *t, target_addr oldpath, size_t oldlen,
|
||||||
target_addr newpath, unsigned newlen)
|
target_addr newpath, size_t newlen)
|
||||||
{
|
{
|
||||||
if (t->tc->rename == NULL) {
|
if (t->tc->rename == NULL) {
|
||||||
t->tc->errno_ = TARGET_ENOENT;
|
t->tc->errno_ = TARGET_ENOENT;
|
||||||
|
@ -474,7 +474,7 @@ int tc_rename(target *t, target_addr oldpath, unsigned oldlen,
|
||||||
return t->tc->rename(t->tc, oldpath, oldlen, newpath, newlen);
|
return t->tc->rename(t->tc, oldpath, oldlen, newpath, newlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tc_unlink(target *t, target_addr path, unsigned plen)
|
int tc_unlink(target *t, target_addr path, size_t plen)
|
||||||
{
|
{
|
||||||
if (t->tc->unlink == NULL) {
|
if (t->tc->unlink == NULL) {
|
||||||
t->tc->errno_ = TARGET_ENOENT;
|
t->tc->errno_ = TARGET_ENOENT;
|
||||||
|
@ -483,7 +483,7 @@ int tc_unlink(target *t, target_addr path, unsigned plen)
|
||||||
return t->tc->unlink(t->tc, path, plen);
|
return t->tc->unlink(t->tc, path, plen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tc_stat(target *t, target_addr path, unsigned plen, target_addr buf)
|
int tc_stat(target *t, target_addr path, size_t plen, target_addr buf)
|
||||||
{
|
{
|
||||||
if (t->tc->stat == NULL) {
|
if (t->tc->stat == NULL) {
|
||||||
t->tc->errno_ = TARGET_ENOENT;
|
t->tc->errno_ = TARGET_ENOENT;
|
||||||
|
@ -516,7 +516,7 @@ int tc_isatty(target *t, int fd)
|
||||||
return t->tc->isatty(t->tc, fd);
|
return t->tc->isatty(t->tc, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tc_system(target *t, target_addr cmd, unsigned cmdlen)
|
int tc_system(target *t, target_addr cmd, size_t cmdlen)
|
||||||
{
|
{
|
||||||
if (t->tc->system == NULL) {
|
if (t->tc->system == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -142,21 +142,21 @@ void target_mem_write8(target *t, uint32_t addr, uint8_t value);
|
||||||
void tc_printf(target *t, const char *fmt, ...);
|
void tc_printf(target *t, const char *fmt, ...);
|
||||||
|
|
||||||
/* Interface to host system calls */
|
/* Interface to host system calls */
|
||||||
int tc_open(target *, target_addr path, unsigned plen,
|
int tc_open(target *, target_addr path, size_t plen,
|
||||||
enum target_open_flags flags, mode_t mode);
|
enum target_open_flags flags, mode_t mode);
|
||||||
int tc_close(target *t, int fd);
|
int tc_close(target *t, int fd);
|
||||||
int tc_read(target *t, int fd, target_addr buf, unsigned int count);
|
int tc_read(target *t, int fd, target_addr buf, unsigned int count);
|
||||||
int tc_write(target *t, int fd, target_addr buf, unsigned int count);
|
int tc_write(target *t, int fd, target_addr buf, unsigned int count);
|
||||||
long tc_lseek(target *t, int fd, long offset,
|
long tc_lseek(target *t, int fd, long offset,
|
||||||
enum target_seek_flag flag);
|
enum target_seek_flag flag);
|
||||||
int tc_rename(target *t, target_addr oldpath, unsigned oldlen,
|
int tc_rename(target *t, target_addr oldpath, size_t oldlen,
|
||||||
target_addr newpath, unsigned newlen);
|
target_addr newpath, size_t newlen);
|
||||||
int tc_unlink(target *t, target_addr path, unsigned plen);
|
int tc_unlink(target *t, target_addr path, size_t plen);
|
||||||
int tc_stat(target *t, target_addr path, unsigned plen, target_addr buf);
|
int tc_stat(target *t, target_addr path, size_t plen, target_addr buf);
|
||||||
int tc_fstat(target *t, int fd, target_addr buf);
|
int tc_fstat(target *t, int fd, target_addr buf);
|
||||||
int tc_gettimeofday(target *t, target_addr tv, target_addr tz);
|
int tc_gettimeofday(target *t, target_addr tv, target_addr tz);
|
||||||
int tc_isatty(target *t, int fd);
|
int tc_isatty(target *t, int fd);
|
||||||
int tc_system(target *t, target_addr cmd, unsigned cmdlen);
|
int tc_system(target *t, target_addr cmd, size_t cmdlen);
|
||||||
|
|
||||||
/* Probe for various targets.
|
/* Probe for various targets.
|
||||||
* Actual functions implemented in their respective drivers.
|
* Actual functions implemented in their respective drivers.
|
||||||
|
|
Loading…
Reference in New Issue