xref: /NextBSD/sys/compat/mach/mach_misc.c (revision 6283aa8b8e910d10094766cf10d892a509825cc1)
1 /*-
2  * Copyright (c) 2014-2015, Matthew Macy <mmacy@nextbsd.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  *  1. Redistributions of source code must retain the above copyright notice,
9  *     this list of conditions and the following disclaimer.
10  *
11  *  2. Neither the name of Matthew Macy nor the names of its
12  *     contributors may be used to endorse or promote products derived from
13  *     this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND 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 COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 
29 /*
30  * MACH compatibility module.
31  *
32  * We actually don't implement anything here yet!
33  */
34 
35 #include <sys/cdefs.h>
36 __FBSDID("$FreeBSD$");
37 
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/namei.h>
41 #include <sys/dirent.h>
42 #include <sys/eventhandler.h>
43 #include <sys/proc.h>
44 #include <sys/file.h>
45 #include <sys/stat.h>
46 #include <sys/time.h>
47 #include <sys/filedesc.h>
48 #include <sys/kernel.h>
49 #include <sys/malloc.h>
50 #include <sys/mbuf.h>
51 #include <sys/mman.h>
52 #include <sys/mount.h>
53 #include <sys/resource.h>
54 #include <sys/resourcevar.h>
55 #include <sys/socket.h>
56 #include <sys/vnode.h>
57 #include <sys/uio.h>
58 #include <sys/wait.h>
59 #include <sys/utsname.h>
60 #include <sys/unistd.h>
61 #include <sys/times.h>
62 #include <sys/sem.h>
63 #include <sys/msg.h>
64 #include <sys/ptrace.h>
65 #include <sys/signalvar.h>
66 
67 #include <netinet/in.h>
68 #include <sys/sysproto.h>
69 
70 #include <vm/vm.h>
71 #include <vm/vm_param.h>
72 #include <vm/pmap.h>
73 #include <vm/vm_map.h>
74 #include <vm/vm_extern.h>
75 
76 #include <sys/mach/mach_types.h>
77 
78 #ifdef MACH_CORRUPTION_DEBUG
79 MALLOC_DEFINE(M_MACH_TMP, "mach temp", "mach compatibility subsystem temp");
80 #else
81 MALLOC_DEFINE(M_MACH_TMP, "mach temp", "mach compatibility subsystem temp");
82 MALLOC_DEFINE(M_MACH_IPC_KMSG, "mach kmsg", "mach compatibility subsystem kmsg");
83 MALLOC_DEFINE(M_MACH_IPC_ENTRY, "mach entry", "mach compatibility subsystem ipc_entry");
84 MALLOC_DEFINE(M_MACH_IPC_TABLE, "mach table", "mach compatibility subsystem ipc_table");
85 MALLOC_DEFINE(M_MACH_KALLOC, "mach kalloc", "mach compatibility subsystem kalloc");
86 MALLOC_DEFINE(M_MACH_VM, "mach vm", "mach compatibility subsystem vm");
87 #endif
88 
89 int
sys_semaphore_timedwait_trap(struct thread * td,struct semaphore_timedwait_trap_args * uap)90 sys_semaphore_timedwait_trap(struct thread *td, struct semaphore_timedwait_trap_args *uap)
91 {
92 
93 	MDPRINTF(("%s(0x%x, %d, %d);\n",
94 			 __FUNCTION__, uap->wait_name, uap->sec, uap->nsec));
95 	return (ENOSYS);
96 }
97 
98 
99 int
sys_semaphore_timedwait_signal_trap(struct thread * td,struct semaphore_timedwait_signal_trap_args * uap)100 sys_semaphore_timedwait_signal_trap(struct thread *td, struct semaphore_timedwait_signal_trap_args *uap)
101 {
102 
103 	MDPRINTF(("%s(0x%x, 0x%x, %d, %d);\n", __FUNCTION__,
104 	    uap->wait_name, uap->signal_name, uap->sec,
105 	    uap->nsec));
106 	return (ENOSYS);
107 }
108 
109 
110 int
sys_pid_for_task(struct thread * td,struct pid_for_task_args * uap)111 sys_pid_for_task(struct thread *td, struct pid_for_task_args *uap)
112 {
113 
114 	MDPRINTF(("sys_mach_pid_for_task(0x%x, %p);\n",
115 	    uap->t, uap->pid));
116 	return (ENOSYS);
117 }
118 
119 
120 int
sys_macx_swapon(struct thread * td,struct macx_swapon_args * uap)121 sys_macx_swapon(struct thread *td, struct macx_swapon_args *uap)
122 {
123 
124 	MDPRINTF(("sys_mach_macx_swapon(%p, %d, %d, %d);\n",
125 	    uap->name, uap->flags, uap->size,
126 			 uap->priority));
127 	return (ENOSYS);
128 }
129 
130 int
sys_macx_swapoff(struct thread * td,struct macx_swapoff_args * uap)131 sys_macx_swapoff(struct thread *td, struct macx_swapoff_args *uap)
132 {
133 
134 	MDPRINTF(("sys_mach_macx_swapoff(%p, %d);\n",
135 			 uap->name, uap->flags));
136 	return (ENOSYS);
137 }
138 
139 int
sys_macx_triggers(struct thread * td,struct macx_triggers_args * uap)140 sys_macx_triggers(struct thread *td, struct macx_triggers_args *uap)
141 {
142 
143 	MDPRINTF(("sys_mach_macx_triggers(%d, %d, %d, 0x%x);\n",
144 	    uap->hi_water, uap->low_water, uap->flags,
145 			 uap->alert_port));
146 	return (ENOSYS);
147 }
148 
149 
150 int
sys_mach_wait_until(struct thread * td,struct mach_wait_until_args * uap)151 sys_mach_wait_until(struct thread *td, struct mach_wait_until_args *uap)
152 {
153 
154 	MDPRINTF(("sys_mach_wait_until(%lu);\n", uap->deadline));
155 	return (ENOSYS);
156 }
157 
158 
159 int
sys_mk_timer_create(struct thread * td,struct mk_timer_create_args * uap)160 sys_mk_timer_create(struct thread *td, struct mk_timer_create_args *uap)
161 {
162 	MDPRINTF(("sys_mach_timer_create();\n"));
163 	return (ENOSYS);
164 }
165 
166 
167 int
sys_mk_timer_destroy(struct thread * td,struct mk_timer_destroy_args * uap)168 sys_mk_timer_destroy(struct thread *td, struct mk_timer_destroy_args *uap)
169 {
170 
171 	MDPRINTF(("sys_mach_timer_destroy(0x%x);\n", uap->name));
172 	return (ENOSYS);
173 }
174 
175 
176 int
sys_mk_timer_arm(struct thread * td,struct mk_timer_arm_args * uap)177 sys_mk_timer_arm(struct thread *td, struct mk_timer_arm_args *uap)
178 {
179 
180 	MDPRINTF(("sys_mach_timer_arm(0x%x, %d);\n",
181 	    uap->name, uap->expire_time));
182 	return (ENOSYS);
183 }
184 
185 int
sys_mk_timer_cancel(struct thread * td,struct mk_timer_cancel_args * uap)186 sys_mk_timer_cancel(struct thread *td, struct mk_timer_cancel_args *uap)
187 {
188 
189 	MDPRINTF(("sys_mach_timer_cancel(0x%x, %p);\n",
190 	    uap->name, uap->result_time));
191 	return (ENOSYS);
192 }
193 
194 int
sys_task_name_for_pid(struct thread * td,struct task_name_for_pid_args * uap)195 sys_task_name_for_pid(struct thread *td, struct task_name_for_pid_args *uap)
196 {
197 	return (ENOSYS);
198 }
199 
200 int
sys_macx_backing_store_suspend(struct thread * td,struct macx_backing_store_suspend_args * uap)201 sys_macx_backing_store_suspend(struct thread *td, struct macx_backing_store_suspend_args *uap)
202 {
203 	return (ENOSYS);
204 }
205 
206 int
sys_macx_backing_store_recovery(struct thread * td,struct macx_backing_store_recovery_args * uap)207 sys_macx_backing_store_recovery(struct thread *td, struct macx_backing_store_recovery_args *uap)
208 {
209 	return (ENOSYS);
210 }
211 
212 
213 
214