summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2003-04-01 23:25:18 +0000
committerjake <jake@FreeBSD.org>2003-04-01 23:25:18 +0000
commitac9bc07ca9180456780c4e82536485b56171bc92 (patch)
treeba8fa139669808717654ad65afb1c942a7d3cc93 /sys/kern
parentd8464b70a3ce9a508a7ec417289322ea1b69334f (diff)
downloadFreeBSD-src-ac9bc07ca9180456780c4e82536485b56171bc92.zip
FreeBSD-src-ac9bc07ca9180456780c4e82536485b56171bc92.tar.gz
- 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.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_context.c7
1 files changed, 3 insertions, 4 deletions
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);
}
OpenPOWER on IntegriCloud