linux-user: Make target_strerror() return 'const char *'
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 6 Jun 2016 18:58:18 +0000 (19:58 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Wed, 8 Jun 2016 09:06:57 +0000 (12:06 +0300)
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>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
linux-user/qemu.h
linux-user/strace.c
linux-user/syscall.c

index 6bd7b3223aac50d6c56c0e0432f40425e434b3bd..56f29c35b5abc9597270c47881118023f3f294b3 100644 (file)
@@ -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);
index 0810c85fbdbde2a6304934df945fc75547a85200..c5980a128cb446749be5f018e24b8edc088332f6 100644 (file)
@@ -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 ) {
index 7b7bae6fda1c7f6908d141994f8b800841ee62c8..262c645d3c56bceb33441a35084925bf53883249 100644 (file)
@@ -630,7 +630,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;