aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-05-31 14:51:07 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-06-06 19:10:37 +0100
commit95902cb84f433095b21560e5ff2c0f05f9c0d8e8 (patch)
tree18b065fcd4c547c66d263a2ef581a18114a65a6c
parent06fc18ebb1781a537ed10e3c83ced4fd5cd71e5f (diff)
downloadqemu-arm-95902cb84f433095b21560e5ff2c0f05f9c0d8e8.tar.gz
linux-user: Make target_strerror() return 'const char *'
Make target_strerror() return 'const char *' rather than just 'char *'; this will allow us to return constant strings from it for some special cases. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--linux-user/qemu.h2
-rw-r--r--linux-user/strace.c4
-rw-r--r--linux-user/syscall.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 6bd7b3223a..56f29c35b5 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -195,7 +195,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
extern THREAD CPUState *thread_cpu;
void cpu_loop(CPUArchState *env);
-char *target_strerror(int err);
+const char *target_strerror(int err);
int get_osversion(void);
void init_qemu_uname_release(void);
void fork_start(void);
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 0810c85fbd..c5980a128c 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -281,7 +281,7 @@ print_ipc(const struct syscallname *name,
static void
print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
{
- char *errstr = NULL;
+ const char *errstr = NULL;
if (ret < 0) {
errstr = target_strerror(-ret);
@@ -1594,7 +1594,7 @@ void
print_syscall_ret(int num, abi_long ret)
{
int i;
- char *errstr = NULL;
+ const char *errstr = NULL;
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 249d246d5c..bcee02dfe8 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -617,7 +617,7 @@ static inline int is_error(abi_long ret)
return (abi_ulong)ret >= (abi_ulong)(-4096);
}
-char *target_strerror(int err)
+const char *target_strerror(int err)
{
if ((err >= ERRNO_TABLE_SIZE) || (err < 0)) {
return NULL;