ultrix_misc.c revision 1.26 1 1.26 christos /* $NetBSD: ultrix_misc.c,v 1.26 1996/10/10 17:52:04 christos Exp $ */
2 1.5 cgd
3 1.1 glass /*
4 1.23 jonathan * Copyright (c) 1995
5 1.23 jonathan * Jonathan Stone (hereinafter referred to as the author)
6 1.23 jonathan *
7 1.23 jonathan * Redistribution and use in source and binary forms, with or without
8 1.23 jonathan * modification, are permitted provided that the following conditions
9 1.23 jonathan * are met:
10 1.23 jonathan * 1. Redistributions of source code must retain the above copyright
11 1.23 jonathan * notice, this list of conditions and the following disclaimer.
12 1.23 jonathan * 2. Redistributions in binary form must reproduce the above copyright
13 1.23 jonathan * notice, this list of conditions and the following disclaimer in the
14 1.23 jonathan * documentation and/or other materials provided with the distribution.
15 1.23 jonathan * 3. The name of the author may not be used to endorse or promote products
16 1.23 jonathan * derived from this software without specific prior written permission.
17 1.23 jonathan *
18 1.23 jonathan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
19 1.23 jonathan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 1.23 jonathan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 1.23 jonathan * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
22 1.23 jonathan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 1.23 jonathan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 1.23 jonathan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.23 jonathan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 1.23 jonathan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.23 jonathan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.23 jonathan * SUCH DAMAGE.
29 1.23 jonathan */
30 1.23 jonathan
31 1.23 jonathan /*
32 1.1 glass * Copyright (c) 1992, 1993
33 1.1 glass * The Regents of the University of California. All rights reserved.
34 1.1 glass *
35 1.1 glass * This software was developed by the Computer Systems Engineering group
36 1.1 glass * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
37 1.1 glass * contributed to Berkeley.
38 1.1 glass *
39 1.1 glass * All advertising materials mentioning features or use of this software
40 1.1 glass * must display the following acknowledgement:
41 1.1 glass * This product includes software developed by the University of
42 1.1 glass * California, Lawrence Berkeley Laboratory.
43 1.1 glass *
44 1.1 glass * Redistribution and use in source and binary forms, with or without
45 1.1 glass * modification, are permitted provided that the following conditions
46 1.1 glass * are met:
47 1.1 glass * 1. Redistributions of source code must retain the above copyright
48 1.1 glass * notice, this list of conditions and the following disclaimer.
49 1.1 glass * 2. Redistributions in binary form must reproduce the above copyright
50 1.1 glass * notice, this list of conditions and the following disclaimer in the
51 1.1 glass * documentation and/or other materials provided with the distribution.
52 1.1 glass * 3. All advertising materials mentioning features or use of this software
53 1.1 glass * must display the following acknowledgement:
54 1.1 glass * This product includes software developed by the University of
55 1.1 glass * California, Berkeley and its contributors.
56 1.1 glass * 4. Neither the name of the University nor the names of its contributors
57 1.1 glass * may be used to endorse or promote products derived from this software
58 1.1 glass * without specific prior written permission.
59 1.1 glass *
60 1.1 glass * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61 1.1 glass * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62 1.1 glass * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63 1.1 glass * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64 1.1 glass * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65 1.1 glass * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66 1.1 glass * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67 1.1 glass * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68 1.1 glass * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69 1.1 glass * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70 1.1 glass * SUCH DAMAGE.
71 1.1 glass *
72 1.5 cgd *
73 1.1 glass * @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
74 1.1 glass *
75 1.1 glass * from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
76 1.1 glass */
77 1.1 glass
78 1.1 glass /*
79 1.1 glass * SunOS compatibility module.
80 1.1 glass *
81 1.1 glass * SunOS system calls that are implemented differently in BSD are
82 1.1 glass * handled here.
83 1.1 glass */
84 1.1 glass
85 1.1 glass #include <sys/param.h>
86 1.1 glass #include <sys/systm.h>
87 1.1 glass #include <sys/namei.h>
88 1.25 mycroft #include <sys/dirent.h>
89 1.1 glass #include <sys/proc.h>
90 1.1 glass #include <sys/file.h>
91 1.1 glass #include <sys/filedesc.h>
92 1.20 jonathan /*#include <sys/stat.h>*/
93 1.20 jonathan /*#include <sys/ioctl.h>*/
94 1.1 glass #include <sys/kernel.h>
95 1.1 glass #include <sys/exec.h>
96 1.1 glass #include <sys/malloc.h>
97 1.1 glass #include <sys/mbuf.h>
98 1.1 glass #include <sys/mman.h>
99 1.1 glass #include <sys/mount.h>
100 1.1 glass #include <sys/resource.h>
101 1.1 glass #include <sys/resourcevar.h>
102 1.1 glass #include <sys/signal.h>
103 1.1 glass #include <sys/signalvar.h>
104 1.1 glass #include <sys/socket.h>
105 1.1 glass #include <sys/vnode.h>
106 1.1 glass #include <sys/uio.h>
107 1.1 glass #include <sys/wait.h>
108 1.1 glass #include <sys/utsname.h>
109 1.1 glass #include <sys/unistd.h>
110 1.20 jonathan
111 1.16 mycroft #include <sys/syscallargs.h>
112 1.16 mycroft
113 1.16 mycroft #include <compat/ultrix/ultrix_syscall.h>
114 1.16 mycroft #include <compat/ultrix/ultrix_syscallargs.h>
115 1.1 glass
116 1.1 glass #include <netinet/in.h>
117 1.1 glass
118 1.1 glass #include <miscfs/specfs/specdev.h>
119 1.1 glass
120 1.3 glass #include <nfs/rpcv2.h>
121 1.21 pk #include <nfs/nfsproto.h>
122 1.3 glass #include <nfs/nfs.h>
123 1.3 glass
124 1.1 glass #include <vm/vm.h>
125 1.11 christos
126 1.23 jonathan #include <sys/conf.h> /* iszerodev() */
127 1.23 jonathan #include <sys/socketvar.h> /* sosetopt() */
128 1.23 jonathan
129 1.11 christos extern struct sysent ultrix_sysent[];
130 1.11 christos extern char *ultrix_syscallnames[];
131 1.22 jonathan
132 1.22 jonathan /*
133 1.22 jonathan * Select the appropriate setregs callback for the target architecture.
134 1.22 jonathan */
135 1.22 jonathan #ifdef mips
136 1.22 jonathan #define ULTRIX_EXEC_SETREGS cpu_exec_ecoff_setregs
137 1.22 jonathan #endif /* mips */
138 1.22 jonathan
139 1.22 jonathan #ifdef vax
140 1.22 jonathan #define ULTRIX_EXEC_SETREGS setregs
141 1.22 jonathan #endif /* mips */
142 1.22 jonathan
143 1.22 jonathan
144 1.22 jonathan extern void ULTRIX_EXEC_SETREGS __P((struct proc *, struct exec_package *,
145 1.11 christos u_long, register_t *));
146 1.19 jonathan extern char sigcode[], esigcode[];
147 1.19 jonathan
148 1.11 christos struct emul emul_ultrix = {
149 1.11 christos "ultrix",
150 1.11 christos NULL,
151 1.11 christos sendsig,
152 1.11 christos ULTRIX_SYS_syscall,
153 1.11 christos ULTRIX_SYS_MAXSYSCALL,
154 1.11 christos ultrix_sysent,
155 1.11 christos ultrix_syscallnames,
156 1.11 christos 0,
157 1.11 christos copyargs,
158 1.22 jonathan ULTRIX_EXEC_SETREGS,
159 1.19 jonathan sigcode,
160 1.19 jonathan esigcode,
161 1.11 christos };
162 1.1 glass
163 1.6 glass #define GSI_PROG_ENV 1
164 1.6 glass
165 1.23 jonathan int
166 1.16 mycroft ultrix_sys_getsysinfo(p, v, retval)
167 1.6 glass struct proc *p;
168 1.15 thorpej void *v;
169 1.16 mycroft register_t *retval;
170 1.6 glass {
171 1.16 mycroft struct ultrix_sys_getsysinfo_args *uap = v;
172 1.6 glass static short progenv = 0;
173 1.6 glass
174 1.16 mycroft switch (SCARG(uap, op)) {
175 1.6 glass /* operations implemented: */
176 1.6 glass case GSI_PROG_ENV:
177 1.16 mycroft if (SCARG(uap, nbytes) < sizeof(short))
178 1.6 glass return EINVAL;
179 1.6 glass *retval = 1;
180 1.16 mycroft return (copyout(&progenv, SCARG(uap, buffer), sizeof(short)));
181 1.6 glass default:
182 1.6 glass *retval = 0; /* info unavail */
183 1.6 glass return 0;
184 1.6 glass }
185 1.6 glass }
186 1.6 glass
187 1.23 jonathan int
188 1.16 mycroft ultrix_sys_setsysinfo(p, v, retval)
189 1.6 glass struct proc *p;
190 1.15 thorpej void *v;
191 1.16 mycroft register_t *retval;
192 1.6 glass {
193 1.23 jonathan
194 1.23 jonathan #ifdef notyet
195 1.16 mycroft struct ultrix_sys_setsysinfo_args *uap = v;
196 1.23 jonathan #endif
197 1.23 jonathan
198 1.6 glass *retval = 0;
199 1.6 glass return 0;
200 1.6 glass }
201 1.6 glass
202 1.23 jonathan int
203 1.16 mycroft ultrix_sys_waitpid(p, v, retval)
204 1.1 glass struct proc *p;
205 1.15 thorpej void *v;
206 1.7 cgd register_t *retval;
207 1.1 glass {
208 1.16 mycroft struct ultrix_sys_waitpid_args *uap = v;
209 1.16 mycroft struct sys_wait4_args ua;
210 1.1 glass
211 1.16 mycroft SCARG(&ua, pid) = SCARG(uap, pid);
212 1.16 mycroft SCARG(&ua, status) = SCARG(uap, status);
213 1.16 mycroft SCARG(&ua, options) = SCARG(uap, options);
214 1.16 mycroft SCARG(&ua, rusage) = 0;
215 1.1 glass
216 1.16 mycroft return (sys_wait4(p, &ua, retval));
217 1.2 glass }
218 1.2 glass
219 1.23 jonathan int
220 1.16 mycroft ultrix_sys_wait3(p, v, retval)
221 1.2 glass struct proc *p;
222 1.15 thorpej void *v;
223 1.7 cgd register_t *retval;
224 1.2 glass {
225 1.16 mycroft struct ultrix_sys_wait3_args *uap = v;
226 1.16 mycroft struct sys_wait4_args ua;
227 1.2 glass
228 1.16 mycroft SCARG(&ua, pid) = -1;
229 1.16 mycroft SCARG(&ua, status) = SCARG(uap, status);
230 1.16 mycroft SCARG(&ua, options) = SCARG(uap, options);
231 1.16 mycroft SCARG(&ua, rusage) = SCARG(uap, rusage);
232 1.1 glass
233 1.16 mycroft return (sys_wait4(p, &ua, retval));
234 1.1 glass }
235 1.1 glass
236 1.20 jonathan /*
237 1.20 jonathan * Ultrix binaries pass in FD_MAX as the first arg to select().
238 1.23 jonathan * On Ultrix, FD_MAX is 4096, which is more than the NetBSD sys_select()
239 1.20 jonathan * can handle.
240 1.23 jonathan * Since we can't have more than the (native) FD_MAX descriptors open,
241 1.23 jonathan * limit nfds to at most FD_MAX.
242 1.20 jonathan */
243 1.23 jonathan int
244 1.18 jonathan ultrix_sys_select(p, v, retval)
245 1.18 jonathan struct proc *p;
246 1.18 jonathan void *v;
247 1.18 jonathan register_t *retval;
248 1.18 jonathan {
249 1.18 jonathan struct sys_select_args *uap = v;
250 1.23 jonathan struct timeval atv;
251 1.18 jonathan int error;
252 1.18 jonathan
253 1.18 jonathan /* Limit number of FDs selected on to the native maximum */
254 1.18 jonathan
255 1.18 jonathan if (SCARG(uap, nd) > FD_SETSIZE)
256 1.18 jonathan SCARG(uap, nd) = FD_SETSIZE;
257 1.18 jonathan
258 1.18 jonathan /* Check for negative timeval */
259 1.18 jonathan if (SCARG(uap, tv)) {
260 1.18 jonathan error = copyin((caddr_t)SCARG(uap, tv), (caddr_t)&atv,
261 1.18 jonathan sizeof(atv));
262 1.18 jonathan if (error)
263 1.18 jonathan goto done;
264 1.18 jonathan #ifdef DEBUG
265 1.18 jonathan /* Ultrix clients sometimes give negative timeouts? */
266 1.18 jonathan if (atv.tv_sec < 0 || atv.tv_usec < 0)
267 1.26 christos kprintf("ultrix select( %ld, %ld): negative timeout\n",
268 1.26 christos atv.tv_sec, atv.tv_usec);
269 1.18 jonathan /*tvp = (timeval *)STACKGAPBASE;*/
270 1.18 jonathan #endif
271 1.18 jonathan
272 1.18 jonathan }
273 1.18 jonathan error = sys_select(p, (void*) uap, retval);
274 1.18 jonathan if (error == EINVAL)
275 1.26 christos kprintf("ultrix select: bad args?\n");
276 1.18 jonathan
277 1.18 jonathan done:
278 1.18 jonathan return error;
279 1.1 glass }
280 1.1 glass
281 1.16 mycroft #if defined(NFSCLIENT)
282 1.23 jonathan int
283 1.16 mycroft async_daemon(p, v, retval)
284 1.1 glass struct proc *p;
285 1.15 thorpej void *v;
286 1.7 cgd register_t *retval;
287 1.1 glass {
288 1.16 mycroft struct sys_nfssvc_args ouap;
289 1.1 glass
290 1.16 mycroft SCARG(&ouap, flag) = NFSSVC_BIOD;
291 1.16 mycroft SCARG(&ouap, argp) = NULL;
292 1.3 glass
293 1.16 mycroft return (sys_nfssvc(p, &ouap, retval));
294 1.3 glass }
295 1.3 glass #endif /* NFSCLIENT */
296 1.3 glass
297 1.1 glass
298 1.1 glass #define SUN__MAP_NEW 0x80000000 /* if not, old mmap & cannot handle */
299 1.1 glass
300 1.20 jonathan int
301 1.16 mycroft ultrix_sys_mmap(p, v, retval)
302 1.1 glass register struct proc *p;
303 1.15 thorpej void *v;
304 1.7 cgd register_t *retval;
305 1.1 glass {
306 1.16 mycroft register struct ultrix_sys_mmap_args *uap = v;
307 1.16 mycroft struct sys_mmap_args ouap;
308 1.1 glass register struct filedesc *fdp;
309 1.1 glass register struct file *fp;
310 1.1 glass register struct vnode *vp;
311 1.1 glass
312 1.1 glass /*
313 1.1 glass * Verify the arguments.
314 1.1 glass */
315 1.16 mycroft if (SCARG(uap, prot) & ~(PROT_READ|PROT_WRITE|PROT_EXEC))
316 1.1 glass return (EINVAL); /* XXX still needed? */
317 1.1 glass
318 1.16 mycroft if ((SCARG(uap, flags) & SUN__MAP_NEW) == 0)
319 1.1 glass return (EINVAL);
320 1.1 glass
321 1.16 mycroft SCARG(&ouap, flags) = SCARG(uap, flags) & ~SUN__MAP_NEW;
322 1.16 mycroft SCARG(&ouap, addr) = SCARG(uap, addr);
323 1.16 mycroft
324 1.16 mycroft if ((SCARG(&ouap, flags) & MAP_FIXED) == 0 &&
325 1.16 mycroft SCARG(&ouap, addr) != 0 &&
326 1.16 mycroft SCARG(&ouap, addr) < (caddr_t)round_page(p->p_vmspace->vm_daddr+MAXDSIZ))
327 1.16 mycroft SCARG(&ouap, addr) = (caddr_t)round_page(p->p_vmspace->vm_daddr+MAXDSIZ);
328 1.16 mycroft
329 1.16 mycroft SCARG(&ouap, len) = SCARG(uap, len);
330 1.16 mycroft SCARG(&ouap, prot) = SCARG(uap, prot);
331 1.16 mycroft SCARG(&ouap, fd) = SCARG(uap, fd);
332 1.16 mycroft SCARG(&ouap, pos) = SCARG(uap, pos);
333 1.1 glass
334 1.1 glass /*
335 1.1 glass * Special case: if fd refers to /dev/zero, map as MAP_ANON. (XXX)
336 1.1 glass */
337 1.1 glass fdp = p->p_fd;
338 1.16 mycroft if ((unsigned)SCARG(&ouap, fd) < fdp->fd_nfiles && /*XXX*/
339 1.16 mycroft (fp = fdp->fd_ofiles[SCARG(&ouap, fd)]) != NULL && /*XXX*/
340 1.1 glass fp->f_type == DTYPE_VNODE && /*XXX*/
341 1.1 glass (vp = (struct vnode *)fp->f_data)->v_type == VCHR && /*XXX*/
342 1.1 glass iszerodev(vp->v_rdev)) { /*XXX*/
343 1.16 mycroft SCARG(&ouap, flags) |= MAP_ANON;
344 1.16 mycroft SCARG(&ouap, fd) = -1;
345 1.1 glass }
346 1.1 glass
347 1.16 mycroft return (sys_mmap(p, &ouap, retval));
348 1.1 glass }
349 1.1 glass
350 1.23 jonathan int
351 1.16 mycroft ultrix_sys_setsockopt(p, v, retval)
352 1.1 glass struct proc *p;
353 1.15 thorpej void *v;
354 1.7 cgd register_t *retval;
355 1.1 glass {
356 1.16 mycroft register struct ultrix_sys_setsockopt_args *uap = v;
357 1.1 glass struct file *fp;
358 1.1 glass struct mbuf *m = NULL;
359 1.1 glass int error;
360 1.1 glass
361 1.23 jonathan if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
362 1.1 glass return (error);
363 1.1 glass #define SO_DONTLINGER (~SO_LINGER)
364 1.16 mycroft if (SCARG(uap, name) == SO_DONTLINGER) {
365 1.1 glass m = m_get(M_WAIT, MT_SOOPTS);
366 1.1 glass mtod(m, struct linger *)->l_onoff = 0;
367 1.1 glass m->m_len = sizeof(struct linger);
368 1.16 mycroft return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level),
369 1.1 glass SO_LINGER, m));
370 1.1 glass }
371 1.16 mycroft if (SCARG(uap, valsize) > MLEN)
372 1.1 glass return (EINVAL);
373 1.16 mycroft if (SCARG(uap, val)) {
374 1.1 glass m = m_get(M_WAIT, MT_SOOPTS);
375 1.23 jonathan if ((error = copyin(SCARG(uap, val), mtod(m, caddr_t),
376 1.23 jonathan (u_int)SCARG(uap, valsize))) != 0) {
377 1.1 glass (void) m_free(m);
378 1.1 glass return (error);
379 1.1 glass }
380 1.16 mycroft m->m_len = SCARG(uap, valsize);
381 1.1 glass }
382 1.16 mycroft return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level),
383 1.16 mycroft SCARG(uap, name), m));
384 1.1 glass }
385 1.1 glass
386 1.16 mycroft struct ultrix_utsname {
387 1.1 glass char sysname[9];
388 1.1 glass char nodename[9];
389 1.1 glass char nodeext[65-9];
390 1.1 glass char release[9];
391 1.1 glass char version[9];
392 1.1 glass char machine[9];
393 1.1 glass };
394 1.1 glass
395 1.20 jonathan int
396 1.16 mycroft ultrix_sys_uname(p, v, retval)
397 1.1 glass struct proc *p;
398 1.15 thorpej void *v;
399 1.7 cgd register_t *retval;
400 1.1 glass {
401 1.16 mycroft struct ultrix_sys_uname_args *uap = v;
402 1.16 mycroft struct ultrix_utsname sut;
403 1.1 glass extern char ostype[], machine[], osrelease[];
404 1.1 glass
405 1.1 glass bzero(&sut, sizeof(sut));
406 1.1 glass
407 1.1 glass bcopy(ostype, sut.sysname, sizeof(sut.sysname) - 1);
408 1.1 glass bcopy(hostname, sut.nodename, sizeof(sut.nodename));
409 1.1 glass sut.nodename[sizeof(sut.nodename)-1] = '\0';
410 1.1 glass bcopy(osrelease, sut.release, sizeof(sut.release) - 1);
411 1.1 glass bcopy("1", sut.version, sizeof(sut.version) - 1);
412 1.1 glass bcopy(machine, sut.machine, sizeof(sut.machine) - 1);
413 1.1 glass
414 1.16 mycroft return copyout((caddr_t)&sut, (caddr_t)SCARG(uap, name),
415 1.16 mycroft sizeof(struct ultrix_utsname));
416 1.1 glass }
417 1.1 glass
418 1.1 glass int
419 1.16 mycroft ultrix_sys_setpgrp(p, v, retval)
420 1.1 glass struct proc *p;
421 1.15 thorpej void *v;
422 1.7 cgd register_t *retval;
423 1.1 glass {
424 1.16 mycroft struct ultrix_sys_setpgrp_args *uap = v;
425 1.15 thorpej
426 1.1 glass /*
427 1.1 glass * difference to our setpgid call is to include backwards
428 1.1 glass * compatibility to pre-setsid() binaries. Do setsid()
429 1.1 glass * instead of setpgid() in those cases where the process
430 1.1 glass * tries to create a new session the old way.
431 1.1 glass */
432 1.16 mycroft if (!SCARG(uap, pgid) &&
433 1.16 mycroft (!SCARG(uap, pid) || SCARG(uap, pid) == p->p_pid))
434 1.16 mycroft return sys_setsid(p, uap, retval);
435 1.1 glass else
436 1.16 mycroft return sys_setpgid(p, uap, retval);
437 1.1 glass }
438 1.1 glass
439 1.1 glass #if defined (NFSSERVER)
440 1.20 jonathan int
441 1.16 mycroft ultrix_sys_nfssvc(p, v, retval)
442 1.1 glass struct proc *p;
443 1.15 thorpej void *v;
444 1.7 cgd register_t *retval;
445 1.1 glass {
446 1.23 jonathan
447 1.23 jonathan #if 0 /* XXX */
448 1.16 mycroft struct ultrix_sys_nfssvc_args *uap = v;
449 1.16 mycroft struct emul *e = p->p_emul;
450 1.16 mycroft struct sys_nfssvc_args outuap;
451 1.1 glass struct sockaddr sa;
452 1.1 glass int error;
453 1.1 glass
454 1.1 glass bzero(&outuap, sizeof outuap);
455 1.16 mycroft SCARG(&outuap, fd) = SCARG(uap, fd);
456 1.16 mycroft SCARG(&outuap, mskval) = STACKGAPBASE;
457 1.16 mycroft SCARG(&outuap, msklen) = sizeof sa;
458 1.16 mycroft SCARG(&outuap, mtchval) = outuap.mskval + sizeof sa;
459 1.16 mycroft SCARG(&outuap, mtchlen) = sizeof sa;
460 1.1 glass
461 1.1 glass bzero(&sa, sizeof sa);
462 1.16 mycroft if (error = copyout(&sa, SCARG(&outuap, mskval), SCARG(&outuap, msklen)))
463 1.1 glass return (error);
464 1.16 mycroft if (error = copyout(&sa, SCARG(&outuap, mtchval), SCARG(&outuap, mtchlen)))
465 1.1 glass return (error);
466 1.1 glass
467 1.1 glass return nfssvc(p, &outuap, retval);
468 1.16 mycroft #else
469 1.16 mycroft return (ENOSYS);
470 1.16 mycroft #endif
471 1.1 glass }
472 1.1 glass #endif /* NFSSERVER */
473 1.1 glass
474 1.16 mycroft struct ultrix_ustat {
475 1.1 glass daddr_t f_tfree; /* total free */
476 1.1 glass ino_t f_tinode; /* total inodes free */
477 1.1 glass char f_fname[6]; /* filsys name */
478 1.1 glass char f_fpack[6]; /* filsys pack name */
479 1.1 glass };
480 1.16 mycroft
481 1.20 jonathan int
482 1.16 mycroft ultrix_sys_ustat(p, v, retval)
483 1.1 glass struct proc *p;
484 1.15 thorpej void *v;
485 1.7 cgd register_t *retval;
486 1.1 glass {
487 1.16 mycroft struct ultrix_sys_ustat_args *uap = v;
488 1.16 mycroft struct ultrix_ustat us;
489 1.1 glass int error;
490 1.1 glass
491 1.1 glass bzero(&us, sizeof us);
492 1.1 glass
493 1.1 glass /*
494 1.1 glass * XXX: should set f_tfree and f_tinode at least
495 1.16 mycroft * How do we translate dev -> fstat? (and then to ultrix_ustat)
496 1.1 glass */
497 1.1 glass
498 1.23 jonathan if ((error = copyout(&us, SCARG(uap, buf), sizeof us)) != 0)
499 1.1 glass return (error);
500 1.1 glass return 0;
501 1.1 glass }
502 1.1 glass
503 1.20 jonathan int
504 1.16 mycroft ultrix_sys_quotactl(p, v, retval)
505 1.1 glass struct proc *p;
506 1.15 thorpej void *v;
507 1.7 cgd register_t *retval;
508 1.1 glass {
509 1.23 jonathan
510 1.23 jonathan #ifdef notyet
511 1.16 mycroft struct ultrix_sys_quotactl_args *uap = v;
512 1.23 jonathan #endif
513 1.15 thorpej
514 1.1 glass return EINVAL;
515 1.1 glass }
516 1.1 glass
517 1.20 jonathan int
518 1.16 mycroft ultrix_sys_vhangup(p, v, retval)
519 1.1 glass struct proc *p;
520 1.16 mycroft void *v;
521 1.7 cgd register_t *retval;
522 1.1 glass {
523 1.16 mycroft
524 1.1 glass return 0;
525 1.1 glass }
526 1.1 glass
527 1.20 jonathan int
528 1.16 mycroft ultrix_sys_exportfs(p, v, retval)
529 1.1 glass struct proc *p;
530 1.15 thorpej void *v;
531 1.7 cgd register_t *retval;
532 1.1 glass {
533 1.23 jonathan #ifdef notyet
534 1.16 mycroft struct ultrix_sys_exportfs_args *uap = v;
535 1.23 jonathan #endif
536 1.15 thorpej
537 1.1 glass /*
538 1.1 glass * XXX: should perhaps translate into a mount(2)
539 1.1 glass * with MOUNT_EXPORT?
540 1.1 glass */
541 1.1 glass return 0;
542 1.1 glass }
543 1.1 glass
544 1.16 mycroft int
545 1.19 jonathan ultrix_sys_sigpending(p, v, retval)
546 1.19 jonathan struct proc *p;
547 1.19 jonathan void *v;
548 1.19 jonathan register_t *retval;
549 1.19 jonathan {
550 1.19 jonathan struct ultrix_sys_sigpending_args *uap = v;
551 1.19 jonathan int mask = p->p_siglist & p->p_sigmask;
552 1.19 jonathan
553 1.19 jonathan return (copyout((caddr_t)&mask, (caddr_t)SCARG(uap, mask), sizeof(int)));
554 1.19 jonathan }
555 1.19 jonathan
556 1.19 jonathan int
557 1.16 mycroft ultrix_sys_sigcleanup(p, v, retval)
558 1.13 mellon struct proc *p;
559 1.15 thorpej void *v;
560 1.13 mellon register_t *retval;
561 1.13 mellon {
562 1.16 mycroft struct ultrix_sys_sigcleanup_args *uap = v;
563 1.15 thorpej
564 1.16 mycroft return sys_sigreturn(p, (struct sys_sigreturn_args *)uap, retval);
565 1.19 jonathan }
566 1.19 jonathan
567 1.19 jonathan int
568 1.19 jonathan ultrix_sys_sigreturn(p, v, retval)
569 1.19 jonathan struct proc *p;
570 1.19 jonathan void *v;
571 1.19 jonathan register_t *retval;
572 1.19 jonathan {
573 1.19 jonathan struct ultrix_sys_sigcleanup_args *uap = v;
574 1.19 jonathan
575 1.19 jonathan #ifdef DEBUG
576 1.26 christos kprintf("ultrix sigreturn\n");
577 1.19 jonathan #endif
578 1.19 jonathan return sys_sigreturn(p, (struct sys_sigreturn_args *)uap, retval);
579 1.1 glass }
580