1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2013 Dmitry Chagin
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD: stable/12/sys/compat/linux/linux_dummy.c 369977 2021-06-16 20:24:42Z dchagin $");
31 
32 #include <sys/param.h>
33 #include <sys/kernel.h>
34 #include <sys/sdt.h>
35 #include <sys/systm.h>
36 #include <sys/proc.h>
37 
38 /*
39  * Including linux vs linux32 here is arbitrary -- the syscall args structures
40  * (proto.h) are not dereferenced by the DUMMY stub implementations, and
41  * suitable for use by both native and compat32 entrypoints.
42  */
43 #include <machine/../linux/linux.h>
44 #include <machine/../linux/linux_proto.h>
45 
46 #include <compat/linux/linux_dtrace.h>
47 #include <compat/linux/linux_util.h>
48 
49 /* DTrace init */
50 LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
51 
52 UNIMPLEMENTED(afs_syscall);
53 UNIMPLEMENTED(create_module);	/* Added in Linux 1.0 removed in 2.6. */
54 UNIMPLEMENTED(epoll_ctl_old);
55 UNIMPLEMENTED(epoll_wait_old);
56 UNIMPLEMENTED(get_kernel_syms);	/* Added in Linux 1.0 removed in 2.6. */
57 UNIMPLEMENTED(getpmsg);
58 UNIMPLEMENTED(nfsservctl);	/* Added in Linux 2.2 removed in 3.1. */
59 UNIMPLEMENTED(putpmsg);
60 UNIMPLEMENTED(query_module);	/* Added in Linux 2.2 removed in 2.6. */
61 UNIMPLEMENTED(security);
62 UNIMPLEMENTED(vserver);
63 
64 DUMMY(sendfile);
65 DUMMY(setfsuid);
66 DUMMY(setfsgid);
67 DUMMY(vhangup);
68 DUMMY(pivot_root);
69 DUMMY(adjtimex);
70 DUMMY(swapoff);
71 DUMMY(init_module);
72 DUMMY(delete_module);
73 DUMMY(lookup_dcookie);
74 DUMMY(remap_file_pages);
75 DUMMY(mbind);
76 DUMMY(get_mempolicy);
77 DUMMY(set_mempolicy);
78 DUMMY(kexec_load);
79 /* Linux 2.6.11: */
80 DUMMY(add_key);
81 DUMMY(request_key);
82 DUMMY(keyctl);
83 /* Linux 2.6.13: */
84 DUMMY(ioprio_set);
85 DUMMY(ioprio_get);
86 DUMMY(inotify_add_watch);
87 DUMMY(inotify_rm_watch);
88 /* Linux 2.6.16: */
89 DUMMY(migrate_pages);
90 DUMMY(unshare);
91 /* Linux 2.6.17: */
92 DUMMY(tee);
93 DUMMY(vmsplice);
94 /* Linux 2.6.18: */
95 DUMMY(move_pages);
96 /* Linux 2.6.27: */
97 DUMMY(signalfd4);
98 DUMMY(inotify_init1);
99 /* Linux 2.6.31: */
100 DUMMY(perf_event_open);
101 /* Linux 2.6.36: */
102 DUMMY(fanotify_init);
103 DUMMY(fanotify_mark);
104 /* Linux 2.6.39: */
105 DUMMY(name_to_handle_at);
106 DUMMY(open_by_handle_at);
107 DUMMY(clock_adjtime);
108 /* Linux 3.0: */
109 DUMMY(setns);
110 /* Linux 3.2: */
111 DUMMY(process_vm_readv);
112 DUMMY(process_vm_writev);
113 /* Linux 3.5: */
114 DUMMY(kcmp);
115 /* Linux 3.8: */
116 DUMMY(finit_module);
117 DUMMY(sched_setattr);
118 DUMMY(sched_getattr);
119 /* Linux 3.17: */
120 DUMMY(memfd_create);
121 DUMMY(seccomp);
122 /* Linux 3.18: */
123 DUMMY(bpf);
124 /* Linux 3.19: */
125 DUMMY(execveat);
126 /* Linux 4.2: */
127 DUMMY(userfaultfd);
128 /* Linux 4.3: */
129 DUMMY(membarrier);
130 /* Linux 4.4: */
131 DUMMY(mlock2);
132 /* Linux 4.5: */
133 DUMMY(copy_file_range);
134 /* Linux 4.6: */
135 DUMMY(preadv2);
136 DUMMY(pwritev2);
137 /* Linux 4.8: */
138 DUMMY(pkey_mprotect);
139 DUMMY(pkey_alloc);
140 DUMMY(pkey_free);
141 
142 #define DUMMY_XATTR(s)						\
143 int								\
144 linux_ ## s ## xattr(						\
145     struct thread *td, struct linux_ ## s ## xattr_args *arg)	\
146 {								\
147 								\
148 	return (EOPNOTSUPP);					\
149 }
150 DUMMY_XATTR(set);
151 DUMMY_XATTR(lset);
152 DUMMY_XATTR(fset);
153 DUMMY_XATTR(get);
154 DUMMY_XATTR(lget);
155 DUMMY_XATTR(fget);
156 DUMMY_XATTR(list);
157 DUMMY_XATTR(llist);
158 DUMMY_XATTR(flist);
159 DUMMY_XATTR(remove);
160 DUMMY_XATTR(lremove);
161 DUMMY_XATTR(fremove);
162