2
0
Fork 0

*** empty log message ***

This commit is contained in:
mike 1994-02-10 09:31:23 +00:00
commit ccc813be29
47 changed files with 5690 additions and 0 deletions

296
.depend Normal file
View file

@ -0,0 +1,296 @@
coff.o : coff.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/linux/fcntl.h \
/usr/include/asm/segment.h /usr/include/linux/sys.h /usr/include/ibcs/ibcs.h \
/usr/include/ibcs/trace.h
emulate.o : emulate.c /usr/include/linux/errno.h /usr/include/linux/sched.h \
/usr/include/linux/tasks.h /usr/include/asm/system.h /usr/include/linux/segment.h \
/usr/include/linux/head.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
/usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/types.h \
/usr/include/linux/dirent.h /usr/include/linux/vfs.h /usr/include/linux/net.h \
/usr/include/linux/socket.h /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h \
/usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h \
/usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h \
/usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
/usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h \
/usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h \
/usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h \
/usr/include/linux/sysv_fs_sb.h /usr/include/linux/mm.h /usr/include/linux/page.h \
/usr/include/linux/kernel.h /usr/include/linux/signal.h /usr/include/linux/time.h \
/usr/include/linux/param.h /usr/include/linux/resource.h /usr/include/linux/vm86.h \
/usr/include/linux/math_emu.h /usr/include/linux/stddef.h /usr/include/linux/unistd.h \
/usr/include/linux/ptrace.h /usr/include/linux/config.h /usr/include/linux/autoconf.h \
/usr/include/linux/fcntl.h /usr/include/asm/segment.h /usr/include/linux/sys.h \
/usr/include/linux/personality.h /usr/include/ibcs/ibcs.h /usr/include/ibcs/abi4.h \
/usr/include/ibcs/trace.h /usr/include/ibcs/xnx.h callmap.inc
fcntl.o : fcntl.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/asm/segment.h \
/usr/include/linux/sys.h /usr/include/linux/ipc.h /usr/include/linux/sem.h /usr/include/linux/string.h \
/usr/include/linux/fcntl.h /usr/include/ibcs/ibcs.h /usr/include/ibcs/trace.h
ioctl.o : ioctl.c /usr/include/linux/errno.h /usr/include/linux/stat.h /usr/include/linux/fs.h \
/usr/include/linux/linkage.h /usr/include/linux/limits.h /usr/include/linux/wait.h \
/usr/include/linux/types.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
/usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
/usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
/usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
/usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h \
/usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h \
/usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h \
/usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h \
/usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h /usr/include/linux/sched.h \
/usr/include/linux/tasks.h /usr/include/asm/system.h /usr/include/linux/segment.h \
/usr/include/linux/head.h /usr/include/linux/mm.h /usr/include/linux/page.h \
/usr/include/linux/kernel.h /usr/include/linux/signal.h /usr/include/linux/time.h \
/usr/include/linux/param.h /usr/include/linux/resource.h /usr/include/linux/vm86.h \
/usr/include/linux/math_emu.h /usr/include/linux/termios.h /usr/include/asm/segment.h \
/usr/include/ibcs/ibcs.h /usr/include/linux/sys.h /usr/include/linux/ptrace.h \
/usr/include/ibcs/trace.h
ipc.o : ipc.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/asm/segment.h \
/usr/include/linux/sys.h /usr/include/linux/ipc.h /usr/include/linux/sem.h /usr/include/linux/shm.h \
/usr/include/linux/string.h /usr/include/ibcs/ibcs.h /usr/include/ibcs/trace.h
mmap.o : mmap.c /usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/sched.h \
/usr/include/linux/tasks.h /usr/include/asm/system.h /usr/include/linux/segment.h \
/usr/include/linux/head.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
/usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/types.h \
/usr/include/linux/dirent.h /usr/include/linux/vfs.h /usr/include/linux/net.h \
/usr/include/linux/socket.h /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h \
/usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h \
/usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h \
/usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
/usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h \
/usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h \
/usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h \
/usr/include/linux/sysv_fs_sb.h /usr/include/linux/signal.h /usr/include/linux/time.h \
/usr/include/linux/param.h /usr/include/linux/resource.h /usr/include/linux/vm86.h \
/usr/include/linux/math_emu.h /usr/include/linux/errno.h /usr/include/linux/kernel.h \
/usr/include/linux/mman.h
open.o : open.c /usr/include/linux/vfs.h /usr/include/linux/types.h /usr/include/linux/utime.h \
/usr/include/linux/errno.h /usr/include/linux/fcntl.h /usr/include/linux/stat.h \
/usr/include/linux/string.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/dirent.h /usr/include/linux/net.h \
/usr/include/linux/socket.h /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h \
/usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h \
/usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h \
/usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
/usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h \
/usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h \
/usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h \
/usr/include/linux/sysv_fs_sb.h /usr/include/linux/mm.h /usr/include/linux/page.h \
/usr/include/linux/kernel.h /usr/include/linux/signal.h /usr/include/linux/time.h \
/usr/include/linux/param.h /usr/include/linux/resource.h /usr/include/linux/vm86.h \
/usr/include/linux/math_emu.h /usr/include/linux/tty.h /usr/include/linux/termios.h \
/usr/include/asm/segment.h /usr/include/ibcs/ibcs.h /usr/include/linux/sys.h \
/usr/include/linux/ptrace.h
signal.o : signal.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/linux/fcntl.h \
/usr/include/asm/segment.h /usr/include/linux/sys.h /usr/include/ibcs/ibcs.h \
/usr/include/ibcs/trace.h /usr/include/ibcs/xnx.h /usr/include/signal.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/sys/types.h
stat.o : stat.c /usr/include/linux/errno.h /usr/include/linux/stat.h /usr/include/linux/fs.h \
/usr/include/linux/linkage.h /usr/include/linux/limits.h /usr/include/linux/wait.h \
/usr/include/linux/types.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
/usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
/usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
/usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
/usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h \
/usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h \
/usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h \
/usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h \
/usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h /usr/include/linux/sched.h \
/usr/include/linux/tasks.h /usr/include/asm/system.h /usr/include/linux/segment.h \
/usr/include/linux/head.h /usr/include/linux/mm.h /usr/include/linux/page.h \
/usr/include/linux/kernel.h /usr/include/linux/signal.h /usr/include/linux/time.h \
/usr/include/linux/param.h /usr/include/linux/resource.h /usr/include/linux/vm86.h \
/usr/include/linux/math_emu.h /usr/include/asm/segment.h /usr/include/ibcs/ibcs.h \
/usr/include/linux/sys.h /usr/include/linux/ptrace.h
sysconf.o : sysconf.c /usr/include/linux/errno.h /usr/include/linux/sched.h \
/usr/include/linux/tasks.h /usr/include/asm/system.h /usr/include/linux/segment.h \
/usr/include/linux/head.h /usr/include/linux/fs.h /usr/include/linux/linkage.h \
/usr/include/linux/limits.h /usr/include/linux/wait.h /usr/include/linux/types.h \
/usr/include/linux/dirent.h /usr/include/linux/vfs.h /usr/include/linux/net.h \
/usr/include/linux/socket.h /usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h \
/usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h \
/usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h \
/usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h \
/usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h \
/usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h \
/usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h \
/usr/include/linux/sysv_fs_sb.h /usr/include/linux/mm.h /usr/include/linux/page.h \
/usr/include/linux/kernel.h /usr/include/linux/signal.h /usr/include/linux/time.h \
/usr/include/linux/param.h /usr/include/linux/resource.h /usr/include/linux/vm86.h \
/usr/include/linux/math_emu.h /usr/include/linux/stddef.h /usr/include/linux/unistd.h \
/usr/include/linux/ptrace.h /usr/include/linux/config.h /usr/include/linux/autoconf.h \
/usr/include/linux/fcntl.h /usr/include/asm/segment.h /usr/include/linux/sys.h \
/usr/include/ibcs/ibcs.h /usr/include/ibcs/trace.h
sysfs.o : sysfs.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/linux/fcntl.h \
/usr/include/asm/segment.h /usr/include/linux/sys.h /usr/include/ibcs/ibcs.h \
/usr/include/ibcs/trace.h
sysi86.o : sysi86.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/linux/fcntl.h \
/usr/include/asm/segment.h /usr/include/linux/sys.h /usr/include/ibcs/ibcs.h \
/usr/include/ibcs/trace.h
ulimit.o : ulimit.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/asm/segment.h \
/usr/include/linux/sys.h
wysev386.o : wysev386.c /usr/include/asm/segment.h /usr/include/linux/mm.h /usr/include/linux/page.h \
/usr/include/linux/sched.h /usr/include/linux/tasks.h /usr/include/asm/system.h \
/usr/include/linux/segment.h /usr/include/linux/head.h /usr/include/linux/fs.h \
/usr/include/linux/linkage.h /usr/include/linux/limits.h /usr/include/linux/wait.h \
/usr/include/linux/types.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
/usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
/usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
/usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
/usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h \
/usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h \
/usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h \
/usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h \
/usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h /usr/include/linux/signal.h \
/usr/include/linux/time.h /usr/include/linux/param.h /usr/include/linux/resource.h \
/usr/include/linux/vm86.h /usr/include/linux/math_emu.h /usr/include/linux/errno.h \
/usr/include/linux/kernel.h /usr/include/linux/utsname.h /usr/include/linux/sys.h \
/usr/include/ibcs/ibcs.h /usr/include/linux/ptrace.h
xnx.o : xnx.c /usr/include/linux/errno.h /usr/include/linux/sched.h /usr/include/linux/tasks.h \
/usr/include/asm/system.h /usr/include/linux/segment.h /usr/include/linux/head.h \
/usr/include/linux/fs.h /usr/include/linux/linkage.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/types.h /usr/include/linux/dirent.h \
/usr/include/linux/vfs.h /usr/include/linux/net.h /usr/include/linux/socket.h \
/usr/include/linux/sockios.h /usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h \
/usr/include/linux/ext_fs_i.h /usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h \
/usr/include/linux/msdos_fs_i.h /usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h \
/usr/include/linux/nfs.h /usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h \
/usr/include/linux/minix_fs_sb.h /usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h \
/usr/include/linux/hpfs_fs_sb.h /usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h \
/usr/include/linux/nfs_fs_sb.h /usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h \
/usr/include/linux/mm.h /usr/include/linux/page.h /usr/include/linux/kernel.h \
/usr/include/linux/signal.h /usr/include/linux/time.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/stddef.h /usr/include/linux/unistd.h /usr/include/linux/ptrace.h \
/usr/include/linux/config.h /usr/include/linux/autoconf.h /usr/include/linux/fcntl.h \
/usr/include/asm/segment.h /usr/include/linux/sys.h /usr/include/ibcs/xnx.h
xstat.o : xstat.c /usr/include/linux/kernel.h /usr/include/linux/linkage.h /usr/include/sys/types.h \
/usr/include/linux/types.h /usr/include/sys/stat.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/linux/stat.h /usr/include/sys/time.h /usr/include/linux/time.h \
/usr/include/time.h /usr/include/asm/segment.h /usr/include/linux/fs.h /usr/include/linux/limits.h \
/usr/include/linux/wait.h /usr/include/linux/dirent.h /usr/include/linux/vfs.h \
/usr/include/linux/net.h /usr/include/linux/socket.h /usr/include/linux/sockios.h \
/usr/include/linux/pipe_fs_i.h /usr/include/linux/minix_fs_i.h /usr/include/linux/ext_fs_i.h \
/usr/include/linux/ext2_fs_i.h /usr/include/linux/hpfs_fs_i.h /usr/include/linux/msdos_fs_i.h \
/usr/include/linux/iso_fs_i.h /usr/include/linux/nfs_fs_i.h /usr/include/linux/nfs.h \
/usr/include/linux/xia_fs_i.h /usr/include/linux/sysv_fs_i.h /usr/include/linux/minix_fs_sb.h \
/usr/include/linux/ext_fs_sb.h /usr/include/linux/ext2_fs_sb.h /usr/include/linux/hpfs_fs_sb.h \
/usr/include/linux/msdos_fs_sb.h /usr/include/linux/iso_fs_sb.h /usr/include/linux/nfs_fs_sb.h \
/usr/include/linux/xia_fs_sb.h /usr/include/linux/sysv_fs_sb.h /usr/include/linux/errno.h \
/usr/include/linux/sched.h /usr/include/linux/tasks.h /usr/include/asm/system.h \
/usr/include/linux/segment.h /usr/include/linux/head.h /usr/include/linux/mm.h \
/usr/include/linux/page.h /usr/include/linux/signal.h /usr/include/linux/param.h \
/usr/include/linux/resource.h /usr/include/linux/vm86.h /usr/include/linux/math_emu.h \
/usr/include/linux/sys.h /usr/include/ibcs/ibcs.h /usr/include/linux/ptrace.h \
/usr/include/ibcs/abi4.h

28
.gitignore vendored Normal file
View file

@ -0,0 +1,28 @@
# CVS default ignores begin
tags
TAGS
.make.state
.nse_depinfo
*~
\#*
.#*
,*
_$*
*$
*.old
*.bak
*.BAK
*.orig
*.rej
.del-*
*.a
*.olb
*.o
*.obj
*.so
*.exe
*.Z
*.elc
*.ln
core
# CVS default ignores end

42
Doc/Notes.Signal Normal file
View file

@ -0,0 +1,42 @@
Drew, Joe, and Brandon.
This file contains my code for the signal functions. I realized that the
existing signal functions will not suffice. This module should do the
proper processing for iBCS signals.
There are patches to the emulate module offered by Drew in his pl14n code
release. The Makefile was changed to include the module.
In addition, I have include a signal.doc file which contains the text from
my UNIX S5 manual describing the functions used by iBCS. I based the
emulator code on this document. Please look it over and see if I have
messed up. I believe it to be correct. However, it never hurts to have
someone check the work before we can trust it.
It follows what I believe to be the proper calling sequence for signals. I
sent a message to the IBSC2 group with the text from the McGraw Hill book
concerning signals. If you would like a copy of the message, then let me
know.
Of couse, this could be totally wrong. That is the whole point about
sending this out to a limited distribution.
In addition to the processing for the various function requests, you may
have noticed that the signal _numbers_ must be changed between the values
used by iBCS and Linux.
I have had to modify the emulate.c module to export an additional
procedure (and for emulate.c to use the procedure itself.) In addition, I
change the branch table to re-direct the signal processing to the signal.c
module.
I hope that this will help the project when it has been proven workable.
Please let me know how this turns out -- one way or the other.
If it does work, then I'll give the final code to Drew to merge into the
master code. That is unless, Drew, you already have it. :-)
Thanks much.
--
Al Longyear longyear@netcom.com longyear@sii.com

190
Doc/signal.doc Normal file
View file

@ -0,0 +1,190 @@
NAME
sigset, sighold, sigrelse, sigignore, sigpause - signal management
SYNOPSIS
#include <signal.h>
void (*sigset (sig, func)) ()
int sig;
void (*func) ();
int sighold (sig)
int sig;
int sigrelse (sig)
int sig;
int sigignore (sig)
int sig;
int sigpause (sig)
int sig;
DESCRIPTION
These functions provide signal management for application processes. sigset
specifies the system signal action to be taken upon receipt of signal
sig. This action is either calling a process signal-catching handler func
or performing a system-defined action.
Sig can be assigned any one of the following values except SIGKILL. Machine
or implementation dependent signals are not included (see NOTES below.)
Each value of sig is a macro, defined in <signal.h>, that expands to an
integer constant expression.
The following values for the system-defined actions of func are also
defined in <signal.h>. Each is a macro that expands to a constant
expression of type pointer to function returning void and has a unique
value that matches no declarable function.
SIG_DFL - default system action
Upon receipt of the signal sig, the receiving process is to be terminated
with all of the consequences outlined in exit(2). In addition a "core
image" will be made in the current working directory of the receiving
process if sig is one for which an asterisk appears in the above list and
the following conditions are met:
The effective user ID and the real user ID of the receiving process
are equal.
An ordinary file named core exists and is writable or can be created.
If the file must be created, it will have the following properties:
a mode of 0666 modified by the file creating mask
[see umask(2)].
A file owner ID that is the same as the effective
user ID of the receiving process.
A file group ID that is the same as the effective
group ID of the receiving process.
SIG_IGN - ignore signal
Any pending signal sig is discarded and the system signal action is set to
ignore future occurrences of this signal type.
SIG_HOLD - hold signal
The signal sig is to be held upon receipt. Any pending signal of this type
remains held. Only one signal of each type is held.
Otherwise, func must be a pointer to a function, the signal-catching
handler, that is to be called when signal sig occurs. In this case, sigset
specifies that the process will call this function upon receipt of signal
sig. Any pending signal of this type is released. This handler address is
retained across calls to the other management functions listed here.
When a signal occurs, the signal number sig will be passed as the only
argument to the signal-catching handler. Before calling the signal-catching
handler, the system signal action will be set to SIG_HOLD. During normal
return from the signal-catching handler, the system signal action is
restored to func and any held signal of this type released. If a non-local
goto (longjump) is taken, the sigrelese must be called to restore the
system signal action and release any held signal of this type.
In general, upon return from the signal-catching handler, the receiving
process will resume execution at the point when it was interrupted.
However, when a signal is caught during a read(2), a write(2), an open(2),
or an ioctl(2) system call during a sigpause system call, or during a
wait(2) system call that does not return immediately due to the existence
of a previously stopped or zombie process, the signal-catching handler will
be executed and then the interrupted system call may return a -1 to the
calling process with errno set to EINTR.
Sighold and sigrelse are used to establish critical regions of
code. Sighold is analogous to raising the priority level and deferring or
holding a signal until the priority is lowered by sigrelse. Sigrelse
restores the system call action to that specified previously by sigset.
Sigignore sets the action for signal sig to SIG_IGN (see above).
Sigpause suspends the calling process until it receives a signal, the same
as pause(2). However, if the signal sig had been received and held, it is
released and the system signal action taken. This system call is useful for
testing variables that are changed on the occurrence of a signal. The
correct usage is to use sighold to block the signal first, then test the
variables. If they have not changed, then call sigpause to wait for the
signal. Sigset will fail if one or more of the following are true:
[EINVAL] Sig is an illegal signal number (including SIGKILL) or the default
handling of sig cannot be changed.
[EINTR] A signal was caught during the system call sigpause.
DIAGNOSTICS
Upon successful completion, sigset returns the previous value of the system
signal action for the specified signal sig. Otherwise, a file of SIG_ERR is
returned and errno is set to indicate the error. SIGE_ERR is defined in
<signal.h>.
For the other functions, upon successful completion, a value of 0 is
returned. Otherwise, a value of -1 is returned and errno is set to indicate
the error.
SEE ALSO
kill(2), pause(2), signal(2), wait(2), setjmp(3C)
WARNING
Two signals that behave differently than the signals described above exist
in this release of the system:
SIGCLD death of a child (reset when caught)
SIGPWR power fail (not reset when caught)
For these signals, func is assigned one of the three values: SIG_DFL,
SIG_IGN, or a function address. The actions prescribed by these values are
as follows:
SIG_DFL - ignore signal
The signal is to be ignored
SIG_IGN - ignore signal
The signal is to be ignore. Also, if SIGCLD, the calling process's child
processes will not create zombie processes when the terminate [see exit(2)].
function address - catch signal
If the signal is SIGPWR, the action to be taken is the same as that
described above for func equal to function address. The same is true if the
signal SIGCLD with one exception; while the process is executing the
signal-catching function, any received SIGCLD signals will be ignore. (This
is the default action.)
The SIGCLD affects tow other system calls [wait(2), and exit(2)] in the
following ways:
wait If the func value of SIGCLD is set to SIG_IGN and a wait is executed,
the wait will block until all of the calling process' child process
terminate; it will then return a value of -1 with errno set to ECHLD.
exit If in the existing process's parent process the func value of SIGCLD
is set to SIG_IGN, the exiting process will not create a zombie process.
When processing a pipeline, the shell makes the last process in the
pipeline the parent of the proceeding processes. A process that may be
piped into in this manner (and thus become the parent of other processes)
should take care not to set SIGCLD to be caught.
NOTES
SIGPOLL is issued when a file descriptor corresponding to a STREAMS [see
intro(2)] file has a "selectable" event pending. A process must
specifically request that this signal be set using the I_SETSIG ioctl(2)
call [see streamio(7)]. Otherwise, the process will never receive SIGPOLL.
For portability, applications should use only the symbolic names of signals
rather than their values and use only the set of signals defined here. The
action for the signal SIGKILL can not be changed from the default system
action.
Specific implementations may have other implementation-defined signals.
Also, additional implementation-defined arguments may be passed to the
signal-catching handler for hardware-generated signals. For certain
hardware-generated signals, it may not be possible to resume execution at
the point of interruption.
The signal type SIGSEGV is reserved for the condition that occurs on an
invalid access to a data object. If an implementation can detect this
condition, this signal type should be used.
The other signal management functions, signal(2) and pause(2), should not
be used in conjunction with these routines for a particular signal type.

191
HOWTO Normal file
View file

@ -0,0 +1,191 @@
$Id: HOWTO,v 1.1 1994/02/10 09:31:22 mike Exp $
$Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Attic/HOWTO,v $
LICENSE (well, sort of . . . .)
This is development level code. It is assumed that you received this code
in good faith and that you will honor the trust placed in you by the
developers. Specifically, please do no reveal the location to the development
code to usenet (newsgroups).
Do not post problems anywhere except the mailing list. Problems about this code
will not be answered if they are received by any other means.
By using this code, you understand and agree that the code has flaws. Programs
which you run under this code should not be __trusted__ to operate properly.
This code has been known to crash the kernel, lock it up, and otherwise
require a general reset of the computer; resulting in the loss of all work
in progress in other screen groups. (We won't assume responsibility if you
trash your disk because the emulator crashes. Backups are a good thing.)
When the code is ready for release, it will be folded into the released
kernel. At that time, everyone who gets Linux's kernel will get this code.
It will not be a separate piece of software.
If you find this to be un-acceptable then you should wait for the general
release.
MAILING LIST
Since you had previously joined the mailing list to find the location of the
development code, this is only documetated for the sake of being complete.
The mail list for this project is located at: linux-activists@joker.cs.hut.fi.
Please send all messages to this location. Either include in the header
or as the first line of the message the following:
X-Mn-Key: IBSC2
[Note, the mail list name is being changed to IBCS2. If the IBSC2 location does
not work, then use the new name of IBCS2.]
GENERAL
This directory contains the iBCS emulator. The iBCS emulator, or Intel
Binary Compatibility Specification, will allow programs written for other
iBCS systems such as SCO and [sic.] Coherent to work under Linux.
This code is under development. (The last three changes were one day
apart. Not even Linus updated code so quickly. :-) If you use the code then
you must accept the fact that it is subject to major revision.
You are welcome to run the code. We do need testers. However, to be a good
tester, you should be like the pilot of a test aircraft. That is you need
to keep good notes as to what you did; your configuration; and what the
results you received. Please try to reduce this as much as possible. (A
memory dump of your SCO Oracle database run is of not much use without the
ability to re-create situation. Try to isolate the problem to as small of
a test case as possible.)
Please see the ToDo list included with the package. It will change over
time as functionality is added and new requirements are determined. We can
use any help that your talents may be employed.
Any change to the iBCS emulator must be sent to Drew Sullivan
<drew@lethe.north.net>. He will coordinate the changes and update the master
copy of the code. You may post the diff patches to the mail list or send it
directly to Drew via Email. Either way, Drew will receive a copy. Please do
not post the article to the list _and_ cc Drew as he will receive two
copies.
INSTALLATION
1. You should tar extract this file into the directory /linux/ibcs. If
you have done this to a separate directory then please move the directory
to /linux/ibcs. This file should then be called /linux/ibcs/HOWTO.
2. Create a symbolic link in /usr/include
ln -s /linux/ibcs /usr/include/ibcs
3. Apply the patches to the kernel.
Tools/apply-patches
4. Change ibcs.h to decide if you want to be SCO or SysVr4 compatible.
This will change when we figure out how to do it dynamically.
#define SCO_COMPAT 1 /* 0 if SysVr4 compatible */
5. Make the kernel. The emulator is used if you select either the COFF
or ELF object file formats. (If you select both, the you will get the
emulator as well.)
Instructions on how to make the kernel are include in the /linux/README
file.
6. Install the kernel. Use either LILO or a separate diskette.
7. Boot that version of the kernel.
8. Run the SCO or iBCS2 programs.
UTILITIES
The emulator has the ability to trace the events which it processes. The
program to enable the tracing funcition is contained in the Tools directory.
To make the trace utility, go to the Tools directory and enter the command:
cc -N -o trace -fomit-frame-pointer trace.c
To use the program, enter the command:
trace 1 to enable the trace function or
trace 0 to disable the trace function.
The result code from the program is the previous setting of the trace event.
This is probably of no use to anyone who is not writing a script, but that
is the meaning of the result code if you are curious.
LIBRARIES
The shared libraries are on the list of ToDo. The libc file is being
developed by Eric Youndale and me. At the present time, the only way that
you can use applications which use a shared library is to include the
shared library from your iBCS system on Linux.
The shared libraries are stored in the directory
/shlib
The libraries are:
libc_s - standard C runtime library.
libns_s - network services library.
libx11_s - X windows library
Additional libraries may be available on your system. They may be called
SCOlibc_s or some similar name. Those libraries will not be available for
Linux. They are specific to the SCO system. It is probably not much of
concern as the three libraries listed above are the only ones which are
specified in iBCS specification.
LIMITATIONS
Until the network services shared library is implemented, the network
programs probably will not work.
Until the X library is implemented, any X windows application _will_not_work_
on this system. Even if you use the SCO system's version, there is no hope
of getting it to work under Linux.
REFERENCES
The Intel Binary Compatibility Specification, version 2 is described in
the "McGraw Hill book".
Intel Binary Compatibility Specification
McGraw-Hill, Inc.
1221 Avenue of the Americas
New York, NY 10020
ISBN 0-07-031219-2
(When I purchased the book around August '93, it cost $40US.)
AUTHOR
Please direct all flames, love letters, comments, corrections, etc. to this
"document" to Al Longyear (longyear@sii.com). [I am the "I" and "me".]
--
Al Longyear longyear@netcom.com longyear@sii.com

73
Makefile Normal file
View file

@ -0,0 +1,73 @@
#
# Makefile for the iBCS emulator files
#
# $Id: Makefile,v 1.1 1994/02/10 09:31:21 mike Exp $
# $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Makefile,v $
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
ifeq (${CFLAGS},)
CFLAGS = -D__KERNEL__=1 -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486
endif
include /linux/.config
.S.s:
$(CPP) -traditional $< -o $*.s
.c.s:
$(CC) $(CFLAGS) -S $<
.s.o:
$(AS) -c -o $*.o $<
.c.o:
$(CC) $(CFLAGS) -c $<
OBJS = emulate.o
OTHER_OBJ = coff.o fcntl.o ioctl.o ipc.o mmap.o open.o \
signal.o stat.o sysconf.o sysfs.o sysi86.o \
ulimit.o wysev386.o wysev386i.o xnx.o xstat.o
OBJS_CODE =
#
# If the IBCS flag is set then include the other modules
ifdef CONFIG_IBCS
OBJS_CODE = $(OTHER_OBJ)
endif
#
# IBCS will be used if ELF object format is allowed
ifdef CONFIG_BINFMT_ELF
OBJS_CODE = $(OTHER_OBJ)
endif
#
# IBCS will be used if COFF object format is allowed
ifdef CONFIG_BINFMT_COFF
OBJS_CODE = $(OTHER_OBJ)
endif
OBJS := $(OBJS) $(OBJS_CODE)
SUBDIRS =
ibcs.o: $(OBJS)
$(LD) -r -o ibcs.o $(OBJS)
sync
clean:
rm -f core *.o *.a *.s
for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean); done
dep:
$(CPP) -M *.c > .depend
for i in $(SUBDIRS); do (cd $$i && $(MAKE) dep) || exit; done
dummy:
#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif

18
Patches/exec.patch Normal file
View file

@ -0,0 +1,18 @@
--- /linux/fs/exec.c Thu Jan 20 07:36:50 1994
+++ fs/exec.c Tue Feb 8 18:46:25 1994
@@ -526,13 +526,13 @@
if (last_task_used_math == current)
last_task_used_math = NULL;
current->used_math = 0;
- current->elf_executable = 0;
+ current->personality = 0;
}
/*
* sys_execve() executes a new program.
*/
-static int do_execve(char * filename, char ** argv, char ** envp, struct pt_regs * regs)
+int do_execve(char * filename, char ** argv, char ** envp, struct pt_regs * regs)
{
struct linux_binprm bprm;
struct linux_binfmt * fmt;

11
Patches/sched.patch Normal file
View file

@ -0,0 +1,11 @@
--- include/linux/sched.h.old Fri Feb 4 16:54:52 1994
+++ include/linux/sched.h Fri Feb 4 09:09:00 1994
@@ -180,7 +180,7 @@
unsigned long saved_kernel_stack;
unsigned long kernel_stack_page;
int exit_code, exit_signal;
- int elf_executable:1;
+ unsigned long personality;
int dumpable:1;
int swappable:1;
unsigned long start_code,end_code,end_data,start_brk,brk,start_stack,start_mmap;

31
Patches/select.patch Normal file
View file

@ -0,0 +1,31 @@
--- fs/select.c.old Fri Feb 4 10:26:39 1994
+++ fs/select.c Fri Feb 4 11:01:15 1994
@@ -3,6 +3,11 @@
*
* Created for Linux based loosely upon Mathius Lattner's minix
* patches by Peter MacDonald. Heavily edited by Linus.
+ *
+ * 4 February 1994
+ * COFF/ELF binary emulation. If the process has the STICKY_TIMEOUTS
+ * flag set in its personality we do *not* modify the given timeout
+ * parameter to reflect time remaining.
*/
#include <linux/types.h>
@@ -14,6 +19,7 @@
#include <linux/stat.h>
#include <linux/signal.h>
#include <linux/errno.h>
+#include <linux/personality.h>
#include <asm/segment.h>
#include <asm/system.h>
@@ -236,7 +242,7 @@
else
timeout = 0;
current->timeout = 0;
- if (tvp) {
+ if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
put_fs_long(timeout/HZ, (unsigned long *) &tvp->tv_sec);
timeout %= HZ;
timeout *= (1000000/HZ);

61
Patches/shm.patch Normal file
View file

@ -0,0 +1,61 @@
From web!hebron.connected.com!baron Tue Jan 25 00:58:47 1994
Return-Path: <web!hebron.connected.com!baron>
Received: from web by lethe.gts.org with uucp (Smail3.1.28.1) id m0pOgnU-0006ZrC; Tue, 25 Jan 94 00:58 EST
Received: from hebron.connected.com by web.apc.org with smtp
(Smail3.1.28.1 #6) id m0pOcvZ-0000YyC; Mon, 24 Jan 94 20:50 EST
Received: by hebron.connected.com id <13925>; Mon, 24 Jan 1994 17:45:02 -0800
Date: Mon, 24 Jan 1994 17:41:44 -0800
From: "Joseph L. Portman III" <baron@hebron.connected.com>
Subject: Oops, shared memory patch needed.
To: "Brandon S. Allbery" <bsa@kf8nh.wariat.org>
cc: Al Longyear <longyear@server1.sii.com>,
Drew Sullivan <drew@lethe.gts.org>
In-Reply-To: <m0pObgF-0005LSC@kf8nh.wariat.org>
Message-ID: <Pine.3.87.9401241744.A11445-0100000@hebron.connected.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Status: RO
On Mon, 24 Jan 1994, Brandon S. Allbery wrote:
>
> The README mentions a shm patch. But it doesn't appear to be included...
> BTW, thanks for providing a valid reply address this time :-)
Oops. Here it is, I will also forward it to Drew and Al.
Just a simple three liner that lets my ipc code do shared memory stuff.
cd /linux and patch < shm.patch
-------cut here ------------
*** ipc/shm.c1 Sat Jan 15 13:00:10 1994
--- ipc/shm.c Sat Jan 15 13:00:49 1994
***************
*** 462,469 ****
shp->attaches = shmd;
shp->shm_lpid = current->pid;
shp->shm_atime = CURRENT_TIME;
! put_fs_long (addr, raddr);
! return 0;
}
/*
--- 462,472 ----
shp->attaches = shmd;
shp->shm_lpid = current->pid;
shp->shm_atime = CURRENT_TIME;
! if (raddr) {
! put_fs_long (addr, raddr);
! return 0;
! } else
! return addr;
}
/*
---- and here ---
-----------------------------
Joe Portman (Westin Hotels & Resorts)
NOTE: These opinions are my own and not those of my employer

57
README Normal file
View file

@ -0,0 +1,57 @@
To: linux-activists@Niksula.hut.fi
X-Mn-Key: IBSC2
Repository: tsx-11.mit.edu:/pub/linux/ALPHA/ibcs2/private/.devel
File: coff-940201.tar.gz
$Id: README,v 1.1 1994/02/10 09:31:22 mike Exp $
$Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/README,v $
-- Drew Sullivan <drew@lethe.north.net>
===========================================================================
# Tue Feb 8, 1994 -- Drew Sullivan <Drew@lethe.north.net> (R1.7)
More Wyse code including ioctls
===========================================================================
# Tue Feb 8, 1994 -- Drew Sullivan <Drew@lethe.north.net> (R1.6)
Hugh change for support of the Wyse version of unix and
mulitple elf/coff personalities.
**** IF this version works, I want to send the kernel patches to Linus ***
Code to do single function tracing has been added to emulate.c
But no support for it in trace.c is there yet.
Mmap support
Bug fixes as usual.
===========================================================================
# Tue Feb 5, 1994 -- Drew Sullivan <Drew@lethe.north.net> (R1.5)
New document HOWTO -- you should read this
Replacement for fs/binfmt_coff.c
Patches for fs/binfmt_elf.c
(Both can be applied via a new script Tools/apply-patches to
a new kernel)
Added sysi86, sysfs, xstat, the start of splitting SCO vs
SysVr4 code (See ibcs.h)
Bug fixes for signal handling
When built against .99pl15, the perl test set fail with seg faults.
Some tests work ok, but others are seg faulting.
===========================================================================
# Tue Feb 1, 1994 -- Drew Sullivan <Drew@lethe.north.net> (R1.4)
Fixed merging where I lost iABI_errors (needed by new signal.c)
Fixed merging where I lost ibcs_kill (Now uses new signal mapping)
Added Al's 2nd little patch to the loader
Minor fixes to the attribution list in ToDo
*** Ted (tytso@tsx-11.mit.edu) Has given me access to the development
directory so that files I upload will be available immediately
===========================================================================
# Mon Jan 31, 1994 -- Drew Sullivan <Drew@lethe.north.net> (R1.3)
Merged Eric Yongdales sysVr4 systems calls.
Merged Al Longyear's signal handling.
===========================================================================
# Sun Jan 30, 1994 -- Drew Sullivan <Drew@lethe.north.net> (R1.2)
Merged Joe Portman's code with mine.
Placed everything under revision control.

BIN
TESTS/sysfs Normal file

Binary file not shown.

44
TESTS/sysfs.c Normal file
View file

@ -0,0 +1,44 @@
/*
* linux/ibcs/TESTS/sysfs.c
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: sysfs.c,v 1.1 1994/02/10 09:31:23 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/TESTS/sysfs.c,v $
*/
#include <sys/types.h>
#include <sys/fstyp.h>
#include <sys/fsid.h>
#include <stdio.h>
main(argc, argv)
int argc;
char *argv[];
{
int n_fs, i;
char buf[1024];
if (argc == 1) {
if ((n_fs = sysfs(GETNFSTYP)) < 0) {
perror("sysfs: GETNFSTYP");
exit(1);
}
printf("%d file system types\n", n_fs);
for (i=1; i<=n_fs; i++) {
if (sysfs(GETFSTYP, i, buf) < 0) {
perror("\nsysfs: GETFSTYP");
} else {
printf("%d %s\n", i, buf);
}
}
} else {
for (n_fs=1; n_fs<argc; n_fs++) {
if ((i = sysfs(GETFSIND, argv[n_fs])) < 0)
perror("sysfs: GETFSIND");
else
printf("%s is index %d\n", argv[n_fs], i);
}
}
}

BIN
TESTS/sysi86 Normal file

Binary file not shown.

35
TESTS/sysi86.c Normal file
View file

@ -0,0 +1,35 @@
/*
* linux/ibcs/TESTS/sysi86.c
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: sysi86.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/TESTS/sysi86.c,v $
*/
#include <sys/sysi86.h>
#include <stdio.h>
main(argc, argv)
int argc;
char *argv[];
{
int n;
switch (atol(argv[1])) {
case 0:
sysi86(SI86FPHW, &n);
printf("SI86FPHW gives %d\n", n);
break;
case 1:
printf("SETNAME gives %d\n", sysi86(SETNAME, argv[2]));
break;
case 2:
printf("STIME gives %d\n", sysi86(STIME, atol(argv[2])));
break;
case 3:
printf("SI86MEM gives %d\n", sysi86(SI86MEM));
break;
}
}

126
ToDo Normal file
View file

@ -0,0 +1,126 @@
------------- ToDo ------------------
$Id: ToDo,v 1.1 1994/02/10 09:31:22 mike Exp $
$Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Attic/ToDo,v $
Repository: tsx-11.mit.edu:/pub/linux/ALPHA/ibcs2/private/.devel
This file contains a partial list of tasks that need doing
with iBCS2 emulation. It is not yet complete. Please
send bug fixes, suggestions, new code to me.
(Known bugs are flagged as ===BUG=== in comments.)
Drew Sullivan -- <drew@lethe.north.net>
------------- Who's Who ------------------
Drew Sullivan <drew@lethe.north.net>
Emulator source maintainer.
Joseph L. Portman III <baron@hebron.connected.com>
Major emulator developer.
libc_s
Alfred Longyear <longyear@netcom.com>
iBCS2 loader
Emulator as of pl12
? Xenix loader
libc_s
Brandon S. Allbery <bsa@kf8nh.wariat.org>
Eric Youngdale <eric@tantalus.nrl.navy.mil>
First cut of the emulator.
ELF loader.
Keeper of the tsx-11 archive
libc_s (elf version)
Philip Balister <balister@vt.edu>
Emulator as of pl13
gdb for coff
Tor Arnsen
Emulator as of pl13
Graham Adams <gadams@ddrive.demon.co.uk>
------------- ToDo ------------------
* Priority
+ Must do to be complete
- Wish item
------------- Kernel ------------------
* do_execv needs to extern rather than static
+ ipc patches
------------- Loader ------------------
* Get current patches into standard distribution.
(There is a patch still left as of 14x)
- Look into adding 386 xenix binaries to the
the loader [Al].
- Look into adding 286 xenix binaries to the
the loader.
------------- Emulator ------------------
* iBCS2 syscalls
+ mount
+ stty
+ gtty
+ lock/plock
+ msgsys
+ sysi86/sys3b
+ advfs
+ unadvfs
+ rmount
+ rumount
+ rfstart
+ rdebug
+ rfstop
+ rfsys
+ sysfs
+ getmsg
+ putmsg
* poll
* Error code handling (mapping errno)
+ Ioctl
A list of ones that are missing is needed.
+ Xenix
* xnx_locking(int fd, int mode, long size)
+ xnx_creatsem(char *sem_name, int mode)
+ xnx_opensem(char *sem_name)
+ xnx_sigsem(int sem_num)
+ xnx_waitsem(int sem_num)
+ xnx_nbwaitsem(int sem_num)
* xnx_rdchk(int fd)
* xnx_chsize(int fd, long size)
+ xnx_ftime(struct timeb * tp)
* xnx_nap(long period)
+ xnx_sdget(char *path, int flags, long size, int mode)
+ xnx_sdfree(char* addr)
+ xnx_sdenter(char *addr, int flags)
+ xnx_sdleave(char *addr)
+ xnx_sdgetv(char *addr)
+ xnx_sdwaitv(char *addr, int vnum)
+ xnx_proctl(int pid, int command, char *arg)
+ xnx_execseg(excode_t oldaddr, unsigned size)
+ xnx_unexecseg(excode_t addr)
+ xnx_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *execptfds, struct timeval *timeout)
* xnx_eaccess(char *path, int mode)
* xnx_paccess(int pid, int cmd, int offset, int count, char *ptr)
* xnx_sigaction(int sig, struct sco_sigaction *act, struct sco_sigaction *oact)
* xnx_sigprocmask(int how, sigset_t *set, sigset_t *oset)
* xnx_sigpending(sigset_t *set)
* xnx_sigsuspend(sigset_t *sigmask)
* xnx_getgroups(int gidsetsize, gid_t *grouplist[])
* xnx_setgroups(int gidsetsize, gid_t *grouplist[])
* xnx_sysconf(int name)
* xnx_pathconf(char *path, int name)
* xnx_fpathconf(int fildes, int name)
? Do we need to support the "luid" or login user id C2 security stuff.
------------- Shared Library ------------------
* Finish the libc_s libary
* Map out the work to be done [Al,Joe,Eric]
+ Create a networking library
+ Create X11R4 and X11R5 library
------------- Testing ------------------
* Create a complete set of test programs
so that we can do regression tests.
The perl code is a good start.

8
Tools/Makefile Normal file
View file

@ -0,0 +1,8 @@
#
# ibcs/Tools/Makefile
#
# $Id: Makefile,v 1.1 1994/02/10 09:31:23 mike Exp $
# $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Tools/Makefile,v $
#
trace: trace.c
cc -N -O -fomit-frame-pointer -o trace trace.c

47
Tools/cxenix Normal file
View file

@ -0,0 +1,47 @@
#!/usr/bin/perl
%t = (
"XLOCKING", 0x0128,
"CREATSEM", 0x0228,
"OPENSEM", 0x0328,
"SIGSEM", 0x0428,
"WAITSEM", 0x0528,
"NBWAITSEM", 0x0628,
"RDCHK", 0x0728,
"CHSIZE", 0x0a28,
"FTIME", 0x0b28,
"NAP", 0x0c28,
"SDGET", 0x0d28,
"SDFREE", 0x0e28,
"SDENTER", 0x0f28,
"SDLEAVE", 0x1028,
"SDGETV", 0x1128,
"SDWAITV", 0x1228,
"PROCTL", 0x2028,
"EXECSEG", 0x2128,
"UNEXECSEG", 0x2228,
"SELECT", 0x2428,
"EACCESS", 0x2528,
"PACCESS", 0x2628,
"SIGACTION", 0x2728,
"SIGPROCMASK", 0x2828,
"SIGPENDING", 0x2928,
"SIGSUSPEND", 0x2a28,
"GETGROUPS", 0x2b28,
"SETGROUPS", 0x2c28,
"SYSCONF", 0x2d28,
"PATHCONF", 0x2e28,
"FPATHCONF", 0x2f28,
"RENAME", 0x3028,
);
%r = reverse %t;
foreach $n (sort bynum keys %r) {
$k = $r{$n};
printf "%-15s %3d\n", "\L$k", int($n/256);
}
sub bynum {
$a <=> $b
}

BIN
Tools/trace Normal file

Binary file not shown.

33
Tools/trace.c Normal file
View file

@ -0,0 +1,33 @@
/*
* little utility to turn tracing on and off for certain calls
* Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
*
* $Id: trace.c,v 1.1 1994/02/10 09:31:23 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Tools/trace.c,v $
*/
#include <stdio.h>
#include <stdlib.h>
int set_trace(int enable)
{
int res;
__asm__ volatile ("mov\t$0x00FF,%%eax\n\t" \
".byte\t0x9a,0,0,0,0,7,0\n\t" \
"sbb\t%%eax,%%eax\n\t" \
"andl\t$1,%%eax\n\t" \
: "=a" (res));
return res;
}
int main(int argc,char ** argv)
{
int callno,val;
if (argc != 2)
exit (1);
callno = atoi(argv[1]);
val = atoi(argv[1]);
exit (set_trace(val));
}

138
errno.h Normal file
View file

@ -0,0 +1,138 @@
#ifndef __ABI_ERRNO_H
#define __ABI_ERRNO_H
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No child processes */
#define EAGAIN 11 /* Try again */
#define ENOMEM 12 /* Out of memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Device or resource busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math argument out of domain of func */
#define ERANGE 34 /* Math result not representable */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
#define EUNATCH 42 /* Protocol driver not attached */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#define EDEADLK 45 /* Resource deadlock would occur */
#define ENOLCK 46 /* No record locks available */
#define ENOSTR 60 /* Device not a stream */
#define ENODATA 61 /* No data available */
#define ETIME 62 /* Timer expired */
#define ENOSR 63 /* Out of streams resources */
#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* Object is remote */
#define ENOLINK 67 /* Link has been severed */
#define EADV 68 /* Advertise error */
#define ESRMNT 69 /* Srmount error */
#define ECOMM 70 /* Communication error on send */
#define EPROTO 71 /* Protocol error */
#define EMULTIHOP 74 /* Multihop attempted */
#define EDOTDOT 76 /* RFS specific error */
#define EBADMSG 77 /* Not a data message */
#define ENAMETOOLONG 78 /* File name too long */
#define EOVERFLOW 79 /* Value too large for defined data type */
#define ENOTUNIQ 80 /* Name not unique on network */
#define EBADFD 81 /* File descriptor in bad state */
#define EREMCHG 82 /* Remote address changed */
#define ENOSYS 89 /* Function not implemented */
#define ELOOP 90 /* Too many symbolic links encountered */
#define EWOULDBLOCK 90 /* Operation would block */
#define ERESTART 91 /* Interrupted system call should be restarted */
#define ESTRPIPE 92 /* Streams pipe error */
#define ENOTEMPTY 93 /* Directory not empty */
#define EUSERS 94 /* Too many users */
#define ESTALE 151 /* Stale NFS file handle */
/* The following errors are not included in the ABI */
#if 0
#define ELIBACC 83 /* Can not access a needed shared library */
#define ELIBBAD 84 /* Accessing a corrupted shared library */
#define ELIBSCN 85 /* .lib section in a.out corrupted */
#define ELIBMAX 86 /* Attempting to link in too many shared libraries */
#define ELIBEXEC 87 /* Cannot exec a shared library directly */
#define EILSEQ 88 /* Illegal byte sequence */
#define ENOTSOCK 95 /* Socket operation on non-socket */
#define EDESTADDRREQ 96 /* Destination address required */
#define EMSGSIZE 97 /* Message too long */
#define EPROTOTYPE 98 /* Protocol wrong type for socket */
#define ENOPROTOOPT 99 /* Protocol not available */
#define EPROTONOSUPPORT 120 /* Protocol not supported */
#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT 123 /* Protocol family not supported */
#define EAFNOSUPPORT 124 /* Address family not supported by protocol */
#define EADDRINUSE 125 /* Address already in use */
#define EADDRNOTAVAIL 126 /* Cannot assign requested address */
#define ENETDOWN 127 /* Network is down */
#define ENETUNREACH 128 /* Network is unreachable */
#define ENETRESET 129 /* Network dropped connection because of reset */
#define ECONNABORTED 130 /* Software caused connection abort */
#define ECONNRESET 131 /* Connection reset by peer */
#define ENOBUFS 132 /* No buffer space available */
#define EISCONN 133 /* Transport endpoint is already connected */
#define ENOTCONN 134 /* Transport endpoint is not connected */
#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 144 /* Too many references: cannot splice */
#define ETIMEDOUT 145 /* Connection timed out */
#define ECONNREFUSED 146 /* Connection refused */
#define EHOSTDOWN 147 /* Host is down */
#define EHOSTUNREACH 148 /* No route to host */
#define EALREADY 149 /* Operation already in progress */
#define EINPROGRESS 150 /* Operation now in progress */
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define EBADE 52 /* Invalid exchange */
#define EBADR 53 /* Invalid request descriptor */
#define EXFULL 54 /* Exchange full */
#define ENOANO 55 /* No anode */
#define EBADRQC 56 /* Invalid request code */
#define EBADSLT 57 /* Invalid slot */
#define EDEADLOCK 58 /* File locking deadlock error */
#define EBFONT 59 /* Bad font file format */
#define EUCLEAN 117 /* Structure needs cleaning */
#define ENOTNAM 118 /* Not a XENIX named type file */
#define ENAVAIL 119 /* No XENIX semaphores available */
#define EISNAM 120 /* Is a named type file */
#define EREMOTEIO 121 /* Remote I/O error */
/* Should never be seen by user programs */
#define ERESTARTSYS 512
#define ERESTARTNOINTR 513
#define ERESTARTNOHAND 514 /* restart if no handler.. */
#endif
#endif

96
fcntl.c Normal file
View file

@ -0,0 +1,96 @@
/*
* linux/ibcs/fcntl.c
*
* Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
* First stab at troubleshooting fcntl calls
*
* $Id: fcntl.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Attic/fcntl.c,v $
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <linux/ipc.h>
#include <linux/sem.h>
#include <linux/string.h>
#include <linux/fcntl.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
struct ibcs_flock
{
short l_type; /* numbers don't match */
short l_whence;
off_t l_start;
off_t l_len; /* 0 means to end of file */
short l_sysid;
short l_pid;
};
/*
** time to get a little more sophisticated on
** fcntl
*/
int
ibcs_fcntl (struct pt_regs *regs)
{
int arg1, arg2, arg3;
int retval;
struct ibcs_flock fl;
arg1 = get_fs_long (((unsigned long *) regs->esp) + (1));
arg2 = get_fs_long (((unsigned long *) regs->esp) + (2));
arg3 = get_fs_long (((unsigned long *) regs->esp) + (3));
switch(arg2)
{
case F_GETLK:
case F_SETLK:
case F_SETLKW:
memcpy_fromfs(&fl,(void *)arg3,sizeof(fl));
fl.l_type--;
memcpy_tofs((void *)arg3,&fl,sizeof(fl));
#if IBCS_TRACE
if (ibcs_func_p->trace)
{
printk ("l_type: %d l_whence: %d l_start: %u l_len: %u l_sysid: %d l_pid: %d\n",
fl.l_type,
fl.l_whence,
fl.l_start,
fl.l_len,
fl.l_sysid,
fl.l_pid);
}
#endif
/*
** okay do some magic here
*/
retval = sys_fcntl(arg1,arg2,arg3);
memcpy_fromfs(&fl,arg3,sizeof(fl));
fl.l_type++;
memcpy_tofs(arg3,&fl,sizeof(fl));
return retval;
break;
default:
retval = sys_fcntl(arg1,arg2,arg3);
return retval;
break;
}
}

73
iBCSemul/Makefile Normal file
View file

@ -0,0 +1,73 @@
#
# Makefile for the iBCS emulator files
#
# $Id: Makefile,v 1.1 1994/02/10 09:31:21 mike Exp $
# $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/Makefile,v $
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
ifeq (${CFLAGS},)
CFLAGS = -D__KERNEL__=1 -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486
endif
include /linux/.config
.S.s:
$(CPP) -traditional $< -o $*.s
.c.s:
$(CC) $(CFLAGS) -S $<
.s.o:
$(AS) -c -o $*.o $<
.c.o:
$(CC) $(CFLAGS) -c $<
OBJS = emulate.o
OTHER_OBJ = coff.o fcntl.o ioctl.o ipc.o mmap.o open.o \
signal.o stat.o sysconf.o sysfs.o sysi86.o \
ulimit.o wysev386.o wysev386i.o xnx.o xstat.o
OBJS_CODE =
#
# If the IBCS flag is set then include the other modules
ifdef CONFIG_IBCS
OBJS_CODE = $(OTHER_OBJ)
endif
#
# IBCS will be used if ELF object format is allowed
ifdef CONFIG_BINFMT_ELF
OBJS_CODE = $(OTHER_OBJ)
endif
#
# IBCS will be used if COFF object format is allowed
ifdef CONFIG_BINFMT_COFF
OBJS_CODE = $(OTHER_OBJ)
endif
OBJS := $(OBJS) $(OBJS_CODE)
SUBDIRS =
ibcs.o: $(OBJS)
$(LD) -r -o ibcs.o $(OBJS)
sync
clean:
rm -f core *.o *.a *.s
for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean); done
dep:
$(CPP) -M *.c > .depend
for i in $(SUBDIRS); do (cd $$i && $(MAKE) dep) || exit; done
dummy:
#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif

195
iBCSemul/coff.c Normal file
View file

@ -0,0 +1,195 @@
/*
* linux/abi/emulate.c
*
* Copyright (C) 1993 Linus Torvalds
*
* Modified by Eric Youngdale to include all ibcs syscalls.
* Re-written by Drew Sullivan to handle lots more of the syscalls correctly.
*
* $Id: coff.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/coff.c,v $
*/
#define __KERNEL__ 1
/*
* Emulate.c contains the entry point for the 'lcall 7,xxx' handler.
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
/* Here we handle syscalls that need a little more special treatment */
int ibcs_fork(struct pt_regs * regs) {
int rvalue;
rvalue = sys_fork(regs->ebx, regs->ecx, 1,
regs->esi, regs->edi, regs->ebp, regs->eax, regs->ds,
regs->es, regs->fs, regs->gs, regs->orig_eax,
regs->eip, regs->cs, regs->eflags, regs->esp, regs->ss);
regs->edx = 0;
return rvalue;
}
int ibcs_pipe(struct pt_regs * regs) {
long filedes[2];
int old_fs = get_fs();
int rvalue;
set_fs(get_ds());
rvalue = sys_pipe(&filedes);
set_fs(old_fs);
if (rvalue == 0) {
rvalue = filedes[0];
regs->edx = filedes[1];
}
return rvalue;
}
/* note the double value return in eax and edx */
int ibcs_getpid(struct pt_regs * regs) {
regs->edx = current->p_pptr->pid;
return current->pid;
}
/* note the double value return in eax and edx */
int ibcs_getuid(struct pt_regs * regs) {
regs->edx = current->euid;
return current->uid;
}
/* note the double value return in eax and edx */
int ibcs_getgid(struct pt_regs * regs) {
regs->edx = current->egid;
return current->gid;
}
#define FLAG_ZF 0x0040
#define FLAG_PF 0x0004
#define FLAG_SF 0x0080
#define FLAG_OF 0x0800
#define MAGIC_WAITPID_FLAG (FLAG_ZF | FLAG_PF | FLAG_SF | FLAG_OF)
int ibcs_wait(struct pt_regs * regs) {
long result;
int pid, loc, opt;
/* if ZF,PF,SF,and OF are set then it is waitpid */
if ((regs->eflags & MAGIC_WAITPID_FLAG) == MAGIC_WAITPID_FLAG) {
pid = get_fs_long(((unsigned long *) regs->esp) + 1);
loc = get_fs_long(((unsigned long *) regs->esp) + 2);
opt = get_fs_long(((unsigned long *) regs->esp) + 3);
result = waitpid(pid, loc, opt);
} else {
loc = get_fs_long(((unsigned long *) regs->esp) + 1);
result = waitpid(-1, loc, 0L);
}
return result;
}
/*
* ibcs_execv() executes a new program.
*
* int execv (char *program, va_list argp);
*
* Environment strings are taken from the current context. argp is
* terminated by a NULL pointer.
*/
int ibcs_execv(struct pt_regs *regs)
{
/* does this entry point do the searching in the PATH line? */
/* No. See above. Al. */
return ibcs_exec(regs);
}
/*
* ibcs_exec() executes a new program.
*/
int ibcs_exec(struct pt_regs *regs)
{
int error;
char *pgm, **argv, **envp;
char *filename;
pgm = (char *)get_fs_long(((unsigned long *) regs->esp) + 1);
argv = (char **)get_fs_long(((unsigned long *) regs->esp) + 2);
envp = (char **)get_fs_long(((unsigned long *) regs->esp) + 3);
error = getname(pgm, &filename);
if (error == 0) {
/* if you get an error on this undefined, then remove the */
/* 'static' declaration in /linux/fs/exec.c */
error = do_execve(filename, argv, envp, regs);
#if IBCS_TRACE
if (ibcs_trace & TRACE_API)
printk(KERN_DEBUG "ibcs_exec(\"%s\") == %d\n",
filename, error);
#endif
putname (filename);
}
return error;
}
asmlinkage int ibcs_utsname(int pname)
{
int error;
struct sco_utsname {
char sysname[9];
char nodename[9];
char release[16];
char kernelid[20];
char machine[9];
char bustype[9];
char sysserial[10];
unsigned short sysorigin;
unsigned short sysoem;
char numuser[9];
unsigned short numcpu;
} *name;
if (!pname)
return -EFAULT;
error = verify_area(VERIFY_WRITE, (char *)pname,sizeof *name);
if (error)
return error;
name = (struct sco_utsname*) pname;
/* ===BUG=== we need to finish this section ...
memcpy_tofs(&name->sysname, &system_utsname.sysname, sizeof (system_utsname.sysname));
memcpy_tofs(&name->nodename,&system_utsname.nodename, sizeof (system_utsname.nodename));
memcpy_tofs(&name->release, &system_utsname.release, sizeof (system_utsname.release));
memcpy_tofs(&name->version, &system_utsname.version, sizeof (system_utsname.version));
memcpy_tofs(&name->machine, &system_utsname.machine, sizeof (system_utsname.machine));
... ===BUG=== we need to finish this section */
return 0;
}
int ibcs_pause(void)
{
current->state = TASK_INTERRUPTIBLE;
schedule();
return -EINTR;
}

369
iBCSemul/emulate.c Normal file
View file

@ -0,0 +1,369 @@
/*
* linux/abi/emulate.c
*
* Copyright (C) 1993 Linus Torvalds
* Modified by Eric Youngdale to include all ibcs syscalls.
* Re-written by Drew Sullivan to handle lots more of the syscalls correctly.
*
* Jan 30 1994, Merged Joe Portman's code -- Drew
* Jan 31 1994, Merged Eric Yongdale's code for elf support -- Drew
*
* Feb 4 1994
* Rebuilt with handling for multiple binary personalities
* -- Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: emulate.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/emulate.c,v $
*/
/*
* Emulate.c contains the entry point for the 'lcall 7,xxx' handler.
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <linux/personality.h>
#include <ibcs/ibcs.h>
#include <ibcs/abi4.h>
#include <ibcs/trace.h>
#include <ibcs/xnx.h>
/*
* ELF and COFF use the IBCS format. If configured for either one then
* enable the ibcs support.
*/
#ifdef CONFIG_BINFMT_ELF
#define CONFIG_IBCS
#endif
#ifdef CONFIG_BINFMT_COFF
#define CONFIG_IBCS
#endif
#ifndef CONFIG_IBCS
/*
* This is a special stub that we use *only* if IBCS
* is not configured into the kernel
*/
asmlinkage void iABI_emulate(struct pt_regs * regs)
{
/* ----+----1----+----2----+----3----+ */
sys_write(2, "(coff, gasp, not here you don't :-)", 35);
printk(KERN_ERR "iBCS2 binaries not configured\n");
do_exit(SIGSEGV);
}
#else /* CONFIG_IBCS */
static void plist(int id, char *name, char *args, int *list);
static void fail(int id, long eax, char *name);
int ibcs_trace = TRACE_API | TRACE_IOCTL | TRACE_IOCTL_F;
int ibcs_id = 0;
IBCS_func *ibcs_func_p;
/* This lookup table is used to determine how many arguments to pull from
the user mode stack, and how many to pass to the kernel routine. */
/* This table is used to convert the errno numbers returned by linux
into the iBCS numbers */
unsigned char errno_cvt[255] = {
0,
EPERM, ENOENT, ESRCH, EINTR, EIO, ENXIO, E2BIG, ENOEXEC, EBADF, ECHILD,
EAGAIN, ENOMEM, EACCES, EFAULT, ENOTBLK, EBUSY, EEXIST, EXDEV, ENODEV,
ENOTDIR, EISDIR, EINVAL, ENFILE, EMFILE, ENOTTY, ETXTBSY, EFBIG, ENOSPC,
ESPIPE, EROFS, EMLINK, EPIPE, EDOM, ERANGE, EDEADLK, ENAMETOOLONG, ENOLCK,
ENOSYS, ENOTEMPTY, ELOOP, EWOULDBLOCK, ENOMSG, EIDRM, ECHRNG, EL2NSYNC,
EL3HLT, EL3RST, ELNRNG, EUNATCH, ENOCSI, EL2HLT, EBADE, EBADR, EXFULL,
ENOANO, EBADRQC, EBADSLT, EDEADLOCK, EBFONT, ENOSTR, ENODATA, ETIME, ENOSR,
ENONET, ENOPKG, EREMOTE, ENOLINK, EADV, ESRMNT, ECOMM, EPROTO, EMULTIHOP,
EDOTDOT, EBADMSG, EOVERFLOW, ENOTUNIQ, EBADFD, EREMCHG, ELIBACC, ELIBBAD,
ELIBSCN, ELIBMAX, ELIBEXEC, EILSEQ, ERESTART, ESTRPIPE, EUSERS, ENOTSOCK,
EDESTADDRREQ, EMSGSIZE, EPROTOTYPE, ENOPROTOOPT, EPROTONOSUPPORT,
ESOCKTNOSUPPORT, EOPNOTSUPP, EPFNOSUPPORT, EAFNOSUPPORT, EADDRINUSE,
EADDRNOTAVAIL, ENETDOWN, ENETUNREACH, ENETRESET, ECONNABORTED, ECONNRESET,
ENOBUFS, EISCONN, ENOTCONN, ESHUTDOWN, ETOOMANYREFS, ETIMEDOUT, ECONNREFUSED,
EHOSTDOWN, EHOSTUNREACH, EALREADY, EINPROGRESS, ESTALE, EUCLEAN, ENOTNAM,
ENAVAIL, EISNAM, EREMOTEIO
};
/* This table contains the appropriate kernel routines that can be run
* to perform the syscalls in question. If an entry is 'Ukn' we don't
* know how to handle it yet. (We also set trace on by default for these)
* Spl means that we need to do special processing for this syscall
* (see ibcs_wait or ibcs_getpid)
* Fast means that even the error return handling is done by the function call.
*/
#define last(x) ((sizeof(x)/sizeof(*x))-1)
#define Spl -1 /* pass the regs structure down */
#define Ukn -2 /* no code to handle this case yet */
#define Fast -3 /* magic on return, return regs structure already set up */
#include "callmap.inc"
void iABI_emulate(struct pt_regs * regs) {
int pers, i, j;
int args[8];
int rvalue;
IBCS_func ***pers_map, **class_map;
IBCS_func *p = NULL;
int id = ++ibcs_id;
/* First decide which personality map we should be looking
* at by looking at the personality of this process.
*/
pers = current->personality & PER_MASK;
if (pers > last(IBCS_personality_map)
|| !(pers_map = IBCS_personality_map[pers])) {
printk(KERN_DEBUG "iBCS: bad personality %x\n", pers);
regs->eflags |= 1; /* Set carry flag */
regs->eax = iABI_errors(EINVAL);
return;
}
/* Now look at the class of the call (lowest byte) and find the
* correct call table set.
*/
i = regs->eax;
class_map = NULL;
switch (i & 0xff) {
case 0x28: /* Xenix class */
class_map = pers_map[1];
i >>= 8;
break;
case 0x83: /* Wyse TCP/IP class if present, otherwise
* it's just a normal call.
*/
if (!(class_map = pers_map[2]))
class_map = pers_map[0];
else
i >>= 8;
break;
case 0x84: /* Wyse NFS class if present, otherwise
* it's just a normal call.
*/
if (!(class_map = pers_map[3]))
class_map = pers_map[0];
else
i >>= 8;
break;
case 0xff: /* Linux debug class */
class_map = pers_map[4];
i >>= 8;
break;
default: /* Base iBCS class */
class_map = pers_map[0];
break;
}
if (!class_map) {
printk(KERN_DEBUG "iBCS: class %lx not supported under personality %x\n",
regs->eax & 0xff, pers);
regs->eflags |= 1; /* Set carry flag */
regs->eax = iABI_errors(EINVAL);
return;
}
/* Next look for group that this call falls in for this class.
* N.B. It isn't easy to see if we are looking off the end of
* the table. We assume binaries are playing fair :-(.
*/
j = i >> 3;
i &= 0x07;
if (!class_map[j]) {
printk(KERN_DEBUG "iBCS: function %lx not supported under personality %x\n",
regs->eax, pers);
regs->eflags |= 1; /* Set carry flag */
regs->eax = iABI_errors(EINVAL);
return;
}
/* And finally we can the function definition */
p = &(class_map[j][i]);
ibcs_func_p = p; /* keep Joe's code happy */
for(i=0; i < p->nargs; i++)
args[i] = get_fs_long(((unsigned long *) regs->esp) + (i+1));
#if IBCS_TRACE
if ((ibcs_trace & TRACE_API) || p->trace) {
if (p->nargs == Spl) {
for(i=0; i < strlen(p->args); i++)
args[i] = get_fs_long(((unsigned long *) regs->esp) + (i+1));
}
plist(id, p->name, p->args, args);
}
#endif
rvalue = 0;
if (p->kfunc) {
switch(p->nargs) {
case Fast:
(*p->kfunc)(regs);
return;
case Spl:
rvalue = (*p->kfunc)(regs);
break;
case 0:
rvalue = (*p->kfunc)();
break;
case 1:
rvalue = (*p->kfunc)(args[0]);
break;
case 2:
rvalue = (*p->kfunc)(args[0], args[1]);
break;
case 3:
rvalue = (*p->kfunc)(args[0], args[1], args[2]);
break;
case 4:
rvalue = (*p->kfunc)(args[0], args[1], args[2], args[3]);
break;
case 5:
rvalue = (*p->kfunc)(args[0], args[1], args[2],
args[3], args[4]);
break;
case 6:
rvalue = (*p->kfunc)(args[0], args[1], args[2],
args[3], args[4], args[5]);
break;
default:
fail(id, regs->eax, p->name);
}
} else {
fail(id, regs->eax, p->name);
}
if (rvalue >= 0) {
regs->eflags &= ~1; /* Clear carry flag */
regs->eax = rvalue;
#if IBCS_TRACE
if (ibcs_trace & TRACE_API) {
printk(KERN_DEBUG "[%d] returns %ld {%ld}\n",
id, regs->eax, regs->edx);
}
#endif
} else {
regs->eflags |= 1; /* Set carry flag */
regs->eax = iABI_errors(-rvalue);
#if IBCS_TRACE
if (ibcs_trace & TRACE_API) {
printk(KERN_DEBUG "[%d] Error return linux=%d -> ibcs=%ld\n",
id, rvalue, regs->eax);
}
#endif
}
}
/* Translate the errno numbers from linux to iBCS2 */
int iABI_errors(int errno) {
if (0 <= errno && errno <= last(errno_cvt)) {
return errno_cvt[errno];
}
return EINVAL;
}
int ibcs_syscall(struct pt_regs *regs) {
regs->eax = get_fs_long(((unsigned long *) regs->esp) + 1);
++regs->esp;
iABI_emulate(regs);
--regs->esp;
return 0;
}
#if IBCS_TRACE
int ibcs_trace_set(int arg)
{
int rvalue = ibcs_trace;
ibcs_trace = arg;
return rvalue;
}
int ibcs_trace_func(int map, int per, int func, int val)
{
int class, rvalue;
IBCS_func ***pmap, **pper;
if (map > last(IBCS_personality_map)) {
return iABI_errors(EINVAL);
}
pmap = IBCS_personality_map[map];
if (pmap[per] == NULL) {
return iABI_errors(EINVAL);
}
pper = pmap[per];
class = func >> 3;
func &= 0x07;
rvalue = pper[class][func].trace;
pper[class][func].trace = val;
return rvalue;
}
/*
* plist is used by the trace code to show the arg list
*/
static void plist(int id, char *name, char *args, int *list) {
int error;
char *tmp, *p, arg_buf[512];
arg_buf[0] = '\0';
p = arg_buf;
while (*args) {
switch(*args++) {
case 'd': sprintf(p, "%d", *list++); break;
case 'o': sprintf(p, "%o", *list++); break;
case 'p': sprintf(p, "%p", (void *)(*list++)); break;
case '?':
case 'x': sprintf(p, "%x", *list++); break;
case 's':
error = getname((char *)(*list++),&tmp);
if (!error) {
/* we are debugging, we don't need to see it all */
tmp[80] = '\0';
strcpy(p, tmp);
putname(tmp);
}
break;
default:
sprintf(p, "?%c%c?", '%', args[-1]);
break;
}
while (*p) ++p;
if (*args) {
*p++ = ',';
*p++ = ' ';
*p = '\0';
}
}
printk(KERN_DEBUG "[%d]%d %s(%s)\n",
id, current->pid, name, arg_buf);
}
#endif /* IBCS_TRACE */
static void fail(int id, long eax, char *name) {
printk(KERN_ERR "[%d] Unsupported iBSC2 function 0x%lx(%s)\n",
id, eax, name);
}
#endif /* CONFIG_IBCS */

158
iBCSemul/ioctl.c Normal file
View file

@ -0,0 +1,158 @@
/*
* linux/ibcs/ioctl.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* Writtin by Drew Sullivan.
*
* $Id: ioctl.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/ioctl.c,v $
*/
#include <linux/errno.h>
#include <linux/stat.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/termios.h>
#include <asm/segment.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
static int ibcs_ioctl_termios(int fd, unsigned int func, void *arg);
static int ibcs_ioctl_termio(int fd, unsigned int func, void *arg);
static int ibcs_ioctl_console(int fd, unsigned int func, void *arg);
static int ibcs_ioctl_video(int fd, unsigned int func, void *arg);
static char *fix(int n) {
static char char_class[4];
char_class[0] = n & 0xFF0000 ? (char)((n >> 16) & 0xFF) : '.';
char_class[1] = n & 0x00FF00 ? (char)((n >> 8) & 0xFF) : '.';
char_class[2] = n & 0x0000FF ? (char)((n ) & 0xFF) : '.';
char_class[3] = 0;
return char_class;
}
/* ibcs_ioctl is a meta mapper, that is
it looks up the class of the ioctl and then
dispatchs to lower level routines to handle the
mapping of the actual ioctls
*/
#ifdef __cplusplus
extern "C"
#endif
int ibcs_ioctl(int fd, unsigned int ioctl_num, void *arg)
{
unsigned int class = ioctl_num >> 8;
int result = - EPERM;
switch (class) {
case 'T': /* xenix ioctl compatibility */
result = ibcs_ioctl_termio(fd, ioctl_num & 0xFF, arg);
break;
case ('i' << 16) | ('X' << 8): /* iBCS2 POSIX */
case 'x': /* Pre-iBCS2 POSIX */
result = ibcs_ioctl_termios(fd, ioctl_num & 0xFF, arg);
break;
case 'C':
result = ibcs_ioctl_console(fd, ioctl_num & 0xFF, arg);
break;
case ('i' << 16) | ('C' << 8): /* iBCS2 POSIX */
case 'X':
result = ibcs_ioctl_video(fd, ioctl_num & 0xFF, arg);
break;
case 'l':
case 'd':
default:
/* Wyse V/386 3.2.1A TCP/IP ioctls.
* We can't do this in the switch above because Wyse puts
* some more stuff in the upper word which is too much trouble
* to check.
*/
switch (class & 0xff) {
case 's':
case 'r':
case 'i':
result = wv386_ioctl(fd, ioctl_num, arg);
break;
}
break;
}
#if IBCS_TRACE
if (ibcs_trace & TRACE_IOCTL) {
if (result == - EPERM) {
printk("iBCS2 ioctl(%d, %x[%s], %x) unsuported\n", fd, ioctl_num, fix(class), (int)arg);
} else {
printk("iBCS2 ioctl(%d, %x[%s], %x) == %d\n", fd, ioctl_num, fix(class), (int)arg, result);
}
}
#endif
return result;
}
static int ibcs_ioctl_termios(int fd, unsigned int func, void *arg) {
switch(func) {
case 1: /* XCGETA */ return sys_ioctl(fd, TCGETS, arg);
case 2: /* XCSETA */ return sys_ioctl(fd, TCSETS, arg);
case 3: /* XCSETAW */ return sys_ioctl(fd, TCSETSW, arg);
case 4: /* XCSETAF */ return sys_ioctl(fd, TCSETSF, arg);
}
return - EPERM;
}
static int ibcs_ioctl_termio(int fd, unsigned int func, void *arg) {
switch(func) {
case 1: /* TCGETA (TIOC|1) */ return sys_ioctl(fd, TCGETA, arg);
case 2: /* TCSETA (TIOC|2) */ return sys_ioctl(fd, TCSETA, arg);
case 3: /* TCSETAW (TIOC|3) */ return sys_ioctl(fd, TCSETAW, arg);
case 4: /* TCSETAF (TIOC|4) */ return sys_ioctl(fd, TCSETAF, arg);
case 5: /* TCSBRK (TIOC|5) */ return sys_ioctl(fd, TCSBRK, arg);
case 6: /* TCXONC (TIOC|6) */ return sys_ioctl(fd, TCXONC, arg);
case 7: /* TCFLSH (TIOC|7) */ return sys_ioctl(fd, TCFLSH, arg);
case 32: /* TCDSET (TIOC|32) */
case 33: /* RTS_TOG (TIOC|33) 386 - "RTS" toggle define 8A1 protocol */
case 34: /* TCGETSC (TIOC|34) ioctl for scancodes */ return 0x04; /* Translates scancode to ascii */
case 35: /* TCSETSC (TIOC|35) ioctl for scancodes */ return - EPERM;
case 103: /* TIOCSWINSZ (TIOC|103) */ return sys_ioctl(fd, TIOCSWINSZ, arg);
case 104: /* TIOCGWINSZ (TIOC|104) */ return sys_ioctl(fd, TIOCGWINSZ, arg);
case 119: /* TIOCGPGRP (TIOC|119) get pgrp of tty */
case 118: /* TIOCSPGRP (TIOC|118) set pgrp of tty */
case 120: /* TIOSETSAK (TIOC|120) set SAK sequence for tty */
case 121: /* TIOGETSAK (TIOC|121) get SAK sequence for tty */
}
return - EPERM;
}
static int ibcs_ioctl_console(int fd, unsigned int func, void *arg) {
switch(func) {
case 4: /* _TTYDEVTYPE */
/* ***BUG*** if on console then 1, if pseudo tty then 2 */
return 1;
}
return - EPERM;
}
static int ibcs_ioctl_video(int fd, unsigned int func, void *arg) {
switch(func) {
case 4: /* C_IOC */
/* get video memory map & IO privilege */
/* see /etc/conf/pack.d/cn/class.h on any SCO unix box :-) */
}
return - EPERM;
}

344
iBCSemul/ipc.c Normal file
View file

@ -0,0 +1,344 @@
/*
* linux/ibcs/ipc.c
*
* Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
* First stab at ibcs shm, sem and msg handlers
*
* $Id: ipc.c,v 1.1 1994/02/10 09:31:21 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/ipc.c,v $
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <linux/ipc.h>
#include <linux/sem.h>
#include <linux/shm.h>
#include <linux/string.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
extern int sys_semop (int semid, struct sembuf *tsops, unsigned nsops);
extern int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong * raddr);
extern int sys_shmdt (char *shmaddr);
extern unsigned char errno_cvt[];
/*
** I think this is what an IBCS semid_ds
** structure looks like
*/
struct ibcs_ipc_perm
{
unsigned short uid; /* owner's user id */
unsigned short gid; /* owner's group id */
unsigned short cuid; /* creator's user id */
unsigned short cgid; /* creator's group id */
unsigned short mode; /* access modes */
unsigned short seq; /* slot usage sequence number */
long key; /* key */
};
struct ibcs_semid_ds
{
struct ibcs_ipc_perm sem_perm;
struct sem *sem_base;
unsigned short sem_nsems;
char __pad[2];
time_t sem_otime;
time_t sem_ctime;
};
/*
** I think this is what an IBCS shmid_ds
** structure looks like
*/
struct ibcs_shmid_ds
{
struct ibcs_ipc_perm shm_perm; /* operation permission struct */
int shm_segsz; /* size of segment in bytes */
struct region *__pad1; /* ptr to region structure */
char __pad2[4]; /* for swap compatibility */
ushort shm_lpid; /* pid of last shmop */
ushort shm_cpid; /* pid of creator */
unsigned short shm_nattch; /* used only for shminfo */
unsigned short __pad3;
time_t shm_atime; /* last shmat time */
time_t shm_dtime; /* last shmdt time */
time_t shm_ctime; /* last change time */
};
/*
** OK here we do some magic with shm and sem calls
** SHM calls can have command + 1 or 3 args
** SEM calls can have command + 3 or 4 args
*/
#define U_SEMCTL (0)
#define U_SEMGET (1)
#define U_SEMOP (2)
#define U_GETNCNT (3)
#define U_GETPID (4)
#define U_GETVAL (5)
#define U_GETALL (6)
#define U_GETZCNT (7)
#define U_SETVAL (8)
#define U_SETALL (9)
static int
ibcs_sem_trans (int arg)
{
switch (arg)
{
case U_GETNCNT:
return GETNCNT;
case U_GETPID:
return GETPID;
case U_GETVAL:
return GETVAL;
case U_GETALL:
return GETALL;
case U_GETZCNT:
return GETZCNT;
case U_SETVAL:
return SETVAL;
case U_SETALL:
return SETALL;
}
return arg;
}
int
ibcs_semsys (struct pt_regs *regs)
{
int command = get_fs_long (((unsigned long *) regs->esp) + (1));
int arg1, arg2, arg3, arg5;
char *arg4;
int retval;
arg1 = get_fs_long (((unsigned long *) regs->esp) + (2));
arg2 = get_fs_long (((unsigned long *) regs->esp) + (3));
arg3 = get_fs_long (((unsigned long *) regs->esp) + (4));
switch (command)
{
/* hard one first */
case U_SEMCTL:
arg4 = (int *) regs->esp + (5);
arg5 = get_fs_long (((int *) regs->esp) + (5));
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("ibcs_semctl: args: %d %d %d %x(%d)\n", arg1, arg2, arg3, arg4, arg5);
#endif
switch (ibcs_sem_trans (arg3))
{
case IPC_SET:
case IPC_RMID:
case SETVAL:
case GETVAL:
return sys_ipc (SEMCTL, arg1, arg2, ibcs_sem_trans (arg3), arg4);
case IPC_STAT:
retval = sys_ipc (SEMCTL, arg1, arg2, ibcs_sem_trans (arg3), arg4);
if (retval < 0)
return retval;
else
{
struct ibcs_semid_ds os;
struct semid_ds is;
memcpy_fromfs (&is, arg4, sizeof (is));
memset (&os, 0, sizeof (os));
memcpy (&os.sem_perm, &is.sem_perm, sizeof (is.sem_perm));
os.sem_otime = is.sem_otime;
os.sem_ctime = is.sem_ctime;
os.sem_base = is.sem_base;
os.sem_nsems = is.sem_nsems;
memcpy_tofs (arg4, &os, sizeof (os));
return retval;
}
default:
printk ("ibcs_semctl: unsupported command %d\n", arg3);
}
case U_SEMGET:
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("ibcs_semget: args: %d %d %o \n", arg1, arg2, arg3);
#endif
return sys_ipc (SEMGET, arg1, arg2, arg3);
case U_SEMOP:
#if IBCS_TRACE
if (ibcs_func_p->trace)
{
printk ("ibcs_semop: args: %d %d %o \n", arg1, arg2, arg3);
{
int x;
struct sembuf tmp;
struct sembuf *tp = (struct sembuf *) arg2;
for (x = 0; x < arg3; x++)
{
memcpy_fromfs (&tmp, tp, sizeof (tmp));
printk ("ibcs_semop args: %d %d %o \n", tmp.sem_num, tmp.sem_op, tmp.sem_flg);
tp++;
}
}
}
#endif
return sys_semop (arg1, (struct sembuf *) arg2, arg3);
}
return -EINVAL;
}
/*
** start with the easy stuff
*/
#define U_SHMAT (0)
#define U_SHMCTL (1)
#define U_SHMDT (2)
#define U_SHMGET (3)
/*
** modified to set the flags directly
** does not return to emulate
*/
int
ibcs_shmsys (struct pt_regs *regs)
{
int command = get_fs_long (((unsigned long *) regs->esp) + (1));
int arg1, arg2, arg3;
long retval = 0;
char *addr;
int old_fs;
struct shmid_ds is;
switch (command)
{
case U_SHMAT:
case U_SHMCTL:
case U_SHMGET:
arg1 = get_fs_long (((unsigned long *) regs->esp) + (2));
arg2 = get_fs_long (((unsigned long *) regs->esp) + (3));
arg3 = get_fs_long (((unsigned long *) regs->esp) + (4));
break;
case U_SHMDT:
addr = (char *) get_fs_long (((unsigned long *) regs->esp) + (2));
break;
default:
printk ("bad SHM command \n");
retval = -EINVAL;
goto test_exit;
}
switch (command)
{
case U_SHMAT:
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("ibcs_shmat: args: %d %x %o \n", arg1, arg2, arg3);
#endif
/*
** raddr = 0 tells sys_shmat to limit to 2G
** and we are IBCS, no raddr value to return
*/
retval = sys_shmat (arg1, (char *) arg2, arg3, 0);
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("ibcs_shmat: return val is %x\n", retval);
#endif
goto test_exit;
case U_SHMGET:
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("ibcs_shmget: args: %d %x %o \n", arg1, arg2, arg3);
#endif
retval = sys_ipc (SHMGET, arg1, arg2, arg3);
goto test_exit;
case U_SHMDT:
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("ibcs_shmdt: arg: %d\n", addr);
#endif
retval = sys_shmdt (addr);
goto test_exit;
case U_SHMCTL:
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("ibcs_shmctl: args: %d %x %o %d %x\n", arg1, arg2, arg3, arg3, arg3);
#endif
switch (arg2)
{
case IPC_RMID:
retval = (sys_ipc (SHMCTL, arg1, arg2, arg3));
goto test_exit;
case IPC_STAT:
old_fs = get_fs();
set_fs(get_ds());
/* retval = sys_ipc (SHMCTL, arg1, arg2, arg3); */
retval = sys_ipc (SHMCTL, arg1, arg2, &is);
set_fs( old_fs);
if (retval < 0)
goto test_exit;
else
{
struct ibcs_shmid_ds os;
memset (&os, 0, sizeof (os));
memcpy (&os.shm_perm, &is.shm_perm, sizeof (is.shm_perm));
os.shm_segsz = is.shm_segsz;
os.shm_lpid = is.shm_lpid;
os.shm_cpid = is.shm_cpid;
os.shm_nattch = is.shm_nattch;
os.shm_atime = is.shm_atime;
os.shm_dtime = is.shm_dtime;
os.shm_ctime = is.shm_ctime;
memcpy_tofs (arg3, &os, sizeof (os));
goto test_exit;
}
default:
printk ("ibcs_shmctl: unsupported command %d\n", arg2);
}
retval = -EINVAL;
goto test_exit;
default:
#if IBCS_TRACE
printk ("ibcs_shm: command: %x\n", command);
#endif
retval = -EINVAL;
goto test_exit;
}
test_exit:;
if ((retval < 0) && (retval > -255))
{
regs->eflags |= 1; /* set carry flag */
regs->eax = errno_cvt[-retval];
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk ("Error %d\n", regs->eax);
#endif
}
else
{
regs->eflags &= ~1; /* Clear carry flag */
regs->eax = retval;
}
return 0;
}

478
iBCSemul/maps/callmap.inc Normal file
View file

@ -0,0 +1,478 @@
/*
* Call Map -- if you can follow how this works, then you
* get a feeling of complexity that we are dealing with
* in this emulator.
*
* $Id: callmap.inc,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/maps/callmap.inc,v $
*/
static IBCS_func Unused[] = {
{ 0, 0,Ukn, "?", "", },
{ 0, 1,Ukn, "?", "", },
{ 0, 1,Ukn, "?", "", },
{ 0, 1,Ukn, "?", "", },
{ 0, 1,Ukn, "?", "", },
{ 0, 1,Ukn, "?", "", },
{ 0, 1,Ukn, "?", "", },
{ 0, 1,Ukn, "?", "", }
};
static IBCS_func IBCS_func_0x00[] = {
{ ibcs_syscall, 0,Fast, "syscall", "", }, /* 0 */
{ sys_exit, 0,1, "exit", "d", }, /* 1 */
{ ibcs_fork, 0,Spl, "fork", "", }, /* 2 */
{ sys_read, 0,3, "read", "dpd", }, /* 3 */
{ sys_write, 0,3, "write", "dpd", }, /* 4 */
{ ibcs_open, 0,3, "open", "soo", }, /* 5 */
{ sys_close, 0,1, "close", "d", }, /* 6 */
{ ibcs_wait, 0,Spl, "wait", "xxx", } /* 7 */
};
static IBCS_func IBCS_func_0x08[] = {
{ sys_creat, 0,2, "creat", "so", }, /* 8 */
{ sys_link, 0,2, "link", "ss", }, /* 9 */
{ sys_unlink, 0,1, "unlink", "s", }, /* 10 */
{ ibcs_exec, 0,Spl, "exec", "sxx", }, /* 11 */
{ sys_chdir, 0,1, "chdir", "s", }, /* 12 */
{ sys_time, 0,1, "time", "d", }, /* 13 */
{ sys_mknod, 0,3, "mknod", "soo", }, /* 14 */
{ sys_chmod, 0,2, "chmod", "so", } /* 15 */
};
static IBCS_func IBCS_func_0x10[] = {
{ sys_chown, 0,3, "chown", "sdd", }, /* 16 */
{ sys_brk, 0,1, "brk/break", "x", }, /* 17 */
{ ibcs_stat, 0,2, "stat", "sp", }, /* 18 */
{ sys_lseek, 0,3, "seek/lseek", "ddd", }, /* 19 */
{ ibcs_getpid, 0,Spl, "getpid", "", }, /* 20 */
{ 0, 1,Ukn, "mount", "", }, /* 21 */
{ sys_umount, 0,1, "umount", "s", }, /* 22 */
{ sys_setuid, 0,1, "setuid", "d", } /* 23 */
};
static IBCS_func IBCS_func_0x18[] = {
{ ibcs_getuid, 0,Spl, "getuid", "", }, /* 24 */
{ sys_stime, 0,1, "stime", "d", }, /* 25 */
{ sys_ptrace, 0,4, "ptrace", "xxxx", }, /* 26 */
{ sys_alarm, 0,1, "alarm", "x", }, /* 27 */
{ ibcs_fstat, 0,2, "fstat", "dp", }, /* 28 */
{ ibcs_pause, 0,0, "pause", "", }, /* 29 */
{ sys_utime, 0,2, "utime", "xx", }, /* 30 */
{ 0, 1,Ukn, "stty", "", } /* 31 */
};
static IBCS_func IBCS_func_0x20[] = {
{ 0, 1,Ukn, "gtty", "", }, /* 32 */
{ sys_access, 0,2, "access", "so", }, /* 33 */
{ sys_nice, 0,1, "nice", "d", }, /* 34 */
{ ibcs_statfs, 0,2, "statfs", "sp", }, /* 35 */
{ sys_sync, 0,0, "sync", "", }, /* 36 */
{ ibcs_kill, 1,2, "kill", "dd", }, /* 37 */
{ ibcs_fstatfs, 0,2, "fstatfs", "dp", }, /* 38 */
{ sys_getpgrp, 0,0, "getpgrp", "", } /* 39 */
};
static IBCS_func IBCS_func_0x28[] = {
{ 0, 0,Spl, "cxenix", "", }, /* 40 */
{ sys_dup, 0,1, "dup", "d", }, /* 41 */
{ ibcs_pipe, 0,Fast, "pipe", "", }, /* 42 */
{ sys_times, 0,1, "times", "p", }, /* 43 */
{ sys_profil, 0,4, "prof", "xxxx", }, /* 44 */
{ 0, 1,Ukn, "lock/plock", "", }, /* 45 */
{ sys_setgid, 0,1, "setgid", "d", }, /* 46 */
{ ibcs_getgid, 0,Spl, "getgid", "", } /* 47 */
};
static IBCS_func IBCS_func_0x30[] = {
{ ibcs_sigfunc, 0,Fast, "signal", "xxx", }, /* 48 */
{ 0, 1,Ukn, "msgsys", "", }, /* 49 */
{ ibcs_sysi86, 1,Spl, "sysi86/sys3b", "d", }, /* 50 */
{ sys_acct, 0,1, "acct/sysacct", "x", }, /* 51 */
{ ibcs_shmsys, 1,Fast, "shmsys", "ddxo", }, /* 52 */
{ ibcs_semsys, 1,Spl, "semsys", "dddx", }, /* 53 */
{ ibcs_ioctl, 0,3, "ioctl", "dxx", }, /* 54 */
{ 0, 0,3, "uadmin", "xxx", } /* 55 */
};
static IBCS_func IBCS_func_0x38[] = {
{ 0, 1,Ukn, "?", "", }, /* 56 */
{ sys_olduname, 0,1, "utsys", "p", }, /* 57 */
{ 0, 1,Ukn, "?", "", }, /* 58 */
{ ibcs_execv, 0,Spl, "execv", "spp", }, /* 59 */
{ sys_umask, 0,1, "umask", "o", }, /* 60 */
{ sys_chroot, 0,1, "chroot", "s", }, /* 61 */
{ ibcs_fcntl, 1,Spl, "fcntl", "ddx", }, /* 62 */
{ ibcs_ulimit, 0,2, "ulimit", "xx", } /* 63 */
};
static IBCS_func IBCS_func_0x40[] = {
{ 0, 1,Ukn, "?", "", }, /* 64 */
{ 0, 1,Ukn, "?", "", }, /* 65 */
{ 0, 1,Ukn, "?", "", }, /* 66 */
{ 0, 1,Ukn, "?", "", }, /* 67 */
{ 0, 1,Ukn, "?", "", }, /* 68 */
{ 0, 1,Ukn, "?", "", }, /* 69 */
{ 0, 1,Ukn, "advfs", "", }, /* 70 */
{ 0, 1,Ukn, "unadvfs", "", } /* 71 */
};
static IBCS_func IBCS_func_0x48[] = {
{ 0, 1,Ukn, "rmount", "", }, /* 72 */
{ 0, 1,Ukn, "rumount", "", }, /* 73 */
{ 0, 1,Ukn, "rfstart", "", }, /* 74 */
{ 0, 1,Ukn, "?", "", }, /* 75 */
{ 0, 1,Ukn, "rdebug", "", }, /* 76 */
{ 0, 1,Ukn, "rfstop", "", }, /* 77 */
{ 0, 1,Ukn, "rfsys", "", }, /* 78 */
{ sys_rmdir, 0,1, "rmdir", "s", } /* 79 */
};
static IBCS_func IBCS_func_0x50[] = {
{ sys_mkdir, 0,2, "mkdir", "so", }, /* 80 */
{ sys_readdir, 0,3, "getdents", "???", }, /* 81 */
{ 0, 1,Ukn, "libattach", "", }, /* 82 */
{ 0, 1,Ukn, "libdetach", "", }, /* 83 */
{ ibcs_sysfs, 1,Spl, "sysfs", "dxx", }, /* 84 */
{ 0, 1,Ukn, "getmsg", "", }, /* 85 */
{ 0, 1,Ukn, "putmsg", "", }, /* 86 */
{ 0, 1,Ukn, "poll", "", } /* 87 */
};
static IBCS_func IBCS_func_0x58[] = {
{ ibcs_lstat, 0,2, "lstat", "sp", }, /* 88 */
{ sys_symlink, 0,2, "symlink", "ss", }, /* 89 */
{ sys_readlink, 0,2, "readlink", "sp", }, /* 90 */
{ sys_setgroups, 1,2, "setgroups", "dp", }, /* 91 */
{ sys_getgroups, 1,2, "getgroups", "dp", }, /* 92 */
{ 0, 1,3, "fchmod", "do", }, /* 93 */
{ 0, 1,3, "fchown", "dxx", }, /* 94 */
{ 0, 1,3, "sigprocmask", "dxx", } /* 95 */
};
static IBCS_func SCOSVR3_func_0x58[] = {
{ 0, 1,Ukn, "?", "", }, /* 88 */
{ 0, 1,Ukn, "?", "", }, /* 89 */
{ sys_symlink, 0,2, "symlink", "ss", }, /* 90 */
{ ibcs_lstat, 0,2, "lstat", "sp", }, /* 91 */
{ sys_readlink, 0,2, "readlink", "sp", }, /* 92 */
{ 0, 1,Ukn, "?", "", }, /* 93 */
{ 0, 1,Ukn, "?", "", }, /* 94 */
{ 0, 1,Ukn, "?", "", } /* 95 */
};
static IBCS_func IBCS_func_0x60[] = {
{ 0, 1,1, "sigsuspend", "x", }, /* 96 */
{ 0, 1,2, "sigaltstack", "xx", }, /* 97 */
{ 0, 1,3, "sigaction", "dxx", }, /* 98 */
{ 0, 1,1, "sigpending", "x", }, /* 99 */
{ 0, 1,Ukn, "context", "", }, /* 100 */
{ 0, 1,Ukn, "evsys", "", }, /* 101 */
{ 0, 1,Ukn, "evtrapret", "", }, /* 102 */
{ 0, 1,Ukn, "statvfs", "", } /* 103 */
};
static IBCS_func IBCS_func_0x68[] = {
{ 0, 1,Ukn, "fstatvfs", "", }, /* 104 */
{ 0, 1,Ukn, "?", "", }, /* 105 */
{ 0, 1,Ukn, "nfssys", "", }, /* 106 */
{ 0, 1,Ukn, "waitsys", "", }, /* 107 */
{ 0, 1,Ukn, "sigsendsys", "", }, /* 108 */
{ 0, 1,Ukn, "hrtsys", "", }, /* 109 */
{ 0, 1,Ukn, "acancel", "", }, /* 110 */
{ 0, 1,Ukn, "async", "", } /* 111 */
};
static IBCS_func IBCS_func_0x70[] = {
{ 0, 1,Ukn, "priocntlsys", "", }, /* 112 */
{ 0, 1,Ukn, "pathconf", "", }, /* 113 */
{ 0, 1,Ukn, "mincore", "", }, /* 114 */
{ ibcs_mmap, 1,6, "mmap", "xxxxdx", }, /* 115 */
{ sys_mprotect, 1,3, "mprotect", "xdx", }, /* 116 */
{ sys_munmap, 1,2, "munmap", "xd", }, /* 117 */
{ 0, 1,Ukn, "mmap", "", }, /* 115 */
{ 0, 1,Ukn, "mprotect", "", }, /* 116 */
{ 0, 1,Ukn, "munmap", "", }, /* 117 */
{ 0, 1,Ukn, "fpathconf", "", }, /* 118 */
{ 0, 1,Ukn, "vfork", "", } /* 119 */
};
static IBCS_func IBCS_func_0x78[] = {
{ 0, 1,Ukn, "fchdir", "", }, /* 120 */
{ 0, 1,Ukn, "readv", "", }, /* 121 */
{ 0, 1,Ukn, "writev", "", }, /* 122 */
{ ibcs_xstat, 1,3, "xstat", "dsx", }, /* 123 */
{ ibcs_lxstat, 1,3, "lxstat", "dsx", }, /* 124 */
{ ibcs_fxstat, 1,3, "fxstat", "ddx", }, /* 125 */
{ ibcs_xmknod, 1,4, "xmknod", "dsox", }, /* 126 */
{ 0, 1,Ukn, "clocal", "", } /* 127 */
};
static IBCS_func IBCS_func_0x80[] = {
{ 0, 1,Ukn, "setrlimit", "", }, /* 128 */
{ 0, 1,Ukn, "getrlimit", "", }, /* 129 */
{ 0, 1,Ukn, "lchown", "", }, /* 130 */
{ 0, 1,Ukn, "memcntl", "", }, /* 131 */
{ 0, 1,Ukn, "getpmsg", "", }, /* 132 */
{ 0, 1,Ukn, "putpmsg", "", }, /* 133 */
{ 0, 1,Ukn, "rename", "", }, /* 134 */
{ 0, 1,Ukn, "uname", "", } /* 135 */
};
static IBCS_func WYSEV386_func_0x80[] = {
{ ibcs_lstat, 0,2, "lstat", "sp", }, /* 128 */
{ sys_readlink, 0,2, "readlink", "sp", }, /* 129 */
{ sys_symlink, 0,2, "symlink", "ss", }, /* 130 */
{ 0, 1,Ukn, "?", "", }, /* 131 */
{ 0, 1,Ukn, "?", "", }, /* 132 */
{ wv386_gethostname, 1,2, "gethostname", "xd", }, /* 133 */
{ sys_sethostname, 1,2, "sethostname", "sd", }, /* 134 */
{ wv386_getdomainname,1,2, "getdomainname","xd", } /* 135 */
};
static IBCS_func IBCS_func_0x88[] = {
{ 0, 1,Ukn, "setegid", "", }, /* 136 */
{ 0, 1,Ukn, "sysconfig", "", }, /* 137 */
{ 0, 1,Ukn, "adjtime", "", }, /* 138 */
{ 0, 1,Ukn, "systeminfo", "", }, /* 139 */
{ 0, 1,Ukn, "?", "", }, /* 140 */
{ 0, 1,Ukn, "seteuid", "", }, /* 141 */
{ 0, 1,Ukn, "?", "", }, /* 142 */
{ 0, 1,Ukn, "?", "", }, /* 143 */
};
static IBCS_func WYSEV386_func_0x88[] = {
{ sys_setdomainname, 1,2, "setdomainname","sd", }, /* 136 */
{ 0, 1,Ukn, "?", "", }, /* 137 */
{ sys_setreuid, 1,2, "setreuid", "dd", }, /* 138 */
{ sys_setregid, 1,2, "setregid", "dd", }, /* 139 */
{ 0, 1,Ukn, "?", "", }, /* 140 */
{ 0, 1,Ukn, "?", "", }, /* 141 */
{ 0, 1,Ukn, "?", "", }, /* 142 */
{ 0, 1,Ukn, "?", "", }, /* 143 */
};
static IBCS_func *iBCS_class_SVR4[] = {
IBCS_func_0x00,
IBCS_func_0x08,
IBCS_func_0x10,
IBCS_func_0x18,
IBCS_func_0x20,
IBCS_func_0x28,
IBCS_func_0x30,
IBCS_func_0x38,
IBCS_func_0x40,
IBCS_func_0x48,
IBCS_func_0x50,
IBCS_func_0x58,
IBCS_func_0x60,
IBCS_func_0x68,
IBCS_func_0x70,
IBCS_func_0x78,
IBCS_func_0x80,
IBCS_func_0x88
};
static IBCS_func *iBCS_class_SCOSVR3[] = {
IBCS_func_0x00,
IBCS_func_0x08,
IBCS_func_0x10,
IBCS_func_0x18,
IBCS_func_0x20,
IBCS_func_0x28,
IBCS_func_0x30,
IBCS_func_0x38,
IBCS_func_0x40,
IBCS_func_0x48,
IBCS_func_0x50,
SCOSVR3_func_0x58,
Unused,
Unused,
Unused,
Unused, /* clocal() is here but who cares? */
Unused,
Unused
};
static IBCS_func *iBCS_class_WYSEV386[] = {
IBCS_func_0x00,
IBCS_func_0x08,
IBCS_func_0x10,
IBCS_func_0x18,
IBCS_func_0x20,
IBCS_func_0x28,
IBCS_func_0x30,
IBCS_func_0x38,
IBCS_func_0x40,
IBCS_func_0x48,
IBCS_func_0x50,
Unused,
Unused,
Unused,
Unused,
Unused,
WYSEV386_func_0x80,
WYSEV386_func_0x88
};
static IBCS_func XNX_func_0x00[] = {
{ 0, 1,Ukn, "syscall", "", }, /* 0 */
{ xnx_locking, 1,3, "locking", "ddd", }, /* 1 */
{ xnx_creatsem, 1,2, "creatsem", "sd", }, /* 2 */
{ xnx_opensem, 1,1, "opensem", "s", }, /* 3 */
{ xnx_sigsem, 1,1, "sigsem", "d", }, /* 4 */
{ xnx_waitsem, 1,1, "waitsem", "d", }, /* 5 */
{ xnx_nbwaitsem, 1,1, "nbwaitsem", "d", }, /* 6 */
{ xnx_rdchk, 1,1, "rdchk", "d", } /* 7 */
};
static IBCS_func XNX_func_0x08[] = {
{ 0, 1,Ukn, "?", "", }, /* 8 */
{ 0, 1,Ukn, "?", "", }, /* 9 */
{ xnx_chsize, 1,2, "chsize", "dd", }, /* 10 */
{ xnx_ftime, 1,Ukn, "ftime", "", }, /* 11 */
{ xnx_nap, 1,1, "nap", "d", }, /* 12 */
{ xnx_sdget, 1,4, "sdget", "sddd", }, /* 13 */
{ xnx_sdfree, 1,1, "sdfree", "x", }, /* 14 */
{ xnx_sdenter, 1,2, "sdenter", "xd", } /* 15 */
};
static IBCS_func XNX_func_0x10[] = {
{ xnx_sdleave, 1,1, "sdleave", "x", }, /* 16 */
{ xnx_sdgetv, 1,1, "sdgetv", "x", }, /* 17 */
{ xnx_sdwaitv, 1,2, "sdwaitv", "xd", }, /* 18 */
{ 0, 1,Ukn, "?", "", }, /* 19 */
{ 0, 1,Ukn, "?", "", }, /* 20 */
{ 0, 1,Ukn, "?", "", }, /* 21 */
{ 0, 1,Ukn, "?", "", }, /* 22 */
{ 0, 1,Ukn, "?", "", } /* 23 */
};
static IBCS_func XNX_func_0x20[] = {
{ xnx_proctl, 1,3, "proctl", "ddx", }, /* 32 */
{ xnx_execseg, 1,2, "execseg", "xd", }, /* 33 */
{ xnx_unexecseg, 1,1, "unexecseg", "x", }, /* 34 */
{ 0, 1,Ukn, "?", "", }, /* 35 */
{ xnx_select, 1,Ukn, "select", "", }, /* 36 */
{ xnx_eaccess, 1,Ukn, "eaccess", "", }, /* 37 */
{ xnx_paccess, 1,Ukn, "paccess", "", }, /* 38 */
{ xnx_sigaction, 1,Ukn, "sigaction", "", } /* 39 */
};
static IBCS_func XNX_func_0x28[] = {
{ xnx_sigprocmask, 1,Ukn, "sigprocmask", "", }, /* 40 */
{ xnx_sigpending, 1,Ukn, "sigpending", "", }, /* 41 */
{ xnx_sigsuspend, 1,Ukn, "sigsuspend", "", }, /* 42 */
{ sys_getgroups, 1,Ukn, "getgroups", "", }, /* 43 */
{ sys_setgroups, 1,Ukn, "setgroups", "", }, /* 44 */
{ sys_sysconf, 1,1, "sysconf", "d", }, /* 45 */
{ xnx_pathconf, 1,Ukn, "pathconf", "", }, /* 46 */
{ xnx_fpathconf, 1,Ukn, "fpathconf", "", } /* 47 */
};
static IBCS_func XNX_func_0x30[] = {
{ sys_rename, 0,2, "rename", "ss", }, /* 48 */
{ 0, 1,Ukn, "?", "", }, /* 49 */
{ 0, 1,Ukn, "?", "", }, /* 50 */
{ 0, 1,Ukn, "?", "", }, /* 51 */
{ 0, 1,Ukn, "?", "", }, /* 52 */
{ 0, 1,Ukn, "?", "", }, /* 53 */
{ 0, 1,Ukn, "?", "", }, /* 54 */
{ 0, 1,Ukn, "?", "", } /* 55 */
};
static IBCS_func *iBCS_class_XNX[] = {
XNX_func_0x00,
XNX_func_0x08,
XNX_func_0x10,
Unused,
XNX_func_0x20,
XNX_func_0x28,
XNX_func_0x30
};
static IBCS_func WYSETCP_func_0x00[] = {
{ wv386_select, 1,Spl, "select", "dxxxx",}, /* 0 */
{ wv386_socket, 1,Spl, "socket", "ddd", }, /* 1 */
{ wv386_connect, 1,Spl, "connect", "dxd", }, /* 2 */
{ wv386_accept, 1,Spl, "accept", "dxx", }, /* 3 */
{ wv386_send, 1,Spl, "send", "dxdd", }, /* 4 */
{ wv386_recv, 1,Spl, "recv", "dxdd", }, /* 5 */
{ wv386_bind, 1,Spl, "bind", "dxd", }, /* 6 */
{ wv386_setsockopt, 1,Spl, "setsockopt", "", } /* 7 */
};
static IBCS_func WYSETCP_func_0x08[] = {
{ wv386_listen, 1,Spl, "listen", "", }, /* 8 */
{ 0, 1,3, "recvmsg", "dxd", }, /* 9 */
{ 0, 1,3, "sendmsg", "dxd", }, /* 10 */
{ wv386_getsockopt, 1,Spl, "getsockopt", "", }, /* 11 */
{ wv386_recvfrom, 1,Spl, "recvfrom", "dxddxd",}, /* 12 */
{ wv386_sendto, 1,Spl, "sendto", "dxddxd",}, /* 13 */
{ wv386_shutdown, 1,Spl, "shutdown", "dd", }, /* 14 */
{ wv386_socketpair, 1,Spl, "socketpair", "dddx", } /* 15 */
};
static IBCS_func WYSETCP_func_0x10[] = {
{ 0, 1,Ukn, "trace", "", }, /* 16 */
{ wv386_getpeername, 1,Spl, "getpeername", "dxx", }, /* 17 */
{ wv386_getsockname, 1,Spl, "getsockname", "", }, /* 18 */
{ wv386_wait3, 1,1, "wait3", "x", }, /* 19 */
{ 0, 1,Ukn, "?", "", }, /* 20 */
{ 0, 1,Ukn, "?", "", }, /* 21 */
{ 0, 1,Ukn, "?", "", }, /* 22 */
{ 0, 1,Ukn, "?", "", } /* 23 */
};
static IBCS_func *iBCS_class_WYSETCP[] = {
WYSETCP_func_0x00,
WYSETCP_func_0x08,
WYSETCP_func_0x10
};
static IBCS_func WYSENFS_func_0x00[] = {
{ 0, 1,Ukn, "nfs_svc", "", }, /* 0 */
{ 0, 1,Ukn, "aync_daemon", "", }, /* 1 */
{ 0, 1,Ukn, "nfs_getfh", "", }, /* 2 */
{ 0, 1,Ukn, "nfsmount", "", }, /* 3 */
{ 0, 1,Ukn, "?", "", }, /* 4 */
{ 0, 1,Ukn, "?", "", }, /* 5 */
{ 0, 1,Ukn, "?", "", }, /* 6 */
{ 0, 1,Ukn, "?", "", } /* 7 */
};
static IBCS_func *iBCS_class_WYSENFS[] = {
WYSENFS_func_0x00
};
static IBCS_func LNX_func_0x00[] = {
{ ibcs_trace_set, 0,1, "trace", "d", }, /* 0 */
{ ibcs_trace_func, 0,4, "trace", "dddd", }, /* 1 */
{ 0, 1,Ukn, "?", "", }, /* 2 */
{ 0, 1,Ukn, "?", "", }, /* 3 */
{ 0, 1,Ukn, "?", "", }, /* 4 */
{ 0, 1,Ukn, "?", "", }, /* 5 */
{ 0, 1,Ukn, "?", "", }, /* 6 */
{ 0, 1,Ukn, "?", "", } /* 7 */
};
static IBCS_func *iBCS_class_LNX[] = {
LNX_func_0x00
};
static IBCS_func **iBCS_personality_LINUX[] = {
NULL, /* Base class 0x00 */
NULL, /* Xenix class 0x28 */
NULL, /* No Wyse TCP/IP class 0x83 */
NULL, /* No Wyse NFS class 0x84 */
iBCS_class_LNX /* Linux additions in class 0xff */
};
static IBCS_func **iBCS_personality_SVR4[] = {
iBCS_class_SVR4, /* Base class 0x00 */
iBCS_class_XNX, /* Xenix class 0x28 */
NULL, /* No Wyse TCP/IP class 0x83 */
NULL, /* No Wyse NFS class 0x84 */
iBCS_class_LNX /* Linux additions in class 0xff */
};
static IBCS_func **iBCS_personality_SCOSVR3[] = {
iBCS_class_SCOSVR3, /* Base class 0x00 */
iBCS_class_XNX, /* Xenix class 0x28 */
NULL, /* No Wyse TCP/IP class 0x83 */
NULL, /* No Wyse NFS class 0x84 */
iBCS_class_LNX /* Linux additions in class 0xff */
};
static IBCS_func **iBCS_personality_WYSEV386[] = {
iBCS_class_WYSEV386, /* Base class 0x00 */
iBCS_class_XNX, /* Xenix class 0x28 */
iBCS_class_WYSETCP, /* Wyse TCP/IP class 0x83 */
iBCS_class_WYSENFS, /* Wyse NFS class 0x84 */
iBCS_class_LNX /* Linux additions in class 0xff */
};
/* The following sequence should match the defined values in the
* header linux/include/linux/personality.h
*/
static IBCS_func ***IBCS_personality_map[] = {
iBCS_personality_LINUX, /* This should never be used? */
iBCS_personality_SVR4, /* SVR4 (base iBCS) */
iBCS_personality_SVR4, /* Base SVR3 (no extensions) is a subset
* of SVR4.
*/
iBCS_personality_SCOSVR3, /* SVR3 with SCO extensions. */
iBCS_personality_WYSEV386 /* SVR3 with Wyse extensions. */
};

25
iBCSemul/mmap.c Normal file
View file

@ -0,0 +1,25 @@
/*
* linux/ibcs/mmap.c
*
* Copyright (C) 1994 Eric Youngdale
*
* $Id: mmap.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/mmap.c,v $
*/
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/mman.h>
#include <linux/sched.h>
int ibcs_mmap(unsigned int vaddr, unsigned int vsize, int prot, int flags,
int fd, unsigned int file_offset)
{
struct file * file = NULL;
if (!(flags & MAP_ANONYMOUS)) {
if (fd >= NR_OPEN || !(file = current->filp[fd]))
return -EBADF;
}
return do_mmap(file, vaddr, vsize, prot, flags, file_offset);
}

166
iBCSemul/open.c Normal file
View file

@ -0,0 +1,166 @@
/*
* linux/ibcs/open.c
*
* Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
* Copyright (C) 1993, 1994 Drew Sullivan (re-worked for iBCS2)
*
* $Id: open.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/open.c,v $
*/
/* Keep track of which struct definition we really want */
#include <linux/vfs.h>
#include <linux/types.h>
#include <linux/utime.h>
#include <linux/errno.h>
#include <linux/fcntl.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/tty.h>
#include <linux/time.h>
#include <asm/segment.h>
#include <ibcs/ibcs.h>
#ifdef __cplusplus
extern "C"
#endif
int ibcs_statfs(const char * path, struct ibcs_statfs * buf)
{
struct inode * inode;
struct statfs lxstat;
struct ibcs_statfs ibcsstat;
int error;
int old_fs;
error = verify_area(VERIFY_WRITE, buf, sizeof(struct ibcs_statfs));
if (error)
return error;
error = namei(path,&inode);
if (error)
return error;
if (!inode->i_sb->s_op->statfs) {
iput(inode);
return -ENOSYS;
}
old_fs = get_fs();
set_fs(get_ds());
inode->i_sb->s_op->statfs(inode->i_sb, &lxstat);
set_fs(old_fs);
iput(inode);
ibcsstat.f_type = lxstat.f_type;
ibcsstat.f_bsize = lxstat.f_bsize;
ibcsstat.f_frsize = lxstat.f_bsize;
ibcsstat.f_blocks = lxstat.f_blocks;
ibcsstat.f_bfree = lxstat.f_bfree;
ibcsstat.f_files = lxstat.f_files;
ibcsstat.f_ffree = lxstat.f_ffree;
memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
/* Finally, copy it to the user's buffer */
memcpy_tofs(&ibcsstat, buf, sizeof(ibcsstat));
return 0;
}
#ifdef __cplusplus
extern "C"
#endif
int ibcs_fstatfs(unsigned int fd, struct ibcs_statfs * buf)
{
struct inode * inode;
struct file * file;
struct statfs lxstat;
struct ibcs_statfs ibcsstat;
int error;
int old_fs;
error = verify_area(VERIFY_WRITE, buf, sizeof(struct ibcs_statfs));
if (error)
return error;
if (fd >= NR_OPEN || !(file = current->filp[fd]))
return -EBADF;
if (!(inode = file->f_inode))
return -ENOENT;
if (!inode->i_sb->s_op->statfs)
return -ENOSYS;
old_fs = get_fs();
set_fs(get_ds());
inode->i_sb->s_op->statfs(inode->i_sb, &lxstat);
set_fs(old_fs);
ibcsstat.f_type = lxstat.f_type;
ibcsstat.f_bsize = lxstat.f_bsize;
ibcsstat.f_frsize = lxstat.f_bsize;
ibcsstat.f_blocks = lxstat.f_blocks;
ibcsstat.f_bfree = lxstat.f_bfree;
ibcsstat.f_files = lxstat.f_files;
ibcsstat.f_ffree = lxstat.f_ffree;
memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
/* Finally, copy it to the user's buffer */
memcpy_tofs(&ibcsstat, buf, sizeof(ibcsstat));
return 0;
}
/*
** okay, translate ibcs open flags into linux open flags
** for ISC unix, there is a difference, so we
** are just kludging it here
*/
#define U_RDONLY 00000
#define U_WRONLY 00001
#define U_RDWR 00002
#define U_NDELAY 00004
#define U_APPEND 00010
#define U_SYNC 00020
#define U_NONBLOCK 00200
#define U_CREAT 00400
#define U_TRUNC 01000
#define U_EXCL 02000
#define U_NOCTTY 04000
/*
** okay, ISC unix does some nasty
** thing with TRUNC, it assumes
** O_CREAT, I guess.
** This is an error, but we
** will kludge it here for compatibility.
*/
int ibcs_translate_open_flag(int flag)
{
int oflag = 0;
/* if (flag & U_RDONLY) oflag |= O_RDONLY; -- RDONLY is zero */
if (flag & U_WRONLY) oflag |= O_WRONLY;
if (flag & U_RDWR) oflag |= O_RDWR;
if (flag & U_NDELAY) oflag |= O_NDELAY;
if (flag & U_APPEND) oflag |= O_APPEND;
if (flag & U_NONBLOCK) oflag |= O_NONBLOCK;
if (flag & U_SYNC) oflag |= O_SYNC;
if (flag & U_CREAT) oflag |= O_CREAT;
if (flag & U_TRUNC) oflag |= (O_TRUNC|O_CREAT);
if (flag & U_EXCL) oflag |= O_EXCL;
if (flag & U_NOCTTY) oflag |= O_NOCTTY;
/* printk("ibcs: open iflag %08o oflag %08o\n",flag,oflag); */
return oflag;
}
int ibcs_open(const char * fname, int flag, int mode)
{
return sys_open(fname, ibcs_translate_open_flag(flag), mode);
}

461
iBCSemul/signal.c Normal file
View file

@ -0,0 +1,461 @@
/*
* linux/ibcs/signal.c
*
* This module does not go through the normal processing routines for
* ibcs. The reason for this is that for most events, the return is a
* procedure address for the previous setting. This procedure address
* may be negative which is not an error. Therefore, the return processing
* for standard functions is skipped by declaring this routine as a "special"
* module for the decoder and dealing with the register settings directly.
*
* Please consider this closely if you plan on changing this mode.
* -- Al Longyear
*
* $Id: signal.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/signal.c,v $
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
#include <ibcs/xnx.h>
#include <linux/fs.h>
#include <signal.h>
#define SIG_HOLD ((__sighandler_t)2) /* hold signal */
/* Translate errors from Linux to iBCS. This is in the emulate.c module. */
extern int iABI_errors (int error);
#ifdef __cplusplus
extern "C"
#endif
extern int ibcs_trace;
#define TRACE_KEY 0x10 /* Flag to trace calls to this module */
#define TRACE (ibcs_trace & TRACE_KEY)
typedef void (*pfn) (void); /* Completion function */
/*
* Parameters to the signal functions have a common stack frame. This
* defines the stack frame.
*/
#define SIGNAL_NUMBER get_fs_long (&((unsigned long *) regs->esp) [1])
#define HIDDEN_PARAM (SIGNAL_NUMBER & ~0xFF)
#define SECOND_PARAM get_fs_long (&((unsigned long *) regs->esp) [2])
#define THIRD_PARAM ((unsigned long) regs->edx)
/* Return a mask that includes SIG only. */
#define __sigmask(sig) (1 << ((sig) - 1))
/*
* Defines for the other signal processing routines
*/
#define __sigemptyset(set) ((*(set) = 0L), 0)
#define __sigfillset(set) ((*(set) = -1L), 0)
#define __sigaddset(set, sig) ((*(set) |= __sigmask (sig)), 0)
#define __sigdelset(set, sig) ((*(set) &= ~__sigmask (sig)), 0)
#define __sigismember(set, sig) ((*(set) & __sigmask (sig)) ? 1 : 0)
#define sigaddset __sigaddset
#define sigdelset __sigdelset
#define sigismember __sigismember
#define sigemptyset __sigemptyset
#define sigfillset __sigfillset
#define TO_KERNEL(save) \
save = get_fs (); \
set_fs (get_ds ())
#define FROM_KERNEL(save) \
set_fs (save)
/*
* Translate the signal number to the corresponding item for Linux.
*/
inline int ibcs_mapsig(int sig) {
static int signals [] = {
-1,
SIGHUP,
SIGINT,
SIGQUIT,
SIGILL,
SIGTRAP,
SIGIOT,
SIGUNUSED, /* SIGEMT */
SIGFPE,
SIGKILL,
SIGUNUSED, /* SIGSYS */
SIGUNUSED, /* SIGSEGV */
SIGUNUSED,
SIGPIPE,
SIGALRM,
SIGTERM,
SIGUSR1,
SIGUSR2,
SIGCHLD,
SIGPWR,
SIGWINCH,
-1,
SIGPOLL
};
if ((unsigned int) sig >= sizeof(signals)/sizeof(signals[0])) {
return -1;
}
return signals[sig];
}
inline int ibcs_signo (struct pt_regs * regs, int *sig) {
int value = ibcs_mapsig(SIGNAL_NUMBER & 0xFF);
if (value == -1) {
regs->eax = iABI_errors (EINVAL);
regs->eflags |= 1;
return 0;
}
*sig = value;
return 1;
}
/*
* Process the signal() function from iBCS
*
* This version appeared in "Advanced Programming in the Unix Environment"
* by W. Richard Stevens, page 298.
*/
void ibcs_sig_handler (struct pt_regs * regs, int sig, __sighandler_t handler)
{
struct sigaction act, oact;
int answer;
int old_fs;
sigemptyset (&act.sa_mask);
act.sa_handler = handler;
act.sa_flags = 0;
if (sig != SIGALRM) {
act.sa_flags |= SA_RESTART;
}
TO_KERNEL (old_fs);
answer = sys_sigaction (sig, &act, &oact);
FROM_KERNEL (old_fs);
if (answer < 0) {
regs->eax = iABI_errors (-answer);
regs->eflags |= 1;
} else
regs->eax = (int) oact.sa_handler;
}
/*
* Process the signal() function from iBCS
*/
int ibcs_signal (struct pt_regs * regs)
{
__sighandler_t vec;
int sig;
if (ibcs_signo (regs, &sig)) {
vec = (__sighandler_t) SECOND_PARAM;
ibcs_sig_handler (regs, sig, vec);
}
return 0;
}
/*
* Process the iBCS sigset function.
*
* This is basically the same as the signal() routine with the exception
* that it will accept a SIG_HOLD parameter.
*
* A SIG_HOLD will defer the processing of the signal until a sigrelse()
* function is called.
*/
int ibcs_sigset (struct pt_regs * regs)
{
sigset_t newmask, oldmask;
__sighandler_t vec;
int sig, answer;
int old_fs;
if (ibcs_signo (regs, &sig)) {
vec = (__sighandler_t) SECOND_PARAM;
if (vec != SIG_HOLD) {
ibcs_sig_handler (regs, sig, vec);
} else {
/*
* Process the hold function
*/
sigemptyset (&newmask);
sigaddset (&newmask, sig);
TO_KERNEL (old_fs);
answer = sys_sigprocmask (SIG_BLOCK,
&newmask,
&oldmask);
FROM_KERNEL (old_fs);
if (answer < 0) {
regs->eax = iABI_errors (-answer);
regs->eflags |= 1;
}
}
}
return 0;
}
/*
* Process the iBCS sighold function.
*
* Suspend the signal from future recognition.
*/
void ibcs_sighold (struct pt_regs * regs)
{
sigset_t newmask, oldmask;
int sig, answer;
int old_fs;
if (!ibcs_signo (regs, &sig))
return;
sigemptyset (&newmask);
sigaddset (&newmask, sig);
TO_KERNEL (old_fs);
answer = sys_sigprocmask (SIG_BLOCK, &newmask, &oldmask);
FROM_KERNEL (old_fs);
if (answer < 0) {
regs->eax = iABI_errors (-answer);
regs->eflags |= 1;
}
}
/*
* Process the iBCS sigrelse.
*
* Re-enable the signal processing from a previously suspended
* signal. This may have been done by calling the sighold() function
* or a longjmp() during the signal processing routine. If you do a
* longjmp() function then it is expected that you will call sigrelse
* before going on with the program.
*/
void ibcs_sigrelse (struct pt_regs * regs)
{
sigset_t newmask, oldmask;
int sig, answer;
int old_fs;
if (!ibcs_signo (regs, &sig))
return;
sigemptyset (&newmask);
sigaddset (&newmask, sig);
TO_KERNEL (old_fs);
answer = sys_sigprocmask (SIG_UNBLOCK, &newmask, &oldmask);
FROM_KERNEL (old_fs);
if (answer < 0) {
regs->eax = iABI_errors (-answer);
regs->eflags |= 1;
}
}
/*
* Process the iBCS sigignore
*
* This is basically a signal (...,SIG_IGN) call.
*/
void ibcs_sigignore (struct pt_regs * regs)
{
struct sigaction act, oact;
int sig, answer;
int old_fs;
if (!ibcs_signo (regs, &sig))
return;
sigemptyset (&act.sa_mask);
act.sa_handler = SIG_IGN;
act.sa_flags = 0;
TO_KERNEL (old_fs);
answer = sys_sigaction (sig, &act, &oact);
FROM_KERNEL (old_fs);
if (answer < 0) {
regs->eax = iABI_errors (-answer);
regs->eflags |= 1;
}
}
/*
* Process the iBCS sigpause
*
* Wait for the signal indicated to arrive before resuming the
* processing. I do not know if the signal is processed first using
* the normal event processing before the return. If someone can
* shed some light on this then please correct this code. I block
* the signal and look for it to show up in the pending list.
*/
void ibcs_sigpause (struct pt_regs * regs)
{
sigset_t newset, oldset, zeroset, pendingset;
int sig, answer;
int old_fs;
if (!ibcs_signo (regs, &sig))
return;
sigemptyset (&zeroset);
sigemptyset (&newset);
sigaddset (&newset, sig);
TO_KERNEL (old_fs);
answer = sys_sigprocmask (SIG_BLOCK, &newset, &oldset);
FROM_KERNEL (old_fs);
if (answer >= 0) {
TO_KERNEL (old_fs);
answer = sys_sigpending (&pendingset);
FROM_KERNEL (old_fs);
while (answer >= 0) {
if (sigismember (&pendingset, sig) != 0)
break;
TO_KERNEL (old_fs);
answer = sys_sigsuspend (&zeroset);
FROM_KERNEL (old_fs);
if (answer >= 0) {
TO_KERNEL (old_fs);
answer = sys_sigpending (&pendingset);
FROM_KERNEL (old_fs);
}
}
TO_KERNEL (old_fs);
sys_sigprocmask (SIG_SETMASK, &oldset, NULL);
FROM_KERNEL (old_fs);
}
if (answer < 0) {
regs->eax = iABI_errors (-answer);
regs->eflags |= 1;
}
}
/*
* This is the service routine for the syscall #48 (signal funcs).
*
* Examine the request code and branch on the request to the appropriate
* function.
*/
int ibcs_sigfunc (struct pt_regs * regs)
{
char *func;
int sig_type = (int) HIDDEN_PARAM;
regs->eflags &= ~1;
regs->eax = 0;
switch (sig_type) {
case 0x0000:
ibcs_signal (regs);
func = KERN_ERR "%snal(%d,0x%08lx)";
break;
case 0x0100:
ibcs_sigset (regs);
func = KERN_ERR "%sset(%d,0x%08lx";
break;
case 0x0200:
ibcs_sighold (regs);
func = KERN_ERR "%shold(%d)";
break;
case 0x0400:
ibcs_sigrelse (regs);
func = KERN_ERR "%srelse(%d)";
break;
case 0x0800:
ibcs_sigignore (regs);
func = KERN_ERR "%snore(%d)";
break;
case 0x1000:
ibcs_sigpause (regs);
func = KERN_ERR "%spause(%d)";
break;
default:
regs->eax = EINVAL;
regs->eflags |= 1;
#if IBCS_TRACE
if (TRACE)
printk (KERN_ERR "iBCS2 sigfunc(%x, %ld, %lx, %lx) unsuported\n",
sig_type,
SIGNAL_NUMBER,
SECOND_PARAM,
THIRD_PARAM);
#endif
return 0;
}
#if IBCS_TRACE
if (TRACE) {
printk (func,
"iBCS2 sig",
SIGNAL_NUMBER,
SECOND_PARAM,
THIRD_PARAM);
printk (KERN_ERR " == 0x%08lx\n", regs->eax);
#endif
}
return 0;
}
int ibcs_kill(int pid, int sig) {
int outsig = ibcs_mapsig(sig & 0xFF);
#if IBCS_TRACE
if (ibcs_func_p->trace)
printk (KERN_ERR "ibcs_kill: insig (%d) outsig(%d) \n"
, sig & 0xFF, outsig);
#endif
if (outsig < 0) {
return -1;
}
return sys_kill (pid, outsig);
}

100
iBCSemul/stat.c Normal file
View file

@ -0,0 +1,100 @@
/*
* linux/ibcs/stat.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* Hacked by Eric Youngdale for iBCS.
* Added to by Drew Sullivan.
*
* $Id: stat.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/stat.c,v $
*/
#define __KERNEL__ 1
#include <linux/errno.h>
#include <linux/stat.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <ibcs/ibcs.h>
/*
* Believe it or not, the original stat structure is compatible with ibcs2.
* The xstat struct used by SVr4 is different than our new struct, but we will
* deal with that later
*/
static void cp_ibcs_stat(struct inode * inode, struct ibcs_stat * statbuf)
{
struct ibcs_stat tmp;
tmp.st_dev = inode->i_dev;
tmp.st_ino = inode->i_ino;
tmp.st_mode = inode->i_mode;
tmp.st_nlink = inode->i_nlink;
tmp.st_uid = inode->i_uid;
tmp.st_gid = inode->i_gid;
tmp.st_rdev = inode->i_rdev;
tmp.st_size = inode->i_size;
tmp.st_atime = inode->i_atime;
tmp.st_mtime = inode->i_mtime;
tmp.st_ctime = inode->i_ctime;
memcpy_tofs(statbuf,&tmp,sizeof(tmp));
}
#ifdef __cplusplus
extern "C"
#endif
int ibcs_stat(char * filename, struct ibcs_stat * statbuf)
{
struct inode * inode;
int error;
error = verify_area(VERIFY_WRITE,statbuf,sizeof (*statbuf));
if (error)
return error;
error = namei(filename,&inode);
if (error)
return error;
cp_ibcs_stat(inode,statbuf);
iput(inode);
return 0;
}
#ifdef __cplusplus
extern "C"
#endif
int ibcs_lstat(char * filename, struct ibcs_stat * statbuf)
{
struct inode * inode;
int error;
error = verify_area(VERIFY_WRITE,statbuf,sizeof (*statbuf));
if (error)
return error;
error = lnamei(filename,&inode);
if (error)
return error;
cp_ibcs_stat(inode,statbuf);
iput(inode);
return 0;
}
#ifdef __cplusplus
extern "C"
#endif
int ibcs_fstat(unsigned int fd, struct ibcs_stat * statbuf)
{
struct file * f;
struct inode * inode;
int error;
error = verify_area(VERIFY_WRITE,statbuf,sizeof (*statbuf));
if (error)
return error;
if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
return -EBADF;
cp_ibcs_stat(inode,statbuf);
return 0;
}

112
iBCSemul/sysconf.c Normal file
View file

@ -0,0 +1,112 @@
/*
* linux/ibcs/sysconf.c
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: sysconf.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/sysconf.c,v $
*/
#define __KERNEL__ 1
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/limits.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
/* The sysconf() call is supposed to give applications access to various
* kernel parameters. According to SCO's man page this a POSIX mandated
* function. Perhaps it should be moved across as a native Linux call?
*
* N.B. SCO only has sysconf in the Xenix group. Therefore this is based
* on the Xenix spec. Is SVR4 the same? Wyse Unix V.3.2.1A doesn't have
* sysconf documented at all.
*
* N.B. 0-7 are required (by who?). Other values may be defined for
* various systems but there appears no guarantee that they match across
* platforms. Thus, unless we can identify what system the executable
* was compiled for, we probably prefer to have extensions fail. Hell,
* nothing important is going to use this obscure stuff anyway...
*/
#define _SC_ARG_MAX 0
#define _SC_CHILD_MAX 1
#define _SC_CLK_TCK 2
#define _SC_NGROUPS_MAX 3
#define _SC_OPEN_MAX 4
#define _SC_JOB_CONTROL 5
#define _SC_SAVED_IDS 6
#define _SC_VERSION 7
int sys_sysconf(int name) {
switch (name) {
case _SC_ARG_MAX: {
/* From limits.h */
return (ARG_MAX);
}
case _SC_CHILD_MAX: {
/* From limits.h */
return (CHILD_MAX);
}
case _SC_CLK_TCK: {
extern unsigned long volatile jiffies;
/* What is this? It's supposed to be evaluated
* at run time - jiffies?
*/
return (jiffies);
}
case _SC_NGROUPS_MAX: {
/* From limits.h */
return (NGROUPS_MAX);
}
case _SC_OPEN_MAX: {
/* From limits.h */
return (OPEN_MAX);
}
case _SC_JOB_CONTROL: {
return (1);
}
case _SC_SAVED_IDS: {
return (1);
}
case _SC_VERSION: {
/* The version of the POSIX standard we conform
* to. SCO defines _POSIX_VERSION as 198808L
* sys/unistd.h. What are we?
*/
return (198808L);
}
}
#if IBCS_TRACE
if (ibcs_trace & TRACE_API) {
printk(KERN_DEBUG "iBCS2 unsupported sysconf call %d\n", name);
}
#endif
return -EINVAL;
}

109
iBCSemul/sysfs.c Normal file
View file

@ -0,0 +1,109 @@
/*
* linux/ibcs/sysfs.c
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: sysfs.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/sysfs.c,v $
*/
#define __KERNEL__ 1
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
/* Declared in linux/fs/filesystems.c.
* We rely on the table of filesystems being statically built at compile
* time. When (and if) we go to a modular system we will have to change
* this code appropriately.
*/
extern struct file_system_type file_systems[];
#define GETFSIND 1
#define GETFSTYP 2
#define GETNFSTYP 3
int ibcs_sysfs(struct pt_regs * regs) {
int cmd;
struct file_system_type *fs;
int error;
int n_fs;
cmd = get_fs_long(((unsigned long *) regs->esp) + 1);
if (cmd == GETFSIND) {
char *fsname, *kfsname;
fsname = (char *)get_fs_long(((unsigned long *) regs->esp) + 2);
error = getname(fsname, &kfsname);
if (error)
return (error);
n_fs = 1;
for (fs=file_systems; fs->name; fs++,n_fs++)
if (!strcmp(fs->name, kfsname)) {
putname(kfsname);
return (n_fs);
}
putname(kfsname);
return (-EINVAL);
}
n_fs = 0;
for (fs=file_systems; fs->name; fs++,n_fs++);
if (cmd == GETNFSTYP) {
return (n_fs);
}
if (cmd == GETFSTYP) {
int fs_ind;
char *buf;
char *p;
fs_ind = get_fs_long(((unsigned long *) regs->esp) + 2) - 1;
if (fs_ind < 0 || fs_ind >= n_fs
|| !file_systems[fs_ind].name)
return (-EINVAL);
buf = (char *)get_fs_long(((unsigned long *) regs->esp) + 3);
error = verify_area(VERIFY_WRITE, buf,
strlen(file_systems[fs_ind].name));
if (error)
return error;
p = file_systems[fs_ind].name;
do {
put_fs_byte(*p, buf++);
} while (*p++);
return (0);
}
#if IBCS_TRACE
if (ibcs_trace & TRACE_API) {
printk(KERN_DEBUG "iBCS2 unsupported sysfs call %d\n", cmd);
}
#endif
return -EINVAL;
}

108
iBCSemul/sysi86.c Normal file
View file

@ -0,0 +1,108 @@
/*
* linux/ibcs/sysi86.c
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: sysi86.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/sysi86.c,v $
*/
#define __KERNEL__ 1
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <ibcs/ibcs.h>
#include <ibcs/trace.h>
/* The sysi86() call is used for machine specific functions. As far as
* SCO goes these are used for things like VP/IX, Merge and the Xenix
* emulator. These are just the handful that might perhaps be expected
* to either do something useful or give useful clues about the system.
*/
#define SI86FPHW 40
# define FP_NO 0 /* No fp at all */
# define FP_SW 1 /* using emulator */
# define FP_HW 2 /* using hardware */
# define FP_287 2 /* using a 287 */
# define FP_387 3 /* using a 387 */
#define STIME 54
#define SETNAME 56
#define SI86MEM 65
int ibcs_sysi86(struct pt_regs * regs) {
int cmd;
cmd = get_fs_long(((unsigned long *) regs->esp) + 1);
switch (cmd) {
case SI86FPHW: {
int *np;
/* If we remove the 'static' from the definition
* of fpu_error in linux/init/main.c we can tell
* whether we are using hardware or software at
* least. For now let's lie... (actually SCO
* Unix 3.4 gives me -1...)
*/
np = (int *)get_fs_long(((unsigned long *) regs->esp) + 2);
put_fs_long(FP_387, np);
return 0;
}
case STIME: {
/* Set the system time. The argument is a long,
* sys_stime() expects a pointer to a long...
*/
if(!suser()) return -EPERM;
return sys_stime(((unsigned long *) regs->esp) + 2);
}
case SETNAME: {
/* The name is required to be string of no more
* than 7 characters. We don't get passed the
* length so we are depending upon the current
* implementation of sys_sethostname() here.
*/
char *cp;
if(!suser()) return -EPERM;
cp = (char *)get_fs_long(((unsigned long *) regs->esp) + 2);
return sys_sethostname(cp, 7);
}
case SI86MEM: {
/* Returns the size of physical memory.
*/
struct sysinfo i;
si_meminfo(&i);
return i.totalram;
}
}
#if IBCS_TRACE
if (ibcs_trace & TRACE_API) {
printk(KERN_DEBUG "iBCS2 unsupported sysi86 call %d\n", cmd);
}
#endif
return -EINVAL;
}

59
iBCSemul/ulimit.c Normal file
View file

@ -0,0 +1,59 @@
/*
* linux/ibcs/ulimit.c
*
* Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
* First stab at ulimit
*
* $Id: ulimit.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/ulimit.c,v $
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <linux/resource.h>
#define IBCS_TRACE 0 /* set to zero to disable tracing */
#define U_GETFSIZE (1) /* get max file size in blocks */
#define U_SETFSIZE (2) /* set max file size in blocks */
#define U_GETMEMLIM (3) /* get process size limit */
#define U_GETMAXOPEN (4) /* get max open files for this process */
#define U_GTXTOFF (64) /* get text offset */
int
ibcs_ulimit (int cmd, int val)
{
switch (cmd)
{
case U_GETFSIZE:
return current->rlim[RLIMIT_FSIZE].rlim_cur;
case U_SETFSIZE:
{
if (!suser ())
return -EPERM;
if (val > current->rlim[RLIMIT_FSIZE].rlim_max)
return -ERANGE;
current->rlim[RLIMIT_FSIZE].rlim_cur = val / 2;
return 0;
case U_GETMEMLIM:
return current->rlim[RLIMIT_DATA].rlim_cur;
case U_GETMAXOPEN:
return NR_OPEN;
default:
return -EINVAL;
}
return -EINVAL;
}
}

131
iBCSemul/wysev386.c Normal file
View file

@ -0,0 +1,131 @@
/*
* linux/ibcs/wysev386.c
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: wysev386.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/wysev386.c,v $
*/
#define __KERNEL__ 1
#include <asm/segment.h>
#include <linux/mm.h>
#include <linux/utsname.h>
#include <linux/wait.h>
#include <linux/net.h>
#include <linux/sys.h>
#include <ibcs/ibcs.h>
int wv386_gethostname(char *name, int len)
{
int error;
char *p;
if ((error = verify_area(VERIFY_WRITE, name, len)))
return error;
--len;
for (p=system_utsname.nodename; *p && len; p++,len--)
put_fs_byte(*p, name++);
*name = '\0';
return (0);
}
int wv386_getdomainname(char *name, int len)
{
int error;
char *p;
if ((error = verify_area(VERIFY_WRITE, name, len)))
return error;
--len;
for (p=system_utsname.domainname; *p && len; p++,len--)
put_fs_byte(*p, name++);
*name = '\0';
return (0);
}
int wv386_wait3(int *loc)
{
return sys_wait4(-1, loc, WNOHANG, 0);
}
/* It would probably be better to remove the statics in linux/net/socket.c
* and go direct to the sock_ calls than via the indirection routine.
*/
int wv386_select(struct pt_regs *regs)
{
return sys_select(((unsigned long *)regs->esp) + 1);
}
int wv386_socket(struct pt_regs *regs)
{
return sys_socketcall(SYS_SOCKET, ((unsigned long *)regs->esp) + 1);
}
int wv386_connect(struct pt_regs *regs)
{
return sys_socketcall(SYS_CONNECT, ((unsigned long *)regs->esp) + 1);
}
int wv386_accept(struct pt_regs *regs)
{
return sys_socketcall(SYS_ACCEPT, ((unsigned long *)regs->esp) + 1);
}
int wv386_send(struct pt_regs *regs)
{
return sys_socketcall(SYS_SEND, ((unsigned long *)regs->esp) + 1);
}
int wv386_recv(struct pt_regs *regs)
{
return sys_socketcall(SYS_RECV, ((unsigned long *)regs->esp) + 1);
}
int wv386_bind(struct pt_regs *regs)
{
return sys_socketcall(SYS_BIND, ((unsigned long *)regs->esp) + 1);
}
int wv386_setsockopt(struct pt_regs *regs)
{
return sys_socketcall(SYS_SETSOCKOPT, ((unsigned long *)regs->esp) + 1);
}
int wv386_listen(struct pt_regs *regs)
{
return sys_socketcall(SYS_LISTEN, ((unsigned long *)regs->esp) + 1);
}
int wv386_getsockopt(struct pt_regs *regs)
{
return sys_socketcall(SYS_GETSOCKOPT, ((unsigned long *)regs->esp) + 1);
}
int wv386_recvfrom(struct pt_regs *regs)
{
return sys_socketcall(SYS_RECVFROM, ((unsigned long *)regs->esp) + 1);
}
int wv386_sendto(struct pt_regs *regs)
{
return sys_socketcall(SYS_SENDTO, ((unsigned long *)regs->esp) + 1);
}
int wv386_shutdown(struct pt_regs *regs)
{
return sys_socketcall(SYS_SHUTDOWN, ((unsigned long *)regs->esp) + 1);
}
int wv386_socketpair(struct pt_regs *regs)
{
return sys_socketcall(SYS_SOCKETPAIR, ((unsigned long *)regs->esp) + 1);
}
int wv386_getpeername(struct pt_regs *regs)
{
return sys_socketcall(SYS_GETPEERNAME, ((unsigned long *)regs->esp) + 1);
}
int wv386_getsockname(struct pt_regs *regs)
{
return sys_socketcall(SYS_GETSOCKNAME, ((unsigned long *)regs->esp) + 1);
}

87
iBCSemul/wysev386i.c Normal file
View file

@ -0,0 +1,87 @@
/*
* linux/ibcs/wysev386i.c
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: wysev386i.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/Attic/wysev386i.c,v $
*/
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/sockios.h>
#include "wysev386i.h"
int
wv386_ioctl(int fd, unsigned int ioctl_num, void *arg)
{
switch (ioctl_num) {
case WVR3_SIOCSHIWAT: /* set high watermark */
return -EPERM;
case WVR3_SIOCGHIWAT: /* get high watermark */
return -EPERM;
case WVR3_SIOCSLOWAT: /* set low watermark */
return -EPERM;
case WVR3_SIOCGLOWAT: /* get low watermark */
return -EPERM;
case WVR3_SIOCATMARK: /* at oob mark? */
return sys_ioctl(fd, SIOCATMARK, arg);
case WVR3_SIOCSPGRP: /* set process group */
return sys_ioctl(fd, SIOCSPGRP, arg);
case WVR3_SIOCGPGRP: /* get process group */
return sys_ioctl(fd, SIOCGPGRP, arg);
case WVR3_SIOCADDRT: /* add route */
return sys_ioctl(fd, SIOCADDRT, arg);
case WVR3_SIOCDELRT: /* delete route */
return sys_ioctl(fd, SIOCDELRT, arg);
case WVR3_SIOCSIFADDR: /* set ifnet address */
return sys_ioctl(fd, SIOCSIFADDR, arg);
case WVR3_SIOCGIFADDR: /* get ifnet address */
return sys_ioctl(fd, SIOCGIFADDR, arg);
case WVR3_SIOCSIFDSTADDR: /* set p-p address */
return sys_ioctl(fd, SIOCSIFDSTADDR, arg);
case WVR3_SIOCGIFDSTADDR: /* get p-p address */
return sys_ioctl(fd, SIOCGIFDSTADDR, arg);
case WVR3_SIOCSIFFLAGS: /* set ifnet flags */
return sys_ioctl(fd, SIOCSIFFLAGS, arg);
case WVR3_SIOCGIFFLAGS: /* get ifnet flags */
return sys_ioctl(fd, SIOCGIFFLAGS, arg);
case WVR3_SIOCGIFBRDADDR: /* get broadcast addr */
return sys_ioctl(fd, SIOCGIFBRDADDR, arg);
case WVR3_SIOCSIFBRDADDR: /* set broadcast addr */
return sys_ioctl(fd, SIOCSIFBRDADDR, arg);
case WVR3_SIOCGIFCONF: /* get ifnet list */
return sys_ioctl(fd, SIOCGIFCONF, arg);
case WVR3_SIOCGIFNETMASK: /* get net addr mask */
return sys_ioctl(fd, SIOCGIFNETMASK, arg);
case WVR3_SIOCSIFNETMASK: /* set net addr mask */
return sys_ioctl(fd, SIOCSIFNETMASK, arg);
case WVR3_SIOCGIFMETRIC: /* get IF metric */
return sys_ioctl(fd, SIOCGIFMETRIC, arg);
case WVR3_SIOCSIFMETRIC: /* set IF metric */
return sys_ioctl(fd, SIOCSIFMETRIC, arg);
case WVR3_SIOCSIFHADDR: /* set hardware addr */
return sys_ioctl(fd, SIOCSIFHWADDR, arg);
case WVR3_SIOCGIFHADDR: /* get hardware addr */
return sys_ioctl(fd, SIOCGIFHWADDR, arg);
case WVR3_SIOCRIFHADDR: /* reset hardware addr */
return 0; /* LIE??? */
case WVR3_SIOCSARP: /* set arp entry */
return sys_ioctl(fd, SIOCSARP, arg);
case WVR3_SIOCGARP: /* get arp entry */
return sys_ioctl(fd, SIOCGARP, arg);
case WVR3_SIOCDARP: /* delete arp entry */
return sys_ioctl(fd, SIOCDARP, arg);
case WVR3_SIOCADDMULTI: /* set multicast addr */
return -EPERM;
case WVR3_SIOCDELMULTI: /* set multicast addr */
return -EPERM;
}
return -EPERM;
}

152
iBCSemul/xnx.c Normal file
View file

@ -0,0 +1,152 @@
/*
* linux/ibcs/xnx.c
*
* Copyright (C) 1993,1994 Drew Sullivan
*
* This contains the set of Xenix syscalls that are used by SCO binaries
*
* $Id: xnx.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/xnx.c,v $
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/segment.h>
#include <linux/ptrace.h>
#include <linux/config.h>
#include <linux/fcntl.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/fs.h>
#include <linux/sys.h>
#include <ibcs/xnx.h>
int xnx_locking(int fd, int mode, long size) {
return -EPERM;
}
int xnx_creatsem(char *sem_name, int mode) {
return -EPERM;
}
int xnx_opensem(char *sem_name) {
return -EPERM;
}
int xnx_sigsem(int sem_num) {
return -EPERM;
}
int xnx_waitsem(int sem_num) {
return -EPERM;
}
int xnx_nbwaitsem(int sem_num) {
return -EPERM;
}
/* check if Input is available */
int xnx_rdchk(int fd) {
return -EPERM;
}
int xnx_chsize(int fd, long size) {
return -EPERM;
}
int xnx_ftime(struct timeb * tp) {
return -EPERM;
}
/* go to sleep for period milliseconds */
int xnx_nap(long period) {
return -EPERM /* slept time */;
}
int xnx_sdget(char *path, int flags, long size, int mode) {
return -EPERM;
}
int xnx_sdfree(char* addr) {
return -EPERM;
}
int xnx_sdenter(char *addr, int flags) {
return -EPERM;
}
int xnx_sdleave(char *addr) {
return -EPERM;
}
int xnx_sdgetv(char *addr) {
return -EPERM;
}
int xnx_sdwaitv(char *addr, int vnum) {
return -EPERM;
}
int xnx_proctl(int pid, int command, char *arg) {
return -EPERM;
}
int xnx_execseg(excode_t oldaddr, unsigned size) {
return -EPERM;
}
int xnx_unexecseg(excode_t addr) {
return -EPERM;
}
int xnx_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *execptfds, struct timeval *timeout) {
return -EPERM;
}
int xnx_eaccess(char *path, int mode) {
return -EPERM;
}
int xnx_paccess(int pid, int cmd, int offset, int count, char *ptr) {
return -EPERM;
}
int xnx_sigaction(int sig, struct sco_sigaction *act, struct sco_sigaction *oact) {
return -EPERM;
}
int xnx_sigprocmask(int how, sigset_t *set, sigset_t *oset) {
return -EPERM;
}
int xnx_sigpending(sigset_t *set) {
return -EPERM;
}
int xnx_sigsuspend(sigset_t *sigmask) {
return -EPERM;
}
int xnx_getgroups(int gidsetsize, gid_t *grouplist[]) {
return -EPERM;
}
int xnx_setgroups(int gidsetsize, gid_t *grouplist[]) {
return -EPERM;
}
int xnx_pathconf(char *path, int name) {
return -EPERM;
}
int xnx_fpathconf(int fildes, int name) {
return -EPERM;
}

205
iBCSemul/xstat.c Normal file
View file

@ -0,0 +1,205 @@
/*
* linux/ibcs/xstat.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* Hacked by Eric Youngdale for iBCS (1993, 1994).
* Added to by Drew Sullivan, modified by EY for xstat (used by SVr4).
*
* $Id: xstat.c,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/iBCSemul/xstat.c,v $
*/
/*
* The xstat interface is used by SVr4, and is effectively an extension
* to stat. The general idea is that stat has some limitations (chiefly
* 16 bit inode numbers), and the solution in SVr4 was to add an entirely
* new syscall. The /usr/include/sys/stat.h header file defines stat as xstat
* so that the new interface is used. The one advantage of xstat is that
* we pass a version number so that it is possible to tell exactly what
* the application is expecting, and it is easy to do the right thing.
* There is usually an inline wrapper function in /usr/include/sys/stat.h
* to perform this conversion.
*/
#define R3_MKNOD_VERSION 1 /* SVr3 */
#define R4_MKNOD_VERSION 2 /* SVr4 */
#define R3_STAT_VERSION 1 /* SVr3 */
#define R4_STAT_VERSION 2 /* SVr4 */
/* Various functions to provide compatibility between the linux
syscalls and the ABI ABI compliant calls */
#include <linux/kernel.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <asm/segment.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/sys.h>
#include <ibcs/ibcs.h>
#include <ibcs/abi4.h>
static void cp_xstat(struct inode * inode, struct xstat * statbuf)
{
struct xstat tmp = {0, };
unsigned int blocks, indirect;
tmp.st_dev = inode->i_dev;
tmp.st_ino = inode->i_ino;
tmp.st_mode = inode->i_mode;
tmp.st_nlink = inode->i_nlink;
tmp.st_uid = inode->i_uid;
tmp.st_gid = inode->i_gid;
tmp.st_rdev = inode->i_rdev;
tmp.st_size = inode->i_size;
tmp.st_atim.tv_sec = inode->i_atime;
tmp.st_mtim.tv_sec = inode->i_mtime;
tmp.st_ctim.tv_sec = inode->i_ctime;
/*
* st_blocks and st_blksize are approximated with a simple algorithm if
* they aren't supported directly by the filesystem. The minix and msdos
* filesystems don't keep track of blocks, so they would either have to
* be counted explicitly (by delving into the file itself), or by using
* this simple algorithm to get a reasonable (although not 100% accurate)
* value.
*/
/*
* Use minix fs values for the number of direct and indirect blocks. The
* count is now exact for the minix fs except that it counts zero blocks.
* Everything is in BLOCK_SIZE'd units until the assignment to
* tmp.st_blksize.
*/
#define D_B 7
#define I_B (BLOCK_SIZE / sizeof(unsigned short))
if (!inode->i_blksize) {
blocks = (tmp.st_size + BLOCK_SIZE - 1) / BLOCK_SIZE;
if (blocks > D_B) {
indirect = (blocks - D_B + I_B - 1) / I_B;
blocks += indirect;
if (indirect > 1) {
indirect = (indirect - 1 + I_B - 1) / I_B;
blocks += indirect;
if (indirect > 1)
blocks++;
}
}
tmp.st_blocks = (BLOCK_SIZE / 512) * blocks;
tmp.st_blksize = BLOCK_SIZE;
} else {
tmp.st_blocks = inode->i_blocks;
tmp.st_blksize = inode->i_blksize;
}
memcpy_tofs(statbuf,&tmp,sizeof(tmp));
}
int ibcs_xstat(int vers, char * path, struct xstat * stat4){
int status;
switch(vers){
case R3_STAT_VERSION:
return ibcs_stat(path, (struct ibcs_stat *) &stat4);
break;
case R4_STAT_VERSION:
{
int error;
struct inode * inode;
error = verify_area(VERIFY_WRITE, stat4, sizeof (*stat4));
if (error)
return error;
error = namei(path, &inode);
if (error)
return error;
cp_xstat(inode,stat4);
iput(inode);
return 0;
};
break;
default:
return -EINVAL;
};
return status;
}
int ibcs_lxstat(int vers, char * path, struct xstat * stat4){
int status;
switch(vers){
case R3_STAT_VERSION:
return ibcs_lstat(path, (struct ibcs_stat *) stat4);
break;
case R4_STAT_VERSION:
{
int error;
struct inode * inode;
error = verify_area(VERIFY_WRITE, stat4, sizeof (*stat4));
if (error)
return error;
error = lnamei(path, &inode);
if (error)
return error;
cp_xstat(inode,stat4);
iput(inode);
return 0;
};
break;
default:
return -EINVAL;
};
return status;
}
int ibcs_fxstat(int vers, int fd, struct xstat * stat4){
int status;
switch(vers){
case R3_STAT_VERSION:
return ibcs_fstat(fd, (struct ibcs_stat *) &stat4);
break;
case R4_STAT_VERSION:
{
int error;
struct file * f;
struct inode * inode;
error = verify_area(VERIFY_WRITE, stat4, sizeof (*stat4));
if (error)
return error;
if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
return -EBADF;
cp_xstat(inode,stat4);
return 0;
};
break;
default:
return -EINVAL;
};
return status;
}
int ibcs_xmknod(int vers, const char * path, mode_t mode, dev_t dev){
unsigned int major, minor;
switch(vers){
case R3_MKNOD_VERSION: /* More or less compatible with current linux */
return sys_mknod(path, mode, dev);
case R4_MKNOD_VERSION:
minor = dev & 0x3ffff;
major = dev >> 18;
if(minor > 0xff || major > 0xff) return -EINVAL;
return sys_mknod(path, mode, ((major << 8) | minor));
default:
return -EINVAL;
};
}

57
include/ibcs/abi4.h Normal file
View file

@ -0,0 +1,57 @@
/*
* These are defined to enable their inclsion in the branch table
* defined below.
*
* Hacked by Eric Youngdale for iBCS (1993, 1994).
*
* $Id: abi4.h,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/abi4.h,v $
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long ABI_dev_t;
typedef unsigned long ABI_ino_t;
typedef unsigned long ABI_mode_t;
typedef unsigned long ABI_nlink_t;
typedef long ABI_uid_t;
typedef long ABI_off_t;
typedef struct timeval ABI_timestruc_t;
/*
* This is the general form of the stat structure in an ABI compliant system.
*/
struct xstat {
ABI_dev_t st_dev;
long st_pad1[3];
ABI_ino_t st_ino;
ABI_mode_t st_mode;
ABI_nlink_t st_nlink;
ABI_uid_t st_uid;
ABI_uid_t st_gid;
ABI_dev_t st_rdev;
long st_pad2[2];
ABI_off_t st_size;
long st_pad3;
ABI_timestruc_t st_atim;
ABI_timestruc_t st_mtim;
ABI_timestruc_t st_ctim;
long st_blksize;
long st_blocks;
char st_fstype[ 16 ] ;
long st_pad4[8];
};
extern int ibcs_xstat(int vers, char * path, struct xstat * stat4);
extern int ibcs_lxstat(int vers, char * path, struct xstat * stat4);
extern int ibcs_fxstat(int vers, int fd, struct xstat * stat4);
extern int ibcs_xmknod(int vers, const char * path, mode_t mode, dev_t dev);
#ifdef __cplusplus
}
#endif

148
include/ibcs/ibcs.h Normal file
View file

@ -0,0 +1,148 @@
/*
* Function prototypes used by the iBCS2 emulator
*
* $Id: ibcs.h,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/ibcs.h,v $
*/
#include <linux/sys.h> /* for fn_ptr */
#include <linux/ptrace.h> /* for pt_regs */
/*
* 4. You need to decide if you want to be SCO or SysVr4 compatible.
* This will change when we figure out how to do it dynamically.
*
* if SCO_CAMPAT is 1 then you will use the SCO syscall numbers
* otherwise you will use the SysVr4 numbers
*/
#define SCO_COMPAT 1 /* 0 if SysVr4 compatible */
/*
* the function prefix sys_... are used by linux in native mode.
* ibcs_... are emulation interfaces for routine that differ from iBCS2
* and linux. The xnx_... are xenix routines. Note, just because
* xnx routines are listed doesn't mean we support native xenix binaries.
* (yet :-)
*/
typedef struct IBCS_function {
fn_ptr kfunc; /* function to call (sys_..., ibcs_... or xnx_...) */
short trace; /* trace function we can turn tracing on or off */
short nargs; /* number of args to kfunc or Ukn, Spl or Fast */
char * name; /* name of function (for tracing) */
char * args; /* how to print the arg list (see plist) */
} IBCS_func;
struct ibcs_statfs {
short f_type;
long f_bsize;
long f_frsize;
long f_blocks;
long f_bfree;
long f_files;
long f_ffree;
char f_fname[6];
char f_fpack[6];
};
struct ibcs_stat {
unsigned short st_dev;
unsigned short st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned short st_rdev;
unsigned long st_size;
unsigned long st_atime;
unsigned long st_mtime;
unsigned long st_ctime;
};
/* coff.c */
extern int ibcs_fork(struct pt_regs * regs);
extern int ibcs_pipe(struct pt_regs * regs);
extern int ibcs_getpid(struct pt_regs * regs);
extern int ibcs_getuid(struct pt_regs * regs);
extern int ibcs_getgid(struct pt_regs * regs);
extern int ibcs_wait(struct pt_regs * regs);
extern int ibcs_execv(struct pt_regs * regs);
extern int ibcs_exec(struct pt_regs * regs);
extern int ibcs_trace_set(int);
extern int ibcs_trace_func(int, int, int, int);
extern int ibcs_utsname(int);
extern int ibcs_pause(void);
/* emulate.c */
extern void iABI_emulate(struct pt_regs *regs);
extern int iABI_errors(int errno);
extern int ibcs_syscall(struct pt_regs *regs);
/* fcntl.c */
extern int ibcs_fcntl(struct pt_regs *regs);
/* ioctl.c */
extern int ibcs_ioctl(int fd, unsigned int ioctl_num, void *arg);
/* ipc.c */
extern int ibcs_semsys (struct pt_regs *regs);
extern int ibcs_shmsys (struct pt_regs *regs);
/* mmap.c */
extern int ibcs_mmap(unsigned int vaddr, unsigned int vsize, int prot,
int flags, int fd, unsigned int file_offset);
/* open.c */
extern int ibcs_statfs(const char * path, struct ibcs_statfs * buf);
extern int ibcs_fstatfs(unsigned int fd, struct ibcs_statfs * buf);
extern int ibcs_open(const char * fname, int flag, int mode);
/* signal.c */
void ibcs_sig_handler (struct pt_regs * regs, int sig, __sighandler_t handler);
extern int ibcs_signal(struct pt_regs * regs);
extern int ibcs_sigset(struct pt_regs * regs);
void ibcs_sighold (struct pt_regs * regs);
void ibcs_sigrelse (struct pt_regs * regs);
void ibcs_sigignore (struct pt_regs * regs);
void ibcs_sigpause (struct pt_regs * regs);
extern int ibcs_sigfunc(struct pt_regs * regs);
extern int ibcs_kill(int pid, int sig);
/* stat.c */
extern int ibcs_stat(char * filename, struct ibcs_stat * statbuf);
extern int ibcs_lstat(char * filename, struct ibcs_stat * statbuf);
extern int ibcs_fstat(unsigned int fd, struct ibcs_stat * statbuf);
/* sysconf.c */
extern int sys_sysconf(int name);
/* sysfs.c */
extern int ibcs_sysfs(struct pt_regs * regs);
/* sysi86.c */
extern int ibcs_sysi86(struct pt_regs * regs);
/* ulimit.c */
extern int ibcs_ulimit(int cmd, int val);
/* wysev386.c */
extern int wv386_gethostname(char *name, int len);
extern int wv386_getdomainname(char *name, int len);
extern int wv386_wait3(int *loc);
extern int wv386_select(struct pt_regs *regs);
extern int wv386_socket(struct pt_regs *regs);
extern int wv386_connect(struct pt_regs *regs);
extern int wv386_accept(struct pt_regs *regs);
extern int wv386_send(struct pt_regs *regs);
extern int wv386_recv(struct pt_regs *regs);
extern int wv386_bind(struct pt_regs *regs);
extern int wv386_setsockopt(struct pt_regs *regs);
extern int wv386_listen(struct pt_regs *regs);
extern int wv386_getsockopt(struct pt_regs *regs);
extern int wv386_recvfrom(struct pt_regs *regs);
extern int wv386_sendto(struct pt_regs *regs);
extern int wv386_shutdown(struct pt_regs *regs);
extern int wv386_socketpair(struct pt_regs *regs);
extern int wv386_getpeername(struct pt_regs *regs);
extern int wv386_getsockname(struct pt_regs *regs);
/* From wysev386i.c */
extern int wv386_ioctl(int fd, unsigned int ioctl_num, void *arg);

200
include/ibcs/termios.h Normal file
View file

@ -0,0 +1,200 @@
/*
* This file was entered from the book
* Intel386 Family Binary Compatability Specification 2
* McGraw-Hill Book company
* ISBN 0-07-031219-2
*
* $Id: termios.h,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/termios.h,v $
*/
#define NCC 8
#define NCCS 13
typedef unsigned short tcflag_t;
typesef unsigned char cc_t;
typedef unsigned long speed_t;
struct termio {
unsigned short c_iflag;
unsigned short c_oflag;
unsigned short c_cflag;
unsigned short c_lflag;
char c_line;
unsigned char c_cc[NC];
};
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
char c_line;
cc_t c_cc[NCCS];
char c_ispeed;
char c_ospeed;
};
#define VINTR 0
#define VQUIT 1
#define VERASE 2
#define VKILL 3
#define VEOF 4
#define VEOL 5
#define VEOL2 6
#define VMIN 4
#define VTIME 5
#define VSWTCH 7
#define VSUSP 10
#define VSTART 11
#define VSTOP 12
#define CNUL 0
#define CDEL 0377
#define CESC '\\'
#define CINTR 0177
#define CQUIT 034
#define CERASE '#'
#define CKILL '@'
#define CSTART 021
#define CSTOP 023
#define CSWTCH 032
#define CNSWTCH 0
#define CSUSP 032
#define IGNBRK 0000001
#define BRKINT 0000002
#define IGNPAR 0000004
#define PARMRK 0000010
#define INPCK 0000020
#define ISTRIP 0000040
#define INLCR 0000100
#define IGNCR 0000200
#define ICRNL 0000400
#define IUCLC 0001000
#define IXON 0002000
#define IXANY 0004000
#define IXOFF 0010000
#define IMAXBEL 0020000 /* RESERVED */
#define DOSMODE 0100000
#define OPOST 00000001
#define OLCUC 00000002
#define ONLCR 00000004
#define OCRNL 00000010
#define ONOCR 00000020
#define ONLRET 00000040
#define OFILL 00000100
#define OFDEL 00000200
#define NLDLY 00000400
#define NL0 0
#define NL1 00000400
#define CRDLY 00003000
#define CR0 0
#define CR1 00001000
#define CR2 00002000
#define CR3 00003000
#define TABDLY 00014000
#define TAB0 0
#define TAB1 00004000
#define TAB2 00010000
#define TAB3 00014000
#define BSDLY 00200000
#define BS0 0
#define BS1 00200000
#define VTDLY 00400000
#define VT0 0
#define VT1 00400000
#define FFDLY 01000000
#define FF0 0
#define FF1 01000000
#define CBAUD 0000017
#define CSIZE 0000060
#define CS5 0
#define CS6 0000020
#define CS7 0000040
#define CS8 0000060
#define CSTOPB 0000100
#define CREAD 0000200
#define PARENB 0000400
#define PARODD 0001000
#define HUPCL 0002000
#define CLOCAL 0004000
#define RCV1EN 0010000
#define XMT1EN 0020000
#define LOBLK 0040000
#define XCLUDE 0100000
#define ISIG 0000001
#define ICANON 0000002
#define XCASE 0000004
#define ECHO 0000010
#define ECHOE 0000020
#define ECHOK 0000040
#define ECHONL 0000100
#define NOFLSH 0000200
#define IEXTEN 0000400
#defien TOSTOP 0001000
/* Bits 10-15 (0176000) in the c_lflag field are RESERVED */
/*
#define XIOC ('x'<<8) Level 2
*/
#define XIOC (('i'<<8)|('X'<<16))
#define XCGETA (XIOC|1)
#define XCSETA (XIOC|2)
#define XCSETAW (XIOC|3)
#define XCSETAF (XIOC|4)
#define TIOC ('T'<<8)
#define TCGETA (TIOC|1)
#define TCSETA (TIOC|2)
#define TCSETAW (TIOC|3)
#define TCSETAF (TIOC|4)
#define TCSBRK (TIOC|5)
#define TCXONC (TIOC|6)
#define TCFLSH (TIOC|7)
#define TIOCGWINSZ (TIOC|104)
#define TIOCSWINSZ (TIOC|103)
#define TCSANOW XCSETA
#define TCSADRAIN XCSETAW
#define TCSAFLUSH XCSETAF
#define TCSADFLUSH XCSETAF
#define TCIFLUSH 0
#define TCOFLUSH 1
#define TCIOFLUSH 2
#define TCOOFF 0
#define TCOON 1
#define TCIOFF 2
#define TCION 3
#define B0 0
#define B50 1
#define B75 2
#define B110 3
#define B134 4
#define B150 5
#define B200 6
#define B300 7
#define B600 8
#define B1200 9
#define B1800 10
#define B2400 11
#define B4800 12
#define B9600 13
#define B19200 14
#define B38400 15
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};

16
include/ibcs/trace.h Normal file
View file

@ -0,0 +1,16 @@
/*
* ibcs trace -- mask of trace values
*
* $Id: trace.h,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/trace.h,v $
*/
#define IBCS_TRACE 1 /* trace code support */
#define TRACE_API 0x00000001 /* all call/return values */
#define TRACE_IOCTL 0x00000002 /* all ioctl calls */
#define TRACE_IOCTL_F 0x00000004 /* ioctl calls that fail */
#define TRACE_SIGNAL_F 0x00000010 /* signal calls that fail */
#define TRACE_FUNC 0x10000000 /* trace this function */
extern int ibcs_trace;
IBCS_func *ibcs_func_p;

284
include/ibcs/unistd.h Normal file
View file

@ -0,0 +1,284 @@
#ifndef _IBCS_UNISTD_H
#define _IBCS_UNISTD_H
/*
* This file contains the system call numbers and the syscallX
* macros
*/
#if 0
#define __NR_setup 0 /* used only by init, to get system going */
#define __NR_exit 1
#define __NR_fork 2
#define __NR_read 3
#define __NR_write 4
#define __NR_open 5
#define __NR_close 6
#define __NR_waitpid 7
#define __NR_creat 8
#define __NR_link 9
#define __NR_unlink 10
#define __NR_execve 11
#define __NR_chdir 12
#define __NR_time 13
#define __NR_mknod 14
#define __NR_chmod 15
#define __NR_chown 16
#define __NR_break 17
#define __NR_oldstat 18
#define __NR_lseek 19
#define __NR_getpid 20
#define __NR_mount 21
#define __NR_umount 22
#define __NR_setuid 23
#define __NR_getuid 24
#define __NR_stime 25
#define __NR_ptrace 26
#define __NR_alarm 27
#define __NR_oldfstat 28
#define __NR_pause 29
#define __NR_utime 30
#define __NR_stty 31
#define __NR_gtty 32
#define __NR_access 33
#define __NR_nice 34
#define __NR_ftime 35
#define __NR_sync 36
#define __NR_kill 37
#define __NR_rename 38
#define __NR_mkdir 39
#define __NR_rmdir 40
#define __NR_dup 41
#define __NR_pipe 42
#define __NR_times 43
#define __NR_prof 44
#define __NR_brk 45
#define __NR_setgid 46
#define __NR_getgid 47
#define __NR_signal 48
#define __NR_geteuid 49
#define __NR_getegid 50
#define __NR_acct 51
#define __NR_phys 52
#define __NR_lock 53
#define __NR_ioctl 54
#define __NR_fcntl 55
#define __NR_mpx 56
#define __NR_setpgid 57
#define __NR_ulimit 58
#define __NR_oldolduname 59
#define __NR_umask 60
#define __NR_chroot 61
#define __NR_ustat 62
#define __NR_dup2 63
#define __NR_getppid 64
#define __NR_getpgrp 65
#define __NR_setsid 66
#define __NR_sigaction 67
#define __NR_sgetmask 68
#define __NR_ssetmask 69
#define __NR_setreuid 70
#define __NR_setregid 71
#define __NR_sigsuspend 72
#define __NR_sigpending 73
#define __NR_sethostname 74
#define __NR_setrlimit 75
#define __NR_getrlimit 76
#define __NR_getrusage 77
#define __NR_gettimeofday 78
#define __NR_settimeofday 79
#define __NR_getgroups 80
#define __NR_setgroups 81
#define __NR_select 82
#define __NR_symlink 83
#define __NR_oldlstat 84
#define __NR_readlink 85
#define __NR_uselib 86
#define __NR_swapon 87
#define __NR_reboot 88
#define __NR_readdir 89
#define __NR_mmap 90
#define __NR_munmap 91
#define __NR_truncate 92
#define __NR_ftruncate 93
#define __NR_fchmod 94
#define __NR_fchown 95
#define __NR_getpriority 96
#define __NR_setpriority 97
#define __NR_profil 98
#define __NR_statfs 99
#define __NR_fstatfs 100
#define __NR_ioperm 101
#define __NR_socketcall 102
#define __NR_syslog 103
#define __NR_setitimer 104
#define __NR_getitimer 105
#define __NR_stat 106
#define __NR_lstat 107
#define __NR_fstat 108
#define __NR_olduname 109
#define __NR_iopl 110
#define __NR_vhangup 111
#define __NR_idle 112
#define __NR_vm86 113
#define __NR_wait4 114
#define __NR_swapoff 115
#define __NR_sysinfo 116
#define __NR_ipc 117 /* not implemented yet */
#define __NR_fsync 118 /* not implemented yet */
#define __NR_sigreturn 119
#define __NR_clone 120
#define __NR_setdomainname 121
#define __NR_uname 122
#endif
#define __IBCS_setup 0 /* used only by init, to get system going */
#define __IBCS_exit 1
#define __IBCS_fork 2
#define __IBCS_read 3
#define __IBCS_write 4
#define __IBCS_open 5
#define __IBCS_close 6
#define __IBCS_waitpid 7
#define __IBCS_creat 8
#define __IBCS_link 9
#define __IBCS_unlink 10
#define __IBCS_exec 11
#define __IBCS_chdir 12
#define __IBCS_time 13
#define __IBCS_mknod 14
#define __IBCS_chmod 15
#define __IBCS_chown 16
#define __IBCS_brk 17
#define __IBCS_stat 18
#define __IBCS_lseek 19
#define __IBCS_getpid 20
#define __IBCS_mount 21
#define __IBCS_umount 22
#define __IBCS_setuid 23
#define __IBCS_getuid 24
#define __IBCS_stime 25
#define __IBCS_ptrace 26
#define __IBCS_alarm 27
#define __IBCS_fstat 28
#define __IBCS_pause 29
#define __IBCS_utime 30
#define __IBCS_stty 31
#define __IBCS_gtty 32
#define __IBCS_access 33
#define __IBCS_nice 34
#define __IBCS_statfs 35
#define __IBCS_sync 36
#define __IBCS_kill 37
#define __IBCS_fstatfs 38
#define __IBCS_getpgrp 39
#define __IBCS_dup 41
#define __IBCS_pipe 42
#define __IBCS_times 43
#define __IBCS_profil 44
#define __IBCS_plock 45
#define __IBCS_setgid 46
#define __IBCS_getgid 47
#define __IBCS_signal 48
#define __IBCS_msgctl 49
#define __IBCS_sysi86 50
#define __IBCS_acct 51
#define __IBCS_shmctl 52
#define __IBCS_semctl 53
#define __IBCS_ioctl 54
#define __IBCS_uadmin 55
#define __IBCS_uname 57
#define __IBCS_execve 59
#define __IBCS_umask 60
#define __IBCS_chroot 61
#define __IBCS_fcntl 62
#define __IBCS_ulimit 63
#define __IBCS_rmdir 79
#define __IBCS_mkdir 80
#define __IBCS_getdents 81
#define __IBCS_sysfs 84
#define __IBCS_getmsg 85
#define __IBCS_putmsg 86
#define __IBCS_poll 87
/* XXX - _foo needs to be __foo, while __IBCS_bar could be _NR_bar. */
/* WARNING - THESE ONLY WORK WITH -fomit-frame-pointer */
#define _syscall0(type,name) \
type name(void) \
{ \
extern int errno; \
long __res; \
__asm__ volatile (".byte 0x9a, 0, 0, 0, 0, 7, 0\n" \
"\tjc 1f\n\txorl %%eax,%%eax\n" \
"\tjmp 2f\n" \
"1:\n" \
"\tmovl %%eax,_errno\n" \
"\tmovl $-1,%%eax\n" \
"2:\n" \
: "=a" (__res) \
: "0" (0x100 + __NR_##name)); \
return __res; \
}
#define _syscall1(type,name,atype,a) \
type name(atype a) \
{ \
extern int errno; \
long __res; \
__asm__ volatile (".byte 0x9a, 0, 0, 0, 0, 7, 0\n" \
"\tjc 1f\n\txorl %%eax,%%eax\n" \
"\tjmp 2f\n" \
"1:\n" \
"\tmovl %%eax,_errno\n" \
"\tmovl $-1,%%eax\n" \
"2:\n" \
: "=a" (__res) \
: "0" (0x100 + __NR_##name)); \
return __res; \
}
#define _syscall2(type,name,atype,a,btype,b) \
type name(atype a,btype b) \
{ \
extern int errno; \
long __res; \
__asm__ volatile (".byte 0x9a, 0, 0, 0, 0, 7, 0\n" \
"\tjc 1f\n\txorl %%eax,%%eax\n" \
"\tjmp 2f\n" \
"1:\n" \
"\tmovl %%eax,_errno\n" \
"\tmovl $-1,%%eax\n" \
"2:\n" \
: "=a" (__res) \
: "0" (0x100 + __NR_##name)); \
return __res; \
}
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
type name(atype a,btype b,ctype c) \
{ \
extern int errno; \
long __res; \
__asm__ volatile (".byte 0x9a, 0, 0, 0, 0, 7, 0\n" \
"\tjc 1f\n\txorl %%eax,%%eax\n" \
"\tjmp 2f\n" \
"1:\n" \
"\tmovl %%eax,_errno\n" \
"\tmovl $-1,%%eax\n" \
"2:\n" \
: "=a" (__res) \
: "0" (0x100 + __NR_##name)); \
return __res; \
}
#endif /* _LINUX_UNISTD_H */

73
include/ibcs/wysev386i.h Normal file
View file

@ -0,0 +1,73 @@
/*
* linux/ibcs/wysev386i.h
*
* Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
*
* $Id: wysev386i.h,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/wysev386i.h,v $
*/
/* Wyse extensions for 4.3 BSD TCP/IP in V/386 3.2.1A */
/* Get struct rtentry from linux/route.h - this should be compatible. */
#include <linux/route.h>
/* Get struct arpreq from linux/if_arp.h - this should be compatible. */
#include <linux/if_arp.h>
/* Get struct ifreq and struct ifconf from linux/if.h - these should
* be compatible.
*/
#include <linux/if.h>
/* Wyse encode the ioctl numbers using the argument size as part of
* the number. This will warn us if we haven't got compatible
* structures :-).
*/
#define WVR3_IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
#define WVR3_IOC_VOID 0x20000000 /* no parameters */
#define WVR3_IOC_OUT 0x40000000 /* copy out parameters */
#define WVR3_IOC_IN 0x80000000 /* copy in parameters */
#define WVR3_IOC_INOUT (WVR3_IOC_IN|WVR3_IOC_OUT)
#define WVR3_IO(x,y) (WVR3_IOC_VOID|(x<<8)|y)
#define WVR3_IOR(x,y,t) (WVR3_IOC_OUT|((sizeof(t)&WVR3_IOCPARM_MASK)<<16)|(x<<8)|y)
#define WVR3_IOW(x,y,t) (WVR3_IOC_IN|((sizeof(t)&WVR3_IOCPARM_MASK)<<16)|(x<<8)|y)
#define WVR3_IOWR(x,y,t) (WVR3_IOC_INOUT|((sizeof(t)&WVR3_IOCPARM_MASK)<<16)|(x<<8)|y)
/* socket i/o controls */
#define WVR3_SIOCSHIWAT WVR3_IOW('s', 0, int) /* set high watermark */
#define WVR3_SIOCGHIWAT WVR3_IOR('s', 1, int) /* get high watermark */
#define WVR3_SIOCSLOWAT WVR3_IOW('s', 2, int) /* set low watermark */
#define WVR3_SIOCGLOWAT WVR3_IOR('s', 3, int) /* get low watermark */
#define WVR3_SIOCATMARK WVR3_IOR('s', 7, int) /* at oob mark? */
#define WVR3_SIOCSPGRP WVR3_IOW('s', 8, int) /* set process group */
#define WVR3_SIOCGPGRP WVR3_IOR('s', 9, int) /* get process group */
#define WVR3_SIOCADDRT WVR3_IOW('r', 10, struct rtentry) /* add route */
#define WVR3_SIOCDELRT WVR3_IOW('r', 11, struct rtentry) /* delete route */
#define WVR3_SIOCSIFADDR WVR3_IOW('i', 12, struct ifreq) /* set ifnet address */
#define WVR3_SIOCGIFADDR WVR3_IOWR('i',13, struct ifreq) /* get ifnet address */
#define WVR3_SIOCSIFDSTADDR WVR3_IOW('i', 14, struct ifreq) /* set p-p address */
#define WVR3_SIOCGIFDSTADDR WVR3_IOWR('i',15, struct ifreq) /* get p-p address */
#define WVR3_SIOCSIFFLAGS WVR3_IOW('i', 16, struct ifreq) /* set ifnet flags */
#define WVR3_SIOCGIFFLAGS WVR3_IOWR('i',17, struct ifreq) /* get ifnet flags */
#define WVR3_SIOCGIFBRDADDR WVR3_IOWR('i',18, struct ifreq) /* get broadcast addr */
#define WVR3_SIOCSIFBRDADDR WVR3_IOW('i',19, struct ifreq) /* set broadcast addr */
#define WVR3_SIOCGIFCONF WVR3_IOWR('i',20, struct ifconf) /* get ifnet list */
#define WVR3_SIOCGIFNETMASK WVR3_IOWR('i',21, struct ifreq) /* get net addr mask */
#define WVR3_SIOCSIFNETMASK WVR3_IOW('i',22, struct ifreq) /* set net addr mask */
#define WVR3_SIOCGIFMETRIC WVR3_IOWR('i',23, struct ifreq) /* get IF metric */
#define WVR3_SIOCSIFMETRIC WVR3_IOW('i',24, struct ifreq) /* set IF metric */
#define WVR3_SIOCSIFHADDR WVR3_IOW('i', 25, struct ifreq) /* set hardware addr */
#define WVR3_SIOCGIFHADDR WVR3_IOWR('i',26, struct ifreq) /* get hardware addr */
#define WVR3_SIOCRIFHADDR WVR3_IOW('i', 27, struct ifreq) /* reset hardware addr */
#define WVR3_SIOCSARP WVR3_IOW('i', 30, struct arpreq) /* set arp entry */
#define WVR3_SIOCGARP WVR3_IOWR('i',31, struct arpreq) /* get arp entry */
#define WVR3_SIOCDARP WVR3_IOW('i', 32, struct arpreq) /* delete arp entry */
#define WVR3_SIOCADDMULTI WVR3_IOW('i', 33, struct ifreq) /* set multicast addr */
#define WVR3_SIOCDELMULTI WVR3_IOW('i', 34, struct ifreq) /* set multicast addr */

55
include/ibcs/xnx.h Normal file
View file

@ -0,0 +1,55 @@
/*
* xnx.h -- xenix ibcs interface
*
* Copyright (C) 1993 Drew Sullivan
* Released for general use as long as this copyright remains.
*
* $Id: xnx.h,v 1.1 1994/02/10 09:31:22 mike Exp $
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/include/ibcs/xnx.h,v $
*/
typedef unsigned short excode_t;
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
struct sco_sigaction {
void (*sa_handler)(int);
sigset_t sa_mask;
int saflags;
};
extern int xnx_locking(int fd, int mode, long size);
extern int xnx_creatsem(char *sem_name, int mode);
extern int xnx_opensem(char *sem_name);
extern int xnx_sigsem(int sem_num);
extern int xnx_waitsem(int sem_num);
extern int xnx_nbwaitsem(int sem_num);
extern int xnx_rdchk(int fd);
extern int xnx_chsize(int fd, long size);
extern int xnx_ftime(struct timeb * tp);
extern int xnx_nap(long period);
extern int xnx_sdget(char *path, int flags, long size, int mode);
extern int xnx_sdfree(char* addr);
extern int xnx_sdenter(char *addr, int flags);
extern int xnx_sdleave(char *addr);
extern int xnx_sdgetv(char *addr);
extern int xnx_sdwaitv(char *addr, int vnum);
extern int xnx_proctl(int pid, int command, char *arg);
extern int xnx_execseg(excode_t oldaddr, unsigned size);
extern int xnx_unexecseg(excode_t addr);
extern int xnx_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *execptfds, struct timeval *timeout);
extern int xnx_eaccess(char *path, int mode);
extern int xnx_paccess(int pid, int cmd, int offset, int count, char *ptr);
extern int xnx_sigaction(int sig, struct sco_sigaction *act, struct sco_sigaction *oact);
extern int xnx_sigprocmask(int how, sigset_t *set, sigset_t *oset);
extern int xnx_sigpending(sigset_t *set);
extern int xnx_sigsuspend(sigset_t *sigmask);
extern int xnx_getgroups(int gidsetsize, gid_t *grouplist[]);
extern int xnx_setgroups(int gidsetsize, gid_t *grouplist[]);
extern int xnx_sysconf(int name);
extern int xnx_pathconf(char *path, int name);
extern int xnx_fpathconf(int fildes, int name);