summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2012-08-13 15:00:45 +0200
committerAnand Avati <avati@redhat.com>2012-08-13 06:12:14 -0700
commit3e5e736043cdb0f48ce617d71c974912a96acef0 (patch)
treef007a512caae72f88edd7db41a7b6ed7d3841429
parent12aa31278c651f36c2ea1c0698ba789aa3f9262c (diff)
NetBSD swapcontext() portability fix
This is a backport of http://review.gluster.com/#change,3794 Patchset 8d47741d5a041e632d9c74c5936fcfaf6ceaaa78 This has been tested on release-3.3 for a few days. BUG: 764655 Change-Id: I75d990649e9cdfbd7dd327ed1071f6ab7ab49f4a Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.com/3813 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--libglusterfs/src/syncop.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index c84832dfbcf..4be00219827 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -82,6 +82,11 @@ __wait (struct synctask *task)
void
synctask_yield (struct synctask *task)
{
+#if defined(__NetBSD__) && defined(_UC_TLSBASE)
+ /* Preserve pthread private pointer through swapcontex() */
+ task->proc->sched.uc_flags &= ~_UC_TLSBASE;
+#endif
+
if (swapcontext (&task->ctx, &task->proc->sched) < 0) {
gf_log ("syncop", GF_LOG_ERROR,
"swapcontext failed (%s)", strerror (errno));
@@ -292,6 +297,11 @@ synctask_switchto (struct synctask *task)
task->woken = 0;
task->slept = 0;
+#if defined(__NetBSD__) && defined(_UC_TLSBASE)
+ /* Preserve pthread private pointer through swapcontex() */
+ task->ctx.uc_flags &= ~_UC_TLSBASE;
+#endif
+
if (swapcontext (&task->proc->sched, &task->ctx) < 0) {
gf_log ("syncop", GF_LOG_ERROR,
"swapcontext failed (%s)", strerror (errno));