Annotation of sys/compat/osf1/README.syscalls, Revision 1.1
1.1 ! nbrk 1: $OpenBSD: README.syscalls,v 1.4 2001/07/09 05:15:23 fgsch Exp $
! 2: $NetBSD: README.syscalls,v 1.2 1999/04/27 16:09:28 cgd Exp $
! 3:
! 4: XXX this file should be gutted. functions' comments should go with
! 5: XXX the functions. Further, this file is ... very out of date.
! 6:
! 7: Once the new syscall argument-handling method was implemented, most
! 8: OSF/1 syscalls boiled down to their NetBSD equivalents. The
! 9: differences are detailed in this file.
! 10:
! 11: Note that some OSF/1 syscalls, including some of those that map
! 12: directly to equivalent NetBSD syscalls, are not implemented; they
! 13: were not needed, so the effort to implement and check them was not
! 14: expended.
! 15:
! 16: Finally, there are some OSF/1 syscalls which were left unimplemented,
! 17: but which seem strange enough to merit a bit more explanation.
! 18:
! 19: OSF/1 compatibility is helped by the fact that the sigcontext
! 20: structure was created for NetBSD/Alpha to be the same as the OSF/1
! 21: sigcontext structure. Because of this, only one sendsig() function is
! 22: needed, and then the NetBSD sigreturn() function can be used for OSF/1
! 23: sigreturn(), as well.
! 24:
! 25: The system calls are split out among the three files:
! 26: osf1_ioctl.c
! 27: osf1_misc.c
! 28: osf1_mount.c
! 29: as follows:
! 30: osf1_ioctl.c contains all osf1_ioctl() handling code.
! 31: osf1_mount.c contains all code dealing with mounting and
! 32: unmounting file systems, and with mount points in
! 33: general (e.g. osf1_getfsstat()).
! 34: osf1_misc.c contains the rest of the emulation functions.
! 35:
! 36: The emulation functions as follows:
! 37:
! 38: osf1_mknod()
! 39: dev_t's are different between OSF/1 and NetBSD. In OSF/1 a
! 40: dev_t has 12 bits of major number and 20 bits of minor number.
! 41: Under NetBSD, it's 24 bits of major, 8 bits of minor (but the
! 42: top 16 bits of the major number are unused, and may be
! 43: rearranged later). In any case, it was decided that the
! 44: primary use for OSF/1 binaries would be to complement native
! 45: NetBSD binaries, so file system dev_t's are assumed to be in
! 46: the NetBSD format, and osf1_mknod() translates from the OSF/1
! 47: format to the NetBSD format.
! 48:
! 49: osf1_getfsstat()
! 50: The statfs structure is different between NetBSD and OSF/1,
! 51: and the way file system types are denoted is different, as
! 52: well. This routine is the same as getfsstat(), except it
! 53: converts the statfs structures before returning them to the
! 54: OSF/1 process.
! 55:
! 56: osf1_lseek()
! 57: To compensate for quad alignment on 32-bit machines, the
! 58: NetBSD lseek() needs an extra argument of padding, before the
! 59: off_t 'offset' argument. This wrapper inserts the padding,
! 60: and calls the NetBSD routine.
! 61:
! 62: osf1_mount()
! 63: The file system type specification and the way you specify
! 64: mount options differs substantially between NetBSD and OSF/1.
! 65: This routine (and its callees) fakes up NetBSD arguments, and
! 66: calls the NetBSD routine.
! 67:
! 68: osf1_unmount()
! 69: Probably not necessary, but safe; translates flags, in case
! 70: the NetBSD unmount flags ever change.
! 71:
! 72: osf1_exec_with_loader() [UNIMPLEMENTED]
! 73: From the description in the OSF/1 manual page, this executes a
! 74: file with a named loader, or "/sbin/loader" if none is named.
! 75: It appears to be used in some way, when executing dynamically
! 76: linked binaries, but is _not_ called directly from user space
! 77: in the normal case. The interface by which it passes the name
! 78: of the file to be executed, its arguments, etc., to the loader
! 79: is unspecified, and, from experimental evidence, doesn't seem
! 80: to be the normal UN*X argument-passing convention (i.e.
! 81: argc/argv). For proper dynamically linked binary support,
! 82: this function will probably have to be implemented, but it's
! 83: unclear how that can be done (short of disassembling a lot of
! 84: code).
! 85:
! 86: osf1_open()
! 87: Translates OSF/1 flags to NetBSD flags.
! 88:
! 89: osf1_ioctl()
! 90: Screens out ioctl requests that aren't known to work, and
! 91: translates those that differ between NetBSD and OSF/1.
! 92:
! 93: osf1_reboot()
! 94: Translates OSF/1 flags to NetBSD flags.
! 95:
! 96: osf1_stat()
! 97: The stat structure differs between NetBSD and OSF/1, both in
! 98: terms of field sizes, and in the dev_t representation.
! 99: This does a NetBSD stat(), translates the results, and returns
! 100: them to the OSF/1 process.
! 101:
! 102: osf1_lstat()
! 103: Same as osf1_stat(), but for lstat().
! 104:
! 105: osf1_mmap()
! 106: The NetBSD version needs 4 bytes of padding before the off_t
! 107: 'pos' argument, and also uses different flags than the OSF/1
! 108: version. This wrapper translates the flags and deals with the
! 109: argument struct padding differences, then calls the NetBSD
! 110: routine.
! 111:
! 112: osf1_fstat()
! 113: Same as osf1_stat(), but for fstat().
! 114:
! 115: osf1_fcntl()
! 116: Translates OSF/1 fcntl() requests into their NetBSD
! 117: counterparts, then calls the NetBSD fcntl() to do the
! 118: operations.
! 119:
! 120: osf1_socket()
! 121: Makes sure that the socket type is valid for NetBSD, and if
! 122: so, calls NetBSD's socket().
! 123:
! 124: osf1_sendto()
! 125: Makes sure that the 'flags' argument doesn't use flags that
! 126: NetBSD can't handle, and calls NetBSD's sendto().
! 127:
! 128: osf1_getrlimit()
! 129: Makes sure that the 'which' selector is one that NetBSD can
! 130: deal with, and calls NetBSD's getrlimit().
! 131:
! 132: osf1_setrlimit()
! 133: Same as osf1_getrlimit(), but for setrlimit().
! 134:
! 135: osf1_sigaction()
! 136: Deals with the differences in the NetBSD and OSF/1 sigaction
! 137: structures, and calls NetBSD's sigaction with the appropriate
! 138: arguments. If the call requests that the old sigaction be
! 139: passed back, osf1_sigaction() translates it back to the OSF/1
! 140: form, and returns it appropriately.
! 141:
! 142: osf1_statfs()
! 143: Does that statfs() on the given pathname, then translates the
! 144: NetBSD statfs structure into the one that OSF/1 uses and
! 145: returns it. Makes a best effort on the mount type, because
! 146: there's not a one-to-one mapping between NetBSD and OSF/1
! 147: mount types.
! 148:
! 149: osf1_fstatfs()
! 150: Same as osf1_statfs(), but for fstatfs().
! 151:
! 152: osf1_usleep_thread()
! 153: This function is how sleep() and usleep() (and possibly other
! 154: functions) are implemented in OSF/1. Its usage was discovered
! 155: by disassembling the library routines that use it. It takes
! 156: two pointers to timeval structures as arguments. The first
! 157: contains the amount of time (in seconds and microseconds) to
! 158: sleep. If the second pointer is non-null, if the process
! 159: wakes up early, the amount of time "unslept" is returned. If
! 160: the process doesn't wake up early, zero is returned.
! 161:
! 162: osf1_setsysinfo()
! 163: A null-op; used early on, but nothing cares that it actually
! 164: does anything.
CVSweb