xref: /freebsd/lib/libc/sys/compat-stub.c (revision d7847a8d351436a4654bd2c746bc9c04401160ee)
1*d7847a8dSBrooks Davis /*-
2*d7847a8dSBrooks Davis  * SPDX-License-Identifier: BSD-2-Clause
3*d7847a8dSBrooks Davis  *
4*d7847a8dSBrooks Davis  * Copyright (c) 2018 SRI International
5*d7847a8dSBrooks Davis  * All rights reserved.
6*d7847a8dSBrooks Davis  *
7*d7847a8dSBrooks Davis  * This software was developed by SRI International and the University of
8*d7847a8dSBrooks Davis  * Cambridge Computer Laboratory (Department of Computer Science and
9*d7847a8dSBrooks Davis  * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
10*d7847a8dSBrooks Davis  * DARPA SSITH research programme.
11*d7847a8dSBrooks Davis  *
12*d7847a8dSBrooks Davis  * Redistribution and use in source and binary forms, with or without
13*d7847a8dSBrooks Davis  * modification, are permitted provided that the following conditions
14*d7847a8dSBrooks Davis  * are met:
15*d7847a8dSBrooks Davis  * 1. Redistributions of source code must retain the above copyright
16*d7847a8dSBrooks Davis  *    notice, this list of conditions and the following disclaimer.
17*d7847a8dSBrooks Davis  * 2. Redistributions in binary form must reproduce the above copyright
18*d7847a8dSBrooks Davis  *    notice, this list of conditions and the following disclaimer in the
19*d7847a8dSBrooks Davis  *    documentation and/or other materials provided with the distribution.
20*d7847a8dSBrooks Davis  *
21*d7847a8dSBrooks Davis  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22*d7847a8dSBrooks Davis  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23*d7847a8dSBrooks Davis  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24*d7847a8dSBrooks Davis  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25*d7847a8dSBrooks Davis  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*d7847a8dSBrooks Davis  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27*d7847a8dSBrooks Davis  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28*d7847a8dSBrooks Davis  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29*d7847a8dSBrooks Davis  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30*d7847a8dSBrooks Davis  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*d7847a8dSBrooks Davis  * SUCH DAMAGE.
32*d7847a8dSBrooks Davis  */
33*d7847a8dSBrooks Davis 
34*d7847a8dSBrooks Davis #include <sys/types.h>
35*d7847a8dSBrooks Davis #include <sys/errno.h>
36*d7847a8dSBrooks Davis 
37*d7847a8dSBrooks Davis /*
38*d7847a8dSBrooks Davis  * XXX: Ideally we'd use a common function rather than generating one
39*d7847a8dSBrooks Davis  * for each compat symbol, but the bfd linker in base rejects that.
40*d7847a8dSBrooks Davis  * This should be revisited once we're using only modern linkers.
41*d7847a8dSBrooks Davis  */
42*d7847a8dSBrooks Davis #define __compat_nosys(symbol, version)				\
43*d7847a8dSBrooks Davis int __compat_enosys ## symbol(void);				\
44*d7847a8dSBrooks Davis int								\
45*d7847a8dSBrooks Davis __compat_enosys ## symbol(void)					\
46*d7847a8dSBrooks Davis {								\
47*d7847a8dSBrooks Davis 								\
48*d7847a8dSBrooks Davis 	return (ENOSYS);					\
49*d7847a8dSBrooks Davis }								\
50*d7847a8dSBrooks Davis __sym_compat(symbol, __compat_enosys ## symbol, version)
51*d7847a8dSBrooks Davis 
52*d7847a8dSBrooks Davis __compat_nosys(netbsd_lchown, FBSD_1.0);
53*d7847a8dSBrooks Davis __compat_nosys(netbsd_msync, FBSD_1.0);
54*d7847a8dSBrooks Davis __compat_nosys(numa_getaffinity, FBSD_1.4);
55*d7847a8dSBrooks Davis __compat_nosys(numa_setaffinity, FBSD_1.4);
56