From 3e5e736043cdb0f48ce617d71c974912a96acef0 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Mon, 13 Aug 2012 15:00:45 +0200 Subject: 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 Reviewed-on: http://review.gluster.com/3813 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/syncop.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libglusterfs/src') 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)); -- cgit