setcontext.c revision 277317
1119026Sume/* 266776Skris * Copyright (c) 2014 The FreeBSD Foundation. 355163Sshin * All rights reserved. 455163Sshin * 555163Sshin * Portions of this software were developed by Konstantin Belousov 662632Skris * under sponsorship from the FreeBSD Foundation. 755163Sshin * 855163Sshin * Redistribution and use in source and binary forms, with or without 955163Sshin * modification, are permitted provided that the following conditions 1055163Sshin * are met: 1155163Sshin * 1. Redistributions of source code must retain the above copyright 1255163Sshin * notice(s), this list of conditions and the following disclaimer as 1355163Sshin * the first lines of this file unmodified other than the possible 1455163Sshin * addition of one or more copyright notices. 1555163Sshin * 2. Redistributions in binary form must reproduce the above copyright 1655163Sshin * notice(s), this list of conditions and the following disclaimer in 1755163Sshin * the documentation and/or other materials provided with the 1862632Skris * distribution. 1955163Sshin * 2055163Sshin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 2155163Sshin * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2255163Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2355163Sshin * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 2455163Sshin * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2555163Sshin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2655163Sshin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 2755163Sshin * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2855163Sshin * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 2955163Sshin * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 3055163Sshin * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3155163Sshin */ 3255163Sshin 3355163Sshin#include <sys/cdefs.h> 3455163Sshin__FBSDID("$FreeBSD: stable/10/lib/libc/sys/setcontext.c 277317 2015-01-18 11:54:20Z kib $"); 35203387Sume 3655163Sshin#include <sys/types.h> 3762632Skris#include <ucontext.h> 38118909Sume#include "libc_private.h" 3955163Sshin 4062632Skris__weak_reference(__sys_setcontext, __setcontext); 4155163Sshin__sym_compat(setcontext, __impl_setcontext, FBSD_1.0); 42203387Sume__weak_reference(setcontext, __impl_setcontext); 4355163Sshin__sym_default(setcontext, setcontext, FBSD_1.2); 4455163Sshin 4555163Sshin#pragma weak setcontext 46203387Sumeint 4755163Sshinsetcontext(const ucontext_t *uc) 48203387Sume{ 49203387Sume 5055163Sshin return (((int (*)(const ucontext_t *)) 5155163Sshin __libc_interposing[INTERPOS_setcontext])(uc)); 5255163Sshin} 5355163Sshin