1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef _EMUL_NETBSD_C_
23 #define _EMUL_NETBSD_C_
25 #include <sys/types.h>
33 #include <sys/errno.h>
34 #include <sys/param.h>
36 #include <sys/resource.h>
37 #include <sys/ioctl.h>
38 #include <sys/mount.h>
39 #include <sys/dirent.h>
41 #define WITH_NetBSD_HOST (NetBSD >= 199306)
42 #if WITH_NetBSD_HOST /* here NetBSD as that is what we're emulating */
43 #include <sys/syscall.h> /* FIXME - should not be including this one */
44 #include <sys/sysctl.h>
45 extern int getdirentries(int fd, char *buf, int nbytes, long *basep);
48 #if (BSD < 199306) /* here BSD as just a bug */
52 #include "emul_generic.h"
55 #ifndef STATIC_INLINE_EMUL_NETBSD
56 #define STATIC_INLINE_EMUL_NETBSD STATIC_INLINE
61 #define SYS(X) ASSERT(call == (SYS_##X))
66 #if WITH_NetBSD_HOST && (PATH_MAX != 1024)
67 #error "PATH_MAX not 1024"
68 #elif !defined(PATH_MAX)
73 STATIC_INLINE_EMUL_NETBSD void
74 write_stat(unsigned_word addr,
88 /* H2T(buf.st_spare1); */
90 /* H2T(buf.st_spare2); */
92 /* H2T(buf.st_spare3); */
99 emul_write_buffer(&buf, addr, sizeof(buf), processor, cia);
104 STATIC_INLINE_EMUL_NETBSD void
105 write_statfs(unsigned_word addr,
119 H2T(buf.f_fsid.val[0]);
120 H2T(buf.f_fsid.val[1]);
123 /* f_fstypename[MFSNAMELEN]; */
124 /* f_mntonname[MNAMELEN]; */
125 /* f_mntfromname[MNAMELEN]; */
126 emul_write_buffer(&buf, addr, sizeof(buf), processor, cia);
131 STATIC_INLINE_EMUL_NETBSD void
132 write_timeval(unsigned_word addr,
139 emul_write_buffer(&t, addr, sizeof(t), processor, cia);
143 STATIC_INLINE_EMUL_NETBSD void
144 write_timezone(unsigned_word addr,
149 H2T(tz.tz_minuteswest);
151 emul_write_buffer(&tz, addr, sizeof(tz), processor, cia);
156 STATIC_INLINE_EMUL_NETBSD void
157 write_direntries(unsigned_word addr,
165 struct dirent *in = (struct dirent*)buf;
166 ASSERT(in->d_reclen <= nbytes);
167 out = (struct dirent*)zalloc(in->d_reclen);
168 bcopy(in, out, in->d_reclen);
173 emul_write_buffer(out, addr, in->d_reclen, processor, cia);
174 nbytes -= in->d_reclen;
175 addr += in->d_reclen;
183 STATIC_INLINE_EMUL_NETBSD void
184 write_rusage(unsigned_word addr,
185 struct rusage rusage,
189 H2T(rusage.ru_utime.tv_sec); /* user time used */
190 H2T(rusage.ru_utime.tv_usec);
191 H2T(rusage.ru_stime.tv_sec); /* system time used */
192 H2T(rusage.ru_stime.tv_usec);
193 H2T(rusage.ru_maxrss); /* integral max resident set size */
194 H2T(rusage.ru_ixrss); /* integral shared text memory size */
195 H2T(rusage.ru_idrss); /* integral unshared data size */
196 H2T(rusage.ru_isrss); /* integral unshared stack size */
197 H2T(rusage.ru_minflt); /* page reclaims */
198 H2T(rusage.ru_majflt); /* page faults */
199 H2T(rusage.ru_nswap); /* swaps */
200 H2T(rusage.ru_inblock); /* block input operations */
201 H2T(rusage.ru_oublock); /* block output operations */
202 H2T(rusage.ru_msgsnd); /* messages sent */
203 H2T(rusage.ru_msgrcv); /* messages received */
204 H2T(rusage.ru_nsignals); /* signals received */
205 H2T(rusage.ru_nvcsw); /* voluntary context switches */
206 H2T(rusage.ru_nivcsw); /* involuntary context switches */
207 emul_write_buffer(&rusage, addr, sizeof(rusage), processor, cia);
211 STATIC_INLINE_EMUL_NETBSD void
212 do_exit(emulation *emul,
218 int status = (int)cpu_registers(processor)->gpr[arg0];
220 if (WITH_TRACE && ppc_trace[trace_os_emul])
221 printf_filtered ("%d)\n", status);
223 cpu_halt(processor, cia, was_exited, status);
227 STATIC_INLINE_EMUL_NETBSD void
228 do_read(emulation *emul,
234 void *scratch_buffer;
235 int d = (int)cpu_registers(processor)->gpr[arg0];
236 unsigned_word buf = cpu_registers(processor)->gpr[arg0+1];
237 int nbytes = cpu_registers(processor)->gpr[arg0+2];
242 if (WITH_TRACE && ppc_trace[trace_os_emul])
243 printf_filtered ("%d, 0x%lx, %d", d, (long)buf, nbytes);
245 /* get a tempoary bufer */
246 scratch_buffer = zalloc(nbytes);
248 /* check if buffer exists by reading it */
249 emul_read_buffer(scratch_buffer, buf, nbytes, processor, cia);
254 status = fread (scratch_buffer, 1, nbytes, stdin);
255 if (status == 0 && ferror (stdin))
259 status = read (d, scratch_buffer, nbytes);
262 cpu_registers(processor)->gpr[0] = errno;
264 cpu_registers(processor)->gpr[3] = status;
267 emul_write_buffer(scratch_buffer, buf, status, processor, cia);
270 zfree(scratch_buffer);
274 STATIC_INLINE_EMUL_NETBSD void
275 do_write(emulation *emul,
281 void *scratch_buffer = NULL;
283 int d = (int)cpu_registers(processor)->gpr[arg0];
284 unsigned_word buf = cpu_registers(processor)->gpr[arg0+1];
285 int nbytes = cpu_registers(processor)->gpr[arg0+2];
289 if (WITH_TRACE && ppc_trace[trace_os_emul])
290 printf_filtered ("%d, 0x%lx, %d", d, (long)buf, nbytes);
292 /* get a tempoary bufer */
293 scratch_buffer = zalloc(nbytes); /* FIXME - nbytes == 0 */
296 nr_moved = vm_data_map_read_buffer(cpu_data_map(processor),
300 if (nr_moved != nbytes) {
301 /* FIXME - should handle better */
302 error("system_call()write copy failed (nr_moved=%d != nbytes=%d)\n",
307 status = write(d, scratch_buffer, nbytes);
308 emul_write_status(processor, status, errno);
309 zfree(scratch_buffer);
313 STATIC_INLINE_EMUL_NETBSD void
314 do_open(emulation *emul,
320 unsigned_word path_addr = cpu_registers(processor)->gpr[arg0];
321 char path_buf[PATH_MAX];
322 char *path = emul_read_string(path_buf, path_addr, PATH_MAX, processor, cia);
323 int flags = (int)cpu_registers(processor)->gpr[arg0+1];
324 int mode = (int)cpu_registers(processor)->gpr[arg0+2];
326 if (WITH_TRACE && ppc_trace[trace_os_emul])
327 printf_filtered ("0x%lx [%s], 0x%x, 0x%x", (long)path_addr, path, flags, mode);
330 emul_write_status(processor, open(path, flags, mode), errno);
334 STATIC_INLINE_EMUL_NETBSD void
335 do_close(emulation *emul,
341 int d = (int)cpu_registers(processor)->gpr[arg0];
343 if (WITH_TRACE && ppc_trace[trace_os_emul])
344 printf_filtered ("%d", d);
347 emul_write_status(processor, close(d), errno);
351 STATIC_INLINE_EMUL_NETBSD void
352 do_break(emulation *emul,
357 /* just pass this onto the `vm' device */
359 psim *system = cpu_system(processor);
360 const device *vm = psim_device(system, "/vm");
362 if (WITH_TRACE && ppc_trace[trace_os_emul])
363 printf_filtered ("0x%lx", (long)cpu_registers(processor)->gpr[arg0]);
366 vm->callback->ioctl(vm,
371 NULL); /*ioctl-data*/
375 STATIC_INLINE_EMUL_NETBSD void
376 do_getpid(emulation *emul,
383 cpu_registers(processor)->gpr[3] = (int)getpid();
387 STATIC_INLINE_EMUL_NETBSD void
388 do_getuid(emulation *emul,
395 cpu_registers(processor)->gpr[3] = (int)getuid();
399 STATIC_INLINE_EMUL_NETBSD void
400 do_geteuid(emulation *emul,
407 cpu_registers(processor)->gpr[3] = (int)geteuid();
411 STATIC_INLINE_EMUL_NETBSD void
412 do_kill(emulation *emul,
418 pid_t pid = cpu_registers(processor)->gpr[arg0];
419 int sig = cpu_registers(processor)->gpr[arg0+1];
421 if (WITH_TRACE && ppc_trace[trace_os_emul])
422 printf_filtered ("%d, %d", (int)pid, sig);
425 printf_filtered("SYS_kill at 0x%x - more to this than just being killed\n",
427 cpu_halt(processor, cia, was_signalled, sig);
431 STATIC_INLINE_EMUL_NETBSD void
432 do_dup(emulation *emul,
438 int oldd = cpu_registers(processor)->gpr[arg0];
439 int status = dup(oldd);
441 if (WITH_TRACE && ppc_trace[trace_os_emul])
442 printf_filtered ("%d", oldd);
445 emul_write_status(processor, status, errno);
449 STATIC_INLINE_EMUL_NETBSD void
450 do_getegid(emulation *emul,
457 cpu_registers(processor)->gpr[3] = (int)getegid();
461 STATIC_INLINE_EMUL_NETBSD void
462 do_getgid(emulation *emul,
469 cpu_registers(processor)->gpr[3] = (int)getgid();
473 STATIC_INLINE_EMUL_NETBSD void
474 do_sigprocmask(emulation *emul,
480 natural_word how = cpu_registers(processor)->gpr[arg0];
481 unsigned_word set = cpu_registers(processor)->gpr[arg0+1];
482 unsigned_word oset = cpu_registers(processor)->gpr[arg0+2];
485 if (WITH_TRACE && ppc_trace[trace_os_emul])
486 printf_filtered ("%ld, 0x%ld, 0x%ld", (long)how, (long)set, (long)oset);
488 cpu_registers(processor)->gpr[3] = 0;
489 cpu_registers(processor)->gpr[4] = set;
493 STATIC_INLINE_EMUL_NETBSD void
494 do_ioctl(emulation *emul,
500 int d = cpu_registers(processor)->gpr[arg0];
501 unsigned request = cpu_registers(processor)->gpr[arg0+1];
502 unsigned_word argp_addr = cpu_registers(processor)->gpr[arg0+2];
504 #if !WITH_NetBSD_HOST
505 cpu_registers(processor)->gpr[arg0] = 0; /* just succeed */
507 unsigned param_len = IOCPARM_LEN(request);
508 unsigned basecmd = IOCBASECMD(request);
509 unsigned group = IOCGROUP(request);
510 unsigned dir = request & IOC_DIRMASK;
514 /* what we haven't done */
515 if (dir & IOC_IN /* write into the io device */
517 || !(dir & IOC_VOID))
518 error("do_ioctl() read or write of parameter not implemented\n");
519 status = ioctl(d, request, NULL);
520 emul_write_status(processor, status, errno);
523 if (WITH_TRACE && ppc_trace[trace_os_emul])
524 printf_filtered ("%d, 0x%x, 0x%lx", d, request, (long)argp_addr);
528 STATIC_INLINE_EMUL_NETBSD void
529 do_umask(emulation *emul,
535 int mask = cpu_registers(processor)->gpr[arg0];
537 if (WITH_TRACE && ppc_trace[trace_os_emul])
538 printf_filtered ("0%o", mask);
541 cpu_registers(processor)->gpr[3] = umask(mask);
545 STATIC_INLINE_EMUL_NETBSD void
546 do_dup2(emulation *emul,
552 int oldd = cpu_registers(processor)->gpr[arg0];
553 int newd = cpu_registers(processor)->gpr[arg0+1];
554 int status = dup2(oldd, newd);
556 if (WITH_TRACE && ppc_trace[trace_os_emul])
557 printf_filtered ("%d, %d", oldd, newd);
560 emul_write_status(processor, status, errno);
564 STATIC_INLINE_EMUL_NETBSD void
565 do_fcntl(emulation *emul,
571 int fd = cpu_registers(processor)->gpr[arg0];
572 int cmd = cpu_registers(processor)->gpr[arg0+1];
573 int arg = cpu_registers(processor)->gpr[arg0+2];
576 if (WITH_TRACE && ppc_trace[trace_os_emul])
577 printf_filtered ("%d, %d, %d", fd, cmd, arg);
580 status = fcntl(fd, cmd, arg);
581 emul_write_status(processor, status, errno);
585 STATIC_INLINE_EMUL_NETBSD void
586 do_gettimeofday(emulation *emul,
592 unsigned_word t_addr = cpu_registers(processor)->gpr[arg0];
593 unsigned_word tz_addr = cpu_registers(processor)->gpr[arg0+1];
596 int status = gettimeofday((t_addr != 0 ? &t : NULL),
597 (tz_addr != 0 ? &tz : NULL));
599 if (WITH_TRACE && ppc_trace[trace_os_emul])
600 printf_filtered ("0x%lx, 0x%lx", (long)t_addr, (long)tz_addr);
603 emul_write_status(processor, status, errno);
606 write_timeval(t_addr, t, processor, cia);
608 write_timezone(tz_addr, tz, processor, cia);
613 STATIC_INLINE_EMUL_NETBSD void
614 do_getrusage(emulation *emul,
620 int who = cpu_registers(processor)->gpr[arg0];
621 unsigned_word rusage_addr = cpu_registers(processor)->gpr[arg0+1];
622 struct rusage rusage;
623 int status = getrusage(who, (rusage_addr != 0 ? &rusage : NULL));
625 if (WITH_TRACE && ppc_trace[trace_os_emul])
626 printf_filtered ("%d, 0x%lx", who, (long)rusage_addr);
629 emul_write_status(processor, status, errno);
631 if (rusage_addr != 0)
632 write_rusage(rusage_addr, rusage, processor, cia);
637 #if !WITH_NetBSD_HOST
640 STATIC_INLINE_EMUL_NETBSD void
641 do_fstatfs(emulation *emul,
647 int fd = cpu_registers(processor)->gpr[arg0];
648 unsigned_word buf_addr = cpu_registers(processor)->gpr[arg0+1];
652 if (WITH_TRACE && ppc_trace[trace_os_emul])
653 printf_filtered ("%d, 0x%lx", fd, (long)buf_addr);
656 status = fstatfs(fd, (buf_addr == 0 ? NULL : &buf));
657 emul_write_status(processor, status, errno);
660 write_statfs(buf_addr, buf, processor, cia);
666 STATIC_INLINE_EMUL_NETBSD void
667 do_stat(emulation *emul,
673 char path_buf[PATH_MAX];
674 unsigned_word path_addr = cpu_registers(processor)->gpr[arg0];
675 unsigned_word stat_buf_addr = cpu_registers(processor)->gpr[arg0+1];
676 char *path = emul_read_string(path_buf, path_addr, PATH_MAX, processor, cia);
680 status = stat(path, &buf);
681 emul_write_status(processor, status, errno);
683 write_stat(stat_buf_addr, buf, processor, cia);
687 STATIC_INLINE_EMUL_NETBSD void
688 do_fstat(emulation *emul,
694 int fd = cpu_registers(processor)->gpr[arg0];
695 unsigned_word stat_buf_addr = cpu_registers(processor)->gpr[arg0+1];
698 emul_write_status(processor, fstat(fd, &buf), errno);
699 write_stat(stat_buf_addr, buf, processor, cia);
703 STATIC_INLINE_EMUL_NETBSD void
704 do_lstat(emulation *emul,
710 char path_buf[PATH_MAX];
711 unsigned_word path_addr = cpu_registers(processor)->gpr[arg0];
712 char *path = emul_read_string(path_buf, path_addr, PATH_MAX, processor, cia);
713 unsigned_word stat_buf_addr = cpu_registers(processor)->gpr[arg0+1];
716 emul_write_status(processor, stat(path, &buf), errno);
717 write_stat(stat_buf_addr, buf, processor, cia);
721 #if !WITH_NetBSD_HOST
722 #define do_getdirentries 0
724 STATIC_INLINE_EMUL_NETBSD void
725 do_getdirentries(emulation *emul,
731 int fd = cpu_registers(processor)->gpr[arg0];
732 unsigned_word buf_addr = cpu_registers(processor)->gpr[arg0+1];
734 int nbytes = cpu_registers(processor)->gpr[arg0+2];
735 unsigned_word basep_addr = cpu_registers(processor)->gpr[arg0+3];
739 if (buf_addr != 0 && nbytes >= 0)
740 buf = zalloc(nbytes);
743 status = getdirentries(fd,
744 (buf_addr == 0 ? NULL : buf),
746 (basep_addr == 0 ? NULL : &basep));
747 emul_write_status(processor, status, errno);
749 emul_write_word(basep_addr, basep, processor, cia);
751 write_direntries(buf_addr, buf, status, processor, cia);
758 STATIC_INLINE_EMUL_NETBSD void
759 do___syscall(emulation *emul,
767 cpu_registers(processor)->gpr[arg0],
774 STATIC_INLINE_EMUL_NETBSD void
775 do_lseek(emulation *emul,
781 int fildes = cpu_registers(processor)->gpr[arg0];
782 off_t offset = emul_read_gpr64(processor, arg0+2);
783 int whence = cpu_registers(processor)->gpr[arg0+4];
786 status = lseek(fildes, offset, whence);
788 emul_write_status(processor, -1, errno);
790 emul_write_gpr64(processor, 3, status);
795 STATIC_INLINE_EMUL_NETBSD void
796 do___sysctl(emulation *emul,
802 /* call the arguments by their real name */
803 unsigned_word name = cpu_registers(processor)->gpr[arg0];
804 natural_word namelen = cpu_registers(processor)->gpr[arg0+1];
805 unsigned_word oldp = cpu_registers(processor)->gpr[arg0+2];
806 unsigned_word oldlenp = cpu_registers(processor)->gpr[arg0+3];
809 natural_word int_val;
812 /* pluck out the management information base id */
814 error("system_call()SYS___sysctl bad name[0]\n");
815 mib = vm_data_map_read_word(cpu_data_map(processor),
821 /* see what to do with it ... */
824 #if WITH_NetBSD_HOST && (CTL_HW != 6)
828 error("system_call()SYS___sysctl - CTL_HW - bad name[1]\n");
829 mib = vm_data_map_read_word(cpu_data_map(processor),
835 case 7/*HW_PAGESIZE*/:
836 #if WITH_NetBSD_HOST && (HW_PAGESIZE != 7)
837 # error "HW_PAGESIZE"
839 oldlen = vm_data_map_read_word(cpu_data_map(processor),
843 if (sizeof(natural_word) > oldlen)
844 error("system_call()sysctl - CTL_HW.HW_PAGESIZE - to small\n");
846 oldlen = sizeof(int_val);
847 emul_write_word(oldp, int_val, processor, cia);
848 emul_write_word(oldlenp, oldlen, processor, cia);
851 error("sysctl() CTL_HW.%d unknown\n", mib);
856 error("sysctl() name[0]=%s unknown\n", (int)mib);
859 cpu_registers(processor)->gpr[3] = 0;
864 static emul_call_descriptor netbsd_descriptors[] = {
865 /* 0 */ { 0, "syscall", { 0, }, 0 },
866 /* 1 */ { do_exit, "exit", { 0, }, 0 },
867 /* 2 */ { 0, "fork", { 0, }, 0 },
868 /* 3 */ { do_read, "read", { 0, }, 0 },
869 /* 4 */ { do_write, "write", { 0, }, 0 },
870 /* 5 */ { do_open, "open", { 0, }, 0 },
871 /* 6 */ { do_close, "close", { 0, }, 0 },
872 /* 7 */ { 0, "wait4", { 0, }, 0 },
873 { 0, }, /* 8 is old creat */
874 /* 9 */ { 0, "link", { 0, }, 0 },
875 /* 10 */ { 0, "unlink", { 0, }, 0 },
876 { 0, }, /* 11 is obsolete execv */
877 /* 12 */ { 0, "chdir", { 0, }, 0 },
878 /* 13 */ { 0, "fchdir", { 0, }, 0 },
879 /* 14 */ { 0, "mknod", { 0, }, 0 },
880 /* 15 */ { 0, "chmod", { 0, }, 0 },
881 /* 16 */ { 0, "chown", { 0, }, 0 },
882 /* 17 */ { do_break, "break", { 0, }, 0 },
883 /* 18 */ { 0, "getfsstat", { 0, }, 0 },
884 { 0, }, /* 19 is old lseek */
885 /* 20 */ { do_getpid, "getpid", { 0, }, 0 },
886 /* 21 */ { 0, "mount", { 0, }, 0 },
887 /* 22 */ { 0, "unmount", { 0, }, 0 },
888 /* 23 */ { 0, "setuid", { 0, }, 0 },
889 /* 24 */ { do_getuid, "getuid", { 0, }, 0 },
890 /* 25 */ { do_geteuid, "geteuid", { 0, }, 0 },
891 /* 26 */ { 0, "ptrace", { 0, }, 0 },
892 /* 27 */ { 0, "recvmsg", { 0, }, 0 },
893 /* 28 */ { 0, "sendmsg", { 0, }, 0 },
894 /* 29 */ { 0, "recvfrom", { 0, }, 0 },
895 /* 30 */ { 0, "accept", { 0, }, 0 },
896 /* 31 */ { 0, "getpeername", { 0, }, 0 },
897 /* 32 */ { 0, "getsockname", { 0, }, 0 },
898 /* 33 */ { 0, "access", { 0, }, 0 },
899 /* 34 */ { 0, "chflags", { 0, }, 0 },
900 /* 35 */ { 0, "fchflags", { 0, }, 0 },
901 /* 36 */ { 0, "sync", { 0, }, 0 },
902 /* 37 */ { do_kill, "kill", { 0, }, 0 },
903 { 0, }, /* 38 is old stat */
904 /* 39 */ { 0, "getppid", { 0, }, 0 },
905 { 0, }, /* 40 is old lstat */
906 /* 41 */ { do_dup, "dup", { 0, }, 0 },
907 /* 42 */ { 0, "pipe", { 0, }, 0 },
908 /* 43 */ { do_getegid, "getegid", { 0, }, 0 },
909 /* 44 */ { 0, "profil", { 0, }, 0 },
910 /* 45 */ { 0, "ktrace", { 0, }, 0 },
911 /* 46 */ { 0, "sigaction", { 0, }, 0 },
912 /* 47 */ { do_getgid, "getgid", { 0, }, 0 },
913 /* 48 */ { do_sigprocmask, "sigprocmask", { 0, }, 0 },
914 /* 49 */ { 0, "getlogin", { 0, }, 0 },
915 /* 50 */ { 0, "setlogin", { 0, }, 0 },
916 /* 51 */ { 0, "acct", { 0, }, 0 },
917 /* 52 */ { 0, "sigpending", { 0, }, 0 },
918 /* 53 */ { 0, "sigaltstack", { 0, }, 0 },
919 /* 54 */ { do_ioctl, "ioctl", { 0, }, 0 },
920 /* 55 */ { 0, "reboot", { 0, }, 0 },
921 /* 56 */ { 0, "revoke", { 0, }, 0 },
922 /* 57 */ { 0, "symlink", { 0, }, 0 },
923 /* 58 */ { 0, "readlink", { 0, }, 0 },
924 /* 59 */ { 0, "execve", { 0, }, 0 },
925 /* 60 */ { do_umask, "umask", { 0, }, 0 },
926 /* 61 */ { 0, "chroot", { 0, }, 0 },
927 { 0, }, /* 62 is old fstat */
928 { 0, }, /* 63 is old getkerninfo */
929 { 0, }, /* 64 is old getpagesize */
930 /* 65 */ { 0, "msync", { 0, }, 0 },
931 /* 66 */ { 0, "vfork", { 0, }, 0 },
932 { 0, }, /* 67 is obsolete vread */
933 { 0, }, /* 68 is obsolete vwrite */
934 /* 69 */ { 0, "sbrk", { 0, }, 0 },
935 /* 70 */ { 0, "sstk", { 0, }, 0 },
936 { 0, }, /* 71 is old mmap */
937 /* 72 */ { 0, "vadvise", { 0, }, 0 },
938 /* 73 */ { 0, "munmap", { 0, }, 0 },
939 /* 74 */ { 0, "mprotect", { 0, }, 0 },
940 /* 75 */ { 0, "madvise", { 0, }, 0 },
941 { 0, }, /* 76 is obsolete vhangup */
942 { 0, }, /* 77 is obsolete vlimit */
943 /* 78 */ { 0, "mincore", { 0, }, 0 },
944 /* 79 */ { 0, "getgroups", { 0, }, 0 },
945 /* 80 */ { 0, "setgroups", { 0, }, 0 },
946 /* 81 */ { 0, "getpgrp", { 0, }, 0 },
947 /* 82 */ { 0, "setpgid", { 0, }, 0 },
948 /* 83 */ { 0, "setitimer", { 0, }, 0 },
949 { 0, }, /* 84 is old wait */
950 /* 85 */ { 0, "swapon", { 0, }, 0 },
951 /* 86 */ { 0, "getitimer", { 0, }, 0 },
952 { 0, }, /* 87 is old gethostname */
953 { 0, }, /* 88 is old sethostname */
954 { 0, }, /* 89 is old getdtablesize */
955 { do_dup2, "dup2", { 0, }, 0 },
957 /* 92 */ { do_fcntl, "fcntl", { 0, }, 0 },
958 /* 93 */ { 0, "select", { 0, }, 0 },
960 /* 95 */ { 0, "fsync", { 0, }, 0 },
961 /* 96 */ { 0, "setpriority", { 0, }, 0 },
962 /* 97 */ { 0, "socket", { 0, }, 0 },
963 /* 98 */ { 0, "connect", { 0, }, 0 },
964 { 0, }, /* 99 is old accept */
965 /* 100 */ { 0, "getpriority", { 0, }, 0 },
966 { 0, }, /* 101 is old send */
967 { 0, }, /* 102 is old recv */
968 /* 103 */ { 0, "sigreturn", { 0, }, 0 },
969 /* 104 */ { 0, "bind", { 0, }, 0 },
970 /* 105 */ { 0, "setsockopt", { 0, }, 0 },
971 /* 106 */ { 0, "listen", { 0, }, 0 },
972 { 0, }, /* 107 is obsolete vtimes */
973 { 0, }, /* 108 is old sigvec */
974 { 0, }, /* 109 is old sigblock */
975 { 0, }, /* 110 is old sigsetmask */
976 /* 111 */ { 0, "sigsuspend", { 0, }, 0 },
977 { 0, }, /* 112 is old sigstack */
978 { 0, }, /* 113 is old recvmsg */
979 { 0, }, /* 114 is old sendmsg */
980 /* - is obsolete vtrace */ { 0, "vtrace 115", { 0, }, 0 },
981 /* 116 */ { do_gettimeofday, "gettimeofday", { 0, }, 0 },
982 /* 117 */ { do_getrusage, "getrusage", { 0, }, 0 },
983 /* 118 */ { 0, "getsockopt", { 0, }, 0 },
984 /* 119 */ { 0, "resuba", { 0, }, 0 },
985 /* 120 */ { 0, "readv", { 0, }, 0 },
986 /* 121 */ { 0, "writev", { 0, }, 0 },
987 /* 122 */ { 0, "settimeofday", { 0, }, 0 },
988 /* 123 */ { 0, "fchown", { 0, }, 0 },
989 /* 124 */ { 0, "fchmod", { 0, }, 0 },
990 { 0, }, /* 125 is old recvfrom */
991 { 0, }, /* 126 is old setreuid */
992 { 0, }, /* 127 is old setregid */
993 /* 128 */ { 0, "rename", { 0, }, 0 },
994 { 0, }, /* 129 is old truncate */
995 { 0, }, /* 130 is old ftruncate */
996 /* 131 */ { 0, "flock", { 0, }, 0 },
997 /* 132 */ { 0, "mkfifo", { 0, }, 0 },
998 /* 133 */ { 0, "sendto", { 0, }, 0 },
999 /* 134 */ { 0, "shutdown", { 0, }, 0 },
1000 /* 135 */ { 0, "socketpair", { 0, }, 0 },
1001 /* 136 */ { 0, "mkdir", { 0, }, 0 },
1002 /* 137 */ { 0, "rmdir", { 0, }, 0 },
1003 /* 138 */ { 0, "utimes", { 0, }, 0 },
1004 { 0, }, /* 139 is obsolete 4.2 sigreturn */
1005 /* 140 */ { 0, "adjtime", { 0, }, 0 },
1006 { 0, }, /* 141 is old getpeername */
1007 { 0, }, /* 142 is old gethostid */
1008 { 0, }, /* 143 is old sethostid */
1009 { 0, }, /* 144 is old getrlimit */
1010 { 0, }, /* 145 is old setrlimit */
1011 { 0, }, /* 146 is old killpg */
1012 /* 147 */ { 0, "setsid", { 0, }, 0 },
1013 /* 148 */ { 0, "quotactl", { 0, }, 0 },
1014 { 0, }, /* 149 is old quota */
1015 { 0, }, /* 150 is old getsockname */
1020 /* 155 */ { 0, "nfssvc", { 0, }, 0 },
1021 { 0, }, /* 156 is old getdirentries */
1022 /* 157 */ { 0, "statfs", { 0, }, 0 },
1023 /* 158 */ { do_fstatfs, "fstatfs", { 0, }, 0 },
1026 /* 161 */ { 0, "getfh", { 0, }, 0 },
1027 { 0, }, /* 162 is old getdomainname */
1028 { 0, }, /* 163 is old setdomainname */
1029 { 0, }, /* 164 is old uname */
1030 /* 165 */ { 0, "sysarch", { 0, }, 0 },
1034 /* 169 */ { 0, "semsys", { 0, }, 0 },
1035 /* 170 */ { 0, "msgsys", { 0, }, 0 },
1036 /* 171 */ { 0, "shmsys", { 0, }, 0 },
1046 /* 181 */ { 0, "setgid", { 0, }, 0 },
1047 /* 182 */ { 0, "setegid", { 0, }, 0 },
1048 /* 183 */ { 0, "seteuid", { 0, }, 0 },
1049 /* 184 */ { 0, "lfs_bmapv", { 0, }, 0 },
1050 /* 185 */ { 0, "lfs_markv", { 0, }, 0 },
1051 /* 186 */ { 0, "lfs_segclean", { 0, }, 0 },
1052 /* 187 */ { 0, "lfs_segwait", { 0, }, 0 },
1053 /* 188 */ { do_stat, "stat", { 0, }, 0 },
1054 /* 189 */ { do_fstat, "fstat", { 0, }, 0 },
1055 /* 190 */ { do_lstat, "lstat", { 0, }, 0 },
1056 /* 191 */ { 0, "pathconf", { 0, }, 0 },
1057 /* 192 */ { 0, "fpathconf", { 0, }, 0 },
1059 /* 194 */ { 0, "getrlimit", { 0, }, 0 },
1060 /* 195 */ { 0, "setrlimit", { 0, }, 0 },
1061 /* 196 */ { do_getdirentries, "getdirentries", { 0, }, 0 },
1062 /* 197 */ { 0, "mmap", { 0, }, 0 },
1063 /* 198 */ { do___syscall, "__syscall", { 0, }, 0 },
1064 /* 199 */ { do_lseek, "lseek", { 0, }, 0 },
1065 /* 200 */ { 0, "truncate", { 0, }, 0 },
1066 /* 201 */ { 0, "ftruncate", { 0, }, 0 },
1067 /* 202 */ { do___sysctl, "__sysctl", { 0, }, 0 },
1068 /* 203 */ { 0, "mlock", { 0, }, 0 },
1069 /* 204 */ { 0, "munlock", { 0, }, 0 },
1072 static char *(netbsd_error_names[]) = {
1109 /* 36 */ "EINPROGRESS",
1110 /* 37 */ "EALREADY",
1111 /* 38 */ "ENOTSOCK",
1112 /* 39 */ "EDESTADDRREQ",
1113 /* 40 */ "EMSGSIZE",
1114 /* 41 */ "EPROTOTYPE",
1115 /* 42 */ "ENOPROTOOPT",
1116 /* 43 */ "EPROTONOSUPPORT",
1117 /* 44 */ "ESOCKTNOSUPPORT",
1118 /* 45 */ "EOPNOTSUPP",
1119 /* 46 */ "EPFNOSUPPORT",
1120 /* 47 */ "EAFNOSUPPORT",
1121 /* 48 */ "EADDRINUSE",
1122 /* 49 */ "EADDRNOTAVAIL",
1123 /* 50 */ "ENETDOWN",
1124 /* 51 */ "ENETUNREACH",
1125 /* 52 */ "ENETRESET",
1126 /* 53 */ "ECONNABORTED",
1127 /* 54 */ "ECONNRESET",
1130 /* 57 */ "ENOTCONN",
1131 /* 58 */ "ESHUTDOWN",
1132 /* 59 */ "ETOOMANYREFS",
1133 /* 60 */ "ETIMEDOUT",
1134 /* 61 */ "ECONNREFUSED",
1136 /* 63 */ "ENAMETOOLONG",
1137 /* 64 */ "EHOSTDOWN",
1138 /* 65 */ "EHOSTUNREACH",
1139 /* 66 */ "ENOTEMPTY",
1140 /* 67 */ "EPROCLIM",
1146 /* 73 */ "ERPCMISMATCH",
1147 /* 74 */ "EPROGUNAVAIL",
1148 /* 75 */ "EPROGMISMATCH",
1149 /* 76 */ "EPROCUNAVAIL",
1154 /* 81 */ "ENEEDAUTH",
1158 static char *(netbsd_signal_names[]) = {
1185 /* 26 */ "SIGVTALRM",
1187 /* 28 */ "SIGWINCH",
1193 emulation emul_netbsd = {
1195 sizeof(netbsd_descriptors) / sizeof(netbsd_descriptors[0]),
1197 sizeof(netbsd_error_names) / sizeof(netbsd_error_names[0]),
1198 netbsd_signal_names,
1199 sizeof(netbsd_signal_names) / sizeof(netbsd_signal_names[0]),
1202 #endif /* _EMUL_NETBSD_C_ */