xref: /netbsd-src/lib/libc/arch/vax/gen/resumecontext.c (revision 0a2b758384678be24779c6c9eea357ff880a9cc0)
1*0a2b7583Sjoerg /*	$NetBSD: resumecontext.c,v 1.4 2011/09/19 21:24:58 joerg Exp $	*/
28c295614Smatt 
38c295614Smatt /*-
48c295614Smatt  * Copyright (c) 2001 The NetBSD Foundation, Inc.
58c295614Smatt  * All rights reserved.
68c295614Smatt  *
78c295614Smatt  * This code is derived from software contributed to The NetBSD Foundation
88c295614Smatt  * by Klaus Klein.
98c295614Smatt  *
108c295614Smatt  * Redistribution and use in source and binary forms, with or without
118c295614Smatt  * modification, are permitted provided that the following conditions
128c295614Smatt  * are met:
138c295614Smatt  * 1. Redistributions of source code must retain the above copyright
148c295614Smatt  *    notice, this list of conditions and the following disclaimer.
158c295614Smatt  * 2. Redistributions in binary form must reproduce the above copyright
168c295614Smatt  *    notice, this list of conditions and the following disclaimer in the
178c295614Smatt  *    documentation and/or other materials provided with the distribution.
188c295614Smatt  *
198c295614Smatt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
208c295614Smatt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
218c295614Smatt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
228c295614Smatt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
238c295614Smatt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
248c295614Smatt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
258c295614Smatt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
268c295614Smatt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
278c295614Smatt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
288c295614Smatt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
298c295614Smatt  * POSSIBILITY OF SUCH DAMAGE.
308c295614Smatt  */
318c295614Smatt 
328c295614Smatt #include <sys/cdefs.h>
338c295614Smatt #if defined(LIBC_SCCS) && !defined(lint)
34*0a2b7583Sjoerg __RCSID("$NetBSD: resumecontext.c,v 1.4 2011/09/19 21:24:58 joerg Exp $");
358c295614Smatt #endif
368c295614Smatt 
378c295614Smatt #include "namespace.h"
38e56cdf1dSmartin #include <stdlib.h>
398c295614Smatt #include <ucontext.h>
40e56cdf1dSmartin #include <unistd.h>
418c295614Smatt #include "extern.h"
428c295614Smatt 
438c295614Smatt void
_resumecontext(void)44*0a2b7583Sjoerg _resumecontext(void)
458c295614Smatt {
468c295614Smatt 	ucontext_t uct;
478c295614Smatt 
488c295614Smatt 	(void)getcontext(&uct);
49e56cdf1dSmartin 	if (uct.uc_link == NULL)
50e56cdf1dSmartin 		exit(0);
518c295614Smatt 	(void)setcontext(uct.uc_link);
52e56cdf1dSmartin 	_exit(-1);
538c295614Smatt 	/* NOTREACHED */
548c295614Smatt }
55