1*b0df966cSskrll /* $NetBSD: resumecontext.c,v 1.5 2013/08/24 07:12:13 skrll Exp $ */
256371a56Schs
356371a56Schs /*-
456371a56Schs * Copyright (c) 2001 The NetBSD Foundation, Inc.
556371a56Schs * All rights reserved.
656371a56Schs *
756371a56Schs * This code is derived from software contributed to The NetBSD Foundation
856371a56Schs * by Klaus Klein.
956371a56Schs *
1056371a56Schs * Redistribution and use in source and binary forms, with or without
1156371a56Schs * modification, are permitted provided that the following conditions
1256371a56Schs * are met:
1356371a56Schs * 1. Redistributions of source code must retain the above copyright
1456371a56Schs * notice, this list of conditions and the following disclaimer.
1556371a56Schs * 2. Redistributions in binary form must reproduce the above copyright
1656371a56Schs * notice, this list of conditions and the following disclaimer in the
1756371a56Schs * documentation and/or other materials provided with the distribution.
1856371a56Schs *
1956371a56Schs * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2056371a56Schs * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2156371a56Schs * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2256371a56Schs * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2356371a56Schs * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2456371a56Schs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2556371a56Schs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2656371a56Schs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2756371a56Schs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2856371a56Schs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2956371a56Schs * POSSIBILITY OF SUCH DAMAGE.
3056371a56Schs */
3156371a56Schs
3256371a56Schs #include <sys/cdefs.h>
3356371a56Schs #if defined(LIBC_SCCS) && !defined(lint)
34*b0df966cSskrll __RCSID("$NetBSD: resumecontext.c,v 1.5 2013/08/24 07:12:13 skrll Exp $");
3556371a56Schs #endif
3656371a56Schs
3756371a56Schs #include "namespace.h"
38e56cdf1dSmartin #include <stdlib.h>
3956371a56Schs #include <ucontext.h>
40e56cdf1dSmartin #include <unistd.h>
4156371a56Schs #include "extern.h"
4256371a56Schs
4356371a56Schs void
_resumecontext(void)440a2b7583Sjoerg _resumecontext(void)
4556371a56Schs {
4656371a56Schs ucontext_t uct;
4756371a56Schs
4856371a56Schs (void)getcontext(&uct);
49e56cdf1dSmartin if (uct.uc_link == NULL)
50e56cdf1dSmartin exit(0);
5156371a56Schs (void)setcontext(uct.uc_link);
52e56cdf1dSmartin _exit(-1);
5356371a56Schs /* NOTREACHED */
5456371a56Schs }
55