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 "emul_generic.h"
35 #include <sys/types.h>
40 #include <sys/errno.h>
41 #include <sys/param.h>
43 #include <sys/resource.h>
44 #include <sys/ioctl.h>
45 #include <sys/mount.h>
46 #include <sys/dirent.h>
56 #define WITH_NetBSD_HOST (NetBSD >= 199306)
57 #if WITH_NetBSD_HOST /* here NetBSD as that is what we're emulating */
58 #include <sys/syscall.h> /* FIXME - should not be including this one */
59 #include <sys/sysctl.h>
60 extern int getdirentries(int fd
, char *buf
, int nbytes
, long *basep
);
63 #if (BSD < 199306) /* here BSD as just a bug */
67 #ifndef STATIC_INLINE_EMUL_NETBSD
68 #define STATIC_INLINE_EMUL_NETBSD STATIC_INLINE
73 #define SYS(X) ASSERT(call == (SYS_##X))
78 #if WITH_NetBSD_HOST && (PATH_MAX != 1024)
79 #error "PATH_MAX not 1024"
80 #elif !defined(PATH_MAX)
85 STATIC_INLINE_EMUL_NETBSD
void
86 write_stat(unsigned_word addr
,
100 /* H2T(buf.st_spare1); */
102 /* H2T(buf.st_spare2); */
104 /* H2T(buf.st_spare3); */
111 emul_write_buffer(&buf
, addr
, sizeof(buf
), processor
, cia
);
116 STATIC_INLINE_EMUL_NETBSD
void
117 write_statfs(unsigned_word addr
,
131 H2T(buf
.f_fsid
.val
[0]);
132 H2T(buf
.f_fsid
.val
[1]);
135 /* f_fstypename[MFSNAMELEN]; */
136 /* f_mntonname[MNAMELEN]; */
137 /* f_mntfromname[MNAMELEN]; */
138 emul_write_buffer(&buf
, addr
, sizeof(buf
), processor
, cia
);
143 STATIC_INLINE_EMUL_NETBSD
void
144 write_timeval(unsigned_word addr
,
151 emul_write_buffer(&t
, addr
, sizeof(t
), processor
, cia
);
155 STATIC_INLINE_EMUL_NETBSD
void
156 write_timezone(unsigned_word addr
,
161 H2T(tz
.tz_minuteswest
);
163 emul_write_buffer(&tz
, addr
, sizeof(tz
), processor
, cia
);
168 STATIC_INLINE_EMUL_NETBSD
void
169 write_direntries(unsigned_word addr
,
177 struct dirent
*in
= (struct dirent
*)buf
;
178 ASSERT(in
->d_reclen
<= nbytes
);
179 out
= (struct dirent
*)zalloc(in
->d_reclen
);
180 bcopy(in
, out
, in
->d_reclen
);
185 emul_write_buffer(out
, addr
, in
->d_reclen
, processor
, cia
);
186 nbytes
-= in
->d_reclen
;
187 addr
+= in
->d_reclen
;
195 STATIC_INLINE_EMUL_NETBSD
void
196 write_rusage(unsigned_word addr
,
197 struct rusage rusage
,
201 H2T(rusage
.ru_utime
.tv_sec
); /* user time used */
202 H2T(rusage
.ru_utime
.tv_usec
);
203 H2T(rusage
.ru_stime
.tv_sec
); /* system time used */
204 H2T(rusage
.ru_stime
.tv_usec
);
205 H2T(rusage
.ru_maxrss
); /* integral max resident set size */
206 H2T(rusage
.ru_ixrss
); /* integral shared text memory size */
207 H2T(rusage
.ru_idrss
); /* integral unshared data size */
208 H2T(rusage
.ru_isrss
); /* integral unshared stack size */
209 H2T(rusage
.ru_minflt
); /* page reclaims */
210 H2T(rusage
.ru_majflt
); /* page faults */
211 H2T(rusage
.ru_nswap
); /* swaps */
212 H2T(rusage
.ru_inblock
); /* block input operations */
213 H2T(rusage
.ru_oublock
); /* block output operations */
214 H2T(rusage
.ru_msgsnd
); /* messages sent */
215 H2T(rusage
.ru_msgrcv
); /* messages received */
216 H2T(rusage
.ru_nsignals
); /* signals received */
217 H2T(rusage
.ru_nvcsw
); /* voluntary context switches */
218 H2T(rusage
.ru_nivcsw
); /* involuntary context switches */
219 emul_write_buffer(&rusage
, addr
, sizeof(rusage
), processor
, cia
);
223 STATIC_INLINE_EMUL_NETBSD
void
224 do_exit(emulation
*emul
,
230 int status
= (int)cpu_registers(processor
)->gpr
[arg0
];
232 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
233 printf_filtered ("%d)\n", status
);
235 cpu_halt(processor
, cia
, was_exited
, status
);
239 STATIC_INLINE_EMUL_NETBSD
void
240 do_read(emulation
*emul
,
246 void *scratch_buffer
;
247 int d
= (int)cpu_registers(processor
)->gpr
[arg0
];
248 unsigned_word buf
= cpu_registers(processor
)->gpr
[arg0
+1];
249 int nbytes
= cpu_registers(processor
)->gpr
[arg0
+2];
254 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
255 printf_filtered ("%d, 0x%lx, %d", d
, (long)buf
, nbytes
);
257 /* get a tempoary bufer */
258 scratch_buffer
= zalloc(nbytes
);
260 /* check if buffer exists by reading it */
261 emul_read_buffer(scratch_buffer
, buf
, nbytes
, processor
, cia
);
266 status
= fread (scratch_buffer
, 1, nbytes
, stdin
);
267 if (status
== 0 && ferror (stdin
))
271 status
= read (d
, scratch_buffer
, nbytes
);
274 cpu_registers(processor
)->gpr
[0] = errno
;
276 cpu_registers(processor
)->gpr
[3] = status
;
279 emul_write_buffer(scratch_buffer
, buf
, status
, processor
, cia
);
282 zfree(scratch_buffer
);
286 STATIC_INLINE_EMUL_NETBSD
void
287 do_write(emulation
*emul
,
293 void *scratch_buffer
= NULL
;
295 int d
= (int)cpu_registers(processor
)->gpr
[arg0
];
296 unsigned_word buf
= cpu_registers(processor
)->gpr
[arg0
+1];
297 int nbytes
= cpu_registers(processor
)->gpr
[arg0
+2];
301 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
302 printf_filtered ("%d, 0x%lx, %d", d
, (long)buf
, nbytes
);
304 /* get a tempoary bufer */
305 scratch_buffer
= zalloc(nbytes
); /* FIXME - nbytes == 0 */
308 nr_moved
= vm_data_map_read_buffer(cpu_data_map(processor
),
312 if (nr_moved
!= nbytes
) {
313 /* FIXME - should handle better */
314 error("system_call()write copy failed (nr_moved=%d != nbytes=%d)\n",
319 status
= write(d
, scratch_buffer
, nbytes
);
320 emul_write_status(processor
, status
, errno
);
321 zfree(scratch_buffer
);
325 STATIC_INLINE_EMUL_NETBSD
void
326 do_open(emulation
*emul
,
332 unsigned_word path_addr
= cpu_registers(processor
)->gpr
[arg0
];
333 char path_buf
[PATH_MAX
];
334 char *path
= emul_read_string(path_buf
, path_addr
, PATH_MAX
, processor
, cia
);
335 int flags
= (int)cpu_registers(processor
)->gpr
[arg0
+1];
336 int mode
= (int)cpu_registers(processor
)->gpr
[arg0
+2];
338 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
339 printf_filtered ("0x%lx [%s], 0x%x, 0x%x", (long)path_addr
, path
, flags
, mode
);
342 emul_write_status(processor
, open(path
, flags
, mode
), errno
);
346 STATIC_INLINE_EMUL_NETBSD
void
347 do_close(emulation
*emul
,
353 int d
= (int)cpu_registers(processor
)->gpr
[arg0
];
355 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
356 printf_filtered ("%d", d
);
359 emul_write_status(processor
, close(d
), errno
);
363 STATIC_INLINE_EMUL_NETBSD
void
364 do_break(emulation
*emul
,
369 /* just pass this onto the `vm' device */
371 psim
*system
= cpu_system(processor
);
372 const device
*vm
= psim_device(system
, "/vm");
374 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
375 printf_filtered ("0x%lx", (long)cpu_registers(processor
)->gpr
[arg0
]);
378 vm
->callback
->ioctl(vm
,
383 NULL
); /*ioctl-data*/
387 STATIC_INLINE_EMUL_NETBSD
void
388 do_getpid(emulation
*emul
,
395 cpu_registers(processor
)->gpr
[3] = (int)getpid();
399 STATIC_INLINE_EMUL_NETBSD
void
400 do_getuid(emulation
*emul
,
407 cpu_registers(processor
)->gpr
[3] = (int)getuid();
411 STATIC_INLINE_EMUL_NETBSD
void
412 do_geteuid(emulation
*emul
,
419 cpu_registers(processor
)->gpr
[3] = (int)geteuid();
423 STATIC_INLINE_EMUL_NETBSD
void
424 do_kill(emulation
*emul
,
430 pid_t pid
= cpu_registers(processor
)->gpr
[arg0
];
431 int sig
= cpu_registers(processor
)->gpr
[arg0
+1];
433 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
434 printf_filtered ("%d, %d", (int)pid
, sig
);
437 printf_filtered("SYS_kill at 0x%x - more to this than just being killed\n",
439 cpu_halt(processor
, cia
, was_signalled
, sig
);
443 STATIC_INLINE_EMUL_NETBSD
void
444 do_dup(emulation
*emul
,
450 int oldd
= cpu_registers(processor
)->gpr
[arg0
];
451 int status
= dup(oldd
);
453 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
454 printf_filtered ("%d", oldd
);
457 emul_write_status(processor
, status
, errno
);
461 STATIC_INLINE_EMUL_NETBSD
void
462 do_getegid(emulation
*emul
,
469 cpu_registers(processor
)->gpr
[3] = (int)getegid();
473 STATIC_INLINE_EMUL_NETBSD
void
474 do_getgid(emulation
*emul
,
481 cpu_registers(processor
)->gpr
[3] = (int)getgid();
485 STATIC_INLINE_EMUL_NETBSD
void
486 do_sigprocmask(emulation
*emul
,
492 natural_word how
= cpu_registers(processor
)->gpr
[arg0
];
493 unsigned_word set
= cpu_registers(processor
)->gpr
[arg0
+1];
494 unsigned_word oset
= cpu_registers(processor
)->gpr
[arg0
+2];
497 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
498 printf_filtered ("%ld, 0x%ld, 0x%ld", (long)how
, (long)set
, (long)oset
);
500 cpu_registers(processor
)->gpr
[3] = 0;
501 cpu_registers(processor
)->gpr
[4] = set
;
505 STATIC_INLINE_EMUL_NETBSD
void
506 do_ioctl(emulation
*emul
,
512 int d
= cpu_registers(processor
)->gpr
[arg0
];
513 unsigned request
= cpu_registers(processor
)->gpr
[arg0
+1];
514 unsigned_word argp_addr
= cpu_registers(processor
)->gpr
[arg0
+2];
516 #if !WITH_NetBSD_HOST
517 cpu_registers(processor
)->gpr
[arg0
] = 0; /* just succeed */
519 unsigned param_len
= IOCPARM_LEN(request
);
520 unsigned basecmd
= IOCBASECMD(request
);
521 unsigned group
= IOCGROUP(request
);
522 unsigned dir
= request
& IOC_DIRMASK
;
526 /* what we haven't done */
527 if (dir
& IOC_IN
/* write into the io device */
529 || !(dir
& IOC_VOID
))
530 error("do_ioctl() read or write of parameter not implemented\n");
531 status
= ioctl(d
, request
, NULL
);
532 emul_write_status(processor
, status
, errno
);
535 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
536 printf_filtered ("%d, 0x%x, 0x%lx", d
, request
, (long)argp_addr
);
540 STATIC_INLINE_EMUL_NETBSD
void
541 do_umask(emulation
*emul
,
547 int mask
= cpu_registers(processor
)->gpr
[arg0
];
549 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
550 printf_filtered ("0%o", mask
);
553 cpu_registers(processor
)->gpr
[3] = umask(mask
);
557 STATIC_INLINE_EMUL_NETBSD
void
558 do_dup2(emulation
*emul
,
564 int oldd
= cpu_registers(processor
)->gpr
[arg0
];
565 int newd
= cpu_registers(processor
)->gpr
[arg0
+1];
566 int status
= dup2(oldd
, newd
);
568 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
569 printf_filtered ("%d, %d", oldd
, newd
);
572 emul_write_status(processor
, status
, errno
);
576 STATIC_INLINE_EMUL_NETBSD
void
577 do_fcntl(emulation
*emul
,
583 int fd
= cpu_registers(processor
)->gpr
[arg0
];
584 int cmd
= cpu_registers(processor
)->gpr
[arg0
+1];
585 int arg
= cpu_registers(processor
)->gpr
[arg0
+2];
588 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
589 printf_filtered ("%d, %d, %d", fd
, cmd
, arg
);
592 status
= fcntl(fd
, cmd
, arg
);
593 emul_write_status(processor
, status
, errno
);
597 STATIC_INLINE_EMUL_NETBSD
void
598 do_gettimeofday(emulation
*emul
,
604 unsigned_word t_addr
= cpu_registers(processor
)->gpr
[arg0
];
605 unsigned_word tz_addr
= cpu_registers(processor
)->gpr
[arg0
+1];
608 int status
= gettimeofday((t_addr
!= 0 ? &t
: NULL
),
609 (tz_addr
!= 0 ? &tz
: NULL
));
611 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
612 printf_filtered ("0x%lx, 0x%lx", (long)t_addr
, (long)tz_addr
);
615 emul_write_status(processor
, status
, errno
);
618 write_timeval(t_addr
, t
, processor
, cia
);
620 write_timezone(tz_addr
, tz
, processor
, cia
);
625 STATIC_INLINE_EMUL_NETBSD
void
626 do_getrusage(emulation
*emul
,
632 int who
= cpu_registers(processor
)->gpr
[arg0
];
633 unsigned_word rusage_addr
= cpu_registers(processor
)->gpr
[arg0
+1];
634 struct rusage rusage
;
635 int status
= getrusage(who
, (rusage_addr
!= 0 ? &rusage
: NULL
));
637 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
638 printf_filtered ("%d, 0x%lx", who
, (long)rusage_addr
);
641 emul_write_status(processor
, status
, errno
);
643 if (rusage_addr
!= 0)
644 write_rusage(rusage_addr
, rusage
, processor
, cia
);
649 #if !WITH_NetBSD_HOST
652 STATIC_INLINE_EMUL_NETBSD
void
653 do_fstatfs(emulation
*emul
,
659 int fd
= cpu_registers(processor
)->gpr
[arg0
];
660 unsigned_word buf_addr
= cpu_registers(processor
)->gpr
[arg0
+1];
664 if (WITH_TRACE
&& ppc_trace
[trace_os_emul
])
665 printf_filtered ("%d, 0x%lx", fd
, (long)buf_addr
);
668 status
= fstatfs(fd
, (buf_addr
== 0 ? NULL
: &buf
));
669 emul_write_status(processor
, status
, errno
);
672 write_statfs(buf_addr
, buf
, processor
, cia
);
678 STATIC_INLINE_EMUL_NETBSD
void
679 do_stat(emulation
*emul
,
685 char path_buf
[PATH_MAX
];
686 unsigned_word path_addr
= cpu_registers(processor
)->gpr
[arg0
];
687 unsigned_word stat_buf_addr
= cpu_registers(processor
)->gpr
[arg0
+1];
688 char *path
= emul_read_string(path_buf
, path_addr
, PATH_MAX
, processor
, cia
);
692 status
= stat(path
, &buf
);
693 emul_write_status(processor
, status
, errno
);
695 write_stat(stat_buf_addr
, buf
, processor
, cia
);
699 STATIC_INLINE_EMUL_NETBSD
void
700 do_fstat(emulation
*emul
,
706 int fd
= cpu_registers(processor
)->gpr
[arg0
];
707 unsigned_word stat_buf_addr
= cpu_registers(processor
)->gpr
[arg0
+1];
710 emul_write_status(processor
, fstat(fd
, &buf
), errno
);
711 write_stat(stat_buf_addr
, buf
, processor
, cia
);
715 STATIC_INLINE_EMUL_NETBSD
void
716 do_lstat(emulation
*emul
,
722 char path_buf
[PATH_MAX
];
723 unsigned_word path_addr
= cpu_registers(processor
)->gpr
[arg0
];
724 char *path
= emul_read_string(path_buf
, path_addr
, PATH_MAX
, processor
, cia
);
725 unsigned_word stat_buf_addr
= cpu_registers(processor
)->gpr
[arg0
+1];
728 emul_write_status(processor
, stat(path
, &buf
), errno
);
729 write_stat(stat_buf_addr
, buf
, processor
, cia
);
733 #if !WITH_NetBSD_HOST
734 #define do_getdirentries 0
736 STATIC_INLINE_EMUL_NETBSD
void
737 do_getdirentries(emulation
*emul
,
743 int fd
= cpu_registers(processor
)->gpr
[arg0
];
744 unsigned_word buf_addr
= cpu_registers(processor
)->gpr
[arg0
+1];
746 int nbytes
= cpu_registers(processor
)->gpr
[arg0
+2];
747 unsigned_word basep_addr
= cpu_registers(processor
)->gpr
[arg0
+3];
751 if (buf_addr
!= 0 && nbytes
>= 0)
752 buf
= zalloc(nbytes
);
755 status
= getdirentries(fd
,
756 (buf_addr
== 0 ? NULL
: buf
),
758 (basep_addr
== 0 ? NULL
: &basep
));
759 emul_write_status(processor
, status
, errno
);
761 emul_write_word(basep_addr
, basep
, processor
, cia
);
763 write_direntries(buf_addr
, buf
, status
, processor
, cia
);
770 STATIC_INLINE_EMUL_NETBSD
void
771 do___syscall(emulation
*emul
,
779 cpu_registers(processor
)->gpr
[arg0
],
786 STATIC_INLINE_EMUL_NETBSD
void
787 do_lseek(emulation
*emul
,
793 int fildes
= cpu_registers(processor
)->gpr
[arg0
];
794 off_t offset
= emul_read_gpr64(processor
, arg0
+2);
795 int whence
= cpu_registers(processor
)->gpr
[arg0
+4];
798 status
= lseek(fildes
, offset
, whence
);
800 emul_write_status(processor
, -1, errno
);
802 emul_write_gpr64(processor
, 3, status
);
807 STATIC_INLINE_EMUL_NETBSD
void
808 do___sysctl(emulation
*emul
,
814 /* call the arguments by their real name */
815 unsigned_word name
= cpu_registers(processor
)->gpr
[arg0
];
816 natural_word namelen
= cpu_registers(processor
)->gpr
[arg0
+1];
817 unsigned_word oldp
= cpu_registers(processor
)->gpr
[arg0
+2];
818 unsigned_word oldlenp
= cpu_registers(processor
)->gpr
[arg0
+3];
821 natural_word int_val
;
824 /* pluck out the management information base id */
826 error("system_call()SYS___sysctl bad name[0]\n");
827 mib
= vm_data_map_read_word(cpu_data_map(processor
),
833 /* see what to do with it ... */
836 #if WITH_NetBSD_HOST && (CTL_HW != 6)
840 error("system_call()SYS___sysctl - CTL_HW - bad name[1]\n");
841 mib
= vm_data_map_read_word(cpu_data_map(processor
),
847 case 7/*HW_PAGESIZE*/:
848 #if WITH_NetBSD_HOST && (HW_PAGESIZE != 7)
849 # error "HW_PAGESIZE"
851 oldlen
= vm_data_map_read_word(cpu_data_map(processor
),
855 if (sizeof(natural_word
) > oldlen
)
856 error("system_call()sysctl - CTL_HW.HW_PAGESIZE - to small\n");
858 oldlen
= sizeof(int_val
);
859 emul_write_word(oldp
, int_val
, processor
, cia
);
860 emul_write_word(oldlenp
, oldlen
, processor
, cia
);
863 error("sysctl() CTL_HW.%d unknown\n", mib
);
868 error("sysctl() name[0]=%s unknown\n", (int)mib
);
871 cpu_registers(processor
)->gpr
[3] = 0;
876 static emul_call_descriptor netbsd_descriptors
[] = {
877 /* 0 */ { 0, "syscall", { 0, }, 0 },
878 /* 1 */ { do_exit
, "exit", { 0, }, 0 },
879 /* 2 */ { 0, "fork", { 0, }, 0 },
880 /* 3 */ { do_read
, "read", { 0, }, 0 },
881 /* 4 */ { do_write
, "write", { 0, }, 0 },
882 /* 5 */ { do_open
, "open", { 0, }, 0 },
883 /* 6 */ { do_close
, "close", { 0, }, 0 },
884 /* 7 */ { 0, "wait4", { 0, }, 0 },
885 { 0, }, /* 8 is old creat */
886 /* 9 */ { 0, "link", { 0, }, 0 },
887 /* 10 */ { 0, "unlink", { 0, }, 0 },
888 { 0, }, /* 11 is obsolete execv */
889 /* 12 */ { 0, "chdir", { 0, }, 0 },
890 /* 13 */ { 0, "fchdir", { 0, }, 0 },
891 /* 14 */ { 0, "mknod", { 0, }, 0 },
892 /* 15 */ { 0, "chmod", { 0, }, 0 },
893 /* 16 */ { 0, "chown", { 0, }, 0 },
894 /* 17 */ { do_break
, "break", { 0, }, 0 },
895 /* 18 */ { 0, "getfsstat", { 0, }, 0 },
896 { 0, }, /* 19 is old lseek */
897 /* 20 */ { do_getpid
, "getpid", { 0, }, 0 },
898 /* 21 */ { 0, "mount", { 0, }, 0 },
899 /* 22 */ { 0, "unmount", { 0, }, 0 },
900 /* 23 */ { 0, "setuid", { 0, }, 0 },
901 /* 24 */ { do_getuid
, "getuid", { 0, }, 0 },
902 /* 25 */ { do_geteuid
, "geteuid", { 0, }, 0 },
903 /* 26 */ { 0, "ptrace", { 0, }, 0 },
904 /* 27 */ { 0, "recvmsg", { 0, }, 0 },
905 /* 28 */ { 0, "sendmsg", { 0, }, 0 },
906 /* 29 */ { 0, "recvfrom", { 0, }, 0 },
907 /* 30 */ { 0, "accept", { 0, }, 0 },
908 /* 31 */ { 0, "getpeername", { 0, }, 0 },
909 /* 32 */ { 0, "getsockname", { 0, }, 0 },
910 /* 33 */ { 0, "access", { 0, }, 0 },
911 /* 34 */ { 0, "chflags", { 0, }, 0 },
912 /* 35 */ { 0, "fchflags", { 0, }, 0 },
913 /* 36 */ { 0, "sync", { 0, }, 0 },
914 /* 37 */ { do_kill
, "kill", { 0, }, 0 },
915 { 0, }, /* 38 is old stat */
916 /* 39 */ { 0, "getppid", { 0, }, 0 },
917 { 0, }, /* 40 is old lstat */
918 /* 41 */ { do_dup
, "dup", { 0, }, 0 },
919 /* 42 */ { 0, "pipe", { 0, }, 0 },
920 /* 43 */ { do_getegid
, "getegid", { 0, }, 0 },
921 /* 44 */ { 0, "profil", { 0, }, 0 },
922 /* 45 */ { 0, "ktrace", { 0, }, 0 },
923 /* 46 */ { 0, "sigaction", { 0, }, 0 },
924 /* 47 */ { do_getgid
, "getgid", { 0, }, 0 },
925 /* 48 */ { do_sigprocmask
, "sigprocmask", { 0, }, 0 },
926 /* 49 */ { 0, "getlogin", { 0, }, 0 },
927 /* 50 */ { 0, "setlogin", { 0, }, 0 },
928 /* 51 */ { 0, "acct", { 0, }, 0 },
929 /* 52 */ { 0, "sigpending", { 0, }, 0 },
930 /* 53 */ { 0, "sigaltstack", { 0, }, 0 },
931 /* 54 */ { do_ioctl
, "ioctl", { 0, }, 0 },
932 /* 55 */ { 0, "reboot", { 0, }, 0 },
933 /* 56 */ { 0, "revoke", { 0, }, 0 },
934 /* 57 */ { 0, "symlink", { 0, }, 0 },
935 /* 58 */ { 0, "readlink", { 0, }, 0 },
936 /* 59 */ { 0, "execve", { 0, }, 0 },
937 /* 60 */ { do_umask
, "umask", { 0, }, 0 },
938 /* 61 */ { 0, "chroot", { 0, }, 0 },
939 { 0, }, /* 62 is old fstat */
940 { 0, }, /* 63 is old getkerninfo */
941 { 0, }, /* 64 is old getpagesize */
942 /* 65 */ { 0, "msync", { 0, }, 0 },
943 /* 66 */ { 0, "vfork", { 0, }, 0 },
944 { 0, }, /* 67 is obsolete vread */
945 { 0, }, /* 68 is obsolete vwrite */
946 /* 69 */ { 0, "sbrk", { 0, }, 0 },
947 /* 70 */ { 0, "sstk", { 0, }, 0 },
948 { 0, }, /* 71 is old mmap */
949 /* 72 */ { 0, "vadvise", { 0, }, 0 },
950 /* 73 */ { 0, "munmap", { 0, }, 0 },
951 /* 74 */ { 0, "mprotect", { 0, }, 0 },
952 /* 75 */ { 0, "madvise", { 0, }, 0 },
953 { 0, }, /* 76 is obsolete vhangup */
954 { 0, }, /* 77 is obsolete vlimit */
955 /* 78 */ { 0, "mincore", { 0, }, 0 },
956 /* 79 */ { 0, "getgroups", { 0, }, 0 },
957 /* 80 */ { 0, "setgroups", { 0, }, 0 },
958 /* 81 */ { 0, "getpgrp", { 0, }, 0 },
959 /* 82 */ { 0, "setpgid", { 0, }, 0 },
960 /* 83 */ { 0, "setitimer", { 0, }, 0 },
961 { 0, }, /* 84 is old wait */
962 /* 85 */ { 0, "swapon", { 0, }, 0 },
963 /* 86 */ { 0, "getitimer", { 0, }, 0 },
964 { 0, }, /* 87 is old gethostname */
965 { 0, }, /* 88 is old sethostname */
966 { 0, }, /* 89 is old getdtablesize */
967 { do_dup2
, "dup2", { 0, }, 0 },
969 /* 92 */ { do_fcntl
, "fcntl", { 0, }, 0 },
970 /* 93 */ { 0, "select", { 0, }, 0 },
972 /* 95 */ { 0, "fsync", { 0, }, 0 },
973 /* 96 */ { 0, "setpriority", { 0, }, 0 },
974 /* 97 */ { 0, "socket", { 0, }, 0 },
975 /* 98 */ { 0, "connect", { 0, }, 0 },
976 { 0, }, /* 99 is old accept */
977 /* 100 */ { 0, "getpriority", { 0, }, 0 },
978 { 0, }, /* 101 is old send */
979 { 0, }, /* 102 is old recv */
980 /* 103 */ { 0, "sigreturn", { 0, }, 0 },
981 /* 104 */ { 0, "bind", { 0, }, 0 },
982 /* 105 */ { 0, "setsockopt", { 0, }, 0 },
983 /* 106 */ { 0, "listen", { 0, }, 0 },
984 { 0, }, /* 107 is obsolete vtimes */
985 { 0, }, /* 108 is old sigvec */
986 { 0, }, /* 109 is old sigblock */
987 { 0, }, /* 110 is old sigsetmask */
988 /* 111 */ { 0, "sigsuspend", { 0, }, 0 },
989 { 0, }, /* 112 is old sigstack */
990 { 0, }, /* 113 is old recvmsg */
991 { 0, }, /* 114 is old sendmsg */
992 /* - is obsolete vtrace */ { 0, "vtrace 115", { 0, }, 0 },
993 /* 116 */ { do_gettimeofday
, "gettimeofday", { 0, }, 0 },
994 /* 117 */ { do_getrusage
, "getrusage", { 0, }, 0 },
995 /* 118 */ { 0, "getsockopt", { 0, }, 0 },
996 /* 119 */ { 0, "resuba", { 0, }, 0 },
997 /* 120 */ { 0, "readv", { 0, }, 0 },
998 /* 121 */ { 0, "writev", { 0, }, 0 },
999 /* 122 */ { 0, "settimeofday", { 0, }, 0 },
1000 /* 123 */ { 0, "fchown", { 0, }, 0 },
1001 /* 124 */ { 0, "fchmod", { 0, }, 0 },
1002 { 0, }, /* 125 is old recvfrom */
1003 { 0, }, /* 126 is old setreuid */
1004 { 0, }, /* 127 is old setregid */
1005 /* 128 */ { 0, "rename", { 0, }, 0 },
1006 { 0, }, /* 129 is old truncate */
1007 { 0, }, /* 130 is old ftruncate */
1008 /* 131 */ { 0, "flock", { 0, }, 0 },
1009 /* 132 */ { 0, "mkfifo", { 0, }, 0 },
1010 /* 133 */ { 0, "sendto", { 0, }, 0 },
1011 /* 134 */ { 0, "shutdown", { 0, }, 0 },
1012 /* 135 */ { 0, "socketpair", { 0, }, 0 },
1013 /* 136 */ { 0, "mkdir", { 0, }, 0 },
1014 /* 137 */ { 0, "rmdir", { 0, }, 0 },
1015 /* 138 */ { 0, "utimes", { 0, }, 0 },
1016 { 0, }, /* 139 is obsolete 4.2 sigreturn */
1017 /* 140 */ { 0, "adjtime", { 0, }, 0 },
1018 { 0, }, /* 141 is old getpeername */
1019 { 0, }, /* 142 is old gethostid */
1020 { 0, }, /* 143 is old sethostid */
1021 { 0, }, /* 144 is old getrlimit */
1022 { 0, }, /* 145 is old setrlimit */
1023 { 0, }, /* 146 is old killpg */
1024 /* 147 */ { 0, "setsid", { 0, }, 0 },
1025 /* 148 */ { 0, "quotactl", { 0, }, 0 },
1026 { 0, }, /* 149 is old quota */
1027 { 0, }, /* 150 is old getsockname */
1032 /* 155 */ { 0, "nfssvc", { 0, }, 0 },
1033 { 0, }, /* 156 is old getdirentries */
1034 /* 157 */ { 0, "statfs", { 0, }, 0 },
1035 /* 158 */ { do_fstatfs
, "fstatfs", { 0, }, 0 },
1038 /* 161 */ { 0, "getfh", { 0, }, 0 },
1039 { 0, }, /* 162 is old getdomainname */
1040 { 0, }, /* 163 is old setdomainname */
1041 { 0, }, /* 164 is old uname */
1042 /* 165 */ { 0, "sysarch", { 0, }, 0 },
1046 /* 169 */ { 0, "semsys", { 0, }, 0 },
1047 /* 170 */ { 0, "msgsys", { 0, }, 0 },
1048 /* 171 */ { 0, "shmsys", { 0, }, 0 },
1058 /* 181 */ { 0, "setgid", { 0, }, 0 },
1059 /* 182 */ { 0, "setegid", { 0, }, 0 },
1060 /* 183 */ { 0, "seteuid", { 0, }, 0 },
1061 /* 184 */ { 0, "lfs_bmapv", { 0, }, 0 },
1062 /* 185 */ { 0, "lfs_markv", { 0, }, 0 },
1063 /* 186 */ { 0, "lfs_segclean", { 0, }, 0 },
1064 /* 187 */ { 0, "lfs_segwait", { 0, }, 0 },
1065 /* 188 */ { do_stat
, "stat", { 0, }, 0 },
1066 /* 189 */ { do_fstat
, "fstat", { 0, }, 0 },
1067 /* 190 */ { do_lstat
, "lstat", { 0, }, 0 },
1068 /* 191 */ { 0, "pathconf", { 0, }, 0 },
1069 /* 192 */ { 0, "fpathconf", { 0, }, 0 },
1071 /* 194 */ { 0, "getrlimit", { 0, }, 0 },
1072 /* 195 */ { 0, "setrlimit", { 0, }, 0 },
1073 /* 196 */ { do_getdirentries
, "getdirentries", { 0, }, 0 },
1074 /* 197 */ { 0, "mmap", { 0, }, 0 },
1075 /* 198 */ { do___syscall
, "__syscall", { 0, }, 0 },
1076 /* 199 */ { do_lseek
, "lseek", { 0, }, 0 },
1077 /* 200 */ { 0, "truncate", { 0, }, 0 },
1078 /* 201 */ { 0, "ftruncate", { 0, }, 0 },
1079 /* 202 */ { do___sysctl
, "__sysctl", { 0, }, 0 },
1080 /* 203 */ { 0, "mlock", { 0, }, 0 },
1081 /* 204 */ { 0, "munlock", { 0, }, 0 },
1084 static char *(netbsd_error_names
[]) = {
1121 /* 36 */ "EINPROGRESS",
1122 /* 37 */ "EALREADY",
1123 /* 38 */ "ENOTSOCK",
1124 /* 39 */ "EDESTADDRREQ",
1125 /* 40 */ "EMSGSIZE",
1126 /* 41 */ "EPROTOTYPE",
1127 /* 42 */ "ENOPROTOOPT",
1128 /* 43 */ "EPROTONOSUPPORT",
1129 /* 44 */ "ESOCKTNOSUPPORT",
1130 /* 45 */ "EOPNOTSUPP",
1131 /* 46 */ "EPFNOSUPPORT",
1132 /* 47 */ "EAFNOSUPPORT",
1133 /* 48 */ "EADDRINUSE",
1134 /* 49 */ "EADDRNOTAVAIL",
1135 /* 50 */ "ENETDOWN",
1136 /* 51 */ "ENETUNREACH",
1137 /* 52 */ "ENETRESET",
1138 /* 53 */ "ECONNABORTED",
1139 /* 54 */ "ECONNRESET",
1142 /* 57 */ "ENOTCONN",
1143 /* 58 */ "ESHUTDOWN",
1144 /* 59 */ "ETOOMANYREFS",
1145 /* 60 */ "ETIMEDOUT",
1146 /* 61 */ "ECONNREFUSED",
1148 /* 63 */ "ENAMETOOLONG",
1149 /* 64 */ "EHOSTDOWN",
1150 /* 65 */ "EHOSTUNREACH",
1151 /* 66 */ "ENOTEMPTY",
1152 /* 67 */ "EPROCLIM",
1158 /* 73 */ "ERPCMISMATCH",
1159 /* 74 */ "EPROGUNAVAIL",
1160 /* 75 */ "EPROGMISMATCH",
1161 /* 76 */ "EPROCUNAVAIL",
1166 /* 81 */ "ENEEDAUTH",
1170 static char *(netbsd_signal_names
[]) = {
1197 /* 26 */ "SIGVTALRM",
1199 /* 28 */ "SIGWINCH",
1205 emulation emul_netbsd
= {
1207 sizeof(netbsd_descriptors
) / sizeof(netbsd_descriptors
[0]),
1209 sizeof(netbsd_error_names
) / sizeof(netbsd_error_names
[0]),
1210 netbsd_signal_names
,
1211 sizeof(netbsd_signal_names
) / sizeof(netbsd_signal_names
[0]),
1214 #endif /* _EMUL_NETBSD_C_ */