This allows SA_RESTART to be supported along with various case where pending signals need to be handled before a system call.
New macro TARGET_ERESTARTSYS which is the error code used by Linux to indicate that system call should be restarted. TARGET_QEMU_ESIGRETURN moved into errno_defs.h and renumbered to 513 which is safe from future use as a system call return value as it is used for system call restarting in Linux and exposed only via ptrace. do_sigreturn() and do_rt_sigreturn() will be amended to return -TARGET_QEMU_ESIGRETURN rather than the value of result register to avoid confusion with -TARGET_ERESTARTSYS and cpu_loop() will be altered to act upon the return value accordingly. Signed-off-by: Timothy Edward Baldwin <t.e.baldwi...@members.leeds.ac.uk> --- linux-user/errno_defs.h | 3 +++ linux-user/mips/syscall.h | 4 ---- linux-user/mips64/syscall.h | 4 ---- linux-user/ppc/syscall.h | 2 -- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/linux-user/errno_defs.h b/linux-user/errno_defs.h index 8a1cf76..a385f50 100644 --- a/linux-user/errno_defs.h +++ b/linux-user/errno_defs.h @@ -139,3 +139,6 @@ /* for robust mutexes */ #define TARGET_EOWNERDEAD 130 /* Owner died */ #define TARGET_ENOTRECOVERABLE 131 /* State not recoverable */ + +#define TARGET_ERESTARTSYS 512 /* Restart system call */ +#define TARGET_QEMU_ESIGRETURN 513 /* Return from signal */ diff --git a/linux-user/mips/syscall.h b/linux-user/mips/syscall.h index 35ca23b..e34f80c 100644 --- a/linux-user/mips/syscall.h +++ b/linux-user/mips/syscall.h @@ -220,10 +220,6 @@ struct target_pt_regs { #define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */ - -/* Nasty hack: define a fake errno value for use by sigreturn. */ -#define TARGET_QEMU_ESIGRETURN 255 - #define UNAME_MACHINE "mips" #define UNAME_MINIMUM_RELEASE "2.6.32" diff --git a/linux-user/mips64/syscall.h b/linux-user/mips64/syscall.h index 6733107..33afb8d 100644 --- a/linux-user/mips64/syscall.h +++ b/linux-user/mips64/syscall.h @@ -217,10 +217,6 @@ struct target_pt_regs { #define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */ - -/* Nasty hack: define a fake errno value for use by sigreturn. */ -#define TARGET_QEMU_ESIGRETURN 255 - #define UNAME_MACHINE "mips64" #define UNAME_MINIMUM_RELEASE "2.6.32" diff --git a/linux-user/ppc/syscall.h b/linux-user/ppc/syscall.h index 0daf5cd..532cbbd 100644 --- a/linux-user/ppc/syscall.h +++ b/linux-user/ppc/syscall.h @@ -50,8 +50,6 @@ struct target_revectored_struct { abi_ulong __map[8]; /* 256 bits */ }; -/* Nasty hack: define a fake errno value for use by sigreturn. */ -#define TARGET_QEMU_ESIGRETURN 255 /* * flags masks -- 2.1.4