From ac9bc07ca9180456780c4e82536485b56171bc92 Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 1 Apr 2003 23:25:18 +0000 Subject: - Fix UC_COPY_SIZE. Adding up the size of structure fields doesn't take alignment into account. - Return EJUSTRETURN from set_context on success to avoid clobbering the first 2 out registers with td_retval on sparc64. --- sys/kern/kern_context.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sys/kern/kern_context.c') diff --git a/sys/kern/kern_context.c b/sys/kern/kern_context.c index d1b657f..ffb3f95 100644 --- a/sys/kern/kern_context.c +++ b/sys/kern/kern_context.c @@ -44,8 +44,7 @@ * the machine context. The next field is uc_link; we want to * avoid destroying the link when copying out contexts. */ -#define UC_COPY_SIZE (sizeof(sigset_t) + sizeof(mcontext_t)) - +#define UC_COPY_SIZE offsetof(ucontext_t, uc_link) #ifndef _SYS_SYSPROTO_H_ struct getcontext_args { @@ -102,7 +101,7 @@ setcontext(struct thread *td, struct setcontext_args *uap) } } } - return (ret); + return (ret == 0 ? EJUSTRETURN : ret); } int @@ -130,5 +129,5 @@ swapcontext(struct thread *td, struct swapcontext_args *uap) } } } - return (ret); + return (ret == 0 ? EJUSTRETURN : ret); } -- cgit v1.1