]> git.proxmox.com Git - mirror_qemu.git/blobdiff - linux-user/syscall.c
Use the host exit syscall for exiting (Lauro Ramos Venancio).
[mirror_qemu.git] / linux-user / syscall.c
index cf0834f77936aa5723b8cd569c099b6c1455eacb..91deb80ba6a7c6d8b2b5de782b52c9cbcda93b22 100644 (file)
@@ -152,6 +152,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,   \
 }
 
 
+#define __NR_sys_exit __NR_exit
 #define __NR_sys_uname __NR_uname
 #define __NR_sys_faccessat __NR_faccessat
 #define __NR_sys_fchmodat __NR_fchmodat
@@ -193,6 +194,7 @@ static int gettid(void) {
     return -ENOSYS;
 }
 #endif
+_syscall1(int,sys_exit,int,status)
 _syscall1(int,sys_uname,struct new_utsname *,buf)
 #if defined(TARGET_NR_faccessat) && defined(__NR_faccessat)
 _syscall4(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode,int,flags)
@@ -1934,6 +1936,7 @@ static inline abi_long host_to_target_msginfo(abi_ulong target_addr,
     __put_user(host_msginfo->msgtql, &target_msginfo->msgtql);
     __put_user(host_msginfo->msgseg, &target_msginfo->msgseg);
     unlock_user_struct(target_msginfo, target_addr, 1);
+    return 0;
 }
 
 static inline abi_long do_msgctl(int msgid, int cmd, abi_long ptr)
@@ -2499,7 +2502,7 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
 #if defined(TARGET_I386)
 
 /* NOTE: there is really one LDT for all the threads */
-uint8_t *ldt_table;
+static uint8_t *ldt_table;
 
 static abi_long read_ldt(abi_ulong ptr, unsigned long bytecount)
 {
@@ -3394,7 +3397,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
         gdb_exit(cpu_env, arg1);
         /* XXX: should free thread stack and CPU env */
-        _exit(arg1);
+        sys_exit(arg1);
         ret = 0; /* avoid warning */
         break;
     case TARGET_NR_read:
@@ -4992,7 +4995,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                    if (tnamelen > 256)
                         tnamelen = 256;
                     /* XXX: may not be correct */
-                   strncpy(tde->d_name, de->d_name, tnamelen);
+                    pstrcpy(tde->d_name, tnamelen, de->d_name);
                     de = (struct linux_dirent *)((char *)de + reclen);
                     len -= reclen;
                     tde = (struct target_dirent *)((char *)tde + treclen);