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