home *** CD-ROM | disk | FTP | other *** search
- #include <bsd43/sys/syscall.h>
- #include <bsd43/sys/param.h>
- #include <bsd43/sys/types.h>
- #include <bsd43/sys/vfs.h>
- #include <bsd43/sys/time.h>
- #include <bsd43/sys/resource.h>
- #include <bsd43/sys/ioctl.h>
- #include <bsd43/sys/stat.h>
- #include <bsd43/sys/file.h>
- #include <bsd43/sys/socket.h>
- #include <bsd43/sys/uio.h>
- #include <bsd43/sys/wait.h>
- #include <bsd43/sys/sysmips.h>
- #include <bsd43/mips/hwconf.h>
- #define NFSCLIENT
- #include <bsd43/sys/mount.h>
- #undef NFSCLIENT
- #include <bsd43/rpc/types.h>
- #include <bsd43/rpc/auth.h>
- #include <bsd43/nfs/nfs.h>
- #include <bsd43/netinet/in.h>
- #include <bsd43/nfs/nfs_clnt.h>
- #include <bsd43/nfs/export.h>
- #include <bsd43/fcntl.h>
- #include <bsd43/signal.h>
- #include <fcntl.h>
- #include <errno.h>
- #include <stdio.h>
- #include "register.h"
- #include "symtab.h"
- #include "diblock.h"
- #include "instrn.h"
- #include "process.h"
- #include "sysentry.h"
- #include "res.h"
- #include "nels.h"
- #include "flag.h"
- #include "generic.h"
-
- extern int fd_lookup();
- extern int fd_open();
- extern void fd_dopen();
- extern int fd_close();
- extern int fd_sort();
- extern void histo_dump();
- extern void hist_dump();
- extern char *strdup();
- extern int bufset();
- extern int mstrlen();
- extern int mgetstring();
- extern int mgets();
- extern char **mgetvp();
- extern int mfreevp();
- extern int augment_execve_args();
- extern int mget();
- extern int mput();
- extern void say_time();
- extern char *proc_text_address();
- extern char *signal_set();
- extern int sysv_sys_ioctl();
-
- extern FILE *outfp;
- extern int errno;
-
- extern int Fflag;
-
- extern unsigned long arg[];
-
- extern int return_errno; /* errno goes here. */
- extern long return_value0; /* Result 1 value goes here. */
- extern long return_value1; /* Result 2 value goes here. */
-
- extern sysentry *current_sysentp;
- extern char *sys_call_buf; /* Scratch buf. */
-
- static
- int
- sys_adjtime(syscallno)
- int syscallno;
- {
- struct bsd43_timeval tv;
- struct bsd43_timeval otv;
-
- return generic_adjtime(syscallno, &tv, sizeof(tv), &otv, sizeof(otv));
- }
-
- static
- int
- sys_dup2(syscallno)
- int syscallno;
- {
- int old_real_fd;
-
- Rstart;
- return_value0 = syscall(BSD43_SYS_dup, fd_lookup((int)arg[0]));
- return_errno = errno;
- Rstop;
-
- if (return_value0 == -1)
- return 0;
-
- if ((old_real_fd = fd_lookup((int)arg[1])) != -1)
- {
- (void)close(old_real_fd);
- (void)fd_close((int)arg[1]);
- }
-
- fd_dopen(return_value0, (int)arg[1]);
-
- return_value0 = (int)arg[1];
-
- return 0;
- }
-
- static
- int
- sys_execve(syscallno)
- int syscallno;
- {
- char *filename;
- char **argp;
- char **envp;
- int need_close_on_exec;
-
- if (mgetstring(arg[0]) == -1)
- return -1;
-
- if ((filename = strdup(sys_call_buf)) == (char *)0)
- {
- vcouldnot("execve(): ran out of memory");
- return -1;
- }
-
- if ((argp = mgetvp(arg[1])) == (char **)0)
- return -1;
-
- if ((envp = mgetvp(arg[2])) == (char **)0)
- return -1;
-
- if (fd_sort() == -1)
- return -1;
-
- if (Fflag)
- {
- int mok;
-
- if
- (
- syscall(BSD43_SYS_access, filename, BSD43_X_OK) != 0
- ||
- (mok = magic_ok(filename)) == 0
- ||
- (mok == 2 && interpreter_ok(filename) == 0)
- ||
- is_a_shared_library(filename)
- )
- {
- return_value0 = -1;
- return_errno = errno;
-
- if (mfreevp(envp) == -1)
- return -1;
-
- if (mfreevp(argp) == -1)
- return -1;
-
- (void)free(filename);
-
- return 0;
- }
-
- if (augment_execve_args(&filename, &argp, &envp) == -1)
- {
- (void)mfreevp(envp);
- (void)mfreevp(argp);
- (void)free(filename);
- }
-
- need_close_on_exec = 0;
- }
- else
- {
- histo_dump();
- hist_dump();
-
- if (fcntl(fileno(outfp), F_SETFD, 1) == -1)
- {
- vcouldnot("fcntl(%d, F_SETFD, 1)", fileno(outfp));
- return -1;
- }
-
- need_close_on_exec = 1;
- }
-
- Rstart;
- return_value0 = syscall(syscallno, filename, argp, envp);
- return_errno = errno;
- Rstop;
-
- if (need_close_on_exec)
- {
- if (fcntl(fileno(outfp), F_SETFD, 0) == -1)
- {
- vcouldnot("fcntl(%d, F_SETFD, 0)", fileno(outfp));
- return -1;
- }
- }
-
- if (mfreevp(envp) == -1)
- return -1;
-
- if (mfreevp(argp) == -1)
- return -1;
-
- (void)free(filename);
-
- return 0;
- }
-
- static
- int
- sys_exportfs(syscallno)
- int syscallno;
- {
- char *dirnamep;
- char dirname[1024];
- struct export exent;
- struct export *exp;
- int first_length;
- int write_length;
-
- if (mgets(arg[0], &dirnamep) == -1)
- return -1;
-
- if (dirnamep != (char *)0)
- {
- (void)strcpy(&dirname[0], dirnamep);
- dirnamep = &dirname[0];
- }
-
- if (arg[1] == (unsigned long)0)
- exp = (struct export *)0;
- else
- {
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg[1], &exent, sizeof(exent)) == -1)
- return -1;
-
- if (exent.ex_flags & EX_RDMOSTLY)
- {
- write_length = exent.ex_writeaddrs.naddrs * sizeof(struct bsd43_sockaddr);
- #if 0
- fprintf(stderr, "writenaddrs = %d, write_length = %d\n", exent.ex_writeaddrs.naddrs, write_length);
- #endif /* 0 */
- }
- else
- write_length = 0;
-
- switch (exent.ex_auth)
- {
- case AUTH_UNIX:
- first_length = exent.ex_u.exunix.rootaddrs.naddrs * sizeof(struct bsd43_sockaddr);
- #if 0
- fprintf(stderr, "rootnaddrs = %d, root_length = %d\n", exent.ex_u.exunix.rootaddrs.naddrs, first_length);
- #endif /* 0 */
-
- if (bufset((unsigned int)(first_length + write_length)) == -1)
- return -1;
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)exent.ex_u.exunix.rootaddrs.addrvec, sys_call_buf, first_length) == -1)
- return -1;
-
- exent.ex_u.exunix.rootaddrs.addrvec = (struct sockaddr *)sys_call_buf;
- break;
-
- case AUTH_DES:
- /*
- * No thanks -- I'll wait till I see it used.
- */
- return -2;
-
- default:
- return -2;
- }
-
- if (exent.ex_flags & EX_RDMOSTLY)
- {
- if (quiet_procmget(GLOBALdipc, (unsigned long)exent.ex_writeaddrs.addrvec, sys_call_buf + first_length, write_length) == -1)
- return -1;
-
- exent.ex_writeaddrs.addrvec = (struct sockaddr *)(sys_call_buf + first_length);
- }
-
- exp = &exent;
- }
-
- Rstart;
- return_value0 = syscall(syscallno, dirnamep, exp);
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_fcntl(syscallno)
- int syscallno;
- {
- switch ((int)arg[1])
- {
- case BSD43_F_DUPFD:
- Rstart;
- return_value0 = syscall(BSD43_SYS_dup, fd_lookup((int)arg[0]));
- return_errno = errno;
- Rstop;
-
- if (return_value0 != -1)
- {
- int newfd;
- int nfiles;
-
- for (nfiles = fd_nfiles(), newfd = (int)arg[2]; newfd < nfiles && fd_lookup(newfd) != -1; newfd++)
- ;
-
- if (newfd >= nfiles)
- {
- (void)close(return_value0);
- errno = EMFILE;
- return 0;
- }
-
- fd_dopen(return_value0, newfd);
-
- return_value0 = newfd;
- }
- break;
-
- case BSD43_F_GETFD:
- case BSD43_F_SETFD:
- case BSD43_F_GETFL:
- case BSD43_F_SETFL:
- case BSD43_F_SETOWN:
- Rstart;
- return_value0 = syscall(syscallno, fd_lookup((int)arg[0]), (int)arg[1], (int)arg[2]);
- return_errno = errno;
- Rstop;
- break;
-
- default:
- return -2;
- }
-
- return 0;
- }
-
- static
- int
- sys_fstat(syscallno)
- int syscallno;
- {
- return generic_fstat(syscallno, sizeof(struct bsd43_stat));
- }
-
- static
- int
- sys_fstatfs(syscallno)
- int syscallno;
- {
- struct bsd43_statfs *bufp;
-
- if (dmget(arg[1], sizeof(*bufp), &bufp) == -1)
- return -1;
-
- Rstart;
- return_value0 = syscall(syscallno, arg[0], bufp);
- return_errno = errno;
- Rstop;
-
- if (mput(arg[1], bufp, sizeof(*bufp), return_value0) == -1)
- return -1;
-
- return 0;
- }
-
- static
- int
- sys_getgid(syscallno)
- int syscallno;
- {
- /*
- * TODO: second return value for BSD43 getgid().
- */
- Rstart;
- return_value0 = syscall(syscallno);
- return_value1 = getegid(); /* Not really correct. */
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_getgroups(syscallno)
- int syscallno;
- {
- return generic_getgroups(syscallno, BSD43_NGROUPS);
- }
-
- static
- int
- sys_getitimer(syscallno)
- int syscallno;
- {
- return generic_getitimer(syscallno, sizeof(struct bsd43_itimerval));
- }
-
- static
- int
- sys_getpgrp(syscallno)
- int syscallno;
- {
- Rstart;
- return_value0 = syscall(syscallno, (int)arg[0]);
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_getrlimit(syscallno)
- int syscallno;
- {
- return generic_getrlimit(syscallno, sizeof(struct bsd43_rlimit));
- }
-
- static
- int
- sys_getrusage(syscallno)
- int syscallno;
- {
- return generic_getrusage(syscallno, sizeof(struct bsd43_rusage));
- }
-
- static
- int
- sys_gettimeofday(syscallno)
- int syscallno;
- {
- struct bsd43_timeval tv;
- struct bsd43_timezone tz;
-
- return generic_gettimeofday(syscallno, &tv, sizeof(tv), &tz, sizeof(tz));
- }
-
- static
- int
- sys_getuid(syscallno)
- int syscallno;
- {
- /*
- * TODO: second return value for BSD43 getuid().
- */
- Rstart;
- return_value0 = syscall(syscallno);
- return_value1 = geteuid(); /* Not really correct. */
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- typedef union bsd43_ifcu bsd43_ifcu;
- union bsd43_ifcu
- {
- caddr_t ifcu_buf;
- struct ifreq *ifcu_req;
- };
-
- typedef struct bsd43_ifconf bsd43_ifconf;
- struct bsd43_ifconf
- {
- int ifc_len; /* size of associated buffer */
- bsd43_ifcu ifc_ifcu;
- };
-
- #define ifconf bsd43_ifconf
-
- /*
- * See /bsd43/usr/include/sys/ioctl.h.
- */
- static
- int
- sys_ioctl(syscallno)
- int syscallno;
- {
- int length;
- int need_copy_in;
- int need_copy_out;
- char iocbuf[BSD43_IOCPARM_MASK];
- bsd43_ifconf *ifp;
- caddr_t saved_ifcu_buf;
-
- if ((arg[1] & (unsigned long)(BSD43_IOC_INOUT | BSD43_IOC_VOID)) == 0)
- return sysv_sys_ioctl();
-
- need_copy_in = arg[1] & (unsigned long)BSD43_IOC_IN;
- need_copy_out = arg[1] & (unsigned long)BSD43_IOC_OUT;
- length = (arg[1] >> (unsigned long)16) & (unsigned long)BSD43_IOCPARM_MASK;
-
- if (need_copy_in)
- {
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg[2], &iocbuf[0], length) == -1)
- return -1;
- }
-
- /*
- * Sadly, the bsd43 ioctl encoding scheme only handles
- * one level of indirection, so ...
- */
- switch (arg[1])
- {
- case BSD43_SIOCGIFCONF:
- /*
- * if(7)
- */
- ifp = (bsd43_ifconf *)&iocbuf[0];
-
- if (bufset((unsigned int)ifp->ifc_len) == -1)
- return -1;
-
- saved_ifcu_buf = ifp->ifc_ifcu.ifcu_buf;
- ifp->ifc_ifcu.ifcu_buf = sys_call_buf;
- break;
- }
-
- /*
- * TODO: But what about fd's hidden in ioctl() args?
- * strioctl() calls, for example.
- */
- Rstart;
- return_value0 = syscall(syscallno, fd_lookup((int)arg[0]), (int)arg[1], &iocbuf[0]);
- return_errno = errno;
- Rstop;
-
- if (return_value0 != -1 && need_copy_out)
- {
- switch (arg[1])
- {
- case BSD43_SIOCGIFCONF:
- ifp = (bsd43_ifconf *)&iocbuf[0];
-
- if (quiet_procmput(GLOBALdipc, (unsigned long)saved_ifcu_buf, sys_call_buf, ifp->ifc_len) == -1)
- return -1;
-
- ifp->ifc_ifcu.ifcu_buf = saved_ifcu_buf;
- break;
- }
-
- if (quiet_procmput(GLOBALdipc, (unsigned long)arg[2], &iocbuf[0], length) == -1)
- return -1;
- }
-
- return 0;
- }
-
- /*
- * Global entry point so that the sysv ioctl()
- * can call the bsd43 ioctl() when it finds that
- * it is really being called with bsd43 arguments
- * .. yes, this is fairly gross.
- */
- int
- bsd43_sys_ioctl()
- {
- static int ive_been_called_before;
- int result;
-
- if (ive_been_called_before)
- result = -2;
- else
- {
- ive_been_called_before = 1;
- result = sys_ioctl(BSD43_SYS_ioctl);
- }
-
- ive_been_called_before = 0;
-
- return result;
- }
-
- static
- int
- sys_lstat(syscallno)
- int syscallno;
- {
- struct bsd43_stat statb;
-
- return generic_lstat(syscallno, &statb, sizeof(statb));
- }
-
- static
- int
- sys_mount(syscallno)
- int syscallno;
- {
- char *typenamep;
- char typename[1024];
- char *dirnamep;
- char dirname[1024];
- char *normal_argsp;
- char normal_args[1024];
- struct bsd43_nfs_args nfsargs;
- /*
- * Should be:
-
- struct bsd43_sockaddr_in sock;
-
- * but there doesn't seem to be such
- * a definition in any of the include
- * files I've looked through, so...
- */
- struct sockaddr_in sock;
- fhandle_t fh;
- char *data;
- char shostname[HOSTNAMESZ];
- char snetname[MAXNETNAMELEN + 1];
-
- if (mgets(arg[0], &typenamep) == -1)
- return -1;
-
- if (typenamep != (char *)0)
- {
- (void)strcpy(&typename[0], typenamep);
- typenamep = &typename[0];
- }
-
- if (mgets(arg[1], &dirnamep) == -1)
- return -1;
-
- if (dirnamep != (char *)0)
- {
- (void)strcpy(&dirname[0], dirnamep);
- dirnamep = &dirname[0];
- }
-
- if
- (
- strcmp(&typename[0], "ffs") == 0
- ||
- strcmp(&typename[0], "ufs") == 0
- ||
- strcmp(&typename[0], "4.3") == 0
- )
- {
- if (mgets(arg[3], &normal_argsp) == -1)
- return -1;
-
- if (normal_argsp != (char *)0)
- {
- (void)strcpy(&normal_args[0], normal_argsp);
- normal_argsp = &normal_args[0];
- }
-
- data = normal_argsp;
- }
- else /* "nfs" */
- {
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg[3], &nfsargs, sizeof(nfsargs)) == -1)
- return -1;
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)nfsargs.addr, &sock, sizeof(sock)) == -1)
- return -1;
-
- /*
- * This cast is wrong but see comment
- * above at start of this routine.
- */
- *(char **)&nfsargs.addr = (char *)&sock;
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)nfsargs.fh, &fh, sizeof(fh)) == -1)
- return -1;
-
- nfsargs.fh = (caddr_t)&fh;
-
- if (nfsargs.flags & BSD43_NFSMNT_HOSTNAME)
- {
- if (quiet_procmget(GLOBALdipc, (unsigned long)nfsargs.bsd43_hostname, &shostname[0], sizeof(shostname)) == -1)
- return -1;
-
- nfsargs.bsd43_hostname = &shostname[0];
- }
-
- if (nfsargs.flags & BSD43_NFSMNT_SECURE)
- {
- if (quiet_procmget(GLOBALdipc, (unsigned long)nfsargs.netname, &snetname[0], sizeof(snetname)) == -1)
- return -1;
-
- nfsargs.netname = &snetname[0];
- }
-
- data = (char *)&nfsargs;
- }
-
- Rstart;
- return_value0 = syscall(syscallno, typenamep, dirnamep, (int)arg[2], (int)data);
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_pipe(syscallno)
- int syscallno;
- {
- /*
- * TODO: do real bsd43 syscall for pipe()
- */
- int fds[2];
-
- Rstart;
- return_value0 = pipe(&fds[0]);
- return_errno = errno;
- Rstop;
-
- if (return_value0 != -1)
- {
- return_value0 = fd_open(fds[0]);
- return_value1 = fd_open(fds[1]);
- }
-
- return 0;
- }
-
- static
- int
- sys_readv(syscallno)
- int syscallno;
- {
- struct bsd43_iovec *saved_iov;
- struct bsd43_iovec *iov;
- int iovcnt;
- int i;
-
- iovcnt = arg[2];
-
- /*
- * Copy in the scatter/gather array.
- */
- if ((struct bsd43_iovec *)arg[1] != (struct bsd43_iovec *)0)
- {
- if ((iov = (struct bsd43_iovec *)malloc(iovcnt * sizeof(*iov))) == (struct bsd43_iovec *)0)
- {
- vcouldnot("allocate buffer for scatter/gather vector of %d elements", iovcnt);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg[1], iov, (unsigned int)iovcnt * sizeof(*iov)) == -1)
- return -1;
-
- /*
- * Save a copy of the array.
- */
- if ((saved_iov = (struct bsd43_iovec *)malloc(iovcnt * sizeof(*iov))) == (struct bsd43_iovec *)0)
- {
- vcouldnot("allocate buffer for saved scatter/gather vector of %d elements", iovcnt);
- return -1;
- }
-
- (void)memcpy(saved_iov, iov, iovcnt * sizeof(*iov));
-
- /*
- * Copy in each entry of the array.
- */
- for (i = 0; i < iovcnt; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &iov[i];
-
- if (liovp->iov_base != (caddr_t)0)
- {
- caddr_t b;
-
- if ((b = (caddr_t)malloc(liovp->iov_len)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for member of scatter/gather vector of %d bytes", liovp->iov_len);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)liovp->iov_base, b, (unsigned int)liovp->iov_len) == -1)
- return -1;
-
- liovp->iov_base = b;
- }
- }
- }
-
- Rstart;
- return_value0 = syscall(syscallno, fd_lookup((int)arg[0]), iov, iovcnt);
- return_errno = errno;
- Rstop;
-
- /*
- * Copy out fields to the user, free()'ing as we go.
- */
-
- /*
- * Copy out the scatter/gather array.
- */
- if ((struct bsd43_iovec *)(arg[1]) != (struct bsd43_iovec *)0)
- {
- /*
- * Copy out each entry of the array.
- */
- for (i = 0; i < iovcnt; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &iov[i];
-
- if (saved_iov[i].iov_base != (caddr_t)0)
- {
- if (quiet_procmput(GLOBALdipc, (unsigned long)saved_iov[i].iov_base, liovp->iov_base, (unsigned int)liovp->iov_len) == -1)
- return -1;
-
- (void)free(liovp->iov_base);
- }
- }
-
- (void)free(saved_iov);
-
- /*
- * Copy out the reconstructed array itself?
- */
-
- (void)free(iov);
- }
-
- return 0;
- }
-
- static
- int
- sys_recvfrom(syscallno)
- int syscallno;
- {
- struct bsd43_sockaddr from;
-
- return generic_recvfrom(syscallno, &from);
- }
-
- static
- int
- sys_recvmsg(syscallno)
- int syscallno;
- {
- struct bsd43_msghdr local_msghdr;
- struct bsd43_msghdr saved_local_msghdr;
- struct bsd43_iovec *saved_msg_iov;
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg[1], &local_msghdr, sizeof(local_msghdr)) == -1)
- return -1;
-
- saved_local_msghdr = local_msghdr;
-
- /*
- * Copy in the optional address.
- */
- if (local_msghdr.msg_name != (caddr_t)0)
- {
- caddr_t name;
-
- if ((name = (caddr_t)malloc(local_msghdr.msg_namelen)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for msg_name of length %d bytes", local_msghdr.msg_namelen);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)local_msghdr.msg_name, name, (unsigned int)local_msghdr.msg_namelen) == -1)
- return -1;
-
- local_msghdr.msg_name = name;
- }
-
- /*
- * Copy in the scatter/gather array.
- */
- if (local_msghdr.msg_iov != (struct bsd43_iovec *)0)
- {
- struct bsd43_iovec *v;
- int i;
-
- if ((v = (struct bsd43_iovec *)malloc(local_msghdr.msg_iovlen * sizeof(*v))) == (struct bsd43_iovec *)0)
- {
- vcouldnot("allocate buffer for scatter/gather vector of %d elements", local_msghdr.msg_iovlen);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)local_msghdr.msg_iov, v, (unsigned int)local_msghdr.msg_iovlen * sizeof(*v)) == -1)
- return -1;
-
- local_msghdr.msg_iov = v;
-
- /*
- * Save a copy of the array.
- */
- if ((saved_msg_iov = (struct bsd43_iovec *)malloc(local_msghdr.msg_iovlen * sizeof(*v))) == (struct bsd43_iovec *)0)
- {
- vcouldnot("allocate buffer for saved scatter/gather vector of %d elements", local_msghdr.msg_iovlen);
- return -1;
- }
-
- (void)memcpy(saved_msg_iov, v, local_msghdr.msg_iovlen * sizeof(*v));
-
- /*
- * Copy in each entry of the array.
- */
- for (i = 0; i < local_msghdr.msg_iovlen; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &(local_msghdr.msg_iov[i]);
-
- if (liovp->iov_base != (caddr_t)0)
- {
- caddr_t b;
-
- if ((b = (caddr_t)malloc(liovp->iov_len)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for member of scatter/gather vector of %d bytes", liovp->iov_len);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)liovp->iov_base, b, (unsigned int)liovp->iov_len) == -1)
- return -1;
-
- liovp->iov_base = b;
- }
- }
- }
-
- /*
- * Copy in the optional(?) access rights.
- */
- if (local_msghdr.msg_accrights != (caddr_t)0)
- {
- caddr_t a;
-
- if ((a = (caddr_t)malloc(local_msghdr.msg_accrightslen)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for access rights of length %d bytes", local_msghdr.msg_accrightslen);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)local_msghdr.msg_accrights, a, (unsigned int)local_msghdr.msg_accrightslen) == -1)
- return -1;
-
- local_msghdr.msg_accrights = a;
- }
-
- Rstart;
- return_value0 = syscall(syscallno, fd_lookup((int)arg[0]), &local_msghdr, (int)arg[2]);
- return_errno = errno;
- Rstop;
-
- /*
- * Copy out fields to the user, free()'ing as we go.
- */
-
- /*
- * Copy out the access rights.
- */
- if (saved_local_msghdr.msg_accrights != (caddr_t)0)
- {
- if (quiet_procmput(GLOBALdipc, (unsigned long)saved_local_msghdr.msg_accrights, local_msghdr.msg_accrights, (unsigned int)local_msghdr.msg_accrightslen) == -1)
- return -1;
-
- (void)free((char *)local_msghdr.msg_accrights);
- }
-
- /*
- * Copy out the scatter/gather array.
- */
- if (saved_local_msghdr.msg_iov != (struct bsd43_iovec *)0)
- {
- int i;
-
- /*
- * Copy out each entry of the array.
- */
- for (i = 0; i < local_msghdr.msg_iovlen; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &(local_msghdr.msg_iov[i]);
-
- if (saved_msg_iov[i].iov_base != (caddr_t)0)
- {
- if (quiet_procmput(GLOBALdipc, (unsigned long)saved_msg_iov[i].iov_base, liovp->iov_base, (unsigned int)liovp->iov_len) == -1)
- return -1;
-
- (void)free(liovp->iov_base);
- }
- }
-
- (void)free(saved_msg_iov);
-
- /*
- * Copy out the reconstructed array itself?
- */
-
- (void)free(local_msghdr.msg_iov);
- }
-
- /*
- * Copy out the received name and its length?
- */
-
- (void)free(local_msghdr.msg_name);
-
- return 0;
- }
-
- #define select_dget(a,d,pp,m,nm) \
- { \
- if (a == 0) \
- pp = (struct bsd43_fd_set *)0; \
- else \
- { \
- struct bsd43_fd_set tfds; \
- int fd; \
- \
- if (quiet_procmget(GLOBALdipc, (unsigned long)a, &tfds, howmany(m, NFDBITS) * sizeof(bsd43_fd_mask)) == -1) \
- return -1; \
- \
- BSD43_FD_ZERO(&d); \
- \
- for (fd = 0; fd < m; fd++) \
- { \
- int nfd; \
- \
- if \
- ( \
- BSD43_FD_ISSET(fd, &tfds) \
- && \
- (nfd = fd_lookup(fd)) != -1 \
- ) \
- { \
- BSD43_FD_SET(nfd, &d); \
- if (nfd >= nm) \
- nm = nfd + 1; \
- } \
- } \
- \
- pp = &d; \
- } \
- }
-
- #define select_tget(a,d,p,t) \
- { \
- if (a == 0) \
- p = (t *)0; \
- else \
- { \
- if (quiet_procmget(GLOBALdipc, (unsigned long)a, &d, sizeof(d)) == -1) \
- return -1; \
- \
- p = &d; \
- } \
- }
-
- #define select_dput(a,pp,nn) \
- { \
- if (a != 0) \
- { \
- struct bsd43_fd_set tfds; \
- int fd; \
- \
- BSD43_FD_ZERO(&tfds); \
- \
- for (fd = 0; fd < nn; fd++) \
- { \
- int nfd; \
- \
- if \
- ( \
- (nfd = fd_lookup(fd)) != -1 \
- && \
- BSD43_FD_ISSET(nfd, pp) \
- ) \
- BSD43_FD_SET(fd, &tfds); \
- } \
- \
- if (quiet_procmput(GLOBALdipc, (unsigned long)a, &tfds, howmany(nn, BSD43_NFDBITS) * sizeof(bsd43_fd_mask)) == -1) \
- return -1; \
- } \
- }
-
- static
- int
- sys_select(syscallno)
- int syscallno;
- {
- struct bsd43_fd_set rfds;
- struct bsd43_fd_set *rfdsp;
- struct bsd43_fd_set wfds;
- struct bsd43_fd_set *wfdsp;
- struct bsd43_fd_set efds;
- struct bsd43_fd_set *efdsp;
- struct bsd43_timeval timeout;
- struct bsd43_timeval *timeoutp;
- int nfds;
- int newnfds;
-
- nfds = (int)arg[0];
- if (nfds > fd_nfiles())
- nfds = fd_nfiles();
- newnfds = 0;
-
- select_dget(arg[1], rfds, rfdsp, nfds, newnfds);
- select_dget(arg[2], wfds, wfdsp, nfds, newnfds);
- select_dget(arg[3], efds, efdsp, nfds, newnfds);
- select_tget(arg[4], timeout, timeoutp, struct bsd43_timeval);
-
- Rstart;
- return_value0 = syscall(syscallno, newnfds, rfdsp, wfdsp, efdsp, timeoutp);
- return_errno = errno;
- Rstop;
-
- if (return_value0 != -1)
- {
- select_dput(arg[3], efdsp, nfds);
- select_dput(arg[2], wfdsp, nfds);
- select_dput(arg[1], rfdsp, nfds);
- }
-
- return 0;
- }
-
- static
- int
- sys_sendmsg(syscallno)
- int syscallno;
- {
- struct bsd43_msghdr local_msghdr;
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg[1], &local_msghdr, sizeof(local_msghdr)) == -1)
- return -1;
-
- #if 0
- fprintf(outfp, "local_msghdr.msg_name = 0x%x\n", local_msghdr.msg_name);
- fprintf(outfp, "local_msghdr.msg_namelen = %d\n", local_msghdr.msg_namelen);
- #endif /* 0 */
-
- /*
- * Copy in the optional address.
- */
- if (local_msghdr.msg_name != (caddr_t)0)
- {
- caddr_t name;
-
- if ((name = (caddr_t)malloc(local_msghdr.msg_namelen)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for msg_name of length %d bytes", local_msghdr.msg_namelen);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)local_msghdr.msg_name, name, (unsigned int)local_msghdr.msg_namelen) == -1)
- return -1;
-
- local_msghdr.msg_name = name;
-
- #if 0
- {
- int i;
-
- fprintf(outfp, "msg_name =");
- for (i = 0; i < local_msghdr.msg_namelen; i++)
- fprintf(outfp, "%02x", local_msghdr.msg_name[i] & 0xFF);
- fprintf(outfp, "\n");
- }
- #endif /* 0 */
- }
-
- #if 0
- fprintf(outfp, "local_msghdr.msg_iov = 0x%x\n", local_msghdr.msg_iov);
- fprintf(outfp, "local_msghdr.msg_iovlen = %d\n", local_msghdr.msg_iovlen);
- #endif /* 0 */
-
- /*
- * Copy in the scatter/gather array.
- */
- if (local_msghdr.msg_iov != (struct bsd43_iovec *)0)
- {
- struct bsd43_iovec *v;
- int i;
-
- if ((v = (struct bsd43_iovec *)malloc(local_msghdr.msg_iovlen * sizeof(*v))) == (struct bsd43_iovec *)0)
- {
- vcouldnot("allocate buffer for scatter/gather vector of %d elements", local_msghdr.msg_iovlen);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)local_msghdr.msg_iov, v, (unsigned int)local_msghdr.msg_iovlen * sizeof(*v)) == -1)
- return -1;
-
- local_msghdr.msg_iov = v;
-
- /*
- * Copy in each entry in the array.
- */
- for (i = 0; i < local_msghdr.msg_iovlen; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &(local_msghdr.msg_iov[i]);
-
- #if 0
- fprintf(outfp, "local_msghdr.msg_iov[%d].iov_base = 0x%x\n", i, liovp->iov_base);
- fprintf(outfp, "local_msghdr.msg_iov[%d].iov_len = %d\n", i, liovp->iov_len);
- #endif /* 0 */
-
- if (liovp->iov_base != (caddr_t)0)
- {
- caddr_t b;
-
- if ((b = (caddr_t)malloc(liovp->iov_len)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for member of scatter/gather vector of %d bytes", liovp->iov_len);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)liovp->iov_base, b, (unsigned int)liovp->iov_len) == -1)
- return -1;
-
- liovp->iov_base = b;
- }
- }
- }
-
- #if 0
- fprintf(outfp, "local_msghdr.msg_accrights = %d\n", local_msghdr.msg_accrights);
- fprintf(outfp, "local_msghdr.msg_accrightslen = %d\n", local_msghdr.msg_accrightslen);
- #endif /* 0 */
-
- /*
- * Copy in the optional(?) access rights.
- */
- if (local_msghdr.msg_accrights != (caddr_t)0)
- {
- caddr_t a;
-
- if ((a = (caddr_t)malloc(local_msghdr.msg_accrightslen)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for access rights of length %d bytes", local_msghdr.msg_accrightslen);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)local_msghdr.msg_accrights, a, (unsigned int)local_msghdr.msg_accrightslen) == -1)
- return -1;
-
- local_msghdr.msg_accrights = a;
- }
-
- Rstart;
- return_value0 = syscall(syscallno, fd_lookup((int)arg[0]), &local_msghdr, (int)arg[2]);
- return_errno = errno;
- Rstop;
-
- /*
- * Should we copy out any of these fields to the user?
- * Assuming "no" until demonstrated otherwise.
- */
-
- /*
- * Free up all the temporary space...
- */
-
- if (local_msghdr.msg_accrights != (caddr_t)0)
- (void)free((char *)local_msghdr.msg_accrights);
-
- if (local_msghdr.msg_iov != (struct bsd43_iovec *)0)
- {
- int i;
-
- for (i = 0; i < local_msghdr.msg_iovlen; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &local_msghdr.msg_iov[i];
-
- if (liovp->iov_base != (caddr_t)0)
- (void)free((char *)liovp->iov_base);
- }
-
- (void)free((char *)local_msghdr.msg_iov);
- }
-
- if (local_msghdr.msg_name != (caddr_t)0)
- (void)free((char *)local_msghdr.msg_name);
-
- return 0;
- }
-
- static
- int
- sys_sendto(syscallno)
- int syscallno;
- {
- struct bsd43_sockaddr to;
-
- return generic_sendto(syscallno, &to);
- }
-
- static
- int
- sys_setitimer(syscallno)
- int syscallno;
- {
- struct bsd43_itimerval it;
- struct bsd43_itimerval oit;
-
- return generic_setitimer(syscallno, &it, sizeof(it), &oit, sizeof(oit));
- }
-
- static
- int
- sys_setpgrp(syscallno)
- int syscallno;
- {
- Rstart;
- return_value0 = syscall(syscallno, (int)arg[0], (int)arg[1]);
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_setrlimit(syscallno)
- int syscallno;
- {
- return generic_setrlimit(syscallno, sizeof(struct bsd43_rlimit));
- }
-
- static
- int
- sys_settimeofday(syscallno)
- int syscallno;
- {
- struct bsd43_timeval tv;
- struct bsd43_timezone tz;
-
- return generic_settimeofday(syscallno, &tv, sizeof(tv), &tz, sizeof(tz));
- }
-
- static
- int
- sys_sigblock(syscallno)
- int syscallno;
- {
- /*
- * TODO - sys_sigblock().
- */
- Rstart;
- return_value0 = syscall(syscallno, (int)arg[0]);
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_sigpause(syscallno)
- int syscallno;
- {
- /*
- * TODO - sys_sigpause().
- */
- Rstart;
- return_value0 = syscall(syscallno, (int)arg[0]);
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_sigreturn(syscallno)
- int syscallno;
- {
- /*
- * TODO - sys_sigreturn().
- */
- return_value0 = -1;
- return_errno = EFAULT;
-
- return 0;
- }
-
- static
- int
- sys_sigsetmask(syscallno)
- int syscallno;
- {
- /*
- * TODO - sys_sigsetmask().
- */
- Rstart;
- return_value0 = syscall(syscallno, (int)arg[0]);
- return_errno = errno;
- Rstop;
-
- return 0;
- }
-
- static
- int
- sys_sigstack(syscallno)
- int syscallno;
- {
- /*
- * TODO - sys_sigstack().
- */
- return_value0 = 0;
- return_errno = errno;
-
- return 0;
- }
-
- static
- int
- sys_sigvec(syscallno)
- int syscallno;
- {
- struct bsd43_sigvec sv;
- struct bsd43_sigvec *svp;
- struct bsd43_sigvec osv;
- struct bsd43_sigvec *osvp;
-
- if (mget(arg[1], &sv, sizeof(sv), &svp) == -1)
- return -1;
-
- if (mget(arg[2], &osv, sizeof(osv), &osvp) == -1)
- return -1;
-
- if
- (
- svp == (struct bsd43_sigvec *)0
- ||
- sv.sv_handler == BSD43_SIG_DFL
- ||
- sv.sv_handler == BSD43_SIG_IGN
- )
- {
- Rstart;
- return_value0 = syscall(syscallno, arg[0], svp, osvp);
- return_errno = errno;
- Rstop;
- }
- else
- {
- /*
- * TODO - rest of sys_sigvec().
- */
- return_value0 = 0;
- return_errno = errno;
- }
-
- if (mput(arg[2], osvp, sizeof(osv), return_value0) == -1)
- return -1;
-
- if (mput(arg[1], svp, sizeof(sv), return_value0) == -1)
- return -1;
-
- return 0;
- }
-
- static
- int
- sys_stat(syscallno)
- int syscallno;
- {
- struct bsd43_stat statb;
-
- return generic_stat(syscallno, &statb, sizeof(statb));
- }
-
- static
- int
- sys_statfs(syscallno)
- int syscallno;
- {
- char *cp;
- struct bsd43_statfs buf;
- struct bsd43_statfs *bufp;
-
- if (mgets(arg[0], &cp) == -1)
- return -1;
-
- if (mget(arg[1], &buf, sizeof(buf), &bufp) == -1)
- return -1;
-
- Rstart;
- return_value0 = syscall(syscallno, cp, bufp);
- return_errno = errno;
- Rstop;
-
- if (mput(arg[1], bufp, sizeof(buf), return_value0) == -1)
- return -1;
-
- return 0;
- }
-
- static
- int
- sys_sysmips(syscallno)
- int syscallno;
- {
- struct bsd43_hw_config *hwcp;
- struct bsd43_rusage *rusep;
- union bsd43_wait status;
- union bsd43_wait *statusp;
-
- switch (arg[0])
- {
- case BSD43_MIPS_HWCONF:
- if (dmget(arg[2], sizeof(*hwcp), &hwcp) == -1)
- return -1;
-
- Rstart;
- return_value0 = syscall(syscallno, arg[0], arg[1], hwcp, arg[3]);
- return_errno = errno;
- Rstop;
-
- if (dmput(arg[2], hwcp, sizeof(*hwcp), return_value0) == -1)
- return -1;
-
- break;
-
- case BSD43_MIPS_GETRUSAGE:
- if (dmget(arg[2], arg[3], &rusep) == -1)
- return -1;
-
- Rstart;
- return_value0 = syscall(syscallno, arg[0], arg[1], rusep, arg[3]);
- return_errno = errno;
- Rstop;
-
- if (dmput(arg[2], rusep, arg[3], return_value0) == -1)
- return -1;
-
- break;
-
- case BSD43_MIPS_WAIT3:
- if (mget(arg[1], &status, sizeof(status), &statusp) == -1)
- return -1;
-
- if (dmget(arg[3], arg[4], &rusep) == -1)
- return -1;
-
- Rstart;
- return_value0 = syscall(syscallno, arg[0], statusp, arg[2], rusep, arg[4]);
- return_errno = errno;
- Rstop;
-
- if (dmput(arg[3], rusep, arg[4], return_value0) == -1)
- return -1;
-
- if (mput(arg[1], statusp, sizeof(status), return_value0) == -1)
- return -1;
-
- break;
-
- default:
- return -2;
- }
-
- return 0;
- }
-
- static
- int
- sys_utimes(syscallno)
- int syscallno;
- {
- struct bsd43_timeval tv[2];
-
- return generic_utimes(syscallno, &tv[0], sizeof(tv));
- }
-
- static
- int
- sys_vfork(syscallno)
- int syscallno;
- {
- int parent_pid;
-
- parent_pid = getpid();
-
- /*
- * Not right for vfork() but close
- * enough for now.
- * Can't be a real vfork() here
- * because the child must be allowed to
- * return from this routine (aka stack frame).
- * So this will break programs
- * that rely on (e.g.) the shared memory
- * properties of vfork()...
- *
- * TODO -- proper vfork().
- */
- errno = 0;
- Rstart;
- return_value0 = syscall(BSD43_SYS_fork);
- return_errno = errno;
- Rstop;
-
- if ((P.p_pid = getpid()) != parent_pid)
- return_value0 = 0;
-
- switch (return_value0)
- {
- case -1: /* error */
- break;
-
- case 0: /* child */
- return_value1 = 1;
- break;
-
- default: /* parent */
- return_value1 = 0;
- break;
- }
-
- return 0;
- }
-
- static
- int
- sys_writev(syscallno)
- int syscallno;
- {
- struct bsd43_iovec *iov;
- int iovcnt;
- int i;
-
- /*
- * Copy in the scatter/gather array.
- */
- if ((struct bsd43_iovec *)arg[1] == (struct bsd43_iovec *)0)
- iov = (struct bsd43_iovec *)0;
- else
- {
- iovcnt = arg[2];
-
- if ((iov = (struct bsd43_iovec *)malloc(iovcnt * sizeof(*iov))) == (struct bsd43_iovec *)0)
- {
- vcouldnot("allocate buffer for scatter/gather vector of %d elements", iovcnt);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg[1], iov, (unsigned int)iovcnt * sizeof(*iov)) == -1)
- return -1;
-
- /*
- * Copy in each entry in the array.
- */
- for (i = 0; i < iovcnt; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &iov[i];
-
- if (liovp->iov_base != (caddr_t)0)
- {
- caddr_t b;
-
- if ((b = (caddr_t)malloc(liovp->iov_len)) == (caddr_t)0)
- {
- vcouldnot("allocate buffer for member of scatter/gather vector of %d bytes", liovp->iov_len);
- return -1;
- }
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)liovp->iov_base, b, (unsigned int)liovp->iov_len) == -1)
- return -1;
-
- liovp->iov_base = b;
- }
- }
- }
-
- Rstart;
- return_value0 = syscall(syscallno, fd_lookup((int)arg[0]), iov, iovcnt);
- return_errno = errno;
- Rstop;
-
- /*
- * Should we copy out any of these fields to the user?
- * Assuming "no" until demonstrated otherwise.
- */
-
- /*
- * Free up all the temporary space...
- */
-
- if (iov != (struct bsd43_iovec *)0)
- {
- for (i = 0; i < iovcnt; i++)
- {
- struct bsd43_iovec *liovp;
-
- liovp = &iov[i];
-
- if (liovp->iov_base != (caddr_t)0)
- (void)free((char *)liovp->iov_base);
- }
-
- (void)free((char *)iov);
- }
-
- return 0;
- }
-
- static
- int
- sys_wait3(syscallno)
- int syscallno;
- {
- union bsd43_wait s;
- struct bsd43_rusage r;
-
- return generic_wait3(syscallno, &s, sizeof(s), &r, sizeof(r));
- }
-
- static sysentry bsd43_systab[] =
- {
- { "syscall", 0, "d", 'd', (int (*)())0, },
- { "_exit", 1, "d", 'e', generic_exit, },
- { "fork", 0, "", 'Y', generic_fork, },
- { "read", 3, "dRd", 'd', generic_read, },
- { "write", 3, "dWd", 'd', generic_write, },
- { "open", 3, "FOm", 'd', generic_open, },
- { "close", 1, "d", 'd', generic_close, },
- { "Owait", 0, "", '\0', (int (*)())0, },
- { "creat", 2, "Fm", 'd', generic_creat, },
- { "link", 2, "FF", 'd', generic_link, },
-
- { "unlink", 1, "F", 'd', generic_unlink, },
- { "Oexecv", 0, "", '\0', (int (*)())0, },
- { "chdir", 1, "F", 'd', generic_chdir, },
- { "Otime", 0, "", '\0', (int (*)())0, },
- { "mknod", 3, "Fmx", 'd', generic_mknod, },
- { "chmod", 2, "Fm", 'd', generic_chmod, },
- { "chown", 3, "Fdd", 'd', generic_chown, },
- { "brk", 1, "I", 'd', generic_brk, },
- { "Ostat", 0, "", '\0', (int (*)())0, },
- { "lseek", 3, "duw", 'u', generic_lseek, },
-
- { "getpid", 0, "", 'd', generic_getpid, },
- { "Omount", 0, "", '\0', (int (*)())0, },
- { "Oumount", 0, "", '\0', (int (*)())0, },
- { "Osetuid", 0, "", '\0', (int (*)())0, },
- { "getuid", 0, "", 'Y', sys_getuid, },
- { "Ostime", 0, "", '\0', (int (*)())0, },
- { "ptrace", 4, "ddxd", 'd', generic_ptrace, },
- { "Oalarm", 0, "", '\0', (int (*)())0, },
- { "Ofstat", 0, "", '\0', (int (*)())0, },
- { "Opause", 0, "", '\0', (int (*)())0, },
-
- { "Outime", 0, "", '\0', (int (*)())0, },
- { "Ostty", 0, "", '\0', (int (*)())0, },
- { "Ogtty", 0, "", '\0', (int (*)())0, },
- { "access", 2, "FP", 'd', generic_access, },
- { "Onice", 0, "", '\0', (int (*)())0, },
- { "Oftime", 0, "", '\0', (int (*)())0, },
- { "sync", 0, "", 'd', generic_sync, },
- { "kill", 2, "dK", 'd', generic_kill, },
- { "stat", 2, "FS", 'd', sys_stat, },
- { "Osetpgrp", 0, "", '\0', (int (*)())0, },
-
- { "lstat", 2, "FS", 'd', sys_lstat, },
- { "dup", 1, "d", 'd', generic_dup, },
- { "pipe", 0, "", 'Y', sys_pipe, },
- { "Otimes", 0, "", '\0', (int (*)())0, },
- { "profil", 4, "Iddd", 'd', generic_profil, },
- { "", 0, "", '\0', (int (*)())0, },
- { "Osetgid", 0, "", '\0', (int (*)())0, },
- { "getgid", 0, "", 'Y', sys_getgid, },
- { "Osigsys", 0, "", '\0', (int (*)())0, },
- { "", 0, "", '\0', (int (*)())0, },
-
- { "", 0, "", '\0', (int (*)())0, },
- { "acct", 1, "F", 'd', generic_acct, },
- { "Ophys", 0, "", '\0', (int (*)())0, },
- { "Osyslock", 0, "", '\0', (int (*)())0, },
- { "ioctl", 3, "dCA", 'd', sys_ioctl, },
- { "reboot", 0, "", '\0', (int (*)())0, },
- { "Ompxchan", 0, "", '\0', (int (*)())0, },
- { "symlink", 2, "FF", 'd', generic_symlink, },
- { "readlink", 3, "FRd", 'd', generic_readlink, },
- { "execve", 3, "FlE", 'e', sys_execve, },
-
- { "umask", 1, "x", 'x', generic_umask, },
- { "chroot", 1, "F", 'd', generic_chroot, },
- { "fstat", 2, "dS", 'd', sys_fstat, },
- { "", 0, "", '\0', (int (*)())0, },
- { "getpagesize", 0, "", 'd', generic_getpagesize, },
- { "mremap", 0, "", '\0', (int (*)())0, },
- { "vfork", 0, "", 'Y', sys_vfork, },
- { "Ovread", 0, "", '\0', (int (*)())0, },
- { "Ovwrite", 0, "", '\0', (int (*)())0, },
- { "sbrk", 0, "", '\0', (int (*)())0, },
-
- { "sstk", 0, "", '\0', (int (*)())0, },
- { "mmap", 0, "", '\0', (int (*)())0, },
- { "Ovadvise", 0, "", '\0', (int (*)())0, },
- { "munmap", 0, "", '\0', (int (*)())0, },
- { "mprotec", 0, "", '\0', (int (*)())0, },
- { "madvise", 0, "", '\0', (int (*)())0, },
- { "vhangup", 0, "", 'd', generic_vhangup, },
- { "Ovlimit", 0, "", '\0', (int (*)())0, },
- { "mincore", 0, "", '\0', (int (*)())0, },
- { "getgroups", 2, "dG", 'd', sys_getgroups, },
-
- { "setgroups", 2, "dg", 'd', generic_setgroups, },
- { "getpgrp", 1, "d", 'd', sys_getpgrp, },
- { "setpgrp", 2, "dd", 'd', sys_setpgrp, },
- { "setitimer", 3, "dVV", 'd', sys_setitimer, },
- { "wait3", 3, "xxx", 'd', sys_wait3, },
- { "swapon", 0, "", '\0', (int (*)())0, },
- { "getitimer", 2, "dV", 'd', sys_getitimer, },
- { "gethostname", 2, "xd", 'd', generic_gethostname, },
- { "sethostname", 0, "", '\0', (int (*)())0, },
- { "getdtablesize", 0, "", 'd', generic_getdtablesize, },
-
- { "dup2", 2, "dd", 'd', sys_dup2, },
- { "getdopt", 0, "", '\0', (int (*)())0, },
- { "fcntl", 3, "dBH", 'd', sys_fcntl, },
- { "select", 5, "dDDDT", 'd', sys_select, },
- { "setdopt", 0, "", '\0', (int (*)())0, },
- { "fsync", 1, "d", 'd', generic_fsync, },
- { "setpriority", 3, "ddd", 'd', generic_setpriority, },
- { "socket", 3, "abc", 'd', generic_socket, },
- { "connect", 3, "dLd", 'd', generic_connect, },
- { "accept", 3, "dLU", 'd', generic_accept, },
-
- { "getpriority", 2, "dd", 'd', generic_getpriority, },
- { "send", 4, "dWdN", 'd', generic_send, },
- { "recv", 4, "dRdN", 'd', generic_recv, },
- { "sigreturn", 1, "I", 'd', sys_sigreturn, },
- { "bind", 3, "dLd", 'd', generic_bind, },
- { "setsockopt", 5, "dddpd", 'd', generic_setsockopt, },
- { "listen", 2, "dd", 'd', generic_listen, },
- { "Ovtimes", 0, "", '\0', (int (*)())0, },
- { "sigvec", 3, "Kff", 'd', sys_sigvec, },
- { "sigblock", 1, "M", 'M', sys_sigblock, },
-
- { "sigsetmask", 1, "M", 'M', sys_sigsetmask, },
- { "sigpause", 1, "K", 'd', sys_sigpause, },
- { "sigstack", 2, "II", 'd', sys_sigstack, },
- { "recvmsg", 3, "dpN", 'd', sys_recvmsg, },
- { "sendmsg", 3, "dpN", 'd', sys_sendmsg, },
- { "Ovtrace", 0, "", '\0', (int (*)())0, },
- { "gettimeofday", 2, "TZ", 'd', sys_gettimeofday, },
- { "getrusage", 2, "dx", 'd', sys_getrusage, },
- { "getsockopt", 5, "dddxU", 'd', generic_getsockopt, },
- { "Oresuba", 0, "", '\0', (int (*)())0, },
-
- { "readv", 3, "dpd", 'd', sys_readv, },
- { "writev", 3, "dpd", 'd', sys_writev, },
- { "settimeofday", 2, "TZ", 'd', sys_settimeofday, },
- { "fchown", 3, "ddd", 'd', generic_fchown, },
- { "fchmod", 2, "dm", 'd', generic_fchmod, },
- { "recvfrom", 6, "dRdNLU", 'd', sys_recvfrom, },
- { "setreuid", 2, "dd", 'd', generic_setreuid, },
- { "setregid", 2, "dd", 'd', generic_setregid, },
- { "rename", 2, "FF", 'd', generic_rename, },
- { "truncate", 2, "Fu", 'd', generic_truncate, },
-
- { "ftruncate", 2, "du", 'd', generic_ftruncate, },
- { "flock", 2, "dd", 'd', generic_flock, },
- { "", 0, "", '\0', (int (*)())0, },
- { "sendto", 6, "dWdNLd", 'd', sys_sendto, },
- { "shutdown", 2, "dd", 'd', generic_shutdown, },
- { "socketpair", 4, "abcQ", 'd', generic_socketpair, },
- { "mkdir", 2, "Fm", 'd', generic_mkdir, },
- { "rmdir", 1, "F", 'd', generic_rmdir, },
- { "utimes", 2, "FV", 'd', sys_utimes, },
- { "sigcleanup", 0, "", '\0', (int (*)())0, },
-
- { "adjtime", 2, "TT", 'd', sys_adjtime, },
- { "getpeername", 3, "dLU", 'd', generic_getpeername, },
- { "gethostid", 0, "", 'u', generic_gethostid, },
- { "sethostid", 1, "u", 'd', generic_sethostid, },
- { "getrlimit", 2, "dx", 'd', sys_getrlimit, },
- { "setrlimit", 2, "dx", 'd', sys_setrlimit, },
- { "killpg", 2, "dK", 'd', generic_killpg, },
- { "", 0, "", '\0', (int (*)())0, },
- { "Osetquota", 0, "", '\0', (int (*)())0, },
- { "Oquota", 0, "", '\0', (int (*)())0, },
-
- { "getsockname", 3, "dLU", 'd', generic_getsockname, },
- { "sysmips", 4, "dxxx", 'd', sys_sysmips, },
- { "cacheflush", 3, "Idd", 'd', generic_cacheflush, },
- { "cachectl", 3, "Idd", 'd', generic_cachectl, },
- { "debug", 0, "", '\0', (int (*)())0, },
- { "", 0, "", '\0', (int (*)())0, },
- { "", 0, "", '\0', (int (*)())0, },
- { "Onfs_mount", 0, "", '\0', (int (*)())0, },
- { "nfssvc", 1, "d", 'd', generic_nfssvc, },
- { "getdirentries", 4, "dRdU", 'd', generic_getdirentries, },
-
- { "statfs", 2, "FX", 'd', sys_statfs, },
- { "fstatfs", 2, "dX", 'd', sys_fstatfs, },
- { "unmount", 1, "F", 'd', generic_unmount, },
- { "async_daemon", 0, "", 'd', generic_async_daemon, },
- { "getfh", 0, "", '\0', (int (*)())0, },
- { "getdomainname", 2, "xd", 'd', generic_getdomainname, },
- { "setdomainname", 2, "xd", 'd', generic_setdomainname, },
- { "Opcfs_mount", 0, "", '\0', (int (*)())0, },
- { "quotactl", 0, "", '\0', (int (*)())0, },
- { "old_exportfs", 0, "", '\0', (int (*)())0, },
-
- { "mount", 4, "FFxp", 'd', sys_mount, },
- { "hdwconf", 0, "", '\0', (int (*)())0, },
- { "exportfs", 2, "Fp", 'd', sys_exportfs, },
- { "nfsfh_open", 0, "", '\0', (int (*)())0, },
- { "libattach", 0, "", '\0', (int (*)())0, },
- { "libdetach", 0, "", '\0', (int (*)())0, },
- };
-
- sysentry *
- bsd43_systab_entry(n)
- int n;
- {
- if (n >= 0 && n < nels(bsd43_systab))
- return &bsd43_systab[n];
-
- return (sysentry *)0;
- }
-
- int
- bsd43_print_open_flags(arg)
- long arg;
- {
- need_leading_pipe = 0;
-
- if ((arg & (BSD43_O_WRONLY | BSD43_O_RDWR)) == 0)
- {
- say_flag(BSD43_O_RDONLY, "O_RDONLY", arg);
- }
- else
- {
- say_flag(BSD43_O_WRONLY, "O_WRONLY", arg);
- say_flag(BSD43_O_RDWR, "O_RDWR", arg);
- }
-
- say_flag(BSD43_O_APPEND, "O_APPEND", arg);
- say_flag(BSD43_O_CREAT, "O_CREAT", arg);
- say_flag(BSD43_O_EXCL, "O_EXCL", arg);
- say_flag(BSD43_O_NDELAY, "O_NDELAY", arg);
- say_flag(BSD43_O_TRUNC, "O_TRUNC", arg);
-
- say_residual(arg);
-
- return 0;
- }
-
- int
- bsd43_print_stat(arg)
- long arg;
- {
- struct bsd43_stat statbuf;
-
- if (quiet_procmget(GLOBALdipc, (unsigned long)arg, (char *)&statbuf, sizeof(statbuf)) == -1)
- return -1;
-
- fprintf(outfp, "{" /* } */ );
- fprintf(outfp, "st_dev=0x%x,", statbuf.st_dev);
- fprintf(outfp, " st_ino=%d,", statbuf.st_ino);
- fprintf(outfp, " st_mode=0x%x,", statbuf.st_mode);
- fprintf(outfp, " st_nlink=%d,", statbuf.st_nlink);
- fprintf(outfp, " st_uid=%d,", statbuf.st_uid);
- fprintf(outfp, " st_gid=%d,", statbuf.st_gid);
- fprintf(outfp, " st_rdev=0x%x,", statbuf.st_rdev);
- fprintf(outfp, " st_size=%d,", statbuf.st_size);
- fprintf(outfp, " st_atime=");
- say_time(outfp, statbuf.st_atime);
- fprintf(outfp, ",");
- fprintf(outfp, " st_mtime=");
- say_time(outfp, statbuf.st_mtime);
- fprintf(outfp, ",");
- fprintf(outfp, " st_ctime=");
- say_time(outfp, statbuf.st_ctime);
- fprintf(outfp, ",");
- fprintf(outfp, " st_blksize=%d,", statbuf.st_blksize);
- fprintf(outfp, " st_blocks=%d,", statbuf.st_blocks);
- fprintf(outfp, /* { */ "}");
-
- return 0;
- }
-
- int
- bsd43_print_ioctl_cmd(cmd)
- unsigned long cmd;
- {
- switch (cmd)
- {
- case BSD43_TIOCGETP:
- fprintf(outfp, "TIOCGETP");
- break;
-
- case BSD43_TIOCSETP:
- fprintf(outfp, "TIOCSETP");
- break;
-
- case BSD43_TIOCSETN:
- fprintf(outfp, "TIOCSETN");
- break;
-
- case BSD43_TIOCGWINSZ:
- fprintf(outfp, "TIOCGWINSZ");
- break;
-
- case BSD43_TIOCLGET:
- fprintf(outfp, "TIOCLGET");
- break;
-
- case BSD43_TIOCLSET:
- fprintf(outfp, "TIOCLSET");
- break;
-
- case BSD43_TIOCGETC:
- fprintf(outfp, "TIOCGETC");
- break;
-
- case BSD43_TIOCSETC:
- fprintf(outfp, "TIOCSETC");
- break;
-
- case BSD43_TIOCGLTC:
- fprintf(outfp, "TIOCGLTC");
- break;
-
- case BSD43_TIOCSLTC:
- fprintf(outfp, "TIOCSLTC");
- break;
-
- case BSD43_FIONBIO:
- fprintf(outfp, "FIONBIO");
- break;
-
- case BSD43_TIOCGPGRP:
- fprintf(outfp, "TIOCGPGRP");
- break;
-
- default:
- fprintf(outfp, "0x%x", cmd);
- break;
- }
-
- return 0;
- }
-
- static
- int
- say_sgttyb(arg)
- unsigned long arg;
- {
- struct bsd43_sgttyb sgb;
-
- if (quiet_procmget(GLOBALdipc, arg, (char *)&sgb, sizeof(sgb)) == -1)
- return -1;
-
- fprintf
- (
- outfp,
- "{sg_ispeed=%d, sg_ospeed=%d, sg_erase=0x%02x, sg_kill=0x%02x, sg_flags=",
- sgb.sg_ispeed & 0xFF,
- sgb.sg_ospeed & 0xFF,
- sgb.sg_erase & 0xFF,
- sgb.sg_kill & 0xFF
- );
-
- need_leading_pipe = 0;
-
- say_notflag(BSD43_BSDELAY, "BS0", sgb.sg_flags);
- say_flag(BSD43_BS1, "BS1", sgb.sg_flags);
- say_notflag(BSD43_VTDELAY, "FF0", sgb.sg_flags);
- say_flag(BSD43_FF1, "FF1", sgb.sg_flags);
- say_notflag(BSD43_CRDELAY, "CR0", sgb.sg_flags);
- say_flag(BSD43_CR3, "CR3", sgb.sg_flags);
- say_flag(BSD43_CR2, "CR2", sgb.sg_flags);
- say_flag(BSD43_CR1, "CR1", sgb.sg_flags);
- say_notflag(BSD43_TBDELAY, "TAB0", sgb.sg_flags);
- say_flag(BSD43_XTABS, "XTABS", sgb.sg_flags);
- say_flag(BSD43_TAB2, "TAB2", sgb.sg_flags);
- say_flag(BSD43_TAB1, "TAB1", sgb.sg_flags);
- say_notflag(BSD43_NLDELAY, "NL0", sgb.sg_flags);
- say_flag(BSD43_NL3, "NL3", sgb.sg_flags);
- say_flag(BSD43_NL2, "NL2", sgb.sg_flags);
- say_flag(BSD43_NL1, "NL1", sgb.sg_flags);
-
- say_flag(BSD43_EVENP, "EVENP", sgb.sg_flags);
- say_flag(BSD43_ODDP, "ODDP", sgb.sg_flags);
- say_flag(BSD43_RAW, "RAW", sgb.sg_flags);
- say_flag(BSD43_CRMOD, "CRMOD", sgb.sg_flags);
- say_flag(BSD43_ECHO, "ECHO", sgb.sg_flags);
- say_flag(BSD43_LCASE, "LCASE", sgb.sg_flags);
- say_flag(BSD43_CBREAK, "CBREAK", sgb.sg_flags);
- say_flag(BSD43_TANDEM, "TANDEM", sgb.sg_flags);
-
- fprintf(outfp, "}");
-
- return 0;
- }
-
- static
- int
- say_lmword(arg)
- unsigned long arg;
- {
- int local_mode_word;
-
- if (quiet_procmget(GLOBALdipc, arg, (char *)&local_mode_word, sizeof(local_mode_word)) == -1)
- return -1;
-
- need_leading_pipe = 0;
-
- say_flag(BSD43_LCRTBS, "LCRTBS", local_mode_word);
- say_flag(BSD43_LPRTERA, "LPRTERA", local_mode_word);
- say_flag(BSD43_LCRTERA, "LCRTERA", local_mode_word);
- say_flag(BSD43_LTILDE, "LTILDE", local_mode_word);
- say_flag(BSD43_LMDMBUF, "LMDMBUF", local_mode_word);
- say_flag(BSD43_LLITOUT, "LLITOUT", local_mode_word);
- say_flag(BSD43_LTOSTOP, "LTOSTOP", local_mode_word);
- say_flag(BSD43_LFLUSHO, "LFLUSHO", local_mode_word);
- say_flag(BSD43_LNOHANG, "LNOHANG", local_mode_word);
- #ifndef BSD43_LETXACK
- #ifndef BSD43_ETXACK
- #define BSD43_ETXACK (BSD43_L001000 >> 16)
- #endif /* BSD43_ETXACK */
- #define BSD43_LETXACK (BSD43_ETXACK >> 16)
- #endif /* BSD43_LETXACK */
- say_flag(BSD43_LETXACK, "LETXACK", local_mode_word);
- say_flag(BSD43_LCRTKIL, "LCRTKIL", local_mode_word);
- say_flag(BSD43_LPASS8, "LPASS8", local_mode_word);
- say_flag(BSD43_LCTLECH, "LCTLECH", local_mode_word);
- say_flag(BSD43_LPENDIN, "LPENDIN", local_mode_word);
- say_flag(BSD43_LDECCTQ, "LDECCTQ", local_mode_word);
- say_flag(BSD43_LNOFLSH, "LNOFLSH", local_mode_word);
-
- say_residual(local_mode_word);
-
- return 0;
- }
-
- static
- int
- say_ltc(arg)
- unsigned long arg;
- {
- struct bsd43_tchars tcs;
-
- if (quiet_procmget(GLOBALdipc, arg, (char *)&tcs, sizeof(tcs)) == -1)
- return -1;
-
- fprintf(outfp, "{");
- fprintf(outfp, "t_intrc=0x%02x, ", tcs.t_intrc);
- fprintf(outfp, "t_quitc=0x%02x, ", tcs.t_quitc);
- fprintf(outfp, "t_startc=0x%02x, ", tcs.t_startc);
- fprintf(outfp, "t_stopc=0x%02x, ", tcs.t_stopc);
- fprintf(outfp, "t_eofc=0x%02x, ", tcs.t_eofc);
- fprintf(outfp, "t_brkc=0x%02x, ", tcs.t_brkc);
- fprintf(outfp, "}");
-
- return 0;
- }
-
- static
- int
- say_sltc(arg)
- unsigned long arg;
- {
- struct bsd43_ltchars ltcs;
-
- if (quiet_procmget(GLOBALdipc, arg, (char *)<cs, sizeof(ltcs)) == -1)
- return -1;
-
- fprintf(outfp, "{");
- fprintf(outfp, "t_suspc=0x%02x, ", ltcs.t_suspc);
- fprintf(outfp, "t_dsuspc=0x%02x, ", ltcs.t_dsuspc);
- fprintf(outfp, "t_rprntc=0x%02x, ", ltcs.t_rprntc);
- fprintf(outfp, "t_flushc=0x%02x, ", ltcs.t_flushc);
- fprintf(outfp, "t_werasc=0x%02x, ", ltcs.t_werasc);
- fprintf(outfp, "t_lnextc=0x%02x, ", ltcs.t_lnextc);
- fprintf(outfp, "}");
-
- return 0;
- }
-
- static
- int
- say_int(arg)
- unsigned long arg;
- {
- int i;
-
- if (quiet_procmget(GLOBALdipc, arg, (char *)&i, sizeof(i)) == -1)
- return -1;
-
- fprintf(outfp, "{");
- fprintf(outfp, "i=%d", i);
- fprintf(outfp, "}");
-
- return 0;
- }
-
- static
- int
- say_winsize(arg)
- unsigned long arg;
- {
- struct bsd43_winsize w;
-
- if (quiet_procmget(GLOBALdipc, arg, (char *)&w, sizeof(w)) == -1)
- return -1;
-
- fprintf(outfp, "{");
- fprintf(outfp, "row=%d,", w.ws_row);
- fprintf(outfp, "col=%d,", w.ws_col);
- fprintf(outfp, "xpixel=%d,", w.ws_xpixel);
- fprintf(outfp, "ypixel=%d,", w.ws_ypixel);
- fprintf(outfp, "}");
-
- return 0;
- }
-
- int
- bsd43_print_ioctl_arg(args)
- unsigned long *args;
- {
- switch (args[1])
- {
- case BSD43_TIOCGETP:
- case BSD43_TIOCSETN:
- case BSD43_TIOCSETP:
- if (say_sgttyb(args[2]) == -1)
- return -1;
- break;
-
- case BSD43_TIOCLGET:
- case BSD43_TIOCLSET:
- if (say_lmword(args[2]) == -1)
- return -1;
- break;
-
- case BSD43_TIOCGETC:
- case BSD43_TIOCSETC:
- if (say_ltc(args[2]) == -1)
- return -1;
- break;
-
- case BSD43_TIOCGLTC:
- case BSD43_TIOCSLTC:
- if (say_sltc(args[2]) == -1)
- return -1;
- break;
-
- case BSD43_FIONBIO:
- case BSD43_TIOCGPGRP:
- if (say_int(args[2]) == -1)
- return -1;
- break;
-
- case BSD43_TIOCGWINSZ:
- if (say_winsize(args[2]) == -1)
- return -1;
- break;
-
- default:
- fprintf(outfp, "0x%x", args[2]);
- break;
- }
-
- return 0;
- }
-
- int
- bsd43_print_fdset(nfds, arg)
- int nfds;
- unsigned long arg;
- {
- if (arg == (unsigned long)0)
- fprintf(outfp, "0x%x", arg);
- else
- {
- struct bsd43_fd_set tfds;
- int fd;
-
- if (quiet_procmget(GLOBALdipc, arg, &tfds, sizeof(tfds)) == -1)
- return -1;
-
- fprintf(outfp, "{");
-
- for (fd = 0; fd < nfds; fd++)
- {
- if (BSD43_FD_ISSET(fd, &tfds))
- fprintf(outfp, "%d,", fd);
- }
-
- fprintf(outfp, "}");
- }
-
- return 0;
- }
-
- int
- bsd43_print_whence(arg)
- unsigned long arg;
- {
- switch (arg)
- {
- case BSD43_L_SET:
- fprintf(outfp, "L_SET");
- break;
-
- case BSD43_L_INCR:
- fprintf(outfp, "L_INCR");
- break;
-
- case BSD43_L_XTND:
- fprintf(outfp, "L_XTND");
- break;
-
- default:
- fprintf(outfp, "0x%x", arg);
- break;
- }
-
- return 0;
- }
-
- int
- bsd43_print_statfs(arg)
- unsigned long arg;
- {
- if (arg == (unsigned long)0)
- fprintf(outfp, "0x%x", arg);
- else
- {
- struct bsd43_statfs t;
-
- if (quiet_procmget(GLOBALdipc, arg, &t, sizeof(t)) == -1)
- return -1;
-
- fprintf(outfp, "{");
- fprintf(outfp, "type=%d,", t.f_type);
- fprintf(outfp, "bsize=%d,", t.f_bsize);
- fprintf(outfp, "blocks=%d,", t.f_blocks);
- fprintf(outfp, "bfree=%d,", t.f_bfree);
- fprintf(outfp, "bavail=%d,", t.f_bavail);
- fprintf(outfp, "files=%d,", t.f_files);
- fprintf(outfp, "ffree=%d,", t.f_ffree);
- fprintf(outfp, "fsid.val[0]=%d,", t.f_fsid.val[0]);
- fprintf(outfp, "fsid.val[1]=%d,", t.f_fsid.val[1]);
- fprintf(outfp, "}");
- }
- return 0;
- }
-
- int
- bsd43_print_sigvec(arg)
- unsigned long arg;
- {
- if (arg == (unsigned long)0)
- fprintf(outfp, "0x%x", arg);
- else
- {
- struct bsd43_sigvec t;
-
- if (quiet_procmget(GLOBALdipc, arg, &t, sizeof(t)) == -1)
- return -1;
-
- fprintf(outfp, "{");
-
- fprintf(outfp, "handler=");
- switch ((int)t.sv_handler)
- {
- case BSD43_BADSIG:
- fprintf(outfp, "BADSIG");
- break;
-
- case BSD43_SIG_DFL:
- fprintf(outfp, "SIG_DFL");
- break;
-
- case BSD43_SIG_IGN:
- fprintf(outfp, "SIG_IGN");
- break;
-
- default:
- fprintf(outfp, "%s", proc_text_address(t.sv_handler));
- break;
- }
- fprintf(outfp, ",");
-
- fprintf(outfp, "mask=%s,", signal_set(t.sv_mask));
- fprintf(outfp, "flags={");
- need_leading_pipe = 0;
- say_flag(BSD43_SV_ONSTACK, "SV_ONSTACK", t.sv_flags);
- say_flag(BSD43_SV_INTERRUPT, "SV_INTERRUPT", t.sv_flags);
- say_residual(t.sv_flags);
- fprintf(outfp, "}");
- fprintf(outfp, "}");
- }
- return 0;
- }
-
- void
- bsd43_print_sigcontext(outfp, p)
- FILE *outfp;
- unsigned long p;
- {
- fprintf(outfp, "0x%x");
- }
-