From f5c14a5dc45cac288ee5ba7a7a8d808630533191 Mon Sep 17 00:00:00 2001 From: Stefanos Stefanidis Date: Fri, 4 Nov 2022 19:36:11 +0200 Subject: [PATCH] Upload part 2 of source. --- usr/src/:mk | 47 +- usr/src/:mkcmd | 4 +- usr/src/:mkhead | 4 +- usr/src/:mklib | 6 +- usr/src/:mkstand | 4 +- usr/src/:mksyshead | 14 +- usr/src/:mkuts | 4 +- usr/src/arglist | 4 +- usr/src/head/archives.h | 12 +- usr/src/head/filehdr.h | 5 +- usr/src/head/fmtmsg.h | 13 +- usr/src/head/ftw.h | 8 +- usr/src/head/grp.h | 4 +- usr/src/head/ieeefp.h | 12 +- usr/src/head/libelf.h | 3 +- usr/src/head/libgenIO.h | 6 +- usr/src/head/limits.h | 17 +- usr/src/head/link.h | 5 +- usr/src/head/malloc.h | 3 +- usr/src/head/math.h | 13 +- usr/src/head/math.h3b5x | 6 - usr/src/head/mon.h | 4 +- usr/src/head/netdb.h | 9 +- usr/src/head/nl_types.h | 6 +- usr/src/head/nsaddr.h | 10 +- usr/src/head/osfcn.h | 81 + usr/src/head/pkgdev.h | 6 +- usr/src/head/pkgtrans.h | 3 +- usr/src/head/rpc/mp.h | 49 + usr/src/head/sac.h | 11 +- usr/src/head/search.h | 8 +- usr/src/head/sgtty.h | 13 +- usr/src/head/shadow.h | 6 +- usr/src/head/signal.h | 6 +- usr/src/head/stdlib.h | 6 +- usr/src/head/string.h | 3 +- usr/src/head/sys.u3b15 | 6 - usr/src/head/sys.u3b5 | 6 - usr/src/head/tar.h | 4 +- usr/src/head/time.h | 21 +- usr/src/head/tiuser.h | 4 +- usr/src/head/unistd.h | 81 +- usr/src/head/userdefs.h | 4 +- usr/src/head/utmp.h | 6 +- usr/src/head/utmpx.h | 24 +- usr/src/head/values.h3b5x | 6 - usr/src/ldflags | 4 +- usr/src/lib/.lib.mk | 22 +- usr/src/lib/libadm/ckdate.c | 82 +- usr/src/lib/libadm/ckgid.c | 21 +- usr/src/lib/libadm/ckint.c | 10 +- usr/src/lib/libadm/ckitem.c | 24 +- usr/src/lib/libadm/ckpath.c | 12 +- usr/src/lib/libadm/ckrange.c | 12 +- usr/src/lib/libadm/ckstr.c | 4 +- usr/src/lib/libadm/cktime.c | 84 +- usr/src/lib/libadm/ckuid.c | 21 +- usr/src/lib/libadm/getvol.c | 4 +- usr/src/lib/libadm/libadm.mk | 4 +- usr/src/lib/libadm/puttext.c | 4 +- usr/src/lib/libc/inc/synonyms.h | 101 +- usr/src/lib/libc/libc.mk | 15 +- usr/src/lib/libc/m32/abi_objects | 23 +- usr/src/lib/libc/m32/ansi.def | 21 +- usr/src/lib/libc/m32/crt/cerror.s | 6 - usr/src/lib/libc/m32/crt/mcount.s | 112 +- usr/src/lib/libc/m32/csu/crt0.s | 6 - usr/src/lib/libc/m32/csu/crt1.s | 14 +- usr/src/lib/libc/m32/csu/crti.s | 6 - usr/src/lib/libc/m32/csu/crtn.s | 6 - usr/src/lib/libc/m32/csu/fcrt0.s | 279 ++ usr/src/lib/libc/m32/csu/fcrt1.s | 288 ++ usr/src/lib/libc/m32/csu/fmcrt0.s | 348 ++ usr/src/lib/libc/m32/csu/fmcrt1.s | 362 ++ usr/src/lib/libc/m32/csu/mcrt0.s | 6 - usr/src/lib/libc/m32/csu/mcrt1.s | 18 +- usr/src/lib/libc/m32/csu/pcrt0.s | 6 - usr/src/lib/libc/m32/csu/pcrt1.s | 12 +- usr/src/lib/libc/m32/csu/pcrti.s | 6 - usr/src/lib/libc/m32/csu/pcrtn.s | 6 - usr/src/lib/libc/m32/fp/dround.s | 6 - usr/src/lib/libc/m32/fp/dspecial.s | 6 - usr/src/lib/libc/m32/fp/faddd.s | 6 - usr/src/lib/libc/m32/fp/fadds.s | 6 - usr/src/lib/libc/m32/fp/fcmpd.s | 6 - usr/src/lib/libc/m32/fp/fcmps.s | 6 - usr/src/lib/libc/m32/fp/fdivd.s | 6 - usr/src/lib/libc/m32/fp/fdivs.s | 6 - usr/src/lib/libc/m32/fp/fdtos.s | 6 - usr/src/lib/libc/m32/fp/fltod.s | 6 - usr/src/lib/libc/m32/fp/fltos.s | 6 - usr/src/lib/libc/m32/fp/fmuld.s | 6 - usr/src/lib/libc/m32/fp/fmuls.s | 6 - usr/src/lib/libc/m32/fp/fnegd.s | 6 - usr/src/lib/libc/m32/fp/fnegs.s | 6 - usr/src/lib/libc/m32/fp/fpgetmask.s | 6 - usr/src/lib/libc/m32/fp/fpgetrnd.s | 6 - usr/src/lib/libc/m32/fp/fpgetsticky.s | 6 - usr/src/lib/libc/m32/fp/fpsetmask.s | 6 - usr/src/lib/libc/m32/fp/fpsetrnd.s | 6 - usr/src/lib/libc/m32/fp/fpsetsticky.s | 6 - usr/src/lib/libc/m32/fp/fpstart.s | 6 - usr/src/lib/libc/m32/fp/fpstart0.s | 6 - usr/src/lib/libc/m32/fp/fstod.s | 6 - usr/src/lib/libc/m32/fp/ftdtol.s | 6 - usr/src/lib/libc/m32/fp/ftdtou.s | 6 - usr/src/lib/libc/m32/fp/ftstol.s | 6 - usr/src/lib/libc/m32/fp/ftstou.s | 6 - usr/src/lib/libc/m32/fp/isnand.s | 6 - usr/src/lib/libc/m32/fp/isnanf.s | 6 - usr/src/lib/libc/m32/fp/scalb.c | 23 +- usr/src/lib/libc/m32/fp/sround.s | 6 - usr/src/lib/libc/m32/fp/sspecial.s | 6 - usr/src/lib/libc/m32/gen/abs.s | 6 - usr/src/lib/libc/m32/gen/atof.c | 3 +- usr/src/lib/libc/m32/gen/biglitpow.s | 6 - usr/src/lib/libc/m32/gen/cuexit.s | 6 - usr/src/lib/libc/m32/gen/dtop.c | 12 +- usr/src/lib/libc/m32/gen/ecvt.c | 16 +- usr/src/lib/libc/m32/gen/fptrap.s | 2112 ++++++++++++ usr/src/lib/libc/m32/gen/frexp.s | 6 - usr/src/lib/libc/m32/gen/getctxt.c | 13 +- usr/src/lib/libc/m32/gen/ladd.s | 6 - usr/src/lib/libc/m32/gen/ldexp.s | 6 - usr/src/lib/libc/m32/gen/lshiftl.s | 6 - usr/src/lib/libc/m32/gen/lsign.s | 6 - usr/src/lib/libc/m32/gen/lsub.s | 6 - usr/src/lib/libc/m32/gen/m32_data.s | 6 - usr/src/lib/libc/m32/gen/makectxt.c | 19 +- usr/src/lib/libc/m32/gen/memcpy.s | 6 - usr/src/lib/libc/m32/gen/setjmp.s | 6 - usr/src/lib/libc/m32/gen/sh_data.c | 13 +- usr/src/lib/libc/m32/gen/sigsetjmp.c | 8 +- usr/src/lib/libc/m32/gen/strcmp.s | 6 - usr/src/lib/libc/m32/gen/strcpy.s | 6 - usr/src/lib/libc/m32/gen/strlen.s | 6 - usr/src/lib/libc/m32/gen/swapctxt.c | 13 +- usr/src/lib/libc/m32/m4.def | 6 - usr/src/lib/libc/m32/makefile | 54 +- usr/src/lib/libc/m32/mcount.def | 6 - usr/src/lib/libc/m32/nonansi.def | 6 - usr/src/lib/libc/m32/nonpic.def | 6 - usr/src/lib/libc/m32/pic.def | 6 - usr/src/lib/libc/m32/print.defs | 10 +- usr/src/lib/libc/m32/print/doprnt.s | 34 +- usr/src/lib/libc/m32/print/fprintf.s | 9 +- usr/src/lib/libc/m32/print/printf.s | 9 +- usr/src/lib/libc/m32/print/sprintf.s | 6 - usr/src/lib/libc/m32/print/vfprintf.s | 9 +- usr/src/lib/libc/m32/print/vprintf.s | 9 +- usr/src/lib/libc/m32/print/vsprintf.s | 6 - usr/src/lib/libc/m32/shared_objects | 48 +- usr/src/lib/libc/m32/sys/_nfssys.s | 10 +- usr/src/lib/libc/m32/sys/_rename.s | 6 - usr/src/lib/libc/m32/sys/_sigaction.s | 6 - usr/src/lib/libc/m32/sys/_signal.s | 6 - usr/src/lib/libc/m32/sys/acancel.s | 20 + usr/src/lib/libc/m32/sys/access.s | 6 - usr/src/lib/libc/m32/sys/acct.s | 6 - usr/src/lib/libc/m32/sys/adjtime.s | 6 - usr/src/lib/libc/m32/sys/alarm.s | 6 - usr/src/lib/libc/m32/sys/brkbase.s | 20 + usr/src/lib/libc/m32/sys/chdir.s | 6 - usr/src/lib/libc/m32/sys/chmod.s | 6 - usr/src/lib/libc/m32/sys/chown.s | 6 - usr/src/lib/libc/m32/sys/chroot.s | 6 - usr/src/lib/libc/m32/sys/close.s | 6 - usr/src/lib/libc/m32/sys/creat.s | 6 - usr/src/lib/libc/m32/sys/dup.s | 6 - usr/src/lib/libc/m32/sys/evsys.s | 196 ++ usr/src/lib/libc/m32/sys/execl.s | 6 - usr/src/lib/libc/m32/sys/execle.s | 6 - usr/src/lib/libc/m32/sys/execv.s | 6 - usr/src/lib/libc/m32/sys/execve.s | 6 - usr/src/lib/libc/m32/sys/exit.s | 6 - usr/src/lib/libc/m32/sys/fchdir.s | 6 - usr/src/lib/libc/m32/sys/fchmod.s | 6 - usr/src/lib/libc/m32/sys/fchown.s | 6 - usr/src/lib/libc/m32/sys/fcntl.s | 6 - usr/src/lib/libc/m32/sys/fmount.s | 16 + usr/src/lib/libc/m32/sys/fork.s | 6 - usr/src/lib/libc/m32/sys/fstat.s | 6 - usr/src/lib/libc/m32/sys/fstatf.s | 6 - usr/src/lib/libc/m32/sys/fstatfs.s | 6 - usr/src/lib/libc/m32/sys/fstatvfs.s | 6 - usr/src/lib/libc/m32/sys/fsync.s | 6 - usr/src/lib/libc/m32/sys/funmount.s | 16 + usr/src/lib/libc/m32/sys/fxstat.s | 6 - usr/src/lib/libc/m32/sys/getdents.s | 6 - usr/src/lib/libc/m32/sys/getegid.s | 6 - usr/src/lib/libc/m32/sys/geteuid.s | 6 - usr/src/lib/libc/m32/sys/getgid.s | 6 - usr/src/lib/libc/m32/sys/getgroups.s | 6 - usr/src/lib/libc/m32/sys/getmsg.s | 11 +- usr/src/lib/libc/m32/sys/getpagesize.s | 18 + usr/src/lib/libc/m32/sys/getpid.s | 6 - usr/src/lib/libc/m32/sys/getpmsg.s | 11 +- usr/src/lib/libc/m32/sys/getppid.s | 6 - usr/src/lib/libc/m32/sys/getrlimit.s | 6 - usr/src/lib/libc/m32/sys/getuid.s | 6 - usr/src/lib/libc/m32/sys/gtty.s | 6 - usr/src/lib/libc/m32/sys/ioctl.s | 6 - usr/src/lib/libc/m32/sys/kill.s | 6 - usr/src/lib/libc/m32/sys/lchown.s | 6 - usr/src/lib/libc/m32/sys/link.s | 6 - usr/src/lib/libc/m32/sys/lseek.s | 6 - usr/src/lib/libc/m32/sys/lstat.s | 6 - usr/src/lib/libc/m32/sys/lxstat.s | 6 - usr/src/lib/libc/m32/sys/mctl.s | 18 + usr/src/lib/libc/m32/sys/memcntl.s | 6 - usr/src/lib/libc/m32/sys/mincore.s | 6 - usr/src/lib/libc/m32/sys/mkdir.s | 6 - usr/src/lib/libc/m32/sys/mknod.s | 6 - usr/src/lib/libc/m32/sys/mmap.s | 6 - usr/src/lib/libc/m32/sys/mount.s | 6 - usr/src/lib/libc/m32/sys/mprotect.s | 6 - usr/src/lib/libc/m32/sys/msgsys.c | 6 +- usr/src/lib/libc/m32/sys/munmap.s | 6 - usr/src/lib/libc/m32/sys/nice.s | 6 - usr/src/lib/libc/m32/sys/nuname.s | 6 - usr/src/lib/libc/m32/sys/open.s | 6 - usr/src/lib/libc/m32/sys/pause.s | 6 - usr/src/lib/libc/m32/sys/pipe.s | 6 - usr/src/lib/libc/m32/sys/plock.s | 6 - usr/src/lib/libc/m32/sys/poll.s | 11 +- usr/src/lib/libc/m32/sys/priocntlset.s | 6 - usr/src/lib/libc/m32/sys/profil.s | 6 - usr/src/lib/libc/m32/sys/ptrace.s | 6 - usr/src/lib/libc/m32/sys/putmsg.s | 11 +- usr/src/lib/libc/m32/sys/putpmsg.s | 11 +- usr/src/lib/libc/m32/sys/read.s | 6 - usr/src/lib/libc/m32/sys/readlink.s | 6 - usr/src/lib/libc/m32/sys/readv.s | 11 +- usr/src/lib/libc/m32/sys/rfsys.s | 6 - usr/src/lib/libc/m32/sys/rmdir.s | 6 - usr/src/lib/libc/m32/sys/sbrk.s | 6 - usr/src/lib/libc/m32/sys/seteguid.s | 10 +- usr/src/lib/libc/m32/sys/setgid.s | 6 - usr/src/lib/libc/m32/sys/setgroups.s | 6 - usr/src/lib/libc/m32/sys/setpgrp.s | 6 - usr/src/lib/libc/m32/sys/setrlimit.s | 6 - usr/src/lib/libc/m32/sys/setsid.s | 6 - usr/src/lib/libc/m32/sys/setuid.s | 6 - usr/src/lib/libc/m32/sys/sigaction.c | 18 +- usr/src/lib/libc/m32/sys/sigaltstk.s | 6 - usr/src/lib/libc/m32/sys/signal.s | 6 - usr/src/lib/libc/m32/sys/sigpending.s | 6 - usr/src/lib/libc/m32/sys/sigprocmsk.s | 6 - usr/src/lib/libc/m32/sys/sigsendset.s | 6 - usr/src/lib/libc/m32/sys/sigsuspend.s | 6 - usr/src/lib/libc/m32/sys/stat.s | 6 - usr/src/lib/libc/m32/sys/statf.s | 6 - usr/src/lib/libc/m32/sys/statfs.s | 6 - usr/src/lib/libc/m32/sys/statvfs.s | 6 - usr/src/lib/libc/m32/sys/stime.s | 6 - usr/src/lib/libc/m32/sys/stty.s | 6 - usr/src/lib/libc/m32/sys/symlink.s | 6 - usr/src/lib/libc/m32/sys/sync.s | 6 - usr/src/lib/libc/m32/sys/sys3b.s | 6 - usr/src/lib/libc/m32/sys/syscall.s | 6 - usr/src/lib/libc/m32/sys/sysconfig.s | 6 - usr/src/lib/libc/m32/sys/sysfs.s | 6 - usr/src/lib/libc/m32/sys/sysinfo.s | 18 +- usr/src/lib/libc/m32/sys/time.s | 6 - usr/src/lib/libc/m32/sys/times.s | 6 - usr/src/lib/libc/m32/sys/uadmin.s | 6 - usr/src/lib/libc/m32/sys/ucontext.s | 6 - usr/src/lib/libc/m32/sys/ulimit.s | 6 - usr/src/lib/libc/m32/sys/umask.s | 6 - usr/src/lib/libc/m32/sys/umount.s | 6 - usr/src/lib/libc/m32/sys/uname.s | 6 - usr/src/lib/libc/m32/sys/unlink.s | 6 - usr/src/lib/libc/m32/sys/ustat.s | 6 - usr/src/lib/libc/m32/sys/utime.s | 6 - usr/src/lib/libc/m32/sys/utssys.s | 6 - usr/src/lib/libc/m32/sys/vfork.s | 18 +- usr/src/lib/libc/m32/sys/wait.s | 6 - usr/src/lib/libc/m32/sys/waitid.s | 6 - usr/src/lib/libc/m32/sys/write.s | 6 - usr/src/lib/libc/m32/sys/writev.s | 11 +- usr/src/lib/libc/m32/sys/xmknod.s | 6 - usr/src/lib/libc/m32/sys/xstat.s | 6 - usr/src/lib/libc/port/gen/_ctype.c | 4 +- usr/src/lib/libc/port/gen/_locale.c | 6 +- usr/src/lib/libc/port/gen/_set_tab.c | 4 +- usr/src/lib/libc/port/gen/_xftw.c | 3 +- usr/src/lib/libc/port/gen/aread.c | 80 + usr/src/lib/libc/port/gen/assert.c | 4 +- usr/src/lib/libc/port/gen/asyncio.c | 103 + usr/src/lib/libc/port/gen/awrite.c | 81 + usr/src/lib/libc/port/gen/cat_init.c | 82 +- usr/src/lib/libc/port/gen/catclose.c | 10 +- usr/src/lib/libc/port/gen/catgets.c | 13 +- usr/src/lib/libc/port/gen/catopen.c | 25 +- usr/src/lib/libc/port/gen/cftime.c | 4 +- usr/src/lib/libc/port/gen/crypt.c | 7 +- usr/src/lib/libc/port/gen/ctype.c | 61 +- usr/src/lib/libc/port/gen/ctypefcns.c | 9 +- usr/src/lib/libc/port/gen/dial.mk | 121 + usr/src/lib/libc/port/gen/dup2.c | 4 +- usr/src/lib/libc/port/gen/errlist | 68 +- usr/src/lib/libc/port/gen/errlist.awk | 6 - usr/src/lib/libc/port/gen/events.c | 472 +++ usr/src/lib/libc/port/gen/execvp.c | 12 +- usr/src/lib/libc/port/gen/fmtmsg.c | 18 +- usr/src/lib/libc/port/gen/getgrbuf.c | 63 + usr/src/lib/libc/port/gen/getgrent.c | 140 +- usr/src/lib/libc/port/gen/getgrgid.c | 34 + usr/src/lib/libc/port/gen/getgrnam.c | 179 +- usr/src/lib/libc/port/gen/getlogin.c | 4 +- usr/src/lib/libc/port/gen/getopt.c | 6 +- usr/src/lib/libc/port/gen/getpwbuf.c | 88 + usr/src/lib/libc/port/gen/getpwent.c | 103 +- usr/src/lib/libc/port/gen/getpwnam.c | 193 +- usr/src/lib/libc/port/gen/getpwuid.c | 33 + usr/src/lib/libc/port/gen/getspent.c | 4 +- usr/src/lib/libc/port/gen/gettimeofday.c | 4 +- usr/src/lib/libc/port/gen/gettxt.c | 6 +- usr/src/lib/libc/port/gen/getut.c | 405 +-- usr/src/lib/libc/port/gen/getutx.c | 356 +- usr/src/lib/libc/port/gen/hrtcftime.c | 10 +- usr/src/lib/libc/port/gen/hrtctime.c | 10 +- usr/src/lib/libc/port/gen/hrtnewres.c | 7 +- usr/src/lib/libc/port/gen/hrtstrftime.c | 9 +- usr/src/lib/libc/port/gen/initgroups.c | 16 +- usr/src/lib/libc/port/gen/localeconv.c | 4 +- usr/src/lib/libc/port/gen/lsearch.c | 4 +- usr/src/lib/libc/port/gen/makefile | 62 +- usr/src/lib/libc/port/gen/mkfifo.c | 8 +- usr/src/lib/libc/port/gen/modf.c | 7 +- usr/src/lib/libc/port/gen/mon.c | 432 ++- usr/src/lib/libc/port/gen/nftw.c | 44 +- usr/src/lib/libc/port/gen/nl_langinfo.c | 262 +- usr/src/lib/libc/port/gen/opendir.c | 8 +- usr/src/lib/libc/port/gen/pathconf.c | 126 + usr/src/lib/libc/port/gen/psiginfo.c | 6 +- usr/src/lib/libc/port/gen/pt.c | 14 +- usr/src/lib/libc/port/gen/putenv.c | 4 +- usr/src/lib/libc/port/gen/putpwbuf.c | 149 + usr/src/lib/libc/port/gen/putpwent.c | 41 +- usr/src/lib/libc/port/gen/realpath.c | 410 +-- usr/src/lib/libc/port/gen/rename.c | 12 +- usr/src/lib/libc/port/gen/select.c | 24 +- usr/src/lib/libc/port/gen/setlocale.c | 42 +- usr/src/lib/libc/port/gen/siginfolst.c | 103 + usr/src/lib/libc/port/gen/sigsetops.c | 18 +- usr/src/lib/libc/port/gen/strftime.c | 69 +- usr/src/lib/libc/port/gen/strmount.c | 37 + usr/src/lib/libc/port/gen/strtol.c | 7 +- usr/src/lib/libc/port/gen/strtoul.c | 24 +- usr/src/lib/libc/port/gen/strumount.c | 25 + usr/src/lib/libc/port/gen/sysconf.c | 14 +- usr/src/lib/libc/port/gen/syslog.c | 20 +- usr/src/lib/libc/port/gen/tfind.c | 4 +- usr/src/lib/libc/port/gen/time_comm.c | 339 +- usr/src/lib/libc/port/gen/time_data.c | 4 +- usr/src/lib/libc/port/gen/time_gdata.c | 6 +- usr/src/lib/libc/port/gen/tsearch.c | 3 +- usr/src/lib/libc/port/gen/ttyname.c | 12 +- usr/src/lib/libc/port/gen/valloc.c | 9 +- usr/src/lib/libc/port/gen/values-Xa.c | 3 +- usr/src/lib/libc/port/gen/values-Xc.c | 4 +- usr/src/lib/libc/port/gen/values-Xt.c | 3 +- usr/src/lib/libc/port/gen/waitpid.c | 21 +- usr/src/lib/libc/port/print/doprnt.c | 12 +- usr/src/lib/libc/port/print/fprintf.c | 4 +- usr/src/lib/libc/port/print/makefile | 4 +- usr/src/lib/libc/port/print/printf.c | 4 +- usr/src/lib/libc/port/print/vfprintf.c | 4 +- usr/src/lib/libc/port/print/vprintf.c | 4 +- usr/src/lib/libc/port/stdio/_filbuf.c | 7 +- usr/src/lib/libc/port/stdio/_wrtchk.c | 4 +- usr/src/lib/libc/port/stdio/cuserid.c | 4 +- usr/src/lib/libc/port/stdio/doscan.c | 14 +- usr/src/lib/libc/port/stdio/fdopen.c | 7 +- usr/src/lib/libc/port/stdio/fgets.c | 7 +- usr/src/lib/libc/port/stdio/flush.c | 14 +- usr/src/lib/libc/port/stdio/fopen.c | 4 +- usr/src/lib/libc/port/stdio/fputs.c | 8 +- usr/src/lib/libc/port/stdio/fread.c | 4 +- usr/src/lib/libc/port/stdio/fseek.c | 5 +- usr/src/lib/libc/port/stdio/gets.c | 7 +- usr/src/lib/libc/port/stdio/popen.c | 8 +- usr/src/lib/libc/port/stdio/putw.c | 6 +- usr/src/lib/libc/port/stdio/stdiom.h | 5 +- usr/src/lib/libc/port/stdio/system.c | 29 +- usr/src/lib/libc/port/stdio/tempnam.c | 12 +- usr/src/lib/libc/port/sys/execl.c | 19 +- usr/src/lib/libc/port/sys/execle.c | 27 +- usr/src/lib/libc/port/sys/hrtsys.c | 7 +- usr/src/lib/libc/port/sys/makefile | 4 +- usr/src/lib/libc/port/sys/msgsys.c | 6 +- usr/src/lib/libcrypt/__Ext_Synonyms | 15 + usr/src/lib/libcrypt/cryptio.c | 30 +- usr/src/lib/libcrypt/des_crypt.c | 6 +- usr/src/lib/libdl/libdl.mk | 11 +- usr/src/lib/libdl/m32/dlclose.s | 6 - usr/src/lib/libdl/m32/dlerror.s | 6 - usr/src/lib/libdl/m32/dlopen.s | 6 - usr/src/lib/libdl/m32/dlsym.s | 6 - usr/src/lib/libgen/getdate.c | 886 +++++ usr/src/lib/libgen/libgen.h | 4 +- usr/src/lib/libgen/libgen.mk | 18 +- usr/src/lib/libgen/mklib-dot-h | 6 - usr/src/lib/libgen/p2open.c | 21 +- usr/src/lib/libgen/reg_compile.c | 4 +- usr/src/lib/libgen/reg_step.c | 4 +- usr/src/lib/libgenIO/g_init.c | 22 +- usr/src/lib/libl/lib/ncform | 6 - usr/src/lib/libl/lib/nrform | 6 - usr/src/lib/libm/m32_sfm/atanf.m | 6 - usr/src/lib/libm/m32_sfm/cosf.m | 6 - usr/src/lib/libm/m32_sfm/expf.m | 6 - usr/src/lib/libm/m32_sfm/log10f.m | 6 - usr/src/lib/libm/m32_sfm/logf.m | 6 - usr/src/lib/libm/m32_sfm/sinf.m | 6 - usr/src/lib/libm/m32_sfm/sqrtf.m | 6 - usr/src/lib/libm/m32_sfm/tanf.m | 6 - usr/src/lib/libm/m32mau/atan.s | 6 - usr/src/lib/libm/m32mau/atanf.s | 6 - usr/src/lib/libm/m32mau/exp.s | 6 - usr/src/lib/libm/m32mau/expf.s | 6 - usr/src/lib/libm/m32mau/log.s | 6 - usr/src/lib/libm/m32mau/logf.s | 6 - usr/src/lib/libm/m32mau/m4.def | 6 - usr/src/lib/libm/m32mau/mcount.def | 6 - usr/src/lib/libm/m32mau/reduce.s | 6 - usr/src/lib/libm/m32mau/reducef.s | 6 - usr/src/lib/libm/m32mau/sin.s | 6 - usr/src/lib/libm/m32mau/sinf.s | 6 - usr/src/lib/libm/m32mau/sqrt.s | 6 - usr/src/lib/libm/m32mau/sqrtf.s | 6 - usr/src/lib/libm/port/pow.c | 10 +- usr/src/lib/libm/port/powf.c | 9 +- usr/src/lib/libmalloc/__Ext_Synonyms | 5 + usr/src/lib/libmalloc/libmalloc.mk | 6 +- usr/src/lib/libmalloc/malloc.c | 24 +- usr/src/lib/libmp/gcd.c | 127 + usr/src/lib/libmp/libmp.mk | 68 + usr/src/lib/libmp/madd.c | 222 ++ usr/src/lib/libmp/mdiv.c | 249 ++ usr/src/lib/libmp/mout.c | 210 ++ usr/src/lib/libmp/msqrt.c | 89 + usr/src/lib/libmp/mult.c | 147 + usr/src/lib/libmp/ngcd.c | 127 + usr/src/lib/libmp/pow.c | 96 + usr/src/lib/libmp/util.c | 295 ++ usr/src/lib/libnls/libnls.mk | 6 +- usr/src/lib/libns/libns.mk | 6 +- usr/src/lib/libns/negotiate.c | 11 +- usr/src/lib/libns/rfs_up.c | 3 +- usr/src/lib/libns/uidmap.c | 5 +- usr/src/lib/libnsl/dial/callers.c | 12 +- usr/src/lib/libnsl/dial/dial.c | 65 +- usr/src/lib/libnsl/dial/dial.mk | 3 +- usr/src/lib/libnsl/dial/interface.c | 4 +- usr/src/lib/libnsl/dial/line.c | 11 +- usr/src/lib/libnsl/dial/parms.h | 4 +- usr/src/lib/libnsl/dial/uucp.h | 4 +- usr/src/lib/libnsl/libnsl.mk | 14 +- usr/src/lib/libnsl/netdir/netdir.c | 9 +- usr/src/lib/libnsl/nsl/_conn_util.c | 5 +- usr/src/lib/libnsl/nsl/_utility.c | 10 +- usr/src/lib/libnsl/nsl/t_connect.c | 5 +- usr/src/lib/libnsl/nsl/t_open.c | 11 +- usr/src/lib/libnsl/nsl/t_snd.c | 11 +- usr/src/lib/libnsl/nsl/t_sndudata.c | 9 +- usr/src/lib/libnsl/rpc/auth_des.c | 60 +- usr/src/lib/libnsl/rpc/clnt_bcast.c | 340 +- usr/src/lib/libnsl/rpc/clnt_generic.c | 8 +- usr/src/lib/libnsl/rpc/clnt_perror.c | 19 +- usr/src/lib/libnsl/rpc/clnt_raw.c | 13 +- usr/src/lib/libnsl/rpc/clnt_vc.c | 3 +- usr/src/lib/libnsl/rpc/getdname.c | 13 +- usr/src/lib/libnsl/rpc/gthostnamadr.c | 87 +- usr/src/lib/libnsl/rpc/key_call.c | 110 +- usr/src/lib/libnsl/rpc/netnamer.c | 120 +- usr/src/lib/libnsl/rpc/rpc.mk | 27 +- usr/src/lib/libnsl/rpc/rpc_generic.c | 8 +- usr/src/lib/libnsl/rpc/rpcb_clnt.c | 105 +- usr/src/lib/libnsl/rpc/rpcb_prot.c | 28 +- usr/src/lib/libnsl/rpc/svc_dg.c | 52 +- usr/src/lib/libnsl/rpc/svc_generic.c | 24 +- usr/src/lib/libnsl/rpc/svc_raw.c | 10 +- usr/src/lib/libnsl/rpc/svc_run.c | 27 +- usr/src/lib/libnsl/rpc/svc_vc.c | 172 +- usr/src/lib/libnsl/saf/doconfig.c | 6 +- usr/src/lib/libnsl/saf/saf.mk | 32 +- usr/src/lib/libnsl/saf/ut.c | 688 ++++ usr/src/lib/libnsl/saf/utx.c | 678 ++++ usr/src/lib/libnsl/yp/dbm.c | 4 +- usr/src/lib/libnsl/yp/yp.mk | 9 +- usr/src/lib/libnsl/yp/yp_all.c | 7 +- usr/src/lib/libnsl/yp/yp_b.h | 34 +- usr/src/lib/libnsl/yp/yp_b_xdr.c | 63 +- usr/src/lib/libnsl/yp/yp_bind.c | 27 +- usr/src/lib/libnsl/yp/yp_enum.c | 5 +- usr/src/lib/libnsl/yp/yp_master.c | 6 +- usr/src/lib/libnsl/yp/yp_match.c | 4 +- usr/src/lib/libnsl/yp/yp_order.c | 5 +- usr/src/lib/libnsl/yp/yp_update.c | 60 +- usr/src/lib/libnsl/yp/yperr_string.c | 5 +- usr/src/lib/libnsl/yp/ypmaint_xdr.c | 38 +- usr/src/lib/libnsl/yp/ypupd.c | 4 +- usr/src/lib/libnsl/yp/ypupd.h | 76 + usr/src/lib/libnsl/yp/ypxdr.c | 6 +- usr/src/lib/libpkg/ckvolseq.c | 20 +- usr/src/lib/libpkg/devtype.c | 73 +- usr/src/lib/libpkg/dstream.c | 392 +-- usr/src/lib/libpkg/gpkglist.c | 27 +- usr/src/lib/libpkg/gpkgmap.c | 7 +- usr/src/lib/libpkg/libpkg.mk | 280 +- usr/src/lib/libpkg/pkgexecv.c | 9 +- usr/src/lib/libpkg/pkgmount.c | 32 +- usr/src/lib/libpkg/pkgtrans.c | 515 +-- usr/src/lib/libpkg/pkgxpand.c | 5 +- usr/src/lib/libpkg/ppkgmap.c | 14 +- usr/src/lib/libpkg/putcfile.c | 14 +- usr/src/lib/libpkg/runcmd.c | 72 +- usr/src/lib/libpkg/srchcfile.c | 11 +- usr/src/lib/libpkg/tputcfent.c | 18 +- usr/src/lib/libpkg/verify.c | 14 +- usr/src/lib/libpt/libpt.c | 149 + usr/src/lib/libpt/libpt.mk | 67 + usr/src/lib/libpt/pt_chmod.c | 51 + usr/src/lib/libresolv/gthostnamadr.c | 3 +- usr/src/lib/libresolv/libresolv.mk | 113 +- usr/src/lib/libresolv/res_comp.c | 3 +- usr/src/lib/libresolv/res_debug.c | 3 +- usr/src/lib/libresolv/res_init.c | 3 +- usr/src/lib/libresolv/res_mkquery.c | 3 +- usr/src/lib/libresolv/res_query.c | 7 +- usr/src/lib/libresolv/res_send.c | 3 +- usr/src/lib/libresolv/sethostent.c | 3 +- usr/src/lib/libresolv/strcasecmp.c | 4 +- usr/src/lib/librpcsvc/publickey.c | 12 +- usr/src/lib/libsocket/inet/bindresvport.c | 4 +- usr/src/lib/libsocket/inet/inet.mk | 5 +- usr/src/lib/libsocket/inet/rcmd.c | 10 +- usr/src/lib/libsocket/libsocket.mk | 25 +- usr/src/lib/libsocket/socket/_conn_util.c | 36 +- usr/src/lib/libsocket/socket/_utility.c | 426 ++- usr/src/lib/libsocket/socket/accept.c | 83 +- usr/src/lib/libsocket/socket/bind.c | 55 +- usr/src/lib/libsocket/socket/connect.c | 51 +- usr/src/lib/libsocket/socket/getpeernm.c | 28 +- usr/src/lib/libsocket/socket/getsocknm.c | 28 +- usr/src/lib/libsocket/socket/listen.c | 16 +- usr/src/lib/libsocket/socket/s_ioctl.c | 206 +- usr/src/lib/libsocket/socket/socket.mk | 5 +- usr/src/lib/libsocket/socket/socketpair.c | 6 +- usr/src/lib/libw/_wchar.h | 31 +- usr/src/lib/libw/getwidth.c | 23 +- usr/src/lib/libw/mbftowc.c | 23 +- usr/src/lib/libw/scrwidth.c | 12 +- usr/src/lib/libwindows/libwindows.mk | 6 +- usr/src/lib/nametoaddr/nametoaddr.mk | 52 +- usr/src/lib/nametoaddr/npack/npack.c | 621 ++++ usr/src/lib/nametoaddr/npack/npack.mk | 59 + usr/src/lib/nametoaddr/straddr/straddr.c | 28 +- usr/src/lib/nametoaddr/tcpip/file_db.c | 4 +- usr/src/lib/nametoaddr/tcpip/tcpip.c | 13 +- usr/src/lib/nametoaddr/tcpip/tcpip.mk | 6 +- usr/src/lib/rtld/common/dlfcns.c | 20 +- usr/src/lib/rtld/common/externs.h | 3 +- usr/src/lib/rtld/common/globals.c | 3 +- usr/src/lib/rtld/common/map.c | 40 +- usr/src/lib/rtld/common/paths.c | 10 +- usr/src/lib/rtld/common/rtfcns.c | 10 +- usr/src/lib/rtld/common/rtld.c | 16 +- usr/src/lib/rtld/common/rtld.h | 3 +- usr/src/lib/rtld/i386/align.s | 7 + usr/src/lib/rtld/i386/clrpage.s | 29 + usr/src/lib/rtld/i386/genset.awk | 133 + usr/src/lib/rtld/i386/genset.in | 33 + usr/src/lib/rtld/i386/rtmemcpy.s | 26 + usr/src/lib/rtld/m32/align.s | 6 - usr/src/lib/rtld/m32/binder.c | 6 +- usr/src/lib/rtld/m32/clrpage.s | 6 - usr/src/lib/rtld/m32/genset.awk | 6 - usr/src/lib/rtld/m32/genset.in | 23 +- usr/src/lib/rtld/m32/machdep.h | 10 +- usr/src/lib/rtld/m32/makefile | 14 +- usr/src/lib/rtld/m32/reloc.c | 10 +- usr/src/lib/rtld/m32/rtbinder.s | 6 - usr/src/lib/rtld/m32/rtboot.s | 6 - usr/src/lib/rtld/m32/rtisastream.c | 36 + usr/src/lib/rtld/m32/rtmemcpy.s | 6 - usr/src/lib/rtld/m32/rtsetup.c | 10 +- usr/src/lib/rtld/m32/rtsyscall.s | 6 - usr/src/lib/terminfo/Doc.sed | 25 + usr/src/lib/terminfo/README | 147 + usr/src/lib/terminfo/adds.ti | 85 + usr/src/lib/terminfo/annarbor.ti | 200 ++ usr/src/lib/terminfo/ansi.ti | 143 + usr/src/lib/terminfo/att.ti | 2778 +++++++++++++++ usr/src/lib/terminfo/beehive.ti | 118 + usr/src/lib/terminfo/cdc.ti | 22 + usr/src/lib/terminfo/ckout | 11 + usr/src/lib/terminfo/colorscan.ti | 24 + usr/src/lib/terminfo/cvt.ex | 165 + usr/src/lib/terminfo/cvt.h | 188 + usr/src/lib/terminfo/cvt.sed | 124 + usr/src/lib/terminfo/datamedia.ti | 77 + usr/src/lib/terminfo/dec.ti | 223 ++ usr/src/lib/terminfo/diablo.ti | 82 + usr/src/lib/terminfo/fortune.ti | 87 + usr/src/lib/terminfo/general.ti | 46 + usr/src/lib/terminfo/hardcopy.ti | 27 + usr/src/lib/terminfo/hazeltine.ti | 143 + usr/src/lib/terminfo/hds.ti | 295 ++ usr/src/lib/terminfo/header | 47 + usr/src/lib/terminfo/heath.ti | 108 + usr/src/lib/terminfo/homebrew.ti | 75 + usr/src/lib/terminfo/hp.ti | 497 +++ usr/src/lib/terminfo/lsi.ti | 90 + usr/src/lib/terminfo/microterm.ti | 115 + usr/src/lib/terminfo/misc.ti | 740 ++++ usr/src/lib/terminfo/pc.ti | 739 ++++ usr/src/lib/terminfo/perkinelmer.ti | 79 + usr/src/lib/terminfo/print.ti | 104 + usr/src/lib/terminfo/special.ti | 36 + usr/src/lib/terminfo/sperry.ti | 47 + usr/src/lib/terminfo/tabset/3101 | 1 + usr/src/lib/terminfo/tabset/beehive | 2 + usr/src/lib/terminfo/tabset/hds | 10 + usr/src/lib/terminfo/tabset/hds3 | 10 + usr/src/lib/terminfo/tabset/std | 1 + usr/src/lib/terminfo/tabset/teleray | 1 + usr/src/lib/terminfo/tabset/vt100 | 3 + usr/src/lib/terminfo/tabset/xerox1720 | 2 + usr/src/lib/terminfo/tektronix.ti | 301 ++ usr/src/lib/terminfo/teleray.ti | 53 + usr/src/lib/terminfo/televideo.ti | 281 ++ usr/src/lib/terminfo/termcap | 1913 +++++++++++ usr/src/lib/terminfo/terminfo.mk | 89 + usr/src/lib/terminfo/ti.ti | 20 + usr/src/lib/terminfo/trailer | 69 + usr/src/lib/terminfo/tymshare.ti | 24 + usr/src/lib/terminfo/visual.ti | 94 + usr/src/lib/terminfo/wyse.ti | 296 ++ usr/src/lib/xlibcurses/demo/.menu.data | 6 - usr/src/lib/xlibcurses/demo/aliens.6 | 6 - usr/src/lib/xlibcurses/demo/ft | 6 - usr/src/lib/xlibcurses/demo/menu.readme | 6 - usr/src/lib/xlibcurses/demo/pacman/README | 6 - usr/src/lib/xlibcurses/demo/pacman/pacman.6 | 6 - usr/src/lib/xlibcurses/demo/rain.6 | 6 - usr/src/lib/xlibcurses/demo/window/README | 6 - usr/src/lib/xlibcurses/demo/window/window.1 | 6 - usr/src/lib/xlibcurses/demo/worms.6 | 6 - usr/src/lib/xlibcurses/screen/caps | 10 +- usr/src/lib/xlibcurses/screen/captoinfo.c | 11 +- usr/src/lib/xlibcurses/screen/chgtinfo.1 | 6 - usr/src/lib/xlibcurses/screen/chgtinfo.c | 9 +- usr/src/lib/xlibcurses/screen/compiler.h | 5 +- usr/src/lib/xlibcurses/screen/curses.ed | 116 +- usr/src/lib/xlibcurses/screen/draino.c | 5 +- usr/src/lib/xlibcurses/screen/llib-lcurses | 6 - usr/src/lib/xlibcurses/screen/makefile | 18 +- usr/src/lib/xlibcurses/screen/makefile.bsd | 8 +- usr/src/lib/xlibcurses/screen/otermcap.c | 9 +- usr/src/lib/xlibcurses/screen/print.c | 11 +- usr/src/lib/xlibcurses/screen/rmident.sh | 4 +- usr/src/lib/xlibcurses/screen/setupterm.c | 15 +- usr/src/lib/xlibcurses/screen/termcap.ed | 6 +- usr/src/lib/xlibcurses/screen/termerr.c | 5 +- usr/src/lib/xlibcurses/screen/tic_main.c | 8 +- usr/src/lib/xlibcurses/screen/uparm.h | 51 + usr/src/lib/xlibcurses/xlibcurses.mk | 3 +- usr/src/lib/zlibeti/curses/INSTALL | 83 + usr/src/lib/zlibeti/curses/ORDER.1 | 1 + usr/src/lib/zlibeti/curses/ORDER.2 | 1 + usr/src/lib/zlibeti/curses/ORDER.3 | 1 + usr/src/lib/zlibeti/curses/Rlist.svr2curs | 15 + usr/src/lib/zlibeti/curses/UNINSTALL | 80 + usr/src/lib/zlibeti/curses/proto.1 | 47 + usr/src/lib/zlibeti/curses/proto.2 | 51 + usr/src/lib/zlibeti/curses/proto.3 | 44 + usr/src/lib/zlibeti/curses/setup | 262 ++ usr/src/lib/zlibeti/curses/svr2curs.name | 1 + usr/src/lib/zlibeti/demo/form0.c | 2 +- usr/src/lib/zlibeti/demo/form1.c | 2 +- usr/src/lib/zlibeti/demo/form2.c | 4 +- usr/src/lib/zlibeti/demo/makefile | 2 +- usr/src/lib/zlibeti/demo/menu0.c | 2 +- usr/src/lib/zlibeti/demo/menu1.c | 2 +- usr/src/lib/zlibeti/eti.h | 2 +- usr/src/lib/zlibeti/form/chg_char.c | 2 +- usr/src/lib/zlibeti/form/chg_data.c | 2 +- usr/src/lib/zlibeti/form/chg_field.c | 2 +- usr/src/lib/zlibeti/form/chg_page.c | 2 +- usr/src/lib/zlibeti/form/driver.c | 2 +- usr/src/lib/zlibeti/form/field.c | 2 +- usr/src/lib/zlibeti/form/field_back.c | 2 +- usr/src/lib/zlibeti/form/field_buf.c | 2 +- usr/src/lib/zlibeti/form/field_fore.c | 2 +- usr/src/lib/zlibeti/form/field_init.c | 2 +- usr/src/lib/zlibeti/form/field_just.c | 2 +- usr/src/lib/zlibeti/form/field_opts.c | 2 +- usr/src/lib/zlibeti/form/field_pad.c | 2 +- usr/src/lib/zlibeti/form/field_stat.c | 2 +- usr/src/lib/zlibeti/form/field_term.c | 2 +- usr/src/lib/zlibeti/form/field_user.c | 2 +- usr/src/lib/zlibeti/form/fieldtype.c | 2 +- usr/src/lib/zlibeti/form/form.c | 2 +- usr/src/lib/zlibeti/form/form.h | 2 +- usr/src/lib/zlibeti/form/form_init.c | 2 +- usr/src/lib/zlibeti/form/form_opts.c | 2 +- usr/src/lib/zlibeti/form/form_sub.c | 2 +- usr/src/lib/zlibeti/form/form_term.c | 2 +- usr/src/lib/zlibeti/form/form_user.c | 2 +- usr/src/lib/zlibeti/form/form_win.c | 2 +- usr/src/lib/zlibeti/form/llib-lform.c | 2 +- usr/src/lib/zlibeti/form/makefile | 4 +- usr/src/lib/zlibeti/form/post.c | 2 +- usr/src/lib/zlibeti/form/regcmp.c | 2 +- usr/src/lib/zlibeti/form/regex.c | 2 +- usr/src/lib/zlibeti/form/ty_alnum.c | 2 +- usr/src/lib/zlibeti/form/ty_alpha.c | 2 +- usr/src/lib/zlibeti/form/ty_enum.c | 2 +- usr/src/lib/zlibeti/form/ty_int.c | 2 +- usr/src/lib/zlibeti/form/ty_num.c | 2 +- usr/src/lib/zlibeti/form/ty_regexp.c | 2 +- usr/src/lib/zlibeti/form/utility.c | 2 +- usr/src/lib/zlibeti/form/utility.h | 2 +- usr/src/lib/zlibeti/man3/menu.3c | 132 + usr/src/lib/zlibeti/menu/affect.c | 2 +- usr/src/lib/zlibeti/menu/chk.c | 2 +- usr/src/lib/zlibeti/menu/connect.c | 2 +- usr/src/lib/zlibeti/menu/curitem.c | 2 +- usr/src/lib/zlibeti/menu/driver.c | 2 +- usr/src/lib/zlibeti/menu/global.c | 2 +- usr/src/lib/zlibeti/menu/itemcount.c | 2 +- usr/src/lib/zlibeti/menu/itemopts.c | 2 +- usr/src/lib/zlibeti/menu/itemusrptr.c | 2 +- usr/src/lib/zlibeti/menu/itemvalue.c | 2 +- usr/src/lib/zlibeti/menu/link.c | 2 +- usr/src/lib/zlibeti/menu/llib-lmenu.c | 2 +- usr/src/lib/zlibeti/menu/makefile | 4 +- usr/src/lib/zlibeti/menu/menu.h | 2 +- usr/src/lib/zlibeti/menu/menuback.c | 2 +- usr/src/lib/zlibeti/menu/menucursor.c | 2 +- usr/src/lib/zlibeti/menu/menufore.c | 2 +- usr/src/lib/zlibeti/menu/menuformat.c | 2 +- usr/src/lib/zlibeti/menu/menugrey.c | 2 +- usr/src/lib/zlibeti/menu/menuitems.c | 2 +- usr/src/lib/zlibeti/menu/menumark.c | 2 +- usr/src/lib/zlibeti/menu/menuopts.c | 2 +- usr/src/lib/zlibeti/menu/menupad.c | 2 +- usr/src/lib/zlibeti/menu/menuserptr.c | 2 +- usr/src/lib/zlibeti/menu/menusub.c | 2 +- usr/src/lib/zlibeti/menu/menuwin.c | 2 +- usr/src/lib/zlibeti/menu/newitem.c | 2 +- usr/src/lib/zlibeti/menu/newmenu.c | 2 +- usr/src/lib/zlibeti/menu/pattern.c | 2 +- usr/src/lib/zlibeti/menu/post.c | 2 +- usr/src/lib/zlibeti/menu/private.h | 2 +- usr/src/lib/zlibeti/menu/scale.c | 2 +- usr/src/lib/zlibeti/menu/show.c | 2 +- usr/src/lib/zlibeti/menu/terminit.c | 2 +- usr/src/lib/zlibeti/menu/tests/makefile | 2 +- usr/src/lib/zlibeti/menu/topitem.c | 2 +- usr/src/lib/zlibeti/menu/visible.c | 2 +- usr/src/lib/zlibeti/panel/bottom.c | 2 +- usr/src/lib/zlibeti/panel/delete.c | 2 +- usr/src/lib/zlibeti/panel/llib-lpanel.c | 2 +- usr/src/lib/zlibeti/panel/makefile | 4 +- usr/src/lib/zlibeti/panel/misc.c | 2 +- usr/src/lib/zlibeti/panel/move.c | 2 +- usr/src/lib/zlibeti/panel/new.c | 2 +- usr/src/lib/zlibeti/panel/panel.h | 2 +- usr/src/lib/zlibeti/panel/private.h | 2 +- usr/src/lib/zlibeti/panel/replace.c | 2 +- usr/src/lib/zlibeti/panel/top.c | 2 +- usr/src/lib/zlibeti/panel/update.c | 2 +- usr/src/lib/zlibeti/zlibeti.mk | 4 +- usr/src/lib/zlibetitam/ReadMagic.c | 2 +- usr/src/lib/zlibetitam/Virt2Ansi.c | 2 +- usr/src/lib/zlibetitam/chartam.h | 2 +- usr/src/lib/zlibetitam/compat.c | 2 +- usr/src/lib/zlibetitam/cvttam.h | 2 +- usr/src/lib/zlibetitam/design.mm | 684 ++++ usr/src/lib/zlibetitam/doborder.c | 2 +- usr/src/lib/zlibetitam/envinit.c | 2 +- usr/src/lib/zlibetitam/form.c | 2 +- usr/src/lib/zlibetitam/form.h | 2 +- usr/src/lib/zlibetitam/help.c | 2 +- usr/src/lib/zlibetitam/help.h | 2 +- usr/src/lib/zlibetitam/help_ds.c | 2 +- usr/src/lib/zlibetitam/help_kb.c | 2 +- usr/src/lib/zlibetitam/kcodes.h | 2 +- usr/src/lib/zlibetitam/keypad.c | 2 +- usr/src/lib/zlibetitam/listop.c | 2 +- usr/src/lib/zlibetitam/llib-lcvt.c | 2 +- usr/src/lib/zlibetitam/llib-lform.c | 2 +- usr/src/lib/zlibetitam/llib-lmenu.c | 2 +- usr/src/lib/zlibetitam/llib-lmsg.c | 2 +- usr/src/lib/zlibetitam/llib-lpbf.c | 2 +- usr/src/lib/zlibetitam/llib-ltam.c | 4 +- usr/src/lib/zlibetitam/llib-lwind.c | 2 +- usr/src/lib/zlibetitam/man3/tam.3c | 310 ++ usr/src/lib/zlibetitam/mbegin.c | 2 +- usr/src/lib/zlibetitam/mcitems.c | 2 +- usr/src/lib/zlibetitam/mctitle.c | 2 +- usr/src/lib/zlibetitam/mdisplay.c | 2 +- usr/src/lib/zlibetitam/mend.c | 2 +- usr/src/lib/zlibetitam/menu.c | 2 +- usr/src/lib/zlibetitam/menu.h | 2 +- usr/src/lib/zlibetitam/message.c | 2 +- usr/src/lib/zlibetitam/message.h | 2 +- usr/src/lib/zlibetitam/minput.c | 2 +- usr/src/lib/zlibetitam/mmatch.c | 2 +- usr/src/lib/zlibetitam/mscroll.c | 2 +- usr/src/lib/zlibetitam/mshape.c | 2 +- usr/src/lib/zlibetitam/mtitle.c | 2 +- usr/src/lib/zlibetitam/mtrunc.c | 2 +- usr/src/lib/zlibetitam/path.h | 2 +- usr/src/lib/zlibetitam/pbf.c | 2 +- usr/src/lib/zlibetitam/pbf.h | 2 +- usr/src/lib/zlibetitam/post.c | 2 +- usr/src/lib/zlibetitam/print.h | 2 +- usr/src/lib/zlibetitam/subcurses.h | 2 +- usr/src/lib/zlibetitam/sys/font.h | 2 +- usr/src/lib/zlibetitam/sys/iohw.h | 2 +- usr/src/lib/zlibetitam/sys/mouse.h | 2 +- usr/src/lib/zlibetitam/sys/signal.h | 2 +- usr/src/lib/zlibetitam/sys/window.h | 2 +- usr/src/lib/zlibetitam/tam.h | 2 +- usr/src/lib/zlibetitam/tamdefs.c | 2 +- usr/src/lib/zlibetitam/tamwin.h | 2 +- usr/src/lib/zlibetitam/temp.h | 2 +- usr/src/lib/zlibetitam/track.c | 2 +- usr/src/lib/zlibetitam/track.h | 2 +- usr/src/lib/zlibetitam/undowindow.c | 2 +- usr/src/lib/zlibetitam/validwin.c | 2 +- usr/src/lib/zlibetitam/wcmd.c | 2 +- usr/src/lib/zlibetitam/wcreate.c | 2 +- usr/src/lib/zlibetitam/wdelete.c | 2 +- usr/src/lib/zlibetitam/werase.c | 2 +- usr/src/lib/zlibetitam/wexit.c | 2 +- usr/src/lib/zlibetitam/wgetc.c | 2 +- usr/src/lib/zlibetitam/wgetpos.c | 2 +- usr/src/lib/zlibetitam/wgetsel.c | 2 +- usr/src/lib/zlibetitam/wgetstat.c | 2 +- usr/src/lib/zlibetitam/wgoto.c | 2 +- usr/src/lib/zlibetitam/wind.c | 2 +- usr/src/lib/zlibetitam/wind.h | 2 +- usr/src/lib/zlibetitam/winit.c | 2 +- usr/src/lib/zlibetitam/winsize.c | 2 +- usr/src/lib/zlibetitam/wlabel.c | 2 +- usr/src/lib/zlibetitam/wnodelay.c | 2 +- usr/src/lib/zlibetitam/wpostwait.c | 2 +- usr/src/lib/zlibetitam/wprexec.c | 2 +- usr/src/lib/zlibetitam/wprintf.c | 2 +- usr/src/lib/zlibetitam/wprompt.c | 2 +- usr/src/lib/zlibetitam/wput.c | 2 +- usr/src/lib/zlibetitam/wrefresh.c | 2 +- usr/src/lib/zlibetitam/wselect.c | 2 +- usr/src/lib/zlibetitam/wsetstat.c | 2 +- usr/src/lib/zlibetitam/wslk.c | 2 +- usr/src/lib/zlibetitam/wuser.c | 2 +- usr/src/lib/zlibetitam/zlibetitam.mk | 4 +- usr/src/pkg/bnu/pkginfo | 4 +- usr/src/pkg/bnu/postinstall | 16 +- usr/src/pkg/bnu/preinstall | 4 +- usr/src/pkg/bnu/prototype | 232 +- usr/src/pkg/core/ifiles/postinstall | 11 +- usr/src/pkg/core/protos/inst | 4 +- usr/src/pkg/core/protos/intrfc | 34 +- usr/src/pkg/core/protos/kernel | 6 +- usr/src/pkg/core/protos/oamadmin | 39 +- usr/src/pkg/core/protos/sysdir | 6 +- usr/src/pkg/core/protos/sysutil | 78 +- usr/src/pkg/core/protos/term | 163 +- usr/src/pkg/core/protos/vtool | 72 +- usr/src/pkg/dfm/depend | 3 +- usr/src/pkg/dfm/prototype | 10 +- usr/src/pkg/dfs/postinstall | 4 +- usr/src/pkg/emd/prototype | 2 +- usr/src/pkg/face/postremove | 2 +- usr/src/pkg/face/prototype | 3 +- usr/src/pkg/inet/postinstall | 251 +- usr/src/pkg/inet/preremove | 11 +- usr/src/pkg/inet/prototype | 36 +- usr/src/pkg/lp/i.cron | 6 +- usr/src/pkg/lp/pkginfo | 4 +- usr/src/pkg/lp/postinstall | 8 +- usr/src/pkg/lp/preinstall | 6 +- usr/src/pkg/lp/prototype | 277 +- usr/src/pkg/lp/request | 16 +- usr/src/pkg/nfs/copyright | 3 +- usr/src/pkg/nfs/prototype | 37 +- usr/src/pkg/npack/depend | 2 + usr/src/pkg/npack/pkginfo | 21 + usr/src/pkg/npack/postinstall | 83 + usr/src/pkg/npack/preinstall | 10 + usr/src/pkg/npack/preremove | 39 + usr/src/pkg/npack/prototype | 63 + usr/src/pkg/nsu/pkginfo | 6 +- usr/src/pkg/nsu/postinstall | 163 +- usr/src/pkg/nsu/preremove | 17 +- usr/src/pkg/nsu/prototype | 41 +- usr/src/pkg/perf/prototype | 1 - usr/src/pkg/rfs/preremove | 7 +- usr/src/pkg/rfs/prototype | 107 +- usr/src/pkg/rpc/postinstall | 52 +- usr/src/pkg/rpc/preremove | 26 +- usr/src/pkg/rpc/prototype | 56 +- usr/src/pkg/slnmap/depend | 4 + usr/src/pkg/slnmap/pkginfo | 11 + usr/src/pkg/slnmap/postinstall | 37 + usr/src/pkg/slnmap/preremove | 12 + usr/src/pkg/slnmap/prototype | 7 + usr/src/pkg/sys/depend | 11 +- usr/src/pkg/sys/prototype | 23 +- usr/src/pkg/sysadm/postinstall | 6 +- usr/src/pkg/sysadm/prototype | 54 +- usr/src/pkg/terminf/pkginfo | 4 +- usr/src/pkg/terminf/prototype | 11 +- usr/src/pkg/usrenv/depend | 3 +- usr/src/pkg/usrenv/pkginfo | 6 +- usr/src/pkg/usrenv/postinstall | 8 +- usr/src/pkg/usrenv/prototype | 19 +- usr/src/pkg/windowing/pkginfo | 4 +- usr/src/pkg/windowing/postinstall | 14 +- usr/src/pkg/windowing/prototype | 6 +- usr/src/pkg/windowing/request | 4 +- usr/src/protocols/npack/cmd/npackinit | 42 + usr/src/protocols/npack/cmd/pckd.c | 49 + usr/src/protocols/npack/cmd/pckd.mk | 35 + usr/src/protocols/npack/io/npack.c | 3197 ++++++++++++++++++ usr/src/protocols/npack/io/npack.mk | 57 + usr/src/protocols/npack/master.d/npack | 15 + usr/src/protocols/npack/sys/npack.h | 235 ++ usr/src/scripts/core/proto.core1 | 26 +- usr/src/scripts/core/setup.icd | 6 +- usr/src/target.dirs | 213 +- usr/src/uts/3b2/boot/boot.fast.mk | 54 + usr/src/uts/3b2/boot/boot/bfslibfm.c | 17 +- usr/src/uts/3b2/boot/boot/boot.c | 10 +- usr/src/uts/3b2/boot/boot/boot.mk | 44 +- usr/src/uts/3b2/boot/boot/lbld | 11 +- usr/src/uts/3b2/boot/filledt/dcp/dcp.mk | 171 +- usr/src/uts/3b2/boot/filledt/dcp/edt_fill.c | 9 +- usr/src/uts/3b2/boot/filledt/dcp/fw_pump.c | 4 +- usr/src/uts/3b2/boot/filledt/dcp/getdgn.c | 13 +- usr/src/uts/3b2/boot/filledt/dcp/getnum.c | 9 +- usr/src/uts/3b2/boot/filledt/dcp/ifile | 9 +- usr/src/uts/3b2/boot/filledt/dcp/ifile.dgmon | 16 +- usr/src/uts/3b2/boot/filledt/dcp/loc_cons.c | 3 +- usr/src/uts/3b2/boot/filledt/dcp/parse.c | 5 +- usr/src/uts/3b2/boot/filledt/dcp/ph_list.c | 4 +- usr/src/uts/3b2/boot/filledt/dcp/setup.c | 7 +- usr/src/uts/3b2/boot/mboot/mbld | 5 +- usr/src/uts/3b2/boot/mboot/mboot.mk | 21 +- usr/src/uts/3b2/boot/olboot/basicio.c | 34 +- usr/src/uts/3b2/boot/olboot/lbld | 11 +- usr/src/uts/3b2/boot/olboot/lboot.c | 3 +- usr/src/uts/3b2/boot/olboot/loadprog.c | 7 +- usr/src/uts/3b2/boot/olboot/olboot.mk | 215 +- usr/src/uts/3b2/debug/prtabs.c | 140 +- usr/src/uts/3b2/debug/trace.c | 216 +- usr/src/uts/3b2/debug/utils.c | 4 +- usr/src/uts/3b2/des/des.h | 4 +- usr/src/uts/3b2/des/desdata.h | 4 +- usr/src/uts/3b2/des/softdes.h | 4 +- usr/src/uts/3b2/disp/disp.c | 11 +- usr/src/uts/3b2/disp/rt.c | 46 +- usr/src/uts/3b2/disp/sysclass.c | 121 +- usr/src/uts/3b2/disp/ts.c | 40 +- usr/src/uts/3b2/exec/coff/coff.c | 18 +- usr/src/uts/3b2/exec/elf/elf.c | 78 +- usr/src/uts/3b2/exec/intp/intp.c | 57 +- usr/src/uts/3b2/exec/intp/intp.mk | 3 +- usr/src/uts/3b2/fs/bfs/bfs.mk | 3 +- usr/src/uts/3b2/fs/bfs/bfs_compact.c | 99 +- usr/src/uts/3b2/fs/bfs/bfs_subr.c | 39 +- usr/src/uts/3b2/fs/bfs/bfs_vfsops.c | 42 +- usr/src/uts/3b2/fs/bfs/bfs_vnops.c | 238 +- usr/src/uts/3b2/fs/dnlc.c | 101 +- usr/src/uts/3b2/fs/fifofs/fifofs.mk | 3 +- usr/src/uts/3b2/fs/fifofs/fifosubr.c | 62 +- usr/src/uts/3b2/fs/fifofs/fifovnops.c | 118 +- usr/src/uts/3b2/fs/fs.fast.mk | 298 ++ usr/src/uts/3b2/fs/fs.full.mk | 298 ++ usr/src/uts/3b2/fs/fs.mk | 10 +- usr/src/uts/3b2/fs/fs_subr.c | 95 +- usr/src/uts/3b2/fs/fs_subr.h | 5 +- usr/src/uts/3b2/fs/fsflush.c | 83 +- usr/src/uts/3b2/fs/lookup.c | 27 +- usr/src/uts/3b2/fs/namefs/namevfs.c | 129 +- usr/src/uts/3b2/fs/namefs/namevno.c | 45 +- usr/src/uts/3b2/fs/nfs/nfs.mk | 20 +- usr/src/uts/3b2/fs/nfs/nfs_aux.c | 38 +- usr/src/uts/3b2/fs/nfs/nfs_client.c | 14 +- usr/src/uts/3b2/fs/nfs/nfs_common.c | 8 +- usr/src/uts/3b2/fs/nfs/nfs_export.c | 146 +- usr/src/uts/3b2/fs/nfs/nfs_server.c | 463 ++- usr/src/uts/3b2/fs/nfs/nfs_subr.c | 117 +- usr/src/uts/3b2/fs/nfs/nfs_vfsops.c | 281 +- usr/src/uts/3b2/fs/nfs/nfs_vnops.c | 359 +- usr/src/uts/3b2/fs/nfs/nfs_xdr.c | 4 +- usr/src/uts/3b2/fs/nfs/nfssys.c | 10 +- usr/src/uts/3b2/fs/pathname.c | 25 +- usr/src/uts/3b2/fs/proc/prdata.h | 4 +- usr/src/uts/3b2/fs/proc/prmachdep.c | 12 +- usr/src/uts/3b2/fs/proc/prsubr.c | 12 +- usr/src/uts/3b2/fs/proc/prvfsops.c | 28 +- usr/src/uts/3b2/fs/proc/prvnops.c | 49 +- usr/src/uts/3b2/fs/rfs/du.c | 607 ++-- usr/src/uts/3b2/fs/rfs/rf_admin.c | 910 ++--- usr/src/uts/3b2/fs/rfs/rf_admin.h | 72 +- usr/src/uts/3b2/fs/rfs/rf_auth.c | 10 +- usr/src/uts/3b2/fs/rfs/rf_cache.c | 71 +- usr/src/uts/3b2/fs/rfs/rf_cache.h | 10 +- usr/src/uts/3b2/fs/rfs/rf_canon.c | 47 +- usr/src/uts/3b2/fs/rfs/rf_canon.h | 53 +- usr/src/uts/3b2/fs/rfs/rf_cirmgr.c | 143 +- usr/src/uts/3b2/fs/rfs/rf_comm.c | 756 ++--- usr/src/uts/3b2/fs/rfs/rf_rsrc.c | 19 +- usr/src/uts/3b2/fs/rfs/rf_serve.c | 145 +- usr/src/uts/3b2/fs/rfs/rf_serve.h | 16 +- usr/src/uts/3b2/fs/rfs/rf_sys.c | 752 +++- usr/src/uts/3b2/fs/rfs/rf_vfsops.c | 287 +- usr/src/uts/3b2/fs/rfs/rf_vnops.c | 660 ++-- usr/src/uts/3b2/fs/rfs/rfcl_subr.c | 635 ++-- usr/src/uts/3b2/fs/rfs/rfcl_subr.h | 14 +- usr/src/uts/3b2/fs/rfs/rfs.mk | 23 +- usr/src/uts/3b2/fs/rfs/rfsr_ops.c | 597 ++-- usr/src/uts/3b2/fs/rfs/rfsr_subr.c | 740 +--- usr/src/uts/3b2/fs/s5/s5alloc.c | 89 +- usr/src/uts/3b2/fs/s5/s5blklist.c | 63 +- usr/src/uts/3b2/fs/s5/s5bmap.c | 56 +- usr/src/uts/3b2/fs/s5/s5dir.c | 44 +- usr/src/uts/3b2/fs/s5/s5inode.c | 65 +- usr/src/uts/3b2/fs/s5/s5rdwri.c | 87 +- usr/src/uts/3b2/fs/s5/s5vfsops.c | 53 +- usr/src/uts/3b2/fs/s5/s5vnops.c | 295 +- usr/src/uts/3b2/fs/specfs/specfs.mk | 9 +- usr/src/uts/3b2/fs/specfs/specgetsizes.c | 11 + usr/src/uts/3b2/fs/specfs/specsubr.c | 95 +- usr/src/uts/3b2/fs/specfs/specvfsops.c | 34 +- usr/src/uts/3b2/fs/specfs/specvnops.c | 253 +- usr/src/uts/3b2/fs/strcalls.c | 5 +- usr/src/uts/3b2/fs/ufs/quota.c | 25 +- usr/src/uts/3b2/fs/ufs/quota_ufs.c | 25 +- usr/src/uts/3b2/fs/ufs/quotacalls.c | 25 +- usr/src/uts/3b2/fs/ufs/ufs.mk | 20 +- usr/src/uts/3b2/fs/ufs/ufs_alloc.c | 173 +- usr/src/uts/3b2/fs/ufs/ufs_blklist.c | 34 +- usr/src/uts/3b2/fs/ufs/ufs_bmap.c | 39 +- usr/src/uts/3b2/fs/ufs/ufs_dir.c | 39 +- usr/src/uts/3b2/fs/ufs/ufs_dsort.c | 25 +- usr/src/uts/3b2/fs/ufs/ufs_inode.c | 79 +- usr/src/uts/3b2/fs/ufs/ufs_subr.c | 50 +- usr/src/uts/3b2/fs/ufs/ufs_tables.c | 25 +- usr/src/uts/3b2/fs/ufs/ufs_vfsops.c | 59 +- usr/src/uts/3b2/fs/ufs/ufs_vnops.c | 156 +- usr/src/uts/3b2/fs/vfs.c | 143 +- usr/src/uts/3b2/fs/vncalls.c | 428 +-- usr/src/uts/3b2/fs/vnode.c | 99 +- usr/src/uts/3b2/fs/xnamfs/xnamvfsops.c | 6 +- usr/src/uts/3b2/fs/xnamfs/xnamvnops.c | 40 +- usr/src/uts/3b2/fs/xnamfs/xsd.c | 4 +- usr/src/uts/3b2/fs/xnamfs/xsem.c | 6 +- usr/src/uts/3b2/io/clone.c | 3 +- usr/src/uts/3b2/io/drivers.mk | 4 +- usr/src/uts/3b2/io/emd.c | 154 +- usr/src/uts/3b2/io/gentty.c | 44 +- usr/src/uts/3b2/io/hde.c | 39 +- usr/src/uts/3b2/io/icd.c | 21 +- usr/src/uts/3b2/io/id.c | 3 +- usr/src/uts/3b2/io/if.c | 17 +- usr/src/uts/3b2/io/io.fast.mk | 60 + usr/src/uts/3b2/io/io.full.mk | 60 + usr/src/uts/3b2/io/iuart.c | 201 +- usr/src/uts/3b2/io/kmacct.c | 645 +--- usr/src/uts/3b2/io/ldterm.c | 132 +- usr/src/uts/3b2/io/log.c | 32 +- usr/src/uts/3b2/io/mau.c | 11 +- usr/src/uts/3b2/io/mem.c | 8 +- usr/src/uts/3b2/io/nppc.c | 436 ++- usr/src/uts/3b2/io/opts.c | 218 ++ usr/src/uts/3b2/io/pckt.c | 2 +- usr/src/uts/3b2/io/physdsk.c | 21 +- usr/src/uts/3b2/io/ptc.c | 256 ++ usr/src/uts/3b2/io/ptem.c | 29 +- usr/src/uts/3b2/io/sad.c | 6 +- usr/src/uts/3b2/io/sddrv.c | 193 +- usr/src/uts/3b2/io/sockmod.c | 926 ++--- usr/src/uts/3b2/io/stream.c | 213 +- usr/src/uts/3b2/io/sxt.c | 16 +- usr/src/uts/3b2/io/ticlts.c | 163 +- usr/src/uts/3b2/io/ticots.c | 37 +- usr/src/uts/3b2/io/timod.c | 24 +- usr/src/uts/3b2/io/tirdwr.c | 2 +- usr/src/uts/3b2/io/ttcompat.c | 32 +- usr/src/uts/3b2/io/xt.c | 12 +- usr/src/uts/3b2/klm/klm.mk | 8 +- usr/src/uts/3b2/klm/klm_kprot.c | 4 +- usr/src/uts/3b2/klm/klm_lkmgr.c | 256 +- usr/src/uts/3b2/ktli/ktli.mk | 59 +- usr/src/uts/3b2/ktli/t_kalloc.c | 64 +- usr/src/uts/3b2/ktli/t_kbind.c | 57 +- usr/src/uts/3b2/ktli/t_kclose.c | 10 +- usr/src/uts/3b2/ktli/t_kconnect.c | 69 +- usr/src/uts/3b2/ktli/t_kfree.c | 57 +- usr/src/uts/3b2/ktli/t_kgtstate.c | 76 +- usr/src/uts/3b2/ktli/t_kopen.c | 164 +- usr/src/uts/3b2/ktli/t_krcvudat.c | 389 ++- usr/src/uts/3b2/ktli/t_ksndudat.c | 78 +- usr/src/uts/3b2/ktli/t_kspoll.c | 104 +- usr/src/uts/3b2/ktli/t_kutil.c | 171 +- usr/src/uts/3b2/master.d/emd | 7 +- usr/src/uts/3b2/master.d/ip | 8 +- usr/src/uts/3b2/master.d/iuart | 4 +- usr/src/uts/3b2/master.d/kernel | 53 +- usr/src/uts/3b2/master.d/nfs | 2 +- usr/src/uts/3b2/master.d/opts | 10 + usr/src/uts/3b2/master.d/ports | 2 +- usr/src/uts/3b2/master.d/ptc | 6 + usr/src/uts/3b2/master.d/rfs | 8 +- usr/src/uts/3b2/master.d/shm | 8 +- usr/src/uts/3b2/master.d/sockmod | 25 +- usr/src/uts/3b2/master.d/stubs | 3 +- usr/src/uts/3b2/master.d/tcp | 10 +- usr/src/uts/3b2/master.d/xnamfs | 4 +- usr/src/uts/3b2/mk.fastsys | 49 + usr/src/uts/3b2/mk.fullsys | 49 + usr/src/uts/3b2/ml/cdump.c | 7 +- usr/src/uts/3b2/ml/gate.c | 28 +- usr/src/uts/3b2/ml/misc.s | 36 +- usr/src/uts/3b2/ml/pstart.c | 84 +- usr/src/uts/3b2/ml/ttrap.s | 51 +- usr/src/uts/3b2/net/if.h | 6 +- usr/src/uts/3b2/netinet/arp.c | 6 +- usr/src/uts/3b2/netinet/in.c | 4 +- usr/src/uts/3b2/netinet/in.h | 19 +- usr/src/uts/3b2/netinet/in_pcb.c | 30 +- usr/src/uts/3b2/netinet/in_switch.c | 14 +- usr/src/uts/3b2/netinet/in_transp.c | 6 +- usr/src/uts/3b2/netinet/ip.mk | 4 +- usr/src/uts/3b2/netinet/ip_icmp.c | 41 +- usr/src/uts/3b2/netinet/ip_input.c | 30 +- usr/src/uts/3b2/netinet/ip_main.c | 7 +- usr/src/uts/3b2/netinet/ip_str.h | 4 +- usr/src/uts/3b2/netinet/netlib.c | 16 +- usr/src/uts/3b2/netinet/raw_ip.c | 12 +- usr/src/uts/3b2/netinet/raw_ip_cb.c | 6 +- usr/src/uts/3b2/netinet/raw_ip_main.c | 39 +- usr/src/uts/3b2/netinet/route.c | 24 +- usr/src/uts/3b2/netinet/tcp.h | 25 +- usr/src/uts/3b2/netinet/tcp_debug.c | 137 +- usr/src/uts/3b2/netinet/tcp_debug.h | 8 +- usr/src/uts/3b2/netinet/tcp_fsm.h | 25 +- usr/src/uts/3b2/netinet/tcp_input.c | 166 +- usr/src/uts/3b2/netinet/tcp_main.c | 175 +- usr/src/uts/3b2/netinet/tcp_output.c | 76 +- usr/src/uts/3b2/netinet/tcp_seq.h | 32 +- usr/src/uts/3b2/netinet/tcp_state.c | 156 +- usr/src/uts/3b2/netinet/tcp_subr.c | 100 +- usr/src/uts/3b2/netinet/tcp_timer.c | 161 +- usr/src/uts/3b2/netinet/tcp_timer.h | 36 +- usr/src/uts/3b2/netinet/tcp_var.h | 34 +- usr/src/uts/3b2/netinet/tcpip.h | 21 +- usr/src/uts/3b2/netinet/udp_io.c | 14 +- usr/src/uts/3b2/netinet/udp_main.c | 30 +- usr/src/uts/3b2/netinet/udp_state.c | 19 +- usr/src/uts/3b2/nfs/export.h | 43 +- usr/src/uts/3b2/nfs/mount.h | 46 +- usr/src/uts/3b2/nfs/nfs.h | 4 +- usr/src/uts/3b2/nfs/nfs_clnt.h | 35 +- usr/src/uts/3b2/nfs/nfssys.h | 12 +- usr/src/uts/3b2/nfs/rnode.h | 8 +- usr/src/uts/3b2/os/acct.c | 34 +- usr/src/uts/3b2/os/bio.c | 140 +- usr/src/uts/3b2/os/clock.c | 65 +- usr/src/uts/3b2/os/cmn_err.c | 104 +- usr/src/uts/3b2/os/core.c | 34 +- usr/src/uts/3b2/os/cred.c | 25 +- usr/src/uts/3b2/os/ddi.c | 74 +- usr/src/uts/3b2/os/exec.c | 418 +-- usr/src/uts/3b2/os/exit.c | 82 +- usr/src/uts/3b2/os/fbio.c | 11 +- usr/src/uts/3b2/os/flock.c | 12 +- usr/src/uts/3b2/os/fork.c | 215 +- usr/src/uts/3b2/os/grow.c | 14 +- usr/src/uts/3b2/os/kma.c | 912 ++++- usr/src/uts/3b2/os/kperf.c | 6 +- usr/src/uts/3b2/os/lock.c | 29 +- usr/src/uts/3b2/os/machdep.c | 84 +- usr/src/uts/3b2/os/main.c | 34 +- usr/src/uts/3b2/os/malloc.c | 27 +- usr/src/uts/3b2/os/mapin.c | 153 + usr/src/uts/3b2/os/move.c | 56 +- usr/src/uts/3b2/os/msg.c | 57 +- usr/src/uts/3b2/os/os.mk | 49 +- usr/src/uts/3b2/os/pgrp.c | 327 +- usr/src/uts/3b2/os/pipe.c | 7 +- usr/src/uts/3b2/os/procset.c | 30 +- usr/src/uts/3b2/os/scalls.c | 544 ++- usr/src/uts/3b2/os/sem.c | 46 +- usr/src/uts/3b2/os/session.c | 301 +- usr/src/uts/3b2/os/shm.c | 36 +- usr/src/uts/3b2/os/sig.c | 83 +- usr/src/uts/3b2/os/slp.c | 26 +- usr/src/uts/3b2/os/space.c | 9 +- usr/src/uts/3b2/os/startup.c | 62 +- usr/src/uts/3b2/os/streamio.c | 378 +-- usr/src/uts/3b2/os/strsubr.c | 392 +-- usr/src/uts/3b2/os/subr.c | 73 +- usr/src/uts/3b2/os/sys3b.c | 27 +- usr/src/uts/3b2/os/sysent.c | 66 +- usr/src/uts/3b2/os/todc.c | 2 +- usr/src/uts/3b2/os/trap.c | 290 +- usr/src/uts/3b2/os/vm_meter.c | 61 +- usr/src/uts/3b2/os/vm_pageout.c | 35 +- usr/src/uts/3b2/os/vm_subr.c | 62 +- usr/src/uts/3b2/os/xsys.c | 42 +- usr/src/uts/3b2/rpc/auth.h | 4 +- usr/src/uts/3b2/rpc/auth_des.c | 39 +- usr/src/uts/3b2/rpc/auth_sys.h | 4 +- usr/src/uts/3b2/rpc/auth_unix.h | 4 +- usr/src/uts/3b2/rpc/authdesubr.c | 232 +- usr/src/uts/3b2/rpc/clnt.h | 84 +- usr/src/uts/3b2/rpc/clnt_clts.c | 492 +-- usr/src/uts/3b2/rpc/clnt_gen.c | 191 +- usr/src/uts/3b2/rpc/cpjsleep.c | 120 + usr/src/uts/3b2/rpc/key_call.c | 253 +- usr/src/uts/3b2/rpc/pmap_kport.c | 191 ++ usr/src/uts/3b2/rpc/pmap_prot.c | 56 + usr/src/uts/3b2/rpc/rpc.mk | 102 +- usr/src/uts/3b2/rpc/rpc_com.h | 4 +- usr/src/uts/3b2/rpc/rpcb_prot.c | 118 + usr/src/uts/3b2/rpc/rpcb_prot.h | 5 +- usr/src/uts/3b2/rpc/rpcent.h | 6 +- usr/src/uts/3b2/rpc/svc.c | 31 +- usr/src/uts/3b2/rpc/svc.h | 7 +- usr/src/uts/3b2/rpc/svc_authu.c | 4 +- usr/src/uts/3b2/rpc/svc_clts.c | 250 +- usr/src/uts/3b2/rpc/svc_gen.c | 60 +- usr/src/uts/3b2/rpc/svc_soc.h | 4 +- usr/src/uts/3b2/rpc/svcauthdes.c | 34 +- usr/src/uts/3b2/rpc/types.h | 23 +- usr/src/uts/3b2/rpcsvc/klm_prot.h | 122 + usr/src/uts/3b2/sys/acct.h | 9 +- usr/src/uts/3b2/sys/buf.h | 7 +- usr/src/uts/3b2/sys/class.h | 14 +- usr/src/uts/3b2/sys/conf.h | 15 +- usr/src/uts/3b2/sys/cred.h | 25 +- usr/src/uts/3b2/sys/ddi.h | 7 +- usr/src/uts/3b2/sys/dnlc.h | 29 +- usr/src/uts/3b2/sys/elf.h | 25 +- usr/src/uts/3b2/sys/elf_386.h | 6 +- usr/src/uts/3b2/sys/elf_M32.h | 7 +- usr/src/uts/3b2/sys/elf_SPARC.h | 7 +- usr/src/uts/3b2/sys/emd.h | 4 +- usr/src/uts/3b2/sys/erec.h | 204 ++ usr/src/uts/3b2/sys/errno.h | 62 +- usr/src/uts/3b2/sys/exec.h | 10 +- usr/src/uts/3b2/sys/fbuf.h | 3 +- usr/src/uts/3b2/sys/fcntl.h | 18 +- usr/src/uts/3b2/sys/file.h | 13 +- usr/src/uts/3b2/sys/flock.h | 13 +- usr/src/uts/3b2/sys/fs/bfs.h | 43 +- usr/src/uts/3b2/sys/fs/bfs_compact.h | 28 +- usr/src/uts/3b2/sys/fs/fifonode.h | 6 +- usr/src/uts/3b2/sys/fs/namenode.h | 3 +- usr/src/uts/3b2/sys/fs/rf_acct.h | 20 +- usr/src/uts/3b2/sys/fs/s5inode.h | 13 +- usr/src/uts/3b2/sys/fs/snode.h | 8 +- usr/src/uts/3b2/sys/fs/ufs_inode.h | 18 +- usr/src/uts/3b2/sys/fs/ufs_quota.h | 9 +- usr/src/uts/3b2/sys/fs/xnamnode.h | 4 +- usr/src/uts/3b2/sys/gdpstr.h | 78 + usr/src/uts/3b2/sys/immu.h | 68 +- usr/src/uts/3b2/sys/ioctl.h | 44 +- usr/src/uts/3b2/sys/lock.h | 4 +- usr/src/uts/3b2/sys/mkdev.h | 6 +- usr/src/uts/3b2/sys/mman.h | 25 +- usr/src/uts/3b2/sys/netcspace.h | 55 + usr/src/uts/3b2/sys/param.h | 37 +- usr/src/uts/3b2/sys/pathname.h | 25 +- usr/src/uts/3b2/sys/proc.h | 222 +- usr/src/uts/3b2/sys/procfs.h | 8 +- usr/src/uts/3b2/sys/prsystm.h | 4 +- usr/src/uts/3b2/sys/ptem.h | 5 +- usr/src/uts/3b2/sys/resource.h | 3 +- usr/src/uts/3b2/sys/rf_cirmgr.h | 10 +- usr/src/uts/3b2/sys/rf_comm.h | 92 +- usr/src/uts/3b2/sys/rf_messg.h | 141 +- usr/src/uts/3b2/sys/session.h | 56 +- usr/src/uts/3b2/sys/shm.h | 31 +- usr/src/uts/3b2/sys/sigaction.h | 32 + usr/src/uts/3b2/sys/signal.h | 87 +- usr/src/uts/3b2/sys/socket.h | 8 +- usr/src/uts/3b2/sys/sockio.h | 2 +- usr/src/uts/3b2/sys/sockmod.h | 18 +- usr/src/uts/3b2/sys/stat.h | 13 +- usr/src/uts/3b2/sys/stream.h | 14 +- usr/src/uts/3b2/sys/strsubr.h | 73 +- usr/src/uts/3b2/sys/swap.h | 31 +- usr/src/uts/3b2/sys/sxt.h | 99 + usr/src/uts/3b2/sys/syscall.h | 21 +- usr/src/uts/3b2/sys/sysconfig.h | 16 +- usr/src/uts/3b2/sys/sysmacros.h | 8 +- usr/src/uts/3b2/sys/systeminfo.h | 8 +- usr/src/uts/3b2/sys/systm.h | 30 +- usr/src/uts/3b2/sys/t_kuser.h | 38 +- usr/src/uts/3b2/sys/termios.h | 58 +- usr/src/uts/3b2/sys/ticots.h | 53 +- usr/src/uts/3b2/sys/ticotsord.h | 265 ++ usr/src/uts/3b2/sys/tihdr.h | 368 ++ usr/src/uts/3b2/sys/time.h | 94 + usr/src/uts/3b2/sys/timeb.h | 43 + usr/src/uts/3b2/sys/times.h | 26 + usr/src/uts/3b2/sys/timod.h | 100 + usr/src/uts/3b2/sys/tiuser.h | 252 ++ usr/src/uts/3b2/sys/todc.h | 59 + usr/src/uts/3b2/sys/trace.h | 24 + usr/src/uts/3b2/sys/ts.h | 55 + usr/src/uts/3b2/sys/tspriocntl.h | 44 + usr/src/uts/3b2/sys/ttcompat.h | 59 + usr/src/uts/3b2/sys/ttold.h | 335 ++ usr/src/uts/3b2/sys/tty.h | 179 + usr/src/uts/3b2/sys/tuneable.h | 40 + usr/src/uts/3b2/sys/types.h | 188 + usr/src/uts/3b2/sys/uadmin.h | 26 + usr/src/uts/3b2/sys/ucontext.h | 65 + usr/src/uts/3b2/sys/uio.h | 51 + usr/src/uts/3b2/sys/ulimit.h | 45 + usr/src/uts/3b2/sys/un.h | 48 + usr/src/uts/3b2/sys/user.h | 355 ++ usr/src/uts/3b2/sys/ustat.h | 32 + usr/src/uts/3b2/sys/utime.h | 23 + usr/src/uts/3b2/sys/utsname.h | 58 + usr/src/uts/3b2/sys/utssys.h | 45 + usr/src/uts/3b2/sys/var.h | 49 + usr/src/uts/3b2/sys/vfs.h | 165 + usr/src/uts/3b2/sys/vfstab.h | 52 + usr/src/uts/3b2/sys/vm.h | 18 + usr/src/uts/3b2/sys/vmmac.h | 39 + usr/src/uts/3b2/sys/vmmeter.h | 161 + usr/src/uts/3b2/sys/vmparam.h | 119 + usr/src/uts/3b2/sys/vmsystm.h | 67 + usr/src/uts/3b2/sys/vnode.h | 319 ++ usr/src/uts/3b2/sys/vtoc.h | 112 + usr/src/uts/3b2/sys/wait.h | 74 + usr/src/uts/3b2/unix.fast.mk | 158 + usr/src/uts/3b2/unix.full.mk | 143 + usr/src/uts/3b2/unix.mk | 143 + usr/src/uts/3b2/vm/anon.h | 64 + usr/src/uts/3b2/vm/as.h | 79 + usr/src/uts/3b2/vm/bootconf.h | 41 + usr/src/uts/3b2/vm/cpu.h | 13 + usr/src/uts/3b2/vm/debugger.h | 138 + usr/src/uts/3b2/vm/faultcode.h | 36 + usr/src/uts/3b2/vm/hat.h | 125 + usr/src/uts/3b2/vm/kernel.h | 25 + usr/src/uts/3b2/vm/mp.h | 56 + usr/src/uts/3b2/vm/page.h | 218 ++ usr/src/uts/3b2/vm/pte.h | 13 + usr/src/uts/3b2/vm/pvn.h | 53 + usr/src/uts/3b2/vm/reboot.h | 35 + usr/src/uts/3b2/vm/rm.h | 43 + usr/src/uts/3b2/vm/seg.h | 144 + usr/src/uts/3b2/vm/seg_dev.c | 602 ++++ usr/src/uts/3b2/vm/seg_dev.h | 47 + usr/src/uts/3b2/vm/seg_kmem.c | 698 ++++ usr/src/uts/3b2/vm/seg_kmem.h | 57 + usr/src/uts/3b2/vm/seg_map.c | 927 +++++ usr/src/uts/3b2/vm/seg_map.h | 102 + usr/src/uts/3b2/vm/seg_u.c | 1086 ++++++ usr/src/uts/3b2/vm/seg_u.h | 109 + usr/src/uts/3b2/vm/seg_vn.c | 2363 +++++++++++++ usr/src/uts/3b2/vm/seg_vn.h | 86 + usr/src/uts/3b2/vm/trace.h | 328 ++ usr/src/uts/3b2/vm/vm.mk | 406 +++ usr/src/uts/3b2/vm/vm_anon.c | 606 ++++ usr/src/uts/3b2/vm/vm_as.c | 987 ++++++ usr/src/uts/3b2/vm/vm_hat.c | 3066 +++++++++++++++++ usr/src/uts/3b2/vm/vm_hat.h | 138 + usr/src/uts/3b2/vm/vm_machdep.c | 405 +++ usr/src/uts/3b2/vm/vm_mp.c | 84 + usr/src/uts/3b2/vm/vm_page.c | 1857 ++++++++++ usr/src/uts/3b2/vm/vm_pvn.c | 976 ++++++ usr/src/uts/3b2/vm/vm_rm.c | 98 + usr/src/uts/3b2/vm/vm_seg.c | 178 + usr/src/uts/3b2/vm/vm_swap.c | 1236 +++++++ usr/src/uts/3b2/vm/vm_vpage.c | 73 + usr/src/uts/3b2/vm/vmlog.h | 93 + usr/src/uts/3b2/vm/vpage.h | 30 + usr/src/uts/3b2/vuifile | 113 + 1394 files changed, 69572 insertions(+), 26184 deletions(-) create mode 100644 usr/src/head/osfcn.h create mode 100644 usr/src/head/rpc/mp.h create mode 100644 usr/src/lib/libc/m32/csu/fcrt0.s create mode 100644 usr/src/lib/libc/m32/csu/fcrt1.s create mode 100644 usr/src/lib/libc/m32/csu/fmcrt0.s create mode 100644 usr/src/lib/libc/m32/csu/fmcrt1.s create mode 100644 usr/src/lib/libc/m32/gen/fptrap.s create mode 100644 usr/src/lib/libc/m32/sys/acancel.s create mode 100644 usr/src/lib/libc/m32/sys/brkbase.s create mode 100644 usr/src/lib/libc/m32/sys/evsys.s create mode 100644 usr/src/lib/libc/m32/sys/fmount.s create mode 100644 usr/src/lib/libc/m32/sys/funmount.s create mode 100644 usr/src/lib/libc/m32/sys/getpagesize.s create mode 100644 usr/src/lib/libc/m32/sys/mctl.s create mode 100644 usr/src/lib/libc/port/gen/aread.c create mode 100644 usr/src/lib/libc/port/gen/asyncio.c create mode 100644 usr/src/lib/libc/port/gen/awrite.c create mode 100644 usr/src/lib/libc/port/gen/dial.mk create mode 100644 usr/src/lib/libc/port/gen/events.c create mode 100644 usr/src/lib/libc/port/gen/getgrbuf.c create mode 100644 usr/src/lib/libc/port/gen/getgrgid.c create mode 100644 usr/src/lib/libc/port/gen/getpwbuf.c create mode 100644 usr/src/lib/libc/port/gen/getpwuid.c create mode 100644 usr/src/lib/libc/port/gen/pathconf.c create mode 100644 usr/src/lib/libc/port/gen/putpwbuf.c create mode 100644 usr/src/lib/libc/port/gen/siginfolst.c create mode 100644 usr/src/lib/libc/port/gen/strmount.c create mode 100644 usr/src/lib/libc/port/gen/strumount.c create mode 100644 usr/src/lib/libcrypt/__Ext_Synonyms create mode 100644 usr/src/lib/libgen/getdate.c create mode 100644 usr/src/lib/libmalloc/__Ext_Synonyms create mode 100644 usr/src/lib/libmp/gcd.c create mode 100644 usr/src/lib/libmp/libmp.mk create mode 100644 usr/src/lib/libmp/madd.c create mode 100644 usr/src/lib/libmp/mdiv.c create mode 100644 usr/src/lib/libmp/mout.c create mode 100644 usr/src/lib/libmp/msqrt.c create mode 100644 usr/src/lib/libmp/mult.c create mode 100644 usr/src/lib/libmp/ngcd.c create mode 100644 usr/src/lib/libmp/pow.c create mode 100644 usr/src/lib/libmp/util.c create mode 100644 usr/src/lib/libnsl/saf/ut.c create mode 100644 usr/src/lib/libnsl/saf/utx.c create mode 100644 usr/src/lib/libnsl/yp/ypupd.h create mode 100644 usr/src/lib/libpt/libpt.c create mode 100644 usr/src/lib/libpt/libpt.mk create mode 100644 usr/src/lib/libpt/pt_chmod.c create mode 100644 usr/src/lib/nametoaddr/npack/npack.c create mode 100644 usr/src/lib/nametoaddr/npack/npack.mk create mode 100644 usr/src/lib/rtld/i386/align.s create mode 100644 usr/src/lib/rtld/i386/clrpage.s create mode 100644 usr/src/lib/rtld/i386/genset.awk create mode 100644 usr/src/lib/rtld/i386/genset.in create mode 100644 usr/src/lib/rtld/i386/rtmemcpy.s create mode 100644 usr/src/lib/rtld/m32/rtisastream.c create mode 100644 usr/src/lib/terminfo/Doc.sed create mode 100644 usr/src/lib/terminfo/README create mode 100644 usr/src/lib/terminfo/adds.ti create mode 100644 usr/src/lib/terminfo/annarbor.ti create mode 100644 usr/src/lib/terminfo/ansi.ti create mode 100644 usr/src/lib/terminfo/att.ti create mode 100644 usr/src/lib/terminfo/beehive.ti create mode 100644 usr/src/lib/terminfo/cdc.ti create mode 100644 usr/src/lib/terminfo/ckout create mode 100644 usr/src/lib/terminfo/colorscan.ti create mode 100644 usr/src/lib/terminfo/cvt.ex create mode 100644 usr/src/lib/terminfo/cvt.h create mode 100644 usr/src/lib/terminfo/cvt.sed create mode 100644 usr/src/lib/terminfo/datamedia.ti create mode 100644 usr/src/lib/terminfo/dec.ti create mode 100644 usr/src/lib/terminfo/diablo.ti create mode 100644 usr/src/lib/terminfo/fortune.ti create mode 100644 usr/src/lib/terminfo/general.ti create mode 100644 usr/src/lib/terminfo/hardcopy.ti create mode 100644 usr/src/lib/terminfo/hazeltine.ti create mode 100644 usr/src/lib/terminfo/hds.ti create mode 100644 usr/src/lib/terminfo/header create mode 100644 usr/src/lib/terminfo/heath.ti create mode 100644 usr/src/lib/terminfo/homebrew.ti create mode 100644 usr/src/lib/terminfo/hp.ti create mode 100644 usr/src/lib/terminfo/lsi.ti create mode 100644 usr/src/lib/terminfo/microterm.ti create mode 100644 usr/src/lib/terminfo/misc.ti create mode 100644 usr/src/lib/terminfo/pc.ti create mode 100644 usr/src/lib/terminfo/perkinelmer.ti create mode 100644 usr/src/lib/terminfo/print.ti create mode 100644 usr/src/lib/terminfo/special.ti create mode 100644 usr/src/lib/terminfo/sperry.ti create mode 100644 usr/src/lib/terminfo/tabset/3101 create mode 100644 usr/src/lib/terminfo/tabset/beehive create mode 100644 usr/src/lib/terminfo/tabset/hds create mode 100644 usr/src/lib/terminfo/tabset/hds3 create mode 100644 usr/src/lib/terminfo/tabset/std create mode 100644 usr/src/lib/terminfo/tabset/teleray create mode 100644 usr/src/lib/terminfo/tabset/vt100 create mode 100644 usr/src/lib/terminfo/tabset/xerox1720 create mode 100644 usr/src/lib/terminfo/tektronix.ti create mode 100644 usr/src/lib/terminfo/teleray.ti create mode 100644 usr/src/lib/terminfo/televideo.ti create mode 100644 usr/src/lib/terminfo/termcap create mode 100644 usr/src/lib/terminfo/terminfo.mk create mode 100644 usr/src/lib/terminfo/ti.ti create mode 100644 usr/src/lib/terminfo/trailer create mode 100644 usr/src/lib/terminfo/tymshare.ti create mode 100644 usr/src/lib/terminfo/visual.ti create mode 100644 usr/src/lib/terminfo/wyse.ti create mode 100644 usr/src/lib/xlibcurses/screen/uparm.h create mode 100644 usr/src/lib/zlibeti/curses/INSTALL create mode 100644 usr/src/lib/zlibeti/curses/ORDER.1 create mode 100644 usr/src/lib/zlibeti/curses/ORDER.2 create mode 100644 usr/src/lib/zlibeti/curses/ORDER.3 create mode 100644 usr/src/lib/zlibeti/curses/Rlist.svr2curs create mode 100644 usr/src/lib/zlibeti/curses/UNINSTALL create mode 100644 usr/src/lib/zlibeti/curses/proto.1 create mode 100644 usr/src/lib/zlibeti/curses/proto.2 create mode 100644 usr/src/lib/zlibeti/curses/proto.3 create mode 100644 usr/src/lib/zlibeti/curses/setup create mode 100644 usr/src/lib/zlibeti/curses/svr2curs.name create mode 100644 usr/src/lib/zlibeti/man3/menu.3c create mode 100644 usr/src/lib/zlibetitam/design.mm create mode 100644 usr/src/lib/zlibetitam/man3/tam.3c create mode 100644 usr/src/pkg/npack/depend create mode 100644 usr/src/pkg/npack/pkginfo create mode 100644 usr/src/pkg/npack/postinstall create mode 100644 usr/src/pkg/npack/preinstall create mode 100644 usr/src/pkg/npack/preremove create mode 100644 usr/src/pkg/npack/prototype create mode 100644 usr/src/pkg/slnmap/depend create mode 100644 usr/src/pkg/slnmap/pkginfo create mode 100644 usr/src/pkg/slnmap/postinstall create mode 100644 usr/src/pkg/slnmap/preremove create mode 100644 usr/src/pkg/slnmap/prototype create mode 100644 usr/src/protocols/npack/cmd/npackinit create mode 100644 usr/src/protocols/npack/cmd/pckd.c create mode 100644 usr/src/protocols/npack/cmd/pckd.mk create mode 100644 usr/src/protocols/npack/io/npack.c create mode 100644 usr/src/protocols/npack/io/npack.mk create mode 100644 usr/src/protocols/npack/master.d/npack create mode 100644 usr/src/protocols/npack/sys/npack.h create mode 100644 usr/src/uts/3b2/boot/boot.fast.mk create mode 100644 usr/src/uts/3b2/fs/fs.fast.mk create mode 100644 usr/src/uts/3b2/fs/fs.full.mk create mode 100644 usr/src/uts/3b2/fs/specfs/specgetsizes.c create mode 100644 usr/src/uts/3b2/io/io.fast.mk create mode 100644 usr/src/uts/3b2/io/io.full.mk create mode 100644 usr/src/uts/3b2/io/opts.c create mode 100644 usr/src/uts/3b2/io/ptc.c create mode 100644 usr/src/uts/3b2/master.d/opts create mode 100644 usr/src/uts/3b2/master.d/ptc create mode 100644 usr/src/uts/3b2/mk.fastsys create mode 100644 usr/src/uts/3b2/mk.fullsys create mode 100644 usr/src/uts/3b2/os/mapin.c create mode 100644 usr/src/uts/3b2/rpc/cpjsleep.c create mode 100644 usr/src/uts/3b2/rpc/pmap_kport.c create mode 100644 usr/src/uts/3b2/rpc/pmap_prot.c create mode 100644 usr/src/uts/3b2/rpc/rpcb_prot.c create mode 100644 usr/src/uts/3b2/rpcsvc/klm_prot.h create mode 100644 usr/src/uts/3b2/sys/erec.h create mode 100644 usr/src/uts/3b2/sys/gdpstr.h create mode 100644 usr/src/uts/3b2/sys/netcspace.h create mode 100644 usr/src/uts/3b2/sys/sigaction.h create mode 100644 usr/src/uts/3b2/sys/sxt.h create mode 100644 usr/src/uts/3b2/sys/ticotsord.h create mode 100644 usr/src/uts/3b2/sys/tihdr.h create mode 100644 usr/src/uts/3b2/sys/time.h create mode 100644 usr/src/uts/3b2/sys/timeb.h create mode 100644 usr/src/uts/3b2/sys/times.h create mode 100644 usr/src/uts/3b2/sys/timod.h create mode 100644 usr/src/uts/3b2/sys/tiuser.h create mode 100644 usr/src/uts/3b2/sys/todc.h create mode 100644 usr/src/uts/3b2/sys/trace.h create mode 100644 usr/src/uts/3b2/sys/ts.h create mode 100644 usr/src/uts/3b2/sys/tspriocntl.h create mode 100644 usr/src/uts/3b2/sys/ttcompat.h create mode 100644 usr/src/uts/3b2/sys/ttold.h create mode 100644 usr/src/uts/3b2/sys/tty.h create mode 100644 usr/src/uts/3b2/sys/tuneable.h create mode 100644 usr/src/uts/3b2/sys/types.h create mode 100644 usr/src/uts/3b2/sys/uadmin.h create mode 100644 usr/src/uts/3b2/sys/ucontext.h create mode 100644 usr/src/uts/3b2/sys/uio.h create mode 100644 usr/src/uts/3b2/sys/ulimit.h create mode 100644 usr/src/uts/3b2/sys/un.h create mode 100644 usr/src/uts/3b2/sys/user.h create mode 100644 usr/src/uts/3b2/sys/ustat.h create mode 100644 usr/src/uts/3b2/sys/utime.h create mode 100644 usr/src/uts/3b2/sys/utsname.h create mode 100644 usr/src/uts/3b2/sys/utssys.h create mode 100644 usr/src/uts/3b2/sys/var.h create mode 100644 usr/src/uts/3b2/sys/vfs.h create mode 100644 usr/src/uts/3b2/sys/vfstab.h create mode 100644 usr/src/uts/3b2/sys/vm.h create mode 100644 usr/src/uts/3b2/sys/vmmac.h create mode 100644 usr/src/uts/3b2/sys/vmmeter.h create mode 100644 usr/src/uts/3b2/sys/vmparam.h create mode 100644 usr/src/uts/3b2/sys/vmsystm.h create mode 100644 usr/src/uts/3b2/sys/vnode.h create mode 100644 usr/src/uts/3b2/sys/vtoc.h create mode 100644 usr/src/uts/3b2/sys/wait.h create mode 100644 usr/src/uts/3b2/unix.fast.mk create mode 100644 usr/src/uts/3b2/unix.full.mk create mode 100644 usr/src/uts/3b2/unix.mk create mode 100644 usr/src/uts/3b2/vm/anon.h create mode 100644 usr/src/uts/3b2/vm/as.h create mode 100644 usr/src/uts/3b2/vm/bootconf.h create mode 100644 usr/src/uts/3b2/vm/cpu.h create mode 100644 usr/src/uts/3b2/vm/debugger.h create mode 100644 usr/src/uts/3b2/vm/faultcode.h create mode 100644 usr/src/uts/3b2/vm/hat.h create mode 100644 usr/src/uts/3b2/vm/kernel.h create mode 100644 usr/src/uts/3b2/vm/mp.h create mode 100644 usr/src/uts/3b2/vm/page.h create mode 100644 usr/src/uts/3b2/vm/pte.h create mode 100644 usr/src/uts/3b2/vm/pvn.h create mode 100644 usr/src/uts/3b2/vm/reboot.h create mode 100644 usr/src/uts/3b2/vm/rm.h create mode 100644 usr/src/uts/3b2/vm/seg.h create mode 100644 usr/src/uts/3b2/vm/seg_dev.c create mode 100644 usr/src/uts/3b2/vm/seg_dev.h create mode 100644 usr/src/uts/3b2/vm/seg_kmem.c create mode 100644 usr/src/uts/3b2/vm/seg_kmem.h create mode 100644 usr/src/uts/3b2/vm/seg_map.c create mode 100644 usr/src/uts/3b2/vm/seg_map.h create mode 100644 usr/src/uts/3b2/vm/seg_u.c create mode 100644 usr/src/uts/3b2/vm/seg_u.h create mode 100644 usr/src/uts/3b2/vm/seg_vn.c create mode 100644 usr/src/uts/3b2/vm/seg_vn.h create mode 100644 usr/src/uts/3b2/vm/trace.h create mode 100644 usr/src/uts/3b2/vm/vm.mk create mode 100644 usr/src/uts/3b2/vm/vm_anon.c create mode 100644 usr/src/uts/3b2/vm/vm_as.c create mode 100644 usr/src/uts/3b2/vm/vm_hat.c create mode 100644 usr/src/uts/3b2/vm/vm_hat.h create mode 100644 usr/src/uts/3b2/vm/vm_machdep.c create mode 100644 usr/src/uts/3b2/vm/vm_mp.c create mode 100644 usr/src/uts/3b2/vm/vm_page.c create mode 100644 usr/src/uts/3b2/vm/vm_pvn.c create mode 100644 usr/src/uts/3b2/vm/vm_rm.c create mode 100644 usr/src/uts/3b2/vm/vm_seg.c create mode 100644 usr/src/uts/3b2/vm/vm_swap.c create mode 100644 usr/src/uts/3b2/vm/vm_vpage.c create mode 100644 usr/src/uts/3b2/vm/vmlog.h create mode 100644 usr/src/uts/3b2/vm/vpage.h create mode 100644 usr/src/uts/3b2/vuifile diff --git a/usr/src/:mk b/usr/src/:mk index a33804d..6c42086 100644 --- a/usr/src/:mk +++ b/usr/src/:mk @@ -1,24 +1,54 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T -# All Rights Reserved +# Copyright (c) 1984 AT&T +# All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk::mk 1.10.2.1" +#ident "@(#)mk::mk 1.10" # # Shell script for rebuilding the UNIX System # trap "exit 1" 1 2 3 15 if [ "$ROOT" = "" ] then - PATH=/usr/ccs/bin:/sbin:/usr/sbin:/usr/bin:/etc ; export PATH + PATH=/bin:/etc:/usr/bin; export PATH fi UID_NAME=`id|sed 's/[()]/ /gp'|awk '{print $2}'` -# create target directories -./:mktarget +# Check for the existance of target directories +test -d ${ROOT:-"/"} || mkdir -p $ROOT +cat -s target.dirs | # print contents of the target directory list +egrep -v "^$|^#" | # get rid of blank lines and comments +while read TARGETDIR MODE OWNER GROUP +do + if [ ! -d ${ROOT}/$TARGETDIR ] + then + mkdir ${ROOT}/$TARGETDIR + if [ ! -d ${ROOT}/$TARGETDIR ] + then + echo "$0: stop: make of directory ${ROOT}/$TARGETDIR failed" + exit 1 + fi + + fi + if [ "$UID_NAME" = "root" ] + then + if [ ! -z "$MODE" -a "$MODE" != "-" ] + then + chmod $MODE ${ROOT}/$TARGETDIR + fi + if [ ! -z "$OWNER" -a "$OWNER" != "-" ] + then + chown $OWNER ${ROOT}/$TARGETDIR + fi + if [ ! -z "$GROUP" -a "$GROUP" != "-" ] + then + chgrp $GROUP ${ROOT}/$TARGETDIR + fi + fi +done # install /usr/include and /usr/include/sys header files ./:mkhead @@ -48,4 +78,9 @@ then fi # build the OS itself ./:mkuts +# build the compatibility package +if [ -d ucbcmd -d -s ucbhead -d -s ucblib ] +then + ./:mkucb +fi exit 0 diff --git a/usr/src/:mkcmd b/usr/src/:mkcmd index 1098ca7..449beac 100644 --- a/usr/src/:mkcmd +++ b/usr/src/:mkcmd @@ -1,11 +1,11 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk::mkcmd 1.29" +#ident "@(#)mk::mkcmd 1.28" # MAKE=${MAKE:-make} CLOBBER=${CLOBBER:-"ON"} diff --git a/usr/src/:mkhead b/usr/src/:mkhead index cfdb42f..343ecd0 100644 --- a/usr/src/:mkhead +++ b/usr/src/:mkhead @@ -1,11 +1,11 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk::mkhead 1.19" +#ident "@(#)mk::mkhead 1.18" # # Install UNIX System header files # diff --git a/usr/src/:mklib b/usr/src/:mklib index dbe1fa7..ba6d749 100644 --- a/usr/src/:mklib +++ b/usr/src/:mklib @@ -1,11 +1,11 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk::mklib 1.8.1.2" +#ident "@(#)mk::mklib 1.8" # # Build UNIX System libraries # For each directory build the library by invoking its @@ -26,7 +26,7 @@ do cd $LIB if [ -f $LIB.mk ] then - $MAKE -b -f $LIB.mk install + $MAKE -b -f $LIB.mk install I="install -i -n $ROOT/lib $ROOT/usr/lib" if [ $? -ne 0 ] then echo ":mklib: *** $MAKE failed using $LIB.mk" diff --git a/usr/src/:mkstand b/usr/src/:mkstand index 1ee49ea..56e71eb 100644 --- a/usr/src/:mkstand +++ b/usr/src/:mkstand @@ -1,11 +1,11 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk::mkstand 1.7" +#ident "@(#)mk::mkstand 1.6" # # make UNIX System stand-alone libraries and commands # diff --git a/usr/src/:mksyshead b/usr/src/:mksyshead index 53c1f5e..efbbf49 100644 --- a/usr/src/:mksyshead +++ b/usr/src/:mksyshead @@ -1,12 +1,4 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T -# All Rights Reserved - -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - - -#ident "@(#)mk::mksyshead 1.24" +#ident "@(#)mk::mksyshead 1.20" # # Install UNIX System 'sys' header files # @@ -60,9 +52,7 @@ for DIR in sys $MACH/sys \ $MACH/netinet \ $MACH/nfs \ $MACH/rpc \ - $MACH/des \ - $MACH/fs \ - $MACH/klm + $MACH/fs do TARGETBASE=`basename $DIR` if [ -d $SRCDIR/$DIR ] diff --git a/usr/src/:mkuts b/usr/src/:mkuts index d8cae25..4956d58 100644 --- a/usr/src/:mkuts +++ b/usr/src/:mkuts @@ -1,11 +1,11 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk::mkuts 1.15" +#ident "@(#)mk::mkuts 1.14" # # Configure and make the UNIX Operating System with various devices # diff --git a/usr/src/arglist b/usr/src/arglist index 7858644..9f482fc 100644 --- a/usr/src/arglist +++ b/usr/src/arglist @@ -1,11 +1,11 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk:arglist 1.3.1.1" +#ident "@(#)mk:arglist 1.3" # if [ x$1 = x+ ] then diff --git a/usr/src/head/archives.h b/usr/src/head/archives.h index 9f59fa0..57d2f26 100644 --- a/usr/src/head/archives.h +++ b/usr/src/head/archives.h @@ -8,7 +8,11 @@ /* Portions Copyright (c) 1988, Sun Microsystems, Inc. */ /* All Rights Reserved. */ -#ident "@(#)head.usr:archives.h 1.6" +#ident "@(#)head.usr:archives.h 1.3" + +/* + * Code review updated version. + */ /* Magic numbers */ @@ -49,7 +53,7 @@ struct hdr_cpio { char h_name[HNAMLEN]; /* filename */ } ; -/* cpio ODC header format */ +/* cpio -c header format */ struct c_hdr { char c_magic[CMS_LEN], @@ -66,7 +70,7 @@ struct c_hdr { c_name[HNAMLEN]; } ; -/* -c and CRC header format */ +/* ASCII and CRC header format */ struct Exp_cpio_hdr { char E_magic[CMS_LEN], @@ -108,8 +112,6 @@ union tblock { t_gid[TGIDLEN], /* gid of file */ t_size[TSIZLEN], /* size of file in bytes */ t_mtime[TTIMLEN], /* modification time of file */ - t_devmajor[8], /* major number for special files */ - t_devminor[8], /* minor number for special files */ t_cksum[TCRCLEN], /* checksum of header */ t_linkflag, /* indicates a link to a file */ t_linkname[TNAMLEN]; /* file this file linked with */ diff --git a/usr/src/head/filehdr.h b/usr/src/head/filehdr.h index ec82542..3772a61 100644 --- a/usr/src/head/filehdr.h +++ b/usr/src/head/filehdr.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)sgs-inc:common/filehdr.h 1.23" +#ident "@(#)sgs-inc:common/filehdr.h 1.22" #ifndef _FILEHDR_H #define _FILEHDR_H @@ -171,8 +171,6 @@ struct filehdr { /* Zilog */ /* 0544 and 0545 reserved for Zilog */ - /* i860 */ -#define I860MAGIC 0515 #define FILHDR struct filehdr #define FILHSZ sizeof(FILHDR) @@ -190,7 +188,6 @@ struct filehdr { || ((x)==I286SMAGIC) || ((x)==I286LMAGIC) \ || ((x)==MC68KWRMAGIC) || ((x)==MC68KROMAGIC) \ || ((x)==MC68KPGMAGIC) \ - || ((x)==I860MAGIC) \ || ((x)==I386MAGIC)) #endif /* _FILEHDR_H */ diff --git a/usr/src/head/fmtmsg.h b/usr/src/head/fmtmsg.h index e1e66bb..822031e 100644 --- a/usr/src/head/fmtmsg.h +++ b/usr/src/head/fmtmsg.h @@ -1,11 +1,11 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:fmtmsg.h 1.3" +#ident "@(#)head.usr:fmtmsg.h 1.1" /* * fmtmsg.h @@ -34,7 +34,7 @@ * MM_MXACTLN Maximum size of an action string */ -#define MM_MXLABELLN 25 +#define MM_MXLABELLN 20 #define MM_MXTAGLN 32 #define MM_MXTXTLN 512 #define MM_MXACTLN 512 @@ -157,12 +157,5 @@ /* Function definition */ - -#if defined(__STDC__) -int fmtmsg(long, const char *, int, const char *, const char *, const char *); -int addseverity(int, const char *); - -#else int fmtmsg(); int addseverity(); -#endif diff --git a/usr/src/head/ftw.h b/usr/src/head/ftw.h index 0e8b875..bd8e56b 100644 --- a/usr/src/head/ftw.h +++ b/usr/src/head/ftw.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:ftw.h 1.3.1.9" +#ident "@(#)head:ftw.h 1.3.1.7" /* * Codes for the third argument to the user-supplied function * which is passed as the second argument to ftwalk @@ -46,11 +46,9 @@ struct FTW #if defined(__STDC__) -#include -#include extern int ftw(const char *, int (*)(const char *, const struct stat *, int), int); extern int _xftw(const int, const char *, int (*)(const char *, const struct stat *, int), int); -extern int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int); +extern int nftw(const char *, int (*)(const char *, const struct stat *, int), int, int); #else @@ -74,8 +72,6 @@ int depth; /* nftw not available to non-EFT applications */ #if defined(_STYPES) -#include - static int nftw(path, fn, depth, flags) const char *path; int (*fn) (); diff --git a/usr/src/head/grp.h b/usr/src/head/grp.h index 04e11c4..e79cff8 100644 --- a/usr/src/head/grp.h +++ b/usr/src/head/grp.h @@ -8,7 +8,7 @@ #ifndef _GRP_H #define _GRP_H -#ident "@(#)head:grp.h 1.3.1.9" +#ident "@(#)head:grp.h 1.3.1.8" #include @@ -26,7 +26,7 @@ struct group { /* see getgrent(3) */ extern void endgrent(void); extern struct group *fgetgrent(FILE *); extern struct group *getgrent(void); -extern struct group *getgrgid(gid_t); +extern struct group *getgrgid(uid_t); extern struct group *getgrnam(const char *); extern void setgrent(void); extern int initgroups(const char *, gid_t); diff --git a/usr/src/head/ieeefp.h b/usr/src/head/ieeefp.h index e70de90..294eedf 100644 --- a/usr/src/head/ieeefp.h +++ b/usr/src/head/ieeefp.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:ieeefp.h 1.17" +#ident "@(#)head:ieeefp.h 1.16" #ifndef _IEEEFP_H #define _IEEEFP_H @@ -406,21 +406,11 @@ extern fp_union _getfltsw(fp_ftype,fp_op,char *,fp_union *,fp_union *,fp_union * static void (* _p754_1)(int *, int (*)()) = _getflthw; static fp_union (* _p754_2)(fp_ftype,fp_op,char *,fp_union *,fp_union *,fp_union *) = _getfltsw; -extern void _s2dec(float *, decimal *, int); -extern void _d2dec(double *, decimal *, int); -extern void _dec2s(decimal *, float *, int); -extern void _dec2d(decimal *, double *, int); - #else extern void _getflthw(); extern fp_union _getfltsw(); static void (* _p754_1)() = _getflthw; static fp_union (* _p754_2)() = _getfltsw; - -extern void _s2dec(); -extern void _d2dec(); -extern void _dec2s(); -extern void _dec2d(); #endif #endif /* ndef P&%$_NOFAULT 1 */ diff --git a/usr/src/head/libelf.h b/usr/src/head/libelf.h index 6a85806..c23a2cf 100644 --- a/usr/src/head/libelf.h +++ b/usr/src/head/libelf.h @@ -8,7 +8,7 @@ #ifndef _LIBELF_H #define _LIBELF_H -#ident "@(#)sgs-inc:common/libelf.h 1.8" +#ident "@(#)sgs-inc:common/libelf.h 1.7" #include #include "sys/elf.h" @@ -43,7 +43,6 @@ typedef enum { ELF_C_SET, ELF_C_FDDONE, ELF_C_FDREAD, - ELF_C_RDWR, ELF_C_NUM /* must be last */ } Elf_Cmd; diff --git a/usr/src/head/libgenIO.h b/usr/src/head/libgenIO.h index 873450a..cd92dff 100644 --- a/usr/src/head/libgenIO.h +++ b/usr/src/head/libgenIO.h @@ -5,7 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.usr:libgenIO.h 1.2" +#ident "@(#)head.usr:libgenIO.h 1.1" + +/* + * Code review updated version. + */ /* device types */ diff --git a/usr/src/head/limits.h b/usr/src/head/limits.h index 8484ca5..93debfe 100644 --- a/usr/src/head/limits.h +++ b/usr/src/head/limits.h @@ -8,7 +8,7 @@ #ifndef _LIMITS_H #define _LIMITS_H -#ident "@(#)head:limits.h 1.28" +#ident "@(#)head:limits.h 1.25" /* Sizes of integral types */ #define CHAR_BIT 8 /* max # of bits in a "char" */ @@ -49,6 +49,7 @@ #if __STDC__ - 0 == 0 || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) #define ARG_MAX 5120 /* max length of arguments to exec */ +#define CHILD_MAX 25 /* max # of processes per user id */ #define LINK_MAX 1000 /* max # of links to a single file */ #ifndef MAX_CANON @@ -59,6 +60,7 @@ #define MAX_INPUT 512 /* max size of a char input buffer */ #endif +#define NAME_MAX 14 /* max # of characters in a file name */ #define NGROUPS_MAX 16 /* max number of groups for a user */ @@ -100,11 +102,7 @@ #define _POSIX_PATH_MAX 255 #define _POSIX_PIPE_BUF 512 -#ifndef CLK_TCK -#define CLK_TCK _sysconf(3) /* 3B2 clock ticks per second */ - /* 3 is _SC_CLK_TCK */ -#endif - +#define CLK_TCK 100 /* UNIX ticks in a second */ #define DBL_DIG 15 /* digits of precision of a "double" */ #define DBL_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/ #define DBL_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/ @@ -137,8 +135,6 @@ #define FCHR_MAX 1048576 /* max size of a file in bytes */ #define PID_MAX 30000 /* max value for a process ID */ -#define CHILD_MAX 25 /* max # of processes per user id */ -#define NAME_MAX 14 /* max # of characters in a file name */ #ifndef OPEN_MAX #define OPEN_MAX 20 /* max # of files a process can have open */ @@ -164,8 +160,9 @@ #define SYSPID_MAX 1 /* max pid of system processes */ #if !defined(_STYPES) -#define SYS_NMLN 257 /* 4.0 size of utsname elements */ - /* also defined in sys/utsname.h */ +#define SYS_NMLN 256 /* 4.0 size of utsname elements */ + /* THIS MUST CHANGE TO 257 TO SUPPORT + * INTERNET HOSTNAMES */ #else #define SYS_NMLN 9 /* old size of utsname elements */ #endif /* _STYPES */ diff --git a/usr/src/head/link.h b/usr/src/head/link.h index 0f985f3..b49a6af 100644 --- a/usr/src/head/link.h +++ b/usr/src/head/link.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)sgs-inc:common/link.h 1.8" +#ident "@(#)sgs-inc:common/link.h 1.7" #ifndef _LINK_H #define _LINK_H @@ -63,9 +63,6 @@ typedef struct { #define DT_MAXPOSTAGS 24 /* number of positive tags */ #define DT_MAXNEGTAGS 3 /* number of negative tags */ -#define DT_LOPROC 0x70000000 /* processor specific range */ -#define DT_HIPROC 0x7fffffff - /* public structure defined and maintained within the run-time diff --git a/usr/src/head/malloc.h b/usr/src/head/malloc.h index 77dde07..3ef0dc6 100644 --- a/usr/src/head/malloc.h +++ b/usr/src/head/malloc.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:malloc.h 1.7" +#ident "@(#)head:malloc.h 1.6" #ifndef _MALLOC_H #define _MALLOC_H @@ -56,7 +56,6 @@ void free(); char *realloc(); int mallopt(); struct mallinfo mallinfo(); -char *calloc(); #endif /* __STDC__ */ diff --git a/usr/src/head/math.h b/usr/src/head/math.h index 848553b..855e8ca 100644 --- a/usr/src/head/math.h +++ b/usr/src/head/math.h @@ -8,9 +8,11 @@ #ifndef _MATH_H #define _MATH_H -#ident "@(#)head:math.h 2.11.1.24" +#ident "@(#)head:math.h 2.11.1.20" + +#if __STDC__ - 0 == 0 /* not ANSI conforming */ +extern int signgam; -#if __STDC__ - 0 == 0 && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) struct exception { int type; char *name; @@ -121,6 +123,7 @@ extern double hypot(double, double); extern double j0(double); extern double j1(double); extern double jn(int, double); +extern int matherr(struct exception *); extern double y0(double); extern double y1(double); extern double yn(int, double); @@ -140,10 +143,6 @@ extern double remainder(double, double); extern int unordered(double, double); extern int finite(double); -#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) -extern int matherr(struct exception *); -#endif - #endif /* __STDC__ == 0 */ #else /* !defined(__STDC__) */ @@ -199,8 +198,6 @@ extern _h_val __huge_val; #if __STDC__ - 0 == 0 || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) -extern int signgam; - /* some useful constants */ #define M_E 2.7182818284590452354 #define M_LOG2E 1.4426950408889634074 diff --git a/usr/src/head/math.h3b5x b/usr/src/head/math.h3b5x index b00cab6..16c3844 100644 --- a/usr/src/head/math.h3b5x +++ b/usr/src/head/math.h3b5x @@ -1,9 +1,3 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - #ident "@(#)head:math.h3b5x 1.12" /* M32 || u3b15 || u3b5 || u3b2 Cross-environment math.h diff --git a/usr/src/head/mon.h b/usr/src/head/mon.h index 624428b..929266a 100644 --- a/usr/src/head/mon.h +++ b/usr/src/head/mon.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:mon.h 1.8.2.2" +#ident "@(#)head:mon.h 1.8.2.1" #ifndef _MON_H #define _MON_H @@ -30,8 +30,6 @@ typedef unsigned short WORD; #if defined(__STDC__) extern void monitor(int (*)(), int (*)(), WORD *, int, int); -#else -extern void monitor(); #endif #endif /* _MON_H */ diff --git a/usr/src/head/netdb.h b/usr/src/head/netdb.h index 92cec1f..ed2a069 100644 --- a/usr/src/head/netdb.h +++ b/usr/src/head/netdb.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.usr:netdb.h 1.2" +#ident "@(#)head.usr:netdb.h 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -72,10 +72,17 @@ struct protoent { int p_proto; /* protocol # */ }; +struct rpcent { + char *r_name; /* name of server for this rpc program */ + char **r_aliases; /* alias list */ + int r_number; /* rpc program number */ +}; + struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent(); struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); struct servent *getservbyname(), *getservbyport(), *getservent(); struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); +struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); /* * Error return codes from gethostbyname() and gethostbyaddr() diff --git a/usr/src/head/nl_types.h b/usr/src/head/nl_types.h index 7a298ff..c3fd01c 100644 --- a/usr/src/head/nl_types.h +++ b/usr/src/head/nl_types.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:nl_types.h 1.3" +#ident "@(#)head:nl_types.h 1.2" /* * allow for limits.h @@ -134,8 +134,4 @@ int catclose(nl_catd); char *catgets(nl_catd, int, int, char *); nl_catd catopen(char *, int); -#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) -char *gettxt(const char *, const char *); -#endif - #endif diff --git a/usr/src/head/nsaddr.h b/usr/src/head/nsaddr.h index bd3533a..c1796bb 100644 --- a/usr/src/head/nsaddr.h +++ b/usr/src/head/nsaddr.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:nsaddr.h 1.10" +#ident "@(#)head:nsaddr.h 1.9" #ifndef _NSADDR_H #define _NSADDR_H @@ -30,15 +30,9 @@ struct address { struct netbuf addbuf; }; -#ifdef __STDC__ struct netbuf *stoa(char *, struct netbuf *); char *atos(char *, struct netbuf *, int); struct address *astoa(char *, struct address *); char *aatos(char *, struct address *, int); -#else -struct netbuf *stoa(); -char *atos(); -struct address *astoa(); -char *aatos(); -#endif + #endif /* _NSADDR_H */ diff --git a/usr/src/head/osfcn.h b/usr/src/head/osfcn.h new file mode 100644 index 0000000..d4482c7 --- /dev/null +++ b/usr/src/head/osfcn.h @@ -0,0 +1,81 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head:osfcn.h 1.9" + +#if defined(__STDC__) + +#include + +extern int access(const char *, int); +extern int acct(const char *); +extern unsigned alarm(unsigned); +extern int brk(void *); +extern int chdir(const char *); +extern int chown(const char *, uid_t, gid_t); +extern int chroot(const char *); +extern int close(int); +extern int dup(int); +extern int execl(const char *, const char *, ...); +extern int execle(const char *, const char *, ...); +extern int execlp(const char *, const char *, ...); +extern int execv(const char *, const char **); +extern int execve(const char *, const char **, const char**); +extern int execvp(const char *, const char **); +extern void exit(int); +extern void _exit(int); +extern pid_t fork(void); +extern gid_t getegid(void); +extern uid_t geteuid(void); +extern gid_t getgid(void); +extern pid_t getpid(void); +extern pid_t getppid(void); +extern pid_t getpgrp(void); +extern uid_t getuid(void); +extern int ioctl(int, int, ...); +extern int link(const char *, const char *); +extern int lockf(int, int, long); +extern long lseek(int, long, int); +extern int nice(int); +extern int pathconf(char *, int); +extern int fpathconf(int, int); +extern int pause(void); +extern int pipe(int *); +extern void profil(char *, int, int, int); +extern int ptrace(int, pid_t, int, int); +extern int read(int, void *, unsigned); +extern int rmdir(const char *); +extern void *sbrk(int); +extern int setgid(gid_t); +extern pid_t setpgrp(void); +extern int setuid(uid_t); +extern unsigned sleep(unsigned); +extern int stime(const time_t *); +extern void sync(void); +extern int sysconf(int); +extern long ulimit(int, long); +extern mode_t umask(mode_t); +extern int unlink(const char *); +extern int wait(int *); +extern int write(int, const void *, unsigned); + +#else +extern unsigned alarm(); +extern void exit(); +extern void _exit(); +extern unsigned short getegid(); +extern unsigned short geteuid(); +extern unsigned short getgid(); +extern unsigned short getuid(); +extern long lseek(); +extern void profil(); +extern char *sbrk(); +extern unsigned sleep(); +extern void sync(); +extern long ulimit(); + +#endif diff --git a/usr/src/head/pkgdev.h b/usr/src/head/pkgdev.h index 65bff35..4a33837 100644 --- a/usr/src/head/pkgdev.h +++ b/usr/src/head/pkgdev.h @@ -5,18 +5,16 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)oamhdrs:pkgdev.h 1.2.1.1" +#ident "@(#)oamhdrs:pkgdev.h 1.2" struct pkgdev { int rdonly; int mntflg; - long capacity; /* number of 512-blocks on device */ char *name; char *dirname; - char *pathname; + char *norewind; char *mount; char *fstyp; char *cdevice; char *bdevice; - char *norewind; }; diff --git a/usr/src/head/pkgtrans.h b/usr/src/head/pkgtrans.h index e727710..120cf53 100644 --- a/usr/src/head/pkgtrans.h +++ b/usr/src/head/pkgtrans.h @@ -5,11 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)oamhdrs:pkgtrans.h 1.2.1.1" +#ident "@(#)oamhdrs:pkgtrans.h 1.2" #define PT_OVERWRITE 0x01 #define PT_INFO_ONLY 0x02 #define PT_RENAME 0x04 #define PT_DEBUG 0x08 #define PT_SILENT 0x10 -#define PT_ODTSTREAM 0x40 diff --git a/usr/src/head/rpc/mp.h b/usr/src/head/rpc/mp.h new file mode 100644 index 0000000..370c9eb --- /dev/null +++ b/usr/src/head/rpc/mp.h @@ -0,0 +1,49 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.usr:rpc/mp.h 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* @(#)mp.h 1.7 88/08/19 SMI; from UCB 5.1 5/30/85 */ + +#ifndef _mp_h +#define _mp_h + +struct mint { + int len; + short *val; +}; +typedef struct mint MINT; + +extern MINT *itom(); +extern MINT *xtom(); +extern char *mtox(); +extern short *xalloc(); +extern void mfree(); + +#define FREE(x) xfree(&(x)) /* Compatibility */ + +#endif /*!_mp_h*/ diff --git a/usr/src/head/sac.h b/usr/src/head/sac.h index 778b5b0..a11fe45 100644 --- a/usr/src/head/sac.h +++ b/usr/src/head/sac.h @@ -5,12 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -# ifndef _SAC_H -# define _SAC_H - -# ident "@(#)head.usr:sac.h 1.4" - -# include +# ident "@(#)head.usr:sac.h 1.3" # define IDLEN 4 /* length in bytes of a utmp id */ # define SC_WILDC 0xff /* wild character for utmp ids */ @@ -33,7 +28,7 @@ struct pmmsg { char pm_type; /* type of message */ - unchar pm_state; /* current state of port monitor */ + char pm_state; /* current state of port monitor */ char pm_maxclass; /* max message class this PM understands */ char pm_tag[PMTAGSIZE + 1]; /* port monitor's tag */ int pm_size; /* size of optional data portion */ @@ -112,5 +107,3 @@ struct sacmsg { # define E_PMRUN 7 /* port monitor is running */ # define E_PMNOTRUN 8 /* port monitor is not running */ # define E_RECOVER 9 /* in recovery */ - -# endif /* _SAC_H */ diff --git a/usr/src/head/search.h b/usr/src/head/search.h index 6dffb99..315bbea 100644 --- a/usr/src/head/search.h +++ b/usr/src/head/search.h @@ -8,7 +8,7 @@ #ifndef _SEARCH_H #define _SEARCH_H -#ident "@(#)head:search.h 1.3.1.11" +#ident "@(#)head:search.h 1.3.1.8" #ifndef _SIZE_T #define _SIZE_T @@ -24,7 +24,7 @@ struct qelem { }; #if defined(__STDC__) -typedef struct entry { char *key; void *data; } ENTRY; +typedef struct entry { void *key, *data; } ENTRY; int hcreate(size_t); void hdestroy(void); ENTRY *hsearch(ENTRY, ACTION); @@ -45,7 +45,7 @@ typedef enum { preorder, postorder, endorder, leaf } VISIT; #if defined(__STDC__) void *tdelete(const void *, void **, int (*)(const void *, const void *)); -void *tfind(const void *, void *const *, int (*)(const void *, const void *)); +void *tfind(const void *, void **, int (*)(const void *, const void *)); void *tsearch(const void *, void **, int (*)(const void *, const void *)); void twalk(void *, void (*)(void *, VISIT, int)); #else @@ -64,7 +64,7 @@ void *bsearch(const void *, const void *, size_t, size_t, /* LSEARCH(3C) */ void *lfind(const void *, const void *, size_t *, size_t, int (*)(const void *, const void *)); -void *lsearch(const void *, void *, size_t *, size_t, +void *lsearch(const void *, const void *, size_t *, size_t, int (*)(const void *, const void *)); #else char *bsearch(); diff --git a/usr/src/head/sgtty.h b/usr/src/head/sgtty.h index d53164d..ae63bb0 100644 --- a/usr/src/head/sgtty.h +++ b/usr/src/head/sgtty.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:sgtty.h 1.3.1.3" +#ident "@(#)head:sgtty.h 1.3.1.2" #ifndef _SGTTY_H #define _SGTTY_H @@ -64,17 +64,6 @@ struct sgttyb { char sg_kill; /* kill character */ int sg_flags; /* mode flags */ }; - -/* BSD local special chars. Structure for TIOCSLTC/TIOCGLTC */ -struct ltchars { - char t_suspc; /* stop process signal */ - char t_dsuspc; /* delayed stop process signal */ - char t_rprntc; /* reprint line */ - char t_flushc; /* flush output (toggles) */ - char t_werasc; /* word erase */ - char t_lnextc; /* literal next character */ -}; - /* * Speeds */ diff --git a/usr/src/head/shadow.h b/usr/src/head/shadow.h index 01646b4..2035e6e 100644 --- a/usr/src/head/shadow.h +++ b/usr/src/head/shadow.h @@ -1,11 +1,11 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:shadow.h 1.2" +#ident "@(#)head.usr:shadow.h 1.2" #define PASSWD "/etc/passwd" #define SHADOW "/etc/shadow" @@ -33,7 +33,7 @@ struct spwd { long sp_warn ; /* number of days to warn user to change passwd */ long sp_inact ; /* number of days the login may be inactive */ long sp_expire ; /* date when the login is no longer valid */ - unsigned long sp_flag; /* currently not being used */ + int sp_flag; /* currently not being used */ } ; #if defined(__STDC__) diff --git a/usr/src/head/signal.h b/usr/src/head/signal.h index 87c06ae..720fb53 100644 --- a/usr/src/head/signal.h +++ b/usr/src/head/signal.h @@ -8,13 +8,14 @@ #ifndef _SIGNAL_H #define _SIGNAL_H -#ident "@(#)head:signal.h 1.5.3.2" +#ident "@(#)head:signal.h 1.5.1.9" typedef int sig_atomic_t; extern char *_sys_siglist[]; extern int _sys_nsig; +#include #include #if defined(__STDC__) @@ -23,9 +24,8 @@ extern void (*signal(int, void (*)(int)))(int); extern int raise(int); #if __STDC__ == 0 || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) -#include extern int kill(pid_t, int); -extern int sigaction(int, const struct sigaction *, struct sigaction *); +extern int sigaction(int, struct sigaction *, struct sigaction *); extern int sigaddset(sigset_t *, int); extern int sigdelset(sigset_t *, int); extern int sigemptyset(sigset_t *); diff --git a/usr/src/head/stdlib.h b/usr/src/head/stdlib.h index 1865894..6fb69a0 100644 --- a/usr/src/head/stdlib.h +++ b/usr/src/head/stdlib.h @@ -8,7 +8,7 @@ #ifndef _STDLIB_H #define _STDLIB_H -#ident "@(#)head:stdlib.h 1.19" +#ident "@(#)head:stdlib.h 1.15" typedef struct { int quot; @@ -90,7 +90,7 @@ extern char *ecvt(double, int, int *, int *); extern char *fcvt(double, int, int *, int *); extern char *getcwd(char *, int); extern char *getlogin(void); -extern int getopt(int, char *const *, const char *); +extern int getopt(int, const char **, const char *); extern char *getpass(const char *); extern int getpw(int, char *); extern char *gcvt(double, int, char *); @@ -100,7 +100,7 @@ extern char *l64a(long); extern void ltol3(char *, const long *, int); extern void * memalign(size_t, size_t); extern char *mktemp(char *); -extern int putenv(char *); +extern int putenv(const char *); extern char *realpath(char *, char *); extern void swab(const char *, char *, int); extern char *ttyname(int); diff --git a/usr/src/head/string.h b/usr/src/head/string.h index 9109df4..3eafb32 100644 --- a/usr/src/head/string.h +++ b/usr/src/head/string.h @@ -8,7 +8,7 @@ #ifndef _STRING_H #define _STRING_H -#ident "@(#)head:string.h 1.7.1.11" +#ident "@(#)head:string.h 1.7.1.7" #ifndef _SIZE_T #define _SIZE_T @@ -82,7 +82,6 @@ extern char *memccpy(), *memchr(), *memcpy(), - *memmove(), *memset(); extern int memcmp(); diff --git a/usr/src/head/sys.u3b15 b/usr/src/head/sys.u3b15 index 3f183c4..9365a9c 100644 --- a/usr/src/head/sys.u3b15 +++ b/usr/src/head/sys.u3b15 @@ -1,9 +1,3 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - #ident "@(#)head:sys.u3b15 1.1" .set exit,1*8 .set fork,2*8 diff --git a/usr/src/head/sys.u3b5 b/usr/src/head/sys.u3b5 index 7b6207e..698cd54 100644 --- a/usr/src/head/sys.u3b5 +++ b/usr/src/head/sys.u3b5 @@ -1,9 +1,3 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - #ident "@(#)head:sys.u3b5 1.2" .set exit,1*8 .set fork,2*8 diff --git a/usr/src/head/tar.h b/usr/src/head/tar.h index 078f305..863e106 100644 --- a/usr/src/head/tar.h +++ b/usr/src/head/tar.h @@ -8,7 +8,7 @@ #ifndef _TAR_H #define _TAR_H -#ident "@(#)head:tar.h 1.2" +#ident "@(#)head:tar.h 1.1" #define TMAGIC "ustar" #define TMAGLEN 6 @@ -42,6 +42,6 @@ #define TGEXEC 00010 #define TOREAD 00004 #define TOWRITE 00002 -#define TOEXEC 00001 +#define TEXEC 00001 #endif /* _TAR_H */ diff --git a/usr/src/head/time.h b/usr/src/head/time.h index 7a2e31e..6ef60b1 100644 --- a/usr/src/head/time.h +++ b/usr/src/head/time.h @@ -8,7 +8,7 @@ #ifndef _TIME_H #define _TIME_H -#ident "@(#)head:time.h 1.17" +#ident "@(#)head:time.h 1.14" #ifndef NULL #define NULL 0 @@ -29,8 +29,6 @@ typedef long time_t; #define CLOCKS_PER_SEC 1000000 - - struct tm { /* see ctime(3) */ int tm_sec; int tm_min; @@ -60,21 +58,13 @@ extern void tzset(void); extern long timezone; extern int daylight; -extern char *tzname[2]; - -#ifndef CLK_TCK -#define CLK_TCK _sysconf(3) /* 3B2 clock ticks per second */ - /* 3 is _SC_CLK_TCK */ +extern char *tzname[]; #endif -#endif - -#if __STDC__ == 0 && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) +#if __STDC__ == 0 extern int cftime(char *, char *, const time_t *); extern int ascftime(char *, const char *, const struct tm *); extern long altzone; -extern struct tm *getdate(const char *); -extern int getdate_err; #endif #else @@ -91,10 +81,7 @@ extern void tzset(); extern long timezone, altzone; extern int daylight; -extern char *tzname[2]; - -extern struct tm *getdate(); -extern int getdate_err; +extern char *tzname[]; #endif /* __STDC__ */ diff --git a/usr/src/head/tiuser.h b/usr/src/head/tiuser.h index 357a80f..019b8fb 100644 --- a/usr/src/head/tiuser.h +++ b/usr/src/head/tiuser.h @@ -1,11 +1,11 @@ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.usr:tiuser.h 1.1" +#ident "@(#)head:tiuser.h 1.2" /* * TLI user interface definitions. diff --git a/usr/src/head/unistd.h b/usr/src/head/unistd.h index 0d690d7..6181d15 100644 --- a/usr/src/head/unistd.h +++ b/usr/src/head/unistd.h @@ -8,7 +8,7 @@ #ifndef _UNISTD_H #define _UNISTD_H -#ident "@(#)head:unistd.h 1.22" +#ident "@(#)head:unistd.h 1.14" /* Symbolic constants for the "access" routine: */ #define R_OK 4 /* Test for Read permission */ @@ -31,8 +31,31 @@ #define GF_PATH "/etc/group" /* Path name of the "group" file */ #define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */ -#include +/* command names for POSIX sysconf */ +#define _SC_ARG_MAX 1 +#define _SC_CHILD_MAX 2 +#define _SC_CLK_TCK 3 +#define _SC_NGROUPS_MAX 4 +#define _SC_OPEN_MAX 5 +#define _SC_JOB_CONTROL 6 +#define _SC_SAVED_IDS 7 +#define _SC_VERSION 8 +#define _SC_PASS_MAX 9 +#define _SC_LOGNAME_MAX 10 +#define _SC_PAGESIZE 11 + +/* command names for POSIX pathconf */ + +#define _PC_LINK_MAX 1 +#define _PC_MAX_CANON 2 +#define _PC_MAX_INPUT 3 +#define _PC_NAME_MAX 4 +#define _PC_PATH_MAX 5 +#define _PC_PIPE_BUF 6 +#define _PC_NO_TRUNC 7 +#define _PC_VDISABLE 8 +#define _PC_CHOWN_RESTRICTED 9 /* compile-time symbolic constants, ** Support does not mean the feature is enabled. @@ -58,8 +81,6 @@ /* Current version of POSIX */ #define _POSIX_VERSION 198808L -/* Current version of XOPEN */ -#define _XOPEN_VERSION 3 #if defined(__STDC__) @@ -80,52 +101,54 @@ extern int dup2(int, int); extern int execl(const char *, const char *, ...); extern int execle(const char *, const char *, ...); extern int execlp(const char *, const char *, ...); -extern int execv(const char *, char *const *); -extern int execve(const char *, char *const *, char *const *); -extern int execvp(const char *, char *const *); +extern int execv(const char *, const char **); +extern int execve(const char *, const char **, const char**); +extern int execvp(const char *, const char **); extern void exit(int); extern void _exit(int); extern pid_t fork(void); -extern long fpathconf(int, int); +extern int fpathconf(int, int); extern char *getcwd(char *, int); extern gid_t getegid(void); extern uid_t geteuid(void); extern gid_t getgid(void); extern int getgroups(int, gid_t *); -extern char *getlogin(void); +extern char *getlogin(); extern pid_t getpid(void); extern pid_t getppid(void); extern pid_t getpgrp(void); +extern char *getlogin(); extern uid_t getuid(void); extern int ioctl(int, int, ...); extern int isatty(int); extern int link(const char *, const char *); extern int lockf(int, int, long); -extern off_t lseek(int, off_t, int); +extern long lseek(int, long, int); extern int nice(int); -extern long pathconf(char *, int); +extern int pathconf(char *, int); extern int pause(void); extern int pipe(int *); extern void profil(char *, int, int, int); extern int ptrace(int, pid_t, int, int); extern int read(int, void *, unsigned); -extern int rename(const char *, const char *); extern int rmdir(const char *); extern void *sbrk(int); extern int setgid(gid_t); extern int setpgid(pid_t, pid_t); extern pid_t setpgrp(void); -extern pid_t setsid(void); +extern pid_t setsid(); extern int setuid(uid_t); extern unsigned sleep(unsigned); extern int stime(const time_t *); extern void sync(void); -extern long sysconf(int); +extern int sysconf(int); extern char *ttyname(int); extern pid_t tcgetpgrp(int); extern int tcsetpgrp(int, pid_t); extern char *ttyname(int); +extern long ulimit(int, long); extern int unlink(const char *); +extern int wait(int *); extern int write(int, const void *, unsigned); #else @@ -149,25 +172,25 @@ extern int execve(); extern int execvp(); extern void exit(); extern void _exit(); -extern int fork(); -extern long fpathconf(); +extern pid_t fork(); +extern int fpathconf(); extern char *getcwd(); -extern int getegid(); -extern int geteuid(); -extern int getgid(); +extern gid_t getegid(); +extern uid_t geteuid(); +extern gid_t getgid(); extern int getgroups(); extern char *getlogin(); -extern int getpid(); -extern int getppid(); -extern int getpgrp(); -extern int getuid(); +extern pid_t getpid(); +extern pid_t getppid(); +extern pid_t getpgrp(); +extern uid_t getuid(); extern int ioctl(); extern int isatty(); extern int link(); extern int lockf(); extern long lseek(); extern int nice(); -extern long pathconf(); +extern int pathconf(); extern int pause(); extern int pipe(); extern void profil(); @@ -177,17 +200,19 @@ extern int rmdir(); extern void *sbrk(); extern int setgid(); extern int setpgid(); -extern int setpgrp(); -extern int setsid(); +extern pid_t setpgrp(); +extern pid_t setsid(); extern int setuid(); extern unsigned sleep(); extern int stime(); extern void sync(); -extern long sysconf(); -extern int tcgetpgrp(); +extern int sysconf(); +extern pid_t tcgetpgrp(); extern int tcsetpgrp(); extern char *ttyname(); +extern long ulimit(); extern int unlink(); +extern int wait(); extern int write(); #endif diff --git a/usr/src/head/userdefs.h b/usr/src/head/userdefs.h index ef0a81b..535189a 100644 --- a/usr/src/head/userdefs.h +++ b/usr/src/head/userdefs.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)userdefs.h:userdefs.h 1.7.1.1" +#ident "@(#)userdefs.h:userdefs.h 1.7" /* User/group default values */ #define DEFGID 99 /* max reserved group id */ @@ -13,7 +13,7 @@ #define DEFGROUP 1 #define DEFGNAME "other" #define DEFPARENT "/home" -#define DEFSKL "/etc/skel" +#define DEFSKL "/usr/sadm/skel" #define DEFSHL "/sbin/sh" #define DEFINACT 0 #define DEFEXPIRE "" diff --git a/usr/src/head/utmp.h b/usr/src/head/utmp.h index 66268ec..be4b865 100644 --- a/usr/src/head/utmp.h +++ b/usr/src/head/utmp.h @@ -5,15 +5,15 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:utmp.h 1.5.1.7" +#ident "@(#)head:utmp.h 1.5.1.6" #ifndef _UTMP_H #define _UTMP_H #include -#define UTMP_FILE "/var/adm/utmp" -#define WTMP_FILE "/var/adm/wtmp" +#define UTMP_FILE "/etc/utmp" +#define WTMP_FILE "/etc/wtmp" #define ut_name ut_user struct utmp diff --git a/usr/src/head/utmpx.h b/usr/src/head/utmpx.h index 6d7680f..806b049 100644 --- a/usr/src/head/utmpx.h +++ b/usr/src/head/utmpx.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head:utmpx.h 1.3" +#ident "@(#)head:utmpx.h 1.1" /******************************************************************* @@ -36,26 +36,22 @@ publication. #include #include -#define UTMPX_FILE "/var/adm/utmpx" -#define WTMPX_FILE "/var/adm/wtmpx" +#define UTMPX_FILE "/etc/utmpx" +#define WTMPX_FILE "/etc/wtmpx" #define ut_name ut_user #define ut_xtime ut_tv.tv_sec struct utmpx { - char ut_user[32]; /* user login name */ - char ut_id[4]; /* inittab id */ - char ut_line[32]; /* device name (console, lnxx) */ - pid_t ut_pid; /* process id */ - short ut_type; /* type of entry */ + char ut_user[32] ; /* user login name */ + char ut_id[4] ; /* /etc/inittab id(usually line #) */ + char ut_line[32] ; /* device name (console, lnxx) */ + pid_t ut_pid ; /* process id */ + short ut_type ; /* type of entry */ struct exit_status ut_exit; /* process termination/exit status */ - struct timeval ut_tv; /* time entry was made */ - long ut_session; /* session ID, used for windowing */ - long pad[5]; /* reserved for future use */ - short ut_syslen; /* significant length of ut_host */ - /* including terminating null */ - char ut_host[257]; /* remote host name */ + struct timeval ut_tv ; /* time entry was made */ + char ut_host[64]; /* remote host name */ } ; /* Definitions for ut_type */ diff --git a/usr/src/head/values.h3b5x b/usr/src/head/values.h3b5x index 9387dc8..772bbd7 100644 --- a/usr/src/head/values.h3b5x +++ b/usr/src/head/values.h3b5x @@ -1,9 +1,3 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - #ident "@(#)head:values.h3b5x 1.9" /* diff --git a/usr/src/ldflags b/usr/src/ldflags index 436a0f5..4c34c01 100644 --- a/usr/src/ldflags +++ b/usr/src/ldflags @@ -1,8 +1,8 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)mk:ldflags 1.8" +#ident "@(#)mk:ldflags 1.7" diff --git a/usr/src/lib/.lib.mk b/usr/src/lib/.lib.mk index f49eac8..312f26a 100644 --- a/usr/src/lib/.lib.mk +++ b/usr/src/lib/.lib.mk @@ -1,26 +1,20 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)lib:libmk.template 1.14.2.3" # Template for Global Library Makefile # # -CCSLIB=$(ROOT)/usr/ccs/lib -LIB=$(ROOT)/lib -USRLIB=$(ROOT)/usr/lib -LIBP=$(ROOT)/usr/ccs/lib/libp -OWN=bin -GRP=bin -CCSBIN=$(ROOT)/usr/ccs/bin +CCSLIB=/langint/3b2sgs/5.0/b7/usr/ccs/lib +LIB=/langint/3b2sgs/5.0/b7/lib +USRLIB=/langint/3b2sgs/5.0/b7/usr/lib +LIBP=/langint/3b2sgs/5.0/b7/usr/ccs/lib/libp +OWN=langint +GRP=lang +CCSBIN= LIBLIST=* MACH=m32 INC=$(ROOT)/usr/include INCSYS=$(ROOT)/usr/include MAKE=make -SGS= +SGS=m32 MAC=BMAC CFLAGS= diff --git a/usr/src/lib/libadm/ckdate.c b/usr/src/lib/libadm/ckdate.c index e031905..e631da3 100644 --- a/usr/src/lib/libadm/ckdate.c +++ b/usr/src/lib/libadm/ckdate.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckdate.c 1.4" +#ident "@(#)libadm:ckdate.c 1.1" #include #include @@ -46,7 +46,6 @@ static char *p_ndigit(), #define DELIM1 '/' #define DELIM2 '-' #define BLANK ' ' -#define TAB ' ' static void setmsg(msg, fmt) @@ -99,15 +98,10 @@ int llim, ulim; char daynum[3]; int begin = -1; int iday = 0; - int idaymax = 2; daynum[0] = '\0'; - if (*string == BLANK) { - *string++; - idaymax--; - } copy = string; - while (isdigit(*copy) && (iday < idaymax)) { + while (isdigit(*copy) && (iday < 3 )) { daynum[iday] = *copy++ ; iday++; } @@ -155,11 +149,11 @@ char *string, mnabr; int n = 0; if(mnabr == 'a') { - mlen = 3; + mlen = 4; for (icnt = 0; icnt < 12; icnt++) mnth[icnt] = amonth[icnt]; } else { - mlen = 9; + mlen = 10; for (icnt = 0; icnt < 12; icnt++) mnth[icnt] = fmonth[icnt]; } @@ -173,7 +167,7 @@ char *string, mnabr; } mletter[imnth] = '\0'; while (!(legit) && (n < 12)) { - if(strncmp(mletter, mnth[n], (imnth = strlen(mnth[n]))) == 0) + if(strcmp(mletter, mnth[n]) == 0) legit = 1; /* found legitimate string */ n++; } @@ -205,78 +199,24 @@ char *string, dchoice; return((dlm == dchoice) ? string + 1 : NULL); } -int +void ckdate_err(fmt, error) char *fmt, *error; { char defmesg[MSGSIZ]; - if(fmtcheck(fmt) == 1) - return(4); setmsg(defmesg, fmt); puterror(stdout, defmesg, error); - return(0); } -int +void ckdate_hlp(fmt, help) char *fmt, *help; { char defmesg[MSGSIZ]; - if(fmtcheck(fmt) == 1) - return(4); setmsg(defmesg, fmt); puthelp(stdout, defmesg, help); - return(0); -} - -/* -* A little state machine that checks out the format to -* make sure it is acceptable. -* return value 1: NG -* return value 0: OK -*/ -int -fmtcheck(fmt) -char *fmt; -{ - int percent = 0; - - while(*fmt) { - switch(*fmt++) { - case '%': /* previous state must be start or letter */ - if(percent == 0) - percent = 1; - else - return(1); - break; - case 'd': /* previous state must be "%"*/ - case 'e': - case 'm': - case 'y': - case 'Y': - case 'D': - case 'h': - case 'b': - case 'B': - if(percent == 1) - percent = 0; - else - return(1); - break; - case TAB: /* previous state must be start or letter */ - case BLANK: - case DELIM1: - case DELIM2: - if(percent == 1) - return(1); - break; - default: - return(1); - } - } - return(percent); } int @@ -286,9 +226,6 @@ char *fmt, *input; char ltrl, dfl; int valid = 1; /* time of day string is valid for format */ - if((fmt != NULL) && (fmtcheck(fmt) == 1)) - return(4); - if(fmt == NULL) fmt = DEFAULT; ltrl = dfl = '\0'; @@ -381,7 +318,7 @@ char *fmt, *input; if(*input) valid = 0; } - return((valid == 0)); + return(!valid); } ckdate(date, fmt, defstr, error, help, prompt) @@ -397,9 +334,6 @@ char *defstr, *error, *help; ept = end; *ept = '\0'; - if((fmt != NULL) && (fmtcheck(fmt) == 1)) - return(4); - setmsg(defmesg, fmt); (void) sprintf(ept, "[?,q]"); diff --git a/usr/src/lib/libadm/ckgid.c b/usr/src/lib/libadm/ckgid.c index d8e0252..83c3aef 100644 --- a/usr/src/lib/libadm/ckgid.c +++ b/usr/src/lib/libadm/ckgid.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckgid.c 1.2" +#ident "@(#)libadm:ckgid.c 1.1" #include #include @@ -66,19 +66,16 @@ int disp; return(msg); } -int +void ckgid_dsp() { struct group *grpptr; /* if display flag is set, then list out group file */ - if (ckgrpfile() == 1) - return(1); setgrent(); while (grpptr = getgrent()) (void) printf("%s\n", grpptr->gr_name); endgrent(); - return(0); } int @@ -93,20 +90,6 @@ char *grpnm; return(valid); } -int -ckgrpfile() /* check to see if group file there */ -{ - struct group *grpptr; - - setgrent (); - if (!(grpptr = getgrent())) { - endgrent (); - return(1); - } - endgrent (); - return(0); -} - void ckgid_err(disp, error) char *error; diff --git a/usr/src/lib/libadm/ckint.c b/usr/src/lib/libadm/ckint.c index 3bee5e4..b690256 100644 --- a/usr/src/lib/libadm/ckint.c +++ b/usr/src/lib/libadm/ckint.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckint.c 1.3" +#ident "@(#)libadm:ckint.c 1.1" #include #include @@ -49,9 +49,7 @@ short base; char *ptr; (void) strtol(value, &ptr, base); - if(*ptr == '\0') - return(0); - return(1); + return(*ptr != '\0'); } void @@ -62,7 +60,7 @@ char *error; char defmesg[64]; setmsg(defmesg, base); - puterror(stdout, defmesg, error); + puterror(stderr, defmesg, error); } void @@ -73,7 +71,7 @@ char *help; char defmesg[64]; setmsg(defmesg, base); - puthelp(stdout, defmesg, help); + puthelp(stderr, defmesg, help); } int diff --git a/usr/src/lib/libadm/ckitem.c b/usr/src/lib/libadm/ckitem.c index 6dc402c..b0bce05 100644 --- a/usr/src/lib/libadm/ckitem.c +++ b/usr/src/lib/libadm/ckitem.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckitem.c 1.3" +#ident "@(#)libadm:ckitem.c 1.1" #include #include @@ -102,26 +102,6 @@ int attr; return(pt); } -void -ckitem_err(menup, error) -CKMENU *menup; -char *error; -{ - deferr = setmsg(menup, 1); - puterror(stdout, deferr, error); - free(deferr); -} - -void -ckitem_hlp(menup, help) -CKMENU *menup; -char *help; -{ - defhlp = setmsg(menup, 0); - puthelp(stdout, defhlp, help); - free(defhlp); -} - ckitem(menup, item, max, defstr, error, help, prompt) CKMENU *menup; char *item[]; @@ -145,7 +125,6 @@ char *defstr, *error, *help, *prompt; item[0] = menup->choice->token; else if(menup->invis) item[0] = menup->invis[0]; - item[1] = NULL; return(0); } } @@ -182,7 +161,6 @@ char *defstr, *error, *help, *prompt; for(i=0; (i < max); i++) item[i] = list[i]; free((char *)list); - item[i] = NULL; } free(defhlp); free(deferr); diff --git a/usr/src/lib/libadm/ckpath.c b/usr/src/lib/libadm/ckpath.c index 90ef2c0..85a9c3d 100644 --- a/usr/src/lib/libadm/ckpath.c +++ b/usr/src/lib/libadm/ckpath.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckpath.c 1.3" +#ident "@(#)libadm:ckpath.c 1.1" #include #include @@ -131,7 +131,7 @@ int pflags; ((pflags & P_CREAT) && (pflags & (P_EXIST|P_NEXIST|P_BLK|P_CHR))) || ((pflags & P_BLK) && (pflags & (P_CHR|P_REG|P_DIR|P_NONZERO))) || ((pflags & P_CHR) && (pflags & (P_REG|P_DIR|P_NONZERO))) || - ((pflags & P_DIR) && (pflags & P_REG))) { + ((pflags & P_DIR) && (pflags & (P_REG|P_NONZERO)))) { return(1); } return(0); @@ -205,7 +205,7 @@ int pflags; return(1); } if((pflags & P_WRITE) && !(status.st_mode & S_IWRITE)) { - errstr = E_WRITE; + errstr = E_READ; return(1); } if((pflags & P_EXEC) && !(status.st_mode & S_IEXEC)) { @@ -226,12 +226,12 @@ char *error, *input; if(input) { if(ckpath_val(input, pflags)) { (void) sprintf(buffer, "Pathname %s.", errstr); - puterror(stdout, buffer, error); + puterror(stderr, buffer, error); return; } } defhlp = sethlp(pflags); - puterror(stdout, defhlp, error); + puterror(stderr, defhlp, error); free(defhlp); } @@ -243,7 +243,7 @@ char *help; char *defhlp; defhlp = sethlp(pflags); - puthelp(stdout, defhlp, help); + puthelp(stderr, defhlp, help); free(defhlp); } diff --git a/usr/src/lib/libadm/ckrange.c b/usr/src/lib/libadm/ckrange.c index 6f04f9b..ecb7495 100644 --- a/usr/src/lib/libadm/ckrange.c +++ b/usr/src/lib/libadm/ckrange.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckrange.c 1.3" +#ident "@(#)libadm:ckrange.c 1.1" #include #include @@ -31,7 +31,7 @@ char *msg; long lower, upper; int base; { - if((base == 10) || (base == 0)) + if(base == 10) (void) sprintf(msg, MESG10, lower, upper); else (void) sprintf(msg, MESG, base, lower, upper); @@ -58,7 +58,7 @@ char *help; char defmesg[MSGSIZ]; setmsg(defmesg, lower, upper, base); - puthelp(stdout, defmesg, help); + puterror(stdout, defmesg, help); } int @@ -71,9 +71,9 @@ char *input; long value; value = strtol(input, &ptr, base); - if((*ptr != '\0') || (value < lower) || (value > upper)) - return(1); - return(0); + if(*ptr != '\0') + return(-1); + return((value < lower) || (value > upper)); } int diff --git a/usr/src/lib/libadm/ckstr.c b/usr/src/lib/libadm/ckstr.c index 76b3d7e..fabcd59 100644 --- a/usr/src/lib/libadm/ckstr.c +++ b/usr/src/lib/libadm/ckstr.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckstr.c 1.2" +#ident "@(#)libadm:ckstr.c 1.1" #include #include @@ -91,7 +91,7 @@ int length; errstr = ERRMSG3; valid = 0; } - return(valid == 0); + return(!valid); } void diff --git a/usr/src/lib/libadm/cktime.c b/usr/src/lib/libadm/cktime.c index e1ed24d..81519b8 100644 --- a/usr/src/lib/libadm/cktime.c +++ b/usr/src/lib/libadm/cktime.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:cktime.c 1.5" +#ident "@(#)libadm:cktime.c 1.1" #include #include #include @@ -21,7 +21,7 @@ extern int getinput(), puttext(); #define PROMPT "Enter the time of day" -#define ERRMSG "Please enter the time of day. Format is" +#define ERRMSG "Please enter the time day. Format is <%s>." #define DEFAULT "%H:%M" #define TLEN 3 @@ -34,16 +34,6 @@ extern int getinput(), #define US 59 #define DELIM1 ':' #define BLANK ' ' -#define TAB ' ' - -static void -setmsg(msg, fmt) -char *msg, *fmt; -{ - if(fmt == NULL) - fmt = DEFAULT; - (void) sprintf(msg, "%s <%s>.", ERRMSG, fmt); -} static char * p_ndig(string, value) @@ -122,9 +112,6 @@ char *fmt, *input; char ltrl, dfl; int valid = 1; /* time of day string is valid for format */ - if((fmt != NULL) && (fmtcheck(fmt) == 1)) - return(4); - if(fmt == NULL) fmt = DEFAULT; ltrl = dfl = '\0'; @@ -256,79 +243,27 @@ char *fmt, *input; if(!(*fmt) && (*input)) valid = 0; - return((valid == 0)); + return(!valid); } -int +void cktime_err(fmt, error) char *fmt, *error; { char defmesg[128]; - if(fmtcheck(fmt) == 1) - return(4); - setmsg(defmesg, fmt); + (void) sprintf(defmesg, ERRMSG, fmt); puterror(stdout, defmesg, error); - return(0); } -int +void cktime_hlp(fmt, help) char *fmt, *help; { char defmesg[128]; - if(fmtcheck(fmt) == 1) - return(4); - setmsg(defmesg, fmt); + (void) sprintf(defmesg, ERRMSG, fmt); puthelp(stdout, defmesg, help); - return(0); -} - -/* -* A little state machine that checks out the format to -* make sure it is acceptable. -* return value 1: NG -* return value 0: OK -*/ -int -fmtcheck(fmt) -char *fmt; -{ - int percent = 0; - - while(*fmt) { - switch(*fmt++) { - case '%': /* previous state must be start or letter */ - if(percent == 0) - percent = 1; - else - return(1); - break; - case 'H': /* previous state must be "%"*/ - case 'M': - case 'S': - case 'T': - case 'R': - case 'r': - case 'I': - case 'p': - if(percent == 1) - percent = 0; - else - return(1); - break; - case TAB: /* previous state must be start or letter */ - case BLANK: - case DELIM1: - if(percent == 1) - return(1); - break; - default: - return(1); - } - } - return(percent); } int @@ -341,12 +276,9 @@ char *defstr, *error, *help; char input[128], defmesg[128]; - if((fmt != NULL) && (fmtcheck(fmt) == 1)) - return(4); - if(fmt == NULL) fmt = DEFAULT; - setmsg(defmesg, fmt); + (void) sprintf(defmesg, ERRMSG, fmt); if(!prompt) prompt = "Enter a time of day"; diff --git a/usr/src/lib/libadm/ckuid.c b/usr/src/lib/libadm/ckuid.c index 3cdff70..c7c9ed1 100644 --- a/usr/src/lib/libadm/ckuid.c +++ b/usr/src/lib/libadm/ckuid.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:ckuid.c 1.2" +#ident "@(#)libadm:ckuid.c 1.1" #include #include @@ -66,19 +66,16 @@ int disp; return(msg); } -int +void ckuid_dsp() { struct passwd *pwdptr; /* if display flag is set, then list out passwd file */ - if (ckpwdfile() == 1) - return(1); setpwent(); while(pwdptr = getpwent()) (void) printf("%s\n", pwdptr->pw_name); endpwent(); - return(0); } int @@ -93,20 +90,6 @@ char *usrnm; return(valid); } -int -ckpwdfile() /* check to see if passwd file there */ -{ - struct passwd *pwdptr; - - setpwent (); - if (!(pwdptr = getpwent())) { - endpwent (); - return(1); - } - endpwent (); - return(0); -} - void ckuid_err(disp, error) short disp; diff --git a/usr/src/lib/libadm/getvol.c b/usr/src/lib/libadm/getvol.c index 925048e..a4502d2 100644 --- a/usr/src/lib/libadm/getvol.c +++ b/usr/src/lib/libadm/getvol.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:getvol.c 1.2" +#ident "@(#)libadm:getvol.c 1.1" #include #include @@ -16,7 +16,6 @@ extern int ckquit; #define LABELSIZ 6 -#define BELL "\007" #define FORMFS_MSG ",\\n\\ \\ or [f] to format %s and place a filesystem on it" #define FORMAT_MSG ",\\n\\ \\ or [f] to format the %s" @@ -337,7 +336,6 @@ int options; *pt = '\0'; pt = prmpt; - fprintf(stderr, BELL); for(;;) { if(n = ckkeywd(strval, keyword, NULL, NULL, NULL, pt)) return(n); diff --git a/usr/src/lib/libadm/libadm.mk b/usr/src/lib/libadm/libadm.mk index 3e296cb..36e4890 100644 --- a/usr/src/lib/libadm/libadm.mk +++ b/usr/src/lib/libadm/libadm.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libadm:libadm.mk 1.2" +#ident "@(#)libadm:libadm.mk 1.1" .c.a:; INC=$(ROOT)/usr/include @@ -30,7 +30,7 @@ LINTFILES= \ devreserv.c putdev.c putdgrp.c \ memory.c -CFLAGS=-I. -I$(INC) $(XFLAGS) $(CCFLAGS) +CFLAGS=-I . -I $(INC) $(XFLAGS) $(CCFLAGS) PKGINFO_FILES=\ $(LIBADM)(pkginfo.o) $(LIBADM)(pkgnmchk.o) $(LIBADM)(pkgparam.o) diff --git a/usr/src/lib/libadm/puttext.c b/usr/src/lib/libadm/puttext.c index 2ef1050..c76c8e4 100644 --- a/usr/src/lib/libadm/puttext.c +++ b/usr/src/lib/libadm/puttext.c @@ -6,12 +6,12 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libadm:puttext.c 1.2" +#ident "@(#)libadm:puttext.c 1.1" #include #include -#define MWIDTH 256 +#define MWIDTH 80 #define WIDTH 60 int diff --git a/usr/src/lib/libc/inc/synonyms.h b/usr/src/lib/libc/inc/synonyms.h index ae61160..cf8ac68 100644 --- a/usr/src/lib/libc/inc/synonyms.h +++ b/usr/src/lib/libc/inc/synonyms.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc:inc/synonyms.h 1.33" +#ident "@(#)libc:inc/synonyms.h 1.20" #if defined(__STDC__) @@ -30,6 +30,9 @@ #define async_daemon _async_daemon #define brk _brk #define brkbase _brkbase +#define cat_init _cat_init +#define cat_malloc_init _cat_malloc_init +#define cat_name _cat_name #define catclose _catclose #define catgets _catgets #define catopen _catopen @@ -67,6 +70,9 @@ #define environ _environ #define erand48 _erand48 #define etext _etext +#define ev_traptousr _ev_traptousr +#define ev_usrtrapret _ev_usrtrapret +#define evsys _evsys #define execl _execl #define execle _execle #define execlp _execlp @@ -87,6 +93,7 @@ #define fgetpwent _fgetpwent #define fgetspent _fgetspent #define finite _finite +#define fmount _fmount #define fmtmsg _fmtmsg #define fork _fork #define fpathconf _fpathconf @@ -97,17 +104,17 @@ #define fpsetmask _fpsetmask #define fpsetround _fpsetround #define fpsetsticky _fpsetsticky +#define fptrap _fptrap #define fstat _fstat #define fstatvfs _fstatvfs #define fsync _fsync #define ftok _ftok #define ftruncate _ftruncate #define ftw _ftw +#define funmount _funmount #define gcvt _gcvt #define getcontext _getcontext #define getcwd _getcwd -#define getdate _getdate -#define getdate_err _getdate_err #define getdents _getdents #define getegid _getegid #define geteuid _geteuid @@ -123,6 +130,7 @@ #define getmntent _getmntent #define getmsg _getmsg #define getopt _getopt +#define getpagesize _getpagesize #define getpass _getpass #define getpgid _getpgid #define getpgrp _getpgrp @@ -144,8 +152,6 @@ #define getutent _getutent #define getutid _getutid #define getutline _getutline -#define getutmp _getutmp -#define getutmpx _getutmpx #define getutxent _getutxent #define getutxid _getutxid #define getutxline _getutxline @@ -204,8 +210,7 @@ #define lsub _lsub #define ltol3 _ltol3 #define makecontext _makecontext -#define makeut _makeut -#define makeutx _makeutx +#define mctl _mctl #define memalign _memalign #define memccpy _memccpy #define memcntl _memcntl @@ -217,10 +222,7 @@ #define mlock _mlock #define mlockall _mlockall #define mmap _mmap -#define modf _modf #define modff _modff -#define modut _modut -#define modutx _modutx #define monitor _monitor #define mount _mount #define mprotect _mprotect @@ -238,7 +240,6 @@ #define nfssvc _nfssvc #define nftw _nftw #define nice _nice -#define nl_langinfo _nl_langinfo #define nrand48 _nrand48 #define nuname _nuname #define open _open @@ -280,7 +281,6 @@ #define semctl _semctl #define semget _semget #define semop _semop -#define setchrclass _setchrclass #define setcontext _setcontext #define setegid _setegid #define seteuid _seteuid @@ -341,9 +341,7 @@ #define swapctl _swapctl #define symlink _symlink #define sync _sync -#define synchutmp _synchutmp #define sys3b _sys3b -#define sysi86 _sysi86 #define sys_errlist _sys_errlist #define sys_nerr _sys_nerr #define syscall _syscall @@ -383,11 +381,7 @@ #define unlink _unlink #define unlockpt _unlockpt #define unordered _unordered -#define updutfile _updutfile -#define updutxfile _updutxfile #define updutmp _updutmp -#define updutmpx _updutmpx -#define updwtmp _updwtmp #define updwtmpx _updwtmpx #define utime _utime #define utmpname _utmpname @@ -411,41 +405,34 @@ #ifdef ABI #define abs _abi_abs +#undef altzone +#define altzone _abi_altzone #define atoi _abi_atoi #define atol _abi_atol +#undef _ctype +#define _ctype _abi__ctype +#define __ctype _abi__ctype +#undef daylight +#define daylight _abi_daylight #define difftime _abi_difftime -#undef endgrent -#define endgrent _abi_endgrent -#undef endpwent -#define endpwent _abi_endpwent -#undef fgetgrent -#define fgetgrent _abi_fgetgrent -#undef fgetpwent -#define fgetpwent _abi_fgetpwent #undef ftruncate #define ftruncate _abi_ftruncate #undef getdents #define getdents _abi_getdents -#undef getgrent -#define getgrent _abi_getgrent -#undef getpwent -#define getpwent _abi_getpwent #define getenv _abi_getenv #define gmtime _abi_gmtime #undef isatty #define isatty _abi_isatty #define labs _abi_labs #define localtime _abi_localtime -#define memchr _abi_memchr +#define memchr _abi_malloc #define memcmp _abi_memcmp #define memcpy _abi_memcpy #define memmove _abi_memmove #define memset _abi_memset #define mktime _abi_mktime -#undef setgrent -#define setgrent _abi_setgrent -#undef setpwent -#define setpwent _abi_setpwent +#undef _numeric +#define _numeric _abi__numeric #undef sleep #define sleep _abi_sleep #define strcat _abi_strcat @@ -459,12 +446,14 @@ #define strtol _abi_strtol #undef syscall #define syscall _abi_syscall -#undef sysi86 -#define sysi86 _abi_sysi86 +#undef timezone +#define timezone _abi_timezone #undef truncate #define truncate _abi_truncate #undef ttyslot #define ttyslot _abi_ttyslot +#undef tzname +#define tzname _abi_tzname #undef tzset #define tzset _abi_tzset @@ -473,60 +462,22 @@ /* names that need to be hidden in the shared library */ #ifdef DSHLIB -#undef closelog -#define closelog _abi_closelog #undef ecvt #define ecvt _abi_ecvt -#undef endgrent -#define endgrent _abi_endgrent -#undef endpwent -#define endpwent _abi_endpwent #undef fcvt #define fcvt _abi_fcvt -#undef fgetgrent -#define fgetgrent _abi_fgetgrent -#undef fgetpwent -#define fgetpwent _abi_fgetpwent #undef ftruncate #define ftruncate _abi_ftruncate -#undef hrtcntl -#define hrtcntl _abi_hrtcntl #undef getdents #define getdents _abi_getdents -#undef getgrent -#define getgrent _abi_getgrent #undef gethz #define gethz _abi_gethz -#undef gettimeofday -#define gettimeofday _abi_gettimeofday -#undef getpwent -#define getpwent _abi_getpwent -#undef openlog -#define openlog _abi_openlog -#undef select -#define select _abi_select -#undef setgrent -#define setgrent _abi_setgrent -#undef setlogmask -#define setlogmask _abi_setlogmask -#undef settimeofday -#define settimeofday _abi_settimeofday -#undef setpwent -#define setpwent _abi_setpwent #undef syscall #define syscall _abi_syscall -#undef sysi86 -#define sysi86 _abi_sysi86 -#undef syslog -#define syslog _abi_syslog #undef truncate #define truncate _abi_truncate #undef ttyslot #define ttyslot _abi_ttyslot -#undef vfork -#define vfork _abi_vfork -#undef vsyslog -#define vsyslog _abi_vsyslog #endif /* DSHLIB */ #endif /* ABI */ diff --git a/usr/src/lib/libc/libc.mk b/usr/src/lib/libc/libc.mk index 3ce9cb4..4fc96d3 100644 --- a/usr/src/lib/libc/libc.mk +++ b/usr/src/lib/libc/libc.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libc:libc.mk 1.27.3.3" +#ident "@(#)libc:libc.mk 1.27.1.16" # # makefile for libc # @@ -34,7 +34,7 @@ MAKE=make ROOT= CCSLIB=$(ROOT)/usr/ccs/lib USRLIB=$(ROOT)/usr/lib -LIBP=$(CCSLIB)/libp +LIBP=$(CCSLIB) ABILIB=$(CCSLIB)/minabi ABILIBP=$(CCSLIB)/minabi/libp DONE= @@ -149,7 +149,7 @@ archive_lib: mkdir object find port $(MACHINE) -name '*.o' -print | \ xargs sh -sc 'cp "$$@" object' - $(PROF)find port $(MACHINE) -name '*.p' -print | \ + $(PROF)find port $(MACHINE) -name '*.o' -print | \ xargs sh -sc 'cp "$$@" object' # # delete temporary libraries @@ -157,7 +157,7 @@ archive_lib: $(PROF)-rm -f libp.libc # # set aside run-time modules, which don't go in library archive! - cd object; for i in *crt?.o values-Xt.o values-Xa.o values-Xc.o; do mv $$i ..; done + cd object; for i in *crt?.o values-Xa.o values-Xc.o; do mv $$i ..; done # # build archive out of the remaining modules. cd object; $(MAKE) -e -f ../$(MACHINE)/makefile archive \ @@ -187,8 +187,7 @@ shared_lib: -rm -f libc.so # # set aside run-time modules, which don't go in library archive! - cd object; for i in *crt?.o values-Xa.o values-Xc.o; do mv $$i ..; done; \ - cp values-Xt.o .. + cd object; for i in *crt?.o values-Xa.o values-Xc.o; do mv $$i ..; done # # build archive out of the remaining modules. cd object; $(MAKE) -e -f ../$(MACHINE)/makefile shared \ @@ -218,7 +217,7 @@ abi_lib: -rm -f libabi.so # # set aside run-time modules, which don't go in library archive! - cd object; for i in *crt?.o values-Xt.o values-Xa.o values-Xc.o; do mv $$i ..; done + cd object; for i in *crt?.o values-Xa.o values-Xc.o; do mv $$i ..; done # # build archive out of the remaining modules. cd object; $(MAKE) -e -f ../$(MACHINE)/makefile abi_lib \ @@ -252,7 +251,7 @@ move: move_archive move_archive: # # move the library or libraries into the correct directory - for i in *crt?.o values-Xt.o values-Xa.o values-Xc.o; \ + for i in *crt?.o values-Xa.o values-Xc.o; \ do sh $(SGSBASE)/sgs.install 644 $(OWN) $(GRP) $(CCSLIB)/$(SGS)$$i $$i; \ rm -f $$i ; done sh $(SGSBASE)/sgs.install 644 $(OWN) $(GRP) $(CCSLIB)/lib$(VARIANT)c.a lib.libc ; \ diff --git a/usr/src/lib/libc/m32/abi_objects b/usr/src/lib/libc/m32/abi_objects index 6797e2b..c5bc54a 100644 --- a/usr/src/lib/libc/m32/abi_objects +++ b/usr/src/lib/libc/m32/abi_objects @@ -1,10 +1,4 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -#ident "@(#)libc-m32:abi_objects 1.9" +#ident "@(#)libc-m32:abi_objects 1.2" rtboot.o globals.o @@ -21,6 +15,7 @@ rtabiaddr.o rtsetup.o rtsyscall.o rtmemcpy.o +rtisastream.o access.A acct.A @@ -52,22 +47,17 @@ fstatvfs.A fsync.A ftok.A getctxt.A -getcwd.A getegid.A geteuid.A getgid.A -getgrnam.A getgroups.A getmsg.A getpid.A getpmsg.A getppid.A -getpwnam.A getrlimit.A getuid.A ioctl.A -initgroups.A -isastream.A kill.A lchown.A link.A @@ -88,7 +78,6 @@ nice.A nuname.A open.A pathconf.A -fpathconf.A pause.A pipe.A poll.A @@ -148,16 +137,16 @@ writev.A xmknod.A xstat.A -cat_init.A -catclose.A -catgets.A -catopen.A closedir.A +getut.A +getpwbuf.A +getgrbuf.A getlogin.A ttyname.A gettxt.A localeconv.A opendir.A +putpwbuf.A readdir.A rewinddir.A setlocale.A diff --git a/usr/src/lib/libc/m32/ansi.def b/usr/src/lib/libc/m32/ansi.def index 21308a4..56d0e46 100644 --- a/usr/src/lib/libc/m32/ansi.def +++ b/usr/src/lib/libc/m32/ansi.def @@ -1,10 +1,4 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -_m4_dnl_ #ident "@(#)libc-m32:ansi.def 1.20" +_m4_dnl_ #ident "@(#)libc-m32:ansi.def 1.14" # function definition for weak global _m4_define_(`_fwdef_', @@ -72,6 +66,9 @@ _m4_define_(`ascftime', _ascftime) _m4_define_(`async_daemon', _async_daemon) _m4_define_(`brk', _brk) _m4_define_(`brkbase', _brkbase) +_m4_define_(`cat_init', _cat_init) +_m4_define_(`cat_malloc_init', _cat_malloc_init) +_m4_define_(`cat_name', _cat_name) _m4_define_(`catclose', _catclose) _m4_define_(`catgets', _catgets) _m4_define_(`catopen', _catopen) @@ -107,6 +104,9 @@ _m4_define_(`endutent', _endutent) _m4_define_(`environ', _environ) _m4_define_(`erand48', _erand48) _m4_define_(`etext', _etext) +_m4_define_(`ev_traptousr', _ev_traptousr) +_m4_define_(`ev_usrtrapret', _ev_usrtrapret) +_m4_define_(`evsys', _evsys) _m4_define_(`execl', _execl) _m4_define_(`execle', _execle) _m4_define_(`execlp', _execlp) @@ -127,6 +127,7 @@ _m4_define_(`fgetgrent', _fgetgrent) _m4_define_(`fgetpwent', _fgetpwent) _m4_define_(`fgetspent', _fgetspent) _m4_define_(`finite', _finite) +_m4_define_(`fmount', _fmount) _m4_define_(`fmtmsg', _fmtmsg) _m4_define_(`fork', _fork) _m4_define_(`fpathconf', _fpathconf) @@ -137,12 +138,14 @@ _m4_define_(`fpgetsticky', _fpgetsticky) _m4_define_(`fpsetmask', _fpsetmask) _m4_define_(`fpsetround', _fpsetround) _m4_define_(`fpsetsticky', _fpsetsticky) +_m4_define_(`fptrap', _fptrap) _m4_define_(`fstat', _fstat) _m4_define_(`fstatvfs', _fstatvfs) _m4_define_(`fsync', _fsync) _m4_define_(`ftok', _ftok) _m4_define_(`ftruncate', _ftruncate) _m4_define_(`ftw', _ftw) +_m4_define_(`funmount', _funmount) _m4_define_(`gcvt', _gcvt) _m4_define_(`getcontext', _getcontext) _m4_define_(`getcwd', _getcwd) @@ -161,6 +164,7 @@ _m4_define_(`getmntany', _getmntany) _m4_define_(`getmntent', _getmntent) _m4_define_(`getmsg', _getmsg) _m4_define_(`getopt', _getopt) +_m4_define_(`getpagesize', _getpagesize) _m4_define_(`getpass', _getpass) _m4_define_(`getpgid', _getpgid) _m4_define_(`getpgrp', _getpgrp) @@ -236,6 +240,7 @@ _m4_define_(`lstat', _lstat) _m4_define_(`lsub', _lsub) _m4_define_(`ltol3', _ltol3) _m4_define_(`makecontext', _makecontext) +_m4_define_(`mctl', _mctl) _m4_define_(`memalign', _memalign) _m4_define_(`memccpy', _memccpy) _m4_define_(`memcntl', _memcntl) @@ -431,7 +436,5 @@ _m4_define_(`_ecvt', _abi_ecvt) _m4_define_(`_fcvt', _abi_fcvt) _m4_define_(`_getdents', _abi_getdents) _m4_define_(`_syscall', _abi_syscall) -_m4_define_(`_sysinfo', _abi_sysinfo) -_m4_define_(`_vfork', _abi_vfork) ') ') diff --git a/usr/src/lib/libc/m32/crt/cerror.s b/usr/src/lib/libc/m32/crt/cerror.s index 497b27d..7ae02e4 100644 --- a/usr/src/lib/libc/m32/crt/cerror.s +++ b/usr/src/lib/libc/m32/crt/cerror.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C return sequence which .ident "@(#)libc-m32:crt/cerror.s 1.6" # sets errno, returns -1. diff --git a/usr/src/lib/libc/m32/crt/mcount.s b/usr/src/lib/libc/m32/crt/mcount.s index f924c22..320be37 100644 --- a/usr/src/lib/libc/m32/crt/mcount.s +++ b/usr/src/lib/libc/m32/crt/mcount.s @@ -1,11 +1,5 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # count subroutine called during profiling -.ident "@(#)libc-m32:crt/mcount.s 1.10" +.ident "@(#)libc-m32:crt/mcount.s 1.7" # # calling sequence: MOVW &a_word,%r0 # JSB _mcount @@ -14,98 +8,32 @@ # .globl _mcount + .globl countbase # Next pc,count cell available. + .globl _countlimit # Cells End Here (points after last) -# # # -# reserve ``call to _mcount_newent still pending'' flag, used -# to prevent recursion. -# isPending == 0 means we here have no outstanding call -# isPending == 1 means we here Have an outstanding call, and -# may not call until that call returns! -# - .data -.isPending: - .word 0 - .text - -# # # -# -# _mcount: call count increment routine for cc -p/-qp profiling (prof(1)) -# -# Call with R0 pointing to a private, static cell (initially zero); -# -# Answer with that cell (now) pointing to a call count entry, -# consisting of a ``backpointer to the function'' and an incremented -# call count (allocate a new one for this fcn if cell was zero). -# -# All knowledge of call count entry management is handled in the -# function _mcount_newent() et. al., which all live in libc-port:gen/mon.c. -# -# -# _mcount -# if nonzero cell contents //i.e. points at an entry -# access entry, increment counter and return. - -# else //fcn as of yet has no entry; get 1 -# if a pointer request is still pending.. -# return without an entry - last request unsatisfied, and -# a recursive request cannot be satisfied. - -# else -# get an entry pointer (mark `request pending' until it answers) -# if entry pointer == 0 -# return without an entry - profiling is Off. - -# else -# initialize this entry: set backpointer to return address, -# set count to 1 for this call. -# return - -# fi -# fi -# fi -# _fgdef_(_mcount): MOVW 0(%r0),%r1 # a_word to %r1 - jz .do_inits # do initialization if zero - - INCW 0(%r1) # haveAnEntry: increm count for - RSB # this call and return. - -# # # -# need to initialize the function's private cell (a_word) to point -# at a call count entry, which we shall try to allocate. -# -# we will do this only if mcount has not already been called and -# is waiting for mcount_newent to return! if we are waiting, then -# in order to prevent recursion we shall forgo calling again. -# -.do_inits: - - - CMPW .isPending,&1 # Are we allowed to call newent? - REQL # If flag==1 we cannot. + jne .add1 # skip initialization if not zero - MOVW &1,.isPending # we CAN call: disable further Calls. + MOVW _dref_(countbase),%r1 # get stack base in %r1 + REQL # return if counting not turned on yet - PUSHW %r0 # sith has no cell, preserve a_word, & - # call to get a call count entry (or 0). + ADDW2 &8,_dref_(countbase) # allocate a new pc,count pair + MOVW -4(%sp),0(%r1) # remember pc + ADDW2 &4,%r1 + MOVW &0,0(%r1) # init call count to zero + MOVW %r1,0(%r0) # store &pair+4 in a_word - call &0,_fref_(_mcount_newent) # Now Call. - MOVW &0,.isPending # Now enable Calls again. - # NOTE: return value is in **r0**: - # 0==profg OFF, !0==ptr to callCntEntry - POPW %r1 # get a_word back: put in r1 now. + CMPW _dref_(_countlimit),_dref_(countbase) # if yet more cells are available.. + jlu .yetmore # then stick with what we have. - CMPW %r0,&0 # is profiling on? if no==0, if - REQL # yes, r0 has addr of entry. + PUSHW %r1 # No Mo Cells; preserve a_word, + call &0,_fref_(_mnewblock) # get more cells (a block of 'em), + POPW %r1 # and restore a_word agin. -# NOTE: for the sake of efficiency (since the call count entry address -# return value comes in r0), r0 and r1 now swap roles; -# r1 points at a_word and r0 accesses the allocated call count entry. +.yetmore: # ok: countbase,limit set for block. - MOVW -4(%sp),0(%r0) # save _mcount return addr in callcnt - ADDW2 &4,%r0 # entry: APROX'LY calling fcn's addr. - MOVW &1,0(%r0) # set callcnt to count this 1st call. - MOVW %r0,0(%r1) # store &pair+4 in a_word - RSB # and return. +.add1: + INCW 0(%r1) # count function call + RSB diff --git a/usr/src/lib/libc/m32/csu/crt0.s b/usr/src/lib/libc/m32/csu/crt0.s index 2299200..4e7f412 100644 --- a/usr/src/lib/libc/m32/csu/crt0.s +++ b/usr/src/lib/libc/m32/csu/crt0.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "crt0.s" .ident "@(#)libc-m32:csu/crt0.s 1.9.1.6" _section23_(.pesel,i,strtab) diff --git a/usr/src/lib/libc/m32/csu/crt1.s b/usr/src/lib/libc/m32/csu/crt1.s index f8aa0a4..5938c71 100644 --- a/usr/src/lib/libc/m32/csu/crt1.s +++ b/usr/src/lib/libc/m32/csu/crt1.s @@ -1,11 +1,5 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "crt1.s" - .ident "@(#)libc-m32:csu/crt1.s 1.18" + .ident "@(#)libc-m32:csu/crt1.s 1.16" _section23_(.pesel,i,strtab) .text # C runtime startoff @@ -18,7 +12,7 @@ .globl _start .globl _init .globl _mcount - .globl environ +# .globl environ # global entities defined elsewhere, but used here .globl __fpstart @@ -70,9 +64,11 @@ _fgdef_(_start): _fgdef_(_mcount): # dummy version for the case when rsb # files have been compiled with -p but # not loaded with load module - .globl __longdouble_used .data .align 4 _dgdef_(__longdouble_used): + .globl __longdouble_used + +_dwdef_(`environ'): .word 0 diff --git a/usr/src/lib/libc/m32/csu/crti.s b/usr/src/lib/libc/m32/csu/crti.s index 1ef1a69..3aeb8f0 100644 --- a/usr/src/lib/libc/m32/csu/crti.s +++ b/usr/src/lib/libc/m32/csu/crti.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:csu/crti.s 1.3" .file "crti.s" diff --git a/usr/src/lib/libc/m32/csu/crtn.s b/usr/src/lib/libc/m32/csu/crtn.s index 5f6c56a..cc232ea 100644 --- a/usr/src/lib/libc/m32/csu/crtn.s +++ b/usr/src/lib/libc/m32/csu/crtn.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:csu/crtn.s 1.6" .file "crtn.s" # diff --git a/usr/src/lib/libc/m32/csu/fcrt0.s b/usr/src/lib/libc/m32/csu/fcrt0.s new file mode 100644 index 0000000..b69eecd --- /dev/null +++ b/usr/src/lib/libc/m32/csu/fcrt0.s @@ -0,0 +1,279 @@ + .file "fcrt0.s" + .ident "@(#)libc-m32:csu/fcrt0.s 1.8.1.6" + _section23_(.pesel,i,strtab) + .text +# +# C language startup routine with compatibility +# floating point startup +# This startup is used when objects from 2.0 CCS or F77 1.1 +# is linked with objects produced by the 2.0p CCC +# + .set _exit,1*8 + .set _signal,48*8 + .set SIGILL,4 + .set SIG_IGN,1 + .set SIG_DFL,0 + + .text + .globl _start # entry point for this file + .globl environ + +# global entities defined elsewhere, but used here + .globl main # entry for user code + .globl __fpstart # floating point startup for 2.0p + .globl fptrap # floating point emulation for 2.0 + .globl exit + + .data + .globl d.vect # in file signal.s + + .text + .globl _mcount # dummy version of mcount subroutine + + .data + .globl _old.fp # global flag tells signal.s that + # old floating point emulation + # is being used, and the process + # is tracing, which renders + # special meaning to SIGILL +_dgdef_(_old.fp): # if tracing is not used, + .word 0 # signal SIGILL is NOT special +######################################################################## + .text +_fgdef_(_start): + PUSHW 0(%ap) # argc + + MOVAW 4(%ap),%r0 + PUSHW %r0 # argv +.L1: + TSTW 0(%r0) # null args term ? + je .L2 + ADDW2 &4,%r0 + jmp .L1 +.L2: + MOVAW 4(%r0),%r0 + MOVW %r0,environ # indir is 0 if no env ; not 0 if env + + PUSHW %r0 # envp + +# intercept floating point illegal op-codes using either undocumented +# fast interface through sys3b system call or through normal signal +# system call +# + PUSHW &6 + PUSHAW .fastiop + CALL -8(%sp),.setiop # sys3b( S3BIOP, .fastiop ) + TSTW %r0 + je .L3 # fast interface is now set; otherwise use signal + + PUSHW &SIGILL + PUSHAW .sigill + CALL -8(%sp),.catch # signal( SIGILL, .sigill ) + MOVW &1,_old.fp # next time SIGILL has special meaning +.L3: + + CALL 0(%sp),__fpstart# initialize the 2.0p floating point state + + CALL -12(%sp),main # main( argc, argv envp ) + + PUSHW %r0 + CALL -4(%sp),exit + + MOVW &4,%r0 + MOVW &_exit,%r1 + GATE +# + .data + .align 4 +_dwdef_(`environ'): + .word 0 + + + +# issue the sys3b system call +# + .set _sys3b,50*8 + + .text +.setiop: + MOVW &4,%r0 + MOVW &_sys3b,%r1 + GATE + jlu .setiopbad + CLRW %r0 + RET +.setiopbad: + MOVW &-1,%r0 # didn't work; must be tracing with ptrace + RET + +# +# The following routine issues the signal system call to catch SIGILL +# interrupts in order to intercept floating point instructions +# +.catch: + MOVW &4,%r0 # issue system call + MOVW &_signal,%r1 + GATE + RET + +# +# The following is the register parameter area for the +# fptrap floating point simulator +# + .data + .align 4 +.regs: + .zero 16*4 # room for 16 registers + + .set R0,0*4 # offsets into .regs + .set R1,1*4 + .set R2,2*4 + .set R3,3*4 + .set R4,4*4 + .set R5,5*4 + .set R6,6*4 + .set R7,7*4 + .set R8,8*4 + .set FP,9*4 + .set AP,10*4 + .set PSW,11*4 + .set SP,12*4 + .set PCBP,13*4 + .set ISP,14*4 + .set PC,15*4 + +# +# The following routines recieves control for a SIGILL signal +# or from the sys3b fast interface for illegal op-codes. It +# determines if the instruction is a floating point instruction or +# not. If it is a floating point instruction, then the floating +# point simulator (fptrap) is called; otherwise, this routine +# plays kernel and delivers the SIGILL signal according to the +# option set by the user with a previous signal(SIGILL,?) call. +# + .text + + .globl fptrap + +# sys3b fast interface for illegal op-codes +# +.fastiop: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + jne .isfp + +# not a floating point op-code + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp4 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + jne .notfp3 # call user signal handler + jmp .notfp1 # ignore signal; MAC32 will loop! + + +# SIGILL illegal op-code processing +# +.sigill: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + je .notfp +.isfp: + PUSHAW .regs # call floating point simulator + CALL -4(%sp),fptrap + + MOVW .regs+PC,-8(%sp) # restore environment and return + EXTFW &(4-1),&18,.regs+PSW,%r0 # PSW flag bits + INSFW &(4-1),&18,%r0,-4(%sp) + MOVW .regs+AP,%ap + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp: # SIGILL was not caused by a + # floating point instruction + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp2 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + je .notfp1 # ignore signal; MAC32 will loop! +.notfp3: + PUSHW &SIGILL # call user signal handler + CALL -4(%sp),*d.vect+(4*SIGILL) + +.notfp1: + MOVW .regs+AP,%ap # restore environment and return + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp2: + PUSHW &SIGILL # reset SIGILL catching + PUSHW &SIG_DFL + CALL -8(%sp),.catch + jmp .notfp1 + +.notfp4: + PUSHW &6 # reset sys3b fast interface + PUSHAW 0 + CALL -8(%sp),.setiop + jmp .notfp1 + + +# + .text +_fgdef_(_mcount): # dummy version for the case when + rsb # files have been compiled with -p but + # not loaded with load module + diff --git a/usr/src/lib/libc/m32/csu/fcrt1.s b/usr/src/lib/libc/m32/csu/fcrt1.s new file mode 100644 index 0000000..c21b6f5 --- /dev/null +++ b/usr/src/lib/libc/m32/csu/fcrt1.s @@ -0,0 +1,288 @@ + .file "fcrt1.s" + .ident "@(#)libc-m32:csu/fcrt1.s 1.18" + _section23_(.pesel,i,strtab) +# +# C language startup routine with compatibility +# floating point startup +# This startup is used when objects from 2.0 CCS or F77 1.1 +# is linked with objects produced by the 2.0p CCC +# + .set _exit,1*8 + .set _signal,48*8 + .set SIGILL,4 + .set SIG_IGN,1 + .set SIG_DFL,0 + + .text + .globl _start # entry point for this file + .globl _init + +# global entities defined elsewhere, but used here + .globl main # entry for user code + .globl __fpstart # floating point startup for 2.0p + .globl fptrap # floating point emulation for 2.0 + .globl exit + .globl _fini + _wdecl_(_cleanup) + + .data + .globl d.vect # in file signal.s + + .text + .globl _mcount # dummy version of mcount subroutine + + .comm _old.fp,4 + # global flag tells signal.s that + # old floating point emulation + # is being used, and the process + # is tracing, which renders + # special meaning to SIGILL + # if tracing is not used, + # signal SIGILL is NOT special + # old.fp is defined in m32/gen/m32_data.s +######################################################################## + .text +_fgdef_(_start): + pushw &_fini + call &1,atexit + TSTW &_cleanup + je .L0 + pushw &_cleanup + call &1,atexit +.L0: + PUSHW 0(%ap) # argc + + MOVAW 4(%ap),%r0 + PUSHW %r0 # argv +.L1: + TSTW 0(%r0) # null args term ? + je .L2 + ADDW2 &4,%r0 + jmp .L1 +.L2: + MOVAW 4(%r0),%r0 + MOVW %r0,environ # indir is 0 if no env ; not 0 if env + + PUSHW %r0 # envp + + CALL 0(%sp),_init # execute initialization code + +# intercept floating point illegal op-codes using either undocumented +# fast interface through sys3b system call or through normal signal +# system call +# + PUSHW &6 + PUSHAW .fastiop + CALL -8(%sp),.setiop # sys3b( S3BIOP, .fastiop ) + TSTW %r0 + je .L3 # fast interface is now set; otherwise use signal + + PUSHW &SIGILL + PUSHAW .sigill + CALL -8(%sp),.catch # signal( SIGILL, .sigill ) + MOVW &1,_old.fp # next time SIGILL has special meaning +.L3: + + CALL 0(%sp),__fpstart# initialize the 2.0p floating point state + + CALL -12(%sp),main # main( argc, argv envp ) + + PUSHW %r0 + CALL -4(%sp),exit + + MOVW &4,%r0 + MOVW &_exit,%r1 + GATE +# + .data + .align 4 +_dwdef_(`environ'): + .word 0 + + + +# issue the sys3b system call +# + .set _sys3b,50*8 + + .text +.setiop: + MOVW &4,%r0 + MOVW &_sys3b,%r1 + GATE + jlu .setiopbad + CLRW %r0 + RET +.setiopbad: + MOVW &-1,%r0 # didn't work; must be tracing with ptrace + RET + +# +# The following routine issues the signal system call to catch SIGILL +# interrupts in order to intercept floating point instructions +# +.catch: + MOVW &4,%r0 # issue system call + MOVW &_signal,%r1 + GATE + RET + +# +# The following is the register parameter area for the +# fptrap floating point simulator +# + .data + .align 4 +.regs: + .zero 16*4 # room for 16 registers + + .set R0,0*4 # offsets into .regs + .set R1,1*4 + .set R2,2*4 + .set R3,3*4 + .set R4,4*4 + .set R5,5*4 + .set R6,6*4 + .set R7,7*4 + .set R8,8*4 + .set FP,9*4 + .set AP,10*4 + .set PSW,11*4 + .set SP,12*4 + .set PCBP,13*4 + .set ISP,14*4 + .set PC,15*4 + +# +# The following routines recieves control for a SIGILL signal +# or from the sys3b fast interface for illegal op-codes. It +# determines if the instruction is a floating point instruction or +# not. If it is a floating point instruction, then the floating +# point simulator (fptrap) is called; otherwise, this routine +# plays kernel and delivers the SIGILL signal according to the +# option set by the user with a previous signal(SIGILL,?) call. +# + .text + + .globl fptrap + +# sys3b fast interface for illegal op-codes +# +.fastiop: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + jne .isfp + +# not a floating point op-code + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp4 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + jne .notfp3 # call user signal handler + jmp .notfp1 # ignore signal; MAC32 will loop! + + +# SIGILL illegal op-code processing +# +.sigill: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + je .notfp +.isfp: + PUSHAW .regs # call floating point simulator + CALL -4(%sp),fptrap + + MOVW .regs+PC,-8(%sp) # restore environment and return + EXTFW &(4-1),&18,.regs+PSW,%r0 # PSW flag bits + INSFW &(4-1),&18,%r0,-4(%sp) + MOVW .regs+AP,%ap + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp: # SIGILL was not caused by a + # floating point instruction + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp2 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + je .notfp1 # ignore signal; MAC32 will loop! +.notfp3: + PUSHW &SIGILL # call user signal handler + CALL -4(%sp),*d.vect+(4*SIGILL) + +.notfp1: + MOVW .regs+AP,%ap # restore environment and return + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp2: + PUSHW &SIGILL # reset SIGILL catching + PUSHW &SIG_DFL + CALL -8(%sp),.catch + jmp .notfp1 + +.notfp4: + PUSHW &6 # reset sys3b fast interface + PUSHAW 0 + CALL -8(%sp),.setiop + jmp .notfp1 + +# + .text +_fgdef_(_mcount): # dummy version for the case when + rsb # files have been compiled with -p but + # not loaded with load module diff --git a/usr/src/lib/libc/m32/csu/fmcrt0.s b/usr/src/lib/libc/m32/csu/fmcrt0.s new file mode 100644 index 0000000..7979d59 --- /dev/null +++ b/usr/src/lib/libc/m32/csu/fmcrt0.s @@ -0,0 +1,348 @@ + .file "fmcrt0.s" + .ident "@(#)libc-m32:csu/fmcrt0.s 1.9.1.9" + _section23_(.pesel,i,strtab) + .text +# +# C language startup routine with compatibility +# floating point startup, and profileing +# This startup is used when objects from 2.0 CCS or F77 1.1 +# is linked with objects produced by the 2.0p CCC +# + .set _exit,1*8 + .set _signal,48*8 + .set SIGILL,4 + .set SIG_IGN,1 + .set SIG_DFL,0 + + .set CBUFS,600 + .set WORDSIZE,4 + + +# exit() is system call #1, _exit == (call #)*(sizeof(gatevector)) + .set _exit,1*8 + +# global entities defined in this file + .globl _start # entry point of this file + .globl exit + +# global entities defined elsewhere, but used here + .globl ___Argv # libc: port/gen/mon.c defines this + .globl __fpstart # libc: floating-point startup + .globl _exithandle + .globl fptrap # floating point emulation for 2.0 + .globl etext # set by 'ld' to end of text + .globl main # user's entry point + .globl monitor # libc: monitor(3C) + .globl sbrk # libc: brk(2) system call + .globl write # libc: write(2) system call + + + .data + .globl d.vect # in file signal.s + .globl _old.fp # global flag tells signal.s that + # old floating point emulation + # is being used, and the process + # is tracing, which renders + # special meaning to SIGILL +_dgdef_(_old.fp): # if tracing is not used, + .word 0 # signal SIGILL is NOT special +######################################################################## + .text + +_fgdef_(_start): + PUSHW 0(%ap) # argc + + MOVAW 4(%ap),%r0 + PUSHW %r0 # argv + MOVW %r0,___Argv # make ___Argv == argv for profiling +.L1: + TSTW 0(%r0) # null args term ? + je .L2 + ADDW2 &4,%r0 + jmp .L1 +.L2: + MOVAW 4(%r0),%r0 + MOVW %r0,environ # indir is 0 if no env ; not 0 if env + + PUSHW %r0 # envp + + +# MUST initialize floating-point state before calling profile code, +# since profiling uses floating-point + + CALL 0(%sp),__fpstart + +# intercept floating point illegal op-codes using either undocumented +# fast interface through sys3b system call or through normal signal +# system call +# + PUSHW &6 + PUSHAW .fastiop + CALL -8(%sp),.setiop # sys3b( S3BIOP, .fastiop ) + TSTW %r0 + je .L3 # fast interface is now set; otherwise use signal + + PUSHW &SIGILL + PUSHAW .sigill + CALL -8(%sp),.catch # signal( SIGILL, .sigill ) + MOVW &1,_old.fp # next time SIGILL has special meaning +.L3: + +# setup for monitoring +# + SUBW3 &.eprol,&(etext+7),%r8 # get text size in double words + LRSW3 &3,%r8,%r8 # (tally area == %r8 shorts) + + LLSW3 &1,%r8,%r8 # tally area size in bytes + ADDW2 &8*CBUFS+12+WORDSIZE-1,%r8 # add in entry counts and header and + ANDW2 &-WORDSIZE,%r8 # round to word boundary + PUSHW %r8 # get space + CALL -1*4(%sp),sbrk + CMPW &-1,%r0 + je .nospace + + ADDW3 &12,%r0,countbase # set up count base for mcount + PUSHAW .eprol # start profiling + PUSHAW etext + PUSHW %r0 + LRSW3 &1,%r8,%r8 # monitor wants # of shorts in buffer + PUSHW %r8 + PUSHW &CBUFS + CALL -5*4(%sp),monitor # monitor(lowpc,highpc,buffer,bufsiz,CBUFS) + + CALL -3*4(%sp),main # main(argc,argv,environ) + + PUSHW %r0 + CALL -1*4(%sp),exit + +# exit, but first call monitor() to write profile buffer +# +_fgdef_(exit): + PUSHW &0 + PUSHW &0 + PUSHW &0 + PUSHW &0 + PUSHW &0 + CALL -5*4(%sp),monitor # terminate monitoring + + call &0,_exithandle + + MOVW &4,%r0 # exit + MOVW &_exit,%r1 + GATE + +# not enough memory for profiling buffer +# +.nospace: + PUSHW &2 # write error message and exit + PUSHAW .emesg + PUSHW &MESSL + CALL -3*4(%sp),write # write(2,.emesg,MESSL) + + PUSHW &-1 + CALL -1*4(%sp),.nospacex # exit(-1) + +.nospacex: + MOVW &4,%r0 # exit + MOVW &_exit,%r1 + GATE + + .data + .align 4 +_dwdef_(`environ'): + .word 0 + +_dwdef_(`countbase'): + .word 0 + +.emesg: # "No space for monitor buffer\n" + .byte 78,111,32,115,112,97,99,101,32,102,111,114 + .byte 32,109,111,110,105,116,111,114 + .byte 32,98,117,102,102,101,114,10 + .set MESSL,.-.emesg + .byte 0 + + .text + .align 4 # generate padding NOP's before .eprol +.eprol: # beginning of user text + +# +# issue the sys3b system call +# + .set _sys3b,50*8 + + .text +.setiop: + MOVW &4,%r0 + MOVW &_sys3b,%r1 + GATE + jlu .setiopbad + CLRW %r0 + RET +.setiopbad: + MOVW &-1,%r0 # didn't work; must be tracing with ptrace + RET + +# +# The following routine issues the signal system call to catch SIGILL +# interrupts in order to intercept floating point instructions +# +.catch: + MOVW &4,%r0 # issue system call + MOVW &_signal,%r1 + GATE + RET + +# +# The following is the register parameter area for the +# fptrap floating point simulator +# + .data + .align 4 +.regs: + .zero 16*4 # room for 16 registers + + .set R0,0*4 # offsets into .regs + .set R1,1*4 + .set R2,2*4 + .set R3,3*4 + .set R4,4*4 + .set R5,5*4 + .set R6,6*4 + .set R7,7*4 + .set R8,8*4 + .set FP,9*4 + .set AP,10*4 + .set PSW,11*4 + .set SP,12*4 + .set PCBP,13*4 + .set ISP,14*4 + .set PC,15*4 + +# +# The following routines recieves control for a SIGILL signal +# or from the sys3b fast interface for illegal op-codes. It +# determines if the instruction is a floating point instruction or +# not. If it is a floating point instruction, then the floating +# point simulator (fptrap) is called; otherwise, this routine +# plays kernel and delivers the SIGILL signal according to the +# option set by the user with a previous signal(SIGILL,?) call. +# + .text + + .globl fptrap + +# sys3b fast interface for illegal op-codes +# +.fastiop: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + jne .isfp + +# not a floating point op-code + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp4 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + jne .notfp3 # call user signal handler + jmp .notfp1 # ignore signal; MAC32 will loop! + + +# SIGILL illegal op-code processing +# +.sigill: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + je .notfp +.isfp: + PUSHAW .regs # call floating point simulator + CALL -4(%sp),fptrap + + MOVW .regs+PC,-8(%sp) # restore environment and return + EXTFW &(4-1),&18,.regs+PSW,%r0 # PSW flag bits + INSFW &(4-1),&18,%r0,-4(%sp) + MOVW .regs+AP,%ap + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp: # SIGILL was not caused by a + # floating point instruction + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp2 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + je .notfp1 # ignore signal; MAC32 will loop! +.notfp3: + PUSHW &SIGILL # call user signal handler + CALL -4(%sp),*d.vect+(4*SIGILL) + +.notfp1: + MOVW .regs+AP,%ap # restore environment and return + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp2: + PUSHW &SIGILL # reset SIGILL catching + PUSHW &SIG_DFL + CALL -8(%sp),.catch + jmp .notfp1 + +.notfp4: + PUSHW &6 # reset sys3b fast interface + PUSHAW 0 + CALL -8(%sp),.setiop + jmp .notfp1 diff --git a/usr/src/lib/libc/m32/csu/fmcrt1.s b/usr/src/lib/libc/m32/csu/fmcrt1.s new file mode 100644 index 0000000..a37c22e --- /dev/null +++ b/usr/src/lib/libc/m32/csu/fmcrt1.s @@ -0,0 +1,362 @@ + .file "fmcrt1.s" + .ident "@(#)libc-m32:csu/fmcrt1.s 1.20" + _section23_(.pesel,i,strtab) + .text +# +# C language startup routine with compatibility +# floating point startup, and profileing +# This startup is used when objects from 2.0 CCS or F77 1.1 +# is linked with objects produced by the 2.0p CCC +# + .set _exit,1*8 + .set _signal,48*8 + .set SIGILL,4 + .set SIG_IGN,1 + .set SIG_DFL,0 + + .set CBUFS,600 + .set WORDSIZE,4 + + +# exit() is system call #1, _exit == (call #)*(sizeof(gatevector)) + .set _exit,1*8 + +# global entities defined in this file + .globl _start # entry point of this file + .globl _init + .globl exit + .globl _fini + _wdecl_(_cleanup) + +# global entities defined elsewhere, but used here + .globl ___Argv # libc: port/gen/mon.c defines this + .globl __fpstart # libc: floating-point startup + .globl _exithandle + .globl fptrap # floating point emulation for 2.0 + .globl etext # set by 'ld' to end of text + .globl main # user's entry point + .globl monitor # libc: monitor(3C) + .globl sbrk # libc: brk(2) system call + .globl write # libc: write(2) system call + + + .data + .globl d.vect # in file signal.s + # global flag tells signal.s that + .comm _old.fp,4 + + # old floating point emulation + # is being used, and the process + # is tracing, which renders + # special meaning to SIGILL + # if tracing is not used, + # signal SIGILL is NOT special + # _old.fp is defined in m32/gen/m32_data.s +######################################################################## + .text + +_fgdef_(_start): + pushw &_fini + call &1,atexit + TSTW &_cleanup + je .L0 + pushw &_cleanup + call &1,atexit +.L0: + PUSHW 0(%ap) # argc + + MOVAW 4(%ap),%r0 + PUSHW %r0 # argv + MOVW %r0,___Argv # make ___Argv == argv for profiling +.L1: + TSTW 0(%r0) # null args term ? + je .L2 + ADDW2 &4,%r0 + jmp .L1 +.L2: + MOVAW 4(%r0),%r0 + MOVW %r0,environ # indir is 0 if no env ; not 0 if env + + PUSHW %r0 # envp + + CALL 0(%sp),_init # execute initialization code + +# MUST initialize floating-point state before calling profile code, +# since profiling uses floating-point + + CALL 0(%sp),__fpstart + +# intercept floating point illegal op-codes using either undocumented +# fast interface through sys3b system call or through normal signal +# system call +# + PUSHW &6 + PUSHAW .fastiop + CALL -8(%sp),.setiop # sys3b( S3BIOP, .fastiop ) + TSTW %r0 + je .L3 # fast interface is now set; otherwise use signal + + PUSHW &SIGILL + PUSHAW .sigill + CALL -8(%sp),.catch # signal( SIGILL, .sigill ) + MOVW &1,_old.fp # next time SIGILL has special meaning +.L3: + +# setup for monitoring +# + SUBW3 &.eprol,&(etext+7),%r8 # get text size in double words + LRSW3 &3,%r8,%r8 # (tally area == %r8 shorts) + + LLSW3 &1,%r8,%r8 # tally area size in bytes + ADDW2 &8*CBUFS+12+WORDSIZE-1,%r8 # add in entry counts and header and + ANDW2 &-WORDSIZE,%r8 # round to word boundary + PUSHW %r8 # get space + CALL -1*4(%sp),sbrk + CMPW &-1,%r0 + je .nospace + + ADDW3 &12,%r0,countbase # set up count base for mcount + PUSHAW .eprol # start profiling + PUSHAW etext + PUSHW %r0 + LRSW3 &1,%r8,%r8 # monitor wants # of shorts in buffer + PUSHW %r8 + PUSHW &CBUFS + CALL -5*4(%sp),monitor # monitor(lowpc,highpc,buffer,bufsiz,CBUFS) + + CALL -3*4(%sp),main # main(argc,argv,environ) + + PUSHW %r0 + CALL -1*4(%sp),exit + +# exit, but first call monitor() to write profile buffer +# +_fgdef_(exit): + PUSHW &0 + PUSHW &0 + PUSHW &0 + PUSHW &0 + PUSHW &0 + CALL -5*4(%sp),monitor # terminate monitoring + + call &0,_exithandle + + MOVW &4,%r0 # exit + MOVW &_exit,%r1 + GATE + +# not enough memory for profiling buffer +# +.nospace: + PUSHW &2 # write error message and exit + PUSHAW .emesg + PUSHW &MESSL + CALL -3*4(%sp),write # write(2,.emesg,MESSL) + + PUSHW &-1 + CALL -1*4(%sp),.nospacex # exit(-1) + +.nospacex: + MOVW &4,%r0 # exit + MOVW &_exit,%r1 + GATE + + .data + .align 4 +_dwdef_(`environ'): + .word 0 + +_dwdef_(`countbase'): + .word 0 + +.emesg: # "No space for monitor buffer\n" + .byte 78,111,32,115,112,97,99,101,32,102,111,114 + .byte 32,109,111,110,105,116,111,114 + .byte 32,98,117,102,102,101,114,10 + .set MESSL,.-.emesg + .byte 0 + + .text + .align 4 # generate padding NOP's before .eprol +.eprol: # beginning of user text + +# +# issue the sys3b system call +# + .set _sys3b,50*8 + + .text +.setiop: + MOVW &4,%r0 + MOVW &_sys3b,%r1 + GATE + jlu .setiopbad + CLRW %r0 + RET +.setiopbad: + MOVW &-1,%r0 # didn't work; must be tracing with ptrace + RET + +# +# The following routine issues the signal system call to catch SIGILL +# interrupts in order to intercept floating point instructions +# +.catch: + MOVW &4,%r0 # issue system call + MOVW &_signal,%r1 + GATE + RET + +# +# The following is the register parameter area for the +# fptrap floating point simulator +# + .data + .align 4 +.regs: + .zero 16*4 # room for 16 registers + + .set R0,0*4 # offsets into .regs + .set R1,1*4 + .set R2,2*4 + .set R3,3*4 + .set R4,4*4 + .set R5,5*4 + .set R6,6*4 + .set R7,7*4 + .set R8,8*4 + .set FP,9*4 + .set AP,10*4 + .set PSW,11*4 + .set SP,12*4 + .set PCBP,13*4 + .set ISP,14*4 + .set PC,15*4 + +# +# The following routines recieves control for a SIGILL signal +# or from the sys3b fast interface for illegal op-codes. It +# determines if the instruction is a floating point instruction or +# not. If it is a floating point instruction, then the floating +# point simulator (fptrap) is called; otherwise, this routine +# plays kernel and delivers the SIGILL signal according to the +# option set by the user with a previous signal(SIGILL,?) call. +# + .text + + .globl fptrap + +# sys3b fast interface for illegal op-codes +# +.fastiop: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + jne .isfp + +# not a floating point op-code + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp4 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + jne .notfp3 # call user signal handler + jmp .notfp1 # ignore signal; MAC32 will loop! + + +# SIGILL illegal op-code processing +# +.sigill: + MOVW %r0,.regs+R0 # save environment + MOVW %r1,.regs+R1 + MOVW %r2,.regs+R2 + MOVW %r3,.regs+R3 + MOVW %r4,.regs+R4 + MOVW %r5,.regs+R5 + MOVW %r6,.regs+R6 + MOVW %r7,.regs+R7 + MOVW %r8,.regs+R8 + MOVW %fp,.regs+FP + MOVW %ap,.regs+AP + MOVW -4(%sp),.regs+PSW + MOVAW -8(%sp),.regs+SP + CLRW .regs+PCBP + CLRW .regs+ISP + MOVW -8(%sp),.regs+PC + + MOVB *.regs+PC,%r0 # op-code of illegal instruction + TSTB _fpopcode(%r0) + je .notfp +.isfp: + PUSHAW .regs # call floating point simulator + CALL -4(%sp),fptrap + + MOVW .regs+PC,-8(%sp) # restore environment and return + EXTFW &(4-1),&18,.regs+PSW,%r0 # PSW flag bits + INSFW &(4-1),&18,%r0,-4(%sp) + MOVW .regs+AP,%ap + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp: # SIGILL was not caused by a + # floating point instruction + + CMPW d.vect+(4*SIGILL),&SIG_DFL + je .notfp2 # default action + + CMPW d.vect+(4*SIGILL),&SIG_IGN + je .notfp1 # ignore signal; MAC32 will loop! +.notfp3: + PUSHW &SIGILL # call user signal handler + CALL -4(%sp),*d.vect+(4*SIGILL) + +.notfp1: + MOVW .regs+AP,%ap # restore environment and return + MOVW .regs+FP,%fp + MOVW .regs+R8,%r8 + MOVW .regs+R7,%r7 + MOVW .regs+R6,%r6 + MOVW .regs+R5,%r5 + MOVW .regs+R4,%r4 + MOVW .regs+R3,%r3 + MOVW .regs+R2,%r2 + MOVW .regs+R1,%r1 + MOVW .regs+R0,%r0 + RETG + +.notfp2: + PUSHW &SIGILL # reset SIGILL catching + PUSHW &SIG_DFL + CALL -8(%sp),.catch + jmp .notfp1 + +.notfp4: + PUSHW &6 # reset sys3b fast interface + PUSHAW 0 + CALL -8(%sp),.setiop + jmp .notfp1 diff --git a/usr/src/lib/libc/m32/csu/mcrt0.s b/usr/src/lib/libc/m32/csu/mcrt0.s index e4edacb..0c23bbf 100644 --- a/usr/src/lib/libc/m32/csu/mcrt0.s +++ b/usr/src/lib/libc/m32/csu/mcrt0.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "mcrt0.s" .ident "@(#)libc-m32:csu/mcrt0.s 1.14.1.9" _section23_(.pesel,i,strtab) diff --git a/usr/src/lib/libc/m32/csu/mcrt1.s b/usr/src/lib/libc/m32/csu/mcrt1.s index ad649e7..bae7dd3 100644 --- a/usr/src/lib/libc/m32/csu/mcrt1.s +++ b/usr/src/lib/libc/m32/csu/mcrt1.s @@ -1,11 +1,5 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "mcrt1.s" - .ident "@(#)libc-m32:csu/mcrt1.s 1.20" + .ident "@(#)libc-m32:csu/mcrt1.s 1.18" _section23_(.pesel,i,strtab) .text # C runtime startup and exit with profiling @@ -127,6 +121,11 @@ nospacex: MOVW &_exit,%r1 GATE + .data + .align 4 +_dwdef_(`environ'): + .word 0 + emesg: # "No space for monitor buffer\n" .byte 78,111,32,115,112,97,99,101,32,102,111,114 .byte 32,109,111,110,105,116,111,114 @@ -138,8 +137,3 @@ emesg: # "No space for monitor buffer\n" .align 4 # generate padding NOP's before _eprol _dgdef_(_eprol): # beginning of user text - .data - .align 4 -_dgdef_(__longdouble_used): - .globl __longdouble_used - diff --git a/usr/src/lib/libc/m32/csu/pcrt0.s b/usr/src/lib/libc/m32/csu/pcrt0.s index 2f38ada..aa0ae30 100644 --- a/usr/src/lib/libc/m32/csu/pcrt0.s +++ b/usr/src/lib/libc/m32/csu/pcrt0.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "pcrt0.s" .ident "@(#)libc-m32:csu/pcrt0.s 1.5" # C runtime startoff diff --git a/usr/src/lib/libc/m32/csu/pcrt1.s b/usr/src/lib/libc/m32/csu/pcrt1.s index 77e2954..eb5a228 100644 --- a/usr/src/lib/libc/m32/csu/pcrt1.s +++ b/usr/src/lib/libc/m32/csu/pcrt1.s @@ -1,11 +1,5 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "pcrt1.s" - .ident "@(#)libc-m32:csu/pcrt1.s 1.20" + .ident "@(#)libc-m32:csu/pcrt1.s 1.18" _section23_(.pesel,i,strtab) .text # C runtime startoff @@ -93,7 +87,9 @@ _prof_dynamic_ptr: # see lprof:soqueue.c _dgdef_(_CAproc): .word 0 - .globl __longdouble_used _dgdef_(__longdouble_used): + .globl __longdouble_used + +_dwdef_(`environ'): .word 0 diff --git a/usr/src/lib/libc/m32/csu/pcrti.s b/usr/src/lib/libc/m32/csu/pcrti.s index d005c56..bfbeeca 100644 --- a/usr/src/lib/libc/m32/csu/pcrti.s +++ b/usr/src/lib/libc/m32/csu/pcrti.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:csu/pcrti.s 1.2" .file "pcrti.s" diff --git a/usr/src/lib/libc/m32/csu/pcrtn.s b/usr/src/lib/libc/m32/csu/pcrtn.s index 9a5605b..59624b8 100644 --- a/usr/src/lib/libc/m32/csu/pcrtn.s +++ b/usr/src/lib/libc/m32/csu/pcrtn.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:csu/pcrtn.s 1.2" .file "pcrtn.s" # diff --git a/usr/src/lib/libc/m32/fp/dround.s b/usr/src/lib/libc/m32/fp/dround.s index 9b8e891..d578124 100644 --- a/usr/src/lib/libc/m32/fp/dround.s +++ b/usr/src/lib/libc/m32/fp/dround.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "dround.s" .ident "@(#)libc-m32:fp/dround.s 1.9" # The routine "_round.double" rounds double precision floating point numbers. diff --git a/usr/src/lib/libc/m32/fp/dspecial.s b/usr/src/lib/libc/m32/fp/dspecial.s index caac361..a6cebdc 100644 --- a/usr/src/lib/libc/m32/fp/dspecial.s +++ b/usr/src/lib/libc/m32/fp/dspecial.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "dspecial.s" .ident "@(#)libc-m32:fp/dspecial.s 1.4.1.3" # This subroutine returns one of the following values. diff --git a/usr/src/lib/libc/m32/fp/faddd.s b/usr/src/lib/libc/m32/fp/faddd.s index 5755fb2..0489cb2 100644 --- a/usr/src/lib/libc/m32/fp/faddd.s +++ b/usr/src/lib/libc/m32/fp/faddd.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "faddd.s" .ident "@(#)libc-m32:fp/faddd.s 1.10.1.4" # double _faddd(arg1,arg2) diff --git a/usr/src/lib/libc/m32/fp/fadds.s b/usr/src/lib/libc/m32/fp/fadds.s index 5558403..4782c58 100644 --- a/usr/src/lib/libc/m32/fp/fadds.s +++ b/usr/src/lib/libc/m32/fp/fadds.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fadds.s" .ident "@(#)libc-m32:fp/fadds.s 1.5.1.4" diff --git a/usr/src/lib/libc/m32/fp/fcmpd.s b/usr/src/lib/libc/m32/fp/fcmpd.s index ce39efa..26e9c3f 100644 --- a/usr/src/lib/libc/m32/fp/fcmpd.s +++ b/usr/src/lib/libc/m32/fp/fcmpd.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "mfcmpd.s" .ident "@(#)libc-m32:fp/fcmpd.s 1.10" # diff --git a/usr/src/lib/libc/m32/fp/fcmps.s b/usr/src/lib/libc/m32/fp/fcmps.s index 191579f..9379af6 100644 --- a/usr/src/lib/libc/m32/fp/fcmps.s +++ b/usr/src/lib/libc/m32/fp/fcmps.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "mfcmps.s" .ident "@(#)libc-m32:fp/fcmps.s 1.11" diff --git a/usr/src/lib/libc/m32/fp/fdivd.s b/usr/src/lib/libc/m32/fp/fdivd.s index 11181a6..cf6abff 100644 --- a/usr/src/lib/libc/m32/fp/fdivd.s +++ b/usr/src/lib/libc/m32/fp/fdivd.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fdivd.s" .ident "@(#)libc-m32:fp/fdivd.s 1.10" diff --git a/usr/src/lib/libc/m32/fp/fdivs.s b/usr/src/lib/libc/m32/fp/fdivs.s index ab92db4..a65232b 100644 --- a/usr/src/lib/libc/m32/fp/fdivs.s +++ b/usr/src/lib/libc/m32/fp/fdivs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fdivs.s" .ident "@(#)libc-m32:fp/fdivs.s 1.9" diff --git a/usr/src/lib/libc/m32/fp/fdtos.s b/usr/src/lib/libc/m32/fp/fdtos.s index e9869a8..1683d19 100644 --- a/usr/src/lib/libc/m32/fp/fdtos.s +++ b/usr/src/lib/libc/m32/fp/fdtos.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fdtos.s" .ident "@(#)libc-m32:fp/fdtos.s 1.6.2.4" diff --git a/usr/src/lib/libc/m32/fp/fltod.s b/usr/src/lib/libc/m32/fp/fltod.s index 734c9a1..2cb9457 100644 --- a/usr/src/lib/libc/m32/fp/fltod.s +++ b/usr/src/lib/libc/m32/fp/fltod.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fltod.s" .ident "@(#)libc-m32:fp/fltod.s 1.7" # convert signed long integer to double precision floating. diff --git a/usr/src/lib/libc/m32/fp/fltos.s b/usr/src/lib/libc/m32/fp/fltos.s index 6446ebc..3fef549 100644 --- a/usr/src/lib/libc/m32/fp/fltos.s +++ b/usr/src/lib/libc/m32/fp/fltos.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fltos.s" .ident "@(#)libc-m32:fp/fltos.s 1.10" # convert long to single precision floating. diff --git a/usr/src/lib/libc/m32/fp/fmuld.s b/usr/src/lib/libc/m32/fp/fmuld.s index c1855e2..dc8ae2b 100644 --- a/usr/src/lib/libc/m32/fp/fmuld.s +++ b/usr/src/lib/libc/m32/fp/fmuld.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fmuld.s" .ident "@(#)libc-m32:fp/fmuld.s 1.12" diff --git a/usr/src/lib/libc/m32/fp/fmuls.s b/usr/src/lib/libc/m32/fp/fmuls.s index 46f94b6..5f7d415 100644 --- a/usr/src/lib/libc/m32/fp/fmuls.s +++ b/usr/src/lib/libc/m32/fp/fmuls.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fmuls.s" .ident "@(#)libc-m32:fp/fmuls.s 1.8" diff --git a/usr/src/lib/libc/m32/fp/fnegd.s b/usr/src/lib/libc/m32/fp/fnegd.s index be84ff9..580e041 100644 --- a/usr/src/lib/libc/m32/fp/fnegd.s +++ b/usr/src/lib/libc/m32/fp/fnegd.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fnegd.s" .ident "@(#)libc-m32:fp/fnegd.s 1.5" # double _fnegd(srcD) diff --git a/usr/src/lib/libc/m32/fp/fnegs.s b/usr/src/lib/libc/m32/fp/fnegs.s index a70b9c5..5969a6c 100644 --- a/usr/src/lib/libc/m32/fp/fnegs.s +++ b/usr/src/lib/libc/m32/fp/fnegs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fnegd.s" .ident "@(#)libc-m32:fp/fnegs.s 1.5" # float _fnegs(srcF) diff --git a/usr/src/lib/libc/m32/fp/fpgetmask.s b/usr/src/lib/libc/m32/fp/fpgetmask.s index ed18574..2100449 100644 --- a/usr/src/lib/libc/m32/fp/fpgetmask.s +++ b/usr/src/lib/libc/m32/fp/fpgetmask.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fpgetmask.s" .ident "@(#)libc-m32:fp/fpgetmask.s 1.11" #---------------------------------- diff --git a/usr/src/lib/libc/m32/fp/fpgetrnd.s b/usr/src/lib/libc/m32/fp/fpgetrnd.s index e28dd29..14babc5 100644 --- a/usr/src/lib/libc/m32/fp/fpgetrnd.s +++ b/usr/src/lib/libc/m32/fp/fpgetrnd.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fpgetrnd.s" .ident "@(#)libc-m32:fp/fpgetrnd.s 1.11" .text diff --git a/usr/src/lib/libc/m32/fp/fpgetsticky.s b/usr/src/lib/libc/m32/fp/fpgetsticky.s index 6df18db..31ee5cc 100644 --- a/usr/src/lib/libc/m32/fp/fpgetsticky.s +++ b/usr/src/lib/libc/m32/fp/fpgetsticky.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fpgetsticky.s" .ident "@(#)libc-m32:fp/fpgetsticky.s 1.11" #---------------------------------- diff --git a/usr/src/lib/libc/m32/fp/fpsetmask.s b/usr/src/lib/libc/m32/fp/fpsetmask.s index bac21c2..d7bd41c 100644 --- a/usr/src/lib/libc/m32/fp/fpsetmask.s +++ b/usr/src/lib/libc/m32/fp/fpsetmask.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:fp/fpsetmask.s 1.4.1.9" .file "fpsetmask.s" # fp_except fpsetmask(mask) diff --git a/usr/src/lib/libc/m32/fp/fpsetrnd.s b/usr/src/lib/libc/m32/fp/fpsetrnd.s index 314ab64..a5cec90 100644 --- a/usr/src/lib/libc/m32/fp/fpsetrnd.s +++ b/usr/src/lib/libc/m32/fp/fpsetrnd.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fpsetrnd.s" .ident "@(#)libc-m32:fp/fpsetrnd.s 1.5.1.9" .text diff --git a/usr/src/lib/libc/m32/fp/fpsetsticky.s b/usr/src/lib/libc/m32/fp/fpsetsticky.s index 2855e6c..39e115c 100644 --- a/usr/src/lib/libc/m32/fp/fpsetsticky.s +++ b/usr/src/lib/libc/m32/fp/fpsetsticky.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fpsetsticky.s" .ident "@(#)libc-m32:fp/fpsetsticky.s 1.4.1.7" #---------------------------------- diff --git a/usr/src/lib/libc/m32/fp/fpstart.s b/usr/src/lib/libc/m32/fp/fpstart.s index 4d83821..b85badd 100644 --- a/usr/src/lib/libc/m32/fp/fpstart.s +++ b/usr/src/lib/libc/m32/fp/fpstart.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fpstart.s" .ident "@(#)libc-m32:fp/fpstart.s 1.4" # diff --git a/usr/src/lib/libc/m32/fp/fpstart0.s b/usr/src/lib/libc/m32/fp/fpstart0.s index 1ee7619..eab3afc 100644 --- a/usr/src/lib/libc/m32/fp/fpstart0.s +++ b/usr/src/lib/libc/m32/fp/fpstart0.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fpstart0.s" .ident "@(#)libc-m32:fp/fpstart0.s 1.5" # diff --git a/usr/src/lib/libc/m32/fp/fstod.s b/usr/src/lib/libc/m32/fp/fstod.s index bc2f068..d6cc434 100644 --- a/usr/src/lib/libc/m32/fp/fstod.s +++ b/usr/src/lib/libc/m32/fp/fstod.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "fstod.s" .ident "@(#)libc-m32:fp/fstod.s 1.4.2.4" diff --git a/usr/src/lib/libc/m32/fp/ftdtol.s b/usr/src/lib/libc/m32/fp/ftdtol.s index a8e6e72..a5d2e78 100644 --- a/usr/src/lib/libc/m32/fp/ftdtol.s +++ b/usr/src/lib/libc/m32/fp/ftdtol.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "ftdtol.s" .ident "@(#)libc-m32:fp/ftdtol.s 1.5.1.7" #**************************************************************************** diff --git a/usr/src/lib/libc/m32/fp/ftdtou.s b/usr/src/lib/libc/m32/fp/ftdtou.s index 9f5e6eb..02d0718 100644 --- a/usr/src/lib/libc/m32/fp/ftdtou.s +++ b/usr/src/lib/libc/m32/fp/ftdtou.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "ftdtou.s" .ident "@(#)libc-m32:fp/ftdtou.s 1.5.1.7" #**************************************************************************** diff --git a/usr/src/lib/libc/m32/fp/ftstol.s b/usr/src/lib/libc/m32/fp/ftstol.s index 93adb2e..71a02cf 100644 --- a/usr/src/lib/libc/m32/fp/ftstol.s +++ b/usr/src/lib/libc/m32/fp/ftstol.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "ftstol.s" .ident "@(#)libc-m32:fp/ftstol.s 1.4.1.8" #**************************************************************************** diff --git a/usr/src/lib/libc/m32/fp/ftstou.s b/usr/src/lib/libc/m32/fp/ftstou.s index 6051e4d..1c77031 100644 --- a/usr/src/lib/libc/m32/fp/ftstou.s +++ b/usr/src/lib/libc/m32/fp/ftstou.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "ftstou.s" .ident "@(#)libc-m32:fp/ftstou.s 1.4.1.7" #**************************************************************************** diff --git a/usr/src/lib/libc/m32/fp/isnand.s b/usr/src/lib/libc/m32/fp/isnand.s index 25eed12..0be557a 100644 --- a/usr/src/lib/libc/m32/fp/isnand.s +++ b/usr/src/lib/libc/m32/fp/isnand.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "isnand.s" .ident "@(#)libc-m32:fp/isnand.s 1.7" # int isnand(srcD) diff --git a/usr/src/lib/libc/m32/fp/isnanf.s b/usr/src/lib/libc/m32/fp/isnanf.s index 28eed28..56945c6 100644 --- a/usr/src/lib/libc/m32/fp/isnanf.s +++ b/usr/src/lib/libc/m32/fp/isnanf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "isnanf.s" .ident "@(#)libc-m32:fp/isnanf.s 1.4" # int isnanf(srcF) diff --git a/usr/src/lib/libc/m32/fp/scalb.c b/usr/src/lib/libc/m32/fp/scalb.c index 18fb543..95e4eb3 100644 --- a/usr/src/lib/libc/m32/fp/scalb.c +++ b/usr/src/lib/libc/m32/fp/scalb.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:fp/scalb.c 1.5" +#ident "@(#)libc-m32:fp/scalb.c 1.4" /*LINTLIBRARY /* SCALB(X,N) @@ -22,7 +22,6 @@ #include #include #include "fpparts.h" -#include double scalb(x,n) double x, n; @@ -34,25 +33,5 @@ double x, n; return (x + 1.0); /* signaling NaN - raise exception */ } #endif - if (x == 0.0) - return x; - if ((n >= (double)INT_MAX) || (n <= (double)INT_MIN)) { - /* over or underflow */ - double d; - errno = ERANGE; - if (x < 0.0) - d = -x; - else - d = x; - if (((d < 1.0) && (n > 0)) || - ((d >= 1.0) && (n < 0))) - return 0.0; /* underflow */ - else { - if (_lib_version == c_issue_4) - return(x > 0.0 ? HUGE : -HUGE); - else - return(x > 0.0 ? HUGE_VAL : -HUGE_VAL); - } - } return(ldexp(x, (int)n)); } diff --git a/usr/src/lib/libc/m32/fp/sround.s b/usr/src/lib/libc/m32/fp/sround.s index 36cf4a7..b434f44 100644 --- a/usr/src/lib/libc/m32/fp/sround.s +++ b/usr/src/lib/libc/m32/fp/sround.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sround.s" .ident "@(#)libc-m32:fp/sround.s 1.4" diff --git a/usr/src/lib/libc/m32/fp/sspecial.s b/usr/src/lib/libc/m32/fp/sspecial.s index dcd9eb0..cea45b5 100644 --- a/usr/src/lib/libc/m32/fp/sspecial.s +++ b/usr/src/lib/libc/m32/fp/sspecial.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sspecial.s" .ident "@(#)libc-m32:fp/sspecial.s 1.3.1.3" diff --git a/usr/src/lib/libc/m32/gen/abs.s b/usr/src/lib/libc/m32/gen/abs.s index 2090d7e..c0c81de 100644 --- a/usr/src/lib/libc/m32/gen/abs.s +++ b/usr/src/lib/libc/m32/gen/abs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "abs.s" .ident "@(#)libc-m32:gen/abs.s 1.5" # int diff --git a/usr/src/lib/libc/m32/gen/atof.c b/usr/src/lib/libc/m32/gen/atof.c index b9dfbf0..75dff48 100644 --- a/usr/src/lib/libc/m32/gen/atof.c +++ b/usr/src/lib/libc/m32/gen/atof.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:gen/atof.c 1.13" +#ident "@(#)libc-m32:gen/atof.c 1.12" /*LINTLIBRARY*/ /* * C library - ascii to floating (atof) and string to double (strtod) @@ -100,6 +100,7 @@ register const char *p; DEC_PTR; /* in case there is no legitimate exponent */ if (c == 'E' || c == 'e') { /* accumulate exponent */ register int e_exp = 0, neg_exp = 0; + STORE_PTR; switch (*p) { /* process sign */ case '-': diff --git a/usr/src/lib/libc/m32/gen/biglitpow.s b/usr/src/lib/libc/m32/gen/biglitpow.s index d19a44a..be1a266 100644 --- a/usr/src/lib/libc/m32/gen/biglitpow.s +++ b/usr/src/lib/libc/m32/gen/biglitpow.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:gen/biglitpow.s 1.4" # # arrays used by both _dtop.c and _ptod.c diff --git a/usr/src/lib/libc/m32/gen/cuexit.s b/usr/src/lib/libc/m32/gen/cuexit.s index 73aecf4..a809f14 100644 --- a/usr/src/lib/libc/m32/gen/cuexit.s +++ b/usr/src/lib/libc/m32/gen/cuexit.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- exit .ident "@(#)libc-m32:gen/cuexit.s 1.7" diff --git a/usr/src/lib/libc/m32/gen/dtop.c b/usr/src/lib/libc/m32/gen/dtop.c index 790783c..906fbc6 100644 --- a/usr/src/lib/libc/m32/gen/dtop.c +++ b/usr/src/lib/libc/m32/gen/dtop.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:gen/dtop.c 1.7" +#ident "@(#)libc-m32:gen/dtop.c 1.6" /* * Simulated extended precision floating point conversion functions * ---------------------------------------------------------------- @@ -284,17 +284,9 @@ long *frac_ptr; } else { retval = (w1 << t) + ((w2 << t) >> WSIZE); w1 = w2 & (WMASK >> t); - w2 = w3; w3 = w4; w4 = 0; + w2 = w3; w3 = w4; } - /* for the accuracy of rounding result, if the last digit of - * retval is 5, and the remaining fraction part is nonzero, - * do the adjustment - change the last digit to 6. - */ - - if(retval%10 == 5 && (w1 || w2 || w3 || w4)) - retval++; - if (prec <= 0) return(retval); diff --git a/usr/src/lib/libc/m32/gen/ecvt.c b/usr/src/lib/libc/m32/gen/ecvt.c index 7437425..61b750c 100644 --- a/usr/src/lib/libc/m32/gen/ecvt.c +++ b/usr/src/lib/libc/m32/gen/ecvt.c @@ -1,11 +1,4 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)libc-m32:gen/ecvt.c 1.16" +#ident "@(#)libc-m32:gen/ecvt.c 1.14" /*LINTLIBRARY*/ /* * ecvt converts to decimal @@ -119,7 +112,7 @@ int *decpt; { register char *end_ptr; char *begin_ptr; - int tdecpt, adjustment; + int tdecpt; long long1, long2; int *pval = (int *)&value; /* see comment below */ @@ -197,7 +190,7 @@ int *decpt; of digits before the decimal point. */ - { + { register int adjustment; end_ptr = &buf[4] + length_wanted; adjustment = end_ptr - @@ -240,8 +233,7 @@ int *decpt; ndigit = NMAX; p = end_ptr = bp + ndigit; - if (*p > '5' || (*p == '5' && - ((((int)*(p - 1)) % 2) || adjustment > 0))) + if (*p >= '5') do { *p = '0'; if (p == bp) { /* all 9's */ diff --git a/usr/src/lib/libc/m32/gen/fptrap.s b/usr/src/lib/libc/m32/gen/fptrap.s new file mode 100644 index 0000000..1fa5785 --- /dev/null +++ b/usr/src/lib/libc/m32/gen/fptrap.s @@ -0,0 +1,2112 @@ + .file "fptrap.s" + .ident "@(#)libc-m32:gen/fptrap.s 1.7" + +_fwdef_(`fptrap'): + SAVE %r3 + MCOUNT + ADDW2 &localvar,%sp +fpreent: # this is the point we return to + # when we are executing the n+1th + # floating point instruction in a + # contiguous sequence of floating + # point instructions (floating + # pointlessly forever?) + MOVW 0(%ap),_sref_(regsave) # register save area address + MOVW 0(%ap),%r0 + MOVW 60(%r0),_sref_(pc) # program counter + MOVW _sref_(pc),_sref_(cpc) # current program counter = pc + jsb fetch_opcode + jsb set_globals + MOVW %fp,%r7 + CLRH _sref_(fetchmd) # src + jsb get_operand + CMPH &9,_sref_(op2) + je two_operands + CMPH &0xf,_sref_(op1) + je get_source + CMPH &7,_sref_(op1) + jgeu one_operand +two_operands: + CMPH &9,_sref_(op2) + je get_source + MOVH &1,_sref_(fetchmd) # src/dest +get_source: + ADDW3 &12,%fp,%r7 + MOVW fdt(%fp),fdt(%r7) # fdt & fdc(fp) moved + MOVW fdu(%fp),fdu(%r7) + MOVW fdl(%fp),fdl(%r7) + MOVW %fp,%r7 + jsb get_admode + jsb get_operand + ADDW3 &12,%fp,%r7 + MOVW %r3,_sref_(dest) +one_operand: + jsb compute_result + CMPH &0xf,_sref_(op1) + je fp_ret + CMPH &9,_sref_(op2) + je get_dest + CMPH &7,_sref_(op1) + jlu store_result +get_dest: + MOVH &2,_sref_(fetchmd) # dest + jsb get_admode + jsb get_operand + MOVW %r3,_sref_(dest) +store_result: + CMPH &1,_sref_(nostore) # was a nan or infinity being converted to integer? + je fp_ret + MOVW _sref_(dest),%r4 + CMPH &0xb,_sref_(op1) + jl word_store + CMPH &0xc,_sref_(op1) + jg word_store +# see if it is a register we are storing + CMPH &4,_sref_(admode) + je strreg # if so, branch +# store in memory + MOVH fdu(%fp),{shalf}0(%r4) + jmp fp_ret +# store halfword in register +strreg: MOVH fdu(%fp),{sword}0(%r4) + jmp fp_ret +word_store: + MOVW fdu(%fp),0(%r4) + CMPH _sref_(mode_precision),&single + je fp_ret + CMPH &0xd,_sref_(op1) # see if double to fw converts + je fp_ret + CMPH &0xe,_sref_(op1) + je fp_ret + MOVW fdl(%fp),4(%r4) +fp_ret: + MOVW _sref_(regsave),%r0 +update_psw: + INSFH &3,&18,_sref_(pswflgs),{uword}44(%r0) # update PSW +new_pc: + MOVW _sref_(cpc),60(%r0) # update pc +# a check to see if the trace enable bit is on in the PSW +# If on, skip the check for a floating point opcode in the next +# instruction. + BITW &0x00020000,44(%r0) + jne re_store +# now, to make things just a little more efficient we check to see +# if the next instruction has a floating point opcode. If it does +# then we fudge up the registers correctly and branch up to the +# top of this routine to interpret that instruction, and so on. +# This relies on a table called _fpopcode which is located in fcrt0.s +# and fmcrt0.s + .globl _fpopcode + MOVB *_sref_(cpc),%r0 # get next opcode +_m4_ifdef_(`DSHLIB', +` ADDW2 _daref_(_fpopcode),%r0 # look opcode up in table + TSTB 0(%r0) +', +` TSTB _fpopcode(%r0) # look opcode up in table +') + jne fpreent # if 1, this is fp opcode +re_store: + RESTORE %r3 + RET + .data + .set fdt,0 # Tag offset + .set fdc,2 + .set fdu,4 # Upper operand offset + .set fdl,8 # Lower operand offset +# +# Instruction decoding +# + .bss op1,2,2 + .bss op2,2,2 + .bss admode,2,2 + .bss regno,2,2 + .bss lit,2,2 +# +# Mode of operation +# + .bss mode_round,2,2 + .bss mode_precision,2,2 + .bss mode_denorm,2,2 + .bss mode_inf,2,2 +# +# Error flags +# + .bss err_inexact,2,2 + .bss err_invalid,2,2 + .bss err_div_zero,2,2 + .bss err_oflow,2,2 + .bss err_uflow,2,2 + .bss err_denorm_op,2,2 +# .bss err_trap_nan,2,2 + .bss err_int_fault,2,2 +# +# Destination structure +# + .bss unnorm_ok,2,2 + .bss denorm_ok,2,2 + .bss othresh,2,2 + .bss uthresh,2,2 +# + .bss fetchmd,2,2 + .bss pswflgs,2,2 + .bss subflg,2,2 + .bss divflg,2,2 +# + .set localvar,24 +# +# Rounding mode +# + .set to_nearest,0 + .set toward_0,1 + .set toward_plus,2 + .set toward_minus,3 +# +# Rounding precision control +# + .set extended,0 + .set single,1 + .set double,2 +# +# Interpretations of denormalised numbers +# + .set warning,0 + .set normalising,1 +# +# Interpretations of infinities +# + .set projective,0 + .set affine,1 +# +# Tag types +# + .set zerotag,0 + .set inftag,1 + .set t_nantag,2 + .set n_nantag,3 + .set numtag,4 +# + .bss shiftcnt,2,2 + .bss maxshft,2,2 + .bss maxexp,2,2 + .bss exponent,2,2 + .bss bias,2,2 + .bss bias2,2,2 + .bss exp,2,2 + .bss expw,2,2 + .bss mant,2,2 + .bss cond,2,2 + .bss isnan,2,2 + .bss stky,2,2 + .bss size,2,2 + .bss nostore,2,2 + .align 4 + .bss pc,4,4 + .bss cpc,4,4 + .bss regsave,4,4 + .bss temp1,4,4 + .bss temp2,4,4 + .bss dest,4,4 + .bss rstky,4,4 + .bss tempvar,4,4 +# + .text +###################################################################### +# +# This routine fetches the opcode of the floating point instruction +# to be executed. +# +fetch_opcode: + MOVW _sref_(regsave),%r0 # r0 = regsave area + MOVW _sref_(cpc),%r1 # r1 = pc + MOVB 0(%r1),%r2 # 1st byte of instruction + EXTFB &3,&4,%r2,{uhalf}_sref_(op1) + EXTFB &3,&0,%r2,{uhalf}_sref_(op2) + INCW _sref_(cpc) # pc bumped up by 1 +get_admode: + MOVW _sref_(cpc),%r1 + MOVB 0(%r1),%r2 + EXTFB &3,&4,%r2,{uhalf}_sref_(admode) + EXTFB &3,&0,%r2,%r3 # r3 = regno or literal (mode 6 or 7) + INCW _sref_(cpc) # pc bumped up by 1 + RSB +##################################################################### +# +# This initialisation routine collects state information. +# +set_globals: + jsb fetch_mode + jsb clear_error + jsb set_dest + CLRH _sref_(nostore) # reset store result flag - used in converts to indicate + # if a nan or infinity to integer convert was + # attempted. If one was attempted, no store of + # result will occur. 0 indicates that result + # should be stored + RSB +fetch_mode: + MOVH &to_nearest,_sref_(mode_round) + CMPH &9,_sref_(op2) + je precision + CMPH &7,_sref_(op1) + jlu precision + MOVH &toward_0,_sref_(mode_round) +precision: + MOVH &double,_sref_(mode_precision) + CMPH &1,_sref_(op2) + jne op2chk + MOVH &single,_sref_(mode_precision) + jmp other_modes +op2chk: + CMPH &9,_sref_(op2) + jne other_modes + CMPH &7,_sref_(op1) + jgeu other_modes + MOVH &single,_sref_(mode_precision) +other_modes: + MOVH &normalising,_sref_(mode_denorm) + MOVH &affine,_sref_(mode_inf) + RSB +clear_error: + CLRH _sref_(pswflgs) + CLRH _sref_(subflg) + CLRH _sref_(err_inexact) + CLRH _sref_(err_invalid) + CLRH _sref_(err_div_zero) + CLRH _sref_(err_oflow) + CLRH _sref_(err_uflow) + CLRH _sref_(err_denorm_op) + CLRH _sref_(err_int_fault) + RSB +set_dest: + CLRH _sref_(unnorm_ok) + MOVH &1,_sref_(denorm_ok) + CMPH _sref_(mode_precision),&double + jne sngl_precis +dbl_precis: + MOVH &55,_sref_(maxshft) + MOVH &52,_sref_(maxexp) + MOVH &1023,_sref_(bias) + MOVH &2047,_sref_(bias2) + MOVH &20,_sref_(exp) + MOVH &10,_sref_(expw) + MOVH &19,_sref_(mant) + MOVH &1023,_sref_(othresh) + MOVH &-1022,_sref_(uthresh) + RSB +sngl_precis: + MOVH &26,_sref_(maxshft) + MOVH &23,_sref_(maxexp) + MOVH &127,_sref_(bias) + MOVH &255,_sref_(bias2) + MOVH &23,_sref_(exp) + MOVH &7,_sref_(expw) + MOVH &22,_sref_(mant) + MOVH &127,_sref_(othresh) + MOVH &-126,_sref_(uthresh) + RSB +######################################################################### +# +# This routine fetches the next operand +# +get_operand: + CMPH &2,_sref_(fetchmd) # check to see if dest fetch + je get_op_dest # if so skip next step + CLRW fdl(%r7) # clear lower half location + # for fetch data just in case + # it is a single +get_op_dest: + CMPH &3,_sref_(admode) + jleu litmode + CMPH &14,_sref_(admode) + jgu litmode + je absdef + CMPH &5,_sref_(admode) + jleu regmode + CMPH &7,_sref_(admode) + jleu offsmod + CMPH &12,_sref_(admode) + jgeu bdispl + jmp displ +litmode: + CMPH _sref_(fetchmd),&0 + jne fpabort + CMPH &9,_sref_(op2) + je fpabort + CMPH &7,_sref_(op1) + jlu fpabort + CMPH &8,_sref_(op1) + jgu fpabort + CMPH &15,_sref_(admode) + je neglit + EXTFB &5,&0,%r2,{uword}fdu(%fp) + RSB +neglit: + MOVW &0xffffffff,fdu(%fp) + EXTFB &5,&0,%r2,%r2 + INSFB &5,&0,%r2,{uword}fdu(%fp) + RSB +regmode: + CMPB %r3,&15 + je immediate + MULW2 &4,%r3 # r3 = offset into register save area + ADDW2 _sref_(regsave),%r3 # r3 = address of operand or operand's EA + CMPH &4,_sref_(admode) + jne deffer +# see if the operand in the register is a halfword. If so, +# then increment address by 2 to point to the correct halfword +# in the register + CMPH &9,_sref_(op2) + je operand + CMPH _sref_(fetchmd),&2 ## source or dest + je rmod_ret +#source operand, see if halfword source + CMPH &7,_sref_(op1) + jne operand + ADDW2 &2,%r3 # is halfword, so point to right half + jmp operand +# destination operand, see if halfword destination +# register deferred +deffer: MOVW 0(%r3),%r3 # r3 = address of operand +operand: + CMPH _sref_(fetchmd),&2 # check if destination + je rmod_ret + CMPH &9,_sref_(op2) + je get_word + CMPH &7,_sref_(op1) + jne get_word + MOVH 0(%r3),{sword}fdu(%fp) + jmp rmod_ret +get_word: + MOVW 0(%r3),fdu(%r7) # get operand + CMPH _sref_(mode_precision),&single + je rmod_ret + MOVW 4(%r3),fdl(%r7) +rmod_ret: + RSB +immediate: + CMPH _sref_(fetchmd),&0 # check if source only + jne fpabort # an immediate is an invalid destination + jsb himm + MOVH {shalf}%r2,{sword}fdu(%r7) + CMPH &5,_sref_(admode) + je rmod_ret + jsb himm + INSFW &15,&16,%r2,fdu(%r7) + RSB +himm: + MOVW _sref_(cpc),%r8 + MOVB 1(%r8),{uword}%r2 + LLSW3 &8,%r2,%r2 + ADDB2 0(%r8),{uword}%r2 + ADDW2 &2,_sref_(cpc) # pc bumped up by 2 + RSB +offsmod: + MOVB %r3,{shalf}_sref_(lit) # literal to be added to c(fp) or c(ap) + CMPH _sref_(lit),&15 + je abschk + ADDH2 &3,_sref_(admode) # admode 6 = r9 = fp, admode 7 = r10 = ap + MULW3 &4,{uhalf}_sref_(admode),%r3 + ADDW2 _sref_(regsave),%r3 # address of contents of fp or ap + ADDW3 {shalf}_sref_(lit),{uword}0(%r3),%r3 # r3 = address of operand + jmp operand +abschk: + CMPH &6,_sref_(admode) + jne absmod + CMPH &0,_sref_(fetchmd) + jne fpabort + MOVB {sbyte}*_sref_(cpc),{sword}fdu(%r7) + INCW _sref_(cpc) + RSB +absmod: + jsb himm + MOVW %r2,%r3 + jsb himm + INSFW &15,&16,%r2,%r3 + jmp operand +absdef: + CMPB %r3,&15 + jne fpabort + jsb himm + MOVW %r2,%r3 + jsb himm + INSFW &15,&16,%r2,%r3 + MOVW 0(%r3),%r3 # defer + jmp operand +bdispl: + CMPH &12,_sref_(admode) + jne get_offset + CMPB %r3,&15 + je dimm +get_offset: + MULW2 &4,%r3 # r3 = offset from regsave area + ADDW2 _sref_(regsave),%r3 # r3 = address of the register + MOVW _sref_(cpc),%r8 + MOVB {sbyte}0(%r8),{sword}%r4 + INCW _sref_(cpc) + ADDW3 0(%r3),%r4,%r3 + CMPH &13,_sref_(admode) + jne operand + MOVW 0(%r3),%r3 + jmp operand +dimm: + jsb immediate + MOVW fdu(%r7),%r3 + jsb immediate + MOVW fdu(%r7),fdl(%r7) + MOVW %r3,fdu(%r7) + RSB +displ: + MULW2 &4,%r3 # r3 = offset from regsave + ADDW2 _sref_(regsave),%r3 # r3 = address of register + jsb himm + CMPH &10,_sref_(admode) + jlu word_disp + MOVH {shalf}%r2,{sword}%r4 + jmp dsp_sum +word_disp: + MOVW %r2,%r4 + jsb himm + INSFW &15,&16,%r2,%r4 +dsp_sum: + ADDW3 0(%r3),%r4,%r3 # r3 = operand or operand's EA + EXTFH &0,&0,_sref_(admode),%r2 # check if admode odd (i.e., mode 7 or 9) + CMPH %r2,&1 + jne operand + MOVW 0(%r3),%r3 + jmp operand +####################################################################### +# +# Determine what operation is to be performed on the operand(s). +# +compute_result: + CMPH &0xf,_sref_(op1) + je compare + CMPH &0xa,_sref_(op1) + jgu flt_int + CMPH &4,_sref_(op1) + jlu add + je subtract + CMPH &6,_sref_(op1) + jlu multiply + je divide + CMPH &9,_sref_(op2) + je arithmetic + CMPH &9,_sref_(op1) + jlu int_flt + ADDH2 _sref_(op1),_sref_(op2) + CMPH &0xb,_sref_(op2) + je sngl_dbl + CMPH &0xe,_sref_(op2) + je dbl_sngl +# we have movss or movdd---set flags and store result + EXTFW &0,&31,fdu(%fp),_sref_(tempvar) # get sign of source + je tstzero + ORH2 &0x8,_sref_(pswflgs) # set N if sign is negative +tstzero: + EXTFW &30,&0,fdu(%fp),_sref_(tempvar) # get first half to test for 0 + ORW2 fdl(%fp),_sref_(tempvar) # or in second half + jne retcomp + ORH2 &0x4,_sref_(pswflgs) # set Z if equal to 0 +retcomp: + RSB +arithmetic: + CMPH &8,_sref_(op1) + jlu add + je subtract + CMPH &0xa,_sref_(op1) + jlu multiply + jmp divide +###################################################################### +# +# Unpack a number, num. It is assumed initially that num is a typical +# number. All special cases are then checked. +# +unpack: + MOVH &numtag,fdt(%r7) + EXTFW {uhalf}_sref_(mant),&0,{uword}fdu(%r7),%r0 + MOVW fdl(%r7),%r1 + MOVH _sref_(expw),_sref_(shiftcnt) + MOVH &99,_sref_(exponent) + jsb shift_left + EXTFH _sref_(expw),_sref_(exp),{uword}fdu(%r7),{uhalf}fdc(%r7) + MOVH fdc(%r7),%r4 + SUBH2 _sref_(bias),fdc(%r7) + ORW3 %r0,%r1,%r5 # r0,r1 is checked for fraction = 0 +# prior to inserting the implied 1 + ORW2 &0x40000000,%r0 # leading 1 inserted + CMPH %r4,&0 + jne inf_or_nan + CMPW %r5,&0 + jne denormalised +normal_0: + MOVH &zerotag,fdt(%r7) + RSB +denormalised: + MOVB &1,_sref_(err_denorm_op) + INSFW &0,&30,&0,%r0 # denormalised numbers have a leading 0 + INCH fdc(%r7) +# CMPH _sref_(mode_denorm),&normalising +# jne finish + jsb norm + RSB +inf_or_nan: + CMPH %r4,_sref_(bias2) + jne finish + MOVH &inftag,fdt(%r7) + CMPW %r5,&0 + je finish +nan: + MOVH &n_nantag,fdt(%r7) +finish: + RSB +######################################################################## +# +# This routine normalises the number in r0,r1. +# +norm: + ORW3 %r1,%r0,%r8 + jne norm_loop + MOVH &zerotag,fdt(%r7) # special case of normal zero + RSB +norm_loop: + EXTFH &0,&30,{uword}%r0,%r8 # bit lost in shift + CMPB %r8,&0 + jne norm_end + EXTFW &0,&31,%r1,%r8 + LLSW3 &1,%r1,%r1 + LLSW3 &1,%r0,%r0 + ORW2 %r8,%r0 + DECH fdc(%r7) # reduce exponent by 1 + jmp norm_loop +norm_end: + RSB +####################################################################### +# +# Check for nans +# +nanchk: + CLRH _sref_(isnan) + CMPH fdt(%fp),&n_nantag + je found_nan + CMPH fdt(%r7),&n_nantag + je found_nan + RSB +found_nan: + MOVH &1,_sref_(isnan) + RSB +########################################################################## +# +# This routine converts a half or a word to floating point internal +# format and assigns that value to a single or double precision +# destination. +# +int_flt: + EXTFW &30,&0,fdu(%fp),%r0 + CMPW %r0,&0 + jne flt_nonzero + +# we have either a zero or the maximum negative number. Check the +# sign to determine which we have + EXTFW &0,&31,fdu(%fp),%r2 + je zeroint # branch if zero + MOVH &31,fdc(%fp) # set exponent and + MOVH &numtag,fdt(%fp) # number tag and + MOVW &0x40000000,%r0 # mantissa of max neg number + CLRW %r1 + jsb pack + RSB +zeroint: + MOVH &zerotag,fdt(%fp) + jsb pack + RSB +flt_nonzero: + MOVH &numtag,fdt(%fp) + CLRW %r1 + EXTFW &0,&31,fdu(%fp),%r2 # r2 = sign + je get_exp + MNEGW %r0,%r0 +get_exp: + MOVH &30,fdc(%fp) + jsb norm + jsb trim_result + jsb pack + RSB +####################################################################### +# +# This routine converts a single precision number to double precision. +# +sngl_dbl: + jsb unpack + MOVH &double,_sref_(mode_precision) + jsb set_dest + CMPH fdt(%fp),&n_nantag + BEB sing_nan + jsb pack + RSB +sing_nan: + EXTFW &22,&0,fdu(%fp),%r2 # extract the pc from the nan + INSFW &3,&28,%r2,fdl(%fp) # insert part of the pc into the double + LRSW3 &4,%r2,%r2 + INSFW &18,&0,%r2,fdu(%fp) + INSFH _sref_(expw),_sref_(exp),_sref_(bias2),{uword}fdu(%fp) # insert the rest of the pc + RSB +######################################################################### +# +# This routine converts a double precision number to single precision. +# +dbl_sngl: + jsb unpack + MOVH &single,_sref_(mode_precision) + jsb set_dest + CMPH fdt(%fp),&n_nantag + jne trim +# +# We have a NaN. Must extract the pc from the double NaN. +# + EXTFW &3,&28,fdl(%fp),%r2 + EXTFW &18,&0,fdu(%fp),%r3 + LLSW3 &4,%r3,%r3 + MOVW &0x7f800000,fdu(%fp) # Put in single NaN exponent. + ORW2 %r2,%r3 + BNEB stnan +# +# We have an artificially produced NaN, i.e., one that has been +# generated by hand rather than by this package. This will occur +# usually when tests of this package are written and NaN handling +# is to be tested. The low 23 bits of the second word will most +# likely contain the nonzero number for these cases. +# + EXTFW &22,&0,fdl(%fp),%r3 + BNEB stnan +# +# In the case of a NaN, if the upper part of the mantissa is 0, the +# single precision result will be 0 with an exponent of all ones. +# The result will look like an infinity. To preserve the NaN concept, +# a 1 is inserted in the lowest bit of the single precision number. +# This case of an artificially produced NaN will rarely, if ever, occur. +# + MOVW &1,%r3 +stnan: + ORW2 %r3,fdu(%fp) + RSB +# +# We have a zero, an infinity, or a number. +# +trim: + CMPW %r1,&0 + je smove + ORW2 &0x1,%r0 # sticky bits from r1 included in r0 +smove: + jsb trim_result + jsb pack + RSB +######################################################################### +# +# This routine converts a single or a double precision number to +# an internal format and assigns that value to a halfword or word. +# +flt_int: + jsb unpack + CMPH fdt(%fp),&zerotag + je flt_A + CMPH fdt(%fp),&numtag + je flt_B + jmp flt_C +# +# 0 +# +flt_A: + CLRW fdu(%fp) + ORH2 &0x4,_sref_(pswflgs) + ANDH2 &0xf7,_sref_(pswflgs) #zap N flag, if set + RSB # int(0) is itself +# +# Typical case of a finite number +# +# if we have a rounding mode, go round the number here before we later +# truncate the lower unused bits +flt_B: + CMPH &0xc,_sref_(op1) + je mantchk + CMPH &0xe,_sref_(op1) + je mantchk + jsb round_int # go round number to an integer + +# check if the exponent is negative. If so, go return 0 and +# set the inexact flag. +mantchk: + CMPH &0,fdc(%fp) + jge pos_exp + ORH2 &0x1,_sref_(pswflgs) # C in PSW set + jmp flt_A + +#here we have a positive exponent. Test to see if the sign of +# the result is to be positive or negative and set the N flag accordingly +pos_exp: + EXTFW &0,&31,fdu(%fp),%r4 + je pos_num + ORH2 &0x8,_sref_(pswflgs) +# now see if the positive exponent is in range to represent the +# number in a halfword or fullword. If a halfword, then +# the exponent must be <15. If a fullword, then the exponent +# must be <31. Set size to value according to the operation. +pos_num: + MOVH &31,_sref_(size) + CMPH &0xc,_sref_(op1) + jg float_I +# we have a float to halfword instruction + MOVH &15,_sref_(size) + CMPH _sref_(size),fdc(%fp) + jl flt_right # branch if exponent is in range + +# check for the special case of the maximum negative number. This +# occurs when the exponent=15, mantissa=8000 (after truncation or +# rounding), and the sign is negative + CMPH _sref_(size),fdc(%fp) # check for exp=15 + jg flt_left # jump if not + EXTFW &14,&15,%r0,_sref_(tempvar) # check for mantissa=8000 + jne flt_left # jump if not + CMPH &0,%r4 # check for negative sign + je flt_left # jump if not + MOVW &0x80000000,fdu(%fp) # special case of max neg number +# check for imprecise result + EXTFW &14,&0,%r0,_sref_(tempvar) + ORW2 %r1,_sref_(tempvar) + je reti + ORH2 &0x1,_sref_(pswflgs) +reti: RSB +float_I: + CMPH _sref_(size),fdc(%fp) + jl flt_right # branch if in range + CMPH _sref_(size),fdc(%fp) # check for exponent=15 + jg flt_left + CMPW &0x40000000,%r0 + jne flt_left + EXTFW &0,&31,%r1,_sref_(tempvar) # test last bit of mantissa for special case + jne flt_left # if one, not special case, so branch + CMPH &0,%r4 # test for negative sign + je flt_left + MOVW &0x80000000,fdu(%fp) +# check for imprecise result + MOVW %r1,_sref_(tempvar) + je reti + ORH2 &0x1,_sref_(pswflgs) + RSB + +# for this section, we have an exponent that is too big, so overflow +# has occurred. Now, we need to set the V flag and determine what +# bits are left after we left shift the mantissa according to +# the exponent +flt_left: + ORH2 &0x2,_sref_(pswflgs) +# first, see if any bits are left at all, ie if exponent is > maxexp + ADDW2 _sref_(size),_sref_(maxexp) + CMPH _sref_(maxexp),fdc(%fp) + jg flt_A # all bits are rotated out, so store zero + jl convert # some bits are left, determine which ones +# test for special case where mantissa last bit =1 and exponent=maxexp +# and sign is negative + CMPH _sref_(mode_precision),&single + jne dbl_flt + EXTFW &0,&7,%r0,%r4 # test for last bit =1 + je flt_A # if not, go store zero + jmp weird +dbl_flt: + EXTFW &0,&10,%r1,%r4 # test for last bit =1 + je flt_A # if not, go store zero +weird: + EXTFW &0,&31,fdu(%fp),%r4 + je flt_A + MOVW &0x80000000,fdu(%fp) + RSB +# at this point, we have a number with exponent in the range +# 15 <= exp < maxexp. We need to shift left the mantissa +# exponent-size+1 times +convert: + SUBH3 _sref_(size),fdc(%fp),_sref_(shiftcnt) # shiftcnt = exponent - size + INCH _sref_(shiftcnt) + jsb shift_left +# check for inexact result, ie if we truncate bits off the right side of +# the mantissa + CMPH &15,_sref_(size) + je hwinx + CMPW &0,%r1 + je exactr + ORH2 &0x1,_sref_(pswflgs) + jmp exactr +hwinx: + EXTFW &15,&0,%r0,_sref_(tempvar) # look at rest of bits in r0 + ORW2 %r1,_sref_(tempvar) # and in r1 + je exactr + ORH2 &0x1,_sref_(pswflgs) # set c flag for inexact + +# test for negative number +exactr: + EXTFW &0,&31,fdu(%fp),%r4 # test sign + je clr31 +# test for special case of 8000 or 80000000 + CMPH &15,_sref_(size) + je checkhw + CMPW %r0,&0x80000000 + je flt_ret +clr31: + EXTFW &30,&0,%r0,_sref_(tempvar) # check for zero + je flt_A + jmp set_sign +checkhw: + EXTFW &15,&16,%r0,_sref_(tempvar) + CMPW &0x8000,_sref_(tempvar) + je flt_ret + EXTFW &14,&16,%r0,_sref_(tempvar) + je flt_A + jmp set_sign +flt_right: + SUBH3 &1,_sref_(size),%r6 + SUBH3 fdc(%fp),%r6,_sref_(shiftcnt) # shiftcnt = 31 - exponent + jsb shift_right + +# test for imprecise result. This occurs when bits in R1 are nonzero +# or for halfwords, when the low 16 bits of r0 are non-zero + ORW2 _sref_(rstky),%r1 + jne setimp + CMPH _sref_(size),&15 + jne set_sign # if fullword, go store result + EXTFW &15,&0,%r0,_sref_(tempvar) # see if low half of r0 is 0 + je set_sign +setimp: + ORH2 &0x1,_sref_(pswflgs) # set imprecise flag +set_sign: + INSFW &0,&31,&0,%r0 + je flt_ret + EXTFW &0,&31,fdu(%fp),%r2 + je flt_ret + MNEGW %r0,%r0 +flt_ret: + CMPH &0xc,_sref_(op1) + jg word_ret + MOVW %r0,fdu(%fp) + RSB +word_ret: + MOVW %r0,fdu(%fp) + RSB +# +# NaN or infinity +# +flt_C: +# CMPH fdt(%fp),&n_nantag +# jne nantrap + ORH2 &0x2,_sref_(pswflgs) # V in PSW set + MOVH &1,_sref_(nostore) # indicate that no store of the + # destination is to take place + RSB # result = itself + + + + +#--------------------------------------------- +# round to integer subroutine for float to int converts +# +round_int: +# subroutine that rounds a number to an integer. Is called by +# the float to integer conversions. %r0,%r1 has mmantissa, +# fdc(%fp) has the exponent + +# see if exp <-1 or > maxexp. If so, return since no significant +# bits will be left + CMPH &-1,fdc(%fp) + jl rndintret # return if less than -1 + CMPH _sref_(maxexp),fdc(%fp) + jg rndintret # return if greater than maxexp + +# now see if exponent is in range -1<=exp<=30 or range 31<=exp<=52. +# this will tell us if LSB is in %r0 or %r1, respectively + CMPH &31,fdc(%fp) + jge largeexp # if second range, branch + +# exponent is in the range -1<=exp<=30. There are three cases here: +# LSB in bit 0, LSB is in bit 1, or LSB is in any other bit. +# handle each case separately, since location of G and Sticky +# vary for each case + MOVW &30,%r4 + SUBH2 fdc(%fp),%r4 # r4 is 30-exp = LSB bit # + CMPW &1,%r4 + jg gencase # branch if general case + je nxtcase # branch if LSB is bit 1 + +# we have lsb is bit 0 in %r0, G is bit 31 in %r1, and Sticky is bits +# 0-30 of %r1 + EXTFW &0,&31,%r1,_sref_(tempvar) # G bit + je rndintret # return if zero + EXTFW &30,&0,%r1,_sref_(tempvar) # S bits + jne shroundup # go round up if G=1,S=1 + EXTFW &0,&0,%r0,_sref_(tempvar) # LSB + jne shroundup # go round up if G=1,S=0,LSB=1 + RSB + +# we have lsb is bit 1 in r0, G is bit 0 in R0 and sticky is R1 +nxtcase: + EXTFW &0,&0,%r0,_sref_(tempvar) # G + je rndintret # return if zero + CMPW &0,%r1 # S + jne shroundup # go round if G=1,S=1 + EXTFW &0,&1,%r0,_sref_(tempvar) # LSB + jne shroundup # go round if G=1,S=0,LSB=1 +rndintret: + RSB + +# general case: LSB is in r0 bit 30-exp=r4, r4-1 is G bit # in r0 +# r4-2 is beginning of sticky in r0,r1 is all sticky +gencase: + DECW %r4 + EXTFW &0,%r4,%r0,_sref_(tempvar) # get G + je rndintret # return if 0 + DECW %r4 + EXTFW %r4,&0,%r0,_sref_(tempvar) # get first half of S + ORW2 %r1,_sref_(tempvar) # get rest of S + jne Toshroundup # round up if G=1,S=1 + ADDW2 &2,%r4 # point to LSB + EXTFW &0,%r4,%r0,_sref_(tempvar) + je rndintret # Chop if G=1,LSB=0 + jmp shroundup +Toshroundup: + ADDW2 &2,%r4 # point to LSB +# round up if G=1,S=1 or G=1,S=0,LSB=1 %r4 is LSB # in R0 +shroundup: + MOVW &1,_sref_(tempvar) # used to generate one in correct + LLSW3 %r4,_sref_(tempvar),_sref_(tempvar) # position to round up + ADDW2 _sref_(tempvar),%r0 # + ANDW3 &0x80000000,%r0,_sref_(tempvar) # see if overflowed into sign bit + je rndintret # return if not + +# we overflowed, so shift mantissa right one and increment exponent by 1 +ovround: + LRSW3 &1,%r1,%r1 # shift right lower half + EXTFW &0,&0,%r0,_sref_(tempvar) # get last bit of 1st half + je shift0 + ORW2 &0x80000000,%r1 # if 1, move into low half +shift0: + LRSW3 &1,%r0,%r0 # shift right upper half + INCH fdc(%fp) # and increment exponent + RSB + + +# 31<=exp<=52, so 31-(exp-31) is LSB # in r1 +# 31-(exp-31)-1 is G # in r1 +# 31-(exp-31)-2 is first S bit # in r1 +largeexp: + MOVW &61,%r4 + SUBH2 fdc(%fp),%r4 # r4 = 31-(exp-31)-1 + EXTFW &0,%r4,%r1,_sref_(tempvar) # get G + je rndintret # return if 0 + DECW %r4 # point to S + EXTFW %r4,&0,%r1,_sref_(tempvar) # get S + jne Tolnroundup # round up if G=1,S=1 + ADDW2 &2,%r4 # point to LSB + EXTFW &0,%r4, %r1,_sref_(tempvar) # get LSB + je rndintret # go chop if G=1,LSB=0,S=0 + jmp lnroundup +Tolnroundup: + ADDW2 &2,%r4 # point to LSB + +# round up if G=1,S=1 or G=1,S=0,LSB=1 r4 is LSB # in R1 +lnroundup: + MOVW &1,_sref_(tempvar) # used to generate 1 in correct + LLSW3 %r4,_sref_(tempvar),_sref_(tempvar) # position to round up + ADDW2 {uword}_sref_(tempvar),{uword}%r1 # round up + jgeu rndintret # if no carry, return + INCW %r0 # propagate carry into r0 + ANDW3 &0x80000000,%r0,_sref_(tempvar) # see if overflowed into sign bit + jne ovround + RSB # return if no overflow +nantrap: +# +# If trap is disabled, set result to a nontrapping NaN +# +# RSB +########################################################################### +# +# Set the result equal to op1 multiplied by op2 +# +# Case Table +# +# | 0 NUM INF NAN +# ______________________________ +# 0 | A A C G +# NUM | A B E G +# INF | C D F G +# NAN | G G G G +# +multiply: + jsb unpack + MOVW %r0,%r2 + MOVW %r1,%r3 # op2 in r2,r3 + MOVW %fp,%r7 + jsb unpack # op1 in r0,r1 + ADDW3 &12,%fp,%r7 + jsb nanchk + CMPH &1,_sref_(isnan) + je mpy_G + EXTFW &0,&31,fdu(%fp),%r4 + EXTFW &0,&31,fdu(%r7),%r5 + INSFW &0,&31,&0,fdu(%fp) + CMPB %r4,%r5 + je is_zero + INSFW &0,&31,&1,fdu(%fp) +is_zero: + CMPH fdt(%fp),&zerotag + jne minfchk + CMPH fdt(%r7),&inftag + je mpy_C + jmp mpy_A +minfchk: + CMPH fdt(%fp),&inftag + jne mnumchk + CMPH fdt(%r7),&zerotag + je mpy_C + CMPH fdt(%r7),&numtag + je mpy_D + jmp mpy_F +mnumchk: + CMPH fdt(%r7),&zerotag + je mpy_A + CMPH fdt(%r7),&numtag + je mpy_B + jmp mpy_E +# +# 0*0 or 0*NUM or NUM*0 +# +mpy_A: + MOVH &zerotag,fdt(%fp) + jsb pack + RSB +# +# NUM*NUM +# +mpy_B: + ADDH2 fdc(%r7),fdc(%fp) + CMPH _sref_(mode_precision),&single + jne mpy_double + EXTFW &9,&21,%r2,%r4 # BU + EXTFW &13,&7,%r2,%r5 # BL + EXTFW &9,&21,%r0,%r2 # AU + EXTFW &13,&7,%r0,%r3 # AL + jsb mpy + MOVH &16,_sref_(shiftcnt) + jsb shift_left # b45 -> b61 for round format +mul_fin: + EXTFW &0,&31,%r0,%r2 # check 1st bit + je mpy_stky + MOVH &1,_sref_(shiftcnt) + INCH fdc(%fp) # adjust exponent + jsb shift_right # shift right by 1 +mpy_stky: + CMPH _sref_(mode_precision),&double + je mul_trm + CMPW %r1,&0 + je mul_trm + ORW2 &0x1,%r0 # sticky from r1 included in r0 +mul_trm: + jsb trim_result + jsb pack + RSB +mpy_double: + MOVH &6,_sref_(shiftcnt) + jsb shift_right + INSFW &30,&0,%r0,fdu(%fp) + MOVW %r1,fdl(%fp) + MOVH &6,_sref_(shiftcnt) + MOVW %r2,%r0 + MOVW %r3,%r1 + jsb shift_right + MOVW %r0,fdu(%r7) + MOVW %r1,fdl(%r7) + EXTFW &13,&18,fdl(%fp),%r2 # AL1 + EXTFW &13,&4,fdl(%fp),%r3 # AL2 + EXTFW &13,&18,fdl(%r7),%r4 # BL1 + EXTFW &13,&4,fdl(%r7),%r5 # BL2 + jsb mpy # ALBL +d_AUBL: + MOVH &28,_sref_(shiftcnt) + jsb shift_right + MOVW _sref_(rstky),{uhalf}_sref_(stky) + MOVW %r0,_sref_(temp1) + MOVW %r1,_sref_(temp2) + EXTFW &10,&14,fdu(%fp),%r2 # AU1 + ANDW3 &0x3fff,fdu(%fp),%r3 # AU2 + jsb mpy # AUBL + ADDW2 {uword}%r1,_sref_(temp2) + jgeu add1 + INCW _sref_(temp1) +add1: + ADDW2 %r0,_sref_(temp1) + EXTFW &13,&18,fdl(%fp),%r2 # AL1 + EXTFW &13,&4,fdl(%fp),%r3 # AL2 + EXTFW &10,&14,fdu(%r7),%r4 # BU1 + ANDW3 &0x3fff,fdu(%r7),%r5 # BU2 + jsb mpy # ALBU + ADDW2 {uword}_sref_(temp2),%r1 + jgeu add2 + INCW %r0 +add2: + ADDW2 _sref_(temp1),%r0 +d_AUBU: + MOVH &22,_sref_(shiftcnt) + jsb shift_right + ORW2 _sref_(rstky),{uhalf}_sref_(stky) + MOVW %r0,_sref_(temp1) + MOVW %r1,_sref_(temp2) + EXTFW &10,&14,fdu(%fp),%r2 # AU1 + ANDW3 &0x3fff,fdu(%fp),%r3 # AU2 + jsb mpy # AUBU + MOVH &6,_sref_(shiftcnt) + jsb shift_left + ADDW2 {uword}_sref_(temp2),%r1 + jgeu add3 + INCW %r0 +add3: + ADDW2 _sref_(temp1),%r0 + ORH2 _sref_(stky),{uword}%r1 + MOVH &8,_sref_(shiftcnt) + jsb shift_left + jmp mul_fin +############################################################################ +# +# This procedure multiplies two 28 bit numbers +# +mpy: + CLRW %r0 + MULW3 %r2,%r4,%r1 # AUBU +mpy_AUBL: + MOVH &14,_sref_(shiftcnt) + jsb shift_left # r0,r1 = AUBU * 2**14 + MULW3 %r2,%r5,%r6 # AUBL + MULW3 %r3,%r4,%r8 # ALBU + ADDW2 %r8,%r6 + ADDW2 {uword}%r6,%r1 # r0,r1 = AUBU * 2**14 + (AUBL + ALBU) + jgeu mpy_ALBL + INCW %r0 # add in carry +mpy_ALBL: + MOVH &14,_sref_(shiftcnt) + jsb shift_left # r0,r1 = AUBU * 2**28 + (AUBL + ALBU) +# * 2**14 + MULW3 %r3,%r5,%r6 # ALBL + ADDW2 {uword}%r6,%r1 + jgeu mpy_ret + INCW %r0 # r0,r1 = AUBU * 2**28 + (AUBL + ALBU) +# * 2**14 + ALBL * 2**0 +mpy_ret: + RSB +# +# 0*INF or INF*0 +# +mpy_C: + ORH2 &0x2,_sref_(pswflgs) # V in PSW set + jsb nangen + RSB +# +# INF*NUM +# +mpy_D: + MOVH &inftag,fdt(%fp) + jsb pack + RSB +# +# NUM*INF +# +mpy_E: + MOVH &inftag,fdt(%fp) + jsb pack + RSB +# +# INF*INF +# +mpy_F: + MOVH &inftag,fdt(%fp) + jsb pack + RSB +# +# NAN*ANYTHING or ANYTHING*NAN +# +mpy_G: + jsb two_nans + RSB +########################################################################## +# +# Set the result to the quotient op1/op2 +# +# Case Table +# +# | 0 NUM INF NAN +# ______________________________ +# 0 | A B B F +# NUM | C D B F +# INF | E E A F +# NAN | F F F F +# +divide: + jsb unpack + MOVW %r0,%r2 + MOVW %r1,%r3 # op2 in r2,r3 + MOVW %fp,%r7 + jsb unpack # op1 in r0,r1 + ADDW3 &12,%fp,%r7 + jsb nanchk + CMPH &1,_sref_(isnan) + je div_F + EXTFW &0,&31,fdu(%fp),%r4 # sign of op2 + EXTFW &0,&31,fdu(%r7),%r5 # sign of op1 + INSFW &0,&31,&0,fdu(%fp) # tentative positive sign + CMPW %r4,%r5 + je dv_p1 + INSFW &0,&31,&1,fdu(%fp) # result is negative +dv_p1: + CMPH fdt(%fp),&zerotag + jne dinfchk + CMPH fdt(%r7),&zerotag + je div_A + jmp div_B +dinfchk: + CMPH fdt(%fp),&inftag + jne dnumchk + CMPH fdt(%r7),&inftag + je div_A + jmp div_E +dnumchk: + CMPH fdt(%r7),&zerotag + je div_C + CMPH fdt(%r7),&numtag + je div_D + jmp div_B +div_ret: + jsb trim_result + jsb pack + RSB +# +# 0/0 or INF/INF +# +div_A: + ORH2 &0x2,_sref_(pswflgs) # V in PSW set + jsb nangen + jmp div_ret +# +# 0/NUM or 0/INF or NUM/INF +# +div_B: + MOVH &zerotag,fdt(%fp) + jmp div_ret +# +# NUM/0 +# +div_C: + MOVH &inftag,fdt(%fp) + ORH2 &0x2,_sref_(pswflgs) # V in PSW set + jmp div_ret +# +# NUM/NUM +# +div_D: + SUBH2 fdc(%r7),fdc(%fp) + CLRH _sref_(divflg) # 1st time through + CMPH _sref_(mode_precision),&single + jne d_divide + jsb s_divide + EXTFW &0,&3,%r4,%r5 # last bit of quotient + jne srem_chk + ADDW2 %r2,%r0 # add divisor to remainder if last bit = 0 +srem_chk: + CMPW %r0,&0 + je mov_quo + ORW2 &0x1,%r4 # sticky info included if remainder != 0 +mov_quo: + MOVW %r4,%r0 + jmp div_ret +d_divide: + jsb s_divide # compute upper 28 bits of quotient + MOVH &1,_sref_(divflg) # signal second time through + MOVW %r4,%r5 + EXTFW &0,&3,%r4,%r6 # get last bit of quotient + jne uvg_p1 + ADDW2 {uword}%r3,%r1 + jgeu uvg_p2 + INCW %r0 +uvg_p2: + ADDW2 %r2,%r0 # add divisor to remainder if last bit = 0 +uvg_p1: + jsb shift_R + jsb s_divide # compute lower 28 bits of quotient + EXTFW &0,&3,%r4,%r6 # get last bit of quotient + jne drem_chk + ADDW2 {uword}%r3,%r1 + jgeu uadd3 + INCW %r0 +uadd3: + ADDW2 %r2,%r0 # add divisor to remainder if last bit = 0 +drem_chk: + ORW2 %r0,%r1 # all zips? + je fix_quo + ORW2 &0x1,%r4 # sticky info added if remainder != 0 +fix_quo: + MOVW %r5,%r0 + MOVW %r4,%r1 + EXTFW &2,&28,%r1,%r4 + LLSW3 &4,%r1,%r1 + ORW2 %r4,%r0 + jmp div_ret +########################################################################## +# +# This procedure divides a double dividend by a double divisor to get a +# 28-bit quotient. Two calls to this procedure are required for a +# double precision divide of 56 bits. +# +# %r0,%r1 = dividend/remainder +# %r2,%r3 = divisor +# %r4 = quotient +# +s_divide: + MOVW &0x10,%r4 # bit 4 (usedtobe 3) of quotient = 1 + SUBW2 {uword}%r3,%r1 + jgeu usub1 + DECW %r0 +usub1: + SUBW2 %r2,%r0 # subtract divisor + TSTW %r0 # the SUB doesn't give us good flags + jge squo1 +# +####### 1st time through ####### +# +# remainder < 0 +sq0: + CMPH _sref_(divflg),&1 + je squo0 + DECH fdc(%fp) + jsb shift_R + ADDW2 {uword}%r3,%r1 + jgeu uadd1 + INCW %r0 +uadd1: + ADDW2 %r2,%r0 # add in divisor + TSTW %r0 # the ADD doesn't give us good flags + jge squo1 +# +####### inner loop ####### +# +squo0: + ADDW2 {uword}%r4,%r4 # fix for ALSW3 glitch on overflow + BVSB sdiv_end + jsb shift_R + ADDW2 {uword}%r3,%r1 + jgeu uadd2 + INCW %r0 +uadd2: + ADDW2 %r2,%r0 # add in divisor + TSTW %r0 # the ADD doesn't give us good flags + jl squo0 +squo1: + ORW2 &0x4,%r4 # insert 1 in quotient (lead zero here) + ADDW2 {uword}%r4,%r4 # needed due to ALSW3 glitch on overflow + BVSB sdiv_end + jsb shift_R + SUBW2 {uword}%r3,%r1 + jgeu usub2 + DECW %r0 +usub2: + SUBW2 %r2,%r0 # subtract divisor + TSTW %r0 # the SUB doesn't give us good flags + jge squo1 + jmp squo0 +sdiv_end: + RSB +# +# INF/NUM or INF/0 +# +div_E: + MOVH &inftag,fdt(%fp) + jmp div_ret +# +# NAN/ANYTHING or ANYTHING/NAN +# +div_F: + jsb two_nans + RSB +####################################################################### +# +# Compare op1 and op2 and return the condition EQUAL, LESS THAN, GREATER +# THAN, or UNORDERED. +# +# Case Table +# +# | 0 NUM INF NAN +# ----------------------------- +# 0 | A B E H +# NUM | C D E H +# INF | F F G H +# NAN | H H H H +# +compare: + jsb unpack + MOVW %r0,%r2 + MOVW %r1,%r3 # op2 in r2,r3 + MOVW %fp,%r7 + jsb unpack # op1 in r0,r1 + ADDW3 &12,%fp,%r7 + jsb nanchk + CMPH &1,_sref_(isnan) + je comp_H + EXTFW &0,&31,fdu(%fp),%r4 + CMPH fdt(%fp),&zerotag + jne numchk +# +# Cases where op1 = 0 +# + CMPH fdt(%r7),&zerotag + je comp_A + CMPH fdt(%r7),&numtag + je comp_B + jmp comp_E +numchk: + CMPH fdt(%fp),&numtag + jne infchk +# +# Cases where op1 is a finite, non-zero number +# + CMPH fdt(%r7),&zerotag + je comp_C + CMPH fdt(%r7),&numtag + je comp_D + jmp comp_E +infchk: + CMPH fdt(%r7),&inftag + je comp_G + jmp comp_F +# +# 0 vs 0 +# +comp_A: + ORH2 &0x4,_sref_(pswflgs) # cond = EQUAL, Z in PSW is set + jmp raise_flag +# +# 0 vs finite +# +comp_B: + EXTFW &0,&31,fdu(%r7),%r5 + je b_greater + ORH2 &0x9,_sref_(pswflgs) # cond = LESS, N & C in PSW are set +b_greater: + jmp raise_flag +# +# Finite vs 0 +# +comp_C: + CMPW &0,%r4 + je c_less + jmp raise_flag +c_less: + ORH2 &0x9,_sref_(pswflgs) # cond = LESS, N & C in PSW are set + jmp raise_flag +# +# Typical case of two finite, non-zero numbers +# +comp_D: + EXTFW &0,&31,fdu(%r7),%r5 + CMPW %r4,%r5 + jne ncomp + CMPW %r4,&0 + je ncomp + CMPW {uword}fdu(%r7),fdu(%fp) + jlu c_less + jgu raise_flag + jmp wdcomp +ncomp: + CMPW fdu(%r7),fdu(%fp) + jg c_less + jl raise_flag +wdcomp: + CMPW {uword}fdl(%r7),fdl(%fp) + jgu comp_C + jlu comp_B + ORH2 &0x4,_sref_(pswflgs) # cond = EQUAL, Z in PSW set + jmp raise_flag +# +# Finite vs infinite +# +comp_E: + CMPH _sref_(mode_denorm),&affine + je comp_B +# ORH2 &0x2,_sref_(pswflgs) # cond = UNORDERED, V in PSW set +# jmp raise_flag +# +# Infinity vs finite +# +comp_F: + CMPH _sref_(mode_denorm),&affine + je comp_C +# ORH2 &0x2,_sref_(pswflgs) # cond = UNORDERED, V in PSW set +# jmp raise_flag +# +# Infinity vs infinity +# +comp_G: + CMPH _sref_(mode_denorm),&affine + jne g_unorder + EXTFW &0,&31,fdu(%r7),%r5 + CMPH %r5,%r4 + jne comp_C + ORH2 &0x4,_sref_(pswflgs) # cond = EQUAL, Z in PSW set + jmp raise_flag +g_unorder: + ORH2 &0x2,_sref_(pswflgs) # cond = UNORDERED, V in PSW set + jmp raise_flag +# +# NaNs +# +comp_H: + jsb two_nans + ORH2 &0x2,_sref_(pswflgs) # cond = UNORDERED, V in PSW set +# +# Currently the only thing raise_flag does is return. This is only a stub +# for a later version that sets err_invalid to TRUE if necessary. Until +# the stub is added, all jmps to raise_flag can be replaced with RSBs. +# +raise_flag: + RSB +######################################################################## +# +# Set the result to the difference between op1 and op2 +# +subtract: + MOVH &1,_sref_(subflg) + EXTFW &0,&31,fdu(%r7),%r6 + MCOMB %r6,%r6 + INSFW &0,&31,%r6,fdu(%r7) + jsb add + RSB +######################################################################## +# +# Set the result to the sum of op1 and op2 +# +# Case Table +# +# | 0 NUM INF NAN +# ------------------------------ +# 0 | A B B F +# NUM | C D B F +# INF | C C E F +# NAN | F F F F +# +add: + jsb unpack + MOVW %r0,%r2 + MOVW %r1,%r3 # op2 in r2,r3 + MOVW %fp,%r7 + jsb unpack # op1 in r0,r1 + ADDW3 &12,%fp,%r7 + jsb nanchk + CMPH &1,_sref_(isnan) + je add_F + CMPH fdt(%fp),&zerotag + jne addnumchk + CMPH fdt(%r7),&zerotag + je add_A + jmp add_B +addnumchk: + CMPH fdt(%fp),&numtag + jne addinfchk + CMPH fdt(%r7),&zerotag + je add_C + CMPH fdt(%r7),&numtag + je add_D + jmp add_B +addinfchk: + CMPH fdt(%r7),&inftag + je add_E + jmp add_C +# +# 0 vs 0 +# +add_A: # result = op1 + ORH2 &0x4,_sref_(pswflgs) # Z in PSW set + EXTFW &0,&31,fdu(%fp),%r4 + EXTFW &0,&31,fdu(%r7),%r5 + CMPW %r4,%r5 + je add_ret +# CMPH _sref_(mode_round),&toward_minus +# jne a_sign +# INSFW &0,&31,&1,fdu(%fp) +# RSB +a_sign: + INSFW &0,&31,&0,fdu(%fp) +add_ret: + RSB +# +# Op1 is 0 or op2 is infinity +# +add_B: # result = op2 + MOVW fdt(%r7),fdt(%fp) # fdt & fdc(%fp) moved + MOVW fdu(%r7),fdu(%fp) + MOVW fdl(%r7),fdl(%fp) + jmp add_C +# +# Op2 is 0 or op1 is infinity +# +add_C: # result = op1 + EXTFW &0,&31,fdu(%fp),%r4 # get the sign bit + je add_ret + ORH2 &0x8,_sref_(pswflgs) + RSB +# +# Typical case of two finite, non-zero numbers +# +add_D: + CLRB %r8 # 1st operand is op1 + MOVH fdc(%fp),_sref_(temp1); # save first op exp + MOVH fdc(%r7),fdc(%fp) # exp from 2nd op + SUBH3 _sref_(temp1),fdc(%r7),_sref_(shiftcnt) # shiftcnt = %r7 - %fp + jge chk_shift + jsb swap + MNEGH _sref_(shiftcnt),_sref_(shiftcnt) + MOVH _sref_(temp1),fdc(%fp) # load exponent of result +chk_shift: + CMPH _sref_(maxshft),_sref_(shiftcnt) + jl align + ORW3 &1,%r3,%r1 # first (r0,r1) is effectively zero + # just set sticky and we're done + MOVW %r2,%r0 + MCOMB %r8,%r8 # effectively a swap + CMPH _sref_(mode_precision),&single + jne sign_compute + ORW2 &1,%r0 # sticky set to 1 for single + jmp sign_compute +align: + jsb shift_right # align op1 + ORW2 _sref_(rstky),%r1 + EXTFW &0,&31,fdu(%fp),%r4 + EXTFW &0,&31,fdu(%r7),%r5 + CMPH %r4,%r5 # compare operand signs + jne magn_subtr +add_magn: + ADDW2 {uword}%r3,%r1 # op1.l = op1.l + op2.l + jgeu add_upper + INCW %r0 # add in carry +add_upper: + ADDW2 %r2,%r0 # op1.u = op1.u + op2.u + TSTW %r0 # see if high bit is one + jge sign_compute + MOVH &1,_sref_(shiftcnt) + jsb shift_right + ORW2 _sref_(rstky),%r1 + INCH fdc(%fp) +sign_compute: + CMPB &0,%r8 + je a_return + MOVW fdu(%r7),fdu(%fp) # result sign +a_return: + CMPH _sref_(mode_precision),&single + jne stky_ok + CMPW %r1,&0 + je stky_ok + ORW2 &0x1,%r0 +stky_ok: + jsb trim_result + jsb pack + RSB +magn_subtr: + CMPW %r0,%r2 + jl sub_magn + jg op_swap + CMPW %r1,%r3 + jleu sub_magn +op_swap: + jsb swap +sub_magn: + CMPB &0,%r8 # trickyness here. this + je sub_op1big # calculates the sign of the + MOVW fdu(%r7),fdu(%fp) # result. r8 = 0 if r0,r1 + # corresponds to op1. + # and r8 != 0 if r2,r3 + # corresponds to op1. We know + # that |(r0,r1)| > |(r1,r2)| so + # the result has the same sign + # as the op corressponding + # to (r0,r1). + # Neat huh? Also we don't + # care about any bits in + # fdu(%fp) other than the + # high bit which is result sign +sub_op1big: + SUBW2 {uword}%r3,%r1 # op1.l = op1.l - op2.l + jgeu sub_upper + DECW %r0 # subtract the borrow +sub_upper: + SUBW2 %r2,%r0 # op1.u = op1.u - op2.u + ORW3 %r0,%r1,%r2 # %r2 = 0 if result is 0 + jne add_norm + MOVH &zerotag,fdt(%fp) +# CMPH _sref_(mode_round),&toward_minus +# je a2_minus + INSFW &0,&31,&0,fdu(%fp) +# jmp add_norm +a2_minus: +# INSFW &0,&31,&1,fdu(%fp) +add_norm: + MOVW %fp,%r7 + jsb norm + jmp a_return +# +# Op1 and op2 are infinity +# +add_E: # result = op1 + EXTFW &0,&31,fdu(%fp),%r0 + EXTFW &0,&31,fdu(%r7),%r1 + CMPW %r0,%r1 + jne e_error +# CMPH _sref_(mode_inf),&affine +# jne e_error + RSB +e_error: + ORH2 &0x2,_sref_(pswflgs) # V in PSW set + jsb nangen + RSB +# +# NaNs +# +add_F: + jsb two_nans + RSB +######################################################################### +# +# The operands are swapped for accuracy in addition and subtraction. The +# borrow problem, for example, is avoided. The opposite operand is now op1. +# +swap: + MOVW %r0,%r6 + MOVW %r2,%r0 + MOVW %r6,%r2 + MOVW %r1,%r6 + MOVW %r3,%r1 + MOVW %r6,%r3 + MCOMB %r8,%r8 + RSB +########################################################################### +# +# This routine determines which operand to use as the nan result and +# fixes up the sign in the case of a subtraction. +# +two_nans: + CMPH fdt(%fp),&n_nantag + je nan_ret # op1 is the nan + MOVW fdu(%r7),fdu(%fp) # op2 is nan, get top half + MOVW fdl(%r7),fdl(%fp) # get bottom half + CMPH _sref_(subflg),&0 + je nan_ret # if not subtract all done + EXTFW &0,&31,fdu(%fp),%r4 # get the sign bit + MCOMB %r4,%r4 # op2 = nan, sign fixed for subtraction + INSFW &0,&31,%r4,fdu(%fp) +nan_ret: + MOVH &n_nantag,fdt(%fp) + RSB +############################################################################ +# +# This procedure generates a NAN by inserting the program counter, pc, +# in the fractional portion of the number and setting the exponent to +# all ones. +# +nangen: + CLRW fdu(%fp) + CLRW fdl(%fp) + MOVH &n_nantag,fdt(%fp) + INSFH _sref_(expw),_sref_(exp),_sref_(bias2),{uword}fdu(%fp) + CMPH &double,_sref_(mode_precision) + BEB dbl_nan + INSFW {uhalf}_sref_(mant),&0,{uword}_sref_(pc),fdu(%fp) + RSB +dbl_nan: + INSFW &3,&28,{uword}_sref_(pc),fdl(%fp) + EXTFW &18,&4,{uword}_sref_(pc),%r8 + INSFW &18,&0,%r8,fdu(%fp) +######################################################################## +# +# This trim sequence applies to all operations that produce floating +# point results. +# +trim_result: + jsb under_result + jsb round_result +# jsb invalid_result + jsb over_result + RSB +######################################################################### +# +# Check for an underflow first so that any denormalisation will occur +# before rounding. +# +under_result: + CMPH fdt(%fp),&numtag + je number + RSB # bypass special results +number: + CMPH _sref_(uthresh),fdc(%fp) + jl underflow + RSB +underflow: + MOVH fdc(%fp),_sref_(exponent) + SUBH3 _sref_(exponent),_sref_(uthresh),_sref_(shiftcnt) + CMPH _sref_(maxshft),_sref_(shiftcnt) + jg flag_uflow + jsb shift_right + MOVH _sref_(exponent),fdc(%fp) + ORW2 _sref_(rstky),%r1 + CMPH _sref_(mode_precision),&single + jne uflow_ret + ORW2 _sref_(rstky),%r0 +uflow_ret: + RSB +flag_uflow: + ORH2 &0x2,_sref_(pswflgs) # set V in PSW + MOVH &zerotag,fdt(%fp) + RSB +######################################################################### +# +# Round the result. +# +round_result: + CMPH fdt(%fp),&numtag + je round + RSB # bypass special results +round: + CMPH _sref_(mode_precision),&single + jne d_round + EXTFW &0,&7,%r0,%r6 # %r6 = least significant digit + ANDW3 &0x3f,%r0,%r3 # %r3 = bits beyond guard + je sguard_sticky # round/sticky = 0 + ORW2 &0x20,%r0 # round/sticky = 1 (b5) +sguard_sticky: + EXTFW &1,&5,%r0,%r3 # %r3 = guard & round/sticky + jmp rndchk +d_round: + EXTFW &0,&10,%r1,%r6 # %r6 = least significant digit + ANDW3 &0x1ff,%r1,%r3 # %r3 = bits beyond guard + je dguard_sticky # round/sticky = 0 + ORW2 &0x100,%r1 # round/sticky = 1 +dguard_sticky: + EXTFW &1,&8,%r1,%r3 # guard & round/sticky +rndchk: + CMPH %r3,&0 + jne round_err + RSB +round_err: + ORH2 &0x1,_sref_(pswflgs) # inexact result, C in PSW set +# CMPH _sref_(mode_round),&toward_minus +# je to_minus +# CMPH _sref_(mode_round),&toward_plus +# je to_plus +# CMPH _sref_(mode_round),&to_nearest +# jne chop_result # round toward 0 + CMPH %r3,&3 + je inc_result + CMPH %r3,&1 + je chop_result + CMPH %r6,&1 # check least significant digit + je inc_result + jmp chop_result +to_minus: +# EXTFW &0,&31,fdu(%fp),%r2 +# CMPH %r2,&1 +# je inc_result +# jmp chop_result +to_plus: +# EXTFW &0,&31,fdu(%fp),%r2 +# CMPH %r2,&0 +# je inc_result +# jmp chop_result +inc_result: + MOVW &0x80,%r6 + CMPH _sref_(mode_precision),&single + jne inc_dbl + ADDW2 %r6,%r0 + BVSB carry_found + RSB +inc_dbl: + MOVW &0x400,%r6 + ADDW2 {uword}%r6,%r1 + jgeu clean_up + INCW %r0 + BVCB clean_up +carry_found: + MOVH &1,_sref_(shiftcnt) + INCH fdc(%fp) + jsb shift_right +clean_up: + RSB +chop_result: + ANDW2 &0xfffffc00,%r1 + CMPH _sref_(mode_precision),&single + jne clean_up + ANDW2 &0xffffff80,%r0 + RSB +######################################################################## +# +# Check for overflow. +# +over_result: + CMPH fdt(%fp),&numtag + jne ovf_return + CMPH _sref_(othresh),fdc(%fp) + jle ovf_return +# CMPH trap_oflow,&0 +# jne ovf_return +# MOVH &1,_sref_(err_inexact) +# CMPH _sref_(mode_round),&to_nearest +# je ovfl +# CMPH _sref_(mode_round),&toward_0 +# jne ovf_return +ovfl: + ORH2 &0x2,_sref_(pswflgs) # V in PSW set + MOVH &inftag,fdt(%fp) # exponent = all ones +ovf_return: + RSB +########################################################################## +# +# This procedure is not needed for this release since only normalised +# numbers are permitted. +# +invalid_result: +# CMPH fdt(%fp),&numtag +# jne valid_result +# EXTFW &0,&30,%r0,%r2 # r2 = msd +# CMPH %r2,&0 +# jne valid_result +# CMPH _sref_(unnorm_ok),&1 +# je valid_result +# CMPH _sref_(denorm_ok),&1 +# jne set_invalid +# CMPH _sref_(uthresh),fdc(%fp) +# je valid_result +set_invalid: +# MOVH &1,_sref_(err_invalid) +valid_result: +# RSB +######################################################################### +# +# This procedure shifts double precision remainders left by 1. +# +shift_R: + LLSW3 &1,%r0,%r0 + EXTFW &0,&31,%r1,%r6 + ORW2 %r6,%r0 + LLSW3 &1,%r1,%r1 # shift remainder + RSB +######################################################################### +# +# This procedure performs a left shift of single or double precision +# numbers. shiftcnt specifies the number of places to be shifted. +# The number to be shifted is contained in %r0 and %r1. +# +shift_left: + CMPH _sref_(shiftcnt),&0 + je lshift_end + EXTFW &0,&31,%r1,%r6 # r6 = carry out + LLSW3 &1,%r1,%r1 + LLSW3 &1,%r0,%r0 + ORW2 %r6,%r0 + DECH _sref_(shiftcnt) + DECH _sref_(exponent) # decrease exponent by 1 + jmp shift_left +lshift_end: + RSB +########################################################################## +# +# This procedure performs a right shift shiftcnt number of places on +# single or double precision numbers. %r0 and %r1 contain the number +# to be shifted. +# +shift_right: + CLRW _sref_(rstky) +r_loop: + CMPH _sref_(shiftcnt),&0 + je rshift_end + ANDW3 &0x1,%r1,%r6 + ORW2 %r6,_sref_(rstky) + LRSW3 &1,%r1,%r1 + EXTFW &0,&0,%r0,%r6 # carry out + LRSW3 &1,%r0,%r0 + INSFW &0,&31,%r6,%r1 + DECH _sref_(shiftcnt) + INCH _sref_(exponent) # increment exponent by 1 + jmp r_loop +rshift_end: + RSB +########################################################################### +# +# Floating point numbers are packed into the proper format here. +# +pack: + EXTFW &0,&31,fdu(%fp),%r4 # sign of the result + je tagchk + ORH2 &0x8,_sref_(pswflgs) # N in PSW set (negative result) +tagchk: + CMPH fdt(%fp),&zerotag + je p_zero + CMPH fdt(%fp),&inftag + je p_inf + CMPH fdt(%fp),&numtag + je p_num +p_nan: + RSB +p_inf: + INSFW &30,&0,&0,fdu(%fp) + INSFH _sref_(expw),_sref_(exp),_sref_(bias2),{uword}fdu(%fp) + CLRW fdl(%fp) + RSB +p_zero: + ORH2 &0x4,_sref_(pswflgs) + CLRW fdl(%fp) + INSFW &30,&0,&0,fdu(%fp) + RSB +p_num: + ADDH2 _sref_(bias),fdc(%fp) + EXTFW &0,&30,%r0,%r2 # get msd + jne p_norm +# +# denormalised numbers have a bias of 1022 (double),%r2 or 126 (single) +# +p_denorm: # msd = 0 + DECH fdc(%fp) +p_norm: + INSFH _sref_(expw),_sref_(exp),fdc(%fp),{uword}fdu(%fp) + EXTFW &29,&0,%r0,%r0 # fraction only in r0 + MOVH _sref_(expw),_sref_(shiftcnt) + jsb shift_right + INSFH _sref_(mant),&0,{uword}%r0,fdu(%fp) + CMPH _sref_(mode_precision),&double + jne pack_ret + MOVW %r1,fdl(%fp) +pack_ret: + RSB +fpabort: + RSB + +# +# The following is the table of floating point op-codes; zero means +# not floating point and non-zero means floating point. +# + .section RODATA + .align 4 + .globl _fpopcode +_dgdef2_(_fpopcode,256): + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 # 00-0F + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 # 10-1F + .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 # 20-2F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # 30-3F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # 40-4F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # 50-5F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # 60-6F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # 70-7F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # 80-8F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # 90-9F + .byte 0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0 # A0-AF + .byte 0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0 # B0-BF + .byte 0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0 # C0-CF + .byte 0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0 # D0-DF + .byte 0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0 # E0-EF + .byte 0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0 # F0-FF + diff --git a/usr/src/lib/libc/m32/gen/frexp.s b/usr/src/lib/libc/m32/gen/frexp.s index bb01dab..bbfecfc 100644 --- a/usr/src/lib/libc/m32/gen/frexp.s +++ b/usr/src/lib/libc/m32/gen/frexp.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "frexp.s" .ident "@(#)libc-m32:gen/frexp.s 1.7" #------------------------------------------------------------------------------ diff --git a/usr/src/lib/libc/m32/gen/getctxt.c b/usr/src/lib/libc/m32/gen/getctxt.c index 4da5e81..e52fcfd 100644 --- a/usr/src/lib/libc/m32/gen/getctxt.c +++ b/usr/src/lib/libc/m32/gen/getctxt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:gen/getctxt.c 1.3" +#ident "@(#)libc-m32:gen/getctxt.c 1.2" #ifdef __STDC__ #pragma weak getcontext = _getcontext @@ -30,15 +30,16 @@ getcontext(ucp) ucontext_t *ucp; { register greg_t *reg; + int error; ucp->uc_flags = UC_ALL; - if (__getcontext(ucp)) - return -1; + if (error = __getcontext(ucp)) + return error; reg = ucp->uc_mcontext.gregs; - reg[R_FP] = *((greg_t *)getfp()-7); - reg[R_AP] = *((greg_t *)getfp()-8); - reg[R_PC] = *((greg_t *)getfp()-9); + reg[R_FP] = getfp()-(7*sizeof(greg_t)); + reg[R_AP] = getfp()-(8*sizeof(greg_t)); + reg[R_PC] = getfp()-(9*sizeof(greg_t)); reg[R_SP] = getap(); return 0; diff --git a/usr/src/lib/libc/m32/gen/ladd.s b/usr/src/lib/libc/m32/gen/ladd.s index 9b2dc8c..ea32d13 100644 --- a/usr/src/lib/libc/m32/gen/ladd.s +++ b/usr/src/lib/libc/m32/gen/ladd.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # Double long add routine. Ported from pdp 11/70 version # with considerable effort. All supplied comments were ported. diff --git a/usr/src/lib/libc/m32/gen/ldexp.s b/usr/src/lib/libc/m32/gen/ldexp.s index 944835a..4749cdc 100644 --- a/usr/src/lib/libc/m32/gen/ldexp.s +++ b/usr/src/lib/libc/m32/gen/ldexp.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:gen/ldexp.s 1.9.1.6" .file "ldexp.s" # double ldexp (value, exp) diff --git a/usr/src/lib/libc/m32/gen/lshiftl.s b/usr/src/lib/libc/m32/gen/lshiftl.s index 623f368..acdc900 100644 --- a/usr/src/lib/libc/m32/gen/lshiftl.s +++ b/usr/src/lib/libc/m32/gen/lshiftl.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # Shift a double long value .ident "@(#)libc-m32:gen/lshiftl.s 1.1" diff --git a/usr/src/lib/libc/m32/gen/lsign.s b/usr/src/lib/libc/m32/gen/lsign.s index d2b675c..48d3b44 100644 --- a/usr/src/lib/libc/m32/gen/lsign.s +++ b/usr/src/lib/libc/m32/gen/lsign.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # Determine the sign of a double-long number. .ident "@(#)libc-m32:gen/lsign.s 1.1" diff --git a/usr/src/lib/libc/m32/gen/lsub.s b/usr/src/lib/libc/m32/gen/lsub.s index d153ede..c712402 100644 --- a/usr/src/lib/libc/m32/gen/lsub.s +++ b/usr/src/lib/libc/m32/gen/lsub.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # Double long subtraction routine. Ported from pdp 11/70 version # with considerable effort. All supplied comments were ported. diff --git a/usr/src/lib/libc/m32/gen/m32_data.s b/usr/src/lib/libc/m32/gen/m32_data.s index ea6ba0d..b5b62ea 100644 --- a/usr/src/lib/libc/m32/gen/m32_data.s +++ b/usr/src/lib/libc/m32/gen/m32_data.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:gen/m32_data.s 1.10" .file "m32_data.s" # This file contains diff --git a/usr/src/lib/libc/m32/gen/makectxt.c b/usr/src/lib/libc/m32/gen/makectxt.c index e641f28..a2374fd 100644 --- a/usr/src/lib/libc/m32/gen/makectxt.c +++ b/usr/src/lib/libc/m32/gen/makectxt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:gen/makectxt.c 1.4" +#ident "@(#)libc-m32:gen/makectxt.c 1.3" #ifdef __STDC__ #pragma weak makecontext = _makecontext @@ -25,26 +25,27 @@ int argc; va_dcl #endif { - register greg_t *reg; int *sp; va_list ap; +#ifdef __STDC__ + va_start(ap,); +#else + va_start(ap); +#endif reg = ucp->uc_mcontext.gregs; reg[R_PC] = (greg_t)func; - sp = (int *)ucp->uc_stack.ss_sp; + sp = ucp->uc_stack.ss_sp; *sp++ = (int)ucp->uc_link; reg[R_AP] = (greg_t)sp; -#ifdef __STDC__ - va_start(ap, ...); -#else - va_start(ap, va_alist); -#endif - while (argc--) + ap = ((char *)&argc); + while (argc--) { *sp++ = va_arg(ap, int); + } *sp++ = (int)setcontext; /* return pc */ *sp++ = (int)(ucp->uc_stack.ss_sp); /* return ap */ diff --git a/usr/src/lib/libc/m32/gen/memcpy.s b/usr/src/lib/libc/m32/gen/memcpy.s index 977fdd6..43c14f4 100644 --- a/usr/src/lib/libc/m32/gen/memcpy.s +++ b/usr/src/lib/libc/m32/gen/memcpy.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "memcpy.s" .ident "@(#)libc-m32:gen/memcpy.s 1.7" # diff --git a/usr/src/lib/libc/m32/gen/setjmp.s b/usr/src/lib/libc/m32/gen/setjmp.s index d4e1d9b..4fe34f4 100644 --- a/usr/src/lib/libc/m32/gen/setjmp.s +++ b/usr/src/lib/libc/m32/gen/setjmp.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- setjmp, longjmp .ident "@(#)libc-m32:gen/setjmp.s 1.4" diff --git a/usr/src/lib/libc/m32/gen/sh_data.c b/usr/src/lib/libc/m32/gen/sh_data.c index c01f758..39e7d38 100644 --- a/usr/src/lib/libc/m32/gen/sh_data.c +++ b/usr/src/lib/libc/m32/gen/sh_data.c @@ -5,15 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:gen/sh_data.c 1.3" +#ident "@(#)libc-m32:gen/sh_data.c 1.1" +/* this file includes definitions of data so that the + * dynamic shared library will build. The actual + * definitions are contained in other source files. + */ #ifdef DSHLIB int _environ; -#else -#ifdef __STDC__ - #pragma weak environ = _environ -int _environ = 0; -#else -int environ = 0; -#endif #endif diff --git a/usr/src/lib/libc/m32/gen/sigsetjmp.c b/usr/src/lib/libc/m32/gen/sigsetjmp.c index ce6d4e7..108b17d 100644 --- a/usr/src/lib/libc/m32/gen/sigsetjmp.c +++ b/usr/src/lib/libc/m32/gen/sigsetjmp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:gen/sigsetjmp.c 1.3" +#ident "@(#)libc-m32:gen/sigsetjmp.c 1.2" #ifdef __STDC__ #pragma weak sigsetjmp = _sigsetjmp @@ -45,9 +45,9 @@ int savemask; ucp->uc_flags &= ~UC_SIGMASK; reg = ucp->uc_mcontext.gregs; - reg[R_FP] = *((greg_t *)getfp()-7); /* get old fp off stack */ - reg[R_AP] = *((greg_t *)getfp()-8); /* get old ap off stack */ - reg[R_PC] = *((greg_t *)getfp()-9); /* get old pc off stack */ + reg[R_FP] = getfp()-(7*sizeof(greg_t)); /* get old fp off stack */ + reg[R_AP] = getfp()-(8*sizeof(greg_t)); /* get old ap off stack */ + reg[R_PC] = getfp()-(9*sizeof(greg_t)); /* get old pc off stack */ reg[R_SP] = getap(); /* reset sp */ return 0; diff --git a/usr/src/lib/libc/m32/gen/strcmp.s b/usr/src/lib/libc/m32/gen/strcmp.s index 0a29473..adebd86 100644 --- a/usr/src/lib/libc/m32/gen/strcmp.s +++ b/usr/src/lib/libc/m32/gen/strcmp.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "strcmp.s" .ident "@(#)libc-m32:gen/strcmp.s 1.5" # Fast assembler language version of the following C-program for diff --git a/usr/src/lib/libc/m32/gen/strcpy.s b/usr/src/lib/libc/m32/gen/strcpy.s index c7785f7..0d173f0 100644 --- a/usr/src/lib/libc/m32/gen/strcpy.s +++ b/usr/src/lib/libc/m32/gen/strcpy.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "strcpy.s" .ident "@(#)libc-m32:gen/strcpy.s 1.5" # Fast assembler language version of the following C-program diff --git a/usr/src/lib/libc/m32/gen/strlen.s b/usr/src/lib/libc/m32/gen/strlen.s index b8fb6b8..2f113f0 100644 --- a/usr/src/lib/libc/m32/gen/strlen.s +++ b/usr/src/lib/libc/m32/gen/strlen.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "strlen.s" .ident "@(#)libc-m32:gen/strlen.s 1.4" # Fast assembler language version of the following C-program diff --git a/usr/src/lib/libc/m32/gen/swapctxt.c b/usr/src/lib/libc/m32/gen/swapctxt.c index 4ad8d33..362fad7 100644 --- a/usr/src/lib/libc/m32/gen/swapctxt.c +++ b/usr/src/lib/libc/m32/gen/swapctxt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:gen/swapctxt.c 1.3" +#ident "@(#)libc-m32:gen/swapctxt.c 1.2" #ifdef __STDC__ #pragma weak swapcontext = _swapcontext @@ -31,14 +31,15 @@ swapcontext(oucp, nucp) ucontext_t *oucp, *nucp; { register greg_t *reg; + int rval; - if (__getcontext(oucp)) - return -1; + if (rval = __getcontext(oucp)) + return rval; reg = oucp->uc_mcontext.gregs; - reg[R_FP] = *((greg_t *)getfp()-7); /* get old fp off stack */ - reg[R_AP] = *((greg_t *)getfp()-8); /* get old ap off stack */ - reg[R_PC] = *((greg_t *)getfp()-9); /* get old pc off stack */ + reg[R_FP] = getfp()-(sizeof(greg_t)*7); /* get old fp off stack */ + reg[R_AP] = getfp()-(sizeof(greg_t)*8); /* get old ap off stack */ + reg[R_PC] = getfp()-(sizeof(greg_t)*9); /* get old pc off stack */ reg[R_SP] = getap(); /* reset sp */ return setcontext(nucp); diff --git a/usr/src/lib/libc/m32/m4.def b/usr/src/lib/libc/m32/m4.def index cf6956a..a09ab75 100644 --- a/usr/src/lib/libc/m32/m4.def +++ b/usr/src/lib/libc/m32/m4.def @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:m4.def 1.4" define(`_m4_define_', defn(`define'))dnl diff --git a/usr/src/lib/libc/m32/makefile b/usr/src/lib/libc/m32/makefile index 058f58c..feba31c 100644 --- a/usr/src/lib/libc/m32/makefile +++ b/usr/src/lib/libc/m32/makefile @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libc-m32:makefile 1.46.1.41" +#ident "@(#)libc-m32:makefile 1.46.1.31" # # makefile for libc/m32 # @@ -35,44 +35,43 @@ M4DEFS=m4.def $(VERSDEF) OBJECTS=\ crt/cerror.o crt/mcount.o \ -csu/crt0.o csu/mcrt0.o \ -csu/crti.o csu/crt1.o csu/mcrt1.o \ +csu/crt0.o csu/mcrt0.o \ +csu/fcrt0.o csu/fmcrt0.o csu/crti.o \ +csu/crt1.o csu/fcrt1.o csu/fmcrt1.o csu/mcrt1.o \ csu/crtn.o csu/pcrt1.o csu/pcrti.o csu/pcrtn.o \ fp/decconv.o fp/scalb.o \ gen/abs.o gen/atof.o \ gen/biglitpow.o gen/dtop.o gen/ecvt.o \ +gen/fptrap.o \ gen/frexp.o \ gen/getctxt.o gen/ladd.o gen/lconstants.o gen/ldexp.o \ gen/ldivide.o gen/lexp10.o gen/llog10.o gen/lmul.o \ gen/lshiftl.o gen/lsign.o gen/lsub.o gen/ltostr.o \ gen/makectxt.o gen/memcpy.o gen/ptod.o gen/setjmp.o \ -gen/siginfolst.o \ gen/sigsetjmp.o gen/strcpy.o gen/strcmp.o gen/strtod.o \ gen/strlen.o gen/swapctxt.o print/doprnt.o print/fprintf.o \ gen/cuexit.o gen/m32_data.o gen/sh_data.o \ print/printf.o print/sprintf.o \ print/vfprintf.o print/vprintf.o print/vsprintf.o print/setpospar.o \ sys/_rename.o sys/_sigaction.o sys/_signal.o \ -sys/access.o sys/acct.o sys/adjtime.o \ -sys/alarm.o \ +sys/acancel.o sys/access.o sys/acct.o sys/adjtime.o \ +sys/alarm.o sys/brkbase.o \ sys/chdir.o sys/chmod.o sys/chown.o \ sys/chroot.o sys/close.o sys/creat.o sys/dup.o \ -sys/execl.o sys/execle.o sys/execv.o \ +sys/evsys.o sys/execl.o sys/execle.o sys/execv.o \ sys/execve.o sys/exit.o sys/fchdir.o sys/fchmod.o \ -sys/fchown.o sys/fcntl.o sys/fork.o \ -sys/fpathconf.o \ -sys/fstat.o sys/fstatvfs.o sys/fsync.o \ +sys/fchown.o sys/fcntl.o sys/fmount.o sys/fork.o \ +sys/fstat.o sys/fstatvfs.o sys/fsync.o sys/funmount.o \ sys/fxstat.o sys/getegid.o sys/geteuid.o sys/getgid.o \ -sys/getgroups.o sys/getmsg.o sys/getpid.o \ +sys/getgroups.o sys/getmsg.o sys/getpagesize.o sys/getpid.o \ sys/getpmsg.o sys/getppid.o sys/getrlimit.o sys/getuid.o \ sys/gtty.o sys/ioctl.o sys/kill.o sys/lchown.o \ sys/link.o sys/lseek.o \ -sys/lstat.o sys/lxstat.o sys/memcntl.o \ +sys/lstat.o sys/lxstat.o sys/mctl.o sys/memcntl.o \ sys/mincore.o sys/mknod.o \ sys/mmap.o sys/mount.o sys/mprotect.o sys/msgsys.o \ sys/munmap.o sys/_nfssys.o sys/nice.o sys/nuname.o \ -sys/open.o sys/pathconf.o \ -sys/pause.o sys/pipe.o sys/poll.o \ +sys/open.o sys/pause.o sys/pipe.o sys/poll.o \ sys/priocntlset.o sys/profil.o sys/plock.o sys/ptrace.o \ sys/putmsg.o sys/putpmsg.o sys/read.o sys/readlink.o \ sys/readv.o sys/rfsys.o \ @@ -117,9 +116,8 @@ fp/fdtos.P fp/fltod.P fp/fltos.P fp/fmuld.P \ fp/fmuls.P fp/fnegd.P fp/fnegs.P fp/fpstart.P \ fp/fpstart1.P fp/fstod.P fp/ftdtol.P fp/ftdtou.P \ fp/ftstol.P fp/ftstou.P fp/getflth1.P fp/getflts1.P \ -fp/isnand.P fp/logb.P fp/scalb.P \ -fp/sround.P fp/sspecial.P gen/atof.P \ -gen/biglitpow.P gen/cuexit.P gen/dtop.P gen/ecvt.P \ +fp/isnand.P fp/sround.P fp/sspecial.P gen/atof.P \ +gen/biglitpow.P gen/cuexit.P gen/dtop.P \ gen/frexp.P gen/getctxt.P gen/ldexp.P \ gen/ltostr.P gen/m32_data.P gen/memcpy.P gen/ptod.P \ gen/setjmp.P gen/sh_data.P gen/sigsetjmp.P gen/strcmp.P \ @@ -131,19 +129,17 @@ sys/acct.P sys/alarm.P sys/chdir.P sys/chmod.P \ sys/chown.P sys/chroot.P sys/close.P sys/creat.P \ sys/dup.P sys/execl.P sys/execle.P sys/execv.P \ sys/execve.P sys/exit.P sys/fchdir.P sys/fchmod.P \ -sys/fchown.P sys/fcntl.P sys/fork.P \ -sys/fpathconf.P sys/fstat.P \ +sys/fchown.P sys/fcntl.P sys/fork.P sys/fstat.P \ sys/fstatvfs.P sys/fsync.P sys/fxstat.P sys/getdents.P \ sys/getegid.P sys/geteuid.P sys/getgid.P sys/getgroups.P \ -sys/getmsg.P sys/getpid.P sys/getpmsg.P \ +sys/getmsg.P sys/getpagesize.P sys/getpid.P sys/getpmsg.P \ sys/getppid.P \ sys/getrlimit.P sys/getuid.P sys/ioctl.P sys/kill.P \ sys/lchown.P sys/link.P sys/lseek.P sys/lstat.P \ -sys/lxstat.P sys/memcntl.P sys/mincore.P \ +sys/lxstat.P sys/mctl.P sys/memcntl.P sys/mincore.P \ sys/mkdir.P sys/mknod.P sys/mmap.P sys/mount.P \ sys/mprotect.P sys/msgsys.P sys/munmap.P sys/nice.P \ -sys/nuname.P sys/open.P sys/pathconf.P \ -sys/pause.P sys/pipe.P \ +sys/nuname.P sys/open.P sys/pause.P sys/pipe.P \ sys/plock.P sys/poll.P sys/priocntlset.P sys/profil.P \ sys/ptrace.P sys/putmsg.P sys/putpmsg.P \ sys/read.P sys/readlink.P sys/readv.P \ @@ -157,7 +153,6 @@ sys/sysconfig.P sys/sysinfo.P \ sys/time.P sys/times.P sys/uadmin.P \ sys/ucontext.P sys/ulimit.P sys/umask.P sys/umount.P \ sys/uname.P sys/unlink.P sys/ustat.P sys/utime.P \ -sys/vfork.P \ sys/wait.P sys/waitid.P sys/write.P sys/writev.P \ sys/xmknod.P sys/xstat.P @@ -283,18 +278,13 @@ shared: cd shared; \ $(LD) -o ../../libc.so.1 -dy -G -e _rt_boot -h /usr/lib/libc.so.1 -ztext -zdefs -Bsymbolic `cat ../../$(MACHINE)/shared_objects | grep -v "\#"` # - # get rid of extraneous rtld file - -rm rtabiaddr.o - # # figure out the correct ordering for all the archive modules - mv cerror.o cerror.x mv fpstart0.o fpstart0.x mv getflth0.o getflth0.x mv getflts0.o getflts0.x mv fpsetmask.o fpsetmask.x -rm -f old_toupper.o old_tolower.o ls | grep '\.o$$' | xargs $(LORDER) | tsort >objlist - mv cerror.x cerror.o mv fpstart0.x fpstart0.o mv getflth0.x getflth0.o mv getflts0.x getflts0.o @@ -302,7 +292,7 @@ shared: # # build the archive with the modules in correct order. xargs $(AR) q ../libc.so objlist - mv cerror.x cerror.o mv fpstart0.x fpstart0.o mv getflth0.x getflth0.o mv getflts0.x getflts0.o @@ -337,7 +325,7 @@ abi_lib: # # build the archive with the modules in correct order. xargs $(AR) q ../libabi.so | old u.u_pcb | +# | | +# |_______________________________| +# | | +# | | +# | u.u_mau (maybe) | +# | | +# | | +# |_______________________________| +# | | +# | u.u_spop (maybe) | +# | | +# |_______________________________| +# | | +# ap,fp ---->| ectxt_elp |<-- cntxtp +# |_______________________________| +# | | +# | ectxt_els | +# |_______________________________| +# | | +# | ectxt_tid | +# |_______________________________| +# | | +# | ectxt_cntxtp | +# |_______________________________| +# | | +# | ectxt_lvl | +# |_______________________________| +# | | +# | ectxt_ufunc | +# |_______________________________| +# | | +# sp ---->| | +# |_______________________________| +# +# +# The value of u.u_spop is saved only if "mau_present" is true. +# The value of u.u_mau is save only if "mau_present" is true +# and the U_SPOP_MAU bit is set in u.u_spop. + + + + + + + + +# The ev_traptousr Function (Continued) +# ===================================== +# +# On entry to the user's trap handler, the stack looks as follows +# before the user does a SAVE. It is assumed that he does do +# a SAVE and RESTORE. Otherwise, the registers won't get saved +# properly since we don't do it. +# +# +# _________________________________ +# | | +# | | +# old sp ---->| old u.u_pcb | +# | | +# |_______________________________| +# | | +# | | +# | u.u_mau (maybe) | +# | | +# | | +# |_______________________________| +# | | +# | u.u_spop (maybe) | +# | | +# |_______________________________| +# | | +# ap,fp ---->| ectxt_elp |<-- cntxtp +# |_______________________________| +# | | +# | ectxt_els | +# |_______________________________| +# | | +# | ectxt_tid | +# |_______________________________| +# | | +# | ectxt_cntxtp | +# |_______________________________| +# | | +# | ectxt_lvl | +# |_______________________________| +# | | +# | ectxt_ufunc | +# |_______________________________| +# | | +# | &ev_usrtrapret | +# |_______________________________| +# | | +# | saved ap | +# |_______________________________| +# | | +# sp ---->| | +# |_______________________________| + + + + + + +# The ev_traptousr Function (Continued) +# ===================================== +# +# We come here from the kernel to transfer to a user's trap +# handler. + +_fwdef_(`ev_traptousr'): + + MCOUNT + MOVW -4(%sp),%r0 # Get func to call. + PUSHW _daref_(ev_usrtrapret) # Return address. + PUSHW %ap # AP to restore. + JMP 0(%r0) # Off to function. + + + +# The ev_usrtrapret Function +# ========================== +# +# A user's trap handler come's back here if it does a normal +# function return. + +_fwdef_(`ev_usrtrapret'): + +# Do the "evtrapret" system call. Note that we should never +# return from this system call. + + MCOUNT + MOVW &4,%r0 # Do the evtrapret system + MOVW &__evtrapret,%r1 # call. + GATE # ... + jmp _cerror # Shouldn't ever come back. diff --git a/usr/src/lib/libc/m32/sys/execl.s b/usr/src/lib/libc/m32/sys/execl.s index f3d9179..96426f5 100644 --- a/usr/src/lib/libc/m32/sys/execl.s +++ b/usr/src/lib/libc/m32/sys/execl.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- execl .ident "@(#)libc-m32:sys/execl.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/execle.s b/usr/src/lib/libc/m32/sys/execle.s index 3b235d2..202571e 100644 --- a/usr/src/lib/libc/m32/sys/execle.s +++ b/usr/src/lib/libc/m32/sys/execle.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- execle .ident "@(#)libc-m32:sys/execle.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/execv.s b/usr/src/lib/libc/m32/sys/execv.s index f8a5642..68bad67 100644 --- a/usr/src/lib/libc/m32/sys/execv.s +++ b/usr/src/lib/libc/m32/sys/execv.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- execv .ident "@(#)libc-m32:sys/execv.s 1.6.1.4" diff --git a/usr/src/lib/libc/m32/sys/execve.s b/usr/src/lib/libc/m32/sys/execve.s index e6e91cc..97db92d 100644 --- a/usr/src/lib/libc/m32/sys/execve.s +++ b/usr/src/lib/libc/m32/sys/execve.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- execve .ident "@(#)libc-m32:sys/execve.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/exit.s b/usr/src/lib/libc/m32/sys/exit.s index f96370d..3360b21 100644 --- a/usr/src/lib/libc/m32/sys/exit.s +++ b/usr/src/lib/libc/m32/sys/exit.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- _exit .ident "@(#)libc-m32:sys/exit.s 1.4" diff --git a/usr/src/lib/libc/m32/sys/fchdir.s b/usr/src/lib/libc/m32/sys/fchdir.s index 06bd47f..0f3a5ab 100644 --- a/usr/src/lib/libc/m32/sys/fchdir.s +++ b/usr/src/lib/libc/m32/sys/fchdir.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/fchdir.s 1.1" # error = fchdir(fd) diff --git a/usr/src/lib/libc/m32/sys/fchmod.s b/usr/src/lib/libc/m32/sys/fchmod.s index 836c58d..d2563b8 100644 --- a/usr/src/lib/libc/m32/sys/fchmod.s +++ b/usr/src/lib/libc/m32/sys/fchmod.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/fchmod.s 1.1" # error = fchmod(fd, mode) diff --git a/usr/src/lib/libc/m32/sys/fchown.s b/usr/src/lib/libc/m32/sys/fchown.s index f157a58..ba22be5 100644 --- a/usr/src/lib/libc/m32/sys/fchown.s +++ b/usr/src/lib/libc/m32/sys/fchown.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/fchown.s 1.1" # error = fchown(fd,owner,group) diff --git a/usr/src/lib/libc/m32/sys/fcntl.s b/usr/src/lib/libc/m32/sys/fcntl.s index 779eacd..0b3b629 100644 --- a/usr/src/lib/libc/m32/sys/fcntl.s +++ b/usr/src/lib/libc/m32/sys/fcntl.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- fcntl .ident "@(#)libc-m32:sys/fcntl.s 1.9" diff --git a/usr/src/lib/libc/m32/sys/fmount.s b/usr/src/lib/libc/m32/sys/fmount.s new file mode 100644 index 0000000..0df1203 --- /dev/null +++ b/usr/src/lib/libc/m32/sys/fmount.s @@ -0,0 +1,16 @@ +.ident "@(#)libc-m32:sys/fmount.s 1.1" + + .set __fmount,105*8 + + .globl _cerror + +_fwdef_(`fmount'): + MCOUNT + MOVW &4,%r0 + MOVW &__fmount,%r1 + GATE + jgeu .noerror + jmp _cerror +.noerror: + CLRW %r0 + RET diff --git a/usr/src/lib/libc/m32/sys/fork.s b/usr/src/lib/libc/m32/sys/fork.s index c217705..88050a4 100644 --- a/usr/src/lib/libc/m32/sys/fork.s +++ b/usr/src/lib/libc/m32/sys/fork.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # .ident "@(#)libc-m32:sys/fork.s 1.7" # C library -- fork diff --git a/usr/src/lib/libc/m32/sys/fstat.s b/usr/src/lib/libc/m32/sys/fstat.s index 4a3bfda..33aef1f 100644 --- a/usr/src/lib/libc/m32/sys/fstat.s +++ b/usr/src/lib/libc/m32/sys/fstat.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- fstat .ident "@(#)libc-m32:sys/fstat.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/fstatf.s b/usr/src/lib/libc/m32/sys/fstatf.s index 6c3325d..63bab27 100644 --- a/usr/src/lib/libc/m32/sys/fstatf.s +++ b/usr/src/lib/libc/m32/sys/fstatf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- fstatf .ident "@(#)libc-m32:sys/fstatf.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/fstatfs.s b/usr/src/lib/libc/m32/sys/fstatfs.s index a3792b6..ffc03f8 100644 --- a/usr/src/lib/libc/m32/sys/fstatfs.s +++ b/usr/src/lib/libc/m32/sys/fstatfs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/fstatfs.s 1.4" # C library -- fstatfs diff --git a/usr/src/lib/libc/m32/sys/fstatvfs.s b/usr/src/lib/libc/m32/sys/fstatvfs.s index e67a6a1..d90ea83 100644 --- a/usr/src/lib/libc/m32/sys/fstatvfs.s +++ b/usr/src/lib/libc/m32/sys/fstatvfs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/fstatvfs.s 1.1" # error = fstatvfs(fd, statbuf) diff --git a/usr/src/lib/libc/m32/sys/fsync.s b/usr/src/lib/libc/m32/sys/fsync.s index d740622..b9c73ac 100644 --- a/usr/src/lib/libc/m32/sys/fsync.s +++ b/usr/src/lib/libc/m32/sys/fsync.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/fsync.s 1.1" # error = fsync(fd) diff --git a/usr/src/lib/libc/m32/sys/funmount.s b/usr/src/lib/libc/m32/sys/funmount.s new file mode 100644 index 0000000..d78490a --- /dev/null +++ b/usr/src/lib/libc/m32/sys/funmount.s @@ -0,0 +1,16 @@ +.ident "@(#)libc-m32:sys/funmount.s 1.1" + + .set __funmount,106*8 + + .globl _cerror + +_fwdef_(`funmount'): + MCOUNT + MOVW &4,%r0 + MOVW &__funmount,%r1 + GATE + jgeu .noerror + jmp _cerror +.noerror: + CLRW %r0 + RET diff --git a/usr/src/lib/libc/m32/sys/fxstat.s b/usr/src/lib/libc/m32/sys/fxstat.s index d9c90cc..c83faab 100644 --- a/usr/src/lib/libc/m32/sys/fxstat.s +++ b/usr/src/lib/libc/m32/sys/fxstat.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/fxstat.s 1.1" # error = _fxstat(version, string, statbuf) diff --git a/usr/src/lib/libc/m32/sys/getdents.s b/usr/src/lib/libc/m32/sys/getdents.s index 34890e7..333d57f 100644 --- a/usr/src/lib/libc/m32/sys/getdents.s +++ b/usr/src/lib/libc/m32/sys/getdents.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- getdents .ident "@(#)libc-m32:sys/getdents.s 1.2.1.7" .file "getdents.s" diff --git a/usr/src/lib/libc/m32/sys/getegid.s b/usr/src/lib/libc/m32/sys/getegid.s index e168547..6372291 100644 --- a/usr/src/lib/libc/m32/sys/getegid.s +++ b/usr/src/lib/libc/m32/sys/getegid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- getegid .ident "@(#)libc-m32:sys/getegid.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/geteuid.s b/usr/src/lib/libc/m32/sys/geteuid.s index b14ff4f..51afb26 100644 --- a/usr/src/lib/libc/m32/sys/geteuid.s +++ b/usr/src/lib/libc/m32/sys/geteuid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- geteuid .ident "@(#)libc-m32:sys/geteuid.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/getgid.s b/usr/src/lib/libc/m32/sys/getgid.s index f7ec1e8..e2eda85 100644 --- a/usr/src/lib/libc/m32/sys/getgid.s +++ b/usr/src/lib/libc/m32/sys/getgid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- getgid .ident "@(#)libc-m32:sys/getgid.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/getgroups.s b/usr/src/lib/libc/m32/sys/getgroups.s index 5b9ec1d..5473e0b 100644 --- a/usr/src/lib/libc/m32/sys/getgroups.s +++ b/usr/src/lib/libc/m32/sys/getgroups.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/getgroups.s 1.1" # ngroups = getgroups(gidsetsize, grouplist); diff --git a/usr/src/lib/libc/m32/sys/getmsg.s b/usr/src/lib/libc/m32/sys/getmsg.s index c7e75ed..53308a3 100644 --- a/usr/src/lib/libc/m32/sys/getmsg.s +++ b/usr/src/lib/libc/m32/sys/getmsg.s @@ -1,15 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/getmsg.s 1.5" +.ident "@(#)libc-m32:sys/getmsg.s 1.4" # C library -- getmsg .set __getmsg,85*8 - .set ERESTART,91 .globl _cerror @@ -19,8 +12,6 @@ _fwdef_(`getmsg'): MOVW &__getmsg,%r1 GATE jgeu .noerror - CMPB &ERESTART,%r0 - BEB getmsg jmp _cerror .noerror: RET diff --git a/usr/src/lib/libc/m32/sys/getpagesize.s b/usr/src/lib/libc/m32/sys/getpagesize.s new file mode 100644 index 0000000..c03fa61 --- /dev/null +++ b/usr/src/lib/libc/m32/sys/getpagesize.s @@ -0,0 +1,18 @@ +# OS library -- getpagesize +.ident "@(#)libc-m32:sys/getpagesize.s 1.1" + +# error = getpagesize() + + .set __getpagesize,118*8 + + .globl _cerror + +_fwdef_(`getpagesize'): + MCOUNT + MOVW &4,%r0 + MOVW &__getpagesize,%r1 + GATE + jgeu .noerror + jmp _cerror +.noerror: + RET diff --git a/usr/src/lib/libc/m32/sys/getpid.s b/usr/src/lib/libc/m32/sys/getpid.s index e430a81..c7cf5f6 100644 --- a/usr/src/lib/libc/m32/sys/getpid.s +++ b/usr/src/lib/libc/m32/sys/getpid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # getpid -- get process ID .ident "@(#)libc-m32:sys/getpid.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/getpmsg.s b/usr/src/lib/libc/m32/sys/getpmsg.s index 6b50512..3c619db 100644 --- a/usr/src/lib/libc/m32/sys/getpmsg.s +++ b/usr/src/lib/libc/m32/sys/getpmsg.s @@ -1,15 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/getpmsg.s 1.2" +.ident "@(#)libc-m32:sys/getpmsg.s 1.1" # C library -- getpmsg .set __getpmsg,132*8 - .set ERESTART,91 .globl _cerror @@ -19,8 +12,6 @@ _fwdef_(`getpmsg'): MOVW &__getpmsg,%r1 GATE jgeu .noerror - CMPB &ERESTART,%r0 - BEB getpmsg jmp _cerror .noerror: RET diff --git a/usr/src/lib/libc/m32/sys/getppid.s b/usr/src/lib/libc/m32/sys/getppid.s index f9bf66a..9b8e9f7 100644 --- a/usr/src/lib/libc/m32/sys/getppid.s +++ b/usr/src/lib/libc/m32/sys/getppid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # getppid -- get parent process ID .ident "@(#)libc-m32:sys/getppid.s 1.5" diff --git a/usr/src/lib/libc/m32/sys/getrlimit.s b/usr/src/lib/libc/m32/sys/getrlimit.s index 72cc0d9..7787fda 100644 --- a/usr/src/lib/libc/m32/sys/getrlimit.s +++ b/usr/src/lib/libc/m32/sys/getrlimit.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/getrlimit.s 1.1" # OS library -- getrlimit diff --git a/usr/src/lib/libc/m32/sys/getuid.s b/usr/src/lib/libc/m32/sys/getuid.s index e05e20c..af84377 100644 --- a/usr/src/lib/libc/m32/sys/getuid.s +++ b/usr/src/lib/libc/m32/sys/getuid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- getuid .ident "@(#)libc-m32:sys/getuid.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/gtty.s b/usr/src/lib/libc/m32/sys/gtty.s index babc1fe..c49da08 100644 --- a/usr/src/lib/libc/m32/sys/gtty.s +++ b/usr/src/lib/libc/m32/sys/gtty.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- gtty .ident "@(#)libc-m32:sys/gtty.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/ioctl.s b/usr/src/lib/libc/m32/sys/ioctl.s index 2d193fb..d2a3c47 100644 --- a/usr/src/lib/libc/m32/sys/ioctl.s +++ b/usr/src/lib/libc/m32/sys/ioctl.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- ioctl .ident "@(#)libc-m32:sys/ioctl.s 1.9" diff --git a/usr/src/lib/libc/m32/sys/kill.s b/usr/src/lib/libc/m32/sys/kill.s index a71b865..73b7964 100644 --- a/usr/src/lib/libc/m32/sys/kill.s +++ b/usr/src/lib/libc/m32/sys/kill.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- kill .ident "@(#)libc-m32:sys/kill.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/lchown.s b/usr/src/lib/libc/m32/sys/lchown.s index 9c151e6..951e6a4 100644 --- a/usr/src/lib/libc/m32/sys/lchown.s +++ b/usr/src/lib/libc/m32/sys/lchown.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- lchown .ident "@(#)libc-m32:sys/lchown.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/link.s b/usr/src/lib/libc/m32/sys/link.s index f91c20a..6be1d63 100644 --- a/usr/src/lib/libc/m32/sys/link.s +++ b/usr/src/lib/libc/m32/sys/link.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- link .ident "@(#)libc-m32:sys/link.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/lseek.s b/usr/src/lib/libc/m32/sys/lseek.s index 75675dc..0928a4a 100644 --- a/usr/src/lib/libc/m32/sys/lseek.s +++ b/usr/src/lib/libc/m32/sys/lseek.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- lseek .ident "@(#)libc-m32:sys/lseek.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/lstat.s b/usr/src/lib/libc/m32/sys/lstat.s index 84f7eb4..1713225 100644 --- a/usr/src/lib/libc/m32/sys/lstat.s +++ b/usr/src/lib/libc/m32/sys/lstat.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/lstat.s 1.1" # error = lstat(string, statbuf) diff --git a/usr/src/lib/libc/m32/sys/lxstat.s b/usr/src/lib/libc/m32/sys/lxstat.s index b7604d0..e55b3f8 100644 --- a/usr/src/lib/libc/m32/sys/lxstat.s +++ b/usr/src/lib/libc/m32/sys/lxstat.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/lxstat.s 1.1" # error = _lxstat(version, string, statbuf) diff --git a/usr/src/lib/libc/m32/sys/mctl.s b/usr/src/lib/libc/m32/sys/mctl.s new file mode 100644 index 0000000..3f750a9 --- /dev/null +++ b/usr/src/lib/libc/m32/sys/mctl.s @@ -0,0 +1,18 @@ +.ident "@(#)libc-m32:sys/mctl.s 1.1" + +# error = mctl(addr, len, function, arg) + + .set __mctl,113*8 + + .globl _cerror + +_fwdef_(`mctl'): + MCOUNT + MOVW &4,%r0 + MOVW &__mctl,%r1 + GATE + jgeu .noerror + jmp _cerror +.noerror: + CLRW %r0 + RET diff --git a/usr/src/lib/libc/m32/sys/memcntl.s b/usr/src/lib/libc/m32/sys/memcntl.s index d61bf09..f654970 100644 --- a/usr/src/lib/libc/m32/sys/memcntl.s +++ b/usr/src/lib/libc/m32/sys/memcntl.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- memcntl .ident "@(#)libc-m32:sys/memcntl.s 1.3" diff --git a/usr/src/lib/libc/m32/sys/mincore.s b/usr/src/lib/libc/m32/sys/mincore.s index fe25500..7d24003 100644 --- a/usr/src/lib/libc/m32/sys/mincore.s +++ b/usr/src/lib/libc/m32/sys/mincore.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/mincore.s 1.1" # error = mincore(addr, len, vec) diff --git a/usr/src/lib/libc/m32/sys/mkdir.s b/usr/src/lib/libc/m32/sys/mkdir.s index 946a1de..57c55c4 100644 --- a/usr/src/lib/libc/m32/sys/mkdir.s +++ b/usr/src/lib/libc/m32/sys/mkdir.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- mkdir .ident "@(#)libc-m32:sys/mkdir.s 1.8" .file "mkdir.s" diff --git a/usr/src/lib/libc/m32/sys/mknod.s b/usr/src/lib/libc/m32/sys/mknod.s index ccaa86a..2594a20 100644 --- a/usr/src/lib/libc/m32/sys/mknod.s +++ b/usr/src/lib/libc/m32/sys/mknod.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- mknod .ident "@(#)libc-m32:sys/mknod.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/mmap.s b/usr/src/lib/libc/m32/sys/mmap.s index fb814e3..790ce55 100644 --- a/usr/src/lib/libc/m32/sys/mmap.s +++ b/usr/src/lib/libc/m32/sys/mmap.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- mmap .ident "@(#)libc-m32:sys/mmap.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/mount.s b/usr/src/lib/libc/m32/sys/mount.s index 8dd834b..c176587 100644 --- a/usr/src/lib/libc/m32/sys/mount.s +++ b/usr/src/lib/libc/m32/sys/mount.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- mount .ident "@(#)libc-m32:sys/mount.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/mprotect.s b/usr/src/lib/libc/m32/sys/mprotect.s index 5427aec..fc2ba9b 100644 --- a/usr/src/lib/libc/m32/sys/mprotect.s +++ b/usr/src/lib/libc/m32/sys/mprotect.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- mprotect .ident "@(#)libc-m32:sys/mprotect.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/msgsys.c b/usr/src/lib/libc/m32/sys/msgsys.c index 6193aae..015dd6e 100644 --- a/usr/src/lib/libc/m32/sys/msgsys.c +++ b/usr/src/lib/libc/m32/sys/msgsys.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:sys/msgsys.c 1.9" +#ident "@(#)libc-m32:sys/msgsys.c 1.8" #ifdef __STDC__ #pragma weak msgctl = _msgctl #pragma weak msgget = _msgget @@ -66,7 +66,7 @@ int msgflg; int msgrcv(msqid, msgp, msgsz, msgtyp, msgflg) int msqid; -void *msgp; +struct msgbuf *msgp; int msgsz; long msgtyp; int msgflg; @@ -77,7 +77,7 @@ int msgflg; int msgsnd(msqid, msgp, msgsz, msgflg) int msqid; -const void *msgp; +const struct msgbuf *msgp; int msgsz, msgflg; { return(syscall(MSGSYS, MSGSND, msqid, msgp, msgsz, msgflg)); diff --git a/usr/src/lib/libc/m32/sys/munmap.s b/usr/src/lib/libc/m32/sys/munmap.s index 395bc85..16d310d 100644 --- a/usr/src/lib/libc/m32/sys/munmap.s +++ b/usr/src/lib/libc/m32/sys/munmap.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- munmap .ident "@(#)libc-m32:sys/munmap.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/nice.s b/usr/src/lib/libc/m32/sys/nice.s index a1b1e01..b32e244 100644 --- a/usr/src/lib/libc/m32/sys/nice.s +++ b/usr/src/lib/libc/m32/sys/nice.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library-- nice .ident "@(#)libc-m32:sys/nice.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/nuname.s b/usr/src/lib/libc/m32/sys/nuname.s index 72fb9ad..ff73225 100644 --- a/usr/src/lib/libc/m32/sys/nuname.s +++ b/usr/src/lib/libc/m32/sys/nuname.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/nuname.s 1.1" # OS library -- nuname diff --git a/usr/src/lib/libc/m32/sys/open.s b/usr/src/lib/libc/m32/sys/open.s index 8fa04cd..aaab1fc 100644 --- a/usr/src/lib/libc/m32/sys/open.s +++ b/usr/src/lib/libc/m32/sys/open.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- open .ident "@(#)libc-m32:sys/open.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/pause.s b/usr/src/lib/libc/m32/sys/pause.s index cc4922d..7620cde 100644 --- a/usr/src/lib/libc/m32/sys/pause.s +++ b/usr/src/lib/libc/m32/sys/pause.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library - pause .ident "@(#)libc-m32:sys/pause.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/pipe.s b/usr/src/lib/libc/m32/sys/pipe.s index 4c8b5e2..f3c80ca 100644 --- a/usr/src/lib/libc/m32/sys/pipe.s +++ b/usr/src/lib/libc/m32/sys/pipe.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # pipe -- C library .ident "@(#)libc-m32:sys/pipe.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/plock.s b/usr/src/lib/libc/m32/sys/plock.s index c11e60b..65fd371 100644 --- a/usr/src/lib/libc/m32/sys/plock.s +++ b/usr/src/lib/libc/m32/sys/plock.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- plock .ident "@(#)libc-m32:sys/plock.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/poll.s b/usr/src/lib/libc/m32/sys/poll.s index 7899dcf..d542ac4 100644 --- a/usr/src/lib/libc/m32/sys/poll.s +++ b/usr/src/lib/libc/m32/sys/poll.s @@ -1,15 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/poll.s 1.5" +.ident "@(#)libc-m32:sys/poll.s 1.4" # C library -- poll .set __poll,87*8 - .set ERESTART,91 .globl _cerror @@ -19,8 +12,6 @@ _fwdef_(`poll'): MOVW &__poll,%r1 GATE jgeu .noerror - CMPB &ERESTART,%r0 - BEB poll jmp _cerror .noerror: RET diff --git a/usr/src/lib/libc/m32/sys/priocntlset.s b/usr/src/lib/libc/m32/sys/priocntlset.s index 871da94..beddb38 100644 --- a/usr/src/lib/libc/m32/sys/priocntlset.s +++ b/usr/src/lib/libc/m32/sys/priocntlset.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/priocntlset.s 1.1" .set _priocntlset,112*8 diff --git a/usr/src/lib/libc/m32/sys/profil.s b/usr/src/lib/libc/m32/sys/profil.s index b863dac..c952d5e 100644 --- a/usr/src/lib/libc/m32/sys/profil.s +++ b/usr/src/lib/libc/m32/sys/profil.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # profil .ident "@(#)libc-m32:sys/profil.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/ptrace.s b/usr/src/lib/libc/m32/sys/ptrace.s index 92ef6fc..3b0fa70 100644 --- a/usr/src/lib/libc/m32/sys/ptrace.s +++ b/usr/src/lib/libc/m32/sys/ptrace.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # ptrace -- C library .ident "@(#)libc-m32:sys/ptrace.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/putmsg.s b/usr/src/lib/libc/m32/sys/putmsg.s index 9c29f9c..1d9e6e6 100644 --- a/usr/src/lib/libc/m32/sys/putmsg.s +++ b/usr/src/lib/libc/m32/sys/putmsg.s @@ -1,15 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/putmsg.s 1.5" +.ident "@(#)libc-m32:sys/putmsg.s 1.4" # C library -- putmsg .set __putmsg,86*8 - .set ERESTART,91 .globl _cerror @@ -19,8 +12,6 @@ _fwdef_(`putmsg'): MOVW &__putmsg,%r1 GATE jgeu .noerror - CMPB &ERESTART,%r0 - BEB putmsg jmp _cerror .noerror: RET diff --git a/usr/src/lib/libc/m32/sys/putpmsg.s b/usr/src/lib/libc/m32/sys/putpmsg.s index 718e373..8d2f323 100644 --- a/usr/src/lib/libc/m32/sys/putpmsg.s +++ b/usr/src/lib/libc/m32/sys/putpmsg.s @@ -1,15 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/putpmsg.s 1.2" +.ident "@(#)libc-m32:sys/putpmsg.s 1.1" # C library -- putpmsg .set __putpmsg,133*8 - .set ERESTART,91 .globl _cerror @@ -19,8 +12,6 @@ _fwdef_(`putpmsg'): MOVW &__putpmsg,%r1 GATE jgeu .noerror - CMPB &ERESTART,%r0 - BEB putpmsg jmp _cerror .noerror: RET diff --git a/usr/src/lib/libc/m32/sys/read.s b/usr/src/lib/libc/m32/sys/read.s index 17f7934..4692de6 100644 --- a/usr/src/lib/libc/m32/sys/read.s +++ b/usr/src/lib/libc/m32/sys/read.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- read .ident "@(#)libc-m32:sys/read.s 1.9" diff --git a/usr/src/lib/libc/m32/sys/readlink.s b/usr/src/lib/libc/m32/sys/readlink.s index fd53d87..1d04a76 100644 --- a/usr/src/lib/libc/m32/sys/readlink.s +++ b/usr/src/lib/libc/m32/sys/readlink.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/readlink.s 1.1" # nchar = readlink(path, buffer, count) diff --git a/usr/src/lib/libc/m32/sys/readv.s b/usr/src/lib/libc/m32/sys/readv.s index 9e5f590..172ff02 100644 --- a/usr/src/lib/libc/m32/sys/readv.s +++ b/usr/src/lib/libc/m32/sys/readv.s @@ -1,15 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/readv.s 1.3" +.ident "@(#)libc-m32:sys/readv.s 1.2" # error = readv(fd, iovp, iovcnt) .set __readv,121*8 - .set ERESTART,91 .globl _cerror @@ -19,8 +12,6 @@ _fwdef_(`readv'): MOVW &__readv,%r1 GATE jgeu .noerror - CMPB &ERESTART,%r0 - BEB readv jmp _cerror .noerror: RET diff --git a/usr/src/lib/libc/m32/sys/rfsys.s b/usr/src/lib/libc/m32/sys/rfsys.s index 1236baa..0b3c086 100644 --- a/usr/src/lib/libc/m32/sys/rfsys.s +++ b/usr/src/lib/libc/m32/sys/rfsys.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/rfsys.s 1.6" .set __rfsys,78*8 diff --git a/usr/src/lib/libc/m32/sys/rmdir.s b/usr/src/lib/libc/m32/sys/rmdir.s index 501fbf0..d3e10b7 100644 --- a/usr/src/lib/libc/m32/sys/rmdir.s +++ b/usr/src/lib/libc/m32/sys/rmdir.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- rmdir .ident "@(#)libc-m32:sys/rmdir.s 1.9" .file "rmdir.s" diff --git a/usr/src/lib/libc/m32/sys/sbrk.s b/usr/src/lib/libc/m32/sys/sbrk.s index ed0593f..4e5fa62 100644 --- a/usr/src/lib/libc/m32/sys/sbrk.s +++ b/usr/src/lib/libc/m32/sys/sbrk.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C-library sbrk .ident "@(#)libc-m32:sys/sbrk.s 1.6.1.6" diff --git a/usr/src/lib/libc/m32/sys/seteguid.s b/usr/src/lib/libc/m32/sys/seteguid.s index 83feeab..dc33b28 100644 --- a/usr/src/lib/libc/m32/sys/seteguid.s +++ b/usr/src/lib/libc/m32/sys/seteguid.s @@ -1,14 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/seteguid.s 1.2" +.ident "@(#)libc-m32:sys/seteguid.s 1.1" # C library -- setegid, seteuid - .set __setegid,136*8 + .set __setegid,140*8 .set __seteuid,141*8 .globl _cerror diff --git a/usr/src/lib/libc/m32/sys/setgid.s b/usr/src/lib/libc/m32/sys/setgid.s index e6499a5..285bb28 100644 --- a/usr/src/lib/libc/m32/sys/setgid.s +++ b/usr/src/lib/libc/m32/sys/setgid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- setgid .ident "@(#)libc-m32:sys/setgid.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/setgroups.s b/usr/src/lib/libc/m32/sys/setgroups.s index 28871cd..b0553c9 100644 --- a/usr/src/lib/libc/m32/sys/setgroups.s +++ b/usr/src/lib/libc/m32/sys/setgroups.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/setgroups.s 1.1" # setgroups(ngroups, grouplist); diff --git a/usr/src/lib/libc/m32/sys/setpgrp.s b/usr/src/lib/libc/m32/sys/setpgrp.s index b0ad1dd..8030de7 100644 --- a/usr/src/lib/libc/m32/sys/setpgrp.s +++ b/usr/src/lib/libc/m32/sys/setpgrp.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- setpgrp, getpgrp .ident "@(#)libc-m32:sys/setpgrp.s 1.7" diff --git a/usr/src/lib/libc/m32/sys/setrlimit.s b/usr/src/lib/libc/m32/sys/setrlimit.s index 2c4b31f..bb4e057 100644 --- a/usr/src/lib/libc/m32/sys/setrlimit.s +++ b/usr/src/lib/libc/m32/sys/setrlimit.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/setrlimit.s 1.1" # OS library -- setrlimit diff --git a/usr/src/lib/libc/m32/sys/setsid.s b/usr/src/lib/libc/m32/sys/setsid.s index fa3dbb5..fe00398 100644 --- a/usr/src/lib/libc/m32/sys/setsid.s +++ b/usr/src/lib/libc/m32/sys/setsid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- setsid, setpgid, getsid, getpgid .ident "@(#)libc-m32:sys/setsid.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/setuid.s b/usr/src/lib/libc/m32/sys/setuid.s index 04bc5a7..53caaf5 100644 --- a/usr/src/lib/libc/m32/sys/setuid.s +++ b/usr/src/lib/libc/m32/sys/setuid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- setuid .ident "@(#)libc-m32:sys/setuid.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/sigaction.c b/usr/src/lib/libc/m32/sys/sigaction.c index 765e412..9a754a3 100644 --- a/usr/src/lib/libc/m32/sys/sigaction.c +++ b/usr/src/lib/libc/m32/sys/sigaction.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-m32:sys/sigaction.c 1.5" +#ident "@(#)libc-m32:sys/sigaction.c 1.4" #ifdef __STDC__ #pragma weak sigaction = _sigaction @@ -30,11 +30,9 @@ sigacthandler(sig, sip, uap) sigaction(sig, nact, oact) int sig; - const struct sigaction *nact; - struct sigaction *oact; + struct sigaction *nact, *oact; { struct sigaction tact; - register struct sigaction *tactp; void (*ohandler)(); if (sig <= 0 || sig >= NSIG) { @@ -44,15 +42,15 @@ sigaction(sig, nact, oact) ohandler = _siguhandler[sig]; - if (tactp = (struct sigaction *)nact) { + if (nact) { tact = *nact; - tactp = &tact; - _siguhandler[sig] = tactp->sa_handler; - if (tactp->sa_handler != SIG_DFL && tactp->sa_handler != SIG_IGN) - tactp->sa_handler = sigacthandler; + nact = &tact; + _siguhandler[sig] = nact->sa_handler; + if (nact->sa_handler != SIG_DFL && nact->sa_handler != SIG_IGN) + nact->sa_handler = sigacthandler; } - if (__sigaction(sig, tactp, oact) == -1) { + if (__sigaction(sig, nact, oact) == -1) { _siguhandler[sig] = ohandler; return -1; } diff --git a/usr/src/lib/libc/m32/sys/sigaltstk.s b/usr/src/lib/libc/m32/sys/sigaltstk.s index 9f38a01..dadc55e 100644 --- a/usr/src/lib/libc/m32/sys/sigaltstk.s +++ b/usr/src/lib/libc/m32/sys/sigaltstk.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sigaltstk.s" .ident "@(#)libc-m32:sys/sigaltstk.s 1.3" diff --git a/usr/src/lib/libc/m32/sys/signal.s b/usr/src/lib/libc/m32/sys/signal.s index 5ccc37a..dd31a4e 100644 --- a/usr/src/lib/libc/m32/sys/signal.s +++ b/usr/src/lib/libc/m32/sys/signal.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "signal.s" .ident "@(#)libc-m32:sys/signal.s 1.19.1.12" diff --git a/usr/src/lib/libc/m32/sys/sigpending.s b/usr/src/lib/libc/m32/sys/sigpending.s index 3044db3..d28f77a 100644 --- a/usr/src/lib/libc/m32/sys/sigpending.s +++ b/usr/src/lib/libc/m32/sys/sigpending.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sigpending.s" .ident "@(#)libc-m32:sys/sigpending.s 1.4" diff --git a/usr/src/lib/libc/m32/sys/sigprocmsk.s b/usr/src/lib/libc/m32/sys/sigprocmsk.s index a1e8dd6..82b5f67 100644 --- a/usr/src/lib/libc/m32/sys/sigprocmsk.s +++ b/usr/src/lib/libc/m32/sys/sigprocmsk.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sigprocmsk.s" .ident "@(#)libc-m32:sys/sigprocmsk.s 1.3" diff --git a/usr/src/lib/libc/m32/sys/sigsendset.s b/usr/src/lib/libc/m32/sys/sigsendset.s index 5ca9352..d7616c6 100644 --- a/usr/src/lib/libc/m32/sys/sigsendset.s +++ b/usr/src/lib/libc/m32/sys/sigsendset.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- sigsendset .ident "@(#)libc-m32:sys/sigsendset.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/sigsuspend.s b/usr/src/lib/libc/m32/sys/sigsuspend.s index 515466b..e283d49 100644 --- a/usr/src/lib/libc/m32/sys/sigsuspend.s +++ b/usr/src/lib/libc/m32/sys/sigsuspend.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sigsuspend.s" .ident "@(#)libc-m32:sys/sigsuspend.s 1.3" diff --git a/usr/src/lib/libc/m32/sys/stat.s b/usr/src/lib/libc/m32/sys/stat.s index 085d8f9..34a0d18 100644 --- a/usr/src/lib/libc/m32/sys/stat.s +++ b/usr/src/lib/libc/m32/sys/stat.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- stat .ident "@(#)libc-m32:sys/stat.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/statf.s b/usr/src/lib/libc/m32/sys/statf.s index 21114a9..9d42cf1 100644 --- a/usr/src/lib/libc/m32/sys/statf.s +++ b/usr/src/lib/libc/m32/sys/statf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- statf .ident "@(#)libc-m32:sys/statf.s 1.8" .file "statf.s" diff --git a/usr/src/lib/libc/m32/sys/statfs.s b/usr/src/lib/libc/m32/sys/statfs.s index 2212d6f..be69581 100644 --- a/usr/src/lib/libc/m32/sys/statfs.s +++ b/usr/src/lib/libc/m32/sys/statfs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/statfs.s 1.4" # C library -- statfs diff --git a/usr/src/lib/libc/m32/sys/statvfs.s b/usr/src/lib/libc/m32/sys/statvfs.s index 721efd5..cf0b339 100644 --- a/usr/src/lib/libc/m32/sys/statvfs.s +++ b/usr/src/lib/libc/m32/sys/statvfs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/statvfs.s 1.1" # error = statvfs(path, statbuf) diff --git a/usr/src/lib/libc/m32/sys/stime.s b/usr/src/lib/libc/m32/sys/stime.s index c2b72b0..28fe242 100644 --- a/usr/src/lib/libc/m32/sys/stime.s +++ b/usr/src/lib/libc/m32/sys/stime.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C - library stime .ident "@(#)libc-m32:sys/stime.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/stty.s b/usr/src/lib/libc/m32/sys/stty.s index 28c5bd2..4dd303b 100644 --- a/usr/src/lib/libc/m32/sys/stty.s +++ b/usr/src/lib/libc/m32/sys/stty.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- stty .ident "@(#)libc-m32:sys/stty.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/symlink.s b/usr/src/lib/libc/m32/sys/symlink.s index a82dbfd..2b24073 100644 --- a/usr/src/lib/libc/m32/sys/symlink.s +++ b/usr/src/lib/libc/m32/sys/symlink.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/symlink.s 1.1" # error = symlink(linkname, target) diff --git a/usr/src/lib/libc/m32/sys/sync.s b/usr/src/lib/libc/m32/sys/sync.s index ade1368..a58e082 100644 --- a/usr/src/lib/libc/m32/sys/sync.s +++ b/usr/src/lib/libc/m32/sys/sync.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- sync .ident "@(#)libc-m32:sys/sync.s 1.5" diff --git a/usr/src/lib/libc/m32/sys/sys3b.s b/usr/src/lib/libc/m32/sys/sys3b.s index 9960b6b..400760d 100644 --- a/usr/src/lib/libc/m32/sys/sys3b.s +++ b/usr/src/lib/libc/m32/sys/sys3b.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/sys3b.s 1.3.1.5" # C library -- sys3b diff --git a/usr/src/lib/libc/m32/sys/syscall.s b/usr/src/lib/libc/m32/sys/syscall.s index 299e027..3e36853 100644 --- a/usr/src/lib/libc/m32/sys/syscall.s +++ b/usr/src/lib/libc/m32/sys/syscall.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- syscall .ident "@(#)libc-m32:sys/syscall.s 1.9" diff --git a/usr/src/lib/libc/m32/sys/sysconfig.s b/usr/src/lib/libc/m32/sys/sysconfig.s index 6a11c58..4cb4faa 100644 --- a/usr/src/lib/libc/m32/sys/sysconfig.s +++ b/usr/src/lib/libc/m32/sys/sysconfig.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- _sysconfig .ident "@(#)libc-m32:sys/sysconfig.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/sysfs.s b/usr/src/lib/libc/m32/sys/sysfs.s index fea9f63..63978cc 100644 --- a/usr/src/lib/libc/m32/sys/sysfs.s +++ b/usr/src/lib/libc/m32/sys/sysfs.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/sysfs.s 1.5" # C library -- sysfs diff --git a/usr/src/lib/libc/m32/sys/sysinfo.s b/usr/src/lib/libc/m32/sys/sysinfo.s index bc70f2c..aecfb5e 100644 --- a/usr/src/lib/libc/m32/sys/sysinfo.s +++ b/usr/src/lib/libc/m32/sys/sysinfo.s @@ -1,10 +1,4 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/sysinfo.s 1.2" +.ident "@(#)libc-m32:sys/sysinfo.s 1.1" # OS library -- sysinfo # error = sysinfo(cmd, buf, count) @@ -13,17 +7,7 @@ .globl _cerror -_m4_ifdef_(`ABI',` - .globl sysinfo -_fgdef_(sysinfo): -',` -_m4_ifdef_(`DSHLIB',` - .globl sysinfo -_fgdef_(sysinfo): -',` _fwdef_(`sysinfo'): -') -') # MOVW &4,%r0 MOVW &_systeminfo,%r1 diff --git a/usr/src/lib/libc/m32/sys/time.s b/usr/src/lib/libc/m32/sys/time.s index a6d374b..399ff88 100644 --- a/usr/src/lib/libc/m32/sys/time.s +++ b/usr/src/lib/libc/m32/sys/time.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- time .ident "@(#)libc-m32:sys/time.s 1.5" diff --git a/usr/src/lib/libc/m32/sys/times.s b/usr/src/lib/libc/m32/sys/times.s index 97ecbea..33ec179 100644 --- a/usr/src/lib/libc/m32/sys/times.s +++ b/usr/src/lib/libc/m32/sys/times.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- times .ident "@(#)libc-m32:sys/times.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/uadmin.s b/usr/src/lib/libc/m32/sys/uadmin.s index 21437b4..89f6090 100644 --- a/usr/src/lib/libc/m32/sys/uadmin.s +++ b/usr/src/lib/libc/m32/sys/uadmin.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/uadmin.s 1.6" # C library -- uadmin diff --git a/usr/src/lib/libc/m32/sys/ucontext.s b/usr/src/lib/libc/m32/sys/ucontext.s index c415231..3d99d00 100644 --- a/usr/src/lib/libc/m32/sys/ucontext.s +++ b/usr/src/lib/libc/m32/sys/ucontext.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- setcontext and getcontext .file "ucontext.s" diff --git a/usr/src/lib/libc/m32/sys/ulimit.s b/usr/src/lib/libc/m32/sys/ulimit.s index 5262a57..aa356e3 100644 --- a/usr/src/lib/libc/m32/sys/ulimit.s +++ b/usr/src/lib/libc/m32/sys/ulimit.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- ulimit .ident "@(#)libc-m32:sys/ulimit.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/umask.s b/usr/src/lib/libc/m32/sys/umask.s index 7bc0e71..c4415b6 100644 --- a/usr/src/lib/libc/m32/sys/umask.s +++ b/usr/src/lib/libc/m32/sys/umask.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- umask .ident "@(#)libc-m32:sys/umask.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/umount.s b/usr/src/lib/libc/m32/sys/umount.s index 2a2a296..9886a17 100644 --- a/usr/src/lib/libc/m32/sys/umount.s +++ b/usr/src/lib/libc/m32/sys/umount.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- umount .ident "@(#)libc-m32:sys/umount.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/uname.s b/usr/src/lib/libc/m32/sys/uname.s index b05bc5e..33be243 100644 --- a/usr/src/lib/libc/m32/sys/uname.s +++ b/usr/src/lib/libc/m32/sys/uname.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- uname .ident "@(#)libc-m32:sys/uname.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/unlink.s b/usr/src/lib/libc/m32/sys/unlink.s index 97bac0e..6a9bc33 100644 --- a/usr/src/lib/libc/m32/sys/unlink.s +++ b/usr/src/lib/libc/m32/sys/unlink.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- unlink .ident "@(#)libc-m32:sys/unlink.s 1.8" diff --git a/usr/src/lib/libc/m32/sys/ustat.s b/usr/src/lib/libc/m32/sys/ustat.s index 3c5b6f4..a0fdaaf 100644 --- a/usr/src/lib/libc/m32/sys/ustat.s +++ b/usr/src/lib/libc/m32/sys/ustat.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library-- ustat .ident "@(#)libc-m32:sys/ustat.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/utime.s b/usr/src/lib/libc/m32/sys/utime.s index 0674502..df63dd3 100644 --- a/usr/src/lib/libc/m32/sys/utime.s +++ b/usr/src/lib/libc/m32/sys/utime.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- utime .ident "@(#)libc-m32:sys/utime.s 1.6" diff --git a/usr/src/lib/libc/m32/sys/utssys.s b/usr/src/lib/libc/m32/sys/utssys.s index 189d091..869389d 100644 --- a/usr/src/lib/libc/m32/sys/utssys.s +++ b/usr/src/lib/libc/m32/sys/utssys.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- utssys .ident "@(#)libc-m32:sys/utssys.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/vfork.s b/usr/src/lib/libc/m32/sys/vfork.s index 8eb414b..8b778f7 100644 --- a/usr/src/lib/libc/m32/sys/vfork.s +++ b/usr/src/lib/libc/m32/sys/vfork.s @@ -1,11 +1,5 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # OS library -- vfork -.ident "@(#)libc-m32:sys/vfork.s 1.2" +.ident "@(#)libc-m32:sys/vfork.s 1.1" .file "vfork.s" .globl _cerror @@ -25,17 +19,7 @@ .set sys_vfork,119 .text -_m4_ifdef_(`ABI',` - .globl vfork -_fgdef_(vfork): -',` -_m4_ifdef_(`DSHLIB',` - .globl vfork -_fgdef_(vfork): -',` _fwdef_(`vfork'): -') -') movw -8(%sp),%r2 # remember old %pc in %r2 movaw _sref_(.L0),-8(%sp) # arrange for RET to return here RET diff --git a/usr/src/lib/libc/m32/sys/wait.s b/usr/src/lib/libc/m32/sys/wait.s index dfa1761..0304ecb 100644 --- a/usr/src/lib/libc/m32/sys/wait.s +++ b/usr/src/lib/libc/m32/sys/wait.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- wait .ident "@(#)libc-m32:sys/wait.s 1.9" diff --git a/usr/src/lib/libc/m32/sys/waitid.s b/usr/src/lib/libc/m32/sys/waitid.s index 51e513e..6d13829 100644 --- a/usr/src/lib/libc/m32/sys/waitid.s +++ b/usr/src/lib/libc/m32/sys/waitid.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/waitid.s 1.1" diff --git a/usr/src/lib/libc/m32/sys/write.s b/usr/src/lib/libc/m32/sys/write.s index ce49dab..31ca148 100644 --- a/usr/src/lib/libc/m32/sys/write.s +++ b/usr/src/lib/libc/m32/sys/write.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # C library -- write .ident "@(#)libc-m32:sys/write.s 1.9" diff --git a/usr/src/lib/libc/m32/sys/writev.s b/usr/src/lib/libc/m32/sys/writev.s index 52c9aa9..409f531 100644 --- a/usr/src/lib/libc/m32/sys/writev.s +++ b/usr/src/lib/libc/m32/sys/writev.s @@ -1,15 +1,8 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -.ident "@(#)libc-m32:sys/writev.s 1.3" +.ident "@(#)libc-m32:sys/writev.s 1.2" # error = writev(fd, iovp, iovcnt) .set __writev,122*8 - .set ERESTART,91 .globl _cerror @@ -19,8 +12,6 @@ _fwdef_(`writev'): MOVW &__writev,%r1 GATE jgeu .noerror - CMPB &ERESTART,%r0 - BEB writev jmp _cerror .noerror: RET diff --git a/usr/src/lib/libc/m32/sys/xmknod.s b/usr/src/lib/libc/m32/sys/xmknod.s index 82d1d21..fad8b01 100644 --- a/usr/src/lib/libc/m32/sys/xmknod.s +++ b/usr/src/lib/libc/m32/sys/xmknod.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/xmknod.s 1.1" # error = _xmknod(version, string, mode, dev) diff --git a/usr/src/lib/libc/m32/sys/xstat.s b/usr/src/lib/libc/m32/sys/xstat.s index dca8620..aa13a98 100644 --- a/usr/src/lib/libc/m32/sys/xstat.s +++ b/usr/src/lib/libc/m32/sys/xstat.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libc-m32:sys/xstat.s 1.1" # error = _xstat(version, string, statbuf) diff --git a/usr/src/lib/libc/port/gen/_ctype.c b/usr/src/lib/libc/port/gen/_ctype.c index 6b9eaa4..906eeb3 100644 --- a/usr/src/lib/libc/port/gen/_ctype.c +++ b/usr/src/lib/libc/port/gen/_ctype.c @@ -5,10 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/_ctype.c 1.3" +#ident "@(#)libc-port:gen/_ctype.c 1.2" +#ifndef ABI #ifdef __STDC__ #pragma weak _ctype = __ctype #endif +#endif #include "synonyms.h" #include #include "_locale.h" diff --git a/usr/src/lib/libc/port/gen/_locale.c b/usr/src/lib/libc/port/gen/_locale.c index eab8def..39c21a2 100644 --- a/usr/src/lib/libc/port/gen/_locale.c +++ b/usr/src/lib/libc/port/gen/_locale.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/_locale.c 1.5" +#ident "@(#)libc-port:gen/_locale.c 1.4" #include "synonyms.h" #include #include "_locale.h" @@ -45,8 +45,8 @@ char * _fullocale(loc, file) /* "/usr/lib/locale//" */ const char *loc, *file; { - static char ans[18 + 2 * LC_NAMELEN] = "/usr/lib/locale/"; - register char *p = ans + 16; + static char ans[14 + 2 * LC_NAMELEN] = "/usr/lib/locale/"; + register char *p = ans + 12; (void)strcpy(p, loc); p += strlen(loc); diff --git a/usr/src/lib/libc/port/gen/_set_tab.c b/usr/src/lib/libc/port/gen/_set_tab.c index ec8214c..b6e5a1c 100644 --- a/usr/src/lib/libc/port/gen/_set_tab.c +++ b/usr/src/lib/libc/port/gen/_set_tab.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/_set_tab.c 1.7" +#ident "@(#)libc-port:gen/_set_tab.c 1.6" /* * _set_tab - set _ctype[], _numeric[] to requested locale-based info. */ @@ -14,7 +14,7 @@ #include "_locale.h" #include #include -#include +#include int _set_tab(loc, cat) diff --git a/usr/src/lib/libc/port/gen/_xftw.c b/usr/src/lib/libc/port/gen/_xftw.c index 4973a60..1f0b0cb 100644 --- a/usr/src/lib/libc/port/gen/_xftw.c +++ b/usr/src/lib/libc/port/gen/_xftw.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/_xftw.c 1.3" +#ident "@(#)libc-port:gen/_xftw.c 1.2" /*LINTLIBRARY*/ /*************************************************************** * _xftw - file tree walk the uses expanded stat structure @@ -77,7 +77,6 @@ #endif #include "synonyms.h" -#include "shlib.h" #include #include #include diff --git a/usr/src/lib/libc/port/gen/aread.c b/usr/src/lib/libc/port/gen/aread.c new file mode 100644 index 0000000..deb6f4c --- /dev/null +++ b/usr/src/lib/libc/port/gen/aread.c @@ -0,0 +1,80 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + + +#ident "@(#)libc-port:gen/aread.c 1.3" + +#include "synonyms.h" +#include +#include +#include +#include +#include +#include +#include + +#ifdef i386 + +#include + +#else /* 3b2, default */ + +#include +#include + +#endif + +#include +#include +#include +#include + +extern int errno; + +#define NULL 0 +#define READ 3 +#define ASYNC 111 + +int +__aread(ver, fildes, bufp, bufs, ecbp) +int ver; +int fildes; +char *bufp; +uint bufs; +ecb_t *ecbp; +{ + register asyncop_t *aioreqp; + register int ret; + + + if ((aioreqp = (asyncop_t *)malloc(sizeof(asyncop_t))) == NULL) { + errno = EAGAIN; + return(-1); + } + + aioreqp->a_syscall = READ; + aioreqp->a_sysarg[0] = fildes; + aioreqp->a_sysarg[1] = (int) bufp; + aioreqp->a_sysarg[2] = (int) bufs; + aioreqp->a_flags = 0; + aioreqp->a_ecb = *ecbp; + + ret = _syscall(ASYNC, ver, aioreqp, 1); + + if (ret == 1) /* if request is accepted */ + ret = 0; + else if (ret == 0) { /* local error encountered */ + errno = aioreqp->a_error; + ret = -1; + } + + /* if global error encountered */ + /* return code and errno should be set already */ + + free(aioreqp); + return(ret); +} diff --git a/usr/src/lib/libc/port/gen/assert.c b/usr/src/lib/libc/port/gen/assert.c index 5852ce1..605bd46 100644 --- a/usr/src/lib/libc/port/gen/assert.c +++ b/usr/src/lib/libc/port/gen/assert.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/assert.c 1.4.1.7" +#ident "@(#)libc-port:gen/assert.c 1.4.1.6" /*LINTLIBRARY*/ /* * called from "assert" macro; prints without printf or stdio. @@ -17,7 +17,7 @@ #include "synonyms.h" #include #include -#include +#include #define WRITE(s, n) (void) write(2, (s), (n)) diff --git a/usr/src/lib/libc/port/gen/asyncio.c b/usr/src/lib/libc/port/gen/asyncio.c new file mode 100644 index 0000000..d4976f2 --- /dev/null +++ b/usr/src/lib/libc/port/gen/asyncio.c @@ -0,0 +1,103 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + + +#ident "@(#)libc-port:gen/asyncio.c 1.2" + +#include "synonyms.h" +#include +#include +#include +#include +#include +#include +#include + +#ifdef i386 + +#include + +#else /* 3b2, default */ + +#include +#include + +#endif + +#include +#include +#include +#include + +extern int errno; + +#define NULL 0 +#define ASYNC 111 +#define READ 3 +#define WRITE 4 + +int +__asyncio(ver, aiop, aios) +int ver; +register aioop_t *aiop; +int aios; +{ + + register asyncop_t *aioreqp; + register asyncop_t *curp; + register aioop_t *caiop; + register i; + int ret; + + if (aios <= 0) { + errno = EINVAL; + return(-1); + } + + /* if error */ + if ((aioreqp = (asyncop_t *)malloc(aios * sizeof(asyncop_t))) == NULL) { + errno = EAGAIN; + return(-1); + } + + caiop = aiop; + for (i = 0, curp = aioreqp; i < aios; i++, curp++, caiop++) { + if (caiop->aio_cmd == AIOC_READ) + curp->a_syscall = READ; + else if (caiop->aio_cmd == AIOC_WRITE) + curp->a_syscall = WRITE; + else { + curp->a_flags = caiop->aio_flags & AIOF_UFLAGS | AIOF_ERROR; + curp->a_error = EINVAL; + continue; + } + + curp->a_sysarg[0] = caiop->aio_fd; + curp->a_sysarg[1] = (int) caiop->aio_bufp; + curp->a_sysarg[2] = caiop->aio_bufs; + curp->a_flags = caiop->aio_flags & AIOF_UFLAGS; + curp->a_offset = caiop->aio_offset; + curp->a_error = 0; + curp->a_pri = caiop->aio_pri; + curp->a_ecb = caiop->aio_ecb; + } + + ret = _syscall(ASYNC, ver, aioreqp, aios); + + for (i = 0, curp = aioreqp; i < aios; i++, curp++, aiop++) { + if ((curp->a_flags & AIOF_PROCESS) == 0) + break; + else { + aiop->aio_flags = curp->a_flags; + aiop->aio_error = curp->a_error; + } + } + + free(aioreqp); + + return(ret); +} diff --git a/usr/src/lib/libc/port/gen/awrite.c b/usr/src/lib/libc/port/gen/awrite.c new file mode 100644 index 0000000..08b8287 --- /dev/null +++ b/usr/src/lib/libc/port/gen/awrite.c @@ -0,0 +1,81 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + + +#ident "@(#)libc-port:gen/awrite.c 1.2" + +#include "synonyms.h" +#include +#include +#include +#include +#include +#include +#include + +#ifdef i386 + +#include + +#else /* 3b2, default */ + +#include +#include + +#endif + +#include +#include +#include +#include + +extern int errno; + +#define NULL 0 +#define WRITE 4 +#define ASYNC 111 + +int +__awrite(ver, fildes, bufp, bufs, ecbp) +int ver; +int fildes; +char *bufp; +uint bufs; +ecb_t *ecbp; +{ + + register asyncop_t *aioreqp; + register int ret; + + + if ((aioreqp = (asyncop_t *)malloc(sizeof(asyncop_t))) == NULL) { + errno = EAGAIN; + return(-1); + } + + aioreqp->a_syscall = WRITE; + aioreqp->a_sysarg[0] = fildes; + aioreqp->a_sysarg[1] = (int) bufp; + aioreqp->a_sysarg[2] = (int) bufs; + aioreqp->a_flags = 0; + aioreqp->a_ecb = *ecbp; + + ret = _syscall(ASYNC, ver, aioreqp, 1); + + if (ret == 1) /* if request is accepted */ + ret = 0; + else if (ret == 0) { /* local error encountered */ + errno = aioreqp->a_error; + ret = -1; + } + + /* if global error encountered */ + /* return code and errno should be set already */ + + free(aioreqp); + return(ret); +} diff --git a/usr/src/lib/libc/port/gen/cat_init.c b/usr/src/lib/libc/port/gen/cat_init.c index 5763be8..2e410e0 100644 --- a/usr/src/lib/libc/port/gen/cat_init.c +++ b/usr/src/lib/libc/port/gen/cat_init.c @@ -5,8 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/cat_init.c 1.3" - +#ident "@(#)libc-port:gen/cat_init.c 1.1" +#ifdef __STDC__ + #pragma weak cat_init = _cat_init + #pragma weak cat_malloc_init = _cat_malloc_init +#endif #include "synonyms.h" #include #include @@ -17,20 +20,17 @@ #include #include #include -#include extern caddr_t mmap(); extern void munmap(); extern char *malloc(); extern int errno; -extern char *_cat_itoa(); -static int cat_malloc_init(); /* * Read a catalog and init the internal structure */ -_cat_init(name, res) +cat_init(name, res) char *name; nl_catd res; { @@ -61,7 +61,6 @@ _cat_init(name, res) /* * Read a malloc catalog and init the internal structure */ -static cat_malloc_init(fd, res) int fd; nl_catd res; @@ -110,7 +109,6 @@ cat_mmp_init (fd,catname,res) int bytes; struct stat sb; caddr_t addr; - char *ptr; static int count = 1; extern char *getcwd(); @@ -152,38 +150,12 @@ cat_mmp_init (fd,catname,res) * Create the link for gettxt */ - /* sprintf(symb_name,"gencat.%x.%x",getpid(),count++); */ - strcpy(symb_name,"gencat."); - if ((ptr = _cat_itoa(getpid(), 16)) == NULL) { - munmap(addr, sb.st_size); - close(fd); - return 0; - } - strcat(symb_name, ptr); - strcat(symb_name, "."); - if ((ptr = _cat_itoa(count++, 16)) == NULL) { - munmap(addr, sb.st_size); - close(fd); - return 0; - } - strcat(symb_name, ptr); - - /* sprintf(symb_path,"%s/%s",(const char *)XOPEN_DIRECTORY,symb_name); */ - strcpy(symb_path,(const char *)XOPEN_DIRECTORY); - strcat(symb_path,"/"); - strcat(symb_path,symb_name); - - if (catname[0] == '/') { - /* sprintf(message_file,"%s%s",catname,(const char *)M_EXTENSION); */ - strcpy(message_file, catname); - strcat(message_file, (const char *)M_EXTENSION); - } else { - /* sprintf(message_file,"%s/%s%s",getcwd(buf,MAXNAMLEN),catname,(const char *)M_EXTENSION); */ - strcpy(message_file, getcwd(buf,MAXNAMLEN)); - strcat(message_file, "/"); - strcat(message_file, catname); - strcat(message_file, (const char *)M_EXTENSION); - } + sprintf(symb_name,"gencat.%x.%x",getpid(),count++); + sprintf(symb_path,"%s/%s",XOPEN_DIRECTORY,symb_name); + if (catname[0] == '/') + sprintf(message_file,"%s%s",catname,M_EXTENSION); + else + sprintf(message_file,"%s/%s%s",getcwd(buf,MAXNAMLEN),catname,M_EXTENSION); if (symlink(message_file,symb_path) < 0) { munmap(addr, sb.st_size); close(fd); @@ -209,33 +181,3 @@ cat_mmp_init (fd,catname,res) return 1; } -static const char *hex_digs = "0123456789abcdef"; -static char *buf; - -#define MAXDIGS 13 /* Max. length of an integer representation */ - -char * -_cat_itoa(num, base) -register int num; -register int base; -{ - register char *ptr; - register int len = MAXDIGS; - - if (!buf) { - if ((buf = malloc(MAXDIGS)) == NULL) - return(NULL); - } - ptr = &(buf[MAXDIGS - 1]); - *ptr = '\0'; - while (--len > 0 && num != 0) { - if (base == 16) { - *(--ptr) = hex_digs[num % 16]; - num /= 16; - } else { - *(--ptr) = num % 10 + '0'; - num /= 10; - } - } - return(ptr); -} diff --git a/usr/src/lib/libc/port/gen/catclose.c b/usr/src/lib/libc/port/gen/catclose.c index ab841f6..d38d3fb 100644 --- a/usr/src/lib/libc/port/gen/catclose.c +++ b/usr/src/lib/libc/port/gen/catclose.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/catclose.c 1.3" +#ident "@(#)libc-port:gen/catclose.c 1.1" #ifdef __STDC__ #pragma weak catclose = _catclose @@ -15,7 +15,6 @@ #include #include #include -#include extern char *setlocale(); extern int _mmp_opened; @@ -35,12 +34,7 @@ char old_locale[MAXNAMLEN]; } else if (catd->type == MKMSGS) { munmap(catd->info.g.sets,catd->info.g.size); - - /* sprintf(symb_path,"%s/%s",(const char *)XOPEN_DIRECTORY,catd->info.g.link); */ - strcpy(symb_path, (const char *)XOPEN_DIRECTORY); - strcat(symb_path, "/"); - strcat(symb_path, catd->info.g.link); - + sprintf(symb_path,"%s/%s",XOPEN_DIRECTORY,catd->info.g.link); unlink(symb_path); close(catd->info.g.fd); free (catd->info.g.link); diff --git a/usr/src/lib/libc/port/gen/catgets.c b/usr/src/lib/libc/port/gen/catgets.c index 24a40a8..90cc5fd 100644 --- a/usr/src/lib/libc/port/gen/catgets.c +++ b/usr/src/lib/libc/port/gen/catgets.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/catgets.c 1.3" +#ident "@(#)libc-port:gen/catgets.c 1.1" #ifdef __STDC__ #pragma weak catgets = _catgets @@ -15,12 +15,10 @@ #include #include #include -#include #define min(a,b) (a>b?b:a) extern char *gettxt(); extern char *setlocale(); -extern char *_cat_itoa(); char * catgets(catd, set_num, msg_num, s) @@ -91,14 +89,7 @@ catgets(catd, set_num, msg_num, s) if (msg_num > set->last_msg) return s; message_no = set->first_msg + msg_num -1; - - /* sprintf(buf,"%s:%d",catd->info.g.link,message_no); */ - strcpy(buf,catd->info.g.link); - strcat(buf,":"); - if ((p = _cat_itoa(message_no, 10)) == NULL) - return s; - strcat(buf, p); - + sprintf(buf,"%s:%d",catd->info.g.link,message_no); strcpy(old_locale,setlocale(LC_MESSAGES,"")); setlocale(LC_MESSAGES,"Xopen"); p = gettxt(buf,DFLT_MSG); diff --git a/usr/src/lib/libc/port/gen/catopen.c b/usr/src/lib/libc/port/gen/catopen.c index 6f2f2cb..36e3bcd 100644 --- a/usr/src/lib/libc/port/gen/catopen.c +++ b/usr/src/lib/libc/port/gen/catopen.c @@ -5,9 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/catopen.c 1.3" +#ident "@(#)libc-port:gen/catopen.c 1.1" #ifdef __STDC__ + #pragma weak cat_name = _cat_name #pragma weak catopen = _catopen #endif #include "synonyms.h" @@ -16,22 +17,21 @@ #include #include #include -#include -#include +char *getenv(), *strchr(), *setlocale(); +static char path[NL_MAXPATHLEN]; +static char def_nlspath[] = DEF_NLSPATH; +static struct stat buff; int _mmp_opened = 0; static char * -cat_name(name, path) +cat_name(name) char *name; - char *path; { - const char *nlspath; - const char *lang, *ptr, *ptr3; - char *ptr2, c, d; + char *nlspath; + char *lang; + char *ptr, *ptr2, *ptr3, c, d; struct stat *buf; - const char *def_nlspath = DEF_NLSPATH; - struct stat buff; /* * A name that contains a slash is a pathname @@ -161,7 +161,6 @@ catopen(name, mode) { nl_catd catd; int fd; - char path[NL_MAXPATHLEN]; /* * Allocate space to hold the necessary data @@ -172,12 +171,12 @@ catopen(name, mode) /* * Get actual file name and open file */ - if ((name = cat_name(name,path)) != 0){ + if ((name = cat_name(name)) != 0){ /* * init internal data structures */ - if (_cat_init(name, catd)) + if (cat_init(name, catd)) return catd; } diff --git a/usr/src/lib/libc/port/gen/cftime.c b/usr/src/lib/libc/port/gen/cftime.c index b54f96a..f8508a1 100644 --- a/usr/src/lib/libc/port/gen/cftime.c +++ b/usr/src/lib/libc/port/gen/cftime.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/cftime.c 1.15" +#ident "@(#)libc-port:gen/cftime.c 1.14" /*LINTLIBRARY*/ /* * This routine converts time as follows. The epoch is 0000 Jan 1 @@ -67,7 +67,7 @@ const struct tm *tm; /* Set format string, if not already set */ if (format == NULL || *format == '\0') if (((format = getenv("CFTIME")) == 0) || *format == 0) - format = "%C"; + format = "%c"; return(strftime(buf, LONG_MAX, format, tm)); } diff --git a/usr/src/lib/libc/port/gen/crypt.c b/usr/src/lib/libc/port/gen/crypt.c index 03936f1..d9df7be 100644 --- a/usr/src/lib/libc/port/gen/crypt.c +++ b/usr/src/lib/libc/port/gen/crypt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/crypt.c 1.11" +#ident "@(#)libc-port:gen/crypt.c 1.10" /*LINTLIBRARY*/ /* * This program implements a data encryption algorithm to encrypt passwords. @@ -16,7 +16,6 @@ #pragma weak setkey = _setkey #endif #include "synonyms.h" -#include static const char IP[] = { 58,50,42,34,26,18,10, 2, @@ -187,10 +186,6 @@ int fake; register int t, j, k; char *R = &L[32]; - if (fake != 0) { - errno = ENOSYS; - return; - } for(j=0; j < 64; j++) L[j] = block[IP[j]-1]; for(i=0; i < 16; i++) { diff --git a/usr/src/lib/libc/port/gen/ctype.c b/usr/src/lib/libc/port/gen/ctype.c index 3373ad1..dcc78de 100644 --- a/usr/src/lib/libc/port/gen/ctype.c +++ b/usr/src/lib/libc/port/gen/ctype.c @@ -5,21 +5,58 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/ctype.c 1.13" - -#ifdef __STDC__ - #pragma weak setchrclass = _setchrclass -#endif +#ident "@(#)libc-port:gen/ctype.c 1.12" #include "synonyms.h" -#include +#include +#include +#include +#include + +#define CCLASS_ROOT "/usr/lib/chrclass/"/* root for character classes */ +#define LEN_CC_ROOT 14 /* length of CCLASS_ROOT */ +#define DEFL_CCLASS "ascii" /* default character class */ +#define SZ 514 + +static char first_call = 1; int -setchrclass(ccname) +_setchrclass(ccname) const char *ccname; { - if (ccname == 0) - ccname = ""; - if (setlocale(LC_CTYPE, ccname) == NULL) - return(-1); - return(0); + char pathname[128]; + char my_ctype[SZ]; /* local copy */ + register int fd, ret = -1; + + /* + * If no character class name supplied, use the CHRCLASS env. variable. + */ + if (ccname == 0 && ((ccname = getenv("CHRCLASS")) == 0 || ccname[0] == '\0')) + { + /* + * If this is the first call to setchrclass() then there is + * nothing else to do here. If this is a subsequent call + * to setchrclass() and if _ctype[] was set to anything but + * the default, the pathname[] array would have been changed. + * Thus, in this case, actually do the reset to "ascii". + */ + if (first_call) + return (0); + ccname = DEFL_CCLASS; + } + first_call = 0; + (void)strcpy(pathname, CCLASS_ROOT); + (void)strcpy(&pathname[LEN_CC_ROOT], ccname); + if ((fd = open(pathname, O_RDONLY)) >= 0) + { + if (read(fd, my_ctype, SZ) == SZ) + { + /* + * Update _ctype[] only after everything works. + */ + (void)memcpy(_ctype, my_ctype, SZ); + ret = 0; + } + (void)close(fd); + } + return (ret); } diff --git a/usr/src/lib/libc/port/gen/ctypefcns.c b/usr/src/lib/libc/port/gen/ctypefcns.c index 52f94e6..724653a 100644 --- a/usr/src/lib/libc/port/gen/ctypefcns.c +++ b/usr/src/lib/libc/port/gen/ctypefcns.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/ctypefcns.c 1.4" +#ident "@(#)libc-port:gen/ctypefcns.c 1.3" #include "synonyms.h" #include @@ -25,13 +25,6 @@ #undef _tolower #undef toascii -#ifdef __STDC__ - #pragma weak isascii = _isascii - #pragma weak toascii = _toascii -#define isascii _isascii -#define toascii _toascii -#endif - int isalpha(c) int c; diff --git a/usr/src/lib/libc/port/gen/dial.mk b/usr/src/lib/libc/port/gen/dial.mk new file mode 100644 index 0000000..162e804 --- /dev/null +++ b/usr/src/lib/libc/port/gen/dial.mk @@ -0,0 +1,121 @@ +# Copyright (c) 1988 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)libc-port:gen/dial.mk 1.1" +# +# makefile for dial(3) +# +# + +.SUFFIXES: .p +CC=cc +CFLAGS= -O -DSTANDALONE -DDIAL +PROF= +NONPROF= +ROOT= +INC=$(ROOT)/usr/include +INCSYS=$(ROOT)/usr/include/sys +INCLIBC= ../../inc +DEFLIST= +SDEFLIST= +INCLIST=-I$(INCLIBC) -I$(UUDIR) +UUDIR=$(ROOT)/usr/src/cmd/uucp + +DIALOBJ= callers.o conn.o getargs.o interface.o line.o stoa.o strecpy.o \ + strsave.o sysfiles.o ulockf.o + +DIALPOBJ= callers.p conn.p getargs.p interface.p line.p stoa.p strecpy.p \ + strsave.p sysfiles.p ulockf.p + +.c.o .c.p: + $(NONPROF)@echo $*.c: + $(NONPROF)$(CC) $(DEFLIST) $(SDEFLIST) $(INCLIST) $(CFLAGS) -c $*.c + $(PROF)@echo $*.c: + $(PROF)$(CC) $(DEFLIST) $(INCLIST) $(CFLAGS) -c -p $*.c && mv $(*F).o $*.p + +# OBJECTS +dial.o: $(INC)/dial.h $(INCSYS)/termio.h $(INC)/errno.h $(INCSYS)/errno.h \ + $(INC)/fcntl.h $(INC)/signal.h $(INCSYS)/signal.h $(INC)/string.h \ + $(DIALOBJ) + $(NONPROF)@echo dial.c: + $(NONPROF)$(CC) $(DEFLIST) $(SDEFLIST) $(INCLIST) \ + $(CFLAGS) -c dial.c + $(NONPROF)mv dial.o dialsub.o + $(NONPROF)$(LD) -r dialsub.o $(DIALOBJ) -o dial.o + +callers.o: $(UUDIR)/callers.c $(UUDIR)/uucp.h $(UUDIR)/parms.h + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/callers.c + +conn.o: $(UUDIR)/conn.c + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/conn.c + +getargs.o: $(UUDIR)/getargs.c $(UUDIR)/uucp.h $(UUDIR)/parms.h + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/getargs.c + +interface.o: $(UUDIR)/interface.c $(UUDIR)/uucp.h + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/interface.c + +line.o: $(UUDIR)/line.c $(UUDIR)/uucp.h + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/line.c + +stoa.o: $(UUDIR)/stoa.c + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/stoa.c + +strecpy.o: $(UUDIR)/strecpy.c + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/strecpy.c + +strsave.o: $(UUDIR)/strsave.c + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/strsave.c + +sysfiles.o: $(UUDIR)/sysfiles.c $(UUDIR)/sysfiles.h + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/sysfiles.c + +ulockf.o: $(UUDIR)/ulockf.c $(UUDIR)/uucp.h $(UUDIR)/parms.h + $(NONPROF)$(CC) -c $(CFLAGS) $(UUDIR)/ulockf.c + + + +# POBJECTS +dial.p: $(INC)/dial.h $(INCSYS)/termio.h $(INC)/errno.h $(INCSYS)/errno.h \ + $(INC)/fcntl.h $(INC)/signal.h $(INCSYS)/signal.h $(INC)/string.h \ + $(DIALPOBJ) + $(PROF)@echo dial.c: + $(PROF)$(CC) $(DEFLIST) $(SDEFLIST) $(INCLIST) \ + $(CFLAGS) -c -p dial.c + $(PROF)mv dial.o dialsub.o + $(PROF)$(LD) -r dialsub.o $(DIALPOBJ) -o dial.o + $(PROF)mv dial.o dial.p + +callers.p: $(UUDIR)/callers.c $(UUDIR)/uucp.h $(UUDIR)/parms.h + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/callers.c && mv callers.o callers.p + +conn.p: $(UUDIR)/conn.c + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/conn.c && mv conn.o conn.p + +getargs.p: $(UUDIR)/getargs.c $(UUDIR)/uucp.h $(UUDIR)/parms.h + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/getargs.c && mv getargs.o getargs.p + +interface.p: $(UUDIR)/interface.c $(UUDIR)/uucp.h + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/interface.c && mv interface.o interface.p + +line.p: $(UUDIR)/line.c $(UUDIR)/uucp.h + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/line.c && mv line.o line.p + +stoa.p: $(UUDIR)/stoa.c + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/stoa.c && mv stoa.o stoa.p + +strecpy.p: $(UUDIR)/strecpy.c + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/strecpy.c && mv strecpy.o strecpy.p + +strsave.p: $(UUDIR)/strsave.c + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/strsave.c && mv strsave.o strsave.p + +sysfiles.p: $(UUDIR)/sysfiles.c $(UUDIR)/sysfiles.h + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/sysfiles.c && mv sysfiles.o sysfiles.p + +ulockf.p: $(UUDIR)/ulockf.c $(UUDIR)/uucp.h $(UUDIR)/parms.h + $(PROF)$(CC) -c -p $(CFLAGS) $(UUDIR)/ulockf.c && mv ulockf.o ulockf.p diff --git a/usr/src/lib/libc/port/gen/dup2.c b/usr/src/lib/libc/port/gen/dup2.c index bb863bd..c58e2b2 100644 --- a/usr/src/lib/libc/port/gen/dup2.c +++ b/usr/src/lib/libc/port/gen/dup2.c @@ -5,14 +5,14 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/dup2.c 1.8" +#ident "@(#)libc-port:gen/dup2.c 1.7" #ifdef __STDC__ #pragma weak dup2 = _dup2 #endif #include "synonyms.h" #include /* Get definition for OPEN_MAX */ #include -#include +#include #include /* Get definition for EBADF */ int diff --git a/usr/src/lib/libc/port/gen/errlist b/usr/src/lib/libc/port/gen/errlist index a7aba1e..c215a95 100644 --- a/usr/src/lib/libc/port/gen/errlist +++ b/usr/src/lib/libc/port/gen/errlist @@ -1,10 +1,4 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -#ident "@(#)libc-port:gen/errlist 1.10" +#ident "@(#)libc-port:gen/errlist 1.5" 1 Not owner 2 No such file or directory @@ -75,7 +69,6 @@ 74 Multihop attempted 77 Not a data message 78 File name too long -79 Value too large for defined data type 80 Name not unique on network 81 File descriptor in bad state 82 Remote address changed @@ -87,27 +80,27 @@ 89 Operation not applicable 90 Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS 93 Directory not empty -94 Too many users -95 Socket operation on non-socket -96 Destination address required -97 Message too long -98 Protocol wrong type for socket -99 Option not supported by protocol -120 Protocol not supported -121 Socket type not supported -122 Operation not supported on transport endpoint -123 Protocol family not supported -124 Address family not supported by protocol family -125 Address already in use -126 Cannot assign requested address -127 Network is down -128 Network is unreachable -129 Network dropped connection because of reset -130 Software caused connection abort -131 Connection reset by peer -132 No buffer space available -133 Transport endpoint is already connected -134 Transport endpoint is not connected +94 Protocol not support +95 Option not support by protocol +96 Socket operation on non-socket +97 Destination address required +98 Message too long +99 Protocal wrong type for socket +120 Socket type not supported +121 Operation not supported on socket +122 Protocol family not supported +123 Address family not supported by protocol family +124 Address already in use +125 Cannot assign requested address +126 Network is down +127 Network is unreachable +128 Network dropped connection because of reset +129 Software caused connection abort +130 Connection reset by peer +131 No buffer space available +132 Socket is already connected +133 Socket is not connected +134 Cannot send after socket shutdown 135 Structure needs cleaning 137 Not a name file 138 Not available @@ -115,12 +108,11 @@ 140 Remote I/O error 141 Reserved for future use 142 -143 Cannot send after socket shutdown -144 Too many references: cannot splice -145 Connection timed out -146 Connection refused -147 Host is down -148 No route to host -149 Operation already in progress -150 Operation now in progress -151 Stale NFS file handle +143 Too many references: cannot splice +144 Connection timed out +145 Connection refused +146 Host is down +147 No route to host +148 Operation already in progress +149 Operation now in progress +150 Stale NFS file handle diff --git a/usr/src/lib/libc/port/gen/errlist.awk b/usr/src/lib/libc/port/gen/errlist.awk index bf232b0..b33b0eb 100644 --- a/usr/src/lib/libc/port/gen/errlist.awk +++ b/usr/src/lib/libc/port/gen/errlist.awk @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)libc-port:gen/errlist.awk 1.1" # create two files from a list of input strings, diff --git a/usr/src/lib/libc/port/gen/events.c b/usr/src/lib/libc/port/gen/events.c new file mode 100644 index 0000000..8471259 --- /dev/null +++ b/usr/src/lib/libc/port/gen/events.c @@ -0,0 +1,472 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/events.c 1.2" +#include "synonyms.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* File Contents +** ============= +** +** This file contains the library routines which convert the +** events function calls to the appropriate system calls. +** The arguments to all of these functions are described on +** the events manual pages. A description of how this interface +** works as well as the definitions of all of the interface +** structures can be found in sys/fs/evsyscall.h. +*/ + + +/* Change History +** ============== +** +** 9/1/87 Original development by Steve Buroff. +*/ + + +/* Miscellaneous Definitions +** ========================= +** +** I find the following handy. +*/ + +#define reg register + + +/* External References +** =================== +** +** We check errno in order to implement restartable system calls. +*/ + +extern int errno; + +/* The __evpost Function +** ===================== +** +** Function to post one or more events to event queues. +*/ + +int +__evpost(ver, elp, els, flags) +reg const evver_t ver; +reg event_t *const elp; +reg const int els; +reg const int flags; +{ + reg evsys_post_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_post_t evsysb; /* The interface */ + /* buffer. */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + ep = &evsysb; + ep->evs_post_elp = elp; + ep->evs_post_els = els; + ep->evs_post_flags = flags; + + /* Now do the evsys. Its return value is the return value + ** for the function. Keep trying if we get ERESTART. + */ + + do { + rval = evsys(EVS_EVPOST, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evpoll Function +** ===================== +** +** Function to poll to determine if an event expression is +** satisfied. +*/ + +int +__evpoll(ver, cmd, elp, els, top) +reg const evver_t ver; +reg const evpollcmds_t cmd; +reg event_t *const elp; +reg const int els; +reg const hrtime_t *const top; +{ + reg evsys_poll_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_poll_t evsysb; /* The interface */ + /* buffer. */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + ep = &evsysb; + ep->evs_poll_cmd = cmd; + ep->evs_poll_elp = elp; + ep->evs_poll_els = els; + ep->evs_poll_top = top; + + /* Now do the evsys. Its return value is the return value + ** for the function. Keep trying if we get ERESTART. + */ + + do { + rval = evsys(EVS_EVPOLL, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evpollmore Function +** ========================= +** +** Function to poll after an evpoll or evtrap returned one or more +** events with the EF_MORE flag set in ev_flags. +*/ + +int +__evpollmore(ver, elp, els) +reg const evver_t ver; +reg event_t *const elp; +reg const int els; +{ + reg evsys_pollmore_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_pollmore_t evsysb; /* The interface */ + /* buffer. */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + ep = &evsysb; + ep->evs_pollmore_elp = elp; + ep->evs_pollmore_els = els; + + /* Now do the evsys. Its return value is the return value + ** for the function. Keep trying if we get ERESTART. + */ + + do { + rval = evsys(EVS_EVPOLLMORE, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evtrap Function +** ===================== +** +** Function to specify that a trap handler should be called when +** a specified event expression is satisfied. +*/ + +int +__evtrap(ver, cmd, elp, els, tid, handlerp, tap) +reg const evver_t ver; +reg const evpollcmds_t cmd; +reg event_t *const elp; +reg const int els; +const long tid; +reg void (*const handlerp)(); +const evta_t *const tap; +{ + reg evsys_trap_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_trap_t evsysb; /* The interface */ + /* buffer. */ + + void ev_traptousr(); + /* The function which */ + /* will call the actual */ + /* user trap handler */ + /* routine. The */ + /* ev_traptousr */ + /* function gets */ + /* control from the */ + /* kernel but not by a */ + /* normal call. The */ + /* stack is in a */ + /* special state (see */ + /* the evsys.s file). */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + ep = &evsysb; + ep->evs_trap_cmd = cmd; + ep->evs_trap_elp = elp; + ep->evs_trap_els = els; + ep->evs_trap_tid = tid; + ep->evs_trap_lfunc = ev_traptousr; + ep->evs_trap_ufunc = handlerp; + ep->evs_trap_tap = tap; + + /* Now do the evsys. Its return value is the return value + ** for the function. Try again if we get ERESTART. + */ + + do { + rval = evsys(EVS_EVTRAP, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evtrapcancel Function +** ============================= +** +** Function to cancel one or more active trap expressions with the +** same trap identifier. +*/ + +int +__evtrapcancel(ver, tidp, tids) +reg const evver_t ver; +reg long *const tidp; +reg const int tids; +{ + reg evsys_trapcan_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_trapcan_t evsysb; /* The interface */ + /* buffer. */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + ep = &evsysb; + ep->evs_trapcan_tidp = tidp; + ep->evs_trapcan_tids = tids; + + /* Now do the evsys. Its return value is the return value + ** for the function. Keep trying if we get ERESTART. + */ + + do { + rval = evsys(EVS_EVTRAPCAN, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evcntl Function +** ===================== +** +** Function to perform event control operations which do not apply +** to any particular event queue. +*/ + +int +__evcntl(ver, cmd, arg1, arg2) +reg const evver_t ver; +reg const evcntlcmds_t cmd; +reg const long arg1; +reg const long arg2; +{ + reg evsys_cntl_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_cntl_t evsysb; /* The interface */ + /* buffer. */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + ep = &evsysb; + ep->evs_cntl_cmd = cmd; + ep->evs_cntl_arg1 = arg1; + ep->evs_cntl_arg2 = arg2; + + /* Now do the evsys. Its return value is the return value + ** for the function. Try again if we get ERESTART. + */ + + do { + rval = evsys(EVS_EVCNTL, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evqcntl Function +** ====================== +** +** Function to perform event control operations which apply to a +** particular event queue. +*/ + +int +__evqcntl(ver, eqd, cmd, arg) +reg const evver_t ver; +reg const int eqd; +reg const evqcntlcmds_t cmd; +reg const long arg; +{ + reg evsys_qcntl_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_qcntl_t evsysb; /* The interface */ + /* buffer. */ + + /* Set up the interface buffer with the parameters from + ** the function call. + */ + + ep = &evsysb; + ep->evs_qcntl_eqd = eqd; + ep->evs_qcntl_cmd = cmd; + ep->evs_qcntl_arg = arg; + + /* Now do the evsys. Its return value is the return value + ** for the function. Try again if we get ERESTART. + */ + + do { + rval = evsys(EVS_EVQCNTL, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evexit Function +** ===================== +** +** Function to cause an event to be posted when a process exits. +** This is just a simple interface to evexitset. +*/ + +int +__evexit(ver, idtype, id, ecbp) +reg const evver_t ver; +reg const idtype_t idtype; +reg const id_t id; +reg const ecb_t *const ecbp; +{ + reg procset_t *psp; /* Ptr to the process set we */ + /* construct. */ + procset_t pset; /* The process set we are going */ + /* to construct. */ + + /* Build a procset_t structure which is equivalent to + ** the simple request specified by idtype and id. + */ + + psp = &pset; + psp->p_op = POP_AND; + psp->p_lidtype = idtype; + psp->p_lid = id; + psp->p_ridtype = P_ALL; + + /* Now just do an evexitset. + */ + + return(__evexitset(ver, psp, P_MYHOSTID, ecbp)); + +} + +/* The __evexitset Function +** ======================== +** +** Function to cause an event to be posted when each of a set of +** processes exits. +*/ + +int +__evexitset(ver, psp, hostid, ecbp) +reg const evver_t ver; +reg const procset_t *const psp; +reg const hostid_t hostid; +reg const ecb_t *const ecbp; +{ + reg evsys_exit_t *ep; /* A ptr to the */ + /* interface buffer. */ + reg int rval; /* Return value. */ + evsys_exit_t evsysb; /* The interface */ + /* buffer. */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + + ep = &evsysb; + ep->evs_exit_psp = psp; + ep->evs_exit_hostid = hostid; + ep->evs_exit_ecbp = ecbp; + + /* Now do the evsys system call. Try again if we get + ** ERESTART. + */ + + do { + rval = evsys(EVS_EVEXIT, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} + +/* The __evsig Function +** ==================== +** +** Function to cause an event to be generated when a signal is sent +** to a process. +*/ + +int +__evsig(ver, sigsetp, ecbp, silp, sils) +reg const evver_t ver; +reg const sigset_t *const sigsetp; +reg const ecb_t *const ecbp; +reg evsiginfo_t *const silp; +reg const int sils; +{ + reg evsys_sig_t *ep; /* A ptr to the interface */ + /* buffer. */ + reg int rval; /* Return value. */ + evsys_sig_t evsysb; /* The interface buffer. */ + + /* Set up the interface structure with the parameters from + ** the function call. + */ + + + ep = &evsysb; + ep->evs_sig_setp = sigsetp; + ep->evs_sig_ecbp = ecbp; + ep->evs_sig_silp = silp; + ep->evs_sig_sils = sils; + + /* Now do the evsys system call. Try again if ERESTART is + ** returned. + */ + + do { + rval = evsys(EVS_EVSIG, ver, ep); + } while(rval == -1 && errno == ERESTART); + + return(rval); +} diff --git a/usr/src/lib/libc/port/gen/execvp.c b/usr/src/lib/libc/port/gen/execvp.c index 248dc1e..c413644 100644 --- a/usr/src/lib/libc/port/gen/execvp.c +++ b/usr/src/lib/libc/port/gen/execvp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/execvp.c 1.20" +#ident "@(#)libc-port:gen/execvp.c 1.16" /*LINTLIBRARY*/ /* * execlp(name, arg,...,0) (like execl, but does path search) @@ -46,7 +46,7 @@ execlp(name, va_alist) char *name; va_dcl int execvp(name, argv) -char *name, *const *argv; +char *name, **argv; { const char *pathstr; char fname[128]; @@ -56,12 +56,8 @@ char *name, *const *argv; register unsigned etxtbsy=1; register int eacces=0; - if (*name == '\0') { - errno = ENOENT; - return(-1); - } if((pathstr = getenv("PATH")) == NULL) - pathstr = "/sbin:/usr/bin:"; + pathstr = "/bin:/usr/bin:"; cp = strchr(name, '/')? (const char *)"": pathstr; do { @@ -78,7 +74,7 @@ char *name, *const *argv; return(-1); } } - (void) execv((const char *)"/sbin/sh", newargs); + (void) execv((const char *)"/bin/sh", newargs); return(-1); case ETXTBSY: if(++etxtbsy > 5) diff --git a/usr/src/lib/libc/port/gen/fmtmsg.c b/usr/src/lib/libc/port/gen/fmtmsg.c index de4603d..f27c40e 100644 --- a/usr/src/lib/libc/port/gen/fmtmsg.c +++ b/usr/src/lib/libc/port/gen/fmtmsg.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/fmtmsg.c 1.9" +#ident "@(#)libc-port:gen/fmtmsg.c 1.7" /*LINTLIBRARY*/ @@ -31,7 +31,6 @@ * UNIX file control definitions * UNIX error numbers and definitions * Global definitions for fmtmsg() - * miscellaneous function declarations */ #ifdef __STDC__ @@ -39,13 +38,12 @@ #pragma weak addseverity = _addseverity #endif #include "synonyms.h" -#include "shlib.h" +#include "shlib.h" #include #include #include #include #include -#include /* * External functions referenced: @@ -58,6 +56,10 @@ * clearerr Clears an error on a stream (this is to make "lint" happy) */ +extern char *getenv(); +extern VOID *malloc(); +extern void free(); +extern long strtol(); #ifdef lint extern void clearerr(); #endif @@ -264,15 +266,10 @@ static struct sevstr *pstdsevs = &sevstrs[0]; * The '\' character also must be escaped. */ -#if __STDC__ -static char * -exttok(const char *tok, const char *delims) -#else static char * exttok(tok, delims) char *tok; /* Ptr to the token we're parsing */ char *delims; /* Ptr to string with delimiters */ -#endif { /* Automatic Data */ @@ -849,6 +846,7 @@ writemsg(stream, verbosity, label, severity, text, action, tag) if (psev == (struct sevstr *) NULL) { /* Use default string, SV=severity */ + /* SOMEDAY don't use sprintf()! It's too big */ (void) sprintf(sevpstrbuf, "SV=%d", severity); sevpstr = sevpstrbuf; @@ -867,7 +865,7 @@ writemsg(stream, verbosity, label, severity, text, action, tag) /* - * Figure out the indents. + * Figure out the indents. What a mess. */ if (doaction && dotext) { diff --git a/usr/src/lib/libc/port/gen/getgrbuf.c b/usr/src/lib/libc/port/gen/getgrbuf.c new file mode 100644 index 0000000..113b6d3 --- /dev/null +++ b/usr/src/lib/libc/port/gen/getgrbuf.c @@ -0,0 +1,63 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/getgrbuf.c 1.1" +/* 3.0 SID # 1.2 */ +/*LINTLIBRARY*/ +#include "synonyms.h" +#include +#include +#include + + +static char * +grskip(p, c) +char *p; +int c; +{ + while (*p != '\0' && *p != c) + ++p; + if (*p != '\0') + *p++ = '\0'; + return(p); +} + +struct group * +#ifdef __STDC__ +_getgrbuf(struct group *grp, char *line, void *(*alloc)(size_t)) +#else +_getgrbuf(grp, line, alloc) + struct group *grp; + char *line; + char (*alloc)(); +#endif +{ + char *p = line, **q; + + grp->gr_name = p; + grp->gr_passwd = p = grskip(p, ':'); + grp->gr_gid = atol(p = grskip(p, ':')); + p = grskip(p, ':'); + (void) grskip(p, '\n'); + { + register char *x = p; + register size_t count = 2; /* last + null */ + while (*x != '\0') + if (*x++ == ',') + ++count; + if ((q = (char **)(*alloc)(count * sizeof(char *))) == 0) + return 0; + } + grp->gr_mem = q; + while (*p != '\0') + { + *q++ = p; + p = grskip(p, ','); + } + *q = 0; + return grp; +} diff --git a/usr/src/lib/libc/port/gen/getgrent.c b/usr/src/lib/libc/port/gen/getgrent.c index 0539755..01dcbb7 100644 --- a/usr/src/lib/libc/port/gen/getgrent.c +++ b/usr/src/lib/libc/port/gen/getgrent.c @@ -5,33 +5,53 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getgrent.c 1.18" +#ident "@(#)libc-port:gen/getgrent.c 1.14" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ -#ifndef DSHLIB #ifdef __STDC__ #pragma weak getgrent = _getgrent #pragma weak fgetgrent = _fgetgrent #pragma weak endgrent = _endgrent #pragma weak setgrent = _setgrent #endif -#endif #include "synonyms.h" #include #include #include #include -#define CL ':' -#define CM ',' -#define NL '\n' -#define TRUE 1 -#define FALSE 0 +#ifdef __STDC__ + struct group *_getgrbuf(struct group *, char *, void *(*)(size_t)); +#else + struct group *_getgrbuf(); + char *malloc(); + char *realloc(); +#endif -static const char *GROUP = "/etc/group"; -static FILE *grf = NULL; +static const char GROUP[] = "/etc/group"; +static FILE *grf; static char *line, *gr_mem; -static int size, gr_size; +static struct group grp; +static size_t size, gr_size; + +#ifdef __STDC__ +static void * +alloc(size_t size) +#else +static char * +alloc(size) + size_t size; +#endif +{ + if (gr_mem != 0) + { + if (gr_size >= size) + return gr_mem; + free(gr_mem); + } + gr_size = size; + return gr_mem = malloc(size); +} void setgrent() @@ -46,40 +66,28 @@ void endgrent() { if (grf != NULL) - { + { (void) fclose(grf); grf = NULL; - } + } } static void cleanup() { if (line != NULL) - { + { free(line); line = NULL; - } + } if (gr_mem != NULL) - { + { free (gr_mem); gr_mem = NULL; - } + } (void) endgrent(); } -static char * -grskip(p, c) -char *p; -int c; -{ - while (*p != '\0' && *p != c) - ++p; - if (*p != '\0') - *p++ = '\0'; - return(p); -} - struct group * getgrent() { @@ -94,81 +102,39 @@ struct group * fgetgrent(f) FILE *f; { - char *p, **q; - int len, count; + char *p; + int len; long offset; char done; - static struct group *grp; - - if (!grp && (grp = (struct group *)malloc(sizeof(struct group))) == NULL) - return NULL; - count = 1; if (line == NULL) - { + { size = BUFSIZ+1; - if ((line = calloc((unsigned)size, sizeof(char))) == NULL) - { + if ((line = malloc(size)) == NULL) + { (void) cleanup(); return(NULL); - } } - done = FALSE; + } + done = 0; while (!done) - { + { offset = ftell(f); if ((p = fgets(line, size, f)) == NULL) return(NULL); len = strlen(p); - if ((len <= size) && (p[len-1] == NL)) - done = TRUE; + if ((len <= size) && (p[len-1] == '\n')) + done = 1; else - { + { size *= 32; - if ((line = realloc(line, (unsigned)size * sizeof(char))) == NULL) - { + if ((line = realloc(line, size)) == NULL) + { (void) cleanup(); return(NULL); - } - fseek(f, offset, 0); - } - } - grp->gr_name = p; - grp->gr_passwd = p = grskip(p, CL); - grp->gr_gid = atol(p = grskip(p, CL)); - p = grskip(p, CL); - (void) grskip(p, NL); - if (gr_mem == NULL) - { - gr_size = 2; - if ((gr_mem = calloc((unsigned)(gr_size), sizeof(char *))) == NULL) - { - (void) cleanup(); - return(NULL); } + fseek(f, offset, 0); } - grp->gr_mem = (char **)(VOID *)gr_mem; - q = grp->gr_mem; - while (*p != '\0') - { - if (count >= gr_size - 1) - { - *q = NULL; - gr_size *= 2; - if ((gr_mem = realloc(gr_mem, (unsigned)(gr_size) * sizeof(char *))) == NULL) - { - (void) cleanup(); - return(NULL); - } - grp->gr_mem = (char **)(VOID *)gr_mem; - q = grp->gr_mem; - while (*q != NULL) - q++; - } - count++; - *q++ = p; - p = grskip(p, CM); - } - *q = NULL; - return(grp); + } + return _getgrbuf(&grp, line, alloc); } diff --git a/usr/src/lib/libc/port/gen/getgrgid.c b/usr/src/lib/libc/port/gen/getgrgid.c new file mode 100644 index 0000000..8ec1855 --- /dev/null +++ b/usr/src/lib/libc/port/gen/getgrgid.c @@ -0,0 +1,34 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/getgrgid.c 1.12" +/* 3.0 SID # 1.2 */ +/*LINTLIBRARY*/ +#ifdef __STDC__ + #pragma weak getgrgid = _getgrgid +#endif +#include "synonyms.h" +#include "shlib.h" +#include +#include +#include + +extern struct group *getgrent(); +extern void setgrent(), endgrent(); + +struct group * +getgrgid(gid) +register uid_t gid; +{ + register struct group *p; + + setgrent(); + while((p = getgrent()) != NULL && p->gr_gid != gid) + ; + endgrent(); + return(p); +} diff --git a/usr/src/lib/libc/port/gen/getgrnam.c b/usr/src/lib/libc/port/gen/getgrnam.c index 1519a2a..8b7eb2b 100644 --- a/usr/src/lib/libc/port/gen/getgrnam.c +++ b/usr/src/lib/libc/port/gen/getgrnam.c @@ -5,192 +5,29 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getgrnam.c 1.16" +#ident "@(#)libc-port:gen/getgrnam.c 1.13" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ #ifdef __STDC__ #pragma weak getgrnam = _getgrnam - #pragma weak getgrgid = _getgrgid #endif #include "synonyms.h" -#include "shlib.h" -#include -#include #include -#include -#include -#include +#include - -#define GROUP "/etc/group" -static char *line, **gr_mem; -static size_t linesz, gr_cnt; -static char *buf; - -extern struct group *_grp_entry(); -extern void _grp_cleanup(), _grp_done(); -extern char *_grp_begin(); +extern struct group *getgrent(); +extern void setgrent(), endgrent(); +extern int strcmp(); struct group * getgrnam(name) register const char *name; { register struct group *p; - char *current, *after; - if ((current = _grp_begin(&after)) == 0) - return 0; - while((p = _grp_entry(¤t, after)) != 0 && strcmp(p->gr_name, name)) + setgrent(); + while((p = getgrent()) != NULL && strcmp(p->gr_name, name)) ; - if (p == 0) - _grp_cleanup(); - _grp_done(); - return(p); -} - -struct group * -getgrgid(gid) -register uid_t gid; -{ - register struct group *p; - char *current, *after; - - if ((current = _grp_begin(&after)) == 0) - return 0; - while((p = _grp_entry(¤t, after)) != 0 && p->gr_gid != gid) - ; - if (p == 0) - _grp_cleanup(); - _grp_done(); - return(p); -} - -char * -_grp_begin(pafter) - char **pafter; -{ - struct stat sb; - int fd; - size_t sz; - - if ((fd = open(GROUP, 0)) < 0) - return 0; - if (fstat(fd, &sb) != 0 - || (sz = sb.st_size) != sb.st_size - || (buf = malloc(sz)) == 0) - { - (void)close(fd); - return 0; - } - if (read(fd, buf, sz) != sz) - { - free(buf); - close(fd); - return 0; - } - close(fd); - *pafter = buf + sz; - return buf; -} - -void -_grp_cleanup() -{ - if (line != 0) - { - linesz = 0; - free(line); - line = 0; - } - if (gr_mem != 0) - { - gr_cnt = 0; - free(gr_mem); - gr_mem = 0; - } -} - - -void -_grp_done() -{ - if (buf != 0) - { - free(buf); - buf = 0; - } -} - -static char * -skip(p, c) -char *p; -int c; -{ - while (*p != '\0' && *p != c) - ++p; - if (*p != '\0') - *p++ = '\0'; + endgrent(); return(p); } - -struct group * -_grp_entry(pcur, after) - char **pcur, *after; -{ - char *p = *pcur, **q; - size_t len; - - static struct group *grp; - if (!grp && (grp = (struct group *)malloc(sizeof(struct group))) == 0) - return 0; - if ((after = memchr(p, '\n', after - p)) == 0) - return 0; - *pcur = ++after; - len = after - p; - if (linesz < len) - { - if (line) - free(line); - if ((line = malloc(len)) == 0) - { - linesz = 0; - _grp_cleanup(); - return 0; - } - linesz = len; - } - memcpy(line, p, len); - p = line; - grp->gr_name = p; - grp->gr_passwd = p = skip(p, ':'); - grp->gr_gid = atol(p = skip(p, ':')); - p = skip(p, ':'); - (void) skip(p, '\n'); - { - register char *s; - for (len = 2, s = p; *s != '\0'; ++s) - if (*s == ',') - ++len; - } - if (gr_cnt < len) - { - if (gr_mem) - free(gr_mem); - if ((gr_mem = (char **)malloc(len * sizeof(char**))) == 0) - { - gr_cnt = 0; - _grp_cleanup(); - return 0; - } - gr_cnt = len; - } - grp->gr_mem = gr_mem; - q = grp->gr_mem; - while (*p != '\0') - { - *q++ = p; - p = skip(p, ','); - } - *q = 0; - return(grp); -} diff --git a/usr/src/lib/libc/port/gen/getlogin.c b/usr/src/lib/libc/port/gen/getlogin.c index a32c709..ae29e6b 100644 --- a/usr/src/lib/libc/port/gen/getlogin.c +++ b/usr/src/lib/libc/port/gen/getlogin.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getlogin.c 1.16" +#ident "@(#)libc-port:gen/getlogin.c 1.15" /*LINTLIBRARY*/ #ifdef __STDC__ #pragma weak getlogin = _getlogin @@ -14,7 +14,7 @@ #include #include #include "utmp.h" -#include +#include #define NULL 0 diff --git a/usr/src/lib/libc/port/gen/getopt.c b/usr/src/lib/libc/port/gen/getopt.c index d9d217f..919fa5c 100644 --- a/usr/src/lib/libc/port/gen/getopt.c +++ b/usr/src/lib/libc/port/gen/getopt.c @@ -5,14 +5,14 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getopt.c 1.23" +#ident "@(#)libc-port:gen/getopt.c 1.21" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ #ifdef __STDC__ #pragma weak getopt = _getopt #endif #include "synonyms.h" -#include +#include #include #define NULL 0 #define EOF (-1) @@ -35,7 +35,7 @@ int _sp = 1; int getopt(argc, argv, opts) int argc; -char *const *argv, *opts; +char **argv, *opts; { register char c; register char *cp; diff --git a/usr/src/lib/libc/port/gen/getpwbuf.c b/usr/src/lib/libc/port/gen/getpwbuf.c new file mode 100644 index 0000000..311892b --- /dev/null +++ b/usr/src/lib/libc/port/gen/getpwbuf.c @@ -0,0 +1,88 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/getpwbuf.c 1.1" +/*LINTLIBRARY*/ +#include "synonyms.h" +#include +#include +#include +#include +#include +#include + + +static char * +pwskip(p) +register char *p; +{ + while(*p && *p != ':' && *p != '\n') + ++p; + if(*p == '\n') + *p = '\0'; + else if(*p) + *p++ = '\0'; + return(p); +} + + +struct passwd * +_getpwbuf(pwd, line) + register + struct passwd *pwd; + char *line; +{ + register char *p = line; + char *end; + long x; + + pwd->pw_name = p; + p = pwskip(p); + pwd->pw_passwd = p; + p = pwskip(p); + if (p == NULL || *p == ':') { + /* check for non-null uid */ + errno = EINVAL; + return (NULL); + } + x = strtol(p, &end, 10); + if (end != memchr(p, ':', strlen(p))){ + /* check for numeric value */ + errno = EINVAL; + return (NULL); + } + p = pwskip(p); + pwd->pw_uid = (x < 0 || x > MAXUID)? (UID_NOBODY): x; + if (p == NULL || *p == ':') { + /* check for non-null uid */ + errno = EINVAL; + return (NULL); + } + x = strtol(p, &end, 10); + if (end != memchr(p, ':', strlen(p))) { + /* check for numeric value */ + errno = EINVAL; + return (NULL); + } + p = pwskip(p); + pwd->pw_gid = (x < 0 || x > MAXUID)? (UID_NOBODY): x; + pwd->pw_comment = p; + pwd->pw_gecos = p; + p = pwskip(p); + pwd->pw_dir = p; + p = pwskip(p); + pwd->pw_shell = p; + p = pwskip(p); + + p = pwd->pw_passwd; + while(*p && *p != ',') + p++; + if(*p) + *p++ = '\0'; + pwd->pw_age = p; + return pwd; +} diff --git a/usr/src/lib/libc/port/gen/getpwent.c b/usr/src/lib/libc/port/gen/getpwent.c index 1a85fcf..ddb42c0 100644 --- a/usr/src/lib/libc/port/gen/getpwent.c +++ b/usr/src/lib/libc/port/gen/getpwent.c @@ -5,17 +5,16 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getpwent.c 1.21" +#ident "@(#)libc-port:gen/getpwent.c 1.18.2.1" /*LINTLIBRARY*/ -#ifndef DSHLIB #ifdef __STDC__ #pragma weak endpwent = _endpwent #pragma weak fgetpwent = _fgetpwent #pragma weak getpwent = _getpwent #pragma weak setpwent = _setpwent #endif -#endif #include "synonyms.h" +#include "shlib.h" #include #include #include @@ -23,16 +22,12 @@ #include #include +struct passwd *_getpwbuf(); + static const char *PASSWD = "/etc/passwd"; static FILE *pwf = NULL; - -#if DSHLIB -static struct passwd *save_passwd; static char *line; -#else -static char line[BUFSIZ+1]; -static struct passwd save_passwd; -#endif +static struct passwd passwd; void setpwent() @@ -47,30 +42,11 @@ void endpwent() { if(pwf != NULL) { -#if DSHLIB - free(line); - line = NULL; - free(save_passwd); - save_passwd = NULL; -#endif (void) fclose(pwf); pwf = NULL; } } -static char * -pwskip(p) -register char *p; -{ - while(*p && *p != ':' && *p != '\n') - ++p; - if(*p == '\n') - *p = '\0'; - else if(*p) - *p++ = '\0'; - return(p); -} - struct passwd * getpwent() { @@ -87,68 +63,9 @@ struct passwd * fgetpwent(f) FILE *f; { - register struct passwd *passwd; - register char *p; - char *end; - long x; - -#if DSHLIB - if (save_passwd == NULL && (((line = malloc(BUFSIZ+1)) == NULL) - || ((save_passwd = (struct passwd *)malloc(sizeof(struct passwd))) == NULL))) { - errno = ENOMEM; - return(NULL); - } - passwd = save_passwd; -#else - passwd = &save_passwd; -#endif - - p = fgets(line, BUFSIZ, f); - if(p == NULL) - return(NULL); - passwd->pw_name = p; - p = pwskip(p); - passwd->pw_passwd = p; - p = pwskip(p); - if (p == NULL || *p == ':') { - /* check for non-null uid */ - errno = EINVAL; - return (NULL); - } - x = strtol(p, &end, 10); - if (end != memchr(p, ':', strlen(p))){ - /* check for numeric value */ - errno = EINVAL; - return (NULL); - } - p = pwskip(p); - passwd->pw_uid = (x < 0 || x > MAXUID)? (UID_NOBODY): x; - if (p == NULL || *p == ':') { - /* check for non-null uid */ - errno = EINVAL; - return (NULL); - } - x = strtol(p, &end, 10); - if (end != memchr(p, ':', strlen(p))) { - /* check for numeric value */ - errno = EINVAL; - return (NULL); - } - p = pwskip(p); - passwd->pw_gid = (x < 0 || x > MAXUID)? (UID_NOBODY): x; - passwd->pw_comment = p; - passwd->pw_gecos = p; - p = pwskip(p); - passwd->pw_dir = p; - p = pwskip(p); - passwd->pw_shell = p; - (void) pwskip(p); - - p = passwd->pw_passwd; - while(*p && *p != ',') - p++; - if(*p) - *p++ = '\0'; - passwd->pw_age = p; - return(passwd); + if (line == 0 && (line = malloc(BUFSIZ + 1)) == 0) + return NULL; + if (fgets(line, BUFSIZ, f) == NULL) + return NULL; + return _getpwbuf(&passwd, line); } diff --git a/usr/src/lib/libc/port/gen/getpwnam.c b/usr/src/lib/libc/port/gen/getpwnam.c index 653dc46..434fa10 100644 --- a/usr/src/lib/libc/port/gen/getpwnam.c +++ b/usr/src/lib/libc/port/gen/getpwnam.c @@ -5,204 +5,29 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getpwnam.c 1.19" +#ident "@(#)libc-port:gen/getpwnam.c 1.16" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ #ifdef __STDC__ #pragma weak getpwnam = _getpwnam - #pragma weak getpwuid = _getpwuid #endif #include "synonyms.h" -#include "shlib.h" -#include -#include -#include #include -#include +#include #include -#include -#include - -#define PASSWD "/etc/passwd" -static char *line; -static size_t linesz; -static char *buf; - -static struct passwd *entry(); -static void cleanup(), done(); -static char *begin(); +extern struct passwd *getpwent(); +extern void setpwent(), endpwent(); struct passwd * getpwnam(name) -register const char *name; +const char *name; { register struct passwd *p; - char *current, *after; - if ((current = begin(&after)) == 0) - return 0; - while((p = entry(¤t, after)) != 0 && strcmp(p->pw_name, name)) + setpwent(); + while ((p = getpwent()) != NULL && strcmp(name, p->pw_name)) ; - if (p == 0) - cleanup(); - done(); - return(p); -} - -struct passwd * -getpwuid(uid) -register uid_t uid; -{ - register struct passwd *p; - char *current, *after; - - if ((current = begin(&after)) == 0) - return 0; - while((p = entry(¤t, after)) != 0 && p->pw_uid != uid) - ; - if (p == 0) - cleanup(); - done(); - return(p); -} - -static char * -begin(pafter) - char **pafter; -{ - struct stat sb; - int fd; - size_t sz; - - if ((fd = open(PASSWD, 0)) < 0) - return 0; - if (fstat(fd, &sb) != 0 - || (sz = sb.st_size) != sb.st_size - || (buf = malloc(sz)) == 0) - { - (void)close(fd); - return 0; - } - if (read(fd, buf, sz) != sz) - { - free(buf); - close(fd); - return 0; - } - close(fd); - *pafter = buf + sz; - return buf; -} - -static void -cleanup() -{ - if (line != 0) - { - linesz = 0; - free(line); - line = 0; - } -} - - -static void -done() -{ - if (buf != 0) - { - free(buf); - buf = 0; - } -} - -static char * -skip(p) -char *p; -{ - while (*p && *p != ':' && *p != '\n') - ++p; - if (*p == '\n') - *p = '\0'; - else if (*p) - *p++ = '\0'; - return(p); -} - -static struct passwd * -entry(pcur, after) - char **pcur, *after; -{ - register char *p = *pcur; - long x; - size_t len; - - static struct passwd *pwd; - - if (!pwd && (pwd = (struct passwd *)malloc(sizeof(struct passwd))) == 0) - return 0; - if ((after = memchr(p, '\n', after - p)) == 0) - return 0; - *pcur = ++after; - len = after - p; - if (linesz < len) - { - if (line) - free(line); - if ((line = malloc(len)) == 0) - { - linesz = 0; - cleanup(); - return 0; - } - linesz = len; - } - memcpy(line, p, len); - p = line; - pwd->pw_name = p; - p = skip(p); - pwd->pw_passwd = p; - p = skip(p); - if (p == 0 || *p == ':') { - /* check for non-null uid */ - errno = EINVAL; - return (0); - } - x = strtol(p, &after, 10); - if (after != memchr(p, ':', strlen(p))){ - /* check for numeric value */ - errno = EINVAL; - return (0); - } - p = skip(p); - pwd->pw_uid = (x < 0 || x > MAXUID)? (UID_NOBODY): x; - if (p == 0 || *p == ':') { - /* check for non-null uid */ - errno = EINVAL; - return (0); - } - x = strtol(p, &after, 10); - if (after != memchr(p, ':', strlen(p))) { - /* check for numeric value */ - errno = EINVAL; - return (0); - } - p = skip(p); - pwd->pw_gid = (x < 0 || x > MAXUID)? (UID_NOBODY): x; - pwd->pw_comment = p; - pwd->pw_gecos = p; - p = skip(p); - pwd->pw_dir = p; - p = skip(p); - pwd->pw_shell = p; - (void) skip(p); - - p = pwd->pw_passwd; - while(*p && *p != ',') - p++; - if(*p) - *p++ = '\0'; - pwd->pw_age = p; - return(pwd); + endpwent(); + return (p); } diff --git a/usr/src/lib/libc/port/gen/getpwuid.c b/usr/src/lib/libc/port/gen/getpwuid.c new file mode 100644 index 0000000..a91c3fa --- /dev/null +++ b/usr/src/lib/libc/port/gen/getpwuid.c @@ -0,0 +1,33 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/getpwuid.c 1.13" +/* 3.0 SID # 1.2 */ +/*LINTLIBRARY*/ +#ifdef __STDC__ + #pragma weak getpwuid = _getpwuid +#endif +#include "synonyms.h" +#include +#include +#include + +extern struct passwd *getpwent(); +extern void setpwent(), endpwent(); + +struct passwd * +getpwuid(uid) +register uid_t uid; +{ + register struct passwd *p; + + setpwent(); + while((p = getpwent()) != NULL && p->pw_uid != uid) + ; + endpwent(); + return(p); +} diff --git a/usr/src/lib/libc/port/gen/getspent.c b/usr/src/lib/libc/port/gen/getspent.c index 4db3e1b..ae10a21 100644 --- a/usr/src/lib/libc/port/gen/getspent.c +++ b/usr/src/lib/libc/port/gen/getspent.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getspent.c 1.4" +#ident "@(#)libc-port:gen/getspent.c 1.3" #ifdef __STDC__ #pragma weak setspent = _setspent @@ -222,7 +222,7 @@ register FILE *f ; else (void) fprintf ( f, ":" ) ; if ( p->sp_expire > 0 ) - (void) fprintf ( f, "%d:", p->sp_expire ) ; + (void) fprintf ( f, "%d\n", p->sp_expire ) ; else (void) fprintf ( f, ":" ) ; if ( p->sp_flag != 0 ) diff --git a/usr/src/lib/libc/port/gen/gettimeofday.c b/usr/src/lib/libc/port/gen/gettimeofday.c index d3f0b26..cf690da 100644 --- a/usr/src/lib/libc/port/gen/gettimeofday.c +++ b/usr/src/lib/libc/port/gen/gettimeofday.c @@ -5,14 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/gettimeofday.c 1.3" +#ident "@(#)libc-port:gen/gettimeofday.c 1.1" -#ifndef DSHLIB #ifdef __STDC__ #pragma weak gettimeofday = _gettimeofday #pragma weak settimeofday = _settimeofday #endif -#endif #include "synonyms.h" #include #include diff --git a/usr/src/lib/libc/port/gen/gettxt.c b/usr/src/lib/libc/port/gen/gettxt.c index a7ce53c..2e6349e 100644 --- a/usr/src/lib/libc/port/gen/gettxt.c +++ b/usr/src/lib/libc/port/gen/gettxt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/gettxt.c 1.6" +#ident "@(#)libc-port:gen/gettxt.c 1.3.1.1" #ifdef __STDC__ #pragma weak Msgdb = _Msgdb @@ -26,7 +26,7 @@ #define P_locale "/usr/lib/locale/" #define L_locale (sizeof(P_locale)) -#define MAXDB 10 /* maximum number of data bases per program */ +#define MAXDB 5 /* maximum number of data bases per program */ #define DEF_LOCALE "/usr/lib/locale/C/LC_MESSAGES/" #define MESSAGES "/LC_MESSAGES/" #define DB_NAME_LEN 15 @@ -132,7 +132,7 @@ const char *dflt_str; fd, 0)) == (caddr_t)-1 ) { if (fd != -1) close(fd); - if (strcmp(saved_locale, "C") == 0) + if (*saved_locale == 'C') return(dflt_str && *dflt_str ? dflt_str : not_found); diff --git a/usr/src/lib/libc/port/gen/getut.c b/usr/src/lib/libc/port/gen/getut.c index f6bf53a..b56c29e 100644 --- a/usr/src/lib/libc/port/gen/getut.c +++ b/usr/src/lib/libc/port/gen/getut.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getut.c 1.19.1.5" +#ident "@(#)libc-port:gen/getut.c 1.19" /* Routines to read and write the /etc/utmp file. */ /* */ @@ -14,17 +14,8 @@ #pragma weak getutent = _getutent #pragma weak getutid = _getutid #pragma weak getutline = _getutline - #pragma weak getutmp = _getutmp - #pragma weak getutmpx = _getutmpx - #pragma weak makeut = _makeut - #pragma weak modut = _modut #pragma weak pututline = _pututline #pragma weak setutent = _setutent - #pragma weak synchutmp = _synchutmp - #pragma weak updutfile = _updutfile - #pragma weak updutxfile = _updutxfile - #pragma weak updutmpx = _updutmpx - #pragma weak updwtmp = _updwtmp #pragma weak utmpname = _utmpname #endif #include "synonyms.h" @@ -37,29 +28,8 @@ #include #include #include -#include -#define IDLEN 4 /* length of id field in utmp */ -#define SC_WILDC 0xff /* wild char for utmp ids */ #define MAXFILE 79 /* Maximum pathname length for "utmp" file */ -#define MAXVAL 255 /* max value for an id 'character' */ -#define IPIPE "/etc/initpipe" /* FIFO to send pids to init */ - -/* - * format of message sent to init - */ - -struct pidrec { - int pd_type; /* command type */ - pid_t pd_pid; /* pid */ -}; - -/* - * pd_type's - */ - -# define ADDPID 1 /* add a pid to "godchild" list */ -# define REMPID 2 /* remove a pid to "godchild" list */ #ifdef ut_time #undef ut_time @@ -73,11 +43,8 @@ struct pidrec { extern long lseek(); extern void setutent(); extern int stat(), write(), read(), close(); -extern void unlockut(); -extern void sendpid(); static int fd = -1; /* File descriptor for the utmp file. */ -static int fd_u = -1; /* File descriptor for the utmpx file. */ static const char *utmpfile = UTMP_FILE; /* Name of the current */ static const char *utmpxfile = UTMPX_FILE; /* "utmp" like file. */ @@ -380,25 +347,19 @@ const char *newfile; int updutmpx(entry) struct utmp *entry; { - int fc, type; + int fd_u, fc, type; struct stat stbuf; struct utmpx uxbuf, *uxptr = NULL; - extern int fd_u; - if(fd_u < 0) { - if ((fd_u = open(utmpxfile, O_RDWR|O_CREAT, 0644)) < 0) { + if ((fd_u = open(utmpxfile, O_RDWR|O_CREAT, 0644)) < 0) { #ifdef ERRDEBUG gdebug("Could not open utmpxfile\n"); #endif - return(1); - } + return(1); } - if ((fc = fcntl(fd_u, F_GETFL, NULL)) == -1) { - close(fd_u); - fd_u = -1; + if ((fc = fcntl(fd_u, F_GETFL, NULL)) == -1) return(1); - } while (read(fd_u, &uxbuf, sizeof(uxbuf)) == sizeof(uxbuf)) { if (uxbuf.ut_type != EMPTY) { @@ -444,15 +405,12 @@ struct utmp *entry; #ifdef ERRDEBUG gdebug("updutmpx failed: write-%d\n", errno); #endif - close(fd_u); - fd_u = -1; return(1); } fcntl(fd_u, F_SETFL, fc); close(fd_u); - fd_u = -1; return(0); } @@ -476,21 +434,15 @@ updwtmp(file, ut) fdx = open(filex, O_WRONLY | O_APPEND); if (fd < 0) { - if (fdx < 0) - return; - if ((fd = open(file, O_WRONLY|O_CREAT)) < 0) { - close(fdx); + if ((fdx < 0) || ((fd = open(file, O_WRONLY|O_CREAT)) < 0)) return; - } - } else if ((fdx < 0) && ((fdx = open(filex, O_WRONLY|O_CREAT)) < 0)) { - close(fd); + } else if ((fdx < 0) && ((fdx = open(filex, O_WRONLY|O_CREAT)) < 0)) return; - } /* Both files exist, synch them */ if (synchutmp(file, filex)) - goto done; + return; /* seek to end of file, in case synchutmp has appended to */ /* the files. */ @@ -500,7 +452,6 @@ updwtmp(file, ut) getutmpx(ut, &utx); write(fdx, &utx, sizeof(struct utmpx)); -done: close(fd); close(fdx); } @@ -533,20 +484,16 @@ getutmpx(ut, utx) struct utmpx *utx; { strncpy(utx->ut_user, ut->ut_user, sizeof(ut->ut_user)); - (void) memset(&utx->ut_user[sizeof(ut->ut_user)], '\0', - sizeof(utx->ut_user) - sizeof(ut->ut_user)); + utx->ut_user[sizeof(ut->ut_user)] = '\0'; strncpy(utx->ut_line, ut->ut_line, sizeof(ut->ut_line)); - (void) memset(&utx->ut_line[sizeof(ut->ut_line)], '\0', - sizeof(utx->ut_line) - sizeof(ut->ut_line)); + utx->ut_line[sizeof(ut->ut_line)] = '\0'; (void) memcpy(utx->ut_id, ut->ut_id, sizeof(ut->ut_id)); utx->ut_pid = ut->ut_pid; utx->ut_type = ut->ut_type; utx->ut_exit = ut->ut_exit; utx->ut_tv.tv_sec = ut->ut_time; utx->ut_tv.tv_usec = 0; - utx->ut_session = 0; - (void) memset(utx->pad, 0, sizeof(utx->pad)); - (void) memset(utx->ut_host, '\0', sizeof(utx->ut_host)); + utx->ut_host[0] = '\0'; } @@ -599,21 +546,14 @@ updutfile(utf, utxf) struct utmp ut; int fd1, fd2, n; - if ((fd1 = open(utf, O_RDWR|O_CREAT|O_TRUNC)) < 0) + if ((fd1 = open(utf, O_RDWR|O_CREAT|O_TRUNC)) < 0 || + (fd2 = open(utxf, O_RDONLY)) < 0) return(1); - if ((fd2 = open(utxf, O_RDONLY)) < 0) { - close(fd1); - return(1); - } - while ((n = read(fd2, &utx, sizeof(utx))) == sizeof(utx)) { getutmp(&utx, &ut); - if (write(fd1, &ut, sizeof(ut)) != sizeof(ut)) { - close(fd1); - close(fd2); + if (write(fd1, &ut, sizeof(ut)) != sizeof(ut)) return(1); - } } close(fd1); close(fd2); @@ -634,12 +574,9 @@ updutxfile(utf, utxf) int fd1, fd2; int n1, n2, cnt=0; - if ((fd1 = open(utf, O_RDONLY)) < 0) - return(1); - if ((fd2 = open(utxf, O_RDWR)) < 0) { - close(fd1); + if ((fd1 = open(utf, O_RDONLY)) < 0 || + (fd2 = open(utxf, O_RDWR)) < 0) return(1); - } /* As long as the entries match, copy the records from the * utmpx file to keep the host information. @@ -652,11 +589,8 @@ updutxfile(utf, utxf) || ! memcmp(ut.ut_line, utx.ut_line, sizeof(ut.ut_line))) { getutmpx(&ut, &utx); lseek(fd2, -(long)sizeof(struct utmpx), 1); - if (write(fd2, &utx, sizeof(utx)) != sizeof(utx)) { - close(fd1); - close(fd2); + if (write(fd2, &utx, sizeof(utx)) != sizeof(utx)) return(1); - } cnt += sizeof(struct utmpx); } } @@ -667,11 +601,8 @@ updutxfile(utf, utxf) if (n1 > 0) { do { getutmpx(&ut, &utx); - if (write(fd2, &utx, sizeof(utx)) != sizeof(utx)) { - close(fd1); - close(fd2); + if (write(fd2, &utx, sizeof(utx)) != sizeof(utx)) return(1); - } } while ((n1 = read(fd1, &ut, sizeof(ut))) == sizeof(ut)); } else { /* out of date file was longer, truncate it */ @@ -684,306 +615,6 @@ updutxfile(utf, utxf) return(0); } -/* - * makeut - create a utmp entry, recycling an id if a wild card is - * specified. Also notify init about the new pid - * - * args: utmp - point to utmp structure to be created - */ - - -struct utmp *makeut(utmp) -register struct utmp *utmp; -{ - register int i; /* scratch variable */ - register struct utmp *utp; /* "current" utmp entry being examined */ - int wild; /* flag, true iff wild card -char seen */ - unsigned char saveid[IDLEN]; /* the last id we matched that was - NOT a dead proc */ - - wild = 0; - for (i = 0; i < IDLEN; i++) { - if ((unsigned char) utmp->ut_id[i] == SC_WILDC) { - wild = 1; - break; - } - } - - if (wild) { - -/* - * try to lock the utmp file, only needed if we're doing wildcard matching - */ - - if (lockut()) - return((struct utmp *) NULL); - - setutent(); - /* find the first alphanumeric character */ - for (i = 0; i < MAXVAL; ++i) { - if (isalnum(i)) - break; - } - (void) memset(saveid, i, IDLEN); - while (utp = getutent()) { - if (idcmp(utmp->ut_id, utp->ut_id)) { - continue; - } - else { - if (utp->ut_type == DEAD_PROCESS) { - break; - } - else { - (void) memcpy(saveid, utp->ut_id, IDLEN); - } - } - } - if (utp) { - -/* - * found an unused entry, reuse it - */ - - (void) memcpy(utmp->ut_id, utp->ut_id, IDLEN); - utp = pututline(utmp); - if (utp) - updwtmp(WTMP_FILE, utp); - endutent(); - unlockut(); - sendpid(ADDPID, (pid_t)utmp->ut_pid); - return(utp); - } - else { - -/* - * nothing available, try to allocate an id - */ - - if (allocid(utmp->ut_id, saveid)) { - endutent(); - unlockut(); - return((struct utmp *) NULL); - } - else { - utp = pututline(utmp); - if (utp) - updwtmp(WTMP_FILE, utp); - endutent(); - unlockut(); - sendpid(ADDPID, (pid_t)utmp->ut_pid); - return(utp); - } - } - } - else { - utp = pututline(utmp); - if (utp) - updwtmp(WTMP_FILE, utp); - endutent(); - sendpid(ADDPID, (pid_t)utmp->ut_pid); - return(utp); - } -} - - -/* - * modut - modify a utmp entry. Also notify init about new pids or - * old pids that it no longer needs to care about - * - * args: utmp - point to utmp structure to be created - */ - - -struct utmp *modut(utp) -register struct utmp *utp; -{ - register int i; /* scratch variable -*/ - struct utmp utmp; /* holding area */ - register struct utmp *ucp = &utmp; /* and a pointer to -it */ - struct utmp *up; /* "current" utmp entry being examined */ - - for (i = 0; i < IDLEN; ++i) { - if ((unsigned char) utp->ut_id[i] == SC_WILDC) - return((struct utmp *) NULL); - } - /* copy the supplied utmp structure someplace safe */ - utmp = *utp; - setutent(); - while (up = getutent()) { - if (idcmp(ucp->ut_id, up->ut_id)) - continue; - /* only get here if ids are the same, i.e. found right entry */ - if (ucp->ut_pid != up->ut_pid) { - sendpid(REMPID, (pid_t)up->ut_pid); - sendpid(ADDPID, (pid_t)ucp->ut_pid); - } - break; - } - up = pututline(ucp); - if (ucp->ut_type == DEAD_PROCESS) - sendpid(REMPID, (pid_t)ucp->ut_pid); - if (up) - updwtmp(WTMP_FILE, up); - endutent(); - return(up); -} - - - -/* - * idcmp - compare two id strings, return 0 if same, non-zero if not * - * args: s1 - first id string - * s2 - second id string - */ - - -static -idcmp(s1, s2) -register char *s1; -register char *s2; -{ - register int i; /* scratch variable */ - - for (i = 0; i < IDLEN; ++i) { - if ((unsigned char) *s1 != SC_WILDC && (*s1++ != *s2++)) - return(-1); - } - return(0); -} - - -/* - * allocid - allocate an unused id for utmp, either by recycling a - * DEAD_PROCESS entry or creating a new one. This routine only * gets called if a wild card character was specified. - * - * args: srcid - pattern for new id - * saveid - last id matching pattern for a non-dead process - */ - - -static -allocid(srcid, saveid) -register char *srcid; -register unsigned char *saveid; -{ - register int i; /* scratch variable */ - int changed; /* flag to indicate that a new id has been generated */ - char copyid[IDLEN]; /* work area */ - - (void) memcpy(copyid, srcid, IDLEN); - changed = 0; - for (i = 0; i < IDLEN; ++i) { - /* if this character isn't wild, it'll be part of the generated id */ - if ((unsigned char) copyid[i] != SC_WILDC) - continue; - /* it's a wild character, retrieve the character from the saved id */ - copyid[i] = saveid[i]; - /* if we haven't changed anything yet, try to find a new char to use */ - if (!changed && (saveid[i] < MAXVAL)) { - -/* - * Note: this algorithm is taking the "last matched" id and trying to make - * a 1 character change to it to create a new one. Rather than special-case - * the first time (when no perturbation is really necessary), just don't - * allocate the first valid id. - */ - - while (++saveid[i] <= MAXVAL) { - /* make sure new char is alphanumeric */ - if (isalnum(saveid[i])) { - copyid[i] = saveid[i]; - changed = 1; - break; - } - } - } - } - /* changed is true if we were successful in allocating an id */ - if (changed) { - (void) memcpy(srcid, copyid, IDLEN); - return(0); - } - else { - return(-1); - } -} - - -/* - * lockut - lock utmp and utmpx files - */ - - -static -lockut() -{ - if ((fd = open(UTMP_FILE, O_RDWR)) < 0) - return(-1); - if ((fd_u = open(UTMPX_FILE, O_RDWR)) < 0) { - close(fd); - fd = -1; - return(-1); - } - if ((lockf(fd, F_LOCK, 0) < 0) || (lockf(fd_u, F_LOCK, 0) < 0)) { - close(fd); close(fd_u); - fd = fd_u = -1; - return(-1); - } - return(0); -} - - -/* - * unlockut - unlock utmp and utmpx files - */ - - -static void -unlockut() -{ - (void) lockf(fd, F_ULOCK, 0); - (void) lockf(fd_u, F_ULOCK, 0); - (void) close(fd); - (void) close(fd_u); - fd = -1; fd_u = -1; -} - - -/* - * sendpid - send message to init to add or remove a pid from the - * "godchild" list - * - * args: cmd - ADDPID or REMPID - * pid - pid of "godchild" - */ - - -static void -sendpid(cmd, pid) -int cmd; -pid_t pid; -{ - int pfd; /* file desc. for init pipe */ - struct pidrec prec; /* place for message to be built */ - -/* - * if for some reason init didn't open initpipe, open it read/write - * here to avoid sending SIGPIPE to the calling process - */ - - pfd = open(IPIPE, O_RDWR); - if (pfd < 0) - return; - prec.pd_pid = pid; - prec.pd_type = cmd; - (void) write(pfd, &prec, sizeof(struct pidrec)); - (void) close(pfd); -} - - #ifdef ERRDEBUG #include diff --git a/usr/src/lib/libc/port/gen/getutx.c b/usr/src/lib/libc/port/gen/getutx.c index 273264a..a32dfe1 100644 --- a/usr/src/lib/libc/port/gen/getutx.c +++ b/usr/src/lib/libc/port/gen/getutx.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/getutx.c 1.5" +#ident "@(#)libc-port:gen/getutx.c 1.1" /******************************************************************* @@ -35,8 +35,6 @@ publication. #pragma weak getutxent = _getutxent #pragma weak getutxid = _getutxid #pragma weak getutxline = _getutxline - #pragma weak makeutx = _makeutx - #pragma weak modutx = _modutx #pragma weak pututxline = _pututxline #pragma weak setutxent = _setutxent #pragma weak endutxent = _endutxent @@ -54,33 +52,9 @@ publication. #include #include #include -#include -#define IDLEN 4 /* length of id field in utmp */ -#define SC_WILDC 0xff /* wild char for utmp ids */ #define MAXFILE 79 /* Maximum pathname length for "utmpx" file */ -# define MAXVAL 255 /* max value for an id `character' */ -# define IPIPE "/etc/initpipe" /* FIFO to send pids to init */ - - -/* - * format of message sent to init - */ - -struct pidrec { - int pd_type; /* command type */ - pid_t pd_pid; /* pid */ -}; - -/* - * pd_type's - */ - -# define ADDPID 1 /* add a pid to "godchild" list */ -# define REMPID 2 /* remove a pid to "godchild" list */ - - #ifdef DEBUG #undef UTMPX_FILE #define UTMPX_FILE "utmpx" @@ -89,11 +63,8 @@ struct pidrec { #endif extern void _setutxent(); -extern void unlockutx(); -extern void sendpid(); static int fd = -1; /* File descriptor for the utmpx file. */ -static int fd_u = -1; /* File descriptor for the utmp file. */ static char utmpxfile[MAXFILE+1] = UTMPX_FILE; /* Name of the current */ static char utmpfile[MAXFILE+1] = UTMP_FILE; /* "utmpx" and "utmp" */ /* like file. */ @@ -390,25 +361,19 @@ const char *newfile; int updutmp(entry) struct utmpx *entry; { - int fc, type; + int fd_u, fc, type; struct stat stbuf; struct utmp ubuf, *uptr = NULL; - extern int fd_u; - if (fd_u < 0) { - if ((fd_u = open(utmpfile, O_RDWR|O_CREAT, 0644)) < 0) { + if ((fd_u = open(utmpfile, O_RDWR|O_CREAT, 0644)) < 0) { #ifdef ERRDEBUG gxdebug("Could not open utmpfile\n"); #endif - return(1); - } + return(1); } - if ((fc = fcntl(fd_u, F_GETFL, NULL)) == -1) { - close(fd_u); - fd_u = -1; + if ((fc = fcntl(fd_u, F_GETFL, NULL)) == -1) return(1); - } while (read(fd_u, &ubuf, sizeof(ubuf)) == sizeof(ubuf)) { if (ubuf.ut_type != EMPTY) { @@ -451,15 +416,12 @@ struct utmpx *entry; getutmp(entry, &ubuf); if (write(fd_u, &ubuf, sizeof(ubuf)) != sizeof(ubuf)) { - close(fd_u); - fd_u = -1; return(1); } fcntl(fd_u, F_SETFL, fc); close(fd_u); - fd_u = -1; return(0); } @@ -484,21 +446,15 @@ updwtmpx(filex, utx) fdx = open(filex, O_WRONLY | O_APPEND); if (fd < 0) { - if (fdx < 0) + if ((fdx < 0) || ((fd = open(file, O_WRONLY|O_CREAT)) < 0)) return; - if ((fd = open(file, O_WRONLY|O_CREAT)) < 0) { - close(fdx); - return; - } - } else if ((fdx < 0) && ((fdx = open(filex, O_WRONLY|O_CREAT)) < 0)) { - close(fd); + } else if ((fdx < 0) && ((fdx = open(filex, O_WRONLY|O_CREAT)) < 0)) return; - } /* Both files exist, synch them */ if (synchutmp(file, filex)) - goto done; + return; /* seek to end of file, in case synchutmp has appended to */ /* the files. */ @@ -508,307 +464,11 @@ updwtmpx(filex, utx) write(fd, &ut, sizeof(struct utmp)); write(fdx, utx, sizeof(struct utmpx)); -done: close(fd); close(fdx); } -/* - * makeutx - create a utmpx entry, recycling an id if a wild card is * specified. Also notify init about the new pid - * - * args: utmpx - point to utmpx structure to be created - */ - - -struct utmpx *makeutx(utmp) -const struct utmpx *utmp; -{ - register int i; /* scratch variable */ - register struct utmpx *utp; /* "current" utmpx entry being examined */ - int wild; /* flag, true iff wild card -char seen */ - unsigned char saveid[IDLEN]; /* the last id we matched that was - NOT a dead proc */ - - wild = 0; - for (i = 0; i < IDLEN; i++) { - if ((unsigned char) utmp->ut_id[i] == SC_WILDC) { - wild = 1; - break; - } - } - - if (wild) { - -/* - * try to lock the utmpx and utmp files, only needed if we're doing - * wildcard matching - */ - - if (lockutx()) - return((struct utmpx *) NULL); - - setutxent(); - /* find the first alphanumeric character */ - for (i = 0; i < MAXVAL; ++i) { - if (isalnum(i)) - break; - } - (void) memset(saveid, i, IDLEN); - while (utp = getutxent()) { - if (idcmp(utmp->ut_id, utp->ut_id)) { - continue; - } - else { - if (utp->ut_type == DEAD_PROCESS) { - break; - } - else { - (void) memcpy(saveid, utp->ut_id, IDLEN); - } - } - } - if (utp) { - -/* - * found an unused entry, reuse it - */ - - (void) memcpy((char *)(utmp->ut_id), utp->ut_id, IDLEN); - utp = pututxline(utmp); - if (utp) - updwtmpx(WTMPX_FILE, utp); - endutxent(); - unlockutx(); - sendpid(ADDPID, (pid_t)utmp->ut_pid); - return(utp); - } - else { - -/* - * nothing available, try to allocate an id - */ - - if (allocid(utmp->ut_id, saveid)) { - endutxent(); - unlockutx(); - return((struct utmpx *) NULL); - } - else { - utp = pututxline(utmp); - if (utp) - updwtmpx(WTMPX_FILE, utp); - endutxent(); - unlockutx(); - sendpid(ADDPID, (pid_t)utmp->ut_pid); - return(utp); - } - } - } - else { - utp = pututxline(utmp); - if (utp) - updwtmpx(WTMPX_FILE, utp); - endutxent(); - sendpid(ADDPID, (pid_t)utmp->ut_pid); - return(utp); - } -} - - -/* - * modutx - modify a utmpx entry. Also notify init about new pids or - * old pids that it no longer needs to care about - * - * args: utp- point to utmpx structure to be created - */ - -struct utmpx *modutx(utp) -const struct utmpx *utp; -{ - register int i; /* scratch variable -*/ - struct utmpx utmp; /* holding area */ - register struct utmpx *ucp = &utmp; /* and a pointer to -it */ - struct utmpx *up; /* "current" utmpx entry being examined */ - - for (i = 0; i < IDLEN; ++i) { - if ((unsigned char) utp->ut_id[i] == SC_WILDC) - return((struct utmpx *) NULL); - } - /* copy the supplied utmpx structure someplace safe */ - utmp = *utp; - setutxent(); - while (up = getutxent()) { - if (idcmp(ucp->ut_id, up->ut_id)) - continue; - /* only get here if ids are the same, i.e. found right entry */ - if (ucp->ut_pid != up->ut_pid) { - sendpid(REMPID, (pid_t)up->ut_pid); - sendpid(ADDPID, (pid_t)ucp->ut_pid); - } - break; - } - up = pututxline(ucp); - if (ucp->ut_type == DEAD_PROCESS) - sendpid(REMPID, (pid_t)ucp->ut_pid); - if (up) - updwtmpx(WTMPX_FILE, up); - endutxent(); - return(up); -} - - -/* - * idcmp - compare two id strings, return 0 if same, non-zero if not * - * args: s1 - first id string - * s2 - second id string - */ - - -static -idcmp(s1, s2) -register char *s1; -register char *s2; -{ - register int i; /* scratch variable */ - - for (i = 0; i < IDLEN; ++i) { - if ((unsigned char) *s1 != SC_WILDC && (*s1++ != *s2++)) - return(-1); - } - return(0); -} - - -/* - * allocid - allocate an unused id for utmp, either by recycling a - * DEAD_PROCESS entry or creating a new one. This routine only * gets called if a wild card character was specified. - * - * args: srcid - pattern for new id - * saveid - last id matching pattern for a non-dead process - */ - - -static -allocid(srcid, saveid) -register char *srcid; -register unsigned char *saveid; -{ - register int i; /* scratch variable */ - int changed; /* flag to indicate that a new id has been generated */ - char copyid[IDLEN]; /* work area */ - - (void) memcpy(copyid, srcid, IDLEN); - changed = 0; - for (i = 0; i < IDLEN; ++i) { - /* if this character isn't wild, it'll be part of the generated id */ - if ((unsigned char) copyid[i] != SC_WILDC) - continue; - /* it's a wild character, retrieve the character from the saved id */ - copyid[i] = saveid[i]; - /* if we haven't changed anything yet, try to find a new char to use */ - if (!changed && (saveid[i] < MAXVAL)) { - -/* - * Note: this algorithm is taking the "last matched" id and trying to make - * a 1 character change to it to create a new one. Rather than special-case - * the first time (when no perturbation is really necessary), just don't - * allocate the first valid id. - */ - - while (++saveid[i] <= MAXVAL) { - /* make sure new char is alphanumeric */ - if (isalnum(saveid[i])) { - copyid[i] = saveid[i]; - changed = 1; - break; - } - } - } - } - /* changed is true if we were successful in allocating an id */ - if (changed) { - (void) memcpy(srcid, copyid, IDLEN); - return(0); - } - else { - return(-1); - } -} - - -/* - * lockutx - lock utmpx and utmp files - */ - -static -lockutx() -{ - if ((fd = open(UTMPX_FILE, O_RDWR)) < 0) - return(-1); - if ((fd_u = open(UTMP_FILE, O_RDWR)) < 0) { - close(fd); - fd = -1; - return(-1); - } - if ((lockf(fd, F_LOCK, 0) < 0) || (lockf(fd_u, F_LOCK, 0) <0)) { - close(fd); close(fd_u); - fd = -1; fd_u = -1; - return(-1); - } - return(0); -} - - -/* - * unlockutx - unlock utmp and utmpx files - */ - -static void -unlockutx() -{ - (void) lockf(fd, F_ULOCK, 0); - (void) lockf(fd_u, F_ULOCK, 0); - (void) close(fd); - (void) close(fd_u); - fd = fd_u = -1; -} - - -/* - * sendpid - send message to init to add or remove a pid from the - * "godchild" list - * - * args: cmd - ADDPID or REMPID - * pid - pid of "godchild" - */ - - -static void -sendpid(cmd, pid) -int cmd; -pid_t pid; -{ - int pfd; /* file desc. for init pipe */ - struct pidrec prec; /* place for message to be built */ - -/* - * if for some reason init didn't open initpipe, open it read/write - * here to avoid sending SIGPIPE to the calling process - */ - - pfd = open(IPIPE, O_RDWR); - if (pfd < 0) - return; - prec.pd_pid = pid; - prec.pd_type = cmd; - (void) write(pfd, &prec, sizeof(struct pidrec)); - (void) close(pfd); -} - #ifdef ERRDEBUG #include diff --git a/usr/src/lib/libc/port/gen/hrtcftime.c b/usr/src/lib/libc/port/gen/hrtcftime.c index 112a19a..fe4bd60 100644 --- a/usr/src/lib/libc/port/gen/hrtcftime.c +++ b/usr/src/lib/libc/port/gen/hrtcftime.c @@ -5,8 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/hrtcftime.c 1.3" +#ident "@(#)libc-port:gen/hrtcftime.c 1.2" +#ifdef __STDC__ + #pragma weak hrtcftime = _hrtcftime + #pragma weak hrtascftime = _hrtascftime +#endif #include "synonyms.h" #include #include @@ -19,7 +23,7 @@ extern char *getenv(); int -_hrtcftime(bufp, fmtp, tdp) +hrtcftime(bufp, fmtp, tdp) char *bufp; char *fmtp; hrtime_t *tdp; @@ -39,7 +43,7 @@ hrtime_t *tdp; } int -_hrtascftime(buf, format, tm, rem, res) +hrtascftime(buf, format, tm, rem, res) char *buf; char *format; struct tm *tm; diff --git a/usr/src/lib/libc/port/gen/hrtctime.c b/usr/src/lib/libc/port/gen/hrtctime.c index 3238237..35571b2 100644 --- a/usr/src/lib/libc/port/gen/hrtctime.c +++ b/usr/src/lib/libc/port/gen/hrtctime.c @@ -5,8 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/hrtctime.c 1.3" +#ident "@(#)libc-port:gen/hrtctime.c 1.2" +#ifdef __STDC__ + #pragma weak hrtctime = _hrtctime + #pragma weak hrtasctime = _hrtasctime +#endif #include "synonyms.h" #include #include @@ -20,7 +24,7 @@ static char cbuf[100]; char * -_hrtctime(tdp) +hrtctime(tdp) hrtime_t *tdp; { register struct tm *tmp; @@ -40,7 +44,7 @@ hrtime_t *tdp; char * -_hrtasctime(tmp, rem, res) +hrtasctime(tmp, rem, res) struct tm *tmp; ulong rem; ulong res; diff --git a/usr/src/lib/libc/port/gen/hrtnewres.c b/usr/src/lib/libc/port/gen/hrtnewres.c index 16dc2b5..e9ecd6c 100644 --- a/usr/src/lib/libc/port/gen/hrtnewres.c +++ b/usr/src/lib/libc/port/gen/hrtnewres.c @@ -5,8 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/hrtnewres.c 1.3" +#ident "@(#)libc-port:gen/hrtnewres.c 1.2" +#ifdef __STDC__ + #pragma weak hrtnewres = _hrtnewres +#endif #include "synonyms.h" #include #include @@ -24,7 +27,7 @@ ** a long, then -1 is returned instead. */ -_hrtnewres(htp, new_res, round) +hrtnewres(htp, new_res, round) register hrtime_t *htp; register ulong new_res; long round; diff --git a/usr/src/lib/libc/port/gen/hrtstrftime.c b/usr/src/lib/libc/port/gen/hrtstrftime.c index 97dec12..f94b44e 100644 --- a/usr/src/lib/libc/port/gen/hrtstrftime.c +++ b/usr/src/lib/libc/port/gen/hrtstrftime.c @@ -9,8 +9,11 @@ ** High resolution version of strftime.c ** */ -#ident "@(#)libc-port:gen/hrtstrftime.c 1.4" +#ident "@(#)libc-port:gen/hrtstrftime.c 1.2" +#ifdef __STDC__ + #pragma weak hrtstrftime = _hrtstrftime +#endif #include "synonyms.h" #include #include @@ -23,7 +26,7 @@ #include #include #include -#include +#include #include #include "_locale.h" @@ -56,7 +59,7 @@ static char * _time[] = { size_t -_hrtstrftime(s, maxsize, format, tm, rem, res) +hrtstrftime(s, maxsize, format, tm, rem, res) char *s; size_t maxsize; const char *format; diff --git a/usr/src/lib/libc/port/gen/initgroups.c b/usr/src/lib/libc/port/gen/initgroups.c index 4cf5257..7a0cc80 100644 --- a/usr/src/lib/libc/port/gen/initgroups.c +++ b/usr/src/lib/libc/port/gen/initgroups.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/initgroups.c 1.5" +#ident "@(#)libc-port:gen/initgroups.c 1.4" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ /* @@ -23,16 +23,11 @@ #include #include -extern char *_grp_begin(); -extern void _grp_cleanup(), _grp_done(); -extern struct group *_grp_entry(); - initgroups(uname, agroup) const char *uname; gid_t agroup; { gid_t *groups; - char *current, *after; register struct group *grp; register int i; long ngroups_max; @@ -46,9 +41,9 @@ initgroups(uname, agroup) if (agroup >= 0) groups[ngroups++] = agroup; - if ((current = _grp_begin(&after)) == 0) - return -1; - while((grp = _grp_entry(¤t, after)) != 0) { + setgrent(); + + while (grp = getgrent()) { if (grp->gr_gid == agroup) continue; for (i = 0; grp->gr_mem[i]; i++) { @@ -61,8 +56,7 @@ initgroups(uname, agroup) } toomany: - _grp_cleanup(); - _grp_done(); + endgrent(); retsave = setgroups(ngroups, groups); errsave = errno; diff --git a/usr/src/lib/libc/port/gen/localeconv.c b/usr/src/lib/libc/port/gen/localeconv.c index ba6f218..7ac14e8 100644 --- a/usr/src/lib/libc/port/gen/localeconv.c +++ b/usr/src/lib/libc/port/gen/localeconv.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/localeconv.c 1.6" +#ident "@(#)libc-port:gen/localeconv.c 1.5" #include "synonyms.h" #include "shlib.h" #include @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/usr/src/lib/libc/port/gen/lsearch.c b/usr/src/lib/libc/port/gen/lsearch.c index 1f2e325..34b8538 100644 --- a/usr/src/lib/libc/port/gen/lsearch.c +++ b/usr/src/lib/libc/port/gen/lsearch.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/lsearch.c 1.16" +#ident "@(#)libc-port:gen/lsearch.c 1.15" /*LINTLIBRARY*/ /* * Linear search algorithm, generalized from Knuth (6.1) Algorithm Q. @@ -29,7 +29,7 @@ VOID * lsearch(ky, bs, nelp, width, compar) const VOID *ky; /* Key to be located */ -VOID *bs; /* Beginning of table */ +register const VOID *bs; /* Beginning of table */ size_t *nelp; /* Pointer to current table size */ register size_t width; /* Width of an element (bytes) */ int (*compar)(); /* Comparison function */ diff --git a/usr/src/lib/libc/port/gen/makefile b/usr/src/lib/libc/port/gen/makefile index d5d800f..706b48a 100644 --- a/usr/src/lib/libc/port/gen/makefile +++ b/usr/src/lib/libc/port/gen/makefile @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libc-port:gen/makefile 1.17.11.12" +#ident "@(#)libc-port:gen/makefile 1.17.10.10" # # makefile for libc/port/gen # @@ -32,9 +32,9 @@ POBJECTS=$(OBJECTS:.o=.p) OBJECTS=\ _ctype.o _loc_data.o _locale.o _set_tab.o \ _shrd_data.o _xftw.o \ -a64l.o abort.o abs.o \ -assert.o atexit.o atof.o atoi.o \ -atol.o bsearch.o calloc.o \ +a64l.o abort.o abs.o aread.o \ +assert.o asyncio.o atexit.o atof.o atoi.o \ +atol.o awrite.o bsearch.o calloc.o \ cat_init.o catclose.o catgets.o catopen.o \ cfgetispeed.o cfgetospeed.o cfree.o cfsetispeed.o cfsetospeed.o \ cftime.o clock.o closedir.o \ @@ -42,14 +42,13 @@ colldata.o crypt.o \ ctime.o ctype.o \ ctypefcns.o div.o drand48.o \ dup2.o ecvt.o errlst.o \ -execvp.o fattach.o fdetach.o \ +events.o execvp.o fattach.o fdetach.o \ ffs.o fmtmsg.o \ frexp.o ftok.o ftw.o gcvt.o \ -getcwd.o getdate.o getdate_data.o \ -getdate_gd.o getenv.o getgrent.o \ +getcwd.o getenv.o getgrbuf.o getgrent.o getgrgid.o \ getgrnam.o gethz.o getlogin.o getmntent.o \ -getopt.o getpw.o getpwent.o getpwnam.o \ -getsetitimer.o \ +getopt.o getpw.o getpwbuf.o getpwent.o getpwnam.o \ +getpwuid.o getsetitimer.o \ getspent.o getsubopt.o gettimeofday.o \ gettxt.o getut.o getutx.o getvfsent.o \ hrtcftime.o hrtctime.o hrtnewres.o hrtstrftime.o \ @@ -64,13 +63,13 @@ mlock.o mlockall.o \ modf.o modff.o mon.o msync.o \ munlock.o munlockall.o new_list.o nftw.o \ nl_langinfo.o opendir.o \ -old_tolower.o old_toupper.o opt_data.o \ +old_tolower.o old_toupper.o opt_data.o pathconf.o \ perror.o priocntl.o psiginfo.o psignal.o \ -pt.o putenv.o putpwent.o \ +pt.o putenv.o putpwbuf.o putpwent.o \ qsort.o raise.o rand.o readdir.o \ realpath.o rename.o rewinddir.o seekdir.o \ select.o setlocale.o \ -sigflag.o siglist.o \ +sigflag.o siginfolst.o siglist.o \ sigsend.o sigsetops.o sleep.o \ ssignal.o str2id.o str2sig.o \ strcat.o strchr.o strcmp.o strcpy.o \ @@ -92,36 +91,34 @@ waitpid.o wctomb.o wcstombs.o PIC_OBJECTS=\ _ctype.P _loc_data.P _locale.P _set_tab.P _xftw.P \ a64l.P abort.P abs.P assert.P atexit.P \ -atof.P atoi.P atol.P bsearch.P calloc.P \ -cat_init.P catclose.P catgets.P catopen.P \ -cfgetispeed.P cfgetospeed.P cfsetispeed.P cfsetospeed.P \ +atof.P atoi.P atol.P bsearch.P \ +calloc.P cfgetispeed.P cfgetospeed.P cfsetispeed.P cfsetospeed.P \ clock.P closedir.P ctime.P \ -ctypefcns.P div.P drand48.P \ +ctype.P ctypefcns.P div.P drand48.P \ dup2.P ecvt.P execvp.P \ fattach.P fdetach.P ffs.P fmtmsg.P \ frexp.P ftok.P ftw.P getcwd.P \ -getdate.P getdate_gd.P getenv.P getgrent.P getgrnam.P \ -gethz.P getlogin.P getopt.P getpwent.P \ -getpwnam.P getsubopt.P gettimeofday.P gettxt.P getut.P \ -hsearch.P import_def.P initgroups.P isatty.P isastream.P \ -l64a.P ldexp.P lfind.P localeconv.P lsearch.P \ +getenv.P getgrbuf.P getgrent.P getgrgid.P getgrnam.P \ +gethz.P getlogin.P getopt.P getpwbuf.P getpwent.P \ +getpwnam.P getpwuid.P getsubopt.P gettxt.P getut.P \ +hsearch.P import_def.P initgroups.P isatty.P l64a.P \ +ldexp.P lfind.P localeconv.P lsearch.P \ malloc.P mbstowcs.P mbtowc.P memccpy.P \ memchr.P memcmp.P memcpy.P memmove.P \ memset.P mkdev.P mkfifo.P mktemp.P \ -mlock.P modf.P mon.P msync.P munlock.P \ -nftw.P nl_langinfo.P \ -opendir.P opt_data.P perror.P \ -priocntl.P pt.P putenv.P \ +mlock.P mon.P msync.P munlock.P nl_langinfo.P \ +opendir.P opt_data.P pathconf.P perror.P \ +priocntl.P pt.P putenv.P putpwbuf.P \ putpwent.P qsort.P \ raise.P rand.P readdir.P rename.P \ -rewinddir.P seekdir.P select.P setlocale.P sigsend.P \ +rewinddir.P seekdir.P setlocale.P sigsend.P \ sigsetops.P sleep.P strcat.P strchr.P \ strcmp.P strcpy.P strcspn.P strdup.P \ strerror.P strftime.P strlen.P strncat.P \ strncmp.P strncpy.P strpbrk.P strrchr.P \ strspn.P strstr.P strtod.P strtok.P \ strtol.P strtoul.P strxfrm.P swab.P \ -swapctl.P sysconf.P syslog.P \ +swapctl.P sysconf.P \ tcdrain.P tcflow.P tcflush.P tcgetattr.P \ tcgetpgrp.P tcgetsid.P tcsendbreak.P tcsetattr.P \ tcsetpgrp.P tell.P telldir.P \ @@ -159,7 +156,7 @@ localeconv.o localeconv.p: $(INC)/stdio.h $(INC)/locale.h $(INC)/stddef.h \ $(INC)/limits.h dup2.o dup2.p _set_tab.o _set_tab.p ctype.o ctype.p \ strftime.o strftime.p: $(INC)/fcntl.h -getgrent.o getgrent.p \ +getgrent.o getgrent.p getgrgid.o getgrgid.p \ getgrnam.o getgrnam.p: $(INC)/grp.h dup2.o dup2.p strtol.o strtol.p strtoul.o strtoul.p: $(INC)/limits.h mon.o mon.p: $(INC)/mon.h $(INCSYS)/sys/types.h $(INC)/stdlib.h $(INC)/stdio.h \ @@ -169,6 +166,7 @@ modf.o modf.p modff.o modff.p raise.o raise.p: $(INCSYS)/sys/types.h \ ecvt.o ecvt.p frexp.o frexp.p ldexp.o ldexp.p \ modf.o modf.p: $(INC)/nan.h getpwent.o getpwent.p getpwnam.o getpwnam.p \ + getpwuid.o getpwuid.p \ putpwent.o putpwent.p: $(INC)/search.h tsearch.o tsearch.p tfind.o tfind.p: $(INC)/search.h abort.o abort.p sleep.o sleep.p \ @@ -215,7 +213,7 @@ _locale.o _locale.p div.o div.p mbtowc.o mbtowc.p \ strftime.o strftime.p: $(INCSYS)/sys/types.h strftime.o strftime.p \ strstr.o strstr.p: $(INC)/stddef.h -_set_tab.o _set_tab.p: $(INC)/unistd.h +_set_tab.o _set_tab.p: $(INC)/osfcn.h _loc_data.o _loc_data.p \ _locale.o _locale.p _set_tab.o _set_tab.p \ setlocale.o setlocale.p strftime.o strftime.p \ @@ -286,6 +284,8 @@ select.o select.p: $(INC)/values.h $(INC)/errno.h $(INCSYS)/sys/types.h \ sigflag.o sigflag.p: $(INC)/signal.h +siginfolst.o siginfolst.p: $(INC)/signal.h $(INC)/siginfo.h + siglist.o siglist.p: $(INC)/signal.h sigsend.o sigsend.p: $(INCSYS)/sys/types.h $(INCSYS)/sys/procset.h @@ -327,6 +327,10 @@ ttyname.o ttyname.p: $(INC)/stdio.h $(INCSYS)/sys/types.h $ $(INC)/dirent.h\ waitpid.o waitpid.p: $(INCSYS)/sys/types.h $(INCSYS)/sys/procset.h $(INCSYS)/sys/wait.h\ $(INC)/errno.h +pathconf.o pathconf.p: $(INCSYS)/sys/types.h $(INC)/errno.h $(INC)/stddef.h\ + $(INC)/limits.h $(INC)/unistd.h $(INCSYS)/sys/statvfs.h $(INCSYS)/sys/termios.h\ + $(INCSYS)/sys/sysconfig.h + swapctl.o swapctl.p: $(INCSYS)/sys/uadmin.h sysconf.o sysconf.p: $(INCSYS)/sys/types.h $(INC)/unistd.h $(INCSYS)/sys/sysconfig.h\ diff --git a/usr/src/lib/libc/port/gen/mkfifo.c b/usr/src/lib/libc/port/gen/mkfifo.c index b2d943c..cc3e211 100644 --- a/usr/src/lib/libc/port/gen/mkfifo.c +++ b/usr/src/lib/libc/port/gen/mkfifo.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/mkfifo.c 1.3" +#ident "@(#)libc-port:gen/mkfifo.c 1.1" /* * mkfifo(3c) - create a named pipe (FIFO). This code provides * a POSIX mkfifo function. @@ -16,13 +16,11 @@ #pragma weak mkfifo = _mkfifo #endif #include "synonyms.h" -#include -#include mkfifo(path,mode) -const char *path; +char *path; int mode; { mode &= 0777; /* only allow file access permissions */ - mode |= S_IFIFO; /* creating a FIFO */ + mode |= 0010000; /* creating a FIFO */ return(mknod(path,mode,0)); } diff --git a/usr/src/lib/libc/port/gen/modf.c b/usr/src/lib/libc/port/gen/modf.c index fae6b60..4c57891 100644 --- a/usr/src/lib/libc/port/gen/modf.c +++ b/usr/src/lib/libc/port/gen/modf.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/modf.c 1.10.1.5" +#ident "@(#)libc-port:gen/modf.c 1.10.1.4" /*LINTLIBRARY*/ /* * modf(value, iptr) returns the signed fractional part of value @@ -13,13 +13,10 @@ * */ -#ifdef __STDC__ - #pragma weak modf = _modf -#endif -#include "synonyms.h" #include #include #include +#include "synonyms.h" #include #include diff --git a/usr/src/lib/libc/port/gen/mon.c b/usr/src/lib/libc/port/gen/mon.c index 0dde774..2178def 100644 --- a/usr/src/lib/libc/port/gen/mon.c +++ b/usr/src/lib/libc/port/gen/mon.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/mon.c 2.23" +#ident "@(#)libc-port:gen/mon.c 2.18" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ /* @@ -16,20 +16,13 @@ * where name consists of argv[0] suitably massaged. * * - * Routines: - * (global) _monitor init, cleanup for prof(1)iling - * (global) _mcount function call counter - * (global) _mcount_newent call count entry manager - * (static) _mnewblock call count block allocator * - * - * Monitor(), coordinating with mcount(), mcount_newent() and mnewblock(), + * Monitor(), in coordination with mcount() and mnewblock(), * maintains a series of one or more blocks of prof-profiling * information. These blocks are added in response to calls to - * monitor() (explicitly or via mcrt[01]'s _start) and, via mcount()'s - * calls to mcount_newent() thence to mnewblock(). - * The blocks are tracked via a linked list of block anchors, - * which each point to a block. + * monitor(), explicitly or via mcrt0's _start, and, via mcount()'s + * calls to mnewblock(). The blocks are tracked via a linked list + * of block anchors, which each point to a block. * * * An anchor points forward, backward and 'down' (to a block). @@ -58,27 +51,22 @@ * + + * + execution + // data collected by system call, * + profile + // profil(2) (assumed ALWAYS specified - * + histogram + // by monitor()-caller, even if small; - * + + // never specified by mnewblock() ). + * + histogram + // by monitor()-caller; never specified + * + + // by mnewblock() ). * +-----------+ * * The first time monitor() is called, it sets up the chain - * by allocating an anchor and initializing countbase and countlimit - * to zero. Everyone assumes that they start out zeroed. + * by allocating an anchor and initializing countbase/limit. + * Jes aboot EVERYONE assumes that they start out 0ed. * - * When a user (or _start from mcrt[01]) calls monitor(), they + * When a user (or _start from mcrt0) calls monitor(), they * register a buffer which contains the third region (either with * a meaningful size, or so short that profil-ing is being shut off). - * - * For each fcn, the first time it calls mcount(), mcount calls - * mcount_newent(), which parcels out the fcn call count entries - * from the current block, until they are exausted; then it calls - * mnewblock(). - * - * Mnewbloc() allocates a block Without a third region, and - * links in a new associated anchor, adding a new anchor&block pair - * to the linked list. Each new mnewblock() block or user block, - * is added to the list as it comes in, FIFO. + * Mcount() parcels out the fcn call count entries from the + * current block, until they are exausted; then it calls mnewblock(). + * Mnewbloc() allocates a block Without the third region, and + * links in a new associated anchor. Each new mnewblock() or + * user block, is added to the list as it comes in. * * When monitor() is called to close up shop, it writes out * a summarizing header, ALL the fcn call counts from ALL @@ -87,23 +75,26 @@ * This preserves all call count information, even when * new blocks are specified. * - * NOTE - no block passed to monitor() may be freed, until + * NB - no block passed to monitor() may be freed, until * it is called to clean up!!!! * + * NB - Only monitor(), mcount() and mnewblock() may change + * countbase and countlimit!!!! */ #ifdef __STDC__ #pragma weak monitor = _monitor #endif #include "synonyms.h" -#include "shlib.h" #include #include #include -#include #include #define PROFDIR "PROFDIR" +#ifdef DEBUG + void dumpAnchors(), showArray(); +#endif char **___Argv = NULL; /* initialized to argv array by mcrt0 (if loaded) */ @@ -114,14 +105,9 @@ char **___Argv = NULL; /* initialized to argv array by mcrt0 (if loaded) */ * that function is called. * When countbase reaches countlimit, mcount() calls * mnewblock() to link in a new block. - * - * Only monitor/mcount/mcount_newent/mnewblock() should change these!! - * Correct that: only these routines are ABLE to change these; - * countbase/countlimit are now STATIC! + * Only monitor/mcount/mnewblock() should change these!! */ -static char *countbase; /* address of next pc,count cell to use in this block */ -static char *_countlimit; /* address limit for cells (addr after last cell) */ @@ -145,9 +131,22 @@ static ANCHOR firstAnchor; /* the first anchor to use - hopefully */ /* a speedup for most cases. */ -static char *mon_out; +static char mon_out[100]; +static char progname[15]; + + +#ifdef DEBUG +# define MNLISTMAX (64) + extern int _mcountcalls; + extern int _mc__cells; + extern int _mc__mnews; + static int mnewblkcalls = 0; + /* used by mnewblkcalls to track areas allocated - for debugging! */ + static ANCHOR *mnewlist[MNLISTMAX]; - + int monitorCalls = 0; /* #times monitor called */ + int monitorActive = 0; /* 1-if active, 0-if inactive */ +#endif void monitor(alowpc, ahighpc, buffer, bufsize, nfunc) @@ -159,23 +158,65 @@ int nfunc; /* max no. of functions whose calls are counted { int scale; long text; - register char *s; + register char *s, *name = mon_out; struct hdr *hdrp; ANCHOR *newanchp; int ssiz; char *lowpc = (char *)alowpc; char *highpc = (char *)ahighpc; +#ifdef DEBUG + monitorCalls++; monitorActive=1; + + printf("\t***>\nentering monitor(): low/hipc=%x/%x (hex).\n", lowpc,highpc); + printf("entering for %s-type call.\n", + ((lowpc==NULL) ? "EndCleanup" : "InitialSetup" ) ); + printf("number of calls to mcount,mnewblock so far, %d,%d\n", + _mcountcalls, mnewblkcalls ); + printf("number of cells taken, calls to mnewblock, %d,%d\n", + _mc__cells, _mc__mnews ); + showArray(); + printf(" buffer %x, bufsize %d, nfunc %d\n", buffer, bufsize, nfunc ); +#endif if (lowpc == NULL) { /* true only at the end */ if (curAnchor != NULL) { /* if anything was collected!.. */ + register pid_t pid; + register int n; +#ifdef DEBUG + aNewReport(); +#endif + if (progname[0] != '\0') { /* finish constructing + "PROFDIR/pid.progname" */ + /* set name to end of PROFDIR */ + name = strrchr(mon_out, '\0'); + if ((pid = getpid()) <= 0) /* extra test just in case */ + pid = 1; /* getpid returns something inappropriate */ + for (n = 10000; n > pid; n /= 10) + ; /* suppress leading zeros */ + for ( ; ; n /= 10) { + *name++ = pid/n + '0'; + if (n == 1) + break; + pid %= n; + } + *name++ = '.'; + (void)strcpy(name, progname); + } +#ifdef DEBUG + printf("write to file: %s\n", name); + dumpAnchors(); +#endif profil((char *)NULL, 0, 0, 0); if ( !writeBlocks() ) perror(mon_out); } +#ifdef DEBUG + monitorActive=0; +#endif return; } /* @@ -199,44 +240,20 @@ int nfunc; /* max no. of functions whose calls are counted return; if ((s = getenv(PROFDIR)) == NULL) /* PROFDIR not in environment */ - mon_out = MON_OUT; /* use default "mon.out" */ + (void)strcpy(name, MON_OUT); /* use default "mon.out" */ else if (*s == '\0') /* value of PROFDIR is NULL */ return; /* no profiling on this run */ - else { /* construct "PROFDIR/pid.progname" */ - register int n; - register pid_t pid; - register char *name; - size_t len; - - len = strlen(s); - /* 15 is space for /pid.mon.out\0, if necessary */ - if ((mon_out = malloc(len + strlen(___Argv[0]) + 15)) == NULL) { - perror(""); - return; - } - strcpy(mon_out, s); - name = mon_out + len; - *name++ = '/'; /* two slashes won't hurt */ - - if ((pid = getpid()) <= 0) /* extra test just in case */ - pid = 1; /* getpid returns something inappropriate */ - for (n = 10000; n > pid; n /= 10) - ; /* suppress leading zeros */ - for ( ; ; n /= 10) { - *name++ = pid/n + '0'; - if (n == 1) - break; - pid %= n; - } - *name++ = '.'; + else { /* set up mon_out and progname to construct + "PROFDIR/pid.progname" when done profiling */ + while (*s != '\0') /* copy PROFDIR value (path-prefix) */ + *name++ = *s++; + *name++ = '/'; /* two slashes won't hurt */ if (___Argv != NULL) /* mcrt0.s executed */ if ((s = strrchr(___Argv[0], '/')) != NULL) - strcpy(name, s + 1); + strcpy(progname, s + 1); else - strcpy(name, ___Argv[0]); - else - strcpy(name, MON_OUT); + strcpy(progname, ___Argv[0]); } @@ -271,6 +288,11 @@ int nfunc; /* max no. of functions whose calls are counted /* (set size of region 3) */ newanchp->histSize = bufsize*sizeof(WORD) - (_countlimit-(char*)buffer); +#ifdef DEBUG + printf("anchor %x:\n\tbuffer at %x\n\thistsize == %d (dec)\n", + newanchp, newanchp->monBuffer, newanchp->histSize); + printf("countbase/limit: %x/%x\n", countbase, _countlimit ); +#endif /* done w/regions 1 + 2: setup 3 */ /* to activate profil processing. */ @@ -297,9 +319,12 @@ int nfunc; /* max no. of functions whose calls are counted curAnchor = newanchp; /* make latest addition, the cur anchor */ +#ifdef DEBUG + monitorActive=0; +#endif } - + /* writeBlocks() - write accumulated profiling info, std fmt. * * This routine collects the function call counts, and the @@ -309,7 +334,8 @@ int nfunc; /* max no. of functions whose calls are counted */ static int -writeBlocks() { +writeBlocks() +{ int fd; int ok; @@ -341,6 +367,10 @@ writeBlocks() { ok = (write(fd, (char *)&sum, sizeof(sum)) == sizeof(sum)) ; +#ifdef DEBUG + printf("lowpc, highpc = 0x%x, 0x%x - nfunc = %d\n", + sum.lpc, sum.hpc, sum.nfns ); +#endif if (ok) /* if the hdr went out ok.. */ @@ -355,6 +385,17 @@ writeBlocks() { p = (char *)ap->monBuffer + sizeof(struct hdr); ok = (write(fd, p, amt) == amt); +#ifdef DEBUG + {int *pi; int i=0; + printf("==>a count array, at addr %08x:\n", p); + for(pi=(int *)p; amt>0; amt -= sizeof(int), pi++) + { + printf(" 0x%08x", *pi); + if( ++i == 4 ) + { putchar('\n'); i=0; } + } + } +#endif } /* count arrays out; write out histgm area */ @@ -366,6 +407,17 @@ writeBlocks() { ok = (write(fd, p, amt) == amt); +#ifdef DEBUG + {int *pi; int i=0; + printf("==>the histgm area, at addr %08x:\n", p); + for(pi=(int *)p; amt>0; amt -= sizeof(int), pi++) + { + printf(" 0x%08x", *pi); + if( ++i == 4 ) + { putchar('\n'); i=0; } + } + } +#endif } } @@ -376,21 +428,15 @@ writeBlocks() { - + /* mnewblock() - allocate and link in a new region1&2 block. * - * This routine, called by mcount_newent(), allocates a new block + * This routine, called by mcount(), allocates a new block * containing only regions 1 & 2 (hdr and fcn call count array), * and an associated anchor (see header comments), inits the * header (region 1) of the block, links the anchor into the * list, and resets the countbase/limit pointers. - * - * This routine cannot be called recursively, since (each) mcount - * has a local lock which prevents recursive calls to mcount_newent. - * See mcount_newent for more details. - * */ - #define THISMANYFCNS (MPROGS0*2) /* call malloc() to get an anchor & a regn1&2 block, together */ @@ -400,8 +446,10 @@ writeBlocks() { ) /* but No region 3 */\ ) +#ifdef DEBUG + static int depth = 0; +#endif -static void _mnewblock() { @@ -410,11 +458,26 @@ _mnewblock() char *p; +#ifdef DEBUG + if( ++depth > 1 ) + { + puts("awwwk!\n"); exit(); + } + + mnewblkcalls++; /* bump # of times called */ +#endif + + + countbase = NULL; /* turn off profile data collection, */ + /* while we get space. Resetting base */ + /* below will turn it back 'on'. */ + + /* get anchor And block, together */ p = (char *)malloc( GETTHISMUCH ); if (p == NULL) { - perror("mcount(mnewblock)"); + perror("mnewblock"); return; } @@ -438,84 +501,151 @@ _mnewblock() countbase = (char *)hdrp + sizeof(struct hdr); _countlimit = countbase + (THISMANYFCNS * sizeof(struct cnt)); - newanchp->histSize = 0 ; /* (set size of region 3.. to 0) */ + /* (set size of region 3.. to 0) */ + newanchp->histSize = 0 ; +#ifdef DEBUG + mnewlist[ mnewblkcalls-1 ] = newanchp; +#endif curAnchor = newanchp; /* make latest addition, the cur anchor */ +#ifdef DEBUG + depth--; +#endif } - -/* * * * * * - * mcount_newent() -- call to get a new mcount call count entry. - * - * this function is called by _mcount to get a new call count entry - * (struct cnt, in the region allocated by _monitor()), or to return - * zero if profiling is off. - * - * This function acts as a funnel, an access function to make sure - * that all instances of mcount (the one in the a.out, and any in - * any shared objects) all get entries from the same array, and - * all know when profiling is off. - * - * NOTE: when mcount calls this function, it sets a private flag - * so that it does not call again until this function returns, - * thus preventing recursion. - * - * At Worst, the mcount in either a shared object or the a.out - * could call once, and then the mcount living in the shared object - * with monitor could call a second time (i.e. libc.so.1, although - * presently it does not have mcount in it). This worst case - * would involve Two active calls to mcount_newent, which it can - * handle, since the second one would find a already-set value - * in countbase. - * - * The only unfortunate result is that No new call counts - * will be handed out until this function returns. - * Thus if malloc or other routines called inductively by - * this routine have not yet been provided with a call count entry, - * they will not get one until this function call is completed. - * Thus a few calls to library routines during the course of - * profiling setup, may not be counted. - * - * NOTE: countbase points at the next available entry, and - * countlimit points past the last valid entry, in the current - * function call counts array. - * - * - * if profiling is off // countbase==0 - * just return 0 - * - * else - * if need more entries // because countbase points last valid entry - * link in a new block, resetting countbase and countlimit - * endif - * if Got more entries - * return pointer to the next available entry, and - * update pointer-to-next-slot before you return. - * - * else // failed to get more entries - * just return 0 - * - * endif - * endif - */ -struct cnt * -_mcount_newent() +#ifdef DEBUG + +void +dumpAnchors() { - if ( countbase == 0 ) - return ((struct cnt *) 0 ); + int nanch,histno; + ANCHOR *ap,*histp; - if ( countbase >= _countlimit ) - _mnewblock(); /* get a new block; set countbase */ + if( curAnchor==NULL ) + { + printf("No anchors initialized (curAnchor is NULL).\n"); + return; + } - if ( countbase != 0 ) + nanch=0; + histno=0; histp=NULL; + for( ap = &firstAnchor; ap!=NULL; ap = ap->next ) { - struct cnt *cur_countbase = (struct cnt *) countbase; + printf("anchor at %x, next is at %x.\n", ap, ap->next ); + nanch++; + if( ap->flags & HAS_HISTOGRAM ) + { + histno=nanch; + histp=ap; + } + } + printf("%d anchor(s), %dTH has last histogram.\n", nanch, histno); +} - countbase += sizeof(struct cnt); - return ( cur_countbase ); - } else - return ((struct cnt *) 0 ); +void +showArray() +{ + int i; + ANCHOR *p, *lastp; + + printf("\nShowing values of curAnchor set by mnewblock..\n"); + lastp= NULL; + for(i=0;i\n",i); + else + { + printf("\tanch @ %08x: nx %08x pr %08x dn %08x fl %d\n", + mnewlist[i], mnewlist[i]->next, + mnewlist[i]->prior, + mnewlist[i]->monBuffer, + mnewlist[i]->flags ); + + /* if not right, go lastp->forward, and here->back */ + if(lastp==NULL || ( + (lastp != mnewlist[i]->prior)|| + (lastp->next != mnewlist[i] ) + ) + ) + { + printf("Current PR != last NX!! Dump chains.\n"); + printf("\ttrack from prior, forward...\n"); + for( p=lastp; p!=mnewlist[i] && p!=NULL; p=p->next) + printf( + "\t\t@ %08x nx %08x pr %08x dn %08x fl %d\n", + p, p->next, p->prior, p->monBuffer, + p->flags ); + printf("\ttrack from here, backward..\n"); + for( p=mnewlist[i]; p!=lastp && p!=NULL; p=p->prior) + printf( + "\t\t@ %08x nx %08x pr %08x dn %08x fl %d\n", + p, p->next, p->prior, p->monBuffer, + p->flags ); + } + } + lastp= mnewlist[i]; + } } + + + + +static int aNewCount = 0; +struct nu +{ + char *b, *l, *a; + short curcalls, curactivity; +}; + +struct nu aNewList[128]; + +aNewBase(awp) +char *awp; /* pointer to fcn's a_word */ +{ + extern char *countbase, *_countlimit; + + aNewList[aNewCount].b = countbase ; + aNewList[aNewCount].l = _countlimit ; + aNewList[aNewCount].a = awp ; + aNewList[aNewCount].curcalls = monitorCalls ; + aNewList[aNewCount].curactivity = monitorActive ; + + aNewCount++; + +} + + +aNewReport() +{ + extern char *countbase, *_countlimit; + char *t1; + int i; + + t1 = countbase; + countbase = 0; + + printf("count is %d..\n\t- countbase, countlimit, callerRetAd, #MonCalls, MonStatus\n", + aNewCount); + for(i=0;i #include #include -#include -#include #ifndef PATH_MAX #define PATH_MAX 1023 @@ -79,21 +77,12 @@ extern int errno; static int walk(); static int oldclose(); -#ifdef __STDC__ -static int (*statf)(const char *, struct stat *); -#else static int (*statf)(); -#endif static char *fullpath; static char *tmppath; static int curflags; static dev_t cur_mount; -#ifdef DSHLIB -static struct FTW *state; -#else -static struct FTW st_state; -static struct FTW *state = &st_state; -#endif +static struct FTW state; struct Save { @@ -120,11 +109,6 @@ int (*fn)(); const char *savepath = path; home[0] = 0; -#ifdef DSHLIB - if (!state && ((state = (struct FTW *)malloc(sizeof(struct FTW))) == NULL)) - return(-1); -#endif - /* If the walk is going to change directory before * reading it, save current woring directory. */ @@ -148,7 +132,7 @@ int (*fn)(); *dp++ = *path++; } *dp = 0; - state->base = base+1-tmppath; + state.base = base+1-tmppath; if(*path) return(-1); curflags = flags; @@ -171,7 +155,7 @@ int (*fn)(); else goto done; } - state->level = 0; + state.level = 0; /* Call walk() which does most of the work. */ @@ -301,15 +285,15 @@ struct Save *last; */ if((curflags&FTW_MOUNT) && type!=FTW_NS && statb.st_dev!=cur_mount) goto quit; - state->quit = 0; + state.quit = 0; /* If current component is not a directory, call user * specified function and get ready to return. */ if(type!=FTW_D || (curflags&FTW_DEPTH)==0) - rc = (*fn)(tmppath, &statb, type, state); - skip = (state->quit&FTW_SKD); - if(rc != 0 || type !=FTW_D || state->quit&FTW_PRUNE) + rc = (*fn)(tmppath, &statb, type, &state); + skip = (state.quit&FTW_SKD); + if(rc != 0 || type !=FTW_D || state.quit&FTW_PRUNE) goto quit; if(tmppath[0] != '\0' && component[-1] != '/') @@ -339,8 +323,8 @@ struct Save *last; } this.dev = statb.st_dev; this.inode = statb.st_ino; - oldbase = state->base; - state->base = component-tmppath; + oldbase = state.base; + state.base = component-tmppath; while(dir = readdir(this.fd)) { if(dir->d_ino == 0) @@ -357,12 +341,12 @@ struct Save *last; while(p < &tmppath[PATH_MAX] && *q != '\0') *p++ = *q++; *p = '\0'; - state->level++; + state.level++; /* Call walk() recursively. */ rc = walk(p, fn, depth-1, &this); - state->level--; + state.level--; if(rc != 0) continue; if(this.fd == 0) @@ -373,11 +357,11 @@ struct Save *last; seekdir(this.fd, this.here); } } - state->base = oldbase; + state.base = oldbase; *--component = 0; type = FTW_DP; if((curflags&(FTW_DEPTH)) && !skip) - rc = (*fn)(tmppath, &statb, type, state); + rc = (*fn)(tmppath, &statb, type, &state); quit: if(cdval >= 0 && last) { diff --git a/usr/src/lib/libc/port/gen/nl_langinfo.c b/usr/src/lib/libc/port/gen/nl_langinfo.c index cc92975..539f3f2 100644 --- a/usr/src/lib/libc/port/gen/nl_langinfo.c +++ b/usr/src/lib/libc/port/gen/nl_langinfo.c @@ -5,27 +5,17 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/nl_langinfo.c 1.6" +#ident "@(#)libc-port:gen/nl_langinfo.c 1.1" -#ifdef __STDC__ - #pragma weak nl_langinfo = _nl_langinfo -#endif -#include "synonyms.h" #include -#include #include #include #include #include -#include #define MAX 64 -#ifdef __STDC__ -extern char *gettxt(const char *, const char *); -#else extern char *gettxt(); -#endif extern size_t strftime(); extern struct lconv *localeconv(); @@ -36,15 +26,11 @@ nl_langinfo( item ) nl_item item; { struct tm tm; -static char *buf; -char *buf2; +static char buf[MAX]; +static char buf2[MAX]; struct lconv *currency; char *s; int size; -const char *rptr; - - if (!buf && (buf = malloc(2 * MAX)) == NULL) - return ""; switch (item) { /* @@ -56,70 +42,63 @@ const char *rptr; tm.tm_wday=0; size = strftime(buf,MAX,"%A",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Sunday"; - break; + return "Sunday"; case DAY_2 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=1; size = strftime(buf,MAX,"%A",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Monday"; - break; + return "Monday"; case DAY_3 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=2; size = strftime(buf,MAX,"%A",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Tuesday"; - break; + return "Tuesday"; case DAY_4 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=3; size = strftime(buf,MAX,"%A",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Wednesday"; - break; + return "Wednesday"; case DAY_5 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=4; size = strftime(buf,MAX,"%A",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Thursday"; - break; + return "Thursday"; case DAY_6 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=5; size = strftime(buf,MAX,"%A",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Friday"; - break; + return "Friday"; case DAY_7 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=6; size = strftime(buf,MAX,"%A",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Saturday"; - break; + return "Saturday"; /* @@ -130,70 +109,63 @@ const char *rptr; tm.tm_wday=0; size = strftime(buf,MAX,"%a",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Sun"; - break; + return "Sun"; case ABDAY_2 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=1; size = strftime(buf,MAX,"%a",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Mon"; - break; + return "Mon"; case ABDAY_3 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=2; size = strftime(buf,MAX,"%a",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Tue"; - break; + return "Tue"; case ABDAY_4 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=3; size = strftime(buf,MAX,"%a",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Wed"; - break; + return "Wed"; case ABDAY_5 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=4; size = strftime(buf,MAX,"%a",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Thur"; - break; + return "Thur"; case ABDAY_6 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=5; size = strftime(buf,MAX,"%a",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Fri"; - break; + return "Fri"; case ABDAY_7 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_wday=6; size = strftime(buf,MAX,"%a",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Sat"; - break; + return "Sat"; @@ -205,120 +177,108 @@ const char *rptr; tm.tm_mon=0; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "January"; - break; + return "January"; case MON_2 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=1; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Feburary"; - break; + return "Feburary"; case MON_3 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=2; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "March"; - break; + return "March"; case MON_4 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=3; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "April"; - break; + return "April"; case MON_5 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=4; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "May"; - break; + return "May"; case MON_6 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=5; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "June"; - break; + return "June"; case MON_7 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=6; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "July"; - break; + return "July"; case MON_8 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=7; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "August"; - break; + return "August"; case MON_9 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=8; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "September"; - break; + return "September"; case MON_10 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=9; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "October"; - break; + return "October"; case MON_11 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=10; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "November"; - break; + return "November"; case MON_12 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=11; size = strftime(buf,MAX,"%B",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "December"; - break; + return "December"; /* * ... and their abbreviated form @@ -328,140 +288,126 @@ const char *rptr; tm.tm_mon=0; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Jan"; - break; + return "Jan"; case ABMON_2 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=1; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Feb"; - break; + return "Feb"; case ABMON_3 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=2; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Mar"; - break; + return "Mar"; case ABMON_4 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=3; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Apr"; - break; + return "Apr"; case ABMON_5 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=4; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "May"; - break; + return "May"; case ABMON_6 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=5; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Jun"; - break; + return "Jun"; case ABMON_7 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=6; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Jul"; - break; + return "Jul"; case ABMON_8 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=7; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Aug"; - break; + return "Aug"; case ABMON_9 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=8; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Sep"; - break; + return "Sep"; case ABMON_10 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=9; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Oct"; - break; + return "Oct"; case ABMON_11 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=10; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Nov"; - break; + return "Nov"; case ABMON_12 : memset((void*)&tm,sizeof (struct tm),0); tm.tm_mon=11; size = strftime(buf,MAX,"%b",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "Dec"; - break; + return "Dec"; case AM_STR : memset((void*)&tm,sizeof (struct tm),0); tm.tm_hour=1; size = strftime(buf,MAX,"%p",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "AM"; - break; + return "AM"; case PM_STR : memset((void*)&tm,sizeof (struct tm),0); tm.tm_hour=13; size = strftime(buf,MAX,"%p",&tm); if (size) - rptr = (const char *) buf; + return buf; else - rptr = "PM"; - break; + return "PM"; /* @@ -482,16 +428,8 @@ const char *rptr; return currency->decimal_point; case CRNCYSTR : - if (currency->p_cs_precedes == CHAR_MAX || *(currency->currency_symbol) == '\0') - return ""; - if (currency->p_cs_precedes == 1) - buf[0] = '-'; - else - buf[0] = '+'; - strcpy(&buf[1], currency->currency_symbol); - return buf; + return currency->currency_symbol; } - break; /* * Default string used to format date and time @@ -505,10 +443,9 @@ const char *rptr; s = gettxt("Xopen_info:1","%H:%M:%S"); setlocale(LC_MESSAGES,buf); if (strcmp(s,"Message not found!!\n")) - rptr = (const char *) s; + return s; else - rptr = "%H:%M:%S"; - break; + return "%H:%M:%S"; case D_FMT : old_locale = setlocale(LC_MESSAGES,(char*)NULL); @@ -517,22 +454,20 @@ const char *rptr; s = gettxt("Xopen_info:2","%m/%d/%y"); setlocale(LC_MESSAGES,buf); if (strcmp(s,"Message not found!!\n")) - rptr = (const char *) s; + return s; else - rptr = "%m/%d/%y"; - break; + return "%m/%d/%y"; case D_T_FMT : old_locale = setlocale(LC_MESSAGES,(char*)NULL); strcpy(buf,old_locale); (void)setlocale(LC_MESSAGES,setlocale(LC_TIME,(char*)NULL)); - s = gettxt("Xopen_info:3","%a %b %d %H:%M:%S %Y"); + s = gettxt("Xopen_info:3","%a %b %d %T %Z %Y"); setlocale(LC_MESSAGES,buf); if (strcmp(s,"Message not found!!\n")) - rptr = (const char *) s; + return s; else - rptr = "%a %b %d %H:%M:%S %Y"; - break; + return "%a %b %d %T %Z %Y"; case YESSTR : old_locale = setlocale(LC_MESSAGES,(char*)NULL); @@ -553,10 +488,9 @@ const char *rptr; s = gettxt("Xopen_info:4","yes"); setlocale(LC_MESSAGES,buf); if (strcmp(s,"Message not found!!\n")) - rptr = (const char *) s; + return s; else - rptr = "yes"; - break; + return "yes"; case NOSTR : old_locale = setlocale(LC_MESSAGES,(char*)NULL); @@ -578,16 +512,12 @@ const char *rptr; s = gettxt("Xopen_info:5","no"); setlocale(LC_MESSAGES,buf); if (strcmp(s,"Message not found!!\n")) - rptr = (const char *) s; + return s; else - rptr = "no"; - break; + return "no"; default : - rptr = ""; - break; + return ""; } - - return (char *) rptr; } diff --git a/usr/src/lib/libc/port/gen/opendir.c b/usr/src/lib/libc/port/gen/opendir.c index e138676..b219c8d 100644 --- a/usr/src/lib/libc/port/gen/opendir.c +++ b/usr/src/lib/libc/port/gen/opendir.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/opendir.c 1.13" +#ident "@(#)libc-port:gen/opendir.c 1.12" /* opendir -- C library extension routine @@ -18,7 +18,6 @@ #include "shlib.h" #include #include -#include #include #include #include @@ -38,11 +37,6 @@ const char *filename; /* name of directory */ if ( (fd = open( filename, 0 )) < 0 ) return NULL; - /* POSIX mandated behavior - * close on exec if using file descriptor - */ - if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) - return NULL; if ( (fstat( fd, &sbuf ) < 0) || ((sbuf.st_mode & S_IFMT) != S_IFDIR) || ((dirp = (DIR *)malloc( sizeof(DIR) )) == NULL) diff --git a/usr/src/lib/libc/port/gen/pathconf.c b/usr/src/lib/libc/port/gen/pathconf.c new file mode 100644 index 0000000..d24ca4a --- /dev/null +++ b/usr/src/lib/libc/port/gen/pathconf.c @@ -0,0 +1,126 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/pathconf.c 1.2" +/* +** pathconf(3c) - returns system configuration information based +** on path. This code provides a POSIX pathconf function. +** +*/ + +#ifdef __STDC__ + #pragma weak pathconf = _pathconf + #pragma weak fpathconf = _fpathconf +#endif +#include "synonyms.h" +#include +#include +#include +#include +#include +#include +#include + + +pathconf(path, name) +char *path; +int name; +{ +struct statvfs vfsbuf; + + switch(name) { + + default: + errno = EINVAL; + return(-1); + + case _PC_LINK_MAX: + return(LINK_MAX); /* defined in limits.h */ + + case _PC_MAX_CANON: + return(MAX_CANON); /* defined in termios.h */ + + case _PC_MAX_INPUT: + return(MAX_INPUT); /* defined in termios.h */ + + case _PC_PATH_MAX: + return(PATH_MAX); /* defined in limits.h */ + + case _PC_PIPE_BUF: + return(PIPE_BUF); /* defined in limits.h */ + + case _PC_NO_TRUNC: + if (path != NULL) { + if (statvfs(path, &vfsbuf)) + return(-1); /* errno set by statvfs */ + + if (vfsbuf.f_flag & ST_NOTRUNC) + return (1); + else { + errno = EINVAL; + return (-1); + } + } + errno = ENOENT; + return(-1); + + case _PC_VDISABLE: + return(_POSIX_VDISABLE); /* defined in termios.h */ + + case _PC_NAME_MAX: + if (path != NULL) { + if (statvfs(path, &vfsbuf)) + return(-1); /* errno set by statvfs */ + + return(vfsbuf.f_namemax); + } + errno = ENOENT; + return(-1); + + case _PC_CHOWN_RESTRICTED: + { + int ret; + if ((ret = _sysconfig(_CONFIG_CHOWN_RST)) == 0) { + errno = EINVAL; + return(-1); + } else + return(ret); + } + + + + } +} + +fpathconf(fd, name) +int fd; +int name; +{ +struct statvfs vfsbuf; + + if (name == _PC_NAME_MAX) { + if (fstatvfs(fd, &vfsbuf)) + return(-1); /* errno set by fstatvfs */ + return(vfsbuf.f_namemax); + } + + if (name == _PC_NO_TRUNC) { + if (fstatvfs(fd, &vfsbuf)) + return(-1); /* errno set by statvfs */ + + if (vfsbuf.f_flag & ST_NOTRUNC) + + return (1); + else { + errno = EINVAL; + return (-1); + } + + } + + return(pathconf(NULL, name)); +} diff --git a/usr/src/lib/libc/port/gen/psiginfo.c b/usr/src/lib/libc/port/gen/psiginfo.c index 717a7ec..e054dc7 100644 --- a/usr/src/lib/libc/port/gen/psiginfo.c +++ b/usr/src/lib/libc/port/gen/psiginfo.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/psiginfo.c 1.2" +#ident "@(#)libc-port:gen/psiginfo.c 1.1" /* * Print the name of the siginfo indicated by "sig", along with the @@ -31,8 +31,6 @@ char *s; if (sip == 0) return; - (void) write(2, s, (unsigned)strlen(s)); - (void) write(2, ": ", 2); c = _sys_siglist[sip->si_signo]; (void) write(2, c, (unsigned)strlen(c)); if (sip->si_code == 0) { @@ -58,5 +56,7 @@ char *s; (void) write(2, c, (unsigned)strlen(c)); (void) write(2, ")", 1); } + (void) write(2, ": ", 2); + (void) write(2, s, (unsigned)strlen(s)); (void) write(2, "\n", 1); } diff --git a/usr/src/lib/libc/port/gen/pt.c b/usr/src/lib/libc/port/gen/pt.c index a64c0b0..66bbfb2 100644 --- a/usr/src/lib/libc/port/gen/pt.c +++ b/usr/src/lib/libc/port/gen/pt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/pt.c 1.4" +#ident "@(#)libc-port:gen/pt.c 1.1" #ifdef __STDC__ #pragma weak ptsname = _ptsname @@ -15,14 +15,8 @@ #include "synonyms.h" #include "sys/types.h" -#ifdef i386 -#include -#include -#include -#else -#include -#include -#endif +#include "sys/psw.h" +#include "sys/pcb.h" #include "sys/param.h" #include "sys/mkdev.h" #include "sys/fs/s5dir.h" @@ -34,8 +28,6 @@ #include "sys/fcntl.h" #include "sys/stat.h" #include "sys/ptms.h" -#include -#include #define PTSNAME "/dev/pts/" /* slave name */ #define PTLEN 13 /* slave name length */ diff --git a/usr/src/lib/libc/port/gen/putenv.c b/usr/src/lib/libc/port/gen/putenv.c index 228f92a..bc53c34 100644 --- a/usr/src/lib/libc/port/gen/putenv.c +++ b/usr/src/lib/libc/port/gen/putenv.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/putenv.c 1.11" +#ident "@(#)libc-port:gen/putenv.c 1.9.1.1" /* LINTLIBRARY */ /* putenv - change environment variables @@ -31,7 +31,7 @@ static int find(), match(); int putenv(change) -char *change; +const char *change; { char **newenv; /* points to new environment */ register int which; /* index of variable to replace */ diff --git a/usr/src/lib/libc/port/gen/putpwbuf.c b/usr/src/lib/libc/port/gen/putpwbuf.c new file mode 100644 index 0000000..f8e49c7 --- /dev/null +++ b/usr/src/lib/libc/port/gen/putpwbuf.c @@ -0,0 +1,149 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/putpwbuf.c 1.1" +/* 3.0 SID # 1.2 */ +/*LINTLIBRARY*/ +/* + * format a password file entry + */ + +#include "synonyms.h" +#include /* BUFSIZ only! nothing else */ +#include +#include + + +typedef struct +{ + char *buf; + char *ptr; + size_t cnt; +#ifdef __STDC__ + int (*fls)(void *, char *, size_t); + void *iop; +#else + int (*fls)(); + char *iop; +#endif +} Buf; + +#ifdef __STDC__ + #undef const +#else + #undef const + #define const +#endif + +static const char colon[] = ":", + comma[] = ",", + newline[] = "\n"; + +static int +copy(b, p) + register + Buf *b; + register + const char *p; +{ + register size_t len, left; + int err = 0; + + if (p == 0) + { + if (b->cnt == BUFSIZ) + return 0; + return (*b->fls)(b->iop, b->buf, (size_t)(BUFSIZ - b->cnt)); + } + len = strlen(p); + while (len != 0) + { + if (b->cnt == 0) + { + err |= (*b->fls)(b->iop, b->buf, (size_t)BUFSIZ); + b->ptr = b->buf; + b->cnt = BUFSIZ; + } + left = b->cnt; + if (len < left) + left = len; + (void)memcpy(b->ptr, p, left); + b->ptr += left; + b->cnt -= left; + p += left; + len -= left; + } + return err; +} + + +static size_t +utoa(val, buf, buflen) + unsigned val; + char *buf; + size_t buflen; +{ + static + const char digs[] = "0123456789"; + size_t len = 0; + unsigned d; + + d = val % 10; + val /= 10; + if (val != 0 && buflen > 2) + len = utoa(val, buf, buflen - 1); + buf[len] = digs[d]; + buf[++len] = '\0'; + return len; +} + + +int +#ifdef __STDC__ +_putpwbuf(register const struct passwd *p, + int (*fls)(void *, char *, size_t), void *iop) +#else +_putpwbuf(p, fls, iop) + register const struct passwd *p; + register int (*fls)(); + char *iop; +#endif +{ + char line[BUFSIZ]; + char num[100]; + Buf b; + int err = 0; + + b.buf = line; + b.ptr = line; + b.cnt = BUFSIZ; + b.fls = fls; + b.iop = iop; + + err |= copy(&b, p->pw_name); + err |= copy(&b, colon); + err |= copy(&b, p->pw_passwd); + if((*p->pw_age) != '\0') + { + err |= copy(&b, comma); + err |= copy(&b, p->pw_age); + } + err |= copy(&b, colon); + (void)utoa((unsigned)p->pw_uid, num, sizeof(num)); + err |= copy(&b, num); + err |= copy(&b, colon); + utoa((unsigned)p->pw_gid, num, sizeof(num)); + err |= copy(&b, num); + err |= copy(&b, colon); + err |= copy(&b, p->pw_gecos); + err |= copy(&b, colon); + err |= copy(&b, p->pw_dir); + err |= copy(&b, colon); + err |= copy(&b, p->pw_shell); + err |= copy(&b, newline); + return err | copy(&b, (char *)0); +} diff --git a/usr/src/lib/libc/port/gen/putpwent.c b/usr/src/lib/libc/port/gen/putpwent.c index 5e959a9..1a56e2e 100644 --- a/usr/src/lib/libc/port/gen/putpwent.c +++ b/usr/src/lib/libc/port/gen/putpwent.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/putpwent.c 1.10" +#ident "@(#)libc-port:gen/putpwent.c 1.9" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ /* @@ -18,21 +18,36 @@ #include #include +#ifdef __STDC__ + int _putpwbuf(const struct passwd *, + int (*)(void *, char *, size_t), void *); +#else + int _putpwbuf(); +#endif + +static int +#ifdef __STDC__ +fls(void *f, char *buf, size_t n) +#else +fls(f, buf, n) + char *f; + char *buf; + size_t n; +#endif +{ + fwrite(buf, n, 1, (FILE *)f); + return ferror(((FILE *)f)); +} + + int putpwent(p, f) register const struct passwd *p; register FILE *f; { - (void) fprintf(f, "%s:%s", p->pw_name, p->pw_passwd); - if((*p->pw_age) != '\0') - (void) fprintf(f, ",%s", p->pw_age); - (void) fprintf(f, ":%u:%u:%s:%s:%s", - p->pw_uid, - p->pw_gid, - p->pw_gecos, - p->pw_dir, - p->pw_shell); - (void) putc('\n', f); - (void) fflush(f); - return(ferror(f)); + int err; + + err = _putpwbuf(p, fls, (char *)f); + (void)fflush(f); + return err | ferror(f); } diff --git a/usr/src/lib/libc/port/gen/realpath.c b/usr/src/lib/libc/port/gen/realpath.c index 312f02b..81a633b 100644 --- a/usr/src/lib/libc/port/gen/realpath.c +++ b/usr/src/lib/libc/port/gen/realpath.c @@ -5,230 +5,238 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/realpath.c 1.2" - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ +#ident "@(#)libc-port:gen/realpath.c 1.1" #ifdef __STDC__ #pragma weak realpath = _realpath - #include "synonyms.h" #endif -#include -#include +#include "synonyms.h" +#include +#include +#include #include +#include +#include #include -extern char *getcwd(); +/* + * Resolve all links for the given "name" and returns the result + * in "actual". Returns pointer to the result if successful, else + * NULL and errno is set. "actual" contains the path name of the + * fault point. + */ +static char * +resolvelinks(name, actual) + register char *name; + char *actual; +{ int last_is_slash = 0; + register char *p = actual; + char namebuf[MAXPATHLEN]; + register char *tmpname = namebuf; + + actual[0] = NULL; + if ((name == NULL) || (name[0] == NULL)) + return (actual); + if (name[0] == '/') { + actual[0] = '/'; + actual[1] = NULL; + if (*++name == NULL) + return (actual); + ++p; + } + + if (name[strlen(name) - 1] == '/') + ++last_is_slash; + + strcpy(tmpname, name); /* Work in tmp area only */ + + /* + * "tmpname" points to the yet unresolved path name. + * "actual" points to the resolved path name so far. + */ + while (tmpname) { + register char *start; /* The new step */ + char tmpres[MAXPATHLEN]; /* Temp result */ + struct stat stbuf; + + start = tmpname; + if (tmpname = strchr(tmpname, '/')) + *tmpname++ = NULL; + + /* start points to the new step */ + sprintf(tmpres, "%s%s", actual, start); + if (lstat(tmpres, &stbuf) == -1) { + strcpy(actual, tmpres); /* Point of error */ + return (NULL); + } + + if ((stbuf.st_mode & S_IFMT) == S_IFLNK) { + char buf[MAXPATHLEN]; + int count; + + if ((count = readlink(tmpres, buf, MAXPATHLEN)) <= 0) { + strcpy(actual, tmpres); /* Point of error */ + return (NULL); + } else { + char tmpdir[MAXPATHLEN]; + char tmpbuf[MAXPATHLEN]; + char *tptr = &tmpbuf[0]; + char *resolved_res; + + buf[count] = NULL; + /* + * Recursively check for all new links. + */ + if (getcwd(tmpdir, MAXPATHLEN) == NULL) + return (NULL); + if (chdir(actual) == -1) + return (NULL); + resolved_res = resolvelinks(buf, tmpbuf); + if (tmpbuf[0] == '/') + /* The link starts from root */ + for (p = &actual[0]; + *p = *tptr; p++, tptr++); + else + for (; *p = *tptr; p++, tptr++); + if (resolved_res == NULL) { + (void) chdir(tmpdir); + return (NULL); + } + if (chdir(tmpdir) == -1) + return (NULL); + } + } else + /* Append start to actual */ + for (; *p = *start; p++, start++); + + if (*(p - sizeof(char)) != '/') + *p++ = '/'; /* Append '/' to actual */ + *p = NULL; + } -/* LINTLIBRARY */ + /* Add/delete "/" depending upon last_is_slash */ + if (last_is_slash == 0) { + if ((*(p - sizeof(char)) == '/') && (actual[1] != NULL)) + *--p = NULL; + } else if (*(p - sizeof(char)) != '/') + *p++ = '/'; + *p = NULL; + + return (actual); +} /* - * Input name in raw, canonicalized pathname output to canon. If dosymlinks - * is nonzero, resolves all symbolic links encountered during canonicalization - * into an equivalent symlink-free form. Returns 0 on success, -1 on failure. - * The routine fails if the current working directory can't be obtained or if - * either of the arguments is NULL. - * - * Sets errno on failure. + * Given a path, it removes all the '.' and '..' in it and returns + * pointer to the result if successful, else returns NULL and the + * error number is set. The partially prepared result is in "dots". */ -static int -pathcanon(raw, canon, dosymlinks) - char *raw, - *canon; - int dosymlinks; +static char * +resolvedots(actual, dots) + register char *actual; + register char *dots; /* The result */ { - register char *s, - *d; - register char *limit = canon + MAXPATHLEN; - char *modcanon; - int nlink = 0; - - /* - * Do a bit of sanity checking. - */ - if (raw == NULL || canon == NULL) { - errno = EINVAL; - return (-1); - } - - /* - * If the path in raw is not already absolute, convert it to that form. - * In any case, initialize canon with the absolute form of raw. Make - * sure that none of the operations overflow the corresponding buffers. - * The code below does the copy operations by hand so that it can easily - * keep track of whether overflow is about to occur. - */ - s = raw; - d = canon; - if (*s != '/') { - /* Relative; prepend the working directory. */ - if (getcwd(d, MAXPATHLEN) == NULL) { - /* Use whatever errno value getcwd may have left around. */ - return (-1); + struct stat stbuf; + int last_is_slash = 0; + char pwd[MAXPATHLEN]; + char *endp; + + if (dots == NULL) { + errno = EINVAL; + return (NULL); + } + dots[0] = NULL; + + if ((actual == NULL) || (actual[0] == NULL)) + return (dots); + if (actual[strlen(actual) - 1] == '/') + ++last_is_slash; + if (getcwd(pwd, MAXPATHLEN) == NULL) + return (NULL); + + if (lstat(actual, &stbuf) == -1) { + strcpy(dots, actual); + return (NULL); } - d += strlen(d); - /* Add slash to separate working directory from relative part. */ - if (d < limit) - *d++ = '/'; - modcanon = d; - } else - modcanon = canon; - while (d < limit && *s) - *d++ = *s++; - - /* Add a trailing slash to simplify the code below. */ - s = "/"; - while (d < limit && (*d++ = *s++)) - continue; - - - /* - * Canonicalize the path. The strategy is to update in place, with - * d pointing to the end of the canonicalized portion and s to the - * current spot from which we're copying. This works because - * canonicalization doesn't increase path length, except as discussed - * below. Note also that the path has had a slash added at its end. - * This greatly simplifies the treatment of boundary conditions. - */ - d = s = modcanon; - while (d < limit && *s) { - if ((*d++ = *s++) == '/' && d > canon + 1) { - register char *t = d - 2; - - switch (*t) { - case '/': - /* Found // in the name. */ - d--; - continue; - case '.': - switch (*--t) { - case '/': - /* Found /./ in the name. */ - d -= 2; - continue; - case '.': - if (*--t == '/') { - /* Found /../ in the name. */ - while (t > canon && *--t != '/') - continue; - d = t + 1; - } - continue; - default: - break; + if ((stbuf.st_mode & S_IFMT) == S_IFDIR) { + char dir[MAXPATHLEN]; + + if ((chdir(actual) != 0) || (getcwd(dir, MAXPATHLEN) == NULL)) { + (void) chdir(pwd); + strcpy(dots, actual); + return (NULL); } - break; - default: - break; - } - /* - * We're at the end of a component. If dosymlinks is set - * see whether the component is a symbolic link. If so, - * replace it by its contents. - */ - if (dosymlinks) { - char link[MAXPATHLEN + 1]; - register int llen; - - /* - * See whether it's a symlink by trying to read it. - * - * Start by isolating it. - */ - *(d - 1) = '\0'; - if ((llen = readlink(canon, link, sizeof link)) >= 0) { - /* Make sure that there are no circular links. */ - nlink++; - if (nlink > MAXSYMLINKS) { - errno = ELOOP; - return (-1); - } - /* - * The component is a symlink. Since its value can be - * of arbitrary size, we can't continue copying in place. - * Instead, form the new path suffix in the link buffer - * and then copy it back to its proper spot in canon. - */ - t = link + llen; - *t++ = '/'; - /* - * Copy the remaining unresolved portion to the end - * of the symlink. If the sum of the unresolved part and - * the readlink exceeds MAXPATHLEN, the extra bytes - * will be dropped off. Too bad! - */ - (void) strncpy(t, s, sizeof link - llen - 1); - link[sizeof link - 1] = '\0'; - /* - * If the link's contents are absolute, copy it back - * to the start of canon, otherwise to the beginning of - * the link's position in the path. - */ - if (link[0] == '/') { - /* Absolute. */ - (void) strcpy(canon, link); - d = s = canon; - } - else { - /* - * Relative: find beginning of component and copy. - */ - --d; - while (d > canon && *--d != '/') - continue; - s = ++d; - /* - * If the sum of the resolved part, the readlink - * and the remaining unresolved part exceeds - * MAXPATHLEN, the extra bytes will be dropped off. - */ - if (strlen(link) >= (limit - s)) { - (void) strncpy(s, link, limit - s); - *(limit - 1) = '\0'; - } else { - (void) strcpy(s, link); + if ((actual[0] != '/') && + (strncmp(pwd, dir, strlen(pwd)) == 0) && + (strlen(pwd) != strlen(dir))) + /* Copy only the relative part of the name */ + strcpy(dots, (char *) (&dir[0] + strlen(pwd) + 1)); + else + strcpy(dots, dir); + } else { /* + * Last component is a file. Find the resolved + * name of the parent of this file, and then append + * the name of this file. + */ + char *pdir; + + if ((pdir = strrchr(actual, '/')) == NULL) + strcpy(dots, actual); + else { + char partial_dir[MAXPATHLEN]; + + *pdir++ = NULL; + if ((chdir(actual) != 0) || + (getcwd(partial_dir, MAXPATHLEN) == NULL)) { + (void) chdir(pwd); + strcpy(dots, actual); + return (NULL); } - } - continue; - } else { - /* - * readlink call failed. It can be because it was - * not a link (i.e. a file, dir etc.) or because the - * the call actually failed. - */ - if (errno != EINVAL) - return (-1); - *(d - 1) = '/'; /* Restore it */ + if ((actual[0] != '/') && + (strncmp(pwd, partial_dir, strlen(pwd)) == 0)) { + if (strlen(pwd) == strlen(partial_dir)) + strcpy(dots, pdir); + else + sprintf(dots, "%s/%s", + (char *) (&partial_dir[0] + + strlen(pwd) + 1), pdir); + } else + sprintf(dots, "%s/%s", partial_dir, pdir); + *--pdir = '/'; } - } /* if (dosymlinks) */ } - } /* while */ - /* Remove the trailing slash that was added above. */ - if (*(d - 1) == '/' && d > canon + 1) - d--; - *d = '\0'; - return (0); + if (chdir(pwd) == -1) + return (NULL); + + /* Add/delete "/" depending upon last_is_slash */ + endp = &dots[strlen(dots)]; + if (last_is_slash == 0) { + if ((*(endp - sizeof(char)) == '/') && (dots[1] != NULL)) + *(endp - sizeof(char)) = NULL; + } else if (*(endp - sizeof(char)) != '/') { + *endp++ = '/'; + *endp = NULL; + } + + return (dots); } /* - * Canonicalize the path given in raw, resolving away all symbolic link - * components. Store the result into the buffer named by canon, which - * must be long enough (MAXPATHLEN bytes will suffice). Returns NULL - * on failure and canon on success. - * - * The routine indirectly invokes the readlink() system call and getcwd() - * so it inherits the possibility of hanging due to inaccessible file - * system resources. + * Given a path, it resolves all links, '.' and '..' in it and + * returns pointer to the result if successful, else returns NULL and + * error number is set. The partially prepared result is in "linkdots". + * Assumes that "linkdots" has enough space allocated to it. */ char * -realpath(raw, canon) - char *raw; - char *canon; +realpath(name, linkdots) + char *name, *linkdots; { - return (pathcanon(raw, canon, 1) < 0 ? NULL : canon); -} + char buf[MAXPATHLEN]; + if (resolvelinks(name, buf) == NULL) { + strcpy(linkdots, buf); + return (NULL); + } + return (resolvedots(buf, linkdots)); +} diff --git a/usr/src/lib/libc/port/gen/rename.c b/usr/src/lib/libc/port/gen/rename.c index 361431d..0e9c77b 100644 --- a/usr/src/lib/libc/port/gen/rename.c +++ b/usr/src/lib/libc/port/gen/rename.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/rename.c 1.10" +#ident "@(#)libc-port:gen/rename.c 1.9" /*LINTLIBRARY*/ #include "synonyms.h" #include @@ -34,5 +34,15 @@ rename(old, new) const char *old; const char *new; { +#ifndef _STYPES return(_rename(old, new)); +#else + if (link(old, new) < 0) + return(-1); + if (unlink(old) < 0) { + (void)unlink(new); + return(-1); + } + return(0); +#endif } diff --git a/usr/src/lib/libc/port/gen/select.c b/usr/src/lib/libc/port/gen/select.c index 208b953..e782cd1 100644 --- a/usr/src/lib/libc/port/gen/select.c +++ b/usr/src/lib/libc/port/gen/select.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/select.c 1.4" +#ident "@(#)libc-port:gen/select.c 1.2" /* * Copyright (c) 1988 by Sun Microsystems, Inc. @@ -24,11 +24,9 @@ * */ -#ifndef DSHLIB #ifdef __STDC__ #pragma weak select = _select #endif -#endif #include "synonyms.h" #include #include @@ -58,12 +56,7 @@ select(nfds, in0, out0, ex0, tv) register struct pollfd *p = pfd; int lastj = -1; /* "zero" is read-only, it could go in the text segment */ -#ifndef DSHLIB static fd_set zero = { 0 }; -#else - fd_set zero; - memset(&zero,0,sizeof(fd_set)); -#endif /* * If any input args are null, point them at the null array. @@ -91,9 +84,9 @@ select(nfds, in0, out0, ex0, tv) goto done; p->events = 0; if (*in & m) - p->events |= POLLRDNORM; + p->events |= POLLIN; if (*out & m) - p->events |= POLLWRNORM; + p->events |= POLLOUT; if (*ex & m) p->events |= POLLRDBAND; p++; @@ -156,7 +149,7 @@ select(nfds, in0, out0, ex0, tv) * Convert results of poll back into bits * in the argument arrays. * - * We assume POLLRDNORM, POLLWRNORM, and POLLRDBAND will only be set + * We assume POLLIN, POLLOUT, and POLLRDBAND will only be set * on return from poll if they were set on input, thus we don't * worry about accidentally setting the corresponding bits in the * zero array if the input bit masks were null. @@ -196,9 +189,9 @@ select(nfds, in0, out0, ex0, tv) } m = 1 << (p->fd % NFDBITS); - if (p->revents & POLLRDNORM) + if (p->revents & POLLIN) *in |= m; - if (p->revents & POLLWRNORM) + if (p->revents & POLLOUT) *out |= m; if (p->revents & POLLRDBAND) *ex |= m; @@ -207,17 +200,16 @@ select(nfds, in0, out0, ex0, tv) * input conditions. */ if ((p->revents & (POLLHUP|POLLERR)) && - (p->events & POLLRDNORM)) + (p->events & POLLIN)) *in |= m; /* * Only set this bit on return if we asked about * output conditions. */ if ((p->revents & (POLLHUP|POLLERR)) && - (p->events & POLLWRNORM)) + (p->events & POLLOUT)) *out |= m; } } return (rv); } - diff --git a/usr/src/lib/libc/port/gen/setlocale.c b/usr/src/lib/libc/port/gen/setlocale.c index 78e99bd..fa2ffbd 100644 --- a/usr/src/lib/libc/port/gen/setlocale.c +++ b/usr/src/lib/libc/port/gen/setlocale.c @@ -5,20 +5,17 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/setlocale.c 1.9" +#ident "@(#)libc-port:gen/setlocale.c 1.5" /* * setlocale - set and query function for all or parts of a program's locale. */ #include "synonyms.h" -#include "shlib.h" #include #include "_locale.h" /* internal to libc locale data structures */ #include #include #include -static char *set_cat(); - char * setlocale(cat, loc) int cat; @@ -69,14 +66,10 @@ const char *loc; */ if (cat == LC_ALL) { - static int reset = 0; register const char *p; register int i; - register char *sv_loc; - if (!reset) - sv_loc = setlocale(LC_ALL, NULL); - cat = LC_CTYPE; + cat = LC_CTYPE - 1; if ((p = loc)[0] != '/') /* simple locale */ { loc = strncpy(part, p, LC_NAMELEN - 1); @@ -91,25 +84,10 @@ const char *loc; part[i] = '\0'; p += i; } - if (set_cat(cat++, part) == 0) { - reset = 1; - setlocale(LC_ALL, sv_loc); - reset = 0; - return 0; - } - } while (cat < LC_ALL); - return setlocale(LC_ALL, NULL); + (void)setlocale(++cat, part); + } while (cat < LC_ALL - 1); + return setlocale(LC_ALL, (char *)0); } - return(set_cat(cat, loc)); -} - -static char * -set_cat(cat, loc) -int cat; -const char *loc; -{ - char part[LC_NAMELEN]; - /* * Set single category's locale. By default, * just note the new name and handle it later. @@ -130,7 +108,7 @@ const char *loc; } else { int fd; - static const char *name[LC_ALL] = + static char name[LC_ALL][12] = { "LC_CTYPE", "LC_NUMERIC", "LC_TIME", @@ -138,11 +116,9 @@ const char *loc; "LC_MONETARY", "LC_MESSAGES" }; - if (strcmp(loc, _cur_locale[cat]) != 0) { - if ((fd = open(_fullocale(loc, name[cat]), O_RDONLY)) == -1) - return 0; - (void)close(fd); - } + if ((fd = open(_fullocale(loc, name[cat]), O_RDONLY)) == -1) + return 0; + (void)close(fd); } return strcpy(_cur_locale[cat], loc); } diff --git a/usr/src/lib/libc/port/gen/siginfolst.c b/usr/src/lib/libc/port/gen/siginfolst.c new file mode 100644 index 0000000..c00b42f --- /dev/null +++ b/usr/src/lib/libc/port/gen/siginfolst.c @@ -0,0 +1,103 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/siginfolst.c 1.3" + +#include "synonyms.h" +#include +#include + + +char * _sys_traplist[NSIGTRAP] = { + "process breakpoint", + "process trace" +}; + +char * _sys_illlist[NSIGILL] = { + "illegal opcode", + "illegal operand", + "illegal addressing mode", + "illegal trap", + "privileged opcode", + "privileged register", + "co-processor", + "bad stack" +}; + +char * _sys_fpelist[NSIGFPE] = { + "integer divide by zero", + "integer overflow", + "floating point divide by zero", + "floating point overflow", + "floating point underflow", + "floating point inexact result", + "invalid floating point operation", + "floating point subscript out of range" +}; + +char * _sys_segvlist[NSIGSEGV] = { + "address not mapped to object", + "invalid permissions" +}; + +char * _sys_buslist[NSIGBUS] = { + "invalid address alignment", + "non-existent physical address", + "object specific" +}; + +char * _sys_cldlist[NSIGCLD] = { + "child has exited", + "child was killed", + "child has coredumped", + "traced child has trapped", + "child has stopped", + "stopped child has continued" +}; + +char * _sys_polllist[NSIGPOLL] = { + "input available", + "output possible", + "message available", + "I/O error", + "high priority input available", + "device disconnected" +}; + +struct siginfolist _sys_siginfolist[NSIG-1] = { + 0, 0, /* SIGHUP */ + 0, 0, /* SIGINT */ + 0, 0, /* SIGQUIT */ + NSIGILL, _sys_illlist, /* SIGILL */ + NSIGTRAP, _sys_traplist, /* SIGTRAP */ + 0, 0, /* SIGABRT */ + 0, 0, /* SIGEMT */ + NSIGFPE, _sys_fpelist, /* SIGFPE */ + 0, 0, /* SIGKILL */ + NSIGBUS, _sys_buslist, /* SIGBUS */ + NSIGSEGV, _sys_segvlist, /* SIGSEGV */ + 0, 0, /* SIGSYS */ + 0, 0, /* SIGPIPE */ + 0, 0, /* SIGALRM */ + 0, 0, /* SIGTERM */ + 0, 0, /* SIGUSR1 */ + 0, 0, /* SIGUSR2 */ + NSIGCLD, _sys_cldlist, /* SIGCLD */ + 0, 0, /* SIGPWR */ + 0, 0, /* SIGWINCH */ + 0, 0, /* SIGURG */ + NSIGPOLL, _sys_polllist, /* SIGPOLL */ + 0, 0, /* SIGSTOP */ + 0, 0, /* SIGTSTP */ + 0, 0, /* SIGCONT */ + 0, 0, /* SIGTTIN */ + 0, 0, /* SIGTTOU */ + 0, 0, /* SIGVTALRM */ + 0, 0, /* SIGPROF */ + 0, 0, /* SIGXCPU */ + 0, 0, /* SIGXFSZ */ +}; diff --git a/usr/src/lib/libc/port/gen/sigsetops.c b/usr/src/lib/libc/port/gen/sigsetops.c index 01d76b3..0769270 100644 --- a/usr/src/lib/libc/port/gen/sigsetops.c +++ b/usr/src/lib/libc/port/gen/sigsetops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/sigsetops.c 1.4" +#ident "@(#)libc-port:gen/sigsetops.c 1.3" /* * POSIX signal manipulation functions. @@ -44,7 +44,7 @@ sigvalid(sig) sigsinit++; } - return (sigs.sigbits[sigword(sig)] & bitmask(sig)) != 0; + return (sigs.word[sigword(sig)] & bitmask(sig)) != 0; } int @@ -64,10 +64,10 @@ int sigemptyset(set) sigset_t *set; { - set->sigbits[0] = 0; - set->sigbits[1] = 0; - set->sigbits[2] = 0; - set->sigbits[3] = 0; + set->word[0] = 0; + set->word[1] = 0; + set->word[2] = 0; + set->word[3] = 0; return 0; } @@ -80,7 +80,7 @@ register int sig; errno = EINVAL; return -1; } - set->sigbits[sigword(sig)] |= bitmask(sig); + set->word[sigword(sig)] |= bitmask(sig); return 0; } @@ -93,7 +93,7 @@ register int sig; errno = EINVAL; return -1; } - set->sigbits[sigword(sig)] &= ~bitmask(sig); + set->word[sigword(sig)] &= ~bitmask(sig); return(0); } @@ -106,5 +106,5 @@ register int sig; errno = EINVAL; return -1; } - return (set->sigbits[sigword(sig)] & bitmask(sig)) != 0; + return (set->word[sigword(sig)] & bitmask(sig)) != 0; } diff --git a/usr/src/lib/libc/port/gen/strftime.c b/usr/src/lib/libc/port/gen/strftime.c index ac91119..cc5cc57 100644 --- a/usr/src/lib/libc/port/gen/strftime.c +++ b/usr/src/lib/libc/port/gen/strftime.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/strftime.c 1.13" +#ident "@(#)libc-port:gen/strftime.c 1.9" #include "synonyms.h" #include "shlib.h" @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include "_locale.h" extern char *tzname[]; @@ -33,7 +33,7 @@ enum { aSun, aMon, aTue, aWed, aThu, aFri, aSat, Sun, Mon, Tue, Wed, Thu, Fri, Sat, Local_time, Local_date, DFL_FMT, - AM, PM, DATE_FMT, + AM, PM, LAST }; static const char * __time[] = { @@ -43,8 +43,8 @@ static const char * __time[] = { "October", "November", "December", "Sun","Mon", "Tue", "Wed","Thu", "Fri","Sat", "Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday", - "%H:%M:%S","%m/%d/%y", "%a %b %d %H:%M:%S %Y", - "AM", "PM", "%a %b %e %T %Z %Y", NULL + "%H:%M:%S","%m/%d/%y", "%a %b %e %T %Z %Y", + "AM", "PM", NULL }; @@ -62,15 +62,8 @@ const struct tm *tm; char nstr[5]; size_t n; static char dflcase[] = "%?"; - settime(); - -/* envoke mktime, for its side effects */ - { - struct tm tmp; - memcpy(&tmp, tm, sizeof(struct tm)); - mktime(&tmp); - } + settime(); /* Set format string, if not already set */ if (format == NULL) @@ -104,9 +97,6 @@ const struct tm *tm; case 'c': /* Localized date & time format */ p = __time[DFL_FMT]; goto recur; - case 'C': /* Localized date & time format */ - p = __time[DATE_FMT]; - goto recur; case 'd': /* Day number */ p = itoa(tm->tm_mday, nstr, 2); break; @@ -146,10 +136,7 @@ const struct tm *tm; p = __time[AM]; break; case 'r': - if (tm->tm_hour >= 12) - p = "%I:%M:%S PM"; - else - p = "%I:%M:%S AM"; + p = "%I:%M:%S %p"; goto recur; case 'R': p = "%H:%M"; @@ -298,14 +285,42 @@ static char * gettz(tm) struct tm *tm; { + static char tznm[MAXTZNAME + 1]; register char *p; + if ((p = getenv("TZ")) == 0 || *p == '\0') + return(tm->tm_isdst ? "" : "GMT"); + if (p[0] == ':') { /* Olson method */ + _ltzset(mktime(tm)); + if (tm->tm_isdst) + return(tzname[1]); + else + return(tzname[0]); + } + p = tz(p, tznm); if (tm->tm_isdst) - p = tzname[1]; - else - p = tzname[0]; - if (strcmp(p, " ") == 0) - return(""); - else - return(p); + p = tz(p, tznm); + return(tznm); +} + +static char * +tz(p, t) +register char *p; +register char *t; +{ + register int n = MAXTZNAME; + + while (!isalpha(*p)) { + if (*p++ == '\0') + goto err; + } + do { + if (--n >= 0) + *t++ = *p; + } while (isalpha(*++p)); + while (--n >= 0) + *t++ = ' '; +err: + *t = '\0'; + return(p); } diff --git a/usr/src/lib/libc/port/gen/strmount.c b/usr/src/lib/libc/port/gen/strmount.c new file mode 100644 index 0000000..d6e88ea --- /dev/null +++ b/usr/src/lib/libc/port/gen/strmount.c @@ -0,0 +1,37 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/strmount.c 1.1" +/* + * Attach a file descriptor to a name in the file system by + * mounting it onto the name space. + */ +#ifdef __STDC__ + #pragma weak strmount = _strmount +#endif +#include "synonyms.h" +#include +#include +#include +#include +#include +#include + +int +strmount(path, fildes) + char *path; + int fildes; +{ + struct fifodata fifodatap; + char fsname[] = "FIFOFS"; + + fifodatap.data_fd = fildes; + return (fmount((char *)NULL, path, MS_DATA, fsname, + (char *)&fifodatap, + sizeof(struct fifodata))); +} + diff --git a/usr/src/lib/libc/port/gen/strtol.c b/usr/src/lib/libc/port/gen/strtol.c index 60cd39d..618e99c 100644 --- a/usr/src/lib/libc/port/gen/strtol.c +++ b/usr/src/lib/libc/port/gen/strtol.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/strtol.c 2.14" +#ident "@(#)libc-port:gen/strtol.c 2.11" /*LINTLIBRARY*/ #include "synonyms.h" #include @@ -38,10 +38,8 @@ register int base; if (ptr != (const char **)0) *ptr = str; /* in case no number is formed */ - if (base < 0 || base > MBASE || base == 1) { - errno = EINVAL; + if (base < 0 || base > MBASE) return (0); /* base is invalid -- should be a fatal error */ - } if (!isalnum(c = *str)) { while (isspace(c)) c = *++str; @@ -92,7 +90,6 @@ register int base; return (neg ? val : -val); overflow: - for (c = *++str; lisalnum(c) && (xx = DIGIT(c)) < base; (c = *++str)); if (ptr != (const char **)0) *ptr = str; errno = ERANGE; diff --git a/usr/src/lib/libc/port/gen/strtoul.c b/usr/src/lib/libc/port/gen/strtoul.c index c7e5862..951bc7f 100644 --- a/usr/src/lib/libc/port/gen/strtoul.c +++ b/usr/src/lib/libc/port/gen/strtoul.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/strtoul.c 1.8" +#ident "@(#)libc-port:gen/strtoul.c 1.4" /*LINTLIBRARY*/ #include "synonyms.h" #include @@ -34,25 +34,14 @@ register int base; int xx; unsigned long multmax; const char **ptr = (const char **)nptr; - int neg = 0; if (ptr != (const char **)0) *ptr = str; /* in case no number is formed */ - if (base < 0 || base > MBASE || base == 1) { - errno = EINVAL; + if (base < 0 || base > MBASE) return (0); /* base is invalid -- should be a fatal error */ - } - if (!isalnum(c = *str)) { - while (isspace(c)) - c = *++str; - switch (c) { - case '-': - neg++; - /* FALLTHROUGH */ - case '+': - c = *++str; - } - } + c = *str; + while (isspace(c)) + c = *++str; if (base == 0) if (c != '0') base = 10; @@ -83,10 +72,9 @@ register int base; } if (ptr != (const char **)0) *ptr = str; - return (neg ? -val : val); + return (val); overflow: - for (c = *++str; lisalnum(c) && (xx = DIGIT(c)) < base; (c = *++str)); if (ptr != (const char **)0) *ptr = str; errno = ERANGE; diff --git a/usr/src/lib/libc/port/gen/strumount.c b/usr/src/lib/libc/port/gen/strumount.c new file mode 100644 index 0000000..3cca9db --- /dev/null +++ b/usr/src/lib/libc/port/gen/strumount.c @@ -0,0 +1,25 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libc-port:gen/strumount.c 1.1" +/* + * Unmount a file descriptor from a file in the file system. + */ +#ifdef __STDC__ + #pragma weak strumount = _strumount +#endif +#include "synonyms.h" +#include +#include + +int +strumount(path) + char *path; +{ + return (funmount(path)); +} + diff --git a/usr/src/lib/libc/port/gen/sysconf.c b/usr/src/lib/libc/port/gen/sysconf.c index 103fb6a..68b0d6a 100644 --- a/usr/src/lib/libc/port/gen/sysconf.c +++ b/usr/src/lib/libc/port/gen/sysconf.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/sysconf.c 1.6" +#ident "@(#)libc-port:gen/sysconf.c 1.3" /* sysconf(3C) - returns system configuration information */ @@ -23,7 +23,6 @@ extern int errno; -long sysconf(name) int name; { @@ -37,7 +36,7 @@ int name; return(ARG_MAX); case _SC_CLK_TCK: - return(_sysconfig(_CONFIG_CLK_TCK)); + return(CLOCKS_PER_SEC); case _SC_JOB_CONTROL: return(_POSIX_JOB_CONTROL); @@ -59,15 +58,6 @@ int name; case _SC_PAGESIZE: return(_sysconfig(_CONFIG_PAGESIZE)); - - case _SC_XOPEN_VERSION: - return(_sysconfig(_CONFIG_XOPEN_VER)); - - case _SC_PASS_MAX: - return(PASS_MAX); - - case _SC_LOGNAME_MAX: - return(LOGNAME_MAX); } } diff --git a/usr/src/lib/libc/port/gen/syslog.c b/usr/src/lib/libc/port/gen/syslog.c index b8c4d85..eb4cb7e 100644 --- a/usr/src/lib/libc/port/gen/syslog.c +++ b/usr/src/lib/libc/port/gen/syslog.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/syslog.c 1.4" +#ident "@(#)libc-port:gen/syslog.c 1.3" /* from "@(#)syslog.c 1.18 88/02/08 SMI"; from UCB 5.9 5/7/86 */ @@ -44,7 +44,6 @@ * The output of this routine is intended to be read by /etc/syslogd. */ -#ifndef DSHLIB #ifdef __STDC__ #pragma weak syslog = _syslog #pragma weak vsyslog = _vsyslog @@ -52,7 +51,6 @@ #pragma weak closelog = _closelog #pragma weak setlogmask = _setlogmask #endif -#endif #include "synonyms.h" #include #include @@ -63,8 +61,6 @@ #include #include #include -#include -#include /*#include */ #define MAXLINE 1024 /* max message size */ @@ -74,13 +70,13 @@ #define PRIFAC(p) (((p) & LOG_FACMASK) >> 3) #define IMPORTANT LOG_ERR -#define logname "/dev/conslog" -#define ctty "/dev/syscon" +static char logname[] = "/dev/conslog"; +static char ctty[] = "/dev/syscon"; static struct __syslog { int _LogFile; int _LogStat; - const char *_LogTag; + char *_LogTag; int _LogMask; char *_SyslogHost; int _LogFacility; @@ -93,7 +89,8 @@ static struct __syslog { #define SyslogHost (__syslog->_SyslogHost) #define LogFacility (__syslog->_LogFacility) -extern int errno; +extern int errno, sys_nerr; +extern char *sys_errlist[]; /*VARARGS2*/ syslog(pri, fmt, va_alist) @@ -162,7 +159,6 @@ vsyslog(pri, fmt, ap) b = buf; f = fmt; while ((c = *f++) != '\0' && c != '\n' && b < &buf[MAXLINE]) { - char *errmsg; if (c != '%') { *b++ = c; continue; @@ -172,10 +168,10 @@ vsyslog(pri, fmt, ap) *b++ = c; continue; } - if ((errmsg = strerror(olderrno)) == NULL) + if ((unsigned)olderrno > sys_nerr) sprintf(b, "error %d", olderrno); else - strcpy(b, errmsg); + strcpy(b, sys_errlist[olderrno]); b += strlen(b); } *b++ = '\n'; diff --git a/usr/src/lib/libc/port/gen/tfind.c b/usr/src/lib/libc/port/gen/tfind.c index 278e962..989f156 100644 --- a/usr/src/lib/libc/port/gen/tfind.c +++ b/usr/src/lib/libc/port/gen/tfind.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/tfind.c 1.10" +#ident "@(#)libc-port:gen/tfind.c 1.9" /*LINTLIBRARY*/ /* * Tree search algorithm, generalized from Knuth (6.2.2) Algorithm T. @@ -29,7 +29,7 @@ typedef struct node { POINTER key; struct node *llink, *rlink; } NODE; VOID * tfind(ky, rtp, compar) const VOID *ky; /* Key to be located */ -VOID *const *rtp; /* Address of the root of the tree */ +VOID **rtp; /* Address of the root of the tree */ int (*compar)(); /* Comparison function */ { POINTER key = (char *)ky; diff --git a/usr/src/lib/libc/port/gen/time_comm.c b/usr/src/lib/libc/port/gen/time_comm.c index 67faf9c..4167797 100644 --- a/usr/src/lib/libc/port/gen/time_comm.c +++ b/usr/src/lib/libc/port/gen/time_comm.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/time_comm.c 1.28" +#ident "@(#)libc-port:gen/time_comm.c 1.20" /* * Functions that are common to ctime(3C) and cftime(3C) */ @@ -29,14 +29,11 @@ static char *getdigit(); static char *gettime(); static int getdst(); -static int posixgetdst(); -static char *posixsubdst(); static void getusa(); static char *getzname(); static int sunday(); static long detzcode(); static int _tzload(); -static char *tzcpy(); extern void _ltzset(); @@ -45,17 +42,13 @@ extern void _ltzset(); #define SEC_PER_DAY (24*60*60) #define SEC_PER_YEAR (365*24*60*60) #define LEAP_TO_70 (70/4) -#define FEB28 (58) - -#define MINTZNAME 3 +#define MAXTZNAME 3 #define year_size(A) (((A) % 4) ? 365 : 366) -static time_t start_dst = -1 ; /* Start date of alternate time zone */ -static time_t end_dst = -1 ; /* End date of alternate time zone */ +static time_t start_dst ; /* Start date of alternate time zone */ +static time_t end_dst; /* End date of alternate time zone */ extern const short __month_size[]; -extern const int __yday_to_month[]; -extern const int __lyday_to_month[]; #ifndef TRUE #define TRUE 1 @@ -81,8 +74,8 @@ struct state { }; static struct state *_tz_state; -static struct tm tm; +static int _tz_is_set = FALSE; struct tm * localtime(timep) @@ -95,7 +88,9 @@ const time_t *timep; long daybegin, dayend; time_t curr; - _ltzset(*timep); + + if (!_tz_is_set) + _ltzset(*timep); s = _tz_state; t = *timep - timezone; @@ -103,7 +98,7 @@ const time_t *timep; if (!daylight) return(tmp); - if (s != 0 && start_dst != -1) + if (s != 0 && start_dst) /* Olson method */ curr = t; else @@ -111,25 +106,18 @@ const time_t *timep; curr = tmp->tm_yday*SEC_PER_DAY + tmp->tm_hour*SEC_PER_HOUR + tmp->tm_min*SEC_PER_MIN + tmp->tm_sec; - if ( start_dst == -1 && end_dst == -1) + if ( start_dst == 0 && end_dst == 0) getusa(&daybegin, &dayend, tmp); else { daybegin = start_dst; dayend = end_dst; } - if (daybegin <= dayend) { - if (curr >= daybegin && curr < dayend) { - t = *timep - altzone; - tmp = gmtime(&t); - tmp->tm_isdst = 1; - } - } else { /* Southern Hemisphere */ - if (!(curr >= dayend && curr < daybegin)) { - t = *timep - altzone; - tmp = gmtime(&t); - tmp->tm_isdst = 1; - } + if (curr >= daybegin && curr < dayend) + { + t = *timep - altzone; + tmp = gmtime(&t); + tmp->tm_isdst = 1; } return(tmp); } @@ -141,6 +129,7 @@ const time_t *clock; register struct tm * tmp; tmp = offtime(clock, 0L); + tzname[0] = "GMT"; return tmp; } @@ -159,6 +148,7 @@ long offset; register int y; register int yleap; register const int * ip; + static struct tm tm; tmp = &tm; days = *clock / SECS_PER_DAY; @@ -214,12 +204,13 @@ time_t time0; time_t mktime(timeptr) struct tm *timeptr; { + extern const int __yday_to_month[]; + extern const int __lyday_to_month[]; struct tm *tptr; long secs; int temp; int isdst = 0; long daybegin, dayend; - struct tm stm; secs = timeptr->tm_sec + SEC_PER_MIN * timeptr->tm_min + SEC_PER_HOUR * timeptr->tm_hour + @@ -250,12 +241,10 @@ struct tm *timeptr; isdst = -1; secs += timezone; } - if (timeptr != &tm) - stm = tm; tptr = localtime((time_t *)&secs); if (isdst == -1) { - if (start_dst == -1 && end_dst == -1) + if (start_dst == 0 && end_dst == 0) getusa(&daybegin, &dayend, tptr); else { daybegin = start_dst; @@ -263,23 +252,13 @@ struct tm *timeptr; } temp = tptr->tm_sec + SEC_PER_MIN * tptr->tm_min + SEC_PER_HOUR * tptr->tm_hour + SEC_PER_DAY * tptr->tm_yday; - if (daybegin <= dayend) { - if (temp >= daybegin && temp < dayend + (timezone - altzone)) { - secs -= (timezone - altzone); - tptr = localtime((time_t *)&secs); - } - } else { /* Southern Hemisphere */ - if (!(temp >= dayend + (timezone - altzone) || temp < daybegin)) { - secs -= (timezone - altzone); - tptr = localtime((time_t *)&secs); - } + if (temp >= daybegin && temp < dayend) { + secs -= (timezone - altzone); + tptr = localtime((time_t *)&secs); } } *timeptr = *tptr; - if (timeptr != &tm) - tm = stm; - if (secs < 0) return(-1); else @@ -293,13 +272,9 @@ time_t tim; register char * name; int i; - if((name = getenv("TZ")) == 0 || *name == '\0') { - /* TZ is not present, use GMT */ - strcpy(tzname[0],"GMT"); - strcpy(tzname[1]," "); - timezone = altzone = daylight = 0; + _tz_is_set = TRUE; + if((name = getenv("TZ")) == 0 || *name == '\0') return; /* TZ is not present, use GMT */ - } if (name[0] == ':') /* Olson method */ { name++; if (_tzload(name) != 0) { @@ -312,9 +287,7 @@ time_t tim; */ if (tim == 0) tim = time(NULL); - if (!(tzname[0]=tzcpy(tzname[0],&_tz_state->chars[0]))) - return; - strcpy(tzname[1]," "); + tzname[0] = tzname[1] = &_tz_state->chars[0]; timezone = -_tz_state->ttis[0].tt_gmtoff; daylight = 0; start_dst = end_dst = 0; @@ -323,8 +296,7 @@ time_t tim; ttisp = &_tz_state->ttis[_tz_state->types[i]]; if (ttisp->tt_isdst) { - if (!(tzname[1]=tzcpy(tzname[1],&_tz_state->chars[ttisp->tt_abbrind]))) - return; + tzname[1] = &_tz_state->chars[ttisp->tt_abbrind]; daylight = 1; altzone = -ttisp->tt_gmtoff; start_dst = _tz_state->ats[i]; @@ -333,8 +305,7 @@ time_t tim; else end_dst = INT_MAX; } else { - if (!(tzname[0]=tzcpy(tzname[0],&_tz_state->chars[ttisp->tt_abbrind]))) - return; + tzname[0] = &_tz_state->chars[ttisp->tt_abbrind]; timezone = -ttisp->tt_gmtoff; } } @@ -342,25 +313,21 @@ time_t tim; } else /* POSIX method */ { /* Get main time zone name and difference from GMT */ - if ( ((name = getzname(name,&tzname[0])) == 0) || + if ( ((name = getzname(name,tzname[0])) == 0) || ((name = gettime(name,&timezone,1)) == 0)) { /* No offset from GMT given, so use GMT */ - strcpy(tzname[0],"GMT"); - strcpy(tzname[1]," "); + tzname[0] = "GMT"; return; } - strcpy(tzname[1]," "); altzone = timezone - SEC_PER_HOUR; start_dst = end_dst = 0; daylight = 0; + /* Get alternate time zone name */ - if ( (name = getzname(name,&tzname[1])) == 0) { - strcpy(tzname[1]," "); + if ( (name = getzname(name,tzname[1])) == 0) return; - } - start_dst = end_dst = -1; daylight = 1; /* If the difference between alternate time zone and @@ -372,10 +339,7 @@ time_t tim; if ( (name = gettime(name,&altzone,1)) == 0 || (*name != ';' && *name != ',')) return; - if (*name == ';') - getdst(name + 1,&start_dst, &end_dst); - else - posixgetdst(name + 1, &start_dst, &end_dst, tim); + getdst(name + 1,&start_dst, &end_dst); } } @@ -388,46 +352,23 @@ tzset() static char * getzname(p, tz) char *p; -char **tz; +char *tz; { - register char *q = p; - register char c; - - if (!isalpha(*q)) - return(0); - while (isalpha(*++q)) ; - c = *q; - *q = '\0'; - if (!(*tz=tzcpy(*tz, p))) { - *q = c; - return(0); - } - *q = c; - return(q); -} + int n = MAXTZNAME; -static char * -tzcpy(s1, s2) -char *s1, *s2; -{ - size_t len; - if (strlen(s1) >= (len = strlen(s2))) { - strcpy(s1, s2); - if (len < MINTZNAME) { - s1 += len; - for (; len <= MINTZNAME; len++) - *s1++ = ' '; - *s1 = '\0'; - } - } else { - if ((s1 = malloc(len+1)) == NULL) - return(0); - strcpy(s1, s2); - } - return(s1); + if (!isalpha(*p)) + return(0); + do + { + *tz++ = *p ; + } while (--n > 0 && isalpha(*++p) ); + while(isalpha(*p)) + p++; + while(--n >= 0) + *tz++ = ' '; /* Pad with blanks */ + return(p); } - static char * gettime(p, timez, f) char *p; @@ -494,8 +435,6 @@ time_t *e; if ( (p = getdigit(p,&lsd)) == 0 ) return(0); lsd -= 1; /* keep julian count in sync with date 1-366 */ - if (lsd < 0 || lsd > 365) - return(0); if ( (*p == '/') && ((p = gettime(p+1,&st,0)) == 0) ) return(0); if (*p == ',') @@ -503,8 +442,6 @@ time_t *e; if ( (p = getdigit(p+1,&led)) == 0 ) return(0); led -= 1; /* keep julian count in sync with date 1-366 */ - if (led < 0 || led > 365) - return(0); if ((*p == '/') && ((p = gettime(p+1,&et,0)) == 0) ) return(0); } @@ -513,190 +450,6 @@ time_t *e; *e = (long)(led * SEC_PER_DAY + et - (timezone - altzone)); return(1); } -static int -posixgetdst(p,s,e,tim) -char *p; -time_t *s; -time_t *e; -time_t tim; /* Time now */ -{ - int lsd,led; - struct tm *std_tm; - unsigned char stdtype, alttype; - int stdjul, altjul; - int stdm, altm; - int stdn, altn; - int stdd, altd; - int xthru = 0; - int wd_jan01, wd; - int d, w; - time_t t; - time_t st,et; - st = et = 7200; /* Default for start and end time is 02:00:00 */ - - if ((p = posixsubdst(p,&stdtype,&stdjul,&stdm,&stdn,&stdd,&st)) == 0) - return(0); - if (*p != ',') - return(0); - if ((p = posixsubdst(p+1,&alttype,&altjul,&altm,&altn,&altd,&et)) == 0) - return(0); - - t = tim - timezone; - std_tm = gmtime(&t); - - while (xthru++ < 2) { - lsd = stdjul; - led = altjul; - if (stdtype == 'J' && isleap(std_tm->tm_year)) - if (lsd > FEB28) - ++lsd; /* Correct for leap year */ - if (alttype == 'J' && isleap(std_tm->tm_year)) - if (led > FEB28) - ++led; /* Correct for leap year */ - if (stdtype == 'M') { /* Figure out the Julian Day */ - wd_jan01 = std_tm->tm_wday - - (std_tm->tm_yday % DAYS_PER_WEEK); - if (wd_jan01 < 0) - wd_jan01 += DAYS_PER_WEEK; - if (isleap(std_tm->tm_year)) - wd = (wd_jan01 + __lyday_to_month[stdm-1]) % - DAYS_PER_WEEK; - else - wd = (wd_jan01 + __yday_to_month[stdm-1]) % - DAYS_PER_WEEK; - for (d = 1; wd != stdd; ++d) - wd = ((wd+1) % DAYS_PER_WEEK); - for (w = 1; w != stdn; ++w) { - d += DAYS_PER_WEEK; - if (d > __mon_lengths[ - isleap(std_tm->tm_year)][stdm]) { - d -= DAYS_PER_WEEK; - break; - } - } - if (isleap(std_tm->tm_year)) - lsd = __lyday_to_month[stdm-1] + d - 1; - else - lsd = __yday_to_month[stdm-1] + d - 1; - } - if (alttype == 'M') { /* Figure out the Julian Day */ - wd_jan01 = std_tm->tm_wday - - (std_tm->tm_yday % DAYS_PER_WEEK); - if (wd_jan01 < 0) - wd_jan01 += DAYS_PER_WEEK; - if (isleap(std_tm->tm_year)) - wd = (wd_jan01 + __lyday_to_month[altm-1]) % - DAYS_PER_WEEK; - else - wd = (wd_jan01 + __yday_to_month[altm-1]) % - DAYS_PER_WEEK; - for (d = 1; wd != altd; ++d) - wd = ((wd+1) % DAYS_PER_WEEK); - for (w = 1; w != altn; ++w) { - d += DAYS_PER_WEEK; - if (d > __mon_lengths[ - isleap(std_tm->tm_year)][altm]) { - d -= DAYS_PER_WEEK; - break; - } - } - if (isleap(std_tm->tm_year)) - led = __lyday_to_month[altm-1] + d - 1; - else - led = __yday_to_month[altm-1] + d - 1; - } - if ((lsd <= led) || (xthru == 2)) - break; - else { /* Southern Hemisphere */ - t = tim - altzone; - std_tm = gmtime(&t); - } - } /* for (;;) */ - *s = (long) (lsd * SEC_PER_DAY + st); - *e = (long) (led * SEC_PER_DAY + et - (timezone - altzone)); - return(1); -} - -static char * -posixsubdst(p,type,jul,m,n,d,tm) -char *p; -unsigned char *type; -int *jul, *m, *n, *d; -time_t *tm; -{ - -/* -** nnn where nnn is between 0 and 365. -*/ - if (isdigit(*p)) { - if ( (p = getdigit(p,jul)) == 0 ) - return(0); - if (*jul < 0 || *jul > 365) - return(0); - *type = '\0'; - } -/* -** J<1-365> where February 28 is always day 59, and March 1 is ALWAYS -** day 60. It is not possible to specify February 29. -** -** This is a hard problem. We can't figure out what time it is until -** we know when daylight savings time begins and ends, and we can't -** know that without knowing what time it is!?! Thank you, POSIX! -** -** -*/ - else if (*p == 'J') { - if ((p = getdigit(p+1,jul)) == 0) - return(0); - if (*jul <= 0 || *jul > 365) - return(0); - --(*jul); /* make it between 0 and 364 */ - *type = 'J'; - } -/* -** Mm.n.d -** Where: -** m is month of year (1-12) -** n is week of month (1-5) -** Week 1 is the week in which the d'th day first falls -** Week 5 means the last day of that type in the month -** whether it falls in the 4th or 5th weeks. -** d is day of week (0-6) 0 == Sunday -** -** This is a hard problem. We can't figure out what time it is until -** we know when daylight savings time begins and ends, and we can't -** know that without knowing what time it is!?! Design by committee. -** The saving grace is that this probably the right way to specify -** Daylight Savings since most countries change on the first/last -** Someday of the month. -*/ - else if (*p == 'M') { - if ((p = getdigit(p+1,m)) == 0) - return(0); - if (*m <= 0 || *m > 12) - return(0); - if (*p != '.') - return(0); - if ((p = getdigit(p+1,n)) == 0) - return(0); - if (*n <= 0 || *n > 5) - return(0); - if (*p != '.') - return(0); - if ((p = getdigit(p+1,d)) == 0) - return(0); - if (*d < 0 || *d > 6) - return(0); - *type = 'M'; - } - else - return(0); - - if ((*p == '/') && ((p = gettime(p+1,tm,0)) == 0)) - return(0); - return(p); -} - static void getusa(s, e, t) diff --git a/usr/src/lib/libc/port/gen/time_data.c b/usr/src/lib/libc/port/gen/time_data.c index 3aa8bb0..649ea82 100644 --- a/usr/src/lib/libc/port/gen/time_data.c +++ b/usr/src/lib/libc/port/gen/time_data.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/time_data.c 1.2" +#ident "@(#)libc-port:gen/time_data.c 1.1" #include "synonyms.h" #include #include @@ -41,5 +41,5 @@ const struct { 76, 119, 303, 75, 58, 303, /* 1975: Last Sun in Feb - last Sun in Oct */ 74, 5, 333, /* 1974: Jan 6 - last Sun. in Nov */ - 69, 119, 303, /* start GMT */ + 70, 119, 303, /* start GMT */ }; diff --git a/usr/src/lib/libc/port/gen/time_gdata.c b/usr/src/lib/libc/port/gen/time_gdata.c index 60c12d3..9d68e49 100644 --- a/usr/src/lib/libc/port/gen/time_gdata.c +++ b/usr/src/lib/libc/port/gen/time_gdata.c @@ -5,14 +5,16 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/time_gdata.c 1.4" +#ident "@(#)libc-port:gen/time_gdata.c 1.2" +#ifndef ABI #ifdef __STDC__ #pragma weak altzone = _altzone #pragma weak daylight = _daylight #pragma weak timezone = _timezone #pragma weak tzname = _tzname #endif +#endif #include "synonyms.h" #include #include @@ -20,4 +22,4 @@ time_t timezone = 0; time_t altzone = 0; int daylight = 0; -char *tzname[] = {"GMT"," "}; +char *tzname[] = {"GMT","GMT"}; diff --git a/usr/src/lib/libc/port/gen/tsearch.c b/usr/src/lib/libc/port/gen/tsearch.c index 625dd0a..abf3915 100644 --- a/usr/src/lib/libc/port/gen/tsearch.c +++ b/usr/src/lib/libc/port/gen/tsearch.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/tsearch.c 2.11" +#ident "@(#)libc-port:gen/tsearch.c 2.11.1.1" /*LINTLIBRARY*/ /* * Tree search algorithm, generalized from Knuth (6.2.2) Algorithm T. @@ -21,6 +21,7 @@ #pragma weak twalk = _twalk #endif #include "synonyms.h" +#include "shlib.h" #include #include typedef char *POINTER; diff --git a/usr/src/lib/libc/port/gen/ttyname.c b/usr/src/lib/libc/port/gen/ttyname.c index 6a1c03a..294497c 100644 --- a/usr/src/lib/libc/port/gen/ttyname.c +++ b/usr/src/lib/libc/port/gen/ttyname.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/ttyname.c 1.23" +#ident "@(#)libc-port:gen/ttyname.c 1.22" /*LINTLIBRARY*/ /* @@ -69,7 +69,7 @@ static const struct entry *get_pri_dirs(); #define MATCH_MM 1 #define MATCH_FS 2 -#define MATCH_INO 4 +#define MATCH_INODE 4 #define MATCH_ALL 7 #define DEV "/dev" @@ -240,11 +240,11 @@ srch_dir(path, depth, skip_dirs, fsb) else if ((tsb.st_mode & S_IFMT) == S_IFCHR) { int flag = 0; if (tsb.st_dev == fsb->st_dev) - flag |= MATCH_FS; - if (tsb.st_rdev == fsb->st_rdev) flag |= MATCH_MM; + if (tsb.st_rdev == fsb->st_rdev) + flag |= MATCH_FS; if (tsb.st_ino == fsb->st_ino) - flag |= MATCH_INO; + flag |= MATCH_INODE; if ( (flag & file.flags) == file.flags ) { strcpy(rbuf, file.name); @@ -358,7 +358,7 @@ get_pri_dirs() vec->flags |= MATCH_FS; break; case 'I': - vec->flags |= MATCH_INO; + vec->flags |= MATCH_INODE; break; case EOLN_CHAR: state = CHECK_STATE; diff --git a/usr/src/lib/libc/port/gen/valloc.c b/usr/src/lib/libc/port/gen/valloc.c index 90a3a96..1af9977 100644 --- a/usr/src/lib/libc/port/gen/valloc.c +++ b/usr/src/lib/libc/port/gen/valloc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/valloc.c 1.2" +#ident "@(#)libc-port:gen/valloc.c 1.1" #ifdef __STDC__ #pragma weak valloc = _valloc @@ -13,7 +13,10 @@ #include "synonyms.h" #include -#include +#include + +extern unsigned getpagesize(); +extern VOID * memalign(); VOID * valloc(size) @@ -21,6 +24,6 @@ valloc(size) { static unsigned pagesize; if (!pagesize) - pagesize = sysconf(_SC_PAGESIZE); + pagesize = getpagesize(); return memalign(pagesize, size); } diff --git a/usr/src/lib/libc/port/gen/values-Xa.c b/usr/src/lib/libc/port/gen/values-Xa.c index d2b62ac..09d4563 100644 --- a/usr/src/lib/libc/port/gen/values-Xa.c +++ b/usr/src/lib/libc/port/gen/values-Xa.c @@ -5,9 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/values-Xa.c 1.3" +#ident "@(#)libc-port:gen/values-Xa.c 1.2" -#include "synonyms.h" #include /* variables which differ depending on the diff --git a/usr/src/lib/libc/port/gen/values-Xc.c b/usr/src/lib/libc/port/gen/values-Xc.c index db8550a..9c3f3f3 100644 --- a/usr/src/lib/libc/port/gen/values-Xc.c +++ b/usr/src/lib/libc/port/gen/values-Xc.c @@ -5,8 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/values-Xc.c 1.3" -#include "synonyms.h" +#ident "@(#)libc-port:gen/values-Xc.c 1.2" + #include /* variables which differ depending on the diff --git a/usr/src/lib/libc/port/gen/values-Xt.c b/usr/src/lib/libc/port/gen/values-Xt.c index be429f7..5ea60ac 100644 --- a/usr/src/lib/libc/port/gen/values-Xt.c +++ b/usr/src/lib/libc/port/gen/values-Xt.c @@ -5,9 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/values-Xt.c 1.3" +#ident "@(#)libc-port:gen/values-Xt.c 1.2" -#include "synonyms.h" #include /* variables which differ depending on the diff --git a/usr/src/lib/libc/port/gen/waitpid.c b/usr/src/lib/libc/port/gen/waitpid.c index c18a23e..b45e532 100644 --- a/usr/src/lib/libc/port/gen/waitpid.c +++ b/usr/src/lib/libc/port/gen/waitpid.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:gen/waitpid.c 1.2" +#ident "@(#)libc-port:gen/waitpid.c 1.1" #ifdef __STDC__ #pragma weak waitpid = _waitpid @@ -22,8 +22,9 @@ int options; idtype_t idtype; id_t id; siginfo_t info; - int error; + register error, stat; + options |= (WEXITED|WTRAPPED); if (pid > 0) { idtype = P_PID; id = pid; @@ -38,16 +39,13 @@ int options; id = getpgid(0); } - options |= (WEXITED|WTRAPPED); - - if ((error = waitid(idtype, id, &info, options)) < 0) + error = waitid(idtype, id, &info, options); + if (error < 0 || stat_loc == 0 || info.si_pid == 0) return error; - if (stat_loc) { + stat = (info.si_status & 0377); - register stat = (info.si_status & 0377); - - switch (info.si_code) { + switch (info.si_code) { case CLD_EXITED: stat <<= 8; break; @@ -64,10 +62,9 @@ int options; case CLD_CONTINUED: stat = WCONTFLG; break; - } - - *stat_loc = stat; } + *stat_loc = stat; + return info.si_pid; } diff --git a/usr/src/lib/libc/port/print/doprnt.c b/usr/src/lib/libc/port/print/doprnt.c index f5daede..c890ca0 100644 --- a/usr/src/lib/libc/port/print/doprnt.c +++ b/usr/src/lib/libc/port/print/doprnt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:print/doprnt.c 3.29" +#ident "@(#)libc-port:print/doprnt.c 3.28" /*LINTLIBRARY*/ /* @@ -297,6 +297,7 @@ register FILE *iop; case '.': flagword |= DOTSEEN; prec = 0; + flagword &= ~PADZERO; /* ignore 0 flag */ goto charswitch; case '*': @@ -468,9 +469,6 @@ register FILE *iop; if (flagword & SHORT) val = (short)val; - if ((flagword & PADZERO) && (flagword & DOTSEEN)) - flagword &= ~PADZERO; /* ignore 0 flag */ - /* Set buffer pointer to last digit */ p = bp = buf + MAXDIGS; @@ -532,9 +530,6 @@ register FILE *iop; if (flagword & SHORT) val = (unsigned short)val; - if ((flagword & PADZERO) && (flagword & DOTSEEN)) - flagword &= ~PADZERO; /* ignore 0 flag */ - p = bp = buf + MAXDIGS; if (val & HIBITL) @@ -576,9 +571,6 @@ register FILE *iop; if (flagword & SHORT) val = (unsigned short)val; - if ((flagword & PADZERO) && (flagword & DOTSEEN)) - flagword &= ~PADZERO; /* ignore 0 flag */ - /* Set translate table for digits */ tab = (fcode == 'X') ? uc_digs : lc_digs; diff --git a/usr/src/lib/libc/port/print/fprintf.c b/usr/src/lib/libc/port/print/fprintf.c index 542e069..511fd19 100644 --- a/usr/src/lib/libc/port/print/fprintf.c +++ b/usr/src/lib/libc/port/print/fprintf.c @@ -5,13 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:print/fprintf.c 1.14" +#ident "@(#)libc-port:print/fprintf.c 1.13" /*LINTLIBRARY*/ #include "synonyms.h" #include "shlib.h" #include #include -#include extern int _doprnt(); @@ -38,7 +37,6 @@ fprintf(iop, format, va_alist) FILE *iop; char *format; va_dcl iop->_flag |= _IOWRT; } else { /* else error */ - errno = EBADF; return EOF; } } diff --git a/usr/src/lib/libc/port/print/makefile b/usr/src/lib/libc/port/print/makefile index bc410d9..be32c61 100644 --- a/usr/src/lib/libc/port/print/makefile +++ b/usr/src/lib/libc/port/print/makefile @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libc-port:print/makefile 1.12.4.1" +#ident "@(#)libc-port:print/makefile 1.12.3.2" # # makefile for libc/port/print # @@ -59,4 +59,4 @@ doprnt.o fprintf.o printf.o sprintf.o : $(INCLIBC)/shlib.h $(PROF)@echo $*.c: $(PROF)$(CC) $(DEFLIST) $(INCLIST) $(CFLAGS) -c -p $*.c && mv $(*F).o $*.p $(PIC)@echo $*.c: - $(PIC)$(CC) $(DEFLIST) $(INCLIST) $(CFLAGS) -c -DDSHLIB -Kpic $*.c && mv $(*F).o $*.P + $(PIC)$(CC) $(DEFLIST) $(INCLIST) $(CFLAGS) -c -Kpic $*.c && mv $(*F).o $*.P diff --git a/usr/src/lib/libc/port/print/printf.c b/usr/src/lib/libc/port/print/printf.c index c82bba3..c36c7f0 100644 --- a/usr/src/lib/libc/port/print/printf.c +++ b/usr/src/lib/libc/port/print/printf.c @@ -5,13 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:print/printf.c 1.14" +#ident "@(#)libc-port:print/printf.c 1.13" /*LINTLIBRARY*/ #include "synonyms.h" #include "shlib.h" #include #include -#include extern int _doprnt(); @@ -38,7 +37,6 @@ printf(format, va_alist) char *format; va_dcl stdout->_flag |= _IOWRT; } else { /* else error */ - errno = EBADF; return EOF; } } diff --git a/usr/src/lib/libc/port/print/vfprintf.c b/usr/src/lib/libc/port/print/vfprintf.c index 05066f8..cb08304 100644 --- a/usr/src/lib/libc/port/print/vfprintf.c +++ b/usr/src/lib/libc/port/print/vfprintf.c @@ -5,12 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:print/vfprintf.c 1.7.1.4" +#ident "@(#)libc-port:print/vfprintf.c 1.7.1.3" /*LINTLIBRARY*/ #include "synonyms.h" #include #include -#include extern int _doprnt(); @@ -30,7 +29,6 @@ va_list ap; iop->_flag |= _IOWRT; } else { /* else error */ - errno = EBADF; return EOF; } } diff --git a/usr/src/lib/libc/port/print/vprintf.c b/usr/src/lib/libc/port/print/vprintf.c index 90289f3..07991cf 100644 --- a/usr/src/lib/libc/port/print/vprintf.c +++ b/usr/src/lib/libc/port/print/vprintf.c @@ -5,12 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:print/vprintf.c 1.7.1.4" +#ident "@(#)libc-port:print/vprintf.c 1.7.1.3" /*LINTLIBRARY*/ #include "synonyms.h" #include #include -#include extern int _doprnt(); @@ -29,7 +28,6 @@ va_list ap; stdout->_flag |= _IOWRT; } else { /* else error */ - errno = EBADF; return EOF; } } diff --git a/usr/src/lib/libc/port/stdio/_filbuf.c b/usr/src/lib/libc/port/stdio/_filbuf.c index 2863b02..a2e09bb 100644 --- a/usr/src/lib/libc/port/stdio/_filbuf.c +++ b/usr/src/lib/libc/port/stdio/_filbuf.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/_filbuf.c 1.8" +#ident "@(#)libc-port:stdio/_filbuf.c 1.7" /*LINTLIBRARY*/ #ifdef __STDC__ @@ -14,7 +14,6 @@ #include "synonyms.h" #include "shlib.h" #include -#include #include "stdiom.h" extern int read(); @@ -31,10 +30,8 @@ _filbuf(iop) /* fill buffer, return first character or EOF */ { if (iop->_flag & _IORW) iop->_flag |= _IOREAD; /* change direction to read - fseek */ - else { - errno = EBADF; + else return EOF; - } } if (iop->_base == 0) diff --git a/usr/src/lib/libc/port/stdio/_wrtchk.c b/usr/src/lib/libc/port/stdio/_wrtchk.c index 2279bde..df23eba 100644 --- a/usr/src/lib/libc/port/stdio/_wrtchk.c +++ b/usr/src/lib/libc/port/stdio/_wrtchk.c @@ -5,14 +5,13 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/_wrtchk.c 1.5" +#ident "@(#)libc-port:stdio/_wrtchk.c 1.4" /*LINTLIBRARY*/ #include "synonyms.h" #include "shlib.h" #include #include "stdiom.h" -#include #undef _wrtchk @@ -26,7 +25,6 @@ _wrtchk(iop) /* check permissions, correct for read & write changes */ { if (!(flags & (_IOWRT | _IORW))) { iop->_flag |= _IOERR; - errno = EBADF; return EOF; /* stream is not writeable */ } iop->_flag = (flags & ~_IOEOF) | _IOWRT; diff --git a/usr/src/lib/libc/port/stdio/cuserid.c b/usr/src/lib/libc/port/stdio/cuserid.c index 31f719c..15ab7ec 100644 --- a/usr/src/lib/libc/port/stdio/cuserid.c +++ b/usr/src/lib/libc/port/stdio/cuserid.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/cuserid.c 1.14" +#ident "@(#)libc-port:stdio/cuserid.c 1.13" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ #ifdef __STDC__ @@ -19,6 +19,7 @@ extern char *getlogin(); extern int getuid(); extern struct passwd *getpwuid(); +extern void endpwent(); static char res[L_cuserid]; char * @@ -34,6 +35,7 @@ cuserid(s) if (p != 0) return strcpy(s, p); pw = getpwuid(getuid()); + endpwent(); if (pw != 0) return strcpy(s, pw->pw_name); *s = '\0'; diff --git a/usr/src/lib/libc/port/stdio/doscan.c b/usr/src/lib/libc/port/stdio/doscan.c index f73ccae..52c2bd4 100644 --- a/usr/src/lib/libc/port/stdio/doscan.c +++ b/usr/src/lib/libc/port/stdio/doscan.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/doscan.c 2.35" +#ident "@(#)libc-port:stdio/doscan.c 2.32" /*LINTLIBRARY*/ #include "synonyms.h" #include @@ -72,12 +72,6 @@ va_list va_alist; * arglst[1] is the second argument, etc. */ - /* Check if readable stream */ - if (!(iop->_flag & (_IOREAD | _IORW))) { - errno = EBADF; - return(EOF); - } - /* Initialize args and sargs to the start of the argument list. * Note that ANSI guarantees that the address of the first member of * a structure will be the same as the address of the structure. */ @@ -162,8 +156,7 @@ va_list va_alist; return(EOF); /* unexpected end of format */ if (isupper(ch)) /* no longer documented */ { - if (_lib_version == c_issue_4) - size = 'l'; + size = 'l'; ch = _tolower(ch); } if (ch!= 'n' && !flag_eof) @@ -321,12 +314,11 @@ va_list *listp; else if (inchar == '+' || inchar == '-' || (isspace(inchar) && (_lib_version == c_issue_4))) { - if ((len-2) < 0) + if ((len-=2) < 0) { locungetc(inchar); break; } - --len; lookahead = readchar(iop); if (isdigit(lookahead)) { diff --git a/usr/src/lib/libc/port/stdio/fdopen.c b/usr/src/lib/libc/port/stdio/fdopen.c index 92f6385..f19a788 100644 --- a/usr/src/lib/libc/port/stdio/fdopen.c +++ b/usr/src/lib/libc/port/stdio/fdopen.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/fdopen.c 1.16" +#ident "@(#)libc-port:stdio/fdopen.c 1.15" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ /* @@ -18,7 +18,6 @@ #endif #include "synonyms.h" #include -#include #include "stdiom.h" extern long lseek( /* int fd, long offset, int whence */ ); @@ -32,9 +31,9 @@ fdopen(fd, type) /* associate file desc. with stream */ register int plus; register unsigned char flag; - if (fd > UCHAR_MAX || (iop = _findiop()) == 0) + if ((iop = _findiop()) == 0) return 0; - iop->_file = (Uchar)fd; + iop->_file = (Uchar)fd; /* assume that fd fits in (Uchar) _file */ switch (type[0]) { default: diff --git a/usr/src/lib/libc/port/stdio/fgets.c b/usr/src/lib/libc/port/stdio/fgets.c index 7095f5b..98284ef 100644 --- a/usr/src/lib/libc/port/stdio/fgets.c +++ b/usr/src/lib/libc/port/stdio/fgets.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/fgets.c 3.15" +#ident "@(#)libc-port:stdio/fgets.c 3.14" /*LINTLIBRARY*/ #include "synonyms.h" @@ -13,7 +13,6 @@ #include #include "stdiom.h" #include -#include char * fgets(buf, size, iop) /* read size-max line from stream, including '\n' */ @@ -26,10 +25,8 @@ fgets(buf, size, iop) /* read size-max line from stream, including '\n' */ register Uchar *bufend; register char *p; - if (!(iop->_flag & (_IOREAD | _IORW))) { - errno = EBADF; + if (!(iop->_flag & (_IOREAD | _IORW))) return 0; - } if (iop->_base == 0) { diff --git a/usr/src/lib/libc/port/stdio/flush.c b/usr/src/lib/libc/port/stdio/flush.c index d0a6d22..711f68a 100644 --- a/usr/src/lib/libc/port/stdio/flush.c +++ b/usr/src/lib/libc/port/stdio/flush.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/flush.c 1.18" +#ident "@(#)libc-port:stdio/flush.c 1.16" /*LINTLIBRARY*/ /* This file always part of stdio usage */ #include "synonyms.h" @@ -221,8 +221,6 @@ int fflush(iop) /* flush (write) buffer */ register FILE *iop; { - int res = 0; - if (iop == NULL) { register int i; register Link *lp; @@ -232,16 +230,14 @@ fflush(iop) /* flush (write) buffer */ do { iop = lp->iobp; for (i = lp->niob; --i >= 0; iop++) { - if (iop->_flag & _IOWRT) - res |= fflush(iop); + if ((iop != NULL) && (iop->_flag & _IOWRT)) + (void)fflush(iop); } } while ((lp = lp->next) != 0); - return res; } if (!(iop->_flag & _IOWRT)) { - lseek(iop->_file, -iop->_cnt, SEEK_CUR); iop->_cnt = 0; iop->_ptr = iop->_base; /* needed for ungetc & mulitbyte pushbacks */ if (iop->_flag & _IORW) { @@ -250,12 +246,12 @@ fflush(iop) /* flush (write) buffer */ return 0; } if (iop->_base != 0 && iop->_ptr > iop->_base) - res = _xflsbuf(iop); + _xflsbuf(iop); if (iop->_flag & _IORW) { iop->_flag &= (unsigned short)~_IOWRT; iop->_cnt = 0; } - return res; + return ferror(iop) ? EOF : 0; } extern int close( /* int fd */ ); diff --git a/usr/src/lib/libc/port/stdio/fopen.c b/usr/src/lib/libc/port/stdio/fopen.c index 5a0cdc9..39d2399 100644 --- a/usr/src/lib/libc/port/stdio/fopen.c +++ b/usr/src/lib/libc/port/stdio/fopen.c @@ -5,14 +5,14 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/fopen.c 1.20" +#ident "@(#)libc-port:stdio/fopen.c 1.19" /*LINTLIBRARY*/ #include "synonyms.h" #include #include "stdiom.h" #include -#include +#include #include static FILE * diff --git a/usr/src/lib/libc/port/stdio/fputs.c b/usr/src/lib/libc/port/stdio/fputs.c index 88d4a9e..5cf5564 100644 --- a/usr/src/lib/libc/port/stdio/fputs.c +++ b/usr/src/lib/libc/port/stdio/fputs.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/fputs.c 3.18" +#ident "@(#)libc-port:stdio/fputs.c 3.16" /*LINTLIBRARY*/ /* * Ptr args aren't checked for NULL because the program would be a @@ -62,11 +62,7 @@ register FILE *iop; /* write out to an unbuffered file */ register unsigned int cnt = strlen(ptr); - if (cnt != write(iop->_file, ptr, cnt)) - { - iop->_flag |= _IOERR; - return EOF; - } + (void)write(iop->_file, ptr, cnt); return cnt; } } diff --git a/usr/src/lib/libc/port/stdio/fread.c b/usr/src/lib/libc/port/stdio/fread.c index d64bc5a..f34992a 100644 --- a/usr/src/lib/libc/port/stdio/fread.c +++ b/usr/src/lib/libc/port/stdio/fread.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/fread.c 3.29" +#ident "@(#)libc-port:stdio/fread.c 3.28" /*LINTLIBRARY*/ #include "synonyms.h" @@ -15,7 +15,6 @@ #include #include #include -#include extern int read(); @@ -41,7 +40,6 @@ fread(ptr, size, count, iop) if (!(iop->_flag & (_IOREAD | _IORW))) { /* is it a readable stream */ iop->_flag |= _IOERR; - errno = EBADF; return 0; } if (iop->_base == 0) diff --git a/usr/src/lib/libc/port/stdio/fseek.c b/usr/src/lib/libc/port/stdio/fseek.c index b593933..01d0318 100644 --- a/usr/src/lib/libc/port/stdio/fseek.c +++ b/usr/src/lib/libc/port/stdio/fseek.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/fseek.c 1.15" +#ident "@(#)libc-port:stdio/fseek.c 1.14" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ /* @@ -31,8 +31,7 @@ int ptrname; offset -= iop->_cnt; } } else if(iop->_flag & (_IOWRT | _IORW)) { - if (fflush(iop) == EOF) - return(-1); + (void) fflush(iop); } iop->_flag &= (unsigned short)~_IOEOF; iop->_cnt = 0; diff --git a/usr/src/lib/libc/port/stdio/gets.c b/usr/src/lib/libc/port/stdio/gets.c index 76ca8cc..dc134f0 100644 --- a/usr/src/lib/libc/port/stdio/gets.c +++ b/usr/src/lib/libc/port/stdio/gets.c @@ -5,14 +5,13 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/gets.c 3.13" +#ident "@(#)libc-port:stdio/gets.c 3.12" /*LINTLIBRARY*/ #include "synonyms.h" #include "shlib.h" #include #include "stdiom.h" #include -#include char * gets(buf) /* read a single line from stdin, replace the '\n' with '\0' */ @@ -23,10 +22,8 @@ gets(buf) /* read a single line from stdin, replace the '\n' with '\0' */ register char *p; register Uchar *bufend; - if (!(stdin->_flag & (_IOREAD | _IORW))) { - errno = EBADF; + if (!(stdin->_flag & (_IOREAD | _IORW))) return 0; - } if (stdin->_base == 0) { if ((bufend = _findbuf(stdin)) == 0) diff --git a/usr/src/lib/libc/port/stdio/popen.c b/usr/src/lib/libc/port/stdio/popen.c index 9e83336..a21613f 100644 --- a/usr/src/lib/libc/port/stdio/popen.c +++ b/usr/src/lib/libc/port/stdio/popen.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/popen.c 1.29" +#ident "@(#)libc-port:stdio/popen.c 1.26" /*LINTLIBRARY*/ #ifdef __STDC__ #pragma weak pclose = _pclose @@ -20,13 +20,13 @@ #include #include #include -#include +#include #define tst(a,b) (*mode == 'r'? (b) : (a)) #define RDR 0 #define WTR 1 -#define BIN_SH "/sbin/sh" +#define BIN_SH "/bin/sh" #define SH "sh" #define SHFLG "-c" #if DSHLIB @@ -44,7 +44,7 @@ const char *cmd, *mode; register int myside, yourside, pid; #if DSHLIB - if (popen_pid == NULL && (popen_pid = (int *)calloc(256, sizeof(int))) == NULL) + if (popen_pid == NULL && (popen_pid = malloc(sizeof(int) * 256)) == NULL) return (NULL); #endif diff --git a/usr/src/lib/libc/port/stdio/putw.c b/usr/src/lib/libc/port/stdio/putw.c index 009d714..70c3103 100644 --- a/usr/src/lib/libc/port/stdio/putw.c +++ b/usr/src/lib/libc/port/stdio/putw.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/putw.c 1.11" +#ident "@(#)libc-port:stdio/putw.c 1.10" /* 3.0 SID # 1.2 */ /*LINTLIBRARY*/ /* @@ -28,7 +28,7 @@ putw(w, stream) register char *s = (char *)&w; register int i = sizeof(int); - while (--i >= 0 && putc(*s++, stream) != EOF) - ; + while (--i >= 0) + (void) putc (*s++, stream); return stream->_flag & _IOERR; } diff --git a/usr/src/lib/libc/port/stdio/stdiom.h b/usr/src/lib/libc/port/stdio/stdiom.h index 9827010..fab7303 100644 --- a/usr/src/lib/libc/port/stdio/stdiom.h +++ b/usr/src/lib/libc/port/stdio/stdiom.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/stdiom.h 1.9" +#ident "@(#)libc-port:stdio/stdiom.h 1.8" /* * stdiom.h - shared guts of stdio therefore it doesn't need a surrounding #ifndef */ @@ -39,9 +39,10 @@ extern Uchar *_bufendtab[]; # define MULTIBFSZ(SZ) ((SZ) - (SZ % BUFSIZ)) #endif -#undef _bufend +#ifndef _bufend #define _bufend(iop) (((iop)->_file < _NFILE) ? _bufendtab[(iop)->_file] : \ _realbufend(iop)) +#endif #define setbufend(iop, end) \ if (iop->_file < _NFILE) _bufendtab[(iop)->_file] = end; \ else _setbufend(iop,end) diff --git a/usr/src/lib/libc/port/stdio/system.c b/usr/src/lib/libc/port/stdio/system.c index 31bca06..0698d12 100644 --- a/usr/src/lib/libc/port/stdio/system.c +++ b/usr/src/lib/libc/port/stdio/system.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/system.c 1.21" +#ident "@(#)libc-port:stdio/system.c 1.18" /* 3.0 SID # 1.4 */ /*LINTLIBRARY*/ #include "synonyms.h" @@ -13,12 +13,9 @@ #include #include #include -#include +#include -#include -#undef uname - -#define BIN_SH "/sbin/sh" +#define BIN_SH "/bin/sh" int system(s) @@ -26,9 +23,7 @@ const char *s; { int status, pid, w; void (*istat)(), (*qstat)(), (*cstat)(); - struct stat buf; - static int vers; - struct utsname uname_buf; + struct stat buf; if (s == NULL) { if (stat(BIN_SH, &buf) != 0) { @@ -52,20 +47,8 @@ const char *s; istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); cstat = signal(SIGCLD, SIG_DFL); - - if (vers == 0) { - if (uname(&uname_buf) > 0) - vers = 2; /* SVR4 system */ - else - vers = 1; /* non-SVR4 system */ - } - - if ( vers == 1 ) { - while((w = wait(&status)) != pid && w != -1) - ; - } else - w = waitpid(pid, &status, 0); - + while((w = wait(&status)) != pid && w != -1) + ; (void) signal(SIGINT, istat); (void) signal(SIGQUIT, qstat); (void) signal(SIGCLD, cstat); diff --git a/usr/src/lib/libc/port/stdio/tempnam.c b/usr/src/lib/libc/port/stdio/tempnam.c index 0f348aa..08af905 100644 --- a/usr/src/lib/libc/port/stdio/tempnam.c +++ b/usr/src/lib/libc/port/stdio/tempnam.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:stdio/tempnam.c 1.7.1.9" +#ident "@(#)libc-port:stdio/tempnam.c 1.7.1.7" /*LINTLIBRARY*/ #ifdef __STDC__ #pragma weak tempnam = _tempnam @@ -14,19 +14,13 @@ #include "shlib.h" #include #include -#include #define max(A,B) (((A)<(B))?(B):(A)) +extern char *malloc(), *getenv(), *mktemp(); extern int access(); -#ifdef __STDC__ -static char *pcopy(char *, const char *); -#else -static char *pcopy(); -#endif - -static char *seed="AAA"; +static char *pcopy(), *seed="AAA"; char * tempnam(dir, pfx) diff --git a/usr/src/lib/libc/port/sys/execl.c b/usr/src/lib/libc/port/sys/execl.c index fb2d2c1..9a58c62 100644 --- a/usr/src/lib/libc/port/sys/execl.c +++ b/usr/src/lib/libc/port/sys/execl.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:sys/execl.c 1.5.1.6" +#ident "@(#)libc-port:sys/execl.c 1.5.1.5" /* * execl(name, arg0, arg1, ..., argn, 0) * environment automatically passed. @@ -15,24 +15,13 @@ #pragma weak execl = _execl #endif #include "synonyms.h" -#include extern int execve(); -int -#ifdef __STDC__ -execl(char *name, ...) -#else -execl(name, va_alist) char *name; va_dcl -#endif +execl(name, args) +char *name, *args; { - va_list args; extern char **environ; -#ifdef __STDC__ - va_start(args,); -#else - va_start(args); -#endif - return (execve(name, args, environ)); + return (execve(name, &args, environ)); } diff --git a/usr/src/lib/libc/port/sys/execle.c b/usr/src/lib/libc/port/sys/execle.c index 2e5eda4..62ebb27 100644 --- a/usr/src/lib/libc/port/sys/execle.c +++ b/usr/src/lib/libc/port/sys/execle.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:sys/execle.c 1.6.1.5" +#ident "@(#)libc-port:sys/execle.c 1.6.1.4" /* * execle(file, arg1, arg2, ..., 0, envp) */ @@ -13,27 +13,16 @@ #pragma weak execle = _execle #endif #include "synonyms.h" -#include extern int execve(); -int -#ifdef __STDC__ -execle(char *file, ...) -#else -execle(file, va_alist) char *file; va_dcl -#endif +execle(file, args) + char *file; + char *args; /* first arg */ { - register char *p; - va_list args, sargs; + register char **p; -#ifdef __STDC__ - va_start(args,); -#else - va_start(args); -#endif - sargs = args; - while ((p = va_arg(args, char *)) != 0) ; - p = va_arg(args, char *); - return(execve(file, sargs, p)); + p = &args; + while(*p++); + return(execve(file, &args, *p)); } diff --git a/usr/src/lib/libc/port/sys/hrtsys.c b/usr/src/lib/libc/port/sys/hrtsys.c index f147b3f..07127ff 100644 --- a/usr/src/lib/libc/port/sys/hrtsys.c +++ b/usr/src/lib/libc/port/sys/hrtsys.c @@ -5,16 +5,14 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:sys/hrtsys.c 1.2" +#ident "@(#)libc-port:sys/hrtsys.c 1.1" -#ifndef DSHLIB #ifdef __STDC__ #pragma weak hrtcntl = _hrtcntl #pragma weak hrtalarm = _hrtalarm #pragma weak hrtsleep = _hrtsleep #pragma weak hrtcancel = _hrtcancel #endif -#endif #include "synonyms.h" #include "sys/types.h" #include "sys/evecb.h" @@ -35,8 +33,6 @@ hrtime_t *hrtp; return(syscall(HRTSYS, HRTCNTL, cmd, clk, intp, hrtp)); } -#ifndef DSHLIB - hrtalarm(cmdp, cmds) hrtcmd_t *cmdp; int cmds; @@ -56,4 +52,3 @@ int eids; { return(syscall(HRTSYS, HRTCANCEL, eidp, eids)); } -#endif diff --git a/usr/src/lib/libc/port/sys/makefile b/usr/src/lib/libc/port/sys/makefile index 813de2c..07258df 100644 --- a/usr/src/lib/libc/port/sys/makefile +++ b/usr/src/lib/libc/port/sys/makefile @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libc-port:sys/makefile 1.5.6.1" +#ident "@(#)libc-port:sys/makefile 1.5.5.2" # # makefile for libc/port/sys # @@ -33,7 +33,7 @@ msgsys.o nfssys.o semsys.o shmsys.o POBJECTS=$(OBJECTS:.o=.p) PIC_OBJECTS=\ -execl.P execle.P execv.P hrtsys.P lockf.P \ +execl.P execle.P execv.P lockf.P \ msgsys.P semsys.P shmsys.P ABI_OBJECTS=$(PIC_OBJECTS:.P=.A) diff --git a/usr/src/lib/libc/port/sys/msgsys.c b/usr/src/lib/libc/port/sys/msgsys.c index 470ed5b..ed124a3 100644 --- a/usr/src/lib/libc/port/sys/msgsys.c +++ b/usr/src/lib/libc/port/sys/msgsys.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libc-port:sys/msgsys.c 1.6.1.6" +#ident "@(#)libc-port:sys/msgsys.c 1.6.1.5" #ifdef __STDC__ #pragma weak msgctl = _msgctl #pragma weak msgget = _msgget @@ -66,7 +66,7 @@ int msgflg; int msgrcv(msqid, msgp, msgsz, msgtyp, msgflg) int msqid; -void *msgp; +struct msgbuf *msgp; int msgsz; long msgtyp; int msgflg; @@ -77,7 +77,7 @@ int msgflg; int msgsnd(msqid, msgp, msgsz, msgflg) int msqid; -const void *msgp; +const struct msgbuf *msgp; int msgsz, msgflg; { return(syscall(MSGSYS, MSGSND, msqid, msgp, msgsz, msgflg)); diff --git a/usr/src/lib/libcrypt/__Ext_Synonyms b/usr/src/lib/libcrypt/__Ext_Synonyms new file mode 100644 index 0000000..9ab0af2 --- /dev/null +++ b/usr/src/lib/libcrypt/__Ext_Synonyms @@ -0,0 +1,15 @@ +#ident "@(#)libcrypt:__Ext_Synonyms 1.3" + +# functions, some are undocumented but are necessary for compatibility +setkey _setkey +encrypt _encrypt +crypt _crypt +des_setkey _des_setkey +des_encrypt _des_encrypt +des_crypt _des_crypt +des_decrypt1 _des_decrypt1 +des_encrypt1 _des_encrypt1 +run_setkey _run_setkey +run_crypt _run_crypt +crypt_close _crypt_close +makekey _makekey diff --git a/usr/src/lib/libcrypt/cryptio.c b/usr/src/lib/libcrypt/cryptio.c index b1727fa..cddbd80 100644 --- a/usr/src/lib/libcrypt/cryptio.c +++ b/usr/src/lib/libcrypt/cryptio.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libcrypt:cryptio.c 1.19" +#ident "@(#)libcrypt:cryptio.c 1.16.1.1" #ifdef __STDC__ #pragma weak run_setkey = _run_setkey @@ -13,13 +13,15 @@ #pragma weak crypt_close = _crypt_close #pragma weak makekey = _makekey #endif - #include "synonyms.h" + #include #include #include #include #include +#include +#undef uname #define READER 0 #define WRITER 1 @@ -44,8 +46,8 @@ extern int kill(); extern char *strncpy(); extern int close(), execl(), + fork(), pipe(); -extern pid_t fork(); void _exit(); int crypt_close(); @@ -66,7 +68,7 @@ const char *keyparam; return(1); } -static char cmd[] = "exec /usr/bin/crypt -p 2>/dev/null"; +static char cmd[] = "exec /bin/crypt -p 2>/dev/null"; static int cryptopen(p) int p[2]; @@ -204,7 +206,7 @@ int p[2]; /* file descriptor array to cmd stdin and stdout */ (void) close( 1 ); (void) fcntl( fromcmd[1], F_DUPFD, 1 ); (void) close( fromcmd[1] ); - (void) execl("/sbin/sh", "sh", "-c", cmd, 0); + (void) execl("/bin/sh", "sh", "-c", cmd, 0); _exit(1); } if(pid == -1) @@ -224,13 +226,21 @@ int p[2]; { register pid_t r; int status; - pid_t waitpid(); + pid_t wait(), waitpid(); void (*hstat)(), (*istat)(), (*qstat)(); + static int vers; + struct utsname uname_buf; pid_t pid; + if (vers == 0) { + if (uname(&uname_buf) > 0) + vers = 2; /* SVR4 system */ + else + vers = 1; + } if(p[0] < 0 || p[0] >= 256 || p[1] < 0 || p[1] >= 256) return -1; pid = popen_pid[p[0]]; @@ -241,8 +251,12 @@ int p[2]; istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); hstat = signal(SIGHUP, SIG_IGN); - while ((r = waitpid(pid, &status, 0)) == (pid_t)-1 && errno == EINTR) - ; + if(vers == 2) + while ((r = wait(&status)) != pid && r != (pid_t)-1 || errno == EINTR) + ; + else + while ((r = waitpid(pid, &status, 0)) == (pid_t)-1 && errno == EINTR) + ; if (r == (pid_t)-1) status = -1; (void) signal(SIGINT, istat); diff --git a/usr/src/lib/libcrypt/des_crypt.c b/usr/src/lib/libcrypt/des_crypt.c index 15680b3..fd86fba 100644 --- a/usr/src/lib/libcrypt/des_crypt.c +++ b/usr/src/lib/libcrypt/des_crypt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libcrypt:des_crypt.c 1.9" +#ident "@(#)libcrypt:des_crypt.c 1.8" #ifdef __STDC__ #pragma weak des_crypt = _des_crypt @@ -15,7 +15,7 @@ #include "synonyms.h" #if INTERNATIONAL -#include +#include #endif /*LINTLIBRARY*/ @@ -263,7 +263,7 @@ int edflag; extern void des_encrypt1(); #if INTERNATIONAL if(edflag) - errno = ENOSYS; + fputs("Decryption unavailable in international version.\n", stderr); #else extern void des_decrypt1(); diff --git a/usr/src/lib/libdl/libdl.mk b/usr/src/lib/libdl/libdl.mk index 6bb50e8..fea2248 100644 --- a/usr/src/lib/libdl/libdl.mk +++ b/usr/src/lib/libdl/libdl.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libdl:libdl.mk 1.5" +#ident "@(#)libdl:libdl.mk 1.4" # # makefile for libdl # @@ -34,14 +34,7 @@ MAKE=make ENVPARMS=ROOT="$(ROOT)" SGS="$(SGS)" OWN="$(OWN)" GRP="$(GRP)" CC="$(CC)" CFLAGS="$(CFLAGS)" LDLIBS="$(LDLIBS)" LINT="$(LINT)" LINTFLAGS="$(LINTFLAGS)" INS="$(INS)" STRIP="$(STRIP)" MAKE="$(MAKE)" LIB="$(LIB)" USRLIB="$(USRLIB)" SGSBASE="$(SGSBASE)" # -all: - if u3b2 || u3b5 || u3b15; \ - then \ - $(MAKE) -f libdl.mk libdl.so MACH=m32; \ - elif i386; \ - then \ - $(MAKE) -f libdl.mk libdl.so MACH=i386; \ - fi +all: libdl.so libdl.so: $(OBJECTS) $(AR) -r libdl.so $(OBJECTS) diff --git a/usr/src/lib/libdl/m32/dlclose.s b/usr/src/lib/libdl/m32/dlclose.s index 6932ea8..0d9b128 100644 --- a/usr/src/lib/libdl/m32/dlclose.s +++ b/usr/src/lib/libdl/m32/dlclose.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)libdl:m32/dlclose.s 1.1" # dlclose calls _dlopen in ld.so diff --git a/usr/src/lib/libdl/m32/dlerror.s b/usr/src/lib/libdl/m32/dlerror.s index caee124..dcf331a 100644 --- a/usr/src/lib/libdl/m32/dlerror.s +++ b/usr/src/lib/libdl/m32/dlerror.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)libdl:m32/dlerror.s 1.1" # dlerror calls _dlerror in ld.so diff --git a/usr/src/lib/libdl/m32/dlopen.s b/usr/src/lib/libdl/m32/dlopen.s index 4549f79..ed03007 100644 --- a/usr/src/lib/libdl/m32/dlopen.s +++ b/usr/src/lib/libdl/m32/dlopen.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)libdl:m32/dlopen.s 1.1" # dlopen calls _dlopen in ld.so diff --git a/usr/src/lib/libdl/m32/dlsym.s b/usr/src/lib/libdl/m32/dlsym.s index 8f3f9db..f1bdf1b 100644 --- a/usr/src/lib/libdl/m32/dlsym.s +++ b/usr/src/lib/libdl/m32/dlsym.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)libdl:m32/dlsym.s 1.1" # dlsym calls _dlsym in ld.so diff --git a/usr/src/lib/libgen/getdate.c b/usr/src/lib/libgen/getdate.c new file mode 100644 index 0000000..e71e070 --- /dev/null +++ b/usr/src/lib/libgen/getdate.c @@ -0,0 +1,886 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libgen:getdate.c 1.1.8.2" + +#ifdef __STDC__ + #pragma weak getdate_err = _getdate_err + #pragma weak getdate = _getdate +#endif +#include "synonyms.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define LC_NAMELEN 15 /* maximum path name length, (incl. \0) */ + +extern char *getenv(); +extern int errno; +extern int read(); +extern void free(); +extern int close(); +extern int fstat(); +extern int stat(); +extern int tolower(); +extern char *_fullocale(); + +extern char _cur_locale[][LC_NAMELEN]; + +int getdate_err = 0; /* This global variable is set + * when an error condition is + * encountered and is used to + * differentiate among different + * error conditions. */ +/* + * The following are the possible contents of the getdate_err + * variable and the corresponding error conditions. + ******************************************************************** + * 1 The DATEMASK environment variable is null or undefined. + * 2 Error on open of the template file. + * 3 Error on stat of the template file. + * 4 The template file is not a regular file. + * 5 Error on read of the template file. + * 6 Malloc failed. + * 7 There is no line in the template that matches the input. + * 8 Invalid input specification. + ******************************************************************** + */ + +static void settime(); +static struct tm *calc_date(); +static int lookup(); +static int read_tmpl(); +static int parse_fmt(); +static void getnow(); +static int verify(); +static void Day(); +static void DMY(); +static void setcal(); +static int days(); +static int jan1(); +static void year(); +static void MON(); +static void Month(); +static void DOW(); +static void adddays(); +static void DOY(); + +static char *input; +static int name; +static int hour; +static int wrong_input; +static int meridian; +static int linenum; +static struct tm *ct; +static struct tm t; +static int dpm[] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +enum STR +{ + aJan, aFeb, aMar, aApr, aMay, aJun, aJul, aAug, aSep, aOct, aNov, aDec, + Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, + aSun, aMon, aTue, aWed, aThu, aFri, aSat, + Sun, Mon, Tue, Wed, Thu, Fri, Sat, + Local_time, Local_date, DFL_FMT, + AM, PM, + LAST +}; +/* + * Default values. + */ +static char * _time[] = { + "jan","feb","mar","apr","may","jun","jul", "aug", "sep","oct", "nov", "dec", + "january", "february", "march","april", + "may","june", "july", "august", "september", + "october", "november", "december", + "sun","mon", "tue", "wed","thu", "fri","sat", + "sunday","monday","tuesday","wednesday", "thursday","friday","saturday", + "%H:%M:%S", "%m/%d/%y", "%a %b %e %T %Z %Y", + "am", "pm", NULL +}; + + + +struct tm * +getdate(expression) +const char *expression; +{ + + settime(); + wrong_input = 0; + linenum = 1; + if (read_tmpl((char *)expression)) + return(calc_date()); + else { + if (wrong_input) + getdate_err = 8; + return(NULL); + } +} + +static char saved_locale[LC_NAMELEN] = "C"; + +/* + * Read the language specific file and initialize pointers + * to month and weekday names and to meridian markers. + */ +extern void tzset(); +extern char *tzname[2]; +static char mytzname[2][4] = { "GMT", " "}; + +static void +settime() +{ + register char *p; + register int j; + register int k = 0; + char *locale; + char *my_time[LAST]; + static char *ostr = (char *)0 ; + char *str; + unsigned char c; + int fd; + struct stat buf; + + + locale = _cur_locale[LC_TIME]; + tzset(); + strncpy(&mytzname[0][0], tzname[0], 3); + strncpy(&mytzname[1][0], tzname[1], 3); + for(j=0; j<2; j++) + for(k = 0; k<3; k++) { + mytzname[j][k] = tolower(mytzname[j][k]); + if(mytzname[j][k] == ' ') { + mytzname[j][k] = '\0'; + break; + } + } + if (strcmp(locale, saved_locale) == 0) + return; + + if ( (fd = open(_fullocale(locale, "LC_TIME"), O_RDONLY)) == -1) + goto err1; + + if ( (fstat(fd, &buf)) != 0 || (str = malloc((unsigned)(buf.st_size + 2))) == NULL) + goto err2; + + if ( (read(fd, str, (unsigned) buf.st_size)) != buf.st_size) + goto err3; + + /* Set last character of str to '\0' */ + p = &str[buf.st_size]; + p[0] = '\n'; + p[1] = '\0'; + + /* p will "walk thru" str */ + p = str; + + j = -1; + k = 0; + while (*p != '\0') + { + /* "Look for a newline, i.e. end of sub-string + * and change it to a '\0'. If LAST pointers + * have been set in mystr, but the newline hasn't been seen + * yet, keep going thru the string leaving mystr alone. + */ + if (++j < (int) LAST) + my_time[j] = p; + p = strchr(p, '\n'); + *p++ = '\0'; + if (j < (int) LAST) + while ((c = my_time[j][k]) != '\0') { + if(c == '%' && my_time[j][k+1]) + k++; + else + my_time[j][k] = tolower(c); + k++; + } + k = 0; + } + if (j == (int) LAST) + { + (void) memcpy((char *) _time, (char *) my_time, sizeof(my_time)); + (void) strcpy(saved_locale, locale); + if (ostr != 0) /* free the previoulsy allocated local array*/ + free(ostr); + ostr = str; + (void) close(fd); + return; + } +err3: (void) free(str); +err2: (void) close(fd); +err1: (void) strcpy(_cur_locale[LC_TIME], saved_locale); + return; +} + +/* + * Parse the number given by the specification. + * Allow at most length digits. + */ +static +number(length) +int length; +{ + int val; + unsigned char c; + + val = 0; + if(!isdigit((unsigned char)*input)) + return -1; + while (length--) { + if(!isdigit(c = *input)) + return val; + val = 10*val + c - '0'; + input++; + } + return val; +} + +/* + * Search for format string in _time array + */ +static +search(start, end) +int start; +int end; +{ + int i, length; + for (i=start; i<=end; i++) { + length = strlen(_time[i]); + if(strncmp(_time[i], input, length) == 0) + { + input += strlen(_time[i]); + return i; + } + } + return(-1); +} + +/* + * Read the user specified template file by line + * until a match occurs. + * The DATEMSK environment variable points to the template file. + */ + +static char *sinput; /* start of input buffer */ + +static int +read_tmpl(line) +char *line; +{ + FILE *fp; + char *file; + char *bp, *start; + struct stat sb; + int ret=0, c; + + + if (((file = getenv("DATEMSK")) == 0) || file[0] == '\0') + { + getdate_err = 1; + return(0); + } + if ((start = (char *)malloc(512)) == NULL) + { + getdate_err = 6; + return(0); + } + if ((fp = fopen(file, "r")) == NULL) + { + getdate_err = 2; + free(start); + return(0); + } + if (stat(file, &sb) < 0) + { + getdate_err = 3; + goto end; + } + if ((sb.st_mode & S_IFMT) != S_IFREG) + { + getdate_err = 4; + goto end; + } + if((sinput = malloc(strlen(line)+1)) == (char *)0) { + getdate_err = 6; + goto end; + } + input = sinput; + strcpy(sinput, line); + while(c = (unsigned char)*input) + *input++ = tolower(c); + input = sinput; + for(;;) { + bp = start; + if (!fgets(bp, 512, fp)) { + if (!feof(fp)) + { + getdate_err = 5; + ret = 0; + break; + } + getdate_err = 7; + ret = 0; + break; + } + if (*(bp+strlen(bp)-1) != '\n') { /* terminating newline? */ + getdate_err = 5; + ret = 0; + break; + } + *(bp + strlen(bp) - 1) = '\0'; +#ifdef DEBUG +printf("line number \"%2d\"---> %s\n", linenum, bp); +#endif + if (strlen(bp)) /* anything left? */ + if (ret = parse_fmt(bp, 0)) + break; + linenum++; + input = sinput; + } +end: + (void) free(start); + (void) fclose(fp); + return ret; +} + + +/* + * Match lines in the template with input specification. + */ +static int +parse_fmt(bp, flag) + char *bp; + int flag; +{ + char *fmt; + int ret; + unsigned char c, d; + if(!flag) + getnow(); + fmt = bp; + while ((c = *fmt++) != '\0') { + if ( c == '%' ) { + c = *fmt++; + if(c != 't' && + c != 'c' && c != 'x' && c != 'X') + while(isspace(d = *input)) + input++; + switch (c) { + case 'a': + if((ret = search(aSun, aSat)) < 0) + return(0); + ret = ret - (int) aSun + 1; + if (t.tm_wday && t.tm_wday != ret) + { + wrong_input++; + return(0); + } + t.tm_wday = ret; + continue; + case 'w': + + if((ret = number(1)) < 0 || ret > 6) + return(0); + if (t.tm_wday && t.tm_wday != ret + 1) + { + wrong_input++; + return(0); + } + t.tm_wday = ret + 1; + continue; + + case 'd': + case 'e': + if ((ret = number(2)) < 1 || ret > 31) + return(0); + if (t.tm_mday && t.tm_mday != ret) + { + wrong_input++; + return(0); + } + t.tm_mday = ret; + continue; + + case 'A': + if ((ret = search(Sun, Sat)) < 0) + return(0); + ret = ret - (int) Sun + 1; + if (t.tm_wday && t.tm_wday != ret) + { + wrong_input++; + return(0); + } + t.tm_wday = ret; + continue; + + case 'h': + case 'b': + if ((ret = search(aJan, aDec)) < 0) + return(0); + ret = ret - (int) aJan + 1; + if (t.tm_mon && t.tm_mon != ret) + { + wrong_input++; + return(0); + } + t.tm_mon = ret; + continue; + case 'B': + if ((ret = search(Jan, Dec)) < 0) + return(0); + ret = ret - (int) Jan + 1; + if (t.tm_mon && t.tm_mon != ret) + { + wrong_input++; + return(0); + } + t.tm_mon = ret; + continue; + case 'Y': + /* The last time UNIX can handle is 1/18/2038; + for simplicity stop at 2038 */ + if ((ret = number(4)) < 1970 || ret > 2037) + return(0); + else + ret = ret - 1900; + if (t.tm_year && t.tm_year != ret) + { + wrong_input++; + return(0); + } + t.tm_year = ret; + continue; + + case 'y': + ret = number(2); + if ((ct->tm_year < 100 && ret >= 70 && ret < 100) || (ct->tm_year >=100 && ret < 38)) + ret = ct->tm_year>=100?100+ret:ret; + else + return(0); + if (t.tm_year && t.tm_year != ret) + { + wrong_input++; + return(0); + } + t.tm_year = ret; + continue; + case 'm': + if ((ret = number(2)) <= 0 || ret > 12) + return(0); + if (t.tm_mon && t.tm_mon != ret) + { + wrong_input++; + return(0); + } + t.tm_mon = ret; + continue; + case 'I': + if ((ret = number(2)) < 1 || ret > 12) + return(0); + if (t.tm_hour && t.tm_hour != ret) + { + wrong_input++; + return(0); + } + t.tm_hour = ret; + continue; + case 'p': + if ((ret = search(AM, PM)) < 0) + return(0); + if (meridian && meridian != ret) + { + wrong_input++; + return(0); + } + meridian = ret; + continue; + case 'H': + if ((ret = number(2)) >= 0 && ret <= 23) + ret = ret + 1; + else + return(0); + if (hour && hour != ret) + { + wrong_input++; + return(0); + } + hour = ret; + continue; + case 'M': + if ((ret = number(2)) >= 0 && ret <= 59) + ret = ret + 1; + else + return(0); + if (t.tm_min && t.tm_min != ret) + { + wrong_input++; + return(0); + } + t.tm_min = ret; + continue; + case 'S': + if ((ret = number(2)) >= 0 && ret <= 59) + ret = ret + 1; + else + return(0); + if (t.tm_sec && t.tm_sec != ret) + { + wrong_input++; + return(0); + } + t.tm_sec = ret; + continue; + + case 'Z': + if(!mytzname[0][0]) + continue; + if(strncmp(&mytzname[0][0], input, strlen(&mytzname[0][0])) == 0) { + input += strlen(&mytzname[0][0]); + if(t.tm_isdst == 2) { + wrong_input++; + return 0; + } + t.tm_isdst = 1; + continue; + } + if(strncmp(&mytzname[1][0], input, strlen(&mytzname[1][0])) == 0) { + input += strlen(&mytzname[1][0]); + if(t.tm_isdst == 1) { + wrong_input++; + return 0; + } + t.tm_isdst = 2; + continue; + } + return 0; + + case 't': + if(*input++ != '\t') + return 0; + continue; + + case 'n': + if(*input++ != '\n') + return 0; + continue; + + /* composite formats */ + + case 'c': + if(parse_fmt(_time[DFL_FMT], 1)) + continue; + return 0; + + case 'x': + if(parse_fmt(_time[Local_date], 1)) + continue; + return 0; + + case 'X': + if(parse_fmt(_time[Local_time], 1)) + continue; + return 0; + + case 'D': + if(parse_fmt("%m/%d/%y", 1)) + continue; + return 0; + + case 'r': + if(parse_fmt("%I:%M:%S %p", 1)) + continue; + return 0; + + case 'R': + if(parse_fmt("%H:%M", 1)) + continue; + return 0; + + case 'T': + if(parse_fmt("%H:%M:%S", 1)) + continue; + return 0; + + case '%': + if(*input++ != '%') + return 0; + continue; + + default: + wrong_input++; + return(0); + } + } + else { + if(!isspace(c)) + while(isspace(d = *input)) + input++; + d = *input++; + if(d != c && !isspace(c)) + return 0; + if(isspace(c) && d != c) { + input--; + continue; + } + if(!d) { + input--; + break; + } + } + } + if(flag) + return 1; + while(isspace(d = *input)) + input++; + if (*input) + return(0); + if (verify()) + return(1); + return(0); +} + +static void +getnow() /* get current date */ +{ + time_t now; + + now = time((time_t *)NULL); + ct = localtime(&now); + ct->tm_yday += 1; + t.tm_year = t.tm_mon = t.tm_mday = t.tm_wday = t.tm_hour = t.tm_min = t.tm_sec = t.tm_isdst = hour = meridian = 0; +} + +/* + * Check validity of input + */ +static int +verify() +{ + int min = 0; + int sec = 0; + int hr = 0; + + if (t.tm_year) + year(t.tm_year); + if (t.tm_mon) + MON(t.tm_mon - 1); + if (t.tm_mday) + Day(t.tm_mday); + if (t.tm_wday) + DOW(t.tm_wday - 1); + if ( ((t.tm_mday)&&((t.tm_mday != ct->tm_mday)||(t.tm_mday > dpm[ct->tm_mon]))) + || + ((t.tm_wday)&&((t.tm_wday-1)!=ct->tm_wday)) + || + ((t.tm_hour&&hour)||(t.tm_hour&&!meridian)|| + (!t.tm_hour&&meridian)||(hour&&meridian)) ) + { + wrong_input++; + return(0); + } + if (t.tm_hour) + { + switch (meridian) + { + case PM: + t.tm_hour %= 12; + t.tm_hour += 12; + break; + case AM: + t.tm_hour %= 12; + if ( ! t.tm_hour ) + hr++; + break; + default: + return(0); + } + } + if (hour) + t.tm_hour = hour - 1; + if (t.tm_min) + { + min++; + t.tm_min -= 1; + } + if (t.tm_sec) + { + sec++; + t.tm_sec -= 1; + } + if ( (! t.tm_year && ! t.tm_mon && ! t.tm_mday && ! t.tm_wday) && ( (t.tm_hour < ct->tm_hour) || ((t.tm_hour == ct->tm_hour) && (t.tm_min < ct->tm_min)) || ((t.tm_hour == ct->tm_hour) && (t.tm_min == ct->tm_min) && (t.tm_sec < ct->tm_sec)) ) ) + t.tm_hour += 24; + if (t.tm_hour || hour || hr || min || sec) + { + ct->tm_hour = t.tm_hour; + ct->tm_min = t.tm_min; + ct->tm_sec = t.tm_sec; + } + if(t.tm_isdst) + ct->tm_isdst = t.tm_isdst - 1; + return(1); +} + + +static void +Day(day) +int day; +{ + if (day < ct->tm_mday) + if( ++ct->tm_mon == 12 ) ++ct->tm_year; + ct->tm_mday = day; + DMY(); +} + + +static void +DMY() +{ + int i, doy; + setcal(ct->tm_year); + for( i=doy=0; itm_mon; i++ ) doy += dpm[i]; + ct->tm_yday = doy + ct->tm_mday; + ct->tm_wday = (jan1(ct->tm_year) + ct->tm_yday - 1) % 7; +} + +static void +setcal(Year) +int Year; +{ + switch( days(Year) ) { + case 365: dpm[1]=28; break; + case 366: dpm[1]=29; break; + } +} + +static int +days(y) +int y; +{ + y += 1900; + return( y%4==0 && y%100!=0 || y%400==0 ? 366 : 365 ); +} + + +/* + * return day of the week + * of jan 1 of given year + */ + +static int +jan1(yr) +{ + register y, d; + +/* + * normal gregorian calendar + * one extra day per four years + */ + + y = yr + 1900; + d = 4+y+(y+3)/4; + +/* + * julian calendar + * regular gregorian + * less three days per 400 + */ + + if(y > 1800) { + d -= (y-1701)/100; + d += (y-1601)/400; + } + +/* + * great calendar changeover instant + */ + + if(y > 1752) + d += 3; + + return(d%7); +} + +static void +year(yr) +int yr; +{ + ct->tm_mon = 0; + ct->tm_mday = 1; + ct->tm_year = yr; + DMY(); +} + +static void +MON(month) +int month; +{ + ct->tm_mday = 1; + Month(month); +} + +static void +Month(month) +int month; +{ + if( month < ct->tm_mon ) ct->tm_year++; + ct->tm_mon = month; + DMY(); +} + +static void +DOW(dow) +int dow; +{ + adddays((dow+7-ct->tm_wday)%7); +} + +static void +adddays(n) +int n; +{ + DOY(ct->tm_yday+n); +} + +static void +DOY(doy) +int doy; +{ + int i; + + if ( doy>days(ct->tm_year) ) { + doy -= days(ct->tm_year); + ct->tm_year++; + } + ct->tm_yday = doy; + setcal(ct->tm_year); + for (i=0; doy>dpm[i]; i++) + doy -= dpm[i]; + ct->tm_mday = doy; + ct->tm_mon = i; + ct->tm_wday = (jan1(ct->tm_year)+ct->tm_yday-1) % 7; +} + +/* + * return time from time structure + */ +static struct tm +*calc_date() +{ + long tv; + tv = mktime(ct); + return localtime(&tv); +} diff --git a/usr/src/lib/libgen/libgen.h b/usr/src/lib/libgen/libgen.h index aed02d5..5e1e2ad 100644 --- a/usr/src/lib/libgen/libgen.h +++ b/usr/src/lib/libgen/libgen.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libgen:libgen.h 2.4.2.5CHANGED" +#ident "@(#)libgen:libgen.h 2.4.2.5" /* declarations of functions found in libgen */ @@ -57,7 +57,7 @@ extern int eaccess(); #include extern struct tm * getdate(const char *); #else -extern struct tm *getdate(); +extern int getdate(); #endif extern int getdate_err; diff --git a/usr/src/lib/libgen/libgen.mk b/usr/src/lib/libgen/libgen.mk index b5e0d10..9c616ec 100644 --- a/usr/src/lib/libgen/libgen.mk +++ b/usr/src/lib/libgen/libgen.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libgen:libgen.mk 1.3.10.1" +#ident "@(#)libgen:libgen.mk 1.3.8.2" # Makefile for libgen @@ -30,7 +30,7 @@ STRIP = strip SIZE = size #top# -# Generated by makefile 1.3.10.1 +# Generated by makefile 1.3.8.2 MAKEFILE = libgen.mk @@ -38,12 +38,12 @@ MAKEFILE = libgen.mk LIBRARY = libgen.a OBJECTS = basename.o bgets.o bufsplit.o copylist.o dirname.o eaccess.o \ - gmatch.o isencrypt.o mkdirp.o p2open.o pathfind.o \ + getdate.o gmatch.o isencrypt.o mkdirp.o p2open.o pathfind.o \ reg_compile.o reg_step.o regcmp.o regex.o rmdirp.o strccpy.o \ strecpy.o strfind.o strrspn.o strtrns.o SOURCES = basename.c bgets.c bufsplit.c copylist.c dirname.c eaccess.c \ - gmatch.c isencrypt.c mkdirp.c p2open.c pathfind.c \ + getdate.c gmatch.c isencrypt.c mkdirp.c p2open.c pathfind.c \ reg_compile.c reg_step.c regcmp.c regex.c rmdirp.c strccpy.c \ strecpy.c strfind.c strrspn.c strtrns.c @@ -56,7 +56,7 @@ $(LIBRARY): $(LIBRARY)(strtrns.o) $(LIBRARY)(strrspn.o) \ $(LIBRARY)(reg_step.o) $(LIBRARY)(reg_compile.o) \ $(LIBRARY)(pathfind.o) $(LIBRARY)(p2open.o) \ $(LIBRARY)(mkdirp.o) $(LIBRARY)(isencrypt.o) \ - $(LIBRARY)(gmatch.o\ + $(LIBRARY)(gmatch.o) $(LIBRARY)(getdate.o) \ $(LIBRARY)(eaccess.o) $(LIBRARY)(dirname.o) \ $(LIBRARY)(copylist.o) $(LIBRARY)(bufsplit.o) \ $(LIBRARY)(bgets.o) $(LIBRARY)(basename.o) @@ -89,6 +89,14 @@ $(LIBRARY)(eaccess.o) eaccess.o: $(INC)/errno.h \ $(INC)/time.h libgen.h synonyms.h +$(LIBRARY)(getdate.o) getdate.o: $(INC)/ctype.h \ + $(INC)/fcntl.h $(INC)/locale.h \ + $(INC)/stdio.h $(INC)/stdlib.h \ + $(INC)/string.h $(INC)/sys/fcntl.h \ + $(INC)/sys/stat.h $(INC)/sys/types.h \ + $(INC)/time.h synonyms.h + + $(LIBRARY)(gmatch.o) gmatch.o: $(INC)/ctype.h \ $(INC)/limits.h $(INC)/stdlib.h _wchar.h \ _range.h synonyms.h diff --git a/usr/src/lib/libgen/mklib-dot-h b/usr/src/lib/libgen/mklib-dot-h index 14eb85e..46e1bfc 100644 --- a/usr/src/lib/libgen/mklib-dot-h +++ b/usr/src/lib/libgen/mklib-dot-h @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)libgen:mklib-dot-h 1.1" # Create an include file that declares all the functions contained # in a lint-library file. diff --git a/usr/src/lib/libgen/p2open.c b/usr/src/lib/libgen/p2open.c index b46cae9..93c8018 100644 --- a/usr/src/lib/libgen/p2open.c +++ b/usr/src/lib/libgen/p2open.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libgen:p2open.c 1.5.8.1" +#ident "@(#)libgen:p2open.c 1.5.6.3" #ifdef __STDC__ #pragma weak p2open = _p2open @@ -22,6 +22,8 @@ #include #include #include +#include +#undef uname extern FILE *fdopen(); extern int close(), @@ -72,6 +74,7 @@ FILE *fp[2]; /* file pointer array to cmd stdin and stdout */ return 0; } +static int vers; int p2close(fp) FILE *fp[2]; @@ -82,6 +85,7 @@ FILE *fp[2]; (*istat)(), (*qstat)(); pid_t pid, r; + struct utsname uname_buf; pid = popen_pid[fileno(fp[0])]; if(pid != popen_pid[fileno(fp[1])]) return -1; @@ -92,8 +96,19 @@ FILE *fp[2]; istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); hstat = signal(SIGHUP, SIG_IGN); - while ((r = waitpid(pid, &status, 0)) == (pid_t)-1 - && errno == EINTR) + if(vers == 0) { + if (uname(&uname_buf) > 0) + vers = 2; /* SVR4 system */ + else + vers = 1; + } + if (vers == 2) + while ((r = wait(&status)) != pid && r != (pid_t)-1 + || errno == EINTR) + ; + else + while ((r = waitpid(pid, &status, 0)) == (pid_t)-1 + && errno == EINTR) ; if (r == (pid_t)-1) status = -1; diff --git a/usr/src/lib/libgen/reg_compile.c b/usr/src/lib/libgen/reg_compile.c index 1248707..6556da0 100644 --- a/usr/src/lib/libgen/reg_compile.c +++ b/usr/src/lib/libgen/reg_compile.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libgen:reg_compile.c 1.2.7.3" +#ident "@(#)libgen:reg_compile.c 1.2.7.2" #ifdef __STDC__ #pragma weak nbra = _nbra @@ -36,7 +36,7 @@ int nbra = 0, regerrno = 0, reglength = 0; -static unsigned char _bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; +static char _bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; char *_compile(); char *strchr(); diff --git a/usr/src/lib/libgen/reg_step.c b/usr/src/lib/libgen/reg_step.c index e8b7e66..5165fa7 100644 --- a/usr/src/lib/libgen/reg_step.c +++ b/usr/src/lib/libgen/reg_step.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libgen:reg_step.c 1.1.7.3" +#ident "@(#)libgen:reg_step.c 1.1.7.2" #ifdef __STDC__ #pragma weak loc1 = _loc1 @@ -30,7 +30,7 @@ char *loc1 = (char *)0, *loc2 = (char *)0, *locs = (char *)0; char *braslist[NBRA] = { (char *)0}; char *braelist[NBRA] = { (char *)0}; -static unsigned char _bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; +static char _bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; static void getrnge(); static int cclass(); int strncmp(); diff --git a/usr/src/lib/libgenIO/g_init.c b/usr/src/lib/libgenIO/g_init.c index 1fe3b3b..2943902 100644 --- a/usr/src/lib/libgenIO/g_init.c +++ b/usr/src/lib/libgenIO/g_init.c @@ -5,13 +5,13 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libgenIO:g_init.c 1.4" +#ident "@(#)libgenIO:g_init.c 1.3" #include #include #include #include -#include +#include #include #include #include @@ -54,23 +54,19 @@ int *devtype, *fdes; struct s3bconf *buffer; struct s3bc *table; struct stat st_buf; - struct statvfs stfs_buf; + struct statfs stfs_buf; *devtype = G_NO_DEV; bufsize = -1; if (fstat(*fdes, &st_buf) == -1) return(-1); if (!(st_buf.st_mode & S_IFCHR) && !(st_buf.st_mode & S_IFBLK)) { - if (st_buf.st_mode & S_IFIFO) { - bufsize = 512; - } else { - *devtype = G_FILE; /* find block size for this file system */ - if (fstatvfs(*fdes, &stfs_buf) < 0) { - bufsize = -1; - errno = ENODEV; - } else - bufsize = stfs_buf.f_bsize; - } + *devtype = G_FILE; /* find block size for this file system */ + if (fstatfs(*fdes, &stfs_buf, sizeof(struct statfs), 0) < 0) { + bufsize = -1; + errno = ENODEV; + } else + bufsize = stfs_buf.f_bsize; return(bufsize); /* We'll have to add a remote attribute to stat but this diff --git a/usr/src/lib/libl/lib/ncform b/usr/src/lib/libl/lib/ncform index 2d294e5..316f2a4 100644 --- a/usr/src/lib/libl/lib/ncform +++ b/usr/src/lib/libl/lib/ncform @@ -1,9 +1,3 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - #ident "@(#)libl:lib/ncform 1.7" int yylineno =1; # define YYU(x) x diff --git a/usr/src/lib/libl/lib/nrform b/usr/src/lib/libl/lib/nrform index 4c64fc3..750e6d8 100644 --- a/usr/src/lib/libl/lib/nrform +++ b/usr/src/lib/libl/lib/nrform @@ -1,9 +1,3 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - #ident "@(#)libl:lib/nrform 1.3" block data integer cshift, csize, yynlin diff --git a/usr/src/lib/libm/m32_sfm/atanf.m b/usr/src/lib/libm/m32_sfm/atanf.m index eb4ab34..361a83d 100644 --- a/usr/src/lib/libm/m32_sfm/atanf.m +++ b/usr/src/lib/libm/m32_sfm/atanf.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32_sfm/atanf.m 1.3" .file "atanf.c" .data diff --git a/usr/src/lib/libm/m32_sfm/cosf.m b/usr/src/lib/libm/m32_sfm/cosf.m index 604af12..2244895 100644 --- a/usr/src/lib/libm/m32_sfm/cosf.m +++ b/usr/src/lib/libm/m32_sfm/cosf.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32_sfm/cosf.m 1.3" .file "cosf.c" .data diff --git a/usr/src/lib/libm/m32_sfm/expf.m b/usr/src/lib/libm/m32_sfm/expf.m index 24fbefb..3130611 100644 --- a/usr/src/lib/libm/m32_sfm/expf.m +++ b/usr/src/lib/libm/m32_sfm/expf.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "expf.s" .ident "@(#)libm:m32_sfm/expf.m 1.3" ################################################################ diff --git a/usr/src/lib/libm/m32_sfm/log10f.m b/usr/src/lib/libm/m32_sfm/log10f.m index d59ce04..0556f28 100644 --- a/usr/src/lib/libm/m32_sfm/log10f.m +++ b/usr/src/lib/libm/m32_sfm/log10f.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32_sfm/log10f.m 1.3" .file "log10f.c" .data diff --git a/usr/src/lib/libm/m32_sfm/logf.m b/usr/src/lib/libm/m32_sfm/logf.m index 00da540..8225e3f 100644 --- a/usr/src/lib/libm/m32_sfm/logf.m +++ b/usr/src/lib/libm/m32_sfm/logf.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32_sfm/logf.m 1.3" .file "logf.c" .data diff --git a/usr/src/lib/libm/m32_sfm/sinf.m b/usr/src/lib/libm/m32_sfm/sinf.m index 3c120d7..93a2522 100644 --- a/usr/src/lib/libm/m32_sfm/sinf.m +++ b/usr/src/lib/libm/m32_sfm/sinf.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32_sfm/sinf.m 1.3" .file "sinf.c" .data diff --git a/usr/src/lib/libm/m32_sfm/sqrtf.m b/usr/src/lib/libm/m32_sfm/sqrtf.m index f75c81f..35d06c7 100644 --- a/usr/src/lib/libm/m32_sfm/sqrtf.m +++ b/usr/src/lib/libm/m32_sfm/sqrtf.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32_sfm/sqrtf.m 1.3" .file "sqrtf.c" .text diff --git a/usr/src/lib/libm/m32_sfm/tanf.m b/usr/src/lib/libm/m32_sfm/tanf.m index 4fc4d1f..49cd7a3 100644 --- a/usr/src/lib/libm/m32_sfm/tanf.m +++ b/usr/src/lib/libm/m32_sfm/tanf.m @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32_sfm/tanf.m 1.3" .file "tanf.c" .data diff --git a/usr/src/lib/libm/m32mau/atan.s b/usr/src/lib/libm/m32mau/atan.s index 248b761..69cc11d 100644 --- a/usr/src/lib/libm/m32mau/atan.s +++ b/usr/src/lib/libm/m32mau/atan.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "atan.s" .ident "@(#)libm:m32mau/atan.s 1.6" ################################################################# diff --git a/usr/src/lib/libm/m32mau/atanf.s b/usr/src/lib/libm/m32mau/atanf.s index 80b61f4..0a14d8e 100644 --- a/usr/src/lib/libm/m32mau/atanf.s +++ b/usr/src/lib/libm/m32mau/atanf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "atanf.s" .ident "@(#)libm:m32mau/atanf.s 1.5" ################################################################# diff --git a/usr/src/lib/libm/m32mau/exp.s b/usr/src/lib/libm/m32mau/exp.s index 41575e0..8214562 100644 --- a/usr/src/lib/libm/m32mau/exp.s +++ b/usr/src/lib/libm/m32mau/exp.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "exp.s" .ident "@(#)libm:m32mau/exp.s 1.6" ##################################################################### diff --git a/usr/src/lib/libm/m32mau/expf.s b/usr/src/lib/libm/m32mau/expf.s index e2a4539..06a7412 100644 --- a/usr/src/lib/libm/m32mau/expf.s +++ b/usr/src/lib/libm/m32mau/expf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "expf.s" .ident "@(#)libm:m32mau/expf.s 1.5" ################################################################ diff --git a/usr/src/lib/libm/m32mau/log.s b/usr/src/lib/libm/m32mau/log.s index f18fe16..4581471 100644 --- a/usr/src/lib/libm/m32mau/log.s +++ b/usr/src/lib/libm/m32mau/log.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "log.s" .ident "@(#)libm:m32mau/log.s 1.7" ######################################################################## diff --git a/usr/src/lib/libm/m32mau/logf.s b/usr/src/lib/libm/m32mau/logf.s index 50240c3..4f01790 100644 --- a/usr/src/lib/libm/m32mau/logf.s +++ b/usr/src/lib/libm/m32mau/logf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "logf.s" .ident "@(#)libm:m32mau/logf.s 1.7" ############################################################ diff --git a/usr/src/lib/libm/m32mau/m4.def b/usr/src/lib/libm/m32mau/m4.def index 8f47150..c5f5fa3 100644 --- a/usr/src/lib/libm/m32mau/m4.def +++ b/usr/src/lib/libm/m32mau/m4.def @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32mau/m4.def 1.2" define(`_m4_define_', defn(`define'))dnl diff --git a/usr/src/lib/libm/m32mau/mcount.def b/usr/src/lib/libm/m32mau/mcount.def index 6481b34..b0a8706 100644 --- a/usr/src/lib/libm/m32mau/mcount.def +++ b/usr/src/lib/libm/m32mau/mcount.def @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)libm:m32mau/mcount.def 1.1" _m4_dnl_ diff --git a/usr/src/lib/libm/m32mau/reduce.s b/usr/src/lib/libm/m32mau/reduce.s index 4fcde95..ad5bd78 100644 --- a/usr/src/lib/libm/m32mau/reduce.s +++ b/usr/src/lib/libm/m32mau/reduce.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "reduce.s" .ident "@(#)libm:m32mau/reduce.s 1.2" ##################################################################### diff --git a/usr/src/lib/libm/m32mau/reducef.s b/usr/src/lib/libm/m32mau/reducef.s index 0af8c03..e1a4784 100644 --- a/usr/src/lib/libm/m32mau/reducef.s +++ b/usr/src/lib/libm/m32mau/reducef.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "reducef.s" .ident "@(#)libm:m32mau/reducef.s 1.2" ##################################################################### diff --git a/usr/src/lib/libm/m32mau/sin.s b/usr/src/lib/libm/m32mau/sin.s index 4fc3f3a..0effd3e 100644 --- a/usr/src/lib/libm/m32mau/sin.s +++ b/usr/src/lib/libm/m32mau/sin.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sin.s" .ident "@(#)libm:m32mau/sin.s 1.4" ################################################### diff --git a/usr/src/lib/libm/m32mau/sinf.s b/usr/src/lib/libm/m32mau/sinf.s index d482e6a..7a4a7e4 100644 --- a/usr/src/lib/libm/m32mau/sinf.s +++ b/usr/src/lib/libm/m32mau/sinf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sin.s" .ident "@(#)libm:m32mau/sinf.s 1.5" ################################################### diff --git a/usr/src/lib/libm/m32mau/sqrt.s b/usr/src/lib/libm/m32mau/sqrt.s index f18b240..52399a4 100644 --- a/usr/src/lib/libm/m32mau/sqrt.s +++ b/usr/src/lib/libm/m32mau/sqrt.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sqrt.s" .ident "@(#)libm:m32mau/sqrt.s 1.5" ############################################################################## diff --git a/usr/src/lib/libm/m32mau/sqrtf.s b/usr/src/lib/libm/m32mau/sqrtf.s index 0dca41e..94642c1 100644 --- a/usr/src/lib/libm/m32mau/sqrtf.s +++ b/usr/src/lib/libm/m32mau/sqrtf.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "sqrtf.s" .ident "@(#)libm:m32mau/sqrtf.s 1.5" ############################################################ diff --git a/usr/src/lib/libm/port/pow.c b/usr/src/lib/libm/port/pow.c index b6cdf9f..9365fa5 100644 --- a/usr/src/lib/libm/port/pow.c +++ b/usr/src/lib/libm/port/pow.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libm:port/pow.c 1.10" +#ident "@(#)libm:port/pow.c 1.9" /*LINTLIBRARY*/ /* */ @@ -105,8 +105,6 @@ double x, y; if (!x) { if (y > 0.0) return(x); /* (0 ** pos) == 0 */ - if ((y == 0.0) && (_lib_version != c_issue_4)) - return(1.0); return(pow_exc(x, y, DOM, 0)); } if (y == 0.0) @@ -326,11 +324,7 @@ register int etype, neg; exc.arg2 = y; exc.name = "pow"; switch(etype) { - case DOM: - if ((x == 0.0) && (_lib_version != c_issue_4)) - exc.retval = -HUGE_VAL; - else - exc.retval = 0.0; + case DOM: exc.retval = 0.0; exc.type = DOMAIN; break; case UNDER: exc.type = UNDERFLOW; diff --git a/usr/src/lib/libm/port/powf.c b/usr/src/lib/libm/port/powf.c index 5a54b98..659d168 100644 --- a/usr/src/lib/libm/port/powf.c +++ b/usr/src/lib/libm/port/powf.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libm:port/powf.c 1.7" +#ident "@(#)libm:port/powf.c 1.6" /*LINTLIBRARY*/ /* * Single precision power function. @@ -42,8 +42,6 @@ float powf(register float x, register float y) if (!x) { if (y > zero) return (x); /* (0 ** pos) == 0 */ - if ((y == (float)0.0) && (_lib_version != c_issue_4)) - return((float)1.0); goto domain; } neg = 0; @@ -96,10 +94,7 @@ float powf(register float x, register float y) domain: exc.type = DOMAIN; - if ((x == (float)0.0) && (_lib_version != c_issue_4)) - exc.retval = -HUGE_VAL; - else - exc.retval = 0.0; + exc.retval = 0.0; if (_lib_version == strict_ansi) errno = EDOM; else if (!matherr(&exc)) { diff --git a/usr/src/lib/libmalloc/__Ext_Synonyms b/usr/src/lib/libmalloc/__Ext_Synonyms new file mode 100644 index 0000000..654e979 --- /dev/null +++ b/usr/src/lib/libmalloc/__Ext_Synonyms @@ -0,0 +1,5 @@ +#ident "@(#)libmalloc:__Ext_Synonyms 1.1" + +cfree _cfree +mallopt _mallopt +mallinfo _mallinfo diff --git a/usr/src/lib/libmalloc/libmalloc.mk b/usr/src/lib/libmalloc/libmalloc.mk index e1554d9..4bd8008 100644 --- a/usr/src/lib/libmalloc/libmalloc.mk +++ b/usr/src/lib/libmalloc/libmalloc.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libmalloc:libmalloc.mk 1.21.1.2" +#ident "@(#)libmalloc:libmalloc.mk 1.21.1.1" # # makefile for libmalloc # @@ -40,7 +40,7 @@ noprof: $(OBJECTS) $(RM) -rf objects mkdir objects $(CP) $(OBJECTS) objects - cd objects; $(AR) $(ARFLAGS) libmalloc.a * + cd objects; $(AR) $(ARFLAGS) libmalloc.a ../__Ext_Synonyms * prof: $(POBJECTS) $(RM) -rf pobjects @@ -49,7 +49,7 @@ prof: $(POBJECTS) do\ $(CP) $$i pobjects/`basename $$i .p`.o;\ done - cd pobjects; $(AR) $(ARFLAGS) libmalloc.a * + cd pobjects; $(AR) $(ARFLAGS) libmalloc.a ../__Ext_Synonyms * malloc.o malloc.p: $(INC)/malloc.h mallint.h diff --git a/usr/src/lib/libmalloc/malloc.c b/usr/src/lib/libmalloc/malloc.c index c8bdccb..2645a6c 100644 --- a/usr/src/lib/libmalloc/malloc.c +++ b/usr/src/lib/libmalloc/malloc.c @@ -5,16 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libmalloc:malloc.c 1.12.2.2" +#ident "@(#)libmalloc:malloc.c 1.12.2.1" #ifdef __STDC__ #pragma weak mallopt = _mallopt #pragma weak mallinfo = _mallinfo #pragma weak cfree = _cfree - -#define VOID void -#else -#define VOID char #endif #include #include @@ -118,7 +114,7 @@ static int grain = ALIGNSZ; /* malloc(nbytes) - give a user nbytes to use */ -VOID * +void * malloc(nbytes) size_t nbytes; { @@ -425,7 +421,7 @@ size_t nbytes; void free(ptr) -VOID *ptr; +void *ptr; { register struct holdblk *holdblk; /* block holding blk */ register struct holdblk *oldhead; /* former head of the hold @@ -488,9 +484,9 @@ VOID *ptr; /* realloc(ptr,size) - give the user a block of size "size", with the contents pointed to by ptr. Free ptr. */ -VOID * +void * realloc(ptr,size) -VOID *ptr; /* block to change size of */ +void *ptr; /* block to change size of */ size_t size; /* size to change to */ { register struct header *blk; /* block ptr is contained in */ @@ -499,13 +495,7 @@ size_t size; /* size to change to */ register unsigned cpysize; /* amount to copy */ register struct header *next; /* block after blk */ - if (ptr == NULL) - return malloc(size); - - if (size == 0) { - free(ptr); - return NULL; - } + if(size == 0) return NULL; if (TESTSMAL(((struct lblk *)((char *)ptr - MINHEAD))->header.holder)) { /* we have a special small block which can't be expanded */ @@ -582,7 +572,7 @@ size_t size; /* size to change to */ */ -VOID * +void * calloc(num, size) register size_t num, size; { diff --git a/usr/src/lib/libmp/gcd.c b/usr/src/lib/libmp/gcd.c new file mode 100644 index 0000000..9018729 --- /dev/null +++ b/usr/src/lib/libmp/gcd.c @@ -0,0 +1,127 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:gcd.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)gcd.c 1.1 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.2 3/13/18 */ + +/* LINTLIBRARY */ + +#include + +gcd(a,b,c) + MINT *a,*b,*c; +{ + MINT x,y,z,w; + + x.len = y.len = z.len = w.len = 0; + _mp_move(a,&x); + _mp_move(b,&y); + while (y.len != 0) { + mdiv(&x,&y,&w,&z); + _mp_move(&y,&x); + _mp_move(&z,&y); + } + _mp_move(&x,c); + xfree(&x); + xfree(&y); + xfree(&z); + xfree(&w); +} + + + + +invert(x1, x0, c) + MINT *x1; + MINT *x0; + MINT *c; +{ + MINT u2, u3; + MINT v2, v3; + MINT zero; + MINT q, r; + MINT t; + MINT x0_prime; + static MINT *one = (MINT *)0; + + /* + * Minimize calls to allocators. Don't use pointers for local + * variables, for the one "initialized" multiple precision + * variable, do it just once. + */ + if (one == (MINT *)0) + one = itom((short)1); + + zero.len = q.len = r.len = t.len = 0; + + x0_prime.len = u2.len = u3.len = 0; + _mp_move(x0, &u3); + _mp_move(x0, &x0_prime); + + v2.len = v3.len = 0; + _mp_move(one, &v2); + _mp_move(x1, &v3); + + while (mcmp(&v3,&zero) != 0) { + /* invariant: x0*u1 + x1*u2 = u3 */ + /* invariant: x0*v1 + x2*v2 = v3 */ + /* invariant: x(n+1) = x(n-1) % x(n) */ + mdiv(&u3,&v3,&q,&r); + _mp_move(&v3,&u3); + _mp_move(&r,&v3); + + mult(&q,&v2,&t); + msub(&u2,&t,&t); + _mp_move(&v2,&u2); + _mp_move(&t,&v2); + } + /* now x0*u1 + x1*u2 == 1, therefore, (u2*x1) % x0 == 1 */ + _mp_move(&u2,c); + if (mcmp(c,&zero) < 0) { + madd(&x0_prime, c, c); + } + xfree(&zero); + xfree(&v2); + xfree(&v3); + xfree(&u2); + xfree(&u3); + xfree(&q); + xfree(&r); + xfree(&t); +} + + diff --git a/usr/src/lib/libmp/libmp.mk b/usr/src/lib/libmp/libmp.mk new file mode 100644 index 0000000..01d7bc3 --- /dev/null +++ b/usr/src/lib/libmp/libmp.mk @@ -0,0 +1,68 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)libmp:libmp.mk 1.2" + +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# PROPRIETARY NOTICE (Combined) +# +# This source code is unpublished proprietary information +# constituting, or derived under license from AT&T's UNIX(r) System V. +# In addition, portions of such source code were derived from Berkeley +# 4.3 BSD under license from the Regents of the University of +# California. +# +# +# +# Copyright Notice +# +# Notice of copyright on this source code product does not indicate +# publication. +# +# (c) 1986,1987,1988.1989 Sun Microsystems, Inc +# (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +# All rights reserved. +# +# +DESTDIR= +USRLIB = $(ROOT)/usr/lib +INC = $(ROOT)/usr/include +DESTINCLUDE = $(ROOT)/usr/include/rpc +LIBNAME = libmp.a +LINT = lint +INS = install +CFLAGS= -O -I$(INC) +LORDER = lorder +OBJS= pow.o gcd.o msqrt.o mdiv.o mout.o mult.o madd.o util.o +SRCS = $(OBJS:%.o=%.c) +HDRS= mp.h + + +all: $(USRLIB)/$(LIBNAME) + +$(USRLIB)/$(LIBNAME): $(OBJS) + rm -f $(LIBNAME); + $(AR) cr $(LIBNAME) $(OBJS) + +$(LIBNAME): $(OBJS) + $(AR) cr $(LIBNAME) `$(LORDER) $(OBJS) | tsort ` + +install: $(USRLIB)/$(LIBNAME) + $(INS) -m 755 -f $(USRLIB) $(LIBNAME) + +installhdrs: $(HDRS) + $(INS) -m 644 -f $(DESTINCLUDE) $(HDRS) + +lint: + $(LINT) $(CFLAGS) $(SRCS) + +clean: + rm -f $(OBJS) + +clobber:clean + rm -f $(LIBNAME) + diff --git a/usr/src/lib/libmp/madd.c b/usr/src/lib/libmp/madd.c new file mode 100644 index 0000000..bdfd917 --- /dev/null +++ b/usr/src/lib/libmp/madd.c @@ -0,0 +1,222 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:madd.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)madd.c 1.1 89/03/10 Copyr 1986 Sun Micro"; +#endif +#ifndef lint +/* from UCB 5.1 4/30/85 */ +#endif + +/* LINTLIBRARY */ + +#include + +m_add(a,b,c) + register struct mint *a,*b,*c; +{ + register int carry,i; + register int x; + register short *cval; + + cval = xalloc(a->len + 1,"m_add"); + carry = 0; + for (i = 0; i < b->len; i++) { + x = carry + a->val[i] + b->val[i]; + if ( x & 0100000) { + carry = 1; + cval[i] = x & 077777; + } else { + carry = 0; + cval[i] = x; + } + } + for (; i < a->len; i++) { + x = carry + a->val[i]; + if (x & 0100000) { + cval[i] = x & 077777; + } else { + carry = 0; + cval[i] = x; + } + } + if (carry == 1) { + cval[i] = 1; + c->len = i + 1; + } else { + c->len = a->len; + } + c->val = cval; + if (c->len == 0) { + free((char *) cval); + } +} + + + +madd(a,b,c) + register struct mint *a,*b,*c; +{ + + struct mint x,y; + int sign; + + x.len = y.len = 0; + _mp_move(a, &x); + _mp_move(b, &y); + xfree(c); + sign = 1; + if (x.len >= 0) { + if(y.len >= 0) { + if (x.len >= y.len) { + m_add(&x,&y,c); + } else { + m_add(&y,&x,c); + } + } else { + y.len = -y.len; + msub(&x,&y,c); + } + } else { + if (y.len <= 0) { + x.len = -x.len; + y.len = -y.len; + sign = -1; + madd(&x,&y,c); + } else { + x.len = -x.len; + msub(&y,&x,c); + } + } + c->len = sign * c->len; + xfree(&x); + xfree(&y); +} + + + +m_sub(a,b,c) + register struct mint *a,*b,*c; +{ + register int x,i; + register int borrow; + short one; + struct mint mone; + + one = 1; + mone.len = 1; + mone.val = &one; + c->val = xalloc(a->len,"m_sub"); + borrow = 0; + for (i = 0; i < b->len; i++) { + x = borrow + a->val[i] - b->val[i]; + if (x & 0100000) { + borrow = -1; + c->val[i] = x & 077777; + } else { + borrow = 0; + c->val[i] = x; + } + } + for(; i < a->len; i++) { + x = borrow + a->val[i]; + if (x & 0100000) { + c->val[i] = x & 077777; + } else { + borrow = 0; + c->val[i] = x; + } + } + if (borrow < 0) { + for (i = 0; i < a->len; i++) { + c->val[i] ^= 077777; + } + c->len = a->len; + madd(c,&mone,c); + } + for(i = a->len-1; i >= 0; --i) { + if (c->val[i] > 0) { + if (borrow == 0) { + c->len = i + 1; + } else { + c->len= -i - 1; + } + return; + } + } + free((char *) c->val); +} + + +msub(a,b,c) + register struct mint *a,*b,*c; +{ + struct mint x,y; + int sign; + + x.len = y.len = 0; + _mp_move(a, &x); + _mp_move(b, &y); + xfree(c); + sign = 1; + if (x.len >= 0) { + if (y.len >= 0) { + if (x.len >= y.len) { + m_sub(&x,&y,c); + } else { + sign = -1; + msub(&y,&x,c); + } + } else { + y.len = -y.len; + madd(&x,&y,c); + } + } else { + if (y.len <= 0) { + x.len = -x.len; + y.len = -y.len; + msub(&y,&x,c); + } else { + x.len = -x.len; + madd(&x,&y,c); + sign = -1; + } + } + c->len = sign * c->len; + xfree(&x); + xfree(&y); +} + + diff --git a/usr/src/lib/libmp/mdiv.c b/usr/src/lib/libmp/mdiv.c new file mode 100644 index 0000000..4306447 --- /dev/null +++ b/usr/src/lib/libmp/mdiv.c @@ -0,0 +1,249 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:mdiv.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)mdiv.c 1.2 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.1 4/30/85 */ + +/* LINTLIBRARY */ + +#include +#include + +mdiv(a, b, q, r) + MINT *a, *b, *q, *r; +{ + MINT x, y; + int sign; + + sign = 1; + x.len = y.len = 0; + _mp_move(a, &x); + _mp_move(b, &y); + if (x.len < 0) { + sign = -1; + x.len = -x.len; + } + if (y.len < 0) { + sign = -sign; + y.len = -y.len; + } + xfree(q); + xfree(r); + m_div(&x, &y, q, r); + if (sign == -1) { + q->len = -q->len; + r->len = -r->len; + } + xfree(&x); + xfree(&y); +} + + +m_dsb (qx, n, a, b) + register short qx; + int n; + short *a, *b; +{ + register long borrow; + register long s3b2shit; + register int j; + register short fifteen = 15; + register short *aptr, *bptr; +#ifdef DEBUGDSB + printf("m_dsb %d %d %d %d\n",qx,n,*a,*b); +#endif + + borrow = 0; + aptr = a; + bptr = b; + for (j = n; j > 0; j--) { +#ifdef DEBUGDSB + printf("1 borrow=%x %d %d %d\n",borrow, (*aptr *qx),*bptr, *aptr); +#endif + borrow -= (*aptr++) * qx - *bptr; +#ifdef DEBUGDSB + printf("2 borrow=%x %d %d %d\n",borrow, (*aptr *qx),*bptr, *aptr); +#endif + *bptr++ = borrow & 077777; +#ifdef DEBUGDSB + printf("3 borrow=%x %d %d %d\n",borrow, (*aptr *qx),*bptr, *aptr); +#endif + if (borrow>=0) borrow >>= fifteen; /*3b2*/ + else borrow= 0xfffe0000 | (borrow >>fifteen); +#ifdef DEBUGDSB + printf("4 borrow=%x %d %d %d\n",borrow, (*aptr *qx),*bptr, *aptr); +#endif + } + borrow += *bptr; + *bptr = borrow & 077777; + if (borrow>=0) s3b2shit= borrow >> fifteen; /*3b2*/ + else s3b2shit= 0xfffe0000 | (borrow >>fifteen); + if (s3b2shit == 0) { +#ifdef DEBUGDSB + printf("mdsb 0\n"); +#endif + return(0); + } + borrow = 0; + aptr = a; + bptr = b; + for (j = n; j > 0; j--) { + borrow += *aptr++ + *bptr; + *bptr++ = borrow & 077777; + if (borrow>=0) borrow >>= fifteen; /*3b2*/ + else borrow= 0xfffe0000 | (borrow >>fifteen); + } +#ifdef DEBUGDSB + printf("mdsb 1\n"); +#endif + return(1); +} + + + +m_trq (v1, v2, u1, u2, u3) + register short v1; + register short v2; + short u1; + short u2; + short u3; +{ + register short d; + register long x1; + register long c1; + + c1 = u1 * 0100000 + u2; + if (u1 == v1) { + d = 077777; + } else { + d = c1 / v1; + } + do { + x1 = c1 - v1 * d; + x1 = x1 * 0100000 + u3 - v2 * d; + --d; + } while (x1 < 0); +#ifdef DEBUGMTRQ + printf ("mtrq %d %d %d %d %d %d\n",v1, v2, u1, u2, u3, (d+1)) ; +#endif + return(d + 1); +} + + +m_div (a, b, q, r) + MINT *a, *b, *q, *r; +{ + MINT u, v, x, w; + short d; + register short *qval; + register short *uval; + register int j; + register int qq; + register int n; + register int v1; + register int v2; + + u.len = v.len = x.len = w.len = 0; + if (b->len == 0) { + _mp_fatal("mdiv divide by zero"); + return; + } + if (b->len == 1) { + r->val = xalloc(1, "m_div1"); + sdiv (a, b->val[0], q, r->val); + if (r->val[0] == 0) { + free ((char *) r->val); + r->len = 0; + } else { + r->len = 1; + } + return; + } + if (a -> len < b -> len) { + q->len = 0; + r->len = a->len; + r->val = xalloc(r->len, "m_div2"); + for (qq = 0; qq < r->len; qq++) { + r->val[qq] = a->val[qq]; + } + return; + } + x.len = 1; + x.val = &d; + n = b->len; + d = 0100000L / (b->val[n - 1] + 1L); + mult(a, &x, &u); /* subtle: relies on mult allocing extra space */ + mult(b, &x, &v); +#ifdef DEBUG_MDIV + printf(" u=%s\n",mtox(&u)); + printf(" v=%s\n",mtox(&v)); +#endif + v1 = v.val[n - 1]; + v2 = v.val[n - 2]; + qval = xalloc(a -> len - n + 1, "m_div3"); + uval = u.val; + for (j = a->len - n; j >= 0; j--) { + qq = m_trq(v1, v2, uval[j + n], uval[j + n - 1], uval[j + n - 2]); + if (m_dsb(qq, n, v.val, uval + j)) + qq -= 1; + qval[j] = qq; + } + x.len = n; + x.val = u.val; + _mp_mcan(&x); +#ifdef DEBUG_MDIV + printf(" x=%s\n",mtox(&x)); + printf(" d(in)=%d\n",(d)); +#endif + sdiv(&x, d, &w, &d); +#ifdef DEBUG_MDIV + printf(" w=%s\n",mtox(&w)); + printf(" d(out)=%d\n",(d)); +#endif + r->len = w.len; + r->val = w.val; + q->val = qval; + qq = a->len - n + 1; + if (qq > 0 && qval[qq - 1] == 0) + qq -= 1; + q->len = qq; + if (qq == 0) + free ((char *) qval); + if (x.len != 0) + xfree (&u); + xfree (&v); +} diff --git a/usr/src/lib/libmp/mout.c b/usr/src/lib/libmp/mout.c new file mode 100644 index 0000000..92fcdf5 --- /dev/null +++ b/usr/src/lib/libmp/mout.c @@ -0,0 +1,210 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:mout.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)mout.c 1.1 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.2 3/13/86 */ + +/* LINTLIBRARY */ + +#include +#include + +static +m_in(a,b,f) + MINT *a; FILE *f; +{ + MINT x, y, ten; + int sign, c; + short qten, qy; + + xfree(a); + sign=1; + ten.len=1; + ten.val= &qten; + qten=b; + x.len=0; + y.len=1; + y.val= &qy; + while ((c = getc(f)) != EOF) + switch (c) { + + case '\\': + (void)getc(f); + continue; + case '\t': + case '\n': + a->len *= sign; + xfree(&x); + return(0); + case ' ': + continue; + case '-': + sign = -sign; + continue; + default: + if(c>='0' && c<= '9') { + qy=c-'0'; + mult(&x,&ten,a); + madd(a,&y,a); + _mp_move(a,&x); + continue; + } else { + (void) ungetc(c,stdin); + a->len *= sign; + return(0); + } + } + return(EOF); +} + +static +m_out(a,b,f) MINT *a; FILE *f; +{ int sign,xlen,i; + short r; + MINT x; + + char *obuf, *malloc(); + register char *bp; + + if (a == NULL) + return; + sign=1; + xlen=a->len; + if(xlen<0) + { xlen= -xlen; + sign= -1; + } + if(xlen==0) { + (void) fprintf(f,"0\n"); + return; + } + x.len=xlen; + x.val=xalloc(xlen,"m_out"); + for(i=0;ival[i]; + obuf=(char *)malloc(7*(unsigned)xlen); + bp=obuf+7*xlen-1; + *bp--=0; + while(x.len>0) + { for(i=0;i<10&&x.len>0;i++) + { sdiv(&x,(short)b,&x,&r); + *bp--=r+'0'; + } + if(x.len>0) *bp--=' '; + } + if(sign==-1) *bp--='-'; + (void) fprintf(f,"%s\n",bp+1); + free(obuf); + xfree(&x); +} + + +static s_div(); + +sdiv(a,n,q,r) MINT *a,*q; short n; short *r; +{ MINT x,y; + int sign; + sign=1; + x.len=a->len; + x.val=a->val; + if(n<0) + { sign= -sign; + n= -n; + } + if(x.len<0) + { sign = -sign; + x.len= -x.len; + } + s_div(&x,n,&y,r); + xfree(q); + q->val=y.val; + q->len=sign*y.len; + *r = *r*sign; + return; +} + +static +s_div(a,n,q,r) MINT *a,*q; short n; short *r; +{ int qlen; + register int i; + register long int x; + register short *qval; + register short *aval; + + x=0; + qlen=a->len; + q->val = xalloc(qlen,"s_div"); + aval = a->val + qlen; + qval = q->val + qlen; + for(i = qlen - 1; i >= 0 ;i--) { + x = x * 0100000 + *--aval; + *--qval = x / n; + x = x % n; + } + *r=x; + if(qlen && q->val[qlen-1]==0) qlen--; + q->len=qlen; + if(qlen==0) free((char *) q->val); +} + +min(a) MINT *a; +{ + return(m_in(a,10,stdin)); +} + +omin(a) MINT *a; +{ + return(m_in(a,8,stdin)); +} + +mout(a) MINT *a; +{ + m_out(a,10,stdout); +} + +omout(a) MINT *a; +{ + m_out(a,8,stdout); +} + +fmout(a,f) MINT *a; FILE *f; +{ m_out(a,10,f); +} + +fmin(a,f) MINT *a; FILE *f; +{ + return(m_in(a,10,f)); +} diff --git a/usr/src/lib/libmp/msqrt.c b/usr/src/lib/libmp/msqrt.c new file mode 100644 index 0000000..3653c44 --- /dev/null +++ b/usr/src/lib/libmp/msqrt.c @@ -0,0 +1,89 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:msqrt.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)msqrt.c 1.1 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.1 4/30/85 */ + +/* LINTLIBRARY */ + +#include +msqrt(a, b, r) + MINT *a, *b, *r; +{ + MINT a0, x, junk, y; + int j; + + a0.len = x.len = junk.len = y.len = 0; + if (a->len < 0) + _mp_fatal("msqrt: neg arg"); + if (a->len == 0) { + b->len = 0; + r->len = 0; + return (0); + } + if (a->len % 2 == 1) + x.len = (1 + a->len) / 2; + else + x.len = 1 + a->len / 2; + x.val = xalloc(x.len, "msqrt"); + for (j = 0; j < x.len; x.val[j++] = 0); + if (a->len % 2 == 1) + x.val[x.len - 1] = 0400; + else + x.val[x.len - 1] = 1; + _mp_move(a, &a0); + xfree(b); + xfree(r); +loop: + mdiv(&a0, &x, &y, &junk); + xfree(&junk); + madd(&x, &y, &y); + sdiv(&y, 2, &y, (short *) &j); + if (mcmp(&x, &y) > 0) { + xfree(&x); + _mp_move(&y, &x); + xfree(&y); + goto loop; + } + xfree(&y); + _mp_move(&x, b); + mult(&x, &x, &x); + msub(&a0, &x, r); + xfree(&x); + xfree(&a0); + return (r->len); +} diff --git a/usr/src/lib/libmp/mult.c b/usr/src/lib/libmp/mult.c new file mode 100644 index 0000000..ac8869a --- /dev/null +++ b/usr/src/lib/libmp/mult.c @@ -0,0 +1,147 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:mult.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)mult.c 1.2 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.1 4/30/85 */ + +/* LINTLIBRARY */ + +#include + +mult(a,b,c) + register struct mint *a,*b,*c; +{ + struct mint x,y; + int sign; + + _mp_mcan(a); + _mp_mcan(b); + if (a->len == 0 || b->len == 0) { + xfree(c); + return; + } + sign = 1; + x.len = y.len = 0; + _mp_move(a, &x); + _mp_move(b, &y); + if (a->len < 0) { + x.len = -x.len; + sign = -sign; + } + if (b->len < 0) { + y.len = -y.len; + sign = -sign; + } + xfree(c); + if (x.len < y.len) { + m_mult(&x,&y,c); + } else { + m_mult(&y,&x,c); + } + if (sign < 0) + c->len = -c->len; + if (c->len == 0) + xfree(c); + xfree(&x); + xfree(&y); +} + +/* + * Knuth 4.3.1, Algorithm M + */ +m_mult(a,b,c) + struct mint *a; + struct mint *b; + struct mint *c; +{ + register int i,j; + register long sum; + register short bcache; + register short *aptr; + register short *bptr; + register short *cptr; + register unsigned short fifteen = 15; + register int alen; + int blen; + +# define BASEBITS (8*sizeof(short)-1) +# define BASE (1 << BASEBITS) +# define LOWBITS (BASE - 1) + + alen = a->len; + blen = b->len; + + c->len = alen + blen; + c->val = xalloc(c->len,"m_mult"); + + aptr = a->val; + bptr = b->val; + cptr = c->val; + + sum = 0; + bcache = *bptr++; + for (i = alen; i > 0; i--) { + sum += *aptr++ * bcache; + *cptr++ = sum & LOWBITS; + /* sum >>= fifteen; */ /*most machines*/ + if (sum >=0) sum >>= fifteen; /*3b2*/ + else sum=0xfffe0000 | (sum >> fifteen); /*3b2*/ + } + *cptr = sum; + aptr -= alen; + cptr -= alen; + cptr++; + + for (j = blen - 1; j > 0; j--) { + sum = 0; + bcache = *bptr++; + for (i = alen; i > 0; i--) { + sum += *aptr++ * bcache + *cptr; + *cptr++ = sum & LOWBITS; + /* sum >>= fifteen; */ /*most machines*/ + if (sum >=0) sum >>= fifteen; /*3b2*/ + else sum=0xfffe0000 | (sum >> fifteen); /*3b2*/ + } + *cptr = sum; + aptr -= alen; + cptr -= alen; + cptr++; + } + if (c->val[c->len-1] == 0) { + c->len--; + } +} diff --git a/usr/src/lib/libmp/ngcd.c b/usr/src/lib/libmp/ngcd.c new file mode 100644 index 0000000..2531dbe --- /dev/null +++ b/usr/src/lib/libmp/ngcd.c @@ -0,0 +1,127 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:ngcd.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)gcd.c 1.1 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.2 3/13/18 */ + +/* LINTLIBRARY */ + +#include + +gcd(a,b,c) + MINT *a,*b,*c; +{ + MINT x,y,z,w; + + x.len = y.len = z.len = w.len = 0; + _mp_move(a,&x); + _mp_move(b,&y); + while (y.len != 0) { + mdiv(&x,&y,&w,&z); + _mp_move(&y,&x); + _mp_move(&z,&y); + } + _mp_move(&x,c); + xfree(&x); + xfree(&y); + xfree(&z); + xfree(&w); +} + + + + +invert(x1, x0, c) + MINT *x1; + MINT *x0; + MINT *c; +{ + MINT u2, u3; + MINT v2, v3; + MINT zero; + MINT q, r; + MINT t; + MINT x0_prime; + static MINT *one = (MINT *)0; + + /* + * Minimize calls to allocators. Don't use pointers for local + * variables, for the one "initialized" multiple precision + * variable, do it just once. + */ + if (one == (MINT *)0) + one = itom((short)1); + + zero.len = q.len = r.len = t.len = 0; + + x0_prime.len = u2.len = u3.len = 0; + _mp_move(x0, &u3); + _mp_move(x0, &x0_prime); + + v2.len = v3.len = 0; + _mp_move(one, &v2); + _mp_move(x1, &v3); + + while (mcmp(&v3,&zero) != 0) { + /* invariant: x0*u1 + x1*u2 = u3 */ + /* invariant: x0*v1 + x2*v2 = v3 */ + /* invariant: x(n+1) = x(n-1) % x(n) */ + mdiv(&u3,&v3,&q,&r); + _mp_move(&v3,&u3); + _mp_move(&r,&v3); + + mult(&q,&v2,&t); + msub(&u2,&t,&t); + _mp_move(&v2,&u2); + _mp_move(&t,&v2); + } + /* now x0*u1 + x1*u2 == 1, therefore, (u2*x1) % x0 == 1 */ + _mp_move(&u2,c); + if (mcmp(c,&zero) < 0) { + madd(&x0_prime, c, c); + } + xfree(&zero); + xfree(&v2); + xfree(&v3); + xfree(&u2); + xfree(&u3); + xfree(&q); + xfree(&r); + xfree(&t); +} + + diff --git a/usr/src/lib/libmp/pow.c b/usr/src/lib/libmp/pow.c new file mode 100644 index 0000000..35e4205 --- /dev/null +++ b/usr/src/lib/libmp/pow.c @@ -0,0 +1,96 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:pow.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)pow.c 1.1 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.1 4/30/85 */ + +/* LINTLIBRARY */ + +#include + +pow(a, b, c, d) + MINT *a, *b, *c, *d; +{ + int i, j, n; + MINT x, y; + MINT a0, b0, c0; + + a0.len = b0.len = c0.len = x.len = y.len = 0; + _mp_move(a, &a0); + _mp_move(b, &b0); + _mp_move(c, &c0); + xfree(d); + d->len = 1; + d->val = xalloc (1, "pow"); + *d->val = 1; + for (j = 0; j < b0.len; j++) { + n = b0.val[b0.len - j - 1]; + for (i = 0; i < 15; i++) { + mult(d, d, &x); + mdiv(&x, &c0, &y, d); + if ((n = n << 1) & 0100000) { + mult(&a0, d, &x); + mdiv(&x, &c0, &y, d); + } + } + } + xfree(&x); + xfree(&y); + xfree(&a0); + xfree(&b0); + xfree(&c0); +} + + +rpow (a, n, b) + MINT *a, *b; +{ + MINT x, y; + int i; + + x.len = 1; + x.val = xalloc(1, "rpow"); + *x.val = n; + y.len = n * a->len + 4; + y.val = xalloc(y.len, "rpow2"); + for (i = 0; i < y.len; i++) + y.val[i] = 0; + y.val[y.len - 1] = 010000; + pow(a, &x, &y, b); + xfree(&x); + xfree(&y); +} diff --git a/usr/src/lib/libmp/util.c b/usr/src/lib/libmp/util.c new file mode 100644 index 0000000..1d944f1 --- /dev/null +++ b/usr/src/lib/libmp/util.c @@ -0,0 +1,295 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libmp:util.c 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)util.c 1.1 89/03/10 Copyr 1986 Sun Micro"; +#endif +/* from UCB 5.1 4/30/85 */ + +/* LINTLIBRARY */ + +#include +#include + +extern char *malloc(); + +_mp_move(a,b) + MINT *a,*b; +{ + int i,j; + + xfree(b); + b->len = a->len; + if ((i = a->len) < 0) { + i = -i; + } + if (i == 0) { + return; + } + b->val = xalloc(i,"_mp_move"); + for(j = 0;j < i; j++) { + b->val[j]=a->val[j]; + } +} + + +/* ARGSUSED */ +/* VARARGS */ +short * +xalloc(nint,s) + int nint; + char *s; +{ + short *i; + + i = (short *) malloc((unsigned) + sizeof(short)*((unsigned)nint + 2)); /* ??? 2 ??? */ +#ifdef DEBUG + (void) fprintf(stderr, "%s: %o\n",s,i); +#endif + if (i == NULL) { + _mp_fatal("mp: no free space"); + } + return(i); +} + + +_mp_fatal(s) + char *s; +{ + (void) fprintf(stderr,"%s\n",s); + (void) fflush(stdout); + sleep(2); + abort(); +} + + +xfree(c) + MINT *c; +{ +#ifdef DBG + (void) fprintf(stderr, "xfree "); +#endif + if (c->len != 0) { + free((char *) c->val); + c->len = 0; + } +} + + + +_mp_mcan(a) + MINT *a; +{ + int i,j; + + if ((i = a->len) == 0) { + return; + } + if (i <0) { + i = -i; + } + for (j = i; j > 0 && a->val[j-1] == 0; j--) + ; + if (j == i) { + return; + } + if (j == 0) { + xfree(a); + return; + } + if (a->len > 0) { + a->len = j; + } else { + a->len = -j; + } +} + + +MINT * +itom(n) + int n; +{ + MINT *a; + + a = (MINT *) malloc((unsigned) sizeof(MINT)); + if (n > 0) { + a->len = 1; + a->val = xalloc(1,"itom1"); + *a->val = n; + } else if ( n < 0) { + a->len = -1; + a->val = xalloc(1,"itom2"); + *a->val = -n; + } else { + a->len = 0; + } + return(a); +} + + + +mcmp(a,b) + MINT *a,*b; +{ + MINT c; + int res; + + _mp_mcan(a); + _mp_mcan(b); + if (a->len != b->len) { + return(a->len - b->len); + } + c.len = 0; + msub(a,b,&c); + res = c.len; + xfree(&c); + return(res); +} + +/* + * Convert hex digit to binary value + */ +static int +xtoi(c) + char c; +{ + if (c >= '0' && c <= '9') { + return(c - '0'); + } else if (c >= 'a' && c <= 'f') { + return(c - 'a' + 10); + } else if (c >= 'A' && c <= 'F') { + return(c - 'A' + 10); + } else { + return(-1); + } +} + + + +/* + * Convert hex key to MINT key + */ +MINT * +xtom(key) + char *key; +{ + int digit; + MINT *m = itom(0); + MINT *d; + MINT *sixteen; + + sixteen = itom(16); + for (; *key; key++) { + digit = xtoi(*key); + if (digit < 0) { + return(NULL); + } + d = itom(digit); + mult(m,sixteen,m); + madd(m,d,m); + mfree(d); + } + mfree(sixteen); + return(m); +} + +static char +itox(d) + short d; +{ + d &= 15; + if (d < 10) { + return('0' + d); + } else { + return('a' - 10 + d); + } +} + +/* + * Convert MINT key to hex key + */ +char * +mtox(key) + MINT *key; +{ + MINT *m = itom(0); + MINT *zero = itom(0); + short r; + char *p; + char c; + char *s; + char *hex; + int size; + +# define BASEBITS (8*sizeof(short) - 1) + + if (key->len >= 0) { + size = key->len; + } else { + size = -key->len; + } + hex = malloc((unsigned) ((size * BASEBITS + 3)) / 4 + 1); + if (hex == NULL) { + return(NULL); + } + _mp_move(key,m); + p = hex; + do { + sdiv(m,16,m,&r); + *p++ = itox(r); + } while (mcmp(m,zero) != 0); + mfree(m); + mfree(zero); + + *p = 0; + for (p--, s = hex; s < p; s++, p--) { + c = *p; + *p = *s; + *s = c; + } + return(hex); +} + +/* + * Deallocate a multiple precision integer + */ +void +mfree(a) + MINT *a; +{ + xfree(a); + free((char *)a); +} diff --git a/usr/src/lib/libnls/libnls.mk b/usr/src/lib/libnls/libnls.mk index 1a9f52c..f5e57ed 100644 --- a/usr/src/lib/libnls/libnls.mk +++ b/usr/src/lib/libnls/libnls.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libnls:libnls.mk 1.2" +#ident "@(#)libnls:libnls.mk 1.1" # # libnls.mk: makefile for network listener library # @@ -22,7 +22,7 @@ LINTFLAGS = -b -x # change the next line to compile with -g # OPT = -g -LIB = $(ROOT)/usr/lib +LIBDIR = $(ROOT)/usr/lib LIBID = bin INCID = bin @@ -52,7 +52,7 @@ $(LIBNLS)(nlsrequest.o): $(INC)/stdio.h $(INC)/ctype.h $(INC)/fcntl.h \ $(INC)/listen.h install: all - install -f $(LIB) -u $(LIBID) -g $(LIBID) -m 644 $(LIBNLS) + install -f $(LIBDIR) -u $(LIBID) -g $(LIBID) -m 644 $(LIBNLS) clean: -rm -f *.o diff --git a/usr/src/lib/libns/libns.mk b/usr/src/lib/libns/libns.mk index 8c8e727..2f5a1a2 100644 --- a/usr/src/lib/libns/libns.mk +++ b/usr/src/lib/libns/libns.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libns:libns.mk 1.10.5.1" +#ident "@(#)libns:libns.mk 1.10.4.1" # This makefile makes libns.a, which is the library for # the name server library. # NOTE: this library is not for general use. It is put @@ -116,8 +116,6 @@ $(LIBNAME)(swtab.o): $(INC)/sys/nserve.h $(INC)/sys/rf_cirmgr.h\ $(LIBNAME)(uidmap.o): idload.h $(INC)/sys/types.h $(INC)/sys/rf_sys.h\ $(INC)/errno.h $(INC)/nserve.h $(LIBNAME)(rfs_up.o): $(INC)/nserve.h $(INC)/sys/types.h $(INC)/sys/nserve.h\ - $(INC)/sys/list.h $(INC)/sys/vnode.h $(INC)/sys/rf_messg.h\ - $(INC)/sys/rf_comm.h $(INC)/errno.h $(INC)/sys/rf_sys.h\ - $(INC)/stdio.h nslog.h + $(INC)/sys/rf_sys.h $(LIBNAME)(ns_syntax.o): $(INC)/nserve.h $(LIBNAME)(rfrcv.o): $(INC)/tiuser.h diff --git a/usr/src/lib/libns/negotiate.c b/usr/src/lib/libns/negotiate.c index 2e59f47..a5dc91d 100644 --- a/usr/src/lib/libns/negotiate.c +++ b/usr/src/lib/libns/negotiate.c @@ -5,13 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libns:negotiate.c 1.9.7.1" +#ident "@(#)libns:negotiate.c 1.9.6.1" #include "grp.h" #include "fcntl.h" #include "string.h" #include "stdio.h" #include "errno.h" -#include "unistd.h" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" @@ -187,15 +186,11 @@ negotiate(fd, passwd, flag, ngroups_maxp) } if (rfversion > RFS1DOT0) { + int trash; /* throwaway arg for getgroups */ int local_ngrpmax; int remote_ngrpmax; - local_ngrpmax = sysconf(_SC_NGROUPS_MAX); - if (local_ngrpmax < 0) { - LOG2(L_TRACE, "(%5d) leave: negotiate\n", Logstamp); - return(N_CERROR); - } - local_ngrpmax = MIN(RF_MAXGROUPS, local_ngrpmax); + local_ngrpmax = MIN(RF_MAXGROUPS, getgroups(0, &trash)); if ((nbytes = tcanon("l", &local_ngrpmax, &nbuf[0], 0)) == 0) { LOG2(L_TRACE, "(%5d) leave: negotiate\n", Logstamp); return(N_CERROR); diff --git a/usr/src/lib/libns/rfs_up.c b/usr/src/lib/libns/rfs_up.c index b613193..535a5db 100644 --- a/usr/src/lib/libns/rfs_up.c +++ b/usr/src/lib/libns/rfs_up.c @@ -5,13 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libns:rfs_up.c 1.1.5.1" +#ident "@(#)libns:rfs_up.c 1.1.4.1" #include #include #include #include #include -#include #include #include #include diff --git a/usr/src/lib/libns/uidmap.c b/usr/src/lib/libns/uidmap.c index 1bb66ca..6fb920d 100644 --- a/usr/src/lib/libns/uidmap.c +++ b/usr/src/lib/libns/uidmap.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libns:uidmap.c 1.7.6.1" +#ident "@(#)libns:uidmap.c 1.7.5.1" #include #include "idload.h" #include @@ -357,8 +357,6 @@ int n_update; error = 1; } - fclose(fp); - if (error) { LOG2(L_TRACE, "(%5d) leave: uidmap\n", Logstamp); return(FAILURE); @@ -985,7 +983,6 @@ char *mach; } *(buf + sbuf.st_size) = '\0'; - close(fd); LOG2(L_TRACE, "(%5d) leave: read_file\n", Logstamp); return(buf); } diff --git a/usr/src/lib/libnsl/dial/callers.c b/usr/src/lib/libnsl/dial/callers.c index 05eaf65..a8bffb7 100644 --- a/usr/src/lib/libnsl/dial/callers.c +++ b/usr/src/lib/libnsl/dial/callers.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:dial/callers.c 1.5" +#ident "@(#)libnsl:dial/callers.c 1.2" #include "uucp.h" @@ -46,7 +46,7 @@ EXTERN int open801(); #endif #ifdef DATAKIT -EXTERN int dkcall(); +int dkcall(); #endif /* DATAKIT */ #ifdef V8 @@ -213,8 +213,6 @@ register char *flds[], *dev[]; char *phonecl; /* clear phone string */ char phoneex[2*(MAXPH+2)]; /* expanded phone string */ EXTERN void ttygenbrk(); - struct termio tty_orig; - int ret_orig = -1; sdev = dev; /* set up default "break" routine */ @@ -319,9 +317,6 @@ register char *flds[], *dev[]; goto bad; } - /* save initial state of line in case script fails */ - ret_orig = ioctl(dcf, TCGETA, &tty_orig); - /* use sdev[] since dev[] is incremented for internal callers */ fixline(dcf, atoi(fdig(sdev[D_CLASS])), D_DIRECT); @@ -369,9 +364,6 @@ register char *flds[], *dev[]; return(dcf); bad: if ( dcf >= 0 ) { - /* reset line settings if we got them in the beginning */ - if ( ret_orig == 0 ) - (void) ioctl(dcf, TCSETAW, &tty_orig); fd_rmlock(dcf); (void)close(dcf); } diff --git a/usr/src/lib/libnsl/dial/dial.c b/usr/src/lib/libnsl/dial/dial.c index 0ca0fea..8f52e5a 100644 --- a/usr/src/lib/libnsl/dial/dial.c +++ b/usr/src/lib/libnsl/dial/dial.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:dial/dial.c 1.5" +#ident "@(#)libnsl:dial/dial.c 1.3" /*LINTLIBRARY*/ /*************************************************************** * dial() returns an fd for an open tty-line connected to the @@ -100,14 +100,6 @@ #include "sysfiles.c" #include "ulockf.c" -#ifdef DATAKIT -#include "dkbreak.c" -#include "dkerr.c" -#include "dkdial.c" -#include "dkminor.c" -#include "dtnamer.c" -#endif - static int rlfd; /* fd for remote comm line */ @@ -148,6 +140,7 @@ CALL call; { char *alt[7]; char speed[10]; /* character value of speed passed to dial */ +int systemname = 0; /* set service so we know which Sysfiles entries to use, then */ /* be sure can access Devices file(s). use "cu" entries ... */ @@ -159,26 +152,17 @@ char speed[10]; /* character value of speed passed to dial */ return(NO_Ldv); } - if (call.attr != NULL) { - if ( call.attr->c_cflag & PARENB ) { - Evenflag = ((call.attr->c_cflag & PARODD) ? 0 : 1); - Oddflag = ((call.attr->c_cflag & PARODD) ? 1 : 0); - } - line_8bit = (call.attr->c_cflag & CS8 ? 1 : 0); - } - - if (call.speed <= 0) - strcpy(speed,"Any"); - else - sprintf(speed,"%d",call.speed); - - /* Determine whether contents of "telno" is a system name. */ - if ( (call.telno != NULL) && - (strlen(call.telno) != strspn(call.telno,"0123456789=-*#")) ) { - /* use conn() for system names */ + if (call.speed <= 0) strcpy(speed,"Any"); + else sprintf(speed,"%d",call.speed); +/* Determine whether contents of telno is a phone number or a system name */ + if(strlen(call.telno) != strspn(call.telno,"0123456789=-*#")) + systemname++; +/* If dial() was given a system name use "conn()" */ + if(systemname) rlfd = conn(call.telno); - } else { + else { alt[F_NAME] = "dummy"; /* to replace the Systems file fields */ + alt[F_TIME] = "Any"; /* needed for getto(); [F_TYPE] and */ alt[F_TYPE] = ""; /* [F_PHONE] assignment below */ alt[F_CLASS] = speed; @@ -186,22 +170,27 @@ char speed[10]; /* character value of speed passed to dial */ alt[F_LOGIN] = ""; alt[6] = ""; - if ( (call.telno != NULL) && (*call.telno != '\0') ) { - /* given a phone number, use an ACU */ - alt[F_PHONE] = call.telno; - alt[F_TYPE] = "ACU"; - } else { - /* otherwise, use a Direct connection */ - alt[F_TYPE] = "Direct"; - /* If device name starts with "/dev/", strip it off */ - /* since Devices file entries will also be stripped. */ - if ( (call.line != NULL) && - (strncmp(call.line, "/dev/", 5) == 0) ) + /* If device specified: if is "/dev/device", strip off */ + /* "/dev/" because must exactly match entries in Devices*/ + /* file, which usually omit the "/dev/". if doesn't */ + /* begin with "/dev/", leave it as it is. */ + if(call.line != NULL) { + if ( strncmp(call.line, "/dev/", 5) == 0 ) Myline = (call.line + 5); else Myline = call.line; } + /* If telno specified */ + if(call.telno != NULL) { + alt[F_PHONE] = call.telno; + alt[F_TYPE] = "ACU"; + } + /* If telno is NULL, it is a direct line */ + else { + alt[F_TYPE] = "Direct"; + } + #ifdef forfutureuse if (call->class != NULL) alt[F_TYPE] = call->class; diff --git a/usr/src/lib/libnsl/dial/dial.mk b/usr/src/lib/libnsl/dial/dial.mk index fe77e12..5d78c70 100644 --- a/usr/src/lib/libnsl/dial/dial.mk +++ b/usr/src/lib/libnsl/dial/dial.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libnsl:dial/dial.mk 1.6" +#ident "@(#)libnsl:dial/dial.mk 1.5" # # *************************************************************** # * Copyright (c) 1984 AT&T Technologies, Inc. * @@ -37,7 +37,6 @@ all: $(OBJS) dial.o: dial.c \ callers.c conn.c \ - dk.h dkbreak.c dkdial.c dkerr.c dkminor.c dtnamer.c sysexits.h \ getargs.c interface.c line.c \ stoa.c strecpy.c strsave.c sysfiles.c ulockf.c uucpdefs.c \ uucp.h diff --git a/usr/src/lib/libnsl/dial/interface.c b/usr/src/lib/libnsl/dial/interface.c index c71c3fb..e243169 100644 --- a/usr/src/lib/libnsl/dial/interface.c +++ b/usr/src/lib/libnsl/dial/interface.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:dial/interface.c 1.2" +#ident "@(#)libnsl:dial/interface.c 1.1" /* interface( label ) provide alternate definitions for the I/O functions through global interfaces. @@ -31,7 +31,7 @@ EXTERN int restline(); extern int read(), write(); static int usetup(), uteardown(); -GLOBAL int (*Read)() = read, +EXTERN int (*Read)() = read, (*Write)() = write, #if defined(__STDC__) (*Ioctl)(int,int,...) = ioctl, diff --git a/usr/src/lib/libnsl/dial/line.c b/usr/src/lib/libnsl/dial/line.c index 76da151..b441fee 100644 --- a/usr/src/lib/libnsl/dial/line.c +++ b/usr/src/lib/libnsl/dial/line.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:dial/line.c 1.2" +#ident "@(#)libnsl:dial/line.c 1.1" /* This is a new line.c, which consists of line.c and culine.c * merged together. @@ -55,14 +55,7 @@ GLOBAL int GLOBAL int donap; /* for speedup hook in pk1.c */ static int Saved_line; /* was savline() successful? */ -GLOBAL int - Oddflag = 0, /* Default is no parity */ - Evenflag = 0, /* Default is no parity */ - Duplex = 1, /* Default is full duplex */ - Terminal = 0, /* Default is no terminal */ - term_8bit = -1, /* Default to terminal setting or 8 bit */ - line_8bit = -1; /* Default is same as terminal */ - +GLOBAL int Oddflag, Evenflag, Duplex, Terminal, line_8bit; static char *P_PARITY = "Parity option error\r\n"; #ifdef ATTSV diff --git a/usr/src/lib/libnsl/dial/parms.h b/usr/src/lib/libnsl/dial/parms.h index 2e8c7c5..ed0fffa 100644 --- a/usr/src/lib/libnsl/dial/parms.h +++ b/usr/src/lib/libnsl/dial/parms.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:dial/parms.h 1.2" +#ident "@(#)libnsl:dial/parms.h 1.1" /* go through this carefully, configuring for your site */ @@ -77,7 +77,9 @@ /* definitions for the types of networks and dialers that are available */ /* used to depend on STANDALONE, but now done at runtime via Sysfiles */ +#ifndef DIAL #define DATAKIT /* define DATAKIT if datakit is available. */ +#endif /* #define UNET /* define UNET if you have 3com ethernet software */ /* #define TCP /* TCP (bsd systems) */ /* #define SYTEK /* for sytek network */ diff --git a/usr/src/lib/libnsl/dial/uucp.h b/usr/src/lib/libnsl/dial/uucp.h index ec2a0ce..7629e88 100644 --- a/usr/src/lib/libnsl/dial/uucp.h +++ b/usr/src/lib/libnsl/dial/uucp.h @@ -5,12 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:dial/uucp.h 1.5" +#ident "@(#)libnsl:dial/uucp.h 1.2" #ifndef _UUCP_H #define _UUCP_H -#include +#include #include #include #include "parms.h" diff --git a/usr/src/lib/libnsl/libnsl.mk b/usr/src/lib/libnsl/libnsl.mk index b1c993a..5f2b548 100644 --- a/usr/src/lib/libnsl/libnsl.mk +++ b/usr/src/lib/libnsl/libnsl.mk @@ -5,8 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libnsl:libnsl.mk 1.4" - +#ident "@(#)libnsl:libnsl.mk 1.3" # # Network services library # @@ -15,8 +14,6 @@ ROOT= USRLIB=$(ROOT)/usr/lib SHLIB=$(ROOT)/shlib INC=$(ROOT)/usr/include -CPPFLAGS=OmitYP -#CPPFLAGS=-DYP INS = install @@ -27,15 +24,6 @@ all: case $$i in\ *.*)\ ;;\ - yp)\ - if [ $(CPPFLAGS) = -DYP ] ; \ - then \ - cd $$i;\ - echo "===== $(MAKE) -f $$i.mk all";\ - $(MAKE) -f $$i.mk ROOT=$(ROOT) INC=$(INC); \ - cd .. ;\ - fi;\ - ;;\ *)\ cd $$i;\ echo "===== $(MAKE) -f $$i.mk all";\ diff --git a/usr/src/lib/libnsl/netdir/netdir.c b/usr/src/lib/libnsl/netdir/netdir.c index 54fc3c7..afed041 100644 --- a/usr/src/lib/libnsl/netdir/netdir.c +++ b/usr/src/lib/libnsl/netdir/netdir.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnet:netdir/netdir.c 1.7" +#ident "@(#)libnet:netdir/netdir.c 1.5" /* *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -65,6 +65,7 @@ static struct translator { struct translator *next; }; + extern char *sys_errlist[]; static struct translator *xlate_list = NULL; @@ -333,8 +334,8 @@ netdir_free(ptr, type) nas = (struct nd_addrlist *) ptr; for (na = nas->n_addrs, i = 0; i < nas->n_cnt; i++, na++) { free(na->buf); + free((char *)na); } - free((char *)nas->n_addrs); free((char *)nas); break; @@ -349,11 +350,11 @@ netdir_free(ptr, type) hss = (struct nd_hostservlist *) ptr; for (hs = hss->h_hostservs, i = 0; i < hss->h_cnt; i++, hs++) { free(hs->h_host); + free(hs->h_serv); } free((char *)hss->h_hostservs); free((char *)hss); break; - default : _nderror = ND_UKNWN; break; @@ -491,7 +492,7 @@ netdir_sperror() (void) sprintf(str, "n2a: control operation failed"); break; case ND_SYSTEM: - (void) sprintf(str, "n2a: system error: %s", strerror(errno)); + (void) sprintf(str, "n2a: system error: %s", sys_errlist[errno]); default : (void) sprintf(str, "n2a: unknown error #%d", _nderror); break; diff --git a/usr/src/lib/libnsl/nsl/_conn_util.c b/usr/src/lib/libnsl/nsl/_conn_util.c index 49573c3..8740320 100644 --- a/usr/src/lib/libnsl/nsl/_conn_util.c +++ b/usr/src/lib/libnsl/nsl/_conn_util.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:nsl/_conn_util.c 1.6.3.2" +#ident "@(#)libnsl:nsl/_conn_util.c 1.6.3.1" #include "sys/param.h" #include "sys/types.h" #include "sys/errno.h" @@ -169,9 +169,8 @@ register struct t_call *call; case T_CONN_CON: if ((ctlbuf.len < sizeof(struct T_conn_con)) || - (pptr->conn_con.OPT_length != 0 && (ctlbuf.len < (pptr->conn_con.OPT_length + - pptr->conn_con.OPT_offset)))) { + pptr->conn_con.OPT_offset))) { t_errno = TSYSERR; errno = EPROTO; return(-1); diff --git a/usr/src/lib/libnsl/nsl/_utility.c b/usr/src/lib/libnsl/nsl/_utility.c index 5020900..384d585 100644 --- a/usr/src/lib/libnsl/nsl/_utility.c +++ b/usr/src/lib/libnsl/nsl/_utility.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:nsl/_utility.c 1.11" +#ident "@(#)libnsl:nsl/_utility.c 1.8" #include "sys/param.h" #include "sys/types.h" #include "sys/errno.h" @@ -64,7 +64,6 @@ int fd; * This is to ensure that if the user wants to align a network * addr on a non-word boundry then it will happen. */ -void _t_aligned_copy(buf, len, init_offset, datap, rtn_offset) char *buf; char *datap; @@ -94,7 +93,6 @@ int y; * The only thing that can be in look buffer is a T_discon_ind, * T_ordrel_ind or a T_uderr_ind. */ -void _t_putback(tiptr, dptr, dsize, cptr, csize) struct _ti_user *tiptr; caddr_t dptr; @@ -150,7 +148,7 @@ long type; int size; cntlflag = fcntl(fd,F_GETFL,0); - fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0) & ~(O_NDELAY | O_NONBLOCK)); + fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0) & ~O_NDELAY); ctlbuf.len = 0; ctlbuf.buf = tiptr->ti_ctlbuf; @@ -267,7 +265,6 @@ int *retlen; * alloc scratch buffers and look buffers */ -/* ARGSUSED */ _t_alloc_bufs(fd, tiptr, info) register struct _ti_user *tiptr; struct T_info_ack info; @@ -326,7 +323,7 @@ struct T_info_ack info; tiptr->ti_lookcsize = 0; tiptr->ti_lookdsize = 0; tiptr->ti_lookflg = 0; - tiptr->ti_flags = USED | info.PROVIDER_flag; + tiptr->ti_flags = USED; tiptr->ti_maxpsz = info.TIDU_size; tiptr->ti_servtype = info.SERV_type; tiptr->ti_state = T_UNINIT; @@ -349,7 +346,6 @@ long infosize; } } -void _null_tiptr(tiptr) struct _ti_user *tiptr; { diff --git a/usr/src/lib/libnsl/nsl/t_connect.c b/usr/src/lib/libnsl/nsl/t_connect.c index 2de7e7f..71273c4 100644 --- a/usr/src/lib/libnsl/nsl/t_connect.c +++ b/usr/src/lib/libnsl/nsl/t_connect.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:nsl/t_connect.c 1.7" +#ident "@(#)libnsl:nsl/t_connect.c 1.5" #include "sys/param.h" #include "sys/types.h" #include "sys/stropts.h" @@ -29,6 +29,7 @@ struct t_call *rcvcall; { int fctlflg; register struct _ti_user *tiptr; + void (*sigsave)(); if ((tiptr = _t_checkfd(fd)) == NULL) return(-1); @@ -41,7 +42,7 @@ struct t_call *rcvcall; return(-1); } - if (fctlflg & (O_NDELAY | O_NONBLOCK)) { + if (fctlflg&O_NDELAY) { tiptr->ti_state = TLI_NEXTSTATE(T_CONNECT2, tiptr->ti_state); t_errno = TNODATA; return(-1); diff --git a/usr/src/lib/libnsl/nsl/t_open.c b/usr/src/lib/libnsl/nsl/t_open.c index aa3d4d3..4ebb04b 100644 --- a/usr/src/lib/libnsl/nsl/t_open.c +++ b/usr/src/lib/libnsl/nsl/t_open.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:nsl/t_open.c 1.5.3.3" +#ident "@(#)libnsl:nsl/t_open.c 1.5.3.1" #include "sys/param.h" #include "sys/types.h" #include "sys/errno.h" @@ -15,7 +15,6 @@ #include "sys/timod.h" #include "sys/tiuser.h" #include "sys/signal.h" -#include "sys/fcntl.h" #include "_import.h" @@ -43,17 +42,12 @@ register struct t_info *info; void (*sigsave)(); - if (!(flags & O_RDWR)) { - errno = 0; - t_errno = TBADFLAG; - return (-1); - } - if ((fd = open(path, flags)) < 0) { t_errno = TSYSERR; return(-1); } + /* * is module already pushed */ @@ -63,6 +57,7 @@ register struct t_info *info; return(-1); } + if (!retval) if (ioctl(fd, I_PUSH, "timod") < 0) { t_errno = TSYSERR; diff --git a/usr/src/lib/libnsl/nsl/t_snd.c b/usr/src/lib/libnsl/nsl/t_snd.c index c67c183..32f0516 100644 --- a/usr/src/lib/libnsl/nsl/t_snd.c +++ b/usr/src/lib/libnsl/nsl/t_snd.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:nsl/t_snd.c 1.3.1.2" +#ident "@(#)libnsl:nsl/t_snd.c 1.3.1.1" #include "sys/param.h" #include "sys/types.h" #include "sys/errno.h" @@ -45,10 +45,7 @@ int flags; t_errno = TNOTSUPPORT; return(-1); } - if (!(tiptr->ti_flags & SENDZERO) && nbytes == 0) { - t_errno = TBADDATA; - return(-1); - } + datareq = (struct T_data_req *)tiptr->ti_ctlbuf; if (flags&T_EXPEDITED) { @@ -66,7 +63,7 @@ int flags; tmp = nbytes; tmpbuf = buf; - do { + while (tmp) { if ((tmpcnt = tmp) > tiptr->ti_maxpsz) { datareq->MORE_flag = 1; tmpcnt = tiptr->ti_maxpsz; @@ -103,7 +100,7 @@ int flags; } tmp = tmp - tmpcnt; tmpbuf = tmpbuf + tmpcnt; - } while (tmp); + } tiptr->ti_state = TLI_NEXTSTATE(T_SND, tiptr->ti_state); return(nbytes - tmp); diff --git a/usr/src/lib/libnsl/nsl/t_sndudata.c b/usr/src/lib/libnsl/nsl/t_sndudata.c index e738309..c6f8040 100644 --- a/usr/src/lib/libnsl/nsl/t_sndudata.c +++ b/usr/src/lib/libnsl/nsl/t_sndudata.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:nsl/t_sndudata.c 1.5" +#ident "@(#)libnsl:nsl/t_sndudata.c 1.4" #include "sys/param.h" #include "sys/types.h" #include "sys/errno.h" @@ -39,10 +39,9 @@ register struct t_unitdata *unitdata; return(-1); } - if (!(tiptr->ti_flags & SENDZERO) && (int)unitdata->udata.len == 0) { - t_errno = TBADDATA; - return(-1); - } + if ((int)unitdata->udata.len == 0) + return(0); + if ((int)unitdata->udata.len > tiptr->ti_maxpsz) { t_errno = TSYSERR; errno = EPROTO; diff --git a/usr/src/lib/libnsl/rpc/auth_des.c b/usr/src/lib/libnsl/rpc/auth_des.c index bdcfd0d..f204f51 100644 --- a/usr/src/lib/libnsl/rpc/auth_des.c +++ b/usr/src/lib/libnsl/rpc/auth_des.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpc:auth_des.c 1.5" +#ident "@(#)librpc:auth_des.c 1.4" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -19,15 +18,15 @@ * * * -* Copyright Notice +* Copyright Notice * -* Notice of copyright on this source code product does not indicate +* Notice of copyright on this source code product does not indicate * publication. * * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. -*/ +*/ #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)auth_des.c 1.9 89/05/02 Copyr 1986 Sun Micro"; @@ -35,7 +34,7 @@ static char sccsid[] = "@(#)auth_des.c 1.9 89/05/02 Copyr 1986 Sun Micro"; /* * auth_des.c, client-side implementation of DES authentication - * + * */ #include @@ -44,24 +43,23 @@ static char sccsid[] = "@(#)auth_des.c 1.9 89/05/02 Copyr 1986 Sun Micro"; #ifdef SYSLOG #include #else -#define LOG_ERR 1 +#define LOG_ERR 1 #endif /* SYSLOG */ #endif /* _KERNEL */ -#define MILLION 1000000L -#define RTIME_TIMEOUT 5 /* seconds to wait for sync */ +#define MILLION 1000000L +#define RTIME_TIMEOUT 5 /* seconds to wait for sync */ -#define AUTH_PRIVATE(auth) (struct ad_private *) auth->ah_private -#define ALLOC(object_type) (object_type *) mem_alloc(sizeof (object_type)) -#define FREE(ptr, size) mem_free((char *)(ptr), (int) size) -#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE) +#define AUTH_PRIVATE(auth) (struct ad_private *) auth->ah_private +#define ALLOC(object_type) (object_type *) mem_alloc(sizeof(object_type)) +#define FREE(ptr, size) mem_free((char *)(ptr), (int) size) +#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE) #ifdef _KERNEL -#define gettimeofday(tvp, tzp) uniqtime(tvp) /* fake system call */ +#define gettimeofday(tvp, tzp) uniqtime(tvp) /* fake system call */ #endif static struct auth_ops *authdes_ops(); -extern char *malloc(); /* * This struct is pointed to by the ah_private field of an "AUTH *" @@ -72,7 +70,7 @@ struct ad_private { char *ad_servername; /* server's full name */ u_int ad_servernamelen; /* length of name, rounded up */ u_int ad_window; /* client specified window */ - bool_t ad_dosync; /* synchronize? */ + bool_t ad_dosync; /* synchronize? */ char *ad_timehost; /* remote host to sync with */ struct timeval ad_timediff; /* server's time - client's time */ u_long ad_nickname; /* server's nickname for client */ @@ -81,7 +79,7 @@ struct ad_private { struct timeval ad_timestamp; /* timestamp sent */ des_block ad_xkey; /* encrypted conversation key */ }; - + AUTH * authdes_seccreate(servername, window, timehost, ckey) char *servername; /* network name of server */ @@ -94,7 +92,7 @@ authdes_seccreate(servername, window, timehost, ckey) char namebuf[MAXNETNAMELEN+1]; /* - * Allocate everything now + * Allocate everything now */ auth = ALLOC(AUTH); if (auth == NULL) { @@ -108,8 +106,6 @@ authdes_seccreate(servername, window, timehost, ckey) } ad->ad_fullname = ad->ad_servername = NULL; /* Sanity reasons */ ad->ad_timehost = NULL; - ad->ad_timediff.tv_sec = 0; - ad->ad_timediff.tv_usec = 0; (void) getnetname(namebuf); ad->ad_fullnamelen = RNDUP(strlen(namebuf)); ad->ad_fullname = mem_alloc(ad->ad_fullnamelen + 1); @@ -136,8 +132,7 @@ authdes_seccreate(servername, window, timehost, ckey) ad->ad_window = window; if (ckey == NULL) { if (key_gendes(&auth->ah_key) < 0) { - msgout( - "authdes_seccreate: unable to gen conversation key"); + msgout("authdes_seccreate: unable to gen conversation key"); goto failed; } } else { @@ -159,7 +154,7 @@ authdes_seccreate(servername, window, timehost, ckey) failed: if (auth) - FREE(auth, sizeof (AUTH)); + FREE(auth, sizeof(AUTH)); if (ad) { if (ad->ad_fullname) FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); @@ -167,7 +162,7 @@ authdes_seccreate(servername, window, timehost, ckey) FREE(ad->ad_servername, ad->ad_servernamelen + 1); if (ad->ad_timehost) FREE(ad->ad_timehost, strlen(ad->ad_timehost) + 1); - FREE(ad, sizeof (struct ad_private)); + FREE(ad, sizeof(struct ad_private)); } return (NULL); } @@ -179,7 +174,7 @@ authdes_seccreate(servername, window, timehost, ckey) /* * 1. Next Verifier - */ + */ /*ARGSUSED*/ static void authdes_nextverf(auth) @@ -230,11 +225,10 @@ authdes_marshal(auth, xdrs) IXDR_PUT_U_LONG(ixdr, ad->ad_window - 1); ivec.key.high = ivec.key.low = 0; status = cbc_crypt((char *)&auth->ah_key, (char *)cryptbuf, - 2 * sizeof (des_block), - DES_ENCRYPT | DES_HW, (char *)&ivec); + 2*sizeof(des_block), DES_ENCRYPT | DES_HW, (char *)&ivec); } else { status = ecb_crypt((char *)&auth->ah_key, (char *)cryptbuf, - sizeof (des_block), DES_ENCRYPT | DES_HW); + sizeof(des_block), DES_ENCRYPT | DES_HW); } if (DES_FAILED(status)) { msgout("authdes_marshal: DES encryption failure"); @@ -306,7 +300,7 @@ authdes_validate(auth, rverf) * Decrypt the timestamp */ status = ecb_crypt((char *)&auth->ah_key, (char *)&verf.adv_xtimestamp, - sizeof (des_block), DES_DECRYPT | DES_HW); + sizeof(des_block), DES_DECRYPT | DES_HW); if (DES_FAILED(status)) { msgout("authdes_validate: DES decryption failure"); @@ -314,7 +308,7 @@ authdes_validate(auth, rverf) } /* - * xdr the decrypted timestamp + * xdr the decrypted timestamp */ ixdr = (u_long *)verf.adv_xtimestamp.c; verf.adv_timestamp.tv_sec = IXDR_GET_LONG(ixdr) + 1; @@ -324,7 +318,7 @@ authdes_validate(auth, rverf) * validate */ if (memcmp((char *)&ad->ad_timestamp, (char *)&verf.adv_timestamp, - sizeof (struct timeval)) != 0) { + sizeof(struct timeval)) != 0) { msgout("authdes_validate: verifier mismatch"); return (FALSE); } @@ -378,8 +372,8 @@ authdes_destroy(auth) FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); FREE(ad->ad_servername, ad->ad_servernamelen + 1); - FREE(ad, sizeof (struct ad_private)); - FREE(auth, sizeof (AUTH)); + FREE(ad, sizeof(struct ad_private)); + FREE(auth, sizeof(AUTH)); } /* diff --git a/usr/src/lib/libnsl/rpc/clnt_bcast.c b/usr/src/lib/libnsl/rpc/clnt_bcast.c index 1084a87..aee5c67 100644 --- a/usr/src/lib/libnsl/rpc/clnt_bcast.c +++ b/usr/src/lib/libnsl/rpc/clnt_bcast.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpc:clnt_bcast.c 1.6" +#ident "@(#)librpc:clnt_bcast.c 1.4" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -19,15 +18,17 @@ * * * -* Copyright Notice +* Copyright Notice * -* Notice of copyright on this source code product does not indicate +* Notice of copyright on this source code product does not indicate * publication. * * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. -*/ +*/ + + #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro"; #endif @@ -39,18 +40,15 @@ static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro"; * Copyright (C) 1988, Sun Microsystems, Inc. * * The following is kludged-up support for simple rpc broadcasts. - * Someday a large, complicated system will replace these trivial + * Someday a large, complicated system will replace these trivial * routines. */ #include -#include -#include -#ifdef PORTMAP #include #include #include -#endif +#include #ifdef DEBUG #include #endif @@ -58,14 +56,16 @@ static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro"; #ifdef SYSLOG #include #else -#define LOG_ERR 3 +#define LOG_ERR 3 #endif /* SYSLOG */ +extern char *strdup(); extern int errno; -#define MAXBCAST 20 /* Max no of broadcasting transports */ +#define MAXBCASTADDRS 10 /* The max broadcast addresses for a transport */ +#define MAXBCAST 20 /* Max no of transports supporting broadcasts */ + -extern char *malloc(); typedef bool_t (*resultproc_t)(); /* @@ -73,18 +73,10 @@ typedef bool_t (*resultproc_t)(); * datagram_n transports. May potentially lead to broadacst storms * and hence should be used with caution, care and courage. * - * The current parameter xdr packet size is limited by the max tsdu - * size of the transport. If the max tsdu size of any transport is - * smaller than the parameter xdr packet, then broadcast is not - * sent on that transport. - * Also, the packet size should be less the packet size of - * the data link layer (for ethernet it is 1400 bytes). The result - * size has to be smaller than the transport tsdu size. - * - * If PORTMAP has been defined, we send two packets for UDP, one for - * rpcbind and one for portmap. For those machines which support - * both rpcbind and portmap, it will cause them to reply twice, and - * also here it will get two responses ... kinda' inefficient and clumsy. + * The current parameter xdr packet size is limited by the max tsdu size + * of the transport. If the max tsdu size of any transport is smaller + * than the parameter xdr packet, then broadcast is not sent on that + * transport. */ enum clnt_stat rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, @@ -99,55 +91,44 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, resultproc_t eachresult; /* call with each result obtained */ char *nettype; /* transport type */ { - enum clnt_stat stat = RPC_SUCCESS; /* Return status */ - XDR xdr_stream; /* XDR stream */ - register XDR *xdrs = &xdr_stream; - fd_set mask; /* File descriptor mask */ - fd_set readfds; - struct rpc_msg msg; /* RPC message */ - struct timeval t; - char *outbuf = NULL; /* Broadcast msg buffer */ - char *inbuf = NULL; /* Reply buf */ - register int fdlistno = 0; - long maxbufsize = 0; - AUTH *sys_auth = authsys_create_default(); - register int i, j; - bool_t done = FALSE; - int net; - char uaddress[1024]; /* A self imposed limit */ - char *uaddrp = uaddress; - int pmap_reply_flag = 0; /* reply recvd from PORTMAP */ + enum clnt_stat stat = RPC_SUCCESS;/* Return status */ + XDR xdr_stream; /* XDR stream */ + register XDR *xdrs = &xdr_stream; + int outlen; /* Length of the xdr'ed message */ + fd_set mask; /* File descriptor mask */ + fd_set readfds; + register u_long xid; /* Transaction id */ + u_long port; /* Not required, but still used - vipin*/ + /* very required for backword comp- cpj */ + struct netbuf addrs[MAXBCASTADDRS]; /* broadcast addresses */ + struct rmtcallargs a; /* Remote arguments */ + struct rmtcallres r; /* Remote results */ + struct rpc_msg msg; /* RPC message */ + struct timeval t; + char *outbuf = NULL; /* Broadcasted message buffer */ + char *inbuf = NULL; /* Reply buf */ struct { int fd; /* File descriptor */ - struct netconfig *nconf; /* Netconfig structure */ - u_int asize; /* Size of the addr buf */ + struct netconfig *nconf;/* Network config structure */ + u_int asize; /* Size of the address buf */ u_int dsize; /* Size of the data buf */ struct netbuf raddr; /* Remote address */ - struct nd_addrlist *nal; /* Broadcast addrs */ - int udpip; /* This is UDP/IP */ - } fdlist[MAXBCAST]; - struct rpcb_rmtcallargs barg; /* Remote arguments */ - struct rpcb_rmtcallres bres; /* Remote results */ + } fdlist[MAXBCAST]; /* A list of fd and netconfs */ struct t_unitdata t_udata, t_rdata; struct netconfig *nconf; - struct nd_hostserv hs; - -#ifdef PORTMAP - u_long port; /* Remote port number */ - int pmap_flag = 0; /* UDP exists ? */ - char *outbuf_pmap = NULL; - struct rmtcallargs barg_pmap; /* Remote arguments */ - struct rmtcallres bres_pmap; /* Remote results */ - struct t_unitdata t_udata_pmap; - int udpbufsz = 0; -#endif /* PORTMAP */ + register int fdlistno = 0; + long maxbufsize = 0; + AUTH *sys_auth = authsys_create_default(); + register int i; + bool_t done = FALSE; + int net; if (sys_auth == (AUTH *)NULL) - return (RPC_SYSTEMERROR); + return(RPC_SYSTEMERROR); /* * initialization: create a fd, a broadcast address, and send the * request on the broadcast transport. - * Listen on all of them and on replies, call the user supplied + * Listen on all of them and on replies call the user supplied * function. */ FD_ZERO(&mask); @@ -169,16 +150,15 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, stat = RPC_CANTSEND; continue; } - if (t_bind(fd, (struct t_bind *)NULL, - (struct t_bind *)NULL) == -1) { + if (t_bind(fd, (struct t_bind *)NULL, (struct t_bind *)NULL) == -1) { (void) t_close(fd); stat = RPC_CANTSEND; continue; } /* Do protocol specific negotiating for broadcast */ - if (netdir_options(nconf, ND_SET_BROADCAST, fd, NULL)) { + if (negotiate_broadcast(fd, nconf)) { (void) t_close(fd); - stat = RPC_NOBROADCAST; + stat = RPC_CANTSEND; continue; } taddr = (struct t_bind *)t_alloc(fd, T_BIND, T_ADDR); @@ -197,21 +177,6 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, maxbufsize = fdlist[fdlistno].dsize; taddr->addr.buf = NULL; (void) t_free((char *)taddr, T_BIND); -#ifdef PORTMAP - if ((nconf->nc_semantics == NC_TPI_CLTS) && - !strcmp(nconf->nc_protofmly, NC_INET) && - !strcmp(nconf->nc_proto, NC_UDP)) { - fdlist[fdlistno].udpip = 1; - udpbufsz = fdlist[fdlistno].dsize; - if ((outbuf_pmap = malloc(udpbufsz)) == NULL){ - t_close(fd); - continue; - } - pmap_flag = 1; - } else { - fdlist[fdlistno].udpip = 0; - } -#endif fdlistno++; } @@ -234,96 +199,72 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, /* Serialize all the arguments which have to be sent */ (void) gettimeofday(&t, (struct timezone *)0); - msg.rm_xid = getpid() ^ t.tv_sec ^ t.tv_usec; + msg.rm_xid = xid = getpid() ^ t.tv_sec ^ t.tv_usec; msg.rm_direction = CALL; msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - msg.rm_call.cb_prog = RPCBPROG; - msg.rm_call.cb_vers = RPCBVERS; - msg.rm_call.cb_proc = RPCBPROC_CALLIT; - barg.prog = prog; - barg.vers = vers; - barg.proc = proc; - barg.xdr_args = xargs; - barg.args_ptr = argsp; - bres.addr_ptr = uaddrp; - bres.xdr_results = xresults; - bres.results_ptr = resultsp; + msg.rm_call.cb_prog = PMAPPROG; + msg.rm_call.cb_vers = PMAPVERS; + msg.rm_call.cb_proc = PMAPPROC_CALLIT; msg.rm_call.cb_cred = sys_auth->ah_cred; msg.rm_call.cb_verf = sys_auth->ah_verf; + a.prog = prog; + a.vers = vers; + a.proc = proc; + a.xdr_args = xargs; + a.args_ptr = argsp; + /* + * This is also being used by the earlier socket broadcasts; + * Though port doesnt make sense here, We still continue to use it + * and ignore this non-malign part. + */ + r.port_ptr = &port; + r.xdr_results = xresults; + r.results_ptr = resultsp; + /* Allocate the space for the max buf size */ xdrmem_create(xdrs, outbuf, maxbufsize, XDR_ENCODE); - if ((! xdr_callmsg(xdrs, &msg)) || - (! xdr_rpcb_rmtcallargs(xdrs, &barg))) { + if ((! xdr_callmsg(xdrs, &msg)) || (! xdr_rmtcall_args(xdrs, &a))) { stat = RPC_CANTENCODEARGS; goto done_broad; } + outlen = (int)xdr_getpos(xdrs); + t_udata.opt.len = 0; t_udata.udata.buf = outbuf; - t_udata.udata.len = xdr_getpos(xdrs); + t_udata.udata.len = outlen; t_rdata.opt.len = 0; - xdr_destroy(xdrs); - -#ifdef PORTMAP - /* Prepare the packet for version 2 PORTMAP */ - if (pmap_flag) { - msg.rm_xid++; /* One way to distinguish */ - msg.rm_call.cb_prog = PMAPPROG; - msg.rm_call.cb_vers = PMAPVERS; - msg.rm_call.cb_proc = PMAPPROC_CALLIT; - barg_pmap.prog = prog; - barg_pmap.vers = vers; - barg_pmap.proc = proc; - barg_pmap.xdr_args = xargs; - barg_pmap.args_ptr = argsp; - bres_pmap.port_ptr = &port; - bres_pmap.xdr_results = xresults; - bres_pmap.results_ptr = resultsp; - xdrmem_create(xdrs, outbuf_pmap, udpbufsz, XDR_ENCODE); - if ((! xdr_callmsg(xdrs, &msg)) || - (! xdr_rmtcall_args(xdrs, &barg_pmap))) { - stat = RPC_CANTENCODEARGS; - goto done_broad; - } - t_udata_pmap.opt.len = 0; - t_udata_pmap.udata.buf = outbuf_pmap; - t_udata_pmap.udata.len = xdr_getpos(xdrs); - xdr_destroy(xdrs); - } -#endif /* PORTMAP */ /* - * Basic loop: broadcast the packets to transports which - * support data packets of size such that one can encode - * all the arguments. + * Basic loop: broadcast the packets to only those transports which + * support data packets of size such that one can encode all the + * arguments. * Wait a while for response(s). * The response timeout grows larger per iteration. */ - hs.h_host = HOST_BROADCAST; - hs.h_serv = "rpcbind"; - t.tv_usec = 0; for (t.tv_sec = 4; t.tv_sec <= 14; t.tv_sec += 2) { /* Broadcast all the packets now */ + int j; + for (i = 0; i < fdlistno; i++) { - struct nd_addrlist *addrlist; + int nets; - if (fdlist[i].dsize < t_udata.udata.len) { + if (fdlist[i].dsize < outlen) { stat = RPC_CANTSEND; continue; } - if (netdir_getbyname(fdlist[i].nconf, &hs, &addrlist) || - (addrlist->n_cnt == 0)) { - stat = RPC_N2AXLATEFAILURE; + nets = getbroadcastnets(fdlist[i].fd, addrs, fdlist[i].nconf); + if (nets == 0) { + stat = RPC_NOBROADCAST; continue; } - for (j = 0; j < addrlist->n_cnt; j++) { - t_udata.addr = addrlist->n_addrs[j]; - if (t_sndudata(fdlist[i].fd, &t_udata)) { - (void) syslog(LOG_ERR, - "Cannot send broadcast packet: %m"); -#ifdef DEBUG - t_error("rpc_broadcast: t_sndudata"); -#endif + for (j = 0; j < nets; j++) { +/* XXX Will go away with a decent getbroadcastnets */ + addrs[j].len = addrs[j].maxlen = fdlist[i].asize; +/* */ t_udata.addr = addrs[j]; + if (t_sndudata(fdlist[i].fd, &t_udata) != 0) { + (void) syslog(LOG_ERR, "Cannot send broadcast packet: %m"); + t_error("broadcast: t_sndudata"); stat = RPC_CANTSEND; continue; } @@ -331,45 +272,29 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, fprintf(stderr, "Broadcast packet sent for %s\n", fdlist[i].nconf->nc_netid); #endif -#ifdef PORTMAP - /* Send the version 2 packet also */ - if (fdlist[i].udpip) { - if (t_sndudata(fdlist[i].fd, &t_udata_pmap)) { - (void) syslog(LOG_ERR, - "Cannot send broadcast packet: %m"); -#ifdef DEBUG - t_error("rpc_broadcast: t_sndudata"); -#endif - stat = RPC_CANTSEND; - continue; - } - } -#ifdef DEBUG - fprintf(stderr, "PMAP Broadcast packet sent for %s\n", - fdlist[i].nconf->nc_netid); -#endif -#endif /* PORTMAP */ - } /* End for sending all packets on this transport */ - (void) netdir_free((char *)addrlist, ND_ADDRLIST); - } /* End for sending on all transports */ + } + } if (eachresult == NULL) { stat = RPC_SUCCESS; - goto done_broad; - } + goto done_broad;; + } /* * Get all the replies from these broadcast requests */ recv_again: + msg.acpted_rply.ar_verf = _null_auth; + msg.acpted_rply.ar_results.where = (caddr_t)&r; + msg.acpted_rply.ar_results.proc = xdr_rmtcallres; readfds = mask; - switch (select(_rpc_dtbsize(), &readfds, (fd_set *)NULL, - (fd_set *)NULL, &t)) { + (fd_set *)NULL, &t)) { case 0: /* timed out */ stat = RPC_TIMEDOUT; continue; + case -1: /* some kind of error */ if (errno == EINTR) goto recv_again; @@ -381,14 +306,10 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, t_rdata.udata.buf = inbuf; for (i = 0; i < fdlistno; i++) { - int flag; + int flag ; if (!FD_ISSET(fdlist[i].fd, &readfds)) continue; -#ifdef DEBUG - fprintf(stderr, "response for %s\n", - fdlist[i].nconf->nc_netid); -#endif try_again: t_rdata.udata.maxlen = fdlist[i].dsize; t_rdata.udata.len = 0; @@ -396,71 +317,46 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, if (t_rcvudata(fdlist[i].fd, &t_rdata, &flag) == -1) { if (errno == EINTR) goto try_again; - (void) syslog(LOG_ERR, - "Cannot receive reply to broadcast: %m"); + (void) syslog(LOG_ERR, "Cannot receive reply to broadcast: %m"); stat = RPC_CANTRECV; continue; } /* * Not taking care of flag for T_MORE. We are assuming that - * such calls should not take more than one transport packet. + * such calls should not take more than one packet. */ if (flag & T_MORE) continue; /* Drop that and go ahead */ - if (t_rdata.udata.len < sizeof (u_long)) + if (t_rdata.udata.len < sizeof(u_long)) continue; /* Drop that and go ahead */ /* * see if reply transaction id matches sent id. - * If so, decode the results. If return id is xid + 1, it was - * a PORTMAP reply + * If so, decode the results. */ - pmap_reply_flag = 0; - if (*((u_long *)(inbuf)) == *((u_long *)(outbuf))) { - msg.acpted_rply.ar_verf = _null_auth; - msg.acpted_rply.ar_results.where = (caddr_t)&bres; - msg.acpted_rply.ar_results.proc = xdr_rpcb_rmtcallres; -#ifdef PORTMAP - } else if (pmap_flag && - *((u_long *)(inbuf)) == *((u_long *)(outbuf_pmap))) { - pmap_reply_flag = 1; - msg.acpted_rply.ar_verf = _null_auth; - msg.acpted_rply.ar_results.where = (caddr_t)&bres_pmap; - msg.acpted_rply.ar_results.proc = xdr_rmtcallres; -#endif /* PORTMAP */ - } else - continue; - xdrmem_create(xdrs, inbuf, - (u_int)t_rdata.udata.len, XDR_DECODE); + xdrmem_create(xdrs, inbuf, (u_int)t_rdata.udata.len, XDR_DECODE); if (xdr_replymsg(xdrs, &msg)) { - if ((msg.rm_reply.rp_stat == MSG_ACCEPTED) && + if ((msg.rm_xid == xid) && + (msg.rm_reply.rp_stat == MSG_ACCEPTED) && (msg.acpted_rply.ar_stat == SUCCESS)) { - struct netbuf *taddr; -#ifdef PORTMAP - if (pmap_flag && pmap_reply_flag) { - /* convert port to taddr */ - ((struct sockaddr_in *)t_rdata.addr.buf)->sin_port = - htons((u_short)port); - taddr = &t_rdata.addr; - } else /* Convert the uaddr to taddr */ -#endif - taddr = uaddr2taddr(fdlist[i].nconf, uaddrp); - done = (*eachresult)(resultsp, taddr, - fdlist[i].nconf); #ifdef DEBUG - { int k; - printf("rmt addr = "); - for (k = 0; k < taddr->len; k++) - printf("%d ", taddr->buf[k]); - printf("\n"); - } + for (k = 0; k < t_rdata.addr.len; k++) + fprintf(stderr, "%d ", t_rdata.addr.buf[k]); + fprintf(stderr, "\n"); #endif - if (taddr && !pmap_reply_flag) - netdir_free((char *)taddr, ND_ADDR); + done = (*eachresult)(resultsp, &t_rdata.addr, + fdlist[i].nconf); } /* otherwise, we just ignore the errors ... */ - } /* else some kind of deserialization problem ... */ + } else { +#ifdef notdef + /* some kind of deserialization problem ... */ + if (msg.rm_xid == xid) + (void) syslog(LOG_ERR, "Broadcast deserialization problem"); + /* otherwise, just random garbage */ +#endif + } xdrs->x_op = XDR_FREE; msg.acpted_rply.ar_results.proc = xdr_void; (void) xdr_replymsg(xdrs, &msg); @@ -480,10 +376,6 @@ rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, (void) free(inbuf); if (outbuf) (void) free(outbuf); -#ifdef PORTMAP - if (outbuf_pmap) - (void) free(outbuf_pmap); -#endif for (i = 0; i < fdlistno; i++) { (void) t_close(fdlist[i].fd); (void) free(fdlist[i].raddr.buf); diff --git a/usr/src/lib/libnsl/rpc/clnt_generic.c b/usr/src/lib/libnsl/rpc/clnt_generic.c index 0f885a7..e52647c 100644 --- a/usr/src/lib/libnsl/rpc/clnt_generic.c +++ b/usr/src/lib/libnsl/rpc/clnt_generic.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:clnt_generic.c 1.3" +#ident "@(#)librpc:clnt_generic.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -43,8 +43,8 @@ static char sccsid[] = "@(#)clnt_generic.c 1.32 89/03/16 Copyr 1988 Sun Micro"; extern int errno; extern int t_errno; + extern char *strdup(); -extern char *malloc(); /* * Top level client creation routine. @@ -71,6 +71,7 @@ clnt_create(hostname, prog, vers, nettype) int net; if ((net = _rpc_setconf(nettype)) == 0) { + printf("CLNT_GENERIC, _rpc_setconf failed\n"); rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; return ((CLIENT *)NULL); } @@ -78,6 +79,7 @@ clnt_create(hostname, prog, vers, nettype) while (clnt == (CLIENT *)NULL) { if ((nconf = _rpc_getconf(net)) == (struct netconfig *)NULL) { if (rpc_createerr.cf_stat == RPC_SUCCESS) + printf("CLNT_GENERIC, _rpc_getconf failed\n"); rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; break; } @@ -108,6 +110,7 @@ clnt_tp_create(hostname, prog, vers, nconf) int fd; /* end point descriptor */ if (nconf == (struct netconfig *)NULL) { + printf("CLNT_GENERIC, nconf NULL\n"); rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; return ((CLIENT *)NULL); } @@ -172,6 +175,7 @@ clnt_tli_create(fd, nconf, svcaddr, prog, vers, sendsz, recvsz) if (fd == RPC_ANYFD) { if (nconf == (struct netconfig *)NULL) { + printf("CLNT_GENERIC, nconf NULL\n"); rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; return ((CLIENT *)NULL); } diff --git a/usr/src/lib/libnsl/rpc/clnt_perror.c b/usr/src/lib/libnsl/rpc/clnt_perror.c index 3cc0346..4bbc952 100644 --- a/usr/src/lib/libnsl/rpc/clnt_perror.c +++ b/usr/src/lib/libnsl/rpc/clnt_perror.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:clnt_perror.c 1.3" +#ident "@(#)librpc:clnt_perror.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -37,7 +37,6 @@ static char sccsid[] = "@(#)clnt_perror.c 1.31 89/03/31 Copyr 1984 Sun Micro"; */ #ifndef KERNEL #include -#include #endif #include @@ -45,6 +44,7 @@ static char sccsid[] = "@(#)clnt_perror.c 1.31 89/03/31 Copyr 1984 Sun Micro"; #include #ifndef KERNEL +extern char *sys_errlist[]; extern char *t_errlist[]; extern char *malloc(); extern int t_nerr; @@ -142,7 +142,7 @@ clnt_sperror(cl, s) (void) sprintf(str, "; %s", t_errlist[e.re_terrno]); str += strlen(str); if (e.re_errno) { - (void) sprintf(str, "; %s", strerror(e.re_errno)); + (void) sprintf(str, "; %s", sys_errlist[e.re_errno]); str += strlen(str); } break; @@ -150,7 +150,7 @@ clnt_sperror(cl, s) case RPC_CANTSEND: case RPC_CANTRECV: if (e.re_errno) { - (void) sprintf(str, "; errno = %s", strerror(e.re_errno)); + (void) sprintf(str, "; errno = %s", sys_errlist[e.re_errno]); str += strlen(str); } if (e.re_terrno) { @@ -216,7 +216,8 @@ char * clnt_spcreateerror(s) char *s; { - extern int _sys_num_err; + extern int sys_nerr; + extern char *sys_errlist[]; char *str = _buf(); if (str == NULL) @@ -239,9 +240,9 @@ clnt_spcreateerror(s) case RPC_SYSTEMERROR: (void) strcat(str, " - "); if (rpc_createerr.cf_error.re_errno > 0 - && rpc_createerr.cf_error.re_errno < _sys_num_err) + && rpc_createerr.cf_error.re_errno < sys_nerr) (void) strcat(str, - strerror(rpc_createerr.cf_error.re_errno)); + sys_errlist[rpc_createerr.cf_error.re_errno]); else (void) sprintf(&str[strlen(str)], "Error %d", rpc_createerr.cf_error.re_errno); @@ -256,9 +257,9 @@ clnt_spcreateerror(s) (void) sprintf(&str[strlen(str)], "TLI Error %d", rpc_createerr.cf_error.re_terrno); if (rpc_createerr.cf_error.re_errno > 0) { - if (rpc_createerr.cf_error.re_errno < _sys_num_err) + if (rpc_createerr.cf_error.re_errno < sys_nerr) (void) strcat(str, - strerror(rpc_createerr.cf_error.re_errno)); + sys_errlist[rpc_createerr.cf_error.re_errno]); else (void) sprintf(&str[strlen(str)], "Error %d", rpc_createerr.cf_error.re_terrno); diff --git a/usr/src/lib/libnsl/rpc/clnt_raw.c b/usr/src/lib/libnsl/rpc/clnt_raw.c index 65cf7bc..952bd4c 100644 --- a/usr/src/lib/libnsl/rpc/clnt_raw.c +++ b/usr/src/lib/libnsl/rpc/clnt_raw.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:clnt_raw.c 1.3" +#ident "@(#)librpc:clnt_raw.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -59,14 +59,15 @@ static char sccsid[] = "@(#)clnt_raw.c 1.34 89/02/28 Copyr 1984 Sun Micro"; static struct clnt_raw_private { CLIENT client_object; XDR xdr_stream; - char *raw_buf; /* should be shared with server handle */ + char *_raw_buf; /* should be shared with server handle */ char mashl_callmsg[MCALL_MSG_SIZE]; u_int mcnt; } *clnt_raw_private; static struct clnt_ops *clnt_raw_ops(); -extern char *calloc(); +void svc_getreq(); +char *calloc(); /* * Create a client handle for memory based rpc. @@ -87,7 +88,7 @@ clnt_raw_create(prog, vers) return ((CLIENT *)NULL); if (_rawcombuf == NULL) _rawcombuf = (char *)calloc(UDPMSGSIZE, sizeof(char)); - clp->raw_buf = _rawcombuf; /* Share it with the server */ + clp->_raw_buf = _rawcombuf; /* Share it with the server */ clnt_raw_private = clp; } xdrs = &clp->xdr_stream; @@ -110,7 +111,7 @@ clnt_raw_create(prog, vers) /* * Set xdrmem for client/server shared buffer */ - xdrmem_create(xdrs, clp->raw_buf, UDPMSGSIZE, XDR_FREE); + xdrmem_create(xdrs, clp->_raw_buf, UDPMSGSIZE, XDR_FREE); /* * create client handle @@ -144,7 +145,7 @@ clnt_raw_call(h, proc, xargs, argsp, xresults, resultsp, timeout) */ xdrs->x_op = XDR_ENCODE; XDR_SETPOS(xdrs, 0); - ((struct rpc_msg *)clp->mashl_callmsg)->rm_xid++ ; + ((struct rpc_msg *)clp->mashl_callmsg)->rm_xid ++ ; if ((! XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) || (! XDR_PUTLONG(xdrs, (long *)&proc)) || (! AUTH_MARSHALL(h->cl_auth, xdrs)) || diff --git a/usr/src/lib/libnsl/rpc/clnt_vc.c b/usr/src/lib/libnsl/rpc/clnt_vc.c index 061c234..c771080 100644 --- a/usr/src/lib/libnsl/rpc/clnt_vc.c +++ b/usr/src/lib/libnsl/rpc/clnt_vc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:clnt_vc.c 1.3" +#ident "@(#)librpc:clnt_vc.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -64,7 +64,6 @@ static char sccsid[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro"; extern int errno; extern int t_errno; -extern char *malloc(); static struct clnt_ops *clnt_vc_ops(); static int read_vc(); diff --git a/usr/src/lib/libnsl/rpc/getdname.c b/usr/src/lib/libnsl/rpc/getdname.c index a6200e3..3da0acc 100644 --- a/usr/src/lib/libnsl/rpc/getdname.c +++ b/usr/src/lib/libnsl/rpc/getdname.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:getdname.c 1.7" +#ident "@(#)librpc:getdname.c 1.4" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -42,12 +42,7 @@ static char sccsid[] = "@(#)getdname.c 1.5 89/04/18 Copyr 1989 Sun Micro"; #include #include -#ifdef _NSL_RPC_ABI -/* For internal use only when building the libnsl RPC routines */ -#define sysinfo _abi_sysinfo -#endif - -#ifndef SI_SRPC_DOMAIN +#ifndef SI_GET_INET_DOMAIN #define use_file #endif @@ -95,7 +90,7 @@ getdomainname(name, namelen) (void) strncpy(name, line, namelen); return (0); #else - int sysinfostatus = sysinfo(SI_SRPC_DOMAIN, name, namelen); + int sysinfostatus = sysinfo(SI_GET_INET_DOMAIN, name, namelen); return ((sysinfostatus < 0) ? -1 : 0); #endif @@ -115,7 +110,7 @@ setdomainname(domain, len) fclose(domain_fd); return(0); #else - int sysinfostatus = sysinfo(SI_SET_SRPC_DOMAIN, domain, len + 1); /*add null*/ + int sysinfostatus = sysinfo(SI_SET_INET_DOMAIN, domain, len + 1); /*add null*/ return ((sysinfostatus < 0) ? -1 : 0); #endif diff --git a/usr/src/lib/libnsl/rpc/gthostnamadr.c b/usr/src/lib/libnsl/rpc/gthostnamadr.c index f34b4ed..cc90f2e 100644 --- a/usr/src/lib/libnsl/rpc/gthostnamadr.c +++ b/usr/src/lib/libnsl/rpc/gthostnamadr.c @@ -5,7 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libnsl:rpc/gthostnamadr.c 1.5" + +#ident "@(#)libnsl:rpc/gthostnamadr.c 1.2" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -52,8 +53,6 @@ static char *host_addrs[2]; int h_errno; -static int strcasecmp(), strncasecmp(); - /* * The following is shared with gethostent.c */ @@ -109,7 +108,15 @@ gethostbyname(nam) #ifdef havdndbm datum key; #endif + char lowname[128]; + register char *lp = lowname; + while (*nam) + if (isupper(*nam)) + *lp++ = tolower(*nam++); + else + *lp++ = *nam++; + *lp = '\0'; #ifdef havdndbm if ((_host_db == (DBM *)NULL) @@ -117,10 +124,10 @@ gethostbyname(nam) #endif sethostent(_host_stayopen); while (hp = gethostent()) { - if (strcasecmp(hp->h_name, nam) == 0) + if (strcmp(hp->h_name, lowname) == 0) break; for (cp = hp->h_aliases; cp != 0 && *cp != 0; cp++) - if (strcasecmp(*cp, nam) == 0) + if (strcmp(*cp, lowname) == 0) goto found; } found: @@ -129,8 +136,8 @@ gethostbyname(nam) return (hp); #ifdef havdndbm } - key.dptr = nam; - key.dsize = strlen(nam); + key.dptr = lowname; + key.dsize = strlen(lowname); hp = fetchhost(key); if (!_host_stayopen) { dbm_close(_host_db); @@ -197,69 +204,3 @@ int type; return ((struct hostent *) 0); } #endif - - -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static char charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -static -strcasecmp(s1, s2) - register char *s1, *s2; -{ - register char *cm = charmap; - - while (cm[*s1] == cm[*s2++]) - if (*s1++ == '\0') - return(0); - return(cm[*s1] - cm[*--s2]); -} - -static -strncasecmp(s1, s2, n) - register char *s1, *s2; - register int n; -{ - register char *cm = charmap; - - while (--n >= 0 && cm[*s1] == cm[*s2++]) - if (*s1++ == '\0') - return(0); - return(n < 0 ? 0 : cm[*s1] - cm[*--s2]); -} diff --git a/usr/src/lib/libnsl/rpc/key_call.c b/usr/src/lib/libnsl/rpc/key_call.c index aa2c75f..0dfaff1 100644 --- a/usr/src/lib/libnsl/rpc/key_call.c +++ b/usr/src/lib/libnsl/rpc/key_call.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpc:key_call.c 1.4" +#ident "@(#)librpc:key_call.c 1.3" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -28,6 +27,11 @@ * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ + +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)key_call.c 1.14 89/05/02 Copyr 1986 Sun Micro"; +#endif + /* * key_call.c, Interface to keyserver * @@ -42,7 +46,6 @@ #include #include #include -#include #define KEY_TIMEOUT 5 /* per-try timeout in seconds */ #define KEY_NRETRY 12 /* number of retries */ @@ -123,7 +126,6 @@ key_gendes(key) return (0); } -/*returns 0 on failure 1 on success*/ static key_call(proc, xdr_arg, arg, xdr_rslt, rslt) u_long proc; @@ -132,43 +134,75 @@ key_call(proc, xdr_arg, arg, xdr_rslt, rslt) bool_t (*xdr_rslt)(); char *rslt; { + XDR xdrargs; + XDR xdrrslt; + FILE *fargs; + FILE *frslt; + void (*osigchild)(); +#ifdef WEXITSTATUS + int status; +#else + union wait status; +#endif + pid_t wpid; + pid_t pid; int success; - void *localhandle; - struct netconfig *nconf; - CLIENT *clnt = NULL; - struct timeval wait_time; - -#define TOTAL_TIMEOUT 30 /* total timeout talking to keyserver */ -#define TOTAL_TRIES 5 /* Number of tries */ - - - - if (!(localhandle = setnetconfig())) - return (0); - while (nconf = getnetconfig(localhandle)) { - if (strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0) { - clnt = clnt_tp_create(_rpc_gethostname(), - KEY_PROG, KEY_VERS, nconf); - if (clnt) break; - } - } - endnetconfig(localhandle); - - if (clnt == NULL) return (0); - - clnt->cl_auth = authsys_create("", geteuid(), 0, 0, NULL); - if (clnt->cl_auth == NULL) return (0); - - wait_time.tv_sec = TOTAL_TIMEOUT/TOTAL_TRIES; - wait_time.tv_usec = 0; - (void) clnt_control(clnt, CLSET_RETRY_TIMEOUT, &wait_time); + uid_t ruid; + uid_t euid; + + success = 1; + osigchild = signal(SIGCHLD, SIG_DFL); + /* This MUST not be SIG_IGN under SYSV */ + + /* + * We are going to exec a set-uid program which makes our effective uid + * zero, and authenticates us with our real uid. We need to make the + * effective uid be the real uid for the setuid program, and + * the real uid be the effective uid so that we can change things back. + */ + euid = geteuid(); + ruid = getuid(); + /*(void) setreuid(euid, ruid);*/ + if (euid != ruid) + (void) setuid(euid); /*eff ->real*/ /*dubious if it works*/ + pid = _rpc_openchild(MESSENGER, &fargs, &frslt); + if (euid != ruid) + (void) setuid(ruid); /*restore real*/ + /*(void) setreuid(ruid, euid);*/ + if (pid < 0) { + debug("open_streams"); + return (0); + } + xdrstdio_create(&xdrargs, fargs, XDR_ENCODE); + xdrstdio_create(&xdrrslt, frslt, XDR_DECODE); - wait_time.tv_sec = TOTAL_TIMEOUT; - wait_time.tv_usec = 0; + if (!xdr_u_long(&xdrargs, &proc) || !(*xdr_arg)(&xdrargs, arg)) { + debug("xdr args"); + success = 0; + } + (void) fclose(fargs); + if (success && !(*xdr_rslt)(&xdrrslt, rslt)) { +#ifdef DEBUG + perror("xdr rslt"); +#endif + success = 0; + } - if (CLNT_CALL(clnt, proc, xdr_arg, arg, xdr_rslt, rslt, wait_time) - == RPC_SUCCESS) return (1); - else return (0); + (void) fclose(frslt); + while (((wpid = wait(&status)) != pid) && (wpid != -1)); + if (wpid < 0 || +#ifdef WEXITSTATUS + WEXITSTATUS(status)) { +#else + (status.w_retcode)) { +#endif +#ifdef DEBUG + fprintf(stderr, "wait: %d %d %x\n", wpid, pid, status); +#endif + success = 0; + } + (void) signal(SIGCHLD, osigchild); + return (success); } diff --git a/usr/src/lib/libnsl/rpc/netnamer.c b/usr/src/lib/libnsl/rpc/netnamer.c index b5af3dd..4e28274 100644 --- a/usr/src/lib/libnsl/rpc/netnamer.c +++ b/usr/src/lib/libnsl/rpc/netnamer.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpc:netnamer.c 1.3" +#ident "@(#)librpc:netnamer.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -19,19 +18,18 @@ * * * -* Copyright Notice +* Copyright Notice * -* Notice of copyright on this source code product does not indicate +* Notice of copyright on this source code product does not indicate * publication. * * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. -*/ +*/ #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)netnamer.c 1.4 89/03/20 Copyr 1986 Sun Micro"; #endif - /* * netname utility routines convert from unix names to network names and * vice-versa This module is operating system dependent! What we define here @@ -51,28 +49,28 @@ static char *NETID = "netid.byname"; static char *NETIDFILE = "/etc/netid"; #ifndef NGROUPS -#define NGROUPS 16 +#define NGROUPS 16 #endif /* * Convert network-name into unix credential */ netname2user(netname, uidp, gidp, gidlenp, gidlist) - char netname[MAXNETNAMELEN + 1]; - uid_t *uidp; - gid_t *gidp; - int *gidlenp; - gid_t *gidlist; + char netname[MAXNETNAMELEN + 1]; + uid_t *uidp; + gid_t *gidp; + int *gidlenp; + gid_t *gidlist; { - char *p; - int gidlen; - uid_t uid; - struct passwd *pwd; - char val[1024]; - char *val1, *val2; - char *domain; - int vallen; - int err; + char *p; + int gidlen; + uid_t uid; + struct passwd *pwd; + char val[1024]; + char *val1, *val2; + char *domain; + int vallen; + int err; if (getnetid(netname, val)) { p = strtok(val, ":"); @@ -98,8 +96,7 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist) val1 = strchr(netname, '.'); if (val1 == NULL) return (0); - if (strncmp(netname, OPSYS, (val1-netname))) - return (0); + if (strncmp(netname,OPSYS,(val1-netname))) return(0); val1++; val2 = strchr(val1, '@'); if (val2 == NULL) @@ -132,18 +129,18 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist) /* * initgroups */ -struct group *getgrent(); +struct group *getgrent(); static getgroups(uname, groups) - char *uname; - int groups[NGROUPS]; + char *uname; + int groups[NGROUPS]; { - gid_t ngroups = 0; + gid_t ngroups = 0; register struct group *grp; - register int i; - register int j; - int filter; + register int i; + register int j; + int filter; setgrent(); while (grp = getgrent()) { @@ -152,7 +149,7 @@ getgroups(uname, groups) if (ngroups == NGROUPS) { #ifdef DEBUG fprintf(stderr, - "initgroups: %s is in too many groups\n", uname); + "initgroups: %s is in too many groups\n", uname); #endif goto toomany; } @@ -176,16 +173,16 @@ getgroups(uname, groups) * Convert network-name to hostname */ netname2host(netname, hostname, hostlen) - char netname[MAXNETNAMELEN + 1]; - char *hostname; - int hostlen; + char netname[MAXNETNAMELEN + 1]; + char *hostname; + int hostlen; { - int err; - char valbuf[1024]; - char *val; - char *val2; - int vallen; - char *domain; + int err; + char valbuf[1024]; + char *val; + char *val2; + int vallen; + char *domain; if (getnetid(netname, valbuf)) { val = valbuf; @@ -198,7 +195,7 @@ netname2host(netname, hostname, hostlen) if (val == NULL) return (0); if (strncmp(netname, OPSYS, (val - netname))) - return (0); + return(0); val++; val2 = strchr(val, '@'); if (val2 == NULL) @@ -225,21 +222,21 @@ netname2host(netname, hostname, hostlen) */ int getnetid(key, ret) - char *key, *ret; + char *key, *ret; { - char buf[1024]; /* big enough */ - char *res; - char *mkey; - char *mval; - char *domain; - int err; - char *lookup; - int len; - FILE *fd; + char buf[1024]; /* big enough */ + char *res; + char *mkey; + char *mval; + char *domain; + int err; + char *lookup; + int len; + FILE *fd; fd = fopen(NETIDFILE, "r"); if (fd == (FILE *) 0) { -#ifdef YP +#ifdef TRYYP res = "+"; goto getnetidyp; #else @@ -257,15 +254,14 @@ getnetid(key, ret) if (res[0] == '#') continue; else if (res[0] == '+') { -#ifdef YP +#ifdef TRYYP getnetidyp: err = yp_get_default_domain(&domain); if (err) { continue; } lookup = NULL; - err = yp_match(domain, NETID, key, - strlen(key), &lookup, &len); + err = yp_match(domain, NETID, key, strlen(key), &lookup, &len); if (err) { #ifdef DEBUG fprintf(stderr, "match failed error %d\n", err); @@ -277,25 +273,21 @@ getnetid(key, ret) free(lookup); fclose(fd); return (2); -#else /* YP */ +#else #ifdef DEBUG - fprintf(stderr, -"Bad record in %s '+' -- yp not supported in this library copy\n", - NETIDFILE); + fprintf(stderr, "Bad record in %s '+' -- yp not supported in this library copy\n", NETIDFILE); #endif continue; -#endif /* YP */ +#endif } else { mkey = strtok(buf, "\t "); if (mkey == NULL) { - fprintf(stderr, - "Bad record in %s -- %s", NETIDFILE, buf); + fprintf(stderr, "Bad record in %s -- %s", NETIDFILE, buf); continue; } mval = strtok(NULL, " \t#\n"); if (mval == NULL) { - fprintf(stderr, - "Bad record in %s val problem - %s", NETIDFILE, buf); + fprintf(stderr, "Bad record in %s val problem - %s", NETIDFILE, buf); continue; } if (strcmp(mkey, key) == 0) { diff --git a/usr/src/lib/libnsl/rpc/rpc.mk b/usr/src/lib/libnsl/rpc/rpc.mk index 92988c3..a27e6eb 100644 --- a/usr/src/lib/libnsl/rpc/rpc.mk +++ b/usr/src/lib/libnsl/rpc/rpc.mk @@ -6,7 +6,7 @@ # actual or intended publication of such source code. -#ident "@(#)librpc:librpc.mk 1.9.1.12" +#ident "@(#)librpc:librpc.mk 1.9.1.8" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # PROPRIETARY NOTICE (Combined) @@ -34,6 +34,9 @@ # Kernel level sources are missing here. Only USER # level rpc sources here # +# Sources missing as of now: +# xdr_float.c\ #because xdr_float is processor specific +# # Sources deleted because of duplicate or obsolete functionality # clnt_udp.c\ clnt_tcp.c # get_myaddress.c\ @@ -62,6 +65,7 @@ # svc_generic.c\ : All the new interface routines for svc side # # Sources in the compatibility package +# clnt_bsoc.c\ # clnt_soc.h # dbx_rpc.c\ # pmap_clnt.c\ @@ -78,6 +82,12 @@ # svcdesname.c\ # svc_authdes.c\ # +# Sources in transient package. +# getdname.o +# syslog.c\ +# port.c\ +# gethostname.c\ +# # Headers included in component head.usrs: # HDRS = auth.h auth_des.h auth_unix.h auth_sys.h clnt.h clnt_soc.h \ # keyprot.h \ @@ -92,7 +102,7 @@ STRIP = strip SIZE = size INS = install INC = $(ROOT)/usr/include -CPPFLAGS = -O -Kpic -I$(INC) -DPORTMAP -D_NSL_RPC_ABI +CPPFLAGS = -O -Kpic -I$(INC) -DPORTMAP CFLAGS = $(CPPFLAGS) HDRS = auth.h auth_des.h auth_sys.h auth_unix.h clnt.h clnt_soc.h \ @@ -108,8 +118,9 @@ SECOBJS=auth_des.o authdes_prot.o getdname.o key_prot.o key_call.o \ INETOBJS=gthostnamadr.o gethostent.o inet_ntoa.o OBJS = $(SECOBJS) $(INETOBJS) auth_none.o auth_sys.o authsys_prot.o \ + clnt_bcast.o clnt_bsoc.o clnt_generic.o clnt_dg.o clnt_vc.o \ clnt_perror.o clnt_raw.o clnt_simple.o \ - clnt_dg.o clnt_vc.o clnt_generic.o clnt_bcast.o getdname.o \ + getdname.o \ gethostname.o getrpcent.o \ pmap_clnt.o pmap_prot.o port.o \ rpc_callmsg.o rpc_comdata.o rpcdname.o\ @@ -124,7 +135,7 @@ LIBOBJS= ../auth_des.o ../authdes_prot.o ../getdname.o ../key_prot.o ../key_call ../netname.o ../netnamer.o ../openchild.o ../rpcdname.o ../rtime_tli.o \ ../svcauth_des.o ../svcdesname.o \ ../auth_none.o ../auth_sys.o ../authsys_prot.o \ - ../clnt_bcast.o ../clnt_generic.o \ + ../clnt_bcast.o ../clnt_bsoc.o ../clnt_generic.o \ ../clnt_dg.o ../clnt_vc.o \ ../clnt_perror.o ../clnt_raw.o ../clnt_simple.o \ ../getdname.o \ @@ -203,6 +214,14 @@ clnt_bcast.o: clnt_bcast.c\ $(INC)/stdio.h\ $(INC)/errno.h +clnt_bsoc.o: clnt_bsoc.c\ + $(INC)/rpc/rpc.h\ + $(INC)/rpc/nettype.h\ + $(INC)/rpc/pmap_prot.h\ + $(INC)/stdio.h\ + $(INC)/errno.h\ + $(INC)/netinet/in.h + clnt_dg.o: clnt_dg.c\ $(INC)/rpc/rpc.h\ $(INC)/errno.h diff --git a/usr/src/lib/libnsl/rpc/rpc_generic.c b/usr/src/lib/libnsl/rpc/rpc_generic.c index 6afefc3..18f3411 100644 --- a/usr/src/lib/libnsl/rpc/rpc_generic.c +++ b/usr/src/lib/libnsl/rpc/rpc_generic.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:rpc_generic.c 1.11" +#ident "@(#)librpc:rpc_generic.c 1.10" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -73,10 +73,12 @@ int _rpc_dtbsize() { struct rlimit rl; + int retval = 64; - if ( getrlimit(RLIMIT_NOFILE, &rl) == 0 ) - return(rl.rlim_max); +/* if ( getrlimit(RLIMIT_NOFILE, &rl) == 0 ) */ +/* return(rl.rlim_max); */ + return(retval); } /* diff --git a/usr/src/lib/libnsl/rpc/rpcb_clnt.c b/usr/src/lib/libnsl/rpc/rpcb_clnt.c index de5afc2..3c81b4d 100644 --- a/usr/src/lib/libnsl/rpc/rpcb_clnt.c +++ b/usr/src/lib/libnsl/rpc/rpcb_clnt.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpc:rpcb_clnt.c 1.8" +#ident "@(#)librpc:rpcb_clnt.c 1.4" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -19,9 +18,9 @@ * * * -* Copyright Notice +* Copyright Notice * -* Notice of copyright on this source code product does not indicate +* Notice of copyright on this source code product does not indicate * publication. * * (c) 1986,1987,1988.1989 Sun Microsystems, Inc @@ -57,7 +56,7 @@ static struct timeval rmttimeout = { 3, 0 }; extern int errno; extern int t_errno; -extern char *strdup(), *malloc(); +extern char *strdup(), *calloc(); static char nullstring[] = "\000"; @@ -88,7 +87,7 @@ getclnthandle(host, nconf) rpcbind_hs.h_serv = "rpcbind"; #ifdef ND_DEBUG fprintf(stderr, "rpcbind client routines: diagnostics :\n"); - fprintf(stderr, "\tGetting address for (%s, %s, %s) ... \n", + fprintf(stderr, " Getting address for (%s,%s,%s) ... \n", rpcbind_hs.h_host, rpcbind_hs.h_serv, nconf->nc_netid); #endif @@ -114,9 +113,9 @@ getclnthandle(host, nconf) { int i; - fprintf(stderr, "\tnetbuf len = %d, maxlen = %d\n", + fprintf(stderr, " netbuf len = %d, maxlen = %d\n", addr->len, addr->maxlen); - fprintf(stderr, "\tAddress is"); + fprintf(stderr, " Address is"); for (i = 0; i < addr->len; i++) fprintf(stderr, "%ud.", addr->buf[i]); fprintf(stderr, "\n"); @@ -124,7 +123,7 @@ getclnthandle(host, nconf) #endif client = clnt_tli_create(fd, nconf, addr, RPCBPROG, RPCBVERS, 0, 0); - if (! client) { + if (! client ) { #ifdef ND_DEBUG fprintf(stderr, "rpcbind clnt interface:"); clnt_pcreateerror(); @@ -132,7 +131,10 @@ getclnthandle(host, nconf) t_close(fd); } else { /* close the fd when we destroy the handle */ - CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL); + CLNT_CONTROL(client, CLSET_FD_CLOSE, NULL); +#ifdef ND_DEBUG + fprintf(stderr, "rpcb_clnt : returned connection to rpcbind.\n"); +#endif } netdir_free((char *)nas, ND_ADDRLIST); return (client); @@ -187,7 +189,7 @@ local_rpcb() return (client); } /* - * Set a mapping between program, version and address. + * Set a mapping between program,version and address. * Calls the rpcbind service remotely to do the mapping. */ bool_t @@ -200,7 +202,6 @@ rpcb_set(program, version, nconf, address) register CLIENT *client; bool_t rslt = FALSE; RPCB parms; - char uidbuf[32]; /* parameter checking */ if (nconf == (struct netconfig *)NULL) { @@ -212,7 +213,7 @@ rpcb_set(program, version, nconf, address) return (FALSE); } client = local_rpcb(); - if (! client) + if (! client ) return (FALSE); parms.r_addr = taddr2uaddr(nconf, address); /* convert to universal */ @@ -223,19 +224,17 @@ rpcb_set(program, version, nconf, address) parms.r_prog = program; parms.r_vers = version; parms.r_netid = nconf->nc_netid; - (void) sprintf(uidbuf, "%d", geteuid()); - parms.r_owner = uidbuf; CLNT_CALL(client, RPCBPROC_SET, xdr_rpcb, &parms, xdr_bool, &rslt, tottimeout); - + CLNT_DESTROY(client); free(parms.r_addr); return (rslt); } /* - * Remove the mapping between program, version and netbuf address. + * Remove the mapping between program,version and netbuf address. * Calls the rpcbind service to do the un-mapping. * If netbuf is NULL, unset for all the transports, otherwise unset * only for the given transport. @@ -249,11 +248,10 @@ rpcb_unset(program, version, nconf) register CLIENT *client; bool_t rslt = FALSE; RPCB parms; - char uidbuf[32]; client = local_rpcb(); - if (! client) + if (! client ) return (FALSE); parms.r_prog = program; @@ -261,20 +259,18 @@ rpcb_unset(program, version, nconf) if (nconf) parms.r_netid = nconf->nc_netid; else - parms.r_netid = nullstring; /* unsets all*/ + parms.r_netid = NULL; /* This unsets all of them */ parms.r_addr = nullstring; - (void) sprintf(uidbuf, "%d", geteuid()); - parms.r_owner = uidbuf; CLNT_CALL(client, RPCBPROC_UNSET, xdr_rpcb, &parms, xdr_bool, &rslt, tottimeout); - + CLNT_DESTROY(client); return (rslt); } /* - * Find the mapped address for program, version. + * Find the mapped address for program,version. * Calls the rpcbind service remotely to do the lookup. * Uses the transport specified in nconf. * Returns FALSE (0) if no map exists, else returns 1. @@ -314,7 +310,6 @@ rpcb_getaddr(program, version, nconf, address, host) parms.r_vers = version; parms.r_netid = nconf->nc_netid; /* not needed */ parms.r_addr = nullstring; /* not needed; just for xdring */ - parms.r_owner = nullstring; /* not needed; just for xdring */ ua = uaddress; clnt_st = CLNT_CALL(client, RPCBPROC_GETADDR, xdr_rpcb, &parms, @@ -328,9 +323,9 @@ rpcb_getaddr(program, version, nconf, address, host) na = uaddr2taddr(nconf, uaddress); #ifdef ND_DEBUG - fprintf(stderr, "\tRemote address is [%s].\n", uaddress); - if (!na) - fprintf(stderr, "\tCouldn't resolve remote address!\n"); + fprintf(stderr, " Remote address is [%s].\n", uaddress); + if (!na) + fprintf(stderr, " Couldn't resolve remote address!\n"); #endif if (! na) { /* We don't know about your universal address */ @@ -353,13 +348,12 @@ rpcb_getaddr(program, version, nconf, address, host) * rpcbind/portmapper do not return PROGVERSMISMATCH because * of svc_versquiet, and hence this */ - if (((clnt_st == RPC_PROGVERSMISMATCH) || - (clnt_st == RPC_PROGUNAVAIL)) && - (strcmp(nconf->nc_protofmly, NC_INET) == 0)) { + if (((clnt_st == RPC_PROGVERSMISMATCH) || (clnt_st == RPC_PROGUNAVAIL)) + && (strcmp(nconf->nc_protofmly, NC_INET) == 0)) { /* * version 3 not available. Try version 2 - * The assumption here is that the netbuf - * is arranged in the sockaddr_in + * XXX: The assumption here is + * that the netbuf is arranged in the sockaddr_in * style for IP cases. */ u_short port; @@ -370,12 +364,11 @@ rpcb_getaddr(program, version, nconf, address, host) protocol = strcmp(nconf->nc_proto, NC_TCP) ? IPPROTO_UDP : IPPROTO_TCP; port = (u_short)pmap_getport((struct sockaddr_in *)remote.buf, - program, version, protocol); + program, version, protocol); if (port && (address->maxlen <= remote.len)) { - memcpy(address->buf, remote.buf, - remote.len); - memcpy((char *)&address->buf[sizeof (short)], - (char *)&port, sizeof (short)); + memcpy(address->buf, remote.buf, remote.len); + memcpy((char *)&address->buf[sizeof(short)], + (char *)&port, sizeof(short)); address->len = remote.len; } else { rpc_createerr.cf_stat = RPC_PMAPFAILURE; @@ -399,11 +392,12 @@ rpcb_getaddr(program, version, nconf, address, host) } error: CLNT_DESTROY(client); -#ifdef ND_DEBUG +#ifdef ND_DEBUG if (status) - fprintf(stderr, "\tSUCCESS.\n"); + fprintf(stderr, " SUCCESS.\n"); else - fprintf(stderr, "\tFAILED.\n"); + fprintf(stderr, " FAILED.\n"); + fprintf(stderr, "rpcb_clnt (getaddr) : End diagnostics.\n"); #endif return (status); } @@ -423,7 +417,8 @@ rpcb_getmaps(nconf, host) RPCBLIST *head = (RPCBLIST *)NULL; register CLIENT *client; - client = getclnthandle(host, nconf); + /* Here one can safely call higher level rpc routines */ + client = clnt_tp_create(host, RPCBPROG, RPCBVERS, nconf); if (client != (CLIENT *)NULL) { if (CLNT_CALL(client, RPCBPROC_DUMP, xdr_void, NULL, xdr_rpcblist, &head, tottimeout) != RPC_SUCCESS) { @@ -457,13 +452,13 @@ rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp, enum clnt_stat stat = RPC_FAILED; struct netbuf *na = NULL; - client = getclnthandle(host, nconf); + client = clnt_tp_create(host, RPCBPROG, RPCBVERS, nconf); if (client != (CLIENT *)NULL) { struct rpcb_rmtcallargs a; struct rpcb_rmtcallres r; char addrbuf[1024]; /* should be enough for all addresses */ - CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, &rmttimeout); + CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, rmttimeout); a.prog = prog; a.vers = vers; a.proc = proc; @@ -478,12 +473,13 @@ rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp, if (stat == RPC_SUCCESS) { na = uaddr2taddr(nconf, addrbuf); if (! na) { + /* We don't know about your universal address */ stat = RPC_N2AXLATEFAILURE; goto error; } if (na->len > addr_ptr->maxlen) { /* Too long address */ - stat = RPC_FAILED; /* XXX A better errorno */ + stat = RPC_FAILED; /* XXX A better error number */ goto error; } memcpy(addr_ptr->buf, na->buf, (int)na->len); @@ -516,7 +512,7 @@ rpcb_gettime(host, timep) time(timep); return (TRUE); } - client = clnt_create(host, RPCBPROG, RPCBVERS, "netpath"); + client = clnt_create(host, RPCBPROG, RPCBVERS, "visible"); if (client) { enum clnt_stat st; @@ -550,7 +546,7 @@ rpcb_taddr2uaddr(nconf, taddr) return (NULL); } client = local_rpcb(); - if (! client) + if (! client ) return (NULL); CLNT_CALL(client, RPCBPROC_TADDR2UADDR, xdr_netbuf, taddr, @@ -581,24 +577,19 @@ rpcb_uaddr2taddr(nconf, uaddr) return (NULL); } client = local_rpcb(); - if (! client) + if (! client ) return (NULL); - memset((char *)&nbuf, 0, sizeof (struct netbuf)); + memset((char *)&nbuf, 0, sizeof(struct netbuf)); if (CLNT_CALL(client, RPCBPROC_UADDR2TADDR, xdr_wrapstring, &uaddr, - xdr_netbuf, &nbuf, tottimeout) == RPC_SUCCESS) { + xdr_netbuf, &nbuf, tottimeout) == RPC_SUCCESS) { taddr = (struct netbuf *)malloc(sizeof (struct netbuf)); - if (!taddr) - goto end; taddr->len = nbuf.len; taddr->maxlen = nbuf.maxlen; - if ((taddr->buf = malloc(nbuf.maxlen)) == NULL) { - free (taddr); - goto end; - } + taddr->buf = calloc(nbuf.maxlen, 1); memcpy(taddr->buf, nbuf.buf, nbuf.len); } -end: CLNT_DESTROY(client); return (taddr); } + diff --git a/usr/src/lib/libnsl/rpc/rpcb_prot.c b/usr/src/lib/libnsl/rpc/rpcb_prot.c index d292ce2..8c6ef35 100644 --- a/usr/src/lib/libnsl/rpc/rpcb_prot.c +++ b/usr/src/lib/libnsl/rpc/rpcb_prot.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpc:rpcb_prot.c 1.4" +#ident "@(#)librpc:rpcb_prot.c 1.3" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -19,15 +18,15 @@ * * * -* Copyright Notice +* Copyright Notice * -* Notice of copyright on this source code product does not indicate +* Notice of copyright on this source code product does not indicate * publication. * * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. -*/ +*/ #if !defined(lint) && defined(SCCSIDS) @@ -64,13 +63,10 @@ xdr_rpcb(xdrs, objp) if (!xdr_string(xdrs, &objp->r_addr, ~0)) { return (FALSE); } - if (!xdr_string(xdrs, &objp->r_owner, ~0)) { - return (FALSE); - } return (TRUE); } -/* +/* * What is going on with linked lists? (!) * First recall the link list declaration from rpc_prot.h: * @@ -79,11 +75,11 @@ xdr_rpcb(xdrs, objp) * struct rpcblist *rpcb_next * }; * - * Compare that declaration with a corresponding xdr declaration that + * Compare that declaration with a corresponding xdr declaration that * is (a) pointer-less, and (b) recursive: * * typedef union switch (bool_t) { - * + * * case TRUE: struct { * struct rpcb; * rpcblist_t foo; @@ -96,8 +92,8 @@ xdr_rpcb(xdrs, objp) * the C declaration has no bool_t variable. The bool_t can be * interpreted as ``more data follows me''; if FALSE then nothing * follows this bool_t; if TRUE then the bool_t is followed by - * an actual struct rpcb, and then (recursively) by the - * xdr union, rpcblist_t. + * an actual struct rpcb, and then (recursively) by the + * xdr union, rpcblist_t. * * This could be implemented via the xdr_union primitive, though this * would cause a one recursive call per element in the list. Rather than do @@ -108,7 +104,7 @@ xdr_rpcb(xdrs, objp) * the net, yet is the data that the pointer points to which is interesting; * this sounds like a job for xdr_reference! */ -/* +/* * And this one encodes and decode the tli version of the mappings. */ bool_t @@ -137,9 +133,9 @@ xdr_rpcblist(xdrs, rp) * before we free the current object ... */ if (freeing) - next = &((*rp)->rpcb_next); + next = &((*rp)->rpcb_next); if (! xdr_reference(xdrs, (caddr_t *)rp, - (u_int)sizeof (RPCBLIST), xdr_rpcb)) + (u_int)sizeof(RPCBLIST), xdr_rpcb)) return (FALSE); rp = (freeing) ? next : &((*rp)->rpcb_next); } diff --git a/usr/src/lib/libnsl/rpc/svc_dg.c b/usr/src/lib/libnsl/rpc/svc_dg.c index 8040218..297bb0c 100644 --- a/usr/src/lib/libnsl/rpc/svc_dg.c +++ b/usr/src/lib/libnsl/rpc/svc_dg.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:svc_dg.c 1.3" +#ident "@(#)librpc:svc_dg.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -27,6 +27,10 @@ * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)svc_dg.c 1.13 89/02/28 Copyr 1988 Sun Micro"; +#endif + /* * svc_dg.c, Server side for connectionless RPC. * @@ -53,10 +57,7 @@ extern int errno; /* * kept in xprt->xp_p2 */ -#define MAX_OPT_WORDS 32 struct svc_dg_data { - struct netbuf optbuf; - long opts[MAX_OPT_WORDS]; /*options*/ u_int su_iosz; /* size of send.recv buffer */ u_long su_xid; /* transaction id */ XDR su_xdrs; /* XDR handle */ @@ -147,53 +148,28 @@ svc_dg_recv(xprt, msg) u_long replylen; struct t_unitdata tu_data; int moreflag; /* Flag indicating more data */ - int lookres; - extern int t_errno; tu_data.addr = xprt->xp_rtaddr; tu_data.udata.buf = (char *)rpc_buffer(xprt); - tu_data.opt.buf= (char *) su->opts; + tu_data.udata.maxlen = su->su_iosz; + tu_data.opt.maxlen = 0; /* * If moreflag is set, drop that data packet. Something wrong */ again: tu_data.addr.len = 0; - tu_data.opt.len = 0; - tu_data.udata.len = 0; - - tu_data.udata.maxlen = su->su_iosz; - tu_data.opt.maxlen = MAX_OPT_WORDS <<2; - moreflag = 0; - - if (t_rcvudata(xprt->xp_fd, &tu_data, &moreflag) == -1) { -/*fprintf(stderr,"rcvudata error=%d errno=%d\n",t_errno, errno); */ - if (t_errno == TLOOK){ - lookres = t_look(xprt->xp_fd); -/*fprintf(stderr,"TLOOK %x\n",lookres);*/ - if (lookres & T_UDERR){ - if (t_rcvuderr(xprt->xp_fd, (struct t_uderr *) 0)<0){ - syslog(LOG_ERR,"t_rcvuderr error=%d\n",t_errno); - } - } - if (lookres & T_DATA) goto again; - } - else if ((errno == EINTR) && (t_errno == TSYSERR)) - goto again; - else - return (FALSE); - } - - if ((moreflag) || (tu_data.udata.len < 4 * sizeof(u_long))){ + if ((t_rcvudata(xprt->xp_fd, &tu_data, &moreflag) == -1) + && (errno == EINTR)) + /* XXX What is the equivalent t_errno here ? */ + goto again; + if ((moreflag) || (tu_data.udata.len < 4 * sizeof(u_long))) return (FALSE); - } - su->optbuf= tu_data.opt; xprt->xp_rtaddr.len = tu_data.addr.len; xdrs->x_op = XDR_DECODE; XDR_SETPOS(xdrs, 0); - if (! xdr_callmsg(xdrs, msg)){ + if (! xdr_callmsg(xdrs, msg)) return (FALSE); - } su->su_xid = msg->rm_xid; if (su->su_cache != NULL) { if (cache_get(xprt, msg, &reply, &replylen)) { @@ -233,8 +209,6 @@ svc_dg_reply(xprt, msg) if (su->su_cache && slen >= 0) { cache_set(xprt, (u_long) slen); } - } else { -fprintf(stderr,"t_sunudata error t_errno=%d errno=%d\n",t_errno,errno); } } return (stat); diff --git a/usr/src/lib/libnsl/rpc/svc_generic.c b/usr/src/lib/libnsl/rpc/svc_generic.c index 69dcfaf..a293c1c 100644 --- a/usr/src/lib/libnsl/rpc/svc_generic.c +++ b/usr/src/lib/libnsl/rpc/svc_generic.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:svc_generic.c 1.6" +#ident "@(#)librpc:svc_generic.c 1.3" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -50,7 +50,7 @@ extern int errno; extern int t_errno; extern char *t_errlist[]; -extern char *strdup(), *malloc(); +extern char *strdup(); /* * The highest level interface for server creation. @@ -268,15 +268,6 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz) */ tres->addr.len = 0; break; - case T_DATAXFER: - /* - * This takes care of the case where a fd - * is passed on which a connection has already - * been accepted. t_getname() should have been - * used to get my own bind address. - */ - tres->addr.len = 0; - break; default: (void) syslog(LOG_ERR, "svc_tli_create: connection in a wierd state (%d)", state); @@ -289,11 +280,9 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz) switch(tinfo.servtype) { case T_COTS_ORD: case T_COTS: - if (state == T_DATAXFER) - xprt = svc_fd_create(fd, sendsz, recvsz); - else - xprt = svc_vc_create(fd, sendsz, recvsz); + xprt = svc_vc_create(fd, sendsz, recvsz); break; + case T_CLTS: xprt = svc_dg_create(fd, sendsz, recvsz); break; @@ -304,7 +293,7 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz) if (xprt == (SVCXPRT *)NULL) /* * The error messages here are spitted out by the lower layers: - * svc_vc_create(), svc_fd_create(), and svc_dg_create(). + * svc_vc_create() and svc_dg_create(). */ goto freedata; @@ -322,6 +311,9 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz) (void) syslog(LOG_ERR, "svc_tli_create: No memory!"); goto freedata; } + + xprt->xp_port = -1; /* To show that it is tli based. Switch */ + if (nconf) { xprt->xp_netid = strdup(nconf->nc_netid); xprt->xp_tp = strdup(nconf->nc_device); diff --git a/usr/src/lib/libnsl/rpc/svc_raw.c b/usr/src/lib/libnsl/rpc/svc_raw.c index 5402b99..71add0e 100644 --- a/usr/src/lib/libnsl/rpc/svc_raw.c +++ b/usr/src/lib/libnsl/rpc/svc_raw.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:svc_raw.c 1.3" +#ident "@(#)librpc:svc_raw.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -49,14 +49,14 @@ static char sccsid[] = "@(#)svc_raw.c 1.25 89/01/31 Copyr 1984 Sun Micro"; * This is the "network" that we will be moving data over */ static struct svc_raw_private { - char *raw_buf; /* should be shared with the cl handle */ + char *_raw_buf; /* should be shared with the cl handle */ SVCXPRT server; XDR xdr_stream; char verf_body[MAX_AUTH_BYTES]; } *svc_raw_private; static struct xp_ops *svc_raw_ops(); -extern char *calloc(); +char *calloc(); SVCXPRT * svc_raw_create() @@ -69,7 +69,7 @@ svc_raw_create() return ((SVCXPRT *)NULL); if (_rawcombuf == NULL) _rawcombuf = (char *)calloc(UDPMSGSIZE, sizeof(char)); - srp->raw_buf = _rawcombuf; /* Share it with the client */ + srp->_raw_buf = _rawcombuf; /* Share it with the client */ svc_raw_private = srp; } srp->server.xp_fd = 0; @@ -77,7 +77,7 @@ svc_raw_create() srp->server.xp_p3 = NULL; srp->server.xp_ops = svc_raw_ops(); srp->server.xp_verf.oa_base = srp->verf_body; - xdrmem_create(&srp->xdr_stream, srp->raw_buf, UDPMSGSIZE, XDR_FREE); + xdrmem_create(&srp->xdr_stream, srp->_raw_buf, UDPMSGSIZE, XDR_FREE); return (&srp->server); } diff --git a/usr/src/lib/libnsl/rpc/svc_run.c b/usr/src/lib/libnsl/rpc/svc_run.c index e588cae..a6aabf2 100644 --- a/usr/src/lib/libnsl/rpc/svc_run.c +++ b/usr/src/lib/libnsl/rpc/svc_run.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpc:svc_run.c 1.3" +#ident "@(#)librpc:svc_run.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -38,15 +37,12 @@ static char sccsid[] = "@(#)svc_run.c 1.9 89/02/28 Copyr 1984 Sun Micro"; */ #include #include -#include #ifdef SYSLOG #include #else #define LOG_ERR 3 #endif /* SYSLOG */ -static int all_done(); - void svc_run() { @@ -55,9 +51,6 @@ svc_run() for (;;) { readfds = svc_fdset; - if (all_done()) { - break; - } switch (select(_rpc_dtbsize(), &readfds, (fd_set *)0, (fd_set *)0, (struct timeval *)0)) { case -1: @@ -73,21 +66,3 @@ svc_run() } } } - -static int -all_done() -{ - static struct rlimit rl; - int i; - - if (rl.rlim_max == 0) { - getrlimit(RLIMIT_NOFILE, &rl); - if (rl.rlim_max == 0) - return(0); - } - - for (i = 0; i < rl.rlim_max ; i++) - if (FD_ISSET(i, &svc_fdset)) - return(0); - return(1); -} diff --git a/usr/src/lib/libnsl/rpc/svc_vc.c b/usr/src/lib/libnsl/rpc/svc_vc.c index a94f2f3..ae7289f 100644 --- a/usr/src/lib/libnsl/rpc/svc_vc.c +++ b/usr/src/lib/libnsl/rpc/svc_vc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)librpc:svc_vc.c 1.7" +#ident "@(#)librpc:svc_vc.c 1.3" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -18,17 +18,21 @@ * * * -* Copyright Notice +* Copyright Notice * -* Notice of copyright on this source code product does not indicate +* Notice of copyright on this source code product does not indicate * publication. * * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. -*/ +*/ +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)svc_vc.c 1.15 89/03/14 Copyr 1988 Sun Micro"; +#endif + /* - * svc_vc.c, Server side for Connection Oriented RPC. + * svc_vc.c, Server side for Connection Oriented RPC. * * Actually implements two flavors of transporter - * a rendezvouser (a listener and connection establisher) @@ -42,12 +46,12 @@ #ifdef SYSLOG #include #else -#define LOG_ERR 3 +#define LOG_ERR 3 #endif /* SYSLOG */ #include #ifndef MIN -#define MIN(a ,b) (((a) < (b)) ? (a) : (b)) +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif extern bool_t abort(); @@ -59,7 +63,7 @@ static void svc_vc_destroy(); static int read_vc(); static int write_vc(); static SVCXPRT *makefd_xprt(); -extern char *strdup(), *malloc(); +extern char *strdup(); struct cf_rendezvous { /* kept in xprt->xp_p1 for rendezvouser */ u_int sendsize; @@ -76,7 +80,7 @@ struct cf_conn { /* kept in xprt->xp_p1 for actual connection*/ /* * Usage: * xprt = svc_vc_create(fd, sendsize, recvsize); - * Since connection streams do buffered io similar to stdio, the caller + * Since connection streams do buffered io similar to stdio, the caller * can specify how big the send and receive buffers are. If recvsize * or sendsize are 0, defaults will be chosen. * fd should be open and bound. @@ -91,14 +95,14 @@ svc_vc_create(fd, sendsize, recvsize) SVCXPRT *xprt; struct t_info tinfo; - xprt = (SVCXPRT *)mem_alloc(sizeof (SVCXPRT)); + xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT)); if (xprt == (SVCXPRT *)NULL) { (void) syslog(LOG_ERR, "svc_vc_create: out of memory"); return ((SVCXPRT *)NULL); } - memset((char *)xprt, 0, sizeof (SVCXPRT)); + memset((char *)xprt, 0, sizeof(SVCXPRT)); - r = (struct cf_rendezvous *)mem_alloc(sizeof (*r)); + r = (struct cf_rendezvous *)mem_alloc(sizeof(*r)); if (r == (struct cf_rendezvous *)NULL) { (void) syslog(LOG_ERR, "svc_vc_create: out of memory"); (void) mem_free(xprt, sizeof (SVCXPRT)); @@ -106,9 +110,7 @@ svc_vc_create(fd, sendsize, recvsize) } if (t_getinfo(fd, &tinfo) == -1) { if ((sendsize == 0) || (recvsize == 0)) { - (void) syslog(LOG_ERR, - "svc_vc_create: could not get transport information"); - (void) mem_free(xprt, sizeof (SVCXPRT)); + (void) syslog(LOG_ERR, "svc_vc_create: could not get transport information"); return ((SVCXPRT *)NULL); } } else { @@ -121,7 +123,6 @@ svc_vc_create(fd, sendsize, recvsize) r->sendsize = sendsize; r->recvsize = recvsize; xprt->xp_fd = fd; - xprt->xp_port = -1; /* He is the rendezvouser */ xprt->xp_p1 = (caddr_t)r; xprt->xp_p2 = NULL; xprt->xp_p3 = NULL; @@ -145,7 +146,7 @@ svc_fd_create(fd, sendsize, recvsize) if (t_getinfo(fd, &tinfo) == -1) { if ((sendsize == 0) || (recvsize == 0)) { (void) syslog(LOG_ERR, - "svc_fd_create: could not get transport information"); + "svc_fd_create: could not get transport information"); return ((SVCXPRT *)NULL); } } else { @@ -167,17 +168,17 @@ makefd_xprt(fd, sendsize, recvsize) { register SVCXPRT *xprt; register struct cf_conn *cd; - - xprt = (SVCXPRT *)mem_alloc(sizeof (SVCXPRT)); + + xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT)); if (xprt == (SVCXPRT *)NULL) { (void) syslog(LOG_ERR, "svc_vc: makefd_xprt: out of memory"); return ((SVCXPRT *)NULL); } - (void) memset((char *)xprt, 0, sizeof (SVCXPRT)); - cd = (struct cf_conn *)mem_alloc(sizeof (struct cf_conn)); + (void) memset((char *)xprt, 0, sizeof(SVCXPRT)); + cd = (struct cf_conn *)mem_alloc(sizeof(struct cf_conn)); if (cd == (struct cf_conn *)NULL) { (void) syslog(LOG_ERR, "svc_vc: makefd_xprt: out of memory"); - (void) mem_free((char *) xprt, sizeof (SVCXPRT)); + (void) mem_free((char *) xprt, sizeof(SVCXPRT)); return ((SVCXPRT *)NULL); } cd->strm_stat = XPRT_IDLE; @@ -208,65 +209,37 @@ rendezvous_request(xprt) register SVCXPRT *xprtnew = NULL; register int fd = RPC_ANYFD; struct cf_rendezvous *r; - struct t_call *t_call, t_call2; - struct t_discon *t_disc; + struct t_call *t_call; struct t_info tinfo; struct t_bind *res = NULL; - char *tpname = NULL; - bool_t alldone = FALSE; - struct netconfig *nconf; - int nettype; + char *tpname; char devbuf[256]; - extern int errno; r = (struct cf_rendezvous *)xprt->xp_p1; - -again: - switch (t_look(xprt->xp_fd)) { - case T_DISCONNECT: - t_disc = (struct t_discon *) t_alloc(xprt->xp_fd, - T_DIS, T_ALL); - if (t_disc == NULL) { - (void) syslog(LOG_ERR, "rendezvous_request: no memory"); - return (FALSE); - } - (void) t_rcvdis(xprt->xp_fd, t_disc); - (void) t_free(t_disc); + t_call = (struct t_call *) t_alloc(xprt->xp_fd, T_CALL, T_ADDR); + if (t_call == NULL) { + (void) syslog(LOG_ERR, "rendezvous_request: no memory"); return (FALSE); - - case T_LISTEN: - - t_call = (struct t_call *) t_alloc(xprt->xp_fd, - T_CALL, T_ADDR| T_OPT); - if (t_call == NULL) { - (void) syslog(LOG_ERR, "rendezvous_request: no memory"); - return (FALSE); - } - if (t_listen(xprt->xp_fd, t_call) == -1) { - if (errno == EINTR) - goto again; - (void) t_free((char *)t_call, T_CALL); - return (FALSE); - } - break; - default: + } + again: + if (t_listen(xprt->xp_fd, t_call) == -1) { + if (errno == EINTR) + goto again; + (void) t_free((char *)t_call, T_CALL); return (FALSE); } /* * Now create another endpoint, and accept the connection - * on it. + * on it. If xprt->xp_tp is NULL, then try all + * possible transports until one finds the appropriate one. */ if (xprt->xp_tp) { tpname = xprt->xp_tp; } else { - /* - * If xprt->xp_tp is NULL, then try all - * possible connection oriented transports until - * one succeeds in finding an appropriate one. - */ + /* Try all the visible connection oriented transports */ struct stat statbuf; struct stat fdstatbuf; - void *hndl; + int nettype; struct netconfig *nconf; if (fstat(xprt->xp_fd, &statbuf) == -1) { @@ -275,30 +248,28 @@ rendezvous_request(xprt) goto err; } - hndl = setnetconfig(); - if (hndl == NULL) { + nettype = _rpc_setconf("circuit_v"); + if (nettype == 0) { (void) syslog(LOG_ERR, - "rendezvous_request: cannot read netconfig database"); + "rendezvous_request: no suitable transport"); goto err; } tpname = devbuf; - while (nconf = getnetconfig(hndl)) { - if ((nconf->nc_semantics != NC_TPI_COTS) && - (nconf->nc_semantics != NC_TPI_COTS_ORD)) - continue; + while (nconf = _rpc_getconf(nettype)) { if (!stat(nconf->nc_device, &fdstatbuf) && (statbuf.st_dev == fdstatbuf.st_dev)) { strcpy(tpname, nconf->nc_device); break; } } - endnetconfig(hndl); + _rpc_endconf(); if (!nconf) { (void) syslog(LOG_ERR, "rendezvous_request: no suitable transport"); goto err; } } + fd = t_open(tpname, O_RDWR, &tinfo); if (fd == -1) { (void) syslog(LOG_ERR, @@ -312,6 +283,10 @@ rendezvous_request(xprt) "rendezvous_request: illegal transport"); goto err; } + /* + * One has to do these t_alloc's every time, because + * transports may have different address buffer sizes. + */ res = (struct t_bind *) t_alloc(fd, T_BIND, T_ADDR); if (res == NULL) { (void) syslog(LOG_ERR, "rendezvous_request: no memory"); @@ -325,17 +300,7 @@ rendezvous_request(xprt) * This connection is not listening, hence no need to set * the qlen. */ - - /* - * XXX: The local transport chokes on its own listen - * options so we zero them for now - */ - t_call2 = *t_call; - t_call2.opt.len = 0; - t_call2.opt.maxlen = 0; - t_call2.opt.buf = NULL; - - if (t_accept(xprt->xp_fd, fd, &t_call2) == -1) { + if (t_accept(xprt->xp_fd, fd, t_call) == -1) { (void) syslog(LOG_ERR, "cannot accept connection"); goto err; } @@ -350,24 +315,16 @@ rendezvous_request(xprt) */ xprtnew->xp_ltaddr = res->addr; res->addr.buf = (char *)NULL; - (void) t_free((char *)res, T_BIND); xprtnew->xp_rtaddr = t_call->addr; + t_call->addr.buf = (char *)NULL; xprtnew->xp_tp = strdup(tpname); xprtnew->xp_netid = strdup(xprt->xp_netid); if ((xprtnew->xp_tp == NULL) || (xprtnew->xp_netid == NULL)) { - (void) syslog(LOG_ERR, - "rendezvous_request: no memory"); + (void) syslog(LOG_ERR, "rendezvous_request: no memory"); goto err; } - if (t_call->opt.len > 0) { - xprtnew->xp_p2 = malloc(sizeof (struct netbuf)); - if (xprtnew->xp_p2 != NULL) { - *((struct netbuf *) xprtnew->xp_p2)= t_call->opt; - t_call->opt.buf = NULL; - } - } - t_call->addr.buf = (char *)NULL; + (void) t_free((char *)res, T_BIND); (void) t_free((char *)t_call, T_CALL); return (FALSE); /* there is never an rpc msg to be processed */ err: @@ -377,7 +334,7 @@ rendezvous_request(xprt) if (xprtnew) svc_vc_destroy(xprtnew); else if (fd != RPC_ANYFD) - t_close(fd); + t_close(fd); return (FALSE); } @@ -402,7 +359,7 @@ svc_vc_destroy(xprt) /* an actual connection end point */ XDR_DESTROY(&(cd->xdrs)); } - (void) mem_free((caddr_t)cd, sizeof (*cd)); + (void) mem_free((caddr_t)cd, sizeof(*cd)); if (xprt->xp_rtaddr.buf) (void) mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen); if (xprt->xp_ltaddr.buf) @@ -411,14 +368,7 @@ svc_vc_destroy(xprt) (void) free(xprt->xp_tp); if (xprt->xp_netid) (void) free(xprt->xp_netid); - (void) mem_free((caddr_t)xprt, sizeof (SVCXPRT)); - - if (xprt->xp_p2){ - (void) mem_free((caddr_t)((struct netbuf *) xprt->xp_p2)->buf, - ((struct netbuf *) xprt->xp_p2)->len); - (void) mem_free((struct netbuf *) xprt->xp_p2, - sizeof (struct netbuf)); - } + (void) mem_free((caddr_t)xprt, sizeof(SVCXPRT)); } /* @@ -446,8 +396,8 @@ read_vc(xprt, buf, len) FD_SET(fd, &mask); do { readfds = mask; - if (select(_rpc_dtbsize(), &readfds, (fd_set *)NULL, - (fd_set *)NULL, &wait_per_try) <= 0) { + if (select(_rpc_dtbsize(), &readfds, (fd_set *)NULL, (fd_set *)NULL, + &wait_per_try) <= 0) { if (errno == EINTR) continue; goto fatal_err; @@ -463,7 +413,7 @@ read_vc(xprt, buf, len) /* * Receive the required bytes of data, even if it is fragmented. */ -static int +static int t_rcvall(fd, buf, len) int fd; char *buf; @@ -510,8 +460,7 @@ write_vc(xprt, buf, len) return (-1); } if ((maxsz == 0) || (maxsz == -1)) { - if ((len = t_snd(xprt->xp_fd, buf, (unsigned)len, - (int)0)) == -1) { + if ((len = t_snd(xprt->xp_fd, buf, (unsigned)len, (int)0)) == -1) { ((struct cf_conn *)(xprt->xp_p1))->strm_stat = XPRT_DIED; } return (len); @@ -522,8 +471,7 @@ write_vc(xprt, buf, len) */ for (cnt = len; cnt > 0; cnt -= i, buf += i) { flag = cnt > maxsz ? T_MORE : 0; - if ((i = t_snd(xprt->xp_fd, buf, - (unsigned)MIN(cnt, maxsz), flag)) == -1) { + if ((i = t_snd(xprt->xp_fd, buf, (unsigned)MIN(cnt, maxsz), flag)) == -1) { ((struct cf_conn *)(xprt->xp_p1))->strm_stat = XPRT_DIED; return (-1); } diff --git a/usr/src/lib/libnsl/saf/doconfig.c b/usr/src/lib/libnsl/saf/doconfig.c index 1ec7187..a590dc1 100644 --- a/usr/src/lib/libnsl/saf/doconfig.c +++ b/usr/src/lib/libnsl/saf/doconfig.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -# ident "@(#)libnet:saf/doconfig.c 1.5" +# ident "@(#)libnet:saf/doconfig.c 1.4" # include # include @@ -27,7 +27,7 @@ extern char *strchr(); extern char *getenv(); extern char *malloc(); -extern char **_environ; +extern char **environ; extern int errno; char *eatwhite(); @@ -489,7 +489,7 @@ int waitflg; /* stderr */ if (dup(0) != 2) return(-1); - execle("/usr/bin/sh", "sh", "-c", p, 0, _environ); + execle("/usr/bin/sh", "sh", "-c", p, 0, environ); /* if we get here, there is a problem - remember that this is the child */ exit(1); diff --git a/usr/src/lib/libnsl/saf/saf.mk b/usr/src/lib/libnsl/saf/saf.mk index d456063..096e6d7 100644 --- a/usr/src/lib/libnsl/saf/saf.mk +++ b/usr/src/lib/libnsl/saf/saf.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libnet:saf/saf.mk 1.16" +#ident "@(#)libnet:saf/saf.mk 1.15" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # PROPRIETARY NOTICE (Combined) @@ -34,13 +34,39 @@ CFLAGS = -O -Kpic -I$(INC) STRIP = strip SIZE = size LINT = lint -OBJECTS = doconfig.o checkver.o -LIBOBJECTS = ../doconfig.o ../checkver.o +OBJECTS = ut.o utx.o doconfig.o checkver.o +LIBOBJECTS = ../ut.o ../utx.o ../doconfig.o ../checkver.o SRCS = $(OBJS:%.o=%.c) all: $(OBJECTS) cp $(OBJECTS) ../ +ut.o: ut.c \ + $(INC)/sys/types.h \ + $(INC)/utmp.h \ + $(INC)/utmpx.h \ + $(INC)/ctype.h \ + $(INC)/unistd.h \ + $(INC)/sys/fcntl.h \ + $(INC)/sys/signal.h \ + $(INC)/sac.h \ + $(INC)/sys/param.h \ + $(INC)/sys/stat.h \ + $(INC)/errno.h \ + $(INC)/stdio.h + +utx.o: utx.c \ + $(INC)/sys/types.h \ + $(INC)/utmpx.h \ + $(INC)/ctype.h \ + $(INC)/unistd.h \ + $(INC)/sys/fcntl.h \ + $(INC)/sys/signal.h \ + $(INC)/sac.h \ + $(INC)/sys/param.h \ + $(INC)/sys/stat.h \ + $(INC)/errno.h \ + $(INC)/stdio.h doconfig.o: doconfig.c \ $(INC)/stdio.h \ diff --git a/usr/src/lib/libnsl/saf/ut.c b/usr/src/lib/libnsl/saf/ut.c new file mode 100644 index 0000000..4de2701 --- /dev/null +++ b/usr/src/lib/libnsl/saf/ut.c @@ -0,0 +1,688 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +# ident "@(#)libnet:saf/ut.c 1.6" + +/******************************************************************* + + PROPRIETARY NOTICE (Combined) + +This source code is unpublished proprietary information +constituting, or derived under license from AT&T's UNIX(r) System V. +In addition, portions of such source code were derived from Berkeley +4.3 BSD under license from the Regents of the University of +California. + + + + Copyright Notice + +Notice of copyright on this source code product does not indicate +publication. + + (c) 1986,1987,1988,1989 Sun Microsystems, Inc + (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + All rights reserved. +********************************************************************/ + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# define MAXVAL 255 /* max value for an id `character' */ +# define IPIPE "/etc/initpipe" /* FIFO to send pids to init */ + + +/* + * format of message sent to init + */ + +struct pidrec { + int pd_type; /* command type */ + pid_t pd_pid; /* pid */ +}; + +/* + * pd_type's + */ + +# define ADDPID 1 /* add a pid to "godchild" list */ +# define REMPID 2 /* remove a pid to "godchild" list */ + + +struct utmp *getutent(); +struct utmp *pututline(); +struct utmp *getutid(); +void setutent(); +void endutent(); +long lseek(); +long time(); + +void unlockut(); +void sendpid(); + +static int Fd = -1; /* File descriptor for the utmp file. */ +static int Fd1 = -1; /* File descriptor for the utmpx file. */ + +/* + * makeut - create a utmp entry, recycling an id if a wild card is + * specified. Also notify init about the new pid + * + * args: utmp - point to utmp structure to be created + */ + + +struct utmp * +makeut(utmp) +register struct utmp *utmp; +{ + register int i; /* scratch variable */ + register struct utmp *utp; /* "current" utmp entry being examined */ + int wild; /* flag, true iff wild card char seen */ + unsigned char saveid[IDLEN]; /* the last id we matched that was + NOT a dead proc */ + + wild = 0; + for (i = 0; i < IDLEN; i++) { + if (utmp->ut_id[i] == SC_WILDC) { + wild = 1; + break; + } + } + + if (wild) { + +/* + * try to lock the utmp file, only needed if we're doing wildcard matching + */ + + if (lockut()) + return((struct utmp *) NULL); + + setutent(); + /* find the first alphanumeric character */ + for (i = 0; i < MAXVAL; ++i) { + if (isalnum(i)) + break; + } + (void) memset(saveid, i, IDLEN); + while (utp = getutent()) { + if (idcmp(utmp->ut_id, utp->ut_id)) { + continue; + } + else { + if (utp->ut_type == DEAD_PROCESS) { + break; + } + else { + (void) memcpy(saveid, utp->ut_id, IDLEN); + } + } + } + if (utp) { + +/* + * found an unused entry, reuse it + */ + + (void) memcpy(utmp->ut_id, utp->ut_id, IDLEN); + utp = pututline(utmp); + if (utp) + updwtmp(WTMP_FILE, utp); + endutent(); + unlockut(); + sendpid(ADDPID, (pid_t)utmp->ut_pid); + return(utp); + } + else { + +/* + * nothing available, try to allocate an id + */ + + if (allocid(utmp->ut_id, saveid)) { + endutent(); + unlockut(); + return((struct utmp *) NULL); + } + else { + utp = pututline(utmp); + if (utp) + updwtmp(WTMP_FILE, utp); + endutent(); + unlockut(); + sendpid(ADDPID, (pid_t)utmp->ut_pid); + return(utp); + } + } + } + else { + utp = pututline(utmp); + if (utp) + updwtmp(WTMP_FILE, utp); + endutent(); + sendpid(ADDPID, (pid_t)utmp->ut_pid); + return(utp); + } +} + + +/* + * modut - modify a utmp entry. Also notify init about new pids or + * old pids that it no longer needs to care about + * + * args: utmp - point to utmp structure to be created + */ + + +struct utmp * +modut(utp) +register struct utmp *utp; +{ + register int i; /* scratch variable */ + struct utmp utmp; /* holding area */ + register struct utmp *ucp = &utmp; /* and a pointer to it */ + struct utmp *up; /* "current" utmp entry being examined */ + + for (i = 0; i < IDLEN; ++i) { + if (utp->ut_id[i] == SC_WILDC) + return((struct utmp *) NULL); + } + /* copy the supplied utmp structure someplace safe */ + utmp = *utp; + setutent(); + while (up = getutent()) { + if (idcmp(ucp->ut_id, up->ut_id)) + continue; + /* only get here if ids are the same, i.e. found right entry */ + if (ucp->ut_pid != up->ut_pid) { + sendpid(REMPID, (pid_t)up->ut_pid); + sendpid(ADDPID, (pid_t)ucp->ut_pid); + } + break; + } + up = pututline(ucp); + if (ucp->ut_type == DEAD_PROCESS) + sendpid(REMPID, (pid_t)ucp->ut_pid); + if (up) + updwtmp(WTMP_FILE, up); + endutent(); + return(up); +} + + +/* + * idcmp - compare two id strings, return 0 if same, non-zero if not + * + * args: s1 - first id string + * s2 - second id string + */ + + +static +idcmp(s1, s2) +register char *s1; +register char *s2; +{ + register int i; /* scratch variable */ + + for (i = 0; i < IDLEN; ++i) { + if (*s1 != SC_WILDC && (*s1++ != *s2++)) + return(-1); + } + return(0); +} + + +/* + * allocid - allocate an unused id for utmp, either by recycling a + * DEAD_PROCESS entry or creating a new one. This routine only + * gets called if a wild card character was specified. + * + * args: srcid - pattern for new id + * saveid - last id matching pattern for a non-dead process + */ + + +static +allocid(srcid, saveid) +register char *srcid; +register unsigned char *saveid; +{ + register int i; /* scratch variable */ + int changed; /* flag to indicate that a new id has been generated */ + char copyid[IDLEN]; /* work area */ + + (void) memcpy(copyid, srcid, IDLEN); + changed = 0; + for (i = 0; i < IDLEN; ++i) { + /* if this character isn't wild, it'll be part of the generated id */ + if (copyid[i] != SC_WILDC) + continue; + /* it's a wild character, retrieve the character from the saved id */ + copyid[i] = saveid[i]; + /* if we haven't changed anything yet, try to find a new char to use */ + if (!changed && (saveid[i] < MAXVAL)) { + +/* + * Note: this algorithm is taking the "last matched" id and trying to make + * a 1 character change to it to create a new one. Rather than special-case + * the first time (when no perturbation is really necessary), just don't + * allocate the first valid id. + */ + + while (++saveid[i] <= MAXVAL) { + /* make sure new char is alphanumeric */ + if (isalnum(saveid[i])) { + copyid[i] = saveid[i]; + changed = 1; + break; + } + } + } + } + /* changed is true if we were successful in allocating an id */ + if (changed) { + (void) memcpy(srcid, copyid, IDLEN); + return(0); + } + else { + return(-1); + } +} + + +/* + * lockut - lock utmp and utmpx files + */ + + +static +lockut() +{ + Fd = open(UTMP_FILE, O_RDWR); + Fd1 = open(UTMPX_FILE, O_RDWR); + if (Fd < 0 || Fd1 < 0) + return(-1); + if ((lockf(Fd, F_LOCK, 0) < 0) || (lockf(Fd1, F_LOCK, 0) < 0)) + return(-1); + return(0); +} + + +/* + * unlockut - unlock utmp and utmpx files + */ + + +static void +unlockut() +{ + (void) lockf(Fd, F_ULOCK, 0); + (void) lockf(Fd1, F_ULOCK, 0); + (void) close(Fd); + (void) close(Fd1); +} + + +/* + * sendpid - send message to init to add or remove a pid from the + * "godchild" list + * + * args: cmd - ADDPID or REMPID + * pid - pid of "godchild" + */ + + +static void +sendpid(cmd, pid) +int cmd; +pid_t pid; +{ + int fd; /* file desc. for init pipe */ + struct pidrec prec; /* place for message to be built */ + +/* + * if for some reason init didn't open initpipe, open it read/write + * here to avoid sending SIGPIPE to the calling process + */ + + fd = open(IPIPE, O_RDWR); + if (fd < 0) + return; + prec.pd_pid = pid; + prec.pd_type = cmd; + (void) write(fd, &prec, sizeof(struct pidrec)); + (void) close(fd); +} + + +/* + * Following is from libc-port:gen/getut.c 1.10 + * It is duplicated here so that the file descriptor used by these + * routines can be shared above for locking. They are static to avoid + * name clashes + */ + +/* Routines to read and write the /etc/utmp file. */ +/* */ +#include +#include +#include + +#define MAXFILE 79 /* Maximum pathname length for "utmp" file */ + + +static char utmpfile[MAXFILE+1] = UTMP_FILE; /* Name of the current "utmp" */ +static char utmpxfile[MAXFILE+1] = UTMPX_FILE; /* and "utmpx" like files. */ + +static long loc_utmp; /* Where in "utmp" the current "ubuf" was + * found. + */ +static struct utmp ubuf; /* Copy of last entry read in. */ + + +/* "getutent" gets the next entry in the utmp file. + */ + +static struct utmp * +getutent() +{ + extern int Fd; + extern char utmpfile[]; + extern struct utmp ubuf; + extern long loc_utmp; + extern int errno; + register char *u; + register int i; + struct stat stbuf, stxbuf; + +/* If the "utmp" file is not open, attempt to open it for + * reading. If there is no file, attempt to create one. If + * both attempts fail, return NULL. If the file exists, but + * isn't readable and writeable, do not attempt to create. + */ + + if (Fd < 0) { + + /* Make sure files are in synch */ + if (synchutmp(utmpfile, utmpxfile)) { + return(NULL); + } + if ((Fd = open(utmpfile, O_RDWR|O_CREAT, 0644)) < 0) { + +/* If the open failed for permissions, try opening it only for + * reading. All "pututline()" later will fail the writes. + */ + if ((Fd = open(utmpfile, O_RDONLY)) < 0) + return(NULL); + } + } + +/* Try to read in the next entry from the utmp file. */ + if (read(Fd,&ubuf,sizeof(ubuf)) != sizeof(ubuf)) { + +/* Make sure ubuf is zeroed. */ + for (i=0,u=(char *)(&ubuf); iut_type) { + +/* Do not look for an entry if the user sent us an EMPTY entry. */ + case EMPTY: + return(NULL); + +/* For RUN_LVL, BOOT_TIME, OLD_TIME, and NEW_TIME entries, only */ +/* the types have to match. If they do, return the address of */ +/* internal buffer. */ + case RUN_LVL: + case BOOT_TIME: + case OLD_TIME: + case NEW_TIME: + if (entry->ut_type == ubuf.ut_type) return(&ubuf); + break; + +/* For INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, and DEAD_PROCESS */ +/* the type of the entry in "ubuf", must be one of the above and */ +/* id's must match. */ + case INIT_PROCESS: + case LOGIN_PROCESS: + case USER_PROCESS: + case DEAD_PROCESS: + if (((type = ubuf.ut_type) == INIT_PROCESS + || type == LOGIN_PROCESS + || type == USER_PROCESS + || type == DEAD_PROCESS) + && ubuf.ut_id[0] == entry->ut_id[0] + && ubuf.ut_id[1] == entry->ut_id[1] + && ubuf.ut_id[2] == entry->ut_id[2] + && ubuf.ut_id[3] == entry->ut_id[3]) + return(&ubuf); + break; + +/* Do not search for illegal types of entry. */ + default: + return(NULL); + } + } + } while (getutent() != NULL); + +/* Return NULL since the proper entry wasn't found. */ + return(NULL); +} + + +/* "pututline" writes the structure sent into the utmp file. */ +/* If there is already an entry with the same id, then it is */ +/* overwritten, otherwise a new entry is made at the end of the */ +/* utmp file. */ + +static struct utmp * +pututline(entry) +struct utmp *entry; +{ + int fc; + struct utmp *answer; + extern struct utmp ubuf; + extern long loc_utmp; + extern int Fd,errno; + struct utmp tmpbuf, savbuf; + +/* Copy the user supplied entry into our temporary buffer to */ +/* avoid the possibility that the user is actually passing us */ +/* the address of "ubuf". */ + tmpbuf = *entry; + getutent(); + if (Fd < 0) { + return((struct utmp *)NULL); + } +/* Make sure file is writable */ + if ((fc=fcntl(Fd, F_GETFL, NULL)) == -1 + || (fc & O_RDWR) != O_RDWR) { + return((struct utmp *)NULL); + } + +/* Find the proper entry in the utmp file. Start at the current */ +/* location. If it isn't found from here to the end of the */ +/* file, then reset to the beginning of the file and try again. */ +/* If it still isn't found, then write a new entry at the end of */ +/* the file. (Making sure the location is an integral number of */ +/* utmp structures into the file incase the file is scribbled.) */ + + if (getutid(&tmpbuf) == NULL) { + setutent(); + if (getutid(&tmpbuf) == NULL) { + fcntl(Fd, F_SETFL, fc | O_APPEND); + } else { + lseek(Fd, -(long)sizeof(struct utmp), 1); + } + } else { + lseek(Fd, -(long)sizeof(struct utmp), 1); + } + +/* Write out the user supplied structure. If the write fails, */ +/* then the user probably doesn't have permission to write the */ +/* utmp file. */ + if (write(Fd,&tmpbuf,sizeof(tmpbuf)) != sizeof(tmpbuf)) { + answer = (struct utmp *)NULL; + } else { +/* Save the user structure that was overwritten. Copy the new user */ +/* structure into ubuf so that it will be up to date in the future. */ + savbuf = ubuf; + ubuf = tmpbuf; + answer = &ubuf; + } + if (updutmpx(entry)) { + lseek(Fd, -(long)sizeof(struct utmp), 1); + write(Fd, &savbuf, sizeof(savbuf)); + answer = (struct utmp*)NULL; + } + + fcntl(Fd, F_SETFL, fc); + return(answer); +} + +/* "setutent" just resets the utmp file back to the beginning. */ + +static void +setutent() +{ + register char *ptr; + register int i; + extern int Fd; + extern struct utmp ubuf; + extern long loc_utmp; + + if (Fd != -1) lseek(Fd,0L,0); + +/* Zero the stored copy of the last entry read, since we are */ +/* resetting to the beginning of the file. */ + + for (i=0,ptr=(char*)&ubuf; i < sizeof(ubuf);i++) *ptr++ = '\0'; + loc_utmp = 0L; +} + +/* "endutent" closes the utmp file. */ + +static void +endutent() +{ + extern int Fd; + extern long loc_utmp; + extern struct utmp ubuf; + register char *ptr; + register int i; + + if (Fd != -1) close(Fd); + Fd = -1; + loc_utmp = 0; + for (i=0,ptr= (char *)(&ubuf); i < sizeof(ubuf);i++) *ptr++ = '\0'; +} + + +static int +updutmpx(entry) +struct utmp *entry; +{ + int fc, type; + extern int Fd1; + struct stat stbuf; + struct utmpx uxbuf, *uxptr = NULL; + + + if (Fd1 < 0) { + if ((Fd1 = open(UTMPX_FILE, O_RDWR|O_CREAT, 0644)) < 0) { + return(1); + } + } + + if ((fc = fcntl(Fd1, F_GETFL, NULL)) == -1) + return(1); + + while (read(Fd1, &uxbuf, sizeof(uxbuf)) == sizeof(uxbuf)) { + if (uxbuf.ut_type != EMPTY) { + switch (entry->ut_type) { + case EMPTY: + goto done; + case RUN_LVL: + case BOOT_TIME: + case OLD_TIME: + case NEW_TIME: + if (entry->ut_type == uxbuf.ut_type) { + uxptr = &uxbuf; + goto done; + } + case INIT_PROCESS: + case LOGIN_PROCESS: + case USER_PROCESS: + case DEAD_PROCESS: + if (((type = uxbuf.ut_type) == INIT_PROCESS + || type == LOGIN_PROCESS + || type == USER_PROCESS + || type == DEAD_PROCESS) + && uxbuf.ut_id[0] == entry->ut_id[0] + && uxbuf.ut_id[1] == entry->ut_id[1] + && uxbuf.ut_id[2] == entry->ut_id[2] + && uxbuf.ut_id[3] == entry->ut_id[3]) { + uxptr = &uxbuf; + goto done; + } + } + } + } + +done: + if (uxptr) { + lseek(Fd1, -(long)sizeof(uxbuf), 1); +} + else { + fcntl(Fd1, F_SETFL, fc|O_APPEND); +} + + getutmpx(entry, &uxbuf); + + if (write(Fd1, &uxbuf, sizeof(uxbuf)) != sizeof(uxbuf)) { + return(1); + } + + fcntl(Fd1, F_SETFL, fc); + + close(Fd1); + Fd1 = -1; + + return(0); +} + diff --git a/usr/src/lib/libnsl/saf/utx.c b/usr/src/lib/libnsl/saf/utx.c new file mode 100644 index 0000000..402fbcb --- /dev/null +++ b/usr/src/lib/libnsl/saf/utx.c @@ -0,0 +1,678 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +# ident "@(#)libnet:saf/utx.c 1.2" + +/******************************************************************* + + PROPRIETARY NOTICE (Combined) + +This source code is unpublished proprietary information +constituting, or derived under license from AT&T's UNIX(r) System V. +In addition, portions of such source code were derived from Berkeley +4.3 BSD under license from the Regents of the University of +California. + + + + Copyright Notice + +Notice of copyright on this source code product does not indicate +publication. + + (c) 1986,1987,1988,1989 Sun Microsystems, Inc + (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + All rights reserved. +********************************************************************/ + +# include +# include +# include +# include +# include +# include +# include +# include + +# define MAXVAL 255 /* max value for an id `character' */ +# define IPIPE "/etc/initpipe" /* FIFO to send pids to init */ + + +/* + * format of message sent to init + */ + +struct pidrec { + int pd_type; /* command type */ + pid_t pd_pid; /* pid */ +}; + +/* + * pd_type's + */ + +# define ADDPID 1 /* add a pid to "godchild" list */ +# define REMPID 2 /* remove a pid to "godchild" list */ + +long lseek(); +long time(); + +void unlockutx(); +void sendpid(); + +static int Fd = -1; /* File descriptor for the utmpx file. */ +static int Fd1 = -1; /* File descriptor for the utmp file. */ + +/* + * makeutx - create a utmpx entry, recycling an id if a wild card is + * specified. Also notify init about the new pid + * + * args: utmpx - point to utmpx structure to be created + */ + + +struct utmpx * +makeutx(utmp) +const struct utmpx *utmp; +{ + register int i; /* scratch variable */ + register struct utmpx *utp; /* "current" utmpx entry being examined */ + int wild; /* flag, true iff wild card char seen */ + unsigned char saveid[IDLEN]; /* the last id we matched that was + NOT a dead proc */ + + wild = 0; + for (i = 0; i < IDLEN; i++) { + if (utmp->ut_id[i] == SC_WILDC) { + wild = 1; + break; + } + } + + if (wild) { + +/* + * try to lock the utmpx and utmp files, only needed if we're doing + * wildcard matching + */ + + if (lockutx()) + return((struct utmpx *) NULL); + + setutxent(); + /* find the first alphanumeric character */ + for (i = 0; i < MAXVAL; ++i) { + if (isalnum(i)) + break; + } + (void) memset(saveid, i, IDLEN); + while (utp = getutxent()) { + if (idcmp(utmp->ut_id, utp->ut_id)) { + continue; + } + else { + if (utp->ut_type == DEAD_PROCESS) { + break; + } + else { + (void) memcpy(saveid, utp->ut_id, IDLEN); + } + } + } + if (utp) { + +/* + * found an unused entry, reuse it + */ + + (void) memcpy(utmp->ut_id, utp->ut_id, IDLEN); + utp = pututxline(utmp); + if (utp) + updwtmpx(WTMPX_FILE, utp); + endutxent(); + unlockutx(); + sendpid(ADDPID, (pid_t)utmp->ut_pid); + return(utp); + } + else { + +/* + * nothing available, try to allocate an id + */ + + if (allocid(utmp->ut_id, saveid)) { + endutxent(); + unlockutx(); + return((struct utmpx *) NULL); + } + else { + utp = pututxline(utmp); + if (utp) + updwtmpx(WTMPX_FILE, utp); + endutxent(); + unlockutx(); + sendpid(ADDPID, (pid_t)utmp->ut_pid); + return(utp); + } + } + } + else { + utp = pututxline(utmp); + if (utp) + updwtmpx(WTMPX_FILE, utp); + endutxent(); + sendpid(ADDPID, (pid_t)utmp->ut_pid); + return(utp); + } +} + + +/* + * modutx - modify a utmpx entry. Also notify init about new pids or + * old pids that it no longer needs to care about + * + * args: utp- point to utmpx structure to be created + */ + + +struct utmpx * +modutx(utp) +const struct utmpx *utp; +{ + register int i; /* scratch variable */ + struct utmpx utmp; /* holding area */ + register struct utmpx *ucp = &utmp; /* and a pointer to it */ + struct utmpx *up; /* "current" utmpx entry being examined */ + + for (i = 0; i < IDLEN; ++i) { + if (utp->ut_id[i] == SC_WILDC) + return((struct utmpx *) NULL); + } + /* copy the supplied utmpx structure someplace safe */ + utmp = *utp; + setutxent(); + while (up = getutxent()) { + if (idcmp(ucp->ut_id, up->ut_id)) + continue; + /* only get here if ids are the same, i.e. found right entry */ + if (ucp->ut_pid != up->ut_pid) { + sendpid(REMPID, (pid_t)up->ut_pid); + sendpid(ADDPID, (pid_t)ucp->ut_pid); + } + break; + } + up = pututxline(ucp); + if (ucp->ut_type == DEAD_PROCESS) + sendpid(REMPID, (pid_t)ucp->ut_pid); + if (up) + updwtmpx(WTMPX_FILE, up); + endutxent(); + return(up); +} + + +/* + * lockutx - lock utmpx and utmp files + */ + + + +/* + * idcmp - compare two id strings, return 0 if same, non-zero if not + * + * args: s1 - first id string + * s2 - second id string + */ + + +static +idcmp(s1, s2) +register char *s1; +register char *s2; +{ + register int i; /* scratch variable */ + + for (i = 0; i < IDLEN; ++i) { + if (*s1 != SC_WILDC && (*s1++ != *s2++)) + return(-1); + } + return(0); +} + + +/* + * allocid - allocate an unused id for utmp, either by recycling a + * DEAD_PROCESS entry or creating a new one. This routine only + * gets called if a wild card character was specified. + * + * args: srcid - pattern for new id + * saveid - last id matching pattern for a non-dead process + */ + + +static +allocid(srcid, saveid) +register char *srcid; +register unsigned char *saveid; +{ + register int i; /* scratch variable */ + int changed; /* flag to indicate that a new id has been generated */ + char copyid[IDLEN]; /* work area */ + + (void) memcpy(copyid, srcid, IDLEN); + changed = 0; + for (i = 0; i < IDLEN; ++i) { + /* if this character isn't wild, it'll be part of the generated id */ + if (copyid[i] != SC_WILDC) + continue; + /* it's a wild character, retrieve the character from the saved id */ + copyid[i] = saveid[i]; + /* if we haven't changed anything yet, try to find a new char to use */ + if (!changed && (saveid[i] < MAXVAL)) { + +/* + * Note: this algorithm is taking the "last matched" id and trying to make + * a 1 character change to it to create a new one. Rather than special-case + * the first time (when no perturbation is really necessary), just don't + * allocate the first valid id. + */ + + while (++saveid[i] <= MAXVAL) { + /* make sure new char is alphanumeric */ + if (isalnum(saveid[i])) { + copyid[i] = saveid[i]; + changed = 1; + break; + } + } + } + } + /* changed is true if we were successful in allocating an id */ + if (changed) { + (void) memcpy(srcid, copyid, IDLEN); + return(0); + } + else { + return(-1); + } +} + +static +lockutx() +{ + Fd = open(UTMPX_FILE, O_RDWR); + Fd1 = open(UTMP_FILE, O_RDWR); + if (Fd < 0 || Fd1 < 0) + return(-1); + if ((lockf(Fd, F_LOCK, 0) < 0) || (lockf(Fd1, F_LOCK, 0) <0)) + return(-1); + return(0); +} + + +/* + * unlockutx - unlock utmp and utmpx files + */ + + +static void +unlockutx() +{ + (void) lockf(Fd, F_ULOCK, 0); + (void) lockf(Fd1, F_ULOCK, 0); + (void) close(Fd); + (void) close(Fd1); +} + +/* + * sendpid - send message to init to add or remove a pid from the + * "godchild" list + * + * args: cmd - ADDPID or REMPID + * pid - pid of "godchild" + */ + + +static void +sendpid(cmd, pid) +int cmd; +pid_t pid; +{ + int fd; /* file desc. for init pipe */ + struct pidrec prec; /* place for message to be built */ + +/* + * if for some reason init didn't open initpipe, open it read/write + * here to avoid sending SIGPIPE to the calling process + */ + + fd = open(IPIPE, O_RDWR); + if (fd < 0) + return; + prec.pd_pid = pid; + prec.pd_type = cmd; + (void) write(fd, &prec, sizeof(struct pidrec)); + (void) close(fd); +} + + + +/* + * Following is from libc-port:gen/getutx.c + * It is duplicated here so that the file descriptor used by these + * routines can be shared above for locking. They are static to avoid + * name clashes + */ + +/* Routines to read and write the /etc/utmp file. */ +/* */ +#include +#include +#include + +#define MAXFILE 79 /* Maximum pathname length for "utmpx" file */ + + +static char utmpxfile[MAXFILE+1] = UTMPX_FILE; /* Name of the current utmpx */ +static char utmpfile[MAXFILE+1] = UTMP_FILE; /* and utmp like file. */ + +static long loc_utmp; /* Where in "utmpx" the current "ubuf" was + * found. + */ +static struct utmpx ubuf; /* Copy of last entry read in. */ + + +/* "getutxent" gets the next entry in the utmpx file. + */ + +static struct utmpx * +getutxent() +{ + extern int Fd; + extern char utmpxfile[]; + extern struct utmpx ubuf; + extern long loc_utmp; + extern int errno; + register char *u; + register int i; + struct stat stbuf, stxbuf; + +/* If the "utmpx" file is not open, attempt to open it for + * reading. If there is no file, attempt to create one. If + * both attempts fail, return NULL. If the file exists, but + * isn't readable and writeable, do not attempt to create. + */ + + if (Fd < 0) { + + /* Make sure files are in synch */ + if (synchutmp(utmpfile, utmpxfile)) { + return(NULL); + } + + if ((Fd = open(utmpxfile, O_RDWR|O_CREAT, 0644)) < 0) { + +/* If the open failed for permissions, try opening it only for + * reading. All "pututxline()" later will fail the writes. + */ + if ((Fd = open(utmpxfile, O_RDONLY)) < 0) + return(NULL); + } + } + +/* Try to read in the next entry from the utmpx file. */ + if (read(Fd,&ubuf,sizeof(ubuf)) != sizeof(ubuf)) { + +/* Make sure ubuf is zeroed. */ + for (i=0,u=(char *)(&ubuf); iut_type) { + +/* Do not look for an entry if the user sent us an EMPTY entry. */ + case EMPTY: + return(NULL); + +/* For RUN_LVL, BOOT_TIME, OLD_TIME, and NEW_TIME entries, only */ +/* the types have to match. If they do, return the address of */ +/* internal buffer. */ + case RUN_LVL: + case BOOT_TIME: + case OLD_TIME: + case NEW_TIME: + if (entry->ut_type == ubuf.ut_type) return(&ubuf); + break; + +/* For INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, and DEAD_PROCESS */ +/* the type of the entry in "ubuf", must be one of the above and */ +/* id's must match. */ + case INIT_PROCESS: + case LOGIN_PROCESS: + case USER_PROCESS: + case DEAD_PROCESS: + if (((type = ubuf.ut_type) == INIT_PROCESS + || type == LOGIN_PROCESS + || type == USER_PROCESS + || type == DEAD_PROCESS) + && ubuf.ut_id[0] == entry->ut_id[0] + && ubuf.ut_id[1] == entry->ut_id[1] + && ubuf.ut_id[2] == entry->ut_id[2] + && ubuf.ut_id[3] == entry->ut_id[3]) + return(&ubuf); + break; + +/* Do not search for illegal types of entry. */ + default: + return(NULL); + } + } + } while (getutxent() != NULL); + +/* Return NULL since the proper entry wasn't found. */ + return(NULL); +} + + +/* "pututxline" writes the structure sent into the utmpx file. */ +/* If there is already an entry with the same id, then it is */ +/* overwritten, otherwise a new entry is made at the end of the */ +/* utmp file. */ + +static struct utmpx * +pututxline(entry) +struct utmpx *entry; +{ + int fc; + struct utmpx *answer; + extern struct utmpx ubuf; + extern long loc_utmp; + extern int Fd,errno; + struct utmpx tmpbuf, savbuf; + +/* Copy the user supplied entry into our temporary buffer to */ +/* avoid the possibility that the user is actually passing us */ +/* the address of "ubuf". */ + tmpbuf = *entry; + getutxent(); + if (Fd < 0) { + return((struct utmpx *)NULL); + } +/* Make sure file is writable */ + if ((fc=fcntl(Fd, F_GETFL, NULL)) == -1 + || (fc & O_RDWR) != O_RDWR) { + return((struct utmpx *)NULL); + } + +/* Find the proper entry in the utmpx file. Start at the current */ +/* location. If it isn't found from here to the end of the */ +/* file, then reset to the beginning of the file and try again. */ +/* If it still isn't found, then write a new entry at the end of */ +/* the file. (Making sure the location is an integral number of */ +/* utmp structures into the file incase the file is scribbled.) */ + + if (getutxid(&tmpbuf) == NULL) { + setutxent(); + if (getutxid(&tmpbuf) == NULL) { + fcntl(Fd, F_SETFL, fc | O_APPEND); + } else { + lseek(Fd, -(long)sizeof(struct utmpx), 1); + } + } else { + lseek(Fd, -(long)sizeof(struct utmpx), 1); + } + +/* Write out the user supplied structure. If the write fails, */ +/* then the user probably doesn't have permission to write the */ +/* utmpx file. */ + if (write(Fd,&tmpbuf,sizeof(tmpbuf)) != sizeof(tmpbuf)) { + answer = (struct utmpx *)NULL; + } else { +/* Save the user structure that was overwritten. Copy the new user */ +/* structure into ubuf so that it will be up to date in the future. */ + savbuf = ubuf; + ubuf = tmpbuf; + answer = &ubuf; + + } + if (updutmp(entry)) { + lseek(Fd, -(long)sizeof(struct utmpx), 1); + write(Fd, &savbuf, sizeof(savbuf)); + answer = (struct utmpx *)NULL; + } + + fcntl(Fd, F_SETFL, fc); + return(answer); +} + +/* "setutxent" just resets the utmpx file back to the beginning. */ + +static void +setutxent() +{ + register char *ptr; + register int i; + extern int Fd; + extern struct utmpx ubuf; + extern long loc_utmp; + + if (Fd != -1) lseek(Fd,0L,0); +/* Zero the stored copy of the last entry read, since we are */ +/* resetting to the beginning of the file. */ + + for (i=0,ptr=(char*)&ubuf; i < sizeof(ubuf);i++) *ptr++ = '\0'; + loc_utmp = 0L; +} + +/* "endutxent" closes the utmpx file. */ + +static void +endutxent() +{ + extern int Fd; + extern long loc_utmp; + extern struct utmpx ubuf; + register char *ptr; + register int i; + + if (Fd != -1) close(Fd); + Fd = -1; + loc_utmp = 0; + for (i=0,ptr= (char *)(&ubuf); i < sizeof(ubuf);i++) *ptr++ = '\0'; +} + + +static +int updutmp(entry) +struct utmpx *entry; +{ + int fc, type; + extern int Fd1; + struct stat stbuf; + struct utmp ubuf, *uptr = NULL; + + if (Fd1 < 0) + if ((Fd1 = open(utmpfile, O_RDWR|O_CREAT, 0644)) < 0) { + return(1); + } + if ((fc = fcntl(Fd1, F_GETFL, NULL)) == -1) + return(1); + + while (read(Fd1, &ubuf, sizeof(ubuf)) == sizeof(ubuf)) { + if (ubuf.ut_type != EMPTY) { + switch (entry->ut_type) { + case EMPTY: + goto done; + case RUN_LVL: + case BOOT_TIME: + case OLD_TIME: + case NEW_TIME: + if (entry->ut_type == ubuf.ut_type) { + uptr = &ubuf; + goto done; + } + case INIT_PROCESS: + case LOGIN_PROCESS: + case USER_PROCESS: + case DEAD_PROCESS: + if (((type = ubuf.ut_type) == INIT_PROCESS + || type == LOGIN_PROCESS + || type == USER_PROCESS + || type == DEAD_PROCESS) + && ubuf.ut_id[0] == entry->ut_id[0] + && ubuf.ut_id[1] == entry->ut_id[1] + && ubuf.ut_id[2] == entry->ut_id[2] + && ubuf.ut_id[3] == entry->ut_id[3]) { + uptr = &ubuf; + goto done; + } + } + } + } + +done: + if (uptr) + lseek(Fd1, -(long)sizeof(ubuf), 1); + else + fcntl(Fd1, F_SETFL, fc|O_APPEND); + + getutmp(entry, &ubuf); + + if (write(Fd1, &ubuf, sizeof(ubuf)) != sizeof(ubuf)) { + return(1); + } + + fcntl(Fd1, F_SETFL, fc); + + close(Fd1); + Fd1 = -1; + + return(0); +} + diff --git a/usr/src/lib/libnsl/yp/dbm.c b/usr/src/lib/libnsl/yp/dbm.c index 0110c5a..2b65b7e 100644 --- a/usr/src/lib/libnsl/yp/dbm.c +++ b/usr/src/lib/libnsl/yp/dbm.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:dbm.c 1.2" +#ident "@(#)libyp:dbm.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -58,6 +57,7 @@ dbminit(file) dbrdonly = 1; } if(pagf < 0 || dirf < 0) { + printf("cannot open database %s\n", file); return(-1); } fstat(dirf, &statb); diff --git a/usr/src/lib/libnsl/yp/yp.mk b/usr/src/lib/libnsl/yp/yp.mk index b97d88f..4286310 100644 --- a/usr/src/lib/libnsl/yp/yp.mk +++ b/usr/src/lib/libnsl/yp/yp.mk @@ -7,7 +7,7 @@ -#ident "@(#)libyp:libyp.mk 1.10" +#ident "@(#)libyp:libyp.mk 1.8" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # PROPRIETARY NOTICE (Combined) @@ -32,7 +32,7 @@ # USRLIB = $(ROOT)/usr/lib INC = $(ROOT)/usr/include -CFLAGS= -O -Kpic -I$(INC) -D_NSL_RPC_ABI +CFLAGS= -O -Kpic -I$(INC) STRIP = strip SIZE = size LINT = lint @@ -48,7 +48,7 @@ LIBOBJS= ../dbm.o ../yp_all.o ../yp_bind.o ../yp_enum.o\ ../yp_b_clnt.o ../yp_b_xdr.o YPSRC= $(OBJS:.o=.c) -HDRS = dbm.h yp_prot.h ypclnt.h +HDRS = dbm.h yp_prot.h ypclnt.h ypupd.h all: $(OBJS) cp $(OBJS) ../ @@ -111,7 +111,6 @@ yp_order.o: yp_order.c\ yp_update.o: yp_update.c\ $(INC)/stdio.h\ $(INC)/rpc/rpc.h\ - $(INC)/rpcsvc/ypupd.h\ yp_b.h yperr_string.o: yperr_string.c\ @@ -130,7 +129,7 @@ ypprot_err.o: ypprot_err.c\ ypupd.o: ypupd.c\ $(INC)/rpc/rpc.h\ - $(INC)/rpcsvc/ypupd.h + ypupd.h ypxdr.o: ypxdr.c\ $(INC)/rpc/rpc.h\ diff --git a/usr/src/lib/libnsl/yp/yp_all.c b/usr/src/lib/libnsl/yp/yp_all.c index 48c9423..6235e23 100644 --- a/usr/src/lib/libnsl/yp/yp_all.c +++ b/usr/src/lib/libnsl/yp/yp_all.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_all.c 1.2" +#ident "@(#)libyp:yp_all.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -99,8 +98,8 @@ yp_all (domain, map, callback) } - if ((allc = clnt_create(pdomb->dom_binding->ypbind_servername, YPPROG, - YPVERS, "circuit_n")) == (CLIENT *) NULL) { + if ((allc = clnt_create(pdomb->dom_binding->ypbind_servername, YPPROG, YPVERS, + "circuit_v")) == (CLIENT *) NULL) { (void) syslog(LOG_ERR, clnt_spcreateerror("yp_all - transport level create failure")); return(YPERR_RPC); diff --git a/usr/src/lib/libnsl/yp/yp_b.h b/usr/src/lib/libnsl/yp/yp_b.h index ccb8c38..f992f78 100644 --- a/usr/src/lib/libnsl/yp/yp_b.h +++ b/usr/src/lib/libnsl/yp/yp_b.h @@ -5,9 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_b.h 1.2" - +#ident "@(#)libyp:yp_b.h 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -35,7 +33,33 @@ */ #include + #include "netconfig.h" + +struct netconfigx { + char *nc_netid; + u_long nc_semantics; + u_long nc_flag; + u_long nc_protofmly; + u_long nc_proto; + char *nc_device; + u_long nc_nlookups; + u_long nc_lookups; + u_long nc_unused[8]; +}; +typedef struct netconfigx netconfigx; +bool_t xdr_netconfigx(); + +struct netbufx { + u_int maxlen; + struct { + u_int buf_len; + char *buf_val; + } buf; +}; +typedef struct netbufx netbufx; +bool_t xdr_netbufx(); + #include extern bool_t xdr_netconfig(); @@ -67,7 +91,7 @@ struct domain { enum ypbind_resptype { YPBIND_SUCC_VAL = 1, - YPBIND_FAIL_VAL = 2 + YPBIND_FAIL_VAL = 2, }; typedef enum ypbind_resptype ypbind_resptype; bool_t xdr_ypbind_resptype(); @@ -85,7 +109,7 @@ bool_t xdr_ypbind_domain(); struct ypbind_binding { struct netconfig *ypbind_nconf; - struct netbuf *ypbind_svcaddr; + struct netbufx *ypbind_svcaddr; char *ypbind_servername; long ypbind_hi_vers; long ypbind_lo_vers; diff --git a/usr/src/lib/libnsl/yp/yp_b_xdr.c b/usr/src/lib/libnsl/yp/yp_b_xdr.c index 5711ed9..1b0277e 100644 --- a/usr/src/lib/libnsl/yp/yp_b_xdr.c +++ b/usr/src/lib/libnsl/yp/yp_b_xdr.c @@ -5,9 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_b_xdr.c 1.2" - +#ident "@(#)libyp:yp_b_xdr.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -30,9 +28,64 @@ * All rights reserved. */ #include -#include #include "yp_b.h" + +bool_t +xdr_netconfigx(xdrs, objp) + XDR *xdrs; + netconfigx *objp; +{ + if (!xdr_string(xdrs, &objp->nc_netid, ~0)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->nc_semantics)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->nc_flag)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->nc_protofmly)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->nc_proto)) { + return (FALSE); + } + if (!xdr_string(xdrs, &objp->nc_device, ~0)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->nc_nlookups)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->nc_lookups)) { + return (FALSE); + } + if (!xdr_vector(xdrs, (char *)objp->nc_unused, 8, sizeof(u_long), xdr_u_long)) { + return (FALSE); + } + return (TRUE); +} + + + + +bool_t +xdr_netbufx(xdrs, objp) + XDR *xdrs; + netbufx *objp; +{ + if (!xdr_u_int(xdrs, &objp->maxlen)) { + return (FALSE); + } + if (!xdr_bytes(xdrs, (char **)&objp->buf.buf_val, (u_int *)&objp->buf.buf_len, ~0)) { + return (FALSE); + } + return (TRUE); +} + + + + bool_t xdr_ypbind_resptype(xdrs, objp) XDR *xdrs; @@ -76,7 +129,7 @@ xdr_ypbind_binding(xdrs, objp) if (!xdr_pointer(xdrs, (char **)&objp->ypbind_nconf, sizeof(struct netconfig), xdr_netconfig)) { return (FALSE); } - if (!xdr_pointer(xdrs, (char **)&objp->ypbind_svcaddr, sizeof(struct netbuf), xdr_netbuf)) { + if (!xdr_pointer(xdrs, (char **)&objp->ypbind_svcaddr, sizeof(netbufx), xdr_netbufx)) { return (FALSE); } if (!xdr_string(xdrs, &objp->ypbind_servername, ~0)) { diff --git a/usr/src/lib/libnsl/yp/yp_bind.c b/usr/src/lib/libnsl/yp/yp_bind.c index ebf914a..6e168aa 100644 --- a/usr/src/lib/libnsl/yp/yp_bind.c +++ b/usr/src/lib/libnsl/yp/yp_bind.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_bind.c 1.3" +#ident "@(#)libyp:yp_bind.c 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -46,7 +45,7 @@ static char sccsid[] = "@(#)yp_bind.c 1.36 88/07/16 Copyr 1985 Sun Micro"; #include #define BFSIZE (YPMAXDOMAIN + 32) /* size of binding file */ -#define YPBINDPROTO "netpath" /* use anything*/ +#define YPBINDPROTO "visible" /* use anything*/ /* This should match the one in ypbind.c */ @@ -132,8 +131,7 @@ struct dom_binding **binding; /* if result == 0, ptr to dom_binding */ return (0); /* We are bound */ while(1){ - tb=clnt_create(_rpc_gethostname(), - (u_long)YPBINDPROG,YPBINDVERS,YPBINDPROTO); + tb=clnt_create(_rpc_gethostname(),YPBINDPROG,YPBINDVERS,YPBINDPROTO); if (tb==NULL) return(YPERR_YPBIND); for(tries=0;tries<5;tries++){ @@ -342,20 +340,18 @@ int *err; pdomb->dom_binding = ypbind_res->ypbind_resp_u.ypbind_bindinfo; /* - * Open up a path to the server, which will remain active globally. - */ - if ((pdomb->dom_client = clnt_tp_create( - pdomb->dom_binding->ypbind_servername, - (u_long) YPPROG, YPVERS, pdomb->dom_binding->ypbind_nconf)) + * Open up a path to the server, which will remain active globally. + */ + if ((pdomb->dom_client = clnt_tli_create(RPC_ANYFD, + pdomb->dom_binding->ypbind_nconf, + pdomb->dom_binding->ypbind_svcaddr, + YPPROG, YPVERS, RPCSMALLMSGSIZE, YPMSGSZ)) == NULL) { - clnt_pcreateerror("yp_bind: clnt_tp_create"); + clnt_pcreateerror("yp_bind:clnt_tli_create"); free((char *) pdomb); *err = YPERR_RPC; return (struct dom_binding *) (NULL); } -#ifdef DEBUG -printf("ypbind: clnt_tp_create suceeded\n"); -#endif pdomb->dom_pnext = bound_domains; /* Link this to the list as */ pdomb->dom_domain=malloc(strlen(domain)+(unsigned)1); @@ -370,6 +366,9 @@ printf("ypbind: clnt_tp_create suceeded\n"); return (pdomb); } + + + int usingypmap(ddn, map) char **ddn; /* the default domainname set by this routine */ diff --git a/usr/src/lib/libnsl/yp/yp_enum.c b/usr/src/lib/libnsl/yp/yp_enum.c index 4efb76a..1331102 100644 --- a/usr/src/lib/libnsl/yp/yp_enum.c +++ b/usr/src/lib/libnsl/yp/yp_enum.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_enum.c 1.2" +#ident "@(#)libyp:yp_enum.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -136,8 +135,6 @@ dofirst (domain, map, pdomb, timeout, key, keylen, val, vallen) * from this point. */ - memset((char *)&resp, 0, sizeof(struct ypresp_key_val)); - if(clnt_call(pdomb->dom_client, YPPROC_FIRST, xdr_ypreq_nokey, &req, xdr_ypresp_key_val, &resp, timeout) != RPC_SUCCESS) { return (YPERR_RPC); diff --git a/usr/src/lib/libnsl/yp/yp_master.c b/usr/src/lib/libnsl/yp/yp_master.c index 46378e5..ebdfefc 100644 --- a/usr/src/lib/libnsl/yp/yp_master.c +++ b/usr/src/lib/libnsl/yp/yp_master.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libyp:yp_master.c 1.3" +#ident "@(#)libyp:yp_master.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -102,7 +102,7 @@ yp_master (domain, map, master) } /* - * This talks v2 to ypserv + * This talks v3 to ypserv */ static int domaster (domain, map, pdomb, timeout, master) @@ -118,7 +118,7 @@ domaster (domain, map, pdomb, timeout, master) req.domain = domain; req.map = map; - memset((char *) &resp, 0, sizeof(struct ypresp_master)); + resp.master = NULL; /* * Do the get_master request. If the rpc call failed, return with diff --git a/usr/src/lib/libnsl/yp/yp_match.c b/usr/src/lib/libnsl/yp/yp_match.c index 38240cc..181d504 100644 --- a/usr/src/lib/libnsl/yp/yp_match.c +++ b/usr/src/lib/libnsl/yp/yp_match.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_match.c 1.2" +#ident "@(#)libyp:yp_match.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -273,7 +272,6 @@ domatch (domain, map, key, keylen, pdomb, timeout, val, vallen) resp.valdat.dptr = NULL; resp.valdat.dsize = 0; - memset((char *)&resp, 0, sizeof(struct ypresp_val)); /* * Do the match request. If the rpc call failed, return with status diff --git a/usr/src/lib/libnsl/yp/yp_order.c b/usr/src/lib/libnsl/yp/yp_order.c index a119599..ca242b2 100644 --- a/usr/src/lib/libnsl/yp/yp_order.c +++ b/usr/src/lib/libnsl/yp/yp_order.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_order.c 1.2" +#ident "@(#)libyp:yp_order.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -118,7 +117,7 @@ doorder (domain, map, pdomb, timeout, order) req.domain = domain; req.map = map; - memset((char *)&resp, 0, sizeof(struct ypresp_order)); + resp.ordernum = 0; /* * Do the get_order request. If the rpc call failed, return with diff --git a/usr/src/lib/libnsl/yp/yp_update.c b/usr/src/lib/libnsl/yp/yp_update.c index 09dcfc5..cecfa0a 100644 --- a/usr/src/lib/libnsl/yp/yp_update.c +++ b/usr/src/lib/libnsl/yp/yp_update.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yp_update.c 1.3" +#ident "@(#)libyp:yp_update.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -19,21 +18,21 @@ * * * -* Copyright Notice +* Copyright Notice * -* Notice of copyright on this source code product does not indicate +* Notice of copyright on this source code product does not indicate * publication. * * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. -*/ +*/ #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)yp_update.c 1.10 88/03/22 Copyr 1986 Sun Micro"; #endif /* - * YP updater interface + * Yellow Pages updater interface */ #include #include @@ -41,16 +40,15 @@ static char sccsid[] = "@(#)yp_update.c 1.10 88/03/22 Copyr 1986 Sun Micro"; #include #include -#define WINDOW (60*60) -#define TOTAL_TIMEOUT 300 +#define WINDOW (60*60) +#define TOTAL_TIMEOUT 300 + +/* + * Turn off debugging + */ +#define debugging 0 +#define debug(msg) -#ifdef DEBUG -#define debugging 1 -#define debug(msg) fprintf(stderr, "%s\n", msg); -#else -#define debugging 0 -#define debug(msg) -#endif extern AUTH *authdes_seccreate(); yp_update(domain, map, op, key, keylen, data, datalen) @@ -63,8 +61,9 @@ yp_update(domain, map, op, key, keylen, data, datalen) int datalen; { struct ypupdate_args args; - u_int rslt; + u_int rslt; struct timeval total; + struct netbuf server; CLIENT *client; char *ypmaster; char ypmastername[MAXNETNAMELEN+1]; @@ -74,22 +73,22 @@ yp_update(domain, map, op, key, keylen, data, datalen) switch (op) { case YPOP_DELETE: proc = YPU_DELETE; - break; + break; case YPOP_INSERT: proc = YPU_INSERT; - break; + break; case YPOP_CHANGE: proc = YPU_CHANGE; - break; + break; case YPOP_STORE: proc = YPU_STORE; - break; + break; default: - return (YPERR_BADARGS); + return(YPERR_BADARGS); } if (yp_master(domain, map, &ypmaster) != 0) { debug("no master found"); - return (YPERR_BADDB); + return (YPERR_BADDB); } client = clnt_create(ypmaster, YPU_PROG, YPU_VERS, "circuit_n"); @@ -102,36 +101,33 @@ yp_update(domain, map, op, key, keylen, data, datalen) } if (! host2netname(ypmastername, ypmaster, domain)) { - clnt_destroy(client); free(ypmaster); return (YPERR_BADARGS); } - client->cl_auth = authdes_seccreate(ypmastername, WINDOW, - ypmaster, NULL); + client->cl_auth = authdes_seccreate(ypmastername, WINDOW, + ypmaster, NULL); free(ypmaster); if (client->cl_auth == NULL) { debug("auth create failed"); clnt_destroy(client); - return (YPERR_RPC); + return (YPERR_RPC); } - args.mapname = map; + args.mapname = map; args.key.yp_buf_len = keylen; args.key.yp_buf_val = key; args.datum.yp_buf_len = datalen; args.datum.yp_buf_val = data; - total.tv_sec = TOTAL_TIMEOUT; - total.tv_usec = 0; + total.tv_sec = TOTAL_TIMEOUT; total.tv_usec = 0; clnt_control(client, CLSET_TIMEOUT, &total); stat = clnt_call(client, proc, xdr_ypupdate_args, &args, xdr_u_int, &rslt, total); if (stat != RPC_SUCCESS) { - debug("ypupdate RPC call failed"); - if (debugging) - clnt_perror(client, "ypupdate call failed"); + debug("ypu call failed"); + if (debugging) clnt_perror(client, "ypu call failed"); rslt = YPERR_RPC; } auth_destroy(client->cl_auth); diff --git a/usr/src/lib/libnsl/yp/yperr_string.c b/usr/src/lib/libnsl/yp/yperr_string.c index fe03e8e..e3cf57f 100644 --- a/usr/src/lib/libnsl/yp/yperr_string.c +++ b/usr/src/lib/libnsl/yp/yperr_string.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:yperr_string.c 1.2" +#ident "@(#)libyp:yperr_string.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -94,7 +93,7 @@ yperr_string(code) } case YPERR_PMAP: { - pmesg = "can't communicate with rpcbind"; + pmesg = "can't communicate with portmapper"; break; } diff --git a/usr/src/lib/libnsl/yp/ypmaint_xdr.c b/usr/src/lib/libnsl/yp/ypmaint_xdr.c index fa883fa..c9d3354 100644 --- a/usr/src/lib/libnsl/yp/ypmaint_xdr.c +++ b/usr/src/lib/libnsl/yp/ypmaint_xdr.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libyp:ypmaint_xdr.c 1.3" - +#ident "@(#)libyp:ypmaint_xdr.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -33,7 +32,7 @@ static char sccsid[] = "@(#)ypmaint_xdr.c 1.4 88/02/08 Copyr 1985 Sun Micro"; #endif /* - * This contains xdr routines used by the YP rpc interface + * This contains xdr routines used by the yellowpages rpc interface * for systems and maintenance programs only. This is a separate module * because most yp clients should not need to link to it. */ @@ -47,7 +46,7 @@ static char sccsid[] = "@(#)ypmaint_xdr.c 1.4 88/02/08 Copyr 1985 Sun Micro"; static bool xdr_ypmaplist(); static bool xdr_ypmaplist_wrap_string(); -extern char *calloc(); +extern unsigned int xdr_ypreq_newname_string(); /* * Serializes/deserializes a ypresp_master structure. @@ -159,7 +158,7 @@ xdr_ypreq_newxfr(xdrs, ps) return (xdr_ypmap_parms(xdrs, &ps->map_parms) && xdr_u_long(xdrs, &ps->transid) && xdr_u_long(xdrs, &ps->proto) && - xdr_string(xdrs, &ps->name, 256) ); + xdr_ypreq_newname_string(xdrs, &ps->name) ); } /* @@ -225,37 +224,16 @@ xdr_ypall(xdrs, callback) } } + bool_t xdr_netconfig(xdrs, objp) XDR *xdrs; struct netconfig *objp; { - char **tmp; - int i; - - if (!xdr_string(xdrs, &objp->nc_netid, ~0)) { - return (FALSE); - } - if (!xdr_u_long(xdrs, &objp->nc_semantics)) { - return (FALSE); - } - if (!xdr_u_long(xdrs, &objp->nc_flag)) { - return (FALSE); - } - if (!xdr_string(xdrs, &objp->nc_protofmly, ~0)) { - return (FALSE); - } - if (!xdr_string(xdrs, &objp->nc_proto, ~0)) { - return (FALSE); - } - if (!xdr_string(xdrs, &objp->nc_device, ~0)) { - return (FALSE); - } - if (!xdr_array(xdrs, &objp->nc_lookups, &objp->nc_nlookups, 100, sizeof (char *), xdr_wrapstring)) { - return (FALSE); - } - if (!xdr_vector(xdrs, (char *)objp->nc_unused, 8, sizeof(u_long), xdr_u_long)) { + if (!xdr_netconfigx(xdrs, objp)) { return (FALSE); } return (TRUE); } + + diff --git a/usr/src/lib/libnsl/yp/ypupd.c b/usr/src/lib/libnsl/yp/ypupd.c index 5dd11d6..98fb95d 100644 --- a/usr/src/lib/libnsl/yp/ypupd.c +++ b/usr/src/lib/libnsl/yp/ypupd.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libyp:ypupd.c 1.2" +#ident "@(#)libyp:ypupd.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -33,7 +33,7 @@ */ #include -#include +#include "ypupd.h" /* @(#)ypupdate_prot.x 1.4 88/02/08 Copyr 1986, Sun Micro */ /* diff --git a/usr/src/lib/libnsl/yp/ypupd.h b/usr/src/lib/libnsl/yp/ypupd.h new file mode 100644 index 0000000..25a1d51 --- /dev/null +++ b/usr/src/lib/libnsl/yp/ypupd.h @@ -0,0 +1,76 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libyp:ypupd.h 1.1" + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's UNIX(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +*/ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include + +/* + * Compiled from ypupdate_prot.x using rpcgen + * This is NOT source code! + * DO NOT EDIT THIS FILE! + */ +#define MAXMAPNAMELEN 255 +#define MAXYPDATALEN 1023 +#define MAXERRMSGLEN 255 + +#define YPU_PROG ((u_long)100028) +#define YPU_VERS ((u_long)1) +#define YPU_CHANGE ((u_long)1) +extern u_int *ypu_change_1(); +#define YPU_INSERT ((u_long)2) +extern u_int *ypu_insert_1(); +#define YPU_DELETE ((u_long)3) +extern u_int *ypu_delete_1(); +#define YPU_STORE ((u_long)4) +extern u_int *ypu_store_1(); + +typedef struct { + u_int yp_buf_len; + char *yp_buf_val; +} yp_buf; +bool_t xdr_yp_buf(); + +struct ypupdate_args { + char *mapname; + yp_buf key; + yp_buf datum; +}; +typedef struct ypupdate_args ypupdate_args; +bool_t xdr_ypupdate_args(); + +struct ypdelete_args { + char *mapname; + yp_buf key; +}; +typedef struct ypdelete_args ypdelete_args; +bool_t xdr_ypdelete_args(); diff --git a/usr/src/lib/libnsl/yp/ypxdr.c b/usr/src/lib/libnsl/yp/ypxdr.c index 10804e8..a6158ab 100644 --- a/usr/src/lib/libnsl/yp/ypxdr.c +++ b/usr/src/lib/libnsl/yp/ypxdr.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)libyp:ypxdr.c 1.2" +#ident "@(#)libyp:ypxdr.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -33,7 +32,7 @@ static char sccsid[] = "@(#)ypxdr.c 1.16 88/03/07 Copyr 1985 Sun Micro"; #endif /* - * This contains xdr routines used by the YP rpc interface. + * This contains xdr routines used by the yellowpages rpc interface. */ #define NULL 0 @@ -177,6 +176,7 @@ bool xdr_ypreq_newname_string(xdrs, ppstring) XDR * xdrs; char **ppstring; + { return (xdr_string(xdrs, ppstring, 256) ); } diff --git a/usr/src/lib/libpkg/ckvolseq.c b/usr/src/lib/libpkg/ckvolseq.c index fb24b24..8b09fcf 100644 --- a/usr/src/lib/libpkg/ckvolseq.c +++ b/usr/src/lib/libpkg/ckvolseq.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:ckvolseq.c 1.6.1.1" +#ident "@(#)libpkg:ckvolseq.c 1.6" #include #include @@ -82,7 +82,7 @@ int part, nparts; if(access(path, 0) == 0) return(0); if(part == 1) { - (void) sprintf(path, "%s/install", dir, part); + (void) sprintf(path, "%s/install.%d", dir, part); if(access(path, 0) == 0) return(0); } @@ -91,5 +91,19 @@ int part, nparts; return(2); } } - return(0); + + /* look for single volume specification */ + (void) sprintf(path, "%s/root", dir, part); + if(access(path, 0) == 0) + return(0); + (void) sprintf(path, "%s/reloc", dir, part); + if(access(path, 0) == 0) + return(0); + if(part == 1) { + (void) sprintf(path, "%s/install", dir); + if(access(path, 0) == 0) + return(0); + } + logerr(MSG_SEQ); + return(2); } diff --git a/usr/src/lib/libpkg/devtype.c b/usr/src/lib/libpkg/devtype.c index 621ff49..54dd0f5 100644 --- a/usr/src/lib/libpkg/devtype.c +++ b/usr/src/lib/libpkg/devtype.c @@ -6,11 +6,10 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:devtype.c 1.3.1.1" +#ident "@(#)libpkg:devtype.c 1.3" #include #include #include -#include extern char *devattr(); extern void logerr(), @@ -22,21 +21,16 @@ devtype(alias, devp) char *alias; struct pkgdev *devp; { - char *name; - struct stat statbuf; devp->mntflg = 0; devp->name = alias; - devp->dirname = devp->pathname = devp->mount = NULL; + devp->norewind = devp->dirname = devp->mount = NULL; devp->fstyp = devp->cdevice = devp->bdevice = NULL; devp->rdonly = 0; - devp->capacity = 0; - /* see if alias represents an existing file */ - if(alias[0] == '/') { - if(!isdir(alias)) { - devp->dirname = devp->name; - return(0); - } + /* see if alias represents an existing directory */ + if((alias[0] == '/') && !isdir(alias)) { + devp->dirname = devp->name; + return(0); /* directory */ } /* see if alias represents a mountable device (e.g., a floppy) */ @@ -50,40 +44,43 @@ struct pkgdev *devp; return(-1); } devp->dirname = devp->mount; + return(0); } else if(devp->mount) { free(devp->mount); devp->mount = NULL; } devp->cdevice = devattr(alias, "cdevice"); - if(devp->cdevice && devp->cdevice[0]) { - /* check for capacity */ - if(name = devattr(alias, "capacity")) { - if(name[0]) - devp->capacity = atol(name); - free(name); + if(!devp->cdevice || !devp->cdevice[0]) { + if(devp->cdevice) { + free(devp->cdevice); + devp->cdevice = NULL; } - /* mountable devices will always have associated raw device */ - return(0); - } - if(devp->cdevice) { - free(devp->cdevice); - devp->cdevice = NULL; + /* + * if it is not a raw device, it must be a directory + */ + devp->dirname = devattr(alias, "pathname"); + if(!devp->dirname || !devp->dirname[0] || + isdir(devp->dirname)) { + if(devp->dirname) { + free(devp->dirname); + devp->dirname = NULL; + } + return(-1); + } + return(0); /* directory */ } - /* - * if it is not a raw device, it must be a directory or a regular file + + /* + * device is not a directory and is not mountable + * so it must be able to support a datastream */ - name = devattr(alias, "pathname"); - if(!name || !name[0]) { - /* Assume a regular file */ - if(name) - free(name); - devp->pathname = alias; - return 0; + if((devp->norewind=devattr(alias,"norewind")) && devp->norewind[0]){ + devp->dirname = NULL; + return(0); /* tempdir */ + } else if(devp->norewind) { + free(devp->norewind); + devp->norewind = NULL; } - if(!isdir(name)) - devp->dirname = name; - else - devp->pathname = name; - return(0); + return(-1); } diff --git a/usr/src/lib/libpkg/dstream.c b/usr/src/lib/libpkg/dstream.c index 38631d4..9c9d514 100644 --- a/usr/src/lib/libpkg/dstream.c +++ b/usr/src/lib/libpkg/dstream.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:dstream.c 1.9.2.2" +#ident "@(#)libpkg:dstream.c 1.9.1.1" #include #include @@ -18,11 +18,8 @@ extern int errno; extern FILE *epopen(); extern int pkgnmchk(), - eptclose(), esystem(); extern void *calloc(), - ecleanup(), - cleanup(), rpterr(), progerr(), logerr(), @@ -30,17 +27,15 @@ extern void *calloc(), #define CMDSIZ 512 #define LSIZE 128 -#define DDPROC "/usr/bin/dd" -#define CPIOPROC "/usr/bin/cpio" +#define DDPROC "/bin/dd" +#define CPIOPROC "/bin/cpio" #define ERR_UNPACK "attempt to process datastream failed" -#define ERR_DSTREAMSEQ "datastream sequence corruption" #define MSG_MEM "no memory" #define MSG_CMDFAIL "- process <%s> failed, exit code %d" #define MSG_TOC "- bad format in datastream table-of-contents" #define MSG_EMPTY "- datastream table-of-contents appears to be empty" #define MSG_POPEN "- popen of <%s> failed, errno=%d" -#define MSG_OPEN "- open of <%s> failed, errno=%d" #define MSG_PCLOSE "- pclose of <%s> failed, errno=%d" #define MSG_PKGNAME "- invalid package name in datastream table-of-contents" #define MSG_NOPKG "- package <%s> not in datastream" @@ -52,32 +47,21 @@ struct dstoc { char pkg[16]; long nparts; long maxsiz; - char volnos[128]; struct dstoc *next; } *ds_head, *ds_toc; #define ds_nparts ds_toc->nparts #define ds_maxsiz ds_toc->maxsiz -int ds_totread; -int ds_fd = -1; -int ds_curpartcnt; -int ds_next(); - -static int ds_read; -static int ds_volno; /* volume number of current volume */ -static int ds_volcnt; /* total number of volumes */ -static char ds_volnos[128]; /* parts/volume info */ -static int ds_volpart; /* number of parts read in current volume, including skipped parts */ -static int ds_skippart; /* number of parts skipped in current volume */ -static int ds_getnextvol(), ds_skip(); +long ds_read; +int ds_next(), ds_skip(); void ds_order(list) char *list[]; { struct dstoc *toc_pt; - register int j, n; + register int i, j, n; char *pt; toc_pt = ds_head; @@ -95,195 +79,41 @@ char *list[]; } } -static char *pds_header; -static char *ds_header; -static int ds_headsize; - -static char * -ds_gets(buf, size) -char *buf; -int size; -{ - int length; - char *nextp; - - nextp = strchr(pds_header, '\n'); - if(nextp == NULL) { - length = strlen(pds_header); - if(length > size) - return 0; - if((ds_header = (char *)realloc(ds_header, ds_headsize + 512)) == NULL) - return 0; - if(read(ds_fd, ds_header + ds_headsize, 512) < 512) - return 0; - ds_headsize += 512; - nextp = strchr(pds_header, '\n'); - if(nextp == NULL) - return 0; - *nextp = '\0'; - if(length + (int)strlen(pds_header) > size) - return 0; - (void)strncpy(buf + length, pds_header, strlen(pds_header)); - buf[length + strlen(pds_header)] = '\0'; - pds_header = nextp + 1; - return buf; - } - *nextp = '\0'; - if((int)strlen(pds_header) > size) - return 0; - (void)strncpy(buf, pds_header, strlen(pds_header)); - buf[strlen(pds_header)] = '\0'; - pds_header = nextp + 1; - return buf; -} - -/* - * function to determine if media is datastream or mounted - * floppy - */ -int -ds_readbuf(device) -char *device; -{ - char buf[512]; - - if(ds_fd > 0) - (void)close(ds_fd); - if((ds_fd = open(device, 0)) >= 0 - && read(ds_fd, buf, 512) == 512 - && strncmp(buf, "# PaCkAgE DaTaStReAm", 20) == 0) { - if((ds_header = (char *)malloc(512)) == NULL) { - (void)close(ds_fd); - ds_fd = -1; - return 0; - } - memcpy(ds_header, buf, 512); - ds_headsize = 512; - return 1; - } else if(ds_fd >= 0) { - (void)close(ds_fd); - ds_fd = -1; - } - return 0; -} - -/* - * Determine how many additional volumes are needed for current package. - * Note: a 0 will occur as first volume number when the package begins - * on the next volume. - */ -static int -ds_volsum(toc) -struct dstoc *toc; -{ - int curpartcnt, volcnt; - char volnos[128], tmpvol[128]; - if(toc->volnos[0]) { - int index, sum; - sscanf(toc->volnos, "%d %[ 0-9]", &curpartcnt, volnos); - volcnt = 0; - sum = curpartcnt; - while(sum < toc->nparts && sscanf(volnos, "%d %[ 0-9]", &index, tmpvol) >= 1) { - (void)strcpy(volnos, tmpvol); - volcnt++; - sum += index; - } - /* side effect - set number of parts read on current volume */ - ds_volpart = index; - return volcnt; - } - ds_volpart += toc->nparts; - return 0; -} - -/* initialize ds_curpartcnt and ds_volnos */ -static void -ds_pkginit() -{ - if(ds_toc->volnos[0]) - sscanf(ds_toc->volnos, "%d %[ 0-9]", &ds_curpartcnt, ds_volnos); - else - ds_curpartcnt = -1; -} - -/* functions to pass current package info to exec'ed program */ -void -ds_putinfo(buf) -char *buf; -{ - (void)sprintf(buf, "%d %d %d %d %d %d %d %d %s", ds_fd, ds_volcnt, ds_volno, ds_totread, ds_volpart, ds_skippart, ds_toc->nparts, ds_toc->maxsiz, ds_toc->volnos); -} - -int -ds_getinfo(string) -char *string; -{ - ds_toc = (struct dstoc *)calloc(1, sizeof(struct dstoc)); - (void)sscanf(string, "%d %d %d %d %d %d %d %d %[ 0-9]", &ds_fd, &ds_volcnt, &ds_volno, &ds_totread, &ds_volpart, &ds_skippart, &ds_toc->nparts, &ds_toc->maxsiz, ds_toc->volnos); - ds_pkginit(); - return ds_toc->nparts; -} - int ds_init(device, pkg) char *device; char **pkg; { - struct dstoc *tail, *toc_pt; - char *ret; + struct dstoc *tail, *toc_pt; + FILE *pp; char cmd[CMDSIZ]; - char line[LSIZE+1]; + char line[LSIZE]; int i, n; - if(!ds_header) { - if(ds_fd >= 0) - (void)close(ds_fd); - if((ds_fd = open(device, 0)) < 0) { - rpterr(); - progerr(ERR_UNPACK); - logerr(MSG_OPEN, device, errno); - return -1; - } - if((ds_header = (char *)malloc(512)) == NULL) { - rpterr(); - progerr(ERR_UNPACK); - logerr(MSG_MEM); - return -1; - } - - if(read(ds_fd, ds_header, 512) != 512) { - rpterr(); - progerr(ERR_UNPACK); - logerr(MSG_TOC); - (void)close(ds_fd); - ds_fd = -1; - return -1; - } - ds_headsize = 512; + (void) sprintf(cmd, "%s if=%s", DDPROC, device); + if((pp = epopen(cmd, "r")) == NULL) { + rpterr(); + progerr(ERR_UNPACK); + logerr(MSG_POPEN, cmd, errno); + return(-1); } - pds_header = ds_header; + /* read datastream table of contents */ ds_head = tail = (struct dstoc *)0; - ds_volcnt = 1; - while(ret=ds_gets(line, LSIZE)) { - int length; - if(strcmp(line, "# end of header") == 0) - break; + while(fgets(line, LSIZE, pp)) { if(!line[0] || (line[0] == '#')) continue; toc_pt = (struct dstoc *) calloc(1, sizeof(struct dstoc)); if(!toc_pt) { progerr(ERR_UNPACK); logerr(MSG_MEM); - ecleanup(); return(-1); } - if((length = sscanf(line, "%14s %d %d %[ 0-9]", toc_pt->pkg, &toc_pt->nparts, - &toc_pt->maxsiz, toc_pt->volnos)) < 3) { + if(sscanf(line, "%14s %d %d", toc_pt->pkg, &toc_pt->nparts, + &toc_pt->maxsiz) != 3) { progerr(ERR_UNPACK); logerr(MSG_TOC); free(toc_pt); - ecleanup(); return(-1); } if(tail) { @@ -291,29 +121,33 @@ char **pkg; tail = toc_pt; } else ds_head = tail = toc_pt; - ds_volcnt += ds_volsum(toc_pt); } - if(!ret) { + sighold(SIGINT); + if(pclose(pp)) { + sigrelse(SIGINT); + rpterr(); progerr(ERR_UNPACK); - logerr(MSG_TOC); - return -1; + logerr(MSG_PCLOSE, cmd, errno); + return(-1); } - sighold(SIGINT); sigrelse(SIGINT); if(!ds_head) { progerr(ERR_UNPACK); logerr(MSG_EMPTY); return(-1); } + /* this could break, thanks to cpio command limit */ - (void) sprintf(cmd, "%s -icdumD -C 512 ", CPIOPROC); + (void) sprintf(cmd, "%s -icdum ", CPIOPROC); for(i=0; pkg[i]; i++) { if(!strcmp(pkg[i], "all")) continue; strcat(cmd, pkg[i]); strcat(cmd, "'/*' "); } - if(n = esystem(cmd, ds_fd, -1)) { + (void) strcat(cmd, "<"); + (void) strcat(cmd, device); + if(n = esystem(cmd)) { rpterr(); progerr(ERR_UNPACK); logerr(MSG_CMDFAIL, cmd, n); @@ -321,16 +155,16 @@ char **pkg; } ds_toc = ds_head; - ds_totread = 0; - ds_volno = 1; + ds_read = 0; return(0); } ds_findpkg(device, pkg) -char *device, *pkg; +char *device; +char *pkg; { + int nskip; char *pkglist[2]; - int nskip, ods_volpart; if(ds_head == NULL) { pkglist[0] = pkg; @@ -345,61 +179,52 @@ char *device, *pkg; return(-1); } + /* nskip should eventually contain the number of cpio archives + * to skip before we reach the package we're looking for + */ nskip = 0; - ds_volno = 1; - ds_volpart = 0; + while(ds_toc) { if(!strcmp(ds_toc->pkg, pkg)) break; - nskip += ds_toc->nparts; - ds_volno += ds_volsum(ds_toc); + nskip += (ds_toc->nparts - ds_read); ds_toc = ds_toc->next; + ds_read = 0; } if(!ds_toc) { progerr(ERR_UNPACK); logerr(MSG_NOPKG, pkg); return(-1); } - - ds_pkginit(); - ds_skippart = 0; - if(ds_curpartcnt > 0) { - ods_volpart = ds_volpart; - /* skip past archives belonging to last package on current volume */ - if(ds_volpart > 0 && ds_getnextvol(device)) - return -1; - ds_totread = nskip - ods_volpart; - if(ds_skip(device, ods_volpart)) - return -1; - } else if(ds_curpartcnt < 0) { - if(ds_skip(device, nskip - ds_totread)) - return -1; - } else - ds_totread = nskip; + ds_skip(device, nskip); ds_read = 0; return(ds_nparts); } -/* - * Get datastream part - * Call for first part should be preceded by - * call to ds_findpkg - */ - -ds_getpkg(device, n, dstdir) +ds_getpkg(device, pkg, n) char *device; +char *pkg; int n; -char *dstdir; { struct statfs buf; + int nskip; + + if(ds_findpkg(device, pkg) < 0) + return(1); if(ds_read >= ds_nparts) return(2); - if(ds_read == n) - return(0); - else if((ds_read > n) || (n > ds_nparts)) - return(2); + if(n) { + if(ds_read == n) + return(0); + else if((ds_read > n) || (n > ds_nparts)) + return(2); + nskip = n - ds_read - 1; + } else { + n = ds_read+1; + nskip = 0; + } if(ds_maxsiz > 0) { if(statfs(".", &buf, sizeof(buf), 0)) { @@ -413,107 +238,48 @@ char *dstdir; return(-1); } } - return ds_next(device, dstdir); -} - -static int -ds_getnextvol(device) -char *device; -{ - char prompt[128]; - int n; - - (void)sprintf(prompt, "Insert %%v %d of %d into %%p", ds_volno, ds_volcnt); - if(ds_fd >= 0) - (void)close(ds_fd); - if(n = getvol(device, NULL, NULL, prompt)) - return n; - if((ds_fd = open(device, 0)) < 0) - return -1; - ds_volpart = 0; - return 0; + if(ds_skip(device, nskip)) + return(-1); + return(ds_next(device)); } -/* - * called by ds_findpkg to skip past archives for unwanted packages - * in current volume - */ -static int +int ds_skip(device, nskip) -char *device; +char *device; int nskip; { char cmd[CMDSIZ]; - int n, onskip = nskip; + int n; while(nskip--) { /* skip this one */ - (void) sprintf(cmd, "%s -ictD -C 512 > /dev/null", CPIOPROC); - if(n = esystem(cmd, ds_fd, -1)) { + (void) sprintf(cmd, "%s if=%s of=/dev/null", DDPROC, + device); + ds_read++; + if(n = esystem(cmd)) { rpterr(); progerr(ERR_UNPACK); logerr(MSG_CMDFAIL, cmd, n); - nskip = onskip; - if(ds_volno == 1 || ds_volpart > 0) - return n; - if(n = ds_getnextvol(device)) - return n; + return(-1); } } - ds_totread += onskip; - ds_volpart = onskip; - ds_skippart = onskip; return(0); } -/* skip to end of package if necessary */ -void ds_skiptoend(device) -char *device; -{ - if(ds_read < ds_nparts && ds_curpartcnt < 0) - ds_skip(device, ds_nparts - ds_read); -} - - int -ds_next(device, instdir) +ds_next(device) char *device; -char *instdir; /* current directory where we are spooling package */ { - char cmd[CMDSIZ], tmpvol[128]; - int nparts, n, index; + char cmd[CMDSIZ]; + int n; - while(1) { - if(ds_read + 1 > ds_curpartcnt && ds_curpartcnt >= 0) { - ds_volno++; - if(n = ds_getnextvol(device)) - return n; - (void)sscanf(ds_volnos, "%d %[ 0-9]", &index, tmpvol); - (void)strcpy(ds_volnos, tmpvol); - ds_curpartcnt += index; - } - (void) sprintf(cmd, "%s -icdumD -C 512", CPIOPROC); - if(n = esystem(cmd, ds_fd, -1)) { - rpterr(); - progerr(ERR_UNPACK); - logerr(MSG_CMDFAIL, cmd, n); - } - if(ds_read == 0) - nparts = 0; - else - nparts = ds_toc->nparts; - if(n || (n = ckvolseq(instdir, ds_read + 1, nparts))) { - if(ds_volno == 1 || ds_volpart > ds_skippart) - return -1; - - if(n = ds_getnextvol(device)) - return n; - continue; - } - ds_read++; - ds_totread++; - ds_volpart++; - - return(0); + (void) sprintf(cmd, "%s -icdum <%s", CPIOPROC, device); + ds_read++; + if(n = esystem(cmd)) { + rpterr(); + progerr(ERR_UNPACK); + logerr(MSG_CMDFAIL, cmd, n); + return(-1); } + return(0); } diff --git a/usr/src/lib/libpkg/gpkglist.c b/usr/src/lib/libpkg/gpkglist.c index 24fa3ec..d1c50e0 100644 --- a/usr/src/lib/libpkg/gpkglist.c +++ b/usr/src/lib/libpkg/gpkglist.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:gpkglist.c 1.6.2.1" +#ident "@(#)libpkg:gpkglist.c 1.6.1.1" #include #include @@ -37,8 +37,6 @@ extern CKMENU *allocmenu(); #define MAXSIZE 128 #define MALLOCSIZ 128 -#define ERR_MEMORY "memory allocation failure, errno=%d" -#define ERR_NOPKG "no package associated with <%s>" #define HEADER "The following packages are available:" #define HELP \ "Please enter the package instances you wish to process \ @@ -103,11 +101,6 @@ char **pkg; if((++n % MALLOCSIZ) == 0) { nwpkg = (char **) realloc(nwpkg, (n+MALLOCSIZ)* sizeof(char**)); - if(nwpkg == NULL) { - progerr(ERR_MEMORY, errno); - errno = ENOMEM; - return(NULL); - } } chp = chp->next; nwpkg[n] = NULL; @@ -137,7 +130,8 @@ char **pkg; (void) fpkginst(NULL); inst = fpkginst(pkg[i], NULL, NULL); if(inst == NULL) { - progerr(ERR_NOPKG, pkg[i]); + progerr("no package associated with <%s>", + pkg[i]); free(nwpkg); nwpkg = NULL; errno = ESRCH; @@ -148,17 +142,12 @@ char **pkg; if((++n % MALLOCSIZ) == 0) { nwpkg = (char **) realloc(nwpkg, (n+MALLOCSIZ)* sizeof(char**)); - if(nwpkg == NULL) { - progerr(ERR_MEMORY, errno); - errno = ENOMEM; - return(NULL); - } } - nwpkg[n] = NULL; } while(inst = fpkginst(pkg[i], NULL, NULL)); } else { if(fpkginfo(&info, pkg[i])) { - progerr(ERR_NOPKG, pkg[i]); + progerr("no package associated with <%s>", + pkg[i]); free(nwpkg); nwpkg = NULL; errno = ESRCH; @@ -168,13 +157,7 @@ char **pkg; if((++n % MALLOCSIZ) == 0) { nwpkg = (char **) realloc(nwpkg, (n+MALLOCSIZ)* sizeof(char**)); - if(nwpkg == NULL) { - progerr(ERR_MEMORY, errno); - errno = ENOMEM; - return(NULL); - } } - nwpkg[n] = NULL; } } while(pkg[++i]); diff --git a/usr/src/lib/libpkg/gpkgmap.c b/usr/src/lib/libpkg/gpkgmap.c index c49c0c9..8168749 100644 --- a/usr/src/lib/libpkg/gpkgmap.c +++ b/usr/src/lib/libpkg/gpkgmap.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:gpkgmap.c 1.5.1.1" +#ident "@(#)libpkg:gpkgmap.c 1.5" #include #include @@ -201,8 +201,9 @@ FILE *fp; /* don't have to check for (mode < 0) since '-' is not a legal digit */ - if((ept->ainfo.mode != BADMODE) && ((ept->ainfo.mode > 07777) || - (strchr("cbdxp", ept->ftype) && (ept->ainfo.mode > 02000)))) { + if((ept->ainfo.mode > 07777) || + (strchr("cbdxp", ept->ftype) && + (ept->ainfo.mode > 02000))) { errstr = "illegal value for mode"; goto error; } diff --git a/usr/src/lib/libpkg/libpkg.mk b/usr/src/lib/libpkg/libpkg.mk index f239486..f244026 100644 --- a/usr/src/lib/libpkg/libpkg.mk +++ b/usr/src/lib/libpkg/libpkg.mk @@ -5,236 +5,62 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libpkg:libpkg.mk 1.13.2.3" - -# Makefile for - -ROOT = - -USRLIB = $(ROOT)/usr/lib - -INC = $(ROOT)/usr/include - -LDFLAGS = - -CFLAGS = -O -I$(INC) - -STRIP = strip - -SIZE = size - -INS = install - -#top# -# Generated by makefile 1.13.2.3 - -MAKEFILE = libpkg.mk - - -LIBRARY = libpkg.a - -OBJECTS = canonize.o ckvolseq.o cvtpath.o devtype.o dstream.o gpkglist.o \ - gpkgmap.o isdir.o logerr.o mappath.o pkgexecl.o pkgexecv.o \ - pkgmount.o pkgtrans.o pkgxpand.o ppkgmap.o progerr.o putcfile.o \ - rrmdir.o runcmd.o srchcfile.o tputcfent.o verify.o - -SOURCES = canonize.c ckvolseq.c cvtpath.c devtype.c dstream.c gpkglist.c \ - gpkgmap.c isdir.c logerr.c mappath.c pkgexecl.c pkgexecv.c \ - pkgmount.c pkgtrans.c pkgxpand.c ppkgmap.c progerr.c putcfile.c \ - rrmdir.c runcmd.c srchcfile.c tputcfent.c verify.c - -ALL: $(LIBRARY) - -$(LIBRARY): $(LIBRARY)(verify.o) $(LIBRARY)(tputcfent.o) \ - $(LIBRARY)(srchcfile.o) $(LIBRARY)(runcmd.o) \ - $(LIBRARY)(rrmdir.o) $(LIBRARY)(putcfile.o) \ - $(LIBRARY)(progerr.o) $(LIBRARY)(ppkgmap.o) \ - $(LIBRARY)(pkgxpand.o) $(LIBRARY)(pkgtrans.o) \ - $(LIBRARY)(pkgmount.o) $(LIBRARY)(pkgexecv.o) \ - $(LIBRARY)(pkgexecl.o) $(LIBRARY)(mappath.o) \ - $(LIBRARY)(logerr.o) $(LIBRARY)(isdir.o) \ - $(LIBRARY)(gpkgmap.o) $(LIBRARY)(gpkglist.o) \ - $(LIBRARY)(dstream.o) $(LIBRARY)(devtype.o) \ - $(LIBRARY)(cvtpath.o) $(LIBRARY)(ckvolseq.o) \ - $(LIBRARY)(canonize.o) - - -$(LIBRARY)(canonize.o) canonize.o: $(INC)/string.h - - -$(LIBRARY)(ckvolseq.o) ckvolseq.o: $(INC)/limits.h \ - $(INC)/pkgstrct.h $(INC)/stdio.h \ - $(INC)/sys/select.h $(INC)/sys/types.h - - -$(LIBRARY)(cvtpath.o) cvtpath.o: $(INC)/string.h - - -$(LIBRARY)(devtype.o) devtype.o: $(INC)/pkgdev.h \ - $(INC)/stdio.h $(INC)/string.h - - -$(LIBRARY)(dstream.o) dstream.o: $(INC)/fcntl.h \ - $(INC)/signal.h $(INC)/stdio.h \ - $(INC)/string.h $(INC)/sys/fcntl.h \ - $(INC)/sys/select.h $(INC)/sys/signal.h \ - $(INC)/sys/statfs.h $(INC)/sys/types.h - - -$(LIBRARY)(gpkglist.o) gpkglist.o: $(INC)/ctype.h \ - $(INC)/errno.h $(INC)/pkginfo.h \ - $(INC)/signal.h $(INC)/stdio.h \ - $(INC)/string.h $(INC)/sys/errno.h \ - $(INC)/sys/select.h $(INC)/sys/signal.h \ - $(INC)/sys/types.h $(INC)/valtools.h - - -$(LIBRARY)(gpkgmap.o) gpkgmap.o: $(INC)/ctype.h \ - $(INC)/limits.h $(INC)/pkgstrct.h \ - $(INC)/stdio.h $(INC)/string.h \ - $(INC)/sys/select.h $(INC)/sys/types.h - - -$(LIBRARY)(isdir.o) isdir.o: $(INC)/limits.h \ - $(INC)/sys/select.h $(INC)/sys/stat.h \ - $(INC)/sys/time.h $(INC)/sys/types.h \ - $(INC)/time.h - - -$(LIBRARY)(logerr.o) logerr.o: $(INC)/stdio.h \ - $(INC)/string.h $(INC)/varargs.h - - -$(LIBRARY)(mappath.o) mappath.o: $(INC)/ctype.h \ - $(INC)/limits.h $(INC)/string.h - - -$(LIBRARY)(pkgexecl.o) pkgexecl.o: $(INC)/signal.h \ - $(INC)/stdio.h $(INC)/string.h \ - $(INC)/sys/select.h $(INC)/sys/signal.h \ - $(INC)/sys/types.h $(INC)/varargs.h - - -$(LIBRARY)(pkgexecv.o) pkgexecv.o: $(INC)/signal.h \ - $(INC)/stdio.h $(INC)/string.h \ - $(INC)/sys/select.h $(INC)/sys/signal.h \ - $(INC)/sys/types.h - - -$(LIBRARY)(pkgmount.o) pkgmount.o: $(INC)/devmgmt.h \ - $(INC)/pkgdev.h $(INC)/pkginfo.h \ - $(INC)/stdio.h $(INC)/string.h \ - $(INC)/sys/mount.h $(INC)/sys/select.h \ - $(INC)/sys/types.h - - -$(LIBRARY)(pkgtrans.o) pkgtrans.o: $(INC)/ctype.h \ - $(INC)/dirent.h $(INC)/fcntl.h \ - $(INC)/limits.h $(INC)/pkgdev.h \ - $(INC)/pkginfo.h $(INC)/pkgstrct.h \ - $(INC)/pkgtrans.h $(INC)/signal.h \ - $(INC)/stdio.h $(INC)/string.h \ - $(INC)/sys/dirent.h $(INC)/sys/fcntl.h \ - $(INC)/sys/select.h $(INC)/sys/signal.h \ - $(INC)/sys/types.h $(INC)/varargs.h - - -$(LIBRARY)(pkgxpand.o) pkgxpand.o: $(INC)/limits.h \ - $(INC)/stdio.h $(INC)/string.h - - -$(LIBRARY)(ppkgmap.o) ppkgmap.o: $(INC)/limits.h \ - $(INC)/pkgstrct.h $(INC)/stdio.h \ - $(INC)/string.h $(INC)/sys/select.h \ - $(INC)/sys/types.h - - -$(LIBRARY)(progerr.o) progerr.o: $(INC)/stdio.h \ - $(INC)/varargs.h - - -$(LIBRARY)(putcfile.o) putcfile.o: $(INC)/limits.h \ - $(INC)/pkgstrct.h $(INC)/stdio.h \ - $(INC)/string.h $(INC)/sys/select.h \ - $(INC)/sys/types.h - - -$(LIBRARY)(rrmdir.o) rrmdir.o: $(INC)/limits.h - - -$(LIBRARY)(runcmd.o) runcmd.o: $(INC)/signal.h \ - $(INC)/stdio.h $(INC)/string.h \ - $(INC)/sys/select.h $(INC)/sys/signal.h \ - $(INC)/sys/types.h - - -$(LIBRARY)(srchcfile.o) srchcfile.o: $(INC)/ctype.h \ - $(INC)/limits.h $(INC)/pkgstrct.h \ - $(INC)/stdio.h $(INC)/string.h \ - $(INC)/sys/select.h $(INC)/sys/types.h - - -$(LIBRARY)(tputcfent.o) tputcfent.o: $(INC)/limits.h \ - $(INC)/pkgstrct.h $(INC)/stdio.h \ - $(INC)/string.h $(INC)/sys/select.h \ - $(INC)/sys/types.h - - -$(LIBRARY)(verify.o) verify.o: $(INC)/grp.h \ - $(INC)/limits.h $(INC)/pkgstrct.h \ - $(INC)/pwd.h $(INC)/stdio.h \ - $(INC)/string.h $(INC)/sys/mkdev.h \ - $(INC)/sys/select.h $(INC)/sys/stat.h \ - $(INC)/sys/time.h $(INC)/sys/types.h \ - $(INC)/sys/utime.h $(INC)/time.h \ - $(INC)/utime.h $(INC)/varargs.h - -GLOBALINCS = $(INC)/ctype.h $(INC)/devmgmt.h \ - $(INC)/dirent.h $(INC)/errno.h $(INC)/fcntl.h \ - $(INC)/grp.h $(INC)/limits.h $(INC)/pkgdev.h \ - $(INC)/pkginfo.h $(INC)/pkgstrct.h \ - $(INC)/pkgtrans.h $(INC)/pwd.h $(INC)/signal.h \ - $(INC)/stdio.h $(INC)/string.h $(INC)/sys/dirent.h \ - $(INC)/sys/errno.h $(INC)/sys/fcntl.h \ - $(INC)/sys/mkdev.h $(INC)/sys/mount.h \ - $(INC)/sys/select.h $(INC)/sys/signal.h \ - $(INC)/sys/stat.h $(INC)/sys/statfs.h \ - $(INC)/sys/time.h $(INC)/sys/types.h \ - $(INC)/sys/utime.h $(INC)/time.h $(INC)/utime.h \ - $(INC)/valtools.h $(INC)/varargs.h - +#ident "@(#)libpkg:libpkg.mk 1.13.1.10" +.c.a:; + +INC=$(ROOT)/usr/include +INCSYS=$(ROOT)/usr/include/sys +USRLIB=$(ROOT)/usr/lib +LIBPKG=libpkg.a +INSTALL=install +LINTLIBPKG=llib-lpkg.ln +LINTFILES=srchcfile.c putcfile.c \ + gpkgmap.c ppkgmap.c tputcfent.c \ + verify.c cvtpath.c mappath.c \ + canonize.c logerr.c progerr.c \ + dstream.c pkgtrans.c \ + gpkglist.c isdir.c runcmd.c \ + rrmdir.c ckvolseq.c devtype.c \ + pkgmount.c pkgexecv.c pkgexecl.c + +CFLAGS=-O -I $(INC) + +PKGINFO_FILES= \ + $(LIBPKG)(srchcfile.o) $(LIBPKG)(putcfile.o) \ + $(LIBPKG)(gpkgmap.o) $(LIBPKG)(ppkgmap.o) $(LIBPKG)(tputcfent.o)\ + $(LIBPKG)(verify.o) $(LIBPKG)(cvtpath.o) $(LIBPKG)(mappath.o) \ + $(LIBPKG)(canonize.o) $(LIBPKG)(logerr.o) $(LIBPKG)(progerr.o) \ + $(LIBPKG)(dstream.o) $(LIBPKG)(pkgtrans.o) \ + $(LIBPKG)(gpkglist.o) $(LIBPKG)(isdir.o) $(LIBPKG)(runcmd.o) \ + $(LIBPKG)(rrmdir.o) $(LIBPKG)(ckvolseq.o) $(LIBPKG)(devtype.o) \ + $(LIBPKG)(pkgmount.o) \ + $(LIBPKG)(pkgexecv.o) $(LIBPKG)(pkgexecl.o) + +all: $(LIBPKG) + +.PRECIOUS: $(LIBPKG) + +$(LIBPKG): $(PKGINFO_FILES) + $(CC) -c $(CFLAGS) $(PRESVR4) $(?:.o=.c) + $(AR) rv $(LIBPKG) $? + rm $? + +$(PKGINFO_FILES): $(INC)/pkginfo.h $(INC)/pkgstrct.h clean: - rm -f $(OBJECTS) - -clobber: - rm -f $(OBJECTS) $(LIBRARY) - -newmakefile: - makefile -m -f $(MAKEFILE) -L $(LIBRARY) -s INC $(INC) -#bottom# - -all : ALL - -install: ALL - install -f $(USRLIB) -m 644 $(LIBRARY) - -size: ALL - $(SIZE) $(LIBRARY) - -strip: ALL - -# These targets are useful but optional + rm -f lint.out llib-libpkg.ln -partslist: - @echo $(MAKEFILE) $(SOURCES) $(LOCALINCS) | tr ' ' '\012' | sort +clobber: clean + rm -f $(LIBPKG) -productdir: - @echo $(USRLIB) | tr ' ' '\012' | sort +strip: -product: - @echo $(LIBRARY) | tr ' ' '\012' | \ - sed 's;^;$(USRLIB)/;' +install: all + $(INSTALL) -f $(USRLIB) $(LIBPKG) + @if [ -f $(LINTLIBPKG) ] ;\ + then \ + $(INSTALL) -f $(ROOT)/usr/lib $(LINTLIBPKG) ;\ + fi -srcaudit: - @fileaudit $(MAKEFILE) $(LOCALINCS) $(SOURCES) -o $(OBJECTS) $(LIBRARY) +lintit: + lint -I $(INC) -u -o pkg $(LINTFILES) > lint.out 2>&1 diff --git a/usr/src/lib/libpkg/pkgexecv.c b/usr/src/lib/libpkg/pkgexecv.c index 40c7714..b0d7d50 100644 --- a/usr/src/lib/libpkg/pkgexecv.c +++ b/usr/src/lib/libpkg/pkgexecv.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:pkgexecv.c 1.8.1.2" +#ident "@(#)libpkg:pkgexecv.c 1.8.1.1" #include #include @@ -24,10 +24,9 @@ extern void exit(), /*VARARGS*/ int -pkgexecv(filein, fileout, arg, fd) +pkgexecv(filein, fileout, arg) char *filein, *fileout; char *arg[]; -int fd; { int n, status, upper, lower; pid_t pid; @@ -39,10 +38,8 @@ int fd; return(-1); } else if(pid) { /* parent */ - if(fd >= 0) - (void)close(fd); func = signal(SIGINT, SIG_IGN); - n = waitpid(pid, &status, 0); + n = wait(&status); if(n != pid) { progerr("wait for %d failed, pid=%d errno=%d", pid, n, errno); diff --git a/usr/src/lib/libpkg/pkgmount.c b/usr/src/lib/libpkg/pkgmount.c index 9aaadac..796ec71 100644 --- a/usr/src/lib/libpkg/pkgmount.c +++ b/usr/src/lib/libpkg/pkgmount.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:pkgmount.c 1.10.2.1" +#ident "@(#)libpkg:pkgmount.c 1.10" #include #include @@ -26,9 +26,9 @@ extern int getvol(), #define CMDSIZ 256 #define ERR_FSTYP "unable to determine fstype for <%s>" -#define MOUNT "/sbin/mount" -#define UMOUNT "/sbin/umount" -#define FSTYP "/sbin/fstyp" +#define MOUNT "/etc/mount" +#define UMOUNT "/etc/umount" +#define FSTYP "/etc/fstyp" #define LABEL0 "Insert %%v %d of %d for <%s> package into %%p." #define LABEL1 "Insert %%v for <%s> package into %%p." @@ -38,10 +38,10 @@ extern int getvol(), int Mntflg = 0; int -pkgmount(devp, pkg, part, nparts, getvolflg) +pkgmount(devp, pkg, part, nparts) struct pkgdev *devp; char *pkg; -int part, nparts, getvolflg; +int part, nparts; { int n, flags; char *pt, prompt[64], cmd[CMDSIZ]; @@ -57,10 +57,9 @@ int part, nparts, getvolflg; else (void) sprintf(prompt, LABEL3); - for(;;) { - if(getvolflg && (n = getvol(devp->bdevice, NULL, - (devp->rdonly ? 0 : DM_FORMFS|DM_WLABEL), prompt))) { + if(n = getvol(devp->bdevice, NULL, + (devp->rdonly ? 0 : DM_FORMFS|DM_WLABEL), prompt)) { if(n == 3) return(3); if(n == 2) @@ -69,32 +68,21 @@ int part, nparts, getvolflg; progerr("unable to obtain package volume"); return(99); } - getvolflg = 1; if(devp->fstyp == NULL) { (void) sprintf(cmd, "%s %s", FSTYP, devp->bdevice); if((pp = epopen(cmd, "r")) == NULL) { - rpterr(); logerr(ERR_FSTYP, devp->bdevice); continue; } cmd[0] = '\0'; - if(fgets(cmd, CMDSIZ, pp) == NULL) { - logerr(ERR_FSTYP, devp->bdevice); - (void) pclose(pp); - continue; - } - if(epclose(pp)) { - rpterr(); + fread(cmd, 1, CMDSIZ, pp); + if(pclose(pp)) { logerr(ERR_FSTYP, devp->bdevice); continue; } if(pt = strpbrk(cmd, " \t\n")) *pt = '\0'; - if(cmd[0] == '\0') { - logerr(ERR_FSTYP, devp->bdevice); - continue; - } devp->fstyp = strdup(cmd); } diff --git a/usr/src/lib/libpkg/pkgtrans.c b/usr/src/lib/libpkg/pkgtrans.c index a9d24e3..2ab11c3 100644 --- a/usr/src/lib/libpkg/pkgtrans.c +++ b/usr/src/lib/libpkg/pkgtrans.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:pkgtrans.c 1.15.3.1" +#ident "@(#)libpkg:pkgtrans.c 1.15.1.1" #include #include @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -26,9 +25,7 @@ extern int errno; extern char *pkgdir; extern FILE *epopen(); extern char **gpkglist(), *devattr(), *fpkginst(); -extern void free(), - ecleanup(), - progerr(), +extern void progerr(), logerr(), rpterr(), ds_order(); @@ -37,7 +34,6 @@ extern int getvol(), mkdir(), chdir(), access(), - eptclose(), ckvolseq(), isdir(), ds_init(), @@ -59,8 +55,7 @@ extern int getvol(), #define RELOC "reloc" #define ROOT "root" #define DDPROC "/bin/dd" -#define CPIOPROC "/usr/bin/cpio" -#define LSPROC "/usr/bin/ls" +#define CPIOPROC "/bin/cpio" #define MSG_TRANSFER "Transferring <%s> package instance\n" #define MSG_RENAME "\t... instance renamed <%s> on destination\n" @@ -71,7 +66,6 @@ extern int getvol(), #define MSG_SEQUENCE "- volume is out of sequence" #define MSG_MEM "- no memory" #define MSG_CMDFAIL "- process <%s> failed, exit code %d" -#define MSG_CMDBIG "- command line too big - <%s>" #define MSG_POPEN "- popen of <%s> failed, errno=%d" #define MSG_PCLOSE "- pclose of <%s> failed, errno=%d" #define MSG_BADDEV "- invalid or unknown device <%s>" @@ -94,18 +88,11 @@ extern int getvol(), "- identical version of <%s> already exists on destination device" #define MSG_TWODSTREAM \ "- both source and destination devices cannot be a datastream" -#define MSG_NOSPACE "- not enough space on device" -#define MSG_HDRLARGE "- datastream header line too large" -#define MSG_OPEN "- open of <%s> failed, errno=%d" static struct pkgdev srcdev, dstdev; static char *tmpdir; static char *tmppath; static char dstinst[16]; -static char *ids_name, *ods_name; -static int ds_volcnt; -static int ds_volno; -static int ds_fd = -1; /* open file descriptor for data stream */ static void (*func)(); static void cleanup(), sigtrap(); static int pkgxfer(), wdsheader(), ckoverwrite(); @@ -145,34 +132,39 @@ char *device; return(0); } - /* check for datastream */ - if(n=pkgtrans(device, (char *)0, allpkg, PT_SILENT|PT_INFO_ONLY)) - return(n); + if(devtype(device, &srcdev)) { + progerr(ERR_TRANSFER); + logerr(MSG_BADDEV, device); + return(1); + } + srcdev.rdonly++; + + if(srcdev.norewind) { + /* need to provide a temp directory where we can + * unwrap the datastream + */ + tmppath = tmpnam(NULL); + tmppath = strdup(tmppath); + if(tmppath == NULL) { + progerr(ERR_TRANSFER); + logerr(MSG_MEM); + return(1); + } + if(mkdir(tmppath, 0755)) { + progerr(ERR_TRANSFER); + logerr(MSG_MKDIR, tmppath); + return(1); + } + if(n=pkgtrans(device, tmppath, allpkg, PT_SILENT|PT_INFO_ONLY)) + return(n); /* pkgtrans has set pkgdir */ + } else if(srcdev.mount) { + pkgmount(&srcdev, NULL, 1, 0); + pkgdir = srcdev.mount; + } return(0); } -static char *hdrbuf; -static char *pinput, *nextpinput; - -static char * -mgets(buf, size) -char *buf; -int size; -{ - nextpinput = strchr(pinput, '\n'); - if(nextpinput == NULL) - return 0; - *nextpinput = '\0'; - if((int)strlen(pinput) > size) - return 0; - (void)strncpy(buf, pinput, strlen(pinput)); - buf[strlen(pinput)] = '\0'; - pinput = nextpinput + 1; - return buf; -} - - /* will return 0, 1, 3, or 99 */ int pkgtrans(device1, device2, pkg, options) @@ -192,94 +184,32 @@ int options; } srcdev.rdonly++; - - /* check for datastream */ - ids_name = NULL; - if(srcdev.bdevice) { - if(n = getvol(srcdev.bdevice, NULL, NULL, "Insert %v into %p.")) { - cleanup(); - if(n == 3) - return(3); - progerr(ERR_TRANSFER); - logerr(MSG_GETVOL); - return(1); - } - if(ds_readbuf(srcdev.cdevice)) - ids_name = srcdev.cdevice; - } - - if(srcdev.cdevice && !srcdev.bdevice) - ids_name = srcdev.cdevice; - else if(srcdev.pathname) - ids_name = srcdev.pathname; - - if(!ids_name && device2 == (char *)0) { - pkgmount(&srcdev, NULL, 1, 0, 0); - return 0; - } - - if(ids_name && device2 == (char *)0) { - tmppath = tmpnam(NULL); - tmppath = strdup(tmppath); - if(tmppath == NULL) { - progerr(ERR_TRANSFER); - logerr(MSG_MEM); - return(1); - } - if(mkdir(tmppath, 0755)) { - progerr(ERR_TRANSFER); - logerr(MSG_MKDIR, tmppath); - return(1); - } - device2 = tmppath; - } - if(devtype(device2, &dstdev)) { progerr(ERR_TRANSFER); logerr(MSG_BADDEV, device2); return(1); } - if((srcdev.cdevice && dstdev.cdevice) && - !strcmp(srcdev.cdevice, dstdev.cdevice)) { + if(srcdev.norewind && dstdev.norewind) { progerr(ERR_TRANSFER); - logerr(MSG_SAMEDEV); + logerr(MSG_TWODSTREAM); return(1); } - - ods_name = NULL; - if(dstdev.cdevice && !dstdev.bdevice || dstdev.pathname) - options |= PT_ODTSTREAM; - - if(options & PT_ODTSTREAM) { - if(!((ods_name = dstdev.cdevice) || (ods_name = dstdev.pathname))) { - progerr(ERR_TRANSFER); - logerr(MSG_BADDEV, device2); - return(1); - } - if(ids_name) { - progerr(ERR_TRANSFER); - logerr(MSG_TWODSTREAM); - return 1; - } - } - - if((srcdev.dirname && dstdev.dirname) && - !strcmp(srcdev.dirname, dstdev.dirname)) { + if((srcdev.bdevice && dstdev.bdevice) && + !strcmp(srcdev.bdevice, dstdev.bdevice)) { progerr(ERR_TRANSFER); logerr(MSG_SAMEDEV); return(1); } - - if((srcdev.pathname && dstdev.pathname) && - !strcmp(srcdev.pathname, dstdev.pathname)) { + if((srcdev.dirname && dstdev.dirname) && + !strcmp(srcdev.dirname, dstdev.dirname)) { progerr(ERR_TRANSFER); logerr(MSG_SAMEDEV); return(1); } - if(ids_name) { - if(srcdev.cdevice && !srcdev.bdevice && (n = getvol(srcdev.cdevice, NULL, NULL, NULL))) { + if(srcdev.norewind) { + if(n = getvol(srcdev.cdevice, NULL, NULL, NULL)) { cleanup(); if(n == 3) return(3); @@ -289,25 +219,31 @@ int options; } if(srcdev.dirname = tmpnam(NULL)) tmpdir = srcdev.dirname = strdup(srcdev.dirname); - if((srcdev.dirname == NULL) || mkdir(srcdev.dirname, 0755) || + if((srcdev.dirname == NULL) || mkdir(srcdev.dirname) || chdir(srcdev.dirname)) { progerr(ERR_TRANSFER); logerr(MSG_NOTEMP, srcdev.dirname); cleanup(); return(1); } - if(ds_init(ids_name, pkg)) { + if(ds_init(srcdev.norewind, pkg)) { cleanup(); return(1); } } else if(srcdev.mount) { - if(n = pkgmount(&srcdev, NULL, 1, 0, 0)) { + if(n = pkgmount(&srcdev, NULL, 1, 0)) { cleanup(); return(n); } } - src = srcdev.dirname; + + if(dstdev.mount) { + if(n = pkgmount(&dstdev, NULL, 0, 0)) { + cleanup(); + return(n); + } + } dst = dstdev.dirname; if(chdir(src)) { @@ -327,239 +263,117 @@ int options; for(nxpkg=0; pkg[nxpkg]; ) nxpkg++; /* count */ - if(ids_name) + if(srcdev.norewind) ds_order(pkg); /* order requests */ - if(options & PT_ODTSTREAM) { - char line[128]; - if(!dstdev.pathname && (n = getvol(ods_name, NULL, NULL, NULL)) ) { + if(dstdev.norewind) { + if(n = getvol(dstdev.cdevice, NULL, NULL, NULL)) { cleanup(); if(n == 3) return(3); progerr(ERR_TRANSFER); logerr(MSG_GETVOL); return(1); - } - if(wdsheader(src, ods_name, pkg)) { + } + if(wdsheader(src, dstdev.norewind, pkg)) { cleanup(); return(1); } - ds_volno = 1; /* number of volumes in datastream */ - pinput = hdrbuf; - /* skip past first line in header */ - (void)mgets(line, 128); } errflg = 0; - for(i=0; pkg[i]; i++) { - if(!(options & PT_ODTSTREAM) && dstdev.mount) { - if(n = pkgmount(&dstdev, NULL, 0, 0, 1)) { - cleanup(); - return(n); - } - } if(errflg = pkgxfer(pkg[i], options)) { pkg[i] = NULL; - if((options & PT_ODTSTREAM) || (errflg != 2)) + if(dstdev.norewind || (errflg != 2)) break; } else if(strcmp(dstinst, pkg[i])) pkg[i] = strdup(dstinst); } - if(!(options & PT_ODTSTREAM) && dst) + if((dstdev.norewind == NULL) && dst) pkgdir = strdup(dst); cleanup(); return(errflg); } - static int wdsheader(src, device, pkg) char *src, *device, **pkg; { - FILE *fp; + FILE *pp, *fp; char path[PATH_MAX], cmd[CMDSIZ]; - int i, n, nparts, maxpsize; - int partcnt, totsize; - int hdrsize = 512; - char *hp; - struct stat statbuf; + int i, nparts, maxpsize; - if((hdrbuf = (char *)malloc(512)) == NULL) { - progerr(ERR_TRANSFER); - logerr(MSG_MEM); - return(1); - } - - if(ds_fd >= 0) - (void)close(ds_fd); - if(dstdev.pathname) - ds_fd = creat(device, 0644); - else - ds_fd = open(device, 1); - if(ds_fd < 0) { - progerr(ERR_TRANSFER); - logerr(MSG_OPEN, device, errno); - return(1); - } - nparts = maxpsize = 0; - (void) sprintf(hdrbuf, "# PaCkAgE DaTaStReAm\n"); - hp = hdrbuf + strlen(hdrbuf); - - totsize = 0; - for(i=0; pkg[i]; i++) { - (void) sprintf(path, "%s/%s/%s", src, pkg[i], PKGINFO); - if(stat(path, &statbuf) < 0) { - progerr(ERR_TRANSFER); - logerr(MSG_BADPKGINFO); - ecleanup(); - return(1); - } - totsize += statbuf.st_size/512 + 1; - } - - /* - * totsize contains number of blocks used by header plus - * extra pkginfo files + /* + * open pipe to dd() so that we can write the + * datastream header to the device */ - totsize += i/4 + 1; - if(dstdev.capacity && totsize > dstdev.capacity) { + (void) sprintf(cmd, "%s of=%s", DDPROC, device); + if((pp = epopen(cmd, "w")) == NULL) { + rpterr(); progerr(ERR_TRANSFER); - logerr(MSG_NOSPACE); - ecleanup(); + logerr(MSG_POPEN, cmd, errno); return(1); } - ds_volcnt = 1; + nparts = maxpsize = 0; + (void) fprintf(pp, "# OA&M DATASTREAM FORMAT 1.0\n"); for(i=0; pkg[i]; i++) { - partcnt = 0; (void) sprintf(path, "%s/%s/%s", src, pkg[i], PKGMAP); if((fp = fopen(path, "r")) == NULL) { progerr(ERR_TRANSFER); logerr(MSG_NOPKGMAP, pkg[i]); sighold(SIGINT); + (void) pclose(pp); sigrelse(SIGINT); - ecleanup(); return(1); } if(fscanf(fp, ":%d%d", &nparts, &maxpsize) != 2) { progerr(ERR_TRANSFER); logerr(MSG_NOSIZE); (void) fclose(fp); - ecleanup(); - return(1); - } - if(dstdev.capacity && maxpsize > dstdev.capacity) { - progerr(ERR_TRANSFER); - logerr(MSG_NOSPACE); - (void) fclose(fp); - ecleanup(); - return(1); - } - - - (void) sprintf(hp, "%s %d %d", pkg[i], nparts, maxpsize); - totsize += nparts * maxpsize; - if(dstdev.capacity && dstdev.capacity < totsize) { - int lastpartcnt = 0; - /* if(i != 0) { - progerr(ERR_TRANSFER); - logerr(MSG_NOSPACE); - (void) fclose(fp); - ecleanup(); - return(1); - } */ - - if(totsize) - totsize -= nparts * maxpsize; - while(partcnt < nparts) { - while(totsize <= dstdev.capacity && partcnt <= nparts) { - totsize += maxpsize; - partcnt++; - } - /* partcnt == 0 means skip to next volume */ - if(partcnt) - partcnt--; - (void) sprintf(hdrbuf + strlen(hdrbuf), " %d", partcnt - lastpartcnt); - ds_volcnt++; - totsize = 0; - lastpartcnt = partcnt; - } - /* first parts/volume number does not count */ - ds_volcnt--; - } - (void) sprintf(hdrbuf + strlen(hdrbuf), "\n"); - - if(strlen(hp) > (size_t)128) { - progerr(ERR_TRANSFER); - logerr(MSG_HDRLARGE); - (void) fclose(fp); - ecleanup(); return(1); } - - hp = hdrbuf + strlen(hdrbuf); - if(strlen(hdrbuf) + 1 > (size_t)hdrsize) { - - if((hdrbuf = (char *)realloc(hdrbuf, hdrsize + 512)) == NULL) { - progerr(ERR_TRANSFER); - logerr(MSG_MEM); - (void) fclose(fp); - ecleanup(); - return(1); - } - hdrsize += 512; - } + (void) fprintf(pp, "%s %d %d\n", pkg[i], nparts, maxpsize); (void) fclose(fp); } sighold(SIGINT); + if(pclose(pp)) { + sigrelse(SIGINT); + rpterr(); + progerr(ERR_TRANSFER); + logerr(MSG_PCLOSE, cmd, errno); + return(1); + } sigrelse(SIGINT); - if(strlen(hdrbuf) + 17 > (size_t)hdrsize) { - - if((hdrbuf = (char *)realloc(hdrbuf, hdrsize + 512)) == NULL) { - progerr(ERR_TRANSFER); - logerr(MSG_MEM); - (void) fclose(fp); - ecleanup(); - return(1); - } - hdrsize += 512; - } - (void) sprintf(hdrbuf + strlen(hdrbuf), "# end of header\n"); - write(ds_fd, hdrbuf, hdrsize); - /* * write the first cpio() archive to the datastream * which should contain the pkginfo & pkgmap files * for all packages */ - sprintf(cmd, "%s ", LSPROC); - for(i=0; pkg[i]; i++) { - if(strlen(cmd) > (size_t)CMDSIZ) { - progerr(ERR_TRANSFER); - logerr(MSG_CMDBIG, cmd); - cleanup(); - return 1; - } - (void) sprintf(cmd + strlen(cmd), "%s/%s ", pkg[i], PKGINFO); - (void) sprintf(cmd + strlen(cmd), "%s/%s ", pkg[i], PKGMAP); - } - if(strlen(cmd) + 30 > (size_t)CMDSIZ) { + (void) sprintf(cmd, "%s -oc >%s", CPIOPROC, device); + if((pp = epopen(cmd, "w")) == NULL) { + rpterr(); progerr(ERR_TRANSFER); - logerr(MSG_CMDBIG, cmd); + logerr(MSG_POPEN, cmd, errno); cleanup(); - return 1; - } - (void) sprintf(cmd + strlen(cmd), " | %s -ocD -C 512", CPIOPROC); - if(n = esystem(cmd, -1, ds_fd)) { + return(1); + } + for(i=0; pkg[i]; i++) { + (void) fprintf(pp, "%s/%s\n", pkg[i], PKGINFO); + (void) fprintf(pp, "%s/%s\n", pkg[i], PKGMAP); + } + sighold(SIGINT); + if(pclose(pp)) { + sigrelse(SIGINT); rpterr(); progerr(ERR_TRANSFER); - logerr(MSG_CMDFAIL, cmd, n); - cleanup(); + logerr(MSG_PCLOSE, cmd, errno); return(1); } + sigrelse(SIGINT); return(0); } @@ -593,10 +407,8 @@ int options; char dstdir[PATH_MAX], temp[PATH_MAX], srcdir[PATH_MAX], - cmd[CMDSIZ], - pkgname[16]; - int i, n, part, nparts, maxpartsize, curpartcnt; - char volnos[128], tmpvol[128]; + cmd[CMDSIZ]; + int i, n, part, nparts, maxpartsiz; info.pkginst = NULL; /* required initialization */ @@ -614,7 +426,7 @@ int options; (void) fprintf(stderr, MSG_TRANSFER, srcinst); (void) strcpy(dstinst, srcinst); - if(!(options & PT_ODTSTREAM)) { + if(dstdev.norewind == NULL) { /* destination is a (possibly mounted) directory */ (void) sprintf(dstdir, "%s/%s", dst, dstinst); @@ -647,27 +459,14 @@ int options; (void) sprintf(dstdir, "%s/%s", dst, dstinst); } else { progerr(ERR_TRANSFER); - logerr(MSG_DUPVERS, srcinst); + logerr(MSG_DUPVERS, temp); (void) fpkginfo(&info, NULL); (void) fpkginst(NULL); return(2); } - } else if(options & PT_RENAME) { - /* - * find next available instance by appending numbers - * to the package abbreviation until the instance - * does not exist in the destination directory - */ - if(pt = strchr(temp, '.')) - *pt = '\0'; - for(i=2; (access(dstdir, 0) == 0); i++) { - (void) sprintf(dstinst, "%s.%d", temp, i); - (void) sprintf(dstdir, "%s/%s", dst, dstinst); - } } else if(options & PT_OVERWRITE) { /* we're allowed to overwrite, but there seems - * to be no valid package to overwrite, and we are - * not allowed to rename the destination, so act + * to be no valid package to overwrite, so act * as if we weren't given permission to overwrite * --- this keeps us from removing a destination * instance which is named the same as the source @@ -678,7 +477,17 @@ int options; (void) fpkginfo(&info, NULL); (void) fpkginst(NULL); - if(ckoverwrite(dst, dstinst, options)) + if(options & PT_RENAME) { + /* + * find next available instance by appending numbers + * to the package abbreviation until the instance + * does not exist in the destination directory + */ + for(i=2; (access(dstdir, 0) == 0); i++) { + (void) sprintf(dstinst, "%s.%d", temp, i); + (void) sprintf(dstdir, "%s/%s", dst, dstinst); + } + } else if(ckoverwrite(dst, dstinst, options)) return(2); if(isdir(dstdir) && mkdir(dstdir, 0755)) { @@ -698,7 +507,7 @@ int options; return(1); } - if(ids_name) { /* unpack the datatstream into a directory */ + if(srcdev.norewind) { /* unpack the datatstream into a directory */ /* * transfer pkginfo & pkgmap first */ @@ -709,9 +518,9 @@ int options; logerr(MSG_POPEN, cmd, errno); return(1); } - (void)fprintf(pp, "%s\n%s\n", PKGINFO, PKGMAP); + (void) (void) fprintf(pp, "%s\n%s\n", PKGINFO, PKGMAP); sighold(SIGINT); - if(epclose(pp)) { + if(pclose(pp)) { sigrelse(SIGINT); rpterr(); progerr(ERR_TRANSFER); @@ -733,24 +542,24 @@ int options; * for each part of the package, use cpio() to * unpack the archive into the destination directory */ - nparts = ds_findpkg(srcdev.cdevice, srcinst); + nparts = ds_findpkg(srcdev.norewind, srcinst); if(nparts < 0) { progerr(ERR_TRANSFER); return(1); } for(part=1; part <= nparts;) { - if(ds_getpkg(srcdev.cdevice, part, dstdir)) { + if(ds_getpkg(srcdev.norewind, srcinst, part)) { progerr(ERR_TRANSFER); return(1); } part++; - if(dstdev.mount) { + if(dstdev.mount) { (void) chdir("/"); if(pkgumount(&dstdev)) return(1); if(part <= nparts) { if(n = pkgmount(&dstdev, NULL, part+1, - nparts, 1)) + nparts)) return(n); if(ckoverwrite(dst, dstinst, options)) return(1); @@ -777,7 +586,7 @@ int options; return(1); } (void) fprintf(pp, "pkginfo"); - if(epclose(pp)) { + if(pclose(pp)) { rpterr(); progerr(ERR_TRANSFER); logerr(MSG_PCLOSE, cmd, errno); @@ -803,7 +612,7 @@ int options; return(1); } nparts = 1; - if(fscanf(fp, ":%d%d", &nparts, &maxpartsize) != 2) { + if(fscanf(fp, ":%d%d", &nparts, &maxpartsiz) != 2) { progerr(ERR_TRANSFER); logerr(MSG_NOSIZE); (void) fclose(fp); @@ -819,35 +628,7 @@ int options; } } - /* write each part of this package */ - if(options & PT_ODTSTREAM) { - char line[128]; - (void)mgets(line, 128); - curpartcnt = -1; - if(sscanf(line, "%s %d %d %[ 0-9]", &pkgname, &nparts, &maxpartsize, volnos) == 4) { - sscanf(volnos, "%d %[ 0-9]", &curpartcnt, tmpvol); - strcpy(volnos, tmpvol); - } - } - for(part=1; part <= nparts; ) { - if(curpartcnt == 0 && (options & PT_ODTSTREAM)) { - char prompt[128]; - int index; - ds_volno++; - (void)close(ds_fd); - (void)sprintf(prompt, "Insert %%v %d of %d into %%p", ds_volno, ds_volcnt); - if(n = getvol(ods_name, NULL, NULL, prompt)) - return n; - if((ds_fd = open(dstdev.cdevice, 1)) < 0) - return 1; - - (void)sscanf(volnos, "%d %[ 0-9]", &index, tmpvol); - (void)strcpy(volnos, tmpvol); - curpartcnt += index; - } - - if(options & PT_INFO_ONLY) nparts = 0; @@ -881,15 +662,17 @@ int options; (void) strcat(cmd, ROOT); } } - if(options & PT_ODTSTREAM) { - (void) sprintf(cmd+strlen(cmd), " -print | %s -ocD -C 512", - CPIOPROC); + if(dstdev.norewind) { + (void) sprintf(cmd+strlen(cmd), + " -print | %s -oc >%s", + CPIOPROC, dstdev.norewind); } else { - (void) sprintf(cmd+strlen(cmd), " -print | %s -pdum %s", + (void) sprintf(cmd+strlen(cmd), + " -print | %s -pdum %s", CPIOPROC, dstdir); } - if(n = esystem(cmd, -1, (options & PT_ODTSTREAM) ? ds_fd : -1)) { + if(n = esystem(cmd)) { rpterr(); progerr(ERR_TRANSFER); logerr(MSG_CMDFAIL, cmd, n); @@ -897,15 +680,13 @@ int options; } part++; - if(srcdev.mount && (nparts > 1)) { - /* unmount current source volume */ + if(srcdev.mount) { (void) chdir("/"); if(pkgumount(&srcdev)) return(1); - /* loop until volume is mounted successfully */ while(part <= nparts) { /* read only */ - if(n = pkgmount(&srcdev, NULL, part, nparts, 1)) + if(n = pkgmount(&srcdev, NULL, part, nparts)) return(n); if(chdir(srcdir)) { progerr(ERR_TRANSFER); @@ -922,44 +703,16 @@ int options; break; } } - if(!(options & PT_ODTSTREAM) && dstdev.mount) { - /* unmount current volume */ + if(dstdev.mount) { if(pkgumount(&dstdev)) return(1); - /* loop until next volume is mounted successfully */ - while(part <= nparts) { + if(part <= nparts) { /* writable */ - if(n = pkgmount(&dstdev, NULL, part, nparts, 1)) - return(n); + pkgmount(&dstdev, NULL, part, nparts); if(ckoverwrite(dst, dstinst, options)) - continue; - if(isdir(dstdir) && mkdir(dstdir, 0755)) { - progerr(ERR_TRANSFER); - logerr(MSG_MKDIR, dstdir); - continue; - } - break; - } - } - - if((options & PT_ODTSTREAM) && part <= nparts) { - if(curpartcnt >= 0 && part > curpartcnt) { - char prompt[128]; - int index; - ds_volno++; - (void)close(ds_fd); - (void)sprintf(prompt, "Insert %%v %d of %d into %%p", ds_volno, ds_volcnt); - if(n = getvol(ods_name, NULL, NULL, prompt)) - return n; - if((ds_fd = open(dstdev.cdevice, 1)) < 0) - return 1; - - (void)sscanf(volnos, "%d %[ 0-9]", &index, tmpvol); - (void)strcpy(volnos, tmpvol); - curpartcnt += index; + return(1); } } - } return(0); } @@ -990,12 +743,8 @@ cleanup() free(tmpdir); tmpdir = NULL; } - if(srcdev.mount && !ids_name) + if(srcdev.mount) pkgumount(&srcdev); - if(dstdev.mount && !ods_name) + if(dstdev.mount) pkgumount(&dstdev); - if(ds_fd >= 0) { - (void)close(ds_fd); - ds_fd = -1; - } } diff --git a/usr/src/lib/libpkg/pkgxpand.c b/usr/src/lib/libpkg/pkgxpand.c index 16067fc..c7ff198 100644 --- a/usr/src/lib/libpkg/pkgxpand.c +++ b/usr/src/lib/libpkg/pkgxpand.c @@ -6,15 +6,14 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:pkgxpand.c 1.3.1.1" +#ident "@(#)libpkg:pkgxpand.c 1.3" #include #include #include extern char *fpkginst(); -extern void *calloc(), - *realloc(); +extern void *malloc(), *realloc(); extern char *pkgdir; #define LSIZE 512 diff --git a/usr/src/lib/libpkg/ppkgmap.c b/usr/src/lib/libpkg/ppkgmap.c index 221923f..1bb49cd 100644 --- a/usr/src/lib/libpkg/ppkgmap.c +++ b/usr/src/lib/libpkg/ppkgmap.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:ppkgmap.c 1.4.1.1" +#ident "@(#)libpkg:ppkgmap.c 1.4" #include #include @@ -43,14 +43,14 @@ FILE *fp; } if(strchr("cb", ept->ftype)) { - if(ept->ainfo.major == BADMAJOR) { + if(ept->ainfo.major < 0) { if(fprintf(fp, " ?") < 0) return(-1); } else { if(fprintf(fp, " %d", ept->ainfo.major) < 0) return(-1); } - if(ept->ainfo.minor == BADMINOR) { + if(ept->ainfo.minor < 0) { if(fprintf(fp, " ?") < 0) return(-1); } else { @@ -60,7 +60,7 @@ FILE *fp; } if(strchr("dxcbpfve", ept->ftype)) { - if(fprintf(fp, ((ept->ainfo.mode == BADMODE) ? " ?" : " %04o"), + if(fprintf(fp, ((ept->ainfo.mode < 0) ? " ?" : " %04o"), ept->ainfo.mode) < 0) return(-1); if(fprintf(fp, " %s %s", ept->ainfo.owner, ept->ainfo.group) < 0) @@ -73,13 +73,13 @@ FILE *fp; } if(strchr("ifve", ept->ftype)) { - if(fprintf(fp, ((ept->cinfo.size == BADCONT) ? " ?" : " %ld"), + if(fprintf(fp, ((ept->cinfo.size < 0) ? " ?" : " %ld"), ept->cinfo.size) < 0) return(-1); - if(fprintf(fp, ((ept->cinfo.cksum == BADCONT) ? " ?" : " %ld"), + if(fprintf(fp, ((ept->cinfo.cksum < 0) ? " ?" : " %ld"), ept->cinfo.cksum) < 0) return(-1); - if(fprintf(fp, ((ept->cinfo.modtime == BADCONT) ? " ?" : " %ld"), + if(fprintf(fp, ((ept->cinfo.modtime < 0) ? " ?" : " %ld"), ept->cinfo.modtime) < 0) return(-1); } diff --git a/usr/src/lib/libpkg/putcfile.c b/usr/src/lib/libpkg/putcfile.c index 7a9d03b..43a449f 100644 --- a/usr/src/lib/libpkg/putcfile.c +++ b/usr/src/lib/libpkg/putcfile.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:putcfile.c 1.5.1.1" +#ident "@(#)libpkg:putcfile.c 1.5" #include #include @@ -44,14 +44,14 @@ FILE *fp; return(-1); if(strchr("cb", ept->ftype)) { - if(ept->ainfo.major == BADMAJOR) { + if(ept->ainfo.major < 0) { if(fprintf(fp, " ?") < 0) return(-1); } else { if(fprintf(fp, " %d", ept->ainfo.major) < 0) return(-1); } - if(ept->ainfo.minor == BADMINOR) { + if(ept->ainfo.minor < 0) { if(fprintf(fp, " ?") < 0) return(-1); } else { @@ -61,7 +61,7 @@ FILE *fp; } if(strchr("dxcbpfve", ept->ftype)) { - if(fprintf(fp, ((ept->ainfo.mode == BADMODE) ? " ?" : " %04o"), + if(fprintf(fp, ((ept->ainfo.mode < 0) ? " ?" : " %04o"), ept->ainfo.mode) < 0) return(-1); if(fprintf(fp, " %s %s", ept->ainfo.owner, ept->ainfo.group) < 0) @@ -69,13 +69,13 @@ FILE *fp; } if(strchr("ifve", ept->ftype)) { - if(fprintf(fp, ((ept->cinfo.size == BADCONT) ? " ?" : " %ld"), + if(fprintf(fp, ((ept->cinfo.size < 0) ? " ?" : " %ld"), ept->cinfo.size) < 0) return(-1); - if(fprintf(fp, ((ept->cinfo.cksum == BADCONT) ? " ?" : " %ld"), + if(fprintf(fp, ((ept->cinfo.cksum < 0) ? " ?" : " %ld"), ept->cinfo.cksum) < 0) return(-1); - if(fprintf(fp, ((ept->cinfo.modtime == BADCONT) ? " ?" : " %ld"), + if(fprintf(fp, ((ept->cinfo.modtime < 0) ? " ?" : " %ld"), ept->cinfo.modtime) < 0) return(-1); } diff --git a/usr/src/lib/libpkg/runcmd.c b/usr/src/lib/libpkg/runcmd.c index db1680d..ac11e4f 100644 --- a/usr/src/lib/libpkg/runcmd.c +++ b/usr/src/lib/libpkg/runcmd.c @@ -6,12 +6,11 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:runcmd.c 1.8.2.2" +#ident "@(#)libpkg:runcmd.c 1.8.1.1" #include #include #include -#include #include static char *errfile = NULL; @@ -27,36 +26,8 @@ extern pid_t fork(), extern int execl(), unlink(); -void -rpterr() -{ - FILE *fp; - int c; - - if(errfile) { - if(fp = fopen(errfile, "r")) { - while((c = getc(fp)) != EOF) - putc(c, stderr); - (void) fclose(fp); - } - (void) unlink(errfile); - errfile = NULL; - } -} - -void -ecleanup() -{ - if(errfile) { - (void) unlink(errfile); - errfile = NULL; - } -} - -int -esystem(cmd, ifd, ofd) +esystem(cmd) char *cmd; -int ifd, ofd; { char *errfile; int status; @@ -67,19 +38,10 @@ int ifd, ofd; progerr("unable to create temp error file, errno=%d", errno); return(-1); } + pid = fork(); if(pid == 0) { /* child */ - if(ifd > 0) { - (void)close(0); - (void)fcntl(ifd, F_DUPFD, 0); - (void)close(ifd); - } - if(ofd >= 0 && ofd != 1) { - (void)close(1); - (void)fcntl(ofd, F_DUPFD, 1); - (void)close(ofd); - } freopen(errfile, "w", stderr); execl("/sbin/sh", "/sbin/sh", "-c", cmd, NULL); progerr("exec of <%s> failed, errno=%d", cmd, errno); @@ -91,7 +53,7 @@ int ifd, ofd; /* parent process */ sighold(SIGINT); - pid = waitpid(pid, &status, 0); + pid = wait(&status); sigrelse(SIGINT); if(pid < 0) @@ -106,13 +68,10 @@ int ifd, ofd; /* terminated by a signal */ status = status & 0177; } - if(status == 0) - ecleanup(); return(status); } -FILE * -epopen(cmd, mode) +FILE *epopen(cmd, mode) char *cmd, *mode; { char *buffer; @@ -146,14 +105,19 @@ char *cmd, *mode; return(pp); } -int -epclose(pp) -FILE *pp; +void +rpterr() { - int n; + FILE *fp; + int c; - n = pclose(pp); - if(n == 0) - ecleanup(); - return(n); + if(errfile) { + if(fp = fopen(errfile, "r")) { + while((c = getc(fp)) != EOF) + putc(c, stderr); + (void) fclose(fp); + } + (void) unlink(errfile); + errfile = NULL; + } } diff --git a/usr/src/lib/libpkg/srchcfile.c b/usr/src/lib/libpkg/srchcfile.c index ba70d66..cb6ec45 100644 --- a/usr/src/lib/libpkg/srchcfile.c +++ b/usr/src/lib/libpkg/srchcfile.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:srchcfile.c 1.7.1.1" +#ident "@(#)libpkg:srchcfile.c 1.7" #include #include @@ -22,8 +22,6 @@ return(-1); \ } -extern void free(); -extern void *calloc(); static int getstr(), getnum(), @@ -274,9 +272,10 @@ FILE *fpin, *fpout; getstr(fpin, NULL, ATRSIZ, ept->ainfo.group)) ERROR("unable to read mode/owner/group") - /* don't have to check (mode < 0) since '-' is not a legal */ - if((ept->ainfo.mode != BADMODE) && ((ept->ainfo.mode > 07777) || - (strchr("cbdxp", ept->ftype) && (ept->ainfo.mode > 02000)))) + /* don't have to check for (mode < 0) since '-' + is not a legal digit */ + if((ept->ainfo.mode > 07777) || (strchr("cbdxp", ept->ftype) && + (ept->ainfo.mode > 02000))) ERROR("illegal value for mode") } diff --git a/usr/src/lib/libpkg/tputcfent.c b/usr/src/lib/libpkg/tputcfent.c index c8b0274..7506d7e 100644 --- a/usr/src/lib/libpkg/tputcfent.c +++ b/usr/src/lib/libpkg/tputcfent.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:tputcfent.c 1.7.1.1" +#ident "@(#)libpkg:tputcfent.c 1.7" #include #include @@ -56,10 +56,6 @@ FILE *fp; (void) fputs("named pipe\n", fp); break; - case 'i': - (void) fputs("installation file\n", fp); - break; - case 'c': case 'b': (void) fprintf(fp, "%s special device\n", @@ -76,18 +72,12 @@ FILE *fp; (void) fprintf(fp, "Source of link: %s\n", pt); break; - case 's': - (void) fputs("symbolic link\n", fp); - pt = (ept->ainfo.local ? ept->ainfo.local : "(unknown)"); - (void) fprintf(fp, "Source of link: %s\n", pt); - break; - default: (void) fputs("unknown\n", fp); break; } - if(!strchr("lsin", ept->ftype)) { + if(!strchr("lin", ept->ftype)) { if(ept->ainfo.mode < 0) (void) fprintf(fp, "Expected mode: ?\n"); else @@ -105,10 +95,6 @@ FILE *fp; (ept->cinfo.modtime > 0) ? ctime(&(ept->cinfo.modtime))+4 : "?\n"); } - if(ept->ftype == 'i') { - (void) fputc('\n', fp); - return; - } status = count = 0; if(pinfo = ept->pinfo) { diff --git a/usr/src/lib/libpkg/verify.c b/usr/src/lib/libpkg/verify.c index b3c8015..29fb919 100644 --- a/usr/src/lib/libpkg/verify.c +++ b/usr/src/lib/libpkg/verify.c @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ /*LINTLIBRARY*/ -#ident "@(#)libpkg:verify.c 1.21.1.1" +#ident "@(#)libpkg:verify.c 1.21" #include #include @@ -124,7 +124,7 @@ struct cinfo *cinfo; /* -1 requires modtimes to be the same */ /* 0 reports modtime failure */ /* 1 fixes modtimes */ - if(setval || (cinfo->modtime == BADCONT)) + if(setval || (cinfo->modtime < 0)) cinfo->modtime = status.st_mtime; else if(status.st_mtime != cinfo->modtime) { if(fix > 0) { @@ -144,7 +144,7 @@ struct cinfo *cinfo; } /*else retcode = VE_TIME;*/ } - if(setval || (cinfo->size == BADCONT)) + if(setval || (cinfo->size < 0)) cinfo->size = status.st_size; else if(status.st_size != cinfo->size) { if(!retcode /*|| (retcode == VE_TIME)*/) @@ -153,7 +153,7 @@ struct cinfo *cinfo; } mycksum = docksum(path); - if(setval || (cinfo->cksum == BADCONT)) + if(setval || (cinfo->cksum < 0)) cinfo->cksum = mycksum; else if((mycksum != cinfo->cksum) || cksumerr) { if(!retcode /*|| (retcode == VE_TIME)*/) @@ -365,7 +365,7 @@ struct ainfo *ainfo; } /* compare specified mode w/ actual mode excluding sticky bit */ - if(setval || (ainfo->mode == BADMODE)) + if(setval || (ainfo->mode < 0)) ainfo->mode = status.st_mode & 07777; else if((ainfo->mode & 06777) != (status.st_mode & 06777)) { if(fix) { @@ -385,7 +385,7 @@ struct ainfo *ainfo; dochown = 0; /* get group entry for specified group */ - if(setval || !strcmp(ainfo->group, BADGROUP)) { + if(setval || !strcmp(ainfo->group, "?")) { grp = getgrgid(status.st_gid); if(grp) (void) strcpy(ainfo->group, grp->gr_name); @@ -416,7 +416,7 @@ struct ainfo *ainfo; setpwent(); /* get password entry for specified owner */ - if(setval || !strcmp(ainfo->owner, BADOWNER)) { + if(setval || !strcmp(ainfo->owner, "?")) { pwd = getpwuid((int)status.st_uid); if(pwd) (void) strcpy(ainfo->owner, pwd->pw_name); diff --git a/usr/src/lib/libpt/libpt.c b/usr/src/lib/libpt/libpt.c new file mode 100644 index 0000000..48ca63a --- /dev/null +++ b/usr/src/lib/libpt/libpt.c @@ -0,0 +1,149 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libpt:libpt.c 1.4" +/* + * Copyright (c) 1987 AT&T + * All Rights Reserved + * + * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T + * The copyright notice above does not evidence any actual + * or intended publication of such source code. + * + */ + + +#include "sys/types.h" +#include "sys/psw.h" +#include "sys/pcb.h" +#include "sys/param.h" +#include "sys/mkdev.h" +#include "sys/fs/s5dir.h" +#include "sys/stream.h" +#include "sys/stropts.h" +#include "sys/signal.h" +#include "sys/user.h" +#include "sys/errno.h" +#include "sys/fcntl.h" +#include "sys/stat.h" +#include "sys/ptms.h" + +#define PTSNAME "/dev/pts/" /* slave name */ +#define PTLEN 13 /* slave name length */ +#define PTPATH "/usr/lib/pt_chmod" /* setuid root program */ +#define PTPGM "pt_chmod" /* setuid root program */ + +static char sname[PTLEN]; + +/* + * Check that fd argument is a file descriptor of an opened master. + * Do this by sending an ISPTM ioctl message down stream. Ioctl() + * will fail if: (1) fd is not a valid file descriptor. (2) the file + * represented by fd does not understand ISPTM (not a master device). + * If we have a valid master, get its minor number via fstat(). + * Concatenate it to PTSNAME and return it as the name of the slave + * device. + */ +char * +ptsname( fd) +{ + register dev_t dev; + struct stat status; + struct strioctl istr; + + istr.ic_cmd = ISPTM; + istr.ic_len = 0; + istr.ic_timout = 0; + istr.ic_dp = NULL; + + if ( ioctl( fd, I_STR, &istr) < 0) + return( NULL); + + if ( fstat( fd, &status) < 0 ) + return( NULL); + + dev = minor( status.st_rdev); + + sprintf( sname, "%s%d", PTSNAME, dev); + + if ( access( sname, 00) < 0) + return( NULL); + + return( sname); +} + + +/* + * Send an ioctl down to the master device requesting the + * master/slave pair be unlocked. + */ +unlockpt( fd) +{ + struct strioctl istr; + + istr.ic_cmd = UNLKPT; + istr.ic_len = 0; + istr.ic_timout = 0; + istr.ic_dp = NULL; + + + if ( ioctl( fd, I_STR, &istr) < 0) + return( -1); + + return( 0); +} + + +/* + * Execute a setuid root program to change the mode, ownership and + * group of the slave device. The parent forks a child process that + * executes the setuid program. It then waits for the child to return. + */ +grantpt( fd) +int fd; +{ + int st_loc; + pid_t pid; + int w; + + char fds[4]; + + + if ( !( pid = fork())) { + sprintf( fds, "%d", fd); + execl( PTPATH, PTPGM, fds, (char *)0); + /* + * the process should not return, unless exec() failed. + */ + return( -1); + } + + /* + * wait() will return the process id for the child process + * or -1 (on failure). + */ + while (( w = wait( &st_loc)) != pid && w != -1); + + /* + * if w == -1, the child process did not fork properly. + * errno is set to ECHILD. + */ + if ( w == -1) + return( -1); + + /* + * If child terminated due to exit()... + * if high order bits are zero + * was an exit(0). + * else it was an exit(-1); + * Else it was struck by a signal. + */ + if (( st_loc & 0377) == 0) + return((( st_loc & 0177400) == 0) ? 0 : -1); + else + return( -1); +} diff --git a/usr/src/lib/libpt/libpt.mk b/usr/src/lib/libpt/libpt.mk new file mode 100644 index 0000000..e920eec --- /dev/null +++ b/usr/src/lib/libpt/libpt.mk @@ -0,0 +1,67 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)libpt:libpt.mk 10.6" +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. +# + +ROOT= +USRLIB=$(ROOT)/usr/lib +ARFLAGS = rvu +INC=$(ROOT)/usr/include +CFLAGS= -I$(INC) + +LIBOBJS= libpt.o pt_chmod.o + +# +# Header dependencies +# + +INCLUDE= $(INC)/grp.h\ + $(INC)/sys/types.h\ + $(INC)/sys/psw.h\ + $(INC)/sys/pcb.h\ + $(INC)/sys/param.h\ + $(INC)/sys/sysmacros.h\ + $(INC)/sys/fs/s5dir.h\ + $(INC)/sys/stream.h\ + $(INC)/sys/stropts.h\ + $(INC)/sys/signal.h\ + $(INC)/sys/user.h\ + $(INC)/sys/errno.h\ + $(INC)/sys/fcntl.h\ + $(INC)/sys/stat.h\ + $(INC)/sys/ptms.h + +all: + $(CC) -c $(CFLAGS) libpt.c + $(AR) $(ARFLAGS) libpt.a libpt.o + $(CC) $(CFLAGS) pt_chmod.c libpt.a -o pt_chmod + +$(LIBOBJS): $(INCLUDES) + +install: all + install -f $(USRLIB) libpt.a; + install -f $(USRLIB) pt_chmod + $(CH)chown bin $(USRLIB)/libpt.a + $(CH)chgrp bin $(USRLIB)/libpt.a + $(CH)chmod 664 $(USRLIB)/libpt.a + $(CH)chgrp bin $(USRLIB)/pt_chmod + $(CH)chmod 04111 $(USRLIB)/pt_chmod + $(CH)chown root $(USRLIB)/pt_chmod + +clean: + -rm -f *.o + +clobber: clean + -rm -f libpt.a + -rm -f pt_chmod + diff --git a/usr/src/lib/libpt/pt_chmod.c b/usr/src/lib/libpt/pt_chmod.c new file mode 100644 index 0000000..009cfac --- /dev/null +++ b/usr/src/lib/libpt/pt_chmod.c @@ -0,0 +1,51 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)libpt:pt_chmod.c 1.5" +/* + * Copyright (c) 1987 AT&T + * All Rights Reserved + * + * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T + * The copyright notice above does not evidence any actual + * or intended publication of such source code. + * + */ +#include + +#define DEFAULT_TTY_GROUP "tty" + +/* + * change the owner and mode of the pseudo terminal slave device. + */ +main( argc, argv) +int argc; +char **argv; +{ + int fd; + gid_t gid; + + struct group *gr_name_ptr; + + char *ptsname(); + + + if (( gr_name_ptr = getgrnam( DEFAULT_TTY_GROUP)) != NULL) + gid = gr_name_ptr->gr_gid; + else + gid = getgid(); + + fd = atoi( argv[1]); + + if ( chown( ptsname( fd), getuid(), gid)) + exit( -1); + + if ( chmod( ptsname( fd), 00620)) + exit( -1); + + exit( 0); +} diff --git a/usr/src/lib/libresolv/gthostnamadr.c b/usr/src/lib/libresolv/gthostnamadr.c index 7160bf8..83e299b 100644 --- a/usr/src/lib/libresolv/gthostnamadr.c +++ b/usr/src/lib/libresolv/gthostnamadr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:gthostnamadr.c 1.2" +#ident "@(#)libresolv:gthostnamadr.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -40,7 +40,6 @@ #include #include #include -#include "res.h" #define MAXALIASES 35 #define MAXADDRS 35 diff --git a/usr/src/lib/libresolv/libresolv.mk b/usr/src/lib/libresolv/libresolv.mk index bbb412b..21f1fbe 100644 --- a/usr/src/lib/libresolv/libresolv.mk +++ b/usr/src/lib/libresolv/libresolv.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libresolv:libresolv.mk 1.2" +#ident "@(#)libresolv:libresolv.mk 1.1" # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -33,26 +33,32 @@ DASHO= -O MORECPP= -DDEBUG -DSYSV INC= $(ROOT)/usr/include INCSYS= $(ROOT)/usr/include/sys +UCBINC= $(ROOT)/usr/ucbinclude USRLIB= $(ROOT)/usr/lib INSTALL= install -LORDER= lorder -TSORT= tsort -CFLAGS= $(DASHO) $(MORECPP) -I$(INC) +CFLAGS= $(DASHO) $(MORECPP) -I$(UCBINC) -I$(INC) LIBNAME= libresolv.a -OBJS= gthostnamadr.o res_comp.o res_debug.o res_init.o \ - res_mkquery.o res_query.o res_send.o sethostent.o \ - strcasecmp.o +LIBOBJS= \ + $(LIBNAME)(gthostnamadr.o) \ + $(LIBNAME)(res_comp.o) \ + $(LIBNAME)(res_debug.o) \ + $(LIBNAME)(res_init.o) \ + $(LIBNAME)(res_mkquery.o) \ + $(LIBNAME)(res_query.o) \ + $(LIBNAME)(res_send.o) \ + $(LIBNAME)(sethostent.o) \ + $(LIBNAME)(strcasecmp.o) all: $(LIBNAME) install: all $(INSTALL) -f $(USRLIB) -m 0444 -u bin -g bin $(LIBNAME) -$(LIBNAME): $(OBJS) - $(AR) crv $(LIBNAME) `$(LORDER) $(OBJS) | $(TSORT)` +$(LIBNAME): $(LIBOBJS) + clean: rm -f *.o @@ -61,92 +67,5 @@ clobber: clean rm -f $(LIBNAME) # -# Header dependencies +# to do -- Header dependencies # -gthostnamadr.o: gthostnamadr.c \ - $(INC)/sys/param.h \ - $(INC)/sys/socket.h \ - $(INC)/netinet/in.h \ - $(INC)/ctype.h \ - $(INC)/netdb.h \ - $(INC)/stdio.h \ - $(INC)/errno.h \ - $(INC)/arpa/inet.h \ - $(INC)/arpa/nameser.h \ - $(INC)/resolv.h \ - res.h \ - $(FRC) - -res_comp.o: res_comp.c \ - $(INC)/sys/types.h \ - $(INC)/stdio.h \ - $(INC)/arpa/nameser.h \ - res.h \ - $(FRC) - -res_debug.o: res_debug.c \ - $(INC)/sys/types.h \ - $(INC)/netinet/in.h \ - $(INC)/stdio.h \ - $(INC)/arpa/nameser.h \ - res.h \ - $(FRC) - -res_init.o: res_init.c \ - $(INC)/sys/types.h \ - $(INC)/sys/socket.h \ - $(INC)/netinet/in.h \ - $(INC)/stdio.h \ - $(INC)/arpa/nameser.h \ - $(INC)/resolv.h \ - res.h \ - $(FRC) - -res_mkquery.o: res_mkquery.c \ - $(INC)/stdio.h \ - $(INC)/sys/types.h \ - $(INC)/netinet/in.h \ - $(INC)/arpa/nameser.h \ - $(INC)/resolv.h \ - res.h \ - $(FRC) - -res_query.o: res_query.c \ - $(INC)/sys/param.h \ - $(INC)/sys/socket.h \ - $(INC)/netinet/in.h \ - $(INC)/ctype.h \ - $(INC)/netdb.h \ - $(INC)/stdio.h \ - $(INC)/errno.h \ - $(INC)/string.h \ - $(INC)/arpa/inet.h \ - $(INC)/arpa/nameser.h \ - $(INC)/resolv.h \ - res.h \ - $(FRC) - -res_send.o: res_send.c \ - $(INC)/sys/param.h \ - $(INC)/sys/time.h \ - $(INC)/sys/socket.h \ - $(INC)/sys/uio.h \ - $(INC)/netinet/in.h \ - $(INC)/stdio.h \ - $(INC)/errno.h \ - $(INC)/arpa/nameser.h \ - $(INC)/resolv.h \ - res.h \ - $(FRC) - -sethostent.o: sethostent.c \ - $(INC)/sys/types.h \ - $(INC)/arpa/nameser.h \ - $(INC)/netinet/in.h \ - $(INC)/resolv.h \ - res.h \ - $(FRC) - -strcasecmp.o: strcasecmp.c \ - res.h \ - $(FRC) diff --git a/usr/src/lib/libresolv/res_comp.c b/usr/src/lib/libresolv/res_comp.c index 5cab47d..1258d20 100644 --- a/usr/src/lib/libresolv/res_comp.c +++ b/usr/src/lib/libresolv/res_comp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:res_comp.c 1.2" +#ident "@(#)libresolv:res_comp.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -33,7 +33,6 @@ #include #include #include -#include "res.h" /* diff --git a/usr/src/lib/libresolv/res_debug.c b/usr/src/lib/libresolv/res_debug.c index 9272f47..3ade0c1 100644 --- a/usr/src/lib/libresolv/res_debug.c +++ b/usr/src/lib/libresolv/res_debug.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:res_debug.c 1.2" +#ident "@(#)libresolv:res_debug.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -38,7 +38,6 @@ #include #include #include -#include "res.h" extern char *p_cdname(), *p_rr(), *p_type(), *p_class(); extern char *inet_ntoa(); diff --git a/usr/src/lib/libresolv/res_init.c b/usr/src/lib/libresolv/res_init.c index f98916e..393a9e2 100644 --- a/usr/src/lib/libresolv/res_init.c +++ b/usr/src/lib/libresolv/res_init.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:res_init.c 1.2" +#ident "@(#)libresolv:res_init.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -36,7 +36,6 @@ #include #include #include -#include "res.h" /* * Resolver configuration file. Contains the address of the diff --git a/usr/src/lib/libresolv/res_mkquery.c b/usr/src/lib/libresolv/res_mkquery.c index a8b0dfd..1a2e5be 100644 --- a/usr/src/lib/libresolv/res_mkquery.c +++ b/usr/src/lib/libresolv/res_mkquery.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:res_mkquery.c 1.2" +#ident "@(#)libresolv:res_mkquery.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -35,7 +35,6 @@ #include #include #include -#include "res.h" #ifndef SYSV extern char *sprintf(); diff --git a/usr/src/lib/libresolv/res_query.c b/usr/src/lib/libresolv/res_query.c index 31a53df..e6299fa 100644 --- a/usr/src/lib/libresolv/res_query.c +++ b/usr/src/lib/libresolv/res_query.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:res_query.c 1.2" +#ident "@(#)libresolv:res_query.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -37,15 +37,10 @@ #include #include #include -#ifdef SYSV -#include -#else #include -#endif /* SYSV */ #include #include #include -#include "res.h" #if PACKETSZ > 1024 #define MAXPACKET PACKETSZ diff --git a/usr/src/lib/libresolv/res_send.c b/usr/src/lib/libresolv/res_send.c index 84897b9..e7ae0c6 100644 --- a/usr/src/lib/libresolv/res_send.c +++ b/usr/src/lib/libresolv/res_send.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:res_send.c 1.2" +#ident "@(#)libresolv:res_send.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -43,7 +43,6 @@ #include #include #include -#include "res.h" extern int errno; diff --git a/usr/src/lib/libresolv/sethostent.c b/usr/src/lib/libresolv/sethostent.c index 884a71c..5bd9747 100644 --- a/usr/src/lib/libresolv/sethostent.c +++ b/usr/src/lib/libresolv/sethostent.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:sethostent.c 1.2" +#ident "@(#)libresolv:sethostent.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -34,7 +34,6 @@ #include #include #include -#include "res.h" sethostent(stayopen) { diff --git a/usr/src/lib/libresolv/strcasecmp.c b/usr/src/lib/libresolv/strcasecmp.c index feb95c5..b9e8faa 100644 --- a/usr/src/lib/libresolv/strcasecmp.c +++ b/usr/src/lib/libresolv/strcasecmp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libresolv:strcasecmp.c 1.2" +#ident "@(#)libresolv:strcasecmp.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -30,8 +30,6 @@ * */ -#include "res.h" - /* * This array is designed for mapping upper and lower case letter * together for a case independent comparison. The mappings are diff --git a/usr/src/lib/librpcsvc/publickey.c b/usr/src/lib/librpcsvc/publickey.c index c1331ce..8925d96 100644 --- a/usr/src/lib/librpcsvc/publickey.c +++ b/usr/src/lib/librpcsvc/publickey.c @@ -5,8 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)librpcsvc:publickey.c 1.2" +#ident "@(#)librpcsvc:publickey.c 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -96,7 +95,7 @@ getpublicandprivatekey(key, ret) if (res[0] == '#') continue; else if (res[0] == '+') { -#ifdef YP +#ifdef TRYYP char *PKMAP = "publickey.byname"; char *lookup; char *domain; @@ -120,14 +119,13 @@ getpublicandprivatekey(key, ret) fclose(fd); free(lookup); return (2); -#else /* YP */ +#else /* TRYYP */ #ifdef DEBUG fprintf(stderr, -"Bad record in %s '+' -- yp not supported in this library copy\n", - PKFILE); +"Bad record in %s '+' -- yp not supported in this library copy\n", PKFILE); #endif /* DEBUG */ continue; -#endif /* YP */ +#endif /* TRYYP */ } else { mkey = strtok(buf, "\t "); if (mkey == NULL) { diff --git a/usr/src/lib/libsocket/inet/bindresvport.c b/usr/src/lib/libsocket/inet/bindresvport.c index ae271c8..781cd62 100644 --- a/usr/src/lib/libsocket/inet/bindresvport.c +++ b/usr/src/lib/libsocket/inet/bindresvport.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libinet:bindresvport.c 1.2" +#ident "@(#)libinet:bindresvport.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -36,7 +36,7 @@ #include #ifdef SYSV -#define bzero(s, len) memset(s, 0, len) +#define bzero(s, len) memset(s, '\0', len) #endif SYSV diff --git a/usr/src/lib/libsocket/inet/inet.mk b/usr/src/lib/libsocket/inet/inet.mk index 7db70e4..d6fab8a 100644 --- a/usr/src/lib/libsocket/inet/inet.mk +++ b/usr/src/lib/libsocket/inet/inet.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libinet:libinet.mk 1.7" +#ident "@(#)libinet:libinet.mk 1.6" # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -32,8 +32,7 @@ INC= $(ROOT)/usr/include DASHO= -O -PICOPT= -Kpic -CFLAGS= $(DASHO) $(MORECPP) -DSYSV $(PICOPT) -I$(INC) +CFLAGS= $(DASHO) $(MORECPP) -DSYSV -Kpic -I$(INC) OBJS= bindresvport.o byteorder.o ether_addr.o getnetbyaddr.o \ getnetbyname.o getnetent.o getproto.o getprotoent.o \ diff --git a/usr/src/lib/libsocket/inet/rcmd.c b/usr/src/lib/libsocket/inet/rcmd.c index b47d28b..91b8a18 100644 --- a/usr/src/lib/libsocket/inet/rcmd.c +++ b/usr/src/lib/libsocket/inet/rcmd.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)cmd-inet:libtmp/rcmd.c 1.4" +#ident "@(#)cmd-inet:libtmp/rcmd.c 1.2" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -48,7 +48,7 @@ #ifdef SYSV #define bcopy(s1, s2, len) memcpy(s2, s1, len) -#define bzero(s, len) memset(s, 0, len) +#define bzero(s, len) memset(s, '\0', len) #define index(s, c) strchr(s, c) char *strchr(); #else @@ -72,7 +72,6 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) int lport = IPPORT_RESERVED - 1; struct hostent *hp; #ifdef SYSV - void (*spipe)(); sigset_t oldmask; sigset_t newmask; #else @@ -88,7 +87,6 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) } *ahost = hp->h_name; #ifdef SYSV - spipe = sigset(SIGPIPE, SIG_IGN); bzero((char *) &newmask, sizeof (newmask)); (void) sigaddset(&newmask, SIGURG); (void) sigprocmask(SIG_BLOCK, &newmask, &oldmask); @@ -103,7 +101,6 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) else perror("rcmd: socket"); #ifdef SYSV - (void) sigset(SIGPIPE, spipe); (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *) 0); #else @@ -143,7 +140,6 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) } perror(hp->h_name); #ifdef SYSV - (void) sigset(SIGPIPE, spipe); (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *) 0); #else sigsetmask(oldmask); @@ -209,7 +205,6 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) goto bad2; } #ifdef SYSV - (void) sigset(SIGPIPE, spipe); (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *) 0); #else sigsetmask(oldmask); @@ -221,7 +216,6 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) bad: (void) close(s); #ifdef SYSV - (void) sigset(SIGPIPE, spipe); (void) sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *) 0); #else sigsetmask(oldmask); diff --git a/usr/src/lib/libsocket/libsocket.mk b/usr/src/lib/libsocket/libsocket.mk index b024c69..4047e4f 100644 --- a/usr/src/lib/libsocket/libsocket.mk +++ b/usr/src/lib/libsocket/libsocket.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libsocket:libsocket.mk 1.12" +#ident "@(#)libsocket:libsocket.mk 1.11" # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -32,13 +32,12 @@ ROOT= USRLIB= $(ROOT)/usr/lib INC= $(ROOT)/usr/include -INS= install +INSTALL= install LORDER= lorder TSORT= tsort DASHO= -O -PICOPT= -Kpic -CFLAGS= $(DASHO) $(MORECPP) -DSYSV $(PICOPT) -I$(INC) +CFLAGS= $(DASHO) $(MORECPP) -DSYSV -Kpic -I$(INC) INETOBJS= bindresvport.o byteorder.o ether_addr.o getnetbyaddr.o \ getnetbyname.o getnetent.o getproto.o getprotoent.o \ @@ -67,23 +66,14 @@ all: @for i in inet socket;\ do\ cd $$i;\ - if [ x$(CCSTYPE) = xCOFF ] ; \ - then \ - echo "\n===== $(MAKE) -f $$i.mk all PICOPT= $(PASSECHO)";\ - $(MAKE) -f $$i.mk all PICOPT= $(PASSTHRU);\ - else \ echo "\n===== $(MAKE) -f $$i.mk all $(PASSECHO)";\ $(MAKE) -f $$i.mk all $(PASSTHRU);\ - fi ;\ cd ..;\ done;\ wait rm -f $(ARNAME) $(LIBNAME) $(AR) crv $(ARNAME) `$(LORDER) $(OBJS) | $(TSORT)` - if [ x$(CCSTYPE) != xCOFF ] ; \ - then \ - $(CC) -G -dy -ztext -o $(LIBNAME) $(OBJS) ;\ - fi + $(CC) -G -dy -ztext -o $(LIBNAME) $(OBJS) rm -f $(OBJS) $(LIBNAME): all @@ -91,11 +81,8 @@ $(LIBNAME): all $(ARNAME): all install: all - if [ x$(CCSTYPE) != xCOFF ] ; \ - then \ - $(INS) -f $(USRLIB) -m 0444 -u root -g bin $(LIBNAME) ;\ - fi - $(INS) -f $(USRLIB) -m 0444 -u root -g bin $(ARNAME) + $(INSTALL) -f $(USRLIB) -m 0644 -u bin -g bin $(LIBNAME) + $(INSTALL) -f $(USRLIB) -m 0644 -u bin -g bin $(ARNAME) clean: @for i in inet socket;\ diff --git a/usr/src/lib/libsocket/socket/_conn_util.c b/usr/src/lib/libsocket/socket/_conn_util.c index eacf07b..8b4771b 100644 --- a/usr/src/lib/libsocket/socket/_conn_util.c +++ b/usr/src/lib/libsocket/socket/_conn_util.c @@ -5,7 +5,30 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:_conn_util.c 1.5" +#ident "@(#)libsocket:_conn_util.c 1.4" + +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ #include #include @@ -33,6 +56,7 @@ _s_snd_conn_req(siptr, call) register struct T_conn_req *creq; register char *buf; register int size; + register void (*sigsave)(); struct strbuf ctlbuf; buf = siptr->ctlbuf; @@ -59,12 +83,18 @@ _s_snd_conn_req(siptr, call) ctlbuf.len = size; ctlbuf.buf = buf; + sigsave = sigset(SIGPOLL, SIG_HOLD); if (putmsg(siptr->fd, &ctlbuf, (call->udata.len? &call->udata: NULL), - 0) < 0) + 0) < 0) { + (void)sigset(SIGPOLL, sigsave); return -1; + } - if (!_s_is_ok(siptr, T_CONN_REQ)) + if (!_s_is_ok(siptr, T_CONN_REQ)) { + (void)sigset(SIGPOLL, sigsave); return -1; + } + (void)sigset(SIGPOLL, sigsave); return 0; } diff --git a/usr/src/lib/libsocket/socket/_utility.c b/usr/src/lib/libsocket/socket/_utility.c index b872dc3..7ae5c42 100644 --- a/usr/src/lib/libsocket/socket/_utility.c +++ b/usr/src/lib/libsocket/socket/_utility.c @@ -5,8 +5,33 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:_utility.c 1.17" +#ident "@(#)libsocket:_utility.c 1.12" +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ +#ifdef DEBUG +#include +#endif #include #include #include @@ -16,18 +41,15 @@ #include #include #include -#include #include #include #include #include #include #include -#include -#include #include #include -#include +#include extern int errno; extern void *calloc(); @@ -44,39 +66,32 @@ static int recvmsg(); static int msgpeek(); static int _s_alloc_bufs(); -/* Global, used to enable debugging. - */ -int _s_sockdebug; - /* The following two string arrays map a number as specified * by a user of sockets, to the string as would be returned * by a call to getnetconfig(). * * They are used by _s_match(); - * - * proto_sw contains protocol entries for which there is a corresponding - * /dev device. All others would presumably use raw IP and download the - * desired protocol. */ static char *proto_sw[] = { - "", + NULL, "icmp", /* 1 = ICMP */ - "", - "", - "", - "", + NULL, + NULL, + NULL, + NULL, "tcp", /* 6 = TCP */ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, "udp", /* 17 = UDP */ + NULL }; static char *family_sw[] = { @@ -103,6 +118,7 @@ static char *family_sw[] = { "x25", /* 20 = AF_X25 */ "osinet", /* 21 = AF_OSINET */ "gosip", /* 22 = AF_GOSIP */ + NULL }; /* @@ -113,6 +129,9 @@ _s_checkfd(s) register int s; { struct _si_user *siptr; +#ifdef DEBUG +fprintf(stdout, "_s_checkfd: s %d: Entered\n", s); +#endif if ((siptr = find_silink(s)) != NULL) return siptr; @@ -120,8 +139,9 @@ _s_checkfd(s) /* maybe the descripter is valid, but we did an exec() * and lost the information. Try to re-constitute the info. */ - SOCKDEBUG((struct _si_user *)NULL, - "_s_checkfd: s %d: Not found, trying to reconstitute\n", s); +#ifdef DEBUG +fprintf(stdout, "_s_checkfd: s %d: Not found, trying to reconstitute\n", s); +#endif if (_s_getudata(s, &siptr) < 0) return NULL; return siptr; @@ -138,7 +158,9 @@ _s_open(device, protocol) int retval; struct _si_user *siptr; - SOCKDEBUG((struct _si_user *)NULL, "_s_open: %s\n", device); +#ifdef DEBUG +fprintf(stdout, "_s_open: %s\n", device); +#endif if ((s = open(device, O_RDWR)) < 0) return NULL; @@ -171,10 +193,8 @@ _s_open(device, protocol) if (protocol) { /* need to send down the protocol number. */ - if (_setsockopt(siptr, SOL_SOCKET, SO_PROTOTYPE, - (caddr_t)&protocol, sizeof(protocol)) < 0) - (void)syslog(LOG_ERR, - "_s_open: setsockopt: SO_PROTOTYPE failed"); + (void)_setsockopt(siptr, SOL_SOCKET, SO_PROTOTYPE, + (caddr_t)&protocol, sizeof(protocol)); } siptr->family = -1; /* No family (yet) */ return siptr; @@ -192,24 +212,14 @@ _s_match(family, type, proto, nethandle) { register struct netconfig *net; register struct netconfig *maybe; - register char *oproto; - - if (family < 0 || family >= sizeof(family_sw)/sizeof(char *) || - proto < 0 || proto >= IPPROTO_MAX) { - errno = EPROTONOSUPPORT; - return NULL; - } - if (proto) { - if (proto >= sizeof(proto_sw)/sizeof(char *)) - oproto = ""; - else oproto = proto_sw[proto]; - } - - /* Loop through each entry in netconfig + + /* loop through each entry in netconfig * until one matches or we reach the end. */ if ((*nethandle = setnetconfig()) == NULL) { - (void)syslog(LOG_ERR, "_s_match: setnetconfig failed"); +#ifdef DEBUG + nc_perror("_s_match: setnetconfig failed"); +#endif return NULL; } @@ -218,9 +228,12 @@ _s_match(family, type, proto, nethandle) if (net->nc_semantics == NC_TPI_COTS_ORD) net->nc_semantics = NC_TPI_COTS; if (proto) { +#ifdef DEBUG +fprintf(stdout, "_s_match: nc_protofmly %s, family %d; nc_semantics %d, type %d; nc_proto %s, proto %d\n", net->nc_protofmly, family, net->nc_semantics, type, net->nc_proto, proto); +#endif if (strcmp(net->nc_protofmly, family_sw[family]) == 0 && net->nc_semantics == type && - strcmp(net->nc_proto, oproto) == 0) + strcmp(net->nc_proto, proto_sw[proto]) == 0) break; if (strcmp(net->nc_protofmly, family_sw[family]) == 0 && @@ -233,6 +246,9 @@ _s_match(family, type, proto, nethandle) continue; } else { +#ifdef DEBUG +fprintf(stdout, "_s_match: nc_protofmly %s, family %d; nc_semantics %d, type %d\n", net->nc_protofmly, family, net->nc_semantics, type); +#endif if (strcmp(net->nc_protofmly, family_sw[family]) == 0 && net->nc_semantics == type) { break; @@ -260,7 +276,6 @@ register struct _si_user **siptr; struct si_udata udata; register struct _si_user *nsiptr; int retlen; - int pid; sigsave = sigset(SIGPOLL, SIG_HOLD); if (!_s_do_ioctl(s, (caddr_t)&udata, sizeof(struct si_udata), @@ -287,26 +302,13 @@ register struct _si_user **siptr; if (_s_alloc_bufs(nsiptr, &udata) < 0) return -1; nsiptr->udata = udata; /* structure copy */ - nsiptr->family = -1; - *siptr = nsiptr; - - /* Set up the (potentially new) process - * to receive SIGPIPE properly from - * sockmod. - */ - pid = getpid(); - if (_ioctl(s, SIOCSPGRP, &pid) < 0) { - (void)syslog(LOG_ERR, - "ioctl: SIOCSPGRP failed %d\n", errno); - errno = 0; - } return 0; } else (*siptr)->udata = udata; - - SOCKDEBUG(*siptr, "_s_getudata: siptr: %x\n", *siptr); - +#ifdef DEBUG +fprintf(stdout, "_s_getudata: siptr %x, servtype %d, addrsize %d, tidusize %d, state %x, options %x\n", *siptr, (*siptr)->udata.servtype, (*siptr)->udata.addrsize, (*siptr)->udata.tidusize, (*siptr)->udata.so_state, (*siptr)->udata.so_options); +#endif return 0; } @@ -315,7 +317,7 @@ register struct _si_user **siptr; * Only UNIX domain supported. * * Returns: - * >0 Number of bytes read on success + * 0 On success * -1 If an error occurred. */ static int @@ -340,9 +342,15 @@ recvaccrights(siptr, msg) /* First get the pipe channel. */ +#ifdef DEBUG +fprintf(stdout, "recvaccrights: getting pipe channel\n"); +#endif if (ioctl(siptr->fd, I_RECVFD, &pipe) < 0) return -1; +#ifdef DEBUG +fprintf(stdout, "recvaccrights: pipe channel fd %d\n", pipe.fd); +#endif /* To ensure the following operations are atomic * as far as the user is concerned, we reset * O_NDELAY if it is on. @@ -359,8 +367,9 @@ recvaccrights(siptr, msg) /* We do the same whether the flags say MSG_PEEK or * not. */ - SOCKDEBUG(siptr, "recvaccrights: getting access rights\n", 0); - +#ifdef DEBUG +fprintf(stdout, "recvaccrights: getting access rights\n"); +#endif /* Dispose of rights, copying them into the users * buffer if possible. */ @@ -372,10 +381,16 @@ recvaccrights(siptr, msg) struct strrecvfd stfd; retval = 0; - if (ioctl(pipe.fd, I_RECVFD, &stfd) < 0) + if (ioctl(pipe.fd, I_RECVFD, &stfd) < 0) { +#ifdef DEBUG +fprintf(stdout, "recvaccrights: got errno %d\n", errno); +#endif break; + } else { - SOCKDEBUG(siptr, "recvaccrights: got fd %d\n", stfd.fd); +#ifdef DEBUG +fprintf(stdout, "recvaccrights: got fd %d\n", stfd.fd); +#endif if (i != nfd) { fdarray[i] = stfd.fd; msg->msg_accrightslen += sizeof(int); @@ -394,6 +409,9 @@ recvaccrights(siptr, msg) if (siptr->udata.servtype == T_CLTS) { /* First get the source address. */ +#ifdef DEBUG +fprintf(stdout, "recvaccrights: Getting source address\n"); +#endif (void)memset((caddr_t)&addr, 0, sizeof(addr)); if (read(pipe.fd, (caddr_t)&addr, sizeof(addr)) != sizeof(addr)) { @@ -410,14 +428,26 @@ recvaccrights(siptr, msg) } for (i = 0; i < msg->msg_iovlen; i++) { +#ifdef DEBUG +fprintf(stdout, "recvaccrights: calling read\n"); +#endif count = read(pipe.fd, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len); - SOCKDEBUG(siptr, "recvaccrights: got %d bytes\n", - count); +#ifdef DEBUG +fprintf(stdout, "recvaccrights: read returned %d bytes\n", count); +#endif +#ifdef DEBUG +if (count < 0) +fprintf(stdout, "recvaccrights: read errno %d\n", errno); +#endif if (count > 0) retval += count; if (count == 0) { /* EOF */ +#ifdef DEBUG +fprintf(stdout, "recvaccrights: Got EOF\n"); +#endif + errno = 0; break; } @@ -472,6 +502,9 @@ msgpeek(s, ctlbuf, rcvbuf, fmode) if (retval == 1) { ctlbuf->len = strpeek.ctlbuf.len; rcvbuf->len = strpeek.databuf.len; +#ifdef DEBUG +fprintf(stdout, "msgpeek: I_PEEK returned %d, rcvbuf->len %d, ctlbuf->len %d\n", retval, rcvbuf->len, ctlbuf->len); +#endif return 0; } else @@ -483,11 +516,17 @@ msgpeek(s, ctlbuf, rcvbuf, fmode) fds[0].fd = s; fds[0].events = POLLIN; fds[0].revents = 0; +#ifdef DEBUG +fprintf(stdout, "msgpeek: Waiting in poll for input\n"); +#endif for (;;) { if (poll(fds, 1L, -1) < 0) return -1; if (fds[0].revents != 0) break; +#ifdef DEBUG +fprintf(stdout, "msgpeek: poll - spurious wakeup\n"); +#endif } } else { @@ -529,7 +568,7 @@ recvmsg(siptr, msg, flags) return 0; if (msg->msg_iovlen > 1) { - if ((rcvbuf.buf = calloc(1, len)) == NULL) { + if ((rcvbuf.buf = (char *)calloc(1, len)) == NULL) { errno = ENOMEM; return -1; } @@ -547,17 +586,24 @@ recvmsg(siptr, msg, flags) ctlbuf.buf = siptr->ctlbuf; if (flags & MSG_OOB) { +#ifdef DEBUG +fprintf(stdout, "recvmsg: Getting OOB data\n"); +#endif /* Handles the case when MSG_PEEK is set * or not. */ if (! _s_do_ioctl(s, rcvbuf.buf, rcvbuf.maxlen, flags, &rcvbuf.len)) goto rcvout; - SOCKDEBUG(siptr, "recvmsg: Got %d bytes OOB data\n", - rcvbuf.len); +#ifdef DEBUG +fprintf(stdout, "recvmsg: Got %d bytes OOB data\n", rcvbuf.len); +#endif } else if (flags & MSG_PEEK) { +#ifdef DEBUG +fprintf(stdout, "recvmsg: Calling msgpeek()\n"); +#endif if (msgpeek(s, &ctlbuf, &rcvbuf, fmode) < 0) { if (errno == EBADMSG) { errno = 0; @@ -575,6 +621,9 @@ recvmsg(siptr, msg, flags) * to cause a SIGURG. */ sigsave = sigset(SIGPOLL, SIG_IGN); +#ifdef DEBUG +fprintf(stdout, "recvmsg: Calling getmsg()\n"); +#endif if (getmsg(s, &ctlbuf, &rcvbuf, &flg) < 0) { (void)sigset(SIGPOLL, sigsave); if (errno == EBADMSG) { @@ -596,7 +645,13 @@ recvmsg(siptr, msg, flags) * of urgent data in the data stream - the user * should not see this. */ +#ifdef DEBUG +fprintf(stdout, "recvmsg: Got instream urgent mark message\n"); +#endif if (flags & MSG_PEEK) { +#ifdef DEBUG +fprintf(stdout, "recvmsg: MSG_PEEK - reading zero length message\n"); +#endif /* better make sure it goes. */ flg = 0; @@ -633,24 +688,34 @@ recvmsg(siptr, msg, flags) register struct T_unitdata_ind *udata_ind; udata_ind = (struct T_unitdata_ind *)ctlbuf.buf; - msg->msg_namelen = _s_cpaddr(siptr, - msg->msg_name, - msg->msg_namelen, - udata_ind->SRC_offset + ctlbuf.buf, - udata_ind->SRC_length); - + addr = udata_ind->SRC_offset + ctlbuf.buf; + if (msg->msg_namelen > udata_ind->SRC_length) + msg->msg_namelen = + udata_ind->SRC_length; + (void)memcpy(msg->msg_name, addr, + msg->msg_namelen); } } else { addrlen = msg->msg_namelen; +#ifdef DEBUG +fprintf(stdout, "recvmsg: calling getpeername: buffer length %d\n", addrlen); +#endif if (_getpeername(siptr, msg->msg_name, &addrlen) < 0) { errno = 0; msg->msg_namelen = 0; } msg->msg_namelen = addrlen; +#ifdef DEBUG +fprintf(stdout, "recvmsg: got %d bytes of address\n", addrlen); +#endif } } + +#ifdef DEBUG +fprintf(stdout, "recvmsg: Returning\n"); +#endif if (msg->msg_iovlen > 1) (void)free(rcvbuf.buf, rcvbuf.maxlen); if (errno) @@ -694,9 +759,18 @@ _s_soreceive(siptr, msg, flags) retval = recvmsg(siptr, msg, flags); - if (errno) + if (errno) { +#ifdef DEBUG +fprintf(stdout, "_s_soreceive: Returning with errno %d\n", errno); +#endif return -1; - else return retval; + } + else { +#ifdef DEBUG +fprintf(stdout, "_s_soreceive: Returning with %d bytes\n", retval); +#endif + return retval; + } } /* common send code. @@ -714,6 +788,9 @@ _s_sosend(siptr, msg, flags) struct strbuf ctlbuf; struct strbuf databuf; +#ifdef DEBUG +fprintf(stdout, "_s_sosend: siptr %x: Entered: state %x\n", siptr, siptr->udata.so_state); +#endif errno = 0; if (siptr->udata.so_state & SS_CANTSENDMORE) { (void)kill(getpid(), SIGPIPE); @@ -739,6 +816,9 @@ _s_sosend(siptr, msg, flags) if ( !(siptr->udata.so_state & SS_ISBOUND)) { /* need to bind it for TLI. */ +#ifdef DEBUG +fprintf(stdout, "_s_sosend: siptr %x: Not bound - binding\n", siptr); +#endif if (_bind(siptr, NULL, 0, NULL, NULL) < 0) return -1; } @@ -765,17 +845,9 @@ _s_sosend(siptr, msg, flags) } if (flags & MSG_OOB) { - /* If the socket is SOCK_DGRAM or - * AF_UNIX which we know is not to support - * MSG_OOB or the TP does not support the - * notion of expedited data then we fail. - * - * Otherwise we hope that the TP knows - * what to do. - */ - if (_s_getfamily(siptr) == AF_UNIX || - siptr->udata.servtype == T_CLTS || - siptr->udata.etsdusize == 0) { + if (_s_getfamily(siptr) != AF_INET || + (siptr->udata.servtype != T_COTS && + siptr->udata.servtype != T_COTS_ORD)) { errno = EOPNOTSUPP; goto sndout; } @@ -794,42 +866,13 @@ _s_sosend(siptr, msg, flags) goto sndout; } - if ((siptr->udata.so_state & SS_ISCONNECTED) == 0) { - switch (_s_getfamily(siptr)) { - case AF_INET: - if (msg->msg_namelen != - sizeof(struct sockaddr_in)) - errno = EINVAL; - break; - - case AF_UNIX: - /* Checked below. - */ - break; - - default: - if (msg->msg_namelen > siptr->udata.addrsize) - errno = EINVAL; - break; - } - if (errno) - goto sndout; - } - if (msg->msg_namelen > 0 && _s_getfamily(siptr) == AF_UNIX) { struct stat rstat; + int unlen; struct sockaddr_un *un; un = (struct sockaddr_un *)msg->msg_name; - if (msg->msg_namelen > sizeof(*un) || - (i = _s_uxpathlen(un)) == - sizeof(un->sun_path)) { - errno = EINVAL; - goto sndout; - } - un->sun_path[i] = 0; - /* Substitute the user supplied address with the * one that will have actually got bound to. */ @@ -837,6 +880,13 @@ _s_sosend(siptr, msg, flags) errno = EINVAL; goto sndout; } + if (msg->msg_namelen > sizeof(*un) || + (unlen = _s_uxpathlen(un)) == + sizeof(un->sun_path)) { + errno = EMSGSIZE; + goto sndout; + } + un->sun_path[unlen] = 0; /* Null terminate */ /* stat the file. */ @@ -859,7 +909,7 @@ _s_sosend(siptr, msg, flags) if (msg->msg_iovlen > 1) { /* have to make one buffer */ - if ((dbuf = calloc(1, len)) == NULL) { + if ((dbuf = (char *)calloc(1, len)) == NULL) { errno = ENOMEM; goto sndout; } @@ -881,8 +931,8 @@ _s_sosend(siptr, msg, flags) tmpbuf = siptr->ctlbuf; udata_req = (struct T_unitdata_req *)tmpbuf; udata_req->PRIM_type = T_UNITDATA_REQ; - udata_req->DEST_length = _s_min(msg->msg_namelen, - siptr->udata.addrsize); + udata_req->DEST_length = + _s_min(msg->msg_namelen, siptr->udata.addrsize); udata_req->DEST_offset = 0; tmpcnt = sizeof(*udata_req); @@ -894,11 +944,16 @@ _s_sosend(siptr, msg, flags) ctlbuf.len = tmpcnt; ctlbuf.buf = tmpbuf; +#ifdef DEBUG +fprintf(stdout, "_s_sosend: ctl buf len %d\n", ctlbuf.len); +#endif databuf.len = len == 0 ? -1 : len; databuf.buf = dbuf; - SOCKDEBUG(siptr, "_s_sosend: sending %d bytes\n", databuf.len); +#ifdef DEBUG +fprintf(stdout, "_s_sosend: sending down CLTS message len %d\n", databuf.len); +#endif if (putmsg(s, &ctlbuf, &databuf, 0) < 0) { if (errno == EAGAIN) errno = ENOMEM; @@ -915,7 +970,6 @@ _s_sosend(siptr, msg, flags) register int tmp; register int tmpcnt; register int firsttime; - register int error; char *tmpbuf; if (len == 0) { @@ -929,6 +983,9 @@ _s_sosend(siptr, msg, flags) } data_req = (struct T_data_req *)siptr->ctlbuf; + if (flags & MSG_OOB) + data_req->PRIM_type = T_EXDATA_REQ; + else data_req->PRIM_type = T_DATA_REQ; ctlbuf.len = sizeof(*data_req); ctlbuf.buf = siptr->ctlbuf; @@ -937,32 +994,21 @@ _s_sosend(siptr, msg, flags) firsttime = 0; while (tmpcnt = get_msg_slice(msg, &tmpbuf, siptr->udata.tidusize, firsttime)) { - if (flags & MSG_OOB) { - data_req->PRIM_type = T_EXDATA_REQ; - if ((tmp - tmpcnt) != 0) - data_req->MORE_flag = 1; - else data_req->MORE_flag = 0; - } - else data_req->PRIM_type = T_DATA_REQ; + if ((tmp - tmpcnt) > 0) { + data_req->MORE_flag = 1; + } else data_req->MORE_flag = 0; + + if (tmpcnt == 0 && firsttime == 0) + databuf.len = -1; + else databuf.len = tmpcnt; - if (data_req->PRIM_type == T_DATA_REQ) { - /* Performance Optimization, don't bother - * with header. - */ - SOCKDEBUG(siptr, - "_s_sosend: writing %d bytes\n", tmpcnt); - error = write(s, tmpbuf, tmpcnt); - } - else { - /* Urgent data. - */ - databuf.len = tmpcnt; - databuf.buf = tmpbuf; - SOCKDEBUG(siptr, - "_s_sosend: sending %d bytes\n", tmpcnt); - error = putmsg(s, &ctlbuf, &databuf, 0); - } - if (error < 0) { + firsttime = 1; + + databuf.buf = tmpbuf; +#ifdef DEBUG +fprintf(stdout, "_s_sosend: sending down COTS message -size %d\n", databuf.len); +#endif + if (putmsg(s, &ctlbuf, &databuf, 0) < 0) { if (len == tmp) { if (errno == EAGAIN) errno = ENOMEM; @@ -973,7 +1019,6 @@ _s_sosend(siptr, msg, flags) goto sndout; } } - firsttime = 1; tmp -= tmpcnt; } retval = len - tmp; @@ -1029,8 +1074,9 @@ send_clts_rights(siptr, msg, data, datalen) /* Send the fd's. */ - SOCKDEBUG(siptr, "send_clts_rights: nmbr of fd's %d\n", - msg->msg_accrightslen/sizeof(int)); +#ifdef DEBUG +fprintf(stdout, "send_clts_rights: nmbr of fd's %d\n", msg->msg_accrightslen/sizeof(int)); +#endif rights = (int *)msg->msg_accrights; for (i = 0; i < msg->msg_accrightslen/sizeof(int); i++) { if (ioctl(pipefd[0], I_SENDFD, rights[i]) < 0) { @@ -1083,11 +1129,17 @@ send_cots_rights(siptr, msg) int retval; int i; +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: Getting pipe\n"); +#endif /* Get a pipe. */ if (pipe(pipefd) < 0) return -1; +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: Got pipe fds %d, %d\n", pipefd[0], pipefd[1]); +#endif /* Ensure nothing in progress. */ intransit = 0; @@ -1095,9 +1147,15 @@ send_cots_rights(siptr, msg) if (_s_do_ioctl(siptr->fd, (caddr_t)&intransit, sizeof(intransit), SI_GETINTRANSIT, &i) == 0) { retval = -1; +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: SI_GETINTRANSIT failed\n"); +#endif goto send_cots_done; } if (i != sizeof(intransit)) { +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: Got size %d\n", i); +#endif errno = EPROTO; retval = -1; goto send_cots_done; @@ -1109,6 +1167,9 @@ send_cots_rights(siptr, msg) /* Send pipe fd. */ +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: Sending pipe fd %d\n", pipefd[1]); +#endif if (ioctl(siptr->fd, I_SENDFD, pipefd[1]) < 0) { retval = -1; goto send_cots_done; @@ -1116,8 +1177,14 @@ send_cots_rights(siptr, msg) /* Send the fd's. */ +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: nmbr of fd's %d\n", msg->msg_accrightslen/sizeof(int)); +#endif fds = (int *)msg->msg_accrights; for (i = 0; i < msg->msg_accrightslen/sizeof(int); i++) { +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: Sending fd %d\n", fds[i]); +#endif if (ioctl(pipefd[0], I_SENDFD, fds[i]) < 0) { retval = -1; goto send_cots_done; @@ -1128,6 +1195,9 @@ send_cots_rights(siptr, msg) if (msg->msg_iovlen) { retval = 0; for (i = 0; i < msg->msg_iovlen; i++) { +#ifdef DEBUG +fprintf(stdout, "send_cots_rights: Sending %d bytes data\n", msg->msg_iov[i].iov_len); +#endif if (write(pipefd[0], msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len) != msg->msg_iov[i].iov_len) { @@ -1389,6 +1459,9 @@ _s_do_ioctl(s, buf, size, cmd, retlen) if ((retval & 0xff) == TSYSERR) errno = (retval >> 8) & 0xff; else { +#ifdef DEBUG +fprintf(stderr, "_s_do_ioctl: TLI error %d\n", retval & 0xff); +#endif errno = tlitosyserr(retval & 0xff); } return 0; @@ -1411,7 +1484,7 @@ _s_alloc_bufs(siptr, udata) size2 = sizeof(union T_primitives) + udata->addrsize + sizeof(long) + udata->optsize + sizeof(long); - if ((siptr->ctlbuf = calloc(1, size2)) == NULL) { + if ((siptr->ctlbuf = (char *)calloc(1, size2)) == NULL) { errno = ENOMEM; return -1; } @@ -1579,7 +1652,9 @@ _s_getfamily(siptr) * until one matches. */ if ((nethandle = setnetconfig()) == NULL) { - syslog(LOG_ERR, "_s_getfamily: setnetconfig failed"); +#ifdef DEBUG + nc_perror("_s_getfamily: setnetconfig failed"); +#endif return -1; } while ((net = getnetconfig(nethandle)) != NULL) { @@ -1620,28 +1695,11 @@ _s_uxpathlen(un) register int i; for (i = 0; i < sizeof(un->sun_path); i++) - if (un->sun_path[i] == NULL) + if (un->sun_path[i] == NULL) { +#ifdef DEBUG +fprintf(stdout, "_s_uxpathlen: Returning %d\n", i); +#endif return i; + } return sizeof(un->sun_path); } - -int -_s_cpaddr(siptr, to, tolen, from, fromlen) - register struct _si_user *siptr; - register char *to; - register int tolen; - register char *from; - register int fromlen; - -{ - (void)memset(to, 0, tolen); - if (_s_getfamily(siptr) == AF_INET) { - if (tolen > sizeof(struct sockaddr_in)) - tolen = sizeof(struct sockaddr_in); - } - else if (tolen > fromlen) - tolen = fromlen; - (void)memcpy(to, from, _s_min(fromlen , tolen)); - return tolen; -} - diff --git a/usr/src/lib/libsocket/socket/accept.c b/usr/src/lib/libsocket/socket/accept.c index 0388996..3994012 100644 --- a/usr/src/lib/libsocket/socket/accept.c +++ b/usr/src/lib/libsocket/socket/accept.c @@ -5,8 +5,30 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:accept.c 1.11" - +#ident "@(#)libsocket:accept.c 1.9" + +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ #include #include #include @@ -22,9 +44,10 @@ #include #include #include -#include -#include -#include +#ifdef DEBUG +#include +#endif + extern int errno; @@ -91,14 +114,11 @@ _accept(siptr, addr, addrlen) /* we don't expect any data, so no data * buffer is needed. */ - sigsave = sigset(SIGPOLL, SIG_HOLD); if ((retval = getmsg(s, &ctlbuf, NULL, &flg)) < 0) { - (void)sigset(SIGPOLL, sigsave); if (errno == EAGAIN) errno = EWOULDBLOCK; return -1; } - (void)sigset(SIGPOLL, sigsave); /* * did I get entire message? */ @@ -124,9 +144,9 @@ _accept(siptr, addr, addrlen) return -1; } if (addr && addrlen) { - *addrlen = _s_cpaddr(siptr, addr, *addrlen, - ctlbuf.buf + pptr->conn_ind.SRC_offset, - pptr->conn_ind.SRC_length); + if (*addrlen > pptr->conn_ind.SRC_length) + *addrlen = pptr->conn_ind.SRC_length; + (void)memcpy(addr, ctlbuf.buf+pptr->conn_ind.SRC_offset, *addrlen); } break; @@ -145,7 +165,9 @@ _accept(siptr, addr, addrlen) * until one matches. */ if ((nethandle = setnetconfig()) == NULL) { - (void)syslog(LOG_ERR, "_accept: setnetconfig failed"); +#ifdef DEBUG + nc_perror("_accept: setnetconfig failed"); +#endif return -1; } while ((net = getnetconfig(nethandle)) != NULL) { @@ -163,7 +185,7 @@ _accept(siptr, addr, addrlen) return -1; } - /* Open a new instance to do the accept on + /* open a new instance to do the accept on * * Note that we have lost the protocol number(if one was * specified) with the listening endpoint, so we assume the @@ -214,39 +236,10 @@ _accept(siptr, addr, addrlen) sigset(SIGPOLL, sigsave); - /* New socket must have attributes of the - * accepting socket. - */ nsiptr->udata.so_state |= SS_ISCONNECTED; - nsiptr->udata.so_options = siptr->udata.so_options & ~SO_ACCEPTCONN; - - /* Make the ownership of the new socket the - * same as the original. - */ - retval = 0; - if (ioctl(s, SIOCGPGRP, &retval) == 0) { - if (retval != 0) { - (void)ioctl(nsiptr->fd, SIOCSPGRP, &retval); - } - } - else { - (void)syslog(LOG_ERR, - "accept: SIOCGPGRP failed errno %d\n", errno); - errno = 0; - } - - /* The accepted socket inherits the non-blocking and SIGIO - * attributes of the accepting socket. - */ - if ((flg = fcntl(s, F_GETFL, 0)) < 0) { - (void)syslog(LOG_ERR, - "accept: fcntl: F_GETFL failed %d\n", errno); - errno = 0; - } - else { - flg &= (FREAD|FWRITE|FASYNC|FNDELAY); - (void)fcntl(nsiptr->fd, F_SETFL, flg); - } return s2; } + + + diff --git a/usr/src/lib/libsocket/socket/bind.c b/usr/src/lib/libsocket/socket/bind.c index 00ef388..3666ea1 100644 --- a/usr/src/lib/libsocket/socket/bind.c +++ b/usr/src/lib/libsocket/socket/bind.c @@ -5,8 +5,30 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:bind.c 1.8" +#ident "@(#)libsocket:bind.c 1.5" +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ #include #include #include @@ -22,7 +44,9 @@ #include #include #include -#include +#ifdef DEBUG +#include +#endif extern int errno; static int _unbind(); @@ -168,13 +192,16 @@ _bind(siptr, name, namelen, raddr, raddrlen) rname = (struct sockaddr_in *)buf; aname = (struct sockaddr_in *)name; +#ifdef DEBUG +fprintf(stdout, "bind: AF_INET: aport %d, aaddr %x: gport %d gaddr %x\n", aname->sin_port, aname->sin_addr.s_addr, rname->sin_port, rname->sin_addr.s_addr); +#endif if (aname->sin_port != 0 && aname->sin_port != rname->sin_port) errno = EADDRINUSE; if (aname->sin_addr.s_addr != INADDR_ANY && aname->sin_addr.s_addr != rname->sin_addr.s_addr) - errno = EADDRNOTAVAIL; + errno = EADDRINUSE; } else if (name->sa_family == AF_UNIX) { @@ -182,6 +209,9 @@ _bind(siptr, name, namelen, raddr, raddrlen) register struct bind_ux *rbind_ux; rbind_ux = (struct bind_ux *)buf; +#ifdef DEBUG +fprintf(stdout, "bind: UNIX domain, got dev %x, ino %x\n", rbind_ux->extdev, rbind_ux->extino); +#endif if (rbind_ux->extdev != bind_ux.extdev || rbind_ux->extino != bind_ux.extino) errno = EADDRINUSE; @@ -189,7 +219,9 @@ _bind(siptr, name, namelen, raddr, raddrlen) } else { struct sockaddr *rname; - +#ifdef DEBUG +fprintf(stdout, "bind: non-AF_INET:\n"); +#endif if (namelen > sizeof(name->sa_family)) { rname = (struct sockaddr *)buf; if (memcmp(name->sa_data, rname->sa_data, @@ -200,21 +232,24 @@ _bind(siptr, name, namelen, raddr, raddrlen) } if (errno) { - register int error; + int inuse; - error = errno; /* Save it */ + inuse = (errno == EADDRINUSE); /* errno may be reset */ (void)_unbind(siptr); if (name && name->sa_family == AF_UNIX && fflag) (void)unlink(name->sa_data); - errno = error; + if (inuse) + errno = EADDRINUSE; return -1; } /* Copy back the bound address if requested. */ - if (raddr != NULL) - *raddrlen = _s_cpaddr(siptr, raddr, *raddrlen, - buf, bind_ack->ADDR_length); + if (raddr != NULL) { + if (bind_ack->ADDR_length < *raddrlen) + *raddrlen = bind_ack->ADDR_length; + (void)memcpy(raddr, buf, *raddrlen); + } siptr->udata.so_state |= SS_ISBOUND; diff --git a/usr/src/lib/libsocket/socket/connect.c b/usr/src/lib/libsocket/socket/connect.c index 35817ca..041e3ca 100644 --- a/usr/src/lib/libsocket/socket/connect.c +++ b/usr/src/lib/libsocket/socket/connect.c @@ -5,8 +5,33 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:connect.c 1.6" - +#ident "@(#)libsocket:connect.c 1.4" + +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ +#ifdef DEBUG +#include +#endif #include #include #include @@ -19,11 +44,7 @@ #include #include #include - - -#ifndef NULL -#define NULL 0 -#endif +#include extern int errno; static int _connect(); @@ -115,7 +136,6 @@ _connect2(siptr, sndcall) register struct t_call *sndcall; { register int fctlflg; - register void (*sigsave)(); if ((fctlflg = fcntl(siptr->fd, F_GETFL, 0)) < 0) return -1; @@ -136,19 +156,12 @@ _connect2(siptr, sndcall) if (_bind(siptr, NULL, 0, NULL, NULL) < 0) return -1; } - - /* Save SIGPOLL until the transaction is complete. - */ - sigsave = sigset(SIGPOLL, SIG_HOLD); - if (_s_snd_conn_req(siptr, sndcall) < 0) { - (void)sigset(SIGPOLL, sigsave); + if (_s_snd_conn_req(siptr, sndcall) < 0) return -1; - } /* if no delay, return with error if not CLTS. */ if (fctlflg & O_NDELAY && siptr->udata.servtype != T_CLTS) { - (void)sigset(SIGPOLL, sigsave); errno = EINPROGRESS; siptr->udata.so_state |= SS_ISCONNECTING; return -1; @@ -157,7 +170,6 @@ _connect2(siptr, sndcall) /* if CLTS, don't get the connection confirm. */ if (siptr->udata.servtype == T_CLTS) { - (void)sigset(SIGPOLL, sigsave); if (sndcall->addr.len == 0) /* Connect to Null address, breaks * the connection. @@ -167,11 +179,8 @@ _connect2(siptr, sndcall) return 0; } - if (_s_rcv_conn_con(siptr) < 0) { - (void)sigset(SIGPOLL, sigsave); + if (_s_rcv_conn_con(siptr) < 0) return -1; - } - (void)sigset(SIGPOLL, sigsave); siptr->udata.so_state |= SS_ISCONNECTED; diff --git a/usr/src/lib/libsocket/socket/getpeernm.c b/usr/src/lib/libsocket/socket/getpeernm.c index efac762..0b3693d 100644 --- a/usr/src/lib/libsocket/socket/getpeernm.c +++ b/usr/src/lib/libsocket/socket/getpeernm.c @@ -5,8 +5,30 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:getpeernm.c 1.5" +#ident "@(#)libsocket:getpeernm.c 1.4" +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ #include #include #include @@ -63,6 +85,8 @@ _getpeername(siptr, name, namelen) } (void)sigset(SIGPOLL, sigsave); - *namelen = _s_cpaddr(siptr, name, *namelen, netbuf.buf, netbuf.len); + if (*namelen > netbuf.len) + *namelen = netbuf.len; + (void)memcpy((caddr_t)name, siptr->ctlbuf, *namelen); return 0; } diff --git a/usr/src/lib/libsocket/socket/getsocknm.c b/usr/src/lib/libsocket/socket/getsocknm.c index eb8a728..cf13b93 100644 --- a/usr/src/lib/libsocket/socket/getsocknm.c +++ b/usr/src/lib/libsocket/socket/getsocknm.c @@ -5,8 +5,30 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:getsocknm.c 1.5" +#ident "@(#)libsocket:getsocknm.c 1.4" +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ #include #include #include @@ -64,6 +86,8 @@ _getsockname(siptr, name, namelen) } (void)sigset(SIGPOLL, sigsave); - *namelen = _s_cpaddr(siptr, name, *namelen, netbuf.buf, netbuf.len); + if (*namelen > netbuf.len) + *namelen = netbuf.len; + (void)memcpy((caddr_t)name, siptr->ctlbuf, *namelen); return 0; } diff --git a/usr/src/lib/libsocket/socket/listen.c b/usr/src/lib/libsocket/socket/listen.c index 00e3f1c..95a49eb 100644 --- a/usr/src/lib/libsocket/socket/listen.c +++ b/usr/src/lib/libsocket/socket/listen.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:listen.c 1.7" +#ident "@(#)libsocket:listen.c 1.4" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -29,7 +29,6 @@ * All rights reserved. * */ - #include #include #include @@ -77,18 +76,15 @@ listen(s, qlen) if ((siptr->udata.so_state & SS_ISBOUND) == 0) { int family; - /* Must have been explicitly bound in the UNIX domain. - */ - if ((family = _s_getfamily(siptr)) == AF_UNIX) { - errno = EINVAL; - return -1; - } - + family = _s_getfamily(siptr); +#ifdef DEBUG +fprintf(stderr, "listen: family %d\n", family); +#endif (void)memcpy(buf + bind_req->ADDR_offset, (caddr_t)&family, sizeof(short)); bind_req->ADDR_length = sizeof(short); } - else bind_req->ADDR_length = siptr->udata.addrsize; + else bind_req->ADDR_length = siptr->ctlsize; sigsave = sigset(SIGPOLL, SIG_HOLD); if (!_s_do_ioctl(s, siptr->ctlbuf, sizeof(*bind_req) + diff --git a/usr/src/lib/libsocket/socket/s_ioctl.c b/usr/src/lib/libsocket/socket/s_ioctl.c index 7d35b74..9675d1f 100644 --- a/usr/src/lib/libsocket/socket/s_ioctl.c +++ b/usr/src/lib/libsocket/socket/s_ioctl.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:s_ioctl.c 1.6" +#ident "@(#)libsocket:s_ioctl.c 1.5" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -29,26 +29,17 @@ * All rights reserved. * */ - +#ifdef DEBUG +#include +#endif #include -#include #include #include -#include #include #include #include #include -#include -#include #include -#include - -#ifndef NULL -#define NULL 0 -#endif /* NULL */ - -#define ISSOCK(A) (ioctl((A), I_FIND, "sockmod")) int fcntl(des, cmd, arg) @@ -58,53 +49,22 @@ fcntl(des, cmd, arg) { int res; - int retval; switch(cmd) { case F_SETOWN: - SOCKDEBUG((struct _si_user *)NULL, - "fcntl: got fcntl-F_SETOWN\n", 0); +#ifdef DEBUG +fprintf(stdout, "fcntl: got fcntl-F_SETOWN\n"); +#endif return ioctl(des, FIOSETOWN, &arg); case F_GETOWN: - SOCKDEBUG((struct _si_user *)NULL, - "fcntl: got fcntl-F_GETOWN\n", 0); +#ifdef DEBUG +fprintf(stdout, "fcntl: doing fcntl-F_GETOWN\n"); +#endif if (ioctl(des, FIOGETOWN, &res) < 0) return -1; return res; - case F_SETFL: - SOCKDEBUG((struct _si_user *)NULL, - "fcntl: got fcntl-F_SETFL\n", 0); - if (ISSOCK(des)) { - res = arg & FASYNC; - if (_s_dofioasync(des, &res) < 0) - return -1; - } - return _fcntl(des, cmd, arg); - - case F_GETFL: { - register int flags; - - SOCKDEBUG((struct _si_user *)NULL, - "fcntl: got fcntl-F_GETFL\n", 0); - if ((flags = _fcntl(des, cmd, arg)) < 0) - return -1; - if (ISSOCK(des)) { - /* See if SIGIO is in force. - */ - if (ioctl(des, I_GETSIG, &retval) < 0) { - if (errno != EINVAL) - return -1; - else errno = 0; - } - else - if (retval & (S_RDNORM|S_WRNORM)) - flags |= FASYNC; - } - return flags; - } - default: return _fcntl(des, cmd, arg); } @@ -120,8 +80,9 @@ ioctl(des, request, arg) pid_t pid; int retval; - SOCKDEBUG((struct _si_user *)NULL, - "ioctl: got ioctl request %x\n", request); +#ifdef DEBUG +fprintf(stdout, "ioctl: got ioctl request %x\n", request); +#endif switch(request) { case FIOASYNC: case FIOSETOWN: @@ -129,11 +90,12 @@ ioctl(des, request, arg) case SIOCSPGRP: case SIOCGPGRP: case SIOCATMARK: - if (ISSOCK(des) == 0) { + if(_ioctl(des, I_FIND, "sockmod") == 0) { if (request == SIOCSPGRP || request == SIOCGPGRP || request == SIOCATMARK) { - SOCKDEBUG((struct _si_user *)NULL, - "ioctl: %d not socket\n", des); +#ifdef DEBUG +fprintf(stdout, "ioctl: %d not socket\n", des); +#endif errno = ENOTSOCK; return -1; } @@ -142,14 +104,48 @@ ioctl(des, request, arg) switch(request) { case FIOASYNC: - /* Facilitate SIGIO. + /* Turn on or off async I/O. + */ +#ifdef DEBUG +fprintf(stdout, "ioctl: got FIOASYNC\n"); +#endif + retval = 0; + if (*(int *)arg) { + if (_ioctl(des, I_GETSIG, &retval) < 0 && + errno != EINVAL) + return -1; + + retval |= (S_RDNORM|S_WRNORM); + return _ioctl(des, I_SETSIG, retval); + } + + /* Get current disposition. + */ + if (_ioctl(des, I_GETSIG, &retval) < 0) { + if (errno == EINVAL) + return 0; + else return -1; + } + if ( !(retval & (S_RDNORM|S_WRNORM))) + /* Async not in effect. + */ + return 0; + + /* Clear out the old. */ - return _s_dofioasync(des, arg); + (void)_ioctl(des, I_SETSIG, 0) ; + + /* Bring in the new. + */ + if (retval &= ~(S_RDNORM|S_WRNORM)) + return _ioctl(des, I_SETSIG, retval); + return 0; case SIOCGPGRP: case FIOGETOWN: - SOCKDEBUG((struct _si_user *)NULL, - "ioctl: got SIOCGPGRP/FIOGETOWN\n", 0); +#ifdef DEBUG +fprintf(stdout, "ioctl: got SIOCGPGRP/FIOGETOWN\n"); +#endif retval = 0; if (_ioctl(des, I_GETSIG, &retval) < 0) { if (errno == EINVAL) { @@ -172,8 +168,9 @@ ioctl(des, request, arg) * fail it if the process group * specified is not the callers. */ - SOCKDEBUG((struct _si_user *)NULL, - "ioctl: got SIOCSPGRP/FIOSETOWN\n", 0); +#ifdef DEBUG +fprintf(stdout, "ioctl: got SIOCSPGRP/FIOSETOWN\n"); +#endif pid = *(pid_t *)arg; if (pid < 0) { pid = -pid; @@ -195,17 +192,29 @@ ioctl(des, request, arg) retval |= (S_RDBAND|S_BANDURG); if (_ioctl(des, I_SETSIG, retval) < 0) { - (void)syslog(LOG_ERR, - "ioctl: I_SETSIG failed %d\n", errno); +#ifdef DEBUG +perror("ioctl: I_SETSIG failed\n"); +#endif + return -1; + } + pid = getpid(); + if (_ioctl(des, SIOCSPGRP, &pid) < 0) { +#ifdef DEBUG +perror("ioctl: SIOCSPGRP failed\n"); +#endif return -1; } return 0; case SIOCATMARK: - SOCKDEBUG((struct _si_user *)NULL, - "ioctl: got SIOCATMARK\n", 0); +#ifdef DEBUG +fprintf(stdout, "ioctl: got SIOCATMARK\n"); +#endif if ((retval = _ioctl(des, I_ATMARK, LASTMARK)) < 0) return -1; +#ifdef DEBUG +fprintf(stdout, "ioctl: I_ATMARK returned %d\n", retval); +#endif *(int *)arg = retval; return 0; } @@ -213,73 +222,12 @@ ioctl(des, request, arg) default: break; } - SOCKDEBUG((struct _si_user *)NULL, - "ioctl: match failed, calling regular ioctl\n", 0); +#ifdef DEBUG +fprintf(stdout, "ioctl: match failed, calling regular ioctl\n"); +#endif return _ioctl(des, request, arg); } -/* Enable or disable asynchronous I/O - */ -static int -_s_dofioasync(des, arg) - register int des; - register int *arg; -{ - int retval; - - SOCKDEBUG((struct _si_user *)NULL, "_s_dofioasync: Entered, %d\n", - *arg); - /* Turn on or off async I/O. - */ - retval = 0; - if (*arg) { - /* Turn ON SIGIO. - */ - if (_ioctl(des, I_GETSIG, &retval) < 0) { - if (errno != EINVAL) - return -1; - else errno = 0; - } - else { - /* Don't bother if already on. - */ - if ((retval & (S_RDNORM|S_WRNORM)) == - (S_RDNORM|S_WRNORM)) - return 0; - } - - SOCKDEBUG((struct _si_user *)NULL, - "_s_dofioasync: Setting SIGIO\n", 0); - retval |= (S_RDNORM|S_WRNORM); - return _ioctl(des, I_SETSIG, retval); - } - - /* Turn OFF SIGIO. - */ - SOCKDEBUG((struct _si_user *)NULL, - "_s_dofioasync: Re-setting SIGIO\n", 0); - if (_ioctl(des, I_GETSIG, &retval) < 0) { - if (errno == EINVAL) { - errno = 0; - return 0; - } - else return -1; - } - if ( !(retval & (S_RDNORM|S_WRNORM))) - /* Async not in effect. - */ - return 0; - - /* Clear out the old. - */ - (void)_ioctl(des, I_SETSIG, 0) ; - - /* Bring in the new. - */ - if (retval &= ~(S_RDNORM|S_WRNORM)) - return _ioctl(des, I_SETSIG, retval); - return 0; -} diff --git a/usr/src/lib/libsocket/socket/socket.mk b/usr/src/lib/libsocket/socket/socket.mk index a09f3fd..db7742d 100644 --- a/usr/src/lib/libsocket/socket/socket.mk +++ b/usr/src/lib/libsocket/socket/socket.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)libsocket:socket/socket.mk 1.3" +#ident "@(#)libsocket:socket/socket.mk 1.2" # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -32,8 +32,7 @@ INC= $(ROOT)/usr/include DASHO= -O -PICOPT= -Kpic -CFLAGS= $(DASHO) $(MORECPP) -DSYSV $(PICOPT) -I$(INC) +CFLAGS= $(DASHO) $(MORECPP) -DSYSV -Kpic -I$(INC) OBJS= accept.o bind.o connect.o socket.o socketpair.o \ diff --git a/usr/src/lib/libsocket/socket/socketpair.c b/usr/src/lib/libsocket/socket/socketpair.c index a3ea3be..dccfd77 100644 --- a/usr/src/lib/libsocket/socket/socketpair.c +++ b/usr/src/lib/libsocket/socket/socketpair.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libsocket:socketpair.c 1.10" +#ident "@(#)libsocket:socketpair.c 1.9" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -29,7 +29,9 @@ * All rights reserved. * */ - +#ifdef DEBUG +#include +#endif #include #include #include diff --git a/usr/src/lib/libw/_wchar.h b/usr/src/lib/libw/_wchar.h index 20ff078..6b42787 100644 --- a/usr/src/lib/libw/_wchar.h +++ b/usr/src/lib/libw/_wchar.h @@ -5,24 +5,17 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libw:_wchar.h 1.3" +#ident "@(#)libw:_wchar.h 1.2" #define SS2 0x8e #define SS3 0x8f -#define H_EUCMASK 0x8080 -#define H_P11 0x8080 /* Code Set 1 */ -#define H_P01 0x0080 /* Code Set 2 */ -#define H_P10 0x8000 /* Code Set 3 */ -#define EUCMASK 0x30000000 -#define P11 0x30000000 /* Code Set 1 */ -#define P01 0x10000000 /* Code Set 2 */ -#define P10 0x20000000 /* Code Set 3 */ -#ifdef __STDC__ -#define _ctype __ctype -#endif -#define multibyte (_ctype[520]>1) -#define eucw1 _ctype[514] -#define eucw2 _ctype[515] -#define eucw3 _ctype[516] -#define scrw1 _ctype[517] -#define scrw2 _ctype[518] -#define scrw3 _ctype[519] +#define EUCMASK 0x8080 +#define P11 0x8080 /* Code Set 1 */ +#define P01 0x0080 /* Code Set 2 */ +#define P10 0x8000 /* Code Set 3 */ +#define multibyte (__ctype[520]>1) +#define eucw1 __ctype[514] +#define eucw2 __ctype[515] +#define eucw3 __ctype[516] +#define scrw1 __ctype[517] +#define scrw2 __ctype[518] +#define scrw3 __ctype[519] diff --git a/usr/src/lib/libw/getwidth.c b/usr/src/lib/libw/getwidth.c index a62e59d..9928597 100644 --- a/usr/src/lib/libw/getwidth.c +++ b/usr/src/lib/libw/getwidth.c @@ -5,23 +5,26 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libw:getwidth.c 1.4" +#ident "@(#)libw:getwidth.c 1.3" #include "libw.h" -#include "_wchar.h" #include +#define CSWIDTH 514 void getwidth(eucstruct) eucwidth_t *eucstruct; { - eucstruct->_eucw1 = eucw1; - eucstruct->_eucw2 = eucw2; - eucstruct->_eucw3 = eucw3; - eucstruct->_multibyte = multibyte; - if (_ctype[520] > 3 || eucw1 > 2) + unsigned char *cswidth = &__ctype[CSWIDTH]; + eucstruct->_eucw1 = cswidth[0]; + eucstruct->_eucw2 = cswidth[1]; + eucstruct->_eucw3 = cswidth[2]; + eucstruct->_multibyte = (cswidth[6] > 1); + if (cswidth[0] > sizeof(unsigned short) + || cswidth[1] > sizeof(unsigned short) + || cswidth[2] > sizeof(unsigned short)) eucstruct->_pcw = sizeof(unsigned long); else eucstruct->_pcw = sizeof(unsigned short); - eucstruct->_scrw1 = scrw1; - eucstruct->_scrw2 = scrw2; - eucstruct->_scrw3 = scrw3; + eucstruct->_scrw1 = cswidth[3]; + eucstruct->_scrw2 = cswidth[4]; + eucstruct->_scrw3 = cswidth[5]; } diff --git a/usr/src/lib/libw/mbftowc.c b/usr/src/lib/libw/mbftowc.c index 0da150e..b7c6c48 100644 --- a/usr/src/lib/libw/mbftowc.c +++ b/usr/src/lib/libw/mbftowc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libw:mbftowc.c 1.2" +#ident "@(#)libw:mbftowc.c 1.1" #include #include #include "_wchar.h" @@ -19,8 +19,6 @@ int *peekc; register int length; register wchar_t intcode; register c; - register shift; - int lflag; char *olds = s; wchar_t mask; @@ -31,23 +29,16 @@ int *peekc; *wchar = c; return(1); } - lflag = _ctype[520] > 3 || eucw1 > 2; intcode = 0; if (c == SS2) { if(!(length = eucw2)) goto lab1; - if (lflag) - mask = P01; - else - mask = H_P01; + mask = P01; goto lab2; } else if(c == SS3) { if(!(length = eucw3)) goto lab1; - if (lflag) - mask = P01; - else - mask = H_P01; + mask = P10; goto lab2; } @@ -56,17 +47,13 @@ int *peekc; *wchar = c; return(1); } - if (lflag) - mask = P11; - else - mask = H_P11; length = eucw1 - 1; + mask = P11; intcode = c & 0177; lab2: if(length < 0) return -1; - shift = 8 - lflag; while(length--) { *s++ = c = (*f)(); if(c < 0200 || iscntrl(c)) { @@ -75,7 +62,7 @@ int *peekc; --s; return(-(s - olds)); } - intcode = (intcode << shift) | (c & 0177); + intcode = (intcode << 8) | (c & 0177); } *wchar = intcode | mask; return(s - olds); diff --git a/usr/src/lib/libw/scrwidth.c b/usr/src/lib/libw/scrwidth.c index 42389f9..0db62e5 100644 --- a/usr/src/lib/libw/scrwidth.c +++ b/usr/src/lib/libw/scrwidth.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)libw:scrwidth.c 1.3" +#ident "@(#)libw:scrwidth.c 1.2" #include "libw.h" #include #include "_wchar.h" @@ -14,13 +14,7 @@ int scrwidth(c) wchar_t c; { if(!wisprint(c)) - return 0; - if(!multibyte || c <= 0177) - return 1; - if(MB_CUR_MAX > 3 || eucw1 > 2) - return((c & P11) == P11 ? scrw1 : + return(0); + return(!multibyte || c <= 0177 ? 1 : (c & P11) == P11 ? scrw1 : (c & P01) ? scrw2 : scrw3); - else - return((c & H_P11) == H_P11 ? scrw1 : - (c & H_P01) ? scrw2 : scrw3); } diff --git a/usr/src/lib/libwindows/libwindows.mk b/usr/src/lib/libwindows/libwindows.mk index d973429..bf96bbc 100644 --- a/usr/src/lib/libwindows/libwindows.mk +++ b/usr/src/lib/libwindows/libwindows.mk @@ -5,14 +5,14 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)attwin:lib/libagent/makefile 1.8.2.1" +#ident "@(#)attwin:lib/libagent/makefile 1.8.1.1" # # Copyright 1985 AT&T # CC = cc AR = ar -USRLIB = $(ROOT)/usr/lib +LIB = $(ROOT)/usr/lib CFLAGS = -O -I$(INC) INC = $(ROOT)/usr/include INS = install @@ -33,7 +33,7 @@ libwindows.o: $(INC)/sys/nxtproto.h $(CC) $(CFLAGS) -c libwindows.c install: all - $(INS) -f $(USRLIB) -u bin -g bin -m 644 libwindows.a + $(INS) -f $(LIB) -u bin -g bin -m 644 libwindows.a clean: rm -f libwindows.o diff --git a/usr/src/lib/nametoaddr/nametoaddr.mk b/usr/src/lib/nametoaddr/nametoaddr.mk index 56fd528..47843a4 100644 --- a/usr/src/lib/nametoaddr/nametoaddr.mk +++ b/usr/src/lib/nametoaddr/nametoaddr.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)nametoaddr:nametoaddr.mk 1.6" +#ident "@(#)nametoaddr:nametoaddr.mk 1.2" # # makefile for name to address mapping dynamic linking libraries. # @@ -15,47 +15,39 @@ TESTDIR = . INC = $(ROOT)/usr/include INS = install CFLAGS = -O +COMPONENTS = npack straddr tcpip FRC = all: - @for i in * ; do \ - if [ -d $$i ] ; then \ - cd $$i;\ - echo "##### make -f $$i.mk \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\"" ;\ - make -f $$i.mk "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)";\ - cd ..; \ - fi; \ + @for i in $(COMPONENTS);\ + do cd $$i;\ + make -f $$i.mk "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)";\ + cd ..;\ done; install: - @for i in * ; do \ - if [ -d $$i ] ; then \ - cd $$i;\ - echo $$i;\ - echo "##### make install -f $$i.mk \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\"" ;\ - make install -f $$i.mk "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)";\ - cd ..;\ - fi; \ + for i in $(COMPONENTS);\ + do cd $$i;\ + echo $$i;\ + make install -f $$i.mk "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)";\ + cd ..;\ done; clean: - @for i in * ; do \ - if [ -d $$i ] ; then \ - cd $$i;\ - echo $$i;\ - make -f $$i.mk clean;\ - cd .. ;\ - fi; \ + for i in $(COMPONENTS);\ + do\ + cd $$i;\ + echo $$i;\ + make -f $$i.mk clean;\ + cd .. ;\ done clobber: - @for i in * ; do \ - if [ -d $$i ] ; then \ - cd $$i;\ - echo $$i;\ - make -f $$i.mk clobber;\ - cd .. ;\ - fi; \ + for i in $(COMPONENTS);\ + do cd $$i;\ + echo $$i;\ + make -f $$i.mk clobber;\ + cd .. ;\ done FRC: diff --git a/usr/src/lib/nametoaddr/npack/npack.c b/usr/src/lib/nametoaddr/npack/npack.c new file mode 100644 index 0000000..00bc58f --- /dev/null +++ b/usr/src/lib/nametoaddr/npack/npack.c @@ -0,0 +1,621 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)nametoaddr:npack/npack.c 1.5" +#include +#include +#include +#include +#include +#include + +/* + * The generic name to address mappings for NPACK. + * + * Address in NPACK consist of a port (32 bits) followed by + * and address (64 bits). The following routines create the + * address from a "host" file and an "services" file. + * The hosts file is /etc/net/npack/hosts and + * contain lines of the form: + * + * 16_hexadecimal_digit_address machname + * + * The services file is /etc/net/npack/services and has lines + * of the form: + * + * service_name 8_hexadecimal_digit_port + * + */ + +#define HOSTFILE "/etc/net/%s/hosts" +#define SERVICEFILE "/etc/net/%s/services" +#define MAXELEMENTS 10 +#define MAXLEN 30 +#define FIELD1 1 +#define FIELD2 2 + +/* + * The length of the port and address in bytes. + */ + +#define PORTLENGTH 4 +#define ADDRLENGTH 8 + +#define toxdigit(c) ((isdigit(c))?((int)(c)-'0'):(toupper(c)-(int)'A'+10)) +#define tochar(c) ((c < 10)?((char)(c) + '0'):((char)(c)+'A'-(char)10)) + +/* + * Local and external functions used. + */ + +extern char *strdup(), *strtok(), *strcpy(), *calloc(); +extern char *fgets(), *malloc(), *strcat(), *memcpy(); +extern FILE *fopen(); +extern int fclose(), strcmp(), strlen(); +extern long strtol(); + +char **searchhost(); +char *searchserv(); +char *mergeaddr(); +int dohex(); + +extern int _nderror; /* used for error reporting */ + +/* + * _netdir_getbyname() returns all of the addresses for + * a specified host and service. + */ + +struct nd_addrlist * +_netdir_getbyname(netconfigp, nd_hostservp) +struct netconfig *netconfigp; +struct nd_hostserv *nd_hostservp; +{ + char searchfile[BUFSIZ]; /* the name of the file to be opened */ + char fulladdr[BUFSIZ]; /* holds the full address string */ + char **addrpp; /* list of addresses from the host file */ + char *port; /* the string from the services file */ + char *hostname; /* the host name to search for */ + FILE *fp; /* points to the hosts and service file */ + struct nd_addrlist *retp; /* the return structure */ + struct netbuf *netbufp; /* indexes through the addresses */ + struct utsname utsname; /* holds information about this machine */ + int naddr; /* the number of address obtained */ + + _nderror = ND_OK; + + /* + * If the given hostname is HOST_SELF, simply re-set + * it to the uname of this machine. If it is HOST_ANY + * or HOST_BROADCAST, return an error (since they are not + * supported). + */ + + if ((strcmp(nd_hostservp->h_host, HOST_ANY) == 0) + || (strcmp(nd_hostservp->h_host, HOST_BROADCAST) == 0)) { + _nderror = ND_NOHOST; + return(NULL); + } + + hostname = nd_hostservp->h_host; + if (strcmp(nd_hostservp->h_host, HOST_SELF) == 0) { + uname(&utsname); + hostname = utsname.nodename; + } + + /* + * Get the address of the host. The hosts file + * is created with the local name of the npack network + * (given in netconfigp->nc_netid). + */ + + (void)sprintf(searchfile, HOSTFILE, netconfigp->nc_netid); + + if (((fp = fopen(searchfile, "r")) == NULL) + || ((addrpp = searchhost(fp, hostname, &naddr, FIELD2)) == NULL)) { + _nderror = ND_NOHOST; + return(NULL); + } + (void)fclose(fp); + + /* + * Get the port number of the address from the services file + */ + + (void)sprintf(searchfile, SERVICEFILE, netconfigp->nc_netid); + + if (((fp = fopen(searchfile, "r")) == NULL) + || ((port = searchserv(fp, nd_hostservp->h_serv, FIELD1)) == NULL)) { + _nderror = ND_NOSERV; + return(NULL); + } + (void)fclose(fp); + + /* + * Allocate space to hold the return structure, set the number + * of address, and allocate space to hold them. + */ + + if ((retp = (struct nd_addrlist *)malloc(sizeof(struct nd_addrlist))) == NULL) { + _nderror = ND_NOMEM; + return(NULL); + } + + retp->n_cnt = naddr; + if ((retp->n_addrs = (struct netbuf *)calloc((unsigned)naddr, sizeof(struct netbuf))) == NULL) { + _nderror = ND_NOMEM; + return(NULL); + } + + /* + * Now simply fill in the address by calling "dohex" + * to transform the hexadecimal string into a hexidecimal + * number and places it into the buffer provided. + */ + + netbufp = retp->n_addrs; + if (dohex(port, fulladdr) != PORTLENGTH) { + _nderror = ND_NOSYM; + return(NULL); + } + while (naddr--) { + + /* + * The port number takes up PORTLENGTH bytes; the + * address takes up ADDRLENGTH + */ + + if (dohex(*addrpp++, &fulladdr[PORTLENGTH]) != ADDRLENGTH) { + _nderror = ND_NOSYM; + return(NULL); + } + fulladdr[PORTLENGTH + ADDRLENGTH] = '\0'; + + netbufp->len = PORTLENGTH + ADDRLENGTH; + netbufp->maxlen = PORTLENGTH + ADDRLENGTH; + if ((netbufp->buf = malloc(PORTLENGTH + ADDRLENGTH)) == NULL) { + _nderror = ND_NOMEM; + return(NULL); + } + (void)memcpy(netbufp->buf, fulladdr, PORTLENGTH + ADDRLENGTH); + netbufp ++; + } + + return(retp); +} + +/* + * _netdir_getbyaddr() takes an address and returns all hosts with + * that address. + */ + +struct nd_hostservlist * +_netdir_getbyaddr(netconfigp, netbufp) +struct netconfig *netconfigp; +struct netbuf *netbufp; +{ + char searchfile[BUFSIZ]; /* the file to be opened */ + char addr[ADDRLENGTH*2+1]; /* string representation of addr */ + char port[PORTLENGTH*2+1]; /* string representation of port */ + struct nd_hostservlist *retp; /* the return structure */ + FILE *fp; /* pointer to open files */ + char **hostpp; /* points to list of host names */ + char *serv; /* resultant service name obtained*/ + int nhost; /* the number of hosts in hostpp */ + struct nd_hostserv *nd_hostservp; /* traverses the host structures */ + int i; /* indexes through full address */ + char tempval; /* hold value to turn into a char */ + + _nderror = ND_OK; + + /* + * Separate the address into port and host address + */ + + for (i = 0; i < PORTLENGTH; i++) { + tempval = (netbufp->buf[i] & 0xF0) >> 4; + port[i*2] = tochar(tempval); + tempval = netbufp->buf[i] & 0x0F; + port[i*2+1] = tochar(tempval); + } + port[PORTLENGTH * 2] = '\0'; + + for (i = 0; i < ADDRLENGTH + 1; i++) { + tempval = (netbufp->buf[i + PORTLENGTH] & 0xF0) >> 4; + addr[i*2] = tochar(tempval); + tempval = netbufp->buf[i + PORTLENGTH] & 0x0F; + addr[i*2+1] = tochar(tempval); + } + addr[ADDRLENGTH * 2] = '\0'; + + /* + * Search for all the hosts associated with the + * given host address. + */ + + (void)sprintf(searchfile, HOSTFILE, netconfigp->nc_netid); + + if (((fp = fopen(searchfile, "r")) == NULL) + || ((hostpp = searchhost(fp, addr, &nhost, FIELD1)) == NULL)) { + _nderror = ND_NOHOST; + return(NULL); + } + (void)fclose(fp); + + /* + * Search for the service associated with the given + * port number. + */ + + (void)sprintf(searchfile, SERVICEFILE, netconfigp->nc_netid); + + if (((fp = fopen(searchfile, "r")) == NULL) + || ((serv = searchserv(fp, port, FIELD2)) == NULL)) { + _nderror = ND_NOSERV; + return(NULL); + } + (void)fclose(fp); + + /* + * Allocate space to hold the return structure, set the number + * of hosts, and allocate space to hold them. + */ + + if ((retp = (struct nd_hostservlist *)malloc(sizeof(struct nd_hostservlist))) == NULL) { + _nderror = ND_NOMEM; + return(NULL); + } + + retp->h_cnt = nhost; + if ((retp->h_hostservs = (struct nd_hostserv *)calloc((unsigned)nhost, sizeof(struct nd_hostserv))) == NULL) { + _nderror = ND_NOMEM; + return(NULL); + } + + /* + * Loop through the host structues and fill them in with + * each host name (and service name). + */ + + nd_hostservp = retp->h_hostservs; + + while (nhost--) { + if (((nd_hostservp->h_host = strdup(*hostpp++)) == NULL) + || ((nd_hostservp->h_serv = strdup(serv)) == NULL)) { + _nderror = ND_NOMEM; + return(NULL); + } + nd_hostservp ++; + } + + return(retp); +} + +/* + * _taddr2uaddr() translates a address into a "universal" address. + * The universal address for npack is a string of the form + * "p1.p2.h1.h2.h3.h4" where p1 and p2 are the decimal representation + * of the port number (each being 8 bits), and h1 - h4 are the + * decimal representation of the host address (8 bits each). + */ + +char * +_taddr2uaddr(netconfigp, netbufp) +struct netconfig *netconfigp; +struct netbuf *netbufp; +{ + char buf[BUFSIZ]; /* buffer to hold universal address */ + int i; /* indexes through buffer */ + int place = 0; /* current place to put address */ + + for (i = 0; i < PORTLENGTH + ADDRLENGTH; i++) { + place += sprintf(&buf[place], "%.2x.", netbufp->buf[i]); + } + + /* + * Get rid of the last "." + */ + + buf[place - 1] = '\0'; + return(strdup(buf)); +} + +/* + * _uaddr2taddr() translates a universal address back into a + * netaddr structure. + */ + +struct netbuf * +_uaddr2taddr(netconfigp, uaddr) +struct netconfig *netconfigp; +char *uaddr; +{ + struct netbuf *retp; /* the return structure */ + char tempbuf[BUFSIZ]; /* temporarily holds the uaddr */ + char *placep; /* traverses the uaddr */ + int i; /* indexes through the netbuf */ + + /* + * Allocate space to hold the return structure and fill in + * the lengths. + */ + + if ((retp = (struct netbuf *)malloc(sizeof(struct netbuf))) == NULL) { + _nderror = ND_NOMEM; + return(NULL); + } + + retp->maxlen = retp->len = ADDRLENGTH+PORTLENGTH; + if ((retp->buf = malloc(ADDRLENGTH + PORTLENGTH)) == NULL) { + _nderror = ND_NOMEM; + return(NULL); + } + + /* + * Convert the character digits into longs for the netbuf. + */ + + (void)strcpy(tempbuf, uaddr); + placep = strtok(tempbuf, "."); + for (i = 0; i < ADDRLENGTH + PORTLENGTH; i++) { + retp->buf[i] = (char)strtol(placep, (char **)NULL, 16); + placep = strtok(NULL, "."); + } + return(retp); +} + +/* + * _netdir_options() is a "catch-all" routine that does + * transport specific things. The only thing that npack + * has to worry about is ND_MERGEADDR. + */ + +int +_netdir_options(netconfigp, option, fd, par) +struct netconfig *netconfigp; +int option; +int fd; +void *par; +{ + struct nd_mergearg *argp; /* the argument for mergeaddr */ + + switch(option) { + case ND_MERGEADDR: + argp = (struct nd_mergearg *)par; + argp->m_uaddr = mergeaddr(netconfigp, argp->s_uaddr, argp->c_uaddr); + return(argp->m_uaddr == NULL? -1 : 0); + default: + _nderror = ND_NOCTRL; + return(-1); + } +} + +/* + * mergeaddr() translates a universal address into something + * that makes sense to the caller. This is a no-op in npack's case, + * so just return the universal address. + */ + +static char * +mergeaddr(netconfigp, uaddr, ruaddr) +struct netconfig *netconfigp; +char *uaddr; +char *ruaddr; +{ + return(strdup(uaddr)); +} + +/* + * searchhost() looks for the specified token in the host file. + * The "field" parameter signifies which field to compare the token + * on, and returns all values associated with the token. + */ + +static char ** +searchhost(fp, token, nelements, field) +FILE *fp; +char *token; +int *nelements; +int field; +{ + /* + * "retp" and "namebuf" make up the array of names + * to return. + */ + + static char *retp[MAXELEMENTS]; + static char namebuf[MAXELEMENTS*MAXLEN]; + + char buf[BUFSIZ]; /* holds each line of the file */ + char *fileaddr; /* the first token in each line */ + char *filehost; /* the second token in each line */ + char *namep = namebuf; /* where the next return string should go */ + char *cmpstr; /* the string to compare token to */ + char *retstr; /* the string to return if compare succeeds */ + char *p; /* traverses the addr turning to upper case */ + + /* + * nelements will contain the number of token found, so + * initially set it to 0. + */ + + *nelements = 0; + + /* + * Loop through the file looking for the tokens and creating + * the list of strings to be returned. + */ + + while (fgets(buf, BUFSIZ, fp) != NULL) { + + /* + * Ignore comments and bad lines. + */ + + if (((fileaddr = strtok(buf, " \t\n")) == NULL) + || (*fileaddr == '#') + || ((filehost = strtok(NULL, " \t\n")) == NULL)) { + continue; + } + + /* + * Change all lower case hex digits to upper case + * to help in comparisons later. + */ + + for (p = fileaddr; *p; p++) + *p = toupper(*p); + + /* + * determine which to compare the token to, then + * compare it, and if they match, add the return + * string to the list. + */ + + cmpstr = (field == FIELD1)? fileaddr : filehost; + retstr = (field == FIELD1)? filehost : fileaddr; + + if ((strcmp(token, cmpstr) == 0) + && (*nelements < MAXELEMENTS)) { + retp[(*nelements)++] = strcpy(namep, retstr); + namep[MAXLEN - 1] = '\0'; + namep += MAXLEN; + } + } + + /* + * If *nelements is 0 then no matches were found. + */ + + if (*nelements == 0) { + return(NULL); + } + return(retp); +} + +/* + * searchserve() looks for the specified token in the service file. + * The "field" parameter signifies which field to compare the token + * on, and returns the string associated with eth token. + */ + +static char * +searchserv(fp, token, field) +FILE *fp; +char *token; +int field; +{ + static char buf[BUFSIZ]; /* holds a line of the file */ + char *fileservice; /* the first token in each line */ + char *fileport; /* the second token in each line */ + char *retp; /* the string to be returned */ + char *cmpstr; /* the string to compare the token to */ + char *retstr; /* temporarily hold token in line of file */ + char *p; /* changes the port num into upper case */ + + retp = NULL; + + /* + * Loop through the services file looking for the token. + */ + + while (fgets(buf, BUFSIZ, fp) != NULL) { + + /* + * If comment or bad line, continue. + */ + + if (((fileservice = strtok(buf, " \t\n")) == NULL) + || (*fileservice == '#') + || ((fileport = strtok(NULL, " \t\n")) == NULL)) { + continue; + } + + /* + * Change all lower case hex digits to upper case + * to help in comparisons later. + */ + + for (p = fileport; *p; p++) + *p = toupper(*p); + + cmpstr = (field == FIELD1)? fileservice : fileport; + retstr = (field == FIELD1)? fileport : fileservice; + + if (strcmp(token, cmpstr) == 0) { + retp = retstr; + break; + } + + } + return(retp); +} + +/* + * dohex() takes a string that consists of a string representation of + * a hexidecimal number, and converts it into hexidecimal digits + * (placing the result into outbuf). + */ + +static int +dohex(srcstr, outbuf) +char *srcstr; +char *outbuf; +{ + int curr; /* used to index through the output buffer */ + int i; /* also indexes through the output buffer */ + int shift = 0; /* boolean that specifies to shift digits */ + char *endp; /* the end of the input string */ + + /* + * The length of the src string must be 8 (if it is a port + * number) or 16 (if it is an address). + */ + + curr = strlen(srcstr); + if (curr != 8 && curr != 16) { + outbuf[0] = '\0'; + return(0); + } + + /* + * Find the end of the string and make sure it is \0. + */ + + for (endp = srcstr; *endp && isxdigit(*endp); ++endp) + ; + + if (*endp != '\0') { + outbuf[0] = '\0'; + return(0); + } + --endp; + + /* + * set "curr" to the last element of the buffer that the + * converted string will go into (if the string was 8, then + * the hex representation will take up 4 bytes, hence the + * last element is 3). + */ + + curr = (curr / 2) - 1; + for (i = 0; i <= curr; i++) + outbuf[i] = '\0'; + + /* + * create the hex representation of the string. + */ + + while (curr >= 0) { + outbuf[curr] |= (toxdigit(*endp) << shift); + if ((shift = (shift) ? 0 : 4) == 0) + --curr; + --endp; + } + + return(strlen(srcstr) / 2); +} diff --git a/usr/src/lib/nametoaddr/npack/npack.mk b/usr/src/lib/nametoaddr/npack/npack.mk new file mode 100644 index 0000000..7f3932e --- /dev/null +++ b/usr/src/lib/nametoaddr/npack/npack.mk @@ -0,0 +1,59 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)nametoaddr:npack/npack.mk 1.1" + +# Makefile for npack.so + +ROOT = + +DIR = $(ROOT)/usr/lib + +INC = $(ROOT)/usr/include + +LDFLAGS = -s + +CFLAGS = -O -I$(INC) + +STRIP = strip + +SIZE = size + +MAKEFILE = npack.mk + +MAINS = npack.so + +OBJECTS = npack.o + +SOURCES = npack.c + +ALL: $(MAINS) + +npack.so: npack.o + $(CC) $(CFLAGS) -dy -G -ztext -o npack.so npack.o $(LDFLAGS) + + +npack.o: $(INC)/stdio.h $(INC)/tiuser.h $(INC)/netdir.h \ + $(INC)/netconfig.h $(INC)/ctype.h + $(CC) $(CFLAGS) -c npack.c $(LDFLAGS) -Kpic + +clean: + rm -f $(OBJECTS) + +clobber: + rm -f $(OBJECTS) $(MAINS) + +all : ALL + +install: ALL + install -f $(DIR) npack.so + +size: ALL + $(SIZE) $(MAINS) + +strip: ALL + $(STRIP) $(MAINS) diff --git a/usr/src/lib/nametoaddr/straddr/straddr.c b/usr/src/lib/nametoaddr/straddr/straddr.c index 1f9c107..f4f7481 100644 --- a/usr/src/lib/nametoaddr/straddr/straddr.c +++ b/usr/src/lib/nametoaddr/straddr/straddr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)nametoaddr:straddr/straddr.c 1.8" +#ident "@(#)nametoaddr:straddr/straddr.c 1.7" #include #include #include @@ -112,9 +112,6 @@ struct nd_hostserv *nd_hostservp; if (((fp = fopen(searchfile, "r")) == NULL) || ((addrpp = searchhost(fp, hostname, &naddr, FIELD2)) == NULL)) { - if (fp != NULL) { - (void)fclose(fp); - } _nderror = ND_NOHOST; return(NULL); } @@ -128,9 +125,6 @@ struct nd_hostserv *nd_hostservp; if (((fp = fopen(searchfile, "r")) == NULL) || ((port = searchserv(fp, nd_hostservp->h_serv, FIELD1)) == NULL)) { - if (fp != NULL) { - (void)fclose(fp); - } _nderror = ND_NOSERV; return(NULL); } @@ -223,9 +217,6 @@ struct netbuf *netbufp; if (((fp = fopen(searchfile, "r")) == NULL) || ((hostpp = searchhost(fp, addr, &nhost, FIELD1)) == NULL)) { _nderror = ND_NOHOST; - if (fp != NULL) { - (void)fclose(fp); - } return(NULL); } (void)fclose(fp); @@ -237,23 +228,12 @@ struct netbuf *netbufp; (void)sprintf(searchfile, SERVICEFILE, netconfigp->nc_netid); - if (port == NULL) { - _nderror = ND_NOSERV; - return(NULL); - } - if (((fp = fopen(searchfile, "r")) == NULL) || ((serv = searchserv(fp, port, FIELD2)) == NULL)) { - serv = _taddr2uaddr(netconfigp, netbufp); - strcpy(fulladdr, serv); - free(serv); - serv = fulladdr; - while (*serv != '.') - serv ++; - } - if (fp != NULL) { - (void)fclose(fp); + _nderror = ND_NOSERV; + return(NULL); } + (void)fclose(fp); /* * Allocate space to hold the return structure, set the number diff --git a/usr/src/lib/nametoaddr/tcpip/file_db.c b/usr/src/lib/nametoaddr/tcpip/file_db.c index d748419..6cd5ef7 100644 --- a/usr/src/lib/nametoaddr/tcpip/file_db.c +++ b/usr/src/lib/nametoaddr/tcpip/file_db.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)nametoaddr:tcpip/file_db.c 1.3" +#ident "@(#)nametoaddr:tcpip/file_db.c 1.2" /* * This is the C library "getXXXbyYYY" routines after they have been stripped @@ -207,7 +207,7 @@ he_interpret() /* Now check for whitespace */ cp = strpbrk(p, " \t"); if (cp == NULL) - return (_gethostent()); + return (NULL); *cp++ = '\0'; /* This breaks the line into name/address components */ /* return one address */ diff --git a/usr/src/lib/nametoaddr/tcpip/tcpip.c b/usr/src/lib/nametoaddr/tcpip/tcpip.c index f2faed7..c452bcb 100644 --- a/usr/src/lib/nametoaddr/tcpip/tcpip.c +++ b/usr/src/lib/nametoaddr/tcpip/tcpip.c @@ -5,10 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)nametoaddr:tcpip/tcpip.c 1.5" +#ident "@(#)nametoaddr:tcpip/tcpip.c 1.4" #if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)tcpip.c 1.5 89/10/09 Copyr 1989 Sun Micro"; +static char sccsid[] = "@(#)tcpip.c 1.4 89/06/16 Copyr 1989 Sun Micro"; #endif /* @@ -38,7 +38,6 @@ static char sccsid[] = "@(#)tcpip.c 1.5 89/10/09 Copyr 1989 Sun Micro"; #include #include #include -#include #ifdef SYSLOG #include #else @@ -195,8 +194,8 @@ _netdir_getbyname(tp, serv) return (NULL); } /* Vendor specific, that is why it's here and hard coded */ - na->maxlen = sizeof(struct sockaddr_in); - na->len = sizeof(struct sockaddr_in); + na->maxlen = 8; + na->len = 8; na->buf = (char *)sa; sa->sin_family = AF_INET; sa->sin_port = server_port; @@ -557,8 +556,8 @@ _uaddr2taddr(tp, addr) return (0); } result->buf = (char *)(sa); - result->maxlen = sizeof(struct sockaddr_in); - result->len = sizeof(struct sockaddr_in); + result->maxlen = 8; + result->len = 8; /* XXX there is probably a better way to do this. */ sscanf(addr,"%d.%d.%d.%d.%d.%d", &h1, &h2, &h3, &h4, &p1, &p2); diff --git a/usr/src/lib/nametoaddr/tcpip/tcpip.mk b/usr/src/lib/nametoaddr/tcpip/tcpip.mk index 9572556..b3dc8d5 100644 --- a/usr/src/lib/nametoaddr/tcpip/tcpip.mk +++ b/usr/src/lib/nametoaddr/tcpip/tcpip.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)nametoaddr:tcpip/tcpip.mk 1.2" +#ident "@(#)nametoaddr:tcpip/tcpip.mk 1.1" # Makefile for tcpip.so @@ -15,9 +15,9 @@ DIR = $(ROOT)/usr/lib INC = $(ROOT)/usr/include -LDFLAGS = -s +LDFLAGS = -s -CFLAGS = -O -I$(INC) -D_NSL_RPC_ABI +CFLAGS = -O -I$(INC) STRIP = strip diff --git a/usr/src/lib/rtld/common/dlfcns.c b/usr/src/lib/rtld/common/dlfcns.c index 3d1a4e0..691a4d9 100644 --- a/usr/src/lib/rtld/common/dlfcns.c +++ b/usr/src/lib/rtld/common/dlfcns.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/dlfcns.c 1.8" +#ident "@(#)rtld:common/dlfcns.c 1.5" #include "rtinc.h" @@ -16,6 +16,7 @@ */ #ifdef __STDC__ + #pragma weak dlerror = _dlerror char *_dlerror() #else @@ -45,6 +46,7 @@ static DLLIST *dl_makelist ARGS((struct rt_private_map *lm)); static int dl_delete ARGS((DLLIB *dptr)); #ifdef __STDC__ + #pragma weak dlopen = _dlopen VOID *_dlopen(pathname, mode) #else VOID *dlopen(pathname, mode) @@ -103,7 +105,7 @@ int mode; if (!dlptr || (dlptr->dl_status != DL_OPEN && dlptr->dl_name)) { if (mode != RTLD_LAZY && mode != RTLD_NOW) { - _rt_lasterr("%s: %s: illegal mode to dlopen: %d",(char*) _rt_name,_proc_name,mode); + _rt_lasterr("ld.so: %s: illegal mode to dlopen: %d",_proc_name,mode); return 0; } /* set up rtld interface */ @@ -140,7 +142,7 @@ int mode; retval++; } if (retval->d_tag == DT_NULL) { - _rt_lasterr("%s: %s: interface error: bad return value to dlopen",(char*) _rt_name,_proc_name); + _rt_lasterr("ld.so: %s: interface error: bad return value to dlopen",_proc_name); return 0; } @@ -250,6 +252,7 @@ struct rt_private_map *lm; */ #ifdef __STDC__ + #pragma weak dlsym = _dlsym VOID *_dlsym(handle, name) #else @@ -267,11 +270,11 @@ VOID *handle; DPRINTF(LIST,(2,"rtld: dlsym(0x%x, %s)\n",handle,name?name:(CONST char *)"0")); if (!name) { - _rt_lasterr("%s: %s: null symbol name to dlsym",(char*) _rt_name,_proc_name); + _rt_lasterr("ld.so: %s: null symbol name to dlsym",_proc_name); return(0); } if (((DLLIB *)handle)->dl_status != DL_OPEN) { - _rt_lasterr("%s: %s: dlsym: attempt to find symbol %s in closed object",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: dlsym: attempt to find symbol %s in closed object",_proc_name,name); return(0); } @@ -290,7 +293,7 @@ VOID *handle; } } if (!sym) { - _rt_lasterr("%s: %s: dlsym: can't find symbol: %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: dlsym: can't find symbol: %s",_proc_name,name); return(0); } symfound: @@ -309,6 +312,7 @@ VOID *handle; */ #ifdef __STDC__ + #pragma weak dlclose = _dlclose int _dlclose(handle) #else @@ -323,7 +327,7 @@ VOID *handle; DPRINTF(LIST,(2,"rtld: dlclose(0x%x)\n",handle)); if (((DLLIB *)handle)->dl_status != DL_OPEN) { - _rt_lasterr("%s: %s: dlclose: attempt to close already closed object",(char*) _rt_name,_proc_name); + _rt_lasterr("ld.so: %s: dlclose: attempt to close already closed object",_proc_name); return(1); } /* decrement reference counts of all objects associated @@ -423,7 +427,7 @@ DLLIB *dptr; PTRUNC(addr), msize) == -1) { /* ??? or should we continue ??? */ - _rt_lasterr("%s: %s: dlclose: failure unmapping %s",(char*) _rt_name,_proc_name,NAME(lm)); + _rt_lasterr("ld.so: %s: dlclose: failure unmapping %s",_proc_name,NAME(lm)); return(0); } } diff --git a/usr/src/lib/rtld/common/externs.h b/usr/src/lib/rtld/common/externs.h index fdbc24e..b0ebdaf 100644 --- a/usr/src/lib/rtld/common/externs.h +++ b/usr/src/lib/rtld/common/externs.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/externs.h 1.6" +#ident "@(#)rtld:common/externs.h 1.5" /* declarations of external symbols used in ld.so */ @@ -21,7 +21,6 @@ extern int _rt_warn; /* print warnings for undefines? */ extern struct r_debug _r_debug; /* debugging information */ extern char *_rt_error; /* string describing last error */ extern char *_proc_name; /* file name of executing process */ -extern CONST char *_rt_name; /* name of the dynamic linker */ extern int _syspagsz; /* system page size */ extern unsigned long _flags; /* machine specific file flags */ diff --git a/usr/src/lib/rtld/common/globals.c b/usr/src/lib/rtld/common/globals.c index da5a19d..4389f8a 100644 --- a/usr/src/lib/rtld/common/globals.c +++ b/usr/src/lib/rtld/common/globals.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/globals.c 1.4" +#ident "@(#)rtld:common/globals.c 1.3" #include "rtinc.h" @@ -25,7 +25,6 @@ struct r_debug _r_debug = { LD_DEBUG_VERSION, int _devzero_fd = -1; /* file descriptor for /dev/zero */ char *_rt_error = 0; /* string describing last error */ char *_proc_name = 0; /* file name of executing process */ -CONST char *_rt_name = "dynamic linker"; int _syspagsz = 0; /* system page size */ unsigned long _flags = 0; /* machine specific file flags */ diff --git a/usr/src/lib/rtld/common/map.c b/usr/src/lib/rtld/common/map.c index 072ea5c..322a0ca 100644 --- a/usr/src/lib/rtld/common/map.c +++ b/usr/src/lib/rtld/common/map.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/map.c 1.26" +#ident "@(#)rtld:common/map.c 1.23" #include "rtinc.h" @@ -57,7 +57,7 @@ CONST char *pathname; if (_read(fd, (char *)ehdr, hsize) != hsize) { if ((_lseek(fd, 0, 0) == -1) || (_read(fd, (char *)ehdr, sizeof(Elf32_Ehdr)) != sizeof(Elf32_Ehdr))) { - _rt_lasterr("%s: %s: can't read ELF header for file: %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: can't read ELF header for file: %s",_proc_name,name); return 0; } } @@ -69,34 +69,34 @@ CONST char *pathname; ehdr->e_ident[EI_MAG1] != ELFMAG1 || ehdr->e_ident[EI_MAG2] != ELFMAG2 || ehdr->e_ident[EI_MAG3] != ELFMAG3) { - _rt_lasterr("%s: %s: %s is not an ELF file",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: %s is not an ELF file",_proc_name,name); return 0; } /* check class and encoding */ if (ehdr->e_ident[EI_CLASS] != M_CLASS || ehdr->e_ident[EI_DATA] != M_DATA) { - _rt_lasterr("%s: %s: %s has wrong class or data encoding",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: %s has wrong class or data encoding",_proc_name,name); return 0; } /* check magic number */ if (is_main) { if (ehdr->e_type != ET_EXEC) { - _rt_lasterr("%s: %s: %s not an executable file",(char*) _rt_name, _proc_name,name); + _rt_lasterr("ld.so: %s: %s not an executable file", _proc_name,name); return 0; } } else { /* shared object */ if (ehdr->e_type != ET_DYN) { - _rt_lasterr("%s: %s: %s not a shared object",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: %s not a shared object",_proc_name,name); return 0; } } /* check machine type */ if (ehdr->e_machine != M_MACH) { - _rt_lasterr("%s: %s: bad machine type for file: %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: bad machine type for file: %s",_proc_name,name); return 0; } @@ -109,7 +109,7 @@ CONST char *pathname; /* verify ELF version */ /* ??? is this too restrictive ??? */ if (ehdr->e_version > EV_CURRENT) { - _rt_lasterr("%s: %s: bad file version for file: %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: bad file version for file: %s",_proc_name,name); return 0; } @@ -118,7 +118,7 @@ CONST char *pathname; ((ehdr->e_ehsize + (ehdr->e_phnum * ehdr->e_phentsize)) > hsize)) { hsize = ehdr->e_phnum * ehdr->e_phentsize; if (_lseek(fd, ehdr->e_phoff, 0) == -1) { - _rt_lasterr("%s: %s: cannot seek to program header for file: %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: cannot seek to program header for file: %s",_proc_name,name); return 0; } @@ -126,7 +126,7 @@ CONST char *pathname; return 0; if (_read(fd, (char *)phdr, hsize) != hsize) { - _rt_lasterr("%s: %s: can't read program header for file: %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: can't read program header for file: %s",_proc_name,name); return 0; } } @@ -143,7 +143,7 @@ CONST char *pathname; first = pptr; } else if (pptr->p_vaddr <= lastaddr) { - _rt_lasterr("%s: %s: invalid program header - segments out of order: %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: invalid program header - segments out of order: %s",_proc_name,name); return 0; } lastaddr = pptr->p_vaddr; @@ -156,14 +156,14 @@ CONST char *pathname; /* check that we have at least 1 loadable segment */ if (first == 0) { - _rt_lasterr("%s: %s: no loadable segments in %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: no loadable segments in %s",_proc_name,name); return 0; } /* calculate beginning virtual addr == virtual address of * first segment truncated to previous page boundary */ - faddr = STRUNC(first->p_vaddr); + faddr = PTRUNC(first->p_vaddr); /* calculate total amount of memory to be mapped == * virtual addr of last loadable segment plus @@ -182,7 +182,7 @@ CONST char *pathname; PROT_READ, MAP_PRIVATE, _devzero_fd, 0)) == -1) { - _rt_lasterr("%s: %s: can't map enough space for file %s",(char*) _rt_name, _proc_name,name); + _rt_lasterr("ld.so: %s: can't map enough space for file %s", _proc_name,name); return 0; } } @@ -192,7 +192,7 @@ CONST char *pathname; (MAP_PRIVATE|MAP_FIXED), _devzero_fd, 0) == (caddr_t)-1) { - _rt_lasterr("%s: %s: can't map enough space for %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: can't map enough space for %s",_proc_name,name); return 0; } } @@ -245,7 +245,7 @@ CONST char *pathname; if (_mmap((caddr_t)addr, fsize, prot, (MAP_FIXED|MAP_PRIVATE), fd, foff) == (caddr_t)-1) { - _rt_lasterr("%s: %s: can't map segment with size 0x%x at 0x%x for file %s",(char*) _rt_name,_proc_name,fsize,addr,name); + _rt_lasterr("ld.so: %s: can't map segment with size 0x%x at 0x%x for file %s",_proc_name,fsize,addr,name); return 0; } @@ -256,7 +256,7 @@ CONST char *pathname; if ((SROUND(addr + msize) > PROUND(addr + msize)) && pptr != last) { if (_munmap((caddr_t)PROUND(addr + msize), (SROUND(addr + msize) - PROUND(addr + msize)))) { - _rt_lasterr("%s: %s: can't unmap space for %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: can't unmap space for %s",_proc_name,name); return 0; } DPRINTF(MAP,(2,"rtld: unmapped 0x%x bytes from addr 0x%x\n", @@ -277,7 +277,7 @@ CONST char *pathname; else { if (_mprotect((caddr_t)bmem,((addr+msize)-bmem), prot) == -1) { - _rt_lasterr("%s: %s: can't set protections on segment of length 0x%x at 0x%x",(char*) _rt_name, _proc_name,(addr+msize)-bmem,bmem); + _rt_lasterr("ld.so: %s: can't set protections on segment of length 0x%x at 0x%x", _proc_name,(addr+msize)-bmem,bmem); return(0); } } @@ -296,7 +296,7 @@ CONST char *pathname; /* close argument file descriptor */ if (_close(fd) == -1) { - _rt_lasterr("%s: %s: can't close %s",(char*) _rt_name,_proc_name,name); + _rt_lasterr("ld.so: %s: can't close %s",_proc_name,name); return 0; } if (!is_main) { /* add base addr to dynamic and entry point */ @@ -470,7 +470,7 @@ int permission; ADDR(lm) : 0; msize = phdr->p_memsz + (addr - PTRUNC(addr)); if (_mprotect((caddr_t)PTRUNC(addr), msize, prot) == -1){ - _rt_lasterr("%s: %s: can't set protections on segment of length 0x%x at 0x%x",(char*) _rt_name, _proc_name,msize, PTRUNC(addr)); + _rt_lasterr("ld.so: %s: can't set protections on segment of length 0x%x at 0x%x", _proc_name,msize, PTRUNC(addr)); return(0); } } diff --git a/usr/src/lib/rtld/common/paths.c b/usr/src/lib/rtld/common/paths.c index 0a068b7..9936b7e 100644 --- a/usr/src/lib/rtld/common/paths.c +++ b/usr/src/lib/rtld/common/paths.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/paths.c 1.5" +#ident "@(#)rtld:common/paths.c 1.3" /* PATH setup and search functions */ @@ -46,7 +46,7 @@ CONST char **pathname; DPRINTF(LIST, (2, "rtld: _so_find(%s, 0x%x)\n", (filename ? filename : (CONST char *)"0"), (unsigned long)pathname)); if (!filename) { - _rt_lasterr("%s: %s: attempt to open file with null name",(char*) _rt_name,_proc_name); + _rt_lasterr("ld.so: %s: attempt to open file with null name",_proc_name); return(-1); } @@ -60,12 +60,12 @@ CONST char **pathname; flen = (p - filename) + 1; /* length includes null at end */ if (flen >= PATH_MAX) { - _rt_lasterr("%s: %s: file name too long: %s",(char*) _rt_name,_proc_name,filename); + _rt_lasterr("ld.so: %s: file name too long: %s",_proc_name,filename); return(-1); } if (slash) { if ((fd = _open(filename, O_RDONLY)) == -1) { - _rt_lasterr("%s: %s: can't open %s",(char*) _rt_name,_proc_name,filename); + _rt_lasterr("ld.so: %s: can't open %s",_proc_name,filename); return(-1); } if ((p = _rtmalloc(flen)) == 0) { @@ -96,7 +96,7 @@ CONST char **pathname; } } /* if here, no files found */ - _rt_lasterr("%s: %s: can't find %s",(char*) _rt_name,_proc_name,filename); + _rt_lasterr("ld.so: %s: can't find %s",_proc_name,filename); return(-1); } diff --git a/usr/src/lib/rtld/common/rtfcns.c b/usr/src/lib/rtld/common/rtfcns.c index 25f7ab9..878eb1c 100644 --- a/usr/src/lib/rtld/common/rtfcns.c +++ b/usr/src/lib/rtld/common/rtfcns.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/rtfcns.c 1.7" +#ident "@(#)rtld:common/rtfcns.c 1.4" #ifdef __STDC__ #include @@ -16,8 +16,6 @@ #include "rtinc.h" #include -static int _rtstrncmp ARGS((CONST char *, CONST char *, int)); - #define ERRSIZE 512 /* size of buffer for error messages */ /* utility routines for run-time linker @@ -77,13 +75,13 @@ unsigned int nb; /* open /dev/zero if not open, for reading anonymous memory */ if (_devzero_fd == -1) { if ((_devzero_fd = _open(DEV_ZERO, O_RDONLY)) == -1) { - _rt_lasterr("%s: %s: can't open %s",(char*) _rt_name,_proc_name,(CONST char *)DEV_ZERO); + _rt_lasterr("ld.so: %s: can't open %s",_proc_name,DEV_ZERO); return 0 ; } } if ((sp = _mmap(0, PROUND(nb), (PROT_READ|PROT_WRITE), MAP_PRIVATE, _devzero_fd, 0)) == (caddr_t)-1) { - _rt_lasterr("%s: %s: can't malloc space",(char*) _rt_name,_proc_name); + _rt_lasterr("ld.so: %s: can't malloc space",_proc_name); return 0; } cp = sp; @@ -259,7 +257,7 @@ va_dcl { va_list adx; static char *errptr = 0; - static CONST char *no_space = "dynamic linker: can't allocate space"; + static CONST char *no_space = "ld.so: can't allocate space"; #ifdef __STDC__ va_start(adx, fmt); diff --git a/usr/src/lib/rtld/common/rtld.c b/usr/src/lib/rtld/common/rtld.c index aa4f2fd..87d4c8b 100644 --- a/usr/src/lib/rtld/common/rtld.c +++ b/usr/src/lib/rtld/common/rtld.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/rtld.c 1.10" +#ident "@(#)rtld:common/rtld.c 1.7" /* main run-time linking routines * @@ -61,7 +61,7 @@ Elf32_Dyn **rt_ret; inttmp[i] = (Elf32_Dyn *)0; while (interface->d_tag != DT_NULL) { if (interface->d_tag > 0) { - _rt_lasterr("%s: %s: internal interface error",(char*) _rt_name,_proc_name); + _rt_lasterr("ld.so: %s: internal interface error",_proc_name); return(1); } inttmp[-interface->d_tag] = interface++; @@ -74,7 +74,7 @@ Elf32_Dyn **rt_ret; /* open /dev/zero if not open, for reading anonymous memory */ if (_devzero_fd == -1) { if ((_devzero_fd = _open(DEV_ZERO, O_RDONLY)) == -1) { - _rt_lasterr("%s: %s: can't open %s",(char*) _rt_name,_proc_name,(CONST char *)DEV_ZERO); + _rt_lasterr("ld.so: %s: can't open %s",_proc_name,(CONST char *)DEV_ZERO); return(1); } } @@ -85,7 +85,7 @@ Elf32_Dyn **rt_ret; /* null pointer an invalid file name */ if (pname == (char *)0) { - _rt_lasterr("%s: %s: internal interface error: null pathname specified",(char*) _rt_name,_proc_name); + _rt_lasterr("ld.so: %s: internal interface error: null pathname specified",_proc_name); return(1); } @@ -106,8 +106,7 @@ Elf32_Dyn **rt_ret; _ld_tail = _rtld_map; } else { /* not run-time linker - find and open file */ - if ((fd = _so_find(pname, (CONST char**) - &pathname)) == -1) { + if ((fd = _so_find(pname, &pathname)) == -1) { return(1); } @@ -164,8 +163,7 @@ Elf32_Dyn **rt_ret; else { /* not run-time linker * find and open file */ - if ((fd = _so_find(name, (CONST char**) - &pname)) == -1) + if ((fd = _so_find(name, &pname)) == -1) return(1); /* map in object and add to end of map list */ @@ -187,7 +185,7 @@ Elf32_Dyn **rt_ret; */ if (_rt_tracing) { for (lm = (struct rt_private_map *)NEXT(_ld_loaded); lm; lm = (struct rt_private_map *)NEXT(lm)) { - _rtfprintf(1, "%s: %s: file loaded: %s\n",(char*) _rt_name,_proc_name,NAME(lm)); + _rtfprintf(1, "ld.so: %s: file loaded: %s\n",_proc_name,NAME(lm)); } /* if _rt_warn not set, exit */ if (!_rt_warn) diff --git a/usr/src/lib/rtld/common/rtld.h b/usr/src/lib/rtld/common/rtld.h index 54e78d3..ddf6eeb 100644 --- a/usr/src/lib/rtld/common/rtld.h +++ b/usr/src/lib/rtld/common/rtld.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:common/rtld.h 1.6" +#ident "@(#)rtld:common/rtld.h 1.4" /* common header for run-time linker */ @@ -89,6 +89,7 @@ struct rel_copy { /* debugger information version*/ #define LD_DEBUG_VERSION 1 + #ifdef DEBUG #define MAXLEVEL 7 /* maximum debugging level */ #define LIST 1 /* dubgging levels - or'able flags */ diff --git a/usr/src/lib/rtld/i386/align.s b/usr/src/lib/rtld/i386/align.s new file mode 100644 index 0000000..df2092e --- /dev/null +++ b/usr/src/lib/rtld/i386/align.s @@ -0,0 +1,7 @@ + .file "align.s" + .ident "@(#)rtld:i386/align.s 1.1" + +/ This file sets the alignment for the data segment. + + .data + .align 0x2000 diff --git a/usr/src/lib/rtld/i386/clrpage.s b/usr/src/lib/rtld/i386/clrpage.s new file mode 100644 index 0000000..eca31a8 --- /dev/null +++ b/usr/src/lib/rtld/i386/clrpage.s @@ -0,0 +1,29 @@ + .ident "@(#)rtld:i386/clrpage.s 1.1" + .file "clrpage.s" + +/ _clrpage(dst, cnt) +/ Fast assembly routine to zero page. +/ Sets cnt bytes to zero, starting at dst +/ Dst and cnt must be coordinated to give word alignment +/ (guaranteed if used to zero a page) + + .set .dst,0x8 / offset of arg0 + .set .cnt,0xc / offset of arg1 + .globl _clrpage + .type _clrpage,@function + .text + .align 4 + +_clrpage: + pushl %edi + movl .dst(%esp),%edi / dst + movl .cnt(%esp),%ecx / cnt + movl $0,%eax / value to store + movl %ecx,%edx + andl $3,%ecx + repz; stosb / clear the memory + movl %edx,%ecx + shrl $2,%ecx + repz; stosl / clear the memory + popl %edi + ret diff --git a/usr/src/lib/rtld/i386/genset.awk b/usr/src/lib/rtld/i386/genset.awk new file mode 100644 index 0000000..46f8252 --- /dev/null +++ b/usr/src/lib/rtld/i386/genset.awk @@ -0,0 +1,133 @@ +#ident "@(#)rtld:i386/genset.awk 1.1" + +# Create rtsetaddr.s or rtabiaddr.s. +# _rt_setaddr() looks up the values of several special symbols that may be +# found in either the user's a.out or ld.so. If the special symbol is in the +# a.out, set the address in the GOT, else do nothing. This is in assembler +# because we have to access the GOT directly. +# The list of symbols is in genset.in. All symbols that must appear in +# rtabiaddr.s have "MIN" as $2. + +BEGIN { + error = 0 + mode = 0 # 1: full libc, 2: min abi + count = 0 +} + +$1 ~ /^@.*/ { + # process an @ directive + # @FULL: full libc + # @MIN: minimal abi libc + if (mode != 0) { + printf "genset.awk: too many @ directives\n" | "cat -u >&2" + error = 1 + exit + } + + if ($1 == "@FULL") { + printf "\t.file\t\"rtsetaddr.s\"\n" + mode = 1 + } else if ($1 == "@MIN") { + printf "\t.file\t\"rtabiaddr.s\"\n" + mode = 2 + } else { + printf "genset.awk: illegal mode " \ + "(@MIN: min abi, @FULL: full libc)\n" | \ + "cat -u >&2" + error = 1 + exit + } + + printf "\n\t.globl\t_rt_setaddr\n" + printf "\t.text\n\t.type\t_rt_setaddr,@function\n\t.align\t4\n" + printf "_rt_setaddr:\n" + printf "\tpushl\t%%ebp\n" + printf "\tmovl\t%%esp,%%ebp\n" + printf "\tpushl\t%%eax\n" + printf "\tpushl\t%%ebx\n" + printf "\tcall\t.L1\n" + printf ".L1:\n" + printf "\tpopl\t%%ebx\n" + printf "\taddl\t$_GLOBAL_OFFSET_TABLE_+[.-.L1],%%ebx\n" + printf "\n" + next +} + +$0 ~ /^#.*/ { + # skip comments + next +} + +NF == 0 { + # skip blank lines + next +} + +{ + if (mode == 0) { + printf "genset.awk: @ directive not set\n" | "cat -u >&2" + error = 1 + exit + } + if (mode == 2 && $2 != "MIN") + next + # put out a .globl and a .string for the symbol + printf "\t.globl\t%s\n", $1 + printf "\t.section\t.rodata\n\t.align\t4\n" + printf ".X%.3d:\t/ %s\n\t.string\t\"%s\"\n", count, $1, $1 + + # put out the code to look up the symbol and fix up the GOT. + printf "\t.text\n" + printf "/ sym = _lookup(\"%s\", LO_ALL, _ld_loaded, &lm);\n", $1 + printf ".SYM%.3d:\n", count + printf "\tleal\t-4(%%ebp),%%eax\n" + printf "\tpushl\t%%eax\n" + printf "\tmovl\t_ld_loaded@GOT(%%ebx),%%eax\n" + printf "\tpushl\t(%%eax)\n" + printf "\tpushl\t$0\n" + printf "\tleal\t.X%.3d@GOTOFF(%%ebx),%%eax\n", count + printf "\tpushl\t%%eax\n" + printf "\tcall\t_lookup@PLT\n" + printf "\taddl\t$16,%%esp\n" + printf "/ if (sym)\n" + printf "/ %s@GOT = sym->st_value + (NAME(lm) ? ADDR(lm) : 0 );\n", $1 + printf "\tcmpl\t$0,%%eax\n" + printf "\tjz\t.SYM%.3d\n", count + 1 + printf "\tmovl\t-4(%%ebp),%%ecx\n" + printf "\tcmpl\t$0,4(%%ecx)\n" + printf "\tjz\t.J1%.3d\n", count + printf "\tmovl\t0(%%ecx),%%edx\n" + printf "\tjmp\t.J2%.3d\n", count + printf ".J1%.3d:\n", count + printf "\tmovl\t$0,%%edx\n" + printf ".J2%.3d:\n", count + printf "\taddl\t4(%%eax),%%edx\n" + printf "\tmovl\t%%edx,%s@GOT(%%ebx)\n", $1 + count++ +} + +END { + if (error == 1) + exit + + printf ".SYM%.3d:\n", count + + if (mode == 1) { # only for full libc + # initialize the __first_list in stdio, this has to be doen + # after fixing up the GOT entries, so that it has the address + # of __iob from either the user's code, or the library, + # as appropriate + + printf "/ Initialize some values ....\n" + printf "/ Set up __first_link used in port/stdio/flush.c\n" + printf "/ struct Link __first_link = { &_iob[0], ... }\n" + printf "\tmovl\t__first_link@GOT(%%ebx),%%eax\n" + printf "\tmovl\t__iob@GOT(%%ebx),%%edx\n" + printf "\tmovl\t%%edx,0(%%eax)\n" + } + + printf "\tpopl\t%%ebx\n" + printf "\tleave\n" + printf "\tret\n" + printf "\t.size\t_rt_setaddr,.-_rt_setaddr\n" +} diff --git a/usr/src/lib/rtld/i386/genset.in b/usr/src/lib/rtld/i386/genset.in new file mode 100644 index 0000000..8ef6a44 --- /dev/null +++ b/usr/src/lib/rtld/i386/genset.in @@ -0,0 +1,33 @@ +#ident "@(#)rtld:i386/genset.in 1.1" + +errno MIN +_fp_hw MIN +_asr MIN +_environ MIN +__flt_rounds MIN +__ctype MIN + +# defined in opt_data.o +optind +optarg +opterr +optopt + +# defined in data.o +__iob +_lastbuf +_smbuf +_bufendtab + +# defined in values-X*.o +_lib_version + +# defined in _loc_data.o +_cur_locale MIN +_numeric MIN + +# defined in time_gdata.o +_altzone MIN +_daylight MIN +_timezone MIN +_tzname MIN diff --git a/usr/src/lib/rtld/i386/rtmemcpy.s b/usr/src/lib/rtld/i386/rtmemcpy.s new file mode 100644 index 0000000..062b8d7 --- /dev/null +++ b/usr/src/lib/rtld/i386/rtmemcpy.s @@ -0,0 +1,26 @@ + .file "rtmemcpy.s" + + .ident "@(#)rtld:i386/rtmemcpy.s 1.1" + + .globl _rt_memcpy + .align 4 + +_rt_memcpy: + pushl %edi + pushl %esi + movl 12(%esp),%edi / %edi = dest address + movl 16(%esp),%esi / %esi = source address + movl 20(%esp),%ecx / %ecx = length of string + movl %edi,%eax / return value from the call + + movl %ecx,%edx / %edx = number of bytes to move + shrl $2,%ecx / %ecx = number of words to move + rep ; smovl / move the words + + movl %edx,%ecx / %ecx = number of bytes to move + andl $0x3,%ecx / %ecx = number of bytes left to move + rep ; smovb / move the bytes + + popl %esi + popl %edi + ret diff --git a/usr/src/lib/rtld/m32/align.s b/usr/src/lib/rtld/m32/align.s index 3321bf6..29466dc 100644 --- a/usr/src/lib/rtld/m32/align.s +++ b/usr/src/lib/rtld/m32/align.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "align.s" .ident "@(#)rtld:m32/align.s 1.1" diff --git a/usr/src/lib/rtld/m32/binder.c b/usr/src/lib/rtld/m32/binder.c index 3d7c3af..39b052c 100644 --- a/usr/src/lib/rtld/m32/binder.c +++ b/usr/src/lib/rtld/m32/binder.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:m32/binder.c 1.4" +#ident "@(#)rtld:m32/binder.c 1.2" /* function binding routine - invoked on the first call @@ -41,7 +41,7 @@ DPRINTF((LIST|DRELOC),(2, "rtld: _binder(0x%x, 0x%x)\n", reloc, lm)); if (!lm) { - _rtfprintf(2, "%s: %s: unidentifiable procedure reference\n",(char*) _rt_name,_proc_name); + _rtfprintf(2, "ld.so: %s: unidentifiable procedure reference\n",_proc_name); (void)_kill(_getpid(), SIGKILL); } @@ -53,7 +53,7 @@ /* find definition for symbol */ if ((nsym = _lookup(symname, 0, _ld_loaded, &nlm)) == (Elf32_Sym *)0) { - _rtfprintf(2, "%s: %s: symbol not found: %s\n",(char*) _rt_name,_proc_name,symname); + _rtfprintf(2, "ld.so: %s: symbol not found: %s\n",_proc_name,symname); (void)_kill(_getpid(), SIGKILL); } diff --git a/usr/src/lib/rtld/m32/clrpage.s b/usr/src/lib/rtld/m32/clrpage.s index e2b4cfe..2a607ff 100644 --- a/usr/src/lib/rtld/m32/clrpage.s +++ b/usr/src/lib/rtld/m32/clrpage.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "clrpage.s" .ident "@(#)rtld:m32/clrpage.s 1.1" diff --git a/usr/src/lib/rtld/m32/genset.awk b/usr/src/lib/rtld/m32/genset.awk index 699f7c2..80ffdc3 100644 --- a/usr/src/lib/rtld/m32/genset.awk +++ b/usr/src/lib/rtld/m32/genset.awk @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)rtld:m32/genset.awk 1.8" # Create rtsetaddr.s or rtabiaddr.s. diff --git a/usr/src/lib/rtld/m32/genset.in b/usr/src/lib/rtld/m32/genset.in index 04669c2..d2865d4 100644 --- a/usr/src/lib/rtld/m32/genset.in +++ b/usr/src/lib/rtld/m32/genset.in @@ -1,20 +1,11 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -#ident "@(#)rtld:m32/genset.in 1.7.1.1" +#ident "@(#)rtld:m32/genset.in 1.5" errno MIN _fp_hw MIN _asr MIN _environ MIN __flt_rounds MIN -__ctype MIN -_fpfault MIN -_fpftype MIN -_getdate_err +__ctype MIN _abi # defined in opt_data.o optind @@ -33,13 +24,13 @@ _lib_version # defined in _loc_data.o _cur_locale MIN -_numeric MIN +_numeric MIN _abi_ # defined in time_gdata.o -_altzone MIN -_daylight MIN -_timezone MIN -_tzname MIN +_altzone MIN _abi +_daylight MIN _abi +_timezone MIN _abi +_tzname MIN _abi # defined in import_def.o malloc PRE _libc_ diff --git a/usr/src/lib/rtld/m32/machdep.h b/usr/src/lib/rtld/m32/machdep.h index fb7386a..71d1576 100644 --- a/usr/src/lib/rtld/m32/machdep.h +++ b/usr/src/lib/rtld/m32/machdep.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:m32/machdep.h 1.3" +#ident "@(#)rtld:m32/machdep.h 1.2" /* 3B2 machine dependent macros, constants and declarations */ @@ -26,20 +26,12 @@ extern int _sys3b ARGS((int, unsigned long *)); /* segment boundary */ -#ifdef ELF_M32_MAXPGSZ -#define SEGSIZE ELF_M32_MAXPGSZ -#else #define SEGSIZE 0x2000 /* 8k */ -#endif /* macro to truncate to previous page boundary */ #define PTRUNC(X) ((X) & ~(PAGESIZE - 1)) -/* macro to truncate to previous segment boundary */ - -#define STRUNC(X) ((X) & ~(SEGSIZE - 1)) - /* macro to round to next page boundary */ #define PROUND(X) (((X) + PAGESIZE - 1) & ~(PAGESIZE - 1)) diff --git a/usr/src/lib/rtld/m32/makefile b/usr/src/lib/rtld/m32/makefile index 0e6bf4c..53ea347 100644 --- a/usr/src/lib/rtld/m32/makefile +++ b/usr/src/lib/rtld/m32/makefile @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)rtld:m32/makefile 1.19" +#ident "@(#)rtld:m32/makefile 1.18" # makefile for 3B2 version of the run-time linker # we first build the pic version of libsys and @@ -18,6 +18,7 @@ MACH=m32 MACHDIR=../$(MACH) DEFLIST=-DM32 INCLIST= -I$(COMDIR) -I$(MACHDIR) -I$(SGSINC)/common -I$(SGSINC)/m32 +PROPTS= -dxerox -omode=l -omode=h AWK=awk ECHO=echo @@ -26,7 +27,8 @@ HFILES= $(COMDIR)/rtld.h $(COMDIR)/dllib.h $(COMDIR)/externs.h \ SOURCES= $(COMDIR)/dlfcns.c $(COMDIR)/globals.c $(COMDIR)/map.c \ $(COMDIR)/rtfcns.c $(COMDIR)/rtld.c $(COMDIR)/paths.c \ - $(MACHDIR)/reloc.c $(MACHDIR)/rtsetup.c $(MACHDIR)/binder.c + $(MACHDIR)/reloc.c $(MACHDIR)/rtsetup.c $(MACHDIR)/binder.c \ + $(MACHDIR)/rtisastream.c AS_SOURCES= $(MACHDIR)/rtbinder.s $(MACHDIR)/rtboot.s $(MACHDIR)/rtmemcpy.s \ $(MACHDIR)/clrpage.s $(MACHDIR)/align.s $(MACHDIR)/rtsyscall.s @@ -34,7 +36,7 @@ AS_SOURCES= $(MACHDIR)/rtbinder.s $(MACHDIR)/rtboot.s $(MACHDIR)/rtmemcpy.s \ # rtboot.o, which contains the startup code, must be linked first OBJECTS= align.o rtboot.o binder.o dlfcns.o globals.o map.o paths.o reloc.o \ rtfcns.o rtld.o rtsetup.o rtbinder.o clrpage.o rtsetaddr.o rtmemcpy.o \ - rtabiaddr.o rtsyscall.o + rtabiaddr.o rtisastream.o rtsyscall.o PRODUCTS= $(OBJECTS) @@ -68,6 +70,9 @@ rtsetup.o: $(MACHDIR)/rtsetup.c $(HFILES) reloc.o: $(MACHDIR)/reloc.c $(HFILES) $(CC) -c $(CFLAGS) $(MODE) $(DEFLIST) $(INCLIST) $(MACHDIR)/reloc.c +rtisastream.o: $(MACHDIR)/rtisastream.c $(HFILES) + $(CC) -c $(CFLAGS) $(MODE) $(DEFLIST) $(INCLIST) $(MACHDIR)/rtisastream.c + rtboot.o: $(MACHDIR)/rtboot.s $(HFILES) $(CC) -c $(CFLAGS) $(MODE) $(MACHDIR)/rtboot.s @@ -101,3 +106,6 @@ clean: clobber: clean -rm -f rtsetaddr.s rtabiaddr.s + +print: $(SOURCES) $(AS_SOURCES) $(HFILES) + pr -n $(SOURCES) $(AS_SOURCES) $(HFILES) | lp $(PROPTS) diff --git a/usr/src/lib/rtld/m32/reloc.c b/usr/src/lib/rtld/m32/reloc.c index 38b72bf..61832f6 100644 --- a/usr/src/lib/rtld/m32/reloc.c +++ b/usr/src/lib/rtld/m32/reloc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:m32/reloc.c 1.12" +#ident "@(#)rtld:m32/reloc.c 1.10" /* 3B2 specific routines for performing relocations */ @@ -165,11 +165,11 @@ do_reloc(lm, reladdr, relsz) && (ELF32_ST_BIND(symref->st_info) != STB_WEAK)) { if (_rt_warn) { - _rtfprintf(2, "%s: %s: relocation error: symbol not found: %s\n",(char*) _rt_name, _proc_name,name); + _rtfprintf(2, "ld.so: %s: relocation error: symbol not found: %s\n", _proc_name,name); continue; } else { - _rt_lasterr("%s: %s: relocation error: symbol not found: %s",(char*) _rt_name, _proc_name, name); + _rt_lasterr("ld.so: %s: relocation error: symbol not found: %s", _proc_name, name); return(0); } } @@ -271,9 +271,9 @@ do_reloc(lm, reladdr, relsz) break; default: if (_rt_warn) - _rtfprintf(2, "%s: %s: invalid relocation type %d at 0x%x\n",(char*) _rt_name,_proc_name,rtype,off); + _rtfprintf(2, "ld.so: %s: invalid relocation type %d at 0x%x\n",_proc_name,rtype,off); else { - _rt_lasterr("%s: %s: invalid relocation type %d at 0x%x",(char*) _rt_name,_proc_name,rtype,off); + _rt_lasterr("ld.so: %s: invalid relocation type %d at 0x%x",_proc_name,rtype,off); return(0); } break; diff --git a/usr/src/lib/rtld/m32/rtbinder.s b/usr/src/lib/rtld/m32/rtbinder.s index f3715d9..820e906 100644 --- a/usr/src/lib/rtld/m32/rtbinder.s +++ b/usr/src/lib/rtld/m32/rtbinder.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)rtld:m32/rtbinder.s 1.4" .file "rtbinder.s" diff --git a/usr/src/lib/rtld/m32/rtboot.s b/usr/src/lib/rtld/m32/rtboot.s index b53fcd4..cf3fc73 100644 --- a/usr/src/lib/rtld/m32/rtboot.s +++ b/usr/src/lib/rtld/m32/rtboot.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .ident "@(#)rtld:m32/rtboot.s 1.5" .file "rtboot.s" diff --git a/usr/src/lib/rtld/m32/rtisastream.c b/usr/src/lib/rtld/m32/rtisastream.c new file mode 100644 index 0000000..94442ad --- /dev/null +++ b/usr/src/lib/rtld/m32/rtisastream.c @@ -0,0 +1,36 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)rtld:m32/rtisastream.c 1.2" +/* + * Check to see if a file descriptor is that of a stream. + * Return 1 with errno set to 0 if it is. Otherwise, + * return 0 with errno set to 0. + * The only error returned is that case of a bad file desc. + * + */ +#include +#include +#include + +int +_isastream(fd) + int fd; +{ + extern int errno; + int rval; + + rval = ioctl(fd, I_CANPUT, 0); + if (rval == -1 && errno == EBADF) + return (-1); + + errno = 0; + if (rval == 0 || rval == 1) + return (1); + + return (0); +} diff --git a/usr/src/lib/rtld/m32/rtmemcpy.s b/usr/src/lib/rtld/m32/rtmemcpy.s index 661d4ec..686d292 100644 --- a/usr/src/lib/rtld/m32/rtmemcpy.s +++ b/usr/src/lib/rtld/m32/rtmemcpy.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - .file "rtmemcpy.s" .ident "@(#)rtld:m32/rtmemcpy.s 1.1" # diff --git a/usr/src/lib/rtld/m32/rtsetup.c b/usr/src/lib/rtld/m32/rtsetup.c index 83b0b20..c3afd56 100644 --- a/usr/src/lib/rtld/m32/rtsetup.c +++ b/usr/src/lib/rtld/m32/rtsetup.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)rtld:m32/rtsetup.c 1.15" +#ident "@(#)rtld:m32/rtsetup.c 1.12" /* 3B2 specific setup routine - * relocate ld.so's symbols, setup its environment, @@ -131,7 +131,7 @@ auxv_t *auxv; */ if (ELF32_R_TYPE(((Elf32_Rel *)reladdr)->r_info) != R_M32_RELATIVE) { - _rtfprintf(2, "%s: internal error: invalid relocation type %d at 0x%x\n",(char*) _rt_name,ELF32_R_TYPE(((Elf32_Rel *)reladdr)->r_info),off); + _rtfprintf(2, "ld.so: internal error: invalid relocation type %d at 0x%x\n",ELF32_R_TYPE(((Elf32_Rel *)reladdr)->r_info),off); (void)_kill(_getpid(), SIGKILL); } symval.c[0] = ((char *)off)[0]; @@ -149,13 +149,13 @@ auxv_t *auxv; _proc_name = pname; /* look for environment strings */ - envdirs = _readenv( (CONST char**) envp, &bmode ); + envdirs = _readenv( envp, &bmode ); DPRINTF(LIST,(2, "rtld: _rt_setup(0x%x, 0x%x, %s, 0x%x, 0x%x)\n",ld_base,(unsigned long)ld_dyn,pname,(unsigned long)envp, auxv)); /* open /dev/zero to use for mapping anonymous memory */ if ((_devzero_fd = _open(DEV_ZERO, O_RDONLY)) == -1) { - _rtfprintf(2, "%s: %s: can't open %s\n",(char*) _rt_name,_proc_name,(CONST char *)DEV_ZERO); + _rtfprintf(2, "ld.so: %s: can't open %s\n",_proc_name,(CONST char *)DEV_ZERO); (void)_kill(_getpid(), SIGKILL); } @@ -312,7 +312,7 @@ unsigned long eflags; CONST char *pathname; { if ((eflags == EF_M32_MAU) && !_flags) { - _rt_lasterr("%s: MAU required for file %s",(char*) _rt_name, pathname); + _rt_lasterr("ld.so: MAU required for file %s", pathname); return 1; } else diff --git a/usr/src/lib/rtld/m32/rtsyscall.s b/usr/src/lib/rtld/m32/rtsyscall.s index f671ae6..ede67ac 100644 --- a/usr/src/lib/rtld/m32/rtsyscall.s +++ b/usr/src/lib/rtld/m32/rtsyscall.s @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # dynamic linker system calls .ident "@(#)rtld:m32/rtsyscall.s 1.3" diff --git a/usr/src/lib/terminfo/Doc.sed b/usr/src/lib/terminfo/Doc.sed new file mode 100644 index 0000000..60eb2d2 --- /dev/null +++ b/usr/src/lib/terminfo/Doc.sed @@ -0,0 +1,25 @@ +#ident "@(#)terminfo:Doc.sed 1.4" +# +# This script is used to strip info from the terminfo +# source files. +# +sed -n ' + /^# \{1,\}Manufacturer:[ ]*\(.*\)/s//.M \1/p + /^# \{1,\}Class:[ ]*\(.*\)/s//.C \1/p + /^# \{1,\}Author:[ ]*\(.*\)/s//.A \1/p + /^# \{1,\}Info:[ ]*/,/^[^#][^ ]/ { + s/^# *Info:/.I/p + /^#[ ]\{1,\}/ { + s/#//p + } + /^#$/ i\ +.IE + } + /^\([^# ][^ ]*\)|\([^|,]*\),[ ]*$/ { + s//Terminal:\ + "\2"\ + \1/ + s/|/, /g + p + } +' $* diff --git a/usr/src/lib/terminfo/README b/usr/src/lib/terminfo/README new file mode 100644 index 0000000..ec6ed04 --- /dev/null +++ b/usr/src/lib/terminfo/README @@ -0,0 +1,147 @@ +#ident "@(#)terminfo:README 1.6" + +1 Within the curses component, exists other conversion tools which are + much more robust than those described below. They are called infocmp, + and captoinfo. The cvt files are provided here only for those possible + cases where a user has the terminfo component without the libcurses + component. + + The captoinfo and infocmp utilities cannot be included here, as they + require the user to have libcurses. Although we know of no instance + when a user would have one and not the other, we have provided the + cvt files (described below) for those limited cases. + + + +2 The files in this directory with the .ti suffix are terminfo sources. + They should be compiled (separately or by catting them together into + terminfo.src) with tic, placing the results in /usr/lib/terminfo. + Please send any updates to AT&T Bell Laboratories UNIX support, + via UNIX mail to attunix!terminfo. + + + +3 The cvt files are useful tools for converting termcap to terminfo. + They are not 100% accurate, but do most of the conversion for you. + cvt.ex is an ex script to convert a termcap description into a + terminfo description. Note that it will not convert padding + specifications, so they must be done by hand. Note also that typical + termcap entries do not give as much information as terminfo, so the + resulting terminfo entry is often incomplete (e.g. won't tell you the + terminal uses xon/xoff handshaking, or what extra function keys send). + You are urged to read the list of terminfo capabilities and augment your + terminfo descriptions accordingly. + + The cvt.h file is useful for a quick hack at converting termcap programs + which use uppercase 2 letter names for capabilities to use terminfo. + Since tget* are provided anyway, this is of questionable value unless + your program barely fits on a pdp-11. + + The cvt.sed script is useful for actually editing the source of the same + class of programs. It requires a sed that understands \< and \>, the + mod is trivial to make if you look at the corresponding code in ex or + grep. + + + +3 There are other incompatibilities at the user level between termcap and + terminfo. A program which creates a termcap description and then + passes it to tgetent (e.g. vi used to do this if no TERM was set) or + which puts such a description in the environment for a child cannot + possibly work, since terminfo puts the parser into the compiler, not + the user program. If you want to give a child a smaller window, set + up the LINES and COLUMNS environment variables or implement the JWINSIZE + ioctl. + + + +4 If you want to edit your own personal terminfo descriptions (and are not + a super user on your system) the method is different. Set + TERMINFO=$HOME/term (or wherever you put the compiled tree) in your + environment, then compile your source with tic. Tic and user programs + will check in $TERMINFO before looking in /usr/lib/terminfo/*/* + + + +5 Philosophy in adding new terminfo capabilities: + + Capabilities were cheap in termcap, since no code supported them + and they need only be documented. In terminfo, they add size to + the structure and the binaries, so don't add them in mass quantities. + + Add a capability only if there is an application that wants to use it. + Lots of terminals have a half duplex forms editing mode, but no UNIX + applications use it, so we don't include it. + + Before you add a capability, try to hold off until there are at least + 2 or 3 different terminals implementing similar features. That way, + you can get a better idea of the general model that the capability + should have, rather than coming up with something that only works + on one kind of terminal. For example, the status line capabilities + were added after we had seen the h19, the tvi950, and the vt100 run + sysline. The original program, called h19sys, only worked on an h19 + and addressed the cursor to line 25. This model doesn't fit other + terminals with a status line. + + Note that capabilities must be added at the end of ../screen/caps. + Furthermore, if you add a private capability, you should check with + someone to make sure your capability goes into the master file, + otherwise someone else will add a different capability and + compatibility between two systems is destroyed. There must be one + master set of capabilities. This list is maintained at AT&T UNIX + Development. Comments should be sent to attunix!terminfo. + + + +6 Current murky areas include: + + Color - there is demand for colors but it isn't clear what to do yet. + Some terminals support only 2 or 4 or 8 or 16 colors, others have a + palette of some huge selection. What are the standard colors? How + does graphics fit into this (terminfo is alphanumeric oriented?) + Curses can have another 16 bits added, or some routine set to decide + which 9 attribute bits have meaning in any given program. An + alternative is that if you just want color alphanumerics for a simple + application, e.g. highlighting certain fields, decide how you would + want your application to behave on a B/W terminal (e.g. a vt100), + using reverse for one thing, blinking for another, bold for another, + invisible for another, etc. + (Invis may be useful for colored fields with no information in them.) + Then make a terminfo entry with blink=xxx, bold=yyy, etc, where xxx + and yyy are sequences to go into the colors you really want. This way + your application also works on B/W terminals. + + Graphics: Giles Billingsley at Berkeley did something called MFBCAP + once, it was like termcap but 3 times as big and handled graphics. + I don't think it was ever finished. I don't know how to do graphics + in curses, one might add it to terminfo at very high cost. + + Input: things that send escape sequences to your program to be decoded + are a hard issue. You have to somehow deal with typeahead and with + terminals that can't do it. This includes "request cursor position", + for which a better solution is to immediately address the cursor to + a known position. (Curses also has filter mode that won't assume + the line but will assume the column.) Mice also fall into this + category. Scanf style strings (tparm is printf style) might be able + to decode these sequences, but I have no experience with them. + + Alternate character set: the vt100 set seems to be becoming a defacto + standard, although it doesn't do much. I almost standardized on the + Teletype 5410, which was a nice superset of the vt100, but then Teletype + updated the 5410 to make it a vt100 duplicate, so now all I've put in + are the vt100 line drawing characters. HP has a more complete set, + but it has some really weird things in it and the mappings are + nonstandard. + Any extension should be able to handle both kinds of terminals, and + handle common programs without assuming an HP (or even a vt100). + + ------------------------------------ + + +7 Additional modules: + + ckout shell script, analyzes file errs for diagnostics + and displays number of entries built + + Doc.sed sed script to be run on ti files. + prints documentation of ti files. diff --git a/usr/src/lib/terminfo/adds.ti b/usr/src/lib/terminfo/adds.ti new file mode 100644 index 0000000..6a7fc09 --- /dev/null +++ b/usr/src/lib/terminfo/adds.ti @@ -0,0 +1,85 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:adds.ti 1.10" +# # -------------------------------- +# +# Manufacturer: ADDS +# Class: II +# +screwpoint|adds viewpoint with ^O bug, + am, + dl1=\El, + cols#80, lh#0, lines#24, lw#0, nlab#0, + bel=^G, clear=\f$<10.1*>, cr=\r, cub1=\b, cud1=\n, + cuf1=^F, cup=\EY%p1%'\s'%+%c%p2%'\s'%+%c$<6>, cuu1=^Z, + ed=\Ek$<16.1*>, el=\EK$<16>, ind=\n, is2=^G, kcub1=^U, + kcud1=\n, kcuf1=^F, kcuu1=^Z, khome=^A, ll=^A, +fviewpoint|flaky adds viewpoint with ^O bug, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, lines#24, cols#80, + dl1=\El, + cup=\EY%p1%' '%+%c%p2%' '%+%c$<6>, is2=, + ed=\Ek$<16.1*>, el=\EK$<16>, cuf1=^F, cuu1=^Z, clear=^L$<10.1*>, ll=^A, + kcub1=^U, kcuf1=^F, kcud1=^J, kcuu1=^Z, khome=^A, +viewpoint|adds viewpoint, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, lines#24, cols#80, + cup=\EY%p1%' '%+%c%p2%' '%+%c$<6>, is2=^O\E0`, + ed=\Ek$<16.1*>, el=\EK$<16>, cuf1=^F, cuu1=^Z, clear=^L$<10.1*>, ll=^A, + dl1=\El, + kcub1=^U, kcuf1=^F, kcud1=^J, kcuu1=^Z, khome=^A, + kf0=^B1, kf2=^B2, kf3=^B!, kf4=^B", kf5=^B#, + rmso=^O, smso=\E0P^N, rmul=^O, smul=\E0`^N, + cvvis=^O\E0P, cnorm=^O\E0`, +v90|viewpoint-90|ADDS viewpoint 90, + lines#24, cols#80, it#8, am, bw, mir, + clear=^L, ll=^A, cuu1=^Z, cub1=^H, cuf1=^F, cud1=^J, + cr=^M, cud1=^J, ind=^J, bel=^G, ht=^I, + dl1=\El, il1=\EM, ed=\Ek, el=\EK, + cbt=\EO, dch1=\EE, .smir=\EF, .rmir=\EF, + pad=\377, + vpa=^K%p1%' '%+%c, + hpa=^P%p1%{10}%/%{16}%*%p1%{10}%m%+%c, + cup=\EY%p1%' '%+%c%p2%' '%+%c, + kbs=^H, kcud1=^J, khome=^A, kcub1=^U, kcuf1=^F, kcuu1=^Z, + kf0=^B1^M, kf1=^B2^M, kf2=^B3^M, kf3=^B4^M, kf4=^B5^M, kf5=^B6^M, + kf6=^B7^M, kf7=^B8^M, kf8=^B9^M, kf9=^B:^M, kf10=^B;^M, + lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, + lf6=F7, lf7=F8, lf8=F9, lf9=F10, lf10=F11, +regent|Adds Regent Series, + cr=^M, cud1=^J, ind=^J, bel=^G, lines#24, cols#80, am, + clear=^L, ll=^A, cuu1=^Z, cub1=^H, cuf1=^F, cud1=^J, +regent100|Adds Regent 100, + kf0=^B1^M, kf1=^B2^M, kf2=^B3^M, kf3=^B4^M, + kf4=^B5^M, kf5=^B6^M, kf6=^B7^M, kf7=^B8^M, + lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, + cup=^K%p1%' '%+%c^P%p2%{10}%/%{16}%*%p2%{10}%m%+%c, + xmc#1, use=regent, +regent20|Adds Regent 20, + ed=\Ek, el=\EK, cup=^K%p1%' '%+%c^P%p2%{10}%/%{16}%*%p2%{10}%m%+%c, + use=regent, +regent25|Adds Regent25, + khome=^A, kcub1=^U, kcuf1=^F, kcuu1=^Z, kcud1=^J, use=regent20, +regent40|Adds Regent 40, + kf0=^B1^M, kf1=^B2^M, kf2=^B3^M, kf3=^B4^M, + kf4=^B5^M, kf5=^B6^M, kf6=^B7^M, kf7=^B8^M, + lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, + il1=2*\EM, dl1=2*\El, smso=\E0P, rmul=\E0@, + smul=\E0`, rmso=\E0@, xmc#1, use=regent25, +regent40-s|regent40+|Adds Regent 40-s, + is2=\EB, use=regent40, +regent60|regent200|Adds Regent 60, + rmso=\ER\E0@\EV, smso=\ER\E0P\EV, + dch1=\EE, rmir=\EF, smir=\EF, is2=\EV\EB, + kdch1=\EE, kich1=\EF, krmir=\EF, use=regent40-s, +regent60-na|regent 60 w/no arrow keys, + kcub1@, kcuf1@, kcuu1@, kcud1@, use=regent60, +a980|adds consul 980, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\E^N$<13>, am, cub1=^H, + clear=^L$<1>^K@, cup=^K%p1%'@'%+%c\E^E%p2%02d, cols#80, dl1=\E^O$<13>, + kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, kf4=\E4, + kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, + lines#24, cuf1=\E^E01, smso=^Y^^^N, rmso=^O, cuu1=$<9>, diff --git a/usr/src/lib/terminfo/annarbor.ti b/usr/src/lib/terminfo/annarbor.ti new file mode 100644 index 0000000..dd09b55 --- /dev/null +++ b/usr/src/lib/terminfo/annarbor.ti @@ -0,0 +1,200 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:annarbor.ti 1.11" +# # -------------------------------- +# +# annarbor: ANN ARBOR +# Manufacturer: ANN ARBOR +# Class: III +# +aa|annarbor|4080|ann arbor 4080, + cr=^M, cud1=^J, ind=^J, bel=^G, ht=^I, tbc=^\^P^P, hts=^]^P1, + cup=^O%p2%{10}%/%{16}%*%p2%{10}%m%+%c%p1%?%p1%{19}%>%t%{12}%+%;%'@'%+%c, + cols#80, lines#40, cub1=^H, clear=^L$<2>, cuu1=^N, cuf1=^_, + home=^K, am, kbs=^^, kcud1=^J, kcuu1=^N, kcub1=^H, kcuf1=^_, khome=^K, +# +aaa+unk|aaa-unk|ann arbor ambassador (internal - don't use this directly), + am, km, mc5i, mir, xon, + cols#80, it#8, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J$<156>, cr=\r, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=^K, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ed=\E[J, el=\E[K$<5>, home=\E[H, hpa=\E[%p1%{1}%+%dG, + ht=\t, hts=\EH, ich=\E[%p1%d@$<4*>, ich1=\E[@$<4>, + il=\E[%p1%dL, il1=\E[L$<3>, ind=^K, invis=\E[8m, + is1=\E[m\E7\E[H\E9\E8, + is3=\E[1Q\E[>20;30l\EP`+x~M\E\\, kbs=\b, kcbt=\E[Z, + kclr=\E[J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kf1=\EOA, + kf10=\EOJ, kf11=\EOK, kf12=\EOL, kf13=\EOM, kf14=\EON, + kf15=\EOO, kf16=\EOP, kf17=\EOQ, kf18=\EOR, kf19=\EOS, + kf2=\EOB, kf20=\EOT, kf21=\EOU, kf22=\EOV, kf23=\EOW, + kf24=\EOX, kf3=\EOC, kf4=\EOD, kf5=\EOE, kf6=\EOF, + kf7=\EOG, kf8=\EOH, kf9=\EOI, khome=\E[H, kich1=\E[@, + kil1=\E[L, krmir=\E6, mc0=\E[0i, mc4=^C, mc5=\E[v, + mc5p=\E[%p1%dv, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db, + rev=\E[7m, + rmkx=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E\\, + rmm=\E[>52l, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + sgr0=\E[0m, + smkx=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E\\, + smm=\E[>52h, smso=\E[7m, smul=\E[4m, tbc=\E[2g, + vpa=\E[%p1%{1}%+%dd, +# Info: +# .flash=\E7\E[H\E[7m\E9$<200>\E[m\E9\E8, +# +aaa+rv, + bold=\E[1;7m, rev=\E[m, blink=\E[5;7m, invis=\E[7;8m, sgr0=\E[7m^N, + rmul=\E[7m, smul=\E[4;7m, rmso=\E[7m, smso=\E[m, rs1=\E[H\E[7m\E[J$<156>, + sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, +# .flash=\E7\E[H\E[m\E9$<200>\E[7m\E9\E8, + is1=\E[7m\E7\E[H\E9\E8, +# Info: +# Ambassador with the DEC option, for partial vt100 compatibility. +# +aaa+dec, + csr=\E[%i%p1%d;%p2%dr, + sgr=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m%?%p9%t^O%e^N%;, + enacs=\E(0, smacs=^O, rmacs=^N, + acsc=aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz||}}, +aaa-18|ann arbor ambassador/18 lines, + smcup=\E[18;0;0;18p, rmcup=\E[60;0;0;18p\E[60;1H\E[K, + is2=\E7\E[60;0;0;18p\E8, lines#18, use=aaa+unk, +aaa-18-rv|ann arbor ambassador/18 lines+reverse video, + use=aaa+rv, use=aaa-18, +aaa-20|ann arbor ambassador/20 lines, + smcup=\E[20;0;0;20p, rmcup=\E[60;0;0;20p\E[60;1H\E[K, + is2=\E7\E[60;0;0;20p\E8, lines#20, use=aaa+unk, +aaa-22|ann arbor ambassador/22 lines, + smcup=\E[22;0;0;22p, rmcup=\E[60;0;0;22p\E[60;1H\E[K, + is2=\E7\E[60;0;0;22p\E8, lines#22, use=aaa+unk, +aaa-24|ann arbor ambassador/24 lines, + smcup=\E[24;0;0;24p, rmcup=\E[60;0;0;24p\E[60;1H\E[K, + is2=\E7\E[60;0;0;24p\E8, lines#24, use=aaa+unk, +aaa-24-rv|ann arbor ambassador/24 lines+reverse video, + use=aaa+rv, use=aaa-24, +aaa-26|ann arbor ambassador/26 lines, + smcup=\E[H\E[J$<156>\E[26;0;0;26p, rmcup=\E[60;0;0;26p\E[26;1H\E[K, + is2=\E7\E[60;0;0;26p\E8, lines#26, use=aaa+unk, +aaa-28|ann arbor ambassador/28 lines, + smcup=\E[H\E[J$<156>\E[28;0;0;28p, rmcup=\E[60;0;0;28p\E[28;1H\E[K, + is2=\E7\E[60;0;0;28p\E8, lines#28, use=aaa+unk, +aaa-30-s|aaa-s|ann arbor ambassador/30 lines with status line, + smcup=\E[H\E[J$<156>\E[30;1;0;30p\E[30;1H\E[K, + rmcup=\E[60;1;0;30p\E[29;1H\E[K, + is2=\r\n\E[A\E7\E[60;1;0;30p\E8, lines#29, + tsl=\E[>51h\E[1;%p1%dH\E[2K, fsl=\E[>51l, hs, eslok, + dsl=\E7\E[60;0;0;30p\E[1;1H\E[K\E[H\E8\r\n\E[K, + use=aaa+unk, +aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status line+reverse video, + use=aaa+rv, use=aaa-30-s, +aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines; status line; saving context, + smcup=\E[30;1H\E[K\E[30;1;0;30p, rmcup=\E[60;1;0;30p\E[59;1H\E[K, + use=aaa-30-s, +aaa-s-rv-ctxt|aaa-30-s-rv-ct|aaa-30-srvctxt|ann arbor ambassador/30 lines; status line; saving context, + smcup=\E[30;1H\E[K\E[30;1;0;30p, rmcup=\E[60;1;0;30p\E[59;1H\E[K, + use=aaa-30-s-rv, +aaa|aaa-30|ambas|ambassador|ann arbor ambassador/30 lines, + smcup=\E[H\E[J$<156>\E[30;0;0;30p, rmcup=\E[60;0;0;30p\E[30;1H\E[K, + is2=\E7\E[60;0;0;30p\E8, lines#30, use=aaa+unk, +aaa-30-rv|aaa-rv|ann arbor ambassador/30 lines in reverse video, + use=aaa+rv, use=aaa-30, +aaa-30-ctxt|aaa-ctxt|ann arbor ambassador/30 lines; saving context, + smcup=\E[30;0;0;30p, rmcup=\E[60;0;0;30p\E[60;1H\E[K, use=aaa-30, +aaa-30-rv-ctxt|aaa-rv-ctxt|ann arbor ambassador/30 lines; saving context, + smcup=\E[30;0;0;30p, rmcup=\E[60;0;0;30p\E[60;1H\E[K, + use=aaa+rv, use=aaa-30, +aaa-36|ann arbor ambassador/36 lines, + smcup=\E[H\E[J$<156>\E[36;0;0;36p, rmcup=\E[60;0;0;36p\E[36;1H\E[K, + is2=\E7\E[60;0;0;36p\E8, lines#36, use=aaa+unk, +aaa-36-rv|ann arbor ambassador/36 lines+reverse video, + use=aaa+rv, use=aaa-36, +aaa-40|ann arbor ambassador/40 lines, + smcup=\E[H\E[J$<156>\E[40;0;0;40p, rmcup=\E[60;0;0;40p\E[40;1H\E[K, + is2=\E7\E[60;0;0;40p\E8, lines#40, use=aaa+unk, +aaa-40-rv|ann arbor ambassador/40 lines+reverse video, + use=aaa+rv, use=aaa-40, +aaa-48|ann arbor ambassador/48 lines, + smcup=\E[H\E[J$<156>\E[48;0;0;48p, rmcup=\E[60;0;0;48p\E[48;1H\E[K, + is2=\E7\E[60;0;0;48p\E8, lines#48, use=aaa+unk, +aaa-48-rv|ann arbor ambassador/48 lines+reverse video, + use=aaa+rv, use=aaa-48, +aaa-60-s|ann arbor ambassador/59 lines plus status line, + is2=\r\n\E[A\E7\E[60;1;0;60p\E8, lines#59, + tsl=\E[>51h\E[1;%p1%dH\E[2K, fsl=\E[>51l, hs, eslok, + dsl=\E7\E[60;0;0;60p\E[1;1H\E[K\E[H\E8\r\n\E[K, + use=aaa+unk, +aaa-60-s-rv|ann arbor ambassador/59 lines+status line+reverse video, + use=aaa+rv, use=aaa-60-s, +aaa-60-s-rv-de|aaa-60-s-rvdec|ann arbor ambassador/dec mode+59 lines+status line+rev video, + use=aaa+dec, use=aaa+rv, use=aaa-60-s, +aaa-60|ann arbor ambassador/60 lines, + is2=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8, lines#60, use=aaa+unk, +aaa-60-rv|ann arbor ambassador/60 lines+reverse video, + use=aaa+rv, use=aaa-60, +aaa-db|ann arbor ambassador 30/destructive backspace, + cub1=\E[D, is3=\E[1Q\E[m\E[>20l\E[>30h, use=aaa-30, +# +guru|guru-33|guru+unk|ann arbor guru/33 lines 80 cols, + smcup=\E[33p, rmcup=\E[255p\E[255;1H\E[K, + flash=\E[>59h$<100>\E[>59l, + is2=\E7\E[255;0;0;33;80;80p\E8\E[J, is3=\E[>59l, lines#33, use=aaa+unk, +guru+rv|guru changes for reverse video, + flash=\E[>59l$<100>\E[>59h, is3=\E[>59h, +guru-rv|guru-33-rv|ann arbor guru/33 lines+reverse video, + use=guru+rv, use=guru-33, +guru+s|changes for status line, + rmcup=\E[255;1p\E[255;1H\E[K, + tsl=\E[>51h\E[1;%p1%dH\E[2K, fsl=\E[>51l, hs, eslok, + dsl=\E7\E[;0p\E[1;1H\E[K\E[H\E8\r\n\E[K, +guru-nctxt, + smcup=\E[H\E[J$<156>\E[33p\E[255;1H\E[K, use=guru, +guru-s|guru-33-s|ann arbor guru/33 lines with status line, + smcup=\E[33;1p\E[255;1H\E[K, + is2=\r\n\E[A\E7\E[255;1;0;33;80;80p\E8\E[J, lines#32, + use=guru+s, use=guru+unk, +guru-24, + smcup=\E[24p, is2=\E7\E[255;0;0;24;80;80p\E8\E[J, + lines#24, cols#80, use=guru+unk, +guru-44, + smcup=\E[44p, is2=\E7\E[255;0;0;44;97;100p\E8\E[J, + lines#44, cols#97, use=guru+unk, +guru-44-s|ann arbor guru/44 lines with status line, + smcup=\E[44;1p\E[255;1H\E[K, + is2=\r\n\E[A\E7\E[255;1;0;44;80;80p\E8\E[J, lines#43, + use=guru+s, use=guru+unk, +guru-76|guru with 76 lines by 89 cols, + smcup=\E[76p, is2=\E7\E[255;0;0;76;89;100p\E8\E[J, + lines#76, cols#89, use=guru+unk, +guru-76-s|ann arbor guru/76 lines with status line, + smcup=\E[76;1p\E[255;1H\E[K, + is2=\r\n\E[A\E7\E[255;1;0;76;89;100p\E8\E[J, lines#75, cols#89, + use=guru+s, use=guru+unk, +guru-76-lp|guru-lp|guru with page bigger than line printer, + smcup=\E[76p, is2=\E7\E[255;0;0;76;134;134p\E8\E[J, + lines#76, cols#134, use=guru+unk, +guru-76-w|guru 76 lines by 178 cols, + smcup=\E[76p, is2=\E7\E[255;0;0;76;178;178p\E8\E[J, + lines#76, cols#178, use=guru+unk, +guru-76-w-s|ann arbor guru/76 lines with status line, + smcup=\E[76;1p\E[255;1H\E[K, + is2=\r\n\E[A\E7\E[255;1;0;76;178;178p\E8\E[J, lines#75, cols#178, + use=guru+s, use=guru+unk, +guru-76-wm|guru 76 lines by 178 cols with 255 cols memory, + smcup=\E[76p, is2=\E7\E[255;0;0;76;178;255p\E8\E[J, + lines#76, cols#178, use=guru+unk, +aaa-rv-unk, + lh#0, lw#0, nlab#0, + blink=\E[5;7m, bold=\E[1;7m, invis=\E[7;8m, + is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, + rmul=\E[7m, rs1=\E[H\E[7m\E[J, + sgr=\E[%?%p1%!%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m, + sgr0=\E[7m, smso=\E[m, smul=\E[4;7m, diff --git a/usr/src/lib/terminfo/ansi.ti b/usr/src/lib/terminfo/ansi.ti new file mode 100644 index 0000000..b421eed --- /dev/null +++ b/usr/src/lib/terminfo/ansi.ti @@ -0,0 +1,143 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:ansi.ti 1.12" +# # ANSI - standards and other nonexistent terminals emulated in software. +# +# Manufacturer: ANSI - Generic +# Class: III +# +# Info: +# This category is used for terminals people "make up" in software +# that do not represent a particular piece of hardware. This +# includes standards, such as the ANSI standard, as well as +# emulator programs that accept a particular set of escape +# sequences. +# +# ANSI capabilities are broken up into pieces, so that a terminal +# implementing some ANSI subset can use many of them. +# +ansi+local, + cud=\E[%p1%dB, cub=\E[%p1%dD, cuf=\E[%p1%dC, cuu=\E[%p1%dA, +ansi+local1, + cud1=^J, cub1=^H, cuf1=\E[C, cuu1=\E[A, +ansi+tabs, + ht=^I, cbt=\E[Z, hts=\EH, tbc=\E[2g, +ansi+inittabs, + it#8, use=ansi+tabs, +ansi+erase, + ed=\E[J, el=\E[K, clear=\E[H\E[J, +ansi+rca, + hpa=\E[%p1%{1}%+%dG, vpa=\E[%p1%{1}%+%dd, +ansi+cup, + cup=\E[%i%p1%d;%p2%dH, home=\E[H, +ansi+rep, + rep=%p1%c\E[%p2%{1}%-%db, +ansi+idl, + dl=\E[%p1%dM, il=\E[%p1%dL, +ansi+idl1, + dl1=\E[M, il1=\E[L, +ansi+idc, + dch1=\E[P, ich=\E[%p1%d@, ich1=\E[@, +# smir=\E6, rmir=\E6, commented out by ehr3 +ansi+arrows, + kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D, kcuf1=\E[C, khome=\E[H, kbs=^H, +ansi+sgr|ansi graphic renditions, + rev=\E[7m, blink=\E[5m, invis=\E[8m, sgr0=\E[0m, +ansi+sgrso|ansi standout only, + rmso=\E[m, smso=\E[7m, +ansi+sgrul|ansi underline only, + rmul=\E[m, smul=\E[4m, +ansi+sgrbold|ansi graphic renditions; assuming terminal has bold; not dim, + bold=\E[1m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, +ansi+sgrdim|ansi graphic renditions; assuming terminal has dim; not bold, + dim=\E[2m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2;%;m, + use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, +ansi+pp|ansi printer port, + mc4=\E[4i, mc5=\E[5i, mc0=\E[0i, +# Info: +# ANSI is a vanilla ANSI terminal. This is assumed to implement +# all the normal ANSI stuff with no extensions. It assumes +# insert/delete line/char is there, so it won't work with +# vt100 clones. It assumes video attributes for bold, blink, +# underline, and reverse, which won't matter much if the terminal +# can't do some of those. Padding is assumed to be zero, which +# shouldn't hurt since xon/xoff is assumed. +# +# We assume a 24x80 screen. This entry was derived from the +# Ann Arbor Ambassador, and is untested. +# +ansi|generic ansi standard terminal, + use=vanilla, am, cols#80, lines#24, xon, + use=ansi+cup, use=ansi+rca, + use=ansi+erase, + use=ansi+tabs, + use=ansi+local1, use=ansi+local, + use=ansi+idc, use=ansi+idl1, use=ansi+idl, + use=ansi+rep, + use=ansi+sgrbold, use=ansi+arrows, +# Info: +# Bare minimum ANSI terminal. This should work on anything, but +# beware of screen size problems and memory relative cursor +# addressing. +# +minansi|minimum ansi standard terminal, + am, xon, use=vanilla, cols#80, lines#24, + use=ansi+cup, use=ansi+erase, +# Info: +# This terminal type is for ANSI terminals with ONLY memory +# relative cursor addressing and more than one page of memory. +# It uses local motions instead of direct cursor addressing, +# and makes almost no assumptions. It does assume auto margins, +# no padding and/or xon/xoff, and a 24x80 screen. +# +mransi|mem rel cup ansi, + am, use=vanilla, cols#80, lines#24, xon, + use=ansi+erase, use=ansi+local1, +# Info: +# Columbus UNIX virtual terminal. This terminal also appears in +# UNIX 4.0 and successors as line discipline 1 (?), but is +# undocumented and does not really work quite right. +# +virtual|cbunix|cb-unix|cb-unix virtual terminal, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, am, clear=\EJ, + cub1=^H, cup=\EG%p2%c%p1%c, cuf1=\EC, cuu1=\EA, el=\EK, + ed=\EL, il1=\EP, dl1=\EN, ich1=\EO, dch1=\EM, lm#0, da, db, + kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kcud1=\EB, khome=\EE, + smso=\Ea\004, rmso=\Eb\004, smul=\Ea\001, rmul=\Eb\001, +# Info: +# This terminal is based on virtual but cleans up a few problems +# with control characters in parameter strings. It is implemented +# in mrh's window manager. +# +pty|4bsd pty terminal, + smso=\Ea$, rmso=\Eb$, smul=\Ea!, rmul=\Eb!, + cup=\EG%p1%' '%+%c%p2%' '%+%c, use=virtual, +# Info: +# A dumb terminal with 1 line which is a fake status line. +# This is useful to run sysline in in a multi-window environment. +# +1line|one_line|one line window, + cr=^M, ind=^J, cols#80, lines#1, am, ht=^I, cub1=^H, + hs, tsl=\n, +# Info: +# 1linepty is like 1line but the 1 line window is smarter, +# with standout, cursor addressing, and clear to eol. +# +1linepty|one_linepty|1 line window in a pty, + smso=\Ea$, rmso=\Eb$, smul=\Ea!, rmul=\Eb!, + cup=\EG%p1%' '%+%c%p2%' '%+%c, tsl=\r\EK\EG %p2%' '%+%c, + eslok, use=1line, +vanilla, + bel=^G, cr=^M, cud1=^J, ind=^J, +datakit, + am, gn, + cols#80, + bel=^G, cr=\r, cud1=\n, ind=\n, diff --git a/usr/src/lib/terminfo/att.ti b/usr/src/lib/terminfo/att.ti new file mode 100644 index 0000000..d7d74d2 --- /dev/null +++ b/usr/src/lib/terminfo/att.ti @@ -0,0 +1,2778 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:att.ti 1.98" +# # -------------------------------- +# +# att: AT&T +# +# Manufacturer: AT&T +# Class: I + +2300|att2300|ATT2300|sv80|AT&T 2300 Video Information Terminal 80 column mode @(#)2300.ti 1.1, + am, xon, eo, mir, msgr, + cols#80, lines#24, it#8, + bel=^G, + cub=\E[%p1%dD, cub1=\b, + cuf=\E[%p1%dC, cuf1=\E[C, + cud=\E[%p1%dB, cud1=\n, + cuu=\E[%p1%dA, cuu1=\E[A, + cup=\E[%i%p1%d;%p2%dH, + ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, + dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, + smso=\E[7m, rmso=\E[0m, rev=\E[7m, + cr=\r, ind=\n, + ht=\t, smir=\E[4h, rmir=\E[4l, + home=\E[H, clear=\E[H\E[J, ed=\E[J, el=\E[K, el1=\E[1K, + kf1=\E[1r, kf2=\E[2r, kf3=\E[3r, kf4=\E[4r, + kf5=\E[5r, kf6=\E[6r, kf7=\E[7r, kf8=\E[8r, + kf9=\E[9r, kf10=\E[10r, kf11=\E[11r, kf12=\E[12r, + kf13=\E[13r, kf14=\E[14r, kf15=\E[15r, kf16=\E[16r, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + khome=\E[H, kclr=\E[J, kcbt=\E[Z, kbs=\b, + kil1=\E[L, kich1=\E[@, kdl1=\E[M, kdch1=\E[P, + mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + sgr0=\E[m, +2350|att2350|ATT2350|AT&T 2350 Video Information Terminal 80 column mode @(#)2300.ti 1.1, + mc0@, mc4@, mc5@, use=att2300, +2300-x40|att2300-x40|ATT2300-x40|sv40|AT&T 2300 Video Information Terminal 40 column mode @(#)2300.ti 1.1, + cols#40, lines#23, it#5, il@, il1@, use=att2300, +2350-x40|att2350-x40|ATT2350-x40|AT&T 2350 Video Information Terminal 40 column mode @(#)2300.ti 1.1, + cols#40, lines#23, it#5, il@, il1@, use=att2350, +33|tty33|tty|AT&T model 33 teletype @(#)33.ti 1.1, + xon,cr=^M, cud1=^J, ind=^J, bel=^G, cols#72, hc, os, + +35|tty35|AT&T model 35 teletype @(#)35.ti 1.1, + use=tty33, + +37|tty37|AT&T model 37 teletype @(#)37.ti 1.1, + xon,cr=^M, cud1=^J, ind=^J, bel=^G, + cub1=^H, hc, hu=\E8, hd=\E9, cuu1=\E7, os, + +# Info: +# The Dataspeed 40's print a visible newline indicator after +# each newline. The 40-1 is a half duplex terminal. +# and is described here. The 40-4 is a 3270 lookalike +# +# The terminal has blinking standout. It also has visible bell +# but I don't know it - it's null here to prevent it from showing +# the BL character. +# +# I am not sure if the 40 has xmc, it looked like it didn't. +# +# Note also that the control characters have been randomly +# rearranged, for example, to get escape you type control-P and +# cntrol-H generates GS, group separator! +# +# +# \EX will get terminal out of protect mode but there doesn't +# appear to be a mnemonic for it (\EW will put it into protect). +# +# When printer is enabled all received characters are printed - no +# print screen is provided. Most delays are pure guesswork. +# +# Watch out for the visible newline symbol. Note that +# the editing and cursor controls do not work in S/R mode except +# for cursor left arrow which generates the backspace character. +# +# Note also that many control codes echo visibly while the +# corresponding escape sequences do not; for example, both ^K +# and \EC move the cursor right one place, but the former +# prints a VT symbol, too. +# + +40|tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2 @(#)40.ti 1.1, + clear=\EH$<20>\EJ$<80>, ed=\EJ$<75>, il1=\EL$<50>, dl1=\EM$<50>, + dch1=\EP$<50>, ich1=\E\^$<50>, cuf1=\EC, cuu1=\E7, cub1=^H, cr=\EG, + ind=\ES$<20>, cud1=\EB, cols#80, lines#24, smso=\E3, rmso=\E4, + xon,kbs=\035, kcub1=^H, rs2=^S\ER$<60>, hts=\E1, home=\EH$<10>, + ri=\ET$<10>, tbc=\EH\E2$<80>, mc5=^R$<2000>, mc4=^T, ht=\E@$<10>, + +43|tty43|AT&T model 43 teletype @(#)43.ti 1.1, + xon,cr=^M, cud1=^J, ind=^J, bel=^G, + kbs=^h, am, cub1=^H, hc, os, cols#132, + +# Info: +# Must setup RETURN KEY - CR, REC'VD LF - INDEX. +# Seems upward compatible with vt100, plus ins/del line/char. +# On sgr, the protection parameter is ignored. +# No check is made to make sure that only 3 parameters are output. +# standout= reverse + half-intensity = 3 | 5. +# bold= reverse + underline = 2 | 3. +# note that half-bright blinking doesn't look different from +# normal blinking. +# +# NOTE:you must program the function keys first, label second! +# + + +ATT4410v1|ATT5410v1|att5410v1|att4410v1|4410v1|tty5410v1|5410v1|AT&T 4410/5410 terminal in 80 column mode - version 1 @(#)4410.ti 1.3, + am, hs, mir, msgr, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffhhggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~00++--\,\,.., + is1=\E[?3l\E)0, + bel=^G, blink=\E[5m, bold=\E[4;7m, clear=\E[H\E[J, + cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=\b, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[P, dim=\E[2m, dl1=\E[M, ed=\E[J, el=\E[K, + fsl=\E8, home=\E[H, ht=\t, ich1=\E[@, il1=\E[L, + ind=\n, invis=\E[8m, + is3=\E[1;03q\s\s\sf1\s\s\s\s\s\s\s\s\s\s\s\EOP\E[2;03q\s\s\sf2\s\s\s\s\s\s\s\s\s\s\s\EOQ\E[3;03q\s\s\sf3\s\s\s\s\s\s\s\s\s\s\s\EOR\E[4;03q\s\s\sf4\s\s\s\s\s\s\s\s\s\s\s\EOS\E[5;03q\s\s\sf5\s\s\s\s\s\s\s\s\s\s\s\EOT\E[6;03q\s\s\sf6\s\s\s\s\s\s\s\s\s\s\s\EOU\E[7;03q\s\s\sf7\s\s\s\s\s\s\s\s\s\s\s\EOV\E[8;03q\s\s\sf8\s\s\s\s\s\s\s\s\s\s\s\EOW, + kbs=\b, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + khome=\E[H, kll=\E[24;1H, ll=\E[24H, nel=\r\n, + pfx=\E[%p1%1d;%p2%l%2.2dq\s\s\sf%p1%1d\s\s\s\s\s\s\s\s\s\s\s%p2%s, + pln=\E[%p1%d;00q%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, + sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O, smacs=^N, smso=\E[2;7m, smul=\E[4m, + tsl=\E7\E[25;%p1%{1}%+%dH, + +att4410v1-w|ATT4410v1-w|att5410v1-w|ATT5410v1-w|4410v1-w|tty5410v1-w|5410v1-w|AT&T 4410/5410 terminal in 132 column mode - version 1 @(#)4410.ti 1.3, + cols#132,is1=\E[?3h\E)0,rs2=\Ec\E[?3h\E[2;0y,wsl#132,use=4410v1, + +att4410|ATT4410|att5410|ATT5410|4410|tty5410|5410|AT&T 4410/5410 terminal in 80 column mode - version 2 @(#)4410.ti 1.3, + pfx=\E[%p1%d;%p2%l%02dq f%p1%d %p2%s, + use=4410v1, + +ATT4410-nfk|att4410-nfk|att5410-nfk|ATT5410-nfk|4410-nfk|tty5410-nfk|5410-nfk|version 1 AT&T 4410/5410 entry without function keys @(#)4410.ti 1.3, + pln@, is3@, kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4410, + +att5410-w|ATT5410-w|att4410-w|4410-w|tty5410-w|5410-w|AT&T 4410/5410 in 132 column mode @(#)4410.ti 1.3, + cols#132, is1=\E[?3h\E)0,rs2=\Ec\E[?3h\E[2;0y, wsl#132, + use=att4410, + + +5410-nsl|att5410-nsl|ATT5410-nsl|4410-nsl|att4410-nsl|ATT4410-nsl|tty5410-nsl|tty5410 entry without pln defined @(#)4410.ti 1.3, + pln@, + use=tty5410, + +otty5410|teletype 5410 for S5R2 curses @(#)4410.ti 1.3, + tsl=\E7\E[25;%p1%{1}%+%dH, + use=tty5410, + +# Info: +# 5410 in terms of a vt100 +# +v5410| 5410 in terms of a vt100 @(#)4410.ti 1.3, + am, mir, msgr, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=\r, csr=\E[%i%p1%d;%p2%dr, + cub1=\b, cud1=\n, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu1=\E[A$<2>, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=\t, hts=\EH, ich1=\E[@, + il1=\E[L, ind=\n, ka1=\EOq, ka3=\EOs, kb2=\EOr, + kbs=\b, kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, + kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmkx=\E[?1l\E>, + rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;$<2>, + sgr0=\E[m^O$<2>, smacs=^N$<2>, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, + +# Info: +# +# Teletype Model 5420 -- A souped up 5410, with multiple windows, +# even! the 5420 has three modes: scroll, window or page mode +# this terminfo should work in scroll or window mode, but doesn't +# take advantage of any of the differences between them. +# +ATT4415|att4415|4415|tty5420|att5420|ATT5420|5420|AT&T 4415/5420 in 80 column mode @(#)4415.ti 1.3, +# Info: +# Memory below (2 lines!) +# + xon,db, mir, +# Info: +# 3 pages of memory (plus some spare) +# + nlab#8, lh#2, lw#8, wsl#55, lm#78, + cbt=\E[Z, clear=\E[x\E[J, cnorm=\E[11;0j, + cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, cuu=\E[%p1%dA, +# Info: +# The 5410 sequences would work for these, but these +# work in both scroll and window mode... +# + cup=\E[%i%p1%d;%p2%dx, + cvvis=\E[11;1j, dch=\E[%p1%dP, dl=\E[%p1%dM, + ech=\E[%p1%ds\E[%p1%dD, + flash=\E[?5h$<200>\E[?5l, + home=\E[x, hpa=\E[%p1%{1}%+%dG, hts=\EH, +# Info: +# Unset insert character so insert mode works +# + ich1@, ich=\E[%p1%d@, il=\E[%p1%dL, indn=\E[%p1%dE, +# Info: +# set 80 column mode, +# + is1=\E[?3l$<100>, +# is2 escape sequence: +# 1) turn off all fonts +# 2) function keys off, keyboard lock off, control display off, +# insert mode off, erasure mode off, +# 3) full duplex, monitor mode off, send graphics off, nl on lf off +# 4) reset origin mode +# 5) set line wraparound +# 6) exit erasure mode, positional attribute mode, and erasure extent mode +# 7) clear margins +# 8) program ENTER to transmit ^J, +# We use \212 to program the ^J because a bare ^J will get translated by +# UNIX into a CR/LF. The enter key is needed for AT&T uOMS. +# 1 2 3 4 5 6 7 8 +# + is2=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[21;1j\212, +# Info: +# set screen color to black, +# + is3=\E[?5l, + kbeg=\Et, kcbt=\E[Z, kdch1=\E[P, kdl1=\E[M, +# info: +# No representation in terminfo for the delete word key +# kdw1=\Ed +# + kel=\E[2K, kend=\Ez, kent=\Eent, +# Info: +# This assumes the power-up send sequence... +# + kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, + kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, + knp=\E[U, kpp=\E[V, kri=\E[S, + lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, lf6=F6, lf7=F7, lf8=F8, + ll=\Ew, mc0=\E[?2i, mc4=\E[4i, mc5=\E[5i, + mrcup=\E[%i%p1%d;%p2%dt, + pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, + rmln=\E|, smln=\E~, prot=\EV, rin=\E[%p1%dF, +# Info: +# This rmcup is not strictly necessary, but it helps maximize +# memory usefulness +# rmcup=\Ez, +# + rmir=\E[4l, rmkx=\E[19;0j\E[21;1j\212, sgr0=\E[0m^O, +# Info: +# sgr0=\E[0m\EW^O, +# + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, +# Info: +# sgr=\E[%?%p1%t2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t^N%e^O%;, +# + smir=\E[4h, +# Info: +# This programs the SYS PF keys to send a set sequence. +# It also sets up labels f1, f2, ..., f8, and sends edit keys. +# This string causes them to send the strings kf1-kf8 +# when pressed in SYS PF mode. +# + smkx=\E[19;1j\E[21;4j\Eent, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, + use=att4410, + +ATT4415-w|att4415-w|4415-w|tty5420-w|att5420-w|ATT5420-w|5420-w|AT&T model 4415/5420 in 132 column mode @(#)4415.ti 1.3, + lm#54, cols#132, wsl#97, +# Info: +# set 132 column mode, +# + is1=\E[?3h$<100>, + use=att4415, + +ATT4415-rv|att4415-rv|4415-rv|tty5420-rv|att5420-rv|ATT5420-rv|5420-rv|AT&T model 4415/5420 80 columns in reverse video @(#)4415.ti 1.3, + flash=\E[?5l$<200>\E[?5h, +# Info: +# set screen color to white, +# + is3=\E[?5h, + use=att4415, + +ATT4415-w-rv|att4415-w-rv|4415-w-rv|tty5420-w-rv|att5420-w-rv|ATT5420-w-rv|5420-w-rv|AT&T model 4415/5420 132 columns in reverse video @(#)4415.ti 1.3, + lm#54, cols#132, wsl#97, + flash=\E[?5l$<200>\E[?5h, +# Info: +# set 132 column mode, +# + is1=\E[?3h$<100>, +# Info: +# set screen color to white, +# + is3=\E[?5h, + use=att4415, + +# Info: +# Note that this mode permits programming USER PF KEYS and labels +# However, when you program user pf labels you have to reselect +# user pf keys to make them appear! +# +ATT4415+nl|att4415+nl|4415+nl|tty5420+nl|att5420+nl|ATT5420+nl|5420+nl|generic AT&T 4415/5420 changes for not changing labels @(#)4415.ti 1.3, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + pfx=\E[%p1%d;%p2%l%02d;0;1q F%p1%d %p2%s, + pln=\E[%p1%d;0;0;1q%p2%:-16.16s, + +ATT4415-nl|att4415-nl|4415-nl|tty5420-nl|att5420-nl|ATT5420-nl|5420-nl|AT&T 4415/5420 without changing labels @(#)4415.ti 1.3, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415, + +ATT4415-rv-nl|att4415-rv-nl|4415-rv-nl|tty5420-rv-nl|5420-rv-nl|ATT5420-rv-nl|att5420-rv-nl|AT&T 4415/5420 reverse video without changing labels @(#)4415.ti 1.3, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415-rv, + +ATT4415-w-nl|att4415-w-nl|4415-w-nl|tty5420-w-nl|5420-w-nl|att5420-w-nl|ATT5420-w-nl|AT&T 4415/5420 132 cols without changing labels @(#)4415.ti 1.3, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415-w, + +ATT4415-w-rv-n|att4415-w-rv-n|4415-w-rv-nl|tty5420-w-rv-n|5420-w-rv-nl|att5420-w-rv-n|ATT5420-w-rv-n|AT&T 4415/5420 132 cols reverse without changing labels @(#)4415.ti 1.3, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + use=att4415+nl, use=att4415-w-rv, + +otty5420|teletype 5420 for SVR2 curses on the 3B-20's @(#)4415.ti 1.3, + hpa=\E[%p1%{1}%+%dG, + vpa=\E[%p1%{1}%+%dd, + use=tty5420, + +att5420_2|ATT5420_2|5420_2|AT&T 5420 model 2 in 80 column mode @(#)4415.ti 1.3, + am, db, hs, mir, msgr, xon, + cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, + wsl#55, + blink=\E[5m, bold=\E[4;7m, cbt=\E[1Z, clear=\EH\EJ, + cnorm=\E[11;0j, cr=\EG, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, + cub1=\b, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cvvis=\E[11;1j, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[0J, el=\E[0K, + el1=\E[1K, flash=\E[?5h$<200>\E[?5l, fsl=\E8, + home=\E[0;0H, hpa=\E[%p1%{1}%+%dG, ht=\t, hts=\EH, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + ind=\n, indn=\E[%p1%dE, invis=\E[8m, + is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;0j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, + kbeg=\Et, kbs=\b, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kel=\E[2K, kend=\Ez, kent=\n, kf1=\EOc, + kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, + kf7=\EOi, kf8=\EOj, khome=\E[H, kich1=\E[4h, + kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, kpp=\E[V, + kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, + lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?;2i, + mc4=\E[4i, mc5=\E[5i, mrcup=\E[%i%p1%d;%p2%dt, + nel=\r\n, + pfx=\E[%p1%d;%p2%l%02dq\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s\s%p2%s\E~, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s\E~, prot=\EV, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, + rmkx=\E[19;0j, rmln=\E|, rmso=\E[m, rmul=\E[m, + rs2=\Ec\E[?3l\E[2;0y, sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + sgr0=\E[0m^O, smacs=^N, smkx=\E[19;1j, + smln=\E~, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, +att5420_2-w|ATT5420_2-w|5420_2-w|AT&T 5420 model 2 in 132 column mode @(#)4415.ti 1.3, + cols#132, + is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r, + use=5420_2, + +4418|att4418|ATT4418|5418|att5418|ATT5418|AT&T 5418 in 80 column mode @(#)4418.ti 1.2, + am, xon, + cols#80, lines#24, + bel=^G, blink=\E[5m, clear=\E[H\E[2J, cr=\r, + cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[1P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, + home=\E[H, ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, + il1=\E[1L, ind=\n, is1=\E[?3l, is2=\E)0\E?6l\E?5l, + kclr=\E[%, kcub1=\E@, kcud1=\EU, kcuf1=\EA, kcuu1=\ES, + khome=\Ec, kent=\E[, kf1=\E[h, kf10=\E[m, kf11=\E[n, kf12=\E[o, + kf13=\E[H, kf14=\E[I, kf15=\E[J, kf18=\E[K, kf19=\E[L, + kf2=\E[i, kf20=\E[E, kf21=\E[_, kf22=\E[M, kf23=\E[N, + kf24=\E[O, kf3=\E[j, kf6=\E[k, kf7=\E[l, kf8=\E[f, + kf9=\E[w, rc=\E8, rev=\E[7m, rmacs=^O, rmso=\E[0m, + rmul=\E[0m, sc=\E7, sgr0=\E[0m^O, smacs=^N, smso=\E[7m, + smul=\E[4m, +4418-w|att4418-w|ATT4418-w|5418-w|att5418-w|ATT5418-w|AT&T 5418 in 132 column mode @(#)4418.ti 1.2, + cols#132,is1=\E[?3h,use=5418, + +4420|tty4420|teletype 4420 @(#)4420.ti 1.1, + xon,da, db, eo, msgr, ul,lm#72, + cols#80, lines#24, + bel=^G, clear=\EH\EJ, cr=\EG, + cuu1=\EA, cud1=\EB,cuf1=\EC,cub1=\ED, + cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, + dch1=\EP, dl1=\EM, ed=\EJ, el=\Ez, il1=\EL, + home=\EH, + ind=\EH\EM\EY7 , kcub1=\b, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf0=\EU, kf3=\E@, + lf0=segment advance, lf3=cursor tab, + kind=\ES, kri=\ET, kcbt=\EO, kclr=\EJ, + kil1=\EL, kdl1=\EM, kich1=\E\^, kdch1=\EP, khome=\EH, + rmdc@, rmso=\E~, rmul=\EZ, smdc@, smso=\E}, smul=\E\\, + +# Info: +# The following is a termcap entry for the Teletype 4424 +# asyncronous keyboard-display terminal. It supports +# the vi editor. The terminal must be "set up" as follows, +# +# HIGHLIGHT DEFINITION 3-TONE +# DISPLAY FUNCTION GROUP III +# +# The second entry below provides limited (a la adm3a) +# operation under GROUP II. +# +# This must be used with DISPLAY FUNCTION GROUP I or III +# and HIGHLIGHT DEFINITION 3-TONE +# +4424|att4424|ATT4424|tty4424|4424-3|teletype 4424 @(#)4424.ti 1.7, + xon,cr=^M, ind=^J, bel=^G, cols#80, lines#24, am, + smso=\E[7m, rmso=\E~, rev=\E[7m, smul=\E[4m, rmul=\EZ, ri=\ET, +# Info: +# The terminal has either bold or blink, depending on options +# + xon,bold=\E[1m, blink=\E[5m, + ht=^I, cbt=\EO, home=\E[H, cuu1=\EA, cuu=\E[%p1%dA, + cud1=\EB, cud=\E[%p1%dB, cuf1=\EC, cuf=\E[%p1%dC, + smcup=\E[1m, + cub1=^H, cub=\E[%p1%dD, cup=\E[%i%p1%d;%p2%dH, + clear=\E[H\E[2J, ed=\EJ, el=\Ez, nel=\EE, hts=\EH, tbc=\EF, + smacs=\E(0, rmacs=\E(B, is2=\E[20l\E[?7h, csr=\E[%i%p1%d;%p2%dr, + il1=\EL, il=\E[%p1%dL, dl1=\EM, dl=\E[%p1%dM, + ich1=\E\^, ich=\E[%p1%d@, dch1=\EP, dch=\E[%p1%dP, + sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p6%t;1%;%?%p4%t;5%;m, + sgr0=\EX\E~\EZ\E4\E(B, + kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D, kcuf1=\E[C, khome=\E[H, kbs=^H, kclr=\EJ, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + +4424-1|att4424-1|ATT4424-1|tty4424-1|teletype 4424 in display function group I @(#)4424.ti 1.7, + kclr@,kcub1=\ED,kcud1=\EB,kcuf1=\EC,kcuu1=\EA,khome@,use=4424, + +# Info: +# The Teletype 5425 is really version 2 of the Teletype 5420. It +# is quite similar, except for some minor differences. No page +# mode, for example, so all of the cup sequences used above have +# to change back to what's being used for the 5410. Many of the +# option settings have changed their numbering as well. +# +# This has been tested on a preliminary model. +# + +ATT4425|ATT5425|att5425|4425|5425|tty5425|att4425|AT&T 4425/5425 @(#)4425.ti 1.3, + am, da, db, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, + wsl#55, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[4;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[12;0j, cr=\r, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[12;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, + ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=\t, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dE, + invis=\E[8m, is1=\E<\E[?3l$<100>, + is2=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212, + is3=\E[?5l, kbeg=\Et, kbs=\b, kcbt=\E[Z, kclr=\E[J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[P, kdl1=\E[M, kel=\E[2K, kend=\Ez, kent=\Eent, + kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, khome=\E[H, kich1=\E[4h, + kil1=\E[L, kind=\E[T, kri=\E[S, ll=\E[24H, mc0=\E[?2i, + mc4=\E[4i, mc5=\E[5i, nel=\r\n, + pfx=\E[%p1%d;%p2%l%02dq\s\s\sF%p1%1d\s\s\s\s\s\s\s\s\s\s\s%p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, + rmir=\E[4l, rmkx=\E[21;0j\E[25;1j\212, rmln=\E|, rmso=\E[m, + rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O, smacs=^N, smir=\E[4h, smkx=\E[21;1j\E[25;4j\Eent\E~, + smln=\E~, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, + +ATT4425-nl|ATT5425-nl|att5425-nl|4425-nl|5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 without label change 80 column mode @(#)4425.ti 1.3, + smkx=\E[21;1j\E[25;4j\Eent,use=4425, + +ATT4425-nl-w|ATT5425-nl-w|att5425-nl-w|4425-nl-w|5425-nl-w|tty5425-nl-w|att4425-nl-w|AT&T 4425/5425 without label change 132 column mode @(#)4425.ti 1.3, + smkx=\E[21;1j\E[25;4j\Eent,use=4425-w, + +4425-fk|5425-fk|tty5425-fk|att4425-fk|AT&T 4425/5425 without function keys @(#)4425.ti 1.3, + smkx@,rmkx@,use=5425, + +ATT4425-w|att5425-w|ATT5425-w|att4425-w|4425-w|5425-w|tty5425-w|teletype 4425/5425 in 132 column mode @(#)4425.ti 1.3, + lm#54, cols#132, wsl#97, +# Info: +# set 132 column mode, +# + is1=\E[?3h$<100>, + use=tty5425, + +4425-w-fk|5425-w-fk|tty5425-w-fk|att4425-w-fk|ATT4425-w-fk|att5425-w-fk|ATT5425-w-fk|AT&T 4425/5425 without function keys in wide mode @(#)4425.ti 1.3, + smkx@,rmkx@,use=5425-w, + +4426|att4426|ATT4426|tty4426|teletype 4426S @(#)4426.ti 1.2, + am,xon, + is1=\Ec\E[?7h, + bel=^G, + bold=\E[5m, + clear=\E[H\E[2J\E[1U\E[H\E[2J\E[1V, + cols#80, + cr=^M, + cub1=\E[D, + cub=\E[%p1%dD, + cud1=\E[B, + cud=\E[%p1%dB, + cuf1=\E[C, + cuf=\E[%p1%dC, + cup=\E[%i%p1%d;%p2%dH, + cuu1=\EA, + cuu=\E[%p1%dA, + dch1=\EP, + dch=\E[%p1%dP, + dl1=\E[M, + dl=\E[%p1%dM, + ed=\E[J, + el=\E[0K, + home=\E[H, + hpa=\E[%p1%dG, + hts=\E1, + ht=\t, + ich1=\E\^, + ich=\E[%p1%d@, + il1=\EL, + il=\E[%p1%dL, + ind=\ES, + ind=^J, + indn=\E[%p1%dS, + is2=\E[m\E[1;24r, + kbs=^H, + kcbt=\EO, + kclr=\E[2J, + kcub1=\ED, + kcud1=\EB, + kcuf1=\EC, + kcuu1=\EA, + kf1=\EOP, + kf2=\EOQ, + kf3=\EOR, + kf4=\EOS, + kf5=\EOT, + kf6=\EOU, + kf7=\EOV, + kf8=\EOW, + khome=\E[H, + kll=\E[24;1H, + lines#24, + ll=\E[24H, + nel=^M^J, + rc=\E8, + rev=\E[7m, + ri=\EM, + ri=\ET, + ri=\E[1U, + rin=\E[%p1%dT, + rmacs=\E(B, + rmso=\E[0m, + rmul=\E[0m, + rmul=\E[m, + rs2=\Ec\E[?3l\E[2;0y, + sc=\E7, + sgr0=\E[0m\E(B, + smacs=\E(0, + smso=\E[5m, + smul=\E[4m, + smul=\E[4m, + tbc=\E[3g, + lm#48,da,db, + vpa=\E[%p1%dd, + + +# Terminfo entry for the AT&T 510 A Personal Terminal +# Function keys 9 - 16 are available only after the +# screen labeled (soft keys/action blocks) are labeled. Function key +# 9 corresponds to the leftmost touch target on the screen, +# function key 16 corresponds to the rightmost. +# +# +# This entry is based on one done by Ernie Rice at Summit, NJ and +# changed by Anne Gallup, Skokie, IL, ttrdc!anne +# +att510a|510a|bct510a|510A|AT&T 510A Personal Terminal @(#)510a.ti 1.3, + am, + xenl, + mir, + msgr, + xon, + cols#80, + lines#24, + nlab#8, + lh#2, + lw#7, + cbt=\E[Z, + bel=^G, + cr=^M, + tbc=\E[3g, + clear=\E[H\E[J, + el=\E[0K, + ed=\E[0J, + cup=\E[%i%p1%d;%p2%dH, + cud1=\E[1B, + home=\E[H, + cub1=^H, + cnorm=\E[11;3|, + cuf1=\E[C, + cuu1=\E[A, + civis=\E[11;0|, + cvvis=\E[11;2|, + dch1=\E[P, + dl1=\E[M, + smacs=^N, + blink=\E[5m, + bold=\E[2;7m, + dim=\E[2m, + rev=\E[7m, + smso=\E[7m, + smul=\E[4m, + rmacs=^O, + sgr0=\E[m^O, + rmso=\E[m, + rmul=\E[m, + ff=^L, + is3=\E[21;1|\212, + il1=\E[L, + kbs=^H, + kcud1=\E[B, + kf1=\EOm, + kf2=\EOV, + kf3=\EOu, + kf4=\ENj, + kf5=\ENe, + kf6=\ENf, + kf7=\ENh, + kf8=\E[H, + kf9=\EOc, + kf10=\EOd, + kf11=\EOe, + kf12=\EOf, + kf13=\EOg, + kf14=\EOh, + kf15=\EOi, + kf16=\EOj, + kcub1=\E[D, + kcuf1=\E[C, + kind=\E[S, + kri=\E[T, + kcuu1=\E[A, + nel=\EE, + dch=\E[%p1%dP, + dl=\E[%p1%dM, + cud=\E[%p1%dB, + il=\E[%p1%dL, + cub=\E[%p1%dD, + cuf=\E[%p1%dC, + cuu=\E[%p1%dA, + mc0=\E[0i, + mc4=\E[?8i, + mc5=\E[?4i, + rc=\E8, + sc=\E7, + ind=^J, + ri=\EM, + sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;m%?%p9%t^N%e^O%;, + hts=\EH, + ht=\t, + acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + pln=\E[%p1%dp%p2%:-16s, + kcbt=\E[Z, + enacs=\E(B\E)1, + kLFT=\E[u, + kRIT=\E[v, + el1=\E[1K, + is1=\E(B\E)1\E[2l, + +# Terminfo entry for the AT&T 510 D Personal Terminal +# Function keys 9 through 16 are accessed by bringing up the +# system blocks. +# Function key 9 corresponds to the leftmost touch target on the screen, +# function key 16 corresponds to the rightmost. +# +# There are problems with soft key labeling. These are due to +# strangenesses in the native terminal that are impossible to +# describe in a terminfo. +# +# +att510d|510d|bct510d|510D|AT&T 510D Personal Terminal @(#)510d.ti 1.2, + am, + da, + db, + mir, + msgr, + xenl, + xon, + cols#80, + lh#2, + lines#24, + lm#48, + lw#7, + nlab#8, + acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + bel=^G, + blink=\E[5m, + bold=\E[2;7m, + cbt=\E[Z, + clear=\E[H\E[J, + cnorm=\E[11;3|, + cr=^M, + cub1=^H, + cub=\E[%p1%dD, + cud1=\E[1B, + cud=\E[%p1%dB, + cuf1=\E[C, + cuf=\E[%p1%dC, + cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, + cuu=\E[%p1%dA, + cvvis=\E[11;2|, + dch1=\E[P, + dch=\E[%p1%dP, + dim=\E[2m, + dl1=\E[M, + dl=\E[%p1%dM, + ed=\E[0J, + el1=\E[1K, + el=\E[0K, + enacs=\E(B\E)1, + ff=^L, + home=\E[H, + hpa=\E[%p1%{1}%+%dG, + hts=\EH, + ht=\t, + ich=\E[%p1%d@, + il1=\E[L, + il=\E[%p1%dL, + ind=^J, + indn=\E[%p1%dS, + invis=\E[8m, + is1=\E(B\E)1\E[5;0|, + is3=\E[21;1|\212, + kbs=^H, + kcbt=\E[Z, + kcub1=\E[D, + kcud1=\E[B, + kcuf1=\E[C, + kcuu1=\E[A, + kf10=\EOd, + kf11=\EOe, + kf12=\EOf, + kf13=\EOg, + kf14=\EOh, + kf15=\EOi, + kf16=\EOj, + kf1=\EOm, + kf2=\EOV, + kf3=\EOu, + kf4=\ENj, + kf5=\ENe, + kf6=\ENf, + kf7=\ENh, + kf8=\E[H, + kf9=\EOc, + kind=\E[S, + kLFT=\E[u, + kri=\E[T, + kRIT=\E[v, + ll=\E#2, + mc0=\E[0i, + mc4=\E[?8i, + mc5=\E[?4i, + mgc=\E:, + nel=\EE, + pln=\E[%p1%dp%p2%:-16s, + rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, + rev=\E[7m, + ri=\EM, + rin=\E[%p1%dT, + rmacs=^O, + rmir=\E[4l, + rmkx=\E[19;0|, + rmln=\E<, + rmso=\E[m, + rmul=\E[m, + rmxon=\E[29;1|, + rs2=\E[5;0|, + sc=\E7, + sgr0=\E[m^O, + sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + smacs=^N, + smgl=\E4, + smgr=\E5, + smir=\E[4h, + smkx=\E[19;1|, + smln=\E?, + smso=\E[7m, + smul=\E[4m, + smxon=\E[29;0|, + tbc=\E[3g, + vpa=\E[%p1%{1}%+%dd, + + +ATT513|att513|513|att513-page|513-page|attis513-pfk|513bct|AT&T 513 Terminal using page mode @(#)513.ti 1.3, + am, chts, mir, msgr, xenl, xon, + cols#80, lh#2, lines#24, lw#8, nlab#8, + acsc=hrisjjkkllmmnnqqttuuvvwwxx{{||}}~~-f\,h.e+g`b, + bel=^G, blink=\E[5m, bold=\E[4;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[11;0|, cr=\r, + csr=%i\E[%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[11;1|, dch=\E[%p1%dP, dch1=\E[P$<1>, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + el1=\E[1K, enacs=\E(B\E)1, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=\t, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dE, + invis=\E[8m, + is1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l, + kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, + kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, + kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, + kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, kOPT=\EOR, kPRT=\EOZ, + kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, kRIT=\ENL, kRPL=\EOY, + kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, kbs=\b, + kcan=\EOw, kcbt=\E[Z, kclo=\EOV, kclr=\E[J, kcmd=\EOu, + kcpy=\ENd, kcrt=\EOn, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\ENf, kdl1=\ENe, + kel=\EOa, kend=\E0, kent=\Eent, kext=\EOk, kf1=\EOc, + kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, + kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, khome=\E[H, + kich1=\ENj, kind=\E[S, kmov=\ENc, kmrk=\ENi, + kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, + kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, + kres=\EOq, krfr=\ENa, kri=\E[T, krpl=\EOy, krst=\EOB, + ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, ll=\E#2, + mc0=\E[?98l\E[0i, mc4=\E[?98l\E[?8i, + mc5=\E[?98l\E[?4i, nel=\EE, + pfkey=\E[%p1%d;%p2%l%d;3;0p\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s\s%p2%s, + pfloc=\E[%p1%d;%p2%l%d;2;0p\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s\s%p2%s, + pfx=\E[%p1%d;%p2%l%d;1;0p\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s\s%p2%s, + pln=\E[%p1%dp%p2%:-16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, + rin=\E[%p1%dF, rmacs=^O, rmir=\E[4l, rmkx=\E[19;0|\E[21;1|\212, + rmln=\E<, rmso=\E[m, rmul=\E[m, + rs1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l\E[2;0|\E[6;1|\E[8;0|\E[19;0|\E[1{\E[?99l, + rs2=\E[5;0|, sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O, smacs=^N, smir=\E[4h, smkx=\E[19;1|\E[21;4|\Eent, + smln=\E?, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%p1%{1}%+%dd, + +ATT500|att500|bct500|500|BCT500|AT&T-IS 500 terminal @(#)513.ti 1.3, + use=att513, + +5310|att5310|ATT5310|AT&T 5310 hardcopy terminal @(#)5310.ti 1.1, + am, hc, os, + cols#80, + bel=^G, cr=\r, cub1=\b, cud1=\n, dch1=\E[P, dl1=\E[M, + ind=\n, kbs=\b, rmso=\E[m, smso=\E[7m, + +5320|att5320|ATT5320|AT&T 5320 hardcopy terminal @(#)5310.ti 1.1, + cols#132, use=5310, +# Info: +# 5620 terminfo (2.0 or later ROMS with char attributes) +# +# assumptions: +# ind (scroll forward one line) is only done at screen bottom +# +att5620|ATT5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns @(#)5620.ti 1.1, + npc,xon,am, cols#88, lines#70, it#8, + bel=^G, cr=^M, clear=\E[H\E[J, + ht=^I, nel=^J, +# Info: +# clear to end of line, screen +# + el=\E[K, ed=\E[J, +# Info: +# scroll screen up/down one/many lines +# + ind=\E[S, indn=\E[%p1%dS, ri=\E[T, rin=\E[%p1%dT, +# Info: +# cursor arbitrarily, down, home, left, right, up +# cup=\E[%i%p1%d;%p2%dH, home=\E[H, +# + cup=\E[%i%p1%d;%p2%dH, cud1=\E[B, home=\E[H, + cub1=^H, cuf1=\E[C, cuu1=\E[A, +# Info: +# delete/insert one/many characters/lines +# + dch1=\E[P, dch=\E[%p1%dP, dl1=\E[M, dl=\E[%p1%dM, + ich1=\E[@, ich=\E[%p1%d@, il1=\E[L, il=\E[%p1%dL, +# Info: +# sequences sent by keys: backspace, clear, down-arrow, +# home-arrow, left-arrow, home-down, right-arrow, up-arrow +# + kbs=^H, kclr=\E[2J, kcud1=\E[B, khome=\E[H, + kcub1=\E[D, kll=\E[70;1H, kcuf1=\E[C, kcuu1=\E[A, +# Info: +# program function keys, reset terminal, restore/store cursor +# position +# + pfx=\E[%p1%d;%p2%l%dq%p2%s, + rs1=\Ec, rc=\E8, sc=\E7, +# Info: +# set/clear underline/standout character attributes +# + smul=\E[4m, rmul=\E[0m, + smso=\E[7m, rmso=\E[0m, +# Info: +# reverse video, reset character attributes, pseudo-dim, +# pseudo-bold +# + rev=\E[7m, sgr0=\E[0m, + dim=\E[2m, bold=\E[2m, + +att5620-24|ATT5620-24|5620-24|dmd-24|teletype dmd 5620 in a 24x80 layer @(#)5620.ti 1.1, + lines#24, use=5620, + +att5620-34|ATT5620-34|5620-34|dmd-34|teletype dmd 5620 in a 34x80 layer @(#)5620.ti 1.1, + lines#34, use=5620, + + +#Info: +# Entries for kf15 thru kf28 refer to the shifted system pf keys. +# +# Entries for kf29 thru kf46 refer to the alternate keypad mode +# keys: = * / + 7 8 9 - 4 5 6 , 1 2 3 0 . ENTER + + +605|605bct|ATT605|att605|AT&T 605 80 column 102key keyboard @(#)605.ti 1.2, + am, + xenl, + hs, + eslok, + mir, + msgr, + xon, + cols#80, + it#8, + lh#2, + lines#24, + lw#8, + nlab#8, + wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, + blink=\E[5m, + bold=\E[1m, + cbt=\E[Z, + civis=\E[?25l, + clear=\E[H\E[J, + cnorm=\E[?25h\E[?12l, + cr=^M, + csr=\E[%i%p1%d;%p2%dr, + cup=\E[%i%p1%d;%p2%dH, + cud1=\E[B, + cub=\E[%p1%dD, + cub1=^H, + cud=\E[%p1%dB, + cuf=\E[%p1%dC, + cuf1=\E[C, + cuu=\E[%p1%dA, + cuu1=\E[A, + cvvis=\E[?12;25h, + dch1=\E[P, + dch=\E[%p1%dP, + dim=\E[2m, + dl=\E[%p1%dM, + dl1=\E[M, + ed=\E[J, + el=\E[K, + el1=\E[1K, + flash=\E[?5h$<200>\E[?5l, + fsl=\E8, + home=\E[H, + ht=\t, + ich=\E[%p1%d@, + il=\E[%p1%dL, + il1=\E[L, + ind=\ED, + invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, + is2=\E[0m^O, + is3=\E(B\E)0, + kbs=^H, + kcbt=\E[Z, + kclr=\E[2J, + kcub1=\E[D, + kcud1=\E[B, + kcuf1=\E[C, + kcuu1=\E[A, + kdch1=\E[P, + kdl1=\E[M, + kend=\E[24;1H, + kf1=\EOc, + kf2=\EOd, + kf3=\EOe, + kf4=\EOf, + kf5=\EOg, + kf6=\EOh, + kf7=\EOi, + kf8=\EOj, + kf9=\ENo, + kf10=\ENp, + kf11=\ENq, + kf12=\ENr, + kf13=\ENs, + kf14=\ENt, + kf15=\EOC, + kf16=\EOD, + kf17=\EOE, + kf18=\EOF, + kf19=\EOG, + kf20=\EOH, + kf21=\EOI, + kf22=\EOJ, + kf23=\ENO, + kf24=\ENP, + kf25=\ENQ, + kf26=\ENR, + kf27=\ENS, + kf28=\ENT, + kf29=\EOP, + kf30=\EOQ, + kf31=\EOR, + kf32=\EOS, + kf33=\EOw, + kf34=\EOx, + kf35=\EOy, + kf36=\EOm, + kf37=\EOt, + kf38=\EOu, + kf39=\EOv, + kf40=\EOl, + kf41=\EOq, + kf42=\EOr, + kf43=\EOs, + kf44=\EOp, + kf45=\EOn, + kf46=\EOM, + khome=\E[H, + kil1=\E[L, + kind=\E[S, + kich1=\E[@, + kpp=\E[V, + knp=\E[U, + kri=\E[T, + kLFT=\E[ A, + kRIT=\E[ @, + ll=\E[24H, + mc4=\E[?4i, + mc5=\E[?5i, + nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, + rev=\E[7m, + ri=\EM, + rmacs=^O, + rmir=\E[4l, + rs2=\Ec\E[?3l, + rc=\E8, + rmso=\E[m, + rmln=\E[2p, + rmul=\E[m, + sgr0=\E[m^O, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + smacs=^N, + smir=\E[4h, + smso=\E[7m, + smul=\E[4m, + smln=\E[p, + sc=\E7, + tsl=\E7\E[25;%i%p1%dx, + +605-w|605bct-w|ATT605-w|att605-w|AT&T 605-w 132 column 102 key keyboard @(#)605.ti 1.2, + cols#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, + wsl#132, + use=605, +#Info: +# Entries for kf15 thru kf28 refer to the shifted system pf keys. +# +# Entries for kf29 thru kf46 refer to the alternate keypad mode +# keys: = * / + 7 8 9 - 4 5 6 , 1 2 3 0 . ENTER +605V2|605V2bct|ATT605V2|att605V2|AT&T 605V2 80 column 102key keyboard @(#)605V2.ti 1.2, + am, + xenl, + hs, + eslok, + mir, + msgr, + xon, + cols#80, + it#8, + lh#2, + lines#24, + lw#8, + nlab#8, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, + blink=\E[5m, + bold=\E[1m, + cbt=\E[Z, + civis=\E[?25l, + clear=\E[H\E[J, + cnorm=\E[?25h\E[?12l, + cr=^M, + csr=\E[%i%p1%d;%p2%dr, + cup=\E[%i%p1%d;%p2%dH, + cud1=\E[B, + cub=\E[%p1%dD, + cub1=^H, + cud=\E[%p1%dB, + cuf=\E[%p1%dC, + cuf1=\E[C, + cuu=\E[%p1%dA, + cuu1=\E[A, + cvvis=\E[?12;25h, + dch1=\E[P, + dch=\E[%p1%dP, + dim=\E[2m, + dl=\E[%p1%dM, + dl1=\E[M, + ed=\E[J, + el=\E[K, + el1=\E[1K, + flash=\E[?5h$<200>\E[?5l, + fsl=\E8, + home=\E[H, + ht=\t, + ich=\E[%p1%d@, + il=\E[%p1%dL, + il1=\E[L, + ind=\ED, + invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, + is2=\E[0m^O, + is3=\E(B\E)0, + kbs=^H, + kcbt=\E[Z, + kclr=\E[2J, + kcub1=\E[D, + kcud1=\E[B, + kcuf1=\E[C, + kcuu1=\E[A, + kdch1=\E[P, + kdl1=\E[M, + kend=\E[24;1H, + kf1=\EOc, + kf2=\EOd, + kf3=\EOe, + kf4=\EOf, + kf5=\EOg, + kf6=\EOh, + kf7=\EOi, + kf8=\EOj, + kf9=\ENo, + kf10=\ENp, + kf11=\ENq, + kf12=\ENr, + kf13=\ENs, + kf14=\ENt, + kf15=\EOC, + kf16=\EOD, + kf17=\EOE, + kf18=\EOF, + kf19=\EOG, + kf20=\EOH, + kf21=\EOI, + kf22=\EOJ, + kf23=\ENO, + kf24=\ENP, + kf25=\ENQ, + kf26=\ENR, + kf27=\ENS, + kf28=\ENT, + kf29=\EOP, + kf30=\EOQ, + kf31=\EOR, + kf32=\EOS, + kf33=\EOw, + kf34=\EOx, + kf35=\EOy, + kf36=\EOm, + kf37=\EOt, + kf38=\EOu, + kf39=\EOv, + kf40=\EOl, + kf41=\EOq, + kf42=\EOr, + kf43=\EOs, + kf44=\EOp, + kf45=\EOn, + kf46=\EOM, + khome=\E[H, + kil1=\E[L, + kich1=\E[@, + kpp=\E[V, + knp=\E[U, + kLFT=\E[ A, + kRIT=\E[ @, + ll=\E[24H, + nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, + rev=\E[7m, + ri=\EM, + rmacs=\E)B^O, + rmir=\E[4l, + rs2=\Ec\E[?3l, + rc=\E8, + rmso=\E[m, + rmln=\E[2p, + rmul=\E[m, + sgr0=\E[m^O, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + smacs=\E)0^N, + smir=\E[4h, + smso=\E[7m, + smul=\E[4m, + smln=\E[p, + sc=\E7, + tsl=\E7\E[25;%i%p1%dx, + tbc=\E[3g, + fln=4\,4, + hts=\EH, + swidm=\E#6, + mc0=\E[i, + mc4=\E[?4i, + mc5=\E[?5i, +605V2-w|605V2bct-w|ATT605V2-w|att605V2-w|AT&T 605V2-w 132 column 102 key keyboard @(#)605V2.ti 1.2, + cols#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, + use=605V2, +610|610bct|ATT610|att610|AT&T 610; 80 column; 98key keyboard @(#)610.ti 1.5, + am, + xenl, + hs, + eslok, + mir, + msgr, + xon, + cols#80, + it#8, + lh#2, + lines#24, + lw#8, + nlab#8, + wsl#80, + cbt=\E[Z, + bel=^G, + cr=^M, + csr=\E[%i%p1%d;%p2%dr, + clear=\E[H\E[J, + el=\E[K, + ed=\E[J, + cup=\E[%i%p1%d;%p2%dH, + cud1=\E[B, + home=\E[H, + civis=\E[?25l, + cub1=^H, + cnorm=\E[?25h\E[?12l, + cuf1=\E[C, + ll=\E[24H, + cuu1=\E[A, + cvvis=\E[?12;25h, + dch1=\E[P, + dl1=\E[M, + smacs=^N, + blink=\E[5m, + bold=\E[1m, + dim=\E[2m, + smir=\E[4h, + ich=\E[%p1%d@, + invis=\E[8m, + rev=\E[7m, + smso=\E[7m, + smul=\E[4m, + rmacs=^O, + sgr0=\E[m^O, + rmir=\E[4l, + rmso=\E[m, + rmul=\E[m, + flash=\E[?5h$<200>\E[?5l, + fsl=\E8, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, + is2=\E[0m^O, + is3=\E(B\E)0, + il1=\E[L, + kbs=^H, + kclr=\E[2J, + kcud1=\E[B, + kf1=\EOc, + kf2=\EOd, + kf3=\EOe, + kf4=\EOf, + kf5=\EOg, + kf6=\EOh, + kf7=\EOi, + kf8=\EOj, + kf9=\ENo, + kf10=\ENp, + kf11=\ENq, + kf12=\ENr, + kf13=\ENs, + kf14=\ENt, + khome=\E[H, + kcub1=\E[D, + kcuf1=\E[C, + kind=\E[S, + kri=\E[T, + kcuu1=\E[A, + nel=\EE, + dch=\E[%p1%dP, + dl=\E[%p1%dM, + cud=\E[%p1%dB, + il=\E[%p1%dL, + cub=\E[%p1%dD, + cuf=\E[%p1%dC, + cuu=\E[%p1%dA, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + mc4=\E[?4i, + mc5=\E[?5i, + rs2=\Ec\E[?3l, + rc=\E8, + sc=\E7, + ind=\ED, + ri=\EM, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + ht=\t, + tsl=\E7\E[25;%i%p1%dx, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, + kcbt=\E[Z, + smln=\E[p, + rmln=\E[2p, + kLFT=\E[ @, + kRIT=\E[ A, + el1=\E[1K, +610-w|610bct-w|ATT610-w|att610-w|AT&T 610; 132 column; 98key keyboard @(#)610.ti 1.5, + cols#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + wsl#132, + use=610, +610-103k|610bct-103k|ATT610-103k|att610-103k|AT&T 610; 80 column; 103key keyboard @(#)610.ti 1.5, + kf9@, + kf10@, + kf11@, + kf12@, + kf13@, + kf14@, + kdch1=\ENf, + kdl1=\ENe, + kel=\EOa, + kich1=\ENj, + krmir=\ENj, + knp=\E[U, + kpp=\E[V, + kbeg=\E9, + kcan=\EOw, + kclo=\EOV, + kcmd=\EOu, + kcpy=\ENd, + kcrt=\EOn, + kend=\E0, + kext=\EOk, + kfnd=\EOx, + khlp=\EOm, + kmrk=\ENi, + kmsg=\EOl, + kmov=\ENc, + knxt=\ENh, + kopn=\EOv, + kopt=\EOr, + kprt=\EOz, + kprv=\ENg, + krdo=\EOt, + kref=\EOb, + krfr=\ENa, + krpl=\EOy, + krst=\EOB, + kres=\EOq, + ksav=\EOo, + kspd=\EOp, + kund=\EOs, + kBEG=\ENB, + kCAN=\EOW, + kCMD=\EOU, + kCPY=\END, + kCRT=\EON, + kDC=\ENF, + kDL=\ENE, + kslt=\ENI, + kEND=\ENN, + kEOL=\EOA, + kEXT=\EOK, + kFND=\EOX, + kHLP=\EOM, + kMSG=\EOL, + kMOV=\ENC, + kNXT=\ENH, + kOPT=\EOR, + kPRT=\EOZ, + kPRV=\ENG, + kRDO=\EOT, + kRPL=\EOY, + kRES=\EOQ, + kSAV=\EOO, + kSPD=\EOP, + kUND=\EOS, + use=610, +610-103k-w|610bct-103k-w|ATT610-103k-w|att610-103k-w|AT&T 610; 132 column; 103key keyboard @(#)610.ti 1.5, + cols#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + wsl#132, + use=610-103k, +615|615mt|ATT615|att615|AT&T 615; 80 column; 98key keyboard @(#)615.ti 1.4, +# add sequences for changing flow control setting + smxon=\E[?21;29h, + rmxon=\E[?21l, +# modify initialization string font setting to match terminal on power-up + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B, +# add print screen not in previous versions of 615 MT + mc0=\E[i, +# add shifted HOME key + kHOM=\ENM, + kLFT=\E[ A, + kRIT=\E[ @, + kf15=\EOC, + kf16=\EOD, + kf17=\EOE, + kf18=\EOF, + kf19=\EOG, + kf20=\EOH, + kf21=\EOI, + kf22=\EOJ, + kf23=\ENO, + kf24=\ENP, + kf25=\ENQ, + kf26=\ENR, + kf27=\ENS, + kf28=\ENT, + kf29=\EOP, + kf30=\EOQ, + kf31=\EOR, + kf32=\EOS, + kf33=\EOw, + kf34=\EOx, + kf35=\EOy, + kf36=\EOm, + kf37=\EOt, + kf38=\EOu, + kf39=\EOv, + kf40=\EOl, + kf41=\EOq, + kf42=\EOr, + kf43=\EOs, + kf44=\EOp, + kf45=\EOn, + kf46=\EOM, + use=610, +615-w|615mt-w|ATT615-w|att615-w|AT&T 615; 132 column; 98key keyboard @(#)615.ti 1.4, +# add sequences for changing flow control setting + smxon=\E[?21;29h, + rmxon=\E[?21l, +# modify initialization string font setting to match terminal on power-up + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)B, +# add print screen not in previous versions of 615 MT + mc0=\E[i, +# add shifted HOME key + kHOM=\ENM, + kLFT=\E[ A, + kRIT=\E[ @, + kf15=\EOC, + kf16=\EOD, + kf17=\EOE, + kf18=\EOF, + kf19=\EOG, + kf20=\EOH, + kf21=\EOI, + kf22=\EOJ, + kf23=\ENO, + kf24=\ENP, + kf25=\ENQ, + kf26=\ENR, + kf27=\ENS, + kf28=\ENT, + kf29=\EOP, + kf30=\EOQ, + kf31=\EOR, + kf32=\EOS, + kf33=\EOw, + kf34=\EOx, + kf35=\EOy, + kf36=\EOm, + kf37=\EOt, + kf38=\EOu, + kf39=\EOv, + kf40=\EOl, + kf41=\EOq, + kf42=\EOr, + kf43=\EOs, + kf44=\EOp, + kf45=\EOn, + kf46=\EOM, + use=610-w, +615-103k|615mt-103k|ATT615-103k|att615-103k|AT&T 615; 80 column; 103key keyboard @(#)615.ti 1.4, +# add sequences for changing flow control setting + smxon=\E[?21;29h, + rmxon=\E[?21l, +# modify initialization string font setting to match terminal on power-up + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B, +# add print screen not in previous versions of 615 MT + mc0=\E[i, +# remove shifted HOME key added for 615 with 98-key keyboard + kHOM@, + kLFT=\E[ A, + kRIT=\E[ @, + use=610-103k, +615-103k-w|615mt-103k-w|ATT615-103k-w|att615-103k-w|AT&T 615; 132 column; 103key keyboard @(#)615.ti 1.4, +# add sequences for changing flow control setting + smxon=\E[?21;29h, + rmxon=\E[?21l, +# modify initialization string font setting to match terminal on power-up + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)B, +# add print screen not in previous versions of 615 MT + mc0=\E[i, +# remove shifted HOME key added for 615 with 98-key keyboard + kHOM@, + kLFT=\E[ A, + kRIT=\E[ @, + use=610-103k-w, +# +# AT&T 615CMT - Color Multitasking Terminal - default is 102 keyboard +# +615CMT-102k|615cmt-102k|A615CMT-102k|a615CMT-102k|AT&T 615 CMT color multitasking terminal; 80 column; 102 key keyboard @(#)615CMT.ti 1.4, + colors#8,pairs#64, +# all attributes supported except protect +# with bold mapped to cyan, dim to blue, and standout as for the 615 MT +# +# color terminfo escape sequence parameters +# parameters foreground background +# +# black 0 30 40 +# blue 1 34 44 +# green 2 32 42 +# cyan 3 36 46 +# red 4 31 41 +# magenta 5 35 45 +# yellow 6 33 43 +# white 7 37 47 +# default - 39 49 +# +# initial color always white foreground on black background + op=\E[37;40m, + sgr0=\E[m^O, +# set for foreground and background color variable + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%{7}%>%t9%e%p1%d%;m, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%{7}%>%t9%e%p1%d%;m, +# +# attribute terminfo parameter escape sequence parameter + +# none 0 0 +# standout 1 7 (reverse) +# underline 2 4 +# reverse 3 7 +# blink 4 5 +# dim 5 34 (blue) +# bold 6 36 (cyan) +# invisible 7 8 +# protect 8 not supported +# altcharset 9 no sequence - SO for on, SI for off +# +# modify sgr from 615 MT for dim and bold + sgr=\E[0%?%p6%t;36%;%?%p5%t;34%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + bold=\E[36m, + dim=\E[34m, +# add keys for 102 key keyboard not on 98 key keyboard + kdch1=\E[P, + kdl1=\E[M, + kend=\E[24;1H, + kich1=\E[@, + kil1=\E[L, + knp=\E[U, + kpp=\E[V, +# remove key for 98 key keyboard not on 102 key keyboard + kHOM@, +# add sequences for changing flow control setting + smxon=\E[?21;29h, + rmxon=\E[?21l, +# modify initialization string font setting + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B, +# add some enhancements not in previous versions for 615 MT + mc0=\E[i, +# all other controls are the same as the 615 MT + use=att615, +# +# AT&T 615CMT - Color Multitasking Terminal - default is 98 keyboard +# +615CMT-98k|615cmt-98k|A615CMT-98k|a615CMT-98k|AT&T 615 CMT color multitasking terminal; 80 column; 98 key keyboard @(#)615CMT.ti 1.4, + kHOM=\ENM, + kdch1@, + kdl1@, + kend@, + kich1@, + kil1@, + knp@, + kpp@, + use=615CMT-102k, +# +# AT&T 615CMT - Color Multitasking Terminal - default is 102 keyboard +# and wide columns +# +615CMT-102k-w|615cmt-102k-w|A615CMT-102k-w|a615CMT-102k-w|AT&T 615 CMT color multitasking terminal; 132 column; 102 key keyboard @(#)615CMT.ti 1.4, + cols#132, + wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)B, + use=615CMT-102k, +# +# AT&T 615CMT - Color Multitasking Terminal - default is 98 keyboard +# and wide columns +# +615CMT-98k-w|615cmt-98k-w|A615CMT-98k-w|a615CMT-98k-w|AT&T 615 CMT color multitasking terminal; 132 column; 98 key keyboard @(#)615CMT.ti 1.4, + cols#132, + wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)B, + kHOM=\ENM, + kdch1@, + kdl1@, + kend@, + kich1@, + kil1@, + knp@, + kpp@, + use=615CMT-102k, +620|620mtg|ATT620|att620|AT&T 620; 80 column; 98key keyboard @(#)620.ti 1.5, + am, + xenl, + hs, + eslok, + mir, + msgr, + xon, + cols#80, + it#8, + lh#2, + lines#24, + lw#8, + nlab#8, + wsl#80, + cbt=\E[Z, + bel=^G, + cr=^M, + csr=\E[%i%p1%d;%p2%dr, + clear=\E[H\E[J, + el=\E[K, + ed=\E[J, + cup=\E[%i%p1%d;%p2%dH, + cud1=\E[B, + home=\E[H, + civis=\E[?25l, + cub1=^H, + cnorm=\E[?25h\E[?12l, + cuf1=\E[C, + ll=\E[24H, + cuu1=\E[A, + cvvis=\E[?12;25h, + dch1=\E[P, + dl1=\E[M, + smacs=^N, + blink=\E[5m, + bold=\E[1m, + smir=\E[4h, + ich=\E[%p1%d@, + invis=\E[8m, + rev=\E[7m, + smso=\E[7m, + smul=\E[4m, + rmacs=^O, + sgr0=\E[m^O, + rmir=\E[4l, + rmso=\E[m, + rmul=\E[m, + flash=\E[?5h$<200>\E[?5l, + fsl=\E8, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h, + is2=\E[0m^O, + is3=\E(B\E)0, + il1=\E[L, + kbs=^H, + kclr=\E[2J, + kcud1=\E[B, + kf1=\EOc, + kf2=\EOd, + kf3=\EOe, + kf4=\EOf, + kf5=\EOg, + kf6=\EOh, + kf7=\EOi, + kf8=\EOj, + kf9=\ENo, + kf10=\ENp, + kf11=\ENq, + kf12=\ENr, + kf13=\ENs, + kf14=\ENt, + kf15=\EOC, + kf16=\EOD, + kf17=\EOE, + kf18=\EOF, + kf19=\EOG, + kf20=\EOH, + kf21=\EOI, + kf22=\EOJ, + kf23=\ENO, + kf24=\ENP, + kf25=\ENQ, + kf26=\ENR, + kf27=\ENS, + kf28=\ENT, + kf29=\EOP, + kf30=\EOQ, + kf31=\EOR, + kf32=\EOS, + kf33=\EOw, + kf34=\EOx, + kf35=\EOy, + kf36=\EOm, + kf37=\EOt, + kf38=\EOu, + kf39=\EOv, + kf40=\EOl, + kf41=\EOq, + kf42=\EOr, + kf43=\EOs, + kf44=\EOp, + kf45=\EOn, + kf46=\EOM, + khome=\E[H, + kcub1=\E[D, + kcuf1=\E[C, + kind=\E[S, + kri=\E[T, + kcuu1=\E[A, + nel=\EE, + dch=\E[%p1%dP, + dl=\E[%p1%dM, + cud=\E[%p1%dB, + il=\E[%p1%dL, + cub=\E[%p1%dD, + cuf=\E[%p1%dC, + cuu=\E[%p1%dA, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + mc4=\E[?4i, + mc5=\E[?5i, + rs2=\Ec\E[?3l, + rc=\E8, + sc=\E7, + ind=\ED, + ri=\EM, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t;2%;%?%p3%p1%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + ht=\t, + tsl=\E7\E[25;%i%p1%dx, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, + kcbt=\E[Z, + smln=\E[p, + rmln=\E[2p, + kLFT=\E[ A, + kRIT=\E[ @, + el1=\E[1K, +620-w|620mtg-w|ATT620-w|att620-w|AT&T 620; 132 column; 98key keyboard @(#)620.ti 1.5, + cols#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + wsl#132, + use=620, +620-103k|620mtg-103k|ATT620-103k|att620-103k|AT&T 620; 80 column; 103key keyboard @(#)620.ti 1.5, + kf9@, + kf10@, + kf11@, + kf12@, + kf13@, + kf14@, + kf15@, + kf16@, + kf17@, + kf18@, + kf19@, + kf20@, + kf21@, + kf22@, + kf23@, + kf24@, + kf25@, + kf26@, + kf27@, + kf28@, + kf29@, + kf30@, + kf31@, + kf32@, + kf33@, + kf34@, + kf35@, + kf36@, + kf37@, + kf38@, + kf39@, + kf40@, + kf41@, + kf42@, + kf43@, + kf44@, + kf45@, + kf46@, + kdch1=\ENf, + kdl1=\ENe, + kel=\EOa, + kich1=\ENj, + krmir=\ENj, + knp=\E[U, + kpp=\E[V, + kbeg=\E9, + kcan=\EOw, + kclo=\EOV, + kcmd=\EOu, + kcpy=\ENd, + kcrt=\EOn, + kend=\E0, + kext=\EOk, + kfnd=\EOx, + khlp=\EOm, + kmrk=\ENi, + kmsg=\EOl, + kmov=\ENc, + knxt=\ENh, + kopn=\EOv, + kopt=\EOr, + kprt=\EOz, + kprv=\ENg, + krdo=\EOt, + kref=\EOb, + krfr=\ENa, + krpl=\EOy, + krst=\EOB, + kres=\EOq, + ksav=\EOo, + kspd=\EOp, + kund=\EOs, + kBEG=\ENB, + kCAN=\EOW, + kCMD=\EOU, + kCPY=\END, + kCRT=\EON, + kDC=\ENF, + kDL=\ENE, + kslt=\ENI, + kEND=\ENN, + kEOL=\EOA, + kEXT=\EOK, + kFND=\EOX, + kHLP=\EOM, + kMSG=\EOL, + kMOV=\ENC, + kNXT=\ENH, + kOPT=\EOR, + kPRT=\EOZ, + kPRV=\ENG, + kRDO=\EOT, + kRPL=\EOY, + kRES=\EOQ, + kSAV=\EOO, + kSPD=\EOP, + kUND=\EOS, + use=620, +620-103k-w|620mtg-103k-w|ATT620-103k-w|att620-103k-w|AT&T 620; 132 column; 103key keyboard @(#)620.ti 1.5, + cols#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + wsl#132, + use=620-103k, + +############################################################## +# +# 630 terminfo +# +# +630|att630|5630|5630DMD|630MTG|AT&T 630 windowing terminal @(#)630.ti 1.5, + am, da, db, mir, msgr, npc, xon, + cols#80, it#8, lines#60, lm#0, +# +# short descriptions without \E +# + bel=^G, cr=\r, ht=\t, nel=\r\n, +# +# cursor movement +# + cuu1=\E[A, cud1=\E[B, cuf1=\E[C, cub1=\b, + cuu=\E[%p1%dA, cud=\E[%p1%dB, cuf=\E[%p1%dC, cub=\E[%p1%dD, + cup=\E[%i%p1%d;%p2%dH, + home=\E[H, + cbt=\E[Z, +# +# scrolling +# + ind=\ED, ri=\EM, + indn=\E[%p1%dS, rin=\E[%p1%dT, +# +# character attributes +# + smul=\E[4m, rmul=\E[m, + smso=\E[7m, rmso=\E[m, + rev=\E[7m, + sgr=\E[0%?%p2%t;4%;%?%p1%p3%|%p4%|%p5%|%t;7%;m, + sgr0=\E[m, +# +# clear +# + el=\E[K, el1=\E[1K, ed=\E[J, clear=\E[H\E[J, +# +# insert/delete +# + dch1=\E[P, dl1=\E[M, il1=\E[L, + dch=\E[%p1%dP, dl=\E[%p1%dM, il=\E[%p1%dL, ich=\E[%p1%d@, + smir=\E[4h, rmir=\E[4l, +# +# pf string +# + pfx=\E[%p1%d;%p2%l%dq%p2%s, +# +# set/reset +# + sc=\E7, rc=\E8, + is2=\E[m, rs2=\Ec, +# +# printer +# + mc4=\E[?4i, mc5=\E[?5i, +# +# keyboard definitions +# + kbs=\b, kclr=\E[2J, khome=\E[H, kcbt=\E[Z, + kcuu1=\E[A, kcud1=\E[B, kcuf1=\E[C, kcub1=\E[D, + kf9=\ENo, kf10=\ENp, kf11=\ENq, + kf12=\ENr, kf13=\ENs, kf14=\ENt, +# +# the following keys are used only by the 122 key keyboard +# + kdch1=\E[P, kdl1=\E[M, + kich1=\E[@, kil1=\E[L, + kf15=\ENu, kf16=\ENv, kf17=\ENw, + kf18=\ENx, kf19=\ENy, kf20=\ENz, + kf21=\EN{, kf22=\EN|, kf23=\EN}, + kf24=\EN~, + + +630-24|att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines @(#)630.ti 1.5, + lines#24, use=630, + + +6300+|PC6300PLUS|pc6300plus|6300plus|6300PLUS|AT&T-IS PC 6300 PLUS Personal Computer @(#)6300+.ti 1.1, + am, + cols#80, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, + cr=\r, cub1=\b, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%02d;%p2%02dH, cuu1=\E[A, dch1=\E[1P, + dim=\E[2m, dl1=\E[1M, ed=\E[0J, el=\E[0K, home=\E[H, + hts=\EH, ich1=\E[1@, il1=\E[1L, ind=\n, invis=\E[9m, + kbs=\b, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\EOu, kf2=\EOd, kf3=\EOe, + kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kf9=\EOk, nel=\r\n, rev=\E[7m, rmso=\E[m, rmul=\E[m, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, +# +# Info: +# TERMINFO entry for the AT&T Unix PC 7300 +# from escape(7) in Unix PC 7300 Manual. +# Somewhat similar to a vt100-am (but different enough +# to redo this from scratch.) +# Info: +# /*************************************************************** +# * +# * FONT LOADING PROGRAM FOR THE UNIX PC +# * +# * This routine loads a font defined in the file ALTFONT +# * into font memory slot #1. Once the font has been loaded, +# * it can be used as an alternative character set. +# * +# * The call to ioctl with the argument WIOCLFONT is the key +# * to this routine. For more information, see window(7) in +# * the PC 7300 documentation. +# ***************************************************************/ +# #include /* needed for strcpy call */ +# #include /* needed for ioctl call */ +# #define FNSIZE 60 /* font name size */ +# #define ALTFONT "/usr/lib/wfont/special.8.ft" /* font file */ +# /* +# * The file /usr/lib/wfont/special.8.ft comes with the +# * standard PC software. It defines a graphics character set +# * similar to that of the Teletype 5425 terminal. To view +# * this or other fonts in /usr/lib/wfont, use the command +# * cfont . For further information on fonts see +# * cfont(1) in the PC 7300 documentation. +# */ +# +# struct altfdata /* structure for alt font data */ +# { +# short altf_slot; /* memory slot number */ +# char altf_name[FNSIZE]; /* font name (file name) */ +# }; +# ldfont() +# { +# int wd; /* window in which altfont will be */ +# struct altfdata altf; +# altf.altf_slot=1; +# strcpy(altf.altf_name,ALTFONT); +# for (wd =1; wd < 12; wd++) { +# ioctl(wd, WIOCLFONT,&altf); +# } +# } +# +7300|unixpc|pc7300|PC7300|unix_pc|AT&T UNIX PC Model 7300 @(#)7300.ti 1.2, + am, xon, + cols#80, it#8, lines#24, + bel=^G, bold=\E[7m, cbt=\E\t, clear=\E[2J\E[H, cr=\r, + cub=\E[%p1%dD, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, il=\E[%p1%dL, + il1=\E[L, ind=\n, is1=^O, kBEG=\EBG, kCAN=\ECN, kCPY=\ECP, + kCRT=\ECR, kDC=\EDC, kDL=\EDL, kEND=\EEN, kEOL=\ECI, + kFND=\EFI, kHLP=\EHL, kHOM=\EHM, kIC=\ENJ, kLFT=\EBW, + kMOV=\EMV, kNXT=\ENX, kOPT=\EOT, kPRV=\EPV, kRDO=\ERO, + kRIT=\EFW, kRPL=\ERP, kSAV=\ESV, kUND=\EUD, kbeg=\Ebg, + kbs=\b, kcan=\Ecn, kcbt=\E\t, kclo=\Ecl, kclr=\Ece, + kcmd=\Ecm, kcpy=\Ecp, kcrt=\Ecr, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\Edc, + ked=\Ece, kel=\Eci, kend=\Een, kext=\Eex, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E5, kf6=\E6, + kf7=\E7, kf8=\E8, kfnd=\Efi, khlp=\Ehl, khome=\Ehm, + kich1=\Eim, kind=\Erd, kmov=\Emv, kmrk=\Emk, knp=\Epg, + knxt=\Enx, kopn=\Eop, kopt=\Eot, kpp=\EPG, kprt=\Epr, + kprv=\Epv, krdo=\Ero, kref=\Ere, krfr=\Erf, kri=\Eru, + krpl=\Erp, krst=\Ers, ksav=\Esv, kslt=\Esl, kund=\Eud, + nel=\EE, rev=\E[7m, ri=\EM, rmacs=\E[10m, rmso=\E[0m, + rmul=\E[0m, sgr0=\E[0;10m, smacs=\E[11m, smso=\E[7m, + smul=\E[4m, +blit|jerq|blit running teletype rom @(#)blit.ti 1.1, + xon,cr=^M, ind=^J, bel=^G, am, ht=^I, it#8, ul, eo, + cud1=^J, cuf1=\EC, cuu1=\EA, cub1=\ED, + cols#87, lines#72, clear=^L, el=\EK, + cup=\EY%p2%' '%+%c%p1%' '%+%c, + il1=\EF!, dl1=\EE!, ich1=\Ef!, dch1=\Ee!, + il=\EF%p1%' '%+%c, dl=\EE%p1%' '%+%c, + ich=\Ef%p1%' '%+%c, dch=\Ee%p1%' '%+%c, + kcuu1=\EA, kcud1=\EB, kcuf1=\EC, kcub1=\ED, kbs=^H, + kf1=\Ex, kf2=\Ey, kf3=\Ez, + +cbblit|fixterm|blit running columbus code @(#)blit.ti 1.1, + smso=\EU!, rmso=\EV!, smul=\EU", rmul=\EV", + flash=\E^G, ed=\EJ, smir=\EQ, rmir=\ER, ich1@, cols#88, + mc5=^R, mc4=^T, mc5p=\EP%p1%03d, use=blit, + +oblit|ojerq|first version of blit rom @(#)blit.ti 1.1, + xon,cr=^M, cud1=^J, ind=^J, bel=^G, cols#88, lines#72, it#8, ht=^I, + am, ul, eo, mir, il=\Ef%p1%' '%+%c, dl=\Ee%p1%' '%+%c, + dl1=\EE, rmir=\ER, smir=\EQ, dch1=\EO, cub1=\ED, da, db, + il1=\EF, ed=\EJ, el=\EK, clear=^L, cup=\EY%p2%' '%+%c%p1%' '%+%c, + cuf1=\EC, cuu1=\EA, flash=\E^G, kbs=^H, + +# Info: +# This is an old version of vitty reentered. It is used when +# running the vitty program outside a blit layer. +# + +blitlayer|vitty| @(#)blit.ti 1.1, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#87, lines#72, it#8, ht=^I, + am, clear=^L, cup=\EY%p2%' '%+%c%p1%' '%+%c, el=\EK, il1=\EI, dl1=\ED, + flash=\E^G, cuu1=^K, + +# Info: +# +# This is a generic terminal for the new AT&T terminals that is not +# really for use by itself, but was created to help make the +# support for the other new terminals easier by defining the +# common entry fields only once. There are several things +# that weren't defined here but were common to 2 or more terminal +# entries because they were different in at least 2 of the other +# entries (e.g. clear, cols, cud1, ht, ind, and lines). +# Unfortunately the 4424 has almost completely different data +# for the fields than what the newer ones have and so hasn't been +# included as one of the terminals using this common entry. +# +attgeneric| AT&T generic terminal description @(#)generic.ti 1.2, + am, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, + wsl#55, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[4;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[12;0j, cr=\r, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[12;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, + ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, + ht=\t, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dE, + invis=\E[8m, is1=\E<\E[?3l$<100>, + is2=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212, + is3=\E[?5l, kbeg=\Et, kbs=\b, kcbt=\E[Z, kclr=\E[2J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[P, kdl1=\E[M, kel=\E[2K, kend=\Ez, kent=\n, + kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, khome=\E[H, kich1=\E[4h, + kil1=\E[L, kind=\E[T, kprt=\EOe, kri=\E[S, ll=\E[24H, + mc0=\E[?2i, mc4=\E[?9i, mc5=\E[?4i, nel=\r\n, + pfx=\E[%p1%d;%p2%l%02dq\s\s\sF%p1%1d\s\s\s\s\s\s\s\s\s\s\s%p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, + rmir=\E[4l, rmkx=\E[21;0j, rmln=\E|, rmso=\E[m, + rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O, smacs=^N, smir=\E[4h, smkx=\E[21;1j\E~, + smln=\E~, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, + +netty| @(#)netty.ti 1.2, + smcup=\EC@\EI@\EU@\ER@\EW@\EP@\E{A\E[@\E#A\EXA, rmcup=\E{@\E#@\EX@, + use=netty-Tabs, + +netty-vi| @(#)netty.ti 1.2, + smcup=\EC@\EI@\EU@\ER@\EW@\EP@\E{A\E[A\E#B\EX@, rmcup=\E{@\E[@\E#@, + use=netty-Tabs, + +netty-Tabs| @(#)netty.ti 1.2, + am, + hs, + mir, + msgr, + it#8, + acsc=jjkkllmmqqxx, + bel=^G, + cr=^M, + clear=^L, + el=\EZ, + cup=\EY%p2%?%p2%{95}%>%t^A%{96}%-%;%' '%+%c%p1%?%p1%{95}%>%t^A%{96}%-%;%' '%+%c, + home=\EY\s\s, + cub1=^H, + cud1=^J, + cuu1=\EA, + dch1=\Ed, + dl1=\ED!, + fsl=^A, + smacs=\ECA, rmacs=\EC@, + smcup=\EC@\EI@\EU@\ER@\EW@\EP@\E{A\E[@\EX@\E#C\EM@!!, rmcup=\E{@\E#@, + smcup=\E{A, rmcup=\E{@, + smir=\EIA, rmir=\EI@, + smul=\EUA, rmul=\EU@, + smso=\ERA, rmso=\ER@, + sgr0=\EC@\EI@\EU@\ER@, + il1=\EO!, + is3=\EF@^A^XOE^A\EFA^A^XOF^A\EFB^A^XOG^A\EFC^A^XOH^A\EFD^A^XOI^A\EFE^A^XOJ^A\EFF^A^XOK^A\EFG^A^XOL^A\EFH^A^XOM^A\EFI^A^XON^A\EFK^A^XOO^A, + kcud1=^XOB, + kf1=^XOE, + kf2=^XOF, + kf3=^XOG, + kf4=^XOH, + kf5=^XOI, + kf6=^XOJ, + kf7=^XOK, + kf8=^XOL, + kclr=^XOM, + khome=^XON, + kll=^XOO, + kcub1=^XOC, + kcuf1=^XOD, + kcuu1=^XOA, + dl=\ED%p1%' '%+%c, + indn=\ES%p1%' '%+%c, + ind=\n, + il=\EO%p1%' '%+%c, + ht=\t, + cols#80, + lines#24, +# Info: +# wind=\Ev%p1%' '%+%c%p3%' '%+%c%p2%' '%+%c%p4%' '%+%c, loses bad +# rev=^N, standout seems to work better +# + tsl=\Eb^A, + +# +# The following Terminfo entry describes functions which are supported by +# the AT&T 5430/pt505 terminal software version 2 and later. +# +# The following represents the screen layout along with the associated +# bezel buttons for the 5430/pt505 terminal. The "kf" designations do +# not appear on the screen but are shown to reference the bezel buttons. +# The "CMD", "MAIL", and "REDRAW" buttons are shown in their approximate +# position relative to the screen. +# +# +# +# +----------------------------------------------------------------+ +# | | +# XXXX | kf0 kf24 | XXXX +# | | +# | | +# XXXX | kf1 kf23 | XXXX +# | | +# | | +# XXXX | kf2 kf22 | XXXX +# | | +# | | +# XXXX | kf3 kf21 | XXXX +# | | +# | | +# XXXX | kf4 kf20 | XXXX +# | | +# | | +# XXXX | kf5 kf19 | XXXX +# | | +# | | +# XXXX | kf6 kf18 | XXXX +# | | +# | | +# XXXX | | XXXX +# | | +# | | +# +----------------------------------------------------------------+ +# +# XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX +# +# Note: XXXX represents the screen buttons +# CMD REDRAW +# +# MAIL +# +# Depression of the "CMD" key sends \E! (kcmd) +# Depression of the "MAIL" key sends \E[26s (kf26) +# "REDRAW" same as "REFRESH" (krfr) +# +# +# "kf" functions adds carriage return to output string if terminal is in +# 'new line' mode. +# +# The following are functions not covered in the table above: +# +# Set keyboard character (SKC): +# +# \EPn1;Pn2w +# +# Pn1= 0 Back Space key +# Pn1= 1 Break key +# Pn2= Program char (hex) +# +# Screen Definition (SDF): +# +# \E[Pn1;Pn2;Pn3;Pn4;Pn5t +# +# Pn1= Window number (1-39) +# Pn2-Pn5= Y;X;Y;X coordinates +# +# Screen Selection (SSL): +# +# \E[Pnu +# +# Pn= Window number +# +# Set Terminal Modes (SM): +# +# \E[Pnh +# +# Pn= 3 Graphics mode +# Pn= > Cursor blink +# Pn= < Enter new line mode +# Pn= = Enter reverse insert/replace mode +# Pn= ? Enter no scroll mode +# +# Reset Terminal Mode (RM): +# +# \E[Pnl +# +# Pn= 3 Exit graphics mode +# Pn= > Exit cursor blink +# Pn= < Exit new line mode +# Pn= = Exit reverse insert/replace mode +# Pn= ? Exit no scroll mode +# +# Screen Status Report (SSR): +# +# \E[Pnp +# +# Pn= 0 Request current window number +# Pn= 1 Request current window dimensions +# +# Device Status Report (DSR): +# +# \E[6n Request cursor position +# +# Call Status Report (CSR): +# +# \E[Pnv +# +# Pn= 0 Call failed +# Pn= 1 Call successful +# +# Transparent Button String (TBS): +# +# \E[Pn1;Pn2;Pn3;{string +# +# Pn1= Button number to be loaded +# Pn2= Character count of "string" +# Pn3= Key mode being loaded: +# 0= Unshifted +# 1= Shifted +# 2= Control +# String= Text string (15 chars max) +# +# Screen Number Report (SNR): +# +# \E[Pnp +# +# Pn= Screen number +# +# Screen Dimension Report (SDR): +# +# \E[Pn1;Pn2r +# +# Pn1= Number of rows available in window +# Pn2= Number of columns available in window +# +# Cursor Position Report (CPR): +# +# \E[Pn1;Pn2R +# +# Pn1= "Y" Position of cousor +# Pn2= "X" Position of cursor +# +# Request Answer Back (RAB): +# +# \E[c +# +# Answer Back Response (ABR): +# +# \E[?;*;30;VSV +# +# *= 0 No printer available +# *= 2 Printer available +# V= Software version number +# SV= Software sub version number +# +# Screen Alingment Aid: +# +# \En +# +# Bell (lower pitch): +# +# \E[x +# +# Dial Phone Number: +# +# \EPdstring\ +# +# string= Phone number to be dialed +# +# Set Phone Labels: +# +# \EPpstring\ +# +# string= Label for phone buttons +# +# Set Clock: +# +# \EPchour;minute;second\ +# +# Position Clock: +# +# \EPsY;X\ +# +# Y= "Y" coordinate +# X= "X" coordinate +# +# Delete Clock: +# +# \Epr\ +# +# Programming The Function Buttons: +# +# \EPfPn;string\ +# +# Pn= Button number (00-06, 18-24) +# (kf00-kf06, kf18-kf24) +# +# string= Text to sent on button depression +# +# Request For Local Directory Data: +# +# \EPp12;\ +# +# Local Directory Data to host: +# +# \EPp11;LOCAL...DIRECTORY...DATA\ +# +# Request for Local Directory Data in print format: +# +# \EPp13;\ +# +# Enable 'Prt on Line' mode: +# +# \022 (DC2) +# +# Disable 'Prt on Line' mode: +# +# \024 (DC4) +# +# +# +# 05-Aug-86 +# +# +505|pt505|5430|gs5430| AT&T Personal Terminal 505 or 5430 GETSET terminal @(#)pt505.ti 1.4, + am, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, cnorm=\E[>l, + cols#80, cr=\r, cub1=\E[D, cub=\E[%p1%dD, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[>h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, + el=\E[0K, el1=\E2K, home=\E[H, ht=\t, il=\E[%p1%dL, il1=\E[L, ind=\n, + is1=\EPr\\E[0u\E[2J\E[0;0H\E[0m\E[3l\E[l\E[=l\E[?l, + it#8, kbs=\b, kcmd=\E!, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf0=\E[00s, kf1=\E[01s, kf2=\E[02s, kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, + kf6=\E[06s, kf18=\E[18s, kf19=\E[19s, kf20=\E[20s, kf21=\E[21s, + kf22=\E[22s, kf23=\E[23s, kf24=\E24s, kf26=\E26s, krfr=\E[27s, + lines#24, mc4=\E[4i, mc5=\E[5i, rc=\E8, + rev=\E[7m, rmacs=\E[10m, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, rs1=\Ec, + sc=\E7, sgr0=\E[0m, smacs=\E[11m, smir=\E[4h, smso=\E[1m, smul=\E[4m, + xon, rmam=\E[11;1j, smam=\E[11;0j, + +# +# The following Terminfo entry describes functions which are supported by +# the AT&T 5430/pt505 terminal software version 1. +# +# The following represents the screen layout along with the associated +# bezel buttons for the 5430/pt505 terminal. The "kf" designations do +# not appear on the screen but are shown to reference the bezel buttons. +# The "CMD", "MAIL", and "REDRAW" buttons are shown in their approximate +# position relative to the screen. +# +# +# +# +----------------------------------------------------------------+ +# | | +# XXXX | kf0 kf24 | XXXX +# | | +# | | +# XXXX | kf1 kf23 | XXXX +# | | +# | | +# XXXX | kf2 kf22 | XXXX +# | | +# | | +# XXXX | kf3 kf21 | XXXX +# | | +# | | +# XXXX | kf4 kf20 | XXXX +# | | +# | | +# XXXX | kf5 kf19 | XXXX +# | | +# | | +# XXXX | kf6 kf18 | XXXX +# | | +# | | +# XXXX | | XXXX +# | | +# | | +# +----------------------------------------------------------------+ +# +# XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX +# +# Note: XXXX represents the screen buttons +# CMD REDRAW +# +# MAIL +# +# Depression of the "CMD" key sends \E! (kcmd) +# Depression of the "MAIL" key sends (note) (kf26) +# "REDRAW" same as "REFRESH" (krfr) (note) +# +# note: The character string sent by key 'kf26' may be user programmable +# to send either \E[16s, or \E[26s. +# The character string sent by key 'krfr' may be user programmable +# to send either \E[17s, or \E[27s. +# +# "kf" functions adds carriage return to output string if terminal is in +# 'new line' mode. +# +# The following are functions not covered in the table above: +# +# Set keyboard character (SKC): +# +# \EPn1;Pn2w +# +# Pn1= 0 Back Space key +# Pn1= 1 Break key +# Pn2= Program char (hex) +# +# Screen Definition (SDF): +# +# \E[Pn1;Pn2;Pn3;Pn4;Pn5t +# +# Pn1= Window number (1-39) +# Pn2-Pn5= Y;X;Y;X coordinates +# +# Screen Selection (SSL): +# +# \E[Pnu +# +# Pn= Window number +# +# Set Terminal Modes (SM): +# +# \E[Pnh +# +# Pn= 3 Graphics mode +# Pn= > Cursor blink +# Pn= < Enter new line mode +# Pn= = Enter reverse insert/replace mode +# Pn= ? Enter no scroll mode +# +# Reset Terminal Mode (RM): +# +# \E[Pnl +# +# Pn= 3 Exit graphics mode +# Pn= > Exit cursor blink +# Pn= < Exit new line mode +# Pn= = Exit reverse insert/replace mode +# Pn= ? Exit no scroll mode +# +# Screen Status Report (SSR): +# +# \E[Pnp +# +# Pn= 0 Request current window number +# Pn= 1 Request current window dimensions +# +# Device Status Report (DSR): +# +# \E[6n Request cursor position +# +# Call Status Report (CSR): +# +# \E[Pnv +# +# Pn= 0 Call failed +# Pn= 1 Call successful +# +# Transparent Button String (TBS): +# +# \E[Pn1;Pn2;Pn3;{string +# +# Pn1= Button number to be loaded +# Pn2= Character count of "string" +# Pn3= Key mode being loaded: +# 0= Unshifted +# 1= Shifted +# 2= Control +# String= Text string (15 chars max) +# +# Screen Number Report (SNR): +# +# \E[Pnp +# +# Pn= Screen number +# +# Screen Dimension Report (SDR): +# +# \E[Pn1;Pn2r +# +# Pn1= Number of rows available in window +# Pn2= Number of columns available in window +# +# Cursor Position Report (CPR): +# +# \E[Pn1;Pn2R +# +# Pn1= "Y" Position of cousor +# Pn2= "X" Position of cursor +# +# Request Answer Back (RAB): +# +# \E[c +# +# Answer Back Response (ABR): +# +# \E[?;0;30;VSV +# +# V= Software version number +# SV= Software sub version number +# +# Screen Alingment Aid: +# +# \En +# +# Bell (lower pitch): +# +# \E[x +# +# Dial Phone Number: +# +# \EPdstring\ +# +# string= Phone number to be dialed +# +# Set Phone Labels: +# +# \EPpstring\ +# +# string= Label for phone buttons +# +# Set Clock: +# +# \EPchour;minute;second\ +# +# Position Clock: +# +# \EPsY;X\ +# +# Y= "Y" coordinate +# X= "X" coordinate +# +# Delete Clock: +# +# \Epr\ +# +# Programming The Function Buttons: +# +# \EPfPn;string\ +# +# Pn= Button number (00-06, 18-24) +# (kf00-kf06, kf18-kf24) +# +# string= Text to sent on button depression +# +# +# +# 05-Aug-86 +# +# +505-24|pt505-24|5430-24|gs5430-24| AT&T PT505 or 5430 GETSET version 1 24 lines @(#)pt505v1.ti 1.2, + am, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, cnorm=\E[>l, + cols#80, cr=\r, cub1=\E[D, cub=\E[%p1%dD, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[>h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, + el=\E[0K, el1=\E2K, home=\E[H, ht=\t, il=\E[%p1%dL, il1=\E[L, ind=\n, + is1=\EPr\\E[0u\E[2J\E[0;0H\E[0m\E[3l\E[l\E[=l\E[?l, + it#8, kbs=\b, kcmd=\E!, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf0=\E[00s, kf1=\E[01s, kf2=\E[02s, kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, + kf6=\E[06s, kf18=\E[18s, kf19=\E[19s, kf20=\E[20s, kf21=\E[21s, + kf22=\E[22s, kf23=\E[23s, kf24=\E24s, kf26=\E26s, krfr=\E[27s, + lines#24, + rev=\E[7m, rmacs=\E[10m, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, rs1=\Ec, + sgr0=\E[0m, smacs=\E[11m, smir=\E[4h, smso=\E[1m, smul=\E[4m, + xon, +505-22|pt505-22|5430-22|gs5430-22| AT&T PT505 or 5430 GETSET version 1 22 lines @(#)pt505v1.ti 1.2, + lines#22, use=5430-24, + +# +# AT&T 386 monocrome console +# +AT386-M|at386-m|386AT-M|386at-m|at/386 console, + am, bw, eo, xon, + cols#80, lines#25, + acsc=``aaffggjYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, + cr=\r, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, + cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%02d;%p2%02dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[1M, + ed=\E[J, el=\E[K, flash=^G, home=\E[H, ht=\t, + ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, + ind=\E[S, indn=\E[%p1%dS, invis=\E[9m, is2=\E[0;10m, + kbs=\b, kcbt=^], kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kend=\E[Y, + kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, + kf8=\EOW, kf9=\EOX, khome=\E[H, kich1=\E[@, knp=\E[U, + kpp=\E[V, krmir=\E0, rev=\E[7m, rin=\E[S, + rmacs=\E[10m, rmso=\E[m, rmul=\E[m, + sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p9%t;12%;%?%p7%t;9%;m, + sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, +# +# AT&T 386 color console +# +AT386|at386|386AT|386at|at/386 console, + colors#8, ncv#3, pairs#64, + op=\E[0m, + setb=\E[4%?%p1%{1}%=%t4 + %e%p1%{3}%=%t6 + %e%p1%{4}%=%t1 + %e%p1%{6}%=%t3 + %e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4 + %e%p1%{3}%=%t6 + %e%p1%{4}%=%t1 + %e%p1%{6}%=%t3 + %e%p1%d%;m, + use=at386-m, +# +# xterm: terminal emulator for XWIN system. +# +xtermm|xterm terminal emulator (monocrome), + am, km, mir, msgr, xenl, + cols#80, it#8, lines#24, .btns#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=@, bold=\E[1m, clear=\E[H\E[2J, cr=\r, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[1D, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ed=\E[J, el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, + home=\E[H, ht=\t, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=\n, ka1=\EOq, ka3=\EOs, + kb2=\EOr, kbs=\b, kc1=\EOp, kc3=\EOn, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, + kend=\E[Y, khome=\E[H, knp=\E[U, kpp=\E[V, + kf0=\EOy, kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EOA, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, kf9=\EOX, rc=\E8, + rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E@0\E[?4r, + rmso=\E[m, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O, smacs=^N, smcup=\E@0\E[?4s\E[?4h\E@1, + smso=\E[7m, tbc=\E[3g, + .getm=\E[%p1%dY, .kmous=\E[^_, .reqmp=\E[492Z, +# +# color xterm +# +xterm|xterm terminal emulator (color), + colors#8, ncv#7, pairs#64, + op=\E[100m, + setb=\E[4%?%p1%{1}%=%t4 + %e%p1%{3}%=%t6 + %e%p1%{4}%=%t1 + %e%p1%{6}%=%t3 + %e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4 + %e%p1%{3}%=%t6 + %e%p1%{4}%=%t1 + %e%p1%{6}%=%t3 + %e%p1%d%;m, + use=xtermm, diff --git a/usr/src/lib/terminfo/beehive.ti b/usr/src/lib/terminfo/beehive.ti new file mode 100644 index 0000000..1413900 --- /dev/null +++ b/usr/src/lib/terminfo/beehive.ti @@ -0,0 +1,118 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:beehive.ti 1.10" +# # -------------------------------- +# +# beehive: BEEHIVE +# +# Manufacturer: BEEHIVE +# Class: II +# +# Info: +# Beehive documentation is undated +# (Preliminary) and has no figures so we must have early Superbee2 +# (Model 600, according to phone conversation with mfr.). It has +# proved reliable except for some missing padding requirements +# (notably after \EK and nl at bottom of screen). +# +# The key idea is that AEP mode is poison for cm & that US's in +# the local memory should be avoided like the plague. That means +# that the 2048 character local buffer is used as 25 lines of 80 +# characters, period. No scrolling local memory, folks. It also +# appears that we cannot use naked INS LINE feature since it uses +# US. The sbi fakes al with an 80-space insert that may be too +# slow at low speeds; also spaces get converted to \040 which is +# too long for some programs (not vi). DEL LINE is ok but slow. +# +# The nl string is designed for last line of screen ONLY; cm to +# 25th line corrects the motion inherent in scrolling to Page 1. +# +# There is one understood bug. It is that the screen appears to +# pop to a new (blank) page after a nl, or leave a half-line +# elipsis to a quad that is the extra 48 memory locations. The +# data received is dumped into memory but not displayed. Not to +# worry if cm is being used; the lines not displayed will be, +# whenever the cursor is moved up there. Since cm is addressed +# relative to MEMORY of window, nothing is lost; but beware of +# relative cursor motion (up,do,nd,bs). Recommended, therefore, +# is setenv MORE -c . +# +# WARNING: Not all features tested. +# +# Timings are assembled from 3 sources. Some timings may reflect +# SB2/Model 300 that were used if more conservative. +# Tested on a Model 600 at 1200 and 9600 bd. +# +# The BACKSPACEkb option is cute. The NEWLINE key, so cleverly +# placed on the keyboard and useless because of AEP, is made +# into a backspace key. In use ESC must be pressed twice (to send) +# and sending ^C must be prefixed by ESC to avoid that wierd +# transmit mode associated with ENTER key. +# +# IF TERMINAL EVER GOES CATATONIC with the cursor buzzing across +# the screen, then it has dropped into ENTER mode; hit +# RESET--ONLINE--!tset. +# +# As delivered this machine has a FATAL feature that will throw +# it into that strange transmit state (SPOW) if the space bar is +# hit after a CR is received, but before receiving a LF (or a +# few others). +# +# The circuits MUST be modified to eliminate the SPOW latch. +# This is done by strapping on chip A46 of the I/O board; cut +# the p.c. connection to Pin 5 and Strap Pin 5 to Pin 8 of that +# chip. This mod has been checked out on a Mod 600 of Superbee II. +# With this modification absurdly high timings on cr are +# unnecessary. +# +# NOTE WELL that the rear panel switch should be set to CR/LF, +# not AEP! +# +sb|sb1|sbg|Beehive superbee, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, cbt=\E`$<650>, bw, cols#80, + il1=\EN\EL$<3>\EQ \EP$<3> \EO\ER\EA$<3>, + ed=\EJ$<3>, el=\EK$<3>, clear=\EH$<1>\EJ$<3>, cup=\EF%p2%03d%p1%03d, + ht=\t, hts=\E1, tbc=\E3, lines#25, cub1=\b$<1>, cr=$<1>\r, da, + db, dch1=\EP$<3>, dl1=\EM$<100>, cud1=\EB$<3>, rmir=\ER, + home=\EH$<1>, smir=\EQ\EO, + is2=\EE$<3>\EX\EZ\EO\Eb\Eg\ER, kf0=\E2, kf1=\Ep, + kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + kf9=\E1, lf0=TAB CLEAR, lf9=TAB SET, + kbs=^_, kcud1=\EB, + kel=\EK, ked=\EJ, kdl1=\EM, kich1=\EQ\EO, krmir=\ER, + khome=\EH, kcub1=\ED, kcuf1=\EC, kcuu1=\EA, mir, + cuf1=\EC$<3>, rmso=\E_3, xmc#1, smso=\E_1, + smcup=\EO, rmul=\E_3, ul, cuu1=\EA$<3>, + smul=\E_0, +sb2|sb3|fixed superbee, + xsb@, use=superbee, +sbi|superbee|beehive superbee at Indiana U., + xsb, cr=^M$<1>, il1=1\EN\EL$<9>\EQ \EP$<9> \EO\ER\EA, use=sbg, +# Info: +# Does this entry make xmc when it doesn't have to? +# Look at those spaces in rmso/smso. Seems strange to me. +# However, not having one to test changes on, I'll just leave it be... +# +bh3m|beehiveIIIm|, + if=/usr/share/lib/tabset/beehive, + cr=^M, cud1=^J, ind=^J, bel=^G, + il1=^S$<160>, am, cub1=^H, ed=^R, el=^P, clear=^E^R, + cols#80, dl1=^Q$<350>, home=^E, lines#20, ll=^E^K, + cuf1=^L, ht=^I, rmso= ^_, smso=^] , cuu1=^K, +microb|microbee|micro bee series, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + ed=\EJ, el=\EK, clear=\EE, cols#80, cup=\EF%p1%' '%+%c%p2%' '%+%c, + kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, + kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, kf9=\Ex, + kcud1=\EB, khome=\EH, kcub1=\ED, kcuf1=\EC, kcuu1=\EA, + lines#24, cuf1=\EC, ht=^I, cuu1=\EA, + rmso=\Ed@ , smso= \EdP, rmul=\Ed@, smul=\Ed`, +bh4|beehive4|beehive 4, + cr=^M, cud1=^J, ind=^J, bel=^G, + cols#80, lines#24, am, cub1=^H, ed=\EJ, el=\EK, clear=\EE, + home=\EH, cuu1=\EA, cuf1=\EC, cub1=\ED, diff --git a/usr/src/lib/terminfo/cdc.ti b/usr/src/lib/terminfo/cdc.ti new file mode 100644 index 0000000..4dd1eb1 --- /dev/null +++ b/usr/src/lib/terminfo/cdc.ti @@ -0,0 +1,22 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:cdc.ti 1.3" +# # -------------------------------- +# +# cdc: CONTROL DATA +# +# Manufacturer: CONTROL DATA +# Class: II +# +cdc456|cdc, + cr=^M, cud1=^J, ind=^J, bel=^G, lines#24, cols#80, clear=^Y^X, + cuf1=^L, cuu1=^Z, cub1=^H, cup=\E1%p1%' '%+%c%p2%' '%+%c, home=^Y, + il1=\E\114, dl1=\E\112, el=^V, ed=^X, am, +cdc456tst, + cr=^M, cud1=^J, ind=^J, bel=^G, + lines#24, cols#80, clear=^y^x, cub1=^H, cup=\E1%p1%' '%+%c%p2%' '%+%c, am, diff --git a/usr/src/lib/terminfo/ckout b/usr/src/lib/terminfo/ckout new file mode 100644 index 0000000..dc37063 --- /dev/null +++ b/usr/src/lib/terminfo/ckout @@ -0,0 +1,11 @@ +#ident "@(#)terminfo:ckout 1.6" +echo "`2>/dev/null cat errs|wc -l` entries have been compiled" +echo +2>/dev/null cat errs|grep -iv "^mkdir"|grep -iv "^create"|grep -iv "^link"|grep -vi terminfo.src|grep -vi touch|grep -vi "working" +if [ $? -ne 0 ] ; + then + echo "\tNo Errors" + else + echo "\tErrors can be found in /tmp/terminfo.errs" + cp errs /tmp/terminfo.errs +fi diff --git a/usr/src/lib/terminfo/colorscan.ti b/usr/src/lib/terminfo/colorscan.ti new file mode 100644 index 0000000..cc6ae91 --- /dev/null +++ b/usr/src/lib/terminfo/colorscan.ti @@ -0,0 +1,24 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:colorscan.ti 1.7" +# Manufacturer: DATAMEDIA +# Class: III +# +cs10|colorscan|Datamedia Color Scan 10, + msgr, + cols#80, lines#24, + bel=^G, clear=\E[;H\E[J, cr=\r, cub1=\b, cud1=\n, cuf1=\E[C, + cup=\E[%i%p1%02d;%p2%02dH, cuu1=\E[A, ed=\E[J, el=\E[K, ind=\n, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + rmso=\E[m, rmul=\E[m, smso=\E[7m, smul=\E[4m, + +cs10-w|Datamedia Color Scan 10 with 132 columns, + cols#132, + cup=\E[%i%p1%02d;%p2%03dH, + use=cs10, diff --git a/usr/src/lib/terminfo/cvt.ex b/usr/src/lib/terminfo/cvt.ex new file mode 100644 index 0000000..812c1a7 --- /dev/null +++ b/usr/src/lib/terminfo/cvt.ex @@ -0,0 +1,165 @@ +" #ident "@(#)terminfo:cvt.ex 1.2" +" Defend against files with spaces instead of tabs +g/^ *:/s/^ */ / +" Clean out all junk lines, making them into comments. +v/^[# A-Za-z]/s/^/# / +g/^[ A-Za-z].*[^\\:]$/s/^/# / +" Get rid of capabilities on the first line. +g/^[a-zA-Z].|.*:.*:/s/:/:\\\ + / +" Change colons to commas, with appropriate white space +v/^#/s/,/\\054/g +v/^#/s/:/, /g +v/^#/s/^ , / / +v/^#/s/, \\$/,/ +" Get rid of two letter codes +g/^[a-zA-Z].|/s///|s/$/HEADER/ +" Change names of capabilities - this list to be updated from caps +v/^#/s/\/mir/g +v/^#/s/\/msgr/g +v/^#/s/\/ht=^I/g +v/^#/s/\/xsb/g +v/^#/s/\/xenl/g +v/^#/s/\/xon/g +v/^#/s/\/xhp/g +v/^#/s/\/cols/g +v/^#/s/\/lines/g +v/^#/s/\/xmc/g +v/^#/s/\/il/g +v/^#/s/\/CC/g +v/^#/s/\/dl/g +v/^#/s/\/cud/g +v/^#/s/\/cub/g +v/^#/s/\/cuf/g +v/^#/s/\/cuu/g +v/^#/s/\/smacs/g +v/^#/s/\/il1/g +v/^#/s/\/rmacs/g +v/^#/s/\/bel/g +v/^#/s/\/cbt/g +v/^#/s/\/el/g +v/^#/s/\/hpa/g +v/^#/s/\/clear/g +v/^#/s/\/cup/g +v/^#/s/\/csr/g +v/^#/s/\/tbc/g +v/^#/s/\/vpa/g +v/^#/s/\/dch1/g +v/^#/s/\/dl1/g +v/^#/s/\/smdc/g +v/^#/s/\/cud1/g +v/^#/s/\/rmdc/g +v/^#/s/\/ed/g +v/^#/s/\/rmir/g +v/^#/s/\/fsl/g +v/^#/s/\/home/g +v/^#/s/\/is2/g +v/^#/s/\/ich1/g +v/^#/s/\/smir/g +v/^#/s/\/kf0/g +v/^#/s/\/kf1/g +v/^#/s/\/kf2/g +v/^#/s/\/kf3/g +v/^#/s/\/kf4/g +v/^#/s/\/kf5/g +v/^#/s/\/kf6/g +v/^#/s/\/kf7/g +v/^#/s/\/kf8/g +v/^#/s/\/kf9/g +v/^#/s/\/kil1/g +v/^#/s/\/kclr/g +v/^#/s/\/kdch/g +v/^#/s/\/kel/g +v/^#/s/\/kind/g +v/^#/s/\/kich1/g +v/^#/s/\/kdl1/g +v/^#/s/\/krmir/g +v/^#/s/\/knp/g +v/^#/s/\/kpp/g +v/^#/s/\/kri/g +v/^#/s/\/ked/g +v/^#/s/\/khts/g +v/^#/s/\/ktbc/g +v/^#/s/\/kbs/g +v/^#/s/\/kcud1/g +v/^#/s/\/rmkx/g +v/^#/s/\/khome/g +v/^#/s/\/kcub1/g +v/^#/s/\/kcuf1/g +v/^#/s/\/smkx/g +v/^#/s/\/kctab/g +v/^#/s/\/kcuu1/g +v/^#/s/\/lf0/g +v/^#/s/\/lf1/g +v/^#/s/\/lf2/g +v/^#/s/\/lf3/g +v/^#/s/\/lf4/g +v/^#/s/\/lf5/g +v/^#/s/\/lf6/g +v/^#/s/\/lf7/g +v/^#/s/\/lf8/g +v/^#/s/\/lf9/g +v/^#/s/\/cub1=^H/g +v/^#/s/\/cub1/g +v/^#/s/\/blink/g +v/^#/s/\/bold/g +v/^#/s/\/sgr0/g +v/^#/s/\/dim/g +v/^#/s/\/blank/g +v/^#/s/\/prot/g +v/^#/s/\/rev/g +v/^#/s/\/cuf1/g +v/^#/s/\/nel/g +v/^#/s/\/pad/g +v/^#/s/\/mc4/g +v/^#/s/\/mc5/g +v/^#/s/\/mc0/g +v/^#/s/\/rs2/g +v/^#/s/\/rep/g +v/^#/s/\/cuf1/g +v/^#/s/\/sgr/g +v/^#/s/\/rmso/g +v/^#/s/\/ind/g +v/^#/s/\/smso/g +v/^#/s/\/ri/g +v/^#/s/\/hts/g +v/^#/s/\/ht/g +v/^#/s/\/rmcup/g +v/^#/s/\/smcup/g +v/^#/s/\/tsl/g +v/^#/s/\/rmul/g +v/^#/s/\/cuu1/g +v/^#/s/\/smul/g +v/^#/s/\/flash/g +v/^#/s/\/cnorm/g +v/^#/s/\/civis/g +v/^#/s/\/cvvis/g +v/^#/s/\/wind/g +" Deal with changes in default rules +g/HEADER/s/$/\ + cr=^M, cud1=^J, ind=^J, bel=^G, +$a +# junk +. +g/HEADER/+,/^[^ ]/-!fmt +g/HEADER/s/// +g/\,/s///|?cr=^M, ?s/// +g/\,/s///|?ind=^J, ?s/// +" Still should do something about the cr=, nl=, tab= capabilities. +" Change parameterized strings +v/^#/s/%\./%p1%c/ +v/^#/s/%\./%p2%c/ +v/^#/s/%\./%p1%c/ +v/^#/s/%\./%p2%c/ +v/^#/s/%d/%p1%DECIMAL/ +v/^#/s/%d/%p2%DECIMAL/ +v/^#/s/%d/%p1%DECIMAL/ +v/^#/s/%d/%p2%DECIMAL/ +v/^#/s/DECIMAL/d/g +v/^#/s/%+\([^%]\)/%p1%'\1'%+%c/ +v/^#/s/%+\([^%]\)/%p2%'\1'%+%c/ +v/^#/s/%+\([^%]\)/%p1%'\1'%+%c/ +v/^#/s/%+\([^%]\)/%p2%'\1'%+%c/ +$g/^# junk$/d +w +q diff --git a/usr/src/lib/terminfo/cvt.h b/usr/src/lib/terminfo/cvt.h new file mode 100644 index 0000000..5d70b1c --- /dev/null +++ b/usr/src/lib/terminfo/cvt.h @@ -0,0 +1,188 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)terminfo:cvt.h 1.1" +/* + * This set of #defines, generated from the "caps" file, is intended as + * a conversion aid from termcap to terminfo. The two letter names are + * likely variable names used for termcap - they can be edited as needed + * for your own variable names. This makes it unnecessary to run a big + * sed script to change all the actual names in your program. + * + * If you are not very short on time or have only a dozen or so capabilities + * in use, it is probably worthwhile to just change all the names. + * This will make your program more maintainable in the long run. + */ + +#define AM auto_right_margin +#define BW auto_left_margin +#define DA memory_above +#define DB memory_below +#define EO erase_overstrike +#define ES status_line_esc_ok +#define GN generic_type +#define HC hard_copy +#define HS has_status_line +#define HZ tilde_glitch +#define IN insert_null_glitch +#define KM has_meta_key +#define MI move_insert_mode +#define MS move_standout_mode +#define OS over_strike +#define PT hardware_tabs +#define UL transparent_underline +#define XB beehive_glitch +#define XN eat_newline_glitch +#define XO xon_xoff +#define XS ceol_standout_glitch +#define XT teleray_glitch +#define CO columns +#define DBS backspace_delay +#define DCR return_delay +#define DFF formfeed_delay +#define DNL newline_delay +#define DTAB tab_delay +#define LI lines +#define LM lines_of_memory +#define PB padding_baud_rate +#define SG magic_cookie_glitch +#define VT virtual_terminal +#define AL_PARM parm_insert_line +#define CMDCHAR command_character +#define CMMEM cursor_mem_address +#define DC_PARM parm_dch +#define DL_PARM parm_delete_line +#define DOWN_PARM parm_down_cursor +#define IC_PARM parm_ich +#define LEFT_PARM parm_left_cursor +#define RIGHT_PARM parm_right_cursor +#define UP_PARM parm_up_cursor +#define AE exit_alt_charset_mode +#define AL insert_line +#define AS enter_alt_charset_mode +#define BL bell +#define BT back_tab +#define CD clr_eos +#define CE clr_eol +#define CH column_address +#define CL clear_screen +#define CM cursor_address +#define CR carriage_return +#define CS change_scroll_region +#define CT clear_all_tabs +#define CV row_address +#define DC delete_character +#define DL delete_line +#define DM enter_delete_mode +#define DO cursor_down +#define DS dis_status_line +#define EC erase_chars +#define ED exit_delete_mode +#define EI exit_insert_mode +#define FF form_feed +#define FS from_status_line +#define HD down_half_line +#define HO cursor_home +#define HU up_half_line +#define I1 init_1string +#define I2 init_2string +#define I3 init_3string +#define IC insert_character +#define IF init_file +#define IM enter_insert_mode +#define IP insert_padding +#define K0 key_f0 +#define K1 key_f1 +#define K2 key_f2 +#define K3 key_f3 +#define K4 key_f4 +#define K5 key_f5 +#define K6 key_f6 +#define K7 key_f7 +#define K8 key_f8 +#define K9 key_f9 +#define K10 key_f10 +#define KIL key_il +#define KCLEAR key_clear +#define KDC key_dc +#define KEOL key_eol +#define KSF key_sf +#define KIC key_ic +#define KDL key_dl +#define KEIC key_eic +#define KNPAGE key_npage +#define KPPAGE key_ppage +#define KSR key_sr +#define KEOS key_eos +#define KSTAB key_stab +#define KA key_catab +#define KB key_backspace +#define KD key_down +#define KE keypad_local +#define KH key_home +#define KL key_left +#define KR key_right +#define KS keypad_xmit +#define KT key_ctab +#define KU key_up +#define L0 lab_f0 +#define L1 lab_f1 +#define L2 lab_f2 +#define L3 lab_f3 +#define L4 lab_f4 +#define L5 lab_f5 +#define L6 lab_f6 +#define L7 lab_f7 +#define L8 lab_f8 +#define L9 lab_f9 +#define LA lab_f10 +#define LE cursor_left +#define LL cursor_to_ll +#define MB enter_blink_mode +#define MD enter_bold_mode +#define ME exit_attribute_mode +#define MH enter_dim_mode +#define MK enter_curs_invis_mode +#define MM meta_on +#define MO meta_off +#define MP enter_protected_mode +#define MR enter_reverse_mode +#define ND cursor_right +#define NW newline +#define PC pad_char +#define PF prtr_off +#define PK pkey_key +#define PL pkey_local +#define PO prtr_on +#define PS print_screen +#define PX pkey_xmit +#define R1 reset_1string +#define R2 reset_2string +#define R3 reset_3string +#define RC restore_cursor +#define RF reset_file +#define RP repeat_char +#define SA set_attributes +#define SC save_cursor +#define SE exit_standout_mode +#define SF scroll_forward +#define SO enter_standout_mode +#define SR scroll_reverse +#define ST set_tab +#define TA tab +#define TE exit_ca_mode +#define TI enter_ca_mode +#define TS to_status_line +#define UC underline_char +#define UE exit_underline_mode +#define UP cursor_up +#define US enter_underline_mode +#define VB flash_screen +#define VE cursor_normal +#define VI cursor_invisible +#define VS cursor_visible +#define WI set_window diff --git a/usr/src/lib/terminfo/cvt.sed b/usr/src/lib/terminfo/cvt.sed new file mode 100644 index 0000000..1ffbc5a --- /dev/null +++ b/usr/src/lib/terminfo/cvt.sed @@ -0,0 +1,124 @@ +s/\/mir/g +s/\/msgr/g +s/\/tabs/g +s/\/xsb/g +s/\/xenl/g +s/\/xon/g +s/\/xhp/g +s/\/cols/g +s/\/bsdly/g +s/\/crdly/g +s/\/ffdly/g +s/\/nldly/g +s/\/tbdly/g +s/\/lines/g +s/\/xmc/g +s/\/il/g +s/\/CC/g +s/\/dl/g +s/\/cud/g +s/\/cub/g +s/\/cuf/g +s/\/cuu/g +s/\/smacs/g +s/\/il1/g +s/\/rmacs/g +s/\/bel/g +s/\/cbt/g +s/\/el/g +s/\/hpa/g +s/\/clear/g +s/\/cup/g +s/\/csr/g +s/\/tbc/g +s/\/vpa/g +s/\/dch1/g +s/\/dl1/g +s/\/smdc/g +s/\/cud1/g +s/\/rmdc/g +s/\/ed/g +s/\/rmir/g +s/\/fsl/g +s/\/home/g +s/\/is2/g +s/\/ich1/g +s/\/smir/g +s/\/kf0/g +s/\/kf1/g +s/\/kf2/g +s/\/kf3/g +s/\/kf4/g +s/\/kf5/g +s/\/kf6/g +s/\/kf7/g +s/\/kf8/g +s/\/kf9/g +s/\/kil1/g +s/\/kclr/g +s/\/kdch/g +s/\/kel/g +s/\/kind/g +s/\/kich1/g +s/\/kdl1/g +s/\/krmir/g +s/\/knp/g +s/\/kpp/g +s/\/kri/g +s/\/ked/g +s/\/khts/g +s/\/ktbc/g +s/\/kbs/g +s/\/kcud1/g +s/\/rmkx/g +s/\/khome/g +s/\/kcub1/g +s/\/kcuf1/g +s/\/smkx/g +s/\/kctab/g +s/\/kcuu1/g +s/\/lf0/g +s/\/lf1/g +s/\/lf2/g +s/\/lf3/g +s/\/lf4/g +s/\/lf5/g +s/\/lf6/g +s/\/lf7/g +s/\/lf8/g +s/\/lf9/g +s/\/cub1/g +s/\/blink/g +s/\/bold/g +s/\/sgr0/g +s/\/dim/g +s/\/blank/g +s/\/prot/g +s/\/rev/g +s/\/cuf1/g +s/\/nel/g +s/\/pad/g +s/\/mc4/g +s/\/mc5/g +s/\/mc0/g +s/\/rs2/g +s/\/rep/g +s/\/cuf1/g +s/\/sgr/g +s/\/rmso/g +s/\/ind/g +s/\/smso/g +s/\/ri/g +s/\/hts/g +s/\/ht/g +s/\/rmcup/g +s/\/smcup/g +s/\/tsl/g +s/\/rmul/g +s/\/cuu1/g +s/\/smul/g +s/\/flash/g +s/\/cnorm/g +s/\/civis/g +s/\/cvvis/g +s/\/wind/g diff --git a/usr/src/lib/terminfo/datamedia.ti b/usr/src/lib/terminfo/datamedia.ti new file mode 100644 index 0000000..b87d013 --- /dev/null +++ b/usr/src/lib/terminfo/datamedia.ti @@ -0,0 +1,77 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:datamedia.ti 1.9" +# # -------------------------------- +# +# datamedia: DATAMEDIA +# +# Manufacturer: DATAMEDIA +# Class: II +# +dm1520|dm1521|1521|1520|datamedia 1520, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^K, el=^], clear=^L, + cup=^^%p2%' '%+%c%p1%' '%+%c, cols#80, home=^Y, + kcuu1=^_, kcud1=^J, kcub1=^H, kcuf1=^\, khome=^Y, + lines#24, cuf1=^\, cuu1=^_, xenl, ht=^I, +dm2500|datamedia2500|2500|datamedia 2500, + cud1=^J, ind=^J, bel=^G, il1=^P\n^X^]^X^]$<1*>, cub1=^H, el=^W, + clear=^^^^\177, cup=^L%p2%'`'%^%c%p1%'`'%^%c, cols#80, + dch1=^P\b^X^]$<10*>, + dl1=^P^Z^X^]$<10*>, smdc=^P, rmdc=^X^], rmir=\377\377^X^]$<10>, home=^B, + ich1=^P^\^X^]$<10*>, smir=^P, lines#24, cuf1=^\, + pad=\377, smso=^N, rmso=^X^], cuu1=^Z, +dm3025|datamedia 3025a, + is2=\EQ\EU\EV, cr=^M, cud1=^J, ind=^J, bel=^G, + il1=\EP\n\EQ$<130>, cub1=^H, ed=\EJ$<2>, el=\EK, clear=\EM$<2>, + cup=\EY%p2%' '%+%c%p1%' '%+%c, cols#80, dch1=\b$<6>, + dl1=\EP\EA\EQ$<130>, smdc=\EP, rmdc=\EQ, rmir=\EQ, home=\EH, + smir=\EP, lines#24, cuf1=\EC, ht=^I, + smso=\EOA, rmso=\EO@, cuu1=\EA, +3045|dm3045|datamedia 3045a, + is2=\EU\EV, cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + ed=\EJ$<2>, el=\EK, clear=\EM$<2>, cup=\EY%p2%' '%+%c%p1%' '%+%c, + cols#80, dch1=\EB$<6>, rmir=\EP, home=\EH, + smir=\EP, ip=$<6>, + kf0=\Ey\r, kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, + kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, kf9=\Ex\r, + khome=\EH, kcuu1=\EA, kcuf1=\EC, lines#24, cuf1=\EC, pad=\177, ht=^I, + eo, ul, cuu1=\EA, xenl, +# Info: +# dt80/1 is2 a vt100 lookalike, but it doesn't seem to need +# any padding. +# +dt80|dmdt80|dm80|datamedia dt80/1, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[2J\E[H, cr=\r, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, ed=\E[J, el=\E[K, + el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=\t, + hts=\EH, ind=\n, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=\b, + kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, + kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, mc0=\E[0i, + mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m$<2>, ri=\EM, + rmacs=^O, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O$<2>, smacs=^N, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +# Info: +# In 132 column mode it needs a little padding. +# This is2 still less padding than the vt100, and you can always +# turn on the ^S/^Q handshaking, smso you can use vt100 flavors +# for things like reverse video. +# +dt80-w|dmdt80-w|dm80-w|datamedia dt80/1 in 132 char mode, + cr=^M, cud1=^J, ind=^J, bel=^G, ed=\E[0J$<20>, cols#132, el=\E[0K$<20>, + cup=\E[%i%p1%d;%p2%dH$<5>, clear=\E[H\E[2J$<50>, cuu1=\E[A$<5>, use=dmdt80, diff --git a/usr/src/lib/terminfo/dec.ti b/usr/src/lib/terminfo/dec.ti new file mode 100644 index 0000000..e235d24 --- /dev/null +++ b/usr/src/lib/terminfo/dec.ti @@ -0,0 +1,223 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:dec.ti 1.12" +# # -------------------------------- +# +# dec: DEC (DIGITAL EQUIPMENT CORPORATION) +# +# Manufacturer: DEC (DIGITAL EQUIPTMENT CORP.) +# Class: II +# +# Info: +# Note that xenl glitch in vt100 is not quite the same as concept, +# since the cursor is left in a different position while in the +# weird state (concept at beginning of next line, vt100 at end +# of this line) so all versions of vi before 3.7 don't handle +# xenl right on vt100. The correct way to handle xenl is when +# you output the char in column 80, immediately output CR LF +# and then assume you are in column 1 of the next line. If xenl +# is on, am should be on too. +# +# I assume you have smooth scroll off or are at a slow enough baud +# rate that it doesn't matter (1200? or less). Also this assumes +# that you set auto-nl to "on", if you set it off use vt100-nam +# below. +# +# The padding requirements listed here are guesses. It is strongly +# recommended that xon/xoff be enabled, as this is assumed here. +# +# The vt100 uses rs2 and rf rather than is2/tbc/hts because the +# tab settings are in non-volatile memory and don't need to be +# reset upon login. Also setting the number of columns glitches +# the screen annoyingly. You can type "reset" to get them set. +# +vt100|vt100-am|dec vt100 (w/advanced video), + mir, msgr, cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, it#8, + clear=\E[H\E[J$<50>, cub1=^H, am, cup=\E[%i%p1%d;%p2%dH$<5>, + cuf1=\E[C$<2>, cuu1=\E[A$<2>, el=\E[K$<3>, el1=\E[1K$<3>, ed=\E[J$<50>, + cud=\E[%p1%dB, cuu=\E[%p1%dA, cub=\E[%p1%dD, cuf=\E[%p1%dC, + smso=\E[1;7m$<2>, rmso=\E[m$<2>, smul=\E[4m$<2>, rmul=\E[m$<2>, + bold=\E[1m$<2>, rev=\E[7m$<2>, blink=\E[5m$<2>, sgr0=\E[m^O$<2>, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, smkx=\E[?1h\E=, rmkx=\E[?1l\E>, + enacs=\E(B\E)0, smacs=^N, rmacs=^O, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + tbc=\E[3g, hts=\EH, home=\E[H, ht=^I, ri=\EM$<5>, + kcuu1=\EOA, kcud1=\EOB, kcuf1=\EOC, kcub1=\EOD, kbs=^H, + +# Info: +# This is how the keypad gets assigned. +# PF1 PF2 PF3 PF4 + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, +# 7 8 9 '-' does not send anything on my terminal. + kf9=\EOw, kf10=\EOx, kf0=\EOy, +# 4 5 6 , + kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, +# 1 2 3 + ka1=\EOq, kb2=\EOr, ka3=\EOs, +# 0 . ENTER + kc1=\EOp, kc3=\EOn, kent=\EOM, +# + + + vt#3, xenl, xon, sc=\E7, rc=\E8, csr=\E[%i%p1%d;%p2%dr, +vt100-nam|vt100 w/no am (w/advanced video), + am@, xenl@, use=vt100-am, +# Info: +# Ordinary vt100 in 132 column ("wide") mode. +# +vt100-w|vt100-w-am|dec vt100 132 cols (w/advanced video), + cols#132, lines#24, rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-am, +vt100-w-nam|vt100-nam-w|dec vt100 132 cols (w/advanced video), + cols#132, lines#14, rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, vt@, use=vt100-nam, +# Info: +# vt100's with no advanced video. +# +vt100-nav|vt100 without advanced video option, + sgr@, smso=\E[7m , rmso=\E[m , xmc#1, + smul@, rmul@, bold@, rev@, blink@, sgr0@, use=vt100, +vt100-nav-w|vt100-w-nav|dec vt100 132 cols 14 lines (no advanced video option), + lines#14, cols#132, use=vt100-nav, +# Info: +# vt100's with one of the 24 lines used as a status line. +# We put the status line on the top. +# +vt100-s|vt100-s-top|vt100-top-s|vt100 for use with sysline, + lines#23, is2=\E7\E[2;24r\E8, clear=\E[2;1H\E[J$<50>, home=\E[2;1H, + dsl=\E7\E[1;24r\E8, + cup=\E[%i%p1%{1}%+%d;%p2%dH$<5>, csr=\E[%i%i%p1%d;%p2%dr, + hs, eslok, tsl=\E7\E[1;%p1%dH\E[1K, fsl=\E8, use=vt100-am, +# Info: +# Status line at bottom. +# Clearing the screen will clobber status line. +# +vt100-s-bot|vt100-bot-s|vt100 for use with sysline, + lines#23, is2=\E[1;23r\E[23;1H, dsl=\E7\E[1;24r\E8, + hs, eslok, tsl=\E7\E[24;%p1%dH\E[1K, fsl=\E8, use=vt100-am, +# Info: +# vt132 - like vt100 but slower and has ins/del line and such. +# I'm told that smir/rmir are backwards in the terminal from the +# manual and from the ANSI standard, this describes the actual +# terminal. I've never actually used a vt132 myself, so this +# is untested. +# +vt132|DEC vt132, + il1=\E[L$<99>, dl1=\E[M$<99>, ip=$<7>, dch1=\E[P$<7>, rmir=\E[4h, + smir=\E[4l, xenl, ind=^J$<30>, use=vt100, +# Info: +# Older DEC CRT's +# +vt50|dec vt50, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=\EJ, el=\EK, clear=\EH\EJ, + cols#80, lines#12, cuf1=\EC, ht=^I, cuu1=\EA, +vt50h|dec vt50h, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=\EJ, el=\EK, + clear=\EH\EJ, cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80, lines#12, + cuf1=\EC, ht=^I, ri=\EI, cuu1=\EA, +vt52|dec vt52, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=\EJ, el=\EK, + clear=\EH\EJ, cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80, lines#24, + cuf1=\EC, ht=^I, it#8, ri=\EI, cuu1=\EA, + kcuu1=\EA, kcud1=\EB, kcuf1=\EC, kcub1=\ED, kbs=^H, +# Info: +# A VT62 can be made to think that it is a VT61 by moving 6 +# soldered-in jumpers on the i/o board. +# The keyboard must be relabeled, also. +# +vt61|vt-61|vt61.5|dec vt61, + cr=^M$<20>, cud1=^J, ind=^J$<20>, bel=^G, cub1=^H, + ed=\EJ$<120>, el=\EK$<70>, clear=\EH\EJ$<120>, + cup=\EY%p1%' '%+%c%p2%' '%+%c$<20>, cols#80, lines#24, + cuf1=\EC$<20>, ht=^I, ri=\E$<20>I, cuu1=\EA$<20>, + kcuu1=\EA, kcud1=\EB, kcuf1=\EC, kcub1=\ED, +# Info: +# Graphics CRT's. +# clear screen also erases graphics +# +vt125|vt125 graphics terminal, + clear=\E[;H\E[2J\EPpS(E)\E\\$<50>, use=vt100, +gt40|dec gt40, + cr=^M, cud1=^J, bel=^G, + cub1=^H, cols#72, lines#30, os, +gt42|dec gt42, + cr=^M, cud1=^J, bel=^G, + cub1=^H, cols#72, lines#40, os, +# Info: +# The gigi does standout with red! +# +gigi|vk100|dec gigi graphics terminal, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#84, lines#24, am, + clear=\E[;H\E[2J, cub1=^H, cup=\E[%i%p1%d;%p2%dH, cuf1=\E[C, + cuu1=\E[A, el=\E[K, ed=\E[J, smso=\E[7;31m, rmso=\E[m, + smul=\E[4m, rmul=\E[m, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?20l\E[?7h\E[?8h, smkx=\E[?1h\E=, + rmkx=\E[?1l\E>, kcuu1=\EOA, + kcud1=\EOB, kcuf1=\EOC, kcub1=\EOD, khome=\E[H, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, ht=^I, ri=\EM, xenl, cud=\E[%p1%dB, + cuu=\E[%p1%dA, cub=\E[%p2%dD, cuf=\E[%p1%dC, +# Info: +# Hard copy (decwriter) dec terminals. +# +dw1|decwriter I, + cr=^M, cud1=^J, ind=^J, bel=^G, + cub1=^H, cols#72, hc, os, +dw2|decwriter|dw|decwriter II, + cr=^M, cud1=^J, ind=^J, bel=^G, kbs=^H, cub1=^H, cols#132, hc, os, +# Info: +# \E(B Use U.S. character set (otherwise # => british pound !) +# \E[20l Disable "linefeed newline" mode (otherwise puts \r after \n,\f,\(vt ) +# \E[w 10 char/in pitch +# \E[1;132 full width horizontal margins +# \E[2g clear all tab stops +# \E[z 6 lines/in +# \E[66t 66 lines/page (for \f) +# \E[1;66r full vertical page can be printed +# \E[4g clear vertical tab stops +# \E> disable alternate keypad mode (so it transmits numbers!) +# \E[%i%du set tab stop at column %d (origin == 1) +# (Full syntax is \E[n;n;n;n;n;...;nu where each 'n' is +# a tab stop) +# +# The dw3 does standout with wide characters. +# +dw3|la120|decwriter III, + cr=^M, cud1=^J, ind=^J, bel=^G, kbs=^h, cub1=^H, cols#132, hc, + os, smso=\E[6w, rmso=\E[w, ht=^I, + is1=\E(B\E[20l\E[w\E[0;132s\E[2g\E[z\E[66t\E[1;66r\E[4g\E>, + is2=\E[9;17;25;33;41;49;57;65;73;81;89;97;105;113;121;129u\r, +dw4|decwriter IV, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, cols#132, hc, os, am, + ht=^I, is2=\Ec, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, kbs=^H, +vt220|dec vt220 8 bit terminal, + am, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E)0, flash=\E[?5h$<200>\E[?5l, home=\E[H, + ht=\t, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, + ind=\ED, is2=\E[?7h\E[>\E[?1h\E\sF\E[?4l, kbs=\b, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, + kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, + lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, + mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, + ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, rs1=\E[?3l, sc=\E7, + sgr0=\E[0m, smacs=^N, smam=\E[?7h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, + + diff --git a/usr/src/lib/terminfo/diablo.ti b/usr/src/lib/terminfo/diablo.ti new file mode 100644 index 0000000..2fdcca5 --- /dev/null +++ b/usr/src/lib/terminfo/diablo.ti @@ -0,0 +1,82 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:diablo.ti 1.6" +# # -------------------------------- +# +# diablo: DAISY WHEEL PRINTERS +# +# Manufacturer: Generic DAISY WHEEL PRINTERS +# Class: II +# +# Info: +# The A manufacturer represents Diablo, DTC, Xerox, Qume, and +# other Daisy wheel terminals until such time as terminfo +# distinguishes between them enough to justify separate codes. +# +diablo|1620|1640|450|diablo 1620, + cr=^M, cud1=^J, ind=^J, bel=^G, tbc=\E2, hts=\E1, hpa=\E\t%p1%{1}%+%c, + kbs=^H, cub1=^H, cols#132, ff=^L, hc, hu=\EU, hd=\ED, os, + ht=^I, cuu1=\E\n, +diablo-m8|1620-m8|1640-m8|diablo 1620 w/8 column left margin, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#124, is2=\r \E9, use=1620, +# Info: +# DTC 382 with VDU. Has no ed so we fake it with el. Standout +# works but won't go away without dynamite. +# +# If no tab is set or the terminal's in a bad mood, it glitches +# the screen around all of memory. Note that return puts a blank +# ("a return character") in the space the cursor was at, so we +# use ^P return (and thus ^P newline for newline). +# +# I have been unable to get tabs set in all 96 lines - +# it always leaves at least one line with no tabs in it, and +# once you tab through that line, it completely weirds out. +# +ps|dtc382|382|DTC 382, + bel=^G, .cud1=^J, ind=^J, il1=^P^Z, am, cub1=^H, + cols#80, el=^P^U, clear=^P^]$<20>, cup=^P^Q%p2%c%p1%c, dch1=^X, + dl1=^P^S, rmir=^Pi, home=^P^R, smir=^PI, cnorm=^Pb, cvvis=^PB, pad=\177, + rmcup=^P^]$<20>, lines#24, cuf1=^PR, .rmso=^P \200, .smso=^P \002^PF, + smul=^P \020, rmul=^P \200, cuu1=^P^L, xhp, lm#96, + da, db, cr=^P^M, ed=^P^U^P^S^P^S, +dtc300s|300|300s|dtc|dtc 300s, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, kbs=^h, + cub1=^H, cols#132, ff=^L, hc, hu=\EH, hd=\Eh, os, ht=^I, cuu1=^Z, +gsi, + cub1=^H, cols#132, hc, hd=\Eh, hu=\EH, os, ht=^I, cuu1=^Z, + cr=^M, cud1=^J, ind=^J, bel=^G, +aj830|aj832|aj|anderson jacobson, + cr=^M, cud1=^J, ind=^J, bel=^G, + cub1=^H, hc, hd=\E9, hu=\E8, os, cuu1=\E7, +# Info: +# This is incomplete, but it's a start. +# +5520|nec|spinwriter|nec 5520, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, + kbs=^h, cub1=^H, cols#132, ff=^L, hc, hu=\E]s\E9\E]W, hd=\E]s\n\E]W, + os, ht=^I, cuu1=\E9, +qume5|qume|qume sprint 5, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, + kbs=^h, cub1=^H, cols#80, ff=^L, hc, hu=\EH, hd=\Eh, os, ht=^I, cuu1=^Z, +# Info: +# I suspect the xerox1720 is the same as the diablo 1620. +# +x1720|x1700|1700|x1750|xerox 1720, + cols#132, cub1=^H, ff=^L, hc, os, ht=^I, + cr=^M, cud1=^J, ind=^J, bel=^G, + tbc=\E2, hts=\E1, +# Info: +# This is an "experimental" entry for the SRI Agiles. +# +# It has been tried in a minimal way -- the Agile did not blow up! +# However, it has not been exhaustively tested. +# +agile|agiles|sri agiles, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, hc, os, cols#132, + ht=^I, kbs=^H, cuu1=\E\n, hu=\E0, hd=\E9, hts=\E1, tbc=\E2, + is2=\EE\EF\EJ, diff --git a/usr/src/lib/terminfo/fortune.ti b/usr/src/lib/terminfo/fortune.ti new file mode 100644 index 0000000..1e41756 --- /dev/null +++ b/usr/src/lib/terminfo/fortune.ti @@ -0,0 +1,87 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:fortune.ti 1.3" +# Manufacturer: FORTUNE +# Class: III +# Info: +# This is the original fortune entry, probably outdated +# +ofos|ofortune|fortune system, + is2=^_.., + lines#25, cols#80, + am, bw, + clear=^L$<20>, ed=^\Y$<3*>, + ich1=^\Q$<5>, dch1=^\W$<5>, + cup=^\C%p1%' '%+%c%p2%' '%+%c, + ht=^Z, + home=^^$<10>, cud1=^J$<3>, cuu1=^K$<3>, cub1=^H, + kbs=^H, kcud1=^Ay\r, khome=^A?\r, kcub1=^Aw\r, kcuf1=^Az\r, kcuu1=^Ax\r, + ind=^J$<5>, + smso=^\H`, rmso=^\I`, xmc#0, + smul=^\HP, rmul=^\IP, + el=^\Z, + rev=\EH, .sgr0=\EI, + +fortune|Fortune Systems 32:16 terminal, + am, + bel=^G, + blink=\EN, + bw, + civis=\E], + clear=^L$<20>, + cnorm=\E\\, + cols#80, + cr=\r, + cub1=^H, + cud1=^J$<3>, + cuf1=^I, + cup=^\C%p1%' '%+%c%p2%' '%+%c$<1>, + cuu1=^K$<3>, + cvvis=\E[, + dch1=^\W$<5>, +# dl1=^\R$<15>, + dl1=^\r$<15>, + ed=^\Y$<3*>, + el=^\Z, + flash=^Y^G, + home=^^$<10>, + ht=^Z, + ich1=^\Q$<5>, +# il1=^\E$<15>, + il1=^\g$<15>, + ind=^J\r$<5>, +# Info: +# not sure about is1! +# + is1=^_.., + kbs=^H, + kcub1=^Aw\r, + kcud1=^Ay\r, + kcuf1=^Az\r, + kcuu1=^Ax\r, + khome=^A?\r, + lines#25, + nel=\r\n, + rep=%p1%c\EF%p2%'?'%+%c, + rev=\EH, + ri=^K\r$<5>, + rmso=^\I`, +# rmul=^\I\20, or +# rmul=^\I, + rmul=\EZ, + sgr0=\EI\E\^\EZ, + smso=^\H`, +# smul=^\H\20, or +# smul=^\HO, + smul=\EY, + xmc#0, +# Info: +# Other stuff: +# bs=^H, ns, +# bs=^H: nl=5^J: ug=0 +# diff --git a/usr/src/lib/terminfo/general.ti b/usr/src/lib/terminfo/general.ti new file mode 100644 index 0000000..c166bc5 --- /dev/null +++ b/usr/src/lib/terminfo/general.ti @@ -0,0 +1,46 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:general.ti 1.7" +# # -------------------------------- +# +# general: GENERAL TERMINAL (formerly INFOTON) +# +# Manufacturer: GENERAL TERMINAL +# Class: I +# +# Info: +# Infoton is now called General Terminal Corp. +# +i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100), + cr=^M, cud1=^J, ind=^J, bel=^G, clear=^L, ed=\EJ, el=\EK, + lines#24, cols#80, il1=\EL, dl1=\EM, cuu1=\EA, cuf1=\EC, + home=\EH, cup=\Ef%p2%' '%+%c%p1%' '%+%c, + flash=\Eb\Ea, am, cub1=^H, smso=\Eb, rmso=\Ea, +infoton, + am, + cols#80, lh#0, lines#24, lw#0, nlab#0, + bel=^G, clear=\f, cr=\r, cub1=^Z, cud1=\n, cuf1=^Y, + cuu1=^\, ed=^K, ind=\n, ll=\b^\, +# Info: +# Looks like an ANSI terminal, but look at dch1! I bet smdc/rmdc +# could be used. +# +# But you would think being ANSI they would do \E[P differently. +# +i400|400|infoton 400, + cr=^M, cud1=^J, ind=^J, bel=^G, + il1=\E[L, am, cub1=^H, el=\E[N, clear=\E[2J, cup=\E[%i%p1%03d;%p2%03dH, + cols#80, dl1=\E[M, lines#25, cuf1=\E[C, cuu1=\E[A, + smir=\E[4h\E[2Q, rmir=\E[4l\E[0Q, dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, +addrinfo, + cr=^M, cud1=^J, ind=^J, bel=^G, + lines#24, cols#80, clear=^L, home=^H, cuf1=^Y, ed=^K, + cuu1=^\, am, cub1=^Z, cup=\037%i%p1%{1}%-%c%p2%{1}%-%c, ll=^H^\, +infotonKAS, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^Z, + ed=^K, clear=^L, cols#80, lines#24, cuf1=^Y, cuu1=^\, ll=^H^\, diff --git a/usr/src/lib/terminfo/hardcopy.ti b/usr/src/lib/terminfo/hardcopy.ti new file mode 100644 index 0000000..946437c --- /dev/null +++ b/usr/src/lib/terminfo/hardcopy.ti @@ -0,0 +1,27 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:hardcopy.ti 1.5" +# # HARDCOPY - various hard copy terminals. +# +# Manufacturer: Generic Hard copy Terminals +# Class: I +# +cdi|cdi1203|, + am, cub1=^H, hc, os, cols#80, + cr=^M$<200>, cud1=^J, ind=^J, bel=^G, +ep48|ep4080|execuport 4080, + am, cub1=^H, os, cols#80, hu=\036, hd=\034, + cr=^M, cud1=^J, ind=^J, bel=^G, +ep40|ep4000|execuport 4000, + am, cub1=^H, os, cols#136, hu=\036, hd=\034, + cr=^M, cud1=^J, ind=^J, bel=^G, +mw2|multiwriter 2, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#132, hc, os, +terminet1200|terminet300|tn1200|tn300|terminet|ge terminet 1200, + cols#120, hc, os, + cr=^M, cud1=^J, ind=^J, bel=^G, diff --git a/usr/src/lib/terminfo/hazeltine.ti b/usr/src/lib/terminfo/hazeltine.ti new file mode 100644 index 0000000..22dca4f --- /dev/null +++ b/usr/src/lib/terminfo/hazeltine.ti @@ -0,0 +1,143 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:hazeltine.ti 1.6" +# # -------------------------------- +# +# hazeltine: HAZELTINE +# +# Manufacturer: HAZELTINE +# Class: II +# +# Info: +# Since cuf1 is blank, when you want to erase something you +# are out of luck. You will have to do ^L's a lot to +# redraw the screen. h1000 is untested. It doesn't work in +# vi - (The code is there but it isn't debugged for this case.) +# +h1000|hazeltine 1000, + cub1=^H, home=^K, clear=^L, cuf1= , + cols#80, lines#12, cr=^M, cud1=^J, ind=^J, bel=^G, +h1420|hazeltine 1420, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, am, lines#24, cols#80, + il1=\E^Z, dl1=\E^S, ed=\E^X, clear=\E\034, cuu1=\E^L, cuf1=^P, + el=\E^O, ht=^N, cup=\E^Q%p2%c%p1%' '%+%c, smso=\E\037, rmso=\E^Y, +h1500|hazeltine 1500, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=~^Z$<40>, hz, am, + cub1=^H, ed=~^X$<10>, + el=~^O, clear=~^\, cup=~^Q%p2%c%p1%c, cols#80, dl1=~^S$<40>, + cud1=~^K, lines#24, cuf1=^P, smso=~^_, rmso=~^Y, cuu1=~^L, +# Info: +# This is a Fluke special to work around the comm gear +# intercepting ^S +# +s1500|hazeltine 1500 thru comm system that see's ^S , + cr=^M, ind=^J, cud1=^J, bel=^G, + il1=~^Z$<40>, am, cub1=^H, ed=~^X$<10>, el=~^O, + clear=~^\, cup=~^Q%p2%c%p1%c, cols#80, + cud1=~^K, hz, lines#24, cuf1=^P, cuu1=~^L, +# Info: +# h1510 assumed to be in escape mode. Else use h1510t. +# +h1510|hazeltine 1510 using escape escapes, + cr=^M, cud1=^J, ind=^J, bel=^G, + il1=\E^Z, am, cub1=^H, ed=\E^X, el=\E^O, clear=\E^\, + cup=\E^Q%p2%c%p1%c, cols#80, dl1=\E^S, cud1=\E^K, + lines#24, cuf1=^P, .rmso=\E^_, .smso=\E^Y, cuu1=\E^L, +h1510t|Hazeltine 1510 with tilde escapes, + am, + home=~^R, + khome=~^R, + cuu1=~^L, + kcuu1=~^L, + cud1=~^K, + kcud1=~^K, + cub1=\b, + bel=^G, + cbt=~, + clear=~, + cols#80, + cr= , + cuf1=^P, + cup=~^Q%p2%c%p1%c, + dl1=~^S$<40>, + ed=~^X$<10>, + el=~^O, + hz, + il1=~^Z$<40>, + ind=^J, + kbs=, + kcbt=~, + kclr=~, + kcub1=\b, + kcuf1=^P, + kf0=~0\r, + kf1=~1\r, + kf2=~2\r, + kf3=~3\r, + kf4=~4\r, + kf5=~5\r, + kf6=~6\r, + kf7=~7\r, + kf8=~8\r, + kf9=~9\r, + ktbc=~.\r, + lines#24, + rmso=~^Y, + sc=~^E, + smso=~^_, + + +h1520|hazeltine 1520, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=~^Z, am, cub1=^H, + ed=~^X, el=~^O, clear=~\034, cup=~^Q%p2%c%p1%c$<1>, cols#80, + dl1=~^S, cud1=~^K, hz, lines#24, cuf1=^P, + rmso=~^Y, smso=~\037, cuu1=~^L, home=~^R, +# Info: +# The h1552 has tildes and backprimes and everything! +# Be sure the auto lf/cr switch is set to cr. +# +h1552|hazeltine 1552, + cols#80, it#8, lines#24, + bel=^G, clear=\EH\EJ, cr=\r, cub1=\b, cud1=\n, + cuf1=\EC, cup=\EY%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=\EA, + dl1=\EO, ed=\EJ, el=\EK, ht=\t, il1=\EE, ind=\n, + kbs=\b, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf1=\EP, kf2=\EQ, kf3=\ER, lf1=blue, lf2=red, + lf3=green, ri=\EI, +h1552-rv|hazeltine 1552 reverse video, + cr=^M, cud1=^J, ind=^J, bel=^G, + smso=\ES, rmso=\ET, use=h1552, +# Info: +# h2000 won't work well because of a clash between upper case +# and ~'s. +# +h2000|hazeltine 2000, + cud1=^J, ind=^J, bel=^G, + il1=~^z$<6>, am, cub1=^H, clear=~^\$<6>, cup=~^q%p2%c%p1%c, cols#74, + dl1=~^s$<6>, home=~^r, lines#27, pad=\177, +# Info: +# Date: Fri Jul 23 10:27:53 1982 +# I tested this termcap entry for the Hazeltine Esprit with vi. It +# seems to work ok. There is one problem though if one types a +# lot of garbage characters very fast vi seems not able to keep +# up and hangs while trying to insert. That's in insert mode +# while trying to insert in the middle of a line. It might be +# because the Esprit doesn't have insert char and delete char as +# a built in function. Vi has to delete to end of line and then +# redraw the rest of the line. +# +esprit|Hazeltine Esprit I, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\E^Z, am, cub1=^H, + cbt=\E^T, bw, ed=\E^W, el=\E^O, clear=\E\034, cup=\E^Q%p2%c%p1%c, + cols#80, dl1=\E^S, cud1=\E^K, home=\E^R, is2=\E\077, + kf0=^B\060\n, kf1=^B\061\n, kf2=^B\062\n, kf3=^B\063\n, + kf4=^B\064\n, kf5=^B\065\n, kf6=^B\066\n, kf7=^B\067\n, + kf8=^B\070\n, kf9=^B\071\n, kbs=^H, kcud1=\E^K, rmkx=\E\076, + khome=\E^R, kcub1=^H, kcuf1=^P, smkx=\E\074, kcuu1=\E^L, lf0=0, + lf1=1, lf2=2, lf3=3, lf4=4, lf5=5, lf6=6, lf7=7, lf8=8, lf9=9, + lines#24, cuf1=^P, rmso=\E^Y, smso=\E^_, cuu1=\E^L, diff --git a/usr/src/lib/terminfo/hds.ti b/usr/src/lib/terminfo/hds.ti new file mode 100644 index 0000000..80a47b9 --- /dev/null +++ b/usr/src/lib/terminfo/hds.ti @@ -0,0 +1,295 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:hds.ti 1.11" +# # -------------------------------- +# +# concept: (HUMAN DESIGNED SYSTEMS) +# +# Manufacturer: HUMAN DESIGNED SYSTEMS +# Class: III +# +# Info: +# There seem to be a number of different versions of the C108 PROMS +# (with bug fixes in its Z-80 program). +# +# The first one that we had would lock out the keyboard of you +# sent lots of short lines (like /usr/dict/words) at 9600 baud. +# Try that on your C108 and see if it sends a ^S when you type it. +# If so, you have an old version of the PROMs. +# +# You should configure the C108 to send ^S/^Q before running this. +# It is much faster (at 9600 baud) than the c100 because the delays +# are not fixed. +# new status line display entries for c108-8p: +# is3 - init str #3 - setup term for status display - +# set programmer mode, select window 2, define window at last +# line of memory, set bkgnd stat mesg there, select window 0. +# +# tsl - to status line - select window 2, home cursor, erase to +# end-of-window, 1/2 bright on, goto(line#0, col#?) +# +# fsl - from status line - 1/2 bright off, select window 0 +# +# dsl - disable status display - set bkgnd status mesg with +# illegal window # +# +# There are probably more function keys that should be added but +# I don't know what they are. +# +c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages, + is3=\EU\E z"\Ev^A\177 !p\E ;"\E z \Ev ^A\177p\Ep\n, + rmcup=\Ev ^A\177p\Ep\r\n, use=c108-4p, +c108+acs|alternate charset defns for c108, + acsc=l\\qLkTxUmMjE, rmacs=\Ej , smacs=\Ej!, +c108-4p-acs|c108-4p w/ acs, + use=c108+acs, use=c108-4p, +c108-8p-acs|c108-8p w/ acs, + use=c108+acs, use=c108-8p, +c108-rv-8p-acs|c108-rv-8p w/ acs, + use=c108+acs, use=c108-rv-8p, +c108-4p|concept108-4p|concept 108 w/4 pages, + hs, eslok, dch1=\E\s1$<16*>, + tsl=\E z"\E?\E^E\EE\Ea %+ , fsl=\Ee\E z , dsl=\E ;\177, + is3=\EU\E z"\Ev\177 !p\E ;"\E z \Ev ^A p\Ep\n, + xon, is1=\EK\E!\E F, + smcup=\EU\Ev 8p\Ep\r\E^U, rmcup=\Ev ^A p\Ep\r\n, + cvvis=\EW, cnorm=\Ew, +# Info: +# No delays needed on c108 because of ^S/^Q handshaking +# + pb@, cr=^M, ind=^J, + cup=\Ea%p1%?%p1%{95}%>%t^A%{96}%-%;%' '%+%c%p2%?%p2%{95}%>%t^A%{96}%-%;%' '%+%c, + use=c100, +c108-rv|c108-rv-8p|concept 108 w/8 pages in reverse video, + smcup=\EU\Ev 8p\Ep\r, rmcup=\Ev ^B p\Ep\r\n, use=c108-rv-4p, +c108-rv-4p|concept108-rv-|concept108rv4p|concept 108 w/4 pages in reverse video, + flash=\EK$<50>\Ek, is1=\Ek, smso=\EE, rmso=\Ee, + use=c108-4p, +c108-rv-4p-acs|c108-rv-4p w/ acs, + use=c108+acs, use=c108-rv-4p, +c108-na|c108-na-8p|c108-8p-na|concept108-na-|concept108na8p|concept 108 w/8 pages no arrows, + kf7=\E;, kf8=\E<, kf9=\E=, + smkx@, rmkx@, use=c108-8p, +c108-na-acs|c108-na w/ acs, + use=c108+acs, use=c108-na, +c108-rv-na|c108-rv-na-8p|c108-8p-rv-na|concept 108 8 pages no arrows rev video, + kf7=\E;, kf8=\E<, kf9=\E=, + smkx@, rmkx@, use=c108-rv-8p, +c108-rv-na-acs|c108-na w/ acs, + use=c108+acs, use=c108-rv-na, +c108-w|c108-w-8p|concept108-w-8|concept108-w8p|concept 108 w/8 pages in wide mode, + is1=\E F\E", + smcup=\EU\Ev 8^AD\Ep\r, rmcup=\Ev ^A0^AD\Ep\r\n, + cols#132, use=c108-8p, +c108-w-acs|c108-w w/ acs, + use=c108+acs, use=c108-w, +# Info: +# Concept 100: +# These have only window relative cursor addressing, not screen +# relative. To get it to work right here, smcup/rmcup (which +# were invented for the # concept) lock you into a one page +# window for screen style programs. +# +# To get out of the one page window, we use a clever trick: +# we set the window size to zero ("\Ev " in rmcup) which the +# terminal recognizes as an error and resets the window to all +# of memory. +# +# This trick works on c100 but does not on c108, sigh. +# +# Some tty drivers use cr3 for concept, others use nl3, hence +# the delays on cr and ind below. This padding is only needed at +# 9600 baud. One or the other is commented out depending on +# local conventions. +# +# 2 ms padding on rmcup isn't always enough. 6 works fine. Maybe +# less than 6 but more than 2 will work. +# +# Note: can't use function keys f7-f10 because they are +# indistinguishable from arrow keys (!), also, del char and +# clear eol use xon/xoff so they probably won't work very well. +# +# Also note that we don't define insrt/del char/delline/eop/send +# because they don't transmit unless we reset them - I figured +# it was a bad idea to clobber their definitions. +# +# The mc5 sequence changes the escape character to ^^ so that +# escapes will be passed through to the printer. Only trouble +# is that ^^ won't be - ^^ was chosen to be unlikely. +# Unfortunately, if you're sending raster bits through to be +# plotted, any character you choose will be likely, so we lose. +# +c100|concept100|concept|c104|c100-4p|hds concept 100, + is2=\EU\Ef\E7\E5\E8\El\ENH\E\0\Eo&\0\Eo'\E\Eo!\0\E^G!\E^HA@ \E4#:"\E:a\E4#;"\E:b\E4#<"\E:c, + is1=\EK, is3=\Ev $<6>\Ep\n, +# cr=^M, ind=^J$<9>, + cr=$<9>^M, ind=^J, + bel=^G, cud1=^J, clear=\E?\E^E$<2*>, + smcup=\EU\Ev 8p\Ep\r\E^U$<16>, rmcup=\Ev $<6>\Ep\r\n, + il1=\E^R$<3*>, am, cub1=^H, ed=\E^E$<16*>, el=\E^U$<16>, + cup=\Ea%p1%' '%+%c%p2%' '%+%c, cols#80, dch1=\E^Q$<16*>, dl1=\E^B$<3*>, + rmir=\E\s\s, eo, smir=\E^P, ip=$<16*>, lines#24, mir, cuf1=\E=, + ht=\t$<8>, kbs=^h, ul, cuu1=\E;, smul=\EG, rmul=\Eg, + xenl, flash=\Ek$<20>\EK, pb#9600, vt#8, + smul=\EG, rmul=\Eg, smso=\ED, rmso=\Ed, + dim=\EE, rev=\ED, blink=\EC, prot=\EI, invis=\EH, sgr0=\EN@, + rep=\Er%p1%c%p2%' '%+%c$<.2*>, smkx=\EX, rmkx=\Ex, + kcuu1=\E;, kcud1=\E<, kcub1=\E>, kcuf1=\E=, khome=\E?, kcbt=\E', + kf1=\E5, kf2=\E6, kf3=\E7, kf4=\E8, kf5=\E9, + kf6=\E:a, kf7=\E:b, kf8=\E:c, + kich1=\E^P, krmir=\E\0, kdch1=\E^Q, kil1=\E^R, kdl1=\E^B, + kel=\E^S, ked=\E^C, kpp=\E., knp=\E-, kind=\E[, kri=\E\\, + khts=\E], kctab=\E_, +# Info: +# \EQ"\EY(^W (send anything from printer to host, for xon/xoff) +# cannot be # in is2 because it will hang a c100 with no printer +# if sent twice. +# + mc5=\EQ"\EY(^W\EYD\Eo ^^, mc4=^^o \E\EQ!\EYP^W, +c100-rv|c100-rv-4p|c100-rv-4p-pp|concept100-rv|c100 rev video, + is1=\Ek, flash=\EK$<20>\Ek, cvvis@, cnorm@, + smso=\EE, rmso=\Ee, use=c100, +c100-rv-na|c100-rv-4p-na|c100 with no arrows, + smkx@, rmkx@, use=c100-rv, +oc100|oconcept|c100-1p|old 1 page concept 100, + in, is3@, use=c100, +# Info: +# +# ht through el included to specify padding needed in raw mode. +# +avt-ns|concept avt with status lins disabled, + am, eo, mir, ul, xenl, xon, + cols#80, it#8, lines#24, lm#192, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J$<38>, cnorm=\E[=119l, cr=\r, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[=119h, dch1=\E[P, dim=\E[1!{, + dl=\E[%p1%dM$<4*>, dl1=\E[M$<4>, ed=\E[J$<96>, + el=\E[K$<6>, home=\E[H, hpa=\E[%p1%{1}%+%dG, + ht=\t$<4>, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL$<4*>, il1=\E[L$<4>, ind=\n$<8>, + invis=\E8m, ip=$<4>, is1=\E[=103l\E[=205l, + is2=\E[1*q\E[2!t\E[7!t\E[=4;101;119;122l\E[=107;118;207h\E)1\E[1Q\EW\E[!y\E[!z\E>\E[0:0:32!r\E[0*w\E[w\E2\r\n\E[2;27!t, + kbs=\b, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\E^B\r, ked=\E^D\r, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, + kich1=\E^A\r, kil1=\E^C\r, ll=\E[24H, mc0=\E[0i, + mc4=\E[4i, mc5=\E[5i, pfloc=\E[%p1%d;0u#%p2%s#, + pfx=\E[%p1%d;1u#%p2%s#, prot=\E[99m, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM$<4>, + rmacs=^N$<1>, rmcup=\E[w\E2\r\n, rmir=\E4l, + rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{, sc=\E7, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + sgr0=\E[m, smacs=^O$<1>, smcup=\E[=4l\E[1;24w\E2\r, + smir=\E1, smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, + tbc=\E[2g, vpa=\E[%p1%{1}%+%dd, +avt-rv-ns|concept avt in reverse video mode/no status line, + is1=\E[=103l\E[=205h, flash=\E[=205l$<50>\E[=205h, use=avt-ns, +avt-w-ns|concept avt in 132 column mode/no status line, + is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, use=avt-ns, +avt-w-rv-ns|concept avt in 132 column mode/no status line, + is1=\E[=103h\E[=205h, smcup=\E[H\E[1;24;1;132w, + flash=\E[=205l$<50>\E[=205h, use=avt-ns, +# Info: +# Concept AVT with status line. We get the status line using the +# "Background status line" feature of the terminal. We swipe the +# first line of memory in window 2 for the status line, keeping +# 191 lines of memory and 24 screen lines for regular use. +# The first line is used instead of the last so that this works +# on both 4 and 8 page AVT's. (Note the lm#191 or 192 - this +# assumes an 8 page AVT but lm isn't currently used anywhere.) +# +avt+s|concept avt status line changes, + is3=\E[2w\E[2!w\E[1;1;1;80w\E[H\E[2*w\E[1!w\E2\r\n, + tsl=\E[2;1!w\E[;%p1%dH\E[2K, fsl=\E[1;1!w, eslok, hs, + dsl=\E[0*w, lm#191, smcup=\E[2;25w\E2\r, rmcup=\E[2w\E2\r\n, + .wind=\E[%i%p1%{1}%+%d;%p2%d;%p3%{01}%+%d;%p4%{01}%+%dw, +avt|c5|avt-s|conceptavt|concept-avt| avt w/4 or 8 pages/80 columns, + use=avt+s, use=avt-ns, +avt-rv|avt-s-rv|avt-rv-s|concept avt in reverse video w/status line, + is1=\E[=103l\E[=205h, flash=\E[=205l$<50>\E[=205h, + use=avt+s, use=avt-ns, +avt-w|avt-w-s|concept avt in 132 column mode w/with status line, + is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, + use=avt+s, use=avt-ns, +avt-w-rv|avt-rv-w|avt-w-s-rv|avt-w-rv-s|avt 132 cols w/status line, + is1=\E[=103h\E[=205h, smcup=\E[H\E[1;24;1;132w, + flash=\E[=205l$<50>\E[=205h, + use=avt+s, use=avt-ns, +# HDS 200 terminals +# +# if=hds give 3 screens of 24 lines each +# sets up for 3 inputs. F10 selects input channel 1 +# F11 selects input channel 2 +# F12 selects input channel 3 +# if=hds3 give 3 screens-> F10 17 lines F12 has 7 lines and F11 has 24 lines +# sets up for 3 inputs. F10 selects input channel 1 +# F11 selects input channel 3 +# F12 selects input channel 2 +# +# +hds200|generic hds 200, + am, xenl, mir, ul, xon, km, nxon, hs, + cols#80, lines#24, xmc#1, it#8, wsl#60, + bel=^G, cr=\r, clear=\E[H\E[J, + el=\E[K, ed=\E[J, cup=\E[%i%p1%02d;%p2%02dH, + cud1=\n, home=$<8*>\E[H, cub1=\b, + cnorm=\E[=119l, cuf1=\E[C, cuu1=\E[A, + cvvis=\E[=119h, dch1=\E[P, dl1=\E[M, + smir=\E1, smso=\E[7m, smul=\E[4m, + rmir=\E1, rmso=\E[m, rmul=\E[m, + is1=\E[1*q\E[2!t\E[7!t\E[=4;101;103;119l\E[=107;118;207h\E)1\E[1Q\EW\E[0:0:32!r\E2\r\n, if=/usr/share/lib/tabset/hds, il1=\E[L, + kbs=\b, nel=\r\n, ind=\n, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, khome=\E[H, +# +# +hds17|hds 17, + lines#17, + bel=^G, cr=\r, cud1=\n, + cub1=\b, if=/usr/share/lib/tabset/hds3, kbs=\b, + kcud1=\n, kcub1=\b, nel=\r\n, + ind=\n, use=hds200, +hds24|hds 24, + lines#24, + bel=^G, cr=\r, cud1=\n, + cub1=\b, if=/usr/share/lib/tabset/hds3, kbs=\b, + kcud1=\n, kcub1=\b, nel=\r\n, + ind=\n, use=hds200, +hds7|hds 7, + lines#7, + bel=^G, cr=\r, cud1=\n, + cub1=\b, if=/usr/share/lib/tabset/hds3, kbs=\b, + kcud1=\n, kcub1=\b, nel=\r\n, + ind=\n, use=hds200, +hds-w|hds wide, + cols#132, + bel=^G, cr=\r, cud1=\n, + cub1=\b, kbs=\b, kcud1=\n, + kcub1=\b, nel=\r\n, ind=\n, + use=hds200, +hds17-w| hds 17 wide, + cols#132, + bel=^G, cr=\r, cud1=\n, + cub1=\b, kbs=\b, kcud1=\n, + kcub1=\b, nel=\r\n, ind=\n, + use=hds17, +hds24-w|hds 24 wide, + cols#132, + bel=^G, cr=\r, cud1=\n, + cub1=\b, kbs=\b, kcud1=\n, + kcub1=\b, nel=\r\n, ind=\n, + use=hds24, +hds7-w|hds 7 wide, + cols#132, + bel=^G, cr=\r, cud1=\n, + cub1=\b, kbs=\b, kcud1=\n, + kcub1=\b, nel=\r\n, ind=\n, + use=hds7, diff --git a/usr/src/lib/terminfo/header b/usr/src/lib/terminfo/header new file mode 100644 index 0000000..864239a --- /dev/null +++ b/usr/src/lib/terminfo/header @@ -0,0 +1,47 @@ +#ident "@(#)terminfo:header 1.4" +# ------------------------ +# +# This file describes capabilities of various terminals, as needed by +# software such as screen editors. It does not attempt to describe +# printing terminals very well, nor graphics terminals. Someday. +# See terminfo(5) in the Unix Programmers Manual for documentation. +# +# Conventions: First entry is two chars, first char is manufacturer, +# second char is canonical name for model or mode. +# Third entry is the one the editor will print with "set" command. +# Last entry is verbose description. +# Others are mnemonic synonyms for the terminal. +# +# Terminal naming conventions: +# Terminal names look like - +# Certain abbreviations (e.g. c100 for concept100) are also allowed +# for upward compatibility. The part to the left of the dash, if a +# dash is present, describes the particular hardware of the terminal. +# The part to the right can be used for flags indicating special ROM's, +# extra memory, particular terminal modes, or user preferences. +# All names are always in lower case, for consistency in typing. +# Because of file naming restrictions, terminal names should not contain +# period or slash, in fact, entirely alphanumeric characters plus dash are +# highly recommended. These restrictions do not apply to the verbose name. +# +# The following are conventionally used flags: +# rv Terminal in reverse video mode (black on white) +# 2p Has two pages of memory. Likewise 4p, 8p, etc. +# w Wide - in 132 column mode. +# pp Has a printer port which is used. +# na No arrow keys - terminfo ignores arrow keys which are +# actually there on the terminal, so the user can use +# the arrow keys locally. +# # The number of lines on the screen. +# s With a status line. +# +# There are some cases where the same name is used for two different +# terminals, e.g. "teleray" or "2621" or "vt100". In these cases, +# if a site has one of these, they should choose a local default and +# bring that terminal to the front in the reorder script. This works +# because tgetent picks the first match in /etc/terminfo. +# +# If you absolutely MUST check for a specific terminal (this is discouraged) +# check for the 1st entry (the canonical form) since all other codes are +# subject to change. We would much rather put in special capabilities to +# describe your terminal rather than having you key on the name. diff --git a/usr/src/lib/terminfo/heath.ti b/usr/src/lib/terminfo/heath.ti new file mode 100644 index 0000000..693bdc9 --- /dev/null +++ b/usr/src/lib/terminfo/heath.ti @@ -0,0 +1,108 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:heath.ti 1.6" +# # -------------------------------- +# +# heath: HEATHKIT and ZENITH +# +# Manufacturer: HEATHKIT and ZENITH +# Class: I +h19-a|heath-ansi|heathkit-a|heathkit h19 ansi mode, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\E[1L$<1*>, am, cub1=^H, ed=\E[J, + el=\E[K, clear=\E[2J, cup=\E[%i%p1%d;%p2%dH, cols#80, + dch1=\E[1P, dl1=\E[1M$<1*>, cud1=\E[1B, + rmir=\E[4l, home=\E[H, smir=\E[4h, lines#24, mir, + cuf1=\E[1C, smacs=\E[10m, rmacs=\E[11m, msgr, ht=^I, it#8, + rmso=\E[0m, smso=\E[7m, cuu1=\E[1A, cvvis=\E[>4h, cnorm=\E[>4l, + kbs=^h, kcuu1=\E[1A, kcud1=\E[1B, kcub1=\E[1D, kcuf1=\E[1C, + khome=\E[H, + kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, lf6=blue, + lf7=red, lf8=white, kf6=\EOP, kf7=\EOQ, kf8=\EOR, + ri=\EM, is2=\E<\E[>1;2;3;4;5;6;7;8;9l\E[0m\E[11m\E[?7h, +h19-bs|heathkit w/keypad shifted, + smkx=\Et, rmkx=\Eu, use=h19-b, +h19-smul|heathkit w/keypad shifted/underscore cursor, + smkx=\Et, rmkx=\Eu, use=h19-u, +h19|heath|h19-b|heathkit|heath-19|z19|zenith|heathkit h19, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL$<1*>, am, cub1=^H, + ed=\EJ, el=\EK, clear=\EE, cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80, + dch1=\EN, dl1=\EM$<1*>, cud1=\EB, rmir=\EO, home=\EH, smir=\E@, + lines#24, mir, cuf1=\EC, smacs=\EF, rmacs=\EG, msgr, ht=^I, it#8, + ri=\EI, rmso=\Eq, smso=\Ep, cuu1=\EA, cvvis=\Ex4, cnorm=\Ey4, + kbs=^h, kcuu1=\EA, kcud1=\EB, kcub1=\ED, kcuf1=\EC, khome=\EH, + kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, + lf6=blue, lf7=red, lf8=white, kf6=\EP, kf7=\EQ, kf8=\ER, + hs, eslok, tsl=\Ej\Ex5\EY8%p1%' '%+%c\Eo\Eo, fsl=\Ek\Ey5, +h19-u|heathkit with underscore cursor, + cvvis@, cnorm@, use=h19-b, +# Info: +# This still doesn't work right - something funny is going on +# with return # and linefeed in the reach program. Apparently +# cr acts like crlf and lf is ignored. There is a "literal end +# of line mode" which works right, but this will cause cr's to +# appear in files that are spooled. This description assumes +# "normal end of line mode". +# +reach|h89|h89 running reach, + cr@, cud1=\EB, ind=\r\l, is2=\Ey3\Ev, use=h19-b, +alto-h19|altoh19|altoheath|alto-heath|alto emulating heathkit h19, + lines#60, il1=\EL, dl1=\EM, use=h19, +# Info: +# The major problem with the Z29 is that it requires more +# padding than the Z19. Once again, here's a little termcap +# entry for it that will do the trick. +# +# The problem declaring an H19 to be synonomous with a Z29 is that +# it needs more padding. It especially loses if a program attempts +# to put the Z29 into insert mode and insert text at 9600 baud. It +# even loses worse if the program attempts to insert tabs at 9600 +# baud. Adding padding to text that is inserted loses because in +# order to make the Z29 not die, one must add so much padding that +# whenever the program tries to use insert mode, the effective +# rate is about 110 baud. +# +# What program would want to put the terminal into insert mode +# and shove stuff at it at 9600 baud you ask? +# +# Emacs. Emacs seems to want to do the mathematically optimal +# thing in doing a redisplay rather than the practical thing. +# When it is about to output a line on top of a line that is +# already on the screen, instead of just killing to the end of +# the line and outputing the new line, it compares the old line +# and the new line and if there are any similarities, it +# constructs the new line by deleting the text on the old line +# on the terminal that is already there and then inserting new +# text into the line to transform it into the new line that is +# to be displayed. The Z29 does not act kindly to this. +# +# But don't cry for too long.... There is a solution. You can make +# a termcap entry for the Z29 that says the Z29 has no insert mode. +# Then Emacs cannot use it. "Oh, no, but now inserting into a +# line will be really slow", you say. Well there is a sort of a +# solution to that too. There is an insert character option on +# the Z29 that will insert one character. Unfortunately, it +# involves putting the terminal into ansi mode, inserting the +# character, and changing it back to H19 mode. All this takes 12 +# characters. Pretty expensive to insert one character, but it +# works. Either Emacs doesn't try to use its inserting hack when +# it's only given an insert character ability or the Z29 doesn't +# require padding with this (the former is probably more likely, +# but I haven't checked it out). +# +z29|zenith29|z29b|, + cr=^M, cud1=^J, ind=^J, bel=^G, is2=\E<\E[?2h\Ev, il1=\EL$<1>, am, + cub1=^H, ed=\EJ$<14>, el=\EK$<1>, clear=\EE$<14>, + cup=\EY%p1%' '%+%c%p2%' '%+%c, + cols#80, dch1=\EN$<0.1*>, dl1=\EM$<1>, cud1=\EB, home=\EH, + ich1=\E<\E[1@\E[?2h$<1>, lines#24, cuf1=\EC, + rmacs=\EF, smacs=\EG, ind=\n$<2>, msgr, ht=^I, ri=\EI$<2>, rmso=\Eq, + smso=\Ep, cuu1=\E$<1>A, cvvis=\Ex4, cnorm=\Ey4, kbs=^h, kcuu1=\EA, + kcud1=\EB, kcub1=\ED, kcuf1=\EC, khome=\EH, kf1=\ES, + kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, + kf9=\E0I, kf0=\E~, lf0=home, + cbt=\E-, smul=\Es8, rmul=\Es0, diff --git a/usr/src/lib/terminfo/homebrew.ti b/usr/src/lib/terminfo/homebrew.ti new file mode 100644 index 0000000..34847cc --- /dev/null +++ b/usr/src/lib/terminfo/homebrew.ti @@ -0,0 +1,75 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:homebrew.ti 1.7" +# # -------------------------------- +# +# homebrew: HOME MADE TERMINALS +# +# Manufacturer: HOME MADE TERMINALS +# Class: III +# +bc|bill croft homebrew, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z, cols#96, home=^^, lines#72, + cuf1=^L, cuu1=^K, +nucterm|rayterm|nuc|nuc homebrew, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, clear=^L$<1>, + lines#24, cols#80, cuf1=^C, cuu1=^N, home=^B, ll=^K, el=^A, ed=^E, +carlock|klc|, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=^E, am, el=^U, clear=^Z$<100>, + cup=\E=%p1%' '%+%c%p2%' '%+%c, cols#80, dch1=\177, dl1=^D, + rmir=^T, home=^^, smir=^T, lines#24, cuf1=^L, rmso=^V, smso=^V, + cuu1=^K, flash=\EV\EV, +# Info: +# EXIDY +# +ex3000, + cr=^M, cud1=^J, ind=^J, bel=^G, lines#24, cols#80, home=^Q, +exidy|exidy2500|exidy sorcerer as dm2500, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=^P^J^X, am, cub1=^H, + el=^W, clear=^^, cup=^L%p2%'`'%^%c%p1%'`'%^%c, cols#64, + dch1=\b, dl1=^P^Z^X, smdc=^P, ed=^X, rmir=^X, home=^B, ich1=^\, + smir=^P, lines#30, cuf1=^\, ht=^I, smso=^N, rmso=^X, cuu1=^Z, +sexidy|exidy smart, + cr=^M, cud1=^J, ind=^J, bel=^G, lines#24, cols#64, clear=^L, home=^Q, + cuf1=^S, cuu1=^W, cub1=^H, cub1=^A, kcud1=^S, +# Info: +# netx and xitex are almost identical, except for the padding +# on clear screen. Hmm. +# +xitex|xitex sct-100, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=^F^E$<2000>, el=^E$<1600>, + clear=^L$<400>, cup=\E=%p1%'@'%+%c%p2%'@'%+%c, cols#64, home=^D, + lines#16, cuf1=\E+@A, ri=\E=@@^K, cuu1=^K, +# NETRONICS +netx|netronics|, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=^F^E$<2000>, el=^E$<1600>, + clear=^L$<466>, cup=\E=%p1%'@'%+%c%p2%'@'%+%c, cols#64, home=^D, + lines#16, cuf1=\E+@A, ri=\E=@@^K, cuu1=^K, +smartvid|Netronics Smartvid 80, + cr=^M, cud1=^J, ind=^J, bel=^G, smacs=\EG@, am, rmacs=\EGB, + cub1=^H, cbt=\EI, bw, ed=\EY, el=\ET, clear=^L, + cup=\E=%p1%' '%+%c%p2%' '%+%c, + cols#80, dch1=\EW, dl1=\ER, cud1=^J, rmir=\ED, eo, home=^Z, + ich1=\EQ, smir=\EC, lines#24, ll=^Z^K, msgr, cuf1=^A, + rmso=\EG@, xmc#1, smso=\EGC, ri=^K, ht=\Ei, rmcup=^Z^K, + rmul=\EG@, cuu1=^K, smul=\EGA, cnorm=^Z^K, xhp, +smarterm|smarterm-s|netronics smarterm 80x24 naked terminal, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE, am, cub1=^H, cbt=\EI, + ed=\EY, el=\ET, clear=^L, cup=\E=%p1%' '%+%c%p2%' '%+%c$<6>, + cols#80, lines#24, + dch1=\EW, dl1=\ER, cud1=^J, rmir=\ED, home=^Z, ich1=\EQ, + smir=\EC, cuf1=^A, ht=^I, rmul=\EG@, xmc#1, ul, + smul=\EGA, +ubell|ubellchar|, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ht=^I, el=\Ed, + clear=^Z, cup=\E=%p1%' '%+%c%p2%' '%+%c, cols#80, lines#24, cuf1=^L, + cuu1=^K, home=^^, +ttywilliams, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#12, + cub1=^Y, cud1=^K, cuu1=^Z, clear=^^, el=^_, am, home=^], cuf1=^X, diff --git a/usr/src/lib/terminfo/hp.ti b/usr/src/lib/terminfo/hp.ti new file mode 100644 index 0000000..344490e --- /dev/null +++ b/usr/src/lib/terminfo/hp.ti @@ -0,0 +1,497 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:hp.ti 1.21" +# # -------------------------------- +# +# hp: HEWLETT PACKARD +# +# Manufacturer: HEWLETT PACKARD +# Class: I +# +# Info: +# Generic HP terminal - this should (hopefully) work on any HP +# terminal. +# +hp|hewlett-packar|hewlettpackard, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL, am, + cub1=^H, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, clear=\EH\EJ, + cup=\E&a%p2%dc%p1%dY$<6>, cols#80, vpa=\E&a%p1%dY, lm#0, da, db, + dch1=\EP, dl1=\EM, rmir=\ER, smir=\EQ, kbs=^H, lines#24, mir, + cuf1=\EC, ht=^I, rmso=\E&d@, smso=\E&dJ, + smul=\E&dD, rmul=\E&d@, cuu1=\EA, xhp, vt#6, kcbt=\Ei, + +hp110|hewlett-packard model 110 portable, + lines#16,use=hp, + +hp+pfk+cr|hp function keys with CR, + kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, + kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, + +hp+pfk-cr|hp function keys w/o CR, + kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, + kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + +# Info: +# The 2621's use the same keys for the arrows and function keys, +# but not separate escape sequences. These definitions allow the +# user to use those keys as arrow keys rather than as function +# keys. +# +hp+pfk+arrows|hp alternate arrow definitions, + khome=\Ep\r, kll=\Eq\r, kind=\Er\r, kri=\Es\r, + kcuu1=\Et\r, kcub1=\Eu\r, kcuf1=\Ev\r, kcud1=\Ew\r, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + +hp+arrows|hp arrow definitions, + kcuu1=\EA, kcud1=\EB, kcub1=\ED, kcuf1=\EC, + khome=\Eh, kll=\EF, kind=\ES, kri=\ET, + +# Info: +# Generic stuff from the HP 262x series +# +hp262x, + dch1=\EP$<2>, ip=$<2>, rmso=\E&d@, smso=\E&dB, ed=\ED\EJ$<500>\EC, + rev=\E&dB, smul=\E&dD, blink=\E&dA, invis=\E&dS, sgr0=\E&d@, rmul=\E&d@, + sgr=\E&d%'@'%?%p1%t%'B'%|%;%?%p2%t%'D'%|%;%?%p3%t%'B'%|%;%?%p4%t%'A'%|%;%c, + khome=\Eh, kcuu1=\EA, kcub1=\ED, kcuf1=\EC, kcud1=\EB, + smkx=\E&s1A, rmkx=\E&s0A, knp=\EU, kpp=\EV, kri=\ET, + kind=\ES, kil1=\EL, kdl1=\EM, kich1=\EQ, kdch1=\EP, + kel=\EK, ked=\EJ, krmir=\ER, + ind=\ES, ht=^I$<2>, xhp, + ed=\EJ, +# Info: +# Note: no "home" on HP's since that homes to top of memory, not +# screen. +# +# The only way to get the arrow keys to transmit anything at all +# is to turn on the function key labels (f1-f8) with smkx, and +# even then the user has to hold down shift! +# +# The default 2621 turns off the labels except when it has to to +# enable the function keys. If your installation prefers labels +# on all the time, or off all the time (at the "expense" of the +# function keys) move the # 2621-nl or 2621-wl labels to the +# front using reorder. +# +# Note: there are newer ROM's for 2621's that allow you to set +# strap A so the regular arrow keys xmit \EA, etc, as with the +# 2645. However, even with this strap set, the terminal stops +# xmitting if you reset it, until you unset and reset the strap! +# Since there is no way to set/unset the strap with an escape +# sequence, we don't use it in the default. +# +# If you like, you can use 2621-ba (bad arrow keys). +# +hp2621-ba|2621-ba|2621 w/new rom and strap A set, + smkx@, rmkx@, + use=hp+arrows, + use=hp2621, + +# Info: +# 2621 with function labels. Most of the time they are off, +# but inside vi, the function key labels appear. You have to +# hold down shift to get them to xmit. +# +hp2621|hp2621a|hp2621A|2621|2621a|2621A|hp2621-wl|2621-wl|hp 2621 w/labels, + is2=\E&jA\r, rmkx=\E&jA, use=hp2621-fl, + +# Info: +# 2621 with function labels. Most of the time they are off, +# but inside vi, the function key labels appear. You have to +# hold down shift to get them to xmit. +# +hp2621-fl|2621-fl|hp 2621, + is2=\E&j@\r, cbt=\Ei, cup=\E&a%p2%dc%p1%dY, + dch1=\EP$<2>, ip=$<2>, pb#19200, + smso=\E&dD, rmso=\E&d@, smul=\E&dD, rmul=\E&d@, sgr0=\E&d@, xhp@, + use=hp+pfk+cr, smkx=\E&jB, rmkx=\E&j@, ht=^I$<2>, xon, use=hp, + +# Info: +# To use 2621p printer, setenv TERM=2621p, PRINTER=2612p +# +hp2621p|2621p|2621P|hp 2621 with printer, + mc5=\E&p11C, mc4=\E&p13C, use=hp2621, + +hp2621p-a|2621p-a|hp2621p with fn as arrows, + use=hp+pfk+arrows, use=hp2621p, + +# Info: +# hp2621 with k45 keyboard +# +hp2621-k45|hp2621k45|2621k45|k45|hp 2621 with 45 keyboard, + kbs=^H, kcuu1=\EA, kcud1=\EB, kcub1=\ED, kcuf1=\EC, khome=\Eh, + smkx=\E&s1A, rmkx=\E&s0A, use=hp2621, + +# Info: +# This terminal should be used at 4800 baud or less. It needs +# padding for plain characters at 9600, I guessed at an +# appropriate cr delay. +# +# It really wants ^E/^F handshaking, but that doesn't work well +# even if you write software to support it. +# +2645|hp2645|hp45|hp 264x series, + dim=\E&dH, rev=\E&dB, smul=\E&dD, blink=\E&dA, sgr0=\E&d@, + sgr=\E&d%'@'%?%p1%t%'B'%|%;%?%p2%t%'D'%|%;%?%p3%t%'B'%|%;%?%p4%t%'A'%|%;%?%p5%t%'H'%|%;%?%p6%t%'B'%|%;%c, + kcuu1=\EA, kcud1=\EB, kcub1=\ED, kcuf1=\EC, khome=\Eh, + kctab=\E2, khts=\E1, + smkx=\E&s1A, rmkx=\E&s0A, knp=\EU, kpp=\EV, kri=\ET, kind=\ES, + kil1=\EL, kdl1=\EM, kich1=\EQ, kdch1=\EP, + kel=\EK, ked=\EJ, krmir=\ER, pb#9600, cr=^M$<20>, use=hp, + +# Info: +# Hp 2624 B with 4 or 10 pages of memory. +# +# Some assumptions are made with this entry. These settings are +# NOT set up by the initialization strings. +# +# Port Configuration +# RecvPace=Xon/Xoff +# XmitPace=Xon/Xoff +# StripNulDel=Yes +# +# Terminal Configuration +# InhHndShk=Yes +# InhDC2=Yes +# XmitFnctn(A)=No +# InhEolWrp=No +# +# Note: the 2624 DOES have a true "home," believe it or not! +# +# The 2624 has an "error line" to which messages can be sent. +# This is CLOSE to what is expected for a "status line". However, +# after a message is sent to the "error line", the next carriage +# return is EATEN and the "error line" is turned back off again! +# So I guess we can't define hs, eslok, wsl, dsl, fsl, tsl +# +# This entry supports emacs (and any other program that uses raw +# mode) at 4800 baud and less. I couldn't get the padding right +# for 9.6. +# + +hp2624|hp2624a|hp2624b|hp2624b-4p|2624-4p|2624|2624a|2624b|Hewlett Packard 2624 B, + da, db, lm#96, + flash=\E&w13F\200\200\200\200\E&w12F\200\200\200\200\E&w13F\200\200\200\200\E&w12F, + use=hp+labels, + use=scrhp, + +# Info: +# These attributes are not set above: +# +# civis, cmdch, cnorm, csr, cub, cud, cuf, cuu, cvvis, dch, dl, +# ech, eo, eslok, fsl, gn, hc, hd, hu, hz, ich, ich1, if, il, in, +# indn, iprog, is2, is3, it, ka1, ka3, kb2, kc1, kc3, kclr, kf0, +# kf10, khts, km, ktbc, lf0, lf1, lf10, lf2, lf3, lf4, lf5, lf6, +# lf7, lf8, lf9, mc5p, os, pad, pfkey*, pfloc*, pfx*, prot, rc, +# rep, rin, rmcup, rmdc, rmm, rs2, rs3, sc, smcup, smdc, smm, tsl, +# uc, ul, vt, wind, wsl, xenl, xmc, xsb, xt +# +# not needed if tset is used: +# if=/usr/share/lib/tabset/std, +# +# This 2626 entry does not use any of the fancy windowing stuff +# of the 2626. +# +# Indeed, terminfo does not yet handle such stuff. Since changing +# any window clears memory, it is probably not possible to use +# this for screen opt. +# +# ed is incredibly slow most of the time - I am guessing at the +# exact padding. Since the terminal uses xoff/xon this is intended +# only for cost computation, so that the terminal will prefer el +# or even dl1 which is probably faster! +# +# \ED\EJ\EC hack for ed from Ed Bradford - apparently ed is only +# extra slow # on the last line of the window. +# +# The padding probably should be changed. +# +hp2626|hp2626a|hp2626p|2626|2626a|2626p|2626A|2626P|hp 2626, + ed=\ED\EJ$<500>\EC, + ip=$<4>, + is2=\E&j@\r, + pb#19200, + da, db, lm#0, + indn=\E&r%p1%dD, + rin=\E&r%p1%dU, + use=hp+pfk+cr, + use=hp+labels, + use=scrhp, + +# Info: +# This entry is for sysline. It allocates a 23 line window with +# a 115 line workspace for regular use, and a 1 line window for +# the status line. +# +# This assumes port 2 is being used. +# Turn off horizontal line, Create ws #1 with 115 lines, +# Create ws #2 with 1 line, Create window #1 lines 1-23, +# Create window #2 lines 24-24, Attach cursor to workspace #1. +# Note that this clears the tabs so it must be done by tset before +# it sets the tabs. +# +hp2626-s|2626-s|hp 2626 using only 23 lines, + tsl=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC, + fsl=\E&d@\E&w7f2p1I\E&w4f1I, eslok, hs, + is1=\E&q3t0{0H \E&w0f115n1I \E&w0f1n2I + \E&w2f1i0d0u22l0S \E&w2f2i0d23u23l0S \E&w7f2p1I \r, + lines#23, use=2626, +# Info: +# Force terminal back to 24 lines after being 23. +# +hp2626-ns|2626-ns|hp 2626 using all 24 lines, + is1=\E&q3t0{0H \E&w0f118n1I \E&w0f1n2I + \E&w2f1i0d0u23l0S \E&w3f2I \E&w7f2p1I \r, + use=2626, +# Info: +# Various entries useful for small windows on 2626. +# +hp2626-12|2626-12, + lines#12, use=2626, +hp2626-12x40|2626-12x40, + cols#40, lines#12, use=2626, +hp2626-x40|2626-x40, + cols#40, use=2626, +hp2626-12-s|2626-12-s, + lines#11, use=2626-s, +# Info: +# You should use this terminal at 4800 baud or less. +# +hp2648|hp2648a|2648a|2648A|2648|HP 2648a graphics terminal, + clear=\EH\EJ$<50>, cup=\E&a%p2%dc%p1%dY$<20>, + dch1=\EP$<7>, ip=$<5>, use=2645, + +# Info: +# 2640a doesn't have the Y cursor addressing feature, and C is +# memory relative instead of screen relative, as we need. +# +2640|hp2640a|2640a|hp 2640a, + cup@, smkx@, rmkx@, use=2645, + +2640b|hp2640b|2644a|hp2644a|hp 264x series, + smkx@, rmkx@, use=2645, + +# Info: +# 2621 using all 48 lines of memory, only 24 visible at any time. +# +hp2621-48|2621-48|48 line 2621, + vpa=\E&a%p1%dR, lines#48, home=\EH, cup=\E&a%p2%dc%p1%dR, use=hp2621, + +# Info: +# 2621 with no labels ever. Also prevents vi delays on escape. +# +hp2621-nl|2621-nl|hp 2621 with no labels, + smkx@, rmkx@, khome@, kcuu1@, kcub1@, kcuf1@, kcud1@, use=hp2621-fl, + +# Info: +# Needed for UCB ARPAVAX console, since lsi-11 expands tabs +# (wrong). +# +hp2621-nt|2621-nt|hp 2621 w/no tabs, + ht@, use=hp2621, + +# Info: +# The HP 150 terminal is a fairly vanilla HP terminal, with the +# clreol standout problem. It also has graphics capabilities and +# a touch screen, which we don't describe here. +# +hp150|Hewlett Packard Model 150, + use=2622, + +# Info: +# Hp 2382a terminals, "the little ones." They don't have any +# alternate character set support and sending out ^N/^O will +# leave the screen blank. +# +hp2382a|hp2382|Hewlett Packard 2382a, + da, db, lm#48, + pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, + lh#1, use=hp+labels, + rmacs@, smacs@, acsc@, + sgr0=\E&d@, + sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%'@'%+%e%'S'%;%e%?%ga%t%ga%'@'%+%e%'@'%;%;%c, + use=scrhp, + +hp2621-a|hp2621a-a|2621-a|hp2621 with fn as arrows, + use=hp+pfk+arrows, use=hp2621-fl, + +# Info: +# new Hewlett Packard terminals +# +# This entry supports emacs (and any other program that uses raw +# mode) at 4800 baud and less. I couldn't get the padding right +# for >=9.6. +# + +newhpkeyboard|generic entry for HP extended keyboard, + kbs=^H, kcbt=\Ei, kclr=\EJ, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, + use=hp+pfk-cr, + khome=\Eh, kich1=\EQ, kil1=\EL, kind=\ET, kll=\EF, + knp=\EU, kpp=\EV, kri=\ES, krmir=\ER, + rmkx=\E&s0A, smkx=\E&s1A, + +newhp|generic entry for new Hewlett Packard terminals, + am, bw, mir, xhp, xon, + cols#80, lines#24, pb#4800, + acsc=T1R!U2S"W3O#V4P$t5u6w7v8:'9(LQKWlRkT5I3@2[MAJSmFjGdHQ;Y+Z*X:4>q\,x.n/, + bel=^G, blink=\E&dA, bold=\E&dF, cbt=\Ei, cr=^M, + cub1=^H, cud1=^J, cuf1=\EC, cuu1=\EA, +# cub1=\ED, cud1=\EB, + dch1=\EP$<2>, dim=\E&dH, dl1=\EM, + ed=\EJ, el=\EK, ht=^I$<2>, + hts=\E1, il1=\EL, ind=^J, invis=\E&dS, ip=$<2>, is1=\E&jB$<8>, +# ind=\ES, + nel=^M^J, + pfkey=\E&f0a%p1%dk0d%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk0d%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk0d%p2%l%dL%p2%s, + rev=\E&dB, ri=\ET, rmacs=^O, rmir=\ER, rmso=\E&d@, rmul=\E&d@, + rs1=\Eg, + sgr0=\E&d@^O, +# Info: +# sgr is figured out as follows: +# tparm parameters +# 1=standout, 2=underlining, 3=reverse video, 4=blinking, 5=dim, +# 6=bold, 7=blank, 8=protection, 9=alternate character set +# The protection parameter is ignored. +# combination parameters +# standout = reverse + half-intensity = 3 | 5. +# bold = reverse + underline = 2 | 3. +# + sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%'@'%+%e%'S'%;%e%?%ga%t%ga%'@'%+%e%'@'%;%;%c%?%p9%t^N%e^O%;, + smacs=^N, smir=\EQ, smso=\E&dJ, smul=\E&dD, + tbc=\E3, + use=newhpkeyboard, + +memhp|memory relative addressing for new HP ttys, + vt#6, + clear=\EH\EJ$<40>, + cub=\E&a-%p1%dC, cud=\E&a+%p1%dR, cuf=\E&a+%p1%dC, cuu=\E&a-%p1%dR, + cup=\E&a%p1%dr%p2%dC, mrcup=\E&a%p1%dr%p2%dC, + home=\EH, hpa=\E&a%p1%dC, ll=\E&a23R^M, vpa=\E&a%p1%dR, + use=newhp, + +scrhp|screen relative addressing for new HP ttys, + clear=\E&a0x0Y\EJ$<40>, + cub=\E&a-%p1%dC, cud=\E&a+%p1%dR, cuf=\E&a+%p1%dC, cuu=\E&a-%p1%dR, + cup=\E&a%p1%dy%p2%dX$<10>, mrcup=\E&a%p1%dr%p2%dC, + home=\E&a0y0X, hpa=\E&a%p1%dC, ll=\E&a0y0X\EA, vpa=\E&a%p1%dY, + use=newhp, + +hp+labels|"standard" label info for new HP ttys, + lh#2, lw#8, nlab#8, + pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s, + smln=\E&jB, + +hp+printer| "standard" printer info for HP ttys, + ff=\E&p4u0C, mc0=\EH\E&p4dF, mc4=\E&p13C, mc5=\E&p11C, + + +# Info: +# The new hp2621b is kind of a cross between the old 2621 and the +# new 262x series of machines. It has dip-switched options. +# The firmware has a bug in it such that if you give it a null +# length label, the following character is eaten! +# + +hp2621b|2621b|hp 2621b with old style keyboard, + lm#48, lh#1, lw#8, nlab#8, + pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d3L%?%ga%!%t%' '%c%;%p2%s\E%'o'%p1%+%c\r, + smln=\E&jB, + khome=\Eh, kll=\EF, kri=\ES, kind=\ET, + kcuu1=\EA, kcub1=\ED, kcuf1=\EC, kcud1=\EB, + use=hp2621, + +hp2621b-p|2621b-p|hp 2621b with printer, + use=hp+printer, + use=hp2621b, + +# Info: +# hp2621b - new 2621b's with new extended keyboard +# these are closer to the new 26xx series than the other 2621b +# +hp2621b-kx|2621b-kx|hp 2621b with extended keyboard, + use=newhpkeyboard, + use=hp2621b, + +hp2621b-kx-p|2621b-kx-p|hp 2621b with new keyboard & printer, + use=hp+printer, + use=hp2621b-kx, + +# Info: +# Some assumptions are made in the following entries. +# These settings are NOT set up by the initialization strings. +# +# Port Configuration +# RecvPace=Xon/Xoff XmitPace=Xon/Xoff StripNulDel=Yes +# +# Terminal Configuration +# InhHndShk(G)=Yes InhDC2(H)=Yes +# XmitFnctn(A)=No InhEolWrp=No +# +# +# Hp 2622a & hp2623a display and graphics terminals +# +hp2622|hp2622a|2622|2622a|hp 2622, + use=hp+pfk+cr, + is2=\E&dj@\r, + pb#19200, + da, db, lm#0, + use=hp+labels, + use=scrhp, + +# Info: +# The 2623 is a 2622 with extra graphics hardware. +# +hp2623|hp2623a|2623|2623a|hp 2623, + use=hp2622, + + +hp2624b-p|hp2624b-4p-p|Hewlett Packard 2624 B with printer, + use=hp+printer, + use=hp2624b, + +# Info: +# The Hewlett Packard B can have an optional extra 6 pages of +# memory. +# + +hp2624-10p|hp2624a-10p|hp2624b-10p|2624-10p|2624a-10p|2624b-10p|Hewlett Packard 2624 B w/ 10 pages of memory, + lm#240, use=hp2624b, + +hp2624b-10p-p|Hewlett Packard 2624 B w/ extra memory & printer, + lm#240, use=hp2624b-p, + +# Info: +# Color manipulations for HP terminals + +hp+color|hp with colors, + ccc, + pairs#8, colors#16, ncv#17, + scp=\E&v%p1%dS, + initp=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a + %?%p3%{1000}%=%t1%e.%p3%d%;b + %?%p4%{1000}%=%t1%e.%p4%d%;c + %?%p5%{1000}%=%t1%e.%p5%d%;x + %?%p6%{1000}%=%t1%e.%p6%d%;y + %?%p7%{1000}%=%t1%e.%p7%d%;z + %p1%dI, + oc=\E&v0m1a1b1c0I\E&v1a1I\E&v1b2I\E&v1a1b3I\E&v1c4I\E&v1a1c5I\E&v1b1c6I\E&v1x1y7I, + op=\E&v0S, + +# Info: +# is2 disables the dispay, set screen to be 80 columns wide, +# set all function keys to transmit default strings, clears +# the screen and then enables the display. +# + +hp2397|2397|2397a|hp2397a|HP 2397A, + is2=\E*dF\E&w6f80X\E&f0a1k2d2Lf1\Ep\E&f0a2k2d2Lf2\Eq\E&f0a3k2d2Lf3\Er\E&f0a4k2d2Lf4\Es\E&f0a5k2d2Lf5\Et\E&f0a6k2d2Lf6\Eu\E&f0a7k2d2Lf7\Ev\E&f0a8k2d2Lf8\Ew\EH\EJ$<40>\E*dE, + use=scrhp, use=hp+labels, use=hp+color, diff --git a/usr/src/lib/terminfo/lsi.ti b/usr/src/lib/terminfo/lsi.ti new file mode 100644 index 0000000..7853dc4 --- /dev/null +++ b/usr/src/lib/terminfo/lsi.ti @@ -0,0 +1,90 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:lsi.ti 1.5" +# # -------------------------------- +# +# lsi: LEAR SIEGLER (ADM) +# +# Manufacturer: LEAR SIEGLER +# Class: III +# +adm1a|adm1|lsi adm1a, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=\E;$<1>, + cols#80, home=^^, lines#24, cuf1=^L, cuu1=^K, +adm2|lsi adm2, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE, am, cub1=^H, ed=\EY, el=\ET, + clear=\E;, cup=\E=%p1%' '%+%c%p2%' '%+%c, cols#80, dch1=\EW, dl1=\ER, + home=^^, ich1=\EQ, kcud1=^J, khome=^^, kcub1=^H, kcuf1=^L, kcuu1=^K, + lines#24, cuf1=^L, cuu1=^K, +adm3|lsi adm3, + cr=^M, cud1=^J, ind=^J, bel=^G, + am, cub1=^H, clear=^Z, lines#24, cols#80, +adm3a|3a|lsi adm3a, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z$<1>, + cols#80, home=^^, lines#24, cuf1=^L, cuu1=^K, +adm3a+|3a+|adm3aplus|lsi adm3a+, + kcub1=^H, kcud1=^J, kcuu1=^K, kcuf1=^L, use=adm3a, +adm5|lsi adm5, + cr=^M, cud1=^J, ind=^J, bel=^G, + ed=\EY, el=\ET, cud1=^J, kbs=^H, khome=^^, + rmso=\EG, xmc#1, smso=\EG, use=adm3aplus, +adm21|lear siegler adm21, + cr=^M, cud1=^J, ind=^J, bel=^G, ed=\EY, el=\ET, il1=30*\EE, + dl1=30*\ER, ich1=\EQ, dch1=\EW, smul=\EG8, + rmul=\EG0, xmc#1, smso=\EG4, rmso=\EG0, kbs=^H, kcub1=^H, + kcuf1=^L, kcuu1=^K, kcud1=^J, khome=^^, use=adm3a, +# Info: +# If the adm31 gives you trouble with standout mode, check the +# DIP switch in position 6, bank @c11, 25% from back end of pad. +# Should be OFF. +# +# If there is no such switch, you have an old adm31 and must use +# oadm31 +# +adm31|31|lsi adm31, + is2=\Eu\E0, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE, am, cub1=^H, + el=\ET, cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=\E*, ed=\EY, cols#80, + dch1=\EW, dl1=\ER, rmir=\Er, home=^^, smir=\Eq, + kf0=^A0\r, kf1=^A1\r, kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, + kf5=^A5\r, kf6=^A6\r, kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, + kcud1=^J, kcub1=^H, kcuf1=^L, kcuu1=^K, + lines#24, mir, cuf1=^L, + rmso=\EG0, smso=\EG1, cuu1=^K, smul=\EG1, rmul=\EG0, +oadm31|o31|old adm31, + smso=\EG4, smul@, rmul@, use=adm31, +# Info: +# I had an ADM36 at home for a month and setup the following +# termcap entry for it. The entry is not fancy (doesn`t set tabs, +# doesn't implement Highlighting or reverse video, etc.), but +# works well with vi. It uses the terminal in ADM36 mode not the +# alternate vt52 emulation mode. +# +36|adm36|lsi adm36, + el=\E[0K, ed=\E[0J, cup=\E[%i%p1%d;%p2%dH, + cuf1=\E[D, cuu1=\E[A, cols#80, lines#24, am, cub1=^H, + clear=\E[H\E[2J, il1=\E[1L$<100>, dl1=\E[1M, + smir=\E[4h, rmir=\E[4l, mir, + kcuu1=\E[A, kcud1=\EB, kcuf1=\EC, kcub1=\ED, + is2=\E[6;?7h\E[4;20;?1;?3;?6;?4l\E(B\E)B\E>, +adm42|42|lsi adm42, + cvvis=\EC\E3 \E3(, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE$<270>, + am, cub1=^H, ed=\EY, el=\ET, clear=\E;, cup=\E=%p1%' '%+%c%p2%' '%+%c, + cols#80, dch1=\EW, dl1=\ER, rmir=\Er, smir=\Eq, ip=$<6*>, lines#24, + cbt=\EI, cuf1=^L, rmso=\EG0, smso=\EG4, ht=\t, cuu1=^k, + pad=\177, kcud1=^J, kcuf1=^L, kcuu1=^K, kcub1=^H, khome=^^, +# Info: +# The following termcap for the Lear Siegler ADM-42 leaves the +# "system line" at the bottom of the screen blank (for those who +# find it distracting otherwise) +# +adm42-nl|42-nl|lsi adm-42 with no system line, + il1=\EE\EF ^I, cbt=\EI\EF ^I, ed=\EY\EF ^I, el=\ET\EF ^I, clear=\E;\EF ^I, + cup=\E=%p1%' '%+%c%p2%' '%+%c$<6>\EF ^I, dch1=\EW\EF ^I, dl1=\ER\EF ^I, + rmir=\Er\EF ^I, smir=\Eq\EF ^I, use=adm42, diff --git a/usr/src/lib/terminfo/microterm.ti b/usr/src/lib/terminfo/microterm.ti new file mode 100644 index 0000000..9d08971 --- /dev/null +++ b/usr/src/lib/terminfo/microterm.ti @@ -0,0 +1,115 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:microterm.ti 1.6" +# # -------------------------------- +# +# microterm: MICROTERM +# +# Manufacturer: MICROTERM +# Class: III +microterm|act4|microterm act iv, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^_, el=^^, clear=^L, + cup=^T%p1%c%p2%c, cols#80, lines#24, cuf1=^X, cuu1=^Z, home=^], +# Info: +# The padding on cuf1 for act5 and mime is a guess and not final. +# The act5 has hardware tabs, but in cols 8, 16, 24, 32, 41 (!), 49, ... +# +microterm5|act5|microterm act v, + uc=\EA, ri=\EH$<3>, kcuu1=^Z, kcud1=^K, kcub1=^H, kcuf1=^X, use=act4, +# Info: +# Act V in split screen mode. act5-s is not tested and said not +# to work. +# Could have been because of the funny tabs - it might work now. +# +act5-s|act5s|act 5 in split screen mode, + smcup=\EP, rmcup=\EQ, lines#48, cols#39, use=act5, +# Info: +# These mime1 entries refer to the Microterm Mime I or Mime II. +# The default mime is assumed to be in enhanced act iv mode. +# There is a ^Q in is2 to unwedge any lines that wedge on ^S. +# +mime|mime1|mime2|mimei|mimeii|microterm mime1, + cup=^T%p1%{24}%+%c%p2%?%p2%{32}%>%t%{48}%+%;%{80}%+%c, cols#80, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=^A$<80>, am, cub1=^H, + ed=^_, el=^^, clear=\035^C, dl1=^W$<80>, ht=^I, lines#24, + cuf1=^X, it#8, uc=^U, cuu1=^z, home=\035, cud1=^K, is2=\E^S^Q, + kcuu1=^Z, kcud1=^K, kcub1=^H, kcuf1=^X, ri=^R$<3>, vt#9, +mime-na|mime with no arrow keys, + kcuu1@, kcud1@, kcuf1@, use=mime, +mime-3a|mime-adm3a|mime1 emulating adm3a, + cols#80, lines#24, + bel=^G, clear=^Z$<1>, cr=\r, cub1=\b, cud1=\n, + cuf1=\f, cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, + home=^^, ind=\n, kcub1=\b, kcud1=^K, kcuf1=^X, + kcuu1=^Z, +mime-3ax|mime-adm3ax|mime1 emulating enhanced adm3a, + il1=^A$<80>, dl1=^W$<80>, ht=^I$<3>, it#8, el=^X, ed=^_, use=mime-3a, +# Info: +# Mimes using brightness for standout. Half bright is very dim +# unless you turn up the brightness so far that lines show up on +# the screen. +# +mime-fb|full bright mime1, + smso=^Y, rmso=^S, is2=^S\E^Q, use=mime, +mime-hb|half bright mime1, + smso=^S, rmso=^Y, is2=^Y\E, use=mime, +# Info: +# These entries (for mime 2a) put the terminal in low intensity +# mode since high intensity mode is so obnoxious. +# This is the preferred mode (but ^X can't be used as a kill +# character (?)) +# +mime2a|mime2a-v|microterm mime2a (emulating an enhanced vt52), + cr=^M, cud1=^J, ind=^J, bel=^G, il1=^A$<20*>, cub1=^H, ed=\EQ$<20*>, + cols#80, el=\EP, clear=\EL, cup=\EY%p1%' '%+%c%p2%' '%+%c, is2=^Y, + dch1=^N, dl1=^W$<20*>, ip=$<2>, rmir=^Z, home=\EH, smir=^O, cuu1=\EA, + ri=\EA, kcud1=\EB, kcub1=\ED, kcuf1=\EC, kcuu1=\EA, lines#24, + cuf1=\EC, ht=^I, it#8, rmso=\E9, smso=\E8, smul=\E4, rmul=\E5, +mime2a-s|microterm mime2a (emulating an enhanced soroc iq120), + cr=^M, cud1=^J, ind=^J, bel=^G, il1=^A$<20*>, am, cub1=^H, ed=\EJ$<20*>, + el=\EK, clear=\EL, cup=\E=%p1%' '%+%c%p2%' '%+%c, cols#80, dch1=\ED, + dl1=^W$<20*>, kcub1=^H, kcuf1=^L, kcuu1=^K, kcud1=^J, home=^^, is2=\E), + ri=\EI, smir=\EE, rmir=^Z, ip=$<2>, lines#24, cuf1=^L, cuu1=\EI, + smso=\E:, rmso=\E;, smul=\E6, rmul=\E7, +# Info: +# Wed Mar 9 18:53:21 1983 +# We run our terminals at 2400 Baud, so there might be some timing +# problems at higher speeds. +# The major improvements in this mod are the terminal now +# scrolls down and insert mode works without redrawing the rest +# of the line to the right of the cursor. This is done with a +# bit of a kludge using the exit graphics mode to get out of +# insert, but it does not appear to hurt anything when using +# vi at least. If you have some users using act4's with programs +# that use curses and graphics mode this could be a problem. +# +mm3|mime314|mm314|mime 314, + am, cub1=^H, ht=^I, ed=^_, el=^^, clear=^L, cup=^T%p1%c%p2%c, + cols#80, lines#24, cuf1=^X, cuu1=^Z, + home=^], kcud1=^K, kcub1=^H, kcuf1=^X, kcuu1=^Z, + il1=^A, dch1=^D, dl1=^W, smir=^S, rmir=^V, +# Info: +# Fri Aug 5 08:11:57 1983 +# this entry works for ergo 4000's with the following setups: +# ansi,wraparound,newline disabled, xon/xoff disabled in both +# setup a & c +# +# WARNING!!! There are multiple versions of ERGO 4000 microcode +# Be advised that very early versions DO NOT WORK RIGHT !! +# Microterm does have a ROM exchange program- use it or lose big +# +m8|ergo4000|microterm ergo 4000, + cr=^M, cud1=^J, ind=^J, bel=^G, ed=\E[0J$<15>, el=\E[0K$<13>, + clear=\E[H\E[2J$<80>, cub1=^H, cuf1=\E[C, cuu1=\E[A, cud1=\E[B, + cup=\E[%i%p1%d;%p2%dH, cols#80, lines#66, da, db, dch1=\E[1P$<80>, + il=\E[1L$<5*>, dl1=\E[1M$<5*>, smir=\E[4h$<6>, rmir=\E[4l, + is2=\E<\E=\E[?1l\E[?4l\E[?5l\E[?7h\E[?8h$<300>, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kcud1=\E[B, rmkx=\E=$<4>, + kcub1=\E[D, kcuf1=\E[C, smkx=\E=$<4>, kcuu1=\E[A, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, msgr, ht=^I, rmso=\E[0m$<20>, + smso=\E[7m$<20>, ri=\EM$<20*>, ind=\ED$<20*>, diff --git a/usr/src/lib/terminfo/misc.ti b/usr/src/lib/terminfo/misc.ti new file mode 100644 index 0000000..50ad894 --- /dev/null +++ b/usr/src/lib/terminfo/misc.ti @@ -0,0 +1,740 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:misc.ti 1.21" +# # -------------------------------- +# +# misc: MISCELLANEOUS TERMINALS +# +# Manufacturer: MISCELLANEOUS TERMINALS +# Class: III +# +# Info: +# This file is for manufacturers with only a few terminals. +# They are included alphabetically by manufacturer. Hard copy +# terminals, personal computers, special "made up" terminals +# and homemade terminals go in separate files. +# +aed512|aed|AED 512, + cr=^M, cud1=^J, bel=^G, + cols#64, lines#40, clear=^L, + cub1=^H, cuf1=\Ei0800\001, + cnorm=\E\072004=000200??\001, + flash=\EK0001??0000K0001202080\001, + smso=\E\07200>8000140[80C00\001, rmso=\E[00C80\001, + smul=\E\07200>8000140\001, rmul=\E\07200>8000100\001, + uc=\Ei???>l0800i0102\001, + smcup=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001, + rmcup=\E\07200>8000100{804<0??00001000L80\072004=000200??\001, + ind=\E;1100\072004=000200??;1300\047\200\001\n\E\072004=0002??00;1200\001\n, + cuu1=^K, .cup=\E;1300%p1%c%p2%c\001, +ampex|d80|dialogue|dialogue80|ampex dialogue 80, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, + is2=\EA, ul, smul=\El, rmul=\Em, + am, bw, cub1=^H, ht=^I, clear=\E*$<75>, cup=\E=%p1%' '%+%c%p2%' '%+%c, + il1=\EE$<5*>, cbt=\EI, ich1=\EQ, dl1=\ER$<5*>, dch1=\EW, + el=\Et, ed=\Ey, smso=\Ej, rmso=\Ek, lines#24, cols#80, cuf1=^L, cuu1=^K, +# Info: +# Tue Aug 9 20:11:37 1983 +# No backspace key in the main QWERTY cluster. Fortunately, +# it has a NEWLINE/PAGE key just above RETURN that sends a strange +# single-character code. Given a suitable Unix (one that lets you +# set an echo-erase-as-BS-SP-BS mode), this key can be used as +# the erase key; I find I like this. Because some people and +# some systems may not, there is another termcap ("ax175e") that +# suppresses this little eccentricity by omitting the relevant +# capability. +# +# Problems: +# - I haven't done tab-setting yet. +# - The initialization sequence doesn't use the terminal's +# reset-everything code because it would require a delay +# in the middle of the is sequence. +# +ampex175|ampex d175, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE, am, cub1=^H, + ed=\Ey, el=\Et, clear=\E+, cup=\E=%p1%' '%+%c%p2%' '%+%c, + cols#80, dch1=\EW, dl1=\ER, + home=\036, ich1=\EQ, is2=\EX\EA\EF, + kcud1=^J, khome=\036, kcub1=^H, kcuf1=^L, + kcuu1=^K, kil1=\EE, kdl1=\ER, kich1=\EQ, kdch1=\EW, + lines#24, ll=\036^K, cuf1=^L, + rmso=\Ek, smso=\Ej, rmcup=\EF, smcup=\EN, rmul=\Em, cuu1=^K, + smul=\El, +ampex175-b|ampex d175 using left arrow for erase, + kbs=^_, use=ampex175, +# Info: +# Below are the termcap entries I've been using. The problem +# with scrolling in vi can only be fixed by getting BBN to put +# smarter scroll logic in the terminal or changing vi or padding +# scrolls with about 500 ms delay. +# +# I always thought the problem was related to the terminal +# counting newlines in its input buffer before scrolling and +# then moving the screen that much. Then vi comes along and +# paints lines in on the bottom line of the screen, so you get +# this big white gap. +# +# We have not had sufficient demand for vi (most use emacs or +# rand) here to fix this problem. +# +# [Sounds like the BitGraph should stop looking ahead when it +# sees escape - ] +# +bitgraph|bbn bitgraph, + use=bg3.10rv, +bg3.10rv|bgrv|bbn bitgraph (reverse video), + use=bg2.0rv, +bg3.10nv|bgnv|bbn bitgraph (normal video), + use=bg2.0nv, +bg3.10|bgn|bbn bitgraph (no init), + use=bg2.0, +bg2.0rv|bbn bitgraph (reverse video), + is2=\E>\E[?5h\E[?7h, flash=\E[?5l\E[?5h, use=bg2.0, +bg2.0nv|bbn bitgraph (normal video), + is2=\E>\E[?5l\E[?7h, flash=\E[?5h\E[?5l, use=bg2.0, +bg2.0|bbn bitgraph (no init), + cr=^M, cud1=^J, bel=^G, + il1=\E[L$<2*>, cub1=^H, ed=\E[J$<150>, el=\E[K$<2>, + clear=\E[H\E[J$<150>, cup=%i\E[%p1%d;%p2%dH, cols#85, csr=\E[%i%p1%d;%p2%dr, + dl1=\E[M$<2*>, cud1=\E[B, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kcud1=\E[B, rmkx=\E>, kcub1=\E[D, kcuf1=\E[C, smkx=\E=, + kcuu1=\E[A, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, lines#64, + cuf1=\E[C, ht=^I, rc=\E8, sc=\E7, rmso=\E[0m, ind=\n$<280>, + smso=\E[7m, cuu1=\E[A, xenl, +bg1.25rv|bbn bitgraph (reverse video), + flash=\E[?5l\E[?5h, is2=\E>\E[?5h\E[?7h, use=bg1.25, +bg1.25nv|bbn bitgraph (normal video), + is2=\E>\E[?5l\E[?7h, flash=\E[?5h\E[?5l, use=bg1.25, +bg1.25|bbn bitgraph, + cr=^M, cud1=^J, bel=^G, il1=\E[L$<2*>, cub1=^H, + ed=\E[J$<150>, el=\E[K$<2>, clear=\E[H\E[J$<150>, cup=%i\E[%p1%d;%p2%dH, + cols#85, dl1=\E[M$<2*>, cud1=\E[B, kf1=\EP, kf2=\EQ, kf3=\ER, + kf4=\ES, kcud1=\EB, rmkx=\E>, kcub1=\ED, kcuf1=\EC, smkx=\E=, + kcuu1=\EA, lines#64, ll=\E[64;1H, lf1=PF1, lf2=PF2, lf3=PF3, + lf4=PF4, cuf1=\E[C, ht=^I, rmso=\E[0m, ind=\n$<280>, + smso=\E[7m, cuu1=\E[A, +ca22851|computer automation 22851, + cr=^M, cud1=^J, ind=^J, bel=^G, cup=\02%i%p1%c%p2%c, cols#80, + lines#24, clear=^L$<8>, am, cub1=\025, cuu1=\026, home=\036, + el=\035, ed=\034, cuf1=\011, kcub1=\025, kcuu1=\026, + kcud1=\027, khome=\036, +# Info: +# CHROMATICS +# Following is revised version. As I mentioned, I recompiled +# curses in order to accomadate the large amount of definition. +# I have put the long strings in ti/te. Ti sets up a window +# that is smaller than the screen, and puts up a warning message +# outside the window. Te erases the warning message, puts the +# window back to be the whole screen, and puts the cursor at just +# below the small window. A defined vs and ve to really turn +# the cursor on and off, but I have taken this out since I don't +# like the cursor being turned off when vi exits. +# +cg7900|chromatics|chromatics 7900, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#40, am, + clear=^L, cub1=^H, cup=^AM%p2%d\,%p1%d\,, cuf1=\035, cuu1=^K, + home=\034, ll=^A|, el=^A`, ed=^Al, il1=^A>2, dl1=^A<2, + ich1=^A>1, dch1=^A<1, + smso=^AC4\,^Ac7\,, rmso=^AC1\,^Ac2\,, uc=^A^A_^A\0, + smcup=^AP0^AO1^AR1^AC4\,^Ac0\,^L^AM0\,42\,WARNING DOUBLE ENTER ESCAPE and ^U^AC1\,^Ac2\,^AW0\,0\,79\,39\,, + rmcup=^AW0\,40\,85\,48\,^L^AW0\,0\,85\,48\,^AM0\,40\,, +cops10|cops|cops-10|, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, bw, ed=^w, el=^v, + clear=30^x, cup=^p%p1%' '%+%c%p2%' '%+%c, cols#80, cud1=\n, kbs=^h, kcud1=\n, + khome=^y, kcub1=^h, kcuf1=^l, kcuu1=^k, lines#24, cuf1=^l, + cuu1=^k, +# Info: +# CYBERNEX +# We recently discovered (it wasn't clearly documented) that the +# Cybernex XL-83 terminal has a reverse-scroll capability; I +# enclose a revised termcap entry with "sr" added. +# +xl83|cybernex XL-83, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^P$<62>, el=^O$<3>, + clear=^L$<62>, cup=^W%p1%' '%+%c%p2%' '%+%c, cols#80, home=^K, + kcud1=^J, kcub1=^H, kcuf1=^I, kcuu1=^N, + lines#24, cuu1=^N, cuf1=^I, ri=^N, +mdl110|cybernex mdl-110, + cup=^P%p1%' '%+%c%p2%' '%+%c, cols#80, lines#24, am, clear=^X$<70>, + cub1=^H, cr=^M, cud1=^J, ind=^J, bel=^G, cuf1=^U, cuu1=^Z, home=^Y, + el=^N@^V$<145>, ed=^NA^W$<145>, il1=^NA^N^]$<65>, dl1=^NA^N^^$<40>, + ich1=^NA^]$<3.5>, dch1=^NA^^$<3.5>, smso=^NF, rmso=^NG, + ht=\t$<43>, ed=^N@^V$<6>, +# Info: +# DATA GENERAL +# +# It has one or two quirks, though; in vi you have to use to +# advance to the next line instead of just hitting the big NEWLINE +# key (which is cursor down to vi). +# +# One pain with using the dasher on unix though is the fact +# that they use # ^H for home cursor. This causes problems with +# reading news and help files on the system that assume ^H is +# backspace. +# +# The trouble with this terminal is that you can't give it a +# linefeed without having it add a carriage return. And there +# isn't any switch that will turn off auto carriage return +# on receipt of linefeed. +# +# Is there any way around this? [I used cud1=^Z to try to +# describe this -] +# +d200|d100|data general dasher 200, + am, bel=^G, bw, clear=^L, cols#80, cr=^M, + cub1=^Y, cud1=^Z, cuf1=^X, cup=^P%p2%c%p1%c, cuu1=^W, + el=^K, home=^H, ind=^J, kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, + kf0=^^z, kf1=^^q, kf2=^^r, kf3=^^s, kf4=^^t, kf5=^^u, kf6=^^v, kf7=^^w, + kf8=^^x, kf9=^^y, khome=^H, lf0=f10, + lines#24, nel=^J, rmso=^^E, rmul=^U, smso=^^D, smul=^T, +dg|dg6053|data general 6053, + cr=^M, cud1=^J, ind=^J, bel=^G, + am, cub1=^H, cup=^P%p2%c%p1%c, clear=^L, home=^H, cuf1=^S, + cuu1=^W, el=^K, cols#80, lines#24, +d132|datagraphix|datagraphix 132a, + cr=^M, cud1=^J, ind=^J, bel=^G, + cols#80, lines#30, clear=^l, home=\Et, da, db, ind=\Ev, ri=\Ew, + cuu1=\Ek, cuf1=\El, cvvis=\Ex, cnorm=\Em\En, + il1=\E3, ich1=\E5, dch1=\E6, in, ich1=\E5, +# Info: +# DATAPOINT (see also pc) +# +datapoint|dp3|dp3360|datapoint 3360, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + ed=^_, el=^^, clear=^]^_, cols#82, home=^], lines#25, cuf1=^x, cuu1=^z, +# Info: +# DELTA DATA +# This is untested. The cup sequence is hairy enough that it +# probably needs work. The idea is ctrl(O), dd(row), dd(col), +# where dd(x) is x - 2*(x%16) + '9' +# +delta|dd5000|delta data 5000, + cud1=^J, ind=^J, bel=^G, am, cub1=^H, clear=^NR, + cup=^O%p1%p1%{16}%m%{2}%*%-%'9'%+%c%p2%p2%{16}%m%{2}%*%-%'9'%+%c, + cols#80, lines#27, home=^NQ, cuf1=^Y, cuu1=^Z, el=^NU, dch1=^NV, +digilog|333|digilog 333, + cub1=^H, cols#80, el=\030, home=^n, lines#16, cuf1=^i, cuu1=^o, + cr=^M, cud1=^J, ind=^J, bel=^G, +# Info: +# DIRECT +# I think the direct is supposed to be vt100 compatible, so all +# this should probably be replaced by a use=vt100, but I can't +# test it. +# +d800|direct|direct800|direct 800/a, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, am, + clear=\E[1;1H\E[2J, cub1=^H, cup=\E[%i%p1%d;%p2%dH, + cuf1=\E[C, cuu1=\E[A, el=\E[K, ed=\E[J, smso=\E[7m, rmso=\E[0m, + smul=\E[4m, rmul=\E[0m, xhp, cvvis=\E[>12l, cnorm=\E[>12h, + ind=\ED, ri=\EM, da, db, smacs=\E[1m, rmacs=\E[0m, msgr, ht=^I, + kcub1=\E[D, kcuf1=\E[C, kcuu1=\E[A, kcud1=\E[B, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, +env230|envision230|envision 230 graphics terminal, + am, mir, msgr, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=\r, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, + el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=\t, + hts=\EH, ind=\n, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=\b, + kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, + kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, mc0=\E[0i, + mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m$<2>, + ri=\EM$<5>, rmacs=^O, rmkx=\E[?1l\E>, rmso=\E[0m<2>, + rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\E7, + sgr=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, + sgr0=\E[m^O$<2>, smacs=^N, smkx=\E[?1h\E=, smso=\E[1m<2>, + smul=\E[4m$<2>, tbc=\E[3g, +falco|ts1|ts-1|falco ts-1, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, ht=^I, + is2=\Eu\E3, il1=\EE, am, el=\ET\EG0^H, cup=\E=%p1%' '%+%c%p2%' '%+%c, + clear=\E*, ed=\EY, dch1=\EW, cub1=^H, dl1=\ER, rmir=\Er, smir=\Eq, + home=^^, kf0=^A0\r, kcud1=^J, kcub1=^H, kcuf1=^L, kcuu1=^K, cuf1=^L, + rmso=\Eg0, smso=\Eg1, cuu1=^K, smul=\Eg1, rmul=\Eg0, +# Info: +# For falcos with the paging option (very nice it turns out - +# they can store several hundred lines of text, as well as have +# a separate screen for vi and other such programs usage)... +# +falco-p|falco-tsl-1sp|falco with paging option, + cr=^M, cud1=^J, ind=^J, bel=^G, is2=\EZ\E3\E_c, il1=\EE, am, + cub1=^H, el=\ET\EG0^H\Eg0, clear=\E*, ed=\EY, cols#80, + dch1=\EW, dl1=\ER, kcud1=\E[B, kcub1=\E[D, rmir=\Er, smir=\Eq, + ht=^I, db, kcuf1=\E[C, kcuu1=\E[A, lines#24, cuf1=\E[C, + rmso=\Eg0, smso=\Eg4, cuu1=\E[A, smul=\Eg1, smcup=\E_d, + rmcup=\E_b, rmul=\Eg0, cud1=\E[B, cup=\E=%p1%' '%+%c%p2%' '%+%c, + msgr, ul, khome=\E[H, da, mir, cbt=\EI, +ts100|ts100-sp|falco ts100-sp, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=\r, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, dch1=\E~W, dl1=\E~R, ed=\E[J$<50>, + el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, + ht=\t, hts=\EH, ich1=\E~Q, il1=\E~E, ind=\n, + is1=\E~)\E~ea, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=\b, + kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, + kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmkx=\E[?1l\E>, + rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O$<2>, smacs=^N, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, +ts100-ctxt|falco ts-100 saving context, + smcup=\E~_d\E[2J, rmcup=\E~_b, use=ts100, +# Info: +# FLUKE +# The 1720a differences from ANSI: no auto margin, destructive +# tabs, # of lines, funny highlighting and underlining +# +f1720|f1720a|fluke 1720A, + cr=^M, ind=^J, cud1=^J, bel=^G, + is2=\E[;H\E[2J, cols#80, lines#16, + cuu1=\E[A, cud1=\E[B, cuf1=\E[C, cub1=^H, cup=\E[%i%p1%d;%p2%dH, + ind=\ED, ri=\EM, + kcuu1=\034, kcud1=\035, kcuf1=\036, kcub1=\037, + smso=\E[7m, rmso=\E[m, xmc#1, + smul=\E[4m, rmul=\E[m, + el=\E[K, ed=\E[J, + xt, clear=\E[;H\E[2J, +# Info: +# INTERTEC +# Intertec: I can't tell if these are the same terminal or not. +# the cup entries are different. The it2 looks suspiciously +# like an an Adds Regent 100, complete with the bug [mrh]. +# +it|intertube|intertec|Intertec InterTube, + cr=^M, ind=^J, cud1=^J, bel=^G, cub1=^H, am, + clear=^L, home=^A, cuu1=^Z, cuf1=^F, + cup=\EY%p1%' '%+%c%p2%' '%+%c$<50>, + smso=\E0P, rmso=\E0@, cols#80, lines#25, +# Info: +# The intertube 2 has the "full duplex" problem like the tek +# 4025: if you are typing and a command comes in, the keystrokes +# you type get interspersed with the command and it messes up. +# +it2|intertube2|intertec data systems intertube 2, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + clear=^L, cols#80, home=^A, lines#25, cuu1=^Z, el=\EK, + hpa=^P%p1%{10}%/%{16}%*%p1%{10}%m%+%c, vpa=^K%p1%c, + cup=^N%p1%c^P%p2%{10}%/%{16}%*%p2%{10}%m%+%c, + cuf1=^F, cud1=\n, ll=^K^X\r, smso=\E0P, rmso=\E0@, +superbrain|intertec superbrain, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=\E~k<10*>, + el=\E~K$<15>, bw, clear=\f$<5*>, + cup=\EY%p1%' '%+%c%p2%' '%+%c$<20>, cols#80, + kcud1=^J, kcub1=^U, kcuf1=^F, kcuu1=^K, lines#24, + cuf1=^F, ht=^I, rmcup=\f, smcup=\f, cuu1=^k, +# FREEDOM 100 by Liberty Electronics USA, SF. +f100|freedom|freedom100|freedom model 100, + am, bw, hs, mir, msgr, xon, + cols#80, lines#24, + acsc=+.'\,.-jHkGlFmEqKxJ, bel=^G, cbt=\EI, clear=^Z, + cr=\r, cub1=\b, cud1=\n, cuf1=\f, + cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, dch1=\EW, + dl1=\ER$<11.5*>, dsl=\Eg\Ef\r, ed=\EY, el=\ET, + flash=\Eb$<50>\Ed, fsl=\r, home=^^, + hpa=\E]%p1%'\s'%+%c, ht=\t, hts=\E1, il1=\EE$<8.5*>, + ind=\n, ip=$<6>, is2=\Eg\Ef\r\Ed, kbs=\b, kcub1=\b, + kcud1=^V, kcuf1=\f, kcuu1=^K, kf0=^AI\r, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, ri=\Ej, + rmacs=\E%, rmir=\Er, rmso=\EG0, rmul=\EG0, smacs=\E$, + smir=\Eq, smso=\EG4, smul=\EG8, tbc=\E3, tsl=\Eg\Ef, + vpa=\E[%p1%'\s'%+%c, +f100-rv|freedom-rv|freedom 100 in reverse video, + is2=\Eg\Ef\r\Eb, flash=\Ed$<50>\Eb, use=f100, +# +# Problem with vi(1). Liberty terminals use the ^V +# code for the down cursor key. When kcud1 is defined in terminfo +# as ^V, the Control Character Quoting capability (^V in insert mode) +# is lost! It cannot be remapped in vi because it is necessary to enter +# a ^V to to quote the ^V that is being remapped!!! +# +# f110 users will have to decide whether +# to lose the down cursor key or the quoting capability. We will opt +# initially for leaving the quoting capability out, since use of VI +# is not generally applicable to most interactive applications +# +# The same applies to f200 users, except that another option exists. +# This option has been chosen locally. It will not be distributed unless +# a user runs into this problem and requests assistance. Very few users, +# if any, should run into this problem. The local solution is in +# vifix.local.ti. The f200 has the ability to reprogram the down cursor +# key. The key is reprogrammed to ^J (linefeed). This value is remembered +# in non-volatile RAM, so powering the terminal off and on will not cause +# the change to be lost. The terminfo definition for the f200 is changed +# to identify kcud1 as ^J instead of ^V. +# +# +f110|freedom110|Liberty Freedom 110, + am, bel=^G, cols#80, lines#24, cr=^M, hs, mir, msgr, + eslok, xon, it#8, wsl#80, cbt=\EI, + tbc=\e3, clear=^Z, + el=\ET, ed=\EY, hpa=\E]%p1%' '%+%c, vpa=\E[%p1%' '%+%c, + cup=\e=%p1%' '%+%c%p2%' '%+%c, cud1=^V, home=^^, + cub1=\b, cuf1=^L, cuu1=^K, dch1=\eW, + dl1=\eR, dsl=\ef\r, smacs=\e$, rmacs=\e%%, blink=\eG2, + bold=\eG0, dim=\EG@, rev=\EG4, rmul=\eG0, + invis=\eG1, smso=\eG<, smul=\eG8, rmso=\eG0, sgr0=\eG0, + flash=\Eb\0\0\0\0\Ed, fsl=\r, + il1=\eE, kbs=\b, kclr=^^, kdch1=\eW, kdl1=\eR, + kel=\eT, ked=\eY, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + kf0=^AI\r, kich1=\eQ, kil1=\eE, kcub1=\b, kcuf1=^L, kcuu1=^K, + mc4=\ea, mc5=\e`, hts=\e1, tsl=\ef, ind=\n, ri=\eJ + smir=\eO\eq, rmir=\er\eO, kcud1=^V, + cnorm=\e.2, cvvis=\e.2, civis=\e.1, +f110-14|Liberty Freedom 110 14inch, + dch1@,use=f110, +f110-w|Liberty Freedom 110 - 132 cols, + cols#132, use=f110, +f110-14w|Liberty Freedom 110 14in/132 cols, + cols#132, dch1@, use=f110, +f200|freedom200|Liberty Freedom 200, + am, bel=^G, cols#80, lines#24, cr=^M, hs, mir, msgr, + eslok, xon, it#8, wsl#80, cbt=\EI, + csr=\em0%p1%' '%+%c%p2%' '%+%c, tbc=\e3, clear=^Z, + el=\ET, ed=\EY, hpa=\E]%p1%' '%+%c, vpa=\E[%p1%' '%+%c, + cup=\e=%p1%' '%+%c%p2%' '%+%c, cud1=^V, home=^^, civis=\e.0, + cub1=\b, cnorm=\e.1, cuf1=^L, cuu1=^K, cvvis=\e.1, dch1=\eW, + dl1=\eR, dsl=\ef\r, smacs=\e$, rmacs=\e%%, blink=\eG2, + bold=\eG0, dim=\EG@, smir=\eq, rmir=\er, rev=\EG4, rmul=\eG0, + invis=\eG1, smso=\eG<, smul=\eG8, rmso=\eG0, sgr0=\eG0, + flash=\Eo\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\en, fsl=\r, + il1=\eE, kbs=\b, kclr=^^, kdch1=\eW, kdl1=\eR, kcud1=^V, + kel=\eT, ked=\eY, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + kf0=^AI\r, kich1=\eQ, kil1=\eE, kcub1=\b, kcuf1=^L, kcuu1=^K, + mc4=\ea, mc5=\e`, hts=\e1, tsl=\ef, ind=\n, ri=\eJ, +f200-w|Liberty Freedom 200 - 132 cols, + cols#132, use=f200, +f200vi|Liberty Freedom 200 for vi, + am, bel=^G, cols#80, lines#24, cr=^M, hs, mir, msgr, + eslok, xon, it#8, wsl#80, cbt=\EI, + csr=\em0%p1%' '%+%c%p2%' '%+%c, tbc=\e3, clear=^Z, + el=\ET, ed=\EY, hpa=\E]%p1%' '%+%c, vpa=\E[%p1%' '%+%c, + cup=\e=%p1%' '%+%c%p2%' '%+%c, cud1=^V, home=^^, civis=\e.0, + cub1=\b, cnorm=\e.1, cuf1=^L, cuu1=^K, cvvis=\e.1, dch1=\eW, + dl1=\eR, dsl=\ef\r, smacs=\e$, rmacs=\e%%, blink=\eG2, + bold=\eG0, dim=\EG@, smir=\eq, rmir=\er, rev=\EG4, rmul=\eG0, + invis=\eG1, smso=\eG<, smul=\eG8, rmso=\eG0, sgr0=\eG0, + flash=\Eb\0\0\0\0\Ed, fsl=\r, + il1=\eE, kbs=\b, kclr=^^, kdch1=\eW, kdl1=\eR, kcud1=^J, + kel=\eT, ked=\eY, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + kf0=^AI\r, kich1=\eQ, kil1=\eE, kcub1=\b, kcuf1=^L, kcuu1=^K, + mc4=\ea, mc5=\e`, hts=\e1, tsl=\ef, ind=\n, ri=\eJ, +f200vi-w|Liberty Freedom 200 - 132 cols for vi, + cols#132, use=f200vi, +omron|omron 8025AG, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL, am, cub1=^H, ed=\ER, + cols#80, el=\EK, clear=\EJ, da, db, dch1=\EP, dl1=\EM, home=\EH, + lines#24, cuf1=\EC, rmso=\E4, ind=\ES, smso=\Ef, ri=\ET, + cuu1=\EA, cvvis=\EN, +plasma|plasma panel, + am, cub1=^H, clear=^L, cols#85, home=^^, lines#45, cuf1=\030, + cuu1=\026, cr=^M, cud1=^J, ind=^J, bel=^G, +ramtek|ramtek 6000, + cr=^M, cud1=^J, ind=^J, bel=^G, lines#24, cols#78, am, + clear=[alpha]\n[erase]\n, cub1=^H, +soroc|iq120|soroc 120, + am, + cols#80, lines#24, + bel=^G, clear=\E*$<2>, cr=\r, cub1=\b, cud1=\n, + cuf1=\f, cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, + ed=\EY, el=\ET, home=^^, ind=\n, kcub1=\b, kcud1=\n, + kcuf1=\f, kcuu1=^K, +# Info: +# Note standout and underline are really sg#1, but when you +# backspace up the whole screen does standout or underline! +# The solution is to not specify sg#1 and live with it. +# +# iq140 standout and underline are confused. What we have +# included here are reasonable possiblities for these two. +# Neither are really correct. +# +iq140|soroc 140, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, am, + clear=\E+, cub1=^H, cup=\E=%p1%' '%+%c%p2%' '%+%c, cuf1=^L, cuu1=^K, + home=^^, ll=^^^K, el=\Et, ed=\Ey, il1=\Ee$<1*>, dl1=\Er$<.7*>, + smir=\E9, cbt=\EI, rmir=\E8, mir, dch1=\Ew, smso=\E\177, rmso=\E\177, + kbs=^H, kcuf1=^L, khome=^^, kcuu1=^K, kf0=^A0\r, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, smul=\E^A, + rmul=\E^A, +swtp|ct82|southwest technical products ct82, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, il1=^\^y, + ed=^v, el=^F, clear=^L, cup=^k%p2%c%p1%c, cols#82, lines#20, dl1=^z, + cuf1=^s, cuu1=^a, smso=^^^v, rmso=^^^F, dch1=^\^h, ich1=^\^x, home=^p, + ind=^n, ri=^o, ll=^c, + is2=^\^r^^^s^^^d^]^w^i^s^^^]^^^o^]^w^r^i, +# Info: +# Another new terminal, tested, seems to work fine with vi. +# +synertek|ktm|380|Synertek KTM 3/80 tubeless terminal, + am, cub1=^H, cols#80, lines#24, ed=\EJ, el=\EK, clear=^Z, + cup=\E=%p1%' '%+%c%p2%' '%+%c, cuu1=^K, cuf1=^L, +# Info: +# TAB +# The tab 132 uses xon/xoff, so no padding needed. +# smkx/rmkx have nothing to do with arrow keys. +# is2 sets 80 col mode, normal video, autowrap on (for am). +# Seems to be no way to get rid of status line. +# +tab132|tab|tab 132/15, + am, da, db, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, lm#96, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=\r, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A$<2>, dch1=\E[P, dl1=\E[M, + ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=\t, hts=\EH, il1=\E[L, + ind=\n, is2=\E[?7h\E[?3l\E[?5l, ka1=\EOq, ka3=\EOs, + kb2=\EOr, kbs=\b, kc1=\EOp, kc3=\EOn, kcub1=\E[D, + kcud1=\E[B, kcuf1=\EOC, kcuu1=\E[A, kent=\EOM, + kf0=\EOy, kf1=\EOP, kf10=\EOx, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, + kf9=\EOw, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, + rmir=\E[4l, rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O$<2>, smacs=^N, smir=\E[4h, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, +tab132-w, + cols#132, is2=\E[?7h\E[?3h\E[?5l, use=tab132, +tab132-rv, + is2=\E[?7h\E[?3l\E[?5h, use=tab132, +tab132-w-rv, + is2=\E[?7h\E[?3h\E[?5h, use=tab132-w, +# Info: +# TEC (various terminals labelled "tec" - manufacturers unknown) +# tec is untested, and taken from CB/Unix virtual terminal driver. +# Upper case terminal, uses lower case for control sequences!!! +# The driver shows the C ~ operator used on CM coordinates. +# +tec400|tec scope, + cr=^M, cud1=^J, ind=^J, bel=^G, cup=l%p2%~%c%p1%~%c, + cuu1=x, cud1=h, cuf1=g, cub1=w, home=i, smso={, rmso=|, + xmc#1, clear=f, il1=e, dl1=u, ich1=d, dch1=t, el=c, ed=s, +tec500|tec 500, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z$<20>, + cols#80, home=^^, lines#24, cuf1=^L, cuu1=^K, smso=^], rmso=^\, +tec, + lines#24, cols#80, clear=^l, cuu1=^k, cuf1=\037, am, + cub1=^H, home=\036, cr=^M, cud1=^J, ind=^J, bel=^G, +teletec|teletec datascreen, + cr=^M, cud1=^J, ind=^J, bel=^G, + am, cub1=^H, cols#80, clear=^l, home=^^, lines#24, cuf1=^_, cuu1=^k, +vc404|volker-craig 404, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^W$<40>, el=^V$<20>, + clear=^X$<40>, cup=^P%p1%' '%+%c%p2%' '%+%c, cols#80, home=^Y$<40>, + kcud1=^J, kcub1=^H, kcuf1=^U, kcuu1=^Z, lines#24, cuf1=^U, cuu1=^Z, +vc404-s|volker-craig 404 w/standout mode, + rmso=^O, smso=^N, use=vc404, +vc404-na|volker-craig 404 w/no arrow keys, + kcuf1@, kcuu1@, use=vc404, +vc404-s-na|volker-craig 404 w/standout mode and no arrow keys, + rmso=^O, smso=^N, use=vc404-na, +vc415|volker-craig 415, + clear=^L, use=vc404, +# Info: +# Missing in vc303a and vc303 descriptions: they scroll 2 lines +# at a time every other linefeed. +# +vc303-a|vc403a|volker-craig 303a, + cr=^M, cud1=^J, bel=^G, am, cub1=^H, el=^V$<20>, clear=^X$<40>, + cols#80, home=^Y$<40>, kcud1=^J, kcub1=^H, kcuf1=^U, + kcuu1=^Z, lines#24, ll=^P^@W, cuf1=^U, cuu1=^Z, +vc303|vc103|vc203|volker-craig 303, + cr=^M, cud1=^J, bel=^G, am, cub1=^H, clear=^L$<40>, cols#80, + home=^K$<40>, kcud1=^J, kcub1=^H, kcuf1=^I, kcuu1=^N, lines#24, + ll=^O$<1>W, cuf1=^I, cuu1=^N, +zen30|z30|zentec 30, + cr=^M, cud1=^J, ind=^J, bel=^G, mir, cols#80, lines#24, + ul, il1=\EE$<1.5*>, cub1=^H, el=\ET$<1.0*>, + cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=\E*, home=^^, cuf1=^L, + rmso=\EG0, smso=\EG6, cuu1=^K, smir=\Eq, rmir=\Er, + am, dch1=\EW, dl1=\ER$<1.5*>, ed=\EY, +# Info: +# COMPUCOLOR, ISC, INTECOLOR (?) +# These compucolors appear similar, but they at least have +# different sized screens. I don't know what's going on here. +# +# There is further confusion since intecolor seems to call +# themselves isc too. +# +# The following termcap for the Intelligent Systems Corporation +# 8001 color terminal with lower-case and 48-line options +# disallows global motion to get around the 2-lines-at-a-time +# scrolling problem. It has been tested and works fine except +# when indented lines are scrolled in from the bottom of the +# screen. The latter problem originates with firmware which +# interprets NL as NL-CR when the cursor is on the bottom line +# of the screen. +# +8001|isc|isc8001|compucolor 8001, + cr=^M$<1>, cud1=^J$<1>, ind=^J$<1>, bel=^G, am, cols#80, lines#47, + il1=\EU$<5*>, dl1=\EV^\$<5*>, clear=^L$<31>, smir=^S\EQ$<1>, + rmir=^R\EK$<1>, kcub1=^Z, kcuf1=^Y, kcuu1=^\, kcud1=^J, khome=^H, + cub1=^Z$<1>, cuf1=^Y$<1>, cuu1=^\$<1>, smul=^Q$<1>, rmul=^R$<1>, +# cup=^C%p2%c%p1%c, +compucolor2|compucolorii|compucolor 2, + cr=^M, cud1=^J, ind=^J, bel=^G, + ht=^I, am, cup=^C%p2%c%p1%c, cub1=^Z, lines#32, cols#64, + clear=^L, home=^H, cuf1=^Y, cuu1=^\, +# Info: +# INTERACTIVE SYSTEMS +# smkx/rmkx from dgc, to make insert mode key work in Rand Editor. +# probably needs more keys defined. +# +intext|Interactive Systems Corporation modified owl 1200, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\020$<5.5*>, am, cub1=^_, + cub1=^H, cbt=^Y, ed=\026J$<5.5*>, el=^K\160^R, + clear=\014$<132>, cup=\017%p1%' '%+%c%p2%' '%+%c, cols#80, + dch1=\022$<5.5*>, dl1=\021$<5.5*>, rmir=\026\074, + smir=\026\073, ip=$<5.5*>, lines#24, cuf1=\036, ht=^I, + cuu1=\034, rmso=^V# , xmc#1, smso=^V$\054, + smkx=\036\072\264\026%, rmkx=\269, + kcub1=^_, kcud1=^J, kcuf1=^^, kcuu1=\034, kbs=^H, khome=^Z, + kf1=^VA\r, kf2=^VB\r, kf3=^VC\r, kf4=^VD\r, kf5=^VE\r, + kf6=^VF\r, kf7=^VG\r, kf8=^VH\r, kf9=^VI\r, kf0=^VJ\r, +intext2|intextii|INTERACTIVE modified owl 1251, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\E[L, am, cbt=\E[Z, + bw, ed=\E[J, el=\E[K, hpa=\E[%p1%{1}%+%dG, clear=\E[H\E[2J, + cup=\E[%i%p1%d;%p2%dH, cols#80, dch1=\E[P, dl1=\E[M, + cud1=\E[B, ich1=\E[@, kf0=\E@\r, + lf0=REFRSH, kf1=\EP\r, lf1=DEL CH, kf2=\EQ\r, lf2=TABSET, + kf3=\ES\r, lf3=GOTO, kf4=\ET\r, lf4=+PAGE, kf5=\EU\r, + lf5=+SRCH, kf6=\EV\r, lf6=-PAGE, kf7=\EW\r, lf7=-SRCH, + kf8=\EX\r, lf8=LEFT, kf9=\EY\r, lf9=RIGHT, kbs=^h, kcud1=\EB\r, + khome=\ER\r, kcub1=\ED\r, kcuf1=\EC\r, kcuu1=\EA\r, lines#24, + cuf1=\E[C, ht=^I, rmso=\E[2 D, ind=\E[S, smso=\E[6 D, ri=\E[T, + rmul=\E[2 D, xmc#0, ul, cuu1=\E[A, smul=\E[18 D, + flash=\E[;;;;;;;;;2;;u\E[;;;;;;;;;1;;u, +# ncr: NCR +# +# The 7900 model 1 is the default 7900 type terminal, so ``7900'' refers to it. +# 7900 is not used by other terminals, so there is no name clash. +ncr7900i|7900i|ncr7900|7900|ncr 7900 model 1, + am, bel=^G, bw, clear=^L, cols#80, cr=^M, + cub1=^H, cud1=^J, cuf1=^F, cuu1=^Z, + ind=^J, ll=^A, + cup=\E1%p2%c%p1%c, + ed=\Ek, el=\EK, + kcud1=^J, kcub1=^U, kcuf1=^F, kcuu1=^Z, khome=^A, + is2=\E0@\E3\E4, lines#24, + rmso=\E0@, xmc#1, smso=\E0Q, + blink=\E0B, dim=\E0A, rev=\E0P, + smul=\E0`, rmul=\E0@, ul, sgr0=\E0@, +# Since each attribute paramter is 0 or 1, we shift each attribute (standout, +# reverse, blink, dim, and underline) the appropriate number of bits (by +# multiplying the 0 or 1 by a coorect factor to shift) so the bias character, +# '@' is (effectively) "or"ed with each attribute to generate the proper third +# character in the 0 sequence. The "sgr" string implements the following +# equation: +# +# ((((('@' + P5) | (P4 << 1)) | (P3 << 3)) | (P2 << 4)) | (p1 * 17)) => +# ((((('@' + P5) + (P4 << 1)) + (P3 << 3)) + (P2 << 4)) + (p1 * 17)) +# +# Where: P1 <==> Standout attribute parameter +# P2 <==> Underline attribute parameter +# P3 <==> Reverse attribute parameter +# P4 <==> Blink attribute parameter +# P5 <==> Dim attribute parameter + sgr=\E0%p5%'@'%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c, + mc4=^T, mc5=^R, +# It seem users have a couple odd problems with ``vi'' when we define arrows, +# since the arrow character has an otherwise special meaning to ``vi''. +7900i-na|ncr7900i-na|ncr7900-na|7900-na|ncr 7900 model 1 with no arrows, + kcud1@, kcub1@, kcuf1@, kcuu1@, use=ncr7900i, +# The entry for the model 4 is mostly untested. People seem to prefer +# other models. This is a pretty outdated model. +7900iv|ncr7900iv|ncr 7900 model 4, + am, bw, hs, eslok, + cols#80, lines#24, + bel=^G, cr=\r, clear=\f, + cup=^K%p1%'@'%+%c\E^E%p2%02d, cud1=\n, home=^K@\E^E00, + cub1=\b, dl1=\E^O, dsl=\Ey1, + fsl=\Ek\Ey5, il1=\E^N, kbs=\b, + kcud1=\EB, kf1=\ES, kf2=\ET, + kf3=\EU, kf4=\EV, kf5=\EW, + kf6=\EP, kf7=\EQ, kf8=\ER, + khome=\EH, kcub1=\ED, kcuf1=\EC, + kcuu1=\EA, lf6=blue, lf7=red, + lf8=white, nel=\r\n, ind=\n, + tsl=\Ej\Ex5\Ex1\EY8%p1%' '%+%c\Eo, + ind=^J, +# Warning: This terminal will lock out the keyboard when it receives a CTRL-D. +# The user can enter a CTRL-B to get out of this locked state. +ncr7901|7901|ncr 7901 model, + cols#80, lines#24, + am, bel=^G, bw, clear=^L, cr=^M, + cub1=^H, cud1=^J, cuf1=^F, cuu1=^Z, + ind=^J, ll=^A, + ed=\Ek, el=\EK, + civis=^W, cnorm=^X, + mc4=^T, mc5=^R, + kcud1=^J, kcub1=^U, kcuf1=^F, kcuu1=^Z, kclr=^L, khome=^A, + is2=^X, + .is2=\E4^O^X, + cup=\EY%p1%' '%+%c%p2%' '%+%c, + vpa=^K%p1%'@'%+%c, +# We want to output the character given by the formula: +# ((col / 10) * 16) + (col % 10) where "col" is "p1" + hpa=^P%p1%{10}%/%{16}%*%p1%{10}%m%+%c, + sgr=\E0%p5%'@'%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c^N, + blink=\E0B, dim=\E0A, rev=\E0P, + smso=\E0Q^N, rmso=^O, .msgr, + smul=\E0`^N, rmul=^O, sgr0=^O, ul, +# +# +# +t88|Synco T88 terminal, + am, xon, + cols#80, lines#24, xmc#0, + bel=^G, clear=^Z, cr=\r, cub1=\b, cud1=\n, cuf1=\f, + cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, dch1=\EW, + dl1=\ER$<1*>, el=\ET, home=^^, ht=\t, ich1=\EQ, + if=/usr/share/lib/tabset/stdcrt, il1=\EE$<1*>, ind=\n, + kbs=\b, kcub1=\b, kcud1=\n, kcuf1=\f, kcuu1=^K, + kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, + kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, + rmso=\E(, rmul=\Em, smso=\E), smul=\El, +# +# +t88-nr|Synco T88 terminal without rev video, + am, xon, + cols#80, lines#24, + bel=^G, clear=^Z, cr=\r, cub1=\b, cud1=\n, cuf1=\f, + cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, dch1=\EW, + dl1=\ER$<1*>, el=\ET, home=^^, ht=\t, ich1=\EQ, + if=/usr/share/lib/tabset/stdcrt, il1=\EE$<1*>, ind=\n, + kbs=\b, kcub1=\b, kcud1=\n, kcuf1=\f, kcuu1=^K, + kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, + kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, + rmul=\Em, smul=\El, diff --git a/usr/src/lib/terminfo/pc.ti b/usr/src/lib/terminfo/pc.ti new file mode 100644 index 0000000..4fcbd42 --- /dev/null +++ b/usr/src/lib/terminfo/pc.ti @@ -0,0 +1,739 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:pc.ti 1.15" +# # PC - Personal Computers and Workstations emulating terminals. +# +# Manufacturer: PERSONAL COMPUTER TERMINALS +# Class: III +# +# Info: +# This category is strange. The typical personal computer offers +# a program to emulate a "terminal" without documenting any +# escape sequences. +# +# I don't have any direct personal experience with these, but +# my impression is that the terminal emulator emulates an +# ultra-dumb terminal, with the cursor cemented to the bottom +# line, and no escape sequences. +# +# Many of the entries below were found in random places with +# no indication of who they came from or how. In many cases, I +# believe what has happened is that someone wrote their own +# terminal emulator program, which understood some control +# characters or escape sequences, and made their own entries. +# +# GENERIC PERSONAL COMPUTER +# +pc|any personal computer emulating a terminal, + am, + cols#40, + bel=^G, cr=\r, cud1=\n, ind=\n, +apple-soroc|apple emulating soroc 120, + am, + cols#80, lines#24, + bel=^G, clear=\E*$<300>, cr=\r, cub1=\b, cud1=\n, + cuf1=\f, cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, + ed=\EY, el=\ET, home=^^, ind=\n, kcub1=\b, kcud1=\n, + kcuf1=\f, kcuu1=^K, +# Info: +# For those of you with either Programma's Pie or Hayden's Pie, +# I'm including a patch for DOS which allows them to function +# interactively as a terminal, with data transfer. +# +# The following termcap entry works only with an Apple ][+ that is +# equipped with a Videx 80 collumn card in slot 3. A special +# routine must be installed at the apple end to enable scroll +# down, here indicated with a ^U. The Videx card must have +# inverse char set. +# +apple|apple-v80|Apple][+ w/Videx80 & custom scroll down, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, cub1=^H$<10>, + smacs=^z2, rmacs=^z3, cup=\015\036%r%p1%' '%+%c%p2%' '%+%c$<6>, + el=\035$<6>, home=\031$<50>, smso=^z3, rmso=^z2, + cuf1=\034, cud1=\012, cuu1=\037, clear=\014$<40*>, + xenl, am, ri=\020, ed=\013$<20*>, +# Info: +# -------------------------------------------------------------- +# +# Pieterm is written using Lisa 2.5. If any of the opcodes used +# are confusing, refer to hex values in the left most column. +# +# +# 1 TTL "PIETERM 1.0 +# 2 NLS +# 3 ; +# 4 ; PIETERM: A program which patches 48k DOS 3.3 to allow +# 5 ; Programma Pie, and Hayden Pie to function in +# 6 ; a terminal mode. +# 7 ; +# 8 ; ASSUMES: Videx 80 collumn Videoterm in slot 3. +# 9 ; 1200 baud Serial Card in slot 2. +# 10 ; DOS 3.3 unmodified at $9D00 (master or slave) +# 11 ; +# 12 ; TO USE: Either from the Command level of Pie, or in a +# 13 ; "HELLO" program, "BRUN PIETERM,A$6000". +# 14 ; To enter terminal mode, from the Command level +# 15 ; of Pie, enter "TERM" or "TERM ". +# 16 ; "TERM" Sends a carriage return before entering terminal +# 17 ; mode. Best for reentering csh. +# 18 ; "TERM " Sends a ^D character before entering +# 19 ; terminal mode. For example, "TERM " should be +# 20 ; entered if returning to a cat>filename. +# 21 ; +# 22 ; RETURN: To return to the command level of Pie from the +# 23 ; terminal mode, enter "^@". With an upper case +# 24 ; locked keyboard, that is control-shift-P. With +# 25 ; and Enhanser II lower case keyboard, that is ^0. +# 26 ; +# 27 ; SENDING: From the Command level of Pie, indicated by +# 28 ; "Command:" (csh indicated by %), enter: +# 29 ; +# 30 ; Command:TERM +# 31 ; % stty -echo;cat>filename;stty echo +# 32 ; % ^@ +# 33 ; Command:>#2 +# 34 ; Command:TERM +# 35 ; ^__space +# 36 ; +# 37 ; RECEIVING: % wc filename +# 38 ; 46 123 4567 filename +# 39 ; % sleep 20;cat filename +# 40 ; ^@ +# 41 ; Command:(1,46)<#2 +# 42 ; +# 43 ; BUGS: Extra linefeeds are sent both ways. A filter program +# 44 ; at the UN*X end is required to strip every other \n. +# 45 ; Arg "^J" Arg "" ^W^X will globally illiminate them +# 46 ; within Pie. +# 47 ; +# 48 ; Since the Patch program overwrites the INIT portion +# 49 ; of DOS, it must be brun every boot. A zap utility +# 50 ; may be used to modify DOS directly on the disk. +# 51 ; +# 52 ; Pie gives no indication of what is going on. This +# 53 ; takes a little getting used to. It is possible to +# 54 ; get so involved with what you are doing in Pie, that +# 55 ; you forget you are logged on. +# 56 ; +# 57 ; Because of the limitation of Pie's buffer, large +# 58 ; file need to be transfered in chunks. +# 59 ; +# 60 ; -------------------------------- +# 61 ; +# 62 ; +# 0800 63 ; +# 06F8 64 NO EQU $6F8 ; address specific to videx +# 0638 65 START EQU NO-$C0 ; card in slot 3. See +# C080 66 DEV0 EQU $C080 ; reference manual. +# C081 67 DEV1 EQU $C081 +# 03B8 68 BASEL EQU $478-$C0 +# CA2E 69 BASCLC1 EQU $CA2E +# 0438 70 BASEH EQU $4F8-$C0 +# 0800 71 ; +# C0AE 72 STATUS EQU $C0AE ; Serial card specific to +# C0AF 73 DATAPORT EQU $C0AF ; slot 2. Adjust as needed. +# 0800 74 ; +# FDED 75 COUT EQU $FDED ; Stdout +# 0800 76 ; +# A884 77 PUTNAME EQU $A884 ; DOS patch addresses +# A909 78 PUTTOKEN EQU $A909 +# 9D1E 79 PUTADR EQU $9D1E +# AE8E 80 PUTPATCH EQU $AE8E +# 0800 81 ; +# 6000 82 ORG $6000 +# 6000 83 OBJ $800 +# 6000 84 ; +# 6000 4C 0B 60 85 JMP MAIN +# 6003 86 ; +# 6003 54 45 52 87 NAME DCI 'TERM' ; hi-bit off except last +# 6006 CD +# 6007 40 70 88 TOKEN HEX 4070 ; need-filename optional +# 6009 8D AE 89 ADRESS ADR PUTPATCH-1 +# 600B 90 ; +# 600B 91 MAIN: +# 600B A2 04 92 LDX 4 +# 600D BD 02 60 93 ^1 LDA NAME-1,X +# 6010 9D 83 A8 94 STA PUTNAME-1,X +# 6013 CA 95 DEX +# 6014 D0 F7 96 BNE <1 +# 6016 E8 97 INX +# 6017 BD 07 60 98 ^2 LDA TOKEN,X +# 601A 9D 09 A9 99 STA PUTTOKEN,X +# 601D BD 09 60 100 LDA ADRESS,X +# 6020 9D 1E 9D 101 STA PUTADR,X +# 6023 CA 102 DEX +# 6024 10 F1 103 BPL <2 +# 6026 A2 73 104 LDX #ENDPATCH-PATCH+1 +# 6028 BD 32 60 105 ^3 LDA PATCH,X +# 602B 9D 8E AE 106 STA PUTPATCH,X +# 602E CA 107 DEX +# 602F 10 F7 108 BPL <3 +# 6031 60 109 RTS +# 6032 110 ; +# 6032 111 PATCH: +# 6032 112 PHS PUTPATCH +# AE8E 113 ; +# AE8E A2 8D 114 LDX #$8D +# AE90 AD 04 02 115 LDA INBUFF+4 +# AE93 C9 A0 116 CMP #" " +# AE95 D0 02 117 BNE >0 +# AE97 A2 84 118 LDX #$84 +# AE99 8A 119 ^0 TXA +# AE9A 4C BD AE 120 JMP SENDIT +# AE9D AD AE C0 121 RECEIVE LDA STATUS +# AEA0 29 01 122 AND #$01 +# AEA2 F0 0C 123 BEQ SEND +# AEA4 AD AF C0 124 LDA DATAPORT +# AEA7 29 7F 125 AND #$7F +# AEA9 C9 10 126 CMP #$10 +# AEAB F0 1F 127 BEQ SCROLLD +# AEAD 20 ED FD 128 PRINTIT JSR COUT +# AEB0 AD 00 C0 129 SEND LDA $C000 +# AEB3 10 E8 130 BPL RECEIVE +# AEB5 8D 10 C0 131 STA $C010 +# AEB8 29 7F 132 AND #$7F +# AEBA D0 01 133 BNE SENDIT +# AEBC 60 134 RTS +# AEBD 48 135 SENDIT PHA +# AEBE AD AE C0 136 S0 LDA STATUS +# AEC1 29 02 137 AND #$02 +# AEC3 F0 F9 138 BEQ S0 +# AEC5 68 139 PLA +# AEC6 8D AF C0 140 STA DATAPORT +# AEC9 4C 9D AE 141 JMP RECEIVE +# AECC 38 142 SCROLLD SEC +# AECD A2 C3 143 LDX #$C3 ; for slot 3 +# AECF AC F8 06 144 LDY NO +# AED2 BD 38 06 145 LDA START,X +# AED5 E9 05 146 SBC #$05 +# AED7 29 7F 147 AND #$7F +# AED9 9D 38 06 148 STA START,X +# AEDC 20 2E CA 149 JSR BASCLC1 +# AEDF A9 0D 150 LDA #$0D +# AEE1 99 80 C0 151 STA DEV0,Y +# AEE4 BD B8 03 152 LDA BASEL,X +# AEE7 99 81 C0 153 STA DEV1,Y +# AEEA A9 0C 154 LDA #$0C +# AEEC 99 80 C0 155 STA DEV0,Y +# AEEF BD 38 04 156 LDA BASEH,X +# AEF2 99 81 C0 157 STA DEV1,Y +# AEF5 A9 19 158 LDA #$19 ; home cursor +# AEF7 20 ED FD 159 JSR COUT +# AEFA A9 1D 160 LDA #$1D ; ceol +# AEFC 20 ED FD 161 JSR COUT +# AEFF 4C 9D AE 162 JMP RECEIVE +# AF02 163 ; +# AF02 164 DPH +# 60A6 165 ORG $6000+*-$800 +# 60A6 166 OBJ * +# 60A6 167 ; +# 60A6 168 ENDPATCH: +# 60A6 169 END +# ATT +# +# Info: +# The official PC terminal emulator program of the AT&T Product +# Centers. +# +# Note - insert mode commented out - doesn't seem to work on +# AT&T PC. +# +simterm|attpc running simterm, + am, + cols#80, lines#24, + bel=^G, clear=\EH\EJ, cr=\r, cub1=\b, cud1=\EB, + cuf1=\EC, cup=\E=%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, + dch1=\ER, dl1=\EM, ed=\EJ, el=\EK, home=\EH, il1=\EL, + ind=\n, rmcup=\EVE, .rmir=\EE, .rmso=\E&d@, smcup=\EVS, + smir=\EQ, smso=\E&dB, +# Info: +# +vic20|vic|vic Personal Computer, + cr=^M, cud1=^J, ind=^J, bel=^G, am, clear=^K^L, home=^L, + lines#20, cuu1=^^, cuf1=^\, cols#22, +# Info: +# (Dan Ingold) +# +# Following is a TERMCAP entry for the Datapoint UNITRM18 +# asynchronous terminal emulation program. It has only been +# tested out at 1200 baud, however, so I don't know if the +# delays are correct. +# +# [what is control "="? keys send different codes from functions? - mrh] +# +unitrm18|datapoint 'UNITRM18' terminal emulator, + cr=^M, ind=^J, cud1=^J, bel=^G, am, cub1=^y, + ed=^?, el=^>, clear=^=^?$<12.5>, cols#80, cud1=^k, home=^=, + kcuu1=^x, kcud1=^r, kcub1=^t, kcuf1=^v, lines#24, cuf1=^x, cuu1=^z, +# Info: +# FLORIDA COMPUTER GRAPHICS +# Florida Computer Graphics Beacon System, using terminal emulator +# program "host.com", as provided by FCG. Entry provided by +# David Bryant (cbosg!djb) 1/7/83. +# This description is for an early release of the "host" program. +# Known bug: ed clears the whole screen, so it's commented out. +# +beacon|FCG Beacon System, + cr=^M, cud1=^J, ind=^J, cols#80, lines#32, clear=\EZ$<10>, + cub1=^H, cup=\E=%p1%' '%+%c%p2%' '%+%c$<20>, cuf1=\EV, cuu1=\EU, el=\ET, + .ed=\EY, dch1=\EW, ich1=\EQ, dl1=\ER, il1=\EE, + smcup=\ESTART^M\E2\0540^M\E12^M\EEND^M$<10>, + bel=\ESTART^M\E37^M\EEND^M$<1>, home=\EH$<10>, + am, da, db, + rev=\ESTART^M\E59\0541^M\EEND^M, + smso=\ESTART^M\E70\0546^M\EEND^M$<20>, + rmso=\ESTART^M\E70\0540^M\EEND^M$<20>, + smul=\ESTART^M\E60\0541^M\EEND^M, + rmul=\ESTART^M\E60\0540^M\EEND^M, + blink=\ESTART^M\E61\0541^M\EEND^M, + sgr0=\ESTART^M\E78^M\E70\0540^M\EEND^M$<20>, +# Info: +# This doesn't work because the cursor position isn't saved +# with the window. +# +beacon-s|FCG Beacon System with status line, + lines#31, eslok, hs, + tsl=\ESTART^M\E45\0541^M\E41\054%p1%d\0541^M\EEND^M$<10>, + fsl=\ESTART^M\E45\0540^M\EEND^M$<10>, + is2=\ESTART^M\E45\0540^M\E65\05431^M\E66\05445^M\E45\0541^M\E65\0541^M\E66\0541^M\E45\0540^M\EEND^M$<30>, + use=beacon, +# Info: +# Here is the xtalk termcap. I mostly use the terminfo (curses) +# version myself since I am working at BTL where they have a +# certain bias. I am sending the terminfo version too, so that +# you can compare them if there are any undiscovered glitches +# in the termcap version due to insufficient testing. +# +# First the termcap version -- +# +# d0|vt100|vt100-am|vt100|dec vt100:\ +# :cr=^M:do=^J:nl=^J:bl=^G:co#80:li#24:cl=50\E[;H\E[2J:\ +# :le=^H:bs:am:cm=5\E[i2252;787036H:nd=2\E[C:up=2\E[A:\ +# :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ +# :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\ +# :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\ +# :rf=/usr/share/lib/tabset/vt100:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ +# :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ta=^I:pt:sr=5\EM:vt#3:xn:\ +# :sc=\E7:rc=\E8:cs=\E[i2252;787036r: +# d1|xtalk|IBM PC with xtalk:\ +# :sc@:rc@:cs@:am@:xn@:al=99\E[L:dl=99\E[M:tc=vt100-am: +# +# The problem is in the "xtalk" entry. The "am" auto-margin +# flag should not be turned off as shown above. The following +# is the corrected "xtalk" entry. +# +# d1|xtalk|IBM PC with xtalk:\ +# :sc@:rc@:cs@:xn@:al=99\E[L:dl=99\E[M:tc=vt100-am: +# +# This is the shell script that I execute from my profile when I +# login from xtalk -- +# +# # set auto margins +# echo '\033[?7h\c' +# #set up tab stops +# stty -tabs +# echo '\033[3g' +# for i in 1 2 3 4 5 6 7 8 9 +# do +# echo ' \033H\c' +# done +# stty tabs +# echo +# +# +# Now the terminfo version (This is the input to the 'tic' +# compiler) -- +# +# Vanilla vt100 definitions. +# vt100|vt100-am|dec vt100, +# cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, it#8, +# clear=\E[H\E[2J$<50>, cub1=^H, am, cup=\E[ip12252;p2787036H$<5>, +# cuf1=\E[C$<2>, cuu1=\E[A$<2>, el=\E[K$<3>, ed=\E[J$<50>, +# cud=\E[p12252B, cuu=\E[p1787036A, cub=\E[p1787088D, cuf=\E[p1787036C, +# smso=\E[7m$<2>, rmso=\E[m$<2>, smul=\E[4m$<2>, rmul=\E[m$<2>, +# bold=\E[1m$<2>, rev=\E[7m$<2>, blink=\E[5m$<2>, sgr0=\E[m$<2>, +# sgr=\E[?p1t;7;?p2t;4;?p3t;7;?p4t;5;?p6t;1;m, +# rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, smkx=\E[?1h\E=, rmkx=\E[?1l\E>, +# tbc=\E[3g, hts=\EH, home=\E[H, +# kcuu1=\EOA, kcud1=\EOB, kcuf1=\EOC, kcub1=\EOD, kbs=^H, +# kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, ht=^I, ri=\EM$<5>, +# vt#3, xenl, xon, sc=\E7, rc=\E8, csr=\E[ip12252;p2787036r, +# +# +# ibm xtalk terminal simulator -- similar to but dumber than +# vanilla vt100 +# Enjoy! +# Rick Thomas +# ihnp4!btlunix!rbt +# (201)-522-6062 +# +# PS -- I just got word that there is a new revision of xtalk +# (3.5 I think they said) that is supposed to fix the vt100 +# emulation problems. +# +xtalk|IBM PC with xtalk communication program, + am, mir, msgr, xon, + cols#80, it#8, lines#24, vt#3, xmc#1, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, clear=\E[H\E[J$<50>, cr=\r, cub=\E[%p1%dD, + cub1=\b, cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, + cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>, + cuu=\E[%p1%dA, cuu1=\E[A$<2>, dl1=\E[M$<99>, + ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=\t, hts=\EH, + il1=\E[L$<99>, ind=\n, ka1=\EOq, ka3=\EOs, kb2=\EOr, + kbs=\b, kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, + kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, ri=\EM$<5>, + rmacs=^O, rmkx=\E[?1l\E>, rmso=\E[m\s, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, smacs=^N, + smkx=\E[?1h\E=, smso=\E[7m\s, tbc=\E[3g, +# +# Info: +# \EI gets you out of inverse video mode. +# +# Info: +# IBM +# Thu May 5 19:35:27 1983 +# +ibmpc|ibm-pc|ibm5051|5051|IBM Personal Computer, + cud1=^J, ind=^J$<10>, bel=^G, smir=\200R, am, cub1=^], + kcud1=^_, clear=^L^K, cr=^M^^, home=^K, lines#24, cuu1=^^, + cuf1=^\, cols#80, +# Info: +# According to the Coherent 2.3 manual, the PC console is similar +# to a z19. The differences seem to be (1) 25 lines, (2) no status +# line, (3) standout is broken, (4) ins/del line is broken, (5) +# has blinking and bold. +# +pc-coherent|pcz19|coherent|IBM PC console running Coherent, + cr=^M, cud1=^J, ind=^J, bel=^G, .il1=\EL$<1*>, am, cub1=^H, + ed=\EJ, el=\EK, clear=\EE, cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80, + dch1=\EN, .dl1=\EM$<1*>, cud1=\EB, rmir=\EO, home=\EH, smir=\E@, + lines#25, mir, cuf1=\EC, ht=^I, it#8, + ri=\EI, rmso=\Eq, smso=\Ep, cuu1=\EA, + kbs=^h, kcuu1=\EA, kcud1=\EB, kcub1=\ED, kcuf1=\EC, khome=\EH, +# Info: +# According to the Venix 1.1 manual, the PC console is similar +# to a DEC vt52. Differences seem to be (1) arrow keys send +# different strings, (2) enhanced standout, (3) added +# insert/delete line. +# +# Note in particular that it doesn't have automatic margins (ick). +# There are other keys (f1-f10, pgup, pgdn, backtab, insch,delch) +# which I don't have time to add now. +# +pc-venix|venix|IBM PC console running Venix, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=\EJ, el=\EK, + clear=\EH\EJ, cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80, lines#25, + cuf1=\EC, ht=^I, it#8, ri=\EI, cuu1=\EA, + kcuu1=\EH, kcud1=\EP, kcuf1=\EM, kcub1=\EK, kbs=^H, + il1=\EL, dl1=\EM, khome=\EG, +ibm|ibm3101|3101|i3101|IBM 3101-10, + am, + cols#80, lines#24, + bel=^G, clear=\EK, cr=\r, cub1=\b, cud1=\n, cuf1=\EC, + cup=\EY%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=\EA, ed=\EJ, + el=\EI, home=\EH, ht=\t, hts=\E0, tbc=\EH, + ind=\n, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, +ibm-system1|system1|ibm system/1 computer, + ind=^J, bel=^G, xt, am, cub1=^H, + cup=^E%p1%' '%+%c%p2%' '%+%c, clear=^Z, + cols#80, home=^K, lines#24, cuf1=^\, cuu1=^^, +megatek|Pegasus Work Station Terminal Emulator, + cols#83, lines#60, os, am, +# Info: +# sol and Microkit are for Corey - 6/11/82 - NS +# +microkit|mkt|microkit terminal computer, + cr=^M, ind=^J, cud1=^J, bel=^G, + il1=\El, am, cub1=^H, ed=\Ej, el=\Ek, clear=\Ee, + cup=\Ey%p1%' '%+%c%p2%' '%+%c, cols#40, dch1=\En, dl1=\Em, + rmir=\Eo, home=\Eh, smir=\E@, lines#23, mir, + cuf1=\Ec, cuu1=\Ea, ht=^I, cvvis=^N^Lzv, cnorm=\Ex, + kcuu1=\Eu, kcud1=\Ed, kcub1=\El, kcuf1=\Er, khome=\Eh, xenl, +# Info: +# OSBORNE +# Thu Jul 7 03:55:16 1983 +# +# As an aside, be careful; it may sound like an anomaly on the +# Osborne, but with the 80-column upgrade, it's too easy to +# enter lines >80 columns! +# +# I've already had several comments... +# The Osborne-1 with the 80-col option is capable of being +# 52,80, or 104 characters wide; default to 80 for compatibility +# with most systems. +# +# The tab is destructive on the Ozzie; make sure to 'stty -tabs'. +# +ozzie|osborne|osborne1|osborne 1, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE, cub1=^H, el=\ET, + cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z, cols#104, dch1=\EW, dl1=\ER, + kcuu1=^K, kcud1=^J, kcub1=^H, kcuf1=^L, cud1=^J, cuf1=^L, + ich1=\EQ, lines#24, cuu1=^K, msgr, smso=\E), rmso=\E(, + ul, smul=\El, rmul=\Em, xt, +# Info: +# SOL +# I don't know which, if either, of these sol's to believe. +# ^S is an arrow key! +# +sol|sol1|, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, cup=\E^1%p1%c\E^2%p2%c, + clear=^K, home=^N, cols#64, lines#16, cuf1=^S, cuu1=^W, + kcub1=^A, kcuf1=^S, kcuu1=^W, kcud1=^Z, +# Info: +# sol and Microkit are for Corey - 6/11/82 - NS +# +sol2|sol terminal computer, + cr=^M, ind=^J$<20>, cud1=^J, bel=^G, + il1=20\EL, am, cub1=^H, ed=20\EJ, el=\EK, clear=20\EE, + cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#64, dch1=\EN, dl1=20\EM, + rmir=\EO, home=\EH, smir=\E@, lines#16, mir, cuf1=\EC, + cuu1=\EA, ht=^I, cvvis=^N^Lv, cnorm=\EX, + kcuu1=\EU, kcud1=\ED, kcub1=\EL, kcuf1=\ER, khome=\EH, xenl, +# Info: +# SUN +# smcup/rmcup control # lines scrolled on linefeed. The sun 2 +# seems to handle this well with it set to 1, so both force this. +# rmcup could use 0 or 3 just as well, I suppose. +# +sun|sun1|sun2|sun microsystems inc workstation, + cr=^M, cud1=\E[B, ind=^J, bel=^G, am, km, cub1=^H, clear=^L, + lines#34, cols#80, cup=\E[%i%p1%d;%p2%dH, cuf1=\E[C, cuu1=\E[A, + el=\E[K, ed=\E[J, smcup=\E[1r, rmcup=\E[1r, kcud1=\E[B, + kcub1=\E[D, kcuu1=\E[A, kcuf1=\E[C, khome=\E[H, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, ht=^I, il1=\E[L, dl1=\E[M, + smso=\E[7m, rmso=\E[m, msgr, ich1=\E[@, mir, dch1=\E[P, +terak|Terak emulating Datamedia 1520, + am, xenl, + cols#80, lines#24, + bel=^G, clear=\f, cr=\r, cub1=\b, cud1=\n, cuf1=^\, + cup=^^%p2%'\s'%+%c%p1%'\s'%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ht=\t, ind=\n, kcub1=\b, kcud1=\n, kcuf1=^\, + kcuu1=^_, khome=^Y, +trs80|trs-80|trs80-1|Radio Shack TRS-80 model I, + cr=^M, cud1=^J, ind=^J, bel=^G, + am, cub1=^H, cols#64, lines#16, +# Info: +# +trs16|trs80-16|trs-80 model 16 console, + cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL, am, cub1=^H, ed=\EJ, + el=\EK, clear=^L, cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, + cols#80, dch1=\EQ, dl1=\EM, + cud1=\EB, ich1=\EP, home=\EH, kbs=^H, kcud1=\EB, + kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kf0=^A, kf1=^B, + lines#24, cuf1=\EC, ht=^I, rmso=\ER@, xmc#0, smso=\ERD, + kf2=^D, kf3=^L, kf4=^U, kf5=^P, kf6=^N, kf7=^S, +# Info: +# Radio Shack model 100 running standard TELCOM Rom program +# hacking by Yerazuws@RPI, Bownesrm@RPI 1/8/84 +# tested at 300 baud (foneline), remember to set the 100's RS-232 +# to ignore parity (eg. config to 37I1N) if you want to +# run Emacs (which this termcap description will, quite nicely!) +# +# From: jgc@sunrise.UUCP Mon, 11-Jul-83 17:33:49 EDT +# esc A - cursor up +# esc B - cursor down +# esc C - cursor right +# esc D - cursor left +# esc E - clear screen and home cursor +# esc H - home cursor +# esc J - erase to end of screen +# esc K - erase to end of line +# esc L - insert line +# esc M - delete line +# esc P - turn on cursor +# esc Q - turn off cursor +# esc T - sets system line (?) +# esc U - resets system line (?) +# esc V - turn off LCD (?) +# esc W - turn on LCD (?) +# esc Y row column - cursor motion (:cm=\EY%+ %+ :) +# esc j - clear screen, don't move cursor +# esc l - erase line, don't move cursor +# esc p - begin reverse video +# esc q - end reverse video +# esc del - change char under cursor to space +# +trs80-100|trs100|trs-100|MZ|m-100|m100| Radio Shack Model 100, + cr=^M, cud1=^J, ind=^J, bel=^G, ed=\EJ, el=\EK, cub1=^H, am, + dl1=\EM, il1=\EL, cuu1=\EA, cuf1=\EC, cup=\EY%p1%' '%+%c%p2%' '%+%c, + lines#8, cols#40, smso=\Ep, rmso=\Eq, + kcuu1=^^, kcud1=^_, kcub1=^], kcuf1=^\, kbs=^H, + home=\EH, clear=\EE, xt, + civis=\EQ, cnorm=\EP, +# XEROX +x820|Xerox 820, + cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + cup=\E=%p1%' '%+%c%p2%' '%+%c, + clear=1^Z, ed=^Q, el=^X, cols#80, home=^^, lines#24, + cuf1=^L, cuu1=^K, + +# COLOR EMULATORS + +gs6300|emots|AT&T PC6300 with EMOTS Terminal Emulator, + +# background color erase + + am, msgr, xon, bce, + cols#80, it#8, lines#24, colors#8, pairs#64, + acsc=\,\,..--++``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + cr=\r, cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, .el1=\E[1K, + home=\E[H, ht=\t, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=\n, is2=\E[0m, kbs=\b, + kcbt=^R\t, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\E[0s, kf2=\E[24s, kf3=\E[1s, + kf4=\E[23s, kf5=\E[2s, kf6=\E[22s, kf7=\E[3s, + kf8=\E[21s, khome=\E[H, mc4=\E[4i, mc5=\E[5i, + rev=\E[7m, ri=\E[L, rmacs=\E[10m, rmln=\E|, rs1=\Ec, + sgr0=\E[m\E[10m, smacs=\E[11m, smso=\E[1m, smul=\E[4m, + +# color information. blue foreground is simulated with cyan + + op=\E[?;m, + setf=\E[?%?%p1%{0}%=%t0 + %e%p1%{1}%=%t2 + %e%p1%{1}%-%d%;m, + setb=\E[?;%p1%dm, + + +pc52|dec vt52 for PC, + +# background color erase + + am, msgr, bce, + cols#80, it#8, lines#25, + +# bold means: white on black bold, so it not allowed with colors +# rev meand: black on white, also not allowed +# smso and dim are simulated with colors, ditto +# smul is allowed, even though it always means white foreground: +# it is too important. + + colors#8, pairs#64, ncv#53, + bel=^G, blink=\Eo, bold=\Ebo\Ec0, clear=\EH\EJ, cr=\r, + cub1=\b, cud1=\n, cuf1=\EC, + cup=\EY%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=\EA, + dim=\Eb3\Ec0, dl1=\EM, ed=\EJ, el=\EK, ht=\t, il1=\EL, + ind=\n, kbs=\b, kcub1=\EL, kcud1=\ED, kcuf1=\ER, + kcuu1=\EU, kf1=\Ea, kf10=\Ej, kf2=\Eb, kf3=\Ec, + kf4=\Ed, kf5=\Ee, kf6=\Ef, kf7=\Eg, kf8=\Eh, kf9=\Ei, + rev=\Ep, ri=\EI, rmso=\Eb7\Ec0, sgr0=\Eb7\Ec0\Et, smso=\Eb6\Ec4, + smul=\Es, + +# color information. blue foreground is simulated with cyan + + op=\Eb7\Ec0, + setf=\Eb%?%p1%{1}%=%t3 + %e%p1%d%;, + setb=\Ec%p1%d, + + +# CTRM terminal emulator + +ctrm|C terminal emulator, + + am, xon, + +# back_color_erase +# underlining is not allowed with colors: first, is is simulated by +# black on white, second, it disables background color manipulations. + + bce, + cols#80, lh#0, lines#24, lm#0, lw#0, nlab#0, colors#8, pairs#64, + pb#19200, vt#6, ncv#2, + bel=^G, cbt=\Ei, clear=\EH\EJ, cr=\r, cub1=\b, + cud1=\n, cuf1=\EC, cup=\E&a%p2%dc%p1%dY, cuu1=\EA, + dch1=\EP$<2>, dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, + ht=\t$<2>, hts=\E1, il1=\EL, ind=\n, ip=$<2>, + is2=\E&jA\r, kbs=\b, kcub1=\Eu\r, kcud1=\Ew\r, + kcuf1=\Ev\r, kcuu1=\Et\r, kf1=\Ep\r, kf2=\Eq\r, + kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, + kf8=\Ew\r, khome=\Ep\r, rmir=\ER, rmkx=\E&jA, smir=\EQ, + smkx=\E&jB, smso=\E&dD, smul=\E&dD, tbc=\E3, + vpa=\E&a%p1%dY, + +# BLINKING, REVERSE and BOLD are allowed with colors, +# so we have to save their status in the static registers A, B and H +# respectively, to be able to restore them when color changes +# (because any color change turns off ALL attributes) + + blink=\E&dA%{1}%PA, + +# "enter_bold_mode" and "enter_reverse_mode" sequences alternates modes, +# rather then simply entering them. Thus we have to check the +# static register B and H to determine the status, before sending the +# escape sequence. + + rev=%?%gB%{0}%=%t\E&dB%{1}%PB%;, + bold=%?%gH%{0}%=%t\E&dH%{1}%PH%;, + + smul=\E&dD, + +# sgr0 now must set the status of all 3 register (A,B,H) to zero +# and then reset colors + + sgr0=\E&d@%{0}%PA%{0}%PB%{0}%PH, + +# implementation of the protect mode would badly penalize the performance. +# we would have to use \E&bn sequence to turn off colors (as well as all +# other attributes), and keep the status of protect mode in yet another +# static variable. If someone really need this mode, they would have to +# create another terminfo entry. + + sgr=\E&d@%{0}%PA%{0}%PB%{0}%PD%{0}%PH + %?%p1%p3%p5%|%|%t\E&dB%{1}%PB%; + %?%p4%t\E&dA%{1}%PA%; + %?%p6%t\E&dH%{1}%PH%; + %?%p2%t\E&dD%;, + +# original color-pair: white on black. +# store the information about colors into static registers + + op=\E&bn\E&bB\E&bG\E&bR + %{0}%PX%{0}%PY%{0}%PZ + %{1}%PW%{1}%PV%{1}%PU, + +# set foreground color. it performs the following steps. +# 1) turn off all attributes +# 2) turn on the background and video attribues that have been turned +# on before (this information is stored in static registers X,Y,Z,A,B,H,D). +# 3) turn on foreground attributes +# 4) store information about foreground into U,V,W static registers + + setf=\E&bn + %?%gA%t\E&dA%; + %?%gB%t\E&dB%; + %?%gH%t\E&dH%; + %?%gX%t\E&br%; + %?%gY%t\E&bg%; + %?%gZ%t\E&bb%; + + %?%p1%{1}%&%t\E&bB%{1}%e%{0}%;%PW + %?%p1%{2}%&%t\E&bG%{1}%e%{0}%;%PV + %?%p1%{4}%&%t\E&bR%{1}%e%{0}%;%PU, + +# turn on background: similar to turn on foreground above + + setb=\E&bn + %?%gA%t\E&dA%; + %?%gB%t\E&dB%; + %?%gH%t\E&dH%; + %?%gU%t\E&bR%; + %?%gV%t\E&bG%; + %?%gW%t\E&bB%; + + %?%p1%{1}%&%t\E&bb%{1}%e%{0}%;%PZ + %?%p1%{2}%&%t\E&bg%{1}%e%{0}%;%PY + %?%p1%{4}%&%t\E&br%{1}%e%{0}%;%PX, diff --git a/usr/src/lib/terminfo/perkinelmer.ti b/usr/src/lib/terminfo/perkinelmer.ti new file mode 100644 index 0000000..33649b4 --- /dev/null +++ b/usr/src/lib/terminfo/perkinelmer.ti @@ -0,0 +1,79 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:perkinelmer.ti 1.10" +# # -------------------------------- +# +# perkinelmer: PERKIN ELMER +# +# Manufacturer: PERKIN ELMER +# Class: II +# +# Following this message is a copy of our TERMINFO file for +# Perkin-Elmer terminals. Please be aware that we are in the +# process of revising it and will supply you a new version as +# soon as its ready. In the mean time, though, this should get +# you started. +# +# +# perkinelmer: PERKIN ELMER +# +bantam|pe550|pe6100|perkin elmer 550, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, cols#80, el=\EI$<20>, + clear=\EK$<20>, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, home=\EH, + lines#24, ll=\EH\EA, cuf1=\EC, cuu1=\EA, +fox|pe1100|perkin elmer 1100, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, + ed=\EJ$<5.5*>, el=\EI, clear=\EH\EJ$<132>, cols#80, home=\EH, lines#24, + ll=\EH\EA, cuf1=\EC, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, + cuu1=\EA, flash=^P^B^P^C, +owl|pe1200|perkin elmer 1200, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL$<5.5*>, + am, cub1=^H, ed=\EJ$<5.5*>, el=\EI$<5.5>, clear=\EH\EJ$<132>, home=\EH, + ll=\EH\EA, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, cols#80, dch1=\EO$<5.5*>, + dl1=\EM$<5.5*>, ich1=\EN, ip=$<5.5*>, kbs=^h, in, lines#24, + cuf1=\EC, cuu1=\EA, rmso=\E!\200, smso=\E!^H, flash=^P^B^P^C, + kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, kf5=\ERE, kf6=\ERF, + kf7=\ERG, kf8=\ERH, kf9=\ERI, kf0=\ERJ, +pe1251|pe6300|pe6312|perkin elmer 1251, + am, cols#80, it#8, lines#24, xmc#1, pb#300, vt#8, + bel=^G, cr=^M, clear=\EK$<332>, el=\EI$<10*>, ed=\EJ$<20*>, + cud1=\EB, home=\EH, cub1=\ED, cuf1=\EC, cuu1=\EA, + cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, ind=^J, hts=\E1, kf0=\ERA, + kf1=\ERB, kf2=\ERC, kf3=\ERD, kf4=\ERE, kf5=\ERF, kf6=\ERG, + kf7=\ERH, kf8=\ERI, kf9=\ERJ, kf10=\ERK, tbc=\E3, +pe7000m|perkin elmer 7000 series monochrome monitor, + am, cols#80, lines#24, + bel=^G, cr=^M, clear=\EK, el=\EI, ed=\EJ, + cud1=\EB, home=\EH, cub1=\ED, cuf1=\EC, cuu1=\EA, + cup=\ES%p1%' '%+%c%p2%' '%+%c,ind=^J, + is1=\E!\0\EW 7o\Egf\ES7 , + smso=\E!\010, rmso=\E!\0, + cbt=\E!Y, + kf0=\E!\0, kf1=\E!\001, kf2=\E!\002, kf3=\E!\003, + kf4=\E!\004, kf5=\E!\005, kf6=\E!\006, kf7=\E!\007, + kf8=\E!\010, kf9=\E!\011, kf10=\E!\012, + kbs=^H, kcud1=\E!U, khome=\E!S, kcub1=\E!V, kcuf1=\E!W, + kcuu1=\E!T, ll=\ES7 , ri=\ER, + rmul=\E!\0, smul=\E!\040, +pe7000c|perkin elmer 7000 series colour monitor, + am, cols#80, lines#24, + bel=^G, cr=^M, clear=\EK, el=\EI, ed=\EJ, + cud1=\EB, home=\EH, cub1=\ED, cuf1=\EC, cuu1=\EA, + cup=\ES%p1%' '%+%c%p2%' '%+%c,ind=^J, + is1=\E!\0\EW 7o\Egf\Eb0\Ec7\ES7 , + smso=\Eb2, rmso=\Eb0, + cbt=\E!Y, + kf0=\E!\0, kf1=\E!\001, kf2=\E!\002, kf3=\E!\003, + kf4=\E!\004, kf5=\E!\005, kf6=\E!\006, kf7=\E!\007, + kf8=\E!\010, kf9=\E!\011, kf10=\E!\012, + kbs=^H, kcud1=\E!U, khome=\E!S, kcub1=\E!V, kcuf1=\E!W, + kcuu1=\E!T, ll=\ES7 , ri=\ER, + rmul=\E!\0, smul=\E!\040, + + + diff --git a/usr/src/lib/terminfo/print.ti b/usr/src/lib/terminfo/print.ti new file mode 100644 index 0000000..33538be --- /dev/null +++ b/usr/src/lib/terminfo/print.ti @@ -0,0 +1,104 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:print.ti 1.9" +# # -------------------------------- +# +# print: PRINTERS +# +# Manufacturer: GENERIC LINE PRINTERS +# Class: III +# +# Info: +# Generic line printer. We assume it can backspace, since even +# those line printers that can't have this hidden by UNIX lpr +# driver. +# +lpr|lp|printer|print|printing|line printer, + cr=^M, cud1=^J, ind=^J, ff=^L, bel=^G, cub1=^H, + lines#66, cols#132, hc, os, +# Info: +# The 'S' beginning mc4 and mc5 is checked for by lp, which +# sleeps 5 seconds. +# +pbox|printerbox|box with print mode switch, + mc5=Set printer switch to "print"\r\n, + mc4=Set printer switch to "terminal"\r\n, +2621-pb|hp2621-pb|2621 with printer box, + am, da, db, mir, xon, + cols#80, lines#24, lm#0, pb#19200, vt#6, + bel=^G, cbt=\Ei, clear=\EH\EJ, cr=\r, cub1=\b, + cud1=\n, cuf1=\EC, cup=\E&a%p2%dc%p1%dY, cuu1=\EA, + dch1=\EP$<2>, dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, + ht=\t$<2>, hts=\E1, il1=\EL, ind=\n, ip=$<2>, + is2=\E&jA\r, kbs=\b, kcbt=\Ei, kf1=\Ep\r, kf2=\Eq\r, + kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, + kf8=\Ew\r, + mc4=Set\sprinter\sswitch\sto\s"terminal"\r\n, + mc5=Set\sprinter\sswitch\sto\s"print"\r\n, rmir=\ER, + rmkx=\E&jA, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, + smir=\EQ, smkx=\E&jB, smso=\E&dD, smul=\E&dD, tbc=\E3, + vpa=\E&a%p1%dY, + cols#87, it#8, lines#72, + bel=^G, clear=\f, cr=\r, cub1=\ED, cud1=\n, cuf1=\EC, + cup=\EY%p2%'\s'%+%c%p1%'\s'%+%c, cuu1=\EA, + dch=\Ee%p1%'\s'%+%c, dch1=\Ee!, dl=\EE%p1%'\s'%+%c, + dl1=\EE!, el=\EK, ht=\t, ich=\Ef%p1%'\s'%+%c, + ich1=\Ef!, il=\EF%p1%'\s'%+%c, il1=\EF!, ind=\n, + kbs=\b, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf1=\Ex, kf2=\Ey, kf3=\Ez, + mc4=Set\sprinter\sswitch\sto\s"terminal"\r\n, + mc5=Set\sprinter\sswitch\sto\s"print"\r\n, +h19-pb|heathkit h19 with printer box, + am, eslok, hs, mir, msgr, + cols#80, it#8, lines#24, + bel=^G, clear=\EE, cnorm=\Ey4, cr=\r, cub1=\b, + cud1=\n, cuf1=\EC, cup=\EY%p1%'\s'%+%c%p2%'\s'%+%c, + cuu1=\EA, cvvis=\Ex4, dch1=\EN, dl1=\EM$<1*>, ed=\EJ, + el=\EK, fsl=\Ek\Ey5, home=\EH, ht=\t, il1=\EL$<1*>, + ind=\n, kbs=\b, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, + kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, khome=\EH, + lf6=blue, lf7=red, lf8=white, + mc4=Set\sprinter\sswitch\sto\s"terminal"\r\n, + mc5=Set\sprinter\sswitch\sto\s"print"\r\n, ri=\EI, + rmacs=\EG, rmir=\EO, rmso=\Eq, smacs=\EF, smir=\E@, + smso=\Ep, tsl=\Ej\Ex5\EY8%p1%'\s'%+%c\Eo\Eo, +mime-pb|mime with printer box, + am, + cols#80, it#8, lines#24, vt#9, + bel=^G, clear=^]^C, cr=\r, cub1=\b, cud1=\n, cuf1=^X, + cup=^T%p1%{24}%+%c%p2%?%p2%{32}%>%t%{48}%+%;%{80}%+%c, + cuu1=^Z, dl1=^W$<80>, ed=^_, el=^^, home=^], ht=\t, + il1=^A$<80>, ind=\n, is2=\E^S^Q, kcub1=\b, kcud1=^K, + kcuf1=^X, kcuu1=^Z, + mc4=Set\sprinter\sswitch\sto\s"terminal"\r\n, + mc5=Set\sprinter\sswitch\sto\s"print"\r\n, ri=^R$<3>, + uc=^U, +citoh|ci8510|8510|c.itoh 8510a, + cols#80, ri=\Er, bold=\E!, smul=\EX, rmul=\EY, sgr0=\E"\EY, it#8, + is2=\E(009\054017\054025\054033\054041\054049\054057\054065\054073., + rep=\ER%p2%03d%p1%c, cub1@, use=lpr, +citoh-pica|citoh in pica, + is1=\EN, use=citoh, +citoh-elite|citoh in elite, + is2=\E(009\054017\054025\054033\054041\054049\054057\054065\054073\054081\054089., + is1=\EE, cols#96, use=citoh, +citoh-comp|citoh in compressed, + is2=\E(009\054017\054025\054033\054041\054049\054057\054065\054073\054081\054089\054097\054105\054113\054121\054129., + is1=\EQ, cols#136, use=citoh, +# Info: +# Infinite cols because we don't want lp ever inserting \n\t**. +# +citoh-prop|citoh-ps|ips|citoh in proportional spacing mode, + is1=\EP, cols#32767, use=citoh, +citoh-6lpi|citoh in 6 lines per inch mode, + is3=\EA, use=citoh, +citoh-8lpi|citoh in 8 lines per inch mode, + is3=\EB, lines#88, use=citoh, +qms-diablo|diablo simulated by qms, + smul=\EE, rmul=\ER, smso=\EW, rmso=\E&, use=lpr, diff --git a/usr/src/lib/terminfo/special.ti b/usr/src/lib/terminfo/special.ti new file mode 100644 index 0000000..09eeec2 --- /dev/null +++ b/usr/src/lib/terminfo/special.ti @@ -0,0 +1,36 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:special.ti 1.5" +# # -------------------------------- +# +# special: SPECIALS +# +# Manufacturer: SPECIAL GENERIC TERMINALS +# Class: III +# Info: +# Generic "terminals". These are used to label tty lines when +# you don't # know what kind of terminal is on it. The +# characteristics of an unknown terminal are the lowest common +# denominator - they look about like a ti 700. +# +arpanet|network|net|, + use=unknown, +bussiplexer, + use=unknown, +dialup, + use=unknown, +ethernet, + use=unknown, +plugboard|patch|patchboard|, + use=unknown, +dumb, + am, bel=^G, cols#80, cr=^M, cud1=^J, ind=^J, +unknown, + gn, use=dumb, +switch|intelligent switch, + use=unknown, diff --git a/usr/src/lib/terminfo/sperry.ti b/usr/src/lib/terminfo/sperry.ti new file mode 100644 index 0000000..e555d81 --- /dev/null +++ b/usr/src/lib/terminfo/sperry.ti @@ -0,0 +1,47 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:sperry.ti 1.9" +# # -------------------------------- +# +# sperry: SPERRY +# +# Manufacturer: SPERRY +# Class: III +# Info: +# This is a terminal that is (going to be) used with increasing +# frequency here, internally at sperry. It is also similar, i +# believe, to the terminal that comes with the sperry pcs that +# have recenty made an entry into the micro market. +# It doesn't have everything that the uts30 has to offer, i'm +# sure (read hope), but its a start. +# +# +# This entry is for the Sperry UTS30 terminal running the TTY +# utility under control of CP/M Plus 1R1. The functionality +# provided is comparable to the DEC vt100. +# +# +uts30|sperry uts30 with cp/m@1R1, + am, bw, hs, + cols#80, lines#24, wsl#40, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\ER, clear=\f, cnorm=\ES, + cr=\r, csr=\EU%p1%' '%+%c%p2%' '%+%c, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=\EB, cuf=\E[%p1%dC, cuf1=\EC, + cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EM, dl=\E[%p1%dM, + dl1=\EL, + ed=\E[J, el=\E[K, fsl=\r, home=\E[H, ht=\t, ich=\E[%p1%d@, ich1=\EO, + il=\E[%p1%dL, il1=\EN, + kbs=\b, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, khome=\E[H, + ind=\l, indn=\E[%p1%dB, + is2=\E[U 7\E[24;1H, rc=\EX, rev=\E[7m, + rf=/usr/share/lib/tabset/vt100, ri=\EI, rin=\E[%p1%dA, + rmacs=\Ed, rmso=\E[m, + rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\EW, sgr0=\E[m, smacs=\EF, smso=\E[7m, smul=\E[4m, + tsl=\E], uc=\EPB, diff --git a/usr/src/lib/terminfo/tabset/3101 b/usr/src/lib/terminfo/tabset/3101 new file mode 100644 index 0000000..dab586b --- /dev/null +++ b/usr/src/lib/terminfo/tabset/3101 @@ -0,0 +1 @@ +H 0 0 0 0 0 0 0 0 0 diff --git a/usr/src/lib/terminfo/tabset/beehive b/usr/src/lib/terminfo/tabset/beehive new file mode 100644 index 0000000..6d30c69 --- /dev/null +++ b/usr/src/lib/terminfo/tabset/beehive @@ -0,0 +1,2 @@ + +                                                                                diff --git a/usr/src/lib/terminfo/tabset/hds b/usr/src/lib/terminfo/tabset/hds new file mode 100644 index 0000000..7b4df79 --- /dev/null +++ b/usr/src/lib/terminfo/tabset/hds @@ -0,0 +1,10 @@ +[0;2*x[0;3*x +[1;2*q[1;3*q +[1!w +[2!w +[3!w +[1;3!w[2;2!w[3;1!w +/[3!w[1;24;3;0;1+w[1+v/ +/[2!w[1;24;2;0;1+w[1+v/ +/[1!w[1;24;1;0;1+w[1+v/ + diff --git a/usr/src/lib/terminfo/tabset/hds3 b/usr/src/lib/terminfo/tabset/hds3 new file mode 100644 index 0000000..120ffae --- /dev/null +++ b/usr/src/lib/terminfo/tabset/hds3 @@ -0,0 +1,10 @@ +[0;2*x[0;3*x +[1;2*q[1;3*q +[1!w +[2!w +[3!w +[1;3!w[2;2!w[3;1!w +/[3!w[+w[1;17;1;0;1+w[18;24;3;0;2+w[2+v/ +/[2!w[+w[1;24;2;0;2+w[2+v/ +/[1!w[+w[1;17;1;0;1+w[18;24;3;0;2+w[1+v/ + diff --git a/usr/src/lib/terminfo/tabset/std b/usr/src/lib/terminfo/tabset/std new file mode 100644 index 0000000..e93f737 --- /dev/null +++ b/usr/src/lib/terminfo/tabset/std @@ -0,0 +1 @@ + 3 1 1 1 1 1 1 1 1 1 1 1 1 1 diff --git a/usr/src/lib/terminfo/tabset/teleray b/usr/src/lib/terminfo/tabset/teleray new file mode 100644 index 0000000..bbce08e --- /dev/null +++ b/usr/src/lib/terminfo/tabset/teleray @@ -0,0 +1 @@ +GY9(FY90FY98FY9@FY9HFY9PFY9XFY9`FY9hF diff --git a/usr/src/lib/terminfo/tabset/vt100 b/usr/src/lib/terminfo/tabset/vt100 new file mode 100644 index 0000000..a65f743 --- /dev/null +++ b/usr/src/lib/terminfo/tabset/vt100 @@ -0,0 +1,3 @@ + + +H H H H H H H H H H H H H H H H diff --git a/usr/src/lib/terminfo/tabset/xerox1720 b/usr/src/lib/terminfo/tabset/xerox1720 new file mode 100644 index 0000000..1fa7c12 --- /dev/null +++ b/usr/src/lib/terminfo/tabset/xerox1720 @@ -0,0 +1,2 @@ +2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + diff --git a/usr/src/lib/terminfo/tektronix.ti b/usr/src/lib/terminfo/tektronix.ti new file mode 100644 index 0000000..9215713 --- /dev/null +++ b/usr/src/lib/terminfo/tektronix.ti @@ -0,0 +1,301 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:tektronix.ti 1.15" +# # -------------------------------- +# +# tektronix: TEKTRONIX +# +# Manufacturer: TEKTRONIX +# Class: III +tek4107|tek4109|4107|4109|tektronix terminals 4107 4109, + am, mir, msgr, ul, xenl, xt, + cvvis=\E%!3, + cnorm=\E%!0, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=\EJ, el=\EK, + clear=\ELZ, cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#79, lines#29, + cuf1=\EC, ht=^I, it#8, ri=\EI, cuu1=\EA, + kcuu1=\EA, kcud1=\EB, kcuf1=\EC, kcub1=\ED, kbs=^H, + smso=\E%!1\E[7;5m$<2>\E%!0, + rmso=\E%!1\E[m$<2>\E%!0, + smul=\E%!1\E[4m$<2>\E%!0, + rmul=\E%!1\E[m$<2>\E%!0, + bold=\E%!1\E[1m$<2>\E%!0, + rev=\E%!1\E[7m$<2>\E%0, + blink=\E%!1\E[5m$<2>\E%!0, + dim=\E%!1\E[<0m$<2>\E%!0, + sgr0=\E%!1\E[m$<2>\E%!0, + sgr=\E%%!1\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m\E%%!0, +tek4105|4105|tektronix 4105, + am, il1=\E[1L, ed=\E[J, el=\E[K, clear=\E[2J\E[H, + cup=\E[%i%p1%2d;%p2%2dH, + cols#79, lines#29, + dch1=\E[1P, dl1=\E[1M, + home=\E[H, smir=\E[4h, rmir=\E[4l, mir, + cuf1=\E[1C, cud1=\E[1B, cuu1=\E[1A, + smacs=\E[1m, rmacs=\E[0m, msgr, + rmso=\E[=0;<1m, smso=\E[=2;<3m, + ul, smul=\E[=5;<2m, rmul=\E[=0;<1m, + is1=\E%!1\E[0m, + rev=\E[=1;<3m, bold=\E[=7;<4m, invis=\E[=6;<5, dim=\E[=1;<6m, + blink=\E[=3;<7m, sgr0=\E[=0;<1m, + smcup=\E%!1\E[?6l\E[2J, xenl, xt, + msgr, mir, kbs=^h, kcuu1=\E[1A, kcud1=\E[1B, + kcub1=\E[1D, kcuf1=\E[1C, + is2=\E%!1\E[?6141\E[0m, + cbt=\E[Z, cr=^M, ri=\E[T, ind=\E[S, it#8, + tbc=\E[1g, ht=^I, bel=^G, + +tek|tek4012|4012|tektronix 4012, + cr=^M, cud1=^J, bel=^G, ff=^L$<1000>, + is2=\E^O, cub1=^H, clear=\E^L$<1000>, cols#75, lines#35, os, +tek4013|4013|tektronix 4013, + smacs=\E^N, rmacs=\E^O, use=4012, +tek4014|4014|tektronix 4014, + is2=\E^O\E9, cols#81, lines#38, use=tek4012, +tek4015|4015|tektronix 4015, + smacs=\E^N, rmacs=\E^O, use=4014, +tek4014-sm|4014-sm|tektronix 4014 in small font, + is2=\E^O\E\072, cols#121, lines#58, use=tek4014, +tek4015-sm|4015-sm|tektronix 4015 in small font, + smacs=\E^N, rmacs=\E^O, use=4014-sm, +tek4023|4023|tex|tektronix 4023, + cr=^M, cud1=^J, ind=^J, bel=^G, smso=^_P, rmso=^_@, + cup=\034%p2%' '%+%c%p1%' '%+%c, cuf1=\t, cub1=^H, + clear=\E^L$<4>, cols#80, lines#24, am, vt#4, +# Info: +# It is recommended that you run the 4025 at 4800 baud or less; +# various bugs in the terminal appear at 9600. It wedges at the +# bottom of memory (try "cat /usr/dict/words"); ^S and ^Q typed +# on keyboard don't work. You have to hit BREAK twice to get +# one break at any speed - this is a documented feature. +# Can't use cursor motion because it's memory relative, and +# because it only works in the workspace, not the monitor. +# Same for home. Likewise, standout only works in the workspace. +# +# el was commented out since vi and rogue seem to work better +# simulating it with lots of spaces! +# +# il1 and il had 145ms of padding, but that slowed down vi's ^U +# and didn't seem necessary. +# +4025|4027|4024|tek4025|tek4027|tek4024|4025cu|4027cu|tektronix 4024/4025/4027, + cr=^M, ind=^F^J, cud1=^F^J, bel=^G, am, da, db, ht=^I, it#8, + cub1=^H, lm#0, lines#34, cols#80, clear=^_era\r\n\n, + is2=\41com 31\r\n^_sto 9 17 25 33 41 49 57 65 73\r, + smkx=^_lea p4 /h/\r^_lea p8 /k/\r^_lea p6 / /\r^_lea p2 /j/\r^_lea f5 /H/\r, + rmkx=^_lea p2\r^_lea p4\r^_lea p6\r^_lea p8\r^_lea f5\r, + cuu1=^K, cuf1=^_rig\r, + ed=^_dli 50\r, cmdch=^_, + dch1=^_dch\r, ich1=^_ich\r ^H, + il1=^_up\r^_ili\r, dl1=^_dli\r^F, + il=^_up\r^_ili %p1%d\r, dl=^_dli %p1%d\r^F, + cuu=^_up %p1%d\r, cud=^_dow %p1%d\r, + cub=^_lef %p1%d\r, cuf=^_rig %p1%d\r, +tek4025-17|4025-17|4027-17|tek 4025 17 line window, + lines#17, use=4025, +tek4025-17-ws|4025-17-ws|4025-17ws|4027-17-ws|tek 4025 17 line window in workspace, + is2=\41com 31\r\n^_sto 9 17 25 33 41 49 57 65 73\r^_wor 17\r^_mon 17\r, + smcup=^_wor h\r, rmcup=^_mon h\r, smso=^_att e\r, rmso=^_att s\r, use=4025-17, +tek4025-ex|4025-ex|4025ex|4027-ex|tek 4025 w/!, + smcup=\41com 31\r, rmcup=^_com 33\r, + is2=^_com 33\r\n\41sto 9 17 25 33 41 49 57 65 73\r, use=4025, +tek4105-30|4105-30|4015 emulating 30 line vt100, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#30, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=\r, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, + el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=\t, + hts=\EH, ind=\n, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=\b, + kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP, + kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt, + kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmkx=\E[?1l\E>, + rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;, + sgr0=\E[m^O$<2>, smacs=^N, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, +# Info: +# The 4110 series may be a wonderful graphics series, but they +# make the 4025 look good for screen editing. +# +# In the dialog area, you can't move the cursor off the bottom +# line. +# +# Out of the dialog area, ^K moves it up, but there is no way +# to scroll. +# +# Note that there is a floppy for free from Tek that makes the +# 4112 emulate the vt52 (use the vt52 termcap). There is also +# an expected enhancement that will use ANSI standard sequences. +# +# 4112 in non-dialog area pretending to scroll. It really wraps +# but vi is said to work (more or less) in this mode. +# +# 'vi' works reasonably well with this entry. +# +4112|4112-nd|4113|4114|tek4112|tektronix 4110 series, + cr=^M, cud1=^J, ind=^J, bel=^G, cuu1=^K, cub1=^H, + am, clear=\E^L, lines#34, cols#80, + smcup=\EKA0\ELV0\EMG0, rmcup=\EKA1\ELV1, +tek4112-d|4112-d|tek 4112 in dialog area, + am, clear=\ELZ, lines#34, cols#80, cuu1=^K, +tek4112-5|4112-5|4112 in 5 line dialog area, + lines#5, use=4112, +tek4115|4115|tektronix 4115, + am, xon, + cols#80, lines#34, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J, cr=\r, cub=\E[%p1%dD, cub1=\b, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=\t, hts=\EH, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + ind=\n, invis=\E[8m, kbs=\b, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rmso=\E[m, + rmul=\E[m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m, + sgr0=\E[0m, smso=\E[7m, smul=\E[4m, tbc=\E[2g, + vpa=\E[%p1%{1}%+%dd, +# Info: +# t500 is a local entry for the oddball Tek 500 owned by Fluke +# Labs +# +t500|Tek series 500, + cr=^M, ind=^J, cud1=^J, bel=^G, + lines#25, cols#80, cub1=^H, cup=\E=%p1%p1%' '%+%c%p2%' '%+%c, + clear=^E$<20>, home=^T, bw, am, +# Info: +# I added the is string - straight Unix has ESC ; in the login +# string which sets a ct8500 into monitor mode (aka 4025 snoopy +# mode). The is string here cleans up a few things (but not +# everything). +# +ct8500|tektronix ct8500, + cr=^M, cud1=^J, ind=^J, bel=^G, cr=^M, cud1=^J, ind=^J, bel=^G, + il1=\E^L, am, cub1=^H, cbt=\E^I, bw, ed=\E^U, el=\E^T, + clear=\E^E, cup=\E|%p1%' '%+%c%p2%' '%+%c, cols#80, + da, db, dch1=\E^], + dl1=\E^M, ich1=\E^\, lines#25, cuf1=\ES, ht=^I, ri=\E^A, rmso=\E , + smso=\E$, rmul=\E , cuu1=\ER, smul=\E\041, is2=^_\EZ\Ek, + sgr0=\E\s, + +# +# Tektronix 4205 terminal. This entry contains information required +# by color curses +# + +tek4205|4205|tektronix 4205, + +# am is not defined because the wrap around occurs not when the char. +# is placed in the 80'th column, but when we are attempting to type +# the 81'st character on the line. + +# bold, dim, and standout are simulated by colors and thus not allowed +# with colors + + am, xenl, msgr, mir, ccc, + cols#80, lines#30, it#8, colors#8, pairs#64, ncv#49, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + il1=\E[1L, ed=\E[J, el=\E[K, clear=\E[2J\E[H, + il=\E[%p1%dL, + cup=\E[%i%p1%d;%p2%dH, + dch1=\E[1P, dl1=\E[1M, + home=\E[H, smir=\E[4h, rmir=\E[4l, + cuf1=\E[C, cud1=\E[B, cuu1=\E[A, cub1=\E[D, + cuf=\E[%p1%dC, cud=\E[%p1%dB, cuu=\E[%p1%dA, cub=\E[%p1%dD, + ech=\E%p1%dX, el1=\E[1K, ich=\E[%p1%d@, + smacs=, rmacs=, enacs=\E)0, + rmso=\E[=0;<1m, smso=\E[=2;<3m, + smul=\E[4m, rmul=\E[24m, + is1=\E%!0\ETM1\E%!1\E[0m, + rev=\E[7m, bold=\E[=7;<4m, invis=\E[=6;<5, dim=\E[=1;<6m, + blink=\E[5m, sgr0=\E[=0;<1m\E[24;25;27m, + smcup=\E%%!1\E[?6l\E[2J, + kbs=^h, kcuu1=\E[A, kcud1=\E[B, + kcub1=\E[D, kcuf1=\E[C, + .is2=\E%%!1\E[?6141\E[0m, + cbt=\E[Z, cr=^M, ind=\ED, ri=\EM, + tbc=\E[1g, ht=^I, bel=^G, + +# tektroinix color table is mapped into the RGB color table + + setb=\E[4%?%p1%{1}%=%t4 + %e%p1%{3}%=%t6 + %e%p1%{4}%=%t1 + %e%p1%{6}%=%t3 + %e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4 + %e%p1%{3}%=%t6 + %e%p1%{4}%=%t1 + %e%p1%{6}%=%t3 + %e%p1%d%;m, +# All colors are reset to factory specifications + + oc=\E%!0 + \ETFB0 + 0000 + 1F4F4F4 + 2F400 + 30F40 + 4A4C, + am, cub1=^H, ed=\EJ$<1>, el=\EK, clear=^L$<1>, + cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80, + dch1=\EQ, dl1=\EM$<2*>, home=\EH, ich1=\EP, ip=$<0.4*>, + kf1=^Z1, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, kf8=^Z8, + lines#24, cuf1=\EC, ht=^I, rmso=\ER@, smso= \ERD, km, + is2=\Ee\EU01^Z1\EV\EU02^Z2\EV\EU03^Z3\EV\EU04^Z4\EV\EU05^Z5\EV\EU06^Z6\EV\EU07^Z7\EV\EU08^Z8\EV\Ef, + cuu1=\EA, smul=\ERH, rmul=\ER@, xhp, xt, xmc#1, +t1061f|teleray 1061 with fast PROMs, + il1=\EL, ip@, dl1=\EM, use=t1061, +# Info: +# teleray 16 - map the arrow keys for vi/rogue, shifted to +# up/down page, and back/forth words. Put the function keys +# (f1-f10) where they can be found, and turn off the other magic +# keys along the top row, except for line/local. Do the magic +# appropriate to make the page shifts work. +# Also toggle ^S/^Q for those of us who use Emacs. +# +ya|t16|teleray 16, + cr=^M, cud1=^J, ind=^J, bel=^G, cr=^M, cud1=^J, ind=^J, bel=^G, + il1=\E[L, am, cub1=^H, ed=\E[0J, + el=\E[0K, clear=\E[H\E[2J, cup=%i\E[%p1%d;%p2%df, cols#80, kf1=^Z1, + kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, kf8=^Z8, + kf9=^Z9, kf10=^Z0, dch1=\E[P, dl1=\E[M, home=\E[H, + smcup=\E[U\E[?38l, rmcup=\E[V\E[24;1f\E[?38h, smir=\E[4h, + rmir=\E[4l, lines#24, cuf1=\E[C, ht=^I, rmso=\E[m, smso=\E[7m, + dch1=\E[P, cud1=\E[B, cuu1=\E[A, smul=\E[4m, + rmul=\E[m, xhp, xt, ri=\E[T, da, db, mir, diff --git a/usr/src/lib/terminfo/televideo.ti b/usr/src/lib/terminfo/televideo.ti new file mode 100644 index 0000000..80b765a --- /dev/null +++ b/usr/src/lib/terminfo/televideo.ti @@ -0,0 +1,281 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:televideo.ti 1.10" +# # -------------------------------- +# +# televideo: TELEVIDEO +# +# Manufacturer: TELEVIDEO +# Class: III +tvi803, + clear=\E*$<10>, use=tvi950, +# Info: +# There are some tvi's that require incredible amounts of padding +# and some that don't. I'm assuming 912 and 920 are the old slow +# ones, and 912b, 912c, 920b, 920c are the new ones that don't +# need padding. +# +tvi912|912|920|tvi920|old televideo, + tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE$<33*>, am, + cub1=^H, el=\ET, cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z, + cols#80, dch1=\EW, dl1=\ER$<33*>, + kbs=^h, kcuu1=^K, kcud1=^J, kcub1=^H, kcuf1=^L, + kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, + kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, + home=^^, ich1=\EQ, lines#24, ht=^I, + rmso=\Ek, smso=\Ej, cuu1=^K, smul=\El, rmul=\Em, xmc#1, +# Info: +# the 912 has a key that's like shift: 8 xmits +# "^A8\r". The 920 has this plus real function keys that xmit +# different things. +# Terminfo makes you use the funct key on the 912 but the real +# keys on the 920. +# +912b|912c|tvi912b|tvi912c|tvi|new televideo 912, + il1=\EE$<5*>, dl1=\ER$<5*>, use=tvi912, +920b|920c|tvi920b|tvi920c|new televideo 920, + kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r, + kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, use=tvi912b, +# Info: +# We got some new tvi912c' that act really weird on the regular +# termcap, so one of our gurus worked this up. Seems that cursor +# addressing is broken. +# +912cc|tvi912cc|tvi912 at cowell college, + cup@, use=tvi912c, +# Info: +# Two page TVI 912/920. +# set to page 1 when entering ex (\E-17 ) +# reset to page 0 when exiting ex (\E-07 ) +# +tvi912-2p|tvi920-2p|912-2p|920-2p|tvi-2p|televideo w/2 pages, + smcup=\E-17 , rmcup=\E-07 , use=tvi912, +tvi950-ap|tvi 950 w/alt pages, + is2=\E\\1, smcup=\E-06 , rmcup=\E-16 , use=tvi950, +tvi950-b|bare tvi950 no is2, + is2@, use=tvi950, +tvi950-ns|tvi950 w/no standout, + smso@, rmso@, smul@, rmul@, use=tvi950, +# Info: +# Now that we have is1, is2, and is3, these should be factored. +# +# is2 for all 950's. It sets the following attributes: +# +# full duplex (\EDF) write protect off (\E() +# +# conversation mode (\EC) graphics mode off (\E%) +# +# white on black (\Ed) auto page flip off (\Ew) +# +# turn off status line (\Eg) clear status line (\Ef\r) +# +# normal video (\E0) monitor mode off (\EX or \Eu) +# +# edit mode (\Er) load blank char to space (\Ee\040) +# +# line edit mode (\EO) enable buffer control (^O) +# +# protect mode off (\E\047) duplex edit keys (\El) +# +# program unshifted send key to send line all (\E016) +# +# program shifted send key to send line unprotected (\E004) +# +# set the following to nulls: +# field delimiter (\Ex0\0\0) +# line delimiter (\Ex1\0\0) +# start-protected field delimiter (\Ex2\0\0) +# end-protected field delimiter (\Ex3\0\0) +# +# +tvi950|950|televideo950, + am, hs, mir, msgr, xenl, + cols#80, lh#0, lines#24, lw#0, nlab#0, xmc#1, + acsc=mExJlFtMjHqKvOkGuLwNnI, bel=^G, cbt=\EI, + clear=\E*, cr=\r, cub1=\b, cud1=\n, cuf1=\f, + cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, el=\Et, + flash=\Eb$<20>\Ed, fsl=\r, home=^^, ht=\t, hts=\E1, + il1=\EE, ind=\n, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%%\Ew\EX\Ee\s^O\El\E016\E004\Ex0\200\200\Ex1\200\200\Ex2\200\200\Ex3\200\200\Ex4\r\200\Ef\r, + kbs=\b, kcub1=\b, kcud1=^V, kcuf1=\f, kcuu1=^K, + kf0=^A0\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + khome=^^, mc4=\Ea, mc5=\E`, ri=\Ej, rmacs=\E%%, + rmir=\Er, smacs=\E$, smir=\Eq, smso=\EG4, smul=\EG8, + tbc=\E3, tsl=\Eg\Ef, +# Info: +# is2 for 950 with two pages adds the following: +# set 48 line page (\E\\2) +# +# place cursor at page 0, line 24, column 1 (\E-07 ) +# +# set local (no send) edit keys (\Ek) +# +# two page 950 adds the following: +# when entering ex, set 24 line page (\E\\1) +# when exiting ex, reset 48 line page (\E\\2) +# place cursor at 0,24,1 (\E-07 ) +# +# set duplex (send) edit keys (\El) when entering vi +# set local (no send) edit keys (\Ek) when exiting vi +# +tvi950-2p|950-2p|televideo950 w/2 pages, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O + \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0 + \Ex3\0\0\Ex4\r\0\E\\2\E-07 , + rmcup=\E\\2\E-07 , smcup=\E\\1\E-07 , + smkx=\El, rmkx=\Ek, use=tvi950, +# Info: +# is2 for 950 with four pages adds the following: +# set 96 line page (\E\\3) +# place cursor at page 0, line 24, column 1 (\E-07 ) +# +# four page 950 adds the following: +# when entering ex, set 24 line page (\E\\1) +# when exiting ex, reset 96 line page (\E\\3) +# place cursor at 0,24,1 (\E-07 ) +# +tvi950-4p|950-4p|televideo950 w/4 pages, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O + \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0 + \Ex3\0\0\Ex4\r\0\E\\3\E-07 , + rmcup=\E\\3\E-07 , smcup=\E\\1\E-07 , + smkx=\El, rmkx=\Ek, use=tvi950, +# Info: +# is2 for reverse video 950 changes the following: +# set reverse video (\Ed) +# +# set flash accordingly (\Ed ...nulls... \Eb) +# +tvi950-rv|950-rv|televideo950 rev video, + tbc=\E3, hts=\E1, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O + \El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0 + \Ex3\0\0\Ex4\r\0, flash=\Ed$<20>\Eb, use=tvi950, +# Info: +# uses the appropriate entries from 950-2p and 950-rv +# +tvi950-rv-2p|950-rv-2p|televideo950 rev video w/2 pages, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O + \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0 + \Ex3\0\0\Ex4\r\0\E\\2\E-07 , + rmcup=\E\\2\E-07 , smcup=\E\\1\E-07 , + smkx=\El, rmkx=\Ek, use=tvi950-rv, +# Info: +# uses the appropriate entries from 950-4p and 950-rv +# +tvi950-rv-4p|950-rv-4p|televideo950 rev video w/4 pages, + is2=\EDF\EC\Eb\EG0\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O + \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0 + \Ex3\0\0\Ex4\r\0\E\\3\E-07 , + rmcup=\E\\3\E-07 , smcup=\E\\1\E-07 , + smkx=\El, rmkx=\Ek, use=tvi950-rv, +# Terminal Configuration Assumptions: +# 1) Edit keys transmit (DUPE on S2 bit 1 down) +# 2) Actually a 925 (not in 912/920 emulation) +# 3) Visual Bell assumes a default of white on black +# 4) Page attributes for special display +# 5) This uses a solid underscore cursor when not in vi. +# Solid Block cursor in vi. +# 6) No function key definitions are given +# 7) Only one page of memory is available +# +tvi925|925|televideo 925, + am, bel=^G, bw, cbt=\EI, clear=^Z, cnorm=\E.4, cols#80, + cr=^M, cub1=^H, cud1=^J, cud1=^V, + cup=\E=%p1%' '%+%c%p2%' '%+%c, cuu1=^K, cvvis=\E.2, + dch1=\EW, dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, + flash=\Eb$<20>\Ed, fsl=\r\Eg, home=^^, hs, + ht=^I, hts=\E1, ich1=\EQ, il1=\EE, ind=^J, + kbs=^H, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, + kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + khome=^^, kich1=\EQ, kdch1=\EW, kil1=\EE, kdl1=\ER, + kclr=^Z, kel=\ET, ked=\EY, + lines#24, rmso=\EG0, rmul=\EG0, smso=\EG4, smul=\EG8, + tbc=\E3, tsl=\Eh\Ef, ul, xmc#1, +# +# +# +tvi914|old televideo, + am, xon, + cols#80, lines#24, xmc#1, + bel=^G, cbt=\EI, clear=^Z, cr=\r, cub1=\b, cud1=^V, + cuf1=\f, cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, + dch1=\EW, dl1=\ER, ed=\EY, el=\ET, home=^^, ich1=\EQ, + il1=\EE, ind=\n, kbs=\b, kcub1=\b, kcud1=^V, kcuf1=\f, + kcuu1=^K, khome=\b, rmso=\EG0, rmul=\EG0, smso=\EG4, + smul=\EG8, +# +# +tvi970|970|televideo 970, + da, db, mir, msgr, ul, xon, + cols#80, lines#24, + bel=^G, bold=\E[1m, cbt=\E[1Z, clear=\E[;H\E[2J, + cnorm=\E[?7h\E[1V, cr=\r, csr=\E[%p1%2.2d;%p2%2.2dr, + cub1=\b, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2.2d;%p2%2.2dH, cuu1=\E[A, + cvvis=\E[?7l\E[1U, dch1=\E[1P, dl1=\E[1M, ed=\E[J, + el=\E[K, flash=\E[?5h\E[?5l, home=\E[1;1H, + hpa=\E[%p1%2.2dG, il1=\E[1L, ind=\n, kbs=\b, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + khome=\E[H, ll=\E[24;1H, rev=\E[7m, rmir=\E[4l, + rmso=\E[0m, rmul=\E[0m, sgr0=\E[m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, vpa=\E[%p1%2.2dd, +# The terminal should be set up with the following configuration +# for televideo 970's: +# under MAIN COMM: comm - cnv; duplx - fdx; send/rcv - no echo; +# parity -no;stop bit - 1; data bits- 8; +# rcv ctrl - xon/off; xmit ctrl - no; +# under EDIT: ins/rpl - rpl; ctrl rep - proc; matopg - single; +# autowrap - wrap; edit bound - pg; editing ext - ln; +# horz edit - rt; vert edit - dwn; autotab - move; +# under STATUS 1: guarded xfer - ungrd; multi-area xfer - all; +# xfer term - part; ln xfer - pg; xfer exec - immed; +# pg xfer - pg; +# +tvi970-ns|970-ns|televideo 970 with no standout, + mir, xon, + cols#80, lines#24, + bel=^G, clear=\E[;H\E[2J, cr=\r, cub1=\b, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%2.2d;%p2%2.2dH, cuu1=\E[A, + dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + hpa=\E[%p1%dG, ht=\t, il1=\E[L, ind=\n, + is2=^O\E[m\E[?3l\E[?5l\E[?7h\E[?8h, kbs=\b, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + rmir=\E[4l, rmso=\E[m, rmul=\E[m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, +tvi970-r|970-r|televideo970 reverse video, + da, db, mir, msgr, ul, xon, + cols#80, lines#24, + bel=^G, bold=\E[1m, cbt=\E[1Z, clear=\E[;H\E[2J, + cnorm=\E[?7h\E[1V, cr=\r, csr=\E[%p1%2.2d;%p2%2.2dr, + cub1=\b, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2.2d;%p2%2.2dH$<5>, cuu1=\E[A, + cvvis=\E[?7l\E[1U, dch1=\E[1P, dl1=\E[1M, ed=\E[J, + el=\E[K, flash=\E[?5l\E[?5h, home=\E[1;1H, + hpa=\E[%p1%2.2dG, il1=\E[1L, ind=\n, kbs=\b, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + khome=\E[H, ll=\E[24;1H, rev=\E[7m, rmir=\E[4l, + rmso=\E[0m, rmul=\E[0m, sgr0=\E[m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, vpa=\E[%p1%2.2dd, +tvi970-rw|970-rw|televideo970 reverse video 132 col, + da, db, mir, msgr, ul, xon, + cols#132, lines#24, + bel=^G, bold=\E[1m, cbt=\E[1Z, clear=\E[;H\E[2J, + cnorm=\E[?7h\E[1V, cr=\r, csr=\E[%p1%2.2d;%p2%2.2dr, + cub1=\b, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2.2d;%p2%2.2dH$<5>, cuu1=\E[A, + cvvis=\E[?7l\E[1U, dch1=\E[1P, dl1=\E[1M, ed=\E[J, + el=\E[K, flash=\E[?5l\E[?5h, home=\E[1;1H, + hpa=\E[%p1%2.2dG, il1=\E[1L, ind=\n, kbs=\b, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + khome=\E[H, ll=\E[24;1H, rev=\E[7m, rmir=\E[4l, + rmso=\E[0m, rmul=\E[0m, sgr0=\E[m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, vpa=\E[%p1%2.2dd, diff --git a/usr/src/lib/terminfo/termcap b/usr/src/lib/terminfo/termcap new file mode 100644 index 0000000..d4bd603 --- /dev/null +++ b/usr/src/lib/terminfo/termcap @@ -0,0 +1,1913 @@ +# Copyright (c) 1984, 1986, 1987, 1988 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +# Copyright (c) 1987, 1988 Microsoft Corporation +# All Rights Reserved + +# This Module contains Proprietary Information of Microsoft +# Corporation and should be treated as Confidential. + +#ident "@(#)terminfo:termcap 1.3" + +sa|arpanet|network:co#80:os:am: +se|ethernet|network:co#80:os:am: +su|dumb|un|unknown:co#80:os:am: +sd|du|dialup:co#80:os:am: +li|ansi|ansi80x25|Ansi standard crt:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:co#80:\ + :dc=\E[P:dl=\E[M:do=\E[B:bt=\E[Z:ei=:ho=\E[H:ic=\E[@:im=:li#25:\ + :nd=\E[C:pt:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:up=\E[A:\ + :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:eo:sf=\E[S:sr=\E[T:\ + :GS=\E[12m:GE=\E[10m:GV=\63:GH=D:\ + :GC=E:GL=\64:GR=C:RT=^J:G1=?:G2=Z:G3=@:G4=Y:GU=A:GD=B:\ + :CW=\E[M:NU=\E[N:RF=\E[O:RC=\E[P:\ + :WL=\E[S:WR=\E[T:CL=\E[U:CR=\E[V:\ + :HM=\E[H:EN=\E[F:PU=\E[I:PD=\E[G: +ansic:CT:tc=ansi: +# ibmcons fixes some problems when using a CGA and a monochrome monitor. +li|ansiega|ibmcons|ansiega80x25|ibmcons80x25|Ansi standard with EGA:\ + :se=\E[21m:us@:ue@:tc=ansi: +li|ansiega-43|ibmcons-43|ansiega80x43|ibmcons80x43|Ansi EGA console in 43 line mode:\ + :li#43:tc=ansiega: +bt|b26:li#29:tc=ansi: +da|dosansi|ANSI.SYS standard crt:\ + :am:bs:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:co#80:\ + :do=\E[B:ho=\E[H:li#25:mi:nd=\E[C:\ + :se=\E[m:so=\E[7m:up=\E[A:\ + :kb=^h:ku=\EH:kd=\EP:kl=\EK:kr=\EM: +### +### ***NOTE***: Taken directly from Intel's termcap +# +# IBM PC in emulation mode for the Intel (IPC) +# vsh functions: +# BACKSPC Deletes character to left of cursor +# DEL Deletes selected characters (same as CTRL-Y in vsh documentation) +# (leaving the DL=^X out of iDIS 1.6 because of problems with vi) +# F1 Page Up F5 Word Left F9 unused +# F2 Page Down F6 Word Right F10 Help +# F3 Page Left F7 Character Left +# F4 Page Right F8 Character Right +ip|ipc|intelpc|Intel IPC:\ + :HP=^AI\r:\ + :PU=^A@\r:PD=^AA\r:PL=^AB\r:PR=^AC\r:\ + :WL=^AD\r:WR=^AE\r:CL=^AF\r:CR=^AG\r:\ + :GS=\E$:GE=\E%:GG#0:G1=G:G2=F:G3=E:G4=H:\ + :GD=N:GH=K:GU=O:GV=J:\ + :M4= \EG4:M5=\EG0 :MB=^U:MC=\EQ:MD=^X:\ + :M8=\E$:M9=\E%:Ma=E:Mb=F:Mc=G:\ + :Md=H:Me=I:Mf=J:Mg=K:Mh=L:Mi=M:Mj=N:Mk=O:\ + :Ml= \EG8:Mm=\EG0 :Mt=^^:Mu=\EI:Mv=?:Mz=^E:\ + :al=1.5*\EE:am:bc=^]:bt=\EI:cd=\EY:ce=2.0*\ET:cl=\E*:\ + :cm=\E=%+ %+ :co#80:dc=^X:dl=1.5*\ER:ei=\Er:ho=^~:im=\Eq:k0=^AI\r:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\ + :k8=^AG\r:k9=^AH\r:kd=^Y:kh=^~:kl=^]:kr=^L:ku=^K:l1=^AJ\r:l2=^AK\r:\ + :l3=^AL\r:l4=^AM\r:l5=^AN\r:l6=^AO\r:li#24:ma=^]h^Yj^Kk^Ll^~H:mi:\ + :nd=^L:se=\EG0:so=\EG4:sg#0:us=\EG8:ue=\EG0:ug#0:ul:up=^K: +f1|free100|liberty freedom 100:\ + :co#80:li#24:am:bs:\ + :cm=\E=%+\040%+\040:\ + :ce=\ET:cd=\EY:cl=\E*:\ + :nd=^L:up=^K:\ + :dl=\ER:al=\EE:dc=\EW:im=:ei=:ic=\EQ:\ + :ti\E.3:te=\E.0:vs=\E.0:ve=\E.0:\ + :so=\EG4:se=\EG0:sg#1:\ + :us=\EG8:ue=\EG0:ug#1:\ + :bl=\EG2:be=\EG0:bg#1:\ + :vb=\Eb^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A\Ed:\ + :kd=^V:ku=^K:kr=^L:kl=^H:ko=dc,ic,dl,al:\ + :k1=^A@^M:k2=^AA^M:k3=^AB^M:k4=^AC^M:\ + :k5=^AD^M:k6=^AE^M:k7=^AF^M:k8=^AG^M: +### Apparently the freedom 110 does NOT have standout glitch. +f2|free110|Freedom 110:\ + :sg#0:tc=free100: +t9|ti931|Texas Instruments 931 VDT:\ + :al=\EN:am:bs:xs:ms:cd=\EJ:ce=\EI:cl=\EL:cm=\EY%+ %+ :co#80:dc=\EQ:\ + :dl=\EO:do=\EB:ho=\EH:ic=\EP:im=:ei=:kd=\EB:kh=\EH:kl=\ED:kr=\EC:\ + :ku=\EA:li#24:nd=\EC:se=\E}\275:sf=\Ea:so=\E{B:sr=\Eb:up=\EA:xt:\ + :us=\E{D:ue=\E}\273:CO=\EM:CF=\ER:k1=\Ei1:k2=\Ei2:k3=\Ei3:k4=\Ei4:\ + :k5=\Ei5:k6=\Ei6:k7=\Ei7:k8=\Ei8:k9=\Ei9:\ + :GS=\016:GE=\017:GG#1:GC=\069:GH=\066:GV=\051:\ + :G1=\072:G2=\052:G3=\055:G4=\075: +### Submitted by Greg Jones of TI +t1|ti924|Texas Instruments 924 VDT 7 bit:\ + :al=\E[L:am:bl=^G:bs:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:\ + :cm=%i\E[%d;%dH:co#80:cr=^M:cs=%i\E[%d;%dr:ct=\E[3g:\ + :dl=\E[M:do=\E[B:ho=\E[H:it#8:kb=\010:\ + :kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:\ + :le=\E[D:li#24:mb=\E[5m:md=\E[1m:me=\E[0m:\ + :mr=\E[7m:nd=\E[C:rc=\E8:\ + :sc=\E7:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:\ + :up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l:vs=\E[?31h:xo:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[16~:\ + :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k0=\E[21~:\ + :Kd=\E[P:Ld=DELC:Ki=\E[@:Li=INSC:Kp=\E[34~:Lp=PRNT:\ + :KC=\E[29~:LC=CMD:KE=\E[1~:\ + :K0=\E[23~:L0=F11:K1=\E[24~:L1=F12:K2=\E[28~:L2=ATTN:\ + :K3=\E[H:L3=HOME:K4=\E[4~:L4=SEND:\ + :G1=\016\153\017:G2=\016\154\017:G3=\016\155\017:G4=\016\152\017:\ + :GV=\016\170\017:GH=\016\161\017: +t2|ti924-8|Texas Instruments 924 VDT 8 bit :\ + :al=\233L:am:bl=^G:bs:cd=\233J:ce=\233K:cl=\2332J\233H:\ + :cm=%i\233%d;%dH:co#80:cr=^M:cs=%i\233%d;%dr:ct=\2333g:\ + :dl=\233M:do=\233B:ho=\233H:it#8:kb=\010:\ + :kd=\233B:kl=\233D:kr=\233C:ku=\233A:\ + :le=\233D:li#24:mb=\2335m:md=\2331m:me=\2330m:\ + :mr=\2337m:nd=\233C:rc=\E8:\ + :sc=\E7:se=\233m:sf=\ED:so=\2337m:sr=\EM:st=\EH:ta=^I:ue=\233m:\ + :up=\233A:us=\2334m:ve=\233?25h:vi=\233?25l:vs=\233?31h:xo:\ + :ho=\233H:kd=\233B:kl=\233D:kr=\233C:ku=\233A:\ + :k1=\217P:k2=\217Q:k3=\217R:k4=\217S:k5=\23316~:\ + :k6=\23317~:k7=\23318~:k8=\23319~:k9=\23320~:k0=\23321~:\ + :Kd=\233P:Ld=DELC:Ki=\233@:Li=INSC:Kp=\23334~:Lp=PRNT:\ + :KC=\23329~:LC=CMD:KE=\2331~:\ + :K0=\23323~:L0=F11:K1=\23324~:L1=F12:K2=\23328~:L2=ATTN:\ + :K3=\233H:L3=HOME:K4=\2334~:L4=SEND:\ + :G1=\016\153\017:G2=\016\154\017:G3=\016\155\017:G4=\016\152\017:\ + :GV=\016\170\017:GH=\016\161\017: +t6|ti926|Texas Instruments 926 VDT:\ + :is=\E\040G\E[33h:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[2J:cm=%i\E[%d;%df:co#80:dc=\E[P:\ + :dl=\E[M:do=\E[B:ic=\E[25h\E[@\E[25l:\ + :kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:ho=\E[H:li#24:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[16~:k6=\E[17~:\ + :k7=\E[18~:k8=\E[19~:nd=\E[C:se=\E[0m:sf=\E[S:so=\E[1m:\ + :sr=\E[T:up=\E[A:GS=\En:GE=\017:\ + :GG#1:GC=8:GH=6:GV=\051:G1=\072:G2=\052:G3=\055:G4=\075:\ + :Ki=\E[@:KI=\E[L:Kd=\E[P:KD=\E[M:Kp=\E[34~:\ + :KC=\E[29~:KE=\E[1~:Kr=\011:Kb=\E[Z:\ + :K0=\E[32~:L0=SKIP:K1=\E[7~:L1=EFLD:\ + :K2=\E[K:L2=EINP:k9=\E[20~:k0=\E[21~:\ + :K3=\E[23~:L3=F11:K4=\E[24~:L4=F12: +S0|sk8620|Seiko 8620:\ + :is=\E[4;5;7l\E[8h:\ + :vs=\E[7l:ve=\E[7h:\ + :al=\E[L:bs:bt=\Et:bw:cd=4*\E[J:ce=3\E[K:cl=4*^Z:cm=5\E[%i%2;%2H:\ + :co#80:dc=4*\E[P:dl=4*\E[M:ei=\E[11l:im=\E[11h:ip=16*:\ + :k0=^AA\r:k1=^AB\r:k2=^AC\r:k3=^AD\r:k4=^AE\r:k5=^AF\r:\ + :k6=^AG\r:k7=^AH\r:k8=^AI\r:k9=^AJ\r:kb=^H:kd=\E[B:kh=^\^:\ + :kl=\E[D:kr=\E[C:ku=\E[A:li#24:nd=2\E[C:pt:se=2\E[m:so=2\E[7m:\ + :sr=5\EM:ue=2\E[m:up=2\E[A:us=2\E[4m: +Al|lisa|apple lisa xenix console display (white on black):\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=^L:cm=\E[%i%d;%dH:co#88:\ + :dc=\E[P:dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:li#32:\ + :nd=\E[C:ms:pt:so=\E[m:se=\E[7m:us=\E[4m:ue=\E[7m:up=\E[A:\ + :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:eo:\ + :is=\E[7m^L:\ + :GS=\E[11m:GE=\E[10m:GV=\140:GH=a:G1=c:G2=f:G3=e:G4=d:GU=u:\ + :GD=s:GC=b:GL=v:GR=t: +# Esprit 6310 terminal entry for tvi925 emulation: the esprit must be +# configured with its internal menus as follows: +# +# on the status line: +# full duplex +# on screen #1 +# EMUL TVI925 +# AUTO WRAP ON +# EOM CR +# AUTO LF OFF +# TAB COLUMN +# on screen #2 +# LEAD IN ESC +# +### if you do not set all of the zillions of options right +### the terminal will exhibit anomalous behaviour +### +e10|esp925|esprit925|esprit tvi925 emulation:if=/usr/share/lib/tabset/stdcrt:\ + :al=\EE:am:bs:bt=\EI:bw:cd=\Ey:ce=\Et:cl=^Z:cm=\E=%+ %+ :\ + :co#80:dc=\EW:dl=\ER:dm=\EB:do=^V:ed=\EC:ei=:ho=^^:ic=\EQ:\ + :im=:is=\EH:k0=^A0\r:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:\ + :k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:kb=^H:kd=^V:\ + :kh=^^:kl=^H:kr=^L:ku=^K:li#24:ma=^R^L^Vj^Kk^Hh^Ll^^H:nd=^L:pt:\ + :se=\EG0:sg#1:so=\EG4:sr=\Ej:tc=e9:ue=\EG0:ug#1:up=^K:us=\EG8:\ + :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\Ed:xn: +# +# Esprit in Hazeltine emulation mode (switched on in the 'is' string). +# This entry is favored because it does not have 'standout glitch' (sg#1) +# which the tvi925 emulation has. +# +e9|espHAZ|esprit|esprit 6310 in hazeltine emulation mode:\ + :is=\E\^0:\ + :al=\E^Z:am:bs:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E^Q%r%.%+ :co#80:\ + :dl=\E^S:do=\E^K:li#24:ma=j^Jk^P^K^Pl :nd=^P:\ + :ku=\E^L:kd=\E^K:kl=^H:kr=^P:\ + :se=\E9@:so=\E9P:up=\E^L: +Am|mac|macintosh|Apple Macintosh with MacTerminal:\ + :AL=\E[%dL:al=\E[L:am:bl=^G:bs:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=\E[%i%d;%dH:co#80:cs=\E[%i%d;%dr:ct=\E[g:DC=\E[%dP:\ + :dc=\E[P:DL=\E[%dM:dl=\E[M:do=\E[B:DO=\E[%dB:ei=:ho=\E[H:\ + :IC=\E[%d@ :ic=\E[@ :im=:is=\E(B\E[2l\E[20l\E[?3l\E[?7h:\ + :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kn#4:kr=\E[C:ku=\E[A:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:LE=\E[%dD:le=\E[D:li#24:\ + :ll=\E[24;1H:ms:nd=\E[C:nw=\EE:pt:rc=\E8:ri=\E[C:RI=\E[%dC:\ + :sc=\E7:se=\E[m:sf=\ED:so=\E[1m:sr=\EM:st=\EH:ue=\E[m:\ + :up=\E[A:UP=\E[%dA:us=\E[4m:xn:xo: +### From MS V 2.2 freeze tape merge (ampex entry merged with ours) +Ma|ampex|d80|dialogue|dialogue80|ampex dialogue 80:\ + :is=\EA:if=/usr/share/lib/tabset/stdcrt:\ + :am:al=3*\EE:bs:bt=\EI:cd=\EY:ce=\ET:cl=\E*:cm=\E=%+ %+ :co#80:dc=\EW:\ + :dl=3*\ER:ei=:ic=\EQ:im=:ma=^R^L^K^P^L\040:ho=\036:\ + :li#24:kl=^H:kr=^L:ku=^K:kd=^J:kh=^^:nd=^L:se=\Ek:so=\Ej:up=^K:\ + :us=\El:ue=\Em:vs=\EA: +nb|nabu|nabu terminal:xn@:tc=vt100n: +Ot|ot80|onyx ot80:\ + :co#80:li#24:am:cl=50\E[H\E[J:bs:cm=5\E[%i%2;%2H:nd=2\E[C:up=2\E[A:\ + :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ + :al=50\E[L:dl=50\E[M:dc=3\E[P:ic=3\E[@:im=:ei=:\ + :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ + :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:xn:sr=5\EM:\ + :ks=\E\075:ke=\E\076: +### Extended capabilities added from MS V 2.2 freeze tape +dv|vt52|dec vt52:\ + :bs:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :co#80:li#24:nd=\EC:\ + :pt:sr=\EI:up=\EA:ku=\EA:kd=\EB:kr=\EC:kl=\ED:\ + :GS=\EF:GE=\EG:GV=x:GH=q:G1=k:G2=l:G3=m:G4=j:GU=v:\ + :GD=w:GC=n:GL=t:GR=u:UK=\EA:DK=\EB:LK=\ED:RK=\EC: +dV|vt52so|dec vt52 with brackets added for standout use:\ + :sg#1:so=[:se=]:EG#1:ES=#:EE=#:tc=vt52: +d0|vt100n|vt100 w/no init:\ + :is@:if@:tc=vt100: +### cs added for Lyrix scrolling improvements +### Extended capabilities added from MS V 2.2 freeze tape +d1|vt100|vt-100|pt100|pt-100|dec vt100:\ + :am:co#80:li#24:cl=50\E[;H\E[2J:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\ + :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ + :is=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ + :if=/usr/share/lib/tabset/vt100:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ + :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:xn:sr=5\EM:\ + :ks=\E\075:ke=\E\076:\ + :GS=\E(0:GE=\E(B:GV=x:GH=q:G1=k:G2=l:G3=m:G4=j:GU=v:\ + :GD=w:GC=n:GL=t:GR=u:\ + :CL=\EOP:CR=\EOQ:WL=\EOR:WR=\EOS:\ + :UK=\E[A:DK=\E[B:LK=\E[D:RK=\E[C:\ + :cs=%i\E[%2;%2r: +# new vt100 entry for use without automargins set (better operation with +# some curses packages) +dn|vt100nam|vt-100|pt100|pt-100|DEC VT100 without automargins:\ + :co#80:li#24:cl=50\E[;H\E[2J:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\ + :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ + :is=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ + :if=/usr/share/lib/tabset/vt100:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ + :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:xn:sr=5\EM:\ + :ks=\E\075:ke=\E\076:\ + :GS=\E(0:GE=\E(B:GV=x:GH=q:G1=k:G2=l:G3=m:G4=j:GU=v:\ + :GD=w:GC=n:GL=t:GR=u:\ + :CL=\EOP:CR=\EOQ:WL=\EOR:WR=\EOS:\ + :UK=\E[A:DK=\E[B:LK=\E[D:RK=\E[C:\ + :cs=%i\E[%2;%2r: +ds|vt100s|vt-100s|pt100s|pt-100s|dec vt100 132 cols 14 lines:\ + :li#14:tc=vt100w: +dt|vt100w|vt-100w|pt100w|pt-100w|dec vt100 132 cols:\ + :co#132:li#24:is=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h:\ + :vs=\E[?3h:tc=vt100: +dz|vt131|vt-131|dec vt131:\ + :ic@:im@:tc=zephyr: +de|vt220|DEC VT220 in vt100 emulation mode:\ + :tc=vt100: +c8|cit80|c.itoh 80:\ + :co#80:li#24:cl=50\E[;H\E[2J:bs:cm=5\E[%i%2;%2H:nd=2\E[C:up=2\E[A:\ + :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ + :is=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8l:\ + :if=/usr/share/lib/tabset/vt100:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ + :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sg#1: +# new cit80 entry for use without automargins set (better operation with +# some curses packages) +c9|cit80nam|C.Itoh 80 without automargins:\ + :am:co#80:li#24:cl=50\E[;H\E[2J:bs:cm=5\E[%i%2;%2H:nd=2\E[C:up=2\E[A:\ + :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ + :is=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8l:\ + :if=/usr/share/lib/tabset/vt100:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ + :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sg#1: +# C. Itoh 467, 414 +# This terminal is essentially identical to the DEC VT100 (ANSI mode). +# It is given a separate entry primarily to identify it uniquely for +# certain graphics software packages. +# The following codes can be added for use with some versions of +# Multiplan(tm): +# :M2= \E[1m:M3=\E[m :M4= \E[7m:M5=\E[m :\ +# :M8=\E[1m\E(0:M9=\E(B\E[0m:MB=^U:MC=^A:MD=^X:\ +# :Ma=m:Mb=l:Mc=k:Md=j:Me=n:Mf=x:Mg=q:Mh=u:Mi=t:Mj=w:Mk=v:\ +# :Ml= \E[4m:Mm=\E[m :Mt=\E[H:Mv=?:Mz=^E: +cg|cie467|cie414|C.Itoh 467, 414 Graphics:\ + :CL=\EOP:CR=\EOQ:WL=\EOR:WR=\EOS:\ + :G1=k:G2=l:G3=m:G4=j:GD=w:GE=\E(B\E[0m:\ + :GH=q:GS=\E[1m\E(0:GU=v:GV=x:\ + :cs=%i\E[%2;%2r:sr=\EM:\ + :ti=\E[?6l:kh@:is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ + :cl=45\E[H\E[J\E[m:cm=%i\E[%2;%2H:se=\E[m:\ + :so=\E[7m:ue=\E[0m:up=\E[A:tc=vt100: +R3|rx303|rexon 303 terminal:\ + :li#24:co#80:am:bs:cl=^Q:cm=^Y%+ %+ :up=^Z:nd=^F:ce=^E:cd=\E^X:\ + :ho=^A:al=^X:dl=^S:\ + :kl=^H:kr=^\\:ku=^K:kd=^J:kh=^\^:\ + :BE=^G:CF=\E6:CO=\E7: +II|TWO|alt2|altosII|Altos Computer Systems II:\ + :al=\E[L:dl=\E[M:co#80:li#24:cl=\E[;H\E[2J:bs:cm=\E[%i%2;%2H:\ + :nd=2\E[C:up=2\E[A:ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:\ + :ue=\E[m:pt:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:kb=^H:\ + :ur:ks=\E=:ke=\E>:k2=^AB\r:k3=^AC\r:\ + :k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:\ + :k8=^AH\r:k9=^AI\r:\ + :GS=\E(0:GE=\E(B:GU=J:GD=K:GV=\072:GH=M:G1=;:G2=I:G3=H:G4=<:\ + :CO=\E[>5l:CF=\E[>5h: +vw|vi55|visual55inADDS|vN|vi55n|Visual 55 using ADDS emulation:\ + :al=\EL:am:bs:cd=\Ek:ce=\EK:cl=\Ev\EY :cm=\EY%+ %+ :co#80:\ + :dl=\EM:eo:li#24:kl=^U:kr=^F:ku=^Z:kd=^J:ks=\E=:ke=\E>:\ + :ma=^Uh^Fl^Zk^E^U^V^F^C^^:nd=\EC:up=\EA:\ + :ho=\EY :so=\EU:se=\ET:ti=\E9@\E0P\ET\E>:ll=^A:CO=^X:CF=^W:\ + :GS=\EF:GE=\EG:GV=a:GH=`:GU=c:GD=d:G1=l:G2=s:G3=e:G4=m:\ + :GC=b:GL=o:GR=n:kh=^A:\ + :k0=\EP:k1=\EQ:k2=\ER:k3=\E :k4=\E\041:k5=\E":\ + :k6=\E#:k7=\E$:k8=\E%:k9=\E&: +vv|vi50|vviewpoint|Visual 50 in ADDS viewpoint emulation:\ + :kh@:tc=vi55: +vW|v55|visual55|Visual 55 emulation of DEC VT52 (called V55):\ + :al=\EL:am:bs:cd=\Ek:ce=\EK:cl=\Ev:cm=\EY%+ %+ :\ + :co#80:dl=\EM:eo:ho=\EH:is=\E0@\E9P\ET\E>:li#24:\ + :kl=\ED:kr=\EC:ku=\EA:kd=\EB:nd=\EC:\ + :se=\ET:so=\EU:up=\EA:\ + :k0=\EP:k1=\EQ:k2=\ER:k3=\E :k4=\E\041:k5=\E":\ + :k6=\E#:k7=\E$:k8=\E%:k9=\E&:\ + :ti=\E0@\E9P\ET\E>:ks=\E=:ke=\E>:\ + :CO=\EX:CF=\Em:\ + :GS=\EF:GE=\EG:GV=a:GH=`:GU=c:GD=d:G1=l:G2=s:G3=e:G4=m:\ + :GC=b:GL=o:GR=n:kh=\EH: +vV|v50|visual50|Visual 50 emulation of DEC VT52:\ + :k0@:k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:k9@:tc=v55: +# +# Some tvi terminals require substantial padding (time delays) and +# some don't. These entries assume that the 912 and 920 are the ones +# that need padding, and the 912b, 912c, 920b, and 920c are the ones +# that don't need padding. +# +# 'is' turns off the status line (\Eg) and turns on the keypad (\El). +# It would seem that the keypad should be turned on/off using :ks=\El:ke=\Ek:, +# but the tab and backspace keys are needed all the time, not just in apps. +# 'al' and 'dl' were only tested at 1200 baud. They might need more padding +# when used at 9600 baud, although this shouldn't be true. +### Extended capabilities from MS V 2.2 freeze tape merge +### Extended capabilities removed due to tset/csh 512 limit +### :EG#1:ES=\EG4:EE=\EG0:GS=\E$:GE=\E%:\ +### :GV=j:GH=k:G1=g:G2=f:G3=e:G4=h:GU=o:GD=n:GC=i:GL=m:GR=l:\ +### :BS=^B:CL=^U:CR=^J:RK=^L:UK=^K:LK=^H:DK=^V:HM=^^:KO=\E>:KF=\E<:\ +### :CO=\E.2:CF=\E.0:MR=\E.1:MP=\E1: +v5|tvi950|950|televideo950:\ + :is=\Eg\El\E\041\062:if=/usr/share/lib/tabset/stdcrt:\ + :al=\EE:am:bs:bt=\EI:cd=\Ey:ce=\Et:cl=\E*:cm=\E=%+ %+ :\ + :co#80:dc=\EW:dl=\ER:do=^V:ei=\Er:ho=^^:im=\Eq:k0=^A0\r:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ + :k7=^AF\r:k8=^AG\r:k9=^AH\r:kb=^H:kd=^V:kh=^^:kl=^H:\ + :ko=ic\054dc\054al\054dl\054cl\054bt\054ce\054cd:kr=^L:\ + :ku=^K:li#24:ma=^Vj^Kk^Hh^Ll^^H:mi:ms:nd=^L:pt:se=\EG0:\ + :sg#1:so=\EG4:sr=\Ej:ue=\EG0:ug#1:up=^K:us=\EG8:\ + :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\Ed:xn: +### Specialized tvi950 entries taken from MS V 2.2 freeze tape merge verbatim +va|tvi950-ap|tvi 950 w/alt pages:\ + :is=\E\\1:ti=\E-06 :te=\E-16 :tc=tvi950: +vf|tvi950-4p|tvi 950 w/4 pages:\ + :ti=\E\\1:te=\E\\3:tc=tvi950: +vl|tvi950b|bare tvi950 no is:\ + :is@:ks=\El:ke=\Ek:tc=tvi950: +vs|tvi950ns|tvi950 w/no standout:\ + :so@:se@:us@:ue@:tc=tvi950: +vt|tvi950-2p|tvi 950 w/2 pages:\ + :ti=\E\\1:te=\E\\2:tc=tvi950: +### added last two lines of extended capabilities from MS +v0|tvi910|910|old televideo 910:\ + :if=/usr/share/lib/tabset/std:\ + :am:bs:bt=\EI:cd=\EY:ce=\ET:ch=\E]%+ :cl=\E+^Z:cm=\E=%+ %+ :co#80:\ + :cv=\E[%+ :do=^J:ho=^^:k0=^A\100^M:k1=^AA^M:k2=^AB^M:k3=^AC^M:\ + :k4=^AD^M:k5=^AE^M:k6=^AF^M:k7=^AG^M:k8=^AH^M:k9=^AI^M:kn#10:kb=^H:\ + :kd=^J:kh=^^:kl=^H:kr=^L:li#24:ms:nd=^L:se=\EG0:sg#1:\ + :so=\EG4:up=^K:ma=j^Jk^P^K^Pl :CO=\E.:CF=\E.:\ + :EG#1:ES=\EG4:EE=\EG0:\ + :BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=^^: +V0|tvi910+|televideo 910 PLUS:\ + :ak=\EG%B0+ FRU:al=33*\EE:\ + :dc=\EW:de=\E):dl=33*\ER:ds=\E(:ei=:ic=\EQ:im=:\ + :BS=^B:CL=^U:CR=^J:DK=^V:CO=\E.2:CF=\E.0:tc=tvi910: +### Last two lines of capabilites in 912 added from MS V 2.2 freeze tape merge +v1|tvi912|912|920|tvi920|old televideo:if=/usr/share/lib/tabset/std:\ + :al=33*\EE:am:bs:ce=\ET:cm=\E=%+ %+ :cl=^Z:co#80:dc=\EW:dl=33*\ER:ei=:\ + :ku=^K:kd=^J:kl=^H:kr=^L:k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:\ + :k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:k8=^AH\r:k9=^AI\r:\ + :ho=^^:im=:ic=\EQ:li#24:nd=^L:pt:se=\Ek:so=\Ej:up=^K:us=\El:ue=\Em:\ + :ma=^K^P^L :sg#1:ug#1:\ + :EG#1:ES=\Ej:EE=\Ek:\ + :BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=^^: +v2|912b|912c|920b|920c|tvi|new televideo:\ + :al=5*\EE:dl=5*\ER:tc=912: +### Merged SCO entry with entry from MS V 2.2 freeze tape +v3|925|925c|tvi925|newer televideo:\ + :if=/usr/share/lib/tabset/stdcrt:\ + :al=5*\EE:bt=\EI:cd=\EY:dl=5*\ER:kd=^V:us=\EG8:ue=\EG0:so=\EG4:se=\EG0:\ + :vb=\Eb\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Ed:\ + :ma=^Vj^Kk^Hh^Ll:sg#1:ug#1:\ + :am:bs:ce=\ET:cm=\E=%+ %+ :co#80:cl=\E+:dc=\EW:do=^V:ei=:\ + :ku=^K:kl=^H:kr=^L:k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:\ + :k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:k8=^AH\r:k9=^AI\r:\ + :kb=^H:kh=^^:im=:ic=\EQ:li#24:nd=^L:pt:up=^K:\ + :ES=\EG4:EE=\EG0:BS=^B:CL=^U:CR=^J:DK=^V:KO=\E>:KF=\E<:\ + :CO=\E.2:CF=\E.0:MR=\E.1:MP=\E1:EG#1:RK=^L:UK=^K:LK=^H:HM=^^: +# The 925so entry should be used with the terminal in black on green video mode. +# (This is set via switches in back: in S2(Function), pin #6 should be down.) +# Also, contrast needs to be set sufficiently high so that half-intensity can +# be clearly distinguished from full-intensity. Then, different intensity can +# be used for standout mode, thus avoiding problems with attribute bytes. +### Submitted by Jim Griffen, specifically for use with SCO Pro. +v4|925so|tvi925so|newer televideo with attribute byte workaround:\ + :if=/usr/share/lib/tabset/std:\ + :al=5*\EE:dl=5*\ER:kd=^V:us=\EG8:ue=\EG0:so=\E(:se=\E):\ + :ma=^Vj^K^P^L :ti=\E):te=\E(:sg#0:ug#1:CO=\E.2:CF=\E.0:\ + :am:bs:ce=\ET:cm=\E=%+ %+ :cl=^Z:co#80:dc=\EW:ei=:\ + :ku=^K:kl=^H:kr=^L:k0=^A@\r:k1=^Aa\r:k2=^Ab\r:k3=^Ac\r:\ + :k4=^Ad\r:k5=^Ae\r:k6=^Af\r:k7=^Ag\rk8=^Ah\r:k9=^Ai\r:\ + :ho=^^:im=:ic=\EQ:li#24:nd=^L:pt:up=^K: +### Untested. Submitted by a customer (Andy Sibre at Aquinas: +### ihnp4!seismo!men1!aquin!andys). Any 'is' string hangs Multiplan. +TV|tvi9220|televideo 9220|Televideo 9220 w/status line @ bottom:\ + :ae=^O:al=\E[L:am:as=^N:bl=^G:bs:cd=\E[J:ce=\E[K:ch=\E[%i%dG:\ + :cl=\E[H\E[J:cm=\E[%i%d;%dH:co#80:cr=^M:cs=\E[%i%d;%dr:\ + :cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=\ED:ds=\E7\E[25;1H\E[K\E8:\ + :ei=\E[4l:es:fs=\E8:ho=\E[H:im=\E[4h:k1=\EOP:k2=\EOQ:k3=\EOR:\ + :k4=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ + :ku=\EOA:le=^H:li#24:md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:mi:ms:\ + :nd=\E[C:nl=^J:pt:rc=\E8:rs=\E>\E[?7h\E[?5W\E[?3l:sc=\E7:\ + :se=\E[0m:so=\E[7m:sr=\EM:ta=^I:ts=\E7\E[25;%i%dH\E[2K:ue=\E[m:\ + :up=\EM:us=\E[4m:vt#3:xn: +TW|tvi9220w|televideo 9220w|Televideo 9220 132 col w/status line @ bottom:\ + :co#132:rs=\E>\E[?7h\E[?5W\E[?3h:tc=tv9220: +### Put SCO h1500, h1510, h1520 back in (pre-MS merge state) +H5|h1500|hazeltine 1500:\ + :al=~^Z:am:bs:cd=~^X:ce=~^O:cl=~^\:cm=~^Q%r%.%.:co#80:\ + :dl=~^S:do=~^K:hz:li#24:nd=^P:.se=~^_:.so=~^Y:up=~^L: +# h1510 uses real escapes (\033), not tildes (\176). +H6|h1510|hazeltine 1510:\ + :al=\E^Z:am:bs:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E^Q%r%.%+ :co#80:\ + :dl=\E^S:do=\E^K:hz:li#24:ma=j^Jk^P^K^Pl :nd=^P:\ + :ku=\E^L:kd=\E^K:kl=^H:kr=^P:\ + :k0=^R:t0=^P:l0=CTRL R:\ + :se=\E^Y:so=\E^_:up=\E^L: +H8|h1520|hazeltine 1520:\ + :tc=h1510: +cc|cci|cci 4574:\ + :am:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :co#80:li#24:nd=\EC:\ + :pt:sr=\EI:up=\EA:ku=\EA:kd=\EB:kr=\EC:kl=\ED:kh=\EH:\ + :so=\EMd:se=\EM : +wb|wy30|wyse30|Wyse WY-30 in wy30 mode:\ + :is=\E\176"\E\176 \EX\E"\EDF\EC\E`7:\ + :ta=5^I:pt:\ + :GG#0:G1=\EH3:G2=\EH2:G3=\EH1:G4=\EH5:GC=\EH8:GD=\EH0:GH=\EH\072:\ + :GU=\EH\075:GV=\EH6:GR=\EH4:GL=\EH9:\ + :al=\EE:am:bs:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ + :cm=\Ea%i%dR%dC:co#80:dc=\EW:dl=\ER:ei=\Er:im=\Eq:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\ + :k8=^AG\r:kd=^J:kh=\E{:kl=^H:kr=^L:ku=^K:\ + :li#24:mi:nd=^L:se=\E(:so=\E):sg#0:ug#1:ue=\EG0:ul:up=^K:us=\EG8: +w1|wy50|wyse50|Wyse WY-50 in wy50 mode:\ + :is=\El\E"\E`\072:if=/usr/share/lib/tabset/std:\ + :cd=\EY:ce=\ET:cl=\E+:\ + :up=^K:do=^J:nd=^L:bc=^H:cm=\E=%+ %+ :ho=^^:\ + :al=\EE:dl=\ER:ic=\EQ:dc=\EW:im=:ei=:\ + :co#80:li#24:sg#1:ug#1:am:bs:mi:pt:ta=5^I:sr=\Ej:\ + :so=\EG4:se=\EG0:us=\EG8:ue=\EG0:\ + :is=\Eu\E0:\ + :ku=^K:kd=^J:kr=^L:kl=^H:kh=^^:kb=^H:cr=^M:\ + :NS=\EK:PS=\EJ:\ + :GS=\EH^B:GE=\EH^C\ + :GV=\EH6:GH=\EH\072:GU=\EH=:GD=\EH0:G1=\EH3:G2=\EH2:G3=\EH1:G4=\EH5:\ + :k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:\ + :k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:\ + :k8=^AH\r:k9=^AI\r:kA=^AJ\r:kB=^AK\r:\ + :kC=^AL\r:kD=^AM\r:kE=^AN\r:kF=^AO\r:\ + :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ + :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ + :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ + :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: +w2|wy50vb|Wyse WY-50/80vb Wyse WY-50/80 with visible bell:\ + :vb=\EA04\200\200\200\200\200\200\200\200\200\200\200\EA00:\ + :tc=wy50: +w3|wy50w|Wyse WY-50/132 Wyse WY-50 with 132 column screen:\ + :is=\EG0\EC\EX\E`1\E`\073\Er:\ + :vs=\E`\073:co#132:tc=wy50: +w7|wy60|wyse60|Wyse WY-60 with 80 column/24 line screen in wy60 mode:\ + :is=\E`\072\Ee(\EO\Ee6\Ec41\E~4\Ec21\Ed/:\ + :if=/usr/share/lib/tabset/std:pt:\ + :G1=\EH3:G2=\EH2:G3=\EH1:G4=\EH5:GD=\EH0:GG#0:GH=\EH\072:\ + :GU=\EH=:GV=\EH6:GR=\EH4:GL=\EH9:GC=\EH8:GF=\EH7:\ + :PU=\EJ:PD=\EK:\ + :al=\EE:am:bs:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ + :cm=\Ea%i%dR%dC:co#80:dc=\EW:dl=\ER:ei=\Er:im=\Eq:k0=^AI\r:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\ + :k8=^AG\r:k9=^AH\r:kd=^J:kh=^~:kl=^H:kr=^L:ku=^K:\ + :li#24:mi:nd=^L:se=\EG0:so=\EG4:sg#0:ug#0:ue=\EG0:ul:up=^K:us=\EG8: +w8|wy60w|wyse60w|Wyse WY-60 with 132 column/42 line screen in wy60 mode:\ + :is=\E`\073\Ee*\EO\Ee6\Ec41\E~4\Ec21:\ + :if=/usr/share/lib/tabset/std:pt:\ + :G1=\EH3:G2=\EH2:G3=\EH1:G4=\EH5:GD=\EH0:GG#0:GH=\EH\072:\ + :GU=\EH=:GV=\EH6:GR=\EH4:GL=\EH9:GC=\EH8:GF=\EH7:\ + :PU=\EJ:PD=\EK:\ + :al=\EE:am:bs:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ + :cm=\Ea%i%dR%dC:co#132:dc=\EW:dl=\ER:ei=\Er:im=\Eq:k0=^AI\r:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\ + :k8=^AG\r:k9=^AH\r:kd=^J:kh=^~:kl=^H:kr=^L:ku=^K:\ + :li#42:mi:nd=^L:se=\EG0:so=\EG4:sg#0:ug#0:ue=\EG0:ul:up=^K:us=\EG8: +w4|wy75|Wyse WY-75 with 80 column line:\ + :is=\E[1;24r\E[?10;3;1l\E[4l\E[?25h\E[m\E(B\E>:\ + :ae=\E(B:as=\E(0:al=\E[L:bs:\ + :bt=\E[Z:cd=50\E[J:ce=3\E[K:cl=50\E[H\E[J:\ + :cm=5\E[%i%d;%dH:co#80:\ + :cs=9\E[%i%d;%dr:dc=\E[P:dl=\E[M:\ + :do=\E[B:ei=\E[4l:eo:ho=10\E[H:im=\E[4h:\ + :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ + :k0=\EOP:k1=\EOQ:k2=\EOR:k3=\EOS:k4=\E[M:\ + :k5=\E[17~:k6=\E[31~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ + :li#24:ll=\E[24;1H:nd=\E[C:pt:se=\E[m:\ + :sg#0:so=\E[7m:ta=\E[I:\ + :ue=\E[p:ug#1:ul:up=\E[A:us=\E[8p: +w5|wy75ap|Wyse WY-75 with Applications and Cursor keypad modes:\ + :is=\E[1;24r\E[?10;3l\E[?1;25h\E[4l\E[m\E(B\E=:\ + :kd=\EOB:ke=10\E[?1l\E>:kh=\EOH:kl=\EOD:kr=\EOC:\ + :ks=10\E[?1h\E=:ku=\EOA:\ + :tc=wy75: +w6|wy75x|Wyse WY-75 with 132 column lines in vi editor mode:\ + :is=\E[1;24r\E[?10;3;1l\E[?25h\E[4l\E[m\E(B\E>:\ + :co#132:vs=100\E[?3h:ve=400\E[?3l:\ + :tc=wy75: +we|wy75w|Wyse WY-75 in 132 column mode:\ + :is=\E[1;24r\E[?10;1l100\E[?3h\E[?25h\E[4l\E[m\E(B\E>:\ + :vs=100\E[?3h:co#132:tc=wy75: +wc|wy85|wyse85|Wyse 85 in 80 column mode, vt100 emulation:\ + :is=\E[61"p\E[13l\E>\E[?1l\E[?3l\E[?7h\E[?16l\E[?5W:\ + :co#80:li#24:am:cl=\E[;H\E[2J:bs:cm=\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\ + :ce=\E[0K:cd=\E[0J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ + :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\ + :kh=\E[H:xn:ks=\E\075:ke=\E\076:\ + :im=:CO=\E[?25h:CF=\E[?25l:ic=\E[1@:dc=\E[1P:\ + :dl=\E[1M:al=\E[1L:GS=\EF:GE=\EG:pt: +wd|wy85w|wyse85w|Wyse 85 in 132 column mode, vt100 emulation:\ + :is=\E[61"p\E[13l\E>\E[?1l\E[?3h\E[?7h\E[?16l\E[?5W:\ + :co#132:tc=wy85: +### Last line of wy100 capabilities taken from MS V 2.2 freeze tape +### The graphics definitions in MS entry more closely matched other wyse +### terminals, so I put those in instead of the original entries. +### The original entries were: +### :GV=\EH\026:GH=\EH\032:GU=\EH\035:GD=\EH\020:\ +### :G1=\EH\023:G2=\EH\022:G3=\EH\021:G4=\EH\025:\ +WY|wy100|wyse|wyse 100:\ + :am:bs:cl=\E*:cm=\E=%+ %+ :\ + :al=\EE:ho=^^:ic=\EQ:im=:ei=:dl=\ER:dc=\EW:\ + :cd=\Ey:ce=\Et:dc=\Ey:so=\EG4:se=\EG0:sg#1:li#24:co#80:nd=^L:up=^K:\ + :ku=^K:kd=^J:kl=^H:kr=^L:\ + :GV=\EH6:GH=\EHZ:GU=\EH=:GD=\EH0:G1=\EH3:G2=\EH2:G3=\EH1:G4=\EH5:\ + :MP=^^\E+:BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=\036: +WC|wy350|wyse350|Wyse 350 80 column color terminal emulating wy50:\ + :tc=wy50: +WW|wy350w|wyse350w|Wyse 350 132 column color terminal emulating wy50:\ + :tc=wy50w: +### Supplied by Tandy via jeana. Also tested at SCO. One conflict found: +### BC is used by Scripsit (Tandy WP) to turn on an underline cursor (rqd) +### and BC is mistakenly used by FoxBASE for backspace (should use bc). +### BC left as Tandy defined it, must be changed to ^h (bc) for use with Fox. +td|dt100|dt-100|Tandy DT-100 terminal:\ + :BC=\E[34l:BF=\E[33h:BN=\E[33l:CF=\E[?25l:CN=\E[?25h:G1=k:G2=l:G3=m:\ + :G4=j:GC=n:GD=w:GE=\E(B:GH=q:GL=u:GR=t:GS=\E(0:GU=v:GV=x:GZ=~:HM=^[[H:\ + :NU=^[[23~:P0=\EOP:P1=\EOQ:P2=^D:P3=^U:P4=\E\E:P5=^R:P6=^P:P7=^N:\ + :P8=\E^I:P9=^I:PA=^O:PB=^F:PC=^L:PD=^[[29~:PE=^T:PL=^[[25~:PM#1:\ + :PN=\E[5i:PR=^[[26~:PS=\E[4i:PU=^[[28~:Pd=^E:U0=^A:U1=^B:UC=\E[34h:\ + :ae=^O:al=\E[L:as=^N:bs:cd=\E[J:ce=\E[K:cl=\E[;H\E[2J:cm=^H\E[%i%d;%dH:\ + :co#80:cs=\E[%2;%2r:dc=\E[P:dl=\E[M:do=\E[B:ho=\E[H:ic=\E[@:\ + :is=\E[?3l\E)0\E(B:k0=\E[?5i:k1=\E[?3i:k2=\E[2i:k3=\E[@:k4=\E[M:\ + :k5=\E[17~:k6=\E[18~:k7=\E[19~:k8=\E[20~:k9=\E[21~:kd=\E[B:\ + :kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:l1=f1:l2=f2:l3=f3:l4=f4:l5=f5:\ + :l6=f6:l7=f7:l8=f8:li#24:nd=\E[C:pt:re=\E[p:ru=\E[24p:se=\E[m:\ + :so=\E[7m:sr=\EM:ue=\E[m:ug#1:up=\E[A:us=\E[4m:CO=\E[?25h: +aa|regent25a|25a|adds regent 25a:\ + :am:bs:cl=^L:cm=\EY%+ %+ :co#80:li#24:nd=\EC:up=\EA:\ + :ku=\EA:kd=\EB:kr=\EC:kl=\ED:kh=\EH: +Ca|cdc456|cdc:\ + :li#24:co#80:cl=^Y^X:nd=^L:up=^Z:bs:\ + :cm=\E1%+ %+ :ho=^Y:al=\E\114:dl=\E\112:ce=^V:cd=^X:am: +Cc|cdc456tst:\ + :li#24:co#80:cl=^y^x:bs:cm=\E1%+ %+ :am: +pt|pt1500|gt|t0|Convergent Technologies PT:\ + :ae=\17:al=\E[1L:am:as=\16:bs:\ + :cd=\E[0J:ce=\E[0K:cl=\E[2J\E[1;1H:cm=\E[%i%2;%2H:co#80:\ + :dc=\E[1P:dl=\E[1M:do=\E[1B:ei=:ho=\E[1;1H:\ + :ic=\E[1@:im=:kb=\10:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:li#26:\ + :k0=\EOY:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:\ + :nd=\E[C:se=\E[m:sf=\E[1S:sr=\E[1T:so=\E[7m:ue=\E[m:up=\E[A:us=\E[4m: +D0|dm1520|1520|datamedia 1520:\ + :am:bs:cd=^K:ce=^]:cl=^L:cm=^^%r%+ %.:co#80:ho=^Y:\ + :ku=^_:kd=^J:kl=^H:kr=^\:kh=^Y:\ + :li#24:nd=^\:up=^_:xn:ma=^\ ^_^P^YH:pt: +D1|dm1521|1521|datamedia 1521:\ + :am:bs:cd=^K:ce=^]:cl=^L:cm=^^%r%+ %.:co#80:ho=^Y:\ + :ku=^_:kd=^J:kl=^H:kr=^\:kh=^Y:\ + :li#24:nd=^\:up=^_:xn:ma=^\ ^_^P^YH:pt: +D2|dm2500|datamedia2500|2500|datamedia 2500:\ + :al=15^P\n^X^]^X^]:bs:ce=^W:cl=^^^^\177:cm=^L%r%n%.%.:co#80:\ + :dc=10*\b:dl=10*^P^Z^X^]:dm=^P:ed=^X^]:ei=10\377\377^X^]:ho=^B:ic10*^\:\ + :im=^P:li#24:nc:nd=^\:pc=\377:so=^N:se=^X^]:up=^Z: +D3|dm3025|datamedia 3025a:is=\EQ\EU\EV:\ + :al=130\EP\n\EQ:bs:cd=2\EJ:ce=\EK:cl=2\EM:cm=\EY%r%+ %+ :\ + :co#80:dc=6\b:dl=130\EP\EA\EQ:dm=\EP:ed=\EQ:ei=\EQ:ho=\EH:\ + :im=\EP:ip=6:li#24:nd=\EC:pt:so=\EOA:se=\EO@:up=\EA: +D4|3045|dm3045|datamedia 3045a:is=\EU\EV:\ + :am:bs:cd=2\EJ:ce=\EK:cl=2\EM:cm=\EY%r%+ %+ :co#80:\ + :dc=6\EB:dm=:ed=:ei=\EP:ho=\EH:ic=:im=\EP:ip=6:\ + :k0=\Ey\r:k1=\Ep\r:k2=\Eq\r:k3=\Er\r:k4=\Es\r:\ + :k5=\Et\r:k6=\Eu\r:k7=\Ev\r:k8=\Ew\r:k9=\Ex\r:\ + :kh=\EH:ku=\EA:kr=\EC:li#24:nd=\EC:pc=\177:pt:eo:ul:up=\EA:xn: +D5|dt80|dmdt80|dm80|datamedia dt80/1:\ + :is=\E<\E[2J\E[H\E[?1;3;5;6;9l\E[?7;8h:\ + :am:bs:cd=\E[J:co#80:li#24:ce=\E[K:cl=\E[2J\E[H:\ + :cm=%i\E[%d;%dH:ho=\E[H:nd=\E[C:\ + :so=\E[7m:se=\E[m:\ + :up=\E[A:us=\E[4m:ue=\E[m:\ + :vb=\E[?5h\E[?5l:\ + :vs=\E[1;2;3;4q\E[?4l:ve=\E[0q\E[?4h:\ + :kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:\ + :sr=\EM:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :ks=\E=:ke=\E>: +D6|dt80132|dmdt80132|datamedia dt80/1 in 132 char mode:\ + :bs:cd=20^[[0J:co#132:ce=20^[[0K:kd=^[[B:kl=^[[D:kr=^[[C:ku=^[[A:\ + :li#24:cm=5^[[%i%d;%dH:cl=50^[[H^[[2J:nd=^[[C:up=5^[[A: +ED|delta|dd5000|delta data 5000:\ + :am:bs:cl=^NR:cm=^O%\104%+9%\104%+9:co#80:li#27:ho=^NQ:nc:nd=^Y:\ + :up=^Z:ce=^NU:dc=^NV:ma=^K^J^Z^P^Y :xr: +It|intext|ISC modified owl 1200:\ + :al=5.5*\020:am:bc=\037:bs:cd=5.5*\026J:cl=132\014:\ + :cm=\017%+ %+ :co#80:dc=5.5*\022:dl=5.5*\021:\ + :ei=\026\074:im=\026\073:ip=5.5*:in:li#24:nd=\036:up=\034:\ + :ma=^K^P^R^L^L :kl=^H:kd=^J:kr=^L:ku=^K: +m2|3163|ibm3163:\ + :co#80:li#24:al=\EX\067\040\EO\E\040Z\EN:am:cl=\EK:bs:\ + :im=:ei=:cm=\EY%+\40%+\40:nd=\EC:up=\EA:ho=\EH:\ + :do=\EB:ce=\EI:cd=\EJ:dl=\EO:in:ic=\EP:dc=\EQ:\ + :sf=\E\040M:sr=\E\041M:so=\E4\101:se=\E4\100:us=\E4\102:ue=\E4\100:\ + :kl=\ED:kr=\EC:kd=\EB:ku=\EA:kh=\EH:GU=A:GD=B:GL=D:GR=C:\ + :GS=\E^S^L%+@:co#80:li#40:bs:cl=2^L:up=^N:nd=^_:ho=^K:am:\ + :kb=^^:kd=^J:ku=^N:kl=^H:kr=^_:kh=^K:ma=^_ ^N^P: +### From MS V 2.2 freeze tape merge (aaa entries merged with ours) +# Function keys not yet defined. 60 line mode not defined since it needs a +# significant amount of 'nl' delay (and then can't be used for vi). +# The cl delay is sufficent, but a smaller one could do. +Mb|aaa|ambas|ambassador|ann arbor ambassador/48 lines:\ + :if=/usr/share/lib/tabset/ambas:\ + :is=\E[48;0;0;48p\E[H\E[J\E[>30h\E[1Q\E[m:\ + :al=\E[L:am:bs:\ + :cd=\E[J:ce=\E[K:cl=400\E[H\E[J:cm=\E[%i%d;%dH:co#80:\ + :da:db:dc=\E[P:dl=\E[M:ei=\E[4l:ho=\E[H:im=\E[4h:\ + :ic=\E[@:li#48:mi:kb=^h:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\EH:\ + :nd=\E[C:nl=\ED:pt:sf=\E[S\ED:sr=\E[T:se=\E[m:so=\E[7m:up=\E[A: +G3|aaa30|ann arbor ambassador 30/destructive backspace:\ + :ti=\E[30;;;30p\E[H\E[J\E[>30h\E[1Q\E[m:bs@:\ + :li#30:te=\E[60;;;p\E[60;1H\ED:\ + :vs=\E[>30l:ve=\E[>30h:tc=aaa: +G6|aaa48db|ann arbor ambassador 48/destructive backspace:\ + :ti=\E[48;;;48p\E[H\E[J\E[>30h\E[1Q\E[m:bs@:\ + :li#48:te=\E[60;;;30p\E[60;1H\ED:\ + :vs=\E[>30l:ve=\E[>30h:tc=aaa: +MB|aaadb|aaagl|ann arbor ambassador 48/destructive backspace:\ + :is=\E[48;0;0;48p\E[H\E[J\E[>30h\E[1Q\E[m:bs@:\ + :if=/usr/share/lib/tabset/ambas:\ + :vs=\E[>30l:ve=\E[>30h:tc=aaa: +Md|datapoint|dp3|dp3360|datapoint 3360:\ + :am:bs:cd^_:ce=^^:cl=^]^_:co#82:ho=^]:li#25:nd=^x:up=^z: +Mz|zen30|z30|zentec 30:\ + :mi:co#80:li#24:ma=^L ^R^L^K^P:ul:\ + :al=1.5*\EE:bs:ce=1.0*\ET:cm=\E=%+ %+ :cl=\E*:\ + :ho=^^:nd=^L:se=\EG0:so=\EG4:sg#1:up=^K:im=\Eq:ei=\Er:\ + :am:dc=\EW:dl=1.5*\ER:cd=\EY: +zz|zephyr|z220|zentec zephyr220 in vt100 mode:\ + :if=/usr/share/lib/tabset/vt100:\ + :am:al=\E[L:bs:cd=50\E[J:ce=3\E[K:cl=50\E[;H\E[2J:\ + :cm=10\E[%i%d;%dH:co#80:dc=\E[P:dl=\E[M:do=\E[B:\ + :ei=:ho=\E[H:ic=\E[@:im=:k1=\EOP:k2=\EOQ:k3=\EOR:\ + :k4=\EOS:kb=^H:kd=\E[B:ke=\E>:kl=\E[D:kr=\E[C:\ + :ks=\E=:ku=\E[A:li#24:nd=\E[C:pt:se=\E[m:so=\E[7m:\ + :sr=\EM:ue=\E[m:up=\E[A:us=\E[4m:xn: +# new zephyr entry for use without automargins set (better operation with +# some curses packages) +zn|zephyrnam|z220|zentec zephyr220 in vt100 mode without automargins:\ + :if=/usr/share/lib/tabset/vt100:\ + :al=\E[L:bs:cd=50\E[J:ce=3\E[K:cl=50\E[;H\E[2J:\ + :cm=10\E[%i%d;%dH:co#80:dc=\E[P:dl=\E[M:do=\E[B:\ + :ei=:ho=\E[H:ic=\E[@:im=:k1=\EOP:k2=\EOQ:k3=\EOR:\ + :k4=\EOS:kb=^H:kd=\E[B:ke=\E>:kl=\E[D:kr=\E[C:\ + :ks=\E=:ku=\E[A:li#24:nd=\E[C:pt:se=\E[m:so=\E[7m:\ + :sr=\EM:ue=\E[m:up=\E[A:us=\E[4m:xn: +### From MS V 2.2 freeze tape merge +### Our vi200 entry was replaced with theirs, since it was more complete, +### although the ke/ks entries were added back in for "backward compatibility". +# The Visual 200 beeps when you type a character in insert mode. +# This can be a distracting feature, and some of the entries below try to +# avoid this behavior by ignoring the feature or turning it off when +# inserting a character. They may not work well at 300 baud. +V2|vi200|visual 200 with function keys:\ + :al=\EL:am:bs:cd=\Ey:ce=4*\Ex:cl=\Ev:\ + :cm=\EY%+ %+ :co#80:dc=4*\EO:dl=4*\EM:ho=\EH:\ + :im=:ei=:ic=\Ei \b\Ej:\ + :is=\E3\Eb\Ej\E\\\El\EG\Ed\Ek:\ + :k0=\EP:k1=\EQ:k2=\ER:k3=\E :k4=\E\041:k5=\E":k6=\E#:\ + :k7=\E$:k8=\E%:k9=\E&:kl=\ED:kr=\EC:ku=\EA:kd=\EB:kh=\EH:\ + :li#24:nd=\EC:pt:sr=\EI:up=\EA:vs=\Ed:ve=\Ec:ks=\E=:ke=\E>: +VR|vi200rvic|visual 200 reverse video using insert char:\ + :ei=\Ej:im=\Ei:ic@:tc=vi200rv: +# The older Visuals didn't come with function keys. This entry uses +# ks and ke so that the keypad keys can be used as function keys. +# If your version of vi doesn't support function keys you may want +# to use V2. +Vf|vi200f|visual|visual 200 no function keys:\ + :al=\EL:am:bs:cd=\Ey:ce=4*\Ex:cl=\Ev:\ + :cm=\EY%+ %+ :co#80:dc=4*\EO:dl=4*\EM:ho=\EH:\ + :im=:ei=:ic=\Ei \b\Ej:\ + :is=\E3\Eb\Ej\E\\\El\EG\Ed\Ek:ks=\E=:ke=\E>:\ + :k0=\E?p:k1=\E?q:k2=\E?r:k3=\E?s:k4=\E?t:k5=\E?u:k6=\E?v:\ + :k7=\E?w:k8=\E?x:k9=\E?y:kl=\ED:kr=\EC:ku=\EA:kd=\EB:kh=\EH:\ + :li#24:nd=\EC:pt:sr=\EI:up=\EA:vs=\Ed:ve=\Ec: +Vr|vi200rv|visual 200 reverse video:\ + :so=\E4:se=\E3:sr@:vs@:ve@:tc=vi200: +Vt|vi200ic|visual 200 using insert char:\ + :ei=\Ej:im=\Ei:ic@:tc=vi200: +X1|tek|tek4012|4012|tektronix 4012:\ + :as=\E^N:ae=\E^O:is=\E^O:bs:cl=1000\E^L:co#75:ns:li#35:os: +X2|tek4014|4014|tektronix 4014:\ + :is=\E^O\E9:co#81:li#38:dF#1000:tc=tek4012: +X3|tek4014sm|4014sm|tektronix 4014 in small font:\ + :is=\E^O\E\072:co#121:li#58:tc=tek4014: +X4|tek4023|4023|tektronix 4023:\ + :so=^_P:se=^_@:cm=\034%r%+ %+ :nd=\t:bs:cl=4\E^L:co#80:li#24:am:\ + :up=1000UP:nd=1000ND: +# Cursor motion (cm) and home (ho) aren't set because they're memory +# relative, and only work in the workspace, not the monitor. +# Standout (so) also only works in the workspace. +X5|4025|4027|4024|tek4025|tek4027|tek4024|4025cu|4027cu|tektronix 4024/4025/4027:\ + :is=\41com 31\r\n^_sto 9,17,25,33,41,49,57,65,73\r:\ + :ks=^_lea p4 /h/\r^_lea p8 /k/\r^_lea p6 / /\r^_lea p2 /j/\r^_lea f5 /H/\r:\ + :ke=^_lea p2\r^_lea p4\r^_lea p6\r^_lea p8\r^_lea f5\r:\ + :am:bs:da:db:pt:li#34:co#80:cl=^_era\r\n\n:up=^K:nd=^_rig\r:\ + :al=145^_up\r^_ili\r:dl=^_dli\r:\ + :dc=^_dch\r:im=^_ich\r:ei=^F\n^K:nl=^F\n:\ + :ce=^_dch 80\r:cd=^_dli 50\r:CC=^_: +X7|4025-17|4027-17|tek 4025 17 line window:li#17:tc=4025: +X8|4025-17ws|4027-17ws|tek 4025 17 line window in workspace:\ + :is=\41com 31\r\n^_sto 9,17,25,33,41,49,57,65,73\r^_wor 17\r^_mon 17\r:\ + :ti=^_wor h\r:te=^_mon h\r:so=^_att e\r:se=^_att s\r:tc=4025-17: +Xe|4025ex|4027ex|tek 4025 w/!:ti=\41com 31\r:te=^_com 33\r:\ + :is=^_com 33\r\n\41sto 9,17,25,33,41,49,57,65,73\r:tc=4025: +# regent: lowest common denominator, works on all Regents. +a0|regent|adds regent series:\ + :am:bs:cl=^L:cm=^K%+ ^P%\102%.:co#80:ho=^A:li#24:nd=^F:up=^Z: +# Regent 100 behaves unpredictably if the computer sends escape when user +# is holding down shift key, so escape has been avoided. +### From MS V 2.2 freeze tape merge (so/se added) +a1|regent100|adds regent 100:\ + :cm=^K%+ ^P%\102%.:k1=^B1\r:k2=^B2\r:k3=^B3\r:k4=^B4\r:\ + :k5=^B5\r:k6=^B6\r:k7=^B7\r:k8=^B8\r:\ + :kh=^A:kl=^U:kr=^F:ku=^Z:kd=^J:so=\E0P:se=\E0@:tc=regent: +a3|regent25|adds regent 25:\ + :k0=^B0\r:k1=^B1\r:k2=^B2\r:k3=^B3\r:k4=^B4\r:\ + :k5=^B5\r:k6=^B6\r:k7=^B7\r:k8=^B8\r:k9=^B9\r:\ + :kh=^A:kl=^U:kr=^F:ku=^Z:kd=^J:tc=regent20: +### Received via jeana. Untested at SCO. +# Supplied by Tandy Corp. +al|adds25lp|dt1|adds regent 25 with local printing:\ + :CF=\E.:CN=\E.:DK=^B2^M:HM=^B7^M^B7^M:LK=^B4^M:NU=^B9^M:P0=^B7^J:\ + :P1=^B9^J:P2=^D:P3=^U:P4=\E\E:P5=^R:P6=^P:P7=^N:P8=\E^I:P9=^I:PA=^O:\ + :PB=^F:PC=^L:PD=^B7^M^B2^M:PE=^T:PF=^B0^J:PG=^B8^J:PH=^B2^J:PI=^B4^J:\ + :PJ=^B6^J:PK=^B5^J:PL=^B7^M^B4^M:PN=\E3:PR=^B7^M^B6^M:PS=^T:CO=\E.:\ + :PU=^B7^M^B8^M:Pd=^E:RK=^B6^M:U0=^A:U1=^B:UK=^B8^M:am:bs:cd=\Ek:ce=\EK:\ + :cl=^L:cm=\EY%+ %+ :co#80:do=^J:ho=\EY :kd=^J:kh=^A:kl=^H:kr=^F:ku=^Z:\ + :li#24:nd=^F:re=\EG0:ru=\EG<:se=\EG0:sg#1:so=\EG4:ue=\EG0:up=^Z:us=\EG8: +# Note: if return acts strangely on the a980, check internal switch #2 +# on the top chip on the CONTROL pc board. +ac|a980|adds consul 980:\ + :al=13\E^N:am:bs:cl=^L\200^K@:cm=^K%+@\E^E%2:co#80:dl=13\E^O:\ + :k0=\E0:k1=\E1:k2=\E2:k3=\E3:k4=\E4:k5=\E5:k6=\E6:k7=\E7:k8=\E8:k9=\E9:\ + :li#24:nd=\E^E01:so=^Y^^^N:se=^O:up=9: +### Modified based on information in Ultrix termcap. +ad|adds|adds viewpoint:\ + :cr=^M:do=^J:nl=^J:bl=^G:\ + :am:le=^H:bs:li#24:co#80:cm=\EY%+ %+ :cd=\Ek:ce=\EK:nd=^F:\ + :up=^Z:cl=^L:ll=^A:kl=^U:kr=^F:kd=^J:ku=^Z:kh=^A:\ + :so=^N:se=^O:us=^N:ue=^O:k1=^B1:k2=^B2:k3=^B3:is=\E0P: +# +# There are at least 3 types of superbees. The sb1 type/entry has f1=escape +# and f2=^C, so it doesn't correctly pass escapes or ^Cs. The sb2 type +# works most reliably. The sb3 type doesn't paint the screen cleanly during +# scrolling if the switch in the back is set to CRLF instead of AEP. +# This description was tested on the sb2 but should work on all with either +# switch setting. +# The ':xb:' code is only necessary for sb1, but is included for sb2 and sb3 +# since the escape key is rather small. 'cm' can only be used if there are +# 2048 bytes of memory and the complicated 'nl' string is included. +# +b2|sb2|sb3|fixed superbee:\ + :xb@:tc=superbee: +bh|bh3m|beehiveIIIm:\ + :if=/usr/share/lib/tabset/beehive:\ + :al=160^S:am:bs:cd=^R:ce=^P:cl=^E^R:co#80:dl=300^Q:ho=^E:li#20:ll=^E^K:\ + :nd=^L:pt:se= ^_:so=^] :up=^K: +# This entry is unreliable when lines are greater than 80 chars long. +bi|superbeeic|super bee with insert char:\ + :ic=:im=\EQ:ei=\ER:tc=superbee: +bm|microb|microbee|micro bee series:\ + :am:bs:cd=\EJ:ce=\EK:cl=\EE:co#80:cm=\EF%+ %+ :\ + :k1=\Ep:k2=\Eq:k3=\Er:k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:k9=\Ex:\ + :kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:\ + :li#24:nd=\EC:pt:se=\Ed@ :so= \EdP:ue=\Ed@:up=\EA:us=\Ed`: +bs|sb1|superbee|superb|beehive super bee:\ + :if=/usr/share/lib/tabset/stdcrt:is=\EE:\ + :am:bs:cd=3\EJ:ce=3\EK:cl=3\EH\EJ:co#80:cm=\EF%r%3%3:cr=1000\r:\ + :dC#10:da:db:xb:dc=3\EP:dl=100\EM:so=\E_1:se=\E_0:\ + :li#25:nl=\n\200\200\200\n\200\200\200\EA\EK\200\200\200\ET\ET:\ + :nd=\EC:pt:up=\EA:ho=\EH:ve=\n:\ + :k1=\Ep:k2=\Eq:k3=\Er:k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:\ + :kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA: +# Some tty drivers use cr3 for concept, others use nl3, hence dN/dC below. +co|c100|concept|concept100|concept 100:\ + :is=\EU\Ef\E7\E5\E8\El\ENH\EK\E\200\Eo&\200\Eo\47\E:\ + :al=3*\E^R:am:bs:cd=16*\E^C:ce=16\E^S:cl=2*^L:cm=\Ea%+ %+ :co#80:\ + :dc=16\E^A:dl=3*\E^B:ei=\E\200:eo:im=\E^P:in:ip=16*:li#24:mi:nd=\E=:\ + :pt:kb=^h:ta=8\t:ul:up=\E;:db:us=\EG:ue=\Eg:xn:vs=\EW:ve=\Ew:\ + :vb=\Ek\200\200\200\200\200\200\200\200\200\200\200\200\200\200\EK:\ + :us=\EG:ue=\Eg:ks=\EX:ke=\Ex:ku=\E;:kd=\E<:kl=\E>:kr=\E=:kh=\E?:\ + :k1=\E5:k2=\E6:k3=\E7:.dN#9:dC#9: +cr|c100rv|c100 rev video:\ + :is=\EU\Ef\E7\E5\E8\El\ENH\Ek\E\200\Eo&\200\Eo\47\E:vs@:ve@:\ + :vb=\EK\200\200\200\200\200\200\200\200\200\200\200\200\200\200\Ek:\ + :tc=c100: +cs|c100s|slowconcept|slowconcept100|slow concept 100:\ + :vb=\Ek\200\EK:pt:dC@:dN@:tc=c100: +cd|c100rvs|slow reverse concept 100:\ + :vb=\EK\200\Ek:pt:dC@:dN@:tc=c100rv: +### All the following c100 entries taken from MS V 2.2 freeze tape merge. +cP|c100rv4ppp|c100 with printer port:\ + :is=\EU\Ef\E7\E5\E8\El\ENH\Ek\E\200\Eo&\200\Eo\041\200\EQ"\EY(^W\Eo\47\E:\ + :tc=c100rv4p: +# Testing newer more portable te. Old te had \Ev ~p. +c4|c1004p|c100 w/4 pages:\ + :ti=\EU\Ev 8p\Ep\r:te=\Ev \200\200\200\200\200\200\Ep\r\n:\ + :vs@:ve@:tc=c100: +cR|c100rv4p|c100 w/4 pages:\ + :ti=\EU\Ev 8p\Ep\r:te=\Ev \200\200\200\200\200\200\Ep\r\n:tc=c100rv: +cn|c100rv4pna|c100 with no arrows:\ + ks@:ke@:tc=c100rv4p: +e1|ep48|ep4080|execuport 4080:am:bs:os:co#80:hu=\036:hd=\034: +e2|ep40|ep4000|execuport 4000:am:bs:os:co#136:hu=\036:hd=\034: +# HEWLETT-PACKARD TERMINALS +# hpsub: +# A subset of standard HP terminal capabilities. May be used for +# any 80 column, 24 line hp terminal supported on this system, +# except the 2640a and the 98x6 console, although the termcaps for +# those devices are dependent (thru tc) on this termcap. No padding has been +# added, so runover may occur on some terminals at higher baud rates. +# For best results, use termcap entry for the specific terminal you are using. +# May not work for some HP terminal emulators. May not work on HP 2645A +# under some circumstances. +# +h0|hpsub|hp terminals -- capability subset:\ + :if=/usr/share/lib/tabset/stdcrt:is=\E&s1A\E<\E&k0\\:al=\EL:am:bs:\ + :cd=\EJ:ce=\EK:ch=\E&a%dC:cl=\EH\EJ:\ + :up=\EA:xs::co#80:da:db:dc=\EP:dl=\EM:do=\EB:ei=\ER:\ + :kb=^H:kd=\EB:kh=\Eh:kl=\ED:kr=\EC:ku=\EA:\ + :ke=\E&s0A:ks=\E&s1A:li#24:mi:nd=\EC:pt:se=\E&d@:so=\E&dB: +# +# hp: +# May be used for most 24 x 80 hp terminals, +# but has no padding added, so may allow runover in some terminals at high +# baud rates. Will not work for 2640a or 2640b terminals, 98x6 and 98x5 +# terminal emulators or 98x6 consoles. +# Adds xy-cursor addressing, vertical cursor addressing, home, +# last line, and underline capabilities. +# +# hp 2392, hp 2393, hp 2394, hp 2397, hp 239x series: +# hp 2622, hp 2623, hp 2624, hp 2625, hp 2627, hp 2628, hp2647, hp 262x series: +# Adds backtab and init sequence; 262x needs no padding; adds scrolling. +# +h6|hpex|hp extended capabilites:\ + :cm=\E&a%dy%dC:cv=\E&a%dY:\ + :im=\EQ:ml=\El:mu=\Em:\ + :ue=\E&d@:us=\E&dD:\ + :tc=hpsub: +h2|2621|hp2621|hp2621a|hp2621p|2621|2621a|2621p|hp 2621:\ + :is=\E&j@\r\E3\r:bt=\Ei:cm=\E&a%r%dc%dY:dc=2\EP:ip=2:\ + :kh=\Ep\r:ku=\Et\r:kl=\Eu\r:kr=\Ev\r:kd=\Ew\r:\ + :kn#8:k1=\Ep\r:k2=\Eq\r:k3=\Er\r:k4=\Es\r:k5=\Et\r:k6=\Eu\r:k7=\Ev\r:\ + :k8=\Ew\r:ks=\E&jB:ke=\E&j@:ta=2^I:xs@:ti=\E&j@\r:vs=\E&j@\r:tc=hp: +hw|2621wl|hp2621wl|2621|hp 2621 with labels:\ + :is=\E&jA\r\E3\r:ke=\E&jA:tc=hp2621: +h1|262x|hp 262x series:\ + :tc=hp: +h8|2622|hp2622|hp2622a|hp2622p|2622|2622a|2622p|hp 2622:\ + :ks@:tc=hp2621: +h5|2392|2393|239x series:\ + :cm=\E&a%dy%dC:cv=\E&a%dY:im=\EQ:ml=\El:mu=\Em:\ + :ue=\E&d@:us=\E&dD:PU=\EV:PD=\EU:HM=\Eh:\ + :bt=\Ei:tc=hpsub: +h3|2392ne|2393ne|239x series:\ + :se@:so@:ue@:us@:ke@:ks@:tc=hp: +ha|2392an|2393an|hp 239x in ansi mode:\ + :is=\E<\E&k1\\\E[>1h:\ + :al=\E[L:am:bs:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:co#80:\ + :dc=\E[P:dl=\E[M:do=\E[B:bt=\E[Z:ei=\E[4l:ho=\E[H:im=\E[4h:\ + :li#24:nd=\E[C:ms:pt:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:up=\E[A:\ + :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:eo:\ + :sf=\E[S:sr=\E[T:PU=\E[V:PD=\E[U:HM=\E[>0s: +h4|hp|hp2645|2645|hp 264x series:\ + :if=/usr/share/lib/tabset/std:\ + :al=\EL:am:bs:cd=\EJ:ce=\EK:ch=\E&a%dC:cl=\EH\EJ:cm=6\E&a%r%dc%dY:\ + :co#80:cv=\E&a%dY:da:db:dc=\EP:dl=\EM:ei=\ER:im=\EQ:\ + :kb=^H:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\Eh:ks=\E&s1A:ke=\E&s0A:\ + :li#24:mi:ml=\El:mu=\Em:nd=\EC:pt:se=\E&d@:so=\E&dJ:\ + :us=\E&dD:ue=\E&d@:up=\EA:xs: +### The following HP entries from MS V 2.2 freeze tape +# Note: no "ho" on HP's since that homes to top of memory, not screen. +# The only way to get the arrow keys to transmit anything at all is to turn +# on the function key labels (f1-f8) with ks, and even then the user has to +# hold down shift. The default 2621 turns off the labels except when it has +# to to enable the function keys. If your installation prefers labels on all +# the time, or off all the time (at the "expense" of the function keys) use +# either 2621nl or 2621wl. +# 2621k45: untested +hk|2621k45|hp2621k45|k45|hp 2621 with 45 keyboard:\ + :kb=^H:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\Eh:ks=\E&s1A:ke=\E&s0A:tc=2621: +h7|hp2626|hp2626a|hp2626p|2626|2626a|2626p|hp 2626:\ + :is=\E&j@\r\E3\r:if=/usr/share/lib/tabset/stdcrt:\ + :al=\EL:am:bs:bt=\Ei:cd=\EJ:ce=\EK:cl=\EH\EJ:\ + :cm=\E&a%r%dc%dY:co#80:da:db:dc=2\EP:dl=\EM:ei=\ER:\ + :im=\EQ:ip=2:li#24:mi:nd=\EC:pt:se=\E&d@:so=\E&dB:up=\EA:\ + :kh=\Eh:ku=\EA:kl=\ED:kr=\EC:kd=\EB:\ + :ma=j^Jk^P^K^Pl :sf=\ES:\ + :ta=2^I:xs: +h9|hp2648|hp2648a|2648a|2648|HP 2648a graphics terminal:\ + :cl=50\EH\EJ:cm=20\E&a%r%dc%dY:dc=7\EP:ip#5:is=130\Eg:tc=hp: +# 2640a doesn't have the Y cursor addressing feature, and C is memory relative +# instead of screen relative, as we need. +hA|2640|hp2640a|2640a|hp 2640a:\ + :cm@:ks@:ke@:tc=hp: +hb|2640b|hp2640b|2644a|hp2644a|hp 264x series:\ + :ks@:ke@:tc=hp: +# 2621 using all 48 lines of memory, only 24 visible at any time. +hB|big2621|48 line 2621:\ + :li#48:ho=\EH:cm=\E&a%r%dc%dR:tc=2621: +hn|2621nl|hp2621nl|2621|hp 2621 with no labels:\ + :ks@:ke@:kh@:ku@:kl@:kr@:kd@:tc=hp2621: +ht|2621nt|hp 2621 w/no tabs:\ + :pt@:tc=2621: +### Heathkit 19 entries from MS V 2.2 freeze tape +### h19 was essentially same, but took MS with graphics and added SCO ke/ks +kb|h19|heath|h19b|heathkit|heath-19|z19|zenith|heathkit h19 w/ function keypad:\ + :al=1*\EL:am:bs:cd=\EJ:ce=\EK:cl=\EE:cm=\EY%+ %+ :co#80:dc=\EN:\ + :dl=1*\EM:do=\EB:ei=\EO:ho=\EH:im=\E@:li#24:mi:nd=\EC:as=\EF:ae=\EG:\ + :ms:pt:sr=\EI:se=\Eq:so=\Ep:up=\EA:vs=\Ex4:ve=\Ey4:\ + :kb=^h:ku=\EA:kd=\EB:kl=\ED:kr=\EC:kh=\EH:kn#8:\ + :ks=\Et:ke=\Eu:\ + :l1=f1:l2=f2:l3=f3:l4=f4:l5=f5:\ + :k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:\ + :l6=BLUE:l7=RED:l8=WHITE:k6=\EP:k7=\EQ:k8=\ER:\ + :GS=\EF:GE=\EG:GV=\140:GH=a:G1=c:G2=f:G3=e:G4=d:GU=u:\ + :GD=s:GC=b:GL=v:GR=t: +kB|h19nk|heathkit w/numeric keypad (not function keys):\ + :ks@:ke@:tc=h19: +kA|h19a|heathA|h19A|heathkitA|heathkit h19 ansi mode:\ + :al=1*\E[1L:am:bs:cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%2;%2H:co#80:\ + :dc=\E[1P:dl=1*\E[1M:do=\E[1B:ei=\E[4l:ho=\E[H:im=\E[4h:li#24:mi:\ + :nd=\E[1C:as=\E[10m:ae=\E[11m:ms:pt:se=\E[0m:so=\E[7m:up=\E[1A:\ + :vs=\E[>4h:ve=\E[>4l:kb=^h:ku=\E[1A:kd=\E[1B:kl=\E[1D:kr=\E[1C:\ + :kh=\E[H:kn#8:k1=\EOS:k2=\EOT:k3=\EOU:k4=\EOV:k5=\EOW:l6=BLUE:\ + :l7=RED:l8=WHITE:k6=\EOP:k7=\EOQ:k8=\EOR:\ + :sr=\EM:is=\E<\E[>1;2;3;4;5;6;7;8;9l\E[0m\E[11m\E[?7h:\ + :cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%2;%2H:co#80:li#24:\ + :se=\E[0m:so=\E[7m:\ + :MP=\E[7l\E[6h\E[?7h:CO=\E[>5l:CF=\E[>5h:KO=\E[>2l:KF=\E[>2h:\ + :CL=\E[4h:CR=\E[P:WL=\E[L:WR=\E[M:\ + :UK=\E[A:DK=\E[B:LK=\E[D:RK=\E[C:HM=\E[H: +l0|adm11|11|lsi adm11:\ + :am:bs:cd=\EY:ce=\ET:cm=\E=%+ %+ :cl=\E*:co#80:\ + :ho=^^:li#24:\ + :kl=^H:kd=^J:ku=^K:kr=^L:ma=^K^P^L :nd=^L:\ + :se=\EG0:so=\EG4:up=^K:sg#1: +l5|adm12|lsi adm12:\ + :GS=\ELC:GE=\ELA:GH=e:GV=a:GU=f:GD=i:G1=g:G2=b:G3=`:G4=d:\ + :tc=adm31: +### All adm3* entries from MS V 2.2 freeze tape merge +l3|adm3|3|lsi adm3:\ + :am:bs:cl=^Z:li#24:ma=^K^P:co#80: +la|adm3a|3a|lsi adm3a:\ + :am:bs:cm=\E=%+ %+ :cl=^Z:co#80:ho=^^:li#24:ma=j^Jk^P^K^Pl :nd=^L:\ + :up=^K:MP=^Z:MR=^Z:EG#1:BE=^G:\ + :BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=\036: +ls|adm3aso|3aso|lsi adm3a with {} for standout:\ + :am:bs:cm=\E=%+ %+ :cl=^Z:co#80:ho=^^:li#24:ma=j^Jk^P^K^Pl :nd=^L:\ + :up=^K:MP=^Z:MR=^Z:sg#1:so={:se=}:BE=^G:\ + :BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=\036: +lA|adm3a19.2|3a19||3a19.2|lsi adm3a at 19.2 baud:\ + :cl=^Z\200\200:tc=adm3a: +lb|adm3a+|3a+|lsi adm3a+:\ + :kl=^H:kd=^J:ku=^K:kr=^L:tc=adm3a: +### adm31 entry taken from MS V 2.2 freeze tape, since looked more complete. +### It had sg#1, though, which broke adm12 so I took it (sg#1) out. +# If the adm31 gives you trouble with standout mode, check the DIP switch +# in position 6, bank @c11, 25% from back end of pc. Should be OFF. +# If there is no such switch, you have an old adm31 and must use oadm31 +l1|adm31|31|lsi adm31|Lear Siegler ADM31:\ + :is=\Eu\E0:\ + :al=\EE:am:bs:ce=\ET:cm=\E=%+ %+ :cl=\E*:cd=\EY:co#80:dc=\EW:dl=\ER:\ + :ei=\Er:ho=^^:im=\Eq:k0=^A0\r:k1=^A1\r:k2=^A2\r:k3=^A3\r:k4=^A4\r:\ + :k5=^A5\r:k6=^A6\r:k7=^A7\r:k8=^A8\r:k9=^A9\r:kd=^J:kl=^H:kr=^L:ku=^K:\ + :li#24:ma=j^Jk^P^K^Pl ^R^L^L :mi:nd=^L:\ + :se=\EG0:so=\EG4:up=^K:us=\EG1:ue=\EG0:GG#1:\ + :BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=\036: +### I don't understand how this helps regular standout, but that's how MS had it +lo|oadm31|o31|old adm31:\ + :so=\EG4:us@:ue@:tc=adm31: +### adm42 entry from MS V 2.2 freeze tape merge +l4|adm42|42|lsi adm42:\ + :vs=\EC\E3 \E3(:\ + :al=270\EE:am:bs:cd=\EY:ce=\ET:cl=\E;:cm=\E=%+ %+ :co#80:\ + :dc=\EW:dl=\ER:ei=\Er:im=\Eq:ip=6*:li#24:\ + :bt=\EI:nd=^L:se=\EG0:so=\EG4:ta=\t:up=^k:\ + :ma=^K^P:pc=\177:\ + :GG#1:CF=\E~1:CO=\E~2:\ + :BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=\036: +s1|svt1210|Sperry 1210, standard setup:\ + :co#80:li#24:cl=70\E[;H\E\E[2J:bs:cm=\E[%i%2;%2H:ti=\E[0;0H:\ + :kh=^A:kr=\E[C:nd=\E[C:kl=\E[D:bc=\E[D:ku=\E[A:up=\E[A:kd=\E[B:\ + :do=\E[B:kb=^H:sr=\EM:\ + :ce=\E[0K:cd=\E[0J:dl=\E2K:\ + :so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:ul:ug#0:\ + :MP=:MR=\E[0;0H:HM=\E\\+O\\+P:\ + :PU=\E\\+1:PD=\E\\+2:PL=\E\\+3:PR=\E\\+4:NU=\E\\+5:CW=\E\\+6:\ + :EN=\E\\+7:WL=\E\\+8:WR=\E\\+9:CL=\E\\+0:CR=\E\\+-:DL=\E\\+=:\ + :CN=:CF=:NM=\E[0m:NB=\E[0m:NR=\E[0;7m:NS=\E[0m:AL=\E[0m:\ + :AS=\E[0,7m:RS=\E[0m:\ + :AB=\E[0m:AR=\E[0;7m:OV#0: +s2|svt1220|Sperry 1220, standard setup:\ + :co#80:li#24:cl=70\E[;H\E[2J:bs:cm=\E[%i%2;%2H:ti=\E[0;0H:\ + :kh=^A:kr=\E[C:nd=\E[C:kl=\E[D:bc=\E[D:ku=\E[A:up=\E[A:kd=\E[B:\ + :do=\E[B:ce=\E[0K:cd=E[0J:dl=\E2K:\ + :so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:ul:ug#0:\ + :MP=:MR=\E[0;0H:HM=\E\\+O\\+P:\ + :PU=\E\\+1:PD=\E\\+2:PL=\E\\+3:PR=\E\\+4:NU=\E\\+5:CW=\E\\+6:\ + :EN=\E\\+7:WL=\E\\+8:WR=\E\\+9:CL=\E\\+0:CR=\E\\+-:DL=\E\\+=:\ + :CN=:CF=:NM=\E[0;1m:NB=\E[0;1;5m:NR=\E[0;1;7m:NS=\E[0;1;5m:\ + :AL=\E[0;5m:AB=\E[0m:AR=\E[0;7m:AS=\E[0;5;7m:RS=\E[0;1m:OV#0: +s3|svt52|1210/1220/PC, Sperry in VT52 mode:\ + :bs:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :co#80:do=\EB:kb=^H:\ + :kd=\EB:kl=\ED:kr=\EC:kw=\EA:li#24:nd=\EC:sr=\EI:up=\EA: +s4|svt100|1220/PC, Sperry in VT100 mode:\ + :co#80:li#24:cl=70\E[;H\E[2J:bs:cm=\E[%i%2;%2H:ti=\E[0;0H:\ + :kh=^A:kr=\E[C:nd=\E[C:kl=\E[D:bc=\E[D:ku=\E[A:up=\E[A:kd=\E[B:\ + :do=\E[B:ce=\E[0K:cd=E[0J:dl=\E2K:\ + :so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:ul:ug#0:\ + :MP=:MR=\E[0;0H:HM=\E\\+O\\+P:\ + :PU=\E\\+1:PD=\E\\+2:PL=\E\\+3:PR=\E\\+4:NU=\E\\+5:CW=\E\\+6:\ + :EN=\E\\+7:WL=\E\\+8:WR=\E\\+9:CL=\E\\+0:CR=\E\\+-:DL=\E\\+=:\ + :CN=:CF=:NM=\E[0;1m:NB=\E[0;1;5m:NR=\E[0;1;7m:NS=\E[0;1;5m:\ + :AL=\E[0;5m:AB=\E[0m:AR=\E[0;7m:AS=\E[0;5;7m:RS=\E[0;1m:OV#0: +# These mime1 entries refer to the Microterm Mime I or Mime II. +# The default mime is assumed to be in enhanced act iv mode. +m3|mime3a|mime1 emulating 3a:\ + :am@:ma=^X ^K^J^Z^P:ku=^Z:kd=^K:kl=^H:kr=^X:tc=adm3a: +### From MS V 2.2 freeze tape merge (m4, m5) +m4|microterm|act4|microterm act iv:\ + :am:bs:cd=^_:nd=^X:up=^Z:ho=^]:\ + :ce=^^:cl=^L:cm=^T%.%.:co#80:li#24:\ + :MP=^L:MR=^L:sg#1:so=[:se=]:EG#1:ES=#:EE=#: +# The padding on sr and ta for act5 and mime may need adjusting +m5|microterm5|act5|microterm act v:\ + :uc=\EA:pt:ta=2^I:sr=3\EH:ku=^Z:kd=^K:kl=^H:kr=^X:\ + :ma=^Z^P^Xl^Kj:tc=act4: +mS|act5s|skinny act5:\ + :ti=\EP:te=\EQ:li#48:co#39:tc=act5: +mm|mime|mime1|mime2|mimei|mimeii|microterm mime1:\ + :al=80^A:am:bs:cd=^_:ce=^^:cl=\035^C:cm=^T%+^X%> 0%+P:co#80:\ + :dl=80^W:li#24:nd=^X:pt:uc=^U:up=^z:ho=\035:do=^K:is=^S\E:\ + :ma=^X ^K^J^Z^P:ku=^Z:kd=^K:kl=^H:kr=^X:sr=3^R:ta=2^I: +### From MS V 2.2 freeze tape merge +# Mimes using brightness for standout. Half bright is really dim unless +# you turn up the brightness so far that lines show up on the screen. +mf|mimefb|full bright mime1:\ + :so=^Y:se=^S:is=^S\E:tc=mime: +mh|mimehb|half bright mime1:\ + :so=^S:se=^Y:is=^Y\E:tc=mime: +# These termcaps (for mime 2a) put the terminal in low intensity mode +# since high intensity mode is not as visually appealing. +ms|mime2as|microterm mime2a (emulating an enhanced soroc iq120):\ + :al=20*^A:am:bs:cd=20*\EJ:ce=\EK:cl=\EL:cm=\E=%+ %+ :co#80:dc=\ED:\ + :dl=20*^W:kl=^H:kr=^L:ku=^K:kd=^J:ho=^^:is=\E):sr=\EI\ + :im=\EE:ei=^Z:ip=2:li#24:nd=^L:so=\E\072:se=\E;:up=\EI:\ + :us=\E6:ue=\E7: +# This is the preferred mode (but ^X can't be used as a kill character). +mv|mime2a|mime2av|microterm mime2a (emulating an enhanced vt52):\ + :al=20*^A:bs:cd=20*\EQ:co#80:ce=\EP:cl=\EL:cm=\EY%+ %+ :is=^Y\ + :dc=^N:dl=20*^W:ip=2:ei=^Z:ho=\EH:im=^O:kd=\EB:kl=\ED:kr=\EC:ku=\EA:\ + :li#24:nd=\EC:pt:se=\E9:so=\E8:up=\EA:sr=\EA:us=\E4:ue=\E5: +mx|mime3ax|mime1 emulating enhanced 3a:\ + :al=80^A:dl=80^W:pt:ce=^X:cd=^_:tc=mime3a: +pf|fox|perkin elmer 1100:\ + :if=/usr/share/lib/tabset/stdcrt:\ + :am:bs:cd=5.5*\EJ:ce=\EI:cl=132\EH\EJ:co#80:ho=\EH:li#24:\ + :ll=\EH\EA:nd=\EC:cm=\EX%+ \EY%+ :up=\EA:vb=^P^B^P^C: +po|owl|perkin elmer 1200:\ + :if=/usr/share/lib/tabset/stdcrt:\ + :al=5.5*\EL:am:bs:cd=5.5*\EJ:ce=\EI:cl=132\EH\EJ:ho=\EH:ll=\EH\EA:\ + :cm=\EX%+ \EY%+ :co#80:dc=5.5*\EO:dl=5.5*\EM:ei=:ic=\EN:im=:ip=5.5*:\ + :kb=^h:in:li#24:nd=\EC:up=\EA:se?=\E\041\200:so?=\E\041^H:vb=^P^B^P^C:\ + :k1=\ERA:k2=\ERB:k3=\ERC:k4=\ERD:k5=\ERE:k6=\ERF:\ + :k7=\ERG:k8=\ERH:k9=\ERI:k0=\ERJ: +qe|exidy|exidy2500|exidy sorcerer as dm2500:\ + :al=^P^J^X:am:bs:ce=^W:cl=^^:cm=^L%r%n%.%.:co#64:\ + :dc=\b:dl=^P^Z^X:dm=^P:ed=^X:ei=^X:ho=^B:ic=^\:\ + :im=^P:li#30:nd=^\:pt:so=^N:se=^X:up=^Z: +### From MS V 2.2 freeze tape merge +qs|sexidy|exidy smart:\ + :li#24:co#64:cl=^l:ho=^q:nd=^s:up=^w:bs:bc=^a:ma=^x^J:kd=^S: +y1|t3700|teleray|dumb teleray 3700:\ + :bs:cl=^L:co#80:li#24: +y3|t3800|teleray 3800 series: \ + :bs:cd=\EJ:ce=\EK:cl=^L:cm=\EY%+ %+ :co#80: \ + :do=\n:ho=\EH:li#24:ll=\EY7 :nd=\EC:pt:up=^K: +y6|t1061|t10|teleray|teleray 1061:if=/usr/share/lib/tabset/teleray:\ + :al=2*\EL:am:bs:cd=1\EJ:ce=\EK:cl=1^L:cm=\EY%+ %+ :co#80:\ + :dc=\EQ:dl=2*\EM:ei=:ho=\EH:ic=\EP:im=:ip=0.4*:\ + :k1=^Z1:k2=^Z2:k3=^Z3:k4=^Z4:k5=^Z5:k6=^Z6:k7=^Z7:k8=^Z8:\ + :li#24:nd=\EC:pt:se=\ER@:so= \ERD:\ + :is=\Ee\EU01^Z1\EV\EU02^Z2\EV\EU03^Z3\EV\EU04^Z4\EV\EU05^Z5\EV\EU06^Z6\EV\EU07^Z7\EV\EU08^Z8\EV\Ef:\ + :up=\EA:us=\ERH:ue=\ER@:xs:xt:sg#2:ug#1: +### From MS V 2.2 freeze tape merge +yf|t1061f|teleray 1061 with fast PROMs:\ + :al=\EL:ip@:dl=\EM:tc=t1061: +CC|c3102|cromemco 3102:\ + :am:bs:co#80:li#24:up=\EA:do=\EB:nd=\EC:cl=\EE:\ + :cm=\EY%+ %+ :cd=\EJ:ce=\EK:al=\EL:dl=\EM:\ + :kl=^H:kr=^L:ku=^K:kd=^J: +px|pixel|Pixel terminal:\ + :cd=\E):co#80:ce=\E&:cl=^L:cm=\E%%%+\041%+\041:kd=^J:kl=\E5:\ + :kh\1:kr=\E%:ku=\E6:li#24:nd=\E\041:pt:up=\E#:so=\E-7:se=\E.7:\ + :pc=\000:am:do=^J:ho=\E1:sg#0: +# The Teletype 5425 is upwardly compatible with the vt100 so the vt100 +# termcap entry was copied and modified appropriately. All padding was +# taken out. This termcap entry supplied by D. W. Dykstra at AT&T Teletype. +# Modification made for use with vi: the cs entry was removed, since vi +# will call that before insert line and then the screen update is wrong. +TG|5425|tty5425|4425|att4425|AT&T Teletype 5425 80 columns:\ + :co#80:li#24:da:db:pt:bs:vt#3:cr=^M:do=^J:nl=^J:bl=^G:\ + :le=^H:nd=\E[C:up=\E[A:\ + :vs=\E[J\E[78t:ks=\E[?1h\E=\E[21;1j:ke=\E[?1l\E>\E[21;0j:\ + :al=\E[L:dl=\E[M:dc=\E[P:ei=\E[4l:im=\E[4h:cm=\E[%i%d;%dH:\ + :cl=\E[;H\E[2J:ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ + :mh=\E[2m:mr=\E[7m:mb=\E[5m:me=\E[m:\ + :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ + :rf=/usr/share/lib/tabset/vt100:sc=\E7:rc=\E8:\ + :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ + :ho=\E[H:kh=\E[H:ko=al,dl,dc,im,ei:kn#10:\ + :k0=\E[J:l0=clear:\ + :k1=\E[2K:l1=clear line:\ + :k2=\E[P:l2=del char:\ + :k3=\E[M:l3=del line:\ + :k4=\E[4h:l4=ins char:\ + :k5=\E[L:l5=ins line:\ + :k6=\Et:l6=top:\ + :k7=\Ez:l7=btm:\ + :k8=\E[S:l8=scroll up:\ + :k9=\E[T:l9=scroll down: +TH|5425-w|tty5425-w|4425-w|att4425-w|AT&T Teletype 5425 132 columns:\ + :co#132:li#24:\ + :rs=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h:\ + :tc=5425: +vz|vtz|vtz-2/10|Zilog vtz 2/10:\ + :co#80:li#24:am:bs:cl=50\E[H\E[2J:cm=10\E[%i%2;%2H:nd=2\E[C:up=2\E[A:\ + :cp=\E[6n:cf=\E[%i%3;%3R:\ + :ce=3\E[K:cd=50\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ + :al=\E[L:dl=\E[M:dc=\E[P:im=\E[>4h:ei=\E[>4l:\ + :kd=^V:kl=^^:kr=^O:ku=^K:\ + :CF=\E[1v:CN=\E[0v:\ + :NM=\E[0m:NB=\E[0;5m:NR=\E[0;7m:NS=\E[0;5;7m:\ + :AL=\E[1m:AB=\E[0;1;5m:AR=\E[0;1;7m:AS=\E[0;1;5;7m:OV#0:\ + :Nm=\E[0;4m:Nb=\E[0;5;4m:Nr=\E[0;7;4m:Ns=\E[0;5;7;4m:\ + :Al=\E[1;4m:Ab=\E[0;1;5;4m:Ar=\E[0;1;7;4m:As=\E[0;1;5;7;4m:OV#0:\ + :ma=^V^Jh^Hk^P^O ^Kk^Z^L:en=\r:lf=\n:es=\E:rs=\177:de=^H:\ + :is=\E[?1h\E=\E[=~u1^K\E[=~d1^V\E[=~l1^^\E[=~r1^O\E[=A2^al\E[=B2^a2\E[=C2^a3\E[=D2^a4\E[=U2^a5\E[=~D2^a6\E[=~L2^a7\E[=~R:\ + :ti=\E[?1h\E=\E[=~u1^K\E[=~d1^V\E[=~l1^H\E[=~r1^O:\ + :ti=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ + :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:kh=\E[H:ho=\E[H:\ + :UK=\E[A:DK=\E[B:RK=\E[C:LK=\E[D:\ + :NM=\E[0m:NB=\E[0;5m:NR=\E[0;7m:NS=\E[0;5;7m:\ + :AL=\E[1m:AB=\E[0;1;5m:AR=\E[0;1;7m:AS=\E[0;1;5;7m:OV#0:\ + :ma=^V^Jh^Hk^P^O ^Kk^Z^L: +### The following entry was created by lyrixdev based on the old qvt101+ +### entry (since overwritten by Qume's new submission). +# QUME's QVT101+ terminal in native mode. +# Since the qvt101+ has an attribute byte, we have added "\E0P" +# to the "is" string. This uses the Adds Viewpoint ADDSVPA2 protected +# mode on and off for "se" and "so" and does not require an attribute byte. +qp|qvt101+so|Qume QVT-101+ with protected mode/standout:\ + :is=\E0P\Ew\E.4\EG0\E(\EC\E%\EX\E\047\E+\Ef^M\Eg:\ + :cl=\E+:ct=\E3:st=\E1:co#80:li#24:cr=^M:nl=^J:le=^H:\ + :sg#0:ug#1:kh=^^:kr=^L:kl=^H:kd=^J:ku=^K:cm=\E=%+ %+ :\ + :bt=\EI:do=^J:nd=^L:up=^K:ho=^^:MP=:MR=:\ + :bs:ul:am:so=\E):se=\E(:ce=\Et:cd=\Ey:al=\EE:\ + :dl=\ER:dc=\EW:ic=\EQ:im=:ei=:us=\EG8:ue=\EG0:as=\E$:\ + :ae=\E%:k0=^A@^M:k1=^AA^M:k2=^AB^M:k3=^AC^M:k4=^AD^M:k5=^AE^M:\ + :k6=^AF^M:k7=^AG^M:k8=^AH^M:k9=^AH^M:vs=\E.1:ve=\E.4\EJ:\ + :G1=g:G2=f:G3=e:G4=h:GC=i:GD=n:GE=\E%:GG=2:GH=k:GL=l:\ + :GR=m:GS=\E$:GU=o:GV=j: +qb|qvt101b|QVT-101 with cursor set to blinking underline:\ + :ve=\E.3\EJ:tc=qvt101: +q2|qvt108|QVT-108:ct=\E3:st=\E1:co#80:li#24:\ + :is=\EG0\E(\EA\E%\EX\E\047\EC\E*\E1\E3:cr=^M:nl=^J:le=^H:\ + :sg#1:ug#1:kh=^^:kr=^L:kl=^H:kd=^V:ku=^K:cm=\E=%+ %+ :\ + :bt=\EI:do=^V:nd=^L:up=^K:ho=^^:ma=^Hh^Jj^Kk^Ll^^H:\ + :bs:ul:am:so=\EG4:se=\EG0:cl=\E*:ce=\Et:cd=\Ey:al=\EE:\ + :dl=\ER:dc=\EW:ic=\EQ:im=:ei=:us=\EG8:ue=\EG0:as=\E$:\ + :ae=\E%:k0=^A@^M:k1=^AA^M:k2=^AB^M:k3=^AC^M:k4=^AD^M:k5=^AE^M:\ + :k6=^AF^M:k7=^AG^M:k8=^AH^M:k9=^AH^M:vs=\E.1:ve=\E.4\EJ: +q3|qvt109|QVT-109:\ + :ct=\E3:st=\E1:co#80:li#24:\ + :is=\EG0\E(\EA\E%\EX\E\047\EC\E*\E1\E3:cr=^M:nl=^J:\ + :kh=^^:kr=^L:kl=^H:kd=^J:ku=^K:cm=\E=%+\040%+\040:\ + :bt=\EI:do=^J:nd=^L:up=^K:ho=^^:ma=^Hh^Jj^Kk^Ll^^H:\ + :bs:ul:am:so=\EG4:se=\EG0:cl=^Z:ce=\Et:cd=\Ey:al=\EE:\ + :dl=\ER:dc=\EW:ic=\EQ:im=:ei=:us=\EG8:ue=\EG0:as=\E$:\ + :ae=\E%:k0=^A@^M:k1=^AA^M:k2=^AB^M:k3=^AC^M:k4=^AD^M:k5=^AE^M:\ + :k6=^AF^M:k7=^AG^M:k8=^AH^M:k9=^AH^M:vs=\E.1:ve=\E.4\EJ:le=^H: +### The following qvt entries were supplied by Qume (Bill Ryan). +### They REPLACE (in most cases) entries that we distributed and were +### previously supplied by Qume. [Changes include renumbering the function +### keys so that 9 and 0 are the same key.] +q1|qvt101|Qume QVT-101 vers c:\ + :is=\E(\EA\E%\EX\E\047\EC\E*\E.3:ct=\E3:st=\E1:co#80:li#24:\ + :cr=^M:nl=^J:le=^H:if=/usr/share/lib/tabset/std:\ + :sg#1:ug#1:kh=^^:kr=^L:kl=^H:kd=^J:ku=^K:cm=\E=%+ %+ :\ + :bt=\EI:do=^J:nd=^L:up=^K:ho=^^:ma=^Hh^Jj^Kk^Ll^^H:\ + :bs:ul:am:so=\EG4:se=\EG0:cl=\E*:ce=\Et:cd=\Ey:al=\EE:\ + :dl=\ER:dc=\EW:ic=\EQ:im=:ei=:us=\EG8:ue=\EG0:as=\E$:\ + :ae=\E%:k1=^A@^M:k2=^AA^M:k3=^AB^M:k4=^AC^M:k5=^AD^M:\ + :k6=^AE^M:k7=^AF^M:k8=^AG^M:k9=^AH^M:k0=^AH^M:kA=^AI^M:\ + :kB=^AJ^M:CF=\E.0:CO=\E.3:CL=^H:CR=^L:DK=^J:DL=\EW:\ + :GS=\E$:GE=\E\045:G1=e:G2=h:G3=g:G4=f:GD=n:GH=k:GU=o:GV=j:\ + :HM=^^:LD=\ER:LF=^J:LK=^H:MN=-:PS=+:RK=^L:RT=^M:TB=^K: +q4|qvt119|Qume QVT-119:\ + :ct=\E3:st=\E1:co#80:li#24:\ + :is=\E(\EA\E%\EX\E\047\EC\E*\E.3:\ + :cr=^M:nl=^J:le=^H:if=/usr/share/lib/tabset/std:\ + :sg#0:ug#0:kh=^^:kr=^L:kl=^H:kd=^J:ku=^K:cm=\E=%+ %+ :\ + :bt=\EI:do=^J:nd=^L:up=^K:ho=^^:ma=^Hh^Jj^Kk^Ll^^H:\ + :bs:ul:am:so=\EG4:se=\EG0:cl=\E*1:ce=\Et:cd=\Ey:al=\EE:\ + :dl=\ER:dc=\EW:ic=\EQ:im=:ei=:us=\EG8:ue=\EG0:as=\E$:\ + :ae=\E%:k1=^A@^M:k2=^AA^M:k3=^AB^M:k4=^AC^M:k5=^AD^M:\ + :k6=^AE^M:k7=^AF^M:k8=^AG^M:k9=^AH^M:k0=^AH^M:kA=^AI^M:\ + :kB=^AJ^M:kC=^AK^M:kD=^AL^M:kE=^AM^M:kF=^AN^M:kG=^AO^M:\ + :kI=^Aa^M:kJ=^Ab^M:kK=^Ac^M:kL=^Ad^M:kM=^Ae^M:\ + :kM=^Af^M:kN=^Ag^M:kO=^Ag^M:kP=^Ah^M:kQ=^Ai^M:kQ=^Aj^M:\ + :kR=^Ak^M:kS=^Al^M:kT=^Am^M:kT=^An^M:kU=^Ao^M:vs=\E.3:\ + :ve=\E.3:GS=\E$:GE=\E\045:G1=g:G2=f:G3=e:G4=h:GD=n:GH=k:\ + :GU=o:GV=j:CF=\E.0:CO=\E.3:CL=^H:CR=^L:DK=^J:DL=\EW:HM=^^:\ + :LF=^J:LK=^H:MN=-:PS=+:RK=^L:RT+^M:TB=^K:LD=\ER: +q5|qvt101+|Qume QVT-101 Plus vers c:\ + :ct=\E3:st=\E1:co#80:li#24:\ + :is=\E(\EA\E%\EX\E\047\EC\E*\E0P:if=/usr/share/lib/tabset/std:\ + :cr=^M:nl=^J:le=^H:\ + :sg#0:ug#1:kh=^^:kr=^L:kl=^H:kd=^J:ku=^K:cm=\E=%+ %+ :\ + :bt=\EI:do=^J:nd=^L:up=^K:ho=^^:ma=^Hh^Jj^Kk^Ll^^H:\ + :bs:ul:am:so=\E):se=\E(:cl=\E*:ce=\Et:cd=\Ey:al=\EE:\ + :dl=\ER:dc=\EW:ic=\EQ:im=:ei=:us=\EG8:ue=\EG0:as=\E$:\ + :ae=\E%:k1=^A@^M:k2=^AA^M:k3=^AB^M:k4=^AC^M:k5=^AD^M:\ + :k6=^AE^M:k7=^AF^M:k8=^AG^M:k9=^AH^M:k0=^AH^M:kA=^AI^M:\ + :kB=^AJ^M:kC=^AK^M:kD=^AL^M:kE=^AM^M:kF=^AN^M:kG=^AO^M:\ + :kH=^A\047^M:kI=^Aa^M:kJ=^Ab^M:kK=^Ac^M:kL=^Ad^M:kM=^Ae^M:\ + :kM=^Af^M:kN=^Ag^M:kO=^Ag^M:kP=^Ah^M:kQ=^Ai^M:kQ=^Aj^M:\ + :kR=^Ak^M:kS=^Al^M:kT=^Am^M:kT=^An^M:kU=^Ao^M:vs=\E.3:\ + :ve=\E.3:CF=\E.0:CO=\E.3:CL=^H:CR=^L:DK=^J:DL=\EW:PD=\EK:\ + :PU=\EJ:KF=\E<:KO=\E>::EE=\El:ES=\Ek:EG#0:HM=^^:LD=\ER:\ + :GS=\E$:GE=\E\045:G1=g:G2=f:G3=e:G4=h:GD=n:GH=k:GU=o:GV=j:\ + :RK=^L:RT=^M:TB=^K:LK=^H:MN=-:PS=+:LF=^J: +q6|qvt119+|Qume QVT-119 Plus vers c:\ + :ct=\E3:st=\E1:co#80:li#24:\ + :is=\E(\EA\E%\EX\E\047\EC\E*\E.3:\ + :cr=^M:nl=^J:le=^H:if=/usr/share/lib/tabset/std:\ + :sg#0:ug#0:kh=^^:kr=^L:kl=^H:kd=^J:ku=^K:cm=\E=%+ %+ :\ + :bt=\EI:do=^J:nd=^L:up=^K:ho=^^:ma=^Hh^Jj^Kk^Ll^^H:\ + :bs:ul:am:so=\EG4:se=\EG0:cl=\E*1:ce=\Et:cd=\Ey:al=\EE:\ + :dl=\ER:dc=\EW:ic=\EQ:im=:ei=:us=\EG8:ue=\EG0:as=\E$:\ + :ae=\E%:k1=^A@^M:k2=^AA^M:k3=^AB^M:k4=^AC^M:k5=^AD^M:\ + :k6=^AE^M:k7=^AF^M:k8=^AG^M:k9=^AH^M:k0=^AH^M:kA=^AI^M:\ + :kB=^AJ^M:kC=^AK^M:kD=^AL^M:kE=^AM^M:kF=^AN^M:kG=^AO^M:\ + :kH=^A\047^M:kI=^Aa^M:kJ=^Ab^M:kK=^Ac^M:kL=^Ad^M:kM=^Ae^M:\ + :kM=^Af^M:kN=^Ag^M:kO=^Ag^M:kP=^Ah^M:kQ=^Ai^M:kQ=^Aj^M:\ + :kR=^Ak^M:kS=^Al^M:kT=^Am^M:kT=^An^M:kU=^Ao^M:vs=\E.3:\ + :ve=\E.3:CF=\E.0:CO=\E.3:CL=^H:CR=^L:DK=^J:DL=\EW:GG#0:\ + :GS=\E$:GE=\E\045:G1=g:G2=f:G3=e:G4=h:GD=n:GH=k:GU=o:GV=j:\ + :HM=^^:LD=\ER:LF=^J:LK=^H:MN=-:PS=+:RK=^L:RT=^M:TB=^K: +q7|qvt201|Qume QVT-201:\ + :ct=\E[g:st=\EH:co#80:li#24:\ + :is=\E[H\E[J\E[0m\E)0\014:if=/usr/share/lib/tabset/vt100:\ + :cr=^M:nl=^J:kr=\E[C:kl=\E[D:\ + :kd=\E[B:ku=\E[A:cm=\E[%2;%2H:do=\E[B:up=\E[A:ho=\E[H:\ + :nd=\E[C:ma=\E[HH\E[Dl\E[Ak\E[Bj\E[Ch:bs:ul:am:so=\E[7m:\ + :se=\E[0m:cl=\E[2J:ce=\E[K:cd=\EJ:al=\E[L:dl=\E[M:ic=\E[@:\ + :dc=\E[P:im=:ei=:us=\E[4m:ue=\E[0m:as=\015:ae=\014:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:GS=^N:GE=^O:GG#0:G1=k:\ + :G2=l:G3=m:G4=j:GD=w:GH=q:GU=v:GV=x:CF=\E[?25l:CO=\E[?25h: +q8|qvt202|Qume QVT-202:\ + :ct=\E[g:st=\EH:co#80:li#24:\ + :is=\E[H\E[J\E[0m\E)0\014:if=/usr/share/lib/tabset/vt100:\ + :cr=^M:nl=^J:kr=\E[C:kl=\E[D:\ + :kd=\E[B:ku=\E[A:cm=\E[%2;%2H:do=\E[B:up=\E[A:ho=\E[H:\ + :nd=\E[C:ma=\E[HH\E[Dl\E[Ak\E[Bj\E[Ch:bs:ul:am:so=\E[7m:\ + :se=\E[0m:cl=\E[2J:ce=\E[K:cd=\EJ:al=\E[L:dl=\E[M:ic=\E[@:\ + :dc=\E[P:im=:ei=:us=\E[4m:ue=\E[0m:as=\015:ae=\014:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:GS=^N:GE=^O:GG#1:G1=k:\ + :G2=l:G3=m:G4=j:GD=w:GH=q:GU=v:GV=x:PU=\E[5~:PD=\E[6~:\ + :CF=\E[?25l:CO=\E[?25h: +q9|qvt103|Qume QVT-103:\ + :ct=\E[g:st=\EH:co#80:li#24:\ + :is=\E[H\E[J\E[0m\E)0\014:if=/usr/share/lib/tabset/vt100:\ + :cr=^M:nl=^J:kr=\E[C:kl=\E[D:\ + :kd=\E[B:ku=\E[A:cm=\E[%2;%2H:do=\E[B:up=\E[A:ho=\E[H:\ + :nd=\E[C:ma=\E[HH\E[Dl\E[Ak\E[Bj\E[Ch:bs:ul:am:so=\E[7m:\ + :se=\E[0m:cl=\E[2J:ce=\E[K:cd=\EJ:al=\E[L:dl=\E[M:ic=\E[@:\ + :dc=\E[P:im=:ei=:us=\E[4m:ue=\E[0m:as=\015:ae=\014:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:ko=dl,il,cd,ho,dc,ic,cl:\ + :GS=^N:GE=^O:GG#0:G1=k:G2=l:G3=m:G4=j:GD=w:GH=q:GU=v:GV=x:\ + :PU=\E[V:PD=\E[U: +qA|qvt203|Qume QVT 203 PLUS:\ + :ct=\E[g:st=\EH:co#80:li#24:\ + :is=\E[H\E[J\E[0m\E)0\014:if=/usr/share/lib/tabset/vt100:\ + :cr=^M:nl=^J:kr=\E[C:kl=\E[D:\ + :kd=\E[B:ku=\E[A:cm=\E[%2;%2H:do=\E[B:up=\E[A:ho=\E[H:\ + :nd=\E[C:ma=\E[HH\E[Dl\E[Ak\E[Bj\E[Ch:bs:ul:am:so=\E[7m:\ + :se=\E[0m:cl=\E[2J:ce=\E[K:cd=\EJ:al=\E[L:dl=\E[M:ic=\E[@:\ + :dc=\E[P:im=:ei=:us=\E[4m:ue=\E[0m:as=\015:ae=\014:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:GS=^N:GE=^O:GG#1:G1=k:\ + :G2=l:G3=m:G4=j:GD=w:GH=q:GU=v:GV=x:PU=\E[5~:PD=\E[6~:\ + :CF=\E[?25l:CO=\E[?25h: +Mu|sun|Sun Microsystems Workstation console:\ + :li#34:co#80:cl=^L:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ + :am:bs:km:mi:ms:pt:\ + :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:\ + :kd=\E[B:kl=\E[D:ku=\E[A:kr=\E[C:kh=\E[H:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :al=\E[L:dl=\E[M:im=:ei=:ic=\E[@:dc=\E[P:\ + :rs=\E[s: +### From MS V 2.2 freeze tape merge +Ft|ft1024|Forward Technology graphics controller:\ + :am:bs:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%2;%2H:co#80:\ + :do=\E[B:ho=\E[H:\ + :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:\ + :kn#4:k1=\EOS:k2=\EOT:k3=\EOU:k4=\EOV:\ + :l1=PF1:l2=PF2:l3=PF3:l4=PF4:\ + :li#66:nd=\E[C:se=\E[m:so=\E[7m:up=\E[A:\ + :vs=\E[?l:\ + :GS=\E[11m:GE=\E[10m:G1=l:G2=k:G3=m:G4=n:\ + :GU=r:GD=q:GH=d:GV=c:GL=t:GR=s:GC=e:\ + :CF=\E[=l:CO=\E[=h:\ + :CL=\EOU:CR=\EOV:WL=\EOS:WR=\EOT: +### Submitted by amdcad!lll-crg!seismo!men1!aquin!andys +# It seems to work for the Kaypro 2,4, & 10. +kp|k10|kaypro|Kaypro 10:\ + :bs:am:co#80:li#24:cm=\E=%+\040%+\040:cl=53*\032:ho=123*\036:\ + :so=2\EB0\EB1:se=2\EC0\EC1:us=2\EB3:ue=2\EC3:ul:cd=4\027:ce=\030:\ + :kd=^J:ku=^K:kr=^L:kl=^H:kb=^H:ug#2:nd=^L:do=^J:up=^K:\ + :al=3*\EE^K:dl=3*\ER: +### Supplied Kimtron via drb. Works with vi and vsh. Otherwise untested. +# Kimtron kt-7 in XENIX mode: kt7pc cursor keys generate esc [ sequences +# instead of control codes; so the following termcap entries are modified +# kd(^V), kl(^B), kr(^L), ku(^K), and cl=\E+ and deleted are ma, ko(dc) +# following delays are added for appropriate operations +# al = dl= 1.5 ms, ce = cd = 0.4 ms, cl = 38 ms; sr is deleted. +km|kt7ix|kimtron kt-7:\ + :am:bs:co#80:li#25:cm=\E=%+ %+ :cl=38\E+:cd=0.4*\EY:ce=0.4\ET:\ + :al=1.5*\EE:dl=1.5*\ER:im=:ei=:ic=\EQ:dc=\EW:if=/usr/share/lib/tabset/stdcrt:\ + :ho=^^:nd=^L:bt=\EI:pt:so=\EGD:se=\EG@:us=\EGH:ue=\EG@:\ + :up=^K:do=^V:kb=^H:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C:kh=^^:\ + :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\ + :k8=^AG\r:k9=^AH\r:k0=^AI\r:ko=ic,al,dl,cl,ce,cd,bt:\ + :EN=0.4*\EY:BE=^G:\ + :GS=\E$:GE=\E%:LD=\ER:PD=\EJ:PU=\EK:TB=^I:\ + :GV=3:GH=D:GU=A:GD=B:GC=E:GL=C:GR=4:\ + :G1=?:G2=Z:G3=@:G4=Y:\ + :ES=\EGD:EE=\EG@:\ + :BS=^H:KO=\E>:KF=\E<:\ + :CO=\E.3:CF=\E.0:MP=\E1: +m7|mt70|morrow|morrow mt70:\ + :ae=\E%:al=\EE:am:as=\E$:bl=^G:bs:bt=\EI:bw:cr=^M:ce=\ET:\ + :cm=\E=%+\040%+\040:cl=\E*:cd=\EY:co#80:do=^J:dc=\EW:dl=\ER:\ + :ei=:ho=^^:ic=\EQ:im=:is=\EX\E"5\EJ0\E@0\E%\E]:k0=^A@\r:\ + :k1=^AA\r:k2=^AB\r:k3=^AC\r:k4=^AD\r:k5=^AE\r:k6=^AF\r:\ + :k7=^AG\r:k8=^AH\r:k9=^AI\r:kb=^H:kd=^AK\r:kl=^AL\r:kr=^AM\r:\ + :ku=^AJ\r:le=^H:li#24:ma=^Jj^Kk^Hh:nd=^L:nl=^J:pt:se=\EG0:\ + :so=\EG4:up=^K:us=\EG1:ue=\EG0:vb=\EK1\EK0:ve=\E"5:vs=\E"2: +### Submitted by August Mohr, written at RDS +FT|fos|fortune|Fortune system:\ + :is=^_..:li#25:co#80:am:bs:bw:cl=20^L:cd=3*^\Y:\ + :ic=5^\Q:dc=5^\W:im=:ei=:dl=15^\R:al=15^\E:cm=^\C%+ %+ :\ + :ta=^Z:ho=10^^:do=3^J:up=3^K:bs=^H:kb=^H:kd=^Ay:\ + :kh=^A?:kl=^Aw:kr=^Az:ku=^Ax:nl=5^J: +### The following entries were taken (more or less verbatim) from +### MS V 2.2 freeze tape. Fixes were missing ":"s and duplicate names. +### +# +# +g2|1200|tn1200|terminet 1200:\ + :co#120:hc:os: +g3|300|tn300|terminet 300:\ + :co#120:hc:os: +### Comment below taken verbatim from MS source. I don't know what it +### means either. +# The A manufacturer represents Diablo, DTC, Xerox, Qume, and other Daisy +# wheel terminals until such time as termcap distinguishes between them +# enough to justify separate codes. +# 1620 uses all 132 columns, 1640 sets left margin to 8 and uses snazzy +# binary tabset file. Both should work on both terminals. +A6|1620|450|diablo 1620:\ + :if=/usr/share/lib/tabset/std:\ + :kb=^H:bs:co#132:ff=^L:hc:hu=\EU:hd=\ED:os:pt:up=\E\n: +A7|1640|diablo 1640:\ + :co#124:if=/usr/share/lib/tabset/diablo:tc=1620: +Ad|dtc300s|300s|gsi|dtc|dtc 300s:\ + :if=/usr/share/lib/tabset/std:\ + :kb=^h:bs:co#132:ff=^L:hc:hu=\EH:hd=\Eh:os:pt:up=^Z: +l2|adm2|lsi adm2:\ + :al=\EE:am:bs:cd=\EY:ce=\ET:cl=\E;:cm=\E=%+ %+ :co#80:dc=\EW:dl=\ER:\ + :ei=:ho=^^:ic=\EQ:im=:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:li#24:nd=^L:up=^K: +Z1|adm5|5|lsi adm5:\ + :cr=^M:do=^J:nl=^J:bl=^G:\ + :cd=\EY:ce=\ET:do=^J:kb=^H:kh=^^:\ + :ME=^G:BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=\036:\ + :ma=^Hh^Jj^Kk^Ll^^H:se=\EG:sg#1:so=\EG:tc=adm3aplus: +Aj|aj830|aj832|aj|anderson jacobson:\ + :bs:hc:hd=\E9:hu=\E8:os:pl:up=\E7: +qc|carlock|klc:\ + :al=^E:am:bs:ce=^U:cl=100^Z:cm=\E=%+ %+ :co#80:dc=\177:dl=^D:dm=:\ + :ed=:ei=^T:ho=^^:im=^T:li#24:nd=^L:se=^V:so=^V:up=^K:vb=\EV\EV: +Mi|cdi|cdi1203:\ + :am:bs:hc:os:co#80:cD#200: +Mg|dg|dg6053|data general 6053:\ + :ca:am:bs:cm=^P%r%.%.:cl=^L:ho=^H:nd=^S:\ + :up=^W:ce=^K:co#80:li#24: +dI|dw1|decwriter I:\ + :bs:co#72:hc:os: +dw|dw2|dw3|dw4|decwriter II:\ + :kb=^h:bs:co#132:hc:os: +d4|gt40|dec gt40:\ + :bs:co#72:ns:li#30:os: +d2|gt42|dec gt42:\ + :bs:co#72:ns:li#40:os: +# Be sure the auto lf/cr switch is set to cr. +H2|h1552|hazeltine 1552:\ + :al=\EE:dl=\EO:f1=\EP:l1=blue:f2=\EQ:l2=red:f3=\ER:l3=green:tc=vt52: +H3|h1552rv|hazeltine 1552 reverse video:\ + :so=\ES:se=\ET:tc=h1552: +# Note: h2000 won't work well because of a clash between upper case and ~'s. +H7|h2000|hazeltine 2000:\ + :al=6~^z:am:bs:cl=6~^\:cm=~^q%r%.%.:co#74:\ + :dl=6~^s:ho=~^r:li#27:nc:pc=\177: +i1|i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100):\ + :cl=^L:cd=\EJ:ce=\EK:li#24:co#80:\ + :al=\EL:dl=\EM:up=\EA:nd=\EC:ho=\EH:cm=\Ef%r%+ %+ :vb=\Eb\Ea:am:bs:\ + :so=\Eb:se=\Ea: +MZ|m100|m-100|radio shack model 100:\ + :am:bs:le=^H:li#8:co#40:\ + :ku=^^:kd=^_:kl=^]:kr=^\:up=\EA:nd=\EC:ho=\EH:ce=\EK:\ + :cd=\EJ:cl=\EE:xt:cm=\EY%+ %+ :\ + :so=\Ep:se=\Eq:al=\EL:dl=\EM: +My|mdl110|cybernex mdl-110:\ + :cm=^P%+ %+ :co#80:li#24:am:cl=70^X:bs:\ + :nd=^U:up=^Z:ho=^Y:ce=145^N@^V:cd=145^NA^W:al=65^NA^N^]:\ + :dl=40^NA^N^^:im=:\ + :ei=:ic=3.5^NA^]:dm:ed:dc=3.5^NA^^:so=^NF:se=^NG:ta=43\t:\ + :ma=^Z^P:cd=6^N@^V: +qn|netx|netronics:\ + :bs:cd=2000^F^E:ce=1600^E:cl=466^L:cm=\E=%+@%+@:co#64:ho=^D:\ + :li#16:ma=j^Jk^Pl :nd=\E+@A:pc=\200:sr=\E=@@^K:up=^K: +qN|nucterm|rayterm|NUC homebrew:\ + :am:bs:cl=1^L:li#24:co#80:nd=^C:up=^N:ho=^B:ll=^K:ce=^A:cd=^E: +Mo|omron|Omron 8025AG:\ + :al=\EL:am:bs:cd=\ER:co#80:ce=\EK:cl=\EJ:da:db:dc=\EP:dl=\EM:\ + :ho=\EH:li#24:nd=\EC:se=\E4:sf=\ES:so=\Ef:sr=\ET:up=\EA:ve=:vs=\EN: +p5|pe550|perkin elmer 550:\ + :am:bs:ce=\EI:cl=\EK:co#80:do=\EB:li#24:up=\EA:nd=\EC:\ + :ho=\EH:cm=\EX%+ \EY%+ : +Mp|plasma|plasma panel:\ + :am:bs:cl=^L:co#85:ho=^^:li#45:nd=\030:up=\026: +Aq|qume5|qume|Qume Sprint 5:\ + :if=/usr/share/lib/tabset/std:\ + :kb=^h:bs:co#80:ff=^L:hc:hu=\EH:hd=\Eh:os:pt:up=^Z: +# Regent 20 +a2|regent20|adds regent 20:\ + :cd=\Ek:ce=\EK:cm=\EY%+ %+ :tc=regent: +# Regent 40 +a4|regent40|adds regent 40:\ + :al=\EM:dl=\El:is=\EB:se=\E0@:so=\EOP:ue=\EO@:us=\E0`:vb=\ED\Ed:\ + :tc=regent25: +# If you have standout problem with regent 200, try so=\ER\EOP:se=\E0@\EV: +a6|regent60|regent200|adds Regent 60:\ + :dc=\EE:ei=\EF:im=\EF:is=\EV\EB:ko=dc,im,ei:tc=regent40: +a7|regent60na|regent 60 w/no arrow keys:\ + :kl@:kr@:ku@:kd@:tc=regent60: +sw|switch|intelligent switch:\ + :co#80:os:am: +Ms|swtp|ct82|southwest technical products ct82:\ + :am:bs:bc=^d:al=^\^y:cd=^v:ce=^F:cl=^L:cm=%r^k%.%.:co#82:li#20:\ + :dl=^z:nd=^s:up=^a:so=^^^v:se=^^^F:dc=^\^h:ic=^\^x:ho=^p:\ + :ei=:sf=^n:sr=^o:ll=^c:im=:\ + :is=^\^r^^^s^^^d^]^w^i^s^^^]^^^o^]^w^r^i: +Xb|tek4013|4013|tektronix 4013:\ + :as=\E^N:ae=\E^O:tc=4012: +Xd|tek4015|4015|tektronix 4015:\ + :as=\E^N:ae=\E^O:tc=4014: +Xf|tek4015sm|4015sm|tektronix 4015 in small font:\ + :as=\E^N:ae=\E^O:tc=4014sm: +Mk|teletec|tec|Teletec Datascreen:\ + :am:bs:co#80:cl=^l:ho=^^:li#24:nd=^_:up=^k: +Mt|terak|Terak emulating Datamedia 1520:\ + :tc=dm1520: +t4|ti745|745|743|ti silent 745:\ + :bs:co#80:hc:os: +t3|ti|ti700|ti733|735|ti735|ti silent 700:\ + :bs:co#80:hc:os:dC#162: +r6|trs16|trs-80 model 16 console:\ + :al=\EL:am:bs:cd=\EJ:ce=\EK:cl=^L:cm=\EY%+ %+ :co#80:dc=\EQ:dl=\EM:\ + :do=\EB:ei=:ic=\EP:ho=\EH:im=:kb=^H:kd=\EB:kl=\ED:kn#2:kr=\EC:\ + :ku=\EA:k0=^A:k1=^B:l0=f1:l1=f2:li#24:nd=\EC:pt:se=\ER@:sg#0:so=\ERD:\ + :up=\EA:GS=\ERG:GE=\ERg:GV=s:GH=u:GU=e:GD=c:G1=`:G2=_:G3=b:G4=a:\ + :CO=\ERC:CF=\ERc: +d3|vt132|vt-132:\ + :al=99\E[L:dl=99\E[M:ip=7:dc=7\E[P:ei=\E[4h:im=\E[4l:xn:dN#30:tc=vt100: +d5|vt50|dec vt50:\ + :bs:cd=\EJ:ce=\EK:cl=\EH\EJ:co#80:li#12:nd=\EC:pt:up=\EA: +dh|vt50h|dec vt50h:\ + :bs:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :co#80:li#12:nd=\EC:\ + :pt:sr=\EI:up=\EA: +qx|xitex|xitex sct-100:\ + :bs:cd=2000^F^E:ce=1600^E:cl=400^L:cm=\E=%+@%+@:co#64:ho=^D:\ + :li#16:ma=j^Jk^Pl :nd=\E+@A:pc=\200:sr=\E=@@^K:up=^K: +kc|z29|h29|zenith z29:\ + :ic=2*:dc=2*\EN:tc=h19: +ZZ|zen50|z50|Cobra|zentec 50:\ + :cm=\E=%+ %+ :cd=\EY:co#80:li#24:\ + :am:al=\EE:ce=\ET:dc=\EW:dl=\ER:ic\EQ:im=:ie=:\ + :cl=\E;:\ + :sg#1:se=\EG0:so=\EG4:\ + :kl=^H:kr=^L:ku=^K:kd=^J:kh=\036:\ + :up=^K:\ + :BS=^U:CL=^V:CR=^B:RK=^L:UK=^K:LK=^H:DK=^J:HM=\036: +Zf|zen40|z40|zentec 40:\ + :am:co#80:li#24:ce=1.0*\EK:cl=\EH\EJ:\ + :bc=\ED:cd=\EJ:nd=\EC:up=\EA:ho=\EH:bw:do=\EB: + +# +# Teletype (from AT&T termcap) +# + +T0|40|tty40|ds40|ds40/2|ds40-2|dataspeed40|teletype dataspeed 40/2:\ + :cl=160\ER:cd=160\EJ:al=160\EL:dl=160\EM:dc=50\EP:im=:ei=:ic=50\E\^:\ + :nd=\EC:up=\E7:bs:cr=\EG:nl=\EG\EB:do=\EB:co#80:li#24:vb=:so=\E3:se=\E4: + +T3|33|tty33|tty|model 33 teletype:\ + :cr=^M:do=^J:nl=^J:bl=^G:co#72:hc:os: + +T4|43|tty43|model 43 teletype:\ + :cr=^M:do=^J:nl=^J:bl=^G:kb=^h:am:le=^H:bs:hc:os:co#132: + +T7|37|tty37|model 37 teletype:\ + :cr=^M:do=^J:nl=^J:bl=^G:le=^H:bs:hc:hu=\E8:hd=\E9:up=\E7:os: + +4420|tty4420|teletype 4420:\ + :db:eo:ms:ul:bs:nc:co#80:li#24:kn#6:al=\EL:bl=^G:cd=\EJ:ce=\Ez:\ + :cl=\EH\EJ:cm=\EY%+ %+ :cr=\EG:dc=\EP:dl=\EM:do=\EB:k0=\EU:k3=\E@:\ + :kA=\EL:kC=\EJ:kF=\ES:kL=\EM:kR=\ET:kd=\EB:kh=\EH:kl=\b:kr=\EC:ku=\EA:\ + :l0=segment advance:l3=cursor tab:le=\b:nd=\EC:se=\E~:sf=\EH\EM\EY7 :\ + :so=\E}:ue=\EZ:up=\EA:us=\E\\:vs=\ER:nl=\EB:ko=le,do,nd,up,dl,al: + +4424|tty4424|4424-1|4424-3|teletype 4424:\ + :am:bs:pt:co#80:li#24:kn#4:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:\ + :IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=\E(B:al=\EL:as=\E(0:bl=^G:\ + :bt=\EO:cd=\EJ:ce=\Ez:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=\r:cs=\E[%i%d;%dr:\ + :ct=\EF:dc=\EP:dl=\EM:do=\EB:ho=\E[H:ic=\E\^:is=\E[20l\E[?7h:k1=\EOP:\ + :k2=\EOQ:k3=\EOR:k4=\EOS:kb=\b:kd=\EB:kh=\E[H:kl=\ED:kr=\EC:ku=\EA:\ + :le=\b:mb=\E3:md=\E3:me=\EX\E~\EZ\E4:mh=\EW:mr=\E}:nd=\EC:nw=\EE:\ + :se=\E~:sf=\n:so=\E}:sr=\ET:st=\EH:ta=\t:ti=\E[1m:ue=\EZ:up=\EA:\ + :us=\E\\:nl=\EB:ko=do,nd,up,ho: + +4424-2|tty4424-w|teletype 4424 in display function group ii:\ + :mr@:ul@:tc=4424: + +5410|tty5410|att5410|4410|att4410|Teletype 5410 terminal in 80 column mode:\ + :am:hs:mi:ms:xo:bs:pt:Nl#8:co#80:it#8:lh#2:li#24:lw#8:ws#80:kn#3:ae=^O:\ + :al=\E[L:as=^N:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=\r:\ + :i2=\E[1;03q f1 \EOP\E[2;03q f2 \EOQ\E[3;03q f3 \EOR\E[4;03q f4 \EOS\E[5;03q f5 \EOT\E[6;03q f6 \EOU\E[7;03q f7 \EOV\E[8;03q f8 \EOW:\ + :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=\n:fs=\E8:ho=\E[H:ic=\E[@:k1=\EOP:\ + :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:kC=\E[2J:\ + :kH=\E[24;1H:kb=\b:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=\b:\ + :ll=\E[24H:mb=\E[5m:md=\E[2;7m:me=\E[m^O:mh=\E[2m:mk=\E[8m:mr=\E[7m:\ + :nd=\E[C:nw=\r\n:r2=\Ec\E[?3l\E[2;0y:rc=\E8:sc=\E7:se=\E[m:sf=\n:\ + :so=\E[7m:sr=\EM:ta=\t:ts=%i\E7\E[25;%dH:ue=\E[m:up=\E[A:us=\E[4m:\ + :ko=nd,up,ho: + +tty5410-nfk|5410-nfk|version 1 tty5410 entry without function keys:\ + :i2@:k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:tc=tty5410: + +5410-w|tty5410-w|att5410-w|4410-w|att4410-w|Teletype 5410 in 132 column mode:\ + :co#132:r2=\E[?3:ws#132:tc=tty5410: + +att5620|ATT5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns @(#)5620.ti 1.1:\ + :am:xo:bs:pt:\ + :co#88:li#70:kn#4:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:SF=\E[%dS:\ + :SR=\E[%dT:al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:ho=\E[H:ic=\E[@:kb=\b:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:\ + :r1=\Ec:rc=\E8:sc=\E7:se=\E[0m:so=\E[7m:sr=\E[T:\ + :ue=\E[0m:up=\E[A:us=\E[4m:nl=\E[B:ko=do,nd,up,ho: + +5420|tty5420|att5420|4415|att4415|Teletype 5420 in 80 column mode:\ + :am:db:hs:mi:ms:xo:bs:pt:co#80:it#8:li#24:lm#78:ws#55:kn#7:AL=\E[%dL:\ + :CM=\E[%i%d;%dt:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:\ + :LF=\E|:LO=\E~:RI=\E[%dC:SF=\E[%dE:SR=\E[%dF:UP=\E[%dA:ae=^O:al=\E[L:\ + :as=^N:cd=\E[J:ce=\E[K:ch=\E[%i%dG:cl=\E[x\E[J:cm=\E[%i%d;%dx:\ + :cs=\E[%i%d;%dr:ct=\E[3g:cv=\E[%i%dd:dc=\E[P:dl=\E[M:ei=\E[4l:fs=\E8:\ + :ho=\E[x:im=\E[4h:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:\ + :k7=\EOi:k8=\EOj:kA=\E[L:kB=\E[Z:kC=\E[2J:kD=\E[P:kE=\E[2K:kF=\E[T:\ + :kH=\Eu:kI=\E[4h:kL=\E[M:kN=\E[U:kP=\E[V:kR=\E[S:kb=\b:kd=\E[B:\ + :ke=\E[19;0j:kh=\E[H:kl=\E[D:kr=\E[C:ks=\E[19;1j:ku=\E[A:le=\b:ll=\Ew:\ + :mb=\E[5m:md=\E[2;7m:me=\E[0m^O:mh=\E[2m:mk=\E[8m:mp=\EV:mr=\E[7m:\ + :nd=\E[C:rc=\E8:sc=\E7:se=\E[m:so=\E[7m:sr=\EM:st=\EH:te=\Ez:ue=\E[m:\ + :up=\E[A:us=\E[4m:ko=bt,nd,up,dc,dl,im,al: + +5420-w|tty5420-w|att5420-w|4415-w|att4415-w|teletype model 5420 in 132 column mode:\ + :lm#54:co#132:ws#97:i1=100\E[?3h:tc=tty5420: + +5420-rv|tty5420-rv|att5420-rv|4415-rv|att4415-rv|teletype model 5420 80 columns in reverse video:\ + :i2=\E[?5h:tc=tty5420: + +5420-w-rv|tty5420-w-rv|att5420-w-rv|4415-w-rv|att4415-w-rv|teletype model 5420 132 columns in reverse video:\ + :lm#54:co#132:ws#97:i1=100\E[?3h:i2=\E[?5h:tc=tty5420: + +513|att513|bct513|AT&T-IS 513 Business Communications Terminal 80 columns:\ + :am:da:db:mi:xn:xo:bs:pt:Nl#8:co#80:lh#2:li#24:lm#72:lw#8:kn#4:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:LF=\E<:LO=\E?:\ + :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:\ + :ch=\E[%i%dG:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=\r:ct=\E[3g:cv=\E[%i%dd:\ + :dc=\E[P:dl=\E[M:do=\n:ei=\E[4l:ho=\E[H:k1=\EOc:k2=\EOd:k3=\EOe:\ + :k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:kB=\E[Z:kC=\E[J:kD=\ENf:\ + :i1=\Ec\E?\E[10;0;3;3|\E[21;1|\212:im=\E[4h:ip=2:kE=\EOa:kF=\E[S:\ + :kI=\ENj:kL=\ENe:kM=\ENj:kN=\E[U:kP=\E[V:kR=\E[T:kb=\b:kd=\E[B:\ + :ke=\E[19;0|:kh=\E[H:kl=\E[D:kr=\E[C:ks=\E[19;1|:ku=\E[A:le=\b:\ + :ll=\E[24H:mb=\E[5m:md=\E[2;7m:me=\E[m^O:mh=\E[2m:mk=\E[8m:mr=\E[7m:\ + :nd=\E[C:nw=\EE:pf=\E[?98l\E[4i:po=\E[?98l\E[8i:ps=\E[?98l\E[0i:\ + :r2=\E[5;0|:r3=\E[2;0;6;0;8;0;19;0|\E(A\E)1:se=\E[m:sf=\n:so=\E[7m:\ + :sr=\EM:st=\EH:ta=\t:ue=\E[m:up=\E[A:us=\E[4m:ko=bt,nd,up,ho: + +513-w|att513-w|bct513-w|AT&T-IS 513 Business Communications Trminal 132 columns:\ + :r2=\E[5;1|:tc=att513: + +att515|515|bct515|AT&T-IS 515 terminal in native mode:\ + :tc=att513: + +TB|bct500|tty5541|teletype 5541:\ + :co#80:li#24:am:cl=\E[2J:bs:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:ce=\E[K:\ + :cd=\E[J:dl=\E[M:da:db:al=\EL:im=:ei=:ic=\E\^:mi:dc=\E[P:so=\E[7m:\ + :se=\E[m:us=\E[4m:uc=\E[m:kl=\E[D:kr=\E[C:kd=\E[B:ku=\E[A:kh=\E[H:pt:\ + :st=\ET:tc=4424: + +# +# misc. other terminals from AT&T +# + +I8|8001|ISC8001|compucolor|intecolor:\ + :cr=^M:do=^J:nl=^J:bl=^G:\ + :al=\EU:am:le=^Z:bc=^Z:cl=3*^L:cm=^C%r%.%.:co#80:cd=\EQ:dm=\EQ:ed=\EF:\ + :dc=\177:dl=\EV:ei=\EF:im=\EQ:li#40:nd=1^Y:ta=8\t:up=^\:ho=1^H:pc=^@: + +IG|compucolor2|compucolorII|MC|Compucolour II:\ + :cr=^M:do=^J:nl=^J:bl=^G:\ + :ta=^I:pt:am:cm=%r^C%.%.:le=^Z:bc=^Z:li#32:co#64:\ + :cl=^L:ho=^H:nd=^Y:up=^\: + +I9|ibm|ibm3101|3101|i3101|IBM 3101-10:\ + :cr=^M:do=^J:nl=^J:bl=^G:ct=\EH:st=\E0:\ + :.if=/usr/share/lib/tabset/3101:\ + :am:le=^H:bs:cl=\EK:li#24:co#80:nd=\EC:up=\EA:cd=\EJ:ce=\EI:\ + :kd=\EB:kl=\ED:kr=\EC:ku=\EA:ho=\EH:cm=\EY%+\40%+\40:ta=^I:pt: + +T8|5420132|5420 132columns:\ + :co#132:li#24:\ + :tc=5420: + +z1|5410|5410 terminal 80 columns:\ + :co#80:li#24:am:cl=\E[;H\E[2J:bs:\ + :cm=\E[%i%d;%dH:nd=\E[C:\ + :up=\E[A:ce=\E[K:cd=\E[J:al=\E[L:\ + :dl=\E[M:ic=\E[@:dc=\E[P:so=\E[7m:\ + :im=:ei=:\ + :se=\E[m:us=\E[4m:ue=\E[m:\ + :kd=\E[B:kl=\E[D:kr=\E[C:\ + :ku=\E[A:kh=\E[H: + +z2|5410132|5410 132 columns:\ + :co#132:|i#24:\ + :tc=5410: + +605|605bct|ATT605|att605|AT&T 605 80 column 102 key keyboard @(#)605.ti 1.1:\ + :am:es:hs:mi:ms:xn:xo:bs:pt:\ + :co#80:li#24:kn#5:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\ + :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ + :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:ei=\E[4l:fs=\E8:\ + :ho=\E[H:\ + :i1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0:\ + :im=\E[4h:is=\E[0m^O:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:\ + :k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kb=\b:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:\ + :r2=\Ec\E[?3l:rc=\E8:sc=\E7:se=\E[m:so=\E[7m:sr=\EM:\ + :ts=\E7\E[25;%i%dx:ue=\E[m:up=\E[A:us=\E[4m:\ + :vb=200\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ + :vs=\E[?12;25h:nl=\E[B:ko=bt,do,nd,up,ho: + +610|610bct|ATT610|att610|AT&T 610; 80 column; 98key keyboard @(#)610.ti 1.4:\ + :am:es:hs:mi:ms:xn:xo:bs:pt:\ + :co#80:li#24:kn#5:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\ + :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ + :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:ei=\E[4l:fs=\E8:\ + :ho=\E[H:\ + :i1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0:\ + :im=\E[4h:is=\E[0m^O:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:\ + :k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kb=\b:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:\ + :r2=\Ec\E[?3l:rc=\E8:sc=\E7:se=\E[m:so=\E[7m:sr=\EM:\ + :ts=\E7\E[25;%i%dx:ue=\E[m:up=\E[A:us=\E[4m:\ + :vb=200\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ + :vs=\E[?12;25h:nl=\E[B:ko=bt,do,nd,up,ho: + +615|615mt|ATT615|att615|AT&T 615; 80 column; 98key keyboard @(#)615.ti 1.3:\ + :am:es:hs:mi:ms:xn:xo:bs:pt:\ + :co#80:li#24:kn#5:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\ + :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ + :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:ei=\E[4l:fs=\E8:\ + :ho=\E[H:\ + :i1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0:\ + :im=\E[4h:is=\E[0m^O:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:\ + :k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kb=\b:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:\ + :r2=\Ec\E[?3l:rc=\E8:sc=\E7:se=\E[m:so=\E[7m:sr=\EM:\ + :ts=\E7\E[25;%i%dx:ue=\E[m:up=\E[A:us=\E[4m:\ + :vb=200\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ + :vs=\E[?12;25h:nl=\E[B:ko=bt,do,nd,up,ho: + +620|620mtg|ATT620|att620|AT&T 620; 80 column; 98key keyboard @(#)620.ti 1.3:\ + :am:es:hs:mi:ms:xn:xo:bs:pt:\ + :co#80:li#24:kn#5:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=\E(B^O:al=\E[L:\ + :as=\E)0^N:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=\E[%i%d;%dH:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:\ + :ei=\E[4l:fs=\E8:ho=\E[H:\ + :i1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h:\ + :im=\E[4h:is=\E[0m^O:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:\ + :k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kb=\b:\ + :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:\ + :r2=\Ec\E[?3l:rc=\E8:sc=\E7:se=\E[m:so=\E[7m:sr=\EM:\ + :ts=\E7\E[25;%i%dx:ue=\E[m:up=\E[A:us=\E[4m:\ + :vb=200\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ + :vs=\E[?12;25h:nl=\E[B:ko=bt,do,nd,up,ho: + +630|att630|5630|5630DMD|630MTG|AT&T 630 windowing terminal @(#)630.ti 1.4:\ + :am:da:db:mi:ms:xo:bs:pt:\ + :co#80:li#60:kn#8:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ + :al=\E[L:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ + :cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:ei=\E[4l:ho=\E[H:\ + :im=\E[4h:is=\E[m:k9=\ENo:kb=\b:kd=\E[B:kh=\E[H:\ + :kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:r2=\Ec:rc=\E8:sc=\E7:\ + :se=\E[m:so=\E[7m:sr=\EM:ue=\E[m:up=\E[A:us=\E[4m:\ + :nl=\E[B:ko=bt,do,nd,up,dc,dl,ho,al: + +AT386|at386|at/386 console:\ + :am:bw:eo:xo:xt:bs:\ + :co#80:li#25:kn#4:\ + :ae=^P:al=\E[1L:cd=\E[0J:ce=\E[0K:cl=\E[2J\E[H:\ + :cm=\E[%i%2;%2H:ct=\E[3g:dc=\E[1P:dl=\E[1M:ho=\E[H:\ + :ic=\E[1@:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:\ + :k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:kb=\b:kd=\E[B:\ + :kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:se=\E[m:\ + :so=\E[7m:st=\EH:ue=\E[m:up=\E[A:us=\E[4m:nl=\E[B:\ + :ko=do,nd,up,ho: + +AT386-M|at386-m|386AT-M|386at-m|at/386 console:\ + :am:bw:eo:xo:xt:pt:\ + :co#80:li#25:kn#6:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:\ + :.SF=!!! MUST CHANGE BY HAND !!!\E[%P1%dS:SR=\E[S:\ + :UP=\E[%dA:ae=\E[10m:al=\E[1L:as=\E[12m:cd=\E[J:\ + :ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%2;%2H:dc=\E[P:dl=\E[1M:\ + :ho=\E[H:ic=\E[1@:is=\E[0;10;38m:k1=\EOP:k2=\EOQ:\ + :k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:\ + :k9=\EOX:kb=\b:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:\ + :ku=\E[A:nd=\E[C:se=\E[m:so=\E[7m:ue=\E[m:up=\E[A:\ + :us=\E[4m:vb=^G:bc=\E[D:nl=\E[B:ko=le,do,nd,up,dc,ho: + +ATT4425|ATT5425|att5425|4425|5425|tty5425|att4425|AT&T 4425/5425:\ + :am:da:db:hs:mi:ms:xn:xo:bs:pt:\ + :co#80:li#24:kn#8:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:\ + :.SF=!!! MUST CHANGE BY HAND !!!\n\E[K%p1%{1}%-%Pa\E[%ga%dL\E[%ga%dE:\ + :SR=\E[%dF:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bt=\E[Z:\ + :cd=\E[J:ce=\E[K:\ + :.ch=!!! MUST CHANGE BY HAND !!!\E[%p1%{1}%+%dG:\ + :cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\ + :.cv=!!! MUST CHANGE BY HAND !!!\E[%p1%{1}%+%dd:\ + :dc=\E[P:dl=\E[M:ei=\E[4l:fs=\E8:ho=\E[H:\ + :i1=100\E<\E[?3l:im=\E[4h:\ + :is=\E[0m^O\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212:\ + :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:\ + :k7=\EOi:k8=\EOj:kb=\b:kd=\E[B:\ + :ke=\E[21;0j\E[25;1j\212:kh=\E[H:kl=\E[D:kr=\E[C:\ + :ks=\E[21;1j\E[25;4j\Eent\E~:ku=\E[A:nd=\E[C:\ + :r2=\Ec\E[?3l\E[2;0y:rc=\E8:sc=\E7:se=\E[m:so=\E[7m:\ + :sr=\EM:st=\EH:\ + :.ts=!!! MUST CHANGE BY HAND !!!\E7\E[25;%p1%{8}%+%dH:\ + :ue=\E[m:up=\E[A:us=\E[4m:vb=200\E[?5h\E[?5l:\ + :ve=\E[12;0j:vs=\E[12;1j:ko=bt,nd,up,dc,dl,ho,im,al: + +xterm|vs100|xterm terminal emulator:\ + :am:km:mi:ms:xn:pt:\ + :co#80:li#65:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\ + :cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\ + :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:ho=\E[H:\ + :ic=\E[@:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:kb=\b:\ + :kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ + :ku=\EOA:nd=\E[C:\ + :r1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H:\ + :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:sc=\E7:\ + :se=\E[m:so=\E[7m:sr=\EM:st=\EH:te=\E@0\E[?4r:\ + :ti=\E@0\E[?4s\E[?4h\E@1:up=\E[A:bc=\E[1D: + +xterms|vs100s|xterm terminal emulator (small screen 24x80):\ + :am:km:mi:ms:xn:pt:\ + :co#80:li#24:\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ + :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\ + :cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\ + :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:ho=\E[H:\ + :ic=\E[@:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ + :k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:kb=\b:\ + :kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ + :ku=\EOA:nd=\E[C:\ + :r1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H:\ + :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:sc=\E7:\ + :se=\E[m:so=\E[7m:sr=\EM:st=\EH:te=\E@0\E[?4r:\ + :ti=\E@0\E[?4s\E[?4h\E@1:up=\E[A:bc=\E[1D: + +# Naming Convention: +# - First entry is two chars, first char indicates manufacturer, +# second char represents canonical abbreviation for model or mode. +# - Second entry is canonical abbreviation. +# - Third entry is the one the editor will print with "set" command. +# - Last entry is a verbose description of the terminal. +# - Other entries are mnemonic synonyms for the terminal. +# +# If an application absolutely MUST check for a specific terminal +# (this is discouraged) check for the 2nd entry (the canonical form) +# since all other codes are subject to change. +# +# Special manufacturer codes: +# M: Misc. (with only a few terminals) +# q: Homemade +# s: special (dialup, etc.) +# diff --git a/usr/src/lib/terminfo/terminfo.mk b/usr/src/lib/terminfo/terminfo.mk new file mode 100644 index 0000000..b444f2c --- /dev/null +++ b/usr/src/lib/terminfo/terminfo.mk @@ -0,0 +1,89 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:terminfo.mk 1.10" +# +# terminfo makefile +# + +ROOT= +TERMDIR=$(ROOT)/usr/share/lib/terminfo +TABDIR=$(ROOT)/usr/share/lib/tabset +TERMCAPDIR=$(ROOT)/usr/share/lib +PARTS= header *.ti trailer +COMPILE=tic -v + +all: ckdir terminfo.src + TERMINFO=$(TERMDIR) 2>&1 $(COMPILE) terminfo.src > errs + @touch install + @echo + @sh ./ckout + @echo + @echo + @echo + cp tabset/* $(TABDIR) + cp *.ti $(TERMDIR)/ti + cp termcap $(TERMCAPDIR) + +install: all + +terminfo.src: $(PARTS) + @cat $(PARTS) > terminfo.src + +clean: + rm -f terminfo.src install errs nohup.out + +clobber: clean + +ckdir: + @echo "terminfo database will be built in $(TERMDIR)." + @echo "checking for the existence of $(TERMDIR):" + @echo + @if [ -d $(TERMDIR) ]; \ + then \ + echo "\t$(TERMDIR) exists"; \ + else \ + echo "\tbuilding $(TERMDIR)"; \ + mkdir $(TERMDIR); \ + $(CH)chown bin $(TERMDIR); \ + $(CH)chgrp bin $(TERMDIR); \ + chmod 775 $(TERMDIR); \ + fi + @echo + @echo + @echo + @echo "terminfo database will reference file in $(TABDIR)." + @echo "checking for the existence of $(TABDIR):" + @echo + @if [ -d $(TABDIR) ]; \ + then \ + echo "\t$(TABDIR) exists"; \ + else \ + echo "\tbuilding $(TABDIR)"; \ + mkdir $(TABDIR); \ + $(CH)chown bin $(TABDIR); \ + $(CH)chgrp bin $(TABDIR); \ + chmod 775 $(TABDIR); \ + fi + @echo + @echo + @echo "terminfo source files will be installed in $(TERMDIR)/ti." + @echo "checking for the existence of $(TERMDIR)/ti:" + @echo + @if [ -d $(TERMDIR)/ti ]; \ + then \ + echo "\t$(TERMDIR)/ti exists"; \ + else \ + echo "\tbuilding $(TERMDIR)/ti"; \ + mkdir $(TERMDIR)/ti; \ + $(CH)chown root $(TERMDIR)/ti; \ + $(CH)chgrp root $(TERMDIR)/ti; \ + chmod 775 $(TERMDIR)/ti; \ + fi + @echo + @echo It will take quite some time to generate $(TERMDIR)/*/*. + @echo diff --git a/usr/src/lib/terminfo/ti.ti b/usr/src/lib/terminfo/ti.ti new file mode 100644 index 0000000..8f20d56 --- /dev/null +++ b/usr/src/lib/terminfo/ti.ti @@ -0,0 +1,20 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:ti.ti 1.3" +# # -------------------------------- +# +# ti: TEXAS INSTRUMENTS +# +# Manufacturer: TEXAS INSTRUMENTS +# Class: II +ti700|ti733|735|ti735|ti silent 700, + cr=^M$<162>, use=ti745, +ti|ti745|745|743|ti silent 745, + cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, cols#80, hc, os, +ti800|ti omni 800, + cols#132, use=ti745, diff --git a/usr/src/lib/terminfo/trailer b/usr/src/lib/terminfo/trailer new file mode 100644 index 0000000..5c95b78 --- /dev/null +++ b/usr/src/lib/terminfo/trailer @@ -0,0 +1,69 @@ +#ident "@(#)terminfo:trailer 1.7" +# # ------------------------ +# +# The following have been included for upward compatibility with previous +# names. They are considered obsolete and the new name (which typically +# contains an extra dash) should be used instead. These names will go +# away eventually (read: "soon") so you should start converting! +# +tvi9122p|9122p|, use=912-2p, +tvi9202p|9202p|, use=920-2p, +tvi9502p|9502p|, use=950-2p, +tvi9504p|9504p|, use=950-4p, +tvi950rv|950rv|, use=950-rv, +tvi950rv2p|950rv2p|, use=950-rv-2p, +tvi950rv4p|950rv4p|, use=950-rv-4p, +aaa-29|, use=aaa-30-s, +aaa-29-ctxt|, use=aaa-30-s-ctxt, +aaa-29-np|, use=aaa-30-s, +aaa-29-rv|, use=aaa-30-s-rv, +aaa-29-rv-ctxt|, use=aaa-s-rv-ctxt, +aaa-59|, use=aaa-60-s, +aaa18|, use=aaa-18, +aaa20|, use=aaa-20, +aaa22|, use=aaa-22, +aaa24|, use=aaa-24, +aaa26|, use=aaa-26, +aaa28|, use=aaa-28, +aaa29|, use=aaa-29, +aaa30|, use=aaa-30, +aaa36|, use=aaa-36, +aaa40|, use=aaa-40, +aaa48|, use=aaa-48, +aaa59|, use=aaa-60-s, +aaa60|, use=aaa-60, +aaadb|, use=aaa-db, +c100-rv-pp|, use=c100-rv, +c1004p|, use=c100-4p, +c100rv|, use=c100-rv, +c100rv4p|, use=c100-rv-4p, +c100rv4pna|, use=c100-rv-4p-na, +c100rv4ppp|, use=c100-rv-4p, +c100rvna|, use=c100-rv-na, +c100rvpp|, use=c100-rv, +c100rvs|, use=c100-rv, +c100s|, use=c100, +c108-4|, use=c108-4p, +c108-8|, use=c108-8p, +h19a|h19A|, use=h19-a, +h19b|, use=h19-b, +h19bs|, use=h19-bs, +h19u|, use=h19-u, +hp2621nl|2621nl|, use=2621-nl, +hp2621nt|2621nt|, use=2621-nt, +hp2621wl|2621wl|, use=2621-wl, +mime2as|, use=mime2a-s, +mime2av|, use=mime2a-v, +mimefb|, use=mime-fb, +mimehb|, use=mime-hb, +tvi2p|, use=tvi-2p, +tvi950b|, use=tvi950-b, +tvi950ns|, use=tvi950-ns, +vt100-np|, use=vt100, +vt100am|, use=vt100-am, +vt100nam|, use=vt100-nam, +vt100s|, use=vt100-s, +vt100w|, use=vt100-w, +# +# END OF TERMINFO +# ------------------------ diff --git a/usr/src/lib/terminfo/tymshare.ti b/usr/src/lib/terminfo/tymshare.ti new file mode 100644 index 0000000..2c5873c --- /dev/null +++ b/usr/src/lib/terminfo/tymshare.ti @@ -0,0 +1,24 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:tymshare.ti 1.4" + +scanset|sc410|sc415|Tymshare Scan Set, + msgr, am, bw, + cols#80, lines#24, + bel=^G, cub1=^H, cud1=^J, ind=^J, cuu1=^K, cr=^M, cuf1=^I, + sc=^B, rc=^C, clear=\EH\EJ, + kcuu1=\EA, kcud1=\EB, kcuf1=\EC, kcub1=\ED, + cup=\EY%p1%' '%+%c%p2%' '%+%c, + ed=\EJ, el=\EK, home=\EH, + rs1=\E>, + smacs=^N, rmacs=^O, acsc=l, clear=\Ev, + cup=\EY%p1%' '%+%c%p2%' '%+%c, dch1=\EO$<4*>, dl1=\EM$<4*>, + home=\EH, ich1=\Ei \b\Ej, is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek, + kf0=\EP, kf1=\EQ, kf2=\ER, kf3=\E , kf4=\E!, kf5=\E", kf6=\E#, + kf7=\E$, kf8=\E%, kf9=\E&, + kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kcud1=\EB, khome=\EH, + cuf1=\EC, ht=^I, ri=\EI, cuu1=\EA, cvvis=\Ed, cnorm=\Ec, +vi200-rv-ic|visual 200 reverse video using insert char, + rmir=\Ej, smir=\Ei, ich1@, use=vi200-rv, +# The older Visuals didn't come with function keys. This entry uses +# smkx and rmkx so that the keypad keys can be used as function keys. +# If your version of vi doesn't support function keys you may want +# to use vi200-f. +vi200-f|visual|visual 200 no function keys, + cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, + il1=\EL, am, cub1=^H, ed=\Ey, el=\Ex$<4*>, clear=\Ev, + cup=\EY%p1%' '%+%c%p2%' '%+%c, dch1=\EO$<4*>, dl1=\EM$<4*>, + home=\EH, ich1=\Ei \b\Ej, is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek, + smkx=\E=, rmkx=\E>, + kf0=\E?p, kf1=\E?q, kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, + kf7=\E?w, kf8=\E?x, kf9=\E?y, + kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kcud1=\EB, khome=\EH, + cuf1=\EC, ht=^I, ri=\EI, cuu1=\EA, cvvis=\Ed, cnorm=\Ec, +vi200-rv|visual 200 reverse video, + smso=\E4, rmso=\E3, ri@, cvvis@, cnorm@, use=vi200, +vi200-ic|visual 200 using insert char, + rmir=\Ej, smir=\Ei, ich1@, use=vi200, +# the function keys are programmable but we don't reprogram +# them to their default values with "is" because programming +# them is very verbose. maybe an "if" file should be made for +# the 300 and they could be stuck in it. +vi300|visual 300 ansi x3.64, + cr=^M, cud1=^J, ind=^J, bel=^G, cr=^M, cud1=^J, ind=^J, bel=^G, + am, cub1=^H, bw, mir, ht=^I, xenl, cols#80, lines#24, + is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[1Q\E[0;1(D\E[8s, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cud1=\E[B, cuf1=\E[C, ri=\EM, + cbt=\E[Z, home=\E[H, ed=\E[J, clear=\E[H\E[2J, el=\E[K, + il1=\E[L, dl1=\E[M, smir=\E[4h, rmir=\E[4l, dch1=\E[P$<40>, + smso=\E[1m, rmso=\E[m, smul=\E[4m, rmul=\E[m, khome=\E[H, + kcud1=\E[B, kcub1=\E[D, kcuf1=\E[C, kcuu1=\E[A, kf1=\E_A\E\\, + kf2=\E_B\E\\, kf3=\E_C\E\\, kf4=\E_D\E\\, kf5=\E_E\E\\, + kf6=\E_F\E\\, kf7=\E_G\E\\, kf8=\E_H\E\\, kf9=\E_I\E\\, +vi300-rv|visual 300 reverse video, + cr=^M, cud1=^J, ind=^J, bel=^G, cr=^M, cud1=^J, ind=^J, bel=^G, + is2=\E[7s\E[2;3;4;20;?6l\E[12;?5;?7h\E[1Q\E[0;1(D\E[8s, + use=vi300, +# slow scroll doesn't work that well; if you type on the +# keyboard while the terminal is scrolling it drops characters +vi300-ss|visual 300 slow scroll, + cr=^M, cud1=^J, ind=^J, bel=^G, cr=^M, cud1=^J, ind=^J, bel=^G, + cvvis=\E[?4l, cnorm=\E[?4h, use=vi300, +# some of the vi300s have older firmware that has the command +# sequence for setting editing extent reversed. +ovi300|visual 300 old, + cr=^M, cud1=^J, ind=^J, bel=^G, cr=^M, cud1=^J, ind=^J, bel=^G, + is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[2Q\E[0;1(D\E[8s, + use=vi300, +# if your version of ex/vi doesn't correctly implement xn +# use this termcap for the vi300 +vi300-aw|visual 300 no autowrap, + am@, xenl@, + cvvis=\E[?7l, cnorm=\E[?7h, + use=vi300, +# the visual 550 is a visual 300 with tektronix graphics, +# and with 33 lines. clear screen is modified here to +# also clear the graphics. +vi550|visual 550 ansi x3.64, + cr=^M, cud1=^J, ind=^J, bel=^G, cr=^M, cud1=^J, ind=^J, bel=^G, + lines#33, clear=\030\E[H\E[2J, use=vi300, diff --git a/usr/src/lib/terminfo/wyse.ti b/usr/src/lib/terminfo/wyse.ti new file mode 100644 index 0000000..4a6ed84 --- /dev/null +++ b/usr/src/lib/terminfo/wyse.ti @@ -0,0 +1,296 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)terminfo:wyse.ti 1.1" +# +# The following terminfo entries are directly from: +# Wyse Technology +# 3571 North First Street +# San Jose, CA 95134 +# +wy30|wyse30|Wyse 30, + am, bw, hs, mir, xon, + cols#80, lines#24, xmc#1, + bel=^G, cbt=\EI, civis=\E`0, clear=\E*$<80>, + cnorm=\E`1, cr=\r, cub1=\b, cud1=\n, cuf1=\f, + cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, + dch1=\EW$<10>, dl1=\ER$<1>, dsl=\EF\r, ed=\Ey$<80>, + el=\Et, fsl=\r, home=^^, ht=\t, hts=\E1, il1=\EE$<2>, + ind=\n, ip=$<2>, is2=\E'\E(\E\^3\E`9^N^T, kbs=\b, + kcbt=\EI, kcub1=\b, kcud1=\n, kcuf1=\f, kcuu1=^K, + kdch1=\EW, kdl1=\ER, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, + kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, + khome=^^, kil1=\EE, ri=\Ej$<3>, rmacs=\EG0\EH^C, + rmir=\Er, rmso=\EG0, rmul=\EG0, smacs=\EG0\EH^B, + smir=\Eq, smso=\EG4, smul=\EG8, tbc=\E0, tsl=\EF, +wy30-vb|wyse30-vb|wyse 30 Visable bell, + flash=\E`8\E`:\E`9, + use=wy30, +# +# Wyse 50 +# +wyse50|wy50|wyse-50|wy-50|Wyse WY-50, + am, bw, hs, mir, xon, + cols#80, lines#24, xmc#1, + bel=^G, cbt=\EI, civis=\E`0, clear=\E*$<20>, + cnorm=\E`1, cr=\r, cub1=\b, cud1=\n, cuf1=\f, + cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, + dch1=\EW$<1>, dl1=\ER, dsl=\EF\r, ed=\Ey$<20>, el=\Et, + fsl=\r, home=^^, ht=\t, hts=\E1, il1=\EE, ind=\n, + ip=$<1>, is1=\E`:\E`9$<30>, is2=^N^T\E'\E(, kbs=\b, + kcbt=\EI, kcub1=\b, kcud1=\n, kcuf1=\f, kcuu1=^K, + kdch1=\EW, kdl1=\ER, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, + kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, + kf9=^AH\r, khome=^^, kil1=\EE, ri=\Ej, + rmacs=\EG0\EH^C, rmir=\Er, rmso=\EG0, rmul=\EG0, + smacs=\EG0\EH^B, smir=\Eq, smso=\EGt, smul=\EG8, + tbc=\E0, tsl=\EF, +wyse50-vb|wy50-vb|wyse-50-vb|wy-50-vb|Wyse 50 Visable bell, + flash=\E`8\E`:\E`9, + use=wy50, +wy50-w|wyse50-w|wyse-50-w|wy-50-w|wyse 50 132-column, + cols#132, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9, + use=wy50, +wy50-wvb|wyse50-wvb|wy-50-wvb|wyse-50-wvb|Wyse 50 132-column Visable bell, + cols#132, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, + flash=\E`8\E`;\E`9, is1=\E`;\E`9, + use=wy50, +# +# The Wyse 60 is like the Wyse 50 but with more padding. +# The reset strings are slow and the pad times very depending +# on other parameters such as font loading. I have tried +# to follow the following outline: +# rs1 -> set personality +# rs2 -> set number of columns +# rs3 -> set number of lines +# is1 -> select the proper font +# is2 -> do the initialization +# is3 -> If this string is empty then rs3 gets sent. +# So I do some initialization here. +# +# The Wyse 60's that have vt100 emulation are slower than the +# older Wyse 60's. This change happened mid-1987. +# The capabilities effected are (dch1) (dl1) (il1) (ind) (ri) +# +################################################################### +### Note: ### +### The Wyse 60 runs faster when the XON/XOFF ### +### handshake is turned off. ### +################################################################### +wy60|wyse60|Wyse 60, + am, bw, hs, km, mir, msgr, xon, + cols#80, lines#24, + bel=^G, cbt=\EI, civis=\E`0, clear=\E*$<100>, + cnorm=\E`1, cr=\r, cub1=\b, cud1=\n, cuf1=\f, + cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c, cuu1=^K, + dch1=\EW$<11>, dl1=\ER$<5>, dsl=\EF\r, ed=\Ey$<100>, + el=\Et, fsl=\r, home=^^, ht=\t, hts=\E1, il1=\EE$<4>, + ind=\n, ip=$<3>, is1=\EcB0\EcC1, + is2=\Ed$\EcD\E'\Er\EH^C\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1^N^T, + kbs=\b, kcbt=\EI, kcub1=\b, kcud1=\n, kcuf1=\f, + kcuu1=^K, kdch1=\EW, kdl1=\ER, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, kil1=\EE, ri=\Ej$<7>, + rmacs=\EH^C, rmir=\Er, rmso=\EG0, rmul=\EG0, + rs1=\E~!\E~4$<150>, rs2=\EeF$<150>, + rs3=\EwG\Ee($<200>, smacs=\EH^B, smir=\Eq, smso=\EGt, + smul=\EG8, tbc=\E0, tsl=\EF, uc=\EG8%p1%c\EG0, +wy60-w|wyse60-w|wyse 60 132-column, + cols#132, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<16>, ip=$<5>, + rs2=\EeF\E`;$<300>, + use=wy60, +wy60-25|wyse60-25|wyse 60 80-column 25-lines, + lines#25, + rs3=\EwG\Ee)$<200>, + use=wy60, +wy60-25-w|wyse60-25-w|wyse 60 132-column 25-lines, + lines#25, + rs3=\EwG\Ee)$<200>, + use=wy60-w, +wy60-42|wyse60-42|wyse 60 80-column 42-lines, + lines#42, + clear=\E*$<260>, cup=\E=%p1%'\s'%+%c%p2%'\s'%+%c$<2>, + dch1=\EW$<16>, dl1=\ER$<11>, ed=\Ey$<260>, + il1=\EE$<11>, ip=$<5>, is1=\EcB2\EcC3, ri=\Ej$<10>, + rs3=\Ee*$<150>, + use=wy60, +wy60-42-w|wyse60-42-w|wyse 60 132-column 42-lines, + cols#132, + cup=\Ea%i%p1%dR%p2%dC$<2>, dch1=\EW$<19>, home=^^$<2>, + ip=$<6>, rs2=\EeF\E`;$<300>, + use=wy60-42, +wy60-43|wyse60-43|wyse 60 80-column 43-lines, + lines#43, + rs3=\Ee+$<150>, + use=wy60-42, +wy60-43-w|wyse60-43-w|wyse 60 132-column 43-lines, + lines#43, + rs3=\Ee+$<150>, + use=wy60-42-w, +wy60-vb|wyse60-vb|Wyse 60 Visable bell, + flash=\E`8\E`9, + use=wy60, +wy60-w-vb|wy60-wvb|wyse60-wvb|Wyse 60 132-column Visable bell, + flash=\E`8\E`9, + use=wy60-w, +# +# Wyse 60 in economy mode with 2 pages of memory +# It may be useful to assign two function keys with the +# values \E=(\s look at old data in page 1 +# \E=W, look at bottem of page 1 +wy60-2p|wyse 60 with 2 pages of memory, + is2=\Ed$\EcD\E'\Er\EH^C\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\EwJ\Ew1^N^T$<150>, + rmcup=\Ew1, rs2=\EeG$<150>, smcup=\Ew0, + use=wy60, +# +###################################################################### +# +# The Wyse-99GT looks at lot like the Wyse 60 except that it +# does not have the 42/43 line mode. In the Wyse-60 the "lines" +# setup parameter controls the number of lines on the screen. +# For the Wyse 99GT the "lines" setup parameter controls the +# number of lines in a page. The screen can display 25 lines max. +# The Wyse-99GT also has personalities for the VT220 and +# Tektronix 4014. But this has no bearing on the native mode. +# +wy99gt|wyse99gt|Wyse 99gt, + clear=\E*$<130>, dch1=\EW$<5>, dl1=\ER$<3>, + ed=\Ey$<130>, il1=\EE$<3>, ip=$<2>, ri=\Ej$<3>, + rs2=\E`:$<150>, + use=wy60, +wy99gt-w|wyse99gt-w|wyse 99gt 132-column, + cols#132, + clear=\E*$<160>, cup=\Ea%i%p1%dR%p2%dC$<2>, + dch1=\EW$<9>, ed=\Ey$<160>, ip=$<4>, rs2=\E`;$<150>, + use=wy99gt, +wy99gt-25|wyse99gt-25|wyse 99gt 80-column 25-lines, + lines#25, + rs3=\EwG\Ee)$<200>, + use=wy99gt, +wy99gt-25-w|wyse99gt-25-w|wyse 99gt 132-column 25-lines, + lines#25, + use=wy99gt-w, +wy99gt-vb|wyse99gt-vb|Wyse 99gt Visable bell, + flash=\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`9, + use=wy99gt, +wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb, + flash=\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`8\E`9, + use=wy99gt-w, +wy99gt-2p|wyse 99gt with 2 pages of memory, + rmcup=\Ew0, smcup=\Ew1, + use=wy99gt, +# +# The Wyse 75 is a vt100 lookalike without advanced video. +# +# The Wyse 75 can support one attribute (e.g. Dim, Inverse, +# Underline) without magic cookies. The following description +# uses this capability, but when more than one attribute is +# put on the screen at once, all attributes will be changed +# to be the same as the last attribute given. +# The Wyse 75 can support more attributes when used with magic +# cookies. The wy75-mc terminal description uses magic cookies +# to correctly handle multiple attributes on a screen. +# +wy75|wyse75|wyse 75, + am, hs, mir, msgr, xenl, xon, + cols#80, lines#24, pb#1201, + bel=^G, cbt=\E[1Z, civis=\E[?25l, clear=\E[H\E[J$<30>, + cnorm=\E[?25h, cr=\r, csr=\E[%i%p1%d;%p2%dr$<2>, + cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP$<3*>, + dch1=\E[P$<3>, dl=\E[%p1%dM$<1*>, dl1=\E[M, + dsl=\E[>\,^A^A\E[>-^A^A, ed=\E[J$<30>, el=\E[K$<3>, + fsl=^A, home=\E[H, hpa=\E[%i%p1%dG, ht=\t, hts=\EH, + ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, + ind=\n, ip=$<1>, is2=\E>\E[?7;?8h\E[4;?1l^O\E)0, + kbs=\b, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdl1=\E[M, kel=\E[K, khome=\E[H, + kil1=\E[L, rc=\E8, ri=\EM$<2>, rmacs=^O, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[0m, rmul=\E[0m, + rs1=\E7\E[1;24r\E8, + rs2=\E[0m\E[35;?7;?8h\E[30;?1l$<20>, rs3=\E[?3l$<80>, + sc=\E7, smacs=\E[0m^N, smir=\E[4h, + smkx=\E[?1l\E[?7h\E=, smso=\E[1t\E[7m, + smul=\E[2t\E[4m, tbc=\E[3g, tsl=\E[>\,^A, +# +# This terminal description used the non-hidden attribute mode +# (with magic cookie). +# +wy75-mc|wyse75-mc|wyse 75 with magic cookies, + msgr@, + xmc#1, + rmacs=\E[0p^O, rmso=\E[0p, rmul=\E[0p, + rs2=\E[0p\E[35;?7;?8h\E[30;?1l$<20>, smacs=\E[0p^N, + smso=\E[17p, smul=\E[8p, + use=wy75, +wy75-vb|wyse75-vb|wyse 75 with visible bell, + flash=\E[30h\E\,\E[30l, + use=wy75, +wy75-w|wyse75-w|wyse 75 in 132 column mode, + cols#132, + rs3=\E[?3h$<80>, + use=wy75, +wy75-wvb|wyse75-wvb|wyse 75 with visible bell 132 columns, + cols#132, + flash=\E[30h\E\,\E[30l, rs3=\E[?3h$<80>, + use=wy75, +# +# Wyse 85 emulating a vt220 7 bit mode. +# 24 line screen with status line. +# +# The vt220 mode permits more function keys but it wipes out +# the escape key. I strongly reccomend that f11 be set to +# escape (esc). +# The terminal may have to be set for 8 data bits and 2 stop +# bits for the arrow keys to work. +# The Wyse 85 runs faster with XON/XOFF enabled. Also the +# (dch) and (ich) work best when XON/XOFF is set. (ich) and +# (dch) leave trash on the screen when used without XON/XOFF. +# +wy85|wyse85|wyse 85, + am, hs, mir, msgr, xenl, xon, + cols#80, lines#24, + bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J$<80>, + cnorm=\E[?25h, cr=\r, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH$<1>, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP$<7*>, + dch1=\E[P$<4>, dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, + dsl=\E[40l, ed=\E[J$<80>, el=\E[K$<7>, + fsl=\E[1;24r\E8, home=\E[H, ht=\t, hts=\EH, + ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, + ind=\E[B, ip=$<4>, is1=\E[62;1"p\E7\E[?6l\E8\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12;36h\E[?7;8;25h$<30>, + kbs=\b, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + khome=\E[26~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, + rc=\E8, ri=\EM$<3>, rmacs=^O, rmir=\E[4l, rmkx=\E>, + rmso=\E[m, rmul=\E[m, + rs1=\E<\E[3;13l\E[!p\E7\E[1;24r\E8\E(B, + rs2=\E[35h\E[?3l$<70>, sc=\E7, smacs=^N, smir=\E[4h, + smkx=\E[?1l\E=, smso=\E[1m, smul=\E[4m, tbc=\E[3g, + tsl=\E[40h\E7\E[25;%i%p1%dH, +# +# Wyse 85 with visual bell. +wy85-vb|wyse85-vb|wyse 85 with visible bell, + flash=\E[30h\E\,\E[30l, + use=wy85, +# +# Wyse 85 in 132-column mode. +wy85-w|wyse85-w|wyse 85 in 132-column mode, + cols#132, + rs2=\E[35h\E[?3h$<120>, + use=wy85, +# +# Wyse 85 in 132-column mode with visual bell. +wy85-wvb|wyse85-wvb|wyse 85 with visible bell 132-columns, + flash=\E[30h\E\,\E[30l, + use=wy85, diff --git a/usr/src/lib/xlibcurses/demo/.menu.data b/usr/src/lib/xlibcurses/demo/.menu.data index 6608257..10a208f 100644 --- a/usr/src/lib/xlibcurses/demo/.menu.data +++ b/usr/src/lib/xlibcurses/demo/.menu.data @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)curses:demo/.menu.data 1.2" vmd vi .menu.data d date diff --git a/usr/src/lib/xlibcurses/demo/aliens.6 b/usr/src/lib/xlibcurses/demo/aliens.6 index a1bd7c8..b265d48 100644 --- a/usr/src/lib/xlibcurses/demo/aliens.6 +++ b/usr/src/lib/xlibcurses/demo/aliens.6 @@ -1,9 +1,3 @@ -./" Copyright (c) 1988 AT&T -./" All Rights Reserved -./" THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -./" The copyright notice above does not evidence any -./" actual or intended publication of such source code. -./" .TH ALIENS 6 4/2/81 .UC 4 .SH NAME diff --git a/usr/src/lib/xlibcurses/demo/ft b/usr/src/lib/xlibcurses/demo/ft index 8a9e331..be8753d 100644 --- a/usr/src/lib/xlibcurses/demo/ft +++ b/usr/src/lib/xlibcurses/demo/ft @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)curses:demo/ft 1.2" The following device driver is in the public domain and has been posted to USENET. It implements the "ft" device and the FTIOCSET and FTIOCCANCEL diff --git a/usr/src/lib/xlibcurses/demo/menu.readme b/usr/src/lib/xlibcurses/demo/menu.readme index 5a38a46..6afd0f6 100644 --- a/usr/src/lib/xlibcurses/demo/menu.readme +++ b/usr/src/lib/xlibcurses/demo/menu.readme @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)curses:demo/menu.readme 1.2" menu.c is the C source for a demonstration program for libcurses and terminfo. It is a menu manager. Input is a file describing diff --git a/usr/src/lib/xlibcurses/demo/pacman/README b/usr/src/lib/xlibcurses/demo/pacman/README index e9620ad..778a1ac 100644 --- a/usr/src/lib/xlibcurses/demo/pacman/README +++ b/usr/src/lib/xlibcurses/demo/pacman/README @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)curses:demo/pacman/README 1.2" Pacman has been tested on cbosgd (running 4.1BSD with the fast timer driver added), and on vanilla 5.0 systems on a VAX and on a 3B. diff --git a/usr/src/lib/xlibcurses/demo/pacman/pacman.6 b/usr/src/lib/xlibcurses/demo/pacman/pacman.6 index 1380335..3f30897 100644 --- a/usr/src/lib/xlibcurses/demo/pacman/pacman.6 +++ b/usr/src/lib/xlibcurses/demo/pacman/pacman.6 @@ -1,9 +1,3 @@ -./" Copyright (c) 1988 AT&T -./" All Rights Reserved -./" THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -./" The copyright notice above does not evidence any -./" actual or intended publication of such source code. -./" .TH PACMAN 6 5/5/82 .SH NAME pacman \- Food Eating CRT Game diff --git a/usr/src/lib/xlibcurses/demo/rain.6 b/usr/src/lib/xlibcurses/demo/rain.6 index 714a418..952c248 100644 --- a/usr/src/lib/xlibcurses/demo/rain.6 +++ b/usr/src/lib/xlibcurses/demo/rain.6 @@ -1,9 +1,3 @@ -./" Copyright (c) 1988 AT&T -./" All Rights Reserved -./" THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -./" The copyright notice above does not evidence any -./" actual or intended publication of such source code. -./" .TH RAIN 6 .SH NAME rain \- animated raindrops display diff --git a/usr/src/lib/xlibcurses/demo/window/README b/usr/src/lib/xlibcurses/demo/window/README index 9497a58..a0d962b 100644 --- a/usr/src/lib/xlibcurses/demo/window/README +++ b/usr/src/lib/xlibcurses/demo/window/README @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - #ident "@(#)curses:demo/window/README 1.2" The window manager divides up ordinary dumb terminals into windows, sort of like a bitmapped workstation (but obviously not as good). diff --git a/usr/src/lib/xlibcurses/demo/window/window.1 b/usr/src/lib/xlibcurses/demo/window/window.1 index 8ad5ca4..2cbc8ae 100644 --- a/usr/src/lib/xlibcurses/demo/window/window.1 +++ b/usr/src/lib/xlibcurses/demo/window/window.1 @@ -1,9 +1,3 @@ -./" Copyright (c) 1988 AT&T -./" All Rights Reserved -./" THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -./" The copyright notice above does not evidence any -./" actual or intended publication of such source code. -./" .TH WINDOW 1 8/25/82 .SH NAME window \- crt screen window manager diff --git a/usr/src/lib/xlibcurses/demo/worms.6 b/usr/src/lib/xlibcurses/demo/worms.6 index ecbe3c4..bcc0076 100644 --- a/usr/src/lib/xlibcurses/demo/worms.6 +++ b/usr/src/lib/xlibcurses/demo/worms.6 @@ -1,9 +1,3 @@ -./" Copyright (c) 1988 AT&T -./" All Rights Reserved -./" THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -./" The copyright notice above does not evidence any -./" actual or intended publication of such source code. -./" .TH WORMS 6 .SH NAME worms \- animate worms on a display terminal diff --git a/usr/src/lib/xlibcurses/screen/caps b/usr/src/lib/xlibcurses/screen/caps index fdd759e..089d646 100644 --- a/usr/src/lib/xlibcurses/screen/caps +++ b/usr/src/lib/xlibcurses/screen/caps @@ -1,10 +1,4 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - -#ident "@(#)curses:screen/caps 1.30" +#ident "@(#)curses:screen/caps 1.29" # Be sure to add new capabilties at the END of the appropriate section! --- begin bool auto_left_margin, "bw" "bw" cub1 wraps from column 0 to last column @@ -490,7 +484,7 @@ set3_des_seq, "s3ds" "s3" Shift into codeset 3 # set_lr_margin, "smglr" "ML" Sets both left and right margins set_tb_margin, "smgtb" "MT" Sets both top and bottom margins -bit_image_repeat, "birep" "Xy" Repeat bit-image cell #1 #2 times (use tparm) +bit_image_repeat, "birep" "Zy" Repeat bit-image cell #1 #2 times (use tparm) bit_image_newline, "binel" "Zz" Move to next row of the bit image (use tparm) bit_image_carriage_return, "bicr" "Yv" Move to beginning of same row (use tparm) color_names, "colornm" "Yw" Give name for color #1 diff --git a/usr/src/lib/xlibcurses/screen/captoinfo.c b/usr/src/lib/xlibcurses/screen/captoinfo.c index 62b2a68..14de71b 100644 --- a/usr/src/lib/xlibcurses/screen/captoinfo.c +++ b/usr/src/lib/xlibcurses/screen/captoinfo.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/captoinfo.c 1.12" +#ident "@(#)curses:screen/captoinfo.c 1.11" /* NAME captoinfo - convert a termcap description to a terminfo description @@ -1328,17 +1328,10 @@ captoinfo () print_no_use_entry (); } - -#include /* use this file to determine if this is SVR4.0 system */ - use_etc_termcap () { if (verbose) -#ifdef SIGSTOP - (void) fprintf (trace, "reading from /usr/share/lib/termcap\n"); -#else /* SIGSTOP */ (void) fprintf (trace, "reading from /etc/termcap\n"); -#endif /* SIGSTOP */ term_name = getenv ("TERM"); captoinfo (); } @@ -1527,7 +1520,7 @@ char **argv; verbose++; break; case 'V': - printf("%s: version %s\n", progname, "@(#)curses:screen/captoinfo.c 1.12"); + printf("@(#)curses:screen/captoinfo.c 1.11"); fflush(stdout); exit (0); case '?': diff --git a/usr/src/lib/xlibcurses/screen/chgtinfo.1 b/usr/src/lib/xlibcurses/screen/chgtinfo.1 index 2431aeb..24b1dcb 100644 --- a/usr/src/lib/xlibcurses/screen/chgtinfo.1 +++ b/usr/src/lib/xlibcurses/screen/chgtinfo.1 @@ -1,9 +1,3 @@ -./" Copyright (c) 1988 AT&T -./" All Rights Reserved -./" THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -./" The copyright notice above does not evidence any -./" actual or intended publication of such source code. -./" .TH CHGTINFO 1 .SH NAME chgtinfo \- create a temporary version of a terminfo entry diff --git a/usr/src/lib/xlibcurses/screen/chgtinfo.c b/usr/src/lib/xlibcurses/screen/chgtinfo.c index 30bde9e..63c78be 100644 --- a/usr/src/lib/xlibcurses/screen/chgtinfo.c +++ b/usr/src/lib/xlibcurses/screen/chgtinfo.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/chgtinfo.c 1.6" +#ident "@(#)curses:screen/chgtinfo.c 1.3" #include #include @@ -141,7 +141,7 @@ char **argv; /* where ? is the first letter of $TERM */ (void) sprintf(TMPtermfile, "%s/%c/%cTMP+TMP", dirname, *term, *term); if (!findtermfile(getenv("TERMINFO"), term) && -#ifdef SIGSTOP /* SVR4 and beyond */ +#ifdef __STDC__ !findtermfile("/usr/share/lib/terminfo", term)) #else !findtermfile("/usr/lib/terminfo", term)) @@ -179,7 +179,7 @@ char **argv; /*NOTREACHED*/ } -#if (defined(SYSV) || defined(USG)) && !defined(SIGPOLL) +#if (defined(SYSV) || defined(USG)) && !defined(SIG_POLL) /* * mkdir(dirname, mode) * @@ -188,9 +188,6 @@ char **argv; */ mkdir(directory, mode) -#ifdef __STDC__ -const -#endif char *directory; int mode; { diff --git a/usr/src/lib/xlibcurses/screen/compiler.h b/usr/src/lib/xlibcurses/screen/compiler.h index 76ed871..a715785 100644 --- a/usr/src/lib/xlibcurses/screen/compiler.h +++ b/usr/src/lib/xlibcurses/screen/compiler.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/compiler.h 1.5" +#ident "@(#)curses:screen/compiler.h 1.3" /********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** @@ -56,7 +56,6 @@ Initial revision */ #include -#include /* use this file to determine if this is SVR4.0 system */ #ifndef TRUE #define TRUE 1 @@ -151,7 +150,7 @@ struct name_table_entry *find_entry(); /* look up entry in hash table */ int next_char(); int trans_string(); -#ifdef SIGSTOP /* SVR4.0 and beyond */ +#ifdef __STDC__ #define SRCDIR "/usr/share/lib/terminfo" #else #define SRCDIR "/usr/lib/terminfo" diff --git a/usr/src/lib/xlibcurses/screen/curses.ed b/usr/src/lib/xlibcurses/screen/curses.ed index 2143a9d..ed4706c 100644 --- a/usr/src/lib/xlibcurses/screen/curses.ed +++ b/usr/src/lib/xlibcurses/screen/curses.ed @@ -1,4 +1,4 @@ -!#ident "@(#)curses:screen/curses.ed 1.58" +!#ident "@(#)curses:screen/curses.ed 1.55" e keycaps H g/.*KEY_/s//KEY_/ @@ -52,7 +52,7 @@ $a # define SYSV #endif /* Some V7 systems define L_ctermid - we list those here */ -#ifdef BSD +#ifdef sun # undef SYSV #endif @@ -203,61 +203,6 @@ extern char curs_parm_err[], /* Function declarations */ -#ifdef _VR3_COMPAT_CODE - -extern _ochtype *acs_map; -extern chtype *acs32map; - -/* definitions for Vr3 source compatibility */ - -#define initscr initscr32 -#define newterm newterm32 -#define waddch w32addch -#define wechochar w32echochar -#define pechochar p32echochar -#define winsch w32insch -#define vidputs vid32puts -#define vidattr vid32attr -#define wattroff w32attroff -#define wattron w32attron -#define wattrset w32attrset -#define acs_map acs32map -#define box box32 - -#ifdef __STDC__ -extern WINDOW *initscr(); -extern SCREEN *newterm(char *, FILE *, FILE *); -#else -extern WINDOW *initscr(); -extern SCREEN *newterm(); -#endif - -/* declarations for mini-curses */ - -#ifdef __STDC__ -extern WINDOW *m_initscr(void); - -extern SCREEN *m_newterm(char *, FILE *, FILE *); - -extern int m_addch(int), m_addstr(char *), m_clear(void), m_erase(void), - m_move(int, int), m_refresh(void); - -#else /* __STDC__ */ -extern WINDOW *m_initscr(); - -extern SCREEN *m_newterm(); - -extern int m_addch(), m_addstr(), m_clear(), m_erase(), - m_move(), m_refresh(); - -#endif /* __STDC__ */ - -#else /* _VR3_COMPAT_CODE */ - -extern chtype *acs_map; - -#endif /* _VR3_COMPAT_CODE */ - #ifdef __STDC__ extern SCREEN *newscreen(char *, int, int, int, FILE *, FILE *), @@ -514,6 +459,61 @@ extern chtype getbkgd(), getattrs(); #endif /* __STDC__ */ #endif /* defined(CURS_PERFORMANCE) && !defined(lint) */ +#ifdef _VR3_COMPAT_CODE + +extern _ochtype *acs_map; +extern chtype *acs32map; + +/* definitions for Vr3 source compatibility */ + +#define initscr initscr32 +#define newterm newterm32 +#define waddch w32addch +#define wechochar w32echochar +#define pechochar p32echochar +#define winsch w32insch +#define vidputs vid32puts +#define vidattr vid32attr +#define wattroff w32attroff +#define wattron w32attron +#define wattrset w32attrset +#define acs_map acs32map +#define box box32 + +#ifdef __STDC__ +extern WINDOW *initscr(); +extern SCREEN *newterm(char *, FILE *, FILE *); +#else +extern WINDOW *initscr(); +extern SCREEN *newterm(); +#endif + +/* declarations for mini-curses */ + +#ifdef __STDC__ +extern WINDOW *m_initscr(void); + +extern SCREEN *m_newterm(char *, FILE *, FILE *); + +extern int m_addch(int), m_addstr(char *), m_clear(void), m_erase(void), + m_move(int, int), m_refresh(void); + +#else /* __STDC__ */ +extern WINDOW *m_initscr(); + +extern SCREEN *m_newterm(); + +extern int m_addch(), m_addstr(), m_clear(), m_erase(), + m_move(), m_refresh(); + +#endif /* __STDC__ */ + +#else /* _VR3_COMPAT_CODE */ + +extern chtype *acs_map; + +#endif /* _VR3_COMPAT_CODE */ + #if defined(NOMACROS) || defined(lint) #ifdef __STDC__ @@ -1047,6 +1047,6 @@ $a 0r copyright.h /screen\/copyright\.h/d 1i -#ident "@(#)curses:screen/curses.ed 1.58" +#ident "@(#)curses:screen/curses.ed 1.55" . w curses.h diff --git a/usr/src/lib/xlibcurses/screen/draino.c b/usr/src/lib/xlibcurses/screen/draino.c index 2fb6427..748739f 100644 --- a/usr/src/lib/xlibcurses/screen/draino.c +++ b/usr/src/lib/xlibcurses/screen/draino.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/draino.c 1.7" +#ident "@(#)curses:screen/draino.c 1.6" #include "curses_inc.h" @@ -49,7 +49,7 @@ int ms; return (OK); napms(NAPINTERVAL); } -#else /* TIOCOUTQ */ +#endif /* TIOCOUTQ */ #ifdef TCSETAW #define _DRAINO @@ -66,7 +66,6 @@ int ms; else return (ERR); #endif /* TCSETAW */ -#endif /* TIOCOUTQ */ #ifndef _DRAINO /* diff --git a/usr/src/lib/xlibcurses/screen/llib-lcurses b/usr/src/lib/xlibcurses/screen/llib-lcurses index 5fc4621..04cbdff 100644 --- a/usr/src/lib/xlibcurses/screen/llib-lcurses +++ b/usr/src/lib/xlibcurses/screen/llib-lcurses @@ -1,9 +1,3 @@ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - #ifdef __STDC__ diff --git a/usr/src/lib/xlibcurses/screen/makefile b/usr/src/lib/xlibcurses/screen/makefile index b27602c..9534c33 100644 --- a/usr/src/lib/xlibcurses/screen/makefile +++ b/usr/src/lib/xlibcurses/screen/makefile @@ -24,7 +24,7 @@ DESTLIB= $(ROOT)/usr/lib DESTBIN= $(ROOT)/usr/bin DESTDIR= $(ROOT) -AR= TMPDIR=$(TMP) ar +AR= TMPDIR=$(TMP) /bin/ar CHMOD= /bin/chmod CPIO= /usr/bin/cpio ECHO= /bin/echo @@ -37,8 +37,8 @@ RM= /bin/rm SHELL= /bin/sh UNIQ= /usr/bin/uniq -INC = $(ROOT)/usr/include -INCLUDE = -I. -I $(INC) +#INC = $(ROOT)/usr/include +INCLUDE = -I. -I $(PWD) -I $(INC) CPPDEFS= -I. @@ -54,7 +54,7 @@ CCSLIB=$(ROOT)/usr/ccs/lib .SUFFIXES: .p .d .t -HEADERS= curses.h unctrl.h curses_inc.h curshdr.h term.h +HEADERS= curses.h unctrl.h curses_inc.h curshdr.h term.h uparm.h # # tic source and header files @@ -194,13 +194,11 @@ $(OBJS2): $(HEADERS) mv $*.o $*.t -mv $*.O $*.o -#obj1: $(OBJS1) +obj1: $(OBJS1) -#obj2: $(OBJS2) +obj2: $(OBJS2) -#$(LIBNAME): obj1 obj2 - -$(LIBNAME): $(OBJS1) $(OBJS2) +$(LIBNAME): obj1 obj2 @$(ECHO) @$(ECHO) Building libcurses archive @$(ECHO) @@ -447,6 +445,8 @@ install: all install -f $(CCSBIN) -m 555 -u bin -g bin captoinfo install -f $(CCSBIN) -m 555 -u bin -g bin infocmp install -f $(CCSBIN) -m 555 -u bin -g bin tput + -mkdir $(ROOT)/etc + install -f $(ROOT)/etc -m 555 -u bin -g bin ../termcap cktmp: @$(ECHO) diff --git a/usr/src/lib/xlibcurses/screen/makefile.bsd b/usr/src/lib/xlibcurses/screen/makefile.bsd index 03fc71d..0561153 100644 --- a/usr/src/lib/xlibcurses/screen/makefile.bsd +++ b/usr/src/lib/xlibcurses/screen/makefile.bsd @@ -1,9 +1,3 @@ -# Copyright (c) 1988 AT&T -# All Rights Reserved -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - # # cursor package maker # V7 and Berkeley UNIX makefile @@ -32,7 +26,7 @@ LDFLAGS=-n LIBS= .SUFFIXES: .p .d .t -HEADERS=curses.h unctrl.h curses_inc.h curshdr.h term.h +HEADERS=curses.h unctrl.h curses_inc.h curshdr.h term.h uparm.h CFILES= baudrate.c capnames.c cbreak.c chkinput.c cio.c compat.c \ copywin.c curs_set.c curses.c def_prog.c delay.c delay_out.c \ delkey.c delkeymap.c delscreen.c delterm.c delwin.c derwin.c \ diff --git a/usr/src/lib/xlibcurses/screen/otermcap.c b/usr/src/lib/xlibcurses/screen/otermcap.c index c0629f1..ea52c6f 100644 --- a/usr/src/lib/xlibcurses/screen/otermcap.c +++ b/usr/src/lib/xlibcurses/screen/otermcap.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/otermcap.c 1.5" +#ident "@(#)curses:screen/otermcap.c 1.3" /* Copyright (c) 1979 Regents of the University of California */ /* Modified to: */ /* 1) remember the name of the first tc= parameter */ @@ -23,13 +23,8 @@ #include #include - -#include /* use this file to determine if this is SVR4.0 system */ -#ifdef SIGSTOP /* SVR4.0 and beyond */ -#define E_TERMCAP "/usr/share/lib/termcap" -#else +/* #include "uparm.h" - TLH all uparm.h had that was needed was E_TERMCAP */ #define E_TERMCAP "/etc/termcap" -#endif /* * termcap - routines for dealing with the terminal capability data base diff --git a/usr/src/lib/xlibcurses/screen/print.c b/usr/src/lib/xlibcurses/screen/print.c index 3677b31..0bebdff 100644 --- a/usr/src/lib/xlibcurses/screen/print.c +++ b/usr/src/lib/xlibcurses/screen/print.c @@ -5,13 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/print.c 1.11" +#ident "@(#)curses:screen/print.c 1.9" #include "curses.h" #include "print.h" -#include /* use this file to determine if this is SVR4.0 system */ -#ifdef SIGSTOP /* SVR4.0 and beyond */ +#ifdef __STDC__ #define _ULIBTI "/usr/share/lib/terminfo" #else #define _ULIBTI "/usr/lib/terminfo" @@ -165,7 +164,11 @@ register char *term, *synonyms; /* All hope is lost */ - fprintf(stderr, "Error: Term \"%s\" not found in %s or %s\n", term, _ULIBTI, getenv("TERMINFO")); +#ifdef __STDC__ + fprintf(stderr, "Error: Term \"%s\" not found in /usr/share/lib/terminfo or %s\n", term, getenv("TERMINFO")); +#else + fprintf(stderr, "Error: Term \"%s\" not found in /usr/lib/terminfo or %s\n", term, getenv("TERMINFO")); +#endif } else do_print = 1; } } else do_print = 1; diff --git a/usr/src/lib/xlibcurses/screen/rmident.sh b/usr/src/lib/xlibcurses/screen/rmident.sh index 67026f3..849a2c6 100644 --- a/usr/src/lib/xlibcurses/screen/rmident.sh +++ b/usr/src/lib/xlibcurses/screen/rmident.sh @@ -5,8 +5,8 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)curses:screen/rmident.sh 1.5" -H='curses.ext maketerm.ed compiler.h curses.form curshdr.h object.h otermcap.h print.h unctrl.h' +#ident "@(#)curses:screen/rmident.sh 1.4" +H='curses.ext maketerm.ed compiler.h curses.form curshdr.h object.h otermcap.h print.h unctrl.h uparm.h' for i in $H do echo de-identing $i diff --git a/usr/src/lib/xlibcurses/screen/setupterm.c b/usr/src/lib/xlibcurses/screen/setupterm.c index acc9af4..8aa9a9b 100644 --- a/usr/src/lib/xlibcurses/screen/setupterm.c +++ b/usr/src/lib/xlibcurses/screen/setupterm.c @@ -5,19 +5,20 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/setupterm.c 1.53" +#ident "@(#)curses:screen/setupterm.c 1.51" #ifndef NOBLIT #include #endif /* NOBLIT */ #include "curses_inc.h" -#include - -#include /* use this file to determine if this is SVR4.0 system */ -#ifndef SIGSTOP /* SVR4.0 and beyond */ +#include "uparm.h" +#ifndef _TERMPATH +#ifndef __STDC__ #define _TERMPATH(file) "/usr/lib/terminfo/file" -#else /* SIGSTOP */ +#else /* __STDC__ */ #define _TERMPATH(file) "/usr/share/lib/terminfo/" #file -#endif /* SIGSTOP */ +#endif /* __STDC__ */ +#endif /* _TERMPATH */ +#include extern bool _use_env; /* in curses.c */ diff --git a/usr/src/lib/xlibcurses/screen/termcap.ed b/usr/src/lib/xlibcurses/screen/termcap.ed index 9bdb19b..bfafe8a 100644 --- a/usr/src/lib/xlibcurses/screen/termcap.ed +++ b/usr/src/lib/xlibcurses/screen/termcap.ed @@ -1,8 +1,8 @@ -!#ident "@(#)curses:screen/termcap.ed 1.19" +!#ident "@(#)curses:screen/termcap.ed 1.18" H !rm -f termcap.c 0a -#ident "@(#)curses:screen/termcap.ed 1.19" +#ident "@(#)curses:screen/termcap.ed 1.18" /* * Simulation of termcap using terminfo. * This file is created from termcap.ed. DO NOT EDIT ME! @@ -165,7 +165,7 @@ register char *tcstr, **area; if (offset == -1) return (0); rv = str_array[offset]; - if (area && *area && rv) + if (area && *area) { (void) strcpy(*area, rv); *area += strlen(rv) + 1; diff --git a/usr/src/lib/xlibcurses/screen/termerr.c b/usr/src/lib/xlibcurses/screen/termerr.c index c6644ab..0bd2f1d 100644 --- a/usr/src/lib/xlibcurses/screen/termerr.c +++ b/usr/src/lib/xlibcurses/screen/termerr.c @@ -5,15 +5,14 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/termerr.c 1.6" +#ident "@(#)curses:screen/termerr.c 1.4" #include "curses_inc.h" -#include /* use this file to determine if this is SVR4.0 system */ char *term_err_strings[] = { "", -#ifdef SIGSTOP /* SVR4.0 and beyond */ +#ifdef __STDC__ "/usr/share/lib/terminfo is unaccessible", #else "/usr/lib/terminfo is unaccessible", diff --git a/usr/src/lib/xlibcurses/screen/tic_main.c b/usr/src/lib/xlibcurses/screen/tic_main.c index 80480a1..c0e914c 100644 --- a/usr/src/lib/xlibcurses/screen/tic_main.c +++ b/usr/src/lib/xlibcurses/screen/tic_main.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)curses:screen/tic_main.c 1.11" +#ident "@(#)curses:screen/tic_main.c 1.9" /********************************************************************* * COPYRIGHT NOTICE * ********************************************************************** @@ -213,7 +213,8 @@ char dirletter; } #include -#if (defined(SYSV) || defined(USG)) && !defined(SIGPOLL) +#include +#if (defined(SYSV) || defined(USG)) && !defined(SIG_POLL) /* * mkdir(dirname, mode) * @@ -222,9 +223,6 @@ char dirletter; */ mkdir(dirname, mode) -#ifdef __STDC__ -const -#endif char *dirname; int mode; { diff --git a/usr/src/lib/xlibcurses/screen/uparm.h b/usr/src/lib/xlibcurses/screen/uparm.h new file mode 100644 index 0000000..4c01625 --- /dev/null +++ b/usr/src/lib/xlibcurses/screen/uparm.h @@ -0,0 +1,51 @@ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)curses:screen/uparm.h 1.4" +/* + * Local configuration of various files. Used if you can't put these + * things in the standard places or aren't the super user, so you + * don't have to modify the source files. Thus, you can install updates + * without having to re-localize your sources. + * + * This file used to go in /usr/include/local/uparm.h. Every version of + * UNIX has undone this, so now it wants to be installed in each source + * directory that needs it. This means you now include "uparm.h" instead + * of "local/uparm.h". + */ + +#ifndef __STDC__ /* not ANSI C */ +/* Path to library files */ +#define libpath(file) "/usr/lib/file" + +/* Path to local library files */ +#define loclibpath(file) "/usr/local/lib/file" + +/* Path to binaries */ +#define binpath(file) "/usr/ucb/file" + +/* Path to things under /usr (e.g. /usr/preserve) */ +#define usrpath(file) "/usr/file" + +/* Location of terminfo binary directory tree */ +#define _TERMPATH(file) "/usr/lib/terminfo/file" +#else /* __STDC__ */ +#define libpath(file) "/usr/lib/" #file +#define loclibpath(file) "/usr/local/lib/" #file +#define binpath(file) "/usr/ucb/" #file +#define usrpath(file) "/usr/" #file +#define _TERMPATH(file) "/usr/share/lib/terminfo/" #file +#endif /* __STDC__ */ + +/* Location of termcap file */ +#define E_TERMCAP "/etc/termcap" + +/* Location of terminfo source file */ +#define E_TERMINFO "./terminfo.src" + +/* Location of the C shell */ +#define B_CSH "/bin/csh" diff --git a/usr/src/lib/xlibcurses/xlibcurses.mk b/usr/src/lib/xlibcurses/xlibcurses.mk index 82b522a..21f80ca 100644 --- a/usr/src/lib/xlibcurses/xlibcurses.mk +++ b/usr/src/lib/xlibcurses/xlibcurses.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)curses:libcurses.mk 1.20" +#ident "@(#)curses:libcurses.mk 1.19" # # Curses Library High Level Makefile. # @@ -126,4 +126,3 @@ bsd: cd screen; make rmident @echo "Curses has been converted for BSD" # this has only been tested on 4.2BSD, but we assume libc has getopt. - diff --git a/usr/src/lib/zlibeti/curses/INSTALL b/usr/src/lib/zlibeti/curses/INSTALL new file mode 100644 index 0000000..6f4ed03 --- /dev/null +++ b/usr/src/lib/zlibeti/curses/INSTALL @@ -0,0 +1,83 @@ +#ident "@(#)sti:curses/INSTALL 1.2" +# +# Save the mount point of the floppy & the package name. +# + +INSPATH="/install/new" +INSINS="/install/install" +PKGNAME="`cat ${INSPATH}/usr/options/svr2curs.name`" +ORDER="`cat ${INSINS}/ORDER`" + + +# +# How much space is needed by this floppy? +# + +USRneeds=`expr "\`du -s ${INSPATH}/usr\`" : "\([0-9]*\).*"` +ROOTneeds=`expr "\`du -s ${INSPATH}\`" : "\([0-9]*\).*"` +ROOTneeds=`expr ${ROOTneeds} - ${USRneeds}` + +# +# How much space is available in the necessary filesystems? +# + +USRspace=`expr "\`df /usr 2>/dev/null\`" : '.*: *\([0-9]*\)'` +ROOTspace=`expr "\`df / 2>/dev/null\`" : '.*: *\([0-9]*\)'` + +# +# Now see if the package fits! +# Inform the user and exit immediately, if not. +# + +if + [ "$USRspace" -lt "$USRneeds" ] +then + echo "**ERROR** ${PKGNAME} cannot be installed --" + echo "Not enough space on the hard disk." + echo "There are $USRspace blocks available" + echo "on the /usr file system --" + echo "$USRneeds blocks are needed." + exit +elif + [ "$ROOTspace" -lt "$ROOTneeds" ] +then + echo "**ERROR** ${PKGNAME} cannot be installed --" + echo "Not enough space on the hard disk." + echo "There are $ROOTspace blocks available" + echo "on the / (root) file system --" + echo "$ROOTneeds blocks are needed." + exit +fi + +if [ -s /usr/lib/libcurses.a ] +then + if [ "${ORDER}" = "3" ] + then + echo "Installing the ${PKGNAME}." + echo "Copyright (c) 1984 AT&T" + echo "All Rights Reserved" + fi +elif [ ! -s /usr/lib/libcurses.a -a "${ORDER}" = "3" ] +then + echo "Installing the ${PKGNAME}." + echo "Copyright (c) 1984 AT&T" + echo "All Rights Reserved" +fi + +UNIXVER=`uname -r | cut -f1 -d.` +if [ $UNIXVER -eq 2 ] + then + cd ${INSPATH} + echo "The following files are being installed:" + find . -print | cpio -pduvm / + ln /usr/lib/libcurses.a /usr/lib/libtermcap.a + echo /usr/lib/libtermcap.a + ln /usr/lib/libcurses.a /usr/lib/libtermlib.a + echo /usr/lib/libtermlib.a + echo + echo + else + echo "This diskette should not be installed on this computer\n" + echo "Install diskette 1 of the TERMINFO Utilities to install the curses library\n" +fi +echo "The installation of ${PKGNAME} is now complete." diff --git a/usr/src/lib/zlibeti/curses/ORDER.1 b/usr/src/lib/zlibeti/curses/ORDER.1 new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/usr/src/lib/zlibeti/curses/ORDER.1 @@ -0,0 +1 @@ +1 diff --git a/usr/src/lib/zlibeti/curses/ORDER.2 b/usr/src/lib/zlibeti/curses/ORDER.2 new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/usr/src/lib/zlibeti/curses/ORDER.2 @@ -0,0 +1 @@ +2 diff --git a/usr/src/lib/zlibeti/curses/ORDER.3 b/usr/src/lib/zlibeti/curses/ORDER.3 new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/usr/src/lib/zlibeti/curses/ORDER.3 @@ -0,0 +1 @@ +3 diff --git a/usr/src/lib/zlibeti/curses/Rlist.svr2curs b/usr/src/lib/zlibeti/curses/Rlist.svr2curs new file mode 100644 index 0000000..069e63d --- /dev/null +++ b/usr/src/lib/zlibeti/curses/Rlist.svr2curs @@ -0,0 +1,15 @@ +/etc/termcap +/usr/lib/llib-lcurses +/usr/lib/llib-lcurses.ln +/usr/lib/libcurses.a +/usr/lib/libtermcap.a +/usr/lib/libtermlib.a +/usr/lib/terminfo +/usr/bin/captoinfo +/usr/bin/infocmp +/usr/bin/tic +/usr/bin/tput +/usr/include/curses.h +/usr/include/term.h +/usr/include/unctrl.h +/usr/options/svr2curs.name diff --git a/usr/src/lib/zlibeti/curses/UNINSTALL b/usr/src/lib/zlibeti/curses/UNINSTALL new file mode 100644 index 0000000..6a7240e --- /dev/null +++ b/usr/src/lib/zlibeti/curses/UNINSTALL @@ -0,0 +1,80 @@ +#ident "@(#)pkg.terminf:terminf/UNINSTALL 1.4" + +# +# UNINSTALL the Terminal Information Utilities +# +# Save mount point of floppy (INSPATH) and package name (PKGNAME) +# + +INSPATH=/install/new +PKGNAME=`cat ${INSPATH}/usr/options/svr2curs.name` + +# +# Remove the files found in the Rlist file from the hard disk. +# + +echo "Removing the ${PKGNAME}." +if [ ! -s /usr/options/svr2curs.name ] + then + echo "The `cat ${INSPATH}/usr/options/svr2curs.name` package is not installed\n" + exit +fi + +echo "The following files and directories are being removed:" +for i in `cat /install/install/Rlist` +do + echo $i + rm -fr $i +done +echo +echo "The ${PKGNAME} have been removed." +echo + +# +# Re-build /usr/lib/terminfo +# + +echo Re-installing core terminfo entries +echo +if [ -d /usr/lib/terminfo ] + then : + else mkdir /usr/lib/terminfo + chown bin /usr/lib/terminfo + chgrp bin /usr/lib/terminfo + chmod 775 /usr/lib/terminfo + echo /usr/lib/terminfo has been re-built +fi + +# +# Re-install core entries +# + +cd /usr/lib/.COREterm +find . -print| while read file +do + DIR=`expr ${file} : '.*/\(.*\)/.*'` + + if [ -f ${file} ] + then + if [ -d /usr/lib/terminfo/${DIR} ] + then : + else mkdir /usr/lib/terminfo/${DIR} + chown bin /usr/lib/terminfo/${DIR} + chgrp bin /usr/lib/terminfo/${DIR} + chmod 775 /usr/lib/terminfo/${DIR} + echo + echo Built directory /usr/lib/terminfo/${DIR} + echo + fi + + BASE=`expr ${file} : '.*/\(.*/.*\)'` + ln ${BASE} /usr/lib/terminfo/${BASE} + echo Linked /usr/lib/.COREterm/${BASE} to /usr/lib/terminfo/${BASE} + fi +done +echo +echo Re-installation of core terminfo entries is complete +echo + + + diff --git a/usr/src/lib/zlibeti/curses/proto.1 b/usr/src/lib/zlibeti/curses/proto.1 new file mode 100644 index 0000000..2340b1d --- /dev/null +++ b/usr/src/lib/zlibeti/curses/proto.1 @@ -0,0 +1,47 @@ +/dev/null +1422 100 +d--775 0 3 +install d--775 0 3 + Rlist ---555 2 2 ./install/terminf/Rlist.terminf + UNINSTALL ---555 2 2 ./install/terminf/UNINSTALL + INSTALL ---555 2 2 ./install/terminf/INSTALL + ORDER ---555 2 2 ./install/terminf/ORDER.1 +$ +new d--775 0 3 + etc d--775 0 3 + termcap ---444 2 2 ../etc/termcap + $ + usr d--775 0 3 + bin d--775 2 2 + captoinfo ---555 2 2 ../usr/bin/captoinfo + infocmp ---555 2 2 ../usr/bin/infocmp + tic ---555 2 2 ../usr/bin/tic + tput ---555 2 2 ../usr/bin/tput + $ + include d--775 2 2 + curses.h ---444 2 2 ../usr/include/curses.h + term.h ---444 2 2 ../usr/include/term.h + unctrl.h ---444 2 2 ../usr/include/unctrl.h + $ + lib d--775 0 3 + llib-lcurses ---444 2 2 ../usr/lib/llib-lcurses + llib-lcurses.ln ---444 2 2 ../usr/lib/llib-lcurses.ln + libcurses.a ---444 2 2 ../usr/lib/libcurses.a + terminfo d--775 2 2 + $ + tabset d--775 2 2 + 3101 ---444 2 2 ../usr/lib/tabset/3101 + beehive ---444 2 2 ../usr/lib/tabset/beehive + std ---444 2 2 ../usr/lib/tabset/std + teleray ---444 2 2 ../usr/lib/tabset/teleray + vt100 ---444 2 2 ../usr/lib/tabset/vt100 + xerox1720 ---444 2 2 ../usr/lib/tabset/xerox1720 + $ + $ + options d--775 0 3 + terminf.name ---444 2 2 ./install/terminf/terminf.name + $ + $ +$ +$ +@(#)sti:curses/proto.1 1.1 diff --git a/usr/src/lib/zlibeti/curses/proto.2 b/usr/src/lib/zlibeti/curses/proto.2 new file mode 100644 index 0000000..1d734d3 --- /dev/null +++ b/usr/src/lib/zlibeti/curses/proto.2 @@ -0,0 +1,51 @@ +/dev/null +1422 100 +d--775 0 3 +install d--775 0 3 + INSTALL ---555 2 2 ./install/terminf/INSTALL + UNINSTALL ---555 2 2 ./install/terminf/UNINSTALL + Rlist ---555 2 2 ./install/terminf/Rlist.terminf + ORDER ---555 2 2 ./install/terminf/ORDER.3 + setup ---555 2 2 ./install/terminf/setup + adds.ti ---444 2 2 ../usr/src/lib/terminfo/adds.ti + annarbor.ti ---444 2 2 ../usr/src/lib/terminfo/annarbor.ti + ansi.ti ---444 2 2 ../usr/src/lib/terminfo/ansi.ti + att.ti ---444 2 2 ../usr/src/lib/terminfo/att.ti + beehive.ti ---444 2 2 ../usr/src/lib/terminfo/beehive.ti + cdc.ti ---444 2 2 ../usr/src/lib/terminfo/cdc.ti + colorscan.ti ---444 2 2 ../usr/src/lib/terminfo/colorscan.ti + datamedia.ti ---444 2 2 ../usr/src/lib/terminfo/datamedia.ti + dec.ti ---444 2 2 ../usr/src/lib/terminfo/dec.ti + diablo.ti ---444 2 2 ../usr/src/lib/terminfo/diablo.ti + fortune.ti ---444 2 2 ../usr/src/lib/terminfo/fortune.ti + general.ti ---444 2 2 ../usr/src/lib/terminfo/general.ti + hardcopy.ti ---444 2 2 ../usr/src/lib/terminfo/hardcopy.ti + hazeltine.ti ---444 2 2 ../usr/src/lib/terminfo/hazeltine.ti + hds.ti ---444 2 2 ../usr/src/lib/terminfo/hds.ti + heath.ti ---444 2 2 ../usr/src/lib/terminfo/heath.ti + homebrew.ti ---444 2 2 ../usr/src/lib/terminfo/homebrew.ti + hp.ti ---444 2 2 ../usr/src/lib/terminfo/hp.ti + lsi.ti ---444 2 2 ../usr/src/lib/terminfo/lsi.ti + microterm.ti ---444 2 2 ../usr/src/lib/terminfo/microterm.ti + misc.ti ---444 2 2 ../usr/src/lib/terminfo/misc.ti + pc.ti ---444 2 2 ../usr/src/lib/terminfo/pc.ti + perkinelmer.ti ---444 2 2 ../usr/src/lib/terminfo/perkinelmer.ti + print.ti ---444 2 2 ../usr/src/lib/terminfo/print.ti + special.ti ---444 2 2 ../usr/src/lib/terminfo/special.ti + sperry.ti ---444 2 2 ../usr/src/lib/terminfo/sperry.ti + tektronix.ti ---444 2 2 ../usr/src/lib/terminfo/tektronix.ti + teleray.ti ---444 2 2 ../usr/src/lib/terminfo/teleray.ti + televideo.ti ---444 2 2 ../usr/src/lib/terminfo/televideo.ti + ti.ti ---444 2 2 ../usr/src/lib/terminfo/ti.ti + tymshare.ti ---444 2 2 ../usr/src/lib/terminfo/tymshare.ti + visual.ti ---444 2 2 ../usr/src/lib/terminfo/visual.ti +$ +new d--775 0 3 + usr d--775 0 3 + options d--775 0 3 + terminf.name ---444 2 2 ./install/terminf/terminf.name + $ + $ +$ +$ +@(#)pkg.terminf:terminf/proto.2 1.5 diff --git a/usr/src/lib/zlibeti/curses/proto.3 b/usr/src/lib/zlibeti/curses/proto.3 new file mode 100644 index 0000000..698e8dd --- /dev/null +++ b/usr/src/lib/zlibeti/curses/proto.3 @@ -0,0 +1,44 @@ +/dev/null +1422 100 +d--775 0 3 +install d--775 0 3 + Rlist ---555 2 2 ./install/terminf/Rlist.svr2curs + UNINSTALL ---555 2 2 ./install/terminf/UNINSTALL.3 + INSTALL ---555 2 2 ./install/terminf/INSTALL.3 + ORDER ---555 2 2 ./install/terminf/ORDER.3 +$ +new d--775 0 3 + usr d--775 0 3 + bin d--775 2 2 + captoinfo ---555 2 2 ../usr/bin/captoinfo + infocmp ---555 2 2 ../usr/bin/infocmp + tic ---555 2 2 ../usr/bin/tic + tput ---555 2 2 ../usr/bin/tput + $ + include d--775 2 2 + curses.h ---444 2 2 ../usr/include/curses.h + term.h ---444 2 2 ../usr/include/term.h + unctrl.h ---444 2 2 ../usr/include/unctrl.h + $ + lib d--775 0 3 + llib-lcurses ---444 2 2 ../usr/lib/llib-lcurses + llib-lcurses.ln ---444 2 2 ../usr/lib/llib-lcurses.ln + libcurses.a ---444 2 2 ../usr/lib/libcurses.a + terminfo d--775 2 2 + $ + tabset d--775 2 2 + 3101 ---444 2 2 ../usr/lib/tabset/3101 + beehive ---444 2 2 ../usr/lib/tabset/beehive + std ---444 2 2 ../usr/lib/tabset/std + teleray ---444 2 2 ../usr/lib/tabset/teleray + vt100 ---444 2 2 ../usr/lib/tabset/vt100 + xerox1720 ---444 2 2 ../usr/lib/tabset/xerox1720 + $ + $ + options d--775 0 3 + svr2curs.name ---444 2 2 ./install/terminf/svr2curs.name + $ + $ +$ +$ +@(#)pkg.terminf:terminf/proto.1 1.11 diff --git a/usr/src/lib/zlibeti/curses/setup b/usr/src/lib/zlibeti/curses/setup new file mode 100644 index 0000000..5304d7d --- /dev/null +++ b/usr/src/lib/zlibeti/curses/setup @@ -0,0 +1,262 @@ +#ident "@(#)sti:curses/setup 1.1" +# +# Script for installation of terminfo entries +# +cd /install/install + +rm -rf /usr/tmp/all.ti +COMPILE="tic -v " +PERMLOC=/usr/lib/terminfo +TIFILES=`ls -aFx *.ti`; +TMPLOC=/usr/tmp/terminf.wrk + +# +# This routine locates a terminal name within a terminfo file +# +locate_ent() +{ + # + # This routine searches for the terminal name within + # the ti files, if found the file's name is displayed. + # + disp_msg() + { + FILE=`egrep -l "^${TERMNAME}\||^[^#].*\|${TERMNAME}\|" *.ti` + if [ -n "${FILE}" ] + then echo "Terminal ${TERMNAME} is located within terminfo file '${FILE}'" + else echo Terminal ${TERMNAME} not found. + fi + } + + # + # Prompt user for terminal name, reject a NULL reply + # + echo + echo "Enter terminal name to be located: \c" + read TERMNAME + if [ -n "${TERMNAME}" ] + then disp_msg + else echo Null reply ignored! + fi +} +# +# Search for the given terminal name - If found compile it +# into /usr/tmp and then move the SINGLE terminal entry to +# ${PERMLOC}. Perform all necessary links. +# +single_file() +{ + # + # This routine performs the actual build, moves + # and links. + # + tmpbuild() + { + # + # Clean up from prior run + # + rm -rf ${TMPLOC} + mkdir ${TMPLOC} + + # + # Compile entire file into a temporary location + # + TERMINFO=${TMPLOC} tic ${FILE} + + # + # Locate the subdirectory of the requested device + # + PREFIX=`expr ${TERMNAME} : '\(.\)' \| ${TERMNAME}` + + # + # To perform links we get the inode of the actual + # file created by tic, then search for all files + # in the ${TMPLOC} directory with the same inode. + # Those files with the same inode are aliases for + # The original entry. + # + CURDIR=`pwd` + cd ${TMPLOC} + INODE=`echo \`ls -i ${PREFIX}/${TERMNAME}\` | cut -f 1 -d ' '` + echo Working in ${PERMLOC} + + # + # Ensure ${PERMLOC} directory exists + # + if [ ! -d "${PERMLOC}" ] + then mkdir ${PERMLOC} + chmod 775 ${PERMLOC} + chown bin ${PERMLOC} + chgrp bin ${PERMLOC} + fi + + # + # Ensure directory exists for upcoming copy + # + if [ ! -d "${PERMLOC}/${PREFIX}" ] + then mkdir ${PERMLOC}/${PREFIX} + fi + + cp ${TMPLOC}/${PREFIX}/${TERMNAME} ${PERMLOC}/${PREFIX} + echo Created ${PREFIX}/${TERMNAME} + ls -i */* | grep ${INODE} | cut -c7- | while read LINKTO + do + PARTIAL=${PREFIX}/${TERMNAME} + DEST=${PERMLOC}/${LINKTO} + # + # Locate the subdirectory of the requested device + # + LNKPRE=`expr ${LINKTO} : '\(.\)' \| ${LINKTO}` + + # + # Ensure LNKPRE dir exists + # + if [ ! -d "${PERMLOC}/${LNKPRE}" ] + then mkdir "${PERMLOC}/${LNKPRE}" + fi + + if [ "${PARTIAL}" != "${LINKTO}" ] + then ln ${PERMLOC}/${PARTIAL} ${DEST} + echo Linked ${LINKTO} + fi + done + cd ${CURDIR} + rm -rf ${TMPLOC} + } + + # + # This routine determines the file which contains the + # terminal desired. If found it is compiled via tmpbuild() + # + looktic() + { + FILE=`egrep -l "^${TERMNAME}\||^[^#].*\|${TERMNAME}\|" *.ti` + if [ -n "${FILE}" ] + then tmpbuild + else echo Terminal ${TERMNAME} not found. + fi + } + + # + # Prompt user for terminal name, reject NULL reply + # + echo + echo "Enter terminal name: \c" + read TERMNAME + if [ -n "${TERMNAME}" ] + then looktic + else echo Null reply ignored! + fi +} +# +# List all eligible files, and allow building of any one file +# +tic_file() +{ + # + # Display list of available files + # + list_files() + { + echo + echo "The following terminfo files may be selected for installation:" + echo + ls -aFx *.ti + } + + # + # The user's file must be in our list + # + valid_file() + { + echo /usr/tmp/all.ti ${TIFILES} | grep ${FILE} > /dev/null + return $? + } + + # + # Ensure only one file is specified + # + multiple() + { + echo ${FILE} | egrep " | " > /dev/null + if [ $? -eq 0 ] + then echo "Error: Only one file may be specified!" + return 0 + else return 1 + fi + } + + # + # Display file names, and loop over the user's replies + # + list_files + while :; + do + rm -rf /usr/tmp/all.ti + echo + echo "Enter a file name, 'all', 'done', or 'files': \c" + read FILE + if [ -n "${FILE}" ] + then if [ "${FILE}" = "all" ] + then rm -rf /usr/tmp/all.ti + cat *.ti > /usr/tmp/all.ti + FILE=/usr/tmp/all.ti + fi + if multiple + then :; + # + # If the user's reply is not NULL + # continue parseing + # + elif [ "${FILE}" = "done" ] + then return + + elif [ "${FILE}" = "files" ] + then list_files + + # + # If user gave us a file name, + # verify it as a .ti file, and + # compile it + # + elif [ -f "${FILE}" ] + then if valid_file + then ${COMPILE} ${FILE} + else echo Error: ${FILE} is not in the list! + fi + + else echo Error: ${FILE} is not a file! + fi + else echo Null reply ignored! + fi + done +} + +# +# Main loop of the script, handles main menu +# +while :; + do + echo + echo " 0 Terminate installation" + echo + echo " 1 Install terminfo file(s)" + echo + echo " 2 Locate a specific terminal within terminfo file(s)" + echo + echo " 3 Compile a SINGLE terminal entry" + echo + echo "Enter option: \c" + read OPTION + if [ -n "${OPTION}" ] + then + case ${OPTION} in + 0) exit;; + 1) tic_file;; + 2) locate_ent;; + 3) single_file;; + *) echo "Invalid option";; + esac + else echo "Null reply ignored!" + fi + done diff --git a/usr/src/lib/zlibeti/curses/svr2curs.name b/usr/src/lib/zlibeti/curses/svr2curs.name new file mode 100644 index 0000000..06f24da --- /dev/null +++ b/usr/src/lib/zlibeti/curses/svr2curs.name @@ -0,0 +1 @@ +SVR2 Curses Library Release 1 diff --git a/usr/src/lib/zlibeti/demo/form0.c b/usr/src/lib/zlibeti/demo/form0.c index b75e304..a2363c4 100644 --- a/usr/src/lib/zlibeti/demo/form0.c +++ b/usr/src/lib/zlibeti/demo/form0.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/demo/form1.c b/usr/src/lib/zlibeti/demo/form1.c index 453b1ed..bc20b74 100644 --- a/usr/src/lib/zlibeti/demo/form1.c +++ b/usr/src/lib/zlibeti/demo/form1.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/demo/form2.c b/usr/src/lib/zlibeti/demo/form2.c index 816c48c..fec55c4 100644 --- a/usr/src/lib/zlibeti/demo/form2.c +++ b/usr/src/lib/zlibeti/demo/form2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ @@ -175,7 +175,7 @@ minute 00 fields to the given values. the following shell procedure might be used to populate the data_input file and invoke mkform. -date "+by $LOGNAME%nmonth %m%nday %d%nhour 8/22/89nminute %M" >/usr/tmp/data$$ +date "+by $LOGNAME%nmonth %m%nday %d%nhour 6/7/89nminute %M" >/usr/tmp/data$$ mkform memo.desc /usr/tmp/data$$ msg$$ rm /usr/tmp/data$$ diff --git a/usr/src/lib/zlibeti/demo/makefile b/usr/src/lib/zlibeti/demo/makefile index c6e9573..f261e6b 100644 --- a/usr/src/lib/zlibeti/demo/makefile +++ b/usr/src/lib/zlibeti/demo/makefile @@ -1,4 +1,4 @@ -# Copyright (c) 1988 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T diff --git a/usr/src/lib/zlibeti/demo/menu0.c b/usr/src/lib/zlibeti/demo/menu0.c index 02a49e9..9e8f9c7 100644 --- a/usr/src/lib/zlibeti/demo/menu0.c +++ b/usr/src/lib/zlibeti/demo/menu0.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/demo/menu1.c b/usr/src/lib/zlibeti/demo/menu1.c index 4536c96..584b066 100644 --- a/usr/src/lib/zlibeti/demo/menu1.c +++ b/usr/src/lib/zlibeti/demo/menu1.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/eti.h b/usr/src/lib/zlibeti/eti.h index 328cc6a..11837d2 100644 --- a/usr/src/lib/zlibeti/eti.h +++ b/usr/src/lib/zlibeti/eti.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/chg_char.c b/usr/src/lib/zlibeti/form/chg_char.c index 49dff2f..15a27fb 100644 --- a/usr/src/lib/zlibeti/form/chg_char.c +++ b/usr/src/lib/zlibeti/form/chg_char.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/chg_data.c b/usr/src/lib/zlibeti/form/chg_data.c index 8070d07..c3f8765 100644 --- a/usr/src/lib/zlibeti/form/chg_data.c +++ b/usr/src/lib/zlibeti/form/chg_data.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/chg_field.c b/usr/src/lib/zlibeti/form/chg_field.c index 9b5fbca..750c48b 100644 --- a/usr/src/lib/zlibeti/form/chg_field.c +++ b/usr/src/lib/zlibeti/form/chg_field.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/chg_page.c b/usr/src/lib/zlibeti/form/chg_page.c index 966f9cd..c31bd85 100644 --- a/usr/src/lib/zlibeti/form/chg_page.c +++ b/usr/src/lib/zlibeti/form/chg_page.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/driver.c b/usr/src/lib/zlibeti/form/driver.c index e6fd36b..87a0b49 100644 --- a/usr/src/lib/zlibeti/form/driver.c +++ b/usr/src/lib/zlibeti/form/driver.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field.c b/usr/src/lib/zlibeti/form/field.c index e934267..eaafd29 100644 --- a/usr/src/lib/zlibeti/form/field.c +++ b/usr/src/lib/zlibeti/form/field.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_back.c b/usr/src/lib/zlibeti/form/field_back.c index 255afd3..6f04034 100644 --- a/usr/src/lib/zlibeti/form/field_back.c +++ b/usr/src/lib/zlibeti/form/field_back.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_buf.c b/usr/src/lib/zlibeti/form/field_buf.c index 0400ddb..e11cbea 100644 --- a/usr/src/lib/zlibeti/form/field_buf.c +++ b/usr/src/lib/zlibeti/form/field_buf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_fore.c b/usr/src/lib/zlibeti/form/field_fore.c index e6cd7fd..1e3dbd9 100644 --- a/usr/src/lib/zlibeti/form/field_fore.c +++ b/usr/src/lib/zlibeti/form/field_fore.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_init.c b/usr/src/lib/zlibeti/form/field_init.c index a229baf..4492c1d 100644 --- a/usr/src/lib/zlibeti/form/field_init.c +++ b/usr/src/lib/zlibeti/form/field_init.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_just.c b/usr/src/lib/zlibeti/form/field_just.c index 73a2a7c..41665f2 100644 --- a/usr/src/lib/zlibeti/form/field_just.c +++ b/usr/src/lib/zlibeti/form/field_just.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_opts.c b/usr/src/lib/zlibeti/form/field_opts.c index a275232..6944b23 100644 --- a/usr/src/lib/zlibeti/form/field_opts.c +++ b/usr/src/lib/zlibeti/form/field_opts.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_pad.c b/usr/src/lib/zlibeti/form/field_pad.c index 7757fa8..35747c0 100644 --- a/usr/src/lib/zlibeti/form/field_pad.c +++ b/usr/src/lib/zlibeti/form/field_pad.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_stat.c b/usr/src/lib/zlibeti/form/field_stat.c index 503b843..f1fc9fb 100644 --- a/usr/src/lib/zlibeti/form/field_stat.c +++ b/usr/src/lib/zlibeti/form/field_stat.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_term.c b/usr/src/lib/zlibeti/form/field_term.c index 7b1bf2b..f9ea77b 100644 --- a/usr/src/lib/zlibeti/form/field_term.c +++ b/usr/src/lib/zlibeti/form/field_term.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/field_user.c b/usr/src/lib/zlibeti/form/field_user.c index 992198a..e96e2c8 100644 --- a/usr/src/lib/zlibeti/form/field_user.c +++ b/usr/src/lib/zlibeti/form/field_user.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/fieldtype.c b/usr/src/lib/zlibeti/form/fieldtype.c index d01df43..85e6825 100644 --- a/usr/src/lib/zlibeti/form/fieldtype.c +++ b/usr/src/lib/zlibeti/form/fieldtype.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form.c b/usr/src/lib/zlibeti/form/form.c index f88805c..2a7f0d1 100644 --- a/usr/src/lib/zlibeti/form/form.c +++ b/usr/src/lib/zlibeti/form/form.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form.h b/usr/src/lib/zlibeti/form/form.h index b6157b1..7e0941c 100644 --- a/usr/src/lib/zlibeti/form/form.h +++ b/usr/src/lib/zlibeti/form/form.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form_init.c b/usr/src/lib/zlibeti/form/form_init.c index 603c00d..432a824 100644 --- a/usr/src/lib/zlibeti/form/form_init.c +++ b/usr/src/lib/zlibeti/form/form_init.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form_opts.c b/usr/src/lib/zlibeti/form/form_opts.c index 0d4b9ff..05989dc 100644 --- a/usr/src/lib/zlibeti/form/form_opts.c +++ b/usr/src/lib/zlibeti/form/form_opts.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form_sub.c b/usr/src/lib/zlibeti/form/form_sub.c index a41e426..154610a 100644 --- a/usr/src/lib/zlibeti/form/form_sub.c +++ b/usr/src/lib/zlibeti/form/form_sub.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form_term.c b/usr/src/lib/zlibeti/form/form_term.c index 4f9d86d..ad3da8c 100644 --- a/usr/src/lib/zlibeti/form/form_term.c +++ b/usr/src/lib/zlibeti/form/form_term.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form_user.c b/usr/src/lib/zlibeti/form/form_user.c index 2f0b9aa..3debee7 100644 --- a/usr/src/lib/zlibeti/form/form_user.c +++ b/usr/src/lib/zlibeti/form/form_user.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/form_win.c b/usr/src/lib/zlibeti/form/form_win.c index 5db694d..7d54739 100644 --- a/usr/src/lib/zlibeti/form/form_win.c +++ b/usr/src/lib/zlibeti/form/form_win.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/llib-lform.c b/usr/src/lib/zlibeti/form/llib-lform.c index b87fbf5..69407ec 100644 --- a/usr/src/lib/zlibeti/form/llib-lform.c +++ b/usr/src/lib/zlibeti/form/llib-lform.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/makefile b/usr/src/lib/zlibeti/form/makefile index 6b9fc19..2633cd6 100644 --- a/usr/src/lib/zlibeti/form/makefile +++ b/usr/src/lib/zlibeti/form/makefile @@ -1,4 +1,4 @@ -# Copyright (c) 1988 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T @@ -6,7 +6,7 @@ # actual or intended publication of such source code. # -#ident "@(#)sti:form/makefile 1.15" +#ident "@(#)sti:form/makefile 1.13" # ROOT= diff --git a/usr/src/lib/zlibeti/form/post.c b/usr/src/lib/zlibeti/form/post.c index 1103905..90cc65e 100644 --- a/usr/src/lib/zlibeti/form/post.c +++ b/usr/src/lib/zlibeti/form/post.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/regcmp.c b/usr/src/lib/zlibeti/form/regcmp.c index 728803a..8300dbe 100644 --- a/usr/src/lib/zlibeti/form/regcmp.c +++ b/usr/src/lib/zlibeti/form/regcmp.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/regex.c b/usr/src/lib/zlibeti/form/regex.c index ccf9259..a18b2c1 100644 --- a/usr/src/lib/zlibeti/form/regex.c +++ b/usr/src/lib/zlibeti/form/regex.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/ty_alnum.c b/usr/src/lib/zlibeti/form/ty_alnum.c index 9a9fd7a..cb4b713 100644 --- a/usr/src/lib/zlibeti/form/ty_alnum.c +++ b/usr/src/lib/zlibeti/form/ty_alnum.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/ty_alpha.c b/usr/src/lib/zlibeti/form/ty_alpha.c index 5987791..a7a0102 100644 --- a/usr/src/lib/zlibeti/form/ty_alpha.c +++ b/usr/src/lib/zlibeti/form/ty_alpha.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/ty_enum.c b/usr/src/lib/zlibeti/form/ty_enum.c index 73251ab..55f78bb 100644 --- a/usr/src/lib/zlibeti/form/ty_enum.c +++ b/usr/src/lib/zlibeti/form/ty_enum.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/ty_int.c b/usr/src/lib/zlibeti/form/ty_int.c index bb95e3f..b17e3cc 100644 --- a/usr/src/lib/zlibeti/form/ty_int.c +++ b/usr/src/lib/zlibeti/form/ty_int.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/ty_num.c b/usr/src/lib/zlibeti/form/ty_num.c index 32b2eb5..3da4880 100644 --- a/usr/src/lib/zlibeti/form/ty_num.c +++ b/usr/src/lib/zlibeti/form/ty_num.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/ty_regexp.c b/usr/src/lib/zlibeti/form/ty_regexp.c index 40eaec7..e08d17d 100644 --- a/usr/src/lib/zlibeti/form/ty_regexp.c +++ b/usr/src/lib/zlibeti/form/ty_regexp.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/utility.c b/usr/src/lib/zlibeti/form/utility.c index ffd6214..78a158d 100644 --- a/usr/src/lib/zlibeti/form/utility.c +++ b/usr/src/lib/zlibeti/form/utility.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/form/utility.h b/usr/src/lib/zlibeti/form/utility.h index 85ce1b6..2abd98a 100644 --- a/usr/src/lib/zlibeti/form/utility.h +++ b/usr/src/lib/zlibeti/form/utility.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/man3/menu.3c b/usr/src/lib/zlibeti/man3/menu.3c new file mode 100644 index 0000000..4cb3ce9 --- /dev/null +++ b/usr/src/lib/zlibeti/man3/menu.3c @@ -0,0 +1,132 @@ +.\"ident "@(#)sti:man3/menu.3c 1.1" +.deTH +.PD +.nrIN \\n()Mu +.ift .ds ]H \\$1\^(\^\\$2\^) +.ifn .ds ]H \\$1(\\$2) +.if\\n()s .ds ]D +.if\\n()t .ds ]D UNIX System V +.ifn .ds ]D UNIX System V +.ds]L +.if!\\$3 .ds ]L (\^\\$3\^) +.if!\\$4 .ds ]D \\$4 +.wh0 }H +.wh-\\n(:mu }F +.em}M +.if\\n(nl .bp +.nr)I \\n()Mu +.nr)R 0 +.}E +.DT +.ifn \{.na +.nh\} +.ift \{.bd S 3 3 +.hy14 \} +.. +.TH MENU 3C +.SH NAME +menu - CRT menu routines +.SH SYNOPSIS +.B #include +.PP +.B cc +[ flags ] files +.B \-lmenu +.B \-lcurses +[ libraries ] +.SH DESCRIPTION +These routines allow the user to create, display, and access menus. +The menus can be displayed on any display device supported by curses(3X). +.SH "SEE ALSO" +form(3), panel(3) and curses(3X). +.SH FUNCTIONS +.nf +.B MENU \(**m; +.B ITEM \(**i; +.B int c, r; +.B int \(**rp, \(**cp; +.B char \(**n, \(**d; +.B ITEM \(**\(**ip; +.B PTF_void f; +.B OPTIONS o; +.B WINDOW \(**w; +.fi +.PP +.LP +.nf +.ta 2.5i +int current_item(m) returns index of current item +int free_item(i) free storage allocated for item +int free_menu(m) free storage allocated for menu +char \(**item_description(i) returns pointer to item's description +PTF_void item_init(m) returns pointer to item initialization routine +char \(**item_name(i) returns pointer to item's name +OPTIONS item_opts(i) returns item's option setting +PTF_void item_term(m) returns pointer to item's termination routine +char \(**item_userptr(i) returns pointer to item's user pointer +int item_count(m) returns number of items in this menu +int item_value(i) returns value of item TRUE=selected, FALSE=unselected +int item_visible(i) TRUE=item displayed on current page, FALSE=not displayed +int menu_back(m) returns attribute that indicates a nonselected items +int menu_driver(m, c) performs user menu requests +int menu_fore(m) returns attribute that indicates a selected items +void menu_format(m, rp, cp) returns number of rows and columns in menu +int menu_grey(m) returns attribute that indicates a nonselectable item +PTF_void menu_init(m) returns pointer to menu's initialization routine +ITEM \(**\(**menu_items(m) returns pointer to the list of menu items +char \(**menu_mark(m) returns pointer to the menu's mark +OPTIONS menu_opts(m) returns menu's option setting +int menu_pad(m) returns menu's pad character +char \(**menu_pattern(m) returns pointer to menu's last pattern match +WINDOW \(**menu_sub(m) returns pointer to menu's subwindow +PTF_void menu_term(m) returns pointer to menu's termination routine +char \(**menu_userptr(m) returns pointer to menu's user pointer +WINDOW \(**menu_win(m) returns pointer to menu's window +ITEM \(**new_item(n, d) returns pointer to new item +MENU \(**new_menu(ip) returns pointer to new menu +int pos_menu_cursor(m) moves the menu window's cursor to the correct position to continue menu processing +int post_menu(m) displays the menu within the menu's subwindow +int scale_menu(m, rp, cp) returns minimal window size to contain menu +int set_current_item(m, c) sets index of current item +int set_item_init(m, f) sets item's initialization routine +int set_item_opts(i, o) sets item's options +int set_item_term(m, f) sets item's termination routine +int set_item_userptr(i, n) sets item's user pointer +int set_item_value(i, c) sets item's value +int set_menu_back(m, c) sets menu's attribute for unselected items +int set_menu_fore(m, c) sets menu's attribute for selected items +int set_menu_format(m, c, r) sets menu's format +int set_menu_grey(m, c) sets menu's attribute for nonselectable items +int set_menu_init(m, f) sets menu's initialization routine +int set_menu_items(m, i) associates item list with menu +int set_menu_mark(m, n) sets menu's mark string +int set_menu_opts(m, o) sets menu's options +int set_menu_pad(m, c) sets pad character for menu +int set_menu_pattern(m, n) sets index to current item to matched pattern +int set_menu_sub(m, w) sets menu's subwindow +int set_menu_term(m, f) sets menu's termination routine +int set_menu_userptr(m, n) sets menu's user pointer +int set_menu_win(m, w) associates window with menu +int set_top_item(m, c) sets index to menu's top item +int top_item(m) returns index to menu's top item +int unpost_menu(m) erases previously displayed menu +.fi +.SH DIAGNOSTICS +The following values are returned by most integer routines: +.LP +.nf +.ta 2.5i +E_OK the routine returned normally +E_SYSTEM_ERROR the error is the result of a system error +E_BAD_ARGUMENT an incorrect argument was passed to the routine +E_POSTED the menu given has not been posted +E_CONNECTED one or more items are connected to another menu +E_BAD_STATE the routine was called from within the menu driver +E_NO_ROOM the menu will not fit within menu's subwindow +E_NOT_POSTED the menu has not yet been posted +E_UNKNOWN_COMMAND an unrecognizable request was given to the driver +E_NO_MATCH no match occurred +E_NOT_SELECTABLE the item cannot be selected +E_NOT_CONNECTED there are no items associated with the menu +E_REQUEST_DENIED the menu driver could not process the request +.fi diff --git a/usr/src/lib/zlibeti/menu/affect.c b/usr/src/lib/zlibeti/menu/affect.c index 9f46436..cc99c93 100644 --- a/usr/src/lib/zlibeti/menu/affect.c +++ b/usr/src/lib/zlibeti/menu/affect.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/chk.c b/usr/src/lib/zlibeti/menu/chk.c index d8bb22f..82dd7aa 100644 --- a/usr/src/lib/zlibeti/menu/chk.c +++ b/usr/src/lib/zlibeti/menu/chk.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/connect.c b/usr/src/lib/zlibeti/menu/connect.c index 86864be..59f95fd 100644 --- a/usr/src/lib/zlibeti/menu/connect.c +++ b/usr/src/lib/zlibeti/menu/connect.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/curitem.c b/usr/src/lib/zlibeti/menu/curitem.c index f9d5d3f..3b7c468 100644 --- a/usr/src/lib/zlibeti/menu/curitem.c +++ b/usr/src/lib/zlibeti/menu/curitem.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/driver.c b/usr/src/lib/zlibeti/menu/driver.c index 1c1037d..e018d9b 100644 --- a/usr/src/lib/zlibeti/menu/driver.c +++ b/usr/src/lib/zlibeti/menu/driver.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/global.c b/usr/src/lib/zlibeti/menu/global.c index c7da5a4..3af0b91 100644 --- a/usr/src/lib/zlibeti/menu/global.c +++ b/usr/src/lib/zlibeti/menu/global.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/itemcount.c b/usr/src/lib/zlibeti/menu/itemcount.c index c2ff2c0..54f7f51 100644 --- a/usr/src/lib/zlibeti/menu/itemcount.c +++ b/usr/src/lib/zlibeti/menu/itemcount.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/itemopts.c b/usr/src/lib/zlibeti/menu/itemopts.c index 12d1d26..8fbd780 100644 --- a/usr/src/lib/zlibeti/menu/itemopts.c +++ b/usr/src/lib/zlibeti/menu/itemopts.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/itemusrptr.c b/usr/src/lib/zlibeti/menu/itemusrptr.c index 73a28bf..26c7556 100644 --- a/usr/src/lib/zlibeti/menu/itemusrptr.c +++ b/usr/src/lib/zlibeti/menu/itemusrptr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/itemvalue.c b/usr/src/lib/zlibeti/menu/itemvalue.c index d892566..1fabc92 100644 --- a/usr/src/lib/zlibeti/menu/itemvalue.c +++ b/usr/src/lib/zlibeti/menu/itemvalue.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/link.c b/usr/src/lib/zlibeti/menu/link.c index b1016bb..7baf38c 100644 --- a/usr/src/lib/zlibeti/menu/link.c +++ b/usr/src/lib/zlibeti/menu/link.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/llib-lmenu.c b/usr/src/lib/zlibeti/menu/llib-lmenu.c index 00df980..2cede25 100644 --- a/usr/src/lib/zlibeti/menu/llib-lmenu.c +++ b/usr/src/lib/zlibeti/menu/llib-lmenu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/makefile b/usr/src/lib/zlibeti/menu/makefile index c566065..63c579d 100644 --- a/usr/src/lib/zlibeti/menu/makefile +++ b/usr/src/lib/zlibeti/menu/makefile @@ -1,4 +1,4 @@ -# Copyright (c) 1988 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T @@ -6,7 +6,7 @@ # actual or intended publication of such source code. # -#ident "@(#)sti:menu/makefile 1.15" +#ident "@(#)sti:menu/makefile 1.13" # ROOT= diff --git a/usr/src/lib/zlibeti/menu/menu.h b/usr/src/lib/zlibeti/menu/menu.h index 371008b..4c3af3c 100644 --- a/usr/src/lib/zlibeti/menu/menu.h +++ b/usr/src/lib/zlibeti/menu/menu.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menuback.c b/usr/src/lib/zlibeti/menu/menuback.c index 431bcdf..0350ff7 100644 --- a/usr/src/lib/zlibeti/menu/menuback.c +++ b/usr/src/lib/zlibeti/menu/menuback.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menucursor.c b/usr/src/lib/zlibeti/menu/menucursor.c index 1b22765..159b069 100644 --- a/usr/src/lib/zlibeti/menu/menucursor.c +++ b/usr/src/lib/zlibeti/menu/menucursor.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menufore.c b/usr/src/lib/zlibeti/menu/menufore.c index f4d44fd..559cb24 100644 --- a/usr/src/lib/zlibeti/menu/menufore.c +++ b/usr/src/lib/zlibeti/menu/menufore.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menuformat.c b/usr/src/lib/zlibeti/menu/menuformat.c index f34f5ff..e63d541 100644 --- a/usr/src/lib/zlibeti/menu/menuformat.c +++ b/usr/src/lib/zlibeti/menu/menuformat.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menugrey.c b/usr/src/lib/zlibeti/menu/menugrey.c index 416cb76..887696d 100644 --- a/usr/src/lib/zlibeti/menu/menugrey.c +++ b/usr/src/lib/zlibeti/menu/menugrey.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menuitems.c b/usr/src/lib/zlibeti/menu/menuitems.c index 5841b6d..35b7718 100644 --- a/usr/src/lib/zlibeti/menu/menuitems.c +++ b/usr/src/lib/zlibeti/menu/menuitems.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menumark.c b/usr/src/lib/zlibeti/menu/menumark.c index 5a056f8..9a9d572 100644 --- a/usr/src/lib/zlibeti/menu/menumark.c +++ b/usr/src/lib/zlibeti/menu/menumark.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menuopts.c b/usr/src/lib/zlibeti/menu/menuopts.c index 4080970..98dc8a4 100644 --- a/usr/src/lib/zlibeti/menu/menuopts.c +++ b/usr/src/lib/zlibeti/menu/menuopts.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menupad.c b/usr/src/lib/zlibeti/menu/menupad.c index 4f986c4..611699d 100644 --- a/usr/src/lib/zlibeti/menu/menupad.c +++ b/usr/src/lib/zlibeti/menu/menupad.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menuserptr.c b/usr/src/lib/zlibeti/menu/menuserptr.c index b36c549..7d307e5 100644 --- a/usr/src/lib/zlibeti/menu/menuserptr.c +++ b/usr/src/lib/zlibeti/menu/menuserptr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menusub.c b/usr/src/lib/zlibeti/menu/menusub.c index 16b1b4c..28b2c2d 100644 --- a/usr/src/lib/zlibeti/menu/menusub.c +++ b/usr/src/lib/zlibeti/menu/menusub.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/menuwin.c b/usr/src/lib/zlibeti/menu/menuwin.c index 03aba81..3b18331 100644 --- a/usr/src/lib/zlibeti/menu/menuwin.c +++ b/usr/src/lib/zlibeti/menu/menuwin.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/newitem.c b/usr/src/lib/zlibeti/menu/newitem.c index 5ce9c52..a4802c3 100644 --- a/usr/src/lib/zlibeti/menu/newitem.c +++ b/usr/src/lib/zlibeti/menu/newitem.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/newmenu.c b/usr/src/lib/zlibeti/menu/newmenu.c index c943d3f..73f5668 100644 --- a/usr/src/lib/zlibeti/menu/newmenu.c +++ b/usr/src/lib/zlibeti/menu/newmenu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/pattern.c b/usr/src/lib/zlibeti/menu/pattern.c index 06754d2..61e6899 100644 --- a/usr/src/lib/zlibeti/menu/pattern.c +++ b/usr/src/lib/zlibeti/menu/pattern.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/post.c b/usr/src/lib/zlibeti/menu/post.c index 93e671b..066047d 100644 --- a/usr/src/lib/zlibeti/menu/post.c +++ b/usr/src/lib/zlibeti/menu/post.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/private.h b/usr/src/lib/zlibeti/menu/private.h index f269f5a..a29b787 100644 --- a/usr/src/lib/zlibeti/menu/private.h +++ b/usr/src/lib/zlibeti/menu/private.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/scale.c b/usr/src/lib/zlibeti/menu/scale.c index f7ce89a..39d5011 100644 --- a/usr/src/lib/zlibeti/menu/scale.c +++ b/usr/src/lib/zlibeti/menu/scale.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/show.c b/usr/src/lib/zlibeti/menu/show.c index a67786d..d180733 100644 --- a/usr/src/lib/zlibeti/menu/show.c +++ b/usr/src/lib/zlibeti/menu/show.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/terminit.c b/usr/src/lib/zlibeti/menu/terminit.c index 088b9c6..018ff4c 100644 --- a/usr/src/lib/zlibeti/menu/terminit.c +++ b/usr/src/lib/zlibeti/menu/terminit.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/tests/makefile b/usr/src/lib/zlibeti/menu/tests/makefile index ac29af1..106d57e 100644 --- a/usr/src/lib/zlibeti/menu/tests/makefile +++ b/usr/src/lib/zlibeti/menu/tests/makefile @@ -1,4 +1,4 @@ -# Copyright (c) 1988 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T diff --git a/usr/src/lib/zlibeti/menu/topitem.c b/usr/src/lib/zlibeti/menu/topitem.c index 5e399d9..36a19ee 100644 --- a/usr/src/lib/zlibeti/menu/topitem.c +++ b/usr/src/lib/zlibeti/menu/topitem.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/menu/visible.c b/usr/src/lib/zlibeti/menu/visible.c index ab622c2..7ea965c 100644 --- a/usr/src/lib/zlibeti/menu/visible.c +++ b/usr/src/lib/zlibeti/menu/visible.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/bottom.c b/usr/src/lib/zlibeti/panel/bottom.c index 5f88593..7830ab5 100644 --- a/usr/src/lib/zlibeti/panel/bottom.c +++ b/usr/src/lib/zlibeti/panel/bottom.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/delete.c b/usr/src/lib/zlibeti/panel/delete.c index a1fe0c3..cb24ee8 100644 --- a/usr/src/lib/zlibeti/panel/delete.c +++ b/usr/src/lib/zlibeti/panel/delete.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/llib-lpanel.c b/usr/src/lib/zlibeti/panel/llib-lpanel.c index 5eee19e..c617226 100644 --- a/usr/src/lib/zlibeti/panel/llib-lpanel.c +++ b/usr/src/lib/zlibeti/panel/llib-lpanel.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/makefile b/usr/src/lib/zlibeti/panel/makefile index 73ad44f..878f1a6 100644 --- a/usr/src/lib/zlibeti/panel/makefile +++ b/usr/src/lib/zlibeti/panel/makefile @@ -1,4 +1,4 @@ -# Copyright (c) 1988 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T @@ -6,7 +6,7 @@ # actual or intended publication of such source code. # -#ident "@(#)sti:panel/makefile 1.12" +#ident "@(#)sti:panel/makefile 1.10" # ROOT= diff --git a/usr/src/lib/zlibeti/panel/misc.c b/usr/src/lib/zlibeti/panel/misc.c index 3ece6f0..64758f8 100644 --- a/usr/src/lib/zlibeti/panel/misc.c +++ b/usr/src/lib/zlibeti/panel/misc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/move.c b/usr/src/lib/zlibeti/panel/move.c index 4babbc6..5799971 100644 --- a/usr/src/lib/zlibeti/panel/move.c +++ b/usr/src/lib/zlibeti/panel/move.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/new.c b/usr/src/lib/zlibeti/panel/new.c index 8fdeb33..2a48957 100644 --- a/usr/src/lib/zlibeti/panel/new.c +++ b/usr/src/lib/zlibeti/panel/new.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/panel.h b/usr/src/lib/zlibeti/panel/panel.h index 6bef93e..ed5aaa3 100644 --- a/usr/src/lib/zlibeti/panel/panel.h +++ b/usr/src/lib/zlibeti/panel/panel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/private.h b/usr/src/lib/zlibeti/panel/private.h index c663928..52b0f24 100644 --- a/usr/src/lib/zlibeti/panel/private.h +++ b/usr/src/lib/zlibeti/panel/private.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/replace.c b/usr/src/lib/zlibeti/panel/replace.c index 5e16966..f38f7e7 100644 --- a/usr/src/lib/zlibeti/panel/replace.c +++ b/usr/src/lib/zlibeti/panel/replace.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/top.c b/usr/src/lib/zlibeti/panel/top.c index 7530fcb..18cc43a 100644 --- a/usr/src/lib/zlibeti/panel/top.c +++ b/usr/src/lib/zlibeti/panel/top.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/panel/update.c b/usr/src/lib/zlibeti/panel/update.c index 5eb42c6..a9f81fd 100644 --- a/usr/src/lib/zlibeti/panel/update.c +++ b/usr/src/lib/zlibeti/panel/update.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibeti/zlibeti.mk b/usr/src/lib/zlibeti/zlibeti.mk index e010eba..cf31c61 100644 --- a/usr/src/lib/zlibeti/zlibeti.mk +++ b/usr/src/lib/zlibeti/zlibeti.mk @@ -1,4 +1,4 @@ -# Copyright (c) 1988 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T @@ -6,7 +6,7 @@ # actual or intended publication of such source code. # -#ident "@(#)libeti:libeti.mk 1.7" +#ident "@(#)libeti:libeti.mk 1.6" # ROOT= diff --git a/usr/src/lib/zlibetitam/ReadMagic.c b/usr/src/lib/zlibetitam/ReadMagic.c index c1c5b26..1c64bec 100644 --- a/usr/src/lib/zlibetitam/ReadMagic.c +++ b/usr/src/lib/zlibetitam/ReadMagic.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/Virt2Ansi.c b/usr/src/lib/zlibetitam/Virt2Ansi.c index af8347e..e151367 100644 --- a/usr/src/lib/zlibetitam/Virt2Ansi.c +++ b/usr/src/lib/zlibetitam/Virt2Ansi.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/chartam.h b/usr/src/lib/zlibetitam/chartam.h index ce7533c..269a511 100644 --- a/usr/src/lib/zlibetitam/chartam.h +++ b/usr/src/lib/zlibetitam/chartam.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/compat.c b/usr/src/lib/zlibetitam/compat.c index 25937af..368597e 100644 --- a/usr/src/lib/zlibetitam/compat.c +++ b/usr/src/lib/zlibetitam/compat.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/cvttam.h b/usr/src/lib/zlibetitam/cvttam.h index 2c76f19..60d906b 100644 --- a/usr/src/lib/zlibetitam/cvttam.h +++ b/usr/src/lib/zlibetitam/cvttam.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/design.mm b/usr/src/lib/zlibetitam/design.mm new file mode 100644 index 0000000..d7a5b93 --- /dev/null +++ b/usr/src/lib/zlibetitam/design.mm @@ -0,0 +1,684 @@ +.\"ident "@(#)stitam:design.mm 1.3" +.lg 0 +.ds cu curses(3X) +.nr Pt 0 +.TL +TAM \(-> SVR3 Curses +.br +Conversion Library +.br +Design Document +.br +Issue 1.0 +.AU "C. D. Francis" cdf SF 60545412 6106 A-118 "attunix!davef" +.AU "G. B. Smith" gbs SF 60545412 6649 G-211 "attunix!snort" +.AS 2 +This document describes a method by which existing TAM programs will run on any +character terminal that is supported by \*(cu. +This method is completely SVID compatible and doesn't use the TAM library. +This document only addresses the issue of character mode applications and +will not address the problem of supporting +TAM graphics mode applications on character terminals. +.AE +.MT "INTERNAL MEMORANDUM" +.PF "''Issue 1.0''" +.H 1 "INTRODUCTION" +This document describes a method by which existing TAM programs will run on any +character terminal that is supported by \*(cu. +This method is completely SVID compatible and doesn't use the TAM library. +This document only addresses the issue of character mode applications and +will not address the problem of supporting +TAM graphics mode applications on character terminals. +.P +Compatibility will be achieved using header files and a set of library +routines that perform TAM functions with calls to \*(cu. +.P +Co-existence of TAM and \*(cu library calls within an application +program will not be achieved by +the conversion library. TAM applications will continue to be limited +to the TAM interface defined for the UNIX PC. +.P +This effort is a part of the Extended Terminal Interface (ETI) project. +The objective of the ETI project is to provide a standard software interface +for screen management and text operations.\*F +In order to achieve compatiblity across the AT&T product line, +ETI has choosen the \*(cu library as its base interface for character +terminals. The primary purpose of the TAM Conversion Library is to +extend the utility of otherwise non-portable UNIX PC applications by providing +a TAM library that is \*(cu compatible. +.FS +Extended Terminal Interface, High Level Requirements for Release 1.0. +N. M. Shah, April 18, 1986 +.FE +.H 1 "MOTIVATION" +Currently, TAM programs only run on the UNIX PC and a limited number of +terminals. +TAM also uses a much older terminal information database (termcap) than the +current version of \*(cu. +This tool will provide a migration path for TAM programs to operate across +the AT&T product line. +.H 1 "CONVERSION" +Compatibility will be achieved by means of a header file, \fItam.h\fP, +and a set of library +subroutines. +All TAM programs will have to be recompiled using the new \fItam.h\fP +header file and then +linked with the new subroutines and the \*(cu library. +The header file will cast all TAM routines directly to conversion library routines +and provide casts for TAM subroutine parameters. +For example, the TAM function \fIwcreate()\fP will be mapped to the conversion +library function \fBTAMwcreate()\fP. \fBTAMwcreate()\fP will consist of +a series of \*(cu calls. +.H 2 "Assumptions" +The following assumptions are being made about TAM, the TAM user +community, and \*(cu, in the design of the migration +tool. +.H 3 "iswind()" +It must be assumed that the iswind() function will always return false. +This implies that the bitmap functions supported by TAM will not operate +with this conversion process. This alleviates the need to convert hardware +dependent code. +.P +The user is responsible for the removal of the unused segments of code that +are not executed following the iswind() function call. +The expurgation is not required, but is recommended since it will +reduce the size of the code. +.P +.H 3 "Mouse Handling" +All calls to track(3T) will map to a call to wgetch(). This coincides with +the way track(3T) currently works on a character terminal. +.P +All calls to mouse management routines will translate to null operations. +This coincides with the results returned for TAM mouse management routines +on character terminals. +.H 3 "Keyboard Map Files" +Keyboard features described by TAM Keyboard Map files are fully subsumed by +new options of SVR3 \fIterminfo\fP and \fI\*(cu\fP. Keymap files are +not necessary for a TAM conversion library based on SVR3 \fI\*(cu\fP. +.H 3 "UNIX PC Keyboard Escape Sequences" +The particular escape sequences emitted by non-ASCII UNIX PC keyboard keys +are of interest to the TAM community. Escape sequences for non-ASCII keyboard +keys will always be expressed to an applications program as their equivalent +UNIX PC keyboard escape sequences. +.H 3 "Virtual Key Codes" +The TAM community references virtual key codes by their symbolic names +defined in \fItam.h\fP rather than by their actual eight bit values. +It is acceptable to change the eight bit values of virtual key codes in \fItam.h\fP. +.H 1 "MONITIONS AND CONCERNS" +.H 2 "System Calls" +Systems calls specifically tailored to the UNIX PC would not be translated. +Calls such as ioctl(2), that have no corresponding meaning to \*(cu +will not be handled. Such system calls are not part of the recommended +TAM interface and will fail under the TAM transition library on all machines +except the UNIX PC. +.H 2 "Curses and TAM Libraries" +Both the \*(cu and TAM libraries contain duplicate subroutine names and +it is for this reason that programs cannot contain a mixture of TAM and +\*(cu subroutines. +In other words, TAM programs that are being migrated cannot contain +calls to \*(cu subroutines other than those provided by TAM. +.H 2 "ANSI Standards - Keyboard Input" +To what extent are ANSI sequences needed in for keyboard input? +More specifically, do applications expect to see escape sequences or just +one character values for key depressions? +The TAM documentation recommends that all keyboard input be through +TAM virtualization functions. The current thought is that the TAM +Conversion Library will allow strict ANSI or input virtualization keyboard +input. +.H 2 "ANSI Standards - Display Output" +To what extent must ANSI sequences be recognized for display output? +Recognizing a generic set of escape sequences is diametric to +\*(cu philosphy, yet the UNIX PC permits generic ANSI sequences on +a limited number of devices. More concretely, on the UNIX PC +\fIecho "\\033[J"\fP will usually clear the screen. The overhead +of yet another display output layer is tremendous while the gained +functionality supports a strictly non-portable coding technique. +The TAM Transition library will not recognize arbitrary ANSI escape +for display output purposes. +.H 1 "DESIGN" +.P +The design of the TAM Conversion Library is broken into two fundamental +sections. The first section, \fBTAM \(-> \*(cu Mapping\fP, covers +the problems of mapping TAM display functions to \*(cu display functions. +The second section, \fBKeyboard Management Subsystem\fP, covers TAM +keyboard input and other input related functions. +.H 2 "TAM \(-> \*(cu Mapping" +The following table gives a brief summary of the mapping of TAM to \*(cu +functions. All references to \*(cu functions and data structures will be +in \fBbold type\fP and all references to TAM functions and data structures +will be in \fIitalic type\fP. +.TS +center tab(;) allbox; +lI lw(4i). +.sp +TAM Function;\fBCurses(3X) Equivalent\fP +.sp +winit();T{ +Call \fBinitscr()\fP and also set up a static link list of window pointers. +Each of these pointers will maintain a forward and backward link to +other windows; information about the window's border; and the window's +prompt, user, label and slk text strings. +The global variable that indicates the current TAM window (\fIwncur\fP) is +declared and initialized in winit. Finally, winit decrements +the value of LINES by the size of the softkey labels, prompt and +command lines at the bottom of the screen. +T} +wexit();Call \fBendwin()\fP and \fBexit().\fP +iswind();Return FALSE. +wcreate();T{ +Call \fBnewwin()\fP and return a window index that looks like the TAM window +index. The flag indicating that variable characters widths are being +used is to be ignored. If a border around the window is indicated then +a subwindow is also created to contain the scrollable portion of the +window and a box is drawn in the parent window. +T} +wdelete();T{ +Call \fBdelwin()\fP and remove the window from the list of windows. +Next, loop through all remaining windows and call \fBtouchwin()\fP and +\fBwnoutrefresh()\fP for each window. +Finally, call \fBdoupdate().\fP +T} +wselect();T{ +Call \fBtouchwin()\fP and \fBwrefresh(),\fP then update the list of windows to +indicate the new ordering. +T} +wgetsel();T{ +Return index to window that is on top, i.e., last window refreshed. +This window will always be the first window given in the list of +windows. +T} +wgetstat();T{ +Return a copy of the \fIwstat\fP structure associated with the window. +T} +wsetstat();T{ +This command can change the size and position of a window and whether +or not the window has a border. +If the size of the window has changed then a new window must be created +(\fBnewwin()\fP), the contents of the old window must be copied to the new +one (\fBoverwrite()\fP), and the old window must be deleted (\fBdelwin()\fP). +.sp +If the border has been changed then a subwindow needs to be either +created or deleted. +.sp +Finally, this window needs to be selected and all the windows need to +be refreshed. +T} +wputc();Call \fBwaddch().\fP +wputs();Call \fBwaddstr().\fP +wprintf();Call\fBwprintw().\fP +wslk();T{ +The array of character strings passed by \fIwslk()\fP are copied to the +structure associated with the window. +T} +wcmd();T{ +The character string passed by \fIwcmd()\fP is copied to the +structure associated with the window. +T} +wprompt();T{ +The character string passed by \fIwprompt()\fP is copied to the +structure associated with the window. +T} +wlabel();T{ +The character string passed by \fIwlabel()\fP is copied to the +structure associated with the window. +T} +wrefresh();T{ +Call \fBwrefresh().\fP +If the window index is -1 then all windows are refreshed in the +appropriate order. +T} +wuser();T{ +The character string passed by \fIwuser()\fP is copied to the +structure associated with the window. +T} +wgoto();Call \fBwmove().\fP +wgetpos();Call \fBgetyx().\fP +wgetc();T{ +Call \fBwgetch().\fP +Character translation, from \*(cu to ANSI may be required depending +on the current keypad mode. +T} +kcodemap();T{ +The ASCII representation of a virtual key is returned where the ASCII +representation is defined by the UNIX PC implementation of TAM. This +is consistent with the current UNIX PC implementation for character +terminals. +T} +keypad();Call \fBkeypad().\fP +wsetmouse();T{ +This is a null operation. +T} +wgetmouse();This is a null operation. +wreadmouse();This is a null operation. +wprexec();Call \fBerase()\fP and \fBrefresh();\fP +wpostwait();T{ +Call \fBwrefresh()\fP for each window in the window list. +T} +wnl();T{ +Toggle between calls to \fBnl()\fP and \fBnonl().\fP +T} +wicon();\fRThis is a null operation. +wicoff();This is a null operation. +track();Call \fBwgetch().\fP +initscr();Call \fBinitscr().\fP +nl();Call \fIwnl(wncur,1).\fP +nonl();Call \fIwnl(wncur,0).\fP +cbreak();Call \fBcbreak().\fP +nocbreak();Call \fBnocbreak().\fP +echo();Call \fBecho().\fP +noecho();Call \fBnoecho().\fP +insch();Call \fBinch().\fP +getch();Call \fBgetch().\fP +flushinp();Call \fBflushinp().\fP +attron();Call \fBattron().\fP +attroff();Call \fBattroff().\fP +savetty();Call \fBsavetty().\fP +resetty();Call \fBresetty().\fP +addch();Call \fIwputc(wncur,...).\fP +addstr();Call \fIwputs(wncur,...).\fP +beep();Call \fBbeep().\fP +clear();Call \fBclear().\fP +clearok();Call \fBclearok().\fP +clrtobot();Call \fBclrtobot().\fP +clrtoeol();Call \fBclrtoeol().\fP +delch();Call \fBdelch().\fP +deleteln();Call \fBdeleteln().\fP +erase();Call \fIclear().\fP +flash();Call \fIbeep().\fP +getyx();Call \fIwgetpos().\fP +insch();Call \fBinsch().\fP +insertln();Call \fBinsertln().\fP +leaveok();This is a null operation. +move();Call \fBwgoto().\fP +mvaddch();Call \fImove()\fP and \fIaddch().\fP +mvaddstr();Call \fImove()\fP and \fIaddstr().\fP +mvinch();Call \fImove()\fP and \fIinch().\fP +nodelay();Call \fBnodelay().\fP +refresh();Call \fIwrefresh(wncur).\fP +resetterm();Call \fBresetterm().\fP +baudrate();Call \fBbaudrate()\fP. +endwin();Call \fBendwin()\fP. +fixterm();Call \fBfixterm()\fP. +printw();Call \fIwprintw(wncur,...)\fP. +.TE +.P +For completeness, the TAM Conversion library includes the TAM message, +menu, form, help, window, and paste buffer functions. +These "high level" functions are built from the functions in +the previous table. +.TS +center allbox tab(;); +cB s s s +lI lI lI lI. +TAM High Level Functions +message();menu();form();exhelp() +wind();pb_open();pb_check();pb_seek() +pb_empty();pb_name();pb_puts();pb_weof() +pb_gets();pb_gbuf();adf_gtwrd();adf_gtxcd() +adf_gttok() +.TE +.H 2 "Keyboard Management Subsystem" +.P +This section includes the design for the \fBKeyboard Management\fP subsystem +of the TAM Conversion library. +.H 3 "Fundamental Problems & Resolutions" +.P +This section addresses the following TAM keyboard input and input related functions. +.VL 20 +.LI "wgetc()" +Read a character from the keyboard. +.LI "keypad()" +Activate or deactivate the translation of escape sequences into virtual +function key codes. +.LI "kcodemap()" +Return the UNIX PC keyboard escape sequence corresponding to a particular +virtual function key. +.LE +.P +Associated with the TAM keyboard input and input related functions are +four basic problems. The problems and their associated resolutions are +listed below. +.BL +.LI +Keyboard Map Files. TAM Keyboard Map files describe the mapping of function key +escape codes to UNIX PC virtual function codes. This functionality is +fully subsumed by new options of SVR3 \fIterminfo\fP and \*(cu. +.LI +Function Key Virtualization. TAM supports a set of virtual function keys +whose numerical values are different than the equivalent \*(cu virtual +function keys. The conversion library will support the same virtual function +key names as UNIX PC TAM but their values will be changed to their SVR3 +\*(cu equivalents. +.LI +Functionally Incompatible Keyboards. Functionally incompatible keyboards +are keyboards that are missing keys that are present on the UNIX PC. +The functions provided by absent keys will be supported by a series +of UNIX PC escape sequences. This technique is similar to that provided +by TAM for character terminals on the UNIX PC. +.LI +Operationally Incompatible Keyboards. Operationally incompatible keyboards +are keyboards that have one or more keys that emit escape sequences that are identical +to the UNIX PC keyboard sequences but do not match in terms of functionality. +The function of an operationally incompatible key will always map to its +\fIterminfo\fP specification. The TAM specific function implied by the same +escape sequence will be accessible through the technique +for functionally incompatible keyboards. +Mechanisms in \*(cu automatically handle timing conflicts between actual +keyboard function keys and UNIX PC keyboard escape sequences. +.LE +.bp +.H 3 "Basic Model" +.P +The following diagram and subsequent notes briefly describe the +\fBKeyboard Subsystem\fP of the TAM conversion library. +.DF +.de PS \" start picture +. \" $1 is height, $2 is width, both in inches +.if t .sp .3 +.in (\\n(.lu-\\$2)/2u +.ne \\$1 +.. +.de PE \" end of picture +.in +.if t .sp .6 +.. +.PS +Transition: box height boxht*6 width boxwid*6 +.ps +4 + "Keyboard Subsystem" ljust at Transition.nw + (linewid/4,-linewid/3) + +.ps -4 + +CursesKey: line <- left linewid*2 from 1/4 between Transition.nw and Transition.sw + + box invis with .n at CursesKey.c "Virtual Key" "from wgetch()" + +SVR3Curses: box with .e at CursesKey.l "SVR3" "Curses" + +VtoAnsi: box height boxht*2 with .se at Transition.se - (linewid,0) "Virtual" "To ANSI" "Mapper" +MagicEscape: box height boxht*2 with .se at 3/4 between Transition.sw and Transition.s "Magic" "Escape" "Recognizer" + +DecisionA: circle radius circlerad/4 at CursesKey.r + (linewid/2,0) +DecisionB: circle radius circlerad/4 at (Transition.s.x+linewid,DecisionA.r.y) + + line -> from CursesKey.r to DecisionA.w +AtoB: line -> from DecisionA.e to DecisionB.w + +AtoMagic0: line from DecisionA.s to (DecisionA.s.x,MagicEscape.w.y+linewid/4) + +AtoMagic1: line <- from MagicEscape.w to (DecisionA.s.x+linewid/4,MagicEscape.w.y) + arc from AtoMagic0.s to AtoMagic1.w + + +MagicToB0: line from MagicEscape.e to (MagicEscape.e.x+linewid/2,MagicEscape.e.y) +MagicToB1: line -> from MagicToB0.e + (linewid/4,linewid/4) to (MagicToB0.e.x+linewid/4,AtoB.c.y) + arc from MagicToB0.e to MagicToB1.s + +KpadOn0: line from DecisionB.n to (DecisionB.n.x,Transition.n.y-linewid/2) +KpadOn1: line from KpadOn0.n + (linewid/4,linewid/4) to (VtoAnsi.n.x+linewid,Transition.n.y-linewid/4) +KpadOn2: line -> from (KpadOn1.e.x+linewid/4,KpadOn0.n.y) to (KpadOn1.e.x+linewid/4,Transition.e.y) + arc from KpadOn1.w to KpadOn0.n + arc from KpadOn2.n to KpadOn1.e + +BtoAnsi0: line from DecisionB.s to (DecisionB.s.x,VtoAnsi.w.y+linewid/4) +BtoAnsi1: line -> from (DecisionB.s.x+linewid/4,VtoAnsi.w.y) to VtoAnsi.w + arc from BtoAnsi0.s to BtoAnsi1.w + +AnsiToExit0: line from VtoAnsi.e to (KpadOn2.s.x-linewid/4,VtoAnsi.e.y) +AnsiToExit1: line -> from (KpadOn2.s.x,VtoAnsi.e.y+linewid/4) to KpadOn2.s + arc from AnsiToExit0.e to AnsiToExit1.s +Leave: line -> right from KpadOn2.s + +.ps -2 + "In Escape" ljust "Sequence" ljust at AtoMagic0.c + (linewid/6,0) + box invis with .s at 1/2 between MagicToB1.n and AtoB.e "Virtual" "Key" + "Keypad" ljust "Mode On" ljust at KpadOn0.c + (linewid/6,0) + "Keypad" ljust "Mode Off" ljust at BtoAnsi0.c + (linewid/6,0) + + + circle radius circlerad/3 at CursesKey.c + (0,circlerad/2) "A" + circle radius circlerad/3 at AtoB.c + (0,circlerad/2) "B" + circle radius circlerad/3 at AtoMagic1.c + (0,circlerad/2) "C" + circle radius circlerad/3 at (1/2 between MagicToB1.n and AtoB.e) - (0,circlerad) "D" + circle radius circlerad/3 at KpadOn1.c - (0,circlerad/2) "E" + circle radius circlerad/3 at BtoAnsi1.c - (0,circlerad/2) "F" + circle radius circlerad/3 at Leave.e + (circlerad/3,0) "G" + +.ps +2 +.PE +.DE +.sk 2 +.VL 15 +.LI "\D'c 1.5m'\h'-1m'\s-2A\s+2" +Input from the keyboard is always read using the \*(cu \fIwgetch()\fP +function. Function key virtualization that is terminal dependent will be +handled by \*(cu while the +internals of the Keyboard Subsystem will manage terminal independent +function key virtualization. +.LI "\D'c 1.5m'\h'-1m'\s-2B\s+2" +At this point a keyboard character is either a terminal dependent virtual +function key or a normal ASCII character that is not part of an escape +sequence. Most keys on a keyboard fall into this category. +.LI "\D'c 1.5m'\h'-1m'\s-2C\s+2" +Characters that reach this point are part of a UNIX PC keyboard escape sequence +or part of an escape sequence not supported by the UNIX PC. In the first case +the UNIX PC keyboard escape sequence will be recognized and a virtual +function key code will be ejected from the \fBMagic Escape Recognizer\fP. +In the second case the escape sequence will pass through the +\fBMagic Escape Recognizer\fP unchanged. +.LI "\D'c 1.5m'\h'-1m'\s-2D\s+2" +At this point each character is either an ASCII character, a UNIX PC keyboard +virtual function key character, or a virtual function key character not supported by +the UNIX PC. A decision must be made to either transmit the character \fIas is\fP +to the application program or to translate the character to its corresponding +ANSI representation as defined for the UNIX PC. Normal ASCII characters +map to themselves, UNIX PC virtual function key characters map to various escape +sequences, and other virtual function key characters map to themselves. +.LI "\D'c 1.5m'\h'-1m'\s-2E\s+2" +At this point all keystrokes are passed to the TAM application. Note that +even virtual function keys not present on UNIX PC TAM will be given +to the application. This is not a problem because UNIX PC TAM virtual +function keys are +superset of \*(cu virtual function keys. +.LI "\D'c 1.5m'\h'-1m'\s-2F\s+2" +At this point all UNIX PC TAM virtual function keys are mapped to their +equivalent ASCII escape sequence. All other characters are passed through +unchanged. +.LI "\D'c 1.5m'\h'-1m'\s-2G\s+2" +Finally, at this point characters are passed to the TAM application through +the \fIwgetc()\fP function call. +.LE +.P +The \fIkeypad()\fP function controls the direction of the branch after point +\u\D'c 1m'\h'-.75m'\v'.25n'\s-4G\s+4\v'-.25n'\d. The \fIkcodemap()\fP function uses the +\fBVirtual To ANSI Mapper\fP to translate a TAM virtual function key +into its equivalent UNIX PC keyboard escape sequence. +.H 3 "Magic Escape Recognizer" +.P +The \fBMagic Escape Recognizer\fP will recognize and translate the following +UNIX PC keyboard specific escape sequences into their corresponding +virtual key values. Escape sequences that do not have a virtual key +value are expressed in \fIitalics\fP. +.SK +.2C +.TS +tab(;); +lP-4 cP-4 s +lP-4 cP-4 s +lP-4 lP-4 lP-4. +\fBTAM Escape\fP;\fBVirtual Key\fP +\fBSequence\fP;; +.sp +;TAM;SVR3 Curses +.sp +ESC 0;End;KEY_END +ESC 9;Beg;KEY_BEG +ESC [ A;Up;KEY_UP +ESC [ B;Down;KEY_DOWN +ESC [ C;Forward;KEY_RIGHT +ESC [ D;Back;KEY_LEFT +ESC [ H;Home;KEY_HOME +ESC [ J;Clear;KEY_CLEAR +ESC [ S;RollDn;KEY_SF +ESC [ T;RollUp;KEY_SR +ESC [ U;Page;KEY_NPAGE +ESC [ V;s_Page;KEY_PPAGE +ESC N a;Rfrsh;KEY_REFRESH +ESC N B;s_Beg;KEY_SBEG +ESC N c;Move;KEY_MOVE +ESC N C;s_Move;KEY_SMOVE +ESC N d;Copy;KEY_COPY +ESC N D;s_Copy;KEY_SCOPY +ESC N e;Dlete;KEY_DL +ESC N E;s_Dlete;KEY_SDL +ESC N f;DleteChar;KEY_DC +ESC N F;s_DleteChar;KEY_SDC +ESC N g;Prev;KEY_PREVIOUS +ESC N G;s_Prev;KEY_SPREVIOUS +ESC N h;Next;KEY_NEXT +ESC N H;s_Next;KEY_SNEXT +ESC N i;Mark;KEY_MARK +ESC N I;Slect;KEY_SELECT +ESC N j;InputMode;KEY_IC +ESC N J;s_InputMode;KEY_SIC +ESC N K;s_Back;KEY_SLEFT +ESC N L;s_Forward;KEY_SRIGHT +ESC N M;s_Home;KEY_SHOME +ESC N N;s_End;KEY_SEND +ESC O a;ClearLine;KEY_EOL +ESC O A;s_ClearLine;KEY_SEOL +ESC O b;Rstrt;KEY_RESTART +ESC O B;Ref;KEY_REFRESH +ESC O c;F1;KEY_F(0) +ESC O C;s_F1;KEY_F(8) +ESC O d;F2;KEY_F(1) +ESC O D;s_F2;KEY_F(9) +ESC O e;F3;KEY_F(2) +ESC O E;s_F3;KEY_F(10) +ESC O f;F4;KEY_F(3) +ESC O F;s_F4;KEY_F(11) +ESC O g;F5;KEY_F(4) +ESC O G;s_F5;KEY_F(12) +ESC O h;F6;KEY_F(5) +ESC O H;s_F6;KEY_F(13) +ESC O i;F7;KEY_F(6) +ESC O I;s_F7;KEY_F(14) +ESC O j;F8;KEY_F(7) +ESC O J;s_F8;KEY_F(15) +ESC O k;Exit;KEY_EXIT +ESC O K;s_Exit;KEY_SEXIT +ESC O l;Msg;KEY_MESSAGE +ESC O L;s_Msg;KEY_SMESSAGE +ESC O m;Help;KEY_HELP +ESC O M;s_Help;KEY_SHELP +ESC O n;Creat;KEY_CREATE +ESC O N;s_Creat;KEY_SCREATE +ESC O o;Save;KEY_SAVE +ESC O O;s_Save;KEY_SSAVE +ESC O p;Suspd;KEY_SUSPEND +ESC O P;s_Suspd;KEY_SSUSPEND +ESC O q;Rsume;KEY_RESUME +ESC O Q;s_Rsume;KEY_SRSUME +ESC O r;Opts;KEY_OPTIONS +ESC O R;s_Opts;KEY_SOPTIONS +ESC O s;Undo;KEY_UNDO +ESC O S;s_Undo;KEY_SUNDO +ESC O t;Redo;KEY_REDO +ESC O T;s_Redo;KEY_SREDO +ESC O u;Cmd;KEY_COMMAND +ESC O U;s_Cmd;KEY_SCOMMAND +ESC O v;Open;KEY_OPEN +ESC O V;Close;KEY_CLOSE +ESC O w;Cancl;KEY_CANCEL +ESC O W;s_Cancl;KEY_SCANCEL +ESC O x;Find;KEY_FIND +ESC O X;s_Find;KEY_SFIND +ESC O y;Rplac;KEY_REPLACE +ESC O Y;s_Rplac;KEY_SREPLACE +ESC O z;Print;KEY_PRINT +ESC O Z;s_Print;KEY_SPRINT +ESC P a;PF1;KEY_F(16) +ESC P b;PF2;KEY_F(17) +ESC P c;PF3;KEY_F(18) +ESC P d;PF4;KEY_F(19) +ESC P e;PF5;KEY_F(20) +ESC P f;PF6;KEY_F(21) +ESC P g;PF7;KEY_F(22) +ESC P h;PF8;KEY_F(23) +ESC P i;PF9;KEY_F(24) +ESC P j;PF10;KEY_F(25) +none\(dg;PF11;KEY_F(26) +none\(dd;PF12;KEY_F(27) +.TE +.1C +.FS "\(dg" +The PF11 virtual key code is generated by the sequence on the +Unix PC keyboard. There is no corresponding escape sequence for PF11. +.FE +.FS "\(dd" +The PF12 virtual key code is generated by the sequence on the +Unix PC keyboard. There is no corresponding escape sequence for PF12. +.FE +.H 3 "Virtual To ANSI Mapper" +.P +The \fBVirtual To ANSI Mapper\fP will map any UNIX PC specific virtual keyboard +character into its corresponding UNIX PC keyboard escape sequence. The +set of virtual keyboard characters recognized is listed in the section +\fBMagic Escape Recognizer\fP. + +.SG +.NS +.sp +Department 60545412 +.sp +C. Arndt +O. Bloom +H. Chiesi +C. Cirillo +M. Clitherow +M. DeFazio +D. Kretsch +A. Hall +T. Hansen +D. McGovern +D. Mongeau +L. Ozimek +J. Peterson +E. Rice +H. Shottland +.sp +UNIX SE & PM at SF: +.sp +J. Baccash +A. Barrese +D. Ryan +.sp +UNIX PC SE/Dev. at FJ: +.sp +B. Courte +W. Gregory +R. Tran +B. Weiss +.sp +3B SE at IW: +.sp +J. M. Grinn +P. Walsh +.sp +Area 59: +.sp +D. Belanger +R. Reeves +.sp +OTS: +.sp +S. Chappell +R. Cohen +S. Jarowski +M. Manks +.sp +Bell Labs Training Center: +.sp +N. Ippolito +.NE +.TC diff --git a/usr/src/lib/zlibetitam/doborder.c b/usr/src/lib/zlibetitam/doborder.c index 9570cf9..481cfc3 100644 --- a/usr/src/lib/zlibetitam/doborder.c +++ b/usr/src/lib/zlibetitam/doborder.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/envinit.c b/usr/src/lib/zlibetitam/envinit.c index 6b5653b..4869b4b 100644 --- a/usr/src/lib/zlibetitam/envinit.c +++ b/usr/src/lib/zlibetitam/envinit.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/form.c b/usr/src/lib/zlibetitam/form.c index 150406a..6702b18 100644 --- a/usr/src/lib/zlibetitam/form.c +++ b/usr/src/lib/zlibetitam/form.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/form.h b/usr/src/lib/zlibetitam/form.h index 3809ae5..bc0bd33 100644 --- a/usr/src/lib/zlibetitam/form.h +++ b/usr/src/lib/zlibetitam/form.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/help.c b/usr/src/lib/zlibetitam/help.c index fe10814..f033ed8 100644 --- a/usr/src/lib/zlibetitam/help.c +++ b/usr/src/lib/zlibetitam/help.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/help.h b/usr/src/lib/zlibetitam/help.h index 57e4456..46ef754 100644 --- a/usr/src/lib/zlibetitam/help.h +++ b/usr/src/lib/zlibetitam/help.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/help_ds.c b/usr/src/lib/zlibetitam/help_ds.c index 3fa47cb..eee8659 100644 --- a/usr/src/lib/zlibetitam/help_ds.c +++ b/usr/src/lib/zlibetitam/help_ds.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/help_kb.c b/usr/src/lib/zlibetitam/help_kb.c index 494c8f9..8f9769f 100644 --- a/usr/src/lib/zlibetitam/help_kb.c +++ b/usr/src/lib/zlibetitam/help_kb.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/kcodes.h b/usr/src/lib/zlibetitam/kcodes.h index d643029..cda5b8f 100644 --- a/usr/src/lib/zlibetitam/kcodes.h +++ b/usr/src/lib/zlibetitam/kcodes.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/keypad.c b/usr/src/lib/zlibetitam/keypad.c index ea736b8..c924bba 100644 --- a/usr/src/lib/zlibetitam/keypad.c +++ b/usr/src/lib/zlibetitam/keypad.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/listop.c b/usr/src/lib/zlibetitam/listop.c index 22f12b4..bfdb3a0 100644 --- a/usr/src/lib/zlibetitam/listop.c +++ b/usr/src/lib/zlibetitam/listop.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/llib-lcvt.c b/usr/src/lib/zlibetitam/llib-lcvt.c index b14c49c..2ef80cd 100644 --- a/usr/src/lib/zlibetitam/llib-lcvt.c +++ b/usr/src/lib/zlibetitam/llib-lcvt.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/llib-lform.c b/usr/src/lib/zlibetitam/llib-lform.c index d3ead99..e85575a 100644 --- a/usr/src/lib/zlibetitam/llib-lform.c +++ b/usr/src/lib/zlibetitam/llib-lform.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/llib-lmenu.c b/usr/src/lib/zlibetitam/llib-lmenu.c index da5c6c3..c82257f 100644 --- a/usr/src/lib/zlibetitam/llib-lmenu.c +++ b/usr/src/lib/zlibetitam/llib-lmenu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/llib-lmsg.c b/usr/src/lib/zlibetitam/llib-lmsg.c index e9510f3..902e675 100644 --- a/usr/src/lib/zlibetitam/llib-lmsg.c +++ b/usr/src/lib/zlibetitam/llib-lmsg.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/llib-lpbf.c b/usr/src/lib/zlibetitam/llib-lpbf.c index c40a41e..bdac4d3 100644 --- a/usr/src/lib/zlibetitam/llib-lpbf.c +++ b/usr/src/lib/zlibetitam/llib-lpbf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/llib-ltam.c b/usr/src/lib/zlibetitam/llib-ltam.c index a36f2d5..36ba0d8 100644 --- a/usr/src/lib/zlibetitam/llib-ltam.c +++ b/usr/src/lib/zlibetitam/llib-ltam.c @@ -1,11 +1,11 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)stitam:llib-ltam.c 1.3" +#ident "@(#)stitam:llib-ltam.c 1.2" /*LINTLIBRARY*/ #include "tam.h" #include "message.h" diff --git a/usr/src/lib/zlibetitam/llib-lwind.c b/usr/src/lib/zlibetitam/llib-lwind.c index 054cb81..bd4442f 100644 --- a/usr/src/lib/zlibetitam/llib-lwind.c +++ b/usr/src/lib/zlibetitam/llib-lwind.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/man3/tam.3c b/usr/src/lib/zlibetitam/man3/tam.3c new file mode 100644 index 0000000..639d43d --- /dev/null +++ b/usr/src/lib/zlibetitam/man3/tam.3c @@ -0,0 +1,310 @@ +.\"ident "@(#)stitam:man3/tam.3c 1.1" +.deTH +.PD +.nrIN \\n()Mu +.ift .ds ]H \\$1\^(\^\\$2\^) +.ifn .ds ]H \\$1(\\$2) +.if\\n()s .ds ]D +.if\\n()t .ds ]D UNIX System V +.ifn .ds ]D UNIX System V +.ds]L +.if!\\$3 .ds ]L (\^\\$3\^) +.if!\\$4 .ds ]D \\$4 +.wh0 }H +.wh-\\n(:mu }F +.em}M +.if\\n(nl .bp +.nr)I \\n()Mu +.nr)R 0 +.}E +.DT +.ifn \{.na +.nh\} +.ift \{.bd S 3 3 +.hy14 \} +.. +.TH TAM 3C +.SH NAME +TAM - TAM transition libraries +.SH SYNOPSIS +.B #include +.PP +.B cc +[ flags ] files +.B \-ltam +.B \-lcurses +[ libraries ] +.SH DESCRIPTION +These routines are used to convert existing TAM programs such that they +run on the 3B processor line using any terminal supported by curses(3X). +After a TAM program has been modified to remove machine specific code, +the program is then recompiled using the transition header files +and linked with the transition library. +.SH FUNCTIONS +The following is a list of TAM routines supplied in the transition library. +Those routines marked with an asterisk are macros and don't return any +value. +For a full description of each routine see the UNIX PC Programmers +Reference Manual. +.nf + +\f(CWint addch(wn, c) +short wn; +char c; + +int addstr(s) +char *s; + +int adf_gttok (ptr, tbl) +char *ptr; +struct s_kwtbl *tbl; + +char *adf_gtwrd (sptr, dptr) +char *sptr, dptr; + +char *adf_gtxcd (sptr, dptr) +char *sptr, dptr; + +int attroff() + +int attron() + +int baudrate() + +int beep() + +int cbreak() + +int clear() + +clearok(dummy, dummy)\(** +int dummy; + +int clrtobot() + +int clrtoeol() + +int delch() + +int deleteln() + +int echo() + +int endwin() + +int erase() + +int exhelp (hfile, htitle) +char *hfile, htitle; + +int fixterm() + +int flash() + +int flushinp() + +int form (form, op) +form_t *form; +int op; + +int getch() + +getyx()\(** + +int initscr() + +insch()\(** + +int insertln() + +int iswind() + +char *kcodemap (code) +unsigned char code; + +int keypad (dummy, flag) +int dummy, flag; + +leaveok(dummy, dummy)\(** +int dummy; + +int menu (menu, op) +menu_t *menu; +int op; + +int message (mtype, hfile, htitle, format [, arg ] ...) +int mtype; +char *hfile, htitle, format; + +int move() + +mvaddch()\(** + +mvaddstr()\(** + +mvinch()\(** + +int nl() + +int nocbreak() + +int nodelay(dummy, bool) +int dummy, bool; + +int noecho() + +int nonl() + +int pb_check (stream) +FILE *stream; + +int pb_empty (stream) +FILE *stream; + +int pb_gbuf (ptr, n, fn, stream) +char *ptr; +int n; +int (*fn) (); +FILE *stream; + +char *pb_gets (ptr, n, stream) +char *ptr; +int n; +FILE *stream; + +char *pb_name() + +FILE *pb_open() + +int pb_puts (ptr, stream) +char *ptr; +FILE *stream; + +int pb_seek (stream) +FILE *stream; + +int pb_weof (stream) +FILE *stream; + +int printw (wn, fmt, arg1 ... argn) +short wn; +char *fmt; + +int refresh() + +int resetterm() + +int resetty() + +int savetty() + +int track (w, trk, op, butptr, whyptr) +int w, op, *butptr, *whyptr; +track_t *trk; + +int wcmd (wn, cp) +short wn; +char *cp; + +int wcreate (row, col, height, width, flags) +short row, col, height, width; +unsigned short flags; + +int wdelete (wn) +short wn; + +void wexit() + +int wgetc (wn) +short wn; + +int wgetmouse (wn, ms) +short wn; +struct umdata *ms; + +int wgetpos (wn, rowp, colp) +short wn; +int *rowp, *colp; + +int wgetsel() + +int wgetstat (wn, wstatp) +short wn; +WSTAT *wstatp; + +int wgoto (wn, row, col) +short wn, row, col; + +void wicoff (wn, row, col, icp) +short wn, row, col; +struct icon *icp; + +void wicon (wn, row, col, icp) +short wn, row, col; +struct icon *icp; + +int wind (type, height width, flags, pfont) +int type, height, width; +short flags; +char *pfont[]; + +void winit() + +int wlabel (wn, cp) +short wn; +char *cp; + +void wnl (wn, flag) +short wn; +int flag; + +int wpostwait() + +int wprexec() + +int wprintf (wn, fmt, arg1 ... argn) +short wn; +char *fmt; + +int wprompt (wn, cp) +short wn; +char *cp; + +int wputc (wn, c) +short wn; +char c; + +int wputs (wn, cp) +short wn; +char *cp; + +int wreadmouse (wn, xp, yp, bp, rp) +short wn; +int *xp, *yp, *bp, *rp; + +int wrefresh (wn) +short wn; + +int wselect (wn) +short wn; + +int wsetmouse (wn, ms) +short wn; +struct umdata *ms; + +int wsetstat (wn, wstatp) +short wn; +WSTAT *wstatp; + +int wslk (wn, 0, slong1, slong2, sshort) +short wn; +char *slong1, *slong2, *sshort; + +int wslk (wn, kn, llabel, slabel) +short wn, kn; +char *llabel, *slabel; + +int wuser (wn, cp) +short wn; +char *cp; + diff --git a/usr/src/lib/zlibetitam/mbegin.c b/usr/src/lib/zlibetitam/mbegin.c index f8a323f..07a6c1e 100644 --- a/usr/src/lib/zlibetitam/mbegin.c +++ b/usr/src/lib/zlibetitam/mbegin.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mcitems.c b/usr/src/lib/zlibetitam/mcitems.c index 5c78d39..563322d 100644 --- a/usr/src/lib/zlibetitam/mcitems.c +++ b/usr/src/lib/zlibetitam/mcitems.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mctitle.c b/usr/src/lib/zlibetitam/mctitle.c index 92e8d1d..da43510 100644 --- a/usr/src/lib/zlibetitam/mctitle.c +++ b/usr/src/lib/zlibetitam/mctitle.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mdisplay.c b/usr/src/lib/zlibetitam/mdisplay.c index 5c0a057..c6ef28b 100644 --- a/usr/src/lib/zlibetitam/mdisplay.c +++ b/usr/src/lib/zlibetitam/mdisplay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mend.c b/usr/src/lib/zlibetitam/mend.c index 987bcd8..841010c 100644 --- a/usr/src/lib/zlibetitam/mend.c +++ b/usr/src/lib/zlibetitam/mend.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/menu.c b/usr/src/lib/zlibetitam/menu.c index f716d93..98a7a29 100644 --- a/usr/src/lib/zlibetitam/menu.c +++ b/usr/src/lib/zlibetitam/menu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/menu.h b/usr/src/lib/zlibetitam/menu.h index a2ccee4..2dcf091 100644 --- a/usr/src/lib/zlibetitam/menu.h +++ b/usr/src/lib/zlibetitam/menu.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/message.c b/usr/src/lib/zlibetitam/message.c index 5145104..afb385c 100644 --- a/usr/src/lib/zlibetitam/message.c +++ b/usr/src/lib/zlibetitam/message.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/message.h b/usr/src/lib/zlibetitam/message.h index 94d7111..dd62c77 100644 --- a/usr/src/lib/zlibetitam/message.h +++ b/usr/src/lib/zlibetitam/message.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/minput.c b/usr/src/lib/zlibetitam/minput.c index 02e91ed..47147fd 100644 --- a/usr/src/lib/zlibetitam/minput.c +++ b/usr/src/lib/zlibetitam/minput.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mmatch.c b/usr/src/lib/zlibetitam/mmatch.c index f0b0501..8404818 100644 --- a/usr/src/lib/zlibetitam/mmatch.c +++ b/usr/src/lib/zlibetitam/mmatch.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mscroll.c b/usr/src/lib/zlibetitam/mscroll.c index 55b0eac..112c7df 100644 --- a/usr/src/lib/zlibetitam/mscroll.c +++ b/usr/src/lib/zlibetitam/mscroll.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mshape.c b/usr/src/lib/zlibetitam/mshape.c index f2a91c2..b0addbb 100644 --- a/usr/src/lib/zlibetitam/mshape.c +++ b/usr/src/lib/zlibetitam/mshape.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mtitle.c b/usr/src/lib/zlibetitam/mtitle.c index 8fb2924..458b4a0 100644 --- a/usr/src/lib/zlibetitam/mtitle.c +++ b/usr/src/lib/zlibetitam/mtitle.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/mtrunc.c b/usr/src/lib/zlibetitam/mtrunc.c index 20d0769..9f501d5 100644 --- a/usr/src/lib/zlibetitam/mtrunc.c +++ b/usr/src/lib/zlibetitam/mtrunc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/path.h b/usr/src/lib/zlibetitam/path.h index e662e74..68378bd 100644 --- a/usr/src/lib/zlibetitam/path.h +++ b/usr/src/lib/zlibetitam/path.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/pbf.c b/usr/src/lib/zlibetitam/pbf.c index 7f7e12e..9518aea 100644 --- a/usr/src/lib/zlibetitam/pbf.c +++ b/usr/src/lib/zlibetitam/pbf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/pbf.h b/usr/src/lib/zlibetitam/pbf.h index b6775e5..8081851 100644 --- a/usr/src/lib/zlibetitam/pbf.h +++ b/usr/src/lib/zlibetitam/pbf.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/post.c b/usr/src/lib/zlibetitam/post.c index 892d3ae..d541f30 100644 --- a/usr/src/lib/zlibetitam/post.c +++ b/usr/src/lib/zlibetitam/post.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/print.h b/usr/src/lib/zlibetitam/print.h index 5d7b952..01bc9ef 100644 --- a/usr/src/lib/zlibetitam/print.h +++ b/usr/src/lib/zlibetitam/print.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/subcurses.h b/usr/src/lib/zlibetitam/subcurses.h index d2087e5..e9e1632 100644 --- a/usr/src/lib/zlibetitam/subcurses.h +++ b/usr/src/lib/zlibetitam/subcurses.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/sys/font.h b/usr/src/lib/zlibetitam/sys/font.h index 4cba3c2..340e424 100644 --- a/usr/src/lib/zlibetitam/sys/font.h +++ b/usr/src/lib/zlibetitam/sys/font.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/sys/iohw.h b/usr/src/lib/zlibetitam/sys/iohw.h index 01eacf4..4c95199 100644 --- a/usr/src/lib/zlibetitam/sys/iohw.h +++ b/usr/src/lib/zlibetitam/sys/iohw.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/sys/mouse.h b/usr/src/lib/zlibetitam/sys/mouse.h index 413120b..b1a6200 100644 --- a/usr/src/lib/zlibetitam/sys/mouse.h +++ b/usr/src/lib/zlibetitam/sys/mouse.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/sys/signal.h b/usr/src/lib/zlibetitam/sys/signal.h index 696b49d..39fcf74 100644 --- a/usr/src/lib/zlibetitam/sys/signal.h +++ b/usr/src/lib/zlibetitam/sys/signal.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/sys/window.h b/usr/src/lib/zlibetitam/sys/window.h index 6723095..fe470a4 100644 --- a/usr/src/lib/zlibetitam/sys/window.h +++ b/usr/src/lib/zlibetitam/sys/window.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/tam.h b/usr/src/lib/zlibetitam/tam.h index 75d5ee8..0523545 100644 --- a/usr/src/lib/zlibetitam/tam.h +++ b/usr/src/lib/zlibetitam/tam.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/tamdefs.c b/usr/src/lib/zlibetitam/tamdefs.c index 4d8f940..3bb17f0 100644 --- a/usr/src/lib/zlibetitam/tamdefs.c +++ b/usr/src/lib/zlibetitam/tamdefs.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/tamwin.h b/usr/src/lib/zlibetitam/tamwin.h index 279f08e..bbfb19c 100644 --- a/usr/src/lib/zlibetitam/tamwin.h +++ b/usr/src/lib/zlibetitam/tamwin.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/temp.h b/usr/src/lib/zlibetitam/temp.h index 13c9ad0..3f8ba69 100644 --- a/usr/src/lib/zlibetitam/temp.h +++ b/usr/src/lib/zlibetitam/temp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/track.c b/usr/src/lib/zlibetitam/track.c index 0e8cdae..713a0d0 100644 --- a/usr/src/lib/zlibetitam/track.c +++ b/usr/src/lib/zlibetitam/track.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/track.h b/usr/src/lib/zlibetitam/track.h index ce7d991..15606ee 100644 --- a/usr/src/lib/zlibetitam/track.h +++ b/usr/src/lib/zlibetitam/track.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/undowindow.c b/usr/src/lib/zlibetitam/undowindow.c index 3cb5c4b..72253c6 100644 --- a/usr/src/lib/zlibetitam/undowindow.c +++ b/usr/src/lib/zlibetitam/undowindow.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/validwin.c b/usr/src/lib/zlibetitam/validwin.c index 9117a46..6300fa7 100644 --- a/usr/src/lib/zlibetitam/validwin.c +++ b/usr/src/lib/zlibetitam/validwin.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wcmd.c b/usr/src/lib/zlibetitam/wcmd.c index 8a23e7b..bccff70 100644 --- a/usr/src/lib/zlibetitam/wcmd.c +++ b/usr/src/lib/zlibetitam/wcmd.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wcreate.c b/usr/src/lib/zlibetitam/wcreate.c index f3cf837..f36de2e 100644 --- a/usr/src/lib/zlibetitam/wcreate.c +++ b/usr/src/lib/zlibetitam/wcreate.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wdelete.c b/usr/src/lib/zlibetitam/wdelete.c index 96c16dc..d77977a 100644 --- a/usr/src/lib/zlibetitam/wdelete.c +++ b/usr/src/lib/zlibetitam/wdelete.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/werase.c b/usr/src/lib/zlibetitam/werase.c index 2a8bb2e..90e8f65 100644 --- a/usr/src/lib/zlibetitam/werase.c +++ b/usr/src/lib/zlibetitam/werase.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wexit.c b/usr/src/lib/zlibetitam/wexit.c index e6126cf..f6b7edf 100644 --- a/usr/src/lib/zlibetitam/wexit.c +++ b/usr/src/lib/zlibetitam/wexit.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wgetc.c b/usr/src/lib/zlibetitam/wgetc.c index 0024d8c..364ec7d 100644 --- a/usr/src/lib/zlibetitam/wgetc.c +++ b/usr/src/lib/zlibetitam/wgetc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wgetpos.c b/usr/src/lib/zlibetitam/wgetpos.c index f473bfc..f0a9fff 100644 --- a/usr/src/lib/zlibetitam/wgetpos.c +++ b/usr/src/lib/zlibetitam/wgetpos.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wgetsel.c b/usr/src/lib/zlibetitam/wgetsel.c index f78b52f..1073c71 100644 --- a/usr/src/lib/zlibetitam/wgetsel.c +++ b/usr/src/lib/zlibetitam/wgetsel.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wgetstat.c b/usr/src/lib/zlibetitam/wgetstat.c index 911c382..a1dddcf 100644 --- a/usr/src/lib/zlibetitam/wgetstat.c +++ b/usr/src/lib/zlibetitam/wgetstat.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wgoto.c b/usr/src/lib/zlibetitam/wgoto.c index b6a11e5..f7e03bf 100644 --- a/usr/src/lib/zlibetitam/wgoto.c +++ b/usr/src/lib/zlibetitam/wgoto.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wind.c b/usr/src/lib/zlibetitam/wind.c index 67698a6..9bf501d 100644 --- a/usr/src/lib/zlibetitam/wind.c +++ b/usr/src/lib/zlibetitam/wind.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wind.h b/usr/src/lib/zlibetitam/wind.h index decded9..73fd3e4 100644 --- a/usr/src/lib/zlibetitam/wind.h +++ b/usr/src/lib/zlibetitam/wind.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/winit.c b/usr/src/lib/zlibetitam/winit.c index 8729af1..01f9652 100644 --- a/usr/src/lib/zlibetitam/winit.c +++ b/usr/src/lib/zlibetitam/winit.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/winsize.c b/usr/src/lib/zlibetitam/winsize.c index 92c08be..c111d3d 100644 --- a/usr/src/lib/zlibetitam/winsize.c +++ b/usr/src/lib/zlibetitam/winsize.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wlabel.c b/usr/src/lib/zlibetitam/wlabel.c index 404d2d6..7a7bb43 100644 --- a/usr/src/lib/zlibetitam/wlabel.c +++ b/usr/src/lib/zlibetitam/wlabel.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wnodelay.c b/usr/src/lib/zlibetitam/wnodelay.c index e0f44ea..2c30fff 100644 --- a/usr/src/lib/zlibetitam/wnodelay.c +++ b/usr/src/lib/zlibetitam/wnodelay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wpostwait.c b/usr/src/lib/zlibetitam/wpostwait.c index ea5f1ca..74e58de 100644 --- a/usr/src/lib/zlibetitam/wpostwait.c +++ b/usr/src/lib/zlibetitam/wpostwait.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wprexec.c b/usr/src/lib/zlibetitam/wprexec.c index e64332b..d350fc0 100644 --- a/usr/src/lib/zlibetitam/wprexec.c +++ b/usr/src/lib/zlibetitam/wprexec.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wprintf.c b/usr/src/lib/zlibetitam/wprintf.c index f1d995a..f2ea02e 100644 --- a/usr/src/lib/zlibetitam/wprintf.c +++ b/usr/src/lib/zlibetitam/wprintf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wprompt.c b/usr/src/lib/zlibetitam/wprompt.c index e030332..4ee8098 100644 --- a/usr/src/lib/zlibetitam/wprompt.c +++ b/usr/src/lib/zlibetitam/wprompt.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wput.c b/usr/src/lib/zlibetitam/wput.c index 1a36ee7..0d5684d 100644 --- a/usr/src/lib/zlibetitam/wput.c +++ b/usr/src/lib/zlibetitam/wput.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wrefresh.c b/usr/src/lib/zlibetitam/wrefresh.c index fc6c479..4b4b009 100644 --- a/usr/src/lib/zlibetitam/wrefresh.c +++ b/usr/src/lib/zlibetitam/wrefresh.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wselect.c b/usr/src/lib/zlibetitam/wselect.c index 62f1eac..5f5b400 100644 --- a/usr/src/lib/zlibetitam/wselect.c +++ b/usr/src/lib/zlibetitam/wselect.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wsetstat.c b/usr/src/lib/zlibetitam/wsetstat.c index 529cb2e..2d082e0 100644 --- a/usr/src/lib/zlibetitam/wsetstat.c +++ b/usr/src/lib/zlibetitam/wsetstat.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wslk.c b/usr/src/lib/zlibetitam/wslk.c index bd33415..1750bc4 100644 --- a/usr/src/lib/zlibetitam/wslk.c +++ b/usr/src/lib/zlibetitam/wslk.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/wuser.c b/usr/src/lib/zlibetitam/wuser.c index 5acfd06..8dfbef2 100644 --- a/usr/src/lib/zlibetitam/wuser.c +++ b/usr/src/lib/zlibetitam/wuser.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 AT&T */ +/* Copyright (c) 1984 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ diff --git a/usr/src/lib/zlibetitam/zlibetitam.mk b/usr/src/lib/zlibetitam/zlibetitam.mk index e7df8ec..6be0cf4 100644 --- a/usr/src/lib/zlibetitam/zlibetitam.mk +++ b/usr/src/lib/zlibetitam/zlibetitam.mk @@ -1,4 +1,4 @@ -# Copyright (c) 1988 AT&T +# Copyright (c) 1984 AT&T # All Rights Reserved # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T @@ -117,7 +117,7 @@ lintit: $(LLIBLN) install: all install -f $(CCSLIB) -m 644 -u $(OWN) -g $(GRP) libtam.a install -f $(CCSLIB) -m 644 -u $(OWN) -g $(GRP) llib-ltam - install -f $(CCSLIB) -m 644 -u $(OWN) -g $(GRP) llib-ltam.ln +# install -f $(CCSLIB) -m 644 -u $(OWN) -g $(GRP) llib-ltam.ln install -f $(CCSLIB) -m 644 -u $(OWN) -g $(GRP) tamhelp if [ ! -d $(ROOT)/usr/add-on ]; \ then \ diff --git a/usr/src/pkg/bnu/pkginfo b/usr/src/pkg/bnu/pkginfo index 6d74ac3..b3fb75a 100644 --- a/usr/src/pkg/bnu/pkginfo +++ b/usr/src/pkg/bnu/pkginfo @@ -1,6 +1,6 @@ -#ident "@(#)pkg.bnu:pkginfo 1.6" +#ident "@(#)pkg.bnu:pkginfo 1.5" -ARCH="3B2" +ARCH="3b2" # BASEDIR="/" CATEGORY="system" CLASSES="none need OAMadmin OAMmif" diff --git a/usr/src/pkg/bnu/postinstall b/usr/src/pkg/bnu/postinstall index 010157b..ee4685f 100644 --- a/usr/src/pkg/bnu/postinstall +++ b/usr/src/pkg/bnu/postinstall @@ -1,4 +1,4 @@ -#ident "@(#)bnu:postinstall 1.26.4.15" +#ident "@(#)bnu:postinstall 1.26.4.12" # # Postinstall for "Basic Networking Utilities" @@ -130,7 +130,7 @@ fi echo " You can use the installed $PKGNAME management menu by typing -'sysadm' and then descending to the Network Services Management +'nsysadm' and then descending to the Network Services Management menu. As part of the initial installation of $PKGNAME you @@ -138,15 +138,13 @@ should execute the following management commands within the Basic Networking Setup menu. (SEE 'Basic Networking Utilities Guide' for more information). -devices: To provide the $PKGNAME package +add_devices: To provide the $PKGNAME package with information about the devices it can use for outgoing traffic. -polling: To initiate the polling of other systems - by this system, '`uname -n`'. -setup: To initialize the $PKGNAME Devices, Systems, - and Polling databases. -systems: To provide the $PKGNAME package - with the names of systems you want to contact." +add_systems: To provide the $PKGNAME package + with the names of systems you want to contact. +add_polling: To initiate the polling of other systems + by this system, '`uname`'." # # # diff --git a/usr/src/pkg/bnu/preinstall b/usr/src/pkg/bnu/preinstall index cc46f77..cb7ca0c 100644 --- a/usr/src/pkg/bnu/preinstall +++ b/usr/src/pkg/bnu/preinstall @@ -1,4 +1,4 @@ -#ident "@(#)bnu:preinstall 1.13.5.7" +#ident "@(#)bnu:preinstall 1.13.5.6" # # Pre installation procedure for "Basic Networking Utilities" # This will be changing radically with SAF and QFT feature changes @@ -10,7 +10,7 @@ rm -rf $BASEDIR/usr/lib/uucp/uugetty # If user wants to change nodename, do it here... -if [ "`uname -n`" != "$NODENAME" -a "$NODENAME" != "" ] +if [ "`uname`" != "$NODENAME" -a "$NODENAME" != "" ] then uname -S ${NODENAME} date +"# Node name changed %D %T. diff --git a/usr/src/pkg/bnu/prototype b/usr/src/pkg/bnu/prototype index 6e4230e..8f2c258 100644 --- a/usr/src/pkg/bnu/prototype +++ b/usr/src/pkg/bnu/prototype @@ -1,6 +1,5 @@ - -#ident "@(#)pkg.bnu:prototype 1.1.5.30" - +#ident "@(#)pkg.bnu:prototype 1.1.5.20" +# # All files/directories are defined as relocatable. Although # BASENAME is not used at this time (i.e. defaults to /) # doing this may facilitate future development. @@ -73,20 +72,8 @@ x OAMadmin $OAMBASE/add-ons x OAMadmin $OAMBASE/add-ons/$PKGINST x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/list -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/add -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/list -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/list -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/setup -x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/setup/add +x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP +x OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin d none /var/sadm ? ? ? d none /var/sadm/pkg ? ? ? x OAMadmin /var/sadm/pkg/$PKGINST @@ -103,97 +90,134 @@ f none /etc/init.d/uucp=/etc/rc2.d/S70uucp # !default 0644 root sys f OAMmif $PKGSAV/intf_install/netserv.mi -f OAMmif $PKGSAV/intf_install/bnu.mi -f OAMmif $PKGSAV/intf_install/devices.mi -f OAMmif $PKGSAV/intf_install/polling.mi -f OAMmif $PKGSAV/intf_install/systems.mi -f OAMmif $PKGSAV/intf_install/setup.mi +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.bnu +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.devices +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.devtype +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lsdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lsdev_1 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lsdev_2 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lsdev_all +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lssys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lssys_all +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lspoll +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.lspoll_all +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.ports +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmpoll +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmpoll_all +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.polling +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmdev_1 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmdev_2 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmdev_all +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.rmsys_all +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.setup +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Menu.systems +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.acudev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.acudev1 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.acudev2 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.acudev3 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.acudev4 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.acudev5 +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.acusys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.adddev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.addpoll +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.addsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.dirdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.dirsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.listdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.listpoll +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.listsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.othdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.othsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.rmdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.rmpoll +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.rmsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.streams +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.tlisdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.tlissys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.cf_adev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.cf_apoll +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.cf_asys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.cf_rdev +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.cf_rpoll +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Form.cf_rsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Text.rmnok +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Text.rmok +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Text.aok +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Text.anok +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/adddev.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/addpoll.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/addr.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/addsys.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/adial.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/adport.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/aport.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/aspeed.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/bnu.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ddirect.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ddlist.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ddrm.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/devcat.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/devices.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/dirdev.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/dirspeed.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/dport.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/dprm.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/dplist.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/dspeed.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/listdev.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/listpoll.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/listsys.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/login.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ndevice.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ndial.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/netserve.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/netwk.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/nport.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/od1.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/od2.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/od3.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/odevice.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/odport.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/oport.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ospeed.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ot1.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ot2.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ot3.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/othdev.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/othspeed.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/passwd.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/phone.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/plistsys.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/polling.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ports.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/psys.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ptimes.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/rmdev.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/rmpoll.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/rmsys.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/salogin.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/script.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/sdevcat.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/setup.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/slistsys.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/srmsys.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/ssdevcat.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/streams.help +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/HELP/systems.help # -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Menu.devtype -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.acudev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.acudev1 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.acudev2 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.acudev3 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.acudev4 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.acudev5 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.adddev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.dirdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.othdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.streams -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.tlisdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Form.cf_adev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Menu.ports -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Text.aok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/add/Text.anok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/list/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/list/Menu.lsdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/list/Menu.lsdev_1 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/list/Menu.lsdev_2 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/list/Menu.lsdev_all -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/list/Form.listdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Menu.rmdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Menu.rmdev_1 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Menu.rmdev_2 -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Menu.rmdev_all -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Form.rmdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Form.cf_rdev -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Text.rmnok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/devices/remove/Text.rmok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/add/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/add/Form.addpoll -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/add/Form.cf_apoll -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/add/Text.aok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/add/Text.anok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/list/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/list/Form.listpoll -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/list/Menu.lspoll -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/list/Menu.lspoll_a -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove/Menu.rmpoll -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove/Menu.rmpoll_a -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove/Form.cf_rpoll -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove/Text.rmnok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove/Text.rmok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/polling/remove/Form.rmpoll -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Form.acusys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Form.addsys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Form.dirsys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Form.othsys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Form.tlissys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Form.cf_asys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Text.aok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/add/Text.anok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/list/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/list/Menu.lssys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/list/Menu.lssys_all -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/list/Form.listsys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove/Menu.rmsys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove/Menu.rmsys_all -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove/Form.cf_rsys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove/Form.rmsys -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove/Text.rmnok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/systems/remove/Text.rmok -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/setup/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/setup/add/Menu.setup # OAM shell scripts: default owner=root group=sys mode=755 # !default 0755 root sys -f OAMadmin $OAMBASE/bin/delentry -f OAMadmin $OAMBASE/bin/validhour -f OAMadmin $OAMBASE/bin/validls -f OAMadmin $OAMBASE/bin/validname -f OAMadmin $OAMBASE/bin/validnetaddr -f OAMadmin $OAMBASE/bin/validphone -f OAMadmin $OAMBASE/bin/validport -f OAMadmin $OAMBASE/bin/validsys +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/delentry +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/validhour +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/validls +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/validname +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/validnetaddr +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/validphone +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/validport +f OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/basic_networking/bin/validsys # # commands: default owner=uucp group=uucp mode=0111 # diff --git a/usr/src/pkg/core/ifiles/postinstall b/usr/src/pkg/core/ifiles/postinstall index 71bb845..049a7a7 100644 --- a/usr/src/pkg/core/ifiles/postinstall +++ b/usr/src/pkg/core/ifiles/postinstall @@ -1,4 +1,4 @@ -#ident "@(#)pkgcore:ifiles/postinstall 1.14" +#ident "@(#)pkgcore:ifiles/postinstall 1.9" error=no while read from to comment @@ -12,7 +12,6 @@ done </dev/null && - installf $PKGINST /dev/ptmx c $CMAJOR $MMAJOR \ - 0666 root other - - if [ $? -eq 0 ] + if [ -f /etc/emd?*.addr ] then - # - # configure pseudo-terminal slave devices - # - TEMP=0 - installf $PKGINST /dev/pts d 775 root sys && - until [ "$TEMP" -eq "$PTNUM" ] - do - echo /dev/pts/$TEMP c $SMAJOR $TEMP \ - 0620 root tty - echo /dev/pts$TEMP=/dev/pts/$TEMP - TEMP=`expr $TEMP + 1` - done | installf $PKGINST - + EMDMAJOR="`echo /etc/emd?*.addr | sed -e 's%/etc/emd%%;s%.addr%%'`" fi fi - - -if [ ! -c /dev/pts/0 ] +if [ ! -z "$EMDMAJOR" -a -f /dev/emd${EMDMAJOR} ] then - echo " -WARNING: pseudo-terminals have not been installed on this machine. -Internet commands such as rlogin and rsh require psuedo-terminals. -Psuedo-terminals are part of the Networking Support Utilities package; -please re-install that package." - -fi - - -# -# put the correct major # in the slink configuration script -# don't error out if this fails -- they can recover -# -if [ -f /etc/emd[0-9].addr ] -then - # there might be multiple emd boards -- just set up the first one - # multiple board setup is too complicated to do here - for i in /etc/emd[0-9].addr - do - EMDMAJOR="`echo $i | sed -e 's%/etc/emd%%;s%.addr%%'`" - if [ ! -z "$EMDMAJOR" -a -c /dev/emd${EMDMAJOR} ] - then - echo "g/ emd 0/s// emd ${EMDMAJOR}/\nw\nq" >/tmp/.inet.eddd - ed -s /etc/inet/strcf /tmp/.inet.eddd + ed -s /etc/inet/strcf /dev/null 2> then : Already there! else - echo "tcp tpi_cots_ord v inet tcp /dev/tcp /usr/lib/tcpip.so,/usr/lib/resolv.so" >>/etc/netconfig + echo "tcp tpi_cots_ord v inet tcp /dev/tcp /usr/lib/tcpip.so" >>/etc/netconfig fi if grep '[ ]inet[ ][ ]*udp[ ][ ]*/dev/udp[ ]' /etc/netconfig >/dev/null 2>&1 then : Already there! else - echo "udp tpi_clts v inet udp /dev/udp /usr/lib/tcpip.so,/usr/lib/resolv.so" >>/etc/netconfig + echo "udp tpi_clts v inet udp /dev/udp /usr/lib/tcpip.so" >>/etc/netconfig fi if grep '[ ]inet[ ][ ]*icmp[ ][ ]*/dev/icmp[ ]' /etc/netconfig >/dev/null 2>&1 then : Already there! else - echo "icmp tpi_raw - inet icmp /dev/icmp /usr/lib/tcpip.so,/usr/lib/resolv.so" >>/etc/netconfig + echo "icmp tpi_raw - inet icmp /dev/icmp /usr/lib/tcpip.so" >>/etc/netconfig fi if grep '[ ]inet[ ][ ]*-[ ][ ]*/dev/rawip[ ]' /etc/netconfig >/dev/null 2>&1 then : Already there! else - echo "rawip tpi_raw - inet - /dev/rawip /usr/lib/tcpip.so,/usr/lib/resolv.so" >>/etc/netconfig -fi - -# -# Update the OAM Scripts to know about us... -# - -if grep 'inet^Internet Protocols (TCP and UDP)^inet/Menu.inet' /usr/sadm/sysadm/menu/netservices/name_to_addr/map.menu >/dev/null 2>&1 -then - : Already there! -else - echo "inet^Internet Protocols (TCP and UDP)^inet/Menu.inet" >>/usr/sadm/sysadm/menu/netservices/name_to_addr/map.menu + echo "rawip tpi_raw - inet - /dev/rawip /usr/lib/tcpip.so" >>/etc/netconfig fi - # # if the admin knows the ip address, put it in /etc/hosts # @@ -230,18 +126,17 @@ NODENAME=`uname -n` if [ ! -z "${NODENAME}" ] then echo " -Do you want to initialize the IP address for host ${NODENAME}? (y,n,?) \c" +Do you want to add the IP address for host ${NODENAME} to /etc/hosts? (y,n,?) \c" read ans if [ "${ans}" = '?' ] then echo " -The IP address is the address by which host ${NODENAME} will be known on the -Internet. +The IP address is the address by which ${NODENAME} will be known on the Internet. These addresses must be administered by a central authority on your network. IP addresses are written as four decimal integers, separated by decimal points (e.g., 128.10.2.70). -Do you want to initialize the IP address for host ${NODENAME}? (y,n) \c" +Do you want to add the IP address for host ${NODENAME} to /etc/hosts? (y,n) \c" read ans fi @@ -254,86 +149,28 @@ Enter the IP address for host ${NODENAME}: \c" if [ ! -z "${ipaddr}" ] then echo "${ipaddr}\t${NODENAME}" >>/etc/hosts - echo " -Added \"${ipaddr}\t${NODENAME}\" to /etc/hosts" fi fi fi -# -# if the admin knows the domain name, put it in /etc/named.boot -# -echo " -Do you want to initialize the Internet domain name for host ${NODENAME}? (y,n,?) \c" -read ans -if [ "${ans}" = '?' ] -then - echo " -The domain name is the complete name for host ${NODENAME} in the Internet -domain name system. For example, for a host 'frodo' in the computer -science department at Perdue University, the domain name would be -frodo.cs.purdue.edu. - -Do you want to initialize the Internet domain name for host ${NODENAME}? (y,n) \c" - read ans -fi -if [ "${ans}" = "y" ] -then - echo " -Enter the Internet domain name for ${NODENAME}: \c" - read dname - if [ ! -z "${dname}" ] - then - echo "domain\t${dname}" >>/etc/named.boot - echo " -Added \"domain\t${dname}\" to /etc/named.boot" - fi -fi - - -# -# Add /dev/inet to /etc/ttysrch to speed up ttyname -# -echo "/dev/inet MF" >>/etc/ttysrch - # # Create /etc/passwd and /etc/group entry for UID_NOBODY # so in.fingerd can run # -UID_NOBODY="`grep '^nobody:' /etc/passwd | cut -d: -f3`" -GID_NOBODY="`grep '^nobody:' /etc/group | cut -d: -f3`" -if [ -z "$UID_NOBODY" ] +if grep '^nobody:' /etc/passwd >/dev/null 2>/dev/null then - if [ -z "$GID_NOBODY" ] - then - passmgmt -a -c 'unprivileged user' -h /nonexistent \ - -s /noshell nobody - else - # already have a group nobody -- use it - passmgmt -a -c 'unprivileged user' -h /nonexistent \ - -s /noshell -g ${GID_NOBODY} nobody - fi - UID_NOBODY="`grep '^nobody:' /etc/passwd | cut -d: -f3`" + : already there ; +else + passmgmt -a -c 'unprivileged user' -h /nonexistent -s /noshell \ + -u 60001 -g 60001 nobody fi -if [ -z "$GID_NOBODY" -a ! -z "$UID_NOBODY" ] +if grep '^nobody:' /etc/group >/dev/null 2>/dev/null then - if cut -d: -f3 /dev/null - then - # already have group using nobody's uid - GID_NOBODY="`grep '^nobody:' /etc/passwd | cut -d: -f4`" - else - GID_NOBODY=$UID_NOBODY - fi - echo "nobody::${GID_NOBODY}:" >>/etc/group - passmgmt -m -g ${GID_NOBODY} nobody + : already there ; +else + echo 'nobody::60001:' >>/etc/group fi -# -# Add root to list of users denied ftp access -# -echo "root" >>/etc/inet/ftpusers -ln -s /etc/inet/ftpusers /etc/ftpusers - # # Create inetd as a port monitor. Version doesn't matter # since inetd doesn't usr _pmtab. diff --git a/usr/src/pkg/inet/preremove b/usr/src/pkg/inet/preremove index 16fbb36..71801f0 100644 --- a/usr/src/pkg/inet/preremove +++ b/usr/src/pkg/inet/preremove @@ -1,4 +1,4 @@ -#ident "@(#)pkg.inet:preremove 1.5" +#ident "@(#)pkg.inet:preremove 1.4" # # Issue a warning message if inet is running. # @@ -35,14 +35,7 @@ grep -v '[ ]inet[ ][ ]*tcp[ ][ ]*/dev/tcp[ ]' /etc/netconfig 2>/dev/null > grep -v '[ ]inet[ ][ ]*udp[ ][ ]*/dev/udp[ ]' /tmp/$$.1 2>/dev/null >/tmp/$$.2 grep -v '[ ]inet[ ][ ]*icmp[ ][ ]*/dev/icmp[ ]' /tmp/$$.2 2>/dev/null >/etc/netconfig -rm -f /tmp/$$.1 /tmp/$$.2 - -# -# Remove ourself from the OAM Scripts... -# - -grep -v 'inet^Internet Protocols (TCP and UDP)^inet/Menu.inet' /usr/sadm/sysadm/menu/netservices/name_to_addr/map.menu 2>/dev/null >/tmp/$$.1 -mv /tmp/$$.1 /usr/sadm/sysadm/menu/netservices/name_to_addr/map.menu +rm -f /rmp/$$.1 /tmp/$$.2 # # Remove the port monitor entry diff --git a/usr/src/pkg/inet/prototype b/usr/src/pkg/inet/prototype index d095239..0b5bd2f 100644 --- a/usr/src/pkg/inet/prototype +++ b/usr/src/pkg/inet/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.inet:prototype 1.31" +#ident "@(#)pkg.inet:prototype 1.20" # # information files # @@ -18,7 +18,6 @@ d none /boot ? ? ? d none /etc ? ? ? d none /etc/init.d ? ? ? d none /etc/rc0.d ? ? ? -d none /etc/rc1.d ? ? ? d none /etc/rc2.d ? ? ? d none /etc/inet 0775 root sys d none /etc/master.d ? ? ? @@ -30,10 +29,6 @@ d none /usr/include ? ? ? d none /usr/include/arpa ? ? ? d none /usr/include/protocols ? ? ? d none /usr/include/sys ? ? ? -d none /usr/sadm/sysadm/menu/netservices ? ? ? -d none /usr/sadm/sysadm/menu/netservices/name_to_addr ? ? ? -d none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet ? ? ? -d none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/bin ? ? ? !default 0444 root root e none /boot/APP=/usr/src/uts/3b2/netinet/APP @@ -58,15 +53,12 @@ e none /etc/master.d/udp=/usr/src/uts/3b2/master.d/udp # !default 0444 root sys f none /etc/init.d/inetinit -f none /etc/inet/rc.inet -l none /etc/rc0.d/K69inet=/etc/init.d/inetinit -l none /etc/rc1.d/K69inet=/etc/init.d/inetinit +l none /etc/rc0.d/K70inet=/etc/init.d/inetinit l none /etc/rc2.d/S69inet=/etc/init.d/inetinit !default 0444 root sys f none /usr/lib/tcpip.so -f none /usr/lib/resolv.so f none /usr/lib/libresolv.a # @@ -75,7 +67,6 @@ f none /usr/lib/libresolv.a !default 0444 root sys f none /etc/inet/hosts f none /etc/inet/inetd.conf -f none /etc/inet/named.boot f none /etc/inet/networks f none /etc/inet/protocols f none /etc/inet/services @@ -88,7 +79,6 @@ f none /usr/lib/nslookup.help !default 0444 root sys s none /etc/hosts=/etc/inet/hosts s none /etc/inetd.conf=/etc/inet/inetd.conf -s none /etc/named.boot=/etc/inet/named.boot s none /etc/networks=/etc/inet/networks s none /etc/protocols=/etc/inet/protocols s none /etc/services=/etc/inet/services @@ -111,6 +101,7 @@ f none /usr/bin/rwho f none /usr/bin/talk f none /usr/bin/telnet f none /usr/bin/tftp +f none /usr/bin/tftp_tli f none /usr/bin/whois # @@ -118,6 +109,7 @@ f none /usr/bin/whois # !default 0555 bin bin f none /usr/sbin/arp 02555 bin sys +f none /usr/sbin/domainname f none /usr/sbin/gettable f none /usr/sbin/htable f none /usr/sbin/ifconfig @@ -136,11 +128,12 @@ f none /usr/sbin/in.rwhod f none /usr/sbin/in.talkd f none /usr/sbin/in.telnetd f none /usr/sbin/in.tftpd +f none /usr/sbin/in.timed f none /usr/sbin/in.tnamed f none /usr/sbin/inetd f none /usr/sbin/ping 04555 root bin f none /usr/sbin/route -f none /usr/sbin/slink 0500 root bin +f none /usr/sbin/slink f none /usr/sbin/trpt # @@ -163,20 +156,3 @@ f none /usr/include/protocols/timed.h=/usr/src/head/protocols/timed.h f none /usr/include/syslog.h=/usr/src/head/syslog.h f none /usr/include/sys/syslog.h=/usr/src/uts/3b2/sys/syslog.h f none /usr/include/sys/un.h=/usr/src/uts/3b2/sys/un.h - -# -# OAM name to address files... -# -!default 0644 bin bin -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Form.inethost -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Form.inetserv -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Help -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Menu.inet -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Text.badaddr -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Text.badport -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Text.h_exists -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Text.h_success -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Text.s_exists -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/Text.s_success -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/bin/inet.host 0755 bin bin -f none /usr/sadm/sysadm/menu/netservices/name_to_addr/inet/bin/inet.services 0755 bin bin diff --git a/usr/src/pkg/lp/i.cron b/usr/src/pkg/lp/i.cron index d71daa9..f644f49 100644 --- a/usr/src/pkg/lp/i.cron +++ b/usr/src/pkg/lp/i.cron @@ -1,10 +1,12 @@ -#ident "@(#)pkg.lp:lp/i.cron 1.4" +#ident "@(#)pkg.lp:lp/i.cron 1.3" while read src dest do [ "${src}" = "/dev/null" ] && continue - su lp -c crontab < ${src} + user=`basename ${dest}` + + su ${user} -c "crontab ${src}" if [ $? -ne 0 ] then exit 2 diff --git a/usr/src/pkg/lp/pkginfo b/usr/src/pkg/lp/pkginfo index 110d730..41585f5 100644 --- a/usr/src/pkg/lp/pkginfo +++ b/usr/src/pkg/lp/pkginfo @@ -1,8 +1,8 @@ -#ident "@(#)pkg.nlp:lp/ifiles/pkginfo 1.9" +#ident "@(#)pkg.nlp:lp/ifiles/pkginfo 1.8" ARCH="3B2" # BASEDIR="/" CATEGORY="system" -CLASSES="none bsd post cron OAMadmin OAMmif" +CLASSES="none bsd post build OAMadmin OAMmif" # DESC= # EMAIL= # HOTLINE= diff --git a/usr/src/pkg/lp/postinstall b/usr/src/pkg/lp/postinstall index 8ff9f75..a977080 100644 --- a/usr/src/pkg/lp/postinstall +++ b/usr/src/pkg/lp/postinstall @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nlp:lp/ifiles/postinstall 1.10" +#ident "@(#)pkg.nlp:lp/ifiles/postinstall 1.8" ########## # @@ -10,9 +10,13 @@ OAMBASE=${OAMBASE:-/var/sadm/sysadm} INTFBASE=${INTFBASE:-${OAMBASE}/menu} cp ${INTFBASE}/main.menu ${INTFBASE}/main.backup -sed 's/printers\/printers/printers/' ${INTFBASE}/main.menu > ${INTFBASE}/tmp.menu +sed 's/printers.menu/Menu.lp/' ${INTFBASE}/main.menu > ${INTFBASE}/tmp.menu mv ${INTFBASE}/tmp.menu ${INTFBASE}/main.menu +########## +# +# Convert old configuration? +########## if [ -s "/usr/spool/lp/pstatus" ] then diff --git a/usr/src/pkg/lp/preinstall b/usr/src/pkg/lp/preinstall index 0f39d3c..8081bcd 100644 --- a/usr/src/pkg/lp/preinstall +++ b/usr/src/pkg/lp/preinstall @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nlp:lp/ifiles/preinstall 1.10" +#ident "@(#)pkg.nlp:lp/ifiles/preinstall 1.9" ########## # # Make sure that there is a group named "lp". If this is @@ -234,8 +234,8 @@ fi echo "\nVerifying that lp can use crontab\n" -CRONALLOW=/etc/cron.d/cron.allow -CRONDENY=/etc/cron.d/cron.deny +CRONALLOW=/etc/cron/cron.allow +CRONDENY=/etc/cron/cron.deny CRONDIR=/var/spool/cron/crontabs if [ -f "${CRONDENY}" ] && \ diff --git a/usr/src/pkg/lp/prototype b/usr/src/pkg/lp/prototype index 5b396d4..2aa1048 100644 --- a/usr/src/pkg/lp/prototype +++ b/usr/src/pkg/lp/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nlp:lp/prototype 1.35" +#ident "@(#)pkg.nlp:lp/prototype 1.21" i pkginfo i request @@ -60,11 +60,11 @@ f none /usr/bin/cancel f none /usr/bin/lp f none /usr/bin/lpstat -f bsd /usr/ucb/lpc -f bsd /usr/ucb/lpq -f bsd /usr/ucb/lpr -f bsd /usr/ucb/lprm -f bsd /usr/ucb/lptest +f bsd /usr/ucb/lpc=/usr/bin/lpc +f bsd /usr/ucb/lpq=/usr/bin/lpq +f bsd /usr/ucb/lpr=/usr/bin/lpr +f bsd /usr/ucb/lprm=/usr/bin/lprm +f bsd /usr/ucb/lptest=/usr/bin/lptest d none /etc/init.d 555 root sys f none /etc/init.d/lp 0555 root sys @@ -75,14 +75,12 @@ f none /etc/init.d/lp 0555 root sys # shutdown script a low number so that LP is one of the first to # stop. This makes sure that anything that LP needs is available. d none /etc/rc0.d 755 root sys -d none /etc/rc1.d 755 root sys d none /etc/rc2.d 755 root sys l none /etc/rc0.d/K20lp=/etc/init.d/lp -l none /etc/rc1.d/K20lp=/etc/init.d/lp l none /etc/rc2.d/S80lp=/etc/init.d/lp # -# This is the configuration directory system for lp. +# This is the coniguration directory system for lp. # Included in here are the filter table, the standard # printer interface and any models salvaged by preinstall # @@ -94,7 +92,7 @@ f none /etc/lp/filter.table.i f none /etc/lp/filter.table=/etc/lp/filter.table.i d none /etc/lp/forms d none /etc/lp/interfaces -f none /etc/lp/Systems +f none /etc/lp/lpNetData d none /usr/lib/lp/model f none /usr/lib/lp/model/standard s none /etc/lp/model=/usr/lib/lp/model @@ -110,6 +108,7 @@ d none /var/spool/lp/fifos/public 773 lp lp d none /var/spool/lp/requests d none /var/spool/lp/system d none /var/spool/lp/tmp +s none /var/spool/lp/temp=/var/spool/lp/tmp s none /etc/lp/logs=/var/lp/logs # # Add symbolic links for backwards compatability @@ -136,189 +135,97 @@ e cron /var/spool/cron/crontabs/lp !default 0755 root sys d none /usr/sadm ? ? ? d none $OAMBASE ? ? ? -d none $OAMBASE/add-ons ? ? ? +d none $OAMBASE/menu ? ? ? d none /var/sadm ? ? ? d none /var/sadm/pkg ? ? ? x OAMadmin /var/sadm/pkg/$PKGINST x OAMadmin $PKGSAV d OAMmif $PKGSAV/intf_install # -d OAMadmin $OAMBASE/add-ons/lp/printers ? ? ? -d OAMadmin $OAMBASE/add-ons/lp/printers/classes -d OAMadmin $OAMBASE/add-ons/lp/printers/filters -d OAMadmin $OAMBASE/add-ons/lp/printers/forms -d OAMadmin $OAMBASE/add-ons/lp/printers/operations -d OAMadmin $OAMBASE/add-ons/lp/printers/printers -d OAMadmin $OAMBASE/add-ons/lp/printers/printers/add -d OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify -d OAMadmin $OAMBASE/add-ons/lp/printers/priorities -d OAMadmin $OAMBASE/add-ons/lp/printers/reports -d OAMadmin $OAMBASE/add-ons/lp/printers/requests -d OAMadmin $OAMBASE/add-ons/lp/printers/systems +d OAMadmin $OAMBASE/menu/printers ? ? ? +d OAMadmin $OAMBASE/menu/printers/classes +d OAMadmin $OAMBASE/menu/printers/filters +d OAMadmin $OAMBASE/menu/printers/forms +d OAMadmin $OAMBASE/menu/printers/operations +d OAMadmin $OAMBASE/menu/printers/printers +d OAMadmin $OAMBASE/menu/printers/priorities +d OAMadmin $OAMBASE/menu/printers/reports +d OAMadmin $OAMBASE/menu/printers/requests +d OAMadmin $OAMBASE/menu/printers/systems # # administrative files: default owner=root group=sys mode=0755 # -!default 0755 root sys -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/mkform.sh -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/getclass.sh -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/findchg.sh -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/chkstty.sh -# -# administrative files: default owner=root group=sys mode=0644 -# !default 0644 root sys f OAMmif $PKGSAV/intf_install/lp.mi -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Form.add -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Form.list -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Form.mod_addpr -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Form.mod_rempr -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Form.modify -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Form.remove -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Menu.class.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Menu.classes -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Menu.pr.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Menu.pr.cl.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Text.add -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Text.error -f OAMadmin $OAMBASE/add-ons/lp/printers/classes/Text.list -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Form.add -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Form.list -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Menu.template -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Form.mod2 -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Form.remove -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Menu.filters -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Text.error -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Text.filt.ls -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Menu.pr.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Form.restore -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Form.options -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Menu.filter.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/filters/Form.modify -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Form.add -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Form.modify -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Form.mount -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Form.remove -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Text.form.ls -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Text.error -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Menu.forms -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Form.list -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Menu.form.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Form.mod2 -f OAMadmin $OAMBASE/add-ons/lp/printers/forms/Menu.filter.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Menu.opers -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.accept -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.default -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.disable -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.enable -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.mount -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.reject -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.start -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.status -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.stop -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Form.unmount -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/operations.men -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/startfailed.t -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/stopfailed.t -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Text.startfail -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Text.stopfail -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Menu.creject -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Menu.caccept -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Menu.cdisable -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Menu.cenable -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Menu.cdefault -f OAMadmin $OAMBASE/add-ons/lp/printers/operations/Menu.cmountf -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/Form.display -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/Form.remove -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Form.add -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Form.conf.lcl -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Form.pwheel -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Form.access -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Form.charset -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Text.error -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Form.comm.lcl -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Text.access -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Text.charset -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Form.conf.rmt -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Menu.ch_users -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Text.pwheel -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Text.confirm -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Text.comm -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Menu.ch_forms -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/add/Menu.ch_class -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Form.modify -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Form.access -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Menu.modify -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Form.charset -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Form.comm.lcl -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Form.conf.lcl -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Form.conf.rmt -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Form.pwheel -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Text.access -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Text.comm -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Text.confirm -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Text.error -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Text.pwheel -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/modify/Text.charset -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/Menu.printers -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/Form.list -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/Text.list -f OAMadmin $OAMBASE/add-ons/lp/printers/printers/Menu.pr.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Form.list -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Form.priority -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Form.set -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Menu.prioritie -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/priorities.men -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Form.users -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Form.default -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Text.list -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Form.system -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Menu.cusers -f OAMadmin $OAMBASE/add-ons/lp/printers/priorities/Form.remove -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Form.wheels -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Form.forms -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Form.printers -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Form.requests -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Form.service -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Menu.reports -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Menu.form.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Text.form.stat -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Menu.wheel.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Text.wh.stat -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Text.pr.stat -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Menu.pr.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Text.rq.stat -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Menu.rq.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Menu.usr.rq.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Text.error -f OAMadmin $OAMBASE/add-ons/lp/printers/reports/Menu.pr.q.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Form.cancel -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Form.hold -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Form.move -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Menu.requests -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Menu.rq.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Menu.pr.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Form.release -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Menu.usr.rq.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Text.error -f OAMadmin $OAMBASE/add-ons/lp/printers/requests/Menu.pr.q.ch -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Form.add -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Form.display -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Form.modify -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Form.remove -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Menu.systems -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Menu.cremove -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Text.display -f OAMadmin $OAMBASE/add-ons/lp/printers/systems/Menu.cmodify -f OAMadmin $OAMBASE/add-ons/lp/printers/Help -f OAMadmin $OAMBASE/add-ons/lp/printers/Menu.lp +f OAMadmin $OAMBASE/menu/printers/Help +f OAMadmin $OAMBASE/menu/printers/Menu.lp +f OAMadmin $OAMBASE/menu/printers/classes/Form.add +f OAMadmin $OAMBASE/menu/printers/classes/Form.list +f OAMadmin $OAMBASE/menu/printers/classes/Form.modify +f OAMadmin $OAMBASE/menu/printers/classes/Form.remove +f OAMadmin $OAMBASE/menu/printers/classes/Help +f OAMadmin $OAMBASE/menu/printers/classes/Text.add +f OAMadmin $OAMBASE/menu/printers/classes/Text.error +f OAMadmin $OAMBASE/menu/printers/classes/classes.ch +f OAMadmin $OAMBASE/menu/printers/classes/cont.slks +f OAMadmin $OAMBASE/menu/printers/classes/members.ch +f OAMadmin $OAMBASE/menu/printers/classes/printers.ch +f OAMadmin $OAMBASE/menu/printers/filters/Form.add +f OAMadmin $OAMBASE/menu/printers/filters/Form.add.2 +f OAMadmin $OAMBASE/menu/printers/filters/Form.list +f OAMadmin $OAMBASE/menu/printers/filters/Form.modify.1 +f OAMadmin $OAMBASE/menu/printers/filters/Form.modify.2 +f OAMadmin $OAMBASE/menu/printers/filters/Form.modify.3 +f OAMadmin $OAMBASE/menu/printers/filters/Form.remove +f OAMadmin $OAMBASE/menu/printers/filters/Help +f OAMadmin $OAMBASE/menu/printers/filters/filter.ch +f OAMadmin $OAMBASE/menu/printers/filters/printers.ch +f OAMadmin $OAMBASE/menu/printers/forms/Form.add +f OAMadmin $OAMBASE/menu/printers/forms/Form.display +f OAMadmin $OAMBASE/menu/printers/forms/Form.modify +f OAMadmin $OAMBASE/menu/printers/forms/Form.mount +f OAMadmin $OAMBASE/menu/printers/forms/Form.remove +f OAMadmin $OAMBASE/menu/printers/forms/Form.status +f OAMadmin $OAMBASE/menu/printers/forms/Form.unmount +f OAMadmin $OAMBASE/menu/printers/forms/Help +f OAMadmin $OAMBASE/menu/printers/operations/Form.accept +f OAMadmin $OAMBASE/menu/printers/operations/Form.default +f OAMadmin $OAMBASE/menu/printers/operations/Form.disable +f OAMadmin $OAMBASE/menu/printers/operations/Form.enable +f OAMadmin $OAMBASE/menu/printers/operations/Form.mount +f OAMadmin $OAMBASE/menu/printers/operations/Form.reject +f OAMadmin $OAMBASE/menu/printers/operations/Form.start +f OAMadmin $OAMBASE/menu/printers/operations/Form.status +f OAMadmin $OAMBASE/menu/printers/operations/Form.stop +f OAMadmin $OAMBASE/menu/printers/operations/Form.unmount +f OAMadmin $OAMBASE/menu/printers/operations/Help +f OAMadmin $OAMBASE/menu/printers/operations/Menu.opers +f OAMadmin $OAMBASE/menu/printers/operations/operations.men +f OAMadmin $OAMBASE/menu/printers/operations/startfailed.t +f OAMadmin $OAMBASE/menu/printers/operations/stopfailed.t +f OAMadmin $OAMBASE/menu/printers/printers/Form.add +f OAMadmin $OAMBASE/menu/printers/printers/Form.display +f OAMadmin $OAMBASE/menu/printers/printers/Form.modify +f OAMadmin $OAMBASE/menu/printers/printers/Form.remove +f OAMadmin $OAMBASE/menu/printers/printers/Help +f OAMadmin $OAMBASE/menu/printers/priorities/Form.list +f OAMadmin $OAMBASE/menu/printers/priorities/Form.priority +f OAMadmin $OAMBASE/menu/printers/priorities/Form.set +f OAMadmin $OAMBASE/menu/printers/priorities/Help +f OAMadmin $OAMBASE/menu/printers/priorities/priorities.men +f OAMadmin $OAMBASE/menu/printers/reports/Form.fonts +f OAMadmin $OAMBASE/menu/printers/reports/Form.forms +f OAMadmin $OAMBASE/menu/printers/reports/Form.printers +f OAMadmin $OAMBASE/menu/printers/reports/Form.requests +f OAMadmin $OAMBASE/menu/printers/reports/Form.service +f OAMadmin $OAMBASE/menu/printers/reports/Help +f OAMadmin $OAMBASE/menu/printers/requests/Form.cancel +f OAMadmin $OAMBASE/menu/printers/requests/Form.hold +f OAMadmin $OAMBASE/menu/printers/requests/Form.move +f OAMadmin $OAMBASE/menu/printers/requests/Form.resume +f OAMadmin $OAMBASE/menu/printers/requests/Help +f OAMadmin $OAMBASE/menu/printers/systems/Form.add +f OAMadmin $OAMBASE/menu/printers/systems/Form.display +f OAMadmin $OAMBASE/menu/printers/systems/Form.modify +f OAMadmin $OAMBASE/menu/printers/systems/Form.remove +f OAMadmin $OAMBASE/menu/printers/systems/Help diff --git a/usr/src/pkg/lp/request b/usr/src/pkg/lp/request index 360e801..1f77b93 100644 --- a/usr/src/pkg/lp/request +++ b/usr/src/pkg/lp/request @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nlp:lp/ifiles/request 1.9" +#ident "@(#)pkg.nlp:lp/ifiles/request 1.8" trap "exit 3" 1 2 3 15 ALLOW=`ckyorn -d n \ @@ -17,20 +17,6 @@ ALLOW=`ckyorn -d n \ -p "Should the disable and enable commands be available to ALL users?" ` || exit $? -POST=`ckyorn -d n \ - -h 'If you answer "y" the programs necessary for using - PostScript printers will be installed. - \\n\\nIf you answer "n" these programs will not be installed. - This will prevent the use of a PostScript printer, but will - conserve space on the hard disk.' \ - -p "Will you be attaching a PostScript printer to this system?" -` || exit $? - echo ALLOW=$ALLOW > $1 -if [ $POST = 'y' ] -then - echo "CLASSES=$CLASSES post" >> $1 -fi - exit $? diff --git a/usr/src/pkg/nfs/copyright b/usr/src/pkg/nfs/copyright index eeda039..84dd7a2 100644 --- a/usr/src/pkg/nfs/copyright +++ b/usr/src/pkg/nfs/copyright @@ -1,4 +1,5 @@ -#ident "@(#)pkg.nfs:copyright 1.2" +#ident "@(#)pkg.nfs:copyright 1.1" Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. Copyright (c) 1986,1987,1988,1989 Sun Microsystems, Inc. +Copyright (c) 1987,1988 Lachman Associates, Inc. (LAI). All Rights Reserved diff --git a/usr/src/pkg/nfs/prototype b/usr/src/pkg/nfs/prototype index c0d6719..1043b7f 100644 --- a/usr/src/pkg/nfs/prototype +++ b/usr/src/pkg/nfs/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nfs:prototype 1.13" +#ident "@(#)pkg.nfs:prototype 1.5" # # information files # @@ -17,6 +17,8 @@ i copyright d none /boot ? ? ? d none /etc ? ? ? d none /etc/master.d ? ? ? +d none /etc/fs ? ? ? +d none /etc/fs/nfs d none /usr ? ? ? d none /usr/bin ? ? ? d none /usr/sbin ? ? ? @@ -24,7 +26,6 @@ d none /usr/lib ? ? ? d none /usr/lib/fs ? ? ? d none /usr/lib/fs/nfs d none /usr/lib/nfs -d none /usr/include/nfs 0755 root sys !default 444 root root f none /boot/NFS=/usr/src/uts/3b2/fs/nfs/NFS @@ -34,11 +35,17 @@ f none /etc/master.d/klm=/usr/src/uts/3b2/master.d/klm !default 555 bin bin f none /usr/lib/fs/nfs/dfmounts +s none /etc/fs/nfs/dfmounts=/usr/lib/fs/nfs/dfmounts f none /usr/lib/fs/nfs/dfshares +s none /etc/fs/nfs/dfshares=/usr/lib/fs/nfs/dfshares f none /usr/lib/fs/nfs/mount +s none /etc/fs/nfs/mount=/usr/lib/fs/nfs/mount f none /usr/lib/fs/nfs/umount +s none /etc/fs/nfs/umount=/usr/lib/fs/nfs/umount f none /usr/lib/fs/nfs/share +s none /etc/fs/nfs/share=/usr/lib/fs/nfs/share f none /usr/lib/fs/nfs/unshare +s none /etc/fs/nfs/unshare=/usr/lib/fs/nfs/unshare f none /usr/lib/nfs/mountd f none /usr/lib/nfs/automount f none /usr/lib/nfs/nfsd @@ -46,25 +53,13 @@ f none /usr/lib/nfs/biod f none /usr/lib/nfs/exportfs f none /usr/lib/nfs/lockd f none /usr/lib/nfs/statd -f none /usr/lib/nfs/bootparamd -f none /usr/sbin/showmount #f none /usr/lib/nfs/rquotad Not available yet - -!default 0444 bin bin -f none /usr/include/nfs/export.h -f none /usr/include/nfs/mount.h -f none /usr/include/nfs/nfs.h -f none /usr/include/nfs/nfs_clnt.h -f none /usr/include/nfs/nfssys.h -f none /usr/include/nfs/rnode.h - -!default 0775 root sys -s none /usr/include/sys/nfs=/usr/include/nfs +#f none /usr/sbin/rpc.bootparamd TCP/IP package +#f none /usr/sbin/showmount SunOS compat pkg !default 444 root sys f none /etc/init.d/nfs l none /etc/rc0.d/K40nfs=/etc/init.d/nfs -l none /etc/rc1.d/K40nfs=/etc/init.d/nfs l none /etc/rc2.d/K20nfs=/etc/init.d/nfs l none /etc/rc3.d/S22nfs=/etc/init.d/nfs # @@ -74,10 +69,6 @@ l none /etc/rc3.d/S22nfs=/etc/init.d/nfs d none /usr/sadm/sysadm/menu/netservices/remote_files/remote d none /usr/sadm/sysadm/menu/netservices/remote_files/remote/nfs d none /usr/sadm/sysadm/menu/netservices/remote_files/remote/nfs/bin -d none /usr/sadm/sysadm/menu/netservices/remote_files/other -d none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs -d none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/control -d none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/control/bin d none /usr/sadm/sysadm/menu/netservices/remote_files/setup d none /usr/sadm/sysadm/menu/netservices/remote_files/setup/nfs d none /usr/sadm/sysadm/menu/netservices/remote_files/local @@ -87,7 +78,6 @@ d none /usr/sadm/sysadm/menu/netservices/remote_files/local/nfs/bin #nfs admin shell scripts # !default 755 bin bin -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/control/bin/status f none /usr/sadm/sysadm/menu/netservices/remote_files/local/nfs/bin/a_att f none /usr/sadm/sysadm/menu/netservices/remote_files/local/nfs/bin/auto_attr f none /usr/sadm/sysadm/menu/netservices/remote_files/local/nfs/bin/auto_mod @@ -133,10 +123,5 @@ f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/nfs/Form.unmount f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/nfs/Help f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/nfs/Text.generic f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/nfs/Text.list -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/Menu.nfs -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/control/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/control/Text.control -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/nfs/control/Menu.control f none /usr/sadm/sysadm/menu/netservices/remote_files/setup/nfs/Help f none /usr/sadm/sysadm/menu/netservices/remote_files/setup/nfs/Menu.setup diff --git a/usr/src/pkg/npack/depend b/usr/src/pkg/npack/depend new file mode 100644 index 0000000..dfb69e4 --- /dev/null +++ b/usr/src/pkg/npack/depend @@ -0,0 +1,2 @@ +#ident "@(#)pkg.npack:depend 1.1" +P nsu Networking Support Utilities diff --git a/usr/src/pkg/npack/pkginfo b/usr/src/pkg/npack/pkginfo new file mode 100644 index 0000000..c1e9afa --- /dev/null +++ b/usr/src/pkg/npack/pkginfo @@ -0,0 +1,21 @@ +#ident "@(#)pkg.npack:pkginfo 1.1" + +ARCH="3b2" +# BASEDIR=/ +CATEGORY="system" +CLASSES="none" +# DESC= +EMAIL="attunix!sar" +# HOTLINE= +ISTATES="S 2" +MAXINST=1 +NAME="NPACK Utilities" +# ORDER= +PKG="npack" +PREDEPEND="npack" +# PSTAMP= +RSTATES="S" +# ULIMIT= +# VENDOR= +VERSION="2.0" +# VSTOCK= diff --git a/usr/src/pkg/npack/postinstall b/usr/src/pkg/npack/postinstall new file mode 100644 index 0000000..2732cae --- /dev/null +++ b/usr/src/pkg/npack/postinstall @@ -0,0 +1,83 @@ +#ident "@(#)pkg.npack:postinstall 1.3 UNOFFICIAL" +# +# postinstall script for npack package +# +# error function - put out a slightly more descriptive error message +# arg 1 is message # +# arg 2 is optional argument for message +# +error() { + errflag=1 + case $1 in + 1) + echo ERROR: drvinstall on $2 failed + ;; + 2) + echo ERROR: could not create $2 + ;; + 3) + echo ERROR: $2 failed + ;; + 4) + echo ERROR: copy failed + ;; + 5) + # message put out elsewhere + ;; + 6) + echo ERROR: installation error + ;; + 7) + echo ERROR: nlsadmin $2 failed for npack + ;; + *) + echo ERROR: undefined error + ;; + esac + } +errflag=0 +BOOT="$BASEDIR/boot" +MASTER="$BASEDIR/etc/master.d" +SYSTEM="$BASEDIR/etc/system" +# +# Configure drivers and make nodes +# +CMAJOR=`/etc/drvinstall -d /boot/CLONE -v 1.0 -nb` || error 1 CLONE +MAJOR=`/etc/drvinstall -m $MASTER/npack -s $SYSTEM -o $BOOT -c 16 -v 1.0` \ + >/dev/null || error 1 NPACK +installf $PKGINST $BASEDIR/dev/npack c $CMAJOR $MAJOR 0666 root sys \ + || error 2 $BASEDIR/dev/npack +# +# Set up listener files for netspec npack +# +nlsadmin -q npack >/dev/null 2>&1 +if [ $? -gt 1 ] +then + /usr/sbin/nlsadmin -i npack || error 7 -i + ADDR=`cat /etc/emd*.addr` + /usr/sbin/nlsadmin -l\\x00000007${ADDR}0000 npack || error 7 -l + /usr/sbin/nlsadmin -a 105 -c "/usr/net/servers/rfs/rfsetup" \ + -y "RFS Server" npack || error 7 -a +fi + +# +# Set up entry in /etc/netconfig +# + +if grep '[ ]localnet[ ][ ]*-[ ][ ]*/dev/npack[ ]' /etc/netconfig >/dev/null 2>&1 +then + : Already there! +else + echo "npack tpi_cots v localnet - /dev/npack /usr/lib/npack.so" >>/etc/netconfig +fi + +# +# finished installing files: tell OAM +# +installf -f $PKGINST || error 6 +# +# make a new UNIX(R) +# +touch $SYSTEM +errflag=`expr ${errflag:=0} + 10` +exit $errflag diff --git a/usr/src/pkg/npack/preinstall b/usr/src/pkg/npack/preinstall new file mode 100644 index 0000000..9a4e69e --- /dev/null +++ b/usr/src/pkg/npack/preinstall @@ -0,0 +1,10 @@ +#ident "@(#)pkg.npack:preinstall 1.1" +# +# preinstall script for npack package +# +# +# Remove old device nodes and files +# +rm -f $BASEDIR/dev/npack* +rm -f $BASEDIR/etc/init.d/*npack $BASEDIR/etc/rc0.d/*npack $BASEDIR/etc/rc2.d/*npack +exit 0 diff --git a/usr/src/pkg/npack/preremove b/usr/src/pkg/npack/preremove new file mode 100644 index 0000000..5209a60 --- /dev/null +++ b/usr/src/pkg/npack/preremove @@ -0,0 +1,39 @@ +#ident "@(#)pkg.npack:preremove 1.3" +# +# preremove script for npack package +# +# error function - put out a slightly more descriptive error message +# arg 1 is message # +# arg 2 is optional argument for message +# +error() { + errflag=1 + case $1 in + 1) + echo "ERROR: drvinstall(uninstall) on $2 failed" + ;; + *) + echo "ERROR: undefined error" + ;; + esac + } +# +errflag=0 +BOOT="$BASEDIR/boot" +MASTER="$BASEDIR/etc/master.d" +SYSTEM="$BASEDIR/etc/system" +# +# Remove the entry from /etc/netconfig +# + +grep -v '[ ]localnet[ ][ ]*-[ ][ ]*/dev/npack[ ]' /etc/netconfig 2>/dev/null >/tmp/$$.1 +mv /tmp/$$.1 /etc/netconfig + +# +# uninstall each supplied driver +# +/etc/drvinstall -u -m $MASTER/npack -s $SYSTEM -o $BOOT \ + -v 1.0 >/dev/null || error 1 NPACK +echo "NPACKriver uninstalled." +errflag=`expr 0$errflag + 10` +exit $errflag diff --git a/usr/src/pkg/npack/prototype b/usr/src/pkg/npack/prototype new file mode 100644 index 0000000..578d3a0 --- /dev/null +++ b/usr/src/pkg/npack/prototype @@ -0,0 +1,63 @@ +#ident "@(#)pkg.npack:prototype 1.3" +# +# All files/directories are defined as relocatable. Although +# BASENAME is not used at this time (i.e. defaults to /) +# doing this may facilitate future development. +# +# installation files: +# 'postinstall' installs drivers, etc +# 'preremove' uninstalls drivers, etc +# +i pkginfo +i preinstall +i postinstall +i preremove +i depend +# +# directories: default owner=root group=sys mode=0775 +# +!default 775 root sys +d none /boot ? ? ? +d none /dev ? ? ? +d none /etc ? ? ? +d none /etc/master.d ? ? ? +d none /etc/init.d ? ? ? +d none /etc/rc0.d ? ? ? +d none /etc/rc2.d ? ? ? +d none /usr ? ? ? +d none /usr/bin ? ? ? +d none /usr/lib ? ? ? +d none /usr/include ? ? ? +d none /usr/include/sys ? ? ? +# +# driver object files: default owner=root group=root mode=0500 +# use already mkboot-ed files for managability +# +!default 0500 root root +e none /boot/NPACK=/usr/src/protocols/io/NPACK +# +# configuration files: default owner=root group=root mode=0444 +# +!default 0444 root root +e none /etc/master.d/npack=/usr/src/protocols/master.d/npack +# +# init scripts: default owner=root, group=sys, mode=444 +# +!default 0444 root sys +f none /etc/init.d/npackinit=/usr/src/protocols/cmd/npackinit +l none /etc/rc0.d/K69npack=/etc/init.d/npackinit +l none /etc/rc2.d/S70npack=/etc/init.d/npackinit +# +# commands: default owner=root, group=sys, mode=0500 +# +!default 0500 root sys +f none /usr/sbin/pckd=/usr/src/protocols/cmd/pckd +l none /usr/bin/pckd=/usr/sbin/pckd +# +# header files: default owner=bin group=bin mode=0444 +# +!default 0444 bin bin +f none /usr/include/sys/npack.h=/usr/src/protocols/sys/npack.h + +!default 0644 bin bin +f none /usr/lib/npack.so diff --git a/usr/src/pkg/nsu/pkginfo b/usr/src/pkg/nsu/pkginfo index 95606c8..d5d5184 100644 --- a/usr/src/pkg/nsu/pkginfo +++ b/usr/src/pkg/nsu/pkginfo @@ -1,9 +1,9 @@ -#ident "@(#)pkg.nsu:pkginfo 1.3.1.2" +#ident "@(#)pkg.nsu:pkginfo 1.3" -ARCH="3B2" +ARCH="3b2" # BASEDIR=/ CATEGORY="system" -CLASSES="none pt build OAMadmin OAMmif" +CLASSES="none pt build" # DESC= # EMAIL= # HOTLINE= diff --git a/usr/src/pkg/nsu/postinstall b/usr/src/pkg/nsu/postinstall index 3a0a3b0..737c8c0 100644 --- a/usr/src/pkg/nsu/postinstall +++ b/usr/src/pkg/nsu/postinstall @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nsu:postinstall 1.20.3.2" +#ident "@(#)pkg.nsu:postinstall 1.20.1.4" # # postinstall script for nsu package # @@ -149,144 +149,13 @@ else echo "ticotsord tpi_cots_ord v loopback - /dev/ticotsord /usr/lib/straddr.so" >>/etc/netconfig fi -# -# create the hosts and services files for the loopback drivers... -# - -mkdir /etc/net /etc/net/ticots /etc/net/ticlts /etc/net/ticotsord >/dev/null 2>&1 - -if grep '^rpcbind rpc' /etc/net/ticots/services >/dev/null 2>&1 -then - : Already there! -else - echo "rpcbind rpc" >>/etc/net/ticots/services -fi - -if grep '^keyserv keyserv' /etc/net/ticots/services >/dev/null 2>&1 -then - : Already there! -else - echo "keyserv keyserv" >>/etc/net/ticots/services -fi - -if grep '^listen serve' /etc/net/ticots/services >/dev/null 2>&1 -then - : Already there! -else - echo "listen serve" >>/etc/net/ticots/services -fi - -if grep '^statd statd' /etc/net/ticots/services >/dev/null 2>&1 -then - : Already there! -else - echo "statd statd" >>/etc/net/ticots/services -fi - -if grep '^lockd lockd' /etc/net/ticots/services >/dev/null 2>&1 -then - : Already there! -else - echo "lockd lockd" >>/etc/net/ticots/services -fi - -if grep '^rpcbind rpc' /etc/net/ticotsord/services >/dev/null 2>&1 -then - : Already there! -else - echo "rpcbind rpc" >>/etc/net/ticotsord/services -fi - -if grep '^keyserv keyserv' /etc/net/ticotsord/services >/dev/null 2>&1 -then - : Already there! -else - echo "keyserv keyserv" >>/etc/net/ticotsord/services -fi - -if grep '^listen serve' /etc/net/ticotsord/services >/dev/null 2>&1 -then - : Already there! -else - echo "listen serve" >>/etc/net/ticotsord/services -fi - -if grep '^statd statd' /etc/net/ticotsord/services >/dev/null 2>&1 -then - : Already there! -else - echo "statd statd" >>/etc/net/ticotsord/services -fi - -if grep '^lockd lockd' /etc/net/ticotsord/services >/dev/null 2>&1 -then - : Already there! -else - echo "lockd lockd" >>/etc/net/ticotsord/services -fi - -if grep '^rpcbind rpc' /etc/net/ticlts/services >/dev/null 2>&1 -then - : Already there! -else - echo "rpcbind rpc" >>/etc/net/ticlts/services -fi - -if grep '^keyserv keyserv' /etc/net/ticlts/services >/dev/null 2>&1 -then - : Already there! -else - echo "keyserv keyserv" >>/etc/net/ticlts/services -fi - -if grep '^listen serve' /etc/net/ticlts/services >/dev/null 2>&1 -then - : Already there! -else - echo "listen serve" >>/etc/net/ticlts/services -fi - -if grep '^statd statd' /etc/net/ticlts/services >/dev/null 2>&1 -then - : Already there! -else - echo "statd statd" >>/etc/net/ticlts/services -fi - -if grep '^lockd lockd' /etc/net/ticlts/services >/dev/null 2>&1 -then - : Already there! -else - echo "lockd lockd" >>/etc/net/ticlts/services -fi - -# -# update the hosts files for the loopback drivers... -# - -UNAME=`/usr/bin/uname` -echo "$UNAME $UNAME" >/etc/net/ticots/hosts -echo "$UNAME $UNAME" >/etc/net/ticlts/hosts -echo "$UNAME $UNAME" >/etc/net/ticotsord/hosts - -# -# Modify the OAM menu to include name to address mapping... -# - -if fgrep 'name_to_address^Machine and Service Address Management^name_to_addr/map.menu' /usr/sadm/sysadm/menu/netservices/netserve.menu >/dev/null 2>&1 -then - : Already there! -else - echo "name_to_address^Machine and Service Address Management^name_to_addr/map.menu" >>/usr/sadm/sysadm/menu/netservices/netserve.menu -fi - # # install listen id (if not there) and fix up files # /usr/bin/passmgmt -a -u 37 -g 4 -c "Network Admin" -h /usr/net/nls listen \ >/dev/null 2>&1 STEM=$BASEDIR/etc/saf -sacadm -L -t listen 2>/dev/null | cut -f1 -d: >/tmp/listeners +sacadm -L -t listen | cut -f1 -d: >/tmp/listeners # # convert the listener files that are already under SAF # control @@ -307,7 +176,7 @@ done # # now convert any old style listeners into new format # -sacadm -L 2>/dev/null | cut -f1 -d: >/tmp/pms +sacadm -L | cut -f1 -d: >/tmp/pms LHOME=$BASEDIR/usr/net/nls for i in $LHOME/* do @@ -366,26 +235,22 @@ done rm /tmp/listeners rm /tmp/pms # -# leave symbolic (and hard) links around for compatibility +# leave symbolic links around for compatibility # -if [ -d $LHOME ] +if [ -f $LHOME/listen ] then - if [ -f $LHOME/listen ] - then - rm $LHOME/listen - fi - if [ -f $LHOME/dbfconv ] - then - rm $LHOME/dbfconv - fi - if [ -f $LHOME/nlps_server ] - then - rm $LHOME/nlps_server - fi + rm $LHOME/listen ln -s $BASEDIR/usr/lib/saf/listen $LHOME/listen +fi +if [ -f $LHOME/dbfconv ] +then + rm $LHOME/dbfconv ln -s $BASEDIR/usr/lib/saf/dbfconv $LHOME/dbfconv +fi +if [ -f $LHOME/nlps_server ] +then + rm $LHOME/nlps_server ln -s $BASEDIR/usr/lib/saf/nlps_server $LHOME/nlps_server - ln $BASEDIR/usr/sbin/nlsadmin $BASEDIR/usr/bin/nlsadmin fi # # finished installing files: tell OAM diff --git a/usr/src/pkg/nsu/preremove b/usr/src/pkg/nsu/preremove index 69874d8..34924dd 100644 --- a/usr/src/pkg/nsu/preremove +++ b/usr/src/pkg/nsu/preremove @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nsu:preremove 1.11.2.3" +#ident "@(#)pkg.nsu:preremove 1.11.1.2" # # preremove script for nsu package # @@ -53,13 +53,13 @@ done # remove listen-type port monitors and any symbolic links that might # be lying arount # -sacadm -L -t listen 2>/dev/null | cut -f1 -d: >/tmp/listeners +sacadm -L -t listen | cut -f1 -d: >/tmp/listeners for i in `cat /tmp/listeners` do sacadm -r -p $i >/dev/null 2>&1 done # -# symlinks and links +# symlinks # LHOME=$BASEDIR/usr/net/nls if [ -f $LHOME/listen ] @@ -74,10 +74,6 @@ if [ -f $LHOME/nlps_server ] then rm $LHOME/nlps_server fi -if [ -f /usr/bin/nlsadmin ] -then - rm /usr/bin/nlsadmin -fi rm /tmp/listeners # @@ -90,13 +86,6 @@ grep -v '[ ]loopback[ ][ ]*-[ ][ ]*/dev/ticots[ ]' /tmp/$$.2 2>/dev/null > rm -f /rmp/$$.1 /tmp/$$.2 -# -# Remove entries from OAM scripts... -# - -fgrep -v 'name_to_address^Machine and Service Address Management^name_to_addr/map.menu' /usr/sadm/sysadm/menu/netservices/netserve.menu 2>/dev/null >/tmp/$$.3 -mv /tmp/$$.3 /usr/sadm/sysadm/menu/netservices/netserve.menu - # # # re-make the kernel diff --git a/usr/src/pkg/nsu/prototype b/usr/src/pkg/nsu/prototype index 896fe87..246b017 100644 --- a/usr/src/pkg/nsu/prototype +++ b/usr/src/pkg/nsu/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.nsu:prototype 1.19.3.3" +#ident "@(#)pkg.nsu:prototype 1.19.2.16" # # All files/directories are defined as relocatable. Although # BASENAME is not used at this time (i.e. defaults to /) @@ -40,13 +40,6 @@ d none /usr/net d none /usr/net/nls d none /usr/lib/saf ? ? ? d none /usr/sbin ? ? ? -d none /usr/sadm ? ? ? -d none /usr/sadm/sysadm ? ? ? -d none $OAMBASE/menu ? ? ? -d none $OAMBASE/menu/netservices ? ? ? -d none $OAMBASE/menu/netservices/name_to_addr ? ? ? -d none $OAMBASE/menu/netservices/name_to_addr/loopback ? ? ? -d none $OAMBASE/menu/netservices/name_to_addr/loopback/bin ? ? ? # # driver object files: default owner=root group=root mode=500 # use already mkboot-ed files for managability @@ -93,12 +86,12 @@ f none /usr/sbin/kmapr s none /usr/bin/kmapr=/usr/sbin/kmapr f none /usr/sbin/kmamkdb s none /usr/bin/kmamkdb=/usr/sbin/kmamkdb -f none /usr/sbin/strace -f none /usr/sbin/strclean -f none /usr/sbin/strerr -s none /usr/bin/strace=/usr/sbin/strace -s none /usr/bin/strclean=/usr/sbin/strclean -s none /usr/bin/strerr=/usr/sbin/strerr +f none /usr/bin/strace +f none /usr/bin/strclean +f none /usr/bin/strerr +s none /usr/sbin/strace=/usr/bin/strace +s none /usr/sbin/strclean=/usr/bin/strclean +s none /usr/sbin/strerr=/usr/bin/strerr f none /usr/sbin/syslogd # # header files: default owner=bin group=bin mode=0444 @@ -114,6 +107,7 @@ f none /usr/include/tiuser.h # !default 0444 root bin f none /usr/lib/libnls.a +f none /usr/lib/libpt.a f none /usr/lib/pt_chmod 04111 root bin f none /usr/lib/libsocket.so f none /usr/lib/libsocket.a @@ -163,22 +157,3 @@ l OAMadmin $OAMBASE/add-ons/$PKGINST/netservices/selection/modify/Help=$OAMBASE/ !default 0755 bin bin f OAMadmin $OAMBASE/bin/nslist f OAMadmin $OAMBASE/bin/chgnetconf -# -# OAM Scripts for Name to Address Mapping... -# -!default 0644 bin bin -f none $OAMBASE/menu/netservices/name_to_addr/Help -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Form.lbserv -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Help -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Menu.loopback -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.badport -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.exists -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.lts -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.lts_ord -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.ord -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.ots -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.ots_lts -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.ots_ord -f none $OAMBASE/menu/netservices/name_to_addr/loopback/Text.success -f none $OAMBASE/menu/netservices/name_to_addr/loopback/bin/loopback.serv 0755 bin bin -f none $OAMBASE/menu/netservices/name_to_addr/map.menu diff --git a/usr/src/pkg/perf/prototype b/usr/src/pkg/perf/prototype index d49be7f..6e35368 100644 --- a/usr/src/pkg/perf/prototype +++ b/usr/src/pkg/perf/prototype @@ -3,7 +3,6 @@ # packaging files i pkginfo i postinstall -i preremove # directories d none /boot ? ? ? diff --git a/usr/src/pkg/rfs/preremove b/usr/src/pkg/rfs/preremove index 278deb5..fbd836f 100644 --- a/usr/src/pkg/rfs/preremove +++ b/usr/src/pkg/rfs/preremove @@ -1,4 +1,4 @@ -#ident "@(#)pkg.rfs:preremove 1.2.1.1" +#ident "@(#)pkg.rfs:preremove 1.2" # # Issue a warning message if RFS is running. # @@ -14,9 +14,4 @@ DRVPATH=/etc/master.d /etc/drvinstall -u -f -m $DRVPATH/rfs -v 1.0 || exit 1 /etc/drvinstall -u -f -m $DRVPATH/sp -v 1.0 || exit 1 -# -# remove log files and lock files created by processes -# -rm -f /etc/dfs/osharetab /usr/net/servers/rfs/rfs.log /etc/rfs/.rmnt.lock /etc/rfs/rmnttab -rm -fr /etc/rfs/auth.info exit 0 diff --git a/usr/src/pkg/rfs/prototype b/usr/src/pkg/rfs/prototype index 193886a..4bf4c49 100644 --- a/usr/src/pkg/rfs/prototype +++ b/usr/src/pkg/rfs/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.rfs:prototype 1.3.10.4" +#ident "@(#)pkg.rfs:prototype 1.3.9.2" # # information files # @@ -86,6 +86,7 @@ f none /usr/sbin/rmntstat s none /usr/bin/rmntstat=/usr/sbin/rmntstat f none /usr/sbin/unadv s none /usr/bin/unadv=/usr/sbin/unadv +f none /usr/lbin/rfsrunning 755 root sys f none /usr/lib/fs/rfs/dfmounts f none /usr/lib/fs/rfs/dfshares 4555 root bin f none /usr/lib/fs/rfs/share @@ -112,17 +113,24 @@ e build /var/spool/cron/crontabs/root=/usr/src/pkg/rfs/crontab # !default 755 root sys d none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs +d none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP d none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/bin d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs +d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/HELP d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control +d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/bin d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map +d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/bin d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net +d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/HELP d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/bin d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system +d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP d none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/bin d none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs +d none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP d none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/bin d none /usr/sadm/sysadm/menu/netservices/remote_files/setup/rfs # @@ -146,8 +154,6 @@ f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/bin/gid_m f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/bin/uid_map f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/bin/rfs_net f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/bin/set_tp -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/bin/getaddr -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/bin/call_addr f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/bin/find_trans f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/bin/get_tps f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/bin/line_num @@ -173,18 +179,6 @@ f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/bin/remote_moun # fmli scripts for rfs admin # !default 644 bin bin -f none /usr/sadm/sysadm/menu/netservices/remote_files/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/setup/rfs/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/local/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/Help -f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/Help f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Form.list f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Form.modify f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Form.modify2 @@ -194,12 +188,45 @@ f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Form.share2 f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Form.unshar2 f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Form.unshar3 f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Form.unshare +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/acc.sh.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/acc.un.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/aut.lst.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/aut.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/auto.un.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/cli.sh.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/cur.lst.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/cur.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/des.sh.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/dir.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/dir.sh.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/imm.un.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/ok.mod2.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/ok.mod3.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/ok.unsh.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/res.sh.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/HELP/res.un.help f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Text.list f none /usr/sadm/sysadm/menu/netservices/remote_files/local/rfs/Text.shmsg +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/HELP/control.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/HELP/id_map.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/HELP/netwk.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/HELP/system.help f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/Menu.rfs f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/Form.start f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/Form.start2 f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/Form.stop +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/add.st.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/check.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/con.loc.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/con.rem.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/conf.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/mstop.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/pass2.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/passctl.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/start.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/stop.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/tp.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/HELP/ver.st.help f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/Menu.control f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/Menu.passctl f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/control/Text.check @@ -209,8 +236,19 @@ f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/Form.set f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/Form.set2 f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/Form.set3 f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/Form.set4 +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/disp.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/gid.dis.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/gid.map.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/gid.set.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/set.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/uid.dis.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/uid.map.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/HELP/uid.set.help f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/Menu.idmap f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/id_map/Text.display +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/HELP/display.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/HELP/set.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/HELP/tr.set.help f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/Menu.netwk f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/Menu.set f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/net/Text.display @@ -223,6 +261,23 @@ f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Form.rf_a f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Form.rf_rem f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Form.rf_rem2 f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Form.set +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/addm.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/addpass.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/address.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/adr.ad.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/con.add.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/display.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/domain.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/lsactiv.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/lshost.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/lsname.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/remm.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/remove.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/rempass.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/role.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/set.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/system.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/HELP/transp.help f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Menu.member f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Menu.system f none /usr/sadm/sysadm/menu/netservices/remote_files/other/rfs/system/Menu.transp @@ -240,6 +295,28 @@ f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/Form.mount f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/Form.unmnt2 f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/Form.unmnt3 f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/Form.unmount +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/acc.mnt.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/acc.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/aut.lst.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/aut.mnt.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/aut.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/auto.un.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/cac.mnt.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/cac.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/cur.lst.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/cur.mnt.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/cur.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/imm.un.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/mnt.mnt.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/mnt.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/mode.un.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/ok.un.auto +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/ok.un.imm +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/res.mnt.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/res.mod.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/res.un.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/set.mnt.help +f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/HELP/su.mod.help f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/Text.list f none /usr/sadm/sysadm/menu/netservices/remote_files/remote/rfs/Text.mount f none /usr/sadm/sysadm/menu/netservices/remote_files/setup/rfs/Menu.setup diff --git a/usr/src/pkg/rpc/postinstall b/usr/src/pkg/rpc/postinstall index b71b62b..5bc0afa 100644 --- a/usr/src/pkg/rpc/postinstall +++ b/usr/src/pkg/rpc/postinstall @@ -1,34 +1,50 @@ -#ident "@(#)pkg.rpc:postinstall 1.5.1.3" +#ident "@(#)pkg.rpc:postinstall 1.5.1.1" -#------install drivers +#-----create system name entries in loopback administrative files -FAILURE=1 # exit code if anything goes wrong -BOOT=/boot # home of driver object modules -MASTER=/etc/master.d +NETDIR=/etc/net +HOSTDIR="$NETDIR/ticots $NETDIR/ticotsord $NETDIR/ticlts" +HOSTNAME=`uname` +i=/etc/net/ticots -/etc/drvinstall -d $BOOT/KRPC -v 1.0 || exit $FAILURE -/etc/drvinstall -d $BOOT/KTLI -v 1.0 || exit $FAILURE -/etc/drvinstall -d $BOOT/IDES -v 1.0 || exit $FAILURE +for i in $HOSTDIR; do + if [ -d $i ] && [ -f $i/hosts ]; then + #Write hostname into hosts file + if grep "$HOSTNAME" $i/hosts >/dev/null 2>&1 ; then : + else + echo "$HOSTNAME\t$HOSTNAME" >>$i/hosts 2>/dev/null + fi + else + echo "**WARNING** ${PKGNAME} cannot install loopback system administrative entries in /etc/net." + echo "They must be added later for RPC services to function." + fi +done #-------update /etc/system - ETCSYSTEM=/etc/system DES='INCLUDE:DES' IDES='INCLUDE:IDES' COMMENTOUT='*INCLUDE:IDES' if [ -f $ETCSYSTEM ]; then - if grep "$DES" $ETCSYSTEM >/dev/null 2>&1 + if grep "$COMMENTOUT" $ETCSYSTEM >/dev/null 2>&1 then - if grep "$IDES" $ETCSYSTEM >/dev/null 2>&1 - then ed $ETCSYSTEM <<-! >/dev/null 2>&1 - g/$IDES/d + g/$COMMENTOUT/d w q ! - echo "$COMMENTOUT" >>$ETCSYSTEM 2>/dev/null + echo "$IDES" >>$ETCSYSTEM 2>/dev/null + else + if grep "$IDES" $ETCSYSTEM >/dev/null 2>&1; then : + else + if (grep "$DES" $ETCSYSTEM >/dev/null 2>&1) + then + echo "$COMMENTOUT" >>$ETCSYSTEM 2>/dev/null + else + echo "$IDES" >>$ETCSYSTEM 2>/dev/null + fi fi fi else @@ -36,6 +52,14 @@ if [ -f $ETCSYSTEM ]; then echo "The entry will have to be added manually at a later time." fi +#------install drivers +FAILURE=1 # exit code if anything goes wrong +BOOT=/boot # home of driver object modules +MASTER=/etc/master.d + +/etc/drvinstall -d $BOOT/KRPC -v 1.0 || exit $FAILURE +/etc/drvinstall -d $BOOT/KTLI -v 1.0 || exit $FAILURE +/etc/drvinstall -d $BOOT/IDES -v 1.0 || exit $FAILURE exit 10 # indicates that the system should be rebooted diff --git a/usr/src/pkg/rpc/preremove b/usr/src/pkg/rpc/preremove index bcfb784..262ffa2 100644 --- a/usr/src/pkg/rpc/preremove +++ b/usr/src/pkg/rpc/preremove @@ -1,28 +1,23 @@ -#ident "@(#)pkg.rpc:preremove 1.4" +#ident "@(#)pkg.rpc:preremove 1.3" #-----Remove administrative files +rm -rf /var/yp || exit 1 +rm -rf /etc/net || exit 1 rm -f /etc/publickey || exit 1 rm -f /etc/netid || exit 1 -#-----Remove drivers -FAILURE=2 # exit code if anything goes wrong -MASTER=/etc/master.d # home of master.d files - -/etc/drvinstall -u -m $MASTER/ktli -v 1.0 || exit $FAILURE -/etc/drvinstall -u -m $MASTER/krpc -v 1.0 || exit $FAILURE -/etc/drvinstall -u -m $MASTER/ides -v 1.0 || exit $FAILURE +#-----Remove etc/system entries -#-----Remove /etc/system entries ETCSYSTEM=/etc/system -COMMENTOUT="*INCLUDE:IDES" +IDES="INCLUDE:IDES" if [ -f $ETCSYSTEM ]; then - if grep "$COMMENTOUT" $ETCSYSTEM >/dev/null 2>&1 + if grep "$IDES" $ETCSYSTEM >/dev/null 2>&1 then ed $ETCSYSTEM <<-! >/dev/null 2>&1 - g/$COMMENTOUT/d + g/$IDES/d w q ! @@ -32,5 +27,12 @@ else echo "The entry will have to be deleted manually at a later time." fi +#-----Remove drivers +FAILURE=2 # exit code if anything goes wrong +MASTER=/etc/master.d # home of master.d files + +/etc/drvinstall -u -m $MASTER/ktli -v 1.0 || exit $FAILURE +/etc/drvinstall -u -m $MASTER/krpc -v 1.0 || exit $FAILURE +/etc/drvinstall -u -m $MASTER/ides -v 1.0 || exit $FAILURE exit 10 # indicates that the system should be rebooted diff --git a/usr/src/pkg/rpc/prototype b/usr/src/pkg/rpc/prototype index bfee6b6..356809f 100644 --- a/usr/src/pkg/rpc/prototype +++ b/usr/src/pkg/rpc/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.rpc:prototype 1.29" +#ident "@(#)pkg.rpc:prototype 1.18" # packaging files i pkginfo @@ -19,6 +19,9 @@ d none /usr ? ? ? d none /usr/bin ? ? ? d none /usr/sbin ? ? ? d none /usr/lib ? ? ? +d none /var ? ? ? +d none /var/yp 755 root sys +d none /var/yp/binding 755 root sys !default 555 bin bin e none /boot/KRPC=/usr/src/uts/3b2/rpc/KRPC @@ -33,47 +36,68 @@ e none /etc/master.d/ides=/usr/src/uts/3b2/master.d/ides !default 444 root sys f none /etc/init.d/rpc l none /etc/rc0.d/K50rpc=/etc/init.d/rpc -l none /etc/rc1.d/K50rpc=/etc/init.d/rpc l none /etc/rc2.d/S75rpc=/etc/init.d/rpc #administrative files for yp and loopback drivers -!default 0644 root sys +!default 0444 root sys f none /etc/publickey f none /etc/netid -f none /etc/rpc -f none /etc/slaves -f none /etc/masters +f none /etc/net/ticots/hosts +f none /etc/net/ticots/services +f none /etc/net/ticotsord/hosts +f none /etc/net/ticotsord/services +f none /etc/net/ticlts/hosts +f none /etc/net/ticlts/services +f none /var/yp/aliases !default 0555 root sys +f none /var/yp/updaters +f none /var/yp/Makefile # package objects: !default 555 bin bin f none /usr/sbin/rpcbind f none /usr/lib/librpcsvc.a +f none /usr/lib/libmp.a f none /usr/bin/rpcgen f none /usr/bin/rpcinfo -f none /usr/lib/netsvc/rwall/rpc.rwalld -f none /usr/lib/netsvc/rusers/rpc.rusersd -f none /usr/lib/netsvc/spray/rpc.sprayd -f none /usr/sbin/keyenvoy 04555 root sys -f none /usr/sbin/rwall +f none /usr/sbin/rpc.rwalld +f none /usr/sbin/rpc.rusersd +f none /usr/sbin/rpc.sprayd +f none /usr/sbin/keyenvoy 04555 root bin +f none /usr/bin/rwall f none /usr/bin/rusers -f none /usr/sbin/spray -f none /usr/sbin/keyprop +f none /usr/bin/spray +f none /usr/bin/rup f none /usr/bin/chkey -f none /usr/sbin/newkey 0555 root sys +f none /usr/bin/newkey f none /usr/bin/domainname f none /usr/bin/keylogin -f none /usr/sbin/keyserv 0555 root sys +f none /usr/sbin/keyserv +f none /usr/bin/ypmatch +f none /usr/bin/ypwhich +f none /usr/bin/ypcat +f none /usr/sbin/makedbm +f none /usr/sbin/yppoll +f none /usr/sbin/yppush +f none /usr/sbin/ypset +f none /usr/sbin/ypxfr +f none /usr/sbin/ypbind +f none /usr/sbin/ypserv +f none /usr/sbin/ypinit +f none /usr/sbin/udpublickey +f none /usr/sbin/ypupdated # header files # !default 0444 bin bin +f none /usr/include/rpc/mp.h=/usr/src/head/rpc/mp.h +f none /usr/include/rpcsvc/dbm.h=/usr/src/head/rpcsvc/dbm.h f none /usr/include/rpcsvc/mount.h=/usr/src/head/rpcsvc/mount.h +f none /usr/include/rpcsvc/rstat.h=/usr/src/head/rpcsvc/rstat.h f none /usr/include/rpcsvc/rusers.h=/usr/src/head/rpcsvc/rusers.h f none /usr/include/rpcsvc/rwall.h=/usr/src/head/rpcsvc/rwall.h f none /usr/include/rpcsvc/spray.h=/usr/src/head/rpcsvc/spray.h f none /usr/include/rpcsvc/yp_prot.h=/usr/src/head/rpcsvc/yp_prot.h f none /usr/include/rpcsvc/ypclnt.h=/usr/src/head/rpcsvc/ypclnt.h f none /usr/include/rpcsvc/ypupd.h=/usr/src/head/rpcsvc/ypupd.h -f none /usr/include/rpcsvc/dbm.h=/usr/src/head/rpcsvc/dbm.h diff --git a/usr/src/pkg/slnmap/depend b/usr/src/pkg/slnmap/depend new file mode 100644 index 0000000..13fec87 --- /dev/null +++ b/usr/src/pkg/slnmap/depend @@ -0,0 +1,4 @@ +#ident "@(#)pkg.slnmap:depend 1.1" +P slnnau AT&T STARLAN NETWORK 3B2 NAU Package + + diff --git a/usr/src/pkg/slnmap/pkginfo b/usr/src/pkg/slnmap/pkginfo new file mode 100644 index 0000000..466d72d --- /dev/null +++ b/usr/src/pkg/slnmap/pkginfo @@ -0,0 +1,11 @@ +#ident "@(#)pkg.slnmap:pkginfo 1.1" + +# +# required parameters +# + +PKG="slnmap" +VERSION="" +NAME="AT&T STARLAN NETWORK 3B2 Name to Address Mapping" +CLASSES="none" +CATEGORY="system" diff --git a/usr/src/pkg/slnmap/postinstall b/usr/src/pkg/slnmap/postinstall new file mode 100644 index 0000000..7c89c84 --- /dev/null +++ b/usr/src/pkg/slnmap/postinstall @@ -0,0 +1,37 @@ +#ident "@(#)pkg.slnmap:postinstall 1.1" + +installf $PKGINST /usr/options/$PKG.name +echo $NAME > /usr/options/$PKG.name + +# +# Udpate the /etc/netconfig file +# +if grep '[ ]osinet[ ][ ]*-[ ][ ]*/dev/starlan[ ]' /etc/netconfig >/dev/null 2>&1 +then + : Already there! +else + echo "starlan tpi_cots v osinet - /dev/starlan /usr/lib/straddr.so" >>/etc/netconfig +fi + +if grep '[ ]osinet[ ][ ]*-[ ][ ]*/dev/starlandg[ ]' /etc/netconfig >/dev/null 2>&1 +then + : Already there! +else + echo "starlandg tpi_clts v osinet - /dev/starlandg /usr/lib/straddr.so" >>/etc/netconfig +fi + +# +# Set STRMSGSZ to 4096 +# + +ed /etc/master.d/kernel </dev/null 2>&1 +/STRMSGSZ = 0$/s/0/4096/ +w +q +! + +cd /boot +/usr/sbin/mkboot -k KERNEL + +installf -f $PKGINST +exit 10 diff --git a/usr/src/pkg/slnmap/preremove b/usr/src/pkg/slnmap/preremove new file mode 100644 index 0000000..ab6bb46 --- /dev/null +++ b/usr/src/pkg/slnmap/preremove @@ -0,0 +1,12 @@ +#ident "@(#)pkg.slnmap:preremove 1.1" + +# +# Remove the entries from /etc/netconfig +# + +grep -v '[ ]osinet[ ][ ]*-[ ][ ]*/dev/starlan[ ]' /etc/netconfig 2>/dev/null >/tmp/$$.1 +grep -v '[ ]osinet[ ][ ]*-[ ][ ]*/dev/starlandg[ ]' /tmp/$$.1 2>/de/etc/netconfig + +rm -f /rmp/$$.1 + +exit 0 diff --git a/usr/src/pkg/slnmap/prototype b/usr/src/pkg/slnmap/prototype new file mode 100644 index 0000000..4ffa80d --- /dev/null +++ b/usr/src/pkg/slnmap/prototype @@ -0,0 +1,7 @@ +#ident "@(#)pkg.slnmap:prototype 1.1" + +# packaging files +i pkginfo +i depend +i postinstall +i preremove diff --git a/usr/src/pkg/sys/depend b/usr/src/pkg/sys/depend index 9f711f2..939ea07 100644 --- a/usr/src/pkg/sys/depend +++ b/usr/src/pkg/sys/depend @@ -1,4 +1,7 @@ -#ident "@(#)pkg.sys:depend 1.1.4.1" -# P indicates a prerequisite for installation -# I indicates an incompatible package -# R indicates a reverse depedency +#ident "@(#)pkg.sys:depend 1.1" +R terminfo terminal information +R editors editing utilities +R perf performance utilities +R windowing windowing utilities +R ipc inter-process commmunication + diff --git a/usr/src/pkg/sys/prototype b/usr/src/pkg/sys/prototype index 8370342..59ba998 100644 --- a/usr/src/pkg/sys/prototype +++ b/usr/src/pkg/sys/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.sys:prototype 1.2.19.3" +#ident "@(#)pkg.sys:prototype 1.2.13.3" # the package files i pkginfo @@ -16,11 +16,13 @@ d none /usr/include/arpa 0755 root sys d none /usr/include/des 0755 root sys d none /usr/include/net 0755 root sys d none /usr/include/netinet 0755 root sys +d none /usr/include/nfs 0755 root sys d none /usr/include/protocols 0755 root sys d none /usr/include/rpc 0755 root sys # the objects: files !default 0444 bin bin +f none /usr/include/fmtmsg.h f none /usr/include/nserve.h f none /usr/include/pn.h f none /usr/include/sys/acct.h @@ -63,6 +65,7 @@ f none /usr/include/sys/elog.h f none /usr/include/sys/elf.h f none /usr/include/sys/elf_M32.h f none /usr/include/sys/elftypes.h +f none /usr/include/sys/erec.h f none /usr/include/sys/err.h f none /usr/include/sys/errno.h f none /usr/include/sys/ertyp.h @@ -72,7 +75,6 @@ f none /usr/include/sys/evecb.h f none /usr/include/sys/events.h f none /usr/include/sys/evsys.h f none /usr/include/sys/evsyscall.h -f none /usr/include/sys/exec.h f none /usr/include/sys/extbus.h f none /usr/include/sys/fault.h f none /usr/include/sys/fblk.h @@ -87,6 +89,7 @@ f none /usr/include/sys/fsiboot.h f none /usr/include/sys/fsid.h f none /usr/include/sys/fstyp.h f none /usr/include/sys/gate.h +f none /usr/include/sys/gdpstr.h f none /usr/include/sys/hdeioctl.h f none /usr/include/sys/hdelog.h f none /usr/include/sys/hetero.h @@ -157,7 +160,6 @@ f none /usr/include/sys/ptms.h f none /usr/include/sys/pump.h f none /usr/include/sys/queue.h f none /usr/include/sys/reg.h -f none /usr/include/sys/regset.h f none /usr/include/sys/resource.h f none /usr/include/sys/rf_adv.h f none /usr/include/sys/rf_cirmgr.h @@ -176,6 +178,7 @@ f none /usr/include/sys/sem.h f none /usr/include/sys/session.h f none /usr/include/sys/sgs.h f none /usr/include/sys/shm.h +f none /usr/include/sys/sigaction.h f none /usr/include/sys/siginfo.h f none /usr/include/sys/signal.h f none /usr/include/sys/sit.h @@ -198,7 +201,7 @@ f none /usr/include/sys/strpump.h f none /usr/include/sys/strstat.h f none /usr/include/sys/strtty.h f none /usr/include/sys/swap.h -f none /usr/include/sys/nsxt.h +f none /usr/include/sys/sxt.h f none /usr/include/sys/sys3b.h f none /usr/include/sys/syscall.h f none /usr/include/sys/sysgdb.h @@ -227,15 +230,12 @@ f none /usr/include/sys/tspriocntl.h f none /usr/include/sys/ttcompat.h f none /usr/include/sys/ttold.h f none /usr/include/sys/tty.h -f none /usr/include/sys/ttydev.h -f none /usr/include/sys/ttychars.h f none /usr/include/sys/tuneable.h f none /usr/include/sys/types.h f none /usr/include/sys/uadmin.h f none /usr/include/sys/ucontext.h f none /usr/include/sys/uio.h f none /usr/include/sys/ulimit.h -f none /usr/include/sys/unistd.h f none /usr/include/sys/user.h f none /usr/include/sys/ustat.h f none /usr/include/sys/utime.h @@ -298,6 +298,12 @@ f none /usr/include/netinet/tcp_var.h f none /usr/include/netinet/tcpip.h f none /usr/include/netinet/udp.h f none /usr/include/netinet/udp_var.h +f none /usr/include/nfs/export.h +f none /usr/include/nfs/mount.h +f none /usr/include/nfs/nfs.h +f none /usr/include/nfs/nfs_clnt.h +f none /usr/include/nfs/nfssys.h +f none /usr/include/nfs/rnode.h f none /usr/include/rpc/auth.h f none /usr/include/rpc/auth_des.h f none /usr/include/rpc/auth_sys.h @@ -354,5 +360,8 @@ f none /usr/include/vm/vpage.h # /usr/include symlinks to /usr/include/sys directories !default 0775 root sys +s none /usr/include/sys/des=/usr/include/des s none /usr/include/sys/net=/usr/include/net s none /usr/include/sys/netinet=/usr/include/netinet +s none /usr/include/sys/nfs=/usr/include/nfs +s none /usr/include/sys/rpc=/usr/include/rpc diff --git a/usr/src/pkg/sysadm/postinstall b/usr/src/pkg/sysadm/postinstall index 29f7c1e..90c5b9b 100644 --- a/usr/src/pkg/sysadm/postinstall +++ b/usr/src/pkg/sysadm/postinstall @@ -1,10 +1,6 @@ -#ident "@(#)pkg.sysadm:postinstall 1.7" +#ident "@(#)pkg.sysadm:postinstall 1.6" cp /sbin/fsdb /usr/sbin/fsdb rm -f /etc/fsdb ln -s /usr/sbin/fsdb /etc/fsdb cp /etc/fs/s5/fsdb /usr/lib/fs/s5/fsdb -cd /usr/lib/locale/C -montbl montbl_C -colltbl colltbl_C -chrtbl chrtbl_C installf -f $PKGINST diff --git a/usr/src/pkg/sysadm/prototype b/usr/src/pkg/sysadm/prototype index 93f07be..ed5ce6a 100644 --- a/usr/src/pkg/sysadm/prototype +++ b/usr/src/pkg/sysadm/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.sysadm:prototype 1.27.2.5" +#ident "@(#)pkg.sysadm:prototype 1.20" # packaging files @@ -18,14 +18,6 @@ d none /usr/bin ? ? ? d none /usr/sbin 775 root sys d none /usr/lib/fs 775 root sys d none /usr/lib/fs/s5 775 root sys -d none /usr/lib/locale 775 root sys -d none /usr/lib/locale/C 775 root sys -d none /usr/lib/locale/Xopen 775 root sys -d none /usr/lib/locale/Xopen1 775 root sys -d none /usr/lib/locale/Xopen/LC_MESSAGES 777 root sys -d none /usr/lib/locale/Xopen1/LC_MESSAGES 777 root sys -d none /usr/lib/locale/TZ 755 bin bin -d none /usr/lib/locale/C/LC_MESSAGES 775 root sys # package objects: @@ -38,7 +30,6 @@ f none /usr/bin/gettxt f none /usr/bin/printf f none /usr/bin/iconv f none /usr/bin/gencat -f none /usr/bin/mkfifo 555 root root f none /usr/bin/mkmsgs 555 root root f none /usr/bin/srchtxt f none /usr/sbin/chroot @@ -51,13 +42,17 @@ f none /usr/sbin/dfsck s none /etc/dfsck=/usr/sbin/dfsck f none /usr/sbin/ff s none /etc/ff=/usr/sbin/ff -f none /usr/sbin/dcopy +l none /usr/sbin/dcopy=/usr/sbin/ff s none /etc/dcopy=/usr/sbin/dcopy f none /sbin/fsdb +f none /usr/lib/fs/s5/dcopy +f none /usr/lib/fs/s5/ff +f none /usr/lib/fs/s5/ncheck +f none /etc/fs/s5/fsdb f none /usr/sbin/fuser s none /etc/fuser=/usr/sbin/fuser f none /usr/sbin/grpck -s none /etc/grpck=/usr/sbin/grpck +s none /etc/grpchk=/usr/sbin/grpck f none /usr/sbin/ldsysdump s none /etc/ldsysdump=/usr/sbin/ldsysdump f none /usr/sbin/link 500 root bin @@ -75,19 +70,6 @@ f none /usr/sbin/volcopy s none /etc/volcopy=/usr/sbin/volcopy f none /usr/sbin/whodo 4555 root bin s none /etc/whodo=/usr/sbin/whodo 4555 root bin -f none /usr/sbin/zic -f none /usr/sbin/zdump -f none /usr/lib/locale/C/LC_TIME 444 root bin -f none /usr/lib/locale/C/chrtbl_C 444 root bin -f none /usr/lib/locale/C/colltbl_C 444 root bin -f none /usr/lib/locale/C/montbl_C 444 root bin -f none /usr/lib/locale/TZ/asia 644 bin bin -f none /usr/lib/locale/TZ/australasia 644 bin bin -f none /usr/lib/locale/TZ/etcetera 644 bin bin -f none /usr/lib/locale/TZ/europe 644 bin bin -f none /usr/lib/locale/TZ/northamerica 644 bin bin -f none /usr/lib/locale/TZ/pacificnew 644 bin bin -f none /usr/lib/locale/TZ/southamerica 644 bin bin # set the default permissions if none are specified !OAMBASE=/usr/sadm/sysadm @@ -130,6 +112,7 @@ f bkrs /usr/lib/getdate/bkrsdates 444 bin bin f bkrs /usr/lib/libadmIO/CTC 700 root sys f bkrs /usr/include/table.h 444 bin bin f bkrs /usr/include/bkrs.h 444 bin bin +f bkrs /usr/include/sys/libadmIO.h 444 bin bin f bkrs /usr/sbin/bkstatus 100 root sys f bkrs /usr/sbin/bkexcept 100 root sys @@ -206,8 +189,6 @@ x OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service 0755 root sys f OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/Help x OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/backup 0755 root sys f OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/backup/Help -f OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/backup/Text.bkpok -f OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/backup/Text.bkpnok f OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/backup/Form.backup x OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/history 0755 root sys f OAMadmin $OAMBASE/add-ons/$PKGINST/backup_service/history/Help @@ -462,10 +443,25 @@ f edsys $OAMBASE/edmenu/Form.savepkg 0644 bin bin f edsys $OAMBASE/edmenu/Form.select 0644 bin bin f edsys $OAMBASE/edmenu/Form.test 0644 bin bin f edsys $OAMBASE/edmenu/Form.overwrite 0644 bin bin -f edsys $OAMBASE/edmenu/Form.redo 0644 bin bin f edsys $OAMBASE/edmenu/Menu.pkg 0644 bin bin f edsys $OAMBASE/edmenu/Menu.choices 0644 bin bin f edsys $OAMBASE/edmenu/Menu.menu 0644 bin bin f edsys $OAMBASE/edmenu/Menu.task 0644 bin bin f edsys $OAMBASE/edmenu/Menu.testmenu 0644 bin bin -f edsys $OAMBASE/edmenu/Help 0755 bin bin +d edsys $OAMBASE/edmenu/HELP 0755 bin bin +f edsys $OAMBASE/edmenu/HELP/chgmen.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/chgtsk.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/choice.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/collsn.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/error.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/gpkg.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/menu.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/pkg.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/pkgmen.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/pkgtsk.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/save.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/select.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/svpkg.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/task.help 0644 bin bin +f edsys $OAMBASE/edmenu/HELP/test.help 0644 bin bin + diff --git a/usr/src/pkg/terminf/pkginfo b/usr/src/pkg/terminf/pkginfo index 9ea3775..fb363db 100644 --- a/usr/src/pkg/terminf/pkginfo +++ b/usr/src/pkg/terminf/pkginfo @@ -1,4 +1,4 @@ -#ident "@(#)pkg.terminf:terminf/pkginfo 1.3" +#ident "@(#)pkg.terminf:terminf/pkginfo 1.2" PKG="terminf" CLASSES="none" @@ -6,5 +6,5 @@ NAME="Terminal Information Utilities" VERSION="4.0" VENDOR="AT&T" CATEGORY="system,essential" -PREDEPEND="terminf" +PREPEND="terminf" INTONLY="y" diff --git a/usr/src/pkg/terminf/prototype b/usr/src/pkg/terminf/prototype index 70b768d..dbf9571 100644 --- a/usr/src/pkg/terminf/prototype +++ b/usr/src/pkg/terminf/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.terminf:terminf/prototype 1.12" +#ident "@(#)pkg.terminf:terminf/prototype 1.8" # packaging and installation scripts @@ -6,8 +6,8 @@ i pkginfo i postinstall i postremove -d none /usr 775 root sys -d none /usr/share 755 root sys +d none /usr +d none /usr/share d none /usr/share/lib 775 root bin d none /etc 775 root sys f none /usr/share/lib/termcap 444 root bin @@ -22,8 +22,6 @@ f none /usr/share/lib/tabset/std 444 root bin f none /usr/share/lib/tabset/teleray 444 root bin f none /usr/share/lib/tabset/vt100 444 root bin f none /usr/share/lib/tabset/xerox1720 444 root bin -f none /usr/share/lib/tabset/hds 444 root bin -f none /usr/share/lib/tabset/hds3 444 root bin # the following files should be pulled from the cross-env during packaging @@ -37,10 +35,9 @@ f none /usr/bin/clear 555 bin bin d none /tmp 777 sys sys d none /tmp/terminf 444 root bin v none /tmp/terminf/adds.ti=/usr/share/lib/terminfo/ti/adds.ti 444 root bin -v none /tmp/terminf/annarbor.ti=/usr/share/lib/terminfo/ti/annarbor.ti 444 root bin +v none /tmp/terminf/annarbour.ti=/usr/share/lib/terminfo/ti/annarbor.ti 444 root bin v none /tmp/terminf/ansi.ti=/usr/share/lib/terminfo/ti/ansi.ti 444 root bin v none /tmp/terminf/att.ti=/usr/share/lib/terminfo/ti/att.ti 444 root bin -v none /tmp/terminf/attprint.ti=/usr/share/lib/terminfo/ti/attprint.ti 444 root bin v none /tmp/terminf/beehive.ti=/usr/share/lib/terminfo/ti/beehive.ti 444 root bin v none /tmp/terminf/cdc.ti=/usr/share/lib/terminfo/ti/cdc.ti 444 root bin v none /tmp/terminf/colorscan.ti=/usr/share/lib/terminfo/ti/colorscan.ti 444 root bin diff --git a/usr/src/pkg/usrenv/depend b/usr/src/pkg/usrenv/depend index 7cc1817..18a1839 100644 --- a/usr/src/pkg/usrenv/depend +++ b/usr/src/pkg/usrenv/depend @@ -1,6 +1,7 @@ -#ident "@(#)pkg.usrenv:depend 1.2" +#ident "@(#)pkg.usrenv:depend 1.1" # P indicates a prerequisite for installation # I indicates an incompatible package # R indicates a reverse dependency P dfm directory and file management utilities +R bnu basic networking utilities diff --git a/usr/src/pkg/usrenv/pkginfo b/usr/src/pkg/usrenv/pkginfo index eeeef9b..5dc7e88 100644 --- a/usr/src/pkg/usrenv/pkginfo +++ b/usr/src/pkg/usrenv/pkginfo @@ -1,9 +1,9 @@ -#ident "@(#)pkg.usrenv:pkginfo 1.2" +#ident "@(#)pkg.usrenv:pkginfo 1.1" # required parameters PKG="usrenv" -ARCH="3B2" +ARCH="3b2" VERSION="" -NAME="User Environment Utilities" +NAME="user environment utilities" CATEGORY="system" CLASSES="none" MAXINST="1" diff --git a/usr/src/pkg/usrenv/postinstall b/usr/src/pkg/usrenv/postinstall index 44ec871..5f7179e 100644 --- a/usr/src/pkg/usrenv/postinstall +++ b/usr/src/pkg/usrenv/postinstall @@ -1,4 +1,4 @@ -#ident "@(#)pkg.usrenv:postinstall 1.9" +#ident "@(#)pkg.usrenv:postinstall 1.8" # install SXT driver (for shl) using drvinstall and check error BOOT=/boot @@ -39,11 +39,5 @@ fi installf $PKGINST /usr/options/$PKG.name echo $NAME > /usr/options/$PKG.name -installf $PKGINST /usr/options/shell.name -echo "Shell Programming Utilities" > /usr/options/shell.name - -installf $PKGINST /usr/options/calc.name -echo "Calculation Utilities" > /usr/options/calc.name - installf -f $PKGINST || exit 2 exit 10 diff --git a/usr/src/pkg/usrenv/prototype b/usr/src/pkg/usrenv/prototype index 12a79bd..8f7fccb 100644 --- a/usr/src/pkg/usrenv/prototype +++ b/usr/src/pkg/usrenv/prototype @@ -1,11 +1,10 @@ -#ident "@(#)pkg.usrenv:prototype 1.13" +#ident "@(#)pkg.usrenv:prototype 1.10" # source locations relative to the prototype file # packaging files i pkginfo i compver i depend -i preremove i postinstall # directories (When the directory file type works take off the '#'s) @@ -22,13 +21,13 @@ d none /usr/lib ? ? ? f none /usr/bin/env f none /usr/bin/nice f none /usr/bin/nohup -f none /usr/sbin/lnsxts 0744 root root +f none /usr/sbin/lnsxts 744 bin bin f none /usr/bin/tty f none /boot/SXT=/usr/src/uts/3b2/io/SXT f none /etc/master.d/sxt=/usr/src/uts/3b2/master.d/sxt 444 bin bin -f none /usr/bin/at 4555 root bin -f none /usr/bin/atq 4555 root bin -f none /usr/bin/atrm 4555 root bin +f none /usr/bin/at 4555 root bin +f none /usr/bin/atq 4555 root bin +f none /usr/bin/atrm 4555 root bin f none /usr/bin/banner f none /usr/bin/batch f none /usr/bin/bc @@ -42,13 +41,13 @@ f none /usr/bin/finger f none /usr/bin/ksh f none /usr/bin/last f none /usr/bin/logname -f none /usr/bin/script 4555 root bin -f none /usr/bin/shl 4755 root bin +f none /usr/bin/script 4555 root bin +f none /usr/bin/shl 4755 root bin f none /usr/bin/tabs f none /usr/bin/units f none /usr/lib/calprog -f none /usr/lib/lib.b 444 bin bin -f none /usr/share/lib/unittab 444 bin bin +f none /usr/lib/lib.b 444 bin bin +f none /usr/lib/unittab 444 bin bin # linked files l none /usr/bin/u3b2=/usr/bin/true diff --git a/usr/src/pkg/windowing/pkginfo b/usr/src/pkg/windowing/pkginfo index 366e55d..2aa6d14 100644 --- a/usr/src/pkg/windowing/pkginfo +++ b/usr/src/pkg/windowing/pkginfo @@ -1,6 +1,6 @@ -#ident "@(#)pkg.windowing:pkginfo 1.4" +#ident "@(#)pkg.windowing:pkginfo 1.3" -ARCH="3B2" +ARCH="3b2" # BASEDIR="/" CATEGORY="system" CLASSES="none" diff --git a/usr/src/pkg/windowing/postinstall b/usr/src/pkg/windowing/postinstall index 16b64e1..3687305 100644 --- a/usr/src/pkg/windowing/postinstall +++ b/usr/src/pkg/windowing/postinstall @@ -1,4 +1,4 @@ -#ident "@(#)pkg.windowing:postinstall 1.7" +#ident "@(#)pkg.windowing:postinstall 1.5" # # postinstall script for windowing package # @@ -17,17 +17,7 @@ SYSTEM="$BASEDIR/etc/system" installf $PKGINST $BOOT/XT f || error installf $PKGINST $MASTER/xt f || error -# -# -# Change the number of devices in $MASTER/xt -# Note the string for #D must match. -# Substitute #D (value 2) with no. of windowing terminals $WTNUM. -# -sed -e "s/xt - 2/xt - $WTNUM/" <$MASTER/xt >/tmp/xt.$$ -cp /tmp/xt.$$ $MASTER/xt -rm -rf /tmp/xt.$$ - -MAJOR=`/etc/drvinstall -m $MASTER/xt -s $SYSTEM -o $BOOT -v 1.0` || error +MAJOR=`/etc/drvinstall -m $MASTER/xt -s $SYSTEM -o $BOOT -c $WTNUM -v 1.0` || error # # configure windowing terminal devices # diff --git a/usr/src/pkg/windowing/prototype b/usr/src/pkg/windowing/prototype index 94ca7df..5843e25 100644 --- a/usr/src/pkg/windowing/prototype +++ b/usr/src/pkg/windowing/prototype @@ -1,4 +1,4 @@ -#ident "@(#)pkg.windowing:prototype 1.8" +#ident "@(#)pkg.windowing:prototype 1.6" # # All files/directories are defined a relocatable. Although # BASENAME is explicitly set to / (root) in pkginfo, @@ -45,9 +45,9 @@ f none /usr/bin/jterm f none /usr/bin/jwin f none /usr/bin/xts f none /usr/bin/xtt -f none /usr/sbin/lnxts 0744 root root +f none /usr/sbin/lnxts 744 bin bin # setuid-root program -f none /usr/bin/layers 4755 root sys +f none /usr/bin/layers 4111 root sys # # header files: default owner=bin group=bin mode=0444 # diff --git a/usr/src/pkg/windowing/request b/usr/src/pkg/windowing/request index 9a0ad0f..e427b02 100644 --- a/usr/src/pkg/windowing/request +++ b/usr/src/pkg/windowing/request @@ -1,4 +1,4 @@ -#ident "@(#)pkg.windowing:request 1.3" +#ident "@(#)pkg.windowing:request 1.2" # # request script for windowing package installation # @@ -9,6 +9,6 @@ HELPMSG="NOTE: since each Windowing Terminal configured allocates memory, choose only the number of terminals you expect to be doing windowing simultaneously." -WTNUM=`ckrange -l 1 -u 100 -p "$PROMPT" -h "$HELPMSG"` || exit $? +WTNUM=`ckrange -l 1 -u 32 -p "$PROMPT" -h "$HELPMSG"` || exit $? echo "WTNUM=$WTNUM" >$1 exit $? diff --git a/usr/src/protocols/npack/cmd/npackinit b/usr/src/protocols/npack/cmd/npackinit new file mode 100644 index 0000000..8407938 --- /dev/null +++ b/usr/src/protocols/npack/cmd/npackinit @@ -0,0 +1,42 @@ +#ident "@(#)npack:cmd/npackinit 1.2" + +# npack setup +EMDDEV=`getmajor EMD` +if [ $? -ne 0 ] +then + exit 1 # network not configured +fi +case $1 in +'start') + set `who -r` + if [ $9 = "S" -o $9 = "1" ] + then + ps -e | grep pckd >/dev/null 2>&1 + if [ $? -ne 0 ] + then + if [ ! -x /usr/bin/pckd ] + then + exit 1 + fi + /usr/bin/pckd /dev/emd$EMDDEV + if [ $? -ne 0 ] + then + echo /etc/init.d/npackinit: /usr/bin/pckd failed + exit 1 + fi + fi + #listener will be started by the SAC + fi + ;; + +'stop') + nlsadmin -k npack + pid=`ps -e | grep pckd | sed -e 's/^ *//' -e 's/ .*//'` + if [ "${pid}" != "" ] + then + kill ${pid} + fi + ;; +*) + exit 1 +esac diff --git a/usr/src/protocols/npack/cmd/pckd.c b/usr/src/protocols/npack/cmd/pckd.c new file mode 100644 index 0000000..a069ee0 --- /dev/null +++ b/usr/src/protocols/npack/cmd/pckd.c @@ -0,0 +1,49 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)npack:cmd/pckd.c 1.2" +#include "sys/stropts.h" +#include "stdio.h" +#include "fcntl.h" + +main(argc, argv) +int argc; +char *argv[]; +{ + int muxfd1, muxfd2; + + if (argc != 2) { + fprintf(stderr, "pckd: USAGE: pckd emd_device\n"); + exit(1); + } + if ((muxfd1 = open(argv[1], O_RDWR)) == -1) { + perror("pckd: open emd failed"); + exit(2); + } + if ((muxfd2 = open("/dev/npack", O_RDWR)) == -1) { + perror("pckd: open npack failed"); + exit(2); + } + if (ioctl(muxfd2, I_LINK, muxfd1) == -1) { + perror("pckd: I_LINK ioctl failed"); + exit(2); + } + switch (fork()) { + case 0: + break; + case -1: + perror("pckd: fork"); + exit(2); + default: + exit(0); + } + setpgrp(); + fclose(stdin); + fclose(stderr); + fclose(stdout); + pause(); +} diff --git a/usr/src/protocols/npack/cmd/pckd.mk b/usr/src/protocols/npack/cmd/pckd.mk new file mode 100644 index 0000000..95020f5 --- /dev/null +++ b/usr/src/protocols/npack/cmd/pckd.mk @@ -0,0 +1,35 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)npack:cmd/pckd.mk 1.4" +ROOT = +TESTDIR = . +INSDIR = $(ROOT)/usr/bin +INC = $(ROOT)/usr/include +INS = : +CFLAGS = -O -s +FRC = + +all: pckd + +pckd: pckd.c\ + $(INC)/sys/stropts.h + $(CC) -I$(INC) $(CFLAGS) -o $(TESTDIR)/pckd pckd.c + +install: all + install -n $(INSDIR) $(TESTDIR)/pckd + cp ./npack $(ROOT)/etc/init.d/npack + $(CH)chmod 744 $(ROOT)/etc/init.d/npack + $(CH)chown adm $(ROOT)/etc/init.d/npack + $(CH)chgrp sys $(ROOT)/etc/init.d/npack + +clean: + rm -f pckd.o + +clobber: clean + rm -f $(TESTDIR)/pckd +FRC: diff --git a/usr/src/protocols/npack/io/npack.c b/usr/src/protocols/npack/io/npack.c new file mode 100644 index 0000000..0bbbfd9 --- /dev/null +++ b/usr/src/protocols/npack/io/npack.c @@ -0,0 +1,3197 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)npack:io/npack.c 1.7.1.7" + +/* + * PACK - Positive ACKnowledgement protocol + * + * Supports TLI Interface for Connection Oriented Transport Service + */ +#include "sys/types.h" +#include "sys/sysmacros.h" +#ifdef uts +#include "sys/mplock.h" +#endif +#ifndef u3b2 +#include "sys/dir.h" +#endif +#include "sys/param.h" +#include "sys/stream.h" +#include "sys/stropts.h" +#include "sys/strlog.h" +#include "sys/log.h" +#include "sys/tihdr.h" +#include "sys/tiuser.h" +#include "sys/debug.h" +#include "sys/signal.h" +#include "sys/psw.h" +#ifdef u3b2 +#include "sys/sbd.h" +#include "sys/pcb.h" +#include "sys/cmn_err.h" +#endif +#include "sys/user.h" +#ifdef uts +#include "sys/k200user.h" +#endif +#include "sys/npack.h" +#include "sys/errno.h" +#include "sys/dlpi.h" +#include "sys/rf_debug.h" + +#ifdef uts +/* Get rid of spl's for uts only */ +#define splstr() 1 +#define splx(s) +#endif + +/* + * These are defined in master file + */ +extern int PKTIME; +extern int NRETRNS; +extern int ACKTIME; +extern int CREDIT; +extern int MONITORTIME; +extern int nvc; +extern struct pck_vc pck_vc[]; +extern long pckminor[]; + +/* + * stream data structure definitions + */ +STATIC int pckopen(), pckclose(), pckuwput(), pckuwsrv(); +STATIC int pcklwsrv(), pcklrput(), pckursrv(); + +#define TEMPSIZE 1024 /* gets updated during dl_bind */ + +STATIC struct module_info pck_uinfo = { + PACK_ID, "pack", 0, TEMPSIZE, TEMPSIZE, TEMPSIZE/2 +}; +STATIC struct module_info pck_linfo = { + PACK_ID, "pack", 0, TEMPSIZE, TEMPSIZE*3, TEMPSIZE +}; +STATIC struct qinit pckurinit = { + NULL, pckursrv, pckopen, pckclose, NULL, &pck_uinfo, NULL +}; +STATIC struct qinit pckuwinit = { + pckuwput, pckuwsrv, NULL, NULL, NULL, &pck_uinfo, NULL +}; +STATIC struct qinit pcklrinit = { + pcklrput, NULL, NULL, NULL, NULL, &pck_linfo, NULL +}; +STATIC struct qinit pcklwinit = { + NULL, pcklwsrv, NULL, NULL, NULL, &pck_linfo, NULL +}; +struct streamtab pckinfo = { + &pckurinit, &pckuwinit, &pcklrinit, &pcklwinit +}; + +STATIC ushort pck_prottype = 0x8010; /* pack protocol type */ +STATIC mblk_t *iocmp; /* msg blk for M_IOCACK */ +STATIC struct pckdev pckdev; +STATIC ushort seq_counter; + +/* + * TLI state transition table + */ +extern char ti_statetbl[TE_NOEVENTS][TS_NOSTATES]; +#define NEXTSTATE(X, Y) ti_statetbl[X][Y] +#define BADSTATE 127 /* unreachable state */ + +/* + * Functions that syntax check the TLI request primitives + * and completely execute any local mgmt primitives + */ +STATIC void pck_chk_creq(), pck_chk_cres(), pck_chk_discon(), pck_chk_data(), + pck_chk_info(), pck_chk_bind(), pck_chk_unbind(), pck_chk_optmgmt(); + +STATIC void (*chk_request[])() = { + pck_chk_creq, /* 0 - T_CONN_REQ */ + pck_chk_cres, /* 1 - T_CONN_RES */ + pck_chk_discon, /* 2 - T_DISCON_REQ */ + pck_chk_data, /* 3 - T_DATA_REQ */ + pck_chk_data, /* 4 - T_EXDATA_REQ */ + pck_chk_info, /* 5 - T_INFO_REQ */ + pck_chk_bind, /* 6 - T_BIND_REQ */ + pck_chk_unbind, /* 7 - T_UNBIND_REQ */ + NULL, /* 8 - T_UNITDATA_REQ: not supported */ + pck_chk_optmgmt, /* 9 - T_OPTMGMT_REQ */ +}; + +/* + * Functions that send the TLI request primitives + * to a remote user. + */ +STATIC int pck_snd_creq(), pck_snd_cres(), pck_snd_discon(), pck_snd_data(); + +STATIC int (*snd_request[])() = { + pck_snd_creq, /* 0 - T_CONN_REQ */ + pck_snd_cres, /* 1 - T_CONN_RES */ + pck_snd_discon, /* 2 - T_DISCON_REQ */ + pck_snd_data, /* 3 - T_DATA_REQ */ + pck_snd_data, /* 4 - T_EXDATA_REQ */ +}; + +/* + * Functions that process incoming PACK Control Packets + */ +STATIC int pck_rcv_connect(), pck_rcv_accept(), pck_rcv_discon(); + +STATIC int (*rcv_ctrl[])() = { + pck_rcv_connect, /* 0 - PM_CONNECT */ + pck_rcv_accept, /* 1 - PM_ACCEPT */ + pck_rcv_discon, /* 2 - PM_DISCONNECT */ +}; +#define NCTRL PM_DISCONNECT+1 + +/* + * Other functions + */ +STATIC long pck_findlink(); +STATIC void pck_recvpkt(); +STATIC void pck_term(); +STATIC int pck_addrcmp(); +STATIC void pck_updisconn(); +STATIC int pck_send_flush(); +STATIC void pck_send_ok_ack(); +STATIC void pck_send_error_ack(); +STATIC void pck_send_fatal(); +STATIC void pck_putwq_inorder(); +STATIC void pck_finished(); +STATIC int pck_adjctrl(); +STATIC int pck_ctrlpkt(); +STATIC void pck_senddisconn(); +STATIC void pck_sendconnect(); +STATIC void pck_retrns(); +STATIC void pck_sendout(); +STATIC void pck_sendack(); +STATIC int pck_sendpkt(); +STATIC void packmonitor(); + +#ifdef uts +mblk_t *pck_recvack(); +void pck_acktimeout(); +mblk_t *pck_deque(); +void pck_lnktimeout(); +void pck_enque(); +#else +STATIC mblk_t *pck_recvack(); +STATIC void pck_acktimeout(); +STATIC mblk_t *pck_deque(); +STATIC void pck_lnktimeout(); +STATIC void pck_enque(); +#endif + +/* + * Mapping of TLI T_primitive types to state machine events + * + * T_INFO_REQ is removed since it doesn't affect state, and + * T_UNITDATA_REQ and T_ORDREL_REQ are not supported. + */ +#define NPRIM T_ORDREL_REQ+1 +#define BADEVENT TE_NOEVENTS +#define NONEVENT 0 + +STATIC int prim_to_event[NPRIM] = { + TE_CONN_REQ, /* 0 - T_CONN_REQ */ + TE_CONN_RES, /* 1 - T_CONN_RES */ + TE_DISCON_REQ, /* 2 - T_DISCON_REQ */ + TE_DATA_REQ, /* 3 - T_DATA_REQ */ + TE_EXDATA_REQ, /* 4 - T_EXDATA_REQ */ + NONEVENT, /* 5 - T_INFO_REQ */ + TE_BIND_REQ, /* 6 - T_BIND_REQ */ + TE_UNBIND_REQ, /* 7 - T_UNBIND_REQ */ + BADEVENT, /* 8 - T_UNITDATA_REQ */ + TE_OPTMGMT_REQ, /* 9 - T_OPTMGMT_REQ */ + BADEVENT, /* 10 - T_ORDREL_REQ */ +}; + +#ifdef DEBUG +int pcklog = 0; +#endif + +int +pckinit() +{ + int i; + + pckdev.qbot = NULL; + pckdev.linkstate = UNLINKED; + for (i = 0; i < nvc; i++) + pckminor[i] = -1; + iocmp = NULL; + return(0); +} + +STATIC int +pckopen(q, dev, flag, sflag) +register queue_t *q; +{ + register struct pck_vc *vcp; + register struct pckseq *seq; + register struct stroptions *sop; + register mblk_t *mp; + + PCKLOG(PACK_ID, VC_NUM(q->q_ptr), 0, SL_TRACE, + "pckopen: called with dev %d\n", dev, 0, 0); + + /* is it already opened */ + if (q->q_ptr) { + PCKLOG(PACK_ID, VC_NUM(q->q_ptr), 0, SL_TRACE, + "pckopen: opened already, open succeeded\n", 0, 0, 0); + return(VC_NUM(q->q_ptr)); + } + + if (sflag == CLONEOPEN) { + for (vcp = pck_vc; vcp < &pck_vc[nvc]; vcp++) + if (vcp->vc_rdq == NULL) + break; + if (vcp >= &pck_vc[nvc]) { + PCKLOG(PACK_ID, -1, 0, SL_TRACE|SL_ERROR, + "pckopen: opened failed: couldn't allocate pck_vc data structure for q = %x\n", q, 0, 0); + u.u_error = ENXIO; + return(OPENFAIL); + } + } else { + dev = minor(dev); + if (dev >= nvc) { + PCKLOG(PACK_ID, -1, 0, SL_TRACE|SL_ERROR, + "pckopen: opened failed: bad dev = %d\n", dev, 0, 0); + u.u_error = ENXIO; + return(OPENFAIL); + } + vcp = &pck_vc[dev]; + } + + /* initialize data structure */ + vcp->vc_state = TS_UNBND; + vcp->vc_flags = 0; + vcp->vc_rdq = q; + vcp->vc_qlen = 0; + for (seq = vcp->vc_seq; seq < &vcp->vc_seq[MAX_CONN_IND]; seq++) + seq->srclink = -1; /* mark unused */ + vcp->vc_seqcnt = 0; + vcp->vc_retrnsq.rq_head = NULL; + vcp->vc_qcnt = 0; + vcp->vc_cpsn = 0; + vcp->vc_epsn = 0; + vcp->vc_rackno = 0; + vcp->vc_sackno = 0; + vcp->vc_lnktimer = -1; + vcp->vc_acktimer = -1; + vcp->vc_dstlink = -1; + vcp->vc_creqmp = NULL; + vcp->vc_reason = 0; + q->q_ptr = (caddr_t)vcp; + WR(q)->q_ptr = (caddr_t)vcp; + /* pckursrv should only be run by being back enabled - i.e. getq */ + noenable(q); + + /* + * Allocate buffer for DL_UNITDATA_REQ messages. + */ + if ((mp = allocb(DATREQSIZE, BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckopen: can't allocb dl_unitdata_req msg\n", 0, 0, 0); + q->q_ptr = NULL; + WR(q)->q_ptr = NULL; + vcp->vc_rdq = NULL; + u.u_error = EAGAIN; + return(OPENFAIL); + } + vcp->vc_datreq = mp; + + /* + * Set up hi-lo water marks and min-max pkt size + * at stream head to correspond to pack values + */ + if ((mp = allocb(sizeof(struct stroptions), BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckopen: can't allocb stroptions msg\n", 0, 0, 0); + q->q_ptr = NULL; + WR(q)->q_ptr = NULL; + vcp->vc_rdq = NULL; + u.u_error = EAGAIN; + return(OPENFAIL); + } + mp->b_datap->db_type = M_SETOPTS; + mp->b_wptr += sizeof(struct stroptions); + sop = (struct stroptions *)mp->b_rptr; + sop->so_flags = SO_MINPSZ | SO_MAXPSZ | SO_HIWAT | SO_LOWAT; + sop->so_minpsz = q->q_minpsz; + sop->so_maxpsz = q->q_maxpsz; + sop->so_lowat = q->q_lowat; + sop->so_hiwat = q->q_hiwat; + putnext(q, mp); + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckopen: open succeeded\n", 0, 0, 0); + return(VC_NUM(vcp)); +} + +STATIC int +pckclose(q) +register queue_t *q; +{ + register struct pck_vc *vcp = (struct pck_vc *)q->q_ptr; + register i; + mblk_t *mp; + + ASSERT(vcp != NULL); + + pck_finished(q, VC_CLOSE); + + for (i = 0; i < nvc; i++) + if (pckminor[i] == VC_NUM(vcp)) { + pckminor[i] = -1; + break; + } + vcp->vc_flags = 0; + vcp->vc_rdq = NULL; + + while (mp = (mblk_t *) pck_deque(&vcp->vc_retrnsq)) + freemsg(mp); + vcp->vc_qcnt = 0; + if ((pckdev.respq == q) && (pckdev.linkstate == WAITLINK)) { + pckdev.respq = NULL; + pckdev.qbot = NULL; + pckdev.linkstate = UNLINKED; + } + freemsg(vcp->vc_datreq); + vcp->vc_datreq = NULL; + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckclose: close succeeded\n", 0, 0, 0); + return(0); +} + +/* + * pckuwput - Upper side write queue put procedure. + * + * Performs syntax checking and processes local + * management primitves. Anything going to remote + * user is queued for processing by svc procedure. + */ +STATIC int +pckuwput(q, mp) +register queue_t *q; +register mblk_t *mp; +{ + register struct pck_vc *vcp; + register union T_primitives *prim; + struct iocblk *iocp; + register mblk_t *amp; + + vcp = (struct pck_vc *)q->q_ptr; + ASSERT(vcp != NULL); + + switch(mp->b_datap->db_type) { + + case M_DATA: + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: M_DATA type received mp = %x\n", mp, 0, 0); + if (pckdev.linkstate != LINKED) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: mux not linked\n", 0, 0, 0); + pck_send_fatal(q, mp); + return(0); + } + putq(q, mp); + return(0); + + case M_PROTO: + case M_PCPROTO: + if (pckdev.linkstate != LINKED) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: mux not linked\n", 0, 0, 0); + pck_send_fatal(q, mp); + return(0); + } + + /* + * Perform syntax checks on all requests, and fully + * process any local mgmt requests. + */ + ASSERT((mp->b_wptr - mp->b_rptr) >= sizeof(long)); + prim = (union T_primitives *)mp->b_rptr; + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: TImsg type = %d received\n", prim->type, 0, 0); + + if (prim->type >= NPRIM) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: bad primitive type %d\n", prim->type, 0, 0); + pck_send_fatal(q, mp); + return(0); + } + if (prim_to_event[prim->type] == BADEVENT) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: unsupported primitive type %d\n", + prim->type, 0, 0); + pck_send_error_ack(q, mp, TNOTSUPPORT, 0); + return(0); + } + + (*chk_request[prim->type])(q, mp); + return(0); + + case M_IOCTL: + ASSERT((mp->b_wptr - mp->b_rptr) == sizeof(struct iocblk)); + iocp = (struct iocblk *)mp->b_rptr; + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: M_IOCTL cmd %o recieved mp = %x\n", + iocp->ioc_cmd, mp, 0); + switch (iocp->ioc_cmd) { + + case I_LINK: + ASSERT((mp->b_cont->b_wptr - mp->b_cont->b_rptr) + == sizeof(struct linkblk)); + if (pckdev.linkstate != UNLINKED) { + iocp->ioc_error = EINVAL; + mp->b_datap->db_type = M_IOCNAK; + } else { + register struct linkblk *lp; + dl_info_req_t *reqp; + + lp = (struct linkblk *)mp->b_cont->b_rptr; + if (!canput(lp->l_qbot)) { + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pckuwput: lower queue full\n", 0, 0, 0); + iocp->ioc_error = EAGAIN; + mp->b_datap->db_type = M_IOCNAK; + break; + } + + /* + * We know sizeof(struct linkblk) is greater + * than sizeof(dl_info_req_t). + */ + pckdev.qbot = lp->l_qbot; + pckdev.linkstate = WAITLINK; + pckdev.respq = RD(q); + iocp->ioc_count = 0; + amp = mp->b_cont; + mp->b_cont = NULL; + iocmp = mp; + amp->b_datap->db_type = M_PROTO; + amp->b_rptr = amp->b_datap->db_base; + amp->b_wptr = amp->b_rptr + DL_INFO_REQ_SIZE; + reqp = (dl_info_req_t *)amp->b_rptr; + reqp->dl_primitive = DL_INFO_REQ; + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pckuwput: sending DL_INFO_REQ to driver\n", + 0, 0, 0); + putnext(pckdev.qbot, amp); + return(0); + } + iocp->ioc_count = 0; + freemsg(unlinkb(mp)); + break; + + case I_UNLINK: + if (pckdev.linkstate != LINKED) { + iocp->ioc_error = EINVAL; + mp->b_datap->db_type = M_IOCNAK; + } else { + mp->b_datap->db_type = M_IOCACK; + pck_term(q, pckdev.qbot); + pckdev.qbot = NULL; + pckdev.linkstate = UNLINKED; + } + iocp->ioc_count = 0; + freemsg(unlinkb(mp)); + break; + + default: + mp->b_datap->db_type = M_IOCNAK; + break; + } + qreply(q, mp); + return(0); + + case M_FLUSH: + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: M_FLUSH type recieved mp = %x\n", mp, 0, 0); + /* + * Flush both queues as appropriate and turn + * back upstream (not sending on to driver) + */ + if (*mp->b_rptr & FLUSHW) { + flushq(q, FLUSHALL); + *mp->b_rptr &= ~FLUSHW; + } + if (*mp->b_rptr & FLUSHR) { + flushq(RD(q), FLUSHALL); + qreply(q, mp); + vcp->vc_flags &= ~(VC_LOCALFC|VC_SENDSTOP); + vcp->vc_flags |= VC_SENDACK; + /* + * send back ack immediately + */ + if (pckdev.linkstate == LINKED) + pck_sendack(vcp, 0); + } else + freemsg(mp); + return(0); + + default: + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwput: unknown STR msg type %o received mp = %x\n", + mp->b_datap->db_type, mp, 0); + freemsg(mp); + return(0); + } +} + +/* + * The receiver has drained the upper queues. Push as many messages + * as possible upstream. The first data message will force an ACKP + * packet back to the transmitter. + */ +STATIC int +pckursrv(q) +register queue_t *q; +{ + register mblk_t *mp; + register struct pck_vc *vcp; + + vcp = (struct pck_vc *)q->q_ptr; + + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckursrv: local receiver freed up\n", 0, 0, 0); + + vcp->vc_flags &= ~VC_LOCALFC; + vcp->vc_flags |= VC_URSRV; + + /* process data queued on vc_rdq */ + while (canput(q->q_next) && (mp = getq(q)) != NULL) + pck_recvpkt(mp); + + if (q->q_first) { + /* Could not push all local data upstream */ + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckursrv: could not send all data upstream\n", 0, 0, 0); + + /* Ack all currently received data */ + if ((vcp->vc_flags & VC_SENDACK) && (pckdev.linkstate == LINKED)) + pck_sendack(vcp, 0); + + vcp->vc_flags |= VC_LOCALFC; + } + vcp->vc_flags &= ~VC_URSRV; +} + +/* + * pckuwsrv - pack upper service routine for write queue + * + * Process all outgoing messages (only M_DATA's or M_PROTO's) + */ +STATIC int +pckuwsrv(q) +register queue_t *q; +{ + register mblk_t *mp; + register struct pck_vc *vcp; + register s; + union T_primitives *prim; + + vcp = (struct pck_vc *)q->q_ptr; + if (pckdev.linkstate != LINKED) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwsrv: mux not linked\n", 0, 0, 0); + flushq(q, FLUSHALL); + return(0); + } + + if (vcp->vc_flags & VC_LNKTOUT) { + vcp->vc_flags &= ~VC_LNKTOUT; + pck_retrns(vcp); + } + if (vcp->vc_flags & VC_ACKTOUT) { + vcp->vc_flags &= ~VC_ACKTOUT; + pck_sendack(vcp, 0); + } + if (vcp->vc_flags & VC_SANITY) { + if (!canput(pckdev.qbot->q_next)) + return(FLOWCNTL); + if ((mp = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + bufcall(MINBUFSZ, BPRI_MED, pckuwsrv, q); + return(0); + } + vcp->vc_flags &= ~VC_SANITY; + mp->b_wptr += MINPKSIZE; + if (pck_sendpkt(mp, vcp, SANITYP) != TRUE) + freemsg(mp); + } + if (vcp->vc_flags & VC_REMFC) + /* Remote receiver is flow controlled */ + return(0); + + while((mp = getq(q)) != NULL) { + if (!canput(pckdev.qbot->q_next)) { + putbq(q, mp); + return(FLOWCNTL); + } + + s = splstr(); + if (mp->b_datap->db_type == M_DATA) { + if ((vcp->vc_state == TS_IDLE) || (vcp->vc_flags & VC_FATAL)) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwsrv: data IDLE or FATAL - free msg\n", 0, 0, 0); + freemsg(mp); + splx(s); + continue; + } + if (NEXTSTATE(TE_DATA_REQ, vcp->vc_state) == BADSTATE) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwsrv: data message out of state\n", 0, 0, 0); + pck_send_fatal(q, mp); + splx(s); + continue; + } + if (pck_snd_data(q, mp) == FALSE) { + putbq(q, mp); + splx(s); + return(0); + } + } else { + prim = (union T_primitives *)mp->b_rptr; + if ((prim->type == T_DATA_REQ) || (prim->type == T_EXDATA_REQ)) { + if ((vcp->vc_state == TS_IDLE) || (vcp->vc_flags & VC_FATAL)) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwsrv: data IDLE or FATAL - free msg\n", 0, 0, 0); + freemsg(mp); + splx(s); + continue; + } + if (NEXTSTATE(TE_DATA_REQ, vcp->vc_state) == BADSTATE) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pckuwsrv: data message out of state\n", 0, 0, 0); + pck_send_fatal(q, mp); + splx(s); + continue; + } + } else { + if (NEXTSTATE(prim_to_event[prim->type], vcp->vc_state) == BADSTATE) { + pck_send_error_ack(q, mp, TOUTSTATE, 0); + splx(s); + continue; + } + } + if ((*snd_request[prim->type])(q, mp) == FALSE) { + putbq(q, mp); + splx(s); + return(0); + } + } + splx(s); + } + return(0); +} + +/* + * pcklwsrv - pack lower write service procedure. + * + * No messages are ever placed on this queue. + * This will get scheduled when the downstream device queue + * reaches its low water mark, and it will back-enable + * all virtual circuits linked through the device. + * + * Virtual circuits are scheduled in a round-robin fashion. + */ +STATIC int +pcklwsrv(q) +register queue_t *q; +{ + register i; + + PCKLOG(PACK_ID, -1, 0, SL_TRACE, "pcklwsrv: q %x\n", q, 0, 0); + for (i = pckdev.lastrun + 1; i < nvc; i++) { + if (pck_vc[i].vc_rdq) + if (pckuwsrv(WR(pck_vc[i].vc_rdq)) == FLOWCNTL) { + pckdev.lastrun = i - 1; + return(0); + } + } + for (i = 0; i <= pckdev.lastrun; i++) { + if (pck_vc[i].vc_rdq) + if (pckuwsrv(WR(pck_vc[i].vc_rdq)) == FLOWCNTL) + break; + } + pckdev.lastrun = i - 1; + return(0); +} + +/* + * pcklrput - pack lower read put procedure. + * + * Process incoming M_PROTO's and place M_DATA msgs + * in stream head read queue of appropriate VC. + */ +STATIC int +pcklrput(q, mp) +register struct queue *q; +register mblk_t *mp; +{ + register struct pck_vc *vcp; + register PACKHDR *pktp; + union DL_primitives *p; + mblk_t *amp; + int l; + mblk_t *tmp; + struct iocblk *iocp; + + PCKLOG(PACK_ID, -1, 0, SL_TRACE, "pcklrput: q %x mp %x type %o\n", + q, mp, mp->b_datap->db_type); + + switch (mp->b_datap->db_type) { + case M_PCPROTO: + case M_PROTO: + p = (union DL_primitives *)mp->b_rptr; + switch (p->dl_primitive) { + case DL_UNITDATA_IND: + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: got DL_UNITDATA_IND", 0, 0, 0); + tmp = mp->b_cont; + mp->b_cont = NULL; + freeb(mp); + mp = tmp; + mp->b_rptr += HDROFFSET; + if (pullupmsg(mp, -1) == 0) { + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: can't pullup incoming pkt\n", 0, 0, 0); + freemsg(mp); + break; + } + pktp = (PACKHDR *)mp->b_rptr; + if ((int)pktp->pk_dstlink >= nvc + || (pckminor[pktp->pk_dstlink] == -1)) { + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: invalid dst link %x\n", + pktp->pk_dstlink, 0, 0); + freemsg(mp); + break; + } + vcp = &pck_vc[pckminor[pktp->pk_dstlink]]; + if (vcp->vc_rdq == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pcklrput: msg for closed link\n", 0, 0, 0); + freemsg(mp); + break; + } + + /* Process non-DATA portions of message mp */ + if (pck_recvack(mp) == NULL) + break; + + if (!canput(vcp->vc_rdq->q_next)) { + + /* Ack all currently received data */ + if ((vcp->vc_flags & VC_SENDACK) && + (pckdev.linkstate == LINKED)) + pck_sendack(vcp, 0); + + /* flow control transmitter */ + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pcklrput: send stop to remote transmitter\n", 0, 0, 0); + vcp->vc_flags |= (VC_SENDSTOP + VC_LOCALFC); + if (pckdev.linkstate == LINKED) + pck_sendack(vcp, 0); + + /* + * The first message queued locally is marked + * SNDACK to force an ACKP back to the transmitter + * after the upper queues have freed up. + */ + if ((l = qsize(vcp->vc_rdq)) == 0) + pktp->pk_type |= SNDACK; + + /* Queue one transmit window locally */ + if (l >= CREDIT) { + /* + * This is a backward compatability hook + * and allows us to talk to NPACK + * providers that don't recognize the + * STOPP message. + */ + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pcklrput: msg discarded, queue full\n", 0, 0, 0); + freemsg(mp); + break; + } + putq(vcp->vc_rdq, mp); + break; + } + if (vcp->vc_rdq->q_first || (vcp->vc_flags&VC_URSRV)) { + /* + * There is still data on read queue! + * Queue the data locally and make sure service + * procedure is scheduled to run. + */ + l = qsize(vcp->vc_rdq); + + /* Queue one transmit window locally */ + if (l >= CREDIT) { + /* + * This is a backward compatability hook + * and allows us to talk to NPACK + * providers that don't recognize the + * STOPP message. + */ + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pcklrput: msg discarded, queue full\n", 0, 0, 0); + freemsg(mp); + break; + } + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pcklrput: vc_rdq not empty or ursrv active: q locally\n", 0, 0, 0); + putq(vcp->vc_rdq, mp); + qenable(vcp->vc_rdq); + break; + } + pck_recvpkt(mp); + break; + + case DL_INFO_ACK: + { + dl_info_ack_t *ackp; + dl_bind_req_t *reqp; + + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: got DL_INFO_ACK\n", 0, 0, 0); + if (pckdev.linkstate == WAITLINK) { + ackp = (dl_info_ack_t *)mp->b_rptr; + if ((ackp->dl_service_mode != DL_CLDLS) || + (ackp->dl_provider_style != DL_STYLE1)) { + iocmp->b_datap->db_type = M_IOCNAK; + putnext(pckdev.respq, iocmp); + iocmp = NULL; + pckdev.linkstate = UNLINKED; + pckdev.respq = NULL; + pckdev.qbot = NULL; + return; + } + + /* + * Adjust interface parameters based on + * the data link provider. + */ + pck_uinfo.mi_maxpsz = ackp->dl_max_sdu - PCKHDRSZ - HDROFFSET; + pck_uinfo.mi_hiwat = pck_uinfo.mi_maxpsz * CREDIT; + pck_uinfo.mi_lowat = pck_uinfo.mi_maxpsz; + pck_linfo.mi_maxpsz = ackp->dl_max_sdu; + pck_linfo.mi_hiwat = ackp->dl_max_sdu * CREDIT; + pck_linfo.mi_lowat = ackp->dl_max_sdu; + + /* + * Adjust parameters of active queues. + */ + for (vcp = pck_vc; vcp < &pck_vc[nvc]; vcp++) { + if (vcp->vc_rdq) { + register queue_t *vq; + + vq = vcp->vc_rdq; + vq->q_hiwat = pck_uinfo.mi_hiwat; + vq->q_lowat = pck_uinfo.mi_lowat; + vq->q_maxpsz = pck_uinfo.mi_maxpsz; + vq = WR(vq); + vq->q_hiwat = pck_uinfo.mi_hiwat; + vq->q_lowat = pck_uinfo.mi_lowat; + vq->q_maxpsz = pck_uinfo.mi_maxpsz; + } + } + q->q_hiwat = pck_linfo.mi_hiwat; + q->q_lowat = pck_linfo.mi_lowat; + q->q_maxpsz = pck_linfo.mi_maxpsz; + WR(q)->q_hiwat = pck_linfo.mi_hiwat; + WR(q)->q_lowat = pck_linfo.mi_lowat; + WR(q)->q_maxpsz = pck_linfo.mi_maxpsz; + + /* + * Generate a DL_BIND_REQ to bind to a DLSAP. + * We know sizeof(dl_info_ack_t) is greater + * than sizeof(dl_bind_req_t). + */ + mp->b_datap->db_type = M_PROTO; + mp->b_rptr = mp->b_datap->db_base; + mp->b_wptr = mp->b_rptr + sizeof(dl_bind_req_t); + reqp = (dl_bind_req_t *)mp->b_rptr; + reqp->dl_primitive = DL_BIND_REQ; + reqp->dl_sap = (ulong)pck_prottype; + reqp->dl_max_conind = 0; + reqp->dl_service_mode = DL_CLDLS; + reqp->dl_conn_mgmt = 0; + qreply(q, mp); + } else { + freemsg(mp); + } + break; + } + + case DL_BIND_ACK: + { + dl_bind_ack_t *ackp; + unchar *cp; + + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: got DL_BIND_ACK\n", 0, 0, 0); + if (pckdev.linkstate == WAITLINK) { + ackp = (dl_bind_ack_t *)mp->b_rptr; + if ((ackp->dl_sap != (long)pck_prottype) || + (ackp->dl_addr_length != NETADDRLEN)) { + iocmp->b_datap->db_type = M_IOCNAK; + putnext(pckdev.respq, iocmp); + iocmp = NULL; + pckdev.linkstate = UNLINKED; + pckdev.respq = NULL; + pckdev.qbot = NULL; + freemsg(mp); + break; + } + + /* + * Finally ack the I_LINK ioctl. + */ + iocmp->b_datap->db_type = M_IOCACK; + putnext(pckdev.respq, iocmp); + iocmp = NULL; + pckdev.linkstate = LINKED; + pckdev.respq = NULL; + + /* + * save the physical network address + */ + cp = mp->b_rptr + ackp->dl_addr_offset; + bcopy(cp, pckdev.phy_naddr, NETADDRLEN); + freemsg(mp); + + /* + * start monitor program + */ + packmonitor(); + } else { + freemsg(mp); + } + break; + } + + case DL_ERROR_ACK: + { + dl_error_ack_t *ackp; + struct iocblk *iocp; + + ackp = (dl_error_ack_t *)mp->b_rptr; + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: got DL_ERROR_ACK, err %d, unix err %d\n", + ackp->dl_errno, ackp->dl_unix_errno, 0); + if (pckdev.linkstate == WAITLINK) { + iocmp->b_datap->db_type = M_IOCNAK; + iocp = (struct iocblk *)iocmp->b_rptr; + iocp->ioc_error = ackp->dl_unix_errno; + putnext(pckdev.respq, iocmp); + iocmp = NULL; + pckdev.linkstate = UNLINKED; + pckdev.respq = NULL; + pckdev.qbot = NULL; + } + freemsg(mp); + break; + } + + case DL_OK_ACK: + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: got DL_OK_ACK\n", 0, 0, 0); + freemsg(mp); + break; + + case DL_UDERROR_IND: + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: got DL_UDERROR_IND\n", 0, 0, 0); + freemsg(mp); + break; + + default: + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: got unknown DL primitive %d\n", + p->dl_primitive, 0, 0); + freemsg(mp); + break; + } + break; + + case M_FLUSH: + + /* + * Flush read queue free msg (can't route upstream) + */ + PCKLOG(PACK_ID, -1, 0, SL_TRACE, "pcklrput: got M_FLUSH\n", 0, 0, 0); + if (*mp->b_rptr & FLUSHR) + flushq(q, FLUSHALL); + if (*mp->b_rptr & FLUSHW) { + *mp->b_rptr &= ~FLUSHR; + flushq(WR(q), FLUSHALL); + qreply(q, mp); + } else + freemsg(mp); + break; + + default: + PCKLOG(PACK_ID, -1, 0, SL_TRACE, + "pcklrput: invalid msg type %o\n", + mp->b_datap->db_type, 0, 0); + freemsg(mp); + break; + } + return(0); +} + +STATIC void +pck_chk_data(q, mp) +register queue_t *q; +register mblk_t *mp; +{ + register struct pck_vc *vcp; + + vcp = (struct pck_vc *)q->q_ptr; + ASSERT(vcp != NULL); + ASSERT((mp->b_wptr - mp->b_rptr) == sizeof(struct T_data_req)); + pck_putwq_inorder(q, mp); +} + +STATIC void +pck_chk_info(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register struct T_info_ack *info_ack; + struct pck_vc *vcp; + mblk_t *ack; + + if ((ack = allocb(sizeof(struct T_info_ack), BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(q->q_ptr), 0, SL_TRACE, + "pck_chk_info: couldn't allocate buffer for info_ack\n", 0, 0, 0); + pck_send_error_ack(q, mp, TSYSERR, EAGAIN); + return; + } + vcp = (struct pck_vc *)q->q_ptr; + freemsg(mp); + ack->b_wptr = ack->b_rptr + sizeof(struct T_info_ack); + ack->b_datap->db_type = M_PCPROTO; + info_ack = (struct T_info_ack *)ack->b_rptr; + info_ack->PRIM_type = T_INFO_ACK; + info_ack->TSDU_size = pck_uinfo.mi_maxpsz; + info_ack->ETSDU_size = ETSDU_SIZE; + info_ack->CDATA_size = CDATA_SIZE; + info_ack->DDATA_size = DDATA_SIZE; + info_ack->ADDR_size = ADDR_SIZE; + info_ack->OPT_size = OPT_SIZE; + info_ack->TIDU_size = pck_uinfo.mi_maxpsz; + info_ack->SERV_type = T_COTS; + info_ack->CURRENT_state = vcp->vc_state; + qreply(q, ack); +} + +STATIC void +pck_chk_bind(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register union T_primitives *prim; + register struct pck_vc *vcp; + + prim = (union T_primitives *)mp->b_rptr; + vcp = (struct pck_vc *)q->q_ptr; + + ASSERT((mp->b_wptr - mp->b_rptr) >= sizeof(struct T_bind_req)); + ASSERT((mp->b_wptr - mp->b_rptr) >= (prim->bind_req.ADDR_offset + + prim->bind_req.ADDR_length)); + + if (NEXTSTATE(prim_to_event[prim->type], vcp->vc_state) == BADSTATE) { + pck_send_error_ack(q, mp, TOUTSTATE, 0); + return; + } + vcp->vc_state = NEXTSTATE(prim_to_event[prim->type], vcp->vc_state); + vcp->vc_qlen = min(prim->bind_req.CONIND_number, MAX_CONN_IND); + + if (prim->bind_req.ADDR_length == 0) { + register struct pckaddr *addrp; + register link; + mblk_t *new; + + if ((new = allocb(sizeof(struct T_bind_ack) + + sizeof(struct pckaddr), BPRI_HI)) == NULL) { + vcp->vc_qlen = 0; + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_chk_bind: couldn't alloc buffer for bind_ack\n", 0, 0, 0); + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TSYSERR, EAGAIN); + return; + } + freemsg(mp); + mp = new; + prim = (union T_primitives *)mp->b_rptr; + + /* + * Find free link number for this minor device. + * First try link that matches minor dev. If not + * free, scan table for free entry. + */ + if (pckminor[VC_NUM(vcp)] == -1) + link = VC_NUM(vcp); + else { + if ((link = pck_findlink()) < 0) { + vcp->vc_qlen = 0; + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TNOADDR, 0); + return; + } + } + pckminor[link] = VC_NUM(vcp); + vcp->vc_srclink = link; + prim->bind_ack.ADDR_offset = sizeof(struct T_bind_ack); + prim->bind_ack.ADDR_length = sizeof(struct pckaddr); + mp->b_wptr = mp->b_rptr + prim->bind_ack.ADDR_offset; + addrp = (struct pckaddr *)mp->b_wptr; + bcopy(pckdev.phy_naddr, addrp->phynaddr, NETADDRLEN); + addrp->link = link; + mp->b_wptr += sizeof(struct pckaddr); + } else { + struct pckaddr addr; + + if (prim->bind_req.ADDR_length != sizeof(struct pckaddr)) { + vcp->vc_qlen = 0; + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADADDR, 0); + return; + } + bcopy((char *)(mp->b_rptr + prim->bind_req.ADDR_offset), + (char *)&addr, sizeof(struct pckaddr)); + bcopy(pckdev.phy_naddr, addr.phynaddr, NETADDRLEN); + if ((addr.link >= nvc) || (addr.link < 0)) { + vcp->vc_qlen = 0; + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADADDR, 0); + return; + } +#if 0 + if (pckminor[addr.link] == -1) + pckminor[addr.link] = VC_NUM(vcp); + else { + if ((addr.link = pck_findlink()) < 0) { + vcp->vc_qlen = 0; + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TNOADDR, 0); + return; + } + } +#else + /* + * We need to set pckminor[addr.link] in all cases instead + * of as above. The above code was causing invalid dst lnk + * messages in pcklrput. + */ + if (pckminor[addr.link] != -1) { + if ((addr.link = pck_findlink()) < 0) { + vcp->vc_qlen = 0; + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TNOADDR, 0); + return; + } + } + pckminor[addr.link] = VC_NUM(vcp); +#endif + vcp->vc_srclink = addr.link; + bcopy((char *)&addr, (char *)(mp->b_rptr + prim->bind_req.ADDR_offset), + sizeof(struct pckaddr)); + } + prim->bind_ack.PRIM_type = T_BIND_ACK; + prim->bind_ack.CONIND_number = vcp->vc_qlen; + mp->b_datap->db_type = M_PCPROTO; + vcp->vc_state = NEXTSTATE(TE_BIND_ACK, vcp->vc_state); + qreply(q, mp); +} + +STATIC void +pck_chk_unbind(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register struct pck_vc *vcp; + register i; + union T_primitives *prim; + + + ASSERT((mp->b_wptr - mp->b_rptr) >= sizeof(struct T_unbind_req)); + prim = (union T_primitives *)mp->b_rptr; + vcp = (struct pck_vc *)q->q_ptr; + + if (NEXTSTATE(prim_to_event[prim->type], vcp->vc_state) == BADSTATE) { + pck_send_error_ack(q, mp, TOUTSTATE, 0); + return; + } + vcp->vc_state = NEXTSTATE(prim_to_event[prim->type], vcp->vc_state); + if (!pck_send_flush(RD(q))) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_chk_unbind: pck_send_flush failed\n", 0, 0, 0); + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TSYSERR, EPROTO); + return; + } + for (i = 0; i < nvc; i++) + if (pckminor[i] == VC_NUM(vcp)) { + pckminor[i] = -1; + break; + } + ASSERT(i < nvc); + vcp->vc_qlen = 0; + vcp->vc_state = NEXTSTATE(TE_OK_ACK1, vcp->vc_state); + pck_send_ok_ack(q, mp, T_UNBIND_REQ); +} + +STATIC void +pck_chk_optmgmt(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register union T_primitives *prim; + register struct pck_vc *vcp; + + prim = (union T_primitives *)mp->b_rptr; + vcp = (struct pck_vc *)q->q_ptr; + + ASSERT((mp->b_wptr - mp->b_rptr) >= sizeof(struct T_optmgmt_req)); + ASSERT((mp->b_wptr - mp->b_rptr) >= (prim->optmgmt_req.OPT_offset + + prim->optmgmt_req.OPT_length)); + + if (NEXTSTATE(prim_to_event[prim->type], vcp->vc_state) == BADSTATE) { + pck_send_error_ack(q, mp, TOUTSTATE, 0); + return; + } + vcp->vc_state = NEXTSTATE(prim_to_event[prim->type], vcp->vc_state); + + switch(prim->optmgmt_req.MGMT_flags) { + + case T_DEFAULT: { + register mblk_t *tmp; + struct pckopt *optp; + + if ((tmp = allocb(sizeof(struct T_optmgmt_ack)+sizeof(struct pckopt), + BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_chk_optmgmt: couldn't alloc buffer for optmgmt_ack\n", 0, 0, 0); + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TSYSERR, EAGAIN); + return; + } + freemsg(mp); + prim = (union T_primitives *)tmp->b_rptr; + tmp->b_datap->db_type = M_PCPROTO; + tmp->b_wptr = tmp->b_rptr + sizeof(struct T_optmgmt_ack) + + sizeof(struct pckopt); + prim->optmgmt_ack.MGMT_flags = T_DEFAULT; + prim->optmgmt_ack.PRIM_type = T_OPTMGMT_ACK; + prim->optmgmt_ack.OPT_length = sizeof(struct pckopt); + prim->optmgmt_ack.OPT_offset = sizeof(struct T_optmgmt_ack); + optp = (struct pckopt *)(tmp->b_rptr + sizeof(struct T_optmgmt_ack)); + optp->nretry = DFLT_NRETRY; + optp->interval = DFLT_INTERVAL; + vcp->vc_state = NEXTSTATE(TE_OPTMGMT_ACK, vcp->vc_state); + qreply(q, tmp); + return; + } + + case T_CHECK: + if ((prim->optmgmt_req.OPT_length != sizeof(struct pckopt)) || + (prim->optmgmt_req.OPT_offset < sizeof(struct T_optmgmt_req))) { + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADOPT, 0); + return; + } + + /* + * Any values are fine. + */ + prim->optmgmt_ack.PRIM_type = T_OPTMGMT_ACK; + prim->optmgmt_ack.MGMT_flags |= T_SUCCESS; + mp->b_datap->db_type = M_PCPROTO; + vcp->vc_state = NEXTSTATE(TE_OPTMGMT_ACK, vcp->vc_state); + qreply(q, mp); + return; + + case T_NEGOTIATE: { + struct pckopt opt; + + /* + * No negotiation -- accept any values sent down + */ + if ((prim->optmgmt_req.OPT_length != sizeof(struct pckopt)) || + (prim->optmgmt_req.OPT_offset < sizeof(struct T_optmgmt_req))) { + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADOPT, 0); + return; + } + bcopy((char *)(mp->b_rptr + prim->optmgmt_req.OPT_offset), + (char *)&opt, sizeof(struct pckopt)); + vcp->vc_nretry = opt.nretry; + vcp->vc_interval = opt.interval; + prim->optmgmt_ack.PRIM_type = T_OPTMGMT_ACK; + mp->b_datap->db_type = M_PCPROTO; + vcp->vc_state = NEXTSTATE(TE_OPTMGMT_ACK, vcp->vc_state); + qreply(q, mp); + return; + } + + default: + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADFLAG, 0); + return; + } +} + +STATIC void +pck_chk_creq(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register union T_primitives *prim; + + prim = (union T_primitives *)mp->b_rptr; + + ASSERT((mp->b_wptr - mp->b_rptr) >= sizeof(struct T_conn_req)); + ASSERT((mp->b_wptr - mp->b_rptr) >= (prim->conn_req.DEST_length + + prim->conn_req.DEST_offset)); + ASSERT((mp->b_wptr - mp->b_rptr) >= (prim->conn_req.OPT_length + + prim->conn_req.OPT_offset)); + + if (prim->conn_req.DEST_length != sizeof(struct pckaddr)) { + pck_send_error_ack(q, mp, TBADADDR, 0); + return; + } + + if (prim->conn_req.OPT_length != 0) + if (prim->conn_req.OPT_length != sizeof(struct pckopt)) { + pck_send_error_ack(q, mp, TBADOPT, 0); + return; + } + if (msgdsize(mp) > CDATA_SIZE) { + pck_send_error_ack(q, mp, TBADDATA, 0); + return; + } + pck_putwq_inorder(q, mp); +} + +STATIC void +pck_chk_cres(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register union T_primitives *prim; + register struct pck_vc *vcp; + + prim = (union T_primitives *)mp->b_rptr; + vcp = (struct pck_vc *)q->q_ptr; + + ASSERT((mp->b_wptr - mp->b_rptr) >= sizeof(struct T_conn_res)); + ASSERT((mp->b_wptr - mp->b_rptr) >= (prim->conn_res.OPT_length + + prim->conn_res.OPT_offset)); + + if (prim->conn_res.OPT_length != 0) + if (prim->conn_res.OPT_length != sizeof(struct pckopt)) { + pck_send_error_ack(q, mp, TBADOPT, 0); + return; + } + if ((vcp->vc_seqcnt > 1) && (prim->conn_res.QUEUE_ptr == OTHERQ(q))) { + pck_send_error_ack(q, mp, TBADF, 0); + return; + } + if (msgdsize(mp) > CDATA_SIZE) { + pck_send_error_ack(q, mp, TBADDATA, 0); + return; + } + pck_putwq_inorder(q, mp); +} + +STATIC void +pck_chk_discon(q, mp) +queue_t *q; +register mblk_t *mp; +{ + ASSERT((mp->b_wptr - mp->b_rptr) >= sizeof(struct T_discon_req)); + + if (msgdsize(mp) > DDATA_SIZE) { + pck_send_error_ack(q, mp, TBADDATA, 0); + return; + } + pck_putwq_inorder(q, mp); +} + +STATIC int +pck_snd_data(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register mblk_t *protomp = NULL; + union T_primitives *prim; + struct pck_vc *vcp; + int rval; + int type; + + vcp = (struct pck_vc *)q->q_ptr; + + if (mp->b_datap->db_type == M_DATA) + type = DATAP; + else { + prim = (union T_primitives *)mp->b_rptr; + if (prim->type == T_DATA_REQ) + type = DATAP; + else + type = DATAP | EXDATAP; + protomp = mp; + mp = mp->b_cont; + protomp->b_cont = NULL; + } + if ((rval = pck_sendpkt(mp, vcp, type)) != TRUE) { + if (protomp) + linkb(protomp, mp); + if (rval == NEEDBUF) + bufcall(MINBUFSZ, BPRI_MED, pckuwsrv, q); + return(FALSE); + } + if (protomp) + freeb(protomp); + return(TRUE); +} + +STATIC int +pck_snd_creq(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register int s; + register struct pck_vc *vcp; + register struct T_conn_req *conn_req; + register struct pm_connect *conn_ind; + register mblk_t *tmp = NULL; + mblk_t *okmp, *bp; + struct pckaddr *addrp, addr; + PACKHDR *pktp; + dl_unitdata_req_t *dlrp; + + vcp = (struct pck_vc *)q->q_ptr; + + s = splstr(); + if (vcp->vc_lnktimer != -1) { + untimeout(vcp->vc_lnktimer); + vcp->vc_lnktimer = -1; + freemsg(vcp->vc_creqmp); + vcp->vc_creqmp = NULL; + } + splx(s); + if ((okmp = allocb(sizeof(struct T_ok_ack), BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_creq: can't alloc ok_ack\n", 0, 0, 0); + bufcall(sizeof(struct T_ok_ack), BPRI_HI, pckuwsrv, q); + return(FALSE); + } + if ((mp->b_datap->db_lim - mp->b_datap->db_base) < MINBUFSZ) { + if ((tmp = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_creq: couldn't alloc buffer for conn_ind\n", 0, 0, 0); + freeb(okmp); + bufcall(MINBUFSZ, BPRI_MED, pckuwsrv, q); + return(FALSE); + } + } + + conn_req = (struct T_conn_req *)mp->b_rptr; + vcp->vc_state = NEXTSTATE(prim_to_event[T_CONN_REQ], vcp->vc_state); + bcopy((char *)(mp->b_rptr + conn_req->DEST_offset), + (char *)&addr, sizeof(struct pckaddr)); + bcopy(addr.phynaddr, vcp->vc_dstnadr, NETADDRLEN); + vcp->vc_dstlink = addr.link; + vcp->vc_datreq->b_rptr = vcp->vc_datreq->b_datap->db_base; + dlrp = (dl_unitdata_req_t *)vcp->vc_datreq->b_rptr; + dlrp->dl_primitive = DL_UNITDATA_REQ; + dlrp->dl_dest_addr_offset = DL_UNITDATA_REQ_SIZE; + dlrp->dl_dest_addr_length = NETADDRLEN; + vcp->vc_datreq->b_wptr = vcp->vc_datreq->b_rptr + DL_UNITDATA_REQ_SIZE; + bcopy(vcp->vc_dstnadr, vcp->vc_datreq->b_wptr, NETADDRLEN); + vcp->vc_datreq->b_wptr += NETADDRLEN; + vcp->vc_datreq->b_datap->db_type = M_PROTO; + if ((bp = copyb(vcp->vc_datreq)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_creq: couldn't dup buffer for DL_UNITDATA_REQ\n", 0, 0, 0); + freeb(okmp); + if (tmp) + freeb(tmp); + bufcall(DATREQSIZE, BPRI_MED, pckuwsrv, q); + return(FALSE); + } + + if (conn_req->OPT_length != 0) { + struct pckopt opt; + + bcopy((char *)(mp->b_rptr + conn_req->OPT_offset), + (char *)&opt, sizeof(struct pckopt)); + vcp->vc_nretry = opt.nretry; + vcp->vc_interval = opt.interval; + } else { + vcp->vc_nretry = DFLT_NRETRY; + vcp->vc_interval = DFLT_INTERVAL; + } + + if (tmp) { + if (mp->b_cont) + linkb(tmp, unlinkb(mp)); + freeb(mp); + mp = tmp; + } + mp->b_datap->db_type = M_DATA; + mp->b_rptr = mp->b_datap->db_base + HDRWORD; + mp->b_wptr = mp->b_rptr + MINPKSIZE - HDROFFSET; + pktp = (PACKHDR *)mp->b_rptr; + pktp->pk_type = CTRLP; + pktp->pk_size = msgdsize(mp) + COMPATSIZE; + conn_ind = (struct pm_connect *)(mp->b_rptr + PCKHDRSZ); + conn_ind->cmd = PM_CONNECT; + mp->b_rptr -= HDROFFSET; + + /* + * Place address in appropriate spot for T_conn_ind so + * that the receiver won't have to move it around. + */ + conn_ind->SRC_offset = sizeof(struct T_conn_ind); + conn_ind->SRC_length = sizeof(struct pckaddr); + addrp = (struct pckaddr *)((char *)conn_ind + conn_ind->SRC_offset); + bcopy(pckdev.phy_naddr, addrp->phynaddr, NETADDRLEN); + addrp->link = vcp->vc_srclink; + bp->b_cont = mp; + vcp->vc_creqmp = bp; + vcp->vc_state = NEXTSTATE(TE_OK_ACK1, vcp->vc_state); + pck_send_ok_ack(q, okmp, T_CONN_REQ); + pck_sendconnect(vcp); + return(TRUE); +} + +STATIC int +pck_snd_cres(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register struct T_conn_res *conn_res; + register struct pm_accept *conn_con; + register struct pck_vc *resvcp; + register struct pck_vc *vcp; + register mblk_t *tmp = NULL; + struct pckaddr *addrp; + struct pckseq *seq; + mblk_t *okmp, *bp; + PACKHDR *pktp; + dl_unitdata_req_t *dlrp; + + vcp = (struct pck_vc *)q->q_ptr; + if ((okmp = allocb(sizeof(struct T_ok_ack), BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_cres: can't alloc ok ack\n", 0, 0, 0); + bufcall(sizeof(struct T_ok_ack), BPRI_HI, pckuwsrv, q); + return(FALSE); + } + if ((mp->b_datap->db_lim - mp->b_datap->db_base) < MINBUFSZ) { + if ((tmp = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_cres: couldn't alloc buffer for conn_con\n", 0, 0, 0); + freeb(okmp); + bufcall(MINBUFSZ, BPRI_MED, pckuwsrv, q); + return(FALSE); + } + } + + conn_res = (struct T_conn_res *)mp->b_rptr; + vcp->vc_state = NEXTSTATE(prim_to_event[T_CONN_RES], vcp->vc_state); + if (conn_res->QUEUE_ptr == vcp->vc_rdq) + resvcp = vcp; + else { + for (resvcp = pck_vc; resvcp < &pck_vc[nvc]; resvcp++) + if (resvcp->vc_rdq == conn_res->QUEUE_ptr) + break; + if (resvcp->vc_state != TS_IDLE) { + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADF, 0); + freeb(okmp); + if (tmp) + freeb(tmp); + freeb(bp); + return(TRUE); + } + resvcp->vc_state = NEXTSTATE(TE_PASS_CONN, resvcp->vc_state); + } + + for (seq = vcp->vc_seq; seq < &vcp->vc_seq[MAX_CONN_IND]; seq++) { + if (seq->seqno == conn_res->SEQ_number) { + bcopy(seq->srcnaddr, resvcp->vc_dstnadr, NETADDRLEN); + resvcp->vc_dstlink = seq->srclink; + seq->srclink = -1; /* mark unused */ + break; + } + } + if (seq >= &vcp->vc_seq[MAX_CONN_IND]) { + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADSEQ, 0); + freeb(okmp); + if (tmp) + freeb(tmp); + freeb(bp); + return(TRUE); + } + + resvcp->vc_datreq->b_rptr = resvcp->vc_datreq->b_datap->db_base; + dlrp = (dl_unitdata_req_t *)resvcp->vc_datreq->b_rptr; + dlrp->dl_primitive = DL_UNITDATA_REQ; + dlrp->dl_dest_addr_offset = DL_UNITDATA_REQ_SIZE; + dlrp->dl_dest_addr_length = NETADDRLEN; + resvcp->vc_datreq->b_wptr = resvcp->vc_datreq->b_rptr + DL_UNITDATA_REQ_SIZE; + bcopy(resvcp->vc_dstnadr, resvcp->vc_datreq->b_wptr, NETADDRLEN); + resvcp->vc_datreq->b_wptr += NETADDRLEN; + resvcp->vc_datreq->b_datap->db_type = M_PROTO; + if ((bp = copyb(resvcp->vc_datreq)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_cres: couldn't copyb buffer for DL_UNITDATA_REQ\n", 0, 0, 0); + freeb(okmp); + if (tmp) + freeb(tmp); + bufcall(DATREQSIZE, BPRI_MED, pckuwsrv, q); + return(FALSE); + } + if (tmp) { + if (mp->b_cont) + linkb(tmp, unlinkb(mp)); + freeb(mp); + mp = tmp; + } + mp->b_datap->db_type = M_DATA; + mp->b_rptr = mp->b_datap->db_base + HDRWORD; + mp->b_wptr = mp->b_rptr + MINPKSIZE - HDROFFSET; + pktp = (PACKHDR *)mp->b_rptr; + pktp->pk_type = CTRLP; + pktp->pk_size = msgdsize(mp) + COMPATSIZE; + conn_con = (struct pm_accept *)(mp->b_rptr + PCKHDRSZ); + conn_con->cmd = PM_ACCEPT; + mp->b_rptr -= HDROFFSET; + + /* + * Place address in appropriate spot for T_conn_con so + * that the receiver won't have to move it around. + */ + conn_con->RES_offset = sizeof(struct T_conn_con); + conn_con->RES_length = sizeof(struct pckaddr); + addrp = (struct pckaddr *)((char *)conn_con + conn_con->RES_offset); + bcopy(pckdev.phy_naddr, addrp->phynaddr, NETADDRLEN); + addrp->link = resvcp->vc_srclink; + if ((vcp->vc_seqcnt == 1) && (resvcp == vcp)) + vcp->vc_state = NEXTSTATE(TE_OK_ACK2, vcp->vc_state); + else if (vcp->vc_seqcnt == 1) + vcp->vc_state = NEXTSTATE(TE_OK_ACK3, vcp->vc_state); + else + vcp->vc_state = NEXTSTATE(TE_OK_ACK4, vcp->vc_state); + vcp->vc_seqcnt--; + pck_send_ok_ack(q, okmp, T_CONN_RES); + bp->b_cont = mp; + pck_sendout(bp, resvcp, NODUP); + return(TRUE); +} + +STATIC int +pck_snd_discon(q, mp) +queue_t *q; +register mblk_t *mp; +{ + register struct T_discon_req *discon_req; + register struct pck_vc *vcp; + register mblk_t *tmp = NULL; + mblk_t *okmp, *bp; + long reason; + unchar req_state, nextstate; + + vcp = (struct pck_vc *)q->q_ptr; + req_state = vcp->vc_state; + + if ((okmp = allocb(sizeof(struct T_ok_ack), BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_discon: can't alloc ok ack\n", 0, 0, 0); + bufcall(sizeof(struct T_ok_ack), BPRI_HI, pckuwsrv, q); + return(FALSE); + } + if ((mp->b_datap->db_lim - mp->b_datap->db_base) < MINBUFSZ) { + if ((tmp = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_discon: couldn't alloc buffer for discon_ind\n", 0, 0, 0); + freeb(okmp); + bufcall(MINBUFSZ, BPRI_MED, pckuwsrv, q); + return(FALSE); + } + } + if ((bp = copyb(vcp->vc_datreq)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_discon: couldn't copyb buffer for DL_UNITDATA_REQ\n", 0, 0, 0); + freeb(okmp); + if (tmp) + freeb(tmp); + bufcall(DATREQSIZE, BPRI_MED, pckuwsrv, q); + return(FALSE); + } + + discon_req = (struct T_discon_req *)mp->b_rptr; + vcp->vc_state = NEXTSTATE(prim_to_event[T_DISCON_REQ], vcp->vc_state); + if (req_state == TS_WRES_CIND) { + register struct pckseq *seq; + + for (seq = vcp->vc_seq; seq < &vcp->vc_seq[MAX_CONN_IND]; seq++) { + if (seq->seqno == discon_req->SEQ_number) { + bcopy(seq->srcnaddr, vcp->vc_dstnadr, NETADDRLEN); + vcp->vc_dstlink = seq->srclink; + seq->srclink = -1; /* mark unused */ + break; + } + } + if (seq >= &vcp->vc_seq[MAX_CONN_IND]) { + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TBADSEQ, 0); + freeb(okmp); + if (tmp) + freeb(tmp); + freeb(bp); + return(TRUE); + } + if (vcp->vc_seqcnt == 1) + nextstate = NEXTSTATE(TE_OK_ACK2, vcp->vc_state); + else + nextstate = NEXTSTATE(TE_OK_ACK4, vcp->vc_state); + vcp->vc_seqcnt--; + reason = VC_REJECT; + } else { + nextstate = NEXTSTATE(TE_OK_ACK1, vcp->vc_state); + reason = VC_USERINIT; + } + if (tmp) { + if (mp->b_cont) + linkb(tmp, unlinkb(mp)); + freeb(mp); + mp = tmp; + } + if (req_state == TS_DATA_XFER) { + if (!pck_send_flush(RD(q))) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_snd_discon: pck_send_flush failed\n", 0, 0, 0); + vcp->vc_state = NEXTSTATE(TE_ERROR_ACK, vcp->vc_state); + pck_send_error_ack(q, mp, TSYSERR, EPROTO); + freeb(okmp); + freeb(bp); + return(TRUE); + } + } + vcp->vc_state = nextstate; + pck_send_ok_ack(q, okmp, T_DISCON_REQ); + bp->b_cont = mp; + pck_senddisconn(q, bp, reason); + return(TRUE); +} + +/* + * Process STOPP, CTRLP, and ACKP message types. Return the + * message pointer if the message contains DATA to go upstream; else + * return NULL. + */ +STATIC mblk_t * +pck_recvack(mp) +register mblk_t *mp; +{ + register struct pck_vc *vcp; + register PACKHDR *opktp; + register mblk_t *mp1; + register s; + PACKHDR pkt; + + pkt = *(PACKHDR *)mp->b_rptr; + vcp = &pck_vc[pckminor[pkt.pk_dstlink]]; + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_recvack: type %x mp %x size %x\n", pkt.pk_type, mp, pkt.pk_size); + + if (pkt.pk_type & STOPP) { + /* Remote receiver has been flow controlled */ + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_recvack: STOPP packet received\n", 0, 0, 0); + vcp->vc_flags |= VC_REMFC; + s = splstr(); + if (vcp->vc_lnktimer != -1) + /* Wait 'patiently' for receiver */ + untimeout(vcp->vc_lnktimer); + + vcp->vc_lnktimer = timeout(pck_lnktimeout, vcp, MONITORTIME); + splx(s); + vcp->vc_nretry = 0; + freemsg(mp); + return(NULL); + } + + if (pkt.pk_type & ACKP) { + /* + * packet contains ACK + */ + if (vcp->vc_state != TS_DATA_XFER) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_recvack: ACK (%x) ignored, link down, state %x\n", + pkt.pk_ackno, vcp->vc_state, 0); + freemsg(mp); + return(NULL); + } + + if (vcp->vc_flags & VC_REMFC) { + /* + * An ACKP indicates remote receiver freed up. + * If the ACKP acks any previously unack'd packets + * then the writer will be enabled below. + */ + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_recvack: remote receiver freed up: pkackno(%x) rackno(%x)\n", + pkt.pk_ackno, vcp->vc_rackno, 0); + vcp->vc_flags &= ~VC_REMFC; + } + + if (vcp->vc_qcnt == 0) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_recvack: ACK (%x) ignored because queue is empty\n", + pkt.pk_ackno, 0, 0); + goto ctrlpk; + } + + /* + * kill packet timer + */ + s = splstr(); + if (vcp->vc_lnktimer != -1) { + untimeout(vcp->vc_lnktimer); + vcp->vc_lnktimer = -1; + } + splx(s); + vcp->vc_nretry = 0; + + /* + * free send buffer for all packets <= ackno + */ + while (mp1 = (mblk_t *) pck_deque(&vcp->vc_retrnsq)) { + opktp = (PACKHDR *)(mp1->b_cont->b_rptr + HDROFFSET); + if (! SEQIN(vcp->vc_rackno, opktp->pk_seqno, pkt.pk_ackno)) { + /* + * have to put the entry back in the + * front of the retransmit queue + * and need to issue a timer again + * because packets left in the queue + */ + mp1->b_next = vcp->vc_retrnsq.rq_head; + vcp->vc_retrnsq.rq_head = mp1; + s = splstr(); + if (vcp->vc_lnktimer != -1) + untimeout(vcp->vc_lnktimer); + + vcp->vc_lnktimer = timeout(pck_lnktimeout, vcp, PKTIME); + splx(s); + break; + } + + freemsg(mp1); + vcp->vc_qcnt--; + } + vcp->vc_rackno = pkt.pk_ackno; + + /* + * send out items waiting in the output queue + */ + if ((int)vcp->vc_qcnt < CREDIT) + qenable(WR(vcp->vc_rdq)); + } + +ctrlpk: + if (pkt.pk_type & CTRLP) { + int pktsize; + + /* + * control packet + */ + pktsize = msgdsize(mp) + COMPATSIZE; + mp->b_rptr += PCKHDRSZ; + if ((int)pkt.pk_size < pktsize) + /* + * Free the pad bytes of the msg. + * Because of earlier pullupmsg, guaranteed that + * msg is in one mblk - can't do adjmsg() since + * mp may point to dup'ed block if loopback. + */ + mp->b_rptr += (pktsize - pkt.pk_size); + + if (pck_ctrlpkt(vcp, mp) == TRUE) + putnext(vcp->vc_rdq, mp); + return(NULL); + } + + if (pkt.pk_type & (DATAP+SANITYP)) + return(mp); + + if (pkt.pk_type & SNDACK) { + /* + * This packet is marked SNDACK without DATA. + * This is only generated when the remote tranmitter + * times out on a flow controlled link. Send back + * a STOPP packet to indicate we're still flow controlled. + */ + if (vcp->vc_flags & VC_LOCALFC) + vcp->vc_flags |= VC_SENDSTOP; + else + vcp->vc_flags |= VC_SENDACK; + if (pckdev.linkstate == LINKED) + pck_sendack(vcp, 0); + } + + freemsg(mp); + return(NULL); +} + +/***** + +NAME pck_recvpkt() + +PURPOSE + To handle input packets. + +DESCRIPTION + RECVPKT(mp) + + if (length received is not the same as the packet length) + ignore the packet and return; + if (packet contains data) { + if (packet sequence number is greater than expected) + error, ignore the packet and return; + if (packet sequence number is less than expected) { + send ACK packet; + ignore the packet and return; + } + increment expected packet sequence number; + set timer to send ACK packet later; + pass the packet to the layer above; + } + +*****/ + +STATIC void +pck_recvpkt(mp) +register mblk_t *mp; +{ + register struct pck_vc *vcp; + register int s; + PACKHDR pkt; + int pktsize; /* packet data size */ + mblk_t *amp; + + pkt = *(PACKHDR *)mp->b_rptr; + vcp = &pck_vc[pckminor[pkt.pk_dstlink]]; + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_recvpkt: type %x mp %x size %x\n", pkt.pk_type, mp, pkt.pk_size); + pktsize = msgdsize(mp) + COMPATSIZE; + mp->b_rptr += sizeof(PACKHDR); + if ((int)pkt.pk_size < pktsize) + /* + * Free the pad bytes of the msg. + * Because of earlier pullupmsg, guaranteed that + * msg is in one mblk - can't do adjmsg() since + * mp may point to dup'ed block if loopback. + */ + mp->b_rptr += (pktsize - pkt.pk_size); + + /* + * ignore the packet if virtual circuit is down + */ + if (vcp->vc_state != TS_DATA_XFER) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_recvpkt: data packet ignored, link down, state %x\n", + vcp->vc_state, 0, 0); + goto freepkt; + } + + /* + * ignore the packet if sequence number > expected + */ + if (pkt.pk_seqno > vcp->vc_epsn) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_recvpkt: seq # (%x) greater than expected (%x)\n", + pkt.pk_seqno, vcp->vc_epsn, 0); + goto freepkt; + } + + if (pkt.pk_seqno < vcp->vc_epsn) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_recvpkt: seq # (%x) less than expected (%x)\n", + pkt.pk_seqno, vcp->vc_epsn, 0); + /* + * ignore the packet if sequence number < expected + * but send an ACK back + */ + vcp->vc_flags |= VC_SENDACK; + if (pckdev.linkstate == LINKED) + pck_sendack(vcp, 0); + + goto freepkt; + } + + /* + * Allocate M_PROTO for T_DATA_IND or T_EXDATA_IND + */ + if (pkt.pk_type & DATAP) { + register mblk_t *protomp; + union T_primitives *prim; + + if ((protomp = allocb(sizeof(struct T_data_ind), BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_recvpkt: can't allocb data proto block\n", 0, 0, 0); + goto freepkt; + } + protomp->b_datap->db_type = M_PROTO; + prim = (union T_primitives *)protomp->b_rptr; + prim->type = (pkt.pk_type & EXDATAP) ? T_EXDATA_IND : T_DATA_IND; + prim->data_ind.MORE_flag = 0; + protomp->b_wptr += sizeof(struct T_data_ind); + linkb(protomp, mp); + mp = protomp; + } + + /* + * increment expected sequence number + */ + vcp->vc_epsn++; + vcp->vc_sackno = pkt.pk_seqno; + vcp->vc_flags |= VC_SENDACK; + + if ((pkt.pk_type & SNDACK) || (pkt.pk_type & SANITYP)) { + /* + * send back ack immediately + */ + if (pckdev.linkstate == LINKED) + pck_sendack(vcp, 0); + } + else { + /* + * set a timer for sending back ack + * in case there is no data traffic + * going to the other direction + */ + s = splstr(); + if (vcp->vc_acktimer == -1) + vcp->vc_acktimer = timeout(pck_acktimeout, vcp, ACKTIME); + splx(s); + } + + if (pkt.pk_type & SANITYP) + goto freepkt; /* discard sanity packet */ + + putnext(vcp->vc_rdq, mp); + return; + + /* + * free packet space + */ +freepkt: + freemsg(mp); + return; +} + +/***** + +NAME pck_sendpkt() + +PURPOSE + To send packet out to the link. + +DESCRIPTION + SENDPKT(mp, dstlink, type) + + mp is the pointer to the message to be sent out, + dstlink is the destination link number. + type is the packet type. + + if (qcnt is less than CREDIT) { + put an entry in retransmit queue; + send data packet; + } + else + put an entry in output queue; + +RETURN TRUE - if message is handled successfully + FALSE - fail to get buffer, may need to put the message + back in the front of queue + +*****/ + +STATIC int +pck_sendpkt(mp, vcp, type) +register mblk_t *mp; /* message pointer */ +register struct pck_vc *vcp; /* virtual circuit pointer */ +register int type; /* packet type */ +{ + register PACKHDR *pktp; + register mblk_t *mp1; + register int s; + int pktsize; + mblk_t *bp; + + ASSERT(mp); + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, "pck_sendpkt: sending pkt\n", 0, 0, 0); + pktsize = msgdsize(mp); + if (vcp->vc_state != TS_DATA_XFER || pktsize == 0) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_sendpkt: packet rejected, bad state %x or zero-length\n", + vcp->vc_state, 0, 0); + freemsg(mp); + return(TRUE); + } + if ((int)vcp->vc_qcnt >= CREDIT) + return(FALSE); + + /* + * allocate a buffer for the packet header + */ + if ((mp1 = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_sendpkt: allocb fail\n", 0, 0, 0); + return(NEEDBUF); + } + if ((bp = copyb(vcp->vc_datreq)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendpkt: couldn't copyb buffer for DL_UNITDATA_REQ\n", 0, 0, 0); + freeb(mp1); + return(NEEDBUF); + } + + /* + * fill in the packet header + */ + mp1->b_cont = mp; + mp1->b_rptr += HDRWORD; + mp1->b_wptr = mp1->b_rptr + PCKHDRSZ; + pktp = (PACKHDR *)mp1->b_rptr; + pktp->pk_type = type; + pktp->pk_size = pktsize + PCKHDRSZ; + mp1->b_rptr -= HDROFFSET; + + /* + * Pad out small data messages so they'll be accepted by + * media driver. + */ + if (pktp->pk_size < MINPKSIZE) + mp1->b_wptr += (MINPKSIZE - pktp->pk_size); + pktp->pk_size += COMPATSIZE; + pktp->pk_seqno = vcp->vc_cpsn; + vcp->vc_cpsn++; + bp->b_cont = mp1; + pck_enque(&vcp->vc_retrnsq, bp); + if (++vcp->vc_qcnt == CREDIT) { + /* + * up to the window size limit, + * force the other side to send back ack + */ + pktp->pk_type |= SNDACK; + } + + s = splstr(); + if (vcp->vc_lnktimer == -1) + vcp->vc_lnktimer = timeout(pck_lnktimeout, vcp, PKTIME); + splx(s); + pck_sendout(bp, vcp, DUP); + return(TRUE); +} + +STATIC void +pck_sendack(vcp, poke) +register struct pck_vc *vcp; +int poke; +{ + register mblk_t *ackbp, *bp; + register dl_unitdata_req_t *reqp; + PACKHDR *ackpktp; + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendack: vcp %x\n", vcp, 0, 0); + if ((ackbp = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendack: allocb failed\n", 0, 0, 0); + return; + } + if ((bp = allocb(DL_UNITDATA_REQ_SIZE, BPRI_MED)) == NULL) { + freeb(ackbp); + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendack: allocb failed\n", 0, 0, 0); + return; + } + ackbp->b_rptr += HDRWORD; + ackpktp = (PACKHDR *)ackbp->b_rptr; + if (poke) + ackpktp->pk_type = SNDACK; + else + ackpktp->pk_type = ACKP; + ackpktp->pk_size = MINPKSIZE + COMPATSIZE - HDROFFSET; + ackbp->b_rptr -= HDROFFSET; + ackbp->b_wptr = ackbp->b_rptr + MINPKSIZE; + bp->b_datap->db_type = M_PROTO; + reqp = (dl_unitdata_req_t *)bp->b_rptr; + reqp->dl_primitive = DL_UNITDATA_REQ; + reqp->dl_dest_addr_offset = DL_UNITDATA_REQ_SIZE; + reqp->dl_dest_addr_length = NETADDRLEN; + bp->b_wptr += DL_UNITDATA_REQ_SIZE; + bcopy(vcp->vc_dstnadr, bp->b_wptr, NETADDRLEN); + bp->b_wptr += NETADDRLEN; + bp->b_cont = ackbp; + pck_sendout(bp, vcp, NODUP); +} + +/* + * pck_sendout() -- send out packet + */ +STATIC void +pck_sendout(mp, vcp, dupflg) +register mblk_t *mp; +register struct pck_vc *vcp; +int dupflg; +{ + register PACKHDR *pktp; + register mblk_t *nmp; + register int s; + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendout: mp %x vcp %x\n", mp, vcp, 0); + if (!canput(pckdev.qbot->q_next)) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendout: driver wq full\n", 0, 0, 0); + return; + } + + /* + * duplicate message before send to emd + */ + pktp = (PACKHDR *)(mp->b_cont->b_rptr + HDROFFSET); + if (dupflg == NODUP) + nmp = mp; + else { + if ((nmp = dupmsg(mp)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendout: dupmsg fail\n", 0, 0, 0); + return; /* time out will force retry later */ + } + } + + if (vcp->vc_flags & VC_SENDSTOP) { + /* + * Send a STOPP packet to remote transmitter if needed. + * We clear the ACKP bit in order to provide backwards + * compatability to NPACK providers which don't recognize + * STOPP packets. They will simply discard this message. + */ + vcp->vc_flags &= ~VC_SENDSTOP; + pktp->pk_type &= ~ACKP; + pktp->pk_type |= STOPP; + } else if (vcp->vc_flags & VC_SENDACK) { + /* + * Piggy back ACK if needed. + * + * We must not send back ACKP packets while local + * receiver is flow controlled. + */ + if (vcp->vc_flags & VC_LOCALFC) { + pktp->pk_type &= ~ACKP; + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendout: ACKP not sent - LOCALFC set\n", 0, 0, 0); + } else { + pktp->pk_type |= ACKP; + pktp->pk_ackno = vcp->vc_sackno; + } + vcp->vc_flags &= ~VC_SENDACK; + s = splstr(); + if (vcp->vc_acktimer != -1) { + untimeout(vcp->vc_acktimer); + vcp->vc_acktimer = -1; + } + splx(s); + } + pktp->pk_srclink = vcp->vc_srclink; + pktp->pk_dstlink = vcp->vc_dstlink; + putnext(pckdev.qbot, nmp); +} + +/***** +NAME pck_retrns() + + To handle packet retransmission when time-out. + +*****/ + +STATIC void +pck_retrns(vcp) +register struct pck_vc *vcp; /* link */ +{ + register PACKHDR *pktp; + register mblk_t *mp1, *mp2; + register int s; + mblk_t *amp; + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_retrns: packet time out for link\n", 0, 0, 0); + + /* + * ignore the time-out if link is down + */ + if (vcp->vc_state != TS_DATA_XFER) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_retrns: time-out ignored, link down, state %x\n", + vcp->vc_state, 0, 0); + return; + } + + vcp->vc_nretry++; + + /* + * link is down if nretry > NRETRNS + */ + if ((int)vcp->vc_nretry > NRETRNS) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_retrns: link is down\n", 0, 0, 0); +#ifdef DEBUG + if (dudebug & NO_RECOVER) + return; +#endif + + /* + * discard packet in the queue + */ + while (mp1 = (mblk_t *) pck_deque(&vcp->vc_retrnsq)) + freemsg(mp1); + vcp->vc_qcnt = 0; + + + /* + * send a DISCONNECT message to the upstream queue + */ + if (pck_send_flush(vcp->vc_rdq)) + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_retrns: pck_send_flush failed\n", 0, 0, 0); + vcp->vc_reason = VC_LINKDOWN; + pck_updisconn(vcp); + return; + } + + if (vcp->vc_flags & VC_REMFC) { + /* + * Remote receiver may be flow controlled - + * poke it to make sure. + */ + PCKLOG(FLOW_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_retrns: timeout on flow controlled link\n", 0, 0, 0); + s = splstr(); + if (vcp->vc_lnktimer != -1) + untimeout(vcp->vc_lnktimer); + + vcp->vc_lnktimer = timeout(pck_lnktimeout, vcp, MONITORTIME); + splx(s); + pck_sendack(vcp, 1); + return; + } + + /* + * retransmit all packets in the retransmit queue + */ + s = splstr(); + if (vcp->vc_lnktimer != -1) + untimeout(vcp->vc_lnktimer); + + vcp->vc_lnktimer = timeout(pck_lnktimeout, vcp, PKTIME); + for (mp1 = vcp->vc_retrnsq.rq_head, mp2 = mp1->b_next; + mp1 != NULL; mp1 = mp2, mp2 = mp2->b_next) { + pktp = (PACKHDR *)(mp1->b_cont->b_rptr + HDROFFSET); + vcp->vc_flags |= VC_SENDACK; + pck_sendout(mp1, vcp, DUP); + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_retrns: packet (%x) retransmit\n", pktp->pk_seqno, 0, 0); + } + splx(s); +} + +/***** + pck_lnktimeout + + called from clock routine when a link times out. + Just mark the link that timed out and + enable the appropriate stream queue. +*****/ + +STATIC void +pck_lnktimeout (vcp) +register struct pck_vc *vcp; +{ + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, "pck_lnktimeout: link timed out\n", 0, 0, 0); + vcp->vc_lnktimer = -1; + +#ifdef DEBUG + if (dudebug & NO_RETRANS) + return; +#endif + + if (vcp->vc_state != TS_DATA_XFER) + return; + vcp->vc_flags |= VC_LNKTOUT; + qenable(WR(vcp->vc_rdq)); +} + +/***** + pck_acktimeout + + called from clock routine when ack needs to be sent back. + Just mark the link that timed out and + enable the appropriate stream queue. +*****/ + +STATIC void +pck_acktimeout (vcp) +register struct pck_vc *vcp; +{ + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, "pck_acktimeout: ack timed out\n", 0, 0, 0); + vcp->vc_acktimer = -1; + if (vcp->vc_state != TS_DATA_XFER) + return; + vcp->vc_flags |= VC_ACKTOUT; + qenable(WR(vcp->vc_rdq)); +} + +/***** + packmonitor -- to send sanity packets periodically to check + if links are still up. + + This routine is scheduled every minute and try to send + a sanity packet to every link that is up and has no + packet in the retransmit queue. i.e., the sanity packet + is sent only if there is no traffic on the link. +*****/ + +STATIC void +packmonitor() +{ + register struct pck_vc *vcp; + + PCKLOG(PACK_ID, -1, 0, SL_TRACE, "packmonitor: active\n", 0, 0, 0); + if (pckdev.linkstate != LINKED) + return; +#ifdef DEBUG + if (dudebug & NO_MONITOR) + goto skip; +#endif + + for (vcp = pck_vc; vcp < &pck_vc[nvc]; vcp++) { + if (vcp->vc_state != TS_DATA_XFER) + continue; + if (vcp->vc_qcnt > 0) + continue; + if (vcp->vc_flags & VC_REMFC) + continue; + + /* + * mark the link that needs to send sanity packet + * and enable the appropriate stream queue + */ + vcp->vc_flags |= VC_SANITY; + qenable(WR(vcp->vc_rdq)); + } + + /* + * schedule itself again + */ +skip: + timeout(packmonitor, 0, MONITORTIME); +} + +/* + * pck_sendconnect() -- send out connect request for virtual circuit set up + */ +STATIC void +pck_sendconnect(vcp) +register struct pck_vc *vcp; /* link ptr */ +{ + register s; + register mblk_t *mp; + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_sendconnect: sending connect request\n", 0, 0, 0); + s = splstr(); + if (vcp->vc_state == TS_DATA_XFER || pckdev.linkstate != LINKED) { + if (vcp->vc_creqmp) freemsg(vcp->vc_creqmp); + vcp->vc_creqmp = NULL; + splx(s); + return; + } + if (vcp->vc_nretry-- == 0) { + /* + * exceed connection retries + * return fail to upper stream + */ + freemsg(vcp->vc_creqmp); + vcp->vc_creqmp = NULL; + splx(s); + vcp->vc_reason = VC_CONNFAIL; + pck_updisconn(vcp); + return; + } + + /* + * send (or retry) connect request - set timer for retry + */ + vcp->vc_lnktimer = timeout(pck_sendconnect, vcp, vcp->vc_interval); + if ((mp = dupmsg(vcp->vc_creqmp)) == NULL) { + splx(s); + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_sendconnect: couldn't dup msg for conn_req\n", 0, 0, 0); + return; + } + splx(s); + pck_sendout(mp, vcp, NODUP); +} + +/* + * pck_senddisconn(q, mp, reason) + * + * send DISCONNECT indication to remote user +*/ +STATIC void +pck_senddisconn(q, mp, reason) +queue_t *q; +register mblk_t *mp; +long reason; +{ + register struct pm_discon *discon_ind; + register struct pck_vc *vcp; + struct pckaddr *addrp; + PACKHDR *pktp; + mblk_t *bp; + + vcp = (struct pck_vc *)q->q_ptr; + if (pckdev.linkstate != LINKED) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_senddisconn: mux not linked\n", 0, 0, 0); + freemsg(mp); + return; + } + bp = mp->b_cont; + bp->b_rptr = bp->b_datap->db_base + HDRWORD; + bp->b_wptr = bp->b_rptr + MINPKSIZE - HDROFFSET; + bp->b_datap->db_type = M_DATA; + pktp = (PACKHDR *)bp->b_rptr; + pktp->pk_type = CTRLP; + pktp->pk_size = msgdsize(bp) + COMPATSIZE; + discon_ind = (struct pm_discon *)(bp->b_rptr + PCKHDRSZ); + discon_ind->cmd = PM_DISCONNECT; + discon_ind->SRC_offset = sizeof(struct pm_discon); + discon_ind->SRC_length = sizeof(struct pckaddr); + addrp = (struct pckaddr *)((char *)discon_ind + discon_ind->SRC_offset); + bcopy(pckdev.phy_naddr, addrp->phynaddr, NETADDRLEN); + addrp->link = vcp->vc_srclink; + bp->b_rptr -= HDROFFSET; + /* + * The reason code is in the appropriate spot for T_discon_ind + * that the receiver won't have to move it around. + */ + discon_ind->reason = reason; + pck_sendout(mp, vcp, NODUP); +} + +/**** + + receive control message for virtual circuit set up. + + CTRLPKT(i, pktp, mp) + + i is the link number; + pktp is the packet pointer; + mp is message pointer; + +****/ + +STATIC int +pck_ctrlpkt(vcp, mp) +register struct pck_vc *vcp; /* link pointer */ +mblk_t *mp; /* message pointer */ +{ + register union pm_ctrl *ctrlp; + + if (pck_adjctrl(&mp, MINPKSIZE - PCKHDRSZ - HDROFFSET) == 0) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_ctrlpkt: can't adjust incoming pkt\n", 0, 0, 0); + freemsg(mp); + return(FALSE); + } + ctrlp = (union pm_ctrl *)mp->b_rptr; + if (ctrlp->cmd >= NCTRL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_ctrlpkt: invalid cmd %x\n", ctrlp->cmd, 0, 0); + freemsg(mp); + return (FALSE); + } + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, "pck_ctrlpkt: cmd %x\n", ctrlp->cmd, 0, 0); + return((*rcv_ctrl[ctrlp->cmd])(vcp, mp)); +} + +/* + * receive CONNECT indication from remote side + */ +STATIC int +pck_rcv_connect(vcp, mp) +register struct pck_vc *vcp; +register mblk_t *mp; +{ + register union pm_ctrl *ctrlp; + register struct T_conn_ind *conn_ind; + register struct pckseq *seq; + struct pckaddr *addrp; + int s; + + ctrlp = (union pm_ctrl *)mp->b_rptr; + s = splstr(); + if ((NEXTSTATE(TE_CONN_IND, vcp->vc_state) == BADSTATE) || + ((int)vcp->vc_seqcnt >= vcp->vc_qlen)) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_rcv_connect: recv'd PM_CONNECT in state %x\n", vcp->vc_state, 0, 0); + freemsg(mp); + splx(s); + return(FALSE); + } + addrp = (struct pckaddr *)((char *)ctrlp + ctrlp->connect.SRC_offset); + for (seq = vcp->vc_seq; seq < &vcp->vc_seq[vcp->vc_qlen]; seq++) { + if (seq->srclink == -1) { + seq->seqno = ++seq_counter; + bcopy(addrp->phynaddr, seq->srcnaddr, NETADDRLEN); + seq->srclink = addrp->link; + break; + } + } + ASSERT(seq < &vcp->vc_seq[vcp->vc_qlen]); + vcp->vc_seqcnt++; + vcp->vc_state = NEXTSTATE(TE_CONN_IND, vcp->vc_state); + splx(s); + conn_ind = (struct T_conn_ind *)ctrlp; + conn_ind->PRIM_type = T_CONN_IND; + conn_ind->OPT_length = 0; + conn_ind->OPT_offset = 0; + conn_ind->SEQ_number = seq->seqno; + mp->b_datap->db_type = M_PROTO; + mp->b_wptr = mp->b_rptr + + sizeof(struct T_conn_ind) + sizeof(struct pckaddr); + return(TRUE); +} + +/* + * receive connect confirmation from remote side + * for the virtual circuit set up + */ +STATIC int +pck_rcv_accept(vcp, mp) +register struct pck_vc *vcp; +register mblk_t *mp; +{ + register union pm_ctrl *ctrlp; + register struct T_conn_con *conn_con; + register s; + struct pckaddr *addrp; + + s = splstr(); + if (NEXTSTATE(TE_CONN_CON, vcp->vc_state) == BADSTATE) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_rcv_accept: recv'd PM_ACCEPT in state %x\n", vcp->vc_state, 0, 0); + freemsg(mp); + splx(s); + return(FALSE); + } + vcp->vc_state = NEXTSTATE(TE_CONN_CON, vcp->vc_state); + if (vcp->vc_lnktimer != -1) { + untimeout(vcp->vc_lnktimer); + vcp->vc_lnktimer = -1; + } + splx(s); + ctrlp = (union pm_ctrl *)mp->b_rptr; + addrp = (struct pckaddr *)((char *)ctrlp + ctrlp->accept.RES_offset); + vcp->vc_dstlink = addrp->link; + freemsg(vcp->vc_creqmp); + vcp->vc_creqmp = NULL; + conn_con = (struct T_conn_con *)ctrlp; + conn_con->PRIM_type = T_CONN_CON; + conn_con->OPT_length = 0; + conn_con->OPT_offset = 0; + mp->b_datap->db_type = M_PROTO; + mp->b_wptr = mp->b_rptr + + sizeof(struct T_conn_con) + sizeof(struct pckaddr); + return(TRUE); +} + +/* + * Process incoming disconnect indication + */ +STATIC int +pck_rcv_discon(vcp, mp) +register struct pck_vc *vcp; +register mblk_t *mp; +{ + register union pm_ctrl *ctrlp; + register struct T_discon_ind *discon_ind; + register struct pckseq *seq; + struct pckaddr *addrp; + int s; + unchar nextstate; + + ctrlp = (union pm_ctrl *)mp->b_rptr; + discon_ind = (struct T_discon_ind *)ctrlp; + discon_ind->PRIM_type = T_DISCON_IND; + s = splstr(); + if (vcp->vc_state == TS_WRES_CIND) { + addrp = (struct pckaddr *)((char *)ctrlp + + ctrlp->discon.SRC_offset); + for (seq = vcp->vc_seq; seq < &vcp->vc_seq[MAX_CONN_IND]; seq++) { + if ((seq->srclink == addrp->link) && + (!pck_addrcmp(seq->srcnaddr, addrp->phynaddr, NETADDRLEN))) { + discon_ind->SEQ_number = seq->seqno; + seq->srclink = -1; + break; + } + } + if (seq >= &vcp->vc_seq[vcp->vc_qlen]) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_rcv_discon: PM_DISCONNECT from unknown src\n", 0, 0, 0); + freemsg(mp); + splx(s); + return(FALSE); + } + if (vcp->vc_seqcnt > 1) + nextstate = NEXTSTATE(TE_DISCON_IND3, vcp->vc_state); + else + nextstate = NEXTSTATE(TE_DISCON_IND2, vcp->vc_state); + vcp->vc_seqcnt--; + } else { + if (NEXTSTATE(TE_DISCON_IND1, vcp->vc_state) == BADSTATE) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_rcv_discon: recv'd PM_DISCONNECT in state %x\n", + vcp->vc_state, 0, 0); + freemsg(mp); + splx(s); + return(FALSE); + } + discon_ind->SEQ_number = -1; + nextstate = NEXTSTATE(TE_DISCON_IND1, vcp->vc_state); + } + mp->b_datap->db_type = M_PROTO; + mp->b_wptr = mp->b_rptr + sizeof(struct T_discon_ind); + if (vcp->vc_state == TS_DATA_XFER) + if (!pck_send_flush(vcp->vc_rdq)) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_rcv_discon: pck_send_flush failed\n", 0, 0, 0); + pck_send_fatal(vcp->vc_rdq, mp); + splx(s); + return(FALSE); + } + vcp->vc_state = nextstate; + vcp->vc_flags = 0; + splx(s); + return(TRUE); +} + +/* + * pck_adjctrl(mp, ctrlsize) + * + * Align message into a control and a data part if data exists + */ +STATIC int +pck_adjctrl(mp, ctrlsize) +register mblk_t **mp; +int ctrlsize; +{ + register mblk_t *cmp; + int mblksize; + + mblksize = (*mp)->b_wptr - (*mp)->b_rptr; + ASSERT(mblksize >= ctrlsize); + if (mblksize == ctrlsize) + return(1); + + if ((cmp = allocb(ctrlsize, BPRI_MED)) == NULL) + return(0); + cmp->b_datap->db_type = M_PROTO; + bcopy((char *)(*mp)->b_rptr, (char *)cmp->b_wptr, ctrlsize); + (*mp)->b_rptr += ctrlsize; + cmp->b_wptr += ctrlsize; + linkb(cmp, (*mp)); + (*mp) = cmp; + return(1); +} + +STATIC void +pck_term(q, qbot) +queue_t *q; +queue_t *qbot; +{ + register struct pck_vc *vcp; + dl_unbind_req_t *ubp; + mblk_t *mp; + + for (vcp = pck_vc; vcp < &pck_vc[nvc]; vcp++) + if (vcp->vc_rdq && vcp != (struct pck_vc *)q->q_ptr) { + vcp->vc_flags |= VC_FATAL; + putctl1(vcp->vc_rdq->q_next, M_ERROR, EIO); + } + + if (!canput(qbot->q_next)) { + cmn_err(CE_CONT, "pck_term: driver queue full\n"); + return; + } + + /* + * build a message block to unbind a protocol type + */ + if ((mp = allocb(DL_UNBIND_REQ_SIZE, BPRI_MED)) == NULL) { + cmn_err(CE_CONT, "pck_term: can't alloc DL_BIND_REQ\n"); + return; + } + + mp->b_datap->db_type = M_PROTO; + mp->b_wptr += DL_UNBIND_REQ_SIZE; + ubp = (dl_unbind_req_t *)mp->b_rptr; + ubp->dl_primitive = DL_UNBIND_REQ; + + /* + * now send the DL_UNBIND_REQ to the driver + */ + PCKLOG(PACK_ID, -1, 0, SL_TRACE, "pck_term: send DL_UNBIND_REQ to driver\n", 0, 0, 0); + putnext(qbot, mp); +} + +STATIC void +pck_finished(q, reason) +register queue_t *q; +long reason; +{ + register struct pck_vc *vcp = (struct pck_vc *)q->q_ptr; + register mblk_t *mp, *bp; + struct pckseq *seq; + queue_t *rdq, *wrq; + + if (q->q_flag & QREADR) { + rdq = q; + wrq = WR(q); + } else { + rdq = RD(q); + wrq = q; + } + flushq(rdq, FLUSHALL); + flushq(wrq, FLUSHALL); + if (vcp->vc_seqcnt) { + for (seq = vcp->vc_seq; seq < &vcp->vc_seq[MAX_CONN_IND]; seq++) { + if (seq->srclink != -1) { + bcopy(seq->srcnaddr, vcp->vc_dstnadr, NETADDRLEN); + vcp->vc_dstlink = seq->srclink; + seq->srclink = -1; + if ((mp = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + printf("pck_finished: couldn't alloc buffer to send discon\n"); + goto noalloc; + } + if ((bp = copyb(vcp->vc_datreq)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_finished: couldn't copyb buffer for DL_UNITDATA_REQ\n", 0, 0, 0); + freeb(mp); + goto noalloc; + } + bp->b_cont = mp; + pck_senddisconn(q, bp, reason); + } + } + } else if ((vcp->vc_state == TS_DATA_XFER) || (vcp->vc_state == TS_WCON_CREQ)) { + if ((mp = allocb(MINBUFSZ, BPRI_MED)) == NULL) { + printf("pck_finished: couldn't alloc buffer to send discon\n"); + goto noalloc; + } + if ((bp = copyb(vcp->vc_datreq)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_finished: couldn't copyb buffer for DL_UNITDATA_REQ\n", 0, 0, 0); + freeb(mp); + goto noalloc; + } + bp->b_cont = mp; + pck_senddisconn(q, bp, reason); + } +noalloc: + vcp->vc_state = TS_UNBND; +} + +/* + * Place messages on write queue in the appropriate order + * based on the TLI precedence rules. + */ +STATIC void +pck_putwq_inorder(q, mp) +register queue_t *q; +register mblk_t *mp; +{ + long primtype; + + primtype = *(long *)mp->b_rptr; + switch(primtype) { + + default: + putq(q, mp); + return; + + case T_EXDATA_REQ: { + /* + * Insert expedited message before regular data messages. + * Can only have data and exdata msgs on queue here. + */ + register mblk_t *mp1; + + for (mp1 = q->q_first; mp1 != NULL; mp1 = mp1->b_next) { + primtype = *(long *)mp1->b_rptr; + if (primtype != T_EXDATA_REQ) + break; + } + insq(q, mp1, mp); + return; + } + + case T_DISCON_REQ: + /* + * Must check for T_CONN_REQ on queue, and remove this + * msg if you find it. + */ + if (q->q_last == NULL) + putq(q, mp); + else { + primtype = *(long *)q->q_last->b_rptr; + if (primtype == T_CONN_REQ) { + flushq(q, FLUSHDATA); + freemsg(mp); + } else { + flushq(q, FLUSHDATA); + putq(q, mp); + } + } + return; + } +} + +STATIC void +pck_send_fatal(q, mp) +register queue_t *q; +register mblk_t *mp; +{ + register struct pck_vc *vcp = (struct pck_vc *)q->q_ptr; + + pck_finished(q, VC_PACKFAIL); + vcp->vc_flags |= VC_FATAL; + mp->b_datap->db_type = M_ERROR; + *mp->b_datap->db_base = EPROTO; + mp->b_rptr = mp->b_datap->db_base; + mp->b_wptr = mp->b_datap->db_base + sizeof(char); + freemsg(unlinkb(mp)); + if (q->q_flag&QREADR) + putnext(q, mp); + else + qreply(q, mp); +} + +STATIC void +pck_send_error_ack(q, mp, tli_error, unix_error) +queue_t *q; +register mblk_t *mp; +long tli_error; +long unix_error; +{ + mblk_t *tmp; + long type; + register union T_primitives *prim; + + prim = (union T_primitives *)mp->b_rptr; + type = prim->type; + /* + * is message large enough to send + * up a T_ERROR_ACK primitive + */ + if ((mp->b_datap->db_lim - mp->b_datap->db_base) < sizeof(struct T_error_ack)) { + if ((tmp=allocb(sizeof(struct T_error_ack), BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(q->q_ptr),0, SL_TRACE, + "pck_send_error_ack: couldn't allocate buffer for error_ack\n", 0, 0, 0); + pck_send_fatal(q, mp); + return; + } + freemsg(mp); + mp = tmp; + } + mp->b_rptr = mp->b_datap->db_base; + mp->b_wptr = mp->b_rptr + sizeof(struct T_error_ack); + prim = (union T_primitives *)mp->b_rptr; + prim->error_ack.ERROR_prim = type; + prim->error_ack.TLI_error = tli_error; + prim->error_ack.UNIX_error = unix_error; + prim->error_ack.PRIM_type = T_ERROR_ACK; + mp->b_datap->db_type = M_PCPROTO; + freemsg(unlinkb(mp)); + if (q->q_flag&QREADR) + putnext(q, mp); + else + qreply(q, mp); + return; +} + +STATIC void +pck_send_ok_ack(q, mp, type) +queue_t *q; +register mblk_t *mp; +long type; +{ + mblk_t *tmp; + register struct T_ok_ack *ok_ack; + + /* + * is message large enough to send + * up a T_OK_ACK primitive + */ + if ((mp->b_datap->db_lim - mp->b_datap->db_base) < sizeof(struct T_ok_ack)) { + if ((tmp = allocb(sizeof(struct T_ok_ack), BPRI_HI)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(q->q_ptr), 0, SL_TRACE, + "pck_send_ok_ack: couldn't alloc buffer for ok_ack\n", 0, 0, 0); + pck_send_fatal(q, mp); + return; + } + freemsg(mp); + mp = tmp; + } + mp->b_rptr = mp->b_datap->db_base; + mp->b_wptr = mp->b_rptr + sizeof(struct T_ok_ack); + ok_ack = (struct T_ok_ack *)mp->b_rptr; + ok_ack->CORRECT_prim = type; + ok_ack->PRIM_type = T_OK_ACK; + mp->b_datap->db_type = M_PCPROTO; + freemsg(unlinkb(mp)); + if (q->q_flag&QREADR) + putnext(q, mp); + else + qreply(q, mp); + return; +} + +STATIC int +pck_send_flush(q) +queue_t *q; +{ + mblk_t *mp; + + if ((mp = allocb(1, BPRI_HI)) == NULL) + return(0); + mp->b_wptr++; + mp->b_datap->db_type = M_FLUSH; + *mp->b_rptr = FLUSHRW; + putnext(q, mp); + return(1); +} + +/* + * pck_updisconn(vcp) + * + * send DISCONNECT indication upstream to local user + */ +STATIC void +pck_updisconn(vcp) +register struct pck_vc *vcp; +{ + register mblk_t *mp; + register struct T_discon_ind *discon_ind; + + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE, + "pck_updisconn: send DISCONNECT indication upstream\n", 0, 0, 0); + vcp->vc_state = TS_IDLE; + if (vcp->vc_rdq == NULL) + return; + + if ((mp = allocb(sizeof(struct T_discon_ind), BPRI_MED)) == NULL) { + PCKLOG(PACK_ID, VC_NUM(vcp), 0, SL_TRACE|SL_ERROR, + "pck_updisconn: allocb fail\n", 0, 0, 0); + bufcall(sizeof(struct T_discon_ind), BPRI_MED, pck_updisconn, vcp); + return; + } + + mp->b_datap->db_type = M_PROTO; + discon_ind = (struct T_discon_ind *)mp->b_wptr; + discon_ind->PRIM_type = T_DISCON_IND; + discon_ind->DISCON_reason = vcp->vc_reason; + mp->b_wptr += sizeof(struct T_discon_ind); + putnext(vcp->vc_rdq, mp); + return; +} + +STATIC void +pck_enque(rq, mp) +register struct retransq *rq; +register mblk_t *mp; +{ + if (rq->rq_head == NULL) { + + /* + * queue is empty + */ + rq->rq_head = mp; + rq->rq_tail = mp; + } else { + rq->rq_tail->b_next = mp; + rq->rq_tail = mp; + } + mp->b_next = NULL; +} + +STATIC mblk_t * +pck_deque(rq) +register struct retransq *rq; +{ + register mblk_t *mp; + + if ((mp = rq->rq_head) != NULL) { + rq->rq_head = rq->rq_head->b_next; + mp->b_next = NULL; + } + return(mp); +} + +STATIC long +pck_findlink() +{ + long link; + + for (link = 0; link < nvc; link++) + if (pckminor[link] == -1) + return (link); + return (-1); +} + +/* + * Return 0 if addresses match and 1 otherwise. + */ +STATIC int +pck_addrcmp(a1, a2, len) +register unchar *a1, *a2; +register uint len; +{ + while (len-- > 0) { + if (*a1++ != *a2++) + return(1); + } + return(0); +} diff --git a/usr/src/protocols/npack/io/npack.mk b/usr/src/protocols/npack/io/npack.mk new file mode 100644 index 0000000..1c38b92 --- /dev/null +++ b/usr/src/protocols/npack/io/npack.mk @@ -0,0 +1,57 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)npack:io/npack.mk 1.8" +ROOT = +INC = $(ROOT)/usr/include + +MACHINE = 3b2 + +MORECPP = +MKBOOT = mkboot +CFLAGS = -O -I.. -I$(INC) $(MORECPP) -Du$(MACHINE) -D_KERNEL +LDFLAGS = +CC = cc +LD = ld + +CLEAN = npack.o + +.c.o: + $(CC) $(CFLAGS) -c $*.c + $(MKBOOT) -m ../master.d -d . npack.o + +all : npack.o + +npack.o: npack.c \ + ../master.d/npack \ + ../sys/npack.h \ + $(INC)/sys/types.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/param.h \ + $(INC)/sys/stream.h \ + $(INC)/sys/stropts.h \ + $(INC)/sys/strlog.h \ + $(INC)/sys/log.h \ + $(INC)/sys/tihdr.h \ + $(INC)/sys/tiuser.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/user.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/dlpi.h \ + $(INC)/sys/rf_debug.h + +install: all + +clean: + rm -f $(CLEAN) + +clobber: clean diff --git a/usr/src/protocols/npack/master.d/npack b/usr/src/protocols/npack/master.d/npack new file mode 100644 index 0000000..9f5af55 --- /dev/null +++ b/usr/src/protocols/npack/master.d/npack @@ -0,0 +1,15 @@ +*#ident "@(#)npack:master.d/npack 1.6" +* +* PACK protocol multiplexer module +* +*FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES +fs - pck - - - + nvc (%i) ={ #C } + pck_vc[#C] (%0x90) + pckminor[#C] (%0x4) + PKTIME (%i) ={ 400 } + NRETRNS (%i) ={ 2 } + ACKTIME (%i) ={ 200 } + CREDIT (%i) ={ 4 } + MONITORTIME (%i) ={ 3000 } +$$ diff --git a/usr/src/protocols/npack/sys/npack.h b/usr/src/protocols/npack/sys/npack.h new file mode 100644 index 0000000..c9e566e --- /dev/null +++ b/usr/src/protocols/npack/sys/npack.h @@ -0,0 +1,235 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)npack:sys/npack.h 1.3.1.6" + +#define NETADDRLEN 6 /* network address length in bytes */ + /* (same as PHYAD_SIZE in emduser.h) */ + +#ifdef uts +typedef unsigned char unchar; +#endif + +/* + * PACK protocol header + */ +typedef struct { + unchar pk_type; /* packet type - ACK, DATA, CTRL */ + ushort pk_seqno; /* packet sequence number */ + ushort pk_ackno; /* packet ACK sequence number */ + ushort pk_srclink; /* source link number */ + ushort pk_dstlink; /* destination link number */ + ushort pk_size; /* size of this packet */ +} PACKHDR; + +/* + * Various constants required by pack + */ +#define PCKHDRSZ sizeof(PACKHDR) +#define HDRWORD 4 +#define HDROFFSET 2 +#define COMPATSIZE 16 /* for compatibility with old driver */ + /* 14 + HDROFFSET */ +#define PACK_ID 9999 +#define FLOW_ID 1987 +#define MINPKSIZE 50 +#define MINBUFSZ 64 +#define NEEDBUF 3 +#define DUP 0 +#define NODUP 1 +#define FLOWCNTL 2 + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif +#ifndef NULL +#define NULL 0 +#endif + +/* + * MUX link states. + */ +#define UNLINKED 0 /* not linked */ +#define WAITLINK 1 /* processing link ioctl */ +#define LINKED 2 /* active */ + +/* + * Define Packet Type + */ +#define DATAP 0x01 /* data packet */ +#define ACKP 0x02 /* acknowledgement packet */ +#define CTRLP 0x04 /* control packet */ +#define SANITYP 0x08 /* sanity packet */ +#define SNDACK 0x10 /* send back ack immediately */ +#define EXDATAP 0x20 /* expedited data packet */ +#define STOPP 0x40 /* transmitter must block */ + +/* + * TI characteristics of the PACK module + */ +#define ETSDU_SIZE 0 +#define CDATA_SIZE 128 +#define DDATA_SIZE 128 +#define ADDR_SIZE sizeof(struct pckaddr) +#define OPT_SIZE sizeof(struct pckopt) +#define MAX_CONN_IND 5 +#define DFLT_NRETRY 1 +#define DFLT_INTERVAL (5*HZ) + +/* + * Sequence structure for listener connect establishment + */ +struct pckseq { + long seqno; /* connect sequence number */ + long srclink; /* caller's mindev */ + char srcnaddr[NETADDRLEN]; /* caller's network addr */ +}; + +/* + * Retransmit queue structure + */ +struct retransq { + mblk_t *rq_head; + mblk_t *rq_tail; +}; + +/* + * Multiplexed low level device structure. + */ +struct pckdev { + char phy_naddr[NETADDRLEN]; /* local network address */ + short lastrun; /* last VC to be scheduled */ + short linkstate; /* condition of link */ + queue_t *respq; /* send ioctl response up this q */ + queue_t *qbot; /* upper queue of linked device */ +}; + +/* + * PACK virtual circuit structure + */ +struct pck_vc { + unchar vc_state; /* state of this circuit for TLI */ + unchar vc_seqcnt; /* # of outstanding conn_ind */ + ushort vc_flags; /* various flags - see below */ + struct pckseq vc_seq[MAX_CONN_IND]; /* conn_ind sequence numbers */ + long vc_qlen; /* max # outstanding conn_ind */ + struct retransq vc_retrnsq; /* retransmit queue */ + ushort vc_cpsn; /* current packet sequence number */ + ushort vc_epsn; /* expected packet sequence number */ + ushort vc_sackno; /* next piggy-back ack number */ + ushort vc_rackno; /* last received ack number */ + ushort vc_qcnt; /* current queue count (retrns) */ + ushort vc_nretry; /* number of retry */ + ushort vc_interval; /* time interval between retries */ + ushort vc_srclink; /* source link number */ + char vc_dstnadr[NETADDRLEN]; /* destination network address */ + ushort vc_dstlink; /* destination link number */ + long vc_lnktimer; /* link timer id */ + long vc_acktimer; /* ack timer id */ + queue_t *vc_rdq; /* stream read queue */ + mblk_t *vc_creqmp; /* msg for sending connect request */ + mblk_t *vc_datreq; /* msg for sending data request */ + long vc_reason; /* disconnect reason */ +}; + +/* + * Flags associated with the virtual circuit + */ +#define VC_SENDACK 0x01 /* send ack */ +#define VC_LNKTOUT 0x02 /* link timed out */ +#define VC_ACKTOUT 0x04 /* ack timed out */ +#define VC_SANITY 0x08 /* sanity packet */ +#define VC_CONNTOUT 0x10 /* connect request timed out */ +#define VC_FATAL 0x20 /* fatal error on VC */ +#define VC_SENDSTOP 0x40 /* send stop packet to transmitter */ +#define VC_LOCALFC 0x80 /* local receiver flow controlled */ +#define VC_REMFC 0x100 /* remote receiver flow controlled */ +#define VC_NEWCON 0x200 /* other end of connection is a new */ + /* style NPACK driver */ +#define VC_URSRV 0x400 /* upper read svc procedure active */ + +/* + * PACK address and options structures + */ +struct pckaddr { + long link; /* minor device of stream (VC) */ + char phynaddr[NETADDRLEN]; /* low level device address */ +}; + +struct pckopt { + ushort nretry; /* no. of connect request retries */ + ushort interval; /* interval in ticks between retries */ +}; + +/* + * Control messages passed between peer PACK modules + */ +struct pm_connect { + long cmd; /* always PM_CONNECT */ + long SRC_length; /* source address length */ + long SRC_offset; /* source address offset */ +}; + +struct pm_accept { + long cmd; /* always PM_ACCEPT */ + long RES_length; /* responding address length */ + long RES_offset; /* responding address offset */ +}; + +struct pm_discon { + long cmd; /* always PM_ACCEPT */ + long reason; /* reason for disconnect */ + long SRC_length; /* source address length */ + long SRC_offset; /* source address offset */ +}; + +union pm_ctrl { + long cmd; /* PACK control cmd */ + struct pm_connect connect; /* connect indication */ + struct pm_accept accept; /* connect confirmation */ + struct pm_discon discon; /* disconnect indication */ +}; + +/* + * various macros + */ +#define VC_NUM(X) ((struct pck_vc *)(X) - pck_vc) +#define SEQIN(LOW, X, HIGH) (((LOW)<=(HIGH))?(((X)>=(LOW)) && \ + ((X)<=(HIGH))) \ + :(((X)<=(HIGH)) ||\ + ((X)>=(LOW)))) + +/* + * incoming commands for virtual circuit set up + */ +#define PM_CONNECT 0 +#define PM_ACCEPT 1 +#define PM_DISCONNECT 2 + +/* + * reason for disconnect + */ +#define VC_REJECT 1 /* reject a conection request */ +#define VC_CLOSE 2 /* closed by the other end */ +#define VC_CONNFAIL 3 /* fail to contact remote side */ +#define VC_LINKDOWN 4 /* link down */ +#define VC_USERINIT 5 /* normal user-initiated disconnect */ +#define VC_PACKFAIL 6 /* fatal error in PACK */ + +#define DATREQSIZE NETADDRLEN+DL_UNITDATA_REQ_SIZE + +/* + * PCKLOG(mid,sid,level,flags,fmt,args) should be used for those trace + * calls that are only to be made during debugging. + */ +#ifdef DEBUG +#define PCKLOG(A, B, C, D, E, F, G, H) ((void)((pcklog) && strlog((A), (B), (C), (D), (E), (F), (G), (H)))) +#else +#define PCKLOG(A, B, C, D, E, F, G, H) +#endif + diff --git a/usr/src/scripts/core/proto.core1 b/usr/src/scripts/core/proto.core1 index 8ab3a4e..43ba4c7 100644 --- a/usr/src/scripts/core/proto.core1 +++ b/usr/src/scripts/core/proto.core1 @@ -1,6 +1,6 @@ /dev/null 3226 416 -d--755 0 3 +d--775 0 3 unix ---500 0 0 ../COREunix dgmon ---500 0 0 ../init/fwnull filledt ---500 0 0 ../filledt @@ -118,18 +118,16 @@ d--755 0 3 c1d1se c--600 0 3 17 30 c1d1sf c--600 0 3 17 31 $ - rroot c--600 0 3 17 0 root b--600 0 3 17 0 tty c--666 0 3 20 0 - fd d--555 0 0 - $ $ tmp d--777 4 4 $ etc d--775 0 3 TIMEZONE ---444 0 3 ../etc/TIMEZONE + init ---555 0 2 ../etc/init inittab ---664 0 3 inst/etc/inittabf - iu.ap ---644 0 3 ../etc/iu.ap + iu.ap ---664 0 3 ../etc/iu.ap mnttab ---644 0 2 /dev/null group ---644 0 3 ../etc/group passwd ---644 0 3 ../etc/passwd @@ -145,9 +143,6 @@ d--755 0 3 mkfs ---555 2 2 ../etc/fs/s5/mkfs mount ---555 2 2 ../etc/fs/s5/mount $ - fd d--775 0 3 - mount ---555 2 2 ../etc/fs/fd/mount - $ $ $ inst d--775 0 3 @@ -172,18 +167,10 @@ d--755 0 3 $ etc d--775 0 3 define ---444 2 2 inst/etc/define - define.min ---444 2 2 inst/etc/define.min do_setup ---444 2 2 inst/etc/do_setup inittabh ---444 2 2 inst/etc/inittabh - inittabl ---444 2 2 inst/etc/inittabl - inittabt ---444 2 2 inst/etc/inittabt - inittabht ---444 2 2 inst/etc/inittabht instf ---555 2 2 inst/etc/instf - asktype ---555 2 2 inst/etc/asktype - instl ---555 2 2 inst/etc/instl - instt ---555 2 2 inst/etc/instt instth ---555 2 2 inst/etc/instth - instht ---555 2 2 inst/etc/instht insth ---555 2 2 inst/etc/insth p_check ---555 2 2 inst/etc/p_check $ @@ -203,13 +190,12 @@ d--755 0 3 root d--775 0 3 $ $ - sbin d--775 0 3 - init ---555 0 2 ../sbin/init + sbin d--775 0 2 fmthard ---555 0 0 ../sbin/fmthard uadmin ---555 0 3 ../sbin/uadmin sh ---555 2 0 ../sbin/sh sync ---555 2 2 ../sbin/sync - autopush ---555 0 3 ../sbin/autopush + autopush ---555 2 0 ../sbin/autopush umount ---555 2 2 ../sbin/umount $ usr d--775 0 3 @@ -260,4 +246,4 @@ d--755 0 3 bin d--775 0 3 $ $ -:#ident "@(#)core:proto.core1 1.15.4.6" +:#ident "@(#)core:proto.core1 1.15.3.5" diff --git a/usr/src/scripts/core/setup.icd b/usr/src/scripts/core/setup.icd index a726207..7ed86cc 100644 --- a/usr/src/scripts/core/setup.icd +++ b/usr/src/scripts/core/setup.icd @@ -1,4 +1,4 @@ -#ident "@(#)core:setup.icd 1.3.3.1" +#ident "@(#)core:setup.icd 1.3.2.6" ROOT=${ROOT:-"/"} BOOTBLK=ICDboot @@ -31,7 +31,7 @@ usr/lib/mboot usr/lib/flboot config/ifile4.0 config/mapfile4.0 -usr/ccs/bin/ld +bin/ld bin/strip ! # Copy all master.d files @@ -82,7 +82,7 @@ echo "Preparing a generic unix for the first restore floppy" TMP_CMDS= for CMD in /usr/sbin/mkboot \ /usr/sbin/cunix \ - /usr/ccs/bin/ld \ + /bin/ld \ /bin/strip \ /mkfs/inst/bin/absunix \ /usr/sbin/newboot \ diff --git a/usr/src/target.dirs b/usr/src/target.dirs index e2dc62d..e861003 100644 --- a/usr/src/target.dirs +++ b/usr/src/target.dirs @@ -1,163 +1,56 @@ -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T -# All Rights Reserved - -# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T -# The copyright notice above does not evidence any -# actual or intended publication of such source code. - - -#ident "@(#)mk:target.dirs 1.2.2.8" +#ident "@(#)mk:target.dirs 1.2" # The format of this file is: -# DIRECTORY [MODE OWNER GROUP OLD-DIRECTORY-NAME[s]] +# DIRECTORY [MODE OWNER GROUP] # The MODE/OWNER/GROUP may be left blank or else # dashes may be used as place holders. -/ 755 root sys -/bck 775 root sys -/boot 775 root sys -/config 775 root bin -/dev 775 root sys -/dev/term 775 root root -/dgn 775 root root -/etc 775 root sys -/etc/cron.d 755 root sys /usr/lib/cron -/etc/default 775 root sys -/etc/dfs 775 root sys -/etc/fs 775 root sys -/etc/fs/bfs 775 root sys -/etc/fs/proc 775 root sys -/etc/fs/rfs 775 root sys -/etc/fs/s5 775 root sys -/etc/init.d 775 root sys -/etc/mail 775 bin mail -/etc/master.d 775 root sys -/etc/rc.d 775 root sys -/etc/rc0.d 775 root sys -/etc/rc1.d 775 root sys -/etc/rc2.d 775 root sys -/etc/rc3.d 775 root sys -/etc/rfs 775 root sys -/etc/saf 755 bin bin -/etc/save.d 775 root sys -/etc/shutdown.d 775 root sys -/etc/tm 775 root sys -/etc/vtoc 775 root sys -/export 775 root sys -/home 775 root sys -/mnt 775 root sys -/opt 775 root sys -/proc 755 root sys -/save 775 root sys -/sbin 775 root sys -/stand 755 root sys -/tmp 1777 sys sys -/usr 775 root sys -/usr/admin 755 root sys -/usr/admin/checkfsys.d 755 root sys -/usr/admin/makefsys.d 755 root sys -/usr/admin/menu 755 root sys -/usr/admin/menu/diagnostics 755 root sys -/usr/admin/menu/diskmgmt 755 root sys -/usr/admin/menu/diskmgmt/checkfsys.d 755 root sys -/usr/admin/menu/diskmgmt/cpdisk.d 755 root sys -/usr/admin/menu/diskmgmt/erase.d 755 root sys -/usr/admin/menu/diskmgmt/format.d 755 root sys -/usr/admin/menu/diskmgmt/harddisk 755 root sys -/usr/admin/menu/diskmgmt/harddisk/display.d 755 root sys -/usr/admin/menu/diskmgmt/harddisk/partitioning.d 755 root sys -/usr/admin/menu/diskmgmt/harddisk/rmdisk.d 755 root sys -/usr/admin/menu/diskmgmt/makefsys.d 755 root sys -/usr/admin/menu/diskmgmt/mountfsys.d 755 root sys -/usr/admin/menu/diskmgmt/umountfsys.d 755 root sys -/usr/admin/menu/filemgmt 755 root sys -/usr/admin/menu/filemgmt/backup.d 755 root sys -/usr/admin/menu/filemgmt/bupsched 755 root sys -/usr/admin/menu/filemgmt/restore.d 755 root sys -/usr/admin/menu/filemgmt/store.d 755 root sys -/usr/admin/menu/machinemgmt 755 root sys -/usr/admin/menu/packagemgmt 755 root sys -/usr/admin/menu/softwaremgmt 755 root sys -/usr/admin/menu/softwaremgmt/installpkg.d 755 root sys -/usr/admin/menu/softwaremgmt/removepkg.d 755 root sys -/usr/admin/menu/softwaremgmt/runpkg.d 755 root sys -/usr/admin/menu/syssetup 755 root sys -/usr/admin/menu/ttymgmt 755 root sys -/usr/admin/menu/usermgmt 755 root sys -/usr/admin/menu/usermgmt/modgroup 755 root sys -/usr/admin/menu/usermgmt/moduser 755 root sys -/usr/admin/mountfsys.d 755 root sys -/usr/admin/umountfsys.d 755 root sys -/usr/bin 775 root bin /bin -/usr/ccs 755 bin bin -/usr/ccs/bin 755 bin bin -/usr/ccs/lib 755 bin bin -/usr/ccs/lib/fp 755 bin bin -/usr/ccs/lib/fp/libp 755 bin bin -/usr/ccs/lib/minabi 755 bin bin -/usr/ccs/lib/minabi/libp 755 bin bin -/usr/include 775 root bin -/usr/lbin 775 bin bin -/usr/lib 775 root bin /lib /shlib -/usr/lib 775 root bin -/usr/lib/cftime 775 bin bin -/usr/lib/chrclass 775 bin bin -/usr/lib/chrtbl 775 bin bin -/usr/lib/class 775 root bin -/usr/lib/class/RT 775 root bin -/usr/lib/class/TS 775 root bin -/usr/lib/config 775 bin bin -/usr/lib/font 775 bin bin -/usr/lib/fs 775 root sys -/usr/lib/fs/bfs 775 root sys -/usr/lib/fs/proc 775 root sys -/usr/lib/fs/rfs 775 root sys -/usr/lib/fs/s5 775 root sys -/usr/lib/lex 775 bin bin -/usr/lib/libp 775 bin bin -/usr/lib/macros 775 bin bin -/usr/lib/mail 775 bin mail -/usr/lib/mail/surrcmd 775 bin mail -/usr/lib/mailx 775 root sys -/usr/lib/pump 775 bin bin -/usr/lib/rfs 775 root sys -/usr/lib/sa 775 adm bin -/usr/lib/saf 775 root bin -/usr/lib/tabset 775 bin bin -/usr/lib/term 775 bin bin -/usr/lib/tmac 775 bin bin -/usr/lib/trouble 775 bin bin -/usr/net 775 root sys -/usr/net/servers 775 root sys -/usr/net/servers/rfs 775 root sys -/usr/sadm 555 bin bin -/usr/sadm/sysadm 555 bin bin -/usr/sadm/sysadm/add-ons 555 bin bin -/usr/sbin 775 root bin -/usr/share 755 root sys -/usr/share/lib 755 root sys /usr/pub -/usr/share/man 755 root sys -/usr/src 775 bin bin -/usr/ucb 775 root bin -/var 775 root sys -/var/adm 775 root sys /usr/adm -/var/adm/log 775 adm adm /etc/log -/var/adm/passwd 775 adm adm -/var/adm/sa 775 adm sys -/var/cron 755 root sys -/var/mail 775 root mail /usr/mail -/var/mail/:saved 775 root mail -/var/news 777 bin bin /usr/news -/var/options 775 root sys /usr/options -/var/preserve 777 bin bin /usr/preserve -/var/sadm 755 root sys -/var/saf 755 bin bin -/var/spool 775 root bin /usr/spool -/var/spool/cron 0700 root sys -/var/spool/cron/atjobs 755 root sys -/var/spool/cron/crontabs 755 root sys -/var/spool/lp 755 lp tty -/var/spool/pkg 777 bin bin -/var/spool/smtpq 775 root mail -/var/spool/uucp 755 uucp uucp -/var/spool/uucppublic 777 uucp uucp -/var/tmp 1777 sys sys /usr/tmp -/var/uucp 755 uucp uucp +/dev +/etc +/etc/cron.d +/etc/fs +/etc/fs/bfs +/etc/fs/events +/etc/fs/proc +/etc/fs/s5 +/etc/nserve +/export +/home +/mnt +/opt +/proc +/sbin +/stand +/tmp +/usr +/usr/bin +/usr/games +/usr/include +/usr/lib +/usr/lib/fs +/usr/sadm +/usr/sadm/sysadm +/usr/sadm/sysadm/add-ons +/usr/sbin +/usr/share +/usr/share/lib +/usr/share/man +/usr/shlib +/usr/src +/usr/ucb +/usr/ucbinclude +/usr/ucblib +/var +/var/adm +/var/cron +/var/mail +/var/opt +/var/preserve +/var/saf +/var/spool +/var/spool/cron +/var/spool/cron/crontabs +/var/spool/cron/atjobs +/var/spool/lp +/var/spool/uucp +/var/spool/uucppublic +/var/tmp +/var/uucp diff --git a/usr/src/uts/3b2/boot/boot.fast.mk b/usr/src/uts/3b2/boot/boot.fast.mk new file mode 100644 index 0000000..6c4cf3d --- /dev/null +++ b/usr/src/uts/3b2/boot/boot.fast.mk @@ -0,0 +1,54 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)boot:boot/boot.fast.mk 11.6" +STRIPOPT = -x -r + +ROOT = +DASHO = -O +INC = $(ROOT)/usr/include +#CFLAGS = -I$(INC) -DINKERNEL $(MORECPP) +CFLAGS = $(DASHO) -I$(INC) -D_KERNEL $(MORECPP) +FRC = + +all: + @for i in boot mboot olboot filledt;\ + do\ + cd $$i;\ + echo "====== $(MAKE) -f $$i.mk \"ROOT=$(ROOT)\" \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\" &";\ + $(MAKE) -f $$i.mk "ROOT=$(ROOT)" "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)" &\ + cd .. ;\ + done;\ + wait + +install: + @for i in boot mboot olboot filledt;\ + do\ + cd $$i;\ + echo "====== $(MAKE) -f $$i.mk install \"ROOT=$(ROOT)\" \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\" &";\ + $(MAKE) -f $$i.mk install "ROOT=$(ROOT)" "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)" &\ + cd .. ;\ + done;\ + wait + +clean: + @for i in boot mboot olboot filledt;\ + do\ + cd $$i;\ + $(MAKE) -f $$i.mk clean; \ + cd .. ;\ + done + +clobber: + @for i in boot mboot olboot filledt;\ + do\ + cd $$i;\ + $(MAKE) -f $$i.mk clobber ;\ + cd .. ;\ + done + +FRC: diff --git a/usr/src/uts/3b2/boot/boot/bfslibfm.c b/usr/src/uts/3b2/boot/boot/bfslibfm.c index 5f8367c..c411209 100644 --- a/usr/src/uts/3b2/boot/boot/bfslibfm.c +++ b/usr/src/uts/3b2/boot/boot/bfslibfm.c @@ -5,7 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/boot/bfslibfm.c 1.10" + +#ident "@(#)boot:boot/boot/bfslibfm.c 1.6" #include "sys/types.h" #include "sys/psw.h" #include "sys/elog.h" @@ -29,7 +30,6 @@ #include "sys/libfm.h" #include "sys/elftypes.h" #include "sys/elf.h" -#include "sys/inline.h" char data[SECTSIZE]; struct nfso nfso[V_NUMPAR]={0,0}; @@ -205,7 +205,7 @@ do_edt() char buffer[40]; - if (!STRCMP(s3bc->name, "SBD")) + if (!strcmp(s3bc->name, "SBD")) { if (s3bc->timestamp > SIZOFMEM) { @@ -296,9 +296,7 @@ int elb; /* found it, therefore mark it found */ { s3bc->board = 0; -#ifdef BOOTDEBUG PRINTF("found board %s\n",s3bc->name); -#endif if(edtp->indir_dev) /* load bus gen program for configured * HA device. @@ -376,16 +374,14 @@ xconfirm() */ for (i=0; icount; ++i){ s3bc = &sys3bconfig->driver[i]; - if (0 != STRCMP(xtcp->name,s3bc->name) + if (0 != strcmp(xtcp->name,s3bc->name) || s3bc->flag & S3BC_IGN) continue; if (s3bc->board == xtcp->maj){ /* found it, therefore mark it found */ -#ifdef BOOTDEBUG PRINTF("found board %s\n",s3bc->name); -#endif s3bc->board = 0; break; } @@ -572,6 +568,7 @@ struct bootattr *battrp; ld = (struct bfs_ldirs *) (onekbuf + j); if (ld->l_ino != 0 && STRCMP(ld->l_name, fname) == 0) { + PRINTF("Found file %s\n", ld->l_name); found ++; break; } @@ -609,7 +606,7 @@ struct bootattr *battrp; battrp->size = dir->d_eoffset - dir->d_sblock +1; battrp->mtime = dir->d_fattr.va_mtime; battrp->ctime = dir->d_fattr.va_ctime; - battrp->blksize = BFS_BSIZE; + battrp->blksize = dir->d_fattr.va_blksize; return((dir->d_sblock + fso) * SECTSIZE); } @@ -734,7 +731,7 @@ struct boothdr *bhdr; read(fd, (stroff + eshdr.sh_name), edtstr, 6); - if (STRCMP(edtstr, "") == 0) { + if (strcmp(edtstr, "") == 0) { bhdr->nsect += 1; break; } diff --git a/usr/src/uts/3b2/boot/boot/boot.c b/usr/src/uts/3b2/boot/boot/boot.c index 0c7183d..7a24639 100644 --- a/usr/src/uts/3b2/boot/boot/boot.c +++ b/usr/src/uts/3b2/boot/boot/boot.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/boot/boot.c 1.14" +#ident "@(#)boot:boot/boot/boot.c 1.12" #include "sys/types.h" #include "sys/psw.h" #include "sys/elog.h" @@ -28,7 +28,6 @@ #include "sys/fsiboot.h" #include "sys/libfm.h" #include "sys/id.h" -#include "sys/inline.h" char magic = FALSE; @@ -66,10 +65,6 @@ main() demand_config = FALSE; - - if (P_CMDQ->b_type == UNIXBOOT) - strcpy(name, "unix"); - /* Loop forever until the final program name to be loaded is found. */ for (;;) @@ -90,6 +85,9 @@ main() (STRCMP(name, FILLEDT) == 0) || (STRCMP(name, LBOOT) == 0)) check_config = FALSE; + else + if (P_CMDQ->b_type == UNIXBOOT) + strcpy(name, "unix"); if (P_CMDQ->b_type == AUTOBOOT){ RNVRAM((char *)(UNX_NVR->bootname), oname, 15); diff --git a/usr/src/uts/3b2/boot/boot/boot.mk b/usr/src/uts/3b2/boot/boot/boot.mk index 7c41056..07a5212 100644 --- a/usr/src/uts/3b2/boot/boot/boot.mk +++ b/usr/src/uts/3b2/boot/boot/boot.mk @@ -5,13 +5,14 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)boot:boot/boot/boot.mk 1.10" +#ident "@(#)boot:boot/boot/boot.mk 1.7" ROOT = -INC = $(ROOT)/usr/include +INCSYS = $(ROOT)/usr/include UINC = $(ROOT)/usr/include +LIB = $(ROOT)/lib DASHO = -O -CFLAGS = $(DASHO) -I$(INC) -I. +CFLAGS = $(DASHO) -I$(INCSYS) -I. SYMLINK = : STRIP = strip INS = install @@ -22,16 +23,15 @@ FRC = FILES = \ misc.o \ - boot.o \ - strrchr.o \ - strncat.o + boot.o all: boot -boot: $(FILES) $(IFILE) $(LIBFM) $(MAPFILE) $(FRC) +boot: $(FILES) $(IFILE) $(LIBFM) $(MAPFILE) + $(FRC) if [ x$(CCSTYPE) = xCOFF ] ; \ - then $(LD) $(LDFLAGS) $(IFILE) $(FILES) $(LIBFM) -o boot ; \ - else $(LD) $(LDFLAGS) -M $(MAPFILE) $(FILES) $(LIBFM) -dn -o boot ; \ + then $(LD) $(LDFLAG) $(IFILE) $(FILES) $(LIBFM) -L$(LIB) -lc -o boot ; \ + else $(LD) $(LDFLAG) -M $(MAPFILE) $(FILES) $(LIBFM) -L$(CCSLIB) -dn -lc -o boot ; \ fi install: boot @@ -54,17 +54,17 @@ clobber: clean # boot.o: boot.c \ - $(INC)/sys/boot.h \ - $(INC)/sys/csr.h \ - $(INC)/sys/elog.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/id.h \ - $(INC)/sys/immu.h \ - $(INC)/sys/nvram.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/types.h \ - $(INC)/sys/dma.h \ - $(INC)/sys/psw.h \ - $(INC)/sys/fs/bfs.h \ - $(INC)/sys/fsiboot.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/csr.h \ + $(INCSYS)/sys/elog.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/id.h \ + $(INCSYS)/sys/immu.h \ + $(INCSYS)/sys/nvram.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/types.h \ + $(INCSYS)/sys/dma.h \ + $(INCSYS)/sys/psw.h \ + $(INCSYS)/sys/fs/bfs.h \ + $(INCSYS)/sys/fsiboot.h \ $(FRC) diff --git a/usr/src/uts/3b2/boot/boot/lbld b/usr/src/uts/3b2/boot/boot/lbld index 6f84faf..8bb1392 100644 --- a/usr/src/uts/3b2/boot/boot/lbld +++ b/usr/src/uts/3b2/boot/boot/lbld @@ -1,4 +1,4 @@ -/* #ident "@(#)boot:boot/boot/lbld 1.4" */ +/* #ident "@(#)boot:boot/boot/lbld 1.3" */ MEMORY { olbcode: origin = 0x0217a800, length = 0x3000 @@ -9,8 +9,15 @@ SECTIONS { .text: { stext = .; misc.o(.text) + *(.text) + *(.text1) } > olbcode - .data: {} > olbcode + .data: { + *(.data) + *(.data1) + *(.rodata) + *(.rodata1) + } > olbcode .bss: {} > olbbss .stack(NOLOAD): { diff --git a/usr/src/uts/3b2/boot/filledt/dcp/dcp.mk b/usr/src/uts/3b2/boot/filledt/dcp/dcp.mk index cb4fb1f..5411dc3 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/dcp.mk +++ b/usr/src/uts/3b2/boot/filledt/dcp/dcp.mk @@ -5,18 +5,19 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)boot:boot/filledt/dcp/dcp.mk 1.13" +#ident "@(#)boot:boot/filledt/dcp/dcp.mk 1.9" ROOT= -DIR=/$(ROOT) -INC=$(ROOT)/usr/include +DIR=$(ROOT) +LIB=$(ROOT)/lib +INCSYS=$(ROOT)/usr/include UINC=$(ROOT)/usr/include LINC=../com SINC=../.. INC_LIST =\ -I$(LINC)\ -I$(SINC)\ - -I$(INC)\ + -I$(INCSYS)\ -I$(UINC) @@ -40,36 +41,24 @@ all: filledt dgmon FL_OBJ = fillcntl.o edt_fill.o fillerror.o loc_cons.o setup.o syg.o \ fw_pump.o p_func.o -DG_OBJ = dcpcntl.o dgn.o dgnerror.o dumpsoak.o execphsz.o \ +DG_OBJ = data.o dcpcntl.o dgn.o dgnerror.o dumpsoak.o execphsz.o \ getdgn.o getnum.o initsoak.o parse.o ph_check.o \ ph_list.o setup.o soak.o soakrec.o p_func.o fw_pump.o filledt: ifile filledt.map $(FL_OBJ) if [ x$(CCSTYPE) = xCOFF ] ; \ then \ - $(LD) $(LDFLAGS) -o filledt $(FL_OBJ) ifile $(LIBFM) ; \ + $(LD) -o filledt $(FL_OBJ) ifile $(LIBFM) -L$(LIB) -lc ; \ else \ - $(LD) $(LDFLAGS) -o filledt $(FL_OBJ) -M filledt.map $(LIBFM) -dn ; \ + $(LD) -o filledt $(FL_OBJ) -M filledt.map $(LIBFM) -L$(CCSLIB) -dn -lc ; \ fi -dgmon: ifile.dgmon dgmon.map data.o dgdata.o $(DG_OBJ) $(LIBFM) +dgmon: ifile dgmon.map $(DG_OBJ) $(LIBFM) if [ x$(CCSTYPE) = xCOFF ] ; \ then \ - $(LD) $(LDFLAGS) -o dgmon $(DG_OBJ) dgdata.o ifile.dgmon $(LIBFM) ; \ + $(LD) -o dgmon $(DG_OBJ) ifile $(LIBFM) -L$(LIB) -lc ; \ else \ - $(LD) $(LDFLAGS) -o dgmon $(DG_OBJ) data.o -M dgmon.map $(LIBFM) -dn ; \ - fi - -data.o: data.s - if [ x$(CCSTYPE) != xCOFF ] ; \ - then \ - $(AS) data.s ; \ - fi - -dgdata.o: dgdata.s - if [ x$(CCSTYPE) = xCOFF ] ; \ - then \ - $(AS) dgdata.s ; \ + $(LD) -o dgmon $(DG_OBJ) -M dgmon.map $(LIBFM) -L$(LIB) -dn -lc ; \ fi install: all @@ -87,103 +76,103 @@ clobber: clean FRC: fillcntl.o: fillcntl.c \ - $(INC)/sys/boot.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/csr.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/iu.h \ - $(INC)/sys/sit.h \ - $(INC)/sys/edt.h \ - $(INC)/sys/iobd.h \ - $(INC)/sys/diagnostic.h \ - $(INC)/sys/dsd.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/csr.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/iu.h \ + $(INCSYS)/sys/sit.h \ + $(INCSYS)/sys/edt.h \ + $(INCSYS)/sys/iobd.h \ + $(INCSYS)/sys/diagnostic.h \ + $(INCSYS)/sys/dsd.h \ $(LINC)/edt_def.h \ $(FRC) edt_fill.o: edt_fill.c \ - $(INC)/sys/types.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/diagnostic.h \ - $(INC)/sys/edt.h \ - $(INC)/sys/firmware.h \ + $(INCSYS)/sys/types.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/diagnostic.h \ + $(INCSYS)/sys/edt.h \ + $(INCSYS)/sys/firmware.h \ $(LINC)/edt_def.h \ - $(INC)/sys/extbus.h \ - $(INC)/sys/boot.h \ + $(INCSYS)/sys/extbus.h \ + $(INCSYS)/sys/boot.h \ $(SINC)/sys/inode.h \ - $(INC)/sys/lboot.h \ - $(INC)/sys/dsd.h \ - $(INC)/sys/vtoc.h \ + $(INCSYS)/sys/lboot.h \ + $(INCSYS)/sys/dsd.h \ + $(INCSYS)/sys/vtoc.h \ $(FRC) fillerror.o: fillerror.c \ - $(INC)/sys/firmware.h \ - $(INC)/sys/edt.h \ - $(INC)/sys/diagnostic.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/edt.h \ + $(INCSYS)/sys/diagnostic.h \ $(FRC) loc_cons.o: loc_cons.c \ - $(INC)/sys/sbd.h \ - $(INC)/sys/iu.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/nvram.h \ - $(INC)/sys/edt.h \ - $(INC)/sys/dsd.h \ - $(INC)/sys/iobd.h \ - $(INC)/sys/diagnostic.h \ - $(INC)/sys/termio.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/iu.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/nvram.h \ + $(INCSYS)/sys/edt.h \ + $(INCSYS)/sys/dsd.h \ + $(INCSYS)/sys/iobd.h \ + $(INCSYS)/sys/diagnostic.h \ + $(INCSYS)/sys/termio.h \ $(FRC) setup.o: setup.c \ - $(INC)/sys/types.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/boot.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/diagnostic.h \ + $(INCSYS)/sys/types.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/diagnostic.h \ $(SINC)/sys/inode.h \ $(SINC)/sys/param.h \ - $(INC)/sys/extbus.h \ - $(INC)/sys/lboot.h \ - $(INC)/sys/id.h \ - $(INC)/sys/vtoc.h \ + $(INCSYS)/sys/extbus.h \ + $(INCSYS)/sys/lboot.h \ + $(INCSYS)/sys/id.h \ + $(INCSYS)/sys/vtoc.h \ $(FRC) syg.o: syg.c \ - $(INC)/sys/sbd.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/edt.h \ - $(INC)/sys/iobd.h \ - $(INC)/sys/diagnostic.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/edt.h \ + $(INCSYS)/sys/iobd.h \ + $(INCSYS)/sys/diagnostic.h \ $(LINC)/edt_def.h \ - $(INC)/sys/dsd.h \ - $(INC)/sys/boot.h \ + $(INCSYS)/sys/dsd.h \ + $(INCSYS)/sys/boot.h \ $(FRC) fw_pump.o: fw_pump.c \ - $(INC)/sys/types.h \ + $(INCSYS)/sys/types.h \ $(SINC)/sys/inode.h \ - $(INC)/a.out.h \ - $(INC)/sys/firmware.h \ + $(UINC)/a.out.h \ + $(INCSYS)/sys/firmware.h \ $(SINC)/sys/param.h \ - $(INC)/sys/lboot.h \ - $(INC)/sys/boot.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/csr.h \ - $(INC)/sys/cio_defs.h \ - $(INC)/sys/diagnostic.h \ - $(INC)/sys/iobd.h \ + $(INCSYS)/sys/lboot.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/csr.h \ + $(INCSYS)/sys/cio_defs.h \ + $(INCSYS)/sys/diagnostic.h \ + $(INCSYS)/sys/iobd.h \ $(FRC) p_func.o: p_func.c \ - $(INC)/sys/sbd.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/edt.h \ - $(INC)/sys/iobd.h \ - $(INC)/sys/diagnostic.h \ - $(INC)/sys/dsd.h \ - $(INC)/sys/boot.h \ - $(INC)/sys/csr.h \ - $(INC)/sys/iu.h \ - $(INC)/sys/sit.h \ - $(INC)/sys/cio_defs.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/edt.h \ + $(INCSYS)/sys/iobd.h \ + $(INCSYS)/sys/diagnostic.h \ + $(INCSYS)/sys/dsd.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/csr.h \ + $(INCSYS)/sys/iu.h \ + $(INCSYS)/sys/sit.h \ + $(INCSYS)/sys/cio_defs.h \ $(FRC) diff --git a/usr/src/uts/3b2/boot/filledt/dcp/edt_fill.c b/usr/src/uts/3b2/boot/filledt/dcp/edt_fill.c index b11ece2..29f3e43 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/edt_fill.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/edt_fill.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/edt_fill.c 1.7" +#ident "@(#)boot:boot/filledt/dcp/edt_fill.c 1.5" @@ -21,7 +21,6 @@ #include #include #include -#include @@ -383,9 +382,7 @@ xbusgen() } p = path; /* edtgen file */ - strcpy(p, edtname); - strcat(p, EDTP(i)->dev_name); - strcat(p, "/"); + strcat(strcat(strcpy(p, edtname), EDTP(i)->dev_name), "/"); strcat(p, gename); if ( findfile(p) == NOTFOUND){ @@ -432,7 +429,7 @@ long startsector,first,last; sect = PHYS_INFO[P_CMDQ->b_dev - HARDDISK0].logicalst; - sect += startsector; + sect += BOOTVTOC->v_part[7].p_start + startsector; mp =first; numsect = (last - first + (BSIZE-1))/BSIZE; diff --git a/usr/src/uts/3b2/boot/filledt/dcp/fw_pump.c b/usr/src/uts/3b2/boot/filledt/dcp/fw_pump.c index e3cdd82..f686f3d 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/fw_pump.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/fw_pump.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/fw_pump.c 1.4" +#ident "@(#)boot:boot/filledt/dcp/fw_pump.c 1.3" # include "sys/types.h" # include "sys/inode.h" @@ -181,7 +181,7 @@ if (answ[0] == 'y') P_CMDQ->b_dev = FLOPDISK; PRINTF("fhp = 0x%x, shp = 0x%x, fa = 0x%x, nsec = 0x%x\n",fhp,shp,fa,nsect); PRINTF("Section %s, paddr 0x%x, size 0x%x, flags 0x%x\n",shp->s_name,shp->s_paddr,shp->s_size,shp->s_flags); #endif - if (STRCMP(shp->s_name,".start") == 0) + if (strcmp(shp->s_name,".start") == 0) strtaddr = shp->s_paddr; /* Set start address to .start */ if((shp->s_flags & STYP_NOLOAD) != 0 || (shp->s_scnptr == 0)) { continue; diff --git a/usr/src/uts/3b2/boot/filledt/dcp/getdgn.c b/usr/src/uts/3b2/boot/filledt/dcp/getdgn.c index 9d361eb..a51959b 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/getdgn.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/getdgn.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/getdgn.c 1.3" +#ident "@(#)boot:boot/filledt/dcp/getdgn.c 1.2" /* routine to download standard and auxiliary files for diagnostics */ @@ -17,12 +17,12 @@ #include #include #include -#include extern void dgnerror(), sysreset(); extern struct edt edt[]; /* equipped device table structure */ extern char option[]; /* option (device) name for diag req */ +extern char *strcpy(), *strcat(); /* File Name variables */ @@ -38,8 +38,7 @@ int i; /* storage for return value from loadprog */ /* construct path name for auxiliary diagnostic file */ -strcpy(Dirname,"dgn/X."); -strcat(Dirname,filename); +(void) strcat(strcpy(Dirname,"dgn/X."),filename); /* find the inode for the auxiliary diagnostic file */ @@ -78,8 +77,7 @@ struct phtab *phptr; /* pointer to phase table */ unsigned char i; long fileaddr; /* address for data download */ -strcpy(Dirname,"dgn/X."); -strcat(Dirname,filename); +(void) strcat(strcpy(Dirname,"dgn/X."),filename); if ( findfile(Dirname) == NOTFOUND) { @@ -162,8 +160,7 @@ ld_sbd() { /* construct path name for diagnostic file in dgn directory */ -strcpy(Dirname,"dgn/"); -strcat(Dirname,filename); +(void) strcat(strcpy(Dirname,"dgn/"),filename); /* find the inode for the diagnostic file */ diff --git a/usr/src/uts/3b2/boot/filledt/dcp/getnum.c b/usr/src/uts/3b2/boot/filledt/dcp/getnum.c index 9c493ab..56553ec 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/getnum.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/getnum.c @@ -5,13 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/getnum.c 1.3" +#ident "@(#)boot:boot/filledt/dcp/getnum.c 1.2" #include #include #include -#include -#include /* This function scans for the board and option number in the EDT. @@ -23,6 +21,7 @@ extern struct edt edt[]; /* equipped device table */ extern void dgnerror(); extern char option[]; /* option name from input parser */ +extern char *strcpy(); extern unsigned char optno; /* option number from input parser */ extern unsigned char opt_type; /* flag to diagnose option type */ extern char filename[]; /* diagnostic phase file name */ @@ -37,7 +36,7 @@ unsigned char dev_match; /* device type match flag */ /* copy EDT phase file name for or DGN all */ if (!STRCMP(option,"\0")) - strcpy(filename,EDTP(*board)->diag_file); + (void) strcpy(filename,EDTP(*board)->diag_file); /* search for match of device ( & number) */ @@ -52,7 +51,7 @@ unsigned char dev_match; /* device type match flag */ /* do device and request numbers match? */ if ((EDTP(*board)->opt_num) == optno) { - strcpy(filename,(EDTP(*board)->diag_file)); + (void) strcpy(filename,(EDTP(*board)->diag_file)); break; } } diff --git a/usr/src/uts/3b2/boot/filledt/dcp/ifile b/usr/src/uts/3b2/boot/filledt/dcp/ifile index 910acab..e794292 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/ifile +++ b/usr/src/uts/3b2/boot/filledt/dcp/ifile @@ -1,4 +1,4 @@ -/* #ident "@(#)boot:boot/filledt/dcp/ifile 1.4" */ +/* #ident "@(#)boot:boot/filledt/dcp/ifile 1.3" */ MEMORY { CONTROL: origin = 0x2024000, length = 0x9000 @@ -6,7 +6,12 @@ MEMORY { SECTIONS { .text: { } > CONTROL - .data: { } > CONTROL + .data: { + *(.data) + *(.data1) + *(.rodata) + *(.rodata1) + } > CONTROL .bss: { } > CONTROL } diff --git a/usr/src/uts/3b2/boot/filledt/dcp/ifile.dgmon b/usr/src/uts/3b2/boot/filledt/dcp/ifile.dgmon index 0bed7c1..db69a88 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/ifile.dgmon +++ b/usr/src/uts/3b2/boot/filledt/dcp/ifile.dgmon @@ -1,15 +1,17 @@ -/* #ident "@(#)boot:boot/filledt/dcp/ifile.dgmon 1.2" */ +/* #ident "@(#)boot:boot/filledt/dcp/ifile.dgmon 1.1" */ MEMORY { CONTROL: origin = 0x2004480, length = 0x7B80 - BUFFERS: origin = 0x2304000, length = 0x100000 } SECTIONS { - .text: { } > CONTROL - .data: { } > CONTROL - .bss: { } > CONTROL - - .buffers: { } > BUFFERS + .text: { } > CONTROL + .data: { + *(.data) + *(.data1) + *(.rodata) + *(.rodata1) + } > CONTROL + .bss: { } > CONTROL } diff --git a/usr/src/uts/3b2/boot/filledt/dcp/loc_cons.c b/usr/src/uts/3b2/boot/filledt/dcp/loc_cons.c index bdcdca4..1878835 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/loc_cons.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/loc_cons.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/loc_cons.c 1.3" +#ident "@(#)boot:boot/filledt/dcp/loc_cons.c 1.2" @@ -30,7 +30,6 @@ #include #include #include -#include extern unsigned char Dirname[]; extern unsigned char filename[]; diff --git a/usr/src/uts/3b2/boot/filledt/dcp/parse.c b/usr/src/uts/3b2/boot/filledt/dcp/parse.c index bb44836..5fcadbd 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/parse.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/parse.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/parse.c 1.3" +#ident "@(#)boot:boot/filledt/dcp/parse.c 1.2" /* Function to parse up the input request and fill in the structure * request as defined in diagnostic.h. @@ -187,8 +187,7 @@ option[0] = '\0'; /* convert options to upper case */ for(temp_ptr=buff;*temp_ptr!= '\0';temp_ptr++) - if (*temp_ptr >= 'a' && *temp_ptr <= 'z') - *temp_ptr -= 'a' - 'A'; + *temp_ptr=toupper(*temp_ptr); /* check for DGN, H or Q request in first token */ if (*buff != '\0') { diff --git a/usr/src/uts/3b2/boot/filledt/dcp/ph_list.c b/usr/src/uts/3b2/boot/filledt/dcp/ph_list.c index be4b592..43eb7af 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/ph_list.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/ph_list.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/ph_list.c 1.3" +#ident "@(#)boot:boot/filledt/dcp/ph_list.c 1.2" /* 3b2 Phase Table List Program */ @@ -13,8 +13,6 @@ #include #include #include -#include -#include extern void dgnerror(), sysreset(); diff --git a/usr/src/uts/3b2/boot/filledt/dcp/setup.c b/usr/src/uts/3b2/boot/filledt/dcp/setup.c index 4d85d82..c6ec074 100644 --- a/usr/src/uts/3b2/boot/filledt/dcp/setup.c +++ b/usr/src/uts/3b2/boot/filledt/dcp/setup.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/filledt/dcp/setup.c 1.5" +#ident "@(#)boot:boot/filledt/dcp/setup.c 1.4" /* @@ -24,7 +24,6 @@ #include #include #include -#include extern struct inode Dinode; /* inode of file system root directory */ extern struct inode Fndinode; /* inode of file found by findfile() */ @@ -38,6 +37,7 @@ extern int fstype; /* file system block size */ #define MYVTOC ((struct vtoc *)(BOOTADDR + BLKSIZE)) #define MYPDINFO ((struct pdinfo *)(BOOTADDR + 2 * BLKSIZE)) +extern char *strcpy(), *strcat(); extern char IOBASE[]; /* base i/o buffer */ extern char IND3[]; /* 3rd level indirect block */ extern char DATA[]; /* a data block */ @@ -319,8 +319,7 @@ if (slot != 0 && FL_CONS->cons_found == ON } /* construct pump file path name */ - strcpy(Dirname,"dgn/C."); - strcat(Dirname,EDTP(OPTION)->dev_name); + (void) strcat(strcpy(Dirname,"dgn/C."),EDTP(OPTION)->dev_name); if (EDTP(OPTION)->cons_file == ON && fw_pump(slot,Dirname) == FAIL) { diff --git a/usr/src/uts/3b2/boot/mboot/mbld b/usr/src/uts/3b2/boot/mboot/mbld index 6a1f37a..a56e186 100644 --- a/usr/src/uts/3b2/boot/mboot/mbld +++ b/usr/src/uts/3b2/boot/mboot/mbld @@ -1,4 +1,4 @@ -/* #ident "@(#)boot:boot/mboot/mbld 11.3" */ +/* #ident "@(#)boot:boot/mboot/mbld 11.2" */ /* mboot.b loader instruction file */ @@ -9,6 +9,9 @@ MEMORY { SECTIONS { .text: { } > mbcode .data: { } > mbcode + .data1: { } > mbcode + .rodata: { } > mbcode + .rodata1: { } > mbcode .bss: { } > mbbss } mboot.o diff --git a/usr/src/uts/3b2/boot/mboot/mboot.mk b/usr/src/uts/3b2/boot/mboot/mboot.mk index 6583e78..2fc1b70 100644 --- a/usr/src/uts/3b2/boot/mboot/mboot.mk +++ b/usr/src/uts/3b2/boot/mboot/mboot.mk @@ -5,13 +5,14 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)boot:boot/mboot/mboot.mk 11.7" +#ident "@(#)boot:boot/mboot/mboot.mk 11.4" ROOT = -INC = $(ROOT)/usr/include +LIB = $(ROOT)/lib +INCSYS = $(ROOT)/usr/include INCLOC = .. DASHO = -O -CFLAGS = $(DASHO) -I$(INCLOC) -I$(INC) +CFLAGS = $(DASHO) -I$(INCLOC) -I$(INCSYS) SIZE = size DIS = dis NM = nm @@ -20,7 +21,7 @@ CONV = conv INS = install SYMLINK = : -LDFLAGS = +LDFLAG = FRC = all: mboot @@ -37,9 +38,9 @@ mboot: mboot.map\ $(FRC) if [ x$(CCSTYPE) = xCOFF ] ; \ then \ - $(LD) $(LDFLAGS) mbld mboot.o -o mboot ; \ + $(LD) $(LDFLAG) mbld mboot.o -o mboot -L$(LIB) -lc ; \ else \ - $(LD) $(LDFLAGS) -Mmboot.map mboot.o -o mboot -dn ; \ + $(LD) $(LDFLAG) -Mmboot.map mboot.o -o mboot -L$(CCSLIB) -dn -lc ; \ fi clean: @@ -61,9 +62,9 @@ FRC: # mboot.o: mboot.c \ - $(INC)/sys/boot.h \ - $(INC)/sys/firmware.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/firmware.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/types.h \ - $(INC)/sys/vtoc.h \ + $(INCSYS)/sys/types.h \ + $(INCSYS)/sys/vtoc.h \ $(FRC) diff --git a/usr/src/uts/3b2/boot/olboot/basicio.c b/usr/src/uts/3b2/boot/olboot/basicio.c index eab5956..1ec7d75 100644 --- a/usr/src/uts/3b2/boot/olboot/basicio.c +++ b/usr/src/uts/3b2/boot/olboot/basicio.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/olboot/basicio.c 11.10" +#ident "@(#)boot:boot/olboot/basicio.c 11.9" #include "sys/param.h" #include "sys/types.h" @@ -390,25 +390,11 @@ int numbytes; long nbytes,size,sbyte; char *mem,*bp; int tc, i; - int fssize; /* - **PRINTF("debug: reading %x %x %x %x bytes\n",ip, offset, buf,numbytes); + PRINTF("debug: reading %x %x %x %x bytes\n",ip, offset, buf,numbytes); */ - switch(fstype) { - case Fs4b: - fssize = (SECTSIZE * 4); - break; - case Fs2b: - fssize = (SECTSIZE * 2); - break; - case Fs1b: - default: - fssize = SECTSIZE; - break; - } - mem= (char *)buf; size = numbytes; @@ -417,11 +403,11 @@ int numbytes; * read in the entire sector and copy part of it to memory. */ - if ((offset % fssize) != 0){ - nbytes = fssize - (offset % fssize); + if ((offset % SECTSIZE) != 0){ + nbytes = SECTSIZE - (offset % SECTSIZE); if (nbytes > size) nbytes = size; - sbyte = offset % fssize; + sbyte = offset % SECTSIZE; bp = DATA + sbyte; if (!rb((paddr_t)&DATA, offset, ip)) return(CFAIL); @@ -437,7 +423,7 @@ int numbytes; * and copy part of it. */ - if (size < fssize){ + if (size < SECTSIZE){ if (!rb((paddr_t)&DATA, offset, ip)) return(CFAIL); tc = FsBSIZE(fstype) - (offset % FsBSIZE(fstype)); @@ -449,12 +435,12 @@ int numbytes; /* Now attempt to read in all the whole sectors */ - while (size >= fssize) { + while (size >= SECTSIZE) { if (!rb((paddr_t)mem, offset, ip)) return(CFAIL); - size -= fssize; - mem += fssize; - offset += fssize; + size -= SECTSIZE; + mem += SECTSIZE; + offset += SECTSIZE; } } return(CPASS); diff --git a/usr/src/uts/3b2/boot/olboot/lbld b/usr/src/uts/3b2/boot/olboot/lbld index 8d73ee4..b148696 100644 --- a/usr/src/uts/3b2/boot/olboot/lbld +++ b/usr/src/uts/3b2/boot/olboot/lbld @@ -1,4 +1,4 @@ -/* #ident "@(#)boot:boot/olboot/lbld 11.7" */ +/* #ident "@(#)boot:boot/olboot/lbld 11.6" */ MEMORY { olbcode: origin = 0x0217a800, length = 0x3000 @@ -9,8 +9,15 @@ SECTIONS { .text: { stext = .; misc.o(.text) + *(.text) + *(.text1) } > olbcode - .data: {} > olbcode + .data: { + *(.data) + *(.data1) + *(.rodata) + *(.rodata1) + } > olbcode .bss: {} > olbbss .stack(NOLOAD): { diff --git a/usr/src/uts/3b2/boot/olboot/lboot.c b/usr/src/uts/3b2/boot/olboot/lboot.c index 41ec21a..03623e9 100644 --- a/usr/src/uts/3b2/boot/olboot/lboot.c +++ b/usr/src/uts/3b2/boot/olboot/lboot.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/olboot/lboot.c 11.11" +#ident "@(#)boot:boot/olboot/lboot.c 11.10" #include "sys/types.h" #include "sys/psw.h" @@ -28,7 +28,6 @@ #include "sys/immu.h" #include "sys/nvram.h" #include "sys/vtoc.h" -#include "sys/inline.h" extern lls(); diff --git a/usr/src/uts/3b2/boot/olboot/loadprog.c b/usr/src/uts/3b2/boot/olboot/loadprog.c index cba5ac2..e6199cb 100644 --- a/usr/src/uts/3b2/boot/olboot/loadprog.c +++ b/usr/src/uts/3b2/boot/olboot/loadprog.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)boot:boot/olboot/loadprog.c 11.14" +#ident "@(#)boot:boot/olboot/loadprog.c 11.13" #include "sys/param.h" #include "sys/types.h" @@ -25,7 +25,6 @@ #include "a.out.h" #include "sys/elftypes.h" #include "sys/elf.h" -#include "sys/inline.h" /* @@ -238,7 +237,7 @@ do_edt() char buffer[40]; - if (!STRCMP(s3bc->name, "SBD")) + if (!strcmp(s3bc->name, "SBD")) { if (s3bc->timestamp > SIZOFMEM) { @@ -405,7 +404,7 @@ xconfirm() */ for (i=0; icount; ++i){ s3bc = &sys3bconfig->driver[i]; - if (0 != STRCMP(xtcp->name,s3bc->name) + if (0 != strcmp(xtcp->name,s3bc->name) || s3bc->flag & S3BC_IGN) continue; diff --git a/usr/src/uts/3b2/boot/olboot/olboot.mk b/usr/src/uts/3b2/boot/olboot/olboot.mk index f03148d..bc5903e 100644 --- a/usr/src/uts/3b2/boot/olboot/olboot.mk +++ b/usr/src/uts/3b2/boot/olboot/olboot.mk @@ -5,14 +5,15 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)boot:boot/olboot/olboot.mk 11.17" +#ident "@(#)boot:boot/olboot/olboot.mk 11.13" ROOT = -INC = $(ROOT)/usr/include +LIB = $(ROOT)/lib +INCSYS = $(ROOT)/usr/include UINC = $(ROOT)/usr/include INCLOC = .. DASHO = -O -CFLAGS = $(DASHO) -I$(INCLOC) -I$(INC) -I$(UINC) $(DBO) +CFLAGS = $(DASHO) -I$(INCLOC) -I$(INCSYS) -I$(UINC) $(DBO) STRIP = strip LIBNAME = libfm.a INS = install @@ -52,16 +53,15 @@ olboot: lbld\ misc.o\ lboot.o\ loadprog.o\ - ../boot/strncat.o\ $(LIBNAME)\ $(FRC) if [ x$(CCSTYPE) = xCOFF ] ; \ then \ - $(LD) $(LDFLAGS) lbld misc.o lboot.o loadprog.o \ - ../boot/strncat.o -o olboot $(LIBNAME) ; \ + $(LD) $(LDFLAG) lbld misc.o lboot.o loadprog.o \ + -o olboot $(LIBNAME) -L$(LIB) -lc ; \ else \ - $(LD) $(LDFLAGS) -M olboot.map misc.o lboot.o loadprog.o \ - ../boot/strncat.o -o olboot $(LIBNAME) -dn ; \ + $(LD) $(LDFLAG) -M olboot.map misc.o lboot.o loadprog.o \ + -o olboot $(LIBNAME) -L$(CCSLIB) -dn -lc ; \ fi flboot: lbld\ @@ -69,16 +69,15 @@ flboot: lbld\ misc.o\ flboot.o\ loadprog.o\ - ../boot/strncat.o\ $(LIBNAME)\ $(FRC) if [ x$(CCSTYPE) = xCOFF ] ; \ then \ - $(LD) $(LDFLAGS) lbld misc.o flboot.o loadprog.o \ - ../boot/strncat.o -o flboot $(LIBNAME) ; \ + $(LD) $(LDFLAG) lbld misc.o flboot.o loadprog.o \ + -o flboot $(LIBNAME) -L$(LIB) -lc ; \ else \ - $(LD) $(LDFLAGS) -M olboot.map misc.o flboot.o loadprog.o \ - ../boot/strncat.o -o flboot $(LIBNAME) -dn ; \ + $(LD) $(LDFLAG) -M olboot.map misc.o flboot.o loadprog.o \ + -o flboot $(LIBNAME) -L$(CCSLIB) -dn -lc ; \ fi $(LIBNAME): $(LFILES) @@ -107,144 +106,144 @@ FRC: # lboot.o: lboot.c \ - $(INC)/a.out.h \ - $(INC)/aouthdr.h \ - $(INC)/filehdr.h \ - $(INC)/linenum.h \ - $(INC)/nlist.h \ - $(INC)/reloc.h \ - $(INC)/scnhdr.h \ - $(INC)/storclass.h \ - $(INC)/syms.h \ - $(INC)/sys/boot.h \ - $(INC)/sys/csr.h \ - $(INC)/sys/elog.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/id.h \ - $(INC)/sys/immu.h \ + $(UINC)/a.out.h \ + $(UINC)/aouthdr.h \ + $(UINC)/filehdr.h \ + $(UINC)/linenum.h \ + $(UINC)/nlist.h \ + $(UINC)/reloc.h \ + $(UINC)/scnhdr.h \ + $(UINC)/storclass.h \ + $(UINC)/syms.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/csr.h \ + $(INCSYS)/sys/elog.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/id.h \ + $(INCSYS)/sys/immu.h \ $(INCLOC)/sys/inode.h \ $(INCLOC)/sys/iobuf.h \ - $(INC)/sys/lboot.h \ - $(INC)/sys/nvram.h \ + $(INCSYS)/sys/lboot.h \ + $(INCSYS)/sys/nvram.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/types.h \ - $(INC)/sys/psw.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/types.h \ + $(INCSYS)/sys/psw.h \ $(FRC) flboot.o: flboot.c \ - $(INC)/a.out.h \ - $(INC)/aouthdr.h \ - $(INC)/filehdr.h \ - $(INC)/linenum.h \ - $(INC)/nlist.h \ - $(INC)/reloc.h \ - $(INC)/scnhdr.h \ - $(INC)/storclass.h \ - $(INC)/syms.h \ - $(INC)/sys/boot.h \ - $(INC)/sys/csr.h \ - $(INC)/sys/elog.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/id.h \ - $(INC)/sys/immu.h \ + $(UINC)/a.out.h \ + $(UINC)/aouthdr.h \ + $(UINC)/filehdr.h \ + $(UINC)/linenum.h \ + $(UINC)/nlist.h \ + $(UINC)/reloc.h \ + $(UINC)/scnhdr.h \ + $(UINC)/storclass.h \ + $(UINC)/syms.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/csr.h \ + $(INCSYS)/sys/elog.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/id.h \ + $(INCSYS)/sys/immu.h \ $(INCLOC)/sys/inode.h \ $(INCLOC)/sys/iobuf.h \ - $(INC)/sys/lboot.h \ - $(INC)/sys/nvram.h \ + $(INCSYS)/sys/lboot.h \ + $(INCSYS)/sys/nvram.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/types.h \ - $(INC)/sys/psw.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/types.h \ + $(INCSYS)/sys/psw.h \ $(FRC) $(LIBNAME)(basicio.o): basicio.c \ - $(INC)/sys/boot.h \ - $(INC)/sys/elog.h \ - $(INC)/sys/firmware.h \ - $(INC)/sys/ino.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/elog.h \ + $(INCSYS)/sys/firmware.h \ + $(INCSYS)/sys/ino.h \ $(INCLOC)/sys/inode.h \ $(INCLOC)/sys/iobuf.h \ - $(INC)/sys/lboot.h \ + $(INCSYS)/sys/lboot.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/sysmacros.h \ - $(INC)/sys/types.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/psw.h \ - $(INC)/sys/immu.h \ - $(INC)/sys/nvram.h \ + $(INCSYS)/sys/sysmacros.h \ + $(INCSYS)/sys/types.h \ + $(INCSYS)/sys/sbd.h \ + $(INCSYS)/sys/psw.h \ + $(INCSYS)/sys/immu.h \ + $(INCSYS)/sys/nvram.h \ $(FRC) $(LIBNAME)(findfile.o): findfile.c \ $(INCLOC)/sys/dir.h \ - $(INC)/sys/firmware.h \ + $(INCSYS)/sys/firmware.h \ $(INCLOC)/sys/inode.h \ - $(INC)/sys/lboot.h \ + $(INCSYS)/sys/lboot.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/types.h \ + $(INCSYS)/sys/types.h \ $(FRC) $(LIBNAME)(findfs.o): findfs.c \ - $(INC)/sys/boot.h \ - $(INC)/sys/elog.h \ + $(INCSYS)/sys/boot.h \ + $(INCSYS)/sys/elog.h \ $(INCLOC)/sys/filsys.h \ - $(INC)/sys/firmware.h \ + $(INCSYS)/sys/firmware.h \ $(INCLOC)/sys/inode.h \ $(INCLOC)/sys/iobuf.h \ - $(INC)/sys/lboot.h \ + $(INCSYS)/sys/lboot.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/types.h \ + $(INCSYS)/sys/types.h \ $(FRC) $(LIBNAME)(loadfile.o): loadfile.c \ - $(INC)/a.out.h \ - $(INC)/aouthdr.h \ - $(INC)/filehdr.h \ - $(INC)/linenum.h \ - $(INC)/nlist.h \ - $(INC)/reloc.h \ - $(INC)/scnhdr.h \ - $(INC)/storclass.h \ - $(INC)/syms.h \ - $(INC)/sys/firmware.h \ + $(UINC)/a.out.h \ + $(UINC)/aouthdr.h \ + $(UINC)/filehdr.h \ + $(UINC)/linenum.h \ + $(UINC)/nlist.h \ + $(UINC)/reloc.h \ + $(UINC)/scnhdr.h \ + $(UINC)/storclass.h \ + $(UINC)/syms.h \ + $(INCSYS)/sys/firmware.h \ $(INCLOC)/sys/inode.h \ - $(INC)/sys/lboot.h \ + $(INCSYS)/sys/lboot.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/types.h \ + $(INCSYS)/sys/types.h \ $(FRC) $(LIBNAME)(oloadp.o): oloadp.c \ - $(INC)/a.out.h \ - $(INC)/aouthdr.h \ - $(INC)/filehdr.h \ - $(INC)/linenum.h \ - $(INC)/nlist.h \ - $(INC)/reloc.h \ - $(INC)/scnhdr.h \ - $(INC)/storclass.h \ - $(INC)/syms.h \ - $(INC)/sys/firmware.h \ + $(UINC)/a.out.h \ + $(UINC)/aouthdr.h \ + $(UINC)/filehdr.h \ + $(UINC)/linenum.h \ + $(UINC)/nlist.h \ + $(UINC)/reloc.h \ + $(UINC)/scnhdr.h \ + $(UINC)/storclass.h \ + $(UINC)/syms.h \ + $(INCSYS)/sys/firmware.h \ $(INCLOC)/sys/inode.h \ - $(INC)/sys/lboot.h \ + $(INCSYS)/sys/lboot.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/types.h \ + $(INCSYS)/sys/types.h \ $(FRC) loadprog.o: loadprog.c \ - $(INC)/a.out.h \ - $(INC)/aouthdr.h \ - $(INC)/filehdr.h \ - $(INC)/linenum.h \ - $(INC)/nlist.h \ - $(INC)/reloc.h \ - $(INC)/scnhdr.h \ - $(INC)/storclass.h \ - $(INC)/syms.h \ - $(INC)/sys/firmware.h \ + $(UINC)/a.out.h \ + $(UINC)/aouthdr.h \ + $(UINC)/filehdr.h \ + $(UINC)/linenum.h \ + $(UINC)/nlist.h \ + $(UINC)/reloc.h \ + $(UINC)/scnhdr.h \ + $(UINC)/storclass.h \ + $(UINC)/syms.h \ + $(INCSYS)/sys/firmware.h \ $(INCLOC)/sys/inode.h \ - $(INC)/sys/lboot.h \ + $(INCSYS)/sys/lboot.h \ $(INCLOC)/sys/param.h \ - $(INC)/sys/types.h \ + $(INCSYS)/sys/types.h \ $(FRC) misc.o: misc.s \ diff --git a/usr/src/uts/3b2/debug/prtabs.c b/usr/src/uts/3b2/debug/prtabs.c index 3cf638a..19a3251 100644 --- a/usr/src/uts/3b2/debug/prtabs.c +++ b/usr/src/uts/3b2/debug/prtabs.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)debug:debug/prtabs.c 1.26" +#ident "@(#)debug:debug/prtabs.c 1.21" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" @@ -31,7 +31,7 @@ #include "vm/seg_vn.h" #include "vm/anon.h" -char prtabs_buf[300]; +char prtabs_buf[200]; char *prproc_hdg = " SLOT ADDR PID PPID STATUS WCHAN FLAGS \tCMD\n\n"; @@ -89,59 +89,42 @@ char *prproc_flgs[] = { }; int prproc_flgs_sz = sizeof(prproc_flgs) / sizeof(char *); -int -procinval(paddr) - register proc_t *paddr; -{ - register proc_t *p; - - for (p = practive; ; p = p->p_next) { - if (p == NULL) { - cmn_err(CE_CONT, "^%x is not a proc table address\n", - paddr); - return -1; - } - if (p == paddr) - return 0; - } -} - printprocs() { - register proc_t *pp; + register proc_t **pp; register int lc; - int i; register user_t *up; int winaddr_save; char buf[20]; + int slot; cmn_err(CE_CONT, "^%s", prproc_hdg); - for (i = 0; i < v.v_proc; i++) { - if ((pp = pid_entry(i)) == NULL) + for (slot = 0, pp = &nproc[0] ; pp < v.ve_proc ; slot++, pp++) { + if (*pp == NULL || (*pp)->p_stat == 0) continue; - sprintf(prtabs_buf, " %3d %.8x ", pp->p_slot, pp); - sprintf(buf, "%4d ", pp->p_pid); + sprintf(prtabs_buf, " %3d %.8x ", slot, *pp); + sprintf(buf, "%4d ", (*pp)->p_pid); strcat(prtabs_buf, buf); - sprintf(buf, "%4d ", pp->p_ppid); + sprintf(buf, "%4d ", (*pp)->p_ppid); strcat(prtabs_buf, buf); - strcat(prtabs_buf, prproc_stat[pp->p_stat]); + strcat(prtabs_buf, prproc_stat[(*pp)->p_stat]); - sprintf(buf, "%.8x ", pp->p_wchan); + sprintf(buf, "%.8x ", (*pp)->p_wchan); strcat(prtabs_buf, buf); for (lc = 0 ; lc < prproc_flgs_sz ; lc++) { - if (pp->p_flag & (1 << lc)) + if ((*pp)->p_flag & (1 << lc)) strcat(prtabs_buf, prproc_flgs[lc]); } - if (pp->p_stat == SZOMB || pp->p_stat == SIDL) { + if ((*pp)->p_stat == SZOMB || (*pp)->p_stat == SIDL) { cmn_err(CE_CONT, "^%s\n", prtabs_buf); continue; } - if (pp->p_flag & SULOAD) { - up = (user_t *)KUSER(pp->p_segu); + if ((*pp)->p_flag & SULOAD) { + up = (user_t *)KUSER((*pp)->p_segu); cmn_err(CE_CONT, "^%s\t%s\n", prtabs_buf, up->u_psargs); } else cmn_err(CE_CONT, "^%s\tSWAPPED\n", prtabs_buf); @@ -345,7 +328,10 @@ register uint adr; sprintf(prtabs_buf, "pte at %#x: ", pt, *(int *)pt); cmn_err(CE_CONT, "^%s", prtabs_buf); - cmn_err(CE_CONT, "^TAG %x ", pt->pgm.pg_tag); + if(pt->pgm.pg_lock) + cmn_err(CE_CONT, "^LK "); + if(pt->pgm.pg_ndref) + cmn_err(CE_CONT, "^NR "); if(pt->pgm.pg_ref) cmn_err(CE_CONT, "^R "); if(pt->pgm.pg_w) @@ -415,7 +401,7 @@ u_int pt; /* * Must be a kernel page table. */ - if ((pt >= (u_int)ksegmappt) && (pt < (u_int)eksegmappt)) { + if ((pt >= (u_int)ksegmappt) && (pt < (u_int)ksegupt)) { secseg = (SCN1 << 14) | ((SEGNUM(kvsegmap) + (((pt - (u_int)ksegmappt) >> 9))) << 1); @@ -440,7 +426,8 @@ u_int pt; return; } - ptd = (struct ptdat *)(pp->p_ptdats) + (((u_int)pt >> 9) & 3); + ptd = (pp->p_ptdats) + (((u_int)pt >> 9) & 3); + /* LINTED */ if (ptd->pt_addr == ((paddr_t)pt & ~255)) { cmn_err(CE_CONT, "pte belongs to a free page table: addr %x pp %x\n", ptd->pt_addr, @@ -454,19 +441,20 @@ u_int pt; ((ptd->pt_secseg << 16) | (pagnum << PNUMSHFT)) ); dodmddelay(); - { - register proc_t *p; - - cmn_err(CE_CONT, "proc:"); - - for (p = practive; p != NULL; p = p->p_next) { - if (p->p_as != ptd->pt_as) - continue; - cmn_err(CE_CONT, " %x", p); - } - cmn_err(CE_CONT, "\n"); - } - + { + register proc_t **pp; + int slot; + + cmn_err(CE_CONT, "proc:"); + slot = 0; + pp = &nproc[0] ; + for ( ; pp < v.ve_proc ; slot++, pp++) { + if (*pp == NULL || (*pp)->p_as != ptd->pt_as) + continue; + cmn_err(CE_CONT, " %x", *pp); + } + cmn_err(CE_CONT, "\n"); + } } } dodmddelay(); @@ -480,6 +468,7 @@ int arg; extern proc_t *curproc; proc_t **argptr; int argc; + int j, flag; argc = argcount(); /* get num of args */ argptr = (proc_t **) &arg; /* get ptr to first arg */ @@ -498,9 +487,25 @@ int arg; argc = 1; } - if (procinval(paddr)) - return; - + /* + Validate the proc table address + */ + + if ((proc_t **)paddr >= nproc && (proc_t **)paddr < v.ve_proc) + paddr = *((proc_t **)paddr); + else + if ((paddr != curproc) && (paddr != opaddr)) { + flag = 0; + for (j = 0; j < v.v_proc ; j++) + if (paddr == nproc[j]) { + ++flag; + break; + } + if (flag == 0) { + cmn_err(CE_CONT, "^%x is not a nproc table address\n", paddr); + return; + } + } opaddr = paddr; if (paddr->p_as == (struct as *)NULL) cmn_err(CE_CONT, "^process has no as\n"); @@ -725,6 +730,7 @@ int arg; extern proc_t *curproc; proc_t **argptr; int argc; + int j, flag; argc = argcount(); /* get num of args */ argptr = (proc_t **) &arg; /* get ptr to first arg */ @@ -741,9 +747,24 @@ int arg; argc = 1; } - if (procinval(paddr)) - return; - + /* + Validate the proc table address + */ + if ((proc_t **)paddr >= nproc && (proc_t **)paddr < v.ve_proc) + paddr = *((proc_t **)paddr); + else + if ((paddr != curproc) && (paddr != opaddr)) { + flag = 0; + for (j = 0; j < v.v_proc ; j++) + if (paddr == nproc[j]) { + ++flag; + break; + } + if (flag == 0) { + cmn_err(CE_CONT, "^%x is not a nproc table address\n", paddr); + return; + } + } opaddr = paddr; if (paddr->p_as == (struct as *)NULL) cmn_err(CE_CONT, "^process has no as\n"); @@ -782,11 +803,14 @@ struct as *asp; ckall() { - register proc_t *p; + register proc_t **pp; + char buf[20]; + int slot; - for (p = practive; p != NULL; p = p->p_next) - if (p->p_as != NULL) - ckp(p); + for (slot=0, pp=&nproc[0] ; pp < v.ve_proc ; slot++, pp++) { + if (*pp != NULL && (*pp)->p_as != NULL) + ckp(*pp); + } } ckp(pp) diff --git a/usr/src/uts/3b2/debug/trace.c b/usr/src/uts/3b2/debug/trace.c index 3948d34..b20f4c4 100644 --- a/usr/src/uts/3b2/debug/trace.c +++ b/usr/src/uts/3b2/debug/trace.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)debug:debug/trace.c 1.14" +#ident "@(#)debug:debug/trace.c 1.10" #include "sys/types.h" #include "sys/sysmacros.h" #include "sys/param.h" @@ -26,9 +26,8 @@ #define MAXARGS 20 -int debugtrace = 0; -char tracebuf[320]; -char debugbuf[320]; +int debugtrace; +char tracebuf[200]; char *s3blookup(); int strcmp(); @@ -40,14 +39,16 @@ int arg; extern proc_t *curproc; proc_t **argptr; int argc; + int j, flag; - argc = argcount(); /* get num of args */ - argptr = (proc_t **) &arg; /* get ptr to first arg */ + argc = argcount(); /* get num of args */ + argptr = (proc_t **) &arg; /* get ptr to first arg */ do { - if (argc != 0) { + if (argc != 0) paddr = *argptr++; - } else { + + else { if (opaddr == NULL) { cmn_err(CE_CONT, "^No proc addr set yet\n"); return; @@ -57,17 +58,35 @@ int arg; argc = 1; } - if (procinval(paddr)) - return; - + /* + Validate the proc table address + */ + + if ((proc_t **)paddr >= nproc && (proc_t **)paddr < v.ve_proc) { + paddr = *((proc_t **)paddr); + } else { + if ((paddr != curproc) && (paddr != opaddr)) { + flag = 0; + for (j = 0; j < v.v_proc ; j++) + if (paddr == nproc[j]) { + ++flag; + break; + } + if (flag == 0) { + cmn_err(CE_CONT, "^%x is not a proc table address\n", paddr); + return; + } + } + } opaddr = paddr; - if (paddr->p_stat == 0 || paddr->p_stat == SIDL || - paddr->p_stat == SZOMB) + if (paddr->p_stat == 0 || paddr->p_stat == SIDL + || paddr->p_stat == SZOMB) cmn_err(CE_CONT, "^Inactive Process\n"); else if ((paddr->p_flag & SULOAD) == 0) cmn_err(CE_CONT, "^Process was swapped out\n"); - else + else { dotrace(paddr); + } if (argc > 1) cmn_err(CE_CONT, "^-------------------------------------------------------------------------------\n\n"); @@ -76,72 +95,88 @@ int arg; } dotrace(pp) - register proc_t *pp; +register proc_t *pp; { + register uint oldubptbl; + register sde_t *sdep; extern proc_t *curproc; - register struct user *uptr; - register u_int stack_base; - register u_int stack_copy; - register u_int pcbaddr; - - cmn_err(CE_CONT, "^Procp: %x\n\n", pp); - - if (pp != curproc) { - uptr = (struct user *)(pp->p_segu); - stack_base = (u_int)0xc0000000; - stack_copy = (u_int)uptr; - pcbaddr = (u_int)uptr + - ((u_int)uptr->u_pcbp - (u_int)0xc0000000); + if(pp == curproc){ + oldubptbl = NULL; } else { - uptr = (struct user *)&u; - stack_base = 0; - stack_copy = 0; - pcbaddr = (u_int)uptr->u_pcbp; + sdep = (sde_t *)*(srama + 3); + oldubptbl = sdep->wd2.address; + sdep->wd2.address = phys_ubptbl(pp->p_ubptbl); + flushmmu((caddr_t)&u, USIZE); } - if (uptr->u_pcbp == &u.u_pcb) { - cmn_err(CE_CONT, "^Can't trace processes in user mode\n"); - return; - } - tracepcb(pcbaddr, stack_base, stack_copy); + tracepcb(pp, u.u_pcbp); + + if(oldubptbl != NULL){ + sdep->wd2.address = oldubptbl; + flushmmu((caddr_t)&u, USIZE); + } } -tracepcb(pcbaddr, stack_base, stack_copy) - pcb_t *pcbaddr; - u_int stack_base; - u_int stack_copy; +tracepcb(paddr, pcbaddr) +proc_t *paddr; +pcb_t *pcbaddr; { - register u_int ap, fp, sp, pc; + register int ap, fp, sp, pc; int *oldpcptr; int *argp; int first; char *s3bsp; + struct hat *hatp; + uint srama_save; + SRAMB sramb_save; + sde_t sde_save; int oldpri; int arg_count; + if (pcbaddr == &u.u_pcb) { + cmn_err(CE_CONT, "^Can't trace processes in user mode\n"); + return; + } + oldpri = splhi(); - if (debugtrace) { - sprintf(debugbuf,"pcbaddr %#x stack_base %#x stack_copy %#x", - pcbaddr, stack_base, stack_copy); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); - } + if (paddr != NULL) { + srama_save = srama[SCN3]; + sramb_save = sramb[SCN3]; + sde_save = *((sde_t *)srama_save); + + if (paddr->p_as == (struct as *)NULL) { + register int s; - cmn_err(CE_CONT, "^ AP FP PC Function\n\n"); + s = spl7(); + ((sde_t *)dflt_sdt_p)->wd2.address = + phys_ubptbl(paddr->p_ubptbl); + srama[SCN3] = dflt_sdt_p; + ((int *)sramb)[SCN3] = 0; + splx(s); + } else { + register struct hat *hatp = &paddr->p_as->a_hat; + register sde_t *sde3; + + sde3 = (sde_t *)hatp->hat_srama[1]; + sde3->wd2.address = phys_ubptbl(paddr->p_ubptbl); + loadmmu(hatp, SCN3); + } + } ap = pcbaddr->regsave[K_AP]; fp = pcbaddr->regsave[K_FP]; pc = (int)pcbaddr->pc; sp = (int)pcbaddr->sp; + cmn_err(CE_CONT, "^ AP FP PC Function Procp: %x\n\n", paddr); if (debugtrace) { - sprintf(debugbuf,"ap %#x fp %#x pc %#x", ap, fp, pc); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); - sprintf(debugbuf,"sp %#x slb %#x sup %#x", - sp, pcbaddr->slb, pcbaddr->sub); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); + sprintf(tracebuf,"%#x %#x %#x %s(", ap, fp, pc, "start"); + cmn_err(CE_CONT, "^%s)\n", tracebuf); + sprintf(tracebuf," %#x %#x", sp, oldpcptr); + cmn_err(CE_CONT, "^%s\n", tracebuf); dodmddelay(); } @@ -158,58 +193,36 @@ tracepcb(pcbaddr, stack_base, stack_copy) if (strcmp(s3bsp, "nrmx_KK") == 0) { if (debugtrace) { - sprintf(debugbuf,"ap %#x fp %#x pc %#x %s()", + sprintf(tracebuf,"%#x %#x %#x %s(", ap, fp, pc, s3bsp); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); - sprintf(debugbuf,"sp %#x oldpcptr %#x", - sp, oldpcptr); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); + cmn_err(CE_CONT, "^%s)\n", tracebuf); + sprintf(tracebuf," %#x %#x", sp, oldpcptr); + cmn_err(CE_CONT, "^%s\n", tracebuf); dodmddelay(); } + pc = *((int *)(sp) - 4); sp = (int)((int *)sp - 6); - pc = *((int *)(stack_copy + sp - stack_base)); s3bsp = s3blookup(pc); if (debugtrace) { - sprintf(debugbuf,"nsp %#x npc %#x", sp, pc); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); + sprintf(tracebuf," npc %#x nsp %#x", pc, sp); + cmn_err(CE_CONT, "^%s\n", tracebuf); dodmddelay(); } } - sprintf(tracebuf,"%#x %#x %#x %s(", - ap, fp, pc, s3bsp); + sprintf(tracebuf,"%#x %#x %#x %s(", ap, fp, pc, s3bsp); - if (fp > ap) { + if (fp > ap) oldpcptr = (int *)(fp - 9 * sizeof(char *)); - if (debugtrace) { - sprintf(debugbuf,"fp > ap : oldpcptr %#x", - oldpcptr); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); - } - } else { + else { oldpcptr = (int *)(sp - 2 * sizeof(char *)); - if (debugtrace) { - sprintf(debugbuf,"fp <= ap : oldpcptr %#x", - oldpcptr); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); - } - } - - /* - * Adjust oldpcptr to the actual stack we are traversing. - */ - oldpcptr = (int *)(stack_copy + ((u_int)oldpcptr - stack_base)); - argp = (int * )(stack_copy + (ap - stack_base)); - - if (debugtrace) { - sprintf(debugbuf,"argp %#x oldpcptr %#x", - argp, oldpcptr); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); + if (debugtrace) + sprintf(tracebuf, "%s!", tracebuf); } - for (arg_count = 1; argp < oldpcptr; argp++) { + for (argp = (int * )ap, arg_count = 1; argp < oldpcptr; argp++) { if (arg_count != 1) sprintf(tracebuf, "%s, ", tracebuf); @@ -220,12 +233,6 @@ tracepcb(pcbaddr, stack_base, stack_copy) sprintf(tracebuf, "%s%#x", tracebuf, *argp); - if (debugtrace) { - sprintf(debugbuf,"argp %#x *argp %#x", - argp, *argp); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); - } - if (++arg_count > MAXARGS) { cmn_err(CE_CONT, "^Trace Error, Too Many Args\n"); goto out; @@ -237,8 +244,8 @@ tracepcb(pcbaddr, stack_base, stack_copy) dodmddelay(); if (debugtrace) { - sprintf(debugbuf,"%#x %#x", sp, oldpcptr); - cmn_err(CE_CONT, "DEBUG: ^%s\n", tracebuf); + sprintf(tracebuf," %#x %#x", sp, oldpcptr); + cmn_err(CE_CONT, "^%s\n", tracebuf); dodmddelay(); } @@ -251,16 +258,15 @@ tracepcb(pcbaddr, stack_base, stack_copy) if (fp > sp) fp = *oldpcptr; - - if (debugtrace) { - sprintf(debugbuf,"ap %#x fp %#x pc %#x sp %#x oldpcptr %#x", - ap, fp, pc, sp, oldpcptr); - cmn_err(CE_CONT, "DEBUG: ^%s\n", debugbuf); - dodmddelay(); - } } out: + if (paddr != NULL) { + *((sde_t *)srama_save) = sde_save; + srama[SCN3] = srama_save; + sramb[SCN3] = sramb_save; + } + splx(oldpri); } @@ -269,12 +275,12 @@ ptrc() register pcb_t *pcbaddr; asm(" MOVW %pcbp,%r8"); - tracepcb(pcbaddr, 0, 0); + tracepcb(NULL, pcbaddr); } uptrc() { - tracepcb(u.u_pcbp, 0, 0); + tracepcb(NULL, u.u_pcbp); } prtpcbp() diff --git a/usr/src/uts/3b2/debug/utils.c b/usr/src/uts/3b2/debug/utils.c index 68a51d3..9f997db 100644 --- a/usr/src/uts/3b2/debug/utils.c +++ b/usr/src/uts/3b2/debug/utils.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)debug:debug/utils.c 1.9" +#ident "@(#)debug:debug/utils.c 1.8" /* */ @@ -404,7 +404,7 @@ iodsk(drive, part, block, flags) bp->b_bufsize = 512; bp->b_pages = 0; bp->b_vp = 0; - bp->b_flags = B_KERNBUF | B_PHYS | B_BUSY | flags; + bp->b_flags = B_PHYS | B_BUSY | flags; bp->b_edev = dev; bp->b_dev = cmpdev(dev); diff --git a/usr/src/uts/3b2/des/des.h b/usr/src/uts/3b2/des/des.h index 44101e4..cfe9ac4 100644 --- a/usr/src/uts/3b2/des/des.h +++ b/usr/src/uts/3b2/des/des.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:des/des.h 1.3" +#ident "@(#)head.sys:des/des.h 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/des/desdata.h b/usr/src/uts/3b2/des/desdata.h index 6faca0d..c70915a 100644 --- a/usr/src/uts/3b2/des/desdata.h +++ b/usr/src/uts/3b2/des/desdata.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:des/desdata.h 1.2" +#ident "@(#)head.sys:des/desdata.h 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/des/softdes.h b/usr/src/uts/3b2/des/softdes.h index 1e08a56..9e87f60 100644 --- a/usr/src/uts/3b2/des/softdes.h +++ b/usr/src/uts/3b2/des/softdes.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:des/softdes.h 1.2" +#ident "@(#)head.sys:des/softdes.h 1.1" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/disp/disp.c b/usr/src/uts/3b2/disp/disp.c index da907ea..f43e292 100644 --- a/usr/src/uts/3b2/disp/disp.c +++ b/usr/src/uts/3b2/disp/disp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:disp/disp.c 1.30" +#ident "@(#)kernel:disp/disp.c 1.28" #include "sys/types.h" #include "sys/param.h" #include "sys/psw.h" @@ -48,7 +48,6 @@ int npwakecnt; /* count of npwakeups since last pswtch() */ proc_t *curproc; /* currently running process */ int curpri; /* priority of current process */ int maxrunpri; /* priority of highest priority active queue */ -int idleswtch; /* flag set while idle in pswtch() */ STATIC ulong *dqactmap; /* bitmap to keep track of active disp queues */ STATIC dispq_t *dispq; /* ptr to array of disp queues indexed by pri */ @@ -159,17 +158,15 @@ pswtch() continue; /* might have made someone runnable */ } curpri = 0; - curproc = proc_sched; + curproc = nproc[0]; #ifdef KPERF if (kpftraceflg) { asm(" MOVAW 0(%pc),Kpc "); kperf_write(KPT_IDLE, Kpc, curproc); } #endif /* KPERF */ - idleswtch++; idle(); splhi(); - idleswtch = 0; runrun = kprunrun = npwakecnt = 0; } dq = &dispq[maxrunpri]; @@ -216,7 +213,7 @@ pswtch() curpri = pp->p_pri; curproc = pp; #ifdef DEBUG - if (pp != proc_bdflush) /* skip bdflush */ + if (pp != nproc[3]) /* skip bdflush */ idlecntdown = 60; #endif @@ -634,10 +631,12 @@ register proc_t *targpp; register int error; id_t reqpcid; register cred_t *reqpcredp; + id_t targpcid; register cred_t *targpcredp; reqpcid = reqpp->p_cid; reqpcredp = reqpp->p_cred; + targpcid = targpp->p_cid; targpcredp = targpp->p_cred; error = CL_PARMSOUT(&class[parmsp->pc_cid], parmsp->pc_clparms, diff --git a/usr/src/uts/3b2/disp/rt.c b/usr/src/uts/3b2/disp/rt.c index 0b01033..594bac2 100644 --- a/usr/src/uts/3b2/disp/rt.c +++ b/usr/src/uts/3b2/disp/rt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:disp/rt.c 1.22" +#ident "@(#)kernel:disp/rt.c 1.20" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" @@ -49,9 +49,8 @@ extern short rt_maxpri; /* maximum real-time priority */ void rt_init(); STATIC int rt_admin(), rt_enterclass(), rt_fork(), rt_getclinfo(); -STATIC int rt_nosys(), rt_parmsin(), rt_parmsout(), rt_parmsset(); -STATIC int rt_proccmp(); -STATIC void rt_exitclass(), rt_forkret(), rt_getglobpri(), rt_nullsys(); +STATIC int rt_parmsin(), rt_parmsout(), rt_parmsset(), rt_proccmp(); +STATIC void rt_exitclass(), rt_forkret(), rt_getglobpri(), rt_nullclass(); STATIC void rt_parmsget(), rt_preempt(), rt_setrun(), rt_sleep(); STATIC void rt_stop(), rt_swapin(), rt_swapout(), rt_tick(), rt_wakeup(); @@ -81,19 +80,19 @@ STATIC struct classfuncs rt_classfuncs = { rt_swapin, rt_swapout, rt_tick, - rt_nullsys, + rt_nullclass, rt_wakeup, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys, - rt_nosys + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass, + rt_nullclass }; @@ -473,15 +472,8 @@ int *globprip; } -STATIC int -rt_nosys() -{ - return(ENOSYS); -} - - STATIC void -rt_nullsys() +rt_nullclass() { } @@ -827,13 +819,13 @@ boolean_t *unloadokp; minpri = rt_maxpri + 1; for (rtpp = rt_plisthead.rt_next; rtpp != &rt_plisthead; rtpp = rtpp->rt_next) { - if (*rtpp->rt_pstatp == SZOMB || *rtpp->rt_pstatp == SIDL) - continue; + ASSERT(*rtpp->rt_pflagp & SULOAD); if ((rtpp->rt_flags & RTRAN) == 0) continue; + if (*rtpp->rt_pstatp == SZOMB) + continue; if (*rtpp->rt_pflagp & (SSYS|SLOCK|SPROCIO|SSWLOCKS)) continue; - ASSERT(*rtpp->rt_pflagp & SULOAD); if (rtpp->rt_pri < minpri) { minpripp = rtpp; minpri = rtpp->rt_pri; diff --git a/usr/src/uts/3b2/disp/sysclass.c b/usr/src/uts/3b2/disp/sysclass.c index 906f021..b152276 100644 --- a/usr/src/uts/3b2/disp/sysclass.c +++ b/usr/src/uts/3b2/disp/sysclass.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:disp/sysclass.c 1.12" +#ident "@(#)kernel:disp/sysclass.c 1.11" #include "sys/types.h" #include "sys/param.h" #include "sys/psw.h" @@ -37,46 +37,100 @@ */ void sys_init(); -STATIC int sys_fork(), sys_nosys(); -STATIC void sys_forkret(), sys_nullsys(), sys_preempt(), sys_setrun(); +STATIC int sys_admin(), sys_enterclass(), sys_fork(), sys_getclinfo(); +STATIC int sys_parmsin(), sys_parmsout(), sys_parmsset(), sys_proccmp(); +STATIC void sys_forkret(), sys_nullclass(), sys_preempt(), sys_setrun(); STATIC void sys_sleep(), sys_wakeup(); STATIC struct classfuncs sys_classfuncs = { - sys_nosys, - sys_nosys, - sys_nullsys, + sys_admin, + sys_enterclass, + sys_nullclass, sys_fork, sys_forkret, - sys_nosys, - sys_nullsys, - sys_nullsys, - sys_nosys, - sys_nosys, - sys_nosys, + sys_getclinfo, + sys_nullclass, + sys_nullclass, + sys_parmsin, + sys_parmsout, + sys_parmsset, sys_preempt, - sys_nosys, + sys_proccmp, sys_setrun, sys_sleep, - sys_nullsys, - sys_nullsys, - sys_nullsys, - sys_nullsys, - sys_nullsys, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, sys_wakeup, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys, - sys_nosys + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass, + sys_nullclass }; +/* + * The following several functions are no-ops for the sys class. + * They will never be called but they make things build nicely. + */ +STATIC int +sys_admin() +{ + return(0); +} + + +STATIC int +sys_enterclass() +{ + return(0); +} + + +STATIC int +sys_getclinfo() +{ + return(0); +} + + +STATIC int +sys_parmsin() +{ + return(0); +} + + +STATIC int +sys_parmsout() +{ + return(0); +} + + +STATIC int +sys_parmsset() +{ + return(0); +} + + +STATIC int +sys_proccmp() +{ + return(0); +} + + /* ARGSUSED */ void sys_init(cid, clparmsz, clfuncspp, maxglobprip) @@ -126,15 +180,8 @@ proc_t *pprocp; } -STATIC int -sys_nosys() -{ - return(ENOSYS); -} - - STATIC void -sys_nullsys() +sys_nullclass() { } diff --git a/usr/src/uts/3b2/disp/ts.c b/usr/src/uts/3b2/disp/ts.c index 821feb1..df10aeb 100644 --- a/usr/src/uts/3b2/disp/ts.c +++ b/usr/src/uts/3b2/disp/ts.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:disp/ts.c 1.23" +#ident "@(#)kernel:disp/ts.c 1.22" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" @@ -66,10 +66,9 @@ else if ((tspp)->ts_umdpri < 0) \ void ts_donice(), ts_init(); STATIC int ts_admin(), ts_enterclass(), ts_fork(), ts_getclinfo(); -STATIC int ts_nosys(), ts_parmsin(), ts_parmsout(), ts_parmsset(); -STATIC int ts_proccmp(); +STATIC int ts_parmsin(), ts_parmsout(), ts_parmsset(), ts_proccmp(); STATIC void ts_exitclass(), ts_forkret(), ts_getglobpri(); -STATIC void ts_nullsys(), ts_parmsget(), ts_preempt(); +STATIC void ts_nullclass(), ts_parmsget(), ts_preempt(); STATIC void ts_setrun(), ts_sleep(), ts_swapin(), ts_swapout(); STATIC void ts_tick(), ts_trapret(), ts_update(), ts_wakeup(); @@ -96,23 +95,23 @@ STATIC struct classfuncs ts_classfuncs = { ts_proccmp, ts_setrun, ts_sleep, - ts_nullsys, + ts_nullclass, ts_swapin, ts_swapout, ts_tick, ts_trapret, ts_wakeup, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys, - ts_nosys + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass, + ts_nullclass }; @@ -541,15 +540,8 @@ int *globprip; } -STATIC int -ts_nosys() -{ - return(ENOSYS); -} - - STATIC void -ts_nullsys() +ts_nullclass() { } diff --git a/usr/src/uts/3b2/exec/coff/coff.c b/usr/src/uts/3b2/exec/coff/coff.c index a47d25b..38e792a 100644 --- a/usr/src/uts/3b2/exec/coff/coff.c +++ b/usr/src/uts/3b2/exec/coff/coff.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)exec:exec/coff/coff.c 1.23" +#ident "@(#)exec:exec/coff/coff.c 1.18" #include "sys/types.h" #include "sys/param.h" @@ -29,6 +29,7 @@ #include "sys/var.h" #include "sys/immu.h" #include "sys/proc.h" +#include "sys/tuneable.h" #include "sys/tty.h" #include "sys/cmn_err.h" #include "sys/debug.h" @@ -49,13 +50,12 @@ int getcoffshlibs(); /* ARGSUSED */ int -coffexec(vp, args, level, execsz, ehdp, setid) +coffexec(vp, args, level, execsz, ehdp) struct vnode *vp; struct uarg *args; int level; long *execsz; exhda_t *ehdp; -int setid; { struct execenv exenv; struct exdata edp; @@ -115,6 +115,8 @@ int setid; if ((error = remove_proc(args)) != 0) goto done; + vp->v_flag |= VTEXT; + /* * Load any shared libraries that are needed. @@ -411,7 +413,7 @@ exhda_t *ehdp; * against the available memory or upper limit of memory allowed. */ - if (*execsz > btoc(u.u_rlimit[RLIMIT_VMEM].rlim_cur)) { + if (*execsz > tune.t_maxumem) { error = ENOMEM; goto bad; } @@ -507,6 +509,8 @@ exhda_t *ehdp; goto bad; } + nvp->v_flag |= VTEXT; + ++dat; ++edp->ux_nshlibs; ++n; @@ -584,13 +588,13 @@ coffcore(vp, pp, credp, rlimit, sig) if (error == 0 && up->u_dsize) { base = (caddr_t)up->u_exdata.ux_datorg; count = ctob(up->u_dsize) - PAGOFF(base); - error = core_seg(pp, vp, offset, base, count, rlimit, credp); + error = core_seg(vp, offset, base, count, rlimit, credp); offset += ctob(btoc(count)); } if (error == 0 && up->u_ssize) - error = core_seg(pp, vp, offset, - pp->p_stkbase, ctob(up->u_ssize), rlimit, credp); + error = core_seg(vp, offset, + (caddr_t)pp->p_stkbase, ctob(up->u_ssize), rlimit, credp); u.u_sysabort = 0; diff --git a/usr/src/uts/3b2/exec/elf/elf.c b/usr/src/uts/3b2/exec/elf/elf.c index d1e44ae..b5df470 100644 --- a/usr/src/uts/3b2/exec/elf/elf.c +++ b/usr/src/uts/3b2/exec/elf/elf.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)exec:exec/elf/elf.c 1.31" +#ident "@(#)exec:exec/elf/elf.c 1.25" #include "sys/types.h" #include "sys/param.h" @@ -29,6 +29,7 @@ #include "sys/var.h" #include "sys/immu.h" #include "sys/proc.h" +#include "sys/tuneable.h" #include "sys/tty.h" #include "sys/cmn_err.h" #include "sys/debug.h" @@ -51,21 +52,22 @@ short elfmagic = 0x7f45; /* magic number for cunix */ extern int mau_present; +STATIC int elfclosedl(); +STATIC int elfopendl(); STATIC int getelfhead(); int -elfexec(vp, args, level, execsz, ehdp, setid) +elfexec(vp, args, level, execsz, ehdp) struct vnode *vp; struct uarg *args; int level; long *execsz; exhda_t *ehdp; -int setid; { Elf32_Ehdr *ehdrp; Elf32_Phdr *phdr; caddr_t phdrbase = 0; - caddr_t base = 0; + caddr_t base; char *dlnp; int dlnsize, fd, *aux, resid, error; long voffset; @@ -163,7 +165,7 @@ int setid; *aux++ = ehdrp->e_entry + voffset; postfixsize += 8 * NBPW; } else { - if (error = execopen(&vp, &fd)) + if (error = elfopendl(&vp, &fd)) goto bad; *aux++ = AT_EXECFD; @@ -194,7 +196,7 @@ int setid; goto bad; *aux++ = AT_BASE; - *aux++ = voffset & ~(ELF_M32_MAXPGSZ - 1); + *aux++ = voffset; *aux++ = AT_FLAGS; *aux++ = mau_present ? EF_M32_MAU : 0; *aux++ = AT_PAGESZ; @@ -206,7 +208,7 @@ int setid; } - if (*execsz > btoc(u.u_rlimit[RLIMIT_VMEM].rlim_cur)) { + if (*execsz > tune.t_maxumem){ error = ENOMEM; goto bad; } @@ -238,7 +240,7 @@ int setid; bad: if (fd != -1) /* did we open the a.out yet */ - (void)execclose(fd); + (void)elfclosedl(fd); psignal(pp,SIGKILL); @@ -382,6 +384,60 @@ long *execsz; return error; } +STATIC int +elfopendl(vpp,fd) +struct vnode **vpp; +int *fd; +{ + struct vnode *vp= *vpp; + struct cred *credp; + file_t *fp; + int error =0; + int filemode = FREAD; + + VN_HOLD(vp); /* the dynamic linkers reference */ + + if (error = falloc((struct vnode *)NULL, filemode,&fp,fd)){ + VN_RELE(vp); + *fd = -1; /* just in case falloc changed value */ + return error; + } + + credp = crdup(u.u_cred); + credp->cr_uid = 0; /* make sure we can open file */ + credp->cr_gid = 0; + + if (error = VOP_OPEN(&vp,filemode,credp)){ + VN_RELE(vp); + setf(*fd,NULLFP); + unfalloc(fp); + *fd = -1; + return error; + } + + (void) crfree(credp); + + *vpp = vp; /* vnode should not have changed */ + + fp->f_vnode = vp; + + return 0; +} + +STATIC int +elfclosedl(fd) +int fd; +{ + int error; + file_t *fp; + + if (error = getf(fd, &fp)) + return error; + setf(fd,NULLFP); + + return closef(fp); +} + STATIC int elf_coffshlib(vp, stphdr, execsz, ehdp) @@ -400,7 +456,7 @@ exhda_t *ehdp; edp.ux_loffset = stphdr->p_offset; shlb_scnsz = (edp.ux_lsize + NBPW) & (~(NBPW - 1)); - shlb_datsz = shlbinfo.shlbs * sizeof(struct exdata); + shlb_datsz = edp.ux_nshlibs * sizeof(struct exdata); shlb_dat = (struct exdata *)kmem_alloc(shlb_datsz, KM_SLEEP); @@ -507,7 +563,7 @@ elfcore(vp, pp, credp, rlimit, sig) ehdr.e_type = ET_CORE; ehdr.e_machine = EM_M32; if (mau_present) - ehdr.e_flags |= EF_M32_MAU; + ehdr.e_type |= EF_M32_MAU; ehdr.e_version = EV_CURRENT; ehdr.e_phoff = sizeof(Elf32_Ehdr); ehdr.e_ehsize = sizeof(Elf32_Ehdr); @@ -587,7 +643,7 @@ elfcore(vp, pp, credp, rlimit, sig) for (i = 1; !error && i < nhdrs; i++) { if (v[i].p_filesz == 0) continue; - error = core_seg(pp, vp, v[i].p_offset, (caddr_t)v[i].p_vaddr, + error = core_seg(vp, v[i].p_offset, (caddr_t)v[i].p_vaddr, v[i].p_filesz, rlimit, credp); } diff --git a/usr/src/uts/3b2/exec/intp/intp.c b/usr/src/uts/3b2/exec/intp/intp.c index 196a2da..364bc61 100644 --- a/usr/src/uts/3b2/exec/intp/intp.c +++ b/usr/src/uts/3b2/exec/intp/intp.c @@ -5,12 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)exec:exec/intp/intp.c 1.10" +#ident "@(#)exec:exec/intp/intp.c 1.8" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" -#include "sys/systm.h" #include "sys/signal.h" #include "sys/psw.h" #include "sys/pcb.h" @@ -52,16 +51,19 @@ struct intpdata { char *intp_arg; }; + /* * Crack open a '#!' line. */ STATIC int -getintphead(idatap, ehdp) +getintphead(vp, idatap, ehdp) + struct vnode *vp; register struct intpdata *idatap; exhda_t *ehdp; { register int error; register char *cp, *linep; + int resid; int rdsz; int ssz = 0; @@ -131,27 +133,28 @@ getintphead(idatap, ehdp) return 0; } + int -intpexec(vp, args, level, execsz, ehdp, setid) - struct vnode *vp; - struct uarg *args; - int level; - long *execsz; - exhda_t *ehdp; - int setid; +intpexec(vp, args, level, execsz, ehdp) +struct vnode *vp; +struct uarg *args; +int level; +long *execsz; +exhda_t *ehdp; { vnode_t *nvp; - int num, error = 0; - char devfd[14]; - int fd = -1; + int num,c,i; + int error=0; + int *from,*to; struct intpdata idata; struct pathname intppn; + extern int userstack[]; if (level) { /* Can't recurse */ error = ENOEXEC; goto bad; } - if ((error = getintphead(&idata, ehdp)) != 0) + if ((error = getintphead(vp, &idata, ehdp)) != 0) goto bad; /* * Look the new vnode up. @@ -168,31 +171,13 @@ intpexec(vp, args, level, execsz, ehdp, setid) if (idata.intp_arg) num++; args->prefixc = num; - args->prefixp = &idata.intp_name; + args->prefixp = (&idata.intp_name); args->prefixsize = idata.intp_ssz; - if (setid) { /* close security hole */ - strcpy(devfd, "/dev/fd/"); - if (error = execopen(&vp, &fd)) { - VN_RELE(nvp); - goto bad; - } - numtos(fd, &devfd[8]); - args->fname = devfd; - } - - error = gexec(&nvp, args, ++level, execsz); - VN_RELE(nvp); - - if (error) - goto bad; - - return 0; + error = gexec(nvp, args, ++level, execsz); + VN_RELE(nvp); bad: - if (fd != -1) - (void)execclose(fd); return error; -} - +} diff --git a/usr/src/uts/3b2/exec/intp/intp.mk b/usr/src/uts/3b2/exec/intp/intp.mk index bd194f0..ca8f805 100644 --- a/usr/src/uts/3b2/exec/intp/intp.mk +++ b/usr/src/uts/3b2/exec/intp/intp.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)exec:exec/intp/intp.mk 1.4" +#ident "@(#)exec:exec/intp/intp.mk 1.3" ROOT = STRIP = strip INC = $(ROOT)/usr/include @@ -39,7 +39,6 @@ intp.o: intp.c \ $(INC)/sys/types.h \ $(INC)/sys/param.h \ $(INC)/sys/sysmacros.h \ - $(INC)/sys/systm.h \ $(INC)/sys/sbd.h \ $(INC)/sys/systm.h \ $(INC)/sys/map.h \ diff --git a/usr/src/uts/3b2/fs/bfs/bfs.mk b/usr/src/uts/3b2/fs/bfs/bfs.mk index aac31cd..48491b5 100644 --- a/usr/src/uts/3b2/fs/bfs/bfs.mk +++ b/usr/src/uts/3b2/fs/bfs/bfs.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)fs:fs/bfs/bfs.mk 1.16" +#ident "@(#)fs:fs/bfs/bfs.mk 1.15" ROOT = STRIP = strip INC = $(ROOT)/usr/include @@ -133,7 +133,6 @@ bfs_vnops.o: bfs_vnops.c \ $(INC)/sys/cmn_err.h \ $(INC)/sys/conf.h \ $(INC)/sys/cred.h \ - $(INC)/sys/dirent.h \ $(INC)/sys/errno.h \ $(INC)/sys/time.h \ $(INC)/sys/fcntl.h \ diff --git a/usr/src/uts/3b2/fs/bfs/bfs_compact.c b/usr/src/uts/3b2/fs/bfs/bfs_compact.c index 6063436..5de4006 100644 --- a/usr/src/uts/3b2/fs/bfs/bfs_compact.c +++ b/usr/src/uts/3b2/fs/bfs/bfs_compact.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/bfs/bfs_compact.c 1.19" +#ident "@(#)fs:fs/bfs/bfs_compact.c 1.17" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -39,8 +39,11 @@ #define BFSBUFSIZE 8192 char bfs_buffer[BFSBUFSIZE]; -int bfs_debugcomp; +/* + * All I/O in this file is done such that it could be called from within the + * kernel or user-level. See bfs_compact.h for further details. + */ int bfs_compact(bs, cr) struct bsuper *bs; @@ -55,7 +58,9 @@ bfs_compact(bs, cr) BFS_LOCK(bs); /* No I/O while compacting */ +#ifdef DEBUG cmn_err(CE_CONT,"Compacting BFS filesystem\n"); +#endif off = bfs_getnxtcblock(bs, 0, &dir, cr); /* Get first file */ eblock = (bs->bsup_start / BFS_BSIZE); @@ -70,11 +75,10 @@ bfs_compact(bs, cr) gapsize = (dir.d_sblock - eblock) - 1; #ifdef DEBUG - if (bfs_debugcomp) - cmn_err(CE_CONT,"Found a gap. New gapsize is %d\n", - gapsize); + cmn_err(CE_CONT,"Found a gap. New gapsize is %d\n", + gapsize); #endif - bfs_shiftfile(bs, &dir, gapsize, off, cr); + bfs_shiftfile(bs, &dir, gapsize, off, 0, cr); cnt++; } eblock = dir.d_eblock; @@ -86,10 +90,12 @@ bfs_compact(bs, cr) bs->bsup_compacted = BFS_YES; +#ifdef DEBUG if (cnt) cmn_err(CE_CONT, "Compaction of BFS filesystem completed\n"); else - cmn_err(CE_CONT, "BFS filesystem was already compacted\n"); + cmn_err(CE_CONT, "BFS filesystem was compacted\n"); +#endif bfs_unlock(bs); return 0; @@ -118,14 +124,13 @@ bfs_getnxtcblock(bs, curblock, drent, cr) */ for (i = BFS_DIRSTART; i < bs->bsup_start; i += sizeof(struct bfs_dirent)) { - BFS_GETINODE(bs->bsup_devnode, i, &dir, cr); + BFS_CCT_GETINODE(bs->bsup_devnode, i, &dir, cr); if (dir.d_ino == 0) continue; if (dir.d_sblock > curblock && dir.d_sblock < drent->d_sblock) { #ifdef DEBUG - if (bfs_debugcomp) cmn_err(CE_CONT,"nxt: fnd sblk %d, gt than %d, lt %d\n", dir.d_sblock, curblock, drent->d_sblock); #endif @@ -140,11 +145,12 @@ bfs_getnxtcblock(bs, curblock, drent, cr) * Shift the file described by dirent "dir", "gapsize" blocks. "Offset" * describes the location on the disk of the dirent. */ -bfs_shiftfile(bs, dir, gapsize, offset, cr) +bfs_shiftfile(bs, dir, gapsize, offset, foffset, cr) struct bsuper *bs; struct bfs_dirent *dir; long gapsize; off_t offset; + daddr_t foffset; struct cred *cr; { long maxshift; @@ -159,13 +165,12 @@ bfs_shiftfile(bs, dir, gapsize, offset, cr) daddr_t btoblock; } sw; - sw.fromblock = dir->d_sblock; - sw.toblock = dir->d_sblock - gapsize; + sw.fromblock = dir->d_sblock + foffset; + sw.toblock = (dir->d_sblock - gapsize) + foffset; #ifdef DEBUG - if (bfs_debugcomp) - cmn_err(CE_CONT,"Shifting a file inode %d from %d to %d\n", - dir->d_ino, sw.fromblock, sw.toblock); + cmn_err(CE_CONT,"Shifting a file inode %d from %d to %d\n", + dir->d_ino, sw.fromblock, sw.toblock); #endif maxshift = min(BFSBUFSIZE, gapsize*512); @@ -175,7 +180,7 @@ bfs_shiftfile(bs, dir, gapsize, offset, cr) */ sw.bfromblock = sw.fromblock; sw.btoblock = sw.toblock; - BFS_CCT_WRITE(bs->bsup_devnode,BFS_SANITYWSTART, + BFS_CCT_WRITE(bs->bsup_devnode,BFS_COMPACTSTART, sizeof(struct sanityw),&sw,cr); /* @@ -212,7 +217,7 @@ bfs_shiftfile(bs, dir, gapsize, offset, cr) if (gapsize*512 < filesize) { sw.bfromblock = sw.fromblock; sw.btoblock = sw.toblock; - BFS_CCT_WRITE(bs->bsup_devnode,BFS_SANITYWSTART, + BFS_CCT_WRITE(bs->bsup_devnode,BFS_COMPACTSTART, sizeof(struct sanityw), &sw, cr); } @@ -231,7 +236,7 @@ bfs_shiftfile(bs, dir, gapsize, offset, cr) * is. */ if (gapsize*512 < filesize) - BFS_CCT_WRITE(bs->bsup_devnode,BFS_SANITYWSTART, + BFS_CCT_WRITE(bs->bsup_devnode,BFS_COMPACTSTART, sizeof(w4fsck), w4fsck, cr); } @@ -240,7 +245,7 @@ bfs_shiftfile(bs, dir, gapsize, offset, cr) */ dir->d_sblock -= gapsize; dir->d_eblock -= gapsize; - BFS_PUTINODE(bs->bsup_devnode, offset, dir,cr); + BFS_CCT_PUTINODE(bs->bsup_devnode, offset, dir,cr); /* * Must write "-1" to all 4 sanity words for fsck to denote that @@ -250,11 +255,61 @@ bfs_shiftfile(bs, dir, gapsize, offset, cr) sw.toblock = -1; sw.bfromblock = -1; sw.btoblock = -1; - BFS_CCT_WRITE(bs->bsup_devnode,BFS_SANITYWSTART, + BFS_CCT_WRITE(bs->bsup_devnode,BFS_COMPACTSTART, sizeof(struct sanityw), &sw, cr); #ifdef DEBUG - if (bfs_debugcomp) - cmn_err(CE_CONT,"File shifted\n"); + cmn_err(CE_CONT,"File shifted\n"); +#endif + return 0; +} + +/* + * Function to write fsck sanity words. + */ +int +bfs_csanity(bvp, sanityno, value, cr) + struct vnode *bvp; + short sanityno; + long value; + struct cred *cr; +{ + BFS_CCT_WRITE(bvp, BFS_COMPACTSTART + ((sanityno-1)*sizeof(long)), + sizeof(long), &value, cr); + return 0; +} + +/* + * The following functions are for use when compaction is being done from + * user mode. + */ +#ifndef _KERNEL +int +seek_read(fd, offset, len, buf) + int fd; + off_t offset; + long len; + char *buf; +{ + lseek(fd, offset, 0); + read(fd, buf, len); + return 0; +} + +int +seek_write(fd, offset, len, buf) + int fd; + off_t offset; + long len; + char *buf; +{ + lseek(fd, offset, 0); + write(fd, buf, len); + return 0; +} #endif + +int +bfs_donothing() +{ return 0; } diff --git a/usr/src/uts/3b2/fs/bfs/bfs_subr.c b/usr/src/uts/3b2/fs/bfs/bfs_subr.c index e632d78..d17cb0b 100644 --- a/usr/src/uts/3b2/fs/bfs/bfs_subr.c +++ b/usr/src/uts/3b2/fs/bfs/bfs_subr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/bfs/bfs_subr.c 1.28" +#ident "@(#)fs:fs/bfs/bfs_subr.c 1.23" #include "sys/types.h" #include "sys/time.h" #include "sys/param.h" @@ -101,7 +101,7 @@ bfs_searchdir(vfsp, nm, cr) char *nm; struct cred *cr; { - ushort ino = 0; + o_ino_t ino = 0; off_t ino_offset = 0; int error; @@ -127,7 +127,7 @@ bfs_rmdirent(vfsp, nm, cr) register struct bsuper *bs = (struct bsuper *)vfsp->vfs_data; register struct bfs_dirent *dir; - ushort ino = 0; + o_ino_t ino = 0; off_t offset = 0; int error = 0; @@ -167,7 +167,7 @@ bfs_rmdirent(vfsp, nm, cr) /* * Update the ROOT inode */ - BFS_PUTINODE(bs->bsup_devnode, BFS_INO2OFF(BFSROOTINO), + error = BFS_PUTINODE(bs->bsup_devnode, BFS_INO2OFF(BFSROOTINO), dir, cr); } BFS_IOEND(bs); @@ -184,14 +184,14 @@ int bfs_addirent(vfsp, nm, inode, cr) struct vfs *vfsp; char *nm; - ushort inode; + o_ino_t inode; struct cred *cr; { register struct bsuper *bs = (struct bsuper *)vfsp->vfs_data; register struct bfs_dirent *dir; struct bfs_ldirs ld; - ushort ino = 0; + o_ino_t ino = 0; off_t offset = 0; int error = 0; int i; @@ -225,7 +225,7 @@ bfs_addirent(vfsp, nm, inode, cr) */ if (ino == 0 && offset == 0) { if ( (dir->d_eoffset + sizeof(struct bfs_ldirs)) < - (dir->d_eblock + 1) * BFS_BSIZE) { + dir->d_eblock * BFS_BSIZE) { offset = dir->d_eoffset +1; dir->d_eoffset += sizeof(struct bfs_ldirs); } @@ -287,7 +287,7 @@ bfs_rendirent(vfsp, snm, tnm, cr) register struct bsuper *bs = (struct bsuper *)vfsp->vfs_data; register struct bfs_dirent *dir; struct bfs_ldirs ld; - ushort ino = 0; + o_ino_t ino = 0; off_t offset = 0; int error = 0; int i; @@ -335,7 +335,7 @@ bfs_rendirent(vfsp, snm, tnm, cr) /* * Update the ROOT inode */ - BFS_PUTINODE(bs->bsup_devnode, BFS_INO2OFF(BFSROOTINO), + error = BFS_PUTINODE(bs->bsup_devnode, BFS_INO2OFF(BFSROOTINO), dir, cr); } BFS_IOEND(bs); @@ -355,7 +355,7 @@ bfs_dotsearch(vfsp, nm, cr, inop, offp) struct vfs *vfsp; char *nm; struct cred *cr; - ushort *inop; + o_ino_t *inop; off_t *offp; { register struct bsuper *bs = (struct bsuper *)vfsp->vfs_data; @@ -423,7 +423,7 @@ bfs_dotsearch(vfsp, nm, cr, inop, offp) * Update the access time of the ROOT inode */ dir->d_fattr.va_atime = hrestime.tv_sec; - BFS_PUTINODE(bs->bsup_devnode, BFS_INO2OFF(BFSROOTINO), dir,cr); + error = BFS_PUTINODE(bs->bsup_devnode, BFS_INO2OFF(BFSROOTINO), dir,cr); kmem_free(dir, sizeof(struct bfs_dirent)); kmem_free(buf, chunksize); @@ -575,7 +575,7 @@ bfs_filetoend(bs, dir, offset, cr) kmem_free(buf, chunksize); dir->d_eoffset = offset1 -1; dir->d_sblock = newblock; - dir->d_eblock = dir->d_eoffset / BFS_BSIZE; + dir->d_eblock = offset1 / BFS_BSIZE; /* * Write the updated inode entry. @@ -601,7 +601,7 @@ bfs_unlock(bs) struct bsuper *bs; { bs->bsup_fslocked = BFS_NO; - wakeprocs((caddr_t)&bs->bsup_fslocked, PRMPT); + wakeup((caddr_t)&bs->bsup_fslocked); return 0; } @@ -628,22 +628,14 @@ bfs_truncate(bs, diroff, length, cr) if (!dir->d_sblock) { BFS_IOEND(bs); kmem_free(dir, sizeof(struct bfs_dirent)); - if (length == 0) - return 0; - else - return EINVAL; + return 0; } - if (dir->d_eoffset + 1 - (dir->d_sblock*BFS_BSIZE) == length) { + if (dir->d_eoffset - (dir->d_sblock*BFS_BSIZE) <= length) { BFS_IOEND(bs); kmem_free(dir, sizeof(struct bfs_dirent)); return 0; } - if (dir->d_eoffset + 1 - (dir->d_sblock*BFS_BSIZE) < length) { - BFS_IOEND(bs); - kmem_free(dir, sizeof(struct bfs_dirent)); - return EINVAL; - } oeblock = dir->d_eblock; dir->d_eoffset = (dir->d_sblock * BFS_BSIZE) + length - 1; @@ -658,7 +650,6 @@ bfs_truncate(bs, diroff, length, cr) if (dir->d_eoffset == ((dir->d_sblock * BFS_BSIZE) - 1)) { dir->d_sblock = 0; dir->d_eblock = 0; - dir->d_eoffset = 0; BFS_PUTINODE(bs->bsup_devnode, diroff, dir, cr); diff --git a/usr/src/uts/3b2/fs/bfs/bfs_vfsops.c b/usr/src/uts/3b2/fs/bfs/bfs_vfsops.c index 96c98bc..acccb2b 100644 --- a/usr/src/uts/3b2/fs/bfs/bfs_vfsops.c +++ b/usr/src/uts/3b2/fs/bfs/bfs_vfsops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/bfs/bfs_vfsops.c 1.33" +#ident "@(#)fs:fs/bfs/bfs_vfsops.c 1.27" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -35,6 +35,8 @@ struct vnode *specvp(), *bdevvp(); +#define BFS_BUFSIZE 1024 + struct vnode *specvp(), *makespecvp(); /* @@ -56,10 +58,6 @@ struct vfsops bfsvfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; extern int bfstype; @@ -75,7 +73,7 @@ bfs_mount(vfsp, mvp, uap, cr) daddr_t lastblock, lastoff; struct vnode *bvp, *rvp; struct bsuper *bfs_super; - long superbuf[7]; + long superbuf[3]; struct bfs_dirent *dir; int rdonly = (uap->flags & MS_RDONLY); int error; @@ -118,7 +116,6 @@ bfs_mount(vfsp, mvp, uap, cr) * on this vnode. */ bvp = makespecvp(dev, VBLK); - bvp->v_vfsp = vfsp; if (error = VOP_OPEN(&bvp, rdonly ? FREAD : FREAD|FWRITE, u.u_cred)) { VN_RELE(bvp); @@ -136,37 +133,22 @@ bfs_mount(vfsp, mvp, uap, cr) vfsp->vfs_flag |= VFS_RDONLY; /* - * The first three words are the magic number, the start and end blocks - * of the file data. The next four words are the sanity words. + * The first three words are the start and end blocks of the file data, + * and the magic number. */ error = vn_rdwr(UIO_READ, bvp, (caddr_t) superbuf, sizeof(superbuf), BFS_SUPEROFF, UIO_SYSSPACE, 0, 0, cr, (int *)0); if (error) { - VOP_CLOSE(bvp, rdonly ? FREAD : FREAD|FWRITE, 1, - (off_t) BFS_INO2OFF(BFSROOTINO), cr); VN_RELE(bvp); return error; } if (superbuf[0] != BFS_MAGIC) { - VOP_CLOSE(bvp, rdonly ? FREAD : FREAD|FWRITE, 1, - (off_t) BFS_INO2OFF(BFSROOTINO), cr); VN_RELE(bvp); return EINVAL; } - /* - * If the last 2 sanity words are not set to "-1", the file system - * must be checked before is mounted. - */ - if (superbuf[5] != -1 && superbuf[6] != -1) { - VOP_CLOSE(bvp, rdonly ? FREAD : FREAD|FWRITE, 1, - (off_t) BFS_INO2OFF(BFSROOTINO), cr); - VN_RELE(bvp); - return ENOSPC; - } - /* * The bfs "superbuf" is constantly referenced for every BFS operation. * It contains all filesystem private info including the device special @@ -177,8 +159,6 @@ bfs_mount(vfsp, mvp, uap, cr) bfs_super = (struct bsuper *) kmem_alloc(sizeof(struct bsuper), KM_SLEEP); if (bfs_super == NULL) { - VOP_CLOSE(bvp, rdonly ? FREAD : FREAD|FWRITE, 1, - (off_t) BFS_INO2OFF(BFSROOTINO), cr); VN_RELE(bvp); return EBUSY; } @@ -227,8 +207,6 @@ bfs_mount(vfsp, mvp, uap, cr) for (i = BFS_DIRSTART; i < bfs_super->bsup_start; i += sizeof(struct bfs_dirent)) { if (BFS_GETINODE(bvp, i, dir, cr)) { - VOP_CLOSE(bvp, rdonly ? FREAD : FREAD|FWRITE, 1, - (off_t) BFS_INO2OFF(BFSROOTINO), cr); VN_RELE(bvp); kmem_free(dir, sizeof(struct bfs_dirent)); kmem_free(bfs_super, sizeof(struct bsuper)); @@ -249,7 +227,10 @@ bfs_mount(vfsp, mvp, uap, cr) } kmem_free((caddr_t)dir, sizeof(struct bfs_dirent)); - vfsp->vfs_bsize = BFS_BSIZE; + /* invalidate blocks with the dev were mounting on */ + binval(dev); /* FIX FOR VM!!!!! */ + fbinval(vfsp); + vfsp->vfs_bsize = BFS_BUFSIZE; vfsp->vfs_bcount = 0; vfsp->vfs_fstype = bfstype; @@ -274,7 +255,6 @@ bfs_unmount(vfsp, cr) struct vfs *vfsp; struct cred *cr; { - dev_t dev; register struct vnode *bvp; register struct bfs_core_vnode *cvp; register struct bsuper *bs = (struct bsuper *)vfsp->vfs_data; @@ -291,12 +271,10 @@ bfs_unmount(vfsp, cr) } bvp = BFS_DEVNODE(vfsp); - dev = vfsp->vfs_dev; VOP_CLOSE(bvp, (vfsp->vfs_flag & VFS_RDONLY) ? FREAD : FREAD|FWRITE, 1, (off_t) BFS_INO2OFF(BFSROOTINO), cr); kmem_free(vfsp->vfs_data,sizeof(struct bsuper)); VN_RELE(bvp); - binval(dev); return 0; } diff --git a/usr/src/uts/3b2/fs/bfs/bfs_vnops.c b/usr/src/uts/3b2/fs/bfs/bfs_vnops.c index 4fd0f07..9459e93 100644 --- a/usr/src/uts/3b2/fs/bfs/bfs_vnops.c +++ b/usr/src/uts/3b2/fs/bfs/bfs_vnops.c @@ -5,13 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/bfs/bfs_vnops.c 1.58" +#ident "@(#)fs:fs/bfs/bfs_vnops.c 1.47" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" #include "sys/conf.h" #include "sys/cred.h" -#include "sys/dirent.h" #include "sys/errno.h" #include "sys/time.h" #include "sys/fcntl.h" @@ -52,7 +51,7 @@ STATIC int bfs_open(), bfs_close(), bfs_read(), bfs_write(); STATIC int bfs_ioctl(), bfs_getattr(), bfs_setattr(); STATIC int bfs_access(), bfs_lookup(), bfs_create(); STATIC int bfs_remove(), bfs_rename(), bfs_readdir(), bfs_fsync(); -STATIC int bfs_fid(), bfs_seek(), bfs_cmp(), bfs_freespace(); +STATIC int bfs_fid(), bfs_seek(), bfs_cmp(), bfs_frlock(), bfs_freespace(); STATIC void bfs_inactive(); STATIC int bfs_link(); @@ -70,7 +69,7 @@ struct vnodeops bfsvnodeops = { bfs_lookup, bfs_create, bfs_remove, - bfs_link, + bfs_link, /* link */ bfs_rename, fs_nosys, /* mkdir */ fs_nosys, /* rmdir */ @@ -84,7 +83,7 @@ struct vnodeops bfsvnodeops = { fs_rwunlock, bfs_seek, bfs_cmp, - fs_frlock, + bfs_frlock, bfs_freespace, fs_nosys, /* realvp */ fs_nosys, /* getpage */ @@ -94,7 +93,6 @@ struct vnodeops bfsvnodeops = { fs_nosys, /* delmap */ fs_poll, fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ fs_nosys, fs_nosys, @@ -103,30 +101,6 @@ struct vnodeops bfsvnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* ARGSUSED */ @@ -279,6 +253,7 @@ bfs_getattr(vp, vap, flags, cr) /* * We get most of the attrs from the dirent. */ + vap->va_mask = dir->d_fattr.va_mask; vap->va_type = dir->d_fattr.va_type; vap->va_mode = (mode_t)dir->d_fattr.va_mode; vap->va_uid = dir->d_fattr.va_uid; @@ -290,7 +265,8 @@ bfs_getattr(vp, vap, flags, cr) vap->va_mtime.tv_nsec = 0; vap->va_ctime.tv_sec = dir->d_fattr.va_ctime; vap->va_ctime.tv_nsec = 0; - vap->va_blksize = 512; + vap->va_blksize = dir->d_fattr.va_blksize; + vap->va_nblocks = dir->d_fattr.va_nblocks; vap->va_vcode = 0; /* @@ -301,10 +277,9 @@ bfs_getattr(vp, vap, flags, cr) vap->va_size = (dir->d_eoffset - (dir->d_sblock*BFS_BSIZE)) +1; else vap->va_size = 0; - vap->va_nblocks = btod(vap->va_size); + vap->va_nodeid = dir->d_ino; - vap->va_fsid = vp->v_vfsp->vfs_dev; - vap->va_rdev = 0; + vap->va_fsid = vap->va_rdev = vp->v_vfsp->vfs_dev; kmem_free((caddr_t)dir, sizeof(struct bfs_dirent)); return 0; } @@ -366,6 +341,8 @@ bfs_setattr(vp, vap, flags, cr) if (!groupmember(battrs->va_gid, cr)) battrs->va_mode &= ~VSGID; } + if ((vp->v_flag & VTEXT) && (battrs->va_mode & VSVTX) == 0) + xrele(vp); } /* * Change file ownership; must be the owner of the file @@ -496,8 +473,18 @@ bfs_access(vp, mode, flags, cr) kmem_free((caddr_t)dir, sizeof(struct bfs_dirent)); - if ((mode & VWRITE) && (vp->v_vfsp->vfs_flag & VFS_RDONLY)) - return EROFS; + /* + * If the text is busy, do not allow writing. + */ + if (mode & VWRITE) { + if (vp->v_vfsp->vfs_flag & VFS_RDONLY) + return EROFS; + if (vp->v_flag & VTEXT) { + xrele(vp); + if (vp->v_flag & VTEXT) + return EBUSY; + } + } /* @@ -536,8 +523,6 @@ bfs_cmp(vp1, vp2) } -#define RECBUFSIZE 1048 - STATIC int bfs_readdir(vp, uiop, cr, eofp) struct vnode *vp; @@ -549,37 +534,43 @@ bfs_readdir(vp, uiop, cr, eofp) register struct bfs_ldirs *ld; off_t diroff = uiop->uio_offset; register struct bsuper *bs = (struct bsuper *)vp->v_vfsp->vfs_data; - register struct dirent *drp; - char *drent; + struct bfs_drent_overlay *drent; char *buf; off_t offset; off_t i; int error = 0; int buflen = 0; int len, chunksize; - int reclen, namesz; - int indrent = 0; - int fixsz; + + drent = (struct bfs_drent_overlay *) + kmem_zalloc(sizeof(struct bfs_drent_overlay), KM_SLEEP); /* * Check for a valid offset into the "directory". */ - if (diroff % sizeof(struct bfs_ldirs) != 0) + if (diroff % sizeof(struct bfs_ldirs) != 0) { + kmem_free(drent, sizeof( struct bfs_drent_overlay)); return ENOENT; + } - if (diroff < 0) + if (diroff < 0) { + kmem_free(drent, sizeof( struct bfs_drent_overlay)); return EINVAL; + } + drent->d_reclen = sizeof(struct bfs_drent_overlay); BFS_IOBEGIN(bs); CHECK_LOCK(bs); dir = (struct bfs_dirent *) kmem_alloc(sizeof(struct bfs_dirent), KM_SLEEP); + BFS_IOBEGIN(bs); /* * Get the ROOT inode. */ error = BFS_GETINODE(bs->bsup_devnode, BFS_INO2OFF(BFSROOTINO), dir,cr); if (error) { + kmem_free(drent, sizeof( struct bfs_drent_overlay)); kmem_free(dir, sizeof(struct bfs_dirent)); BFS_IOEND(bs); return(error); @@ -589,12 +580,8 @@ bfs_readdir(vp, uiop, cr, eofp) chunksize = MIN(len, DIRBUFSIZE); buf = kmem_alloc(chunksize, KM_SLEEP); - drent = kmem_alloc(RECBUFSIZE, KM_SLEEP); - drp = (struct dirent *)drent; - fixsz = (char *)drp->d_name - (char *)drp; - - for (offset = diroff + (dir->d_sblock * BFS_BSIZE); - uiop->uio_resid > 0 && len > 0; len -= buflen, offset += buflen) { + for (offset = diroff + (dir->d_sblock * BFS_BSIZE); len > 0; + len -= buflen, offset +=buflen) { buflen = MIN(chunksize, len); /* @@ -602,50 +589,31 @@ bfs_readdir(vp, uiop, cr, eofp) */ error = BFS_GETDIRLIST(bs->bsup_devnode, offset, buf,buflen,cr); if (error) { + kmem_free(drent, sizeof( struct bfs_drent_overlay)); kmem_free(dir, sizeof(struct bfs_dirent)); kmem_free(buf, chunksize); - kmem_free(drent, RECBUFSIZE); BFS_IOEND(bs); return(error); } - for (i = 0; i < buflen && uiop->uio_resid >= indrent; - i += sizeof(struct bfs_ldirs)) { + for (i = 0; i < buflen; i += sizeof(struct bfs_ldirs)) { + if (uiop->uio_resid < sizeof(struct bfs_drent_overlay)) + break; ld = (struct bfs_ldirs *) (buf + i); - if (ld->l_ino == 0 ) - continue; - namesz = (ld->l_name[BFS_MAXFNLEN -1] == '\0') ? - strlen(ld->l_name) : BFS_MAXFNLEN; - reclen = (fixsz + namesz + 1 + (NBPW -1)) & ~(NBPW -1); - - if (RECBUFSIZE - indrent < reclen || - uiop->uio_resid < indrent + reclen ) { - uiomove(drent, indrent, UIO_READ, uiop); - if (uiop->uio_resid < reclen) { - offset += i; - indrent = -1; - break; - } - drp = (struct dirent *) drent; - indrent = 0; - } - if (uiop->uio_resid >= indrent + reclen) { - drp->d_ino = ld->l_ino; - drp->d_off = offset +i; - drp->d_reclen = (short)reclen; - strncpy(drp->d_name, ld->l_name,BFS_MAXFNLEN); - drp->d_name[namesz] = '\0'; - drp = (struct dirent *) (((char *)drp) +reclen); - indrent += reclen; + if (ld->l_ino != 0 ) { + drent->d_ino = ld->l_ino; + drent->d_off = offset +i; + strncpy(drent->d_name, ld->l_name,BFS_MAXFNLEN); + uiomove(drent, sizeof(struct bfs_drent_overlay), + UIO_READ, uiop); + } } - if (indrent == -1) + if (uiop->uio_resid < sizeof(struct bfs_drent_overlay)) { + offset += i; break; + } } - - if (indrent > 0 && uiop->uio_resid >= indrent) - uiomove(drent, indrent, UIO_READ, uiop); - /* * The offset must be changed manually to reflect the filesystem * DEPENDENT directory size. @@ -656,9 +624,9 @@ bfs_readdir(vp, uiop, cr, eofp) *eofp = (offset >= dir->d_eoffset); } + kmem_free(drent, sizeof( struct bfs_drent_overlay)); kmem_free(dir, sizeof(struct bfs_dirent)); kmem_free(buf, chunksize); - kmem_free(drent, RECBUFSIZE); BFS_IOEND(bs); return(error); } @@ -762,14 +730,10 @@ bfs_lookup(dvp, nm, vpp, pnp, flags, rdir, cr) register struct bsuper *bs = (struct bsuper *)dvp->v_vfsp->vfs_data; off_t offset; struct vnode *vp; - int error; if (dvp->v_type != VDIR) /* We can only read root */ return ENOTDIR; - if (error = bfs_access(dvp, VEXEC, 0, cr)) - return error; - /* * The null name means the current directory. */ @@ -818,13 +782,6 @@ bfs_remove(vp, nm, cr) int error = 0; daddr_t lastblock = 0; - /* - * Since BFS is a flat file system, only need to check permissions - * of the ROOT directory. - */ - if (error = bfs_access(vp, VEXEC|VWRITE, 0, cr)) - return error; - /* * Get a new vnode for the file in question. */ @@ -833,7 +790,7 @@ bfs_remove(vp, nm, cr) return error; if (rvp->v_type == VDIR) { - VN_RELE(rvp); + VN_RELE(rvp); /* Should probably never get here */ return EISDIR; } @@ -843,6 +800,19 @@ bfs_remove(vp, nm, cr) BFS_IOBEGIN(bs); CHECK_LOCK(bs); + /* + * Check if the file is busy in core. + */ + if (rvp->v_flag & VTEXT) { + xrele(rvp); + if (rvp->v_flag & VTEXT) { + BFS_IOEND(bs); + kmem_free(dir, sizeof(struct bfs_dirent)); + VN_RELE(rvp); + return EBUSY; + } + } + /* * If this is the file farthest into the disk, we must flag a * different file as the last. @@ -871,13 +841,7 @@ bfs_remove(vp, nm, cr) dir->d_fattr.va_nlink -= 1; dir->d_fattr.va_ctime = hrestime.tv_sec; - error = BFS_PUTINODE(bs->bsup_devnode, rvp->v_data, dir, cr); - if (error) { - BFS_IOEND(bs); - kmem_free(dir, sizeof(struct bfs_dirent)); - VN_RELE(rvp); - return error; - } + BFS_PUTINODE(bs->bsup_devnode, rvp->v_data, dir, cr); /* * If link count is >= 1, we are done! @@ -915,9 +879,7 @@ bfs_remove(vp, nm, cr) kmem_free(dir, sizeof(struct bfs_dirent)); VN_RELE(rvp); return error; - } else - bs->bsup_compacted = BFS_NO; - + } BFS_IOEND(bs); /* @@ -932,11 +894,14 @@ bfs_remove(vp, nm, cr) BFS_GETINODE(bs->bsup_devnode, bs->bsup_lastfile, ldir, cr); if (ldir->d_sblock == dir->d_eblock + 1 && - ldir->d_eblock - ldir->d_sblock < SMALLFILE) + ldir->d_eblock - ldir->d_sblock < SMALLFILE) { bfs_compact(bs, cr); + } else + bs->bsup_compacted = BFS_NO; kmem_free(ldir, sizeof(struct bfs_dirent)); - } + } else + bs->bsup_compacted = BFS_NO; kmem_free(dir, sizeof(struct bfs_dirent)); VN_RELE(rvp); @@ -996,7 +961,7 @@ bfs_link(tdvp, svp, tnm, cr) { register struct bsuper *bs = (struct bsuper *)svp->v_vfsp->vfs_data; register struct bfs_dirent *dir; - ushort sino; + o_ino_t sino; int error = 0; if (tdvp->v_type != VDIR) @@ -1133,8 +1098,15 @@ bfs_create(dvp, fname, vap, excl, mode, vpp, cr) /* * Get most attributes from argument list. */ + dir->d_fattr.va_mask = vap->va_mask; dir->d_fattr.va_type = vap->va_type; dir->d_fattr.va_mode = (o_mode_t)vap->va_mode; + dir->d_fattr.va_nodeid = vap->va_nodeid; + dir->d_fattr.va_size = vap->va_size; + dir->d_fattr.va_blksize = vap->va_blksize; + dir->d_fattr.va_nblocks = vap->va_nblocks; + dir->d_fattr.va_rdev = 0; + dir->d_fattr.va_fsid = cmpdev(dvp->v_vfsp->vfs_dev); dir->d_fattr.va_uid = cr->cr_uid; dir->d_fattr.va_gid = cr->cr_gid; dir->d_fattr.va_mtime = hrestime.tv_sec; @@ -1149,12 +1121,7 @@ bfs_create(dvp, fname, vap, excl, mode, vpp, cr) /* * Put the new dirent in the inode slot. */ - error = BFS_PUTINODE(bs->bsup_devnode, dir_off, dir, cr); - if (error) { - BFS_IOEND(bs); - kmem_free(dir, sizeof(struct bfs_dirent)); - return error; - } + BFS_PUTINODE(bs->bsup_devnode, dir_off, dir, cr); BFS_IOEND(bs); @@ -1179,6 +1146,30 @@ bfs_create(dvp, fname, vap, excl, mode, vpp, cr) return 0; } +/* ARGSUSED */ +STATIC +int +bfs_frlock(vp, cmd, bfp, flag, offset, cr) + struct vnode *vp; + int cmd; + struct flock *bfp; + int flag; + off_t offset; + struct cred *cr; +{ + int frcmd; + + if (cmd == F_GETLK || cmd == F_O_GETLK) + frcmd = 0; + else if (cmd == F_SETLK) + frcmd = SETFLCK; + else if (cmd == F_SETLKW) + frcmd = SETFLCK|SLPFLCK; + else + return EINVAL; + + return reclock(vp, bfp, frcmd, flag, offset); +} /* ARGSUSED */ STATIC int @@ -1227,6 +1218,17 @@ bfs_write(vp, uiop, ioflag, cr) BFS_IOBEGIN(bs); CHECK_LOCK(bs); + /* + * Check for busy text. + */ + if (vp->v_flag & VTEXT) { + xrele(vp); + if (vp->v_flag & VTEXT) { + BFS_IOEND(bs); + return ETXTBSY; + } + } + if (uiop->uio_offset < 0) { BFS_IOEND(bs); return EINVAL; @@ -1388,7 +1390,7 @@ bfs_write(vp, uiop, ioflag, cr) /* * Write the new dirent. */ - if (dir->d_eoffset >= (dir->d_eblock * BFS_BSIZE)) { + if (dir->d_eoffset > (dir->d_eblock * BFS_BSIZE)) { dir->d_eblock = dir->d_eoffset / BFS_BSIZE; if (!oeblock) @@ -1408,5 +1410,5 @@ bfs_write(vp, uiop, ioflag, cr) kmem_free(dir, sizeof(struct bfs_dirent)); kmem_free(buf, chunksize); BFS_IOEND(bs); - return 0; + return 0 ; } diff --git a/usr/src/uts/3b2/fs/dnlc.c b/usr/src/uts/3b2/fs/dnlc.c index d83303f..7706faf 100644 --- a/usr/src/uts/3b2/fs/dnlc.c +++ b/usr/src/uts/3b2/fs/dnlc.c @@ -5,34 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/dnlc.c 1.12" +#ident "@(#)fs:fs/dnlc.c 1.7" #include "sys/types.h" #include "sys/param.h" #include "sys/systm.h" -#include "sys/vfs.h" #include "sys/vnode.h" #include "sys/cred.h" #include "sys/dnlc.h" @@ -70,8 +46,7 @@ #define INS_HASH(ncp, nch) nc_inshash(ncp, nch) #define RM_HASH(ncp) nc_rmhash(ncp) -#define INS_LRU(ncp1, ncp2) nc_inslru((struct ncache *) ncp1, \ - (struct ncache *) ncp2) +#define INS_LRU(ncp1, ncp2) nc_inslru((struct ncache *) ncp1, (struct ncache *) ncp2) #define RM_LRU(ncp) nc_rmlru((struct ncache *) ncp) #define NULL_HASH(ncp) (ncp)->hash_next = (ncp)->hash_prev = (ncp) @@ -107,6 +82,7 @@ STATIC int doingcache = 1; STATIC void dnlc_rm(struct ncache *); STATIC struct ncache *dnlc_search(vnode_t *, char *, int, int, cred_t *); +STATIC int dnlc_has_vp(vnode_t *); STATIC void nc_inshash(struct ncache *, struct ncache *); STATIC void nc_rmhash(struct ncache *); @@ -117,6 +93,7 @@ STATIC void nc_rmlru(struct ncache *); STATIC void dnlc_rm(); STATIC struct ncache *dnlc_search(); +STATIC int dnlc_has_vp(); STATIC void nc_inshash(); STATIC void nc_rmhash(); @@ -137,7 +114,7 @@ dnlc_init() if (ncsize <= 0 || (ncache = - (struct ncache *)kmem_zalloc(ncsize * sizeof(*ncache), KM_SLEEP)) + (struct ncache *)kmem_alloc(ncsize * sizeof(*ncache), KM_SLEEP)) == NULL) { doingcache = 0; cmn_err(CE_NOTE, "No memory for name cache\n"); @@ -202,8 +179,6 @@ dnlc_enter(dp, name, vp, cred) VN_RELE(ncp->dp); if (ncp->vp != NULL) VN_RELE(ncp->vp); - if (ncp->cred != NULL) - crfree(ncp->cred); /* * Hold the vnodes we are entering and * fill in cache info. @@ -338,41 +313,6 @@ dnlc_purge_vp(vp) } while (moretodo); } -/* - * Purge cache entries referencing a vfsp. Caller supplies a count - * of entries to purge; up to that many will be freed. A count of - * zero indicates that all such entries should be purged. Returns - * the number of entries that were purged. - */ -int -dnlc_purge_vfsp(vfsp, count) - register struct vfs *vfsp; - register int count; -{ - register int moretodo; - register struct ncache *ncp; - register int n = 0; - - if (!doingcache) - return 0; - do { - moretodo = 0; - for (ncp = nc_lru.lru_next; ncp != (struct ncache *) &nc_lru; - ncp = ncp->lru_next) { - if (ncp->dp->v_vfsp == vfsp - || ncp->vp->v_vfsp == vfsp) { - n++; - dnlc_rm(ncp); - if (count == 0 || n < count) - moretodo = 1; - break; - } - } - } while (moretodo); - - return n; -} - /* * Purge any cache entry. * Called by, e.g., iget() when inode freelist is empty. @@ -506,3 +446,34 @@ nc_rmlru(ncp) ncp->lru_prev->lru_next = ncp->lru_next; ncp->lru_next->lru_prev = ncp->lru_prev; } + +/* + * Return 1 if cache has entries referencing a vnode. + */ +STATIC int +dnlc_has_vp(vp) + register vnode_t *vp; +{ + register struct ncache *ncp; + + if (!doingcache) + return 0; + ncp = nc_lru.lru_next; + for (; ncp != (struct ncache *) &nc_lru; ncp = ncp->lru_next) { + if (ncp->vp == vp) + return 1; + } + return 0; +} + +/* + * XXX -- kludge to turn off VTEXT until ETXTBSY goes away. + */ +void +xrele(vp) + register vnode_t *vp; +{ + ASSERT(vp->v_flag & VTEXT); + if (vp->v_count == 1 || (vp->v_count == 2 && dnlc_has_vp(vp))) + vp->v_flag &= ~VTEXT; +} diff --git a/usr/src/uts/3b2/fs/fifofs/fifofs.mk b/usr/src/uts/3b2/fs/fifofs/fifofs.mk index 5eb7c56..1885cdd 100644 --- a/usr/src/uts/3b2/fs/fifofs/fifofs.mk +++ b/usr/src/uts/3b2/fs/fifofs/fifofs.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)fs:fs/fifofs/fifofs.mk 1.11" +#ident "@(#)fs:fs/fifofs/fifofs.mk 1.10" ROOT = STRIP = strip INC = $(ROOT)/usr/include @@ -73,7 +73,6 @@ fifovnops.o: fifovnops.c \ $(INC)/sys/types.h \ $(INC)/sys/param.h \ $(INC)/sys/systm.h \ - $(INC)/sys/sysmacros.h \ $(INC)/sys/cred.h \ $(INC)/sys/errno.h \ $(INC)/sys/time.h \ diff --git a/usr/src/uts/3b2/fs/fifofs/fifosubr.c b/usr/src/uts/3b2/fs/fifofs/fifosubr.c index 1ec6b69..9011fb9 100644 --- a/usr/src/uts/3b2/fs/fifofs/fifosubr.c +++ b/usr/src/uts/3b2/fs/fifofs/fifosubr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/fifofs/fifosubr.c 1.37" +#ident "@(#)fs:fs/fifofs/fifosubr.c 1.32" /* * The routines defined in this file are supporting routines for FIFOFS * file sytem type. @@ -63,7 +63,7 @@ struct fifonode *fifoalloc; dev_t fifodev; struct vfs *fifovfsp; int fifofstype; -int fifoinit(), fs_sync(), fifo_stropen(); +int fifoinit(), fifosync(), fifo_stropen(); ushort fifogetid(); void fifoclearid(), fifoinsert(), fiforemove(), fifo_flush(); struct vnode *fifovp(), *makepipe(); @@ -82,7 +82,7 @@ struct vfsops fifovfsops = { fs_nosys, /* umount */ fs_nosys, /* root */ fs_nosys, /* statvfs */ - fs_sync, + fifosync, fs_nosys, /* vget */ fs_nosys, /* mountroot */ fs_nosys, /* swapvp */ @@ -90,10 +90,6 @@ struct vfsops fifovfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* @@ -133,6 +129,21 @@ fifoinit(vswp, fstype) return (0); } +/* + * VOP_FSYNC flushes file system buffers to disk. Since + * pipes and FIFOs are streams based, they have no buffers + * to be flushed. + * This routine must be supported for all file system types, + * therefore a 0 is returned instead of ENOSYS. + */ +/*ARGSUSED*/ +int +fifosync(vfsp) + struct vfs *vfsp; +{ + return (0); +} + /* * Provide a shadow for a vnode. If vp already has a shadow in the hash list, * return its shadow. Otherwise, create a vnode to shadow vp, hash the @@ -187,11 +198,15 @@ makepipe() { register struct fifonode *fnp; register struct vnode *newvp; + static ushort pipeino = 1; fnp = (struct fifonode *)kmem_zalloc(sizeof(struct fifonode), KM_SLEEP); + pipeino = fifogetid(pipeino); + fnp->fn_rcnt = fnp->fn_wcnt = 1; fnp->fn_atime = fnp->fn_mtime = fnp->fn_ctime = hrestime.tv_sec; + fnp->fn_ino = pipeino; fnp->fn_flag |= ISPIPE; newvp = FTOV(fnp); @@ -272,9 +287,6 @@ fifo_stropen(vpp, flag, crp) if ((error = stropen(oldvp, &pdev, flag, crp)) != 0) return (error); - - fnp->fn_open++; - /* * If the vnode was switched (connld on the pipe), return the * new vnode (in fn_unique field) to the upper layer and @@ -425,33 +437,3 @@ register queue_t *qp; qenable(nq); } } - -/* #ifdef MERGE */ -/* - * XENIX rdchk support. - */ -int -fifo_rdchk(vp) -struct vnode *vp; -{ - struct fifonode *fnp = VTOF(vp); - - if (vp->v_type != VFIFO || vp->v_op != &fifo_vnodeops) - return 0; - - if (fnp->fn_flag & ISPIPE) - /* - * If it's a pipe and the other end is still open, - * return 1. Otherwise, return 0. - */ - if (fnp->fn_mate) - return 1; - else - return 0; - else - /* - * For non-pipe FIFO, return number of writers. - */ - return (fnp->fn_wcnt); -} -/* #endif MERGE */ diff --git a/usr/src/uts/3b2/fs/fifofs/fifovnops.c b/usr/src/uts/3b2/fs/fifofs/fifovnops.c index 206ddcd..29ba99b 100644 --- a/usr/src/uts/3b2/fs/fifofs/fifovnops.c +++ b/usr/src/uts/3b2/fs/fifofs/fifovnops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/fifofs/fifovnops.c 1.52" +#ident "@(#)fs:fs/fifofs/fifovnops.c 1.42" /* * FIFOFS file system vnode operations. This file system * type supports STREAMS-based pipes and FIFOs. @@ -13,7 +13,6 @@ #include "sys/types.h" #include "sys/param.h" #include "sys/systm.h" -#include "sys/sysmacros.h" #include "sys/cred.h" #include "sys/errno.h" #include "sys/time.h" @@ -53,7 +52,7 @@ void fifo_inactive(), fifo_rwlock(), fifo_rwunlock(); extern int strwrite(), strread(), strioctl(), strpoll(); extern int strclose(), strclean(), putctl(); extern int fifo_stropen(), nm_unmountall(); -extern dev_t fifodev; +extern dev_t fifodev; extern void fifo_flush(), fifoclearid(), fiforemove(); extern void runqueues(); extern int cleanlocks(); @@ -101,7 +100,6 @@ struct vnodeops fifo_vnodeops = { fs_nosys, /* delmap */ fifo_poll, fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ fs_nosys, fs_nosys, @@ -110,30 +108,6 @@ struct vnodeops fifo_vnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* @@ -165,7 +139,7 @@ fifo_open(vpp, flag, crp) } if ((flag & FREAD) && (fnp->fn_rcnt++ == 0)) - wakeprocs((caddr_t) &fnp->fn_rcnt, PRMPT); + wakeup((caddr_t) &fnp->fn_rcnt); if (flag & FWRITE) { if ((flag & (FNDELAY|FNONBLOCK)) && fnp->fn_rcnt == 0) { @@ -173,7 +147,7 @@ fifo_open(vpp, flag, crp) return (ENXIO); } if (fnp->fn_wcnt++ == 0) - wakeprocs((caddr_t) &fnp->fn_wcnt, PRMPT); + wakeup((caddr_t) &fnp->fn_wcnt); } if (flag & FREAD) { while (fnp->fn_wcnt == 0) { @@ -242,34 +216,33 @@ fifo_close(vp, flag, count, offset, crp) */ if (flag & FREAD) { fnp->fn_rcnt--; - wakeprocs((caddr_t)vp->v_stream->sd_wrq, PRMPT); - wakeprocs((caddr_t) &fnp->fn_wcnt, PRMPT); + wakeup((caddr_t)vp->v_stream->sd_wrq); + wakeup((caddr_t) &fnp->fn_wcnt); } if (flag & FWRITE) { fnp->fn_wcnt--; - wakeprocs((caddr_t)RD(vp->v_stream->sd_wrq), PRMPT); - wakeprocs((caddr_t) &fnp->fn_rcnt, PRMPT); + wakeup((caddr_t)RD(vp->v_stream->sd_wrq)); + wakeup((caddr_t) &fnp->fn_rcnt); } - fnp->fn_open--; - if (fnp->fn_open > 0) - return (0); /* * If no more readers and writers, tear down the stream, send * hangup message to other side and force an unmount of * other end. */ - if ((fnp->fn_flag & ISPIPE) && fnp->fn_mate) { - putctl(vp->v_stream->sd_wrq->q_next, M_HANGUP); - qenable(vp->v_stream->sd_wrq->q_next); - fnp2 = VTOF(fnp->fn_mate); - fnp2->fn_mate = NULL; - if ((fnp->fn_mate)->v_stream->sd_flag & STRMOUNT) { - (void) nm_unmountall(FTOV(fnp2), crp); + if (vp->v_count == 1) { + if ((fnp->fn_flag & ISPIPE) && fnp->fn_mate) { + putctl(vp->v_stream->sd_wrq->q_next, M_HANGUP); + qenable(vp->v_stream->sd_wrq->q_next); + fnp2 = VTOF(fnp->fn_mate); + fnp2->fn_mate = NULL; + if ((fnp->fn_mate)->v_stream->sd_flag & STRMOUNT) { + (void) nm_unmountall(FTOV(fnp2), crp); + } } + error = strclose(vp, flag, crp); + wakeup((caddr_t) &fnp->fn_unique); + fnp->fn_mate = NULL; } - error = strclose(vp, flag, crp); - wakeprocs((caddr_t) &fnp->fn_unique, PRMPT); - fnp->fn_mate = NULL; return (error); } @@ -319,12 +292,7 @@ fifo_read(vp, uiop, ioflag, crp) fnp->fn_flag &= ~FIFOREAD; } } while ((error = strread(vp, uiop, crp)) == ESTRPIPE); - if (error == 0) { - fnp->fn_atime = hrestime.tv_sec; - if (fnp->fn_mate) - VTOF(fnp->fn_mate)->fn_atime = hrestime.tv_sec; - } - wakeprocs((caddr_t)vp->v_stream->sd_wrq, PRMPT); + wakeup((caddr_t)vp->v_stream->sd_wrq); return (error); } @@ -351,7 +319,6 @@ fifo_write(vp, uiop, ioflag, crp) { register struct fifonode *fnp = VTOF(vp); register int error = 0; - register int write_size = uiop->uio_resid; uiop->uio_offset = 0; if (!vp->v_stream) @@ -360,17 +327,14 @@ fifo_write(vp, uiop, ioflag, crp) psignal(u.u_procp, SIGPIPE); return (EPIPE); } - if ((write_size == 0) && !(vp->v_stream->sd_flag & STRSNDZERO)) + if ((uiop->uio_resid == 0) && !(vp->v_stream->sd_flag & STRSNDZERO)) return (0); while((error = strwrite(vp, uiop, crp)) == ESTRPIPE) { if (uiop->uio_fmode & FNDELAY) return (0); if (uiop->uio_fmode & FNONBLOCK) { - if (uiop->uio_resid < write_size) - return (0); - else - return (EAGAIN); + return (EAGAIN); } if (fnp->fn_rcnt == 0 || (!fnp->fn_mate && fnp->fn_flag & ISPIPE)) { psignal(u.u_procp, SIGPIPE); @@ -383,14 +347,7 @@ fifo_write(vp, uiop, ioflag, crp) fifo_rwlock(FTOV(fnp)); fnp->fn_flag &= ~FIFOWRITE; } - if (error == 0) { - fnp->fn_mtime = fnp->fn_ctime = hrestime.tv_sec; - if (fnp->fn_mate) { - VTOF(fnp->fn_mate)->fn_mtime = hrestime.tv_sec; - VTOF(fnp->fn_mate)->fn_ctime = hrestime.tv_sec; - } - } - wakeprocs((caddr_t)RD(vp->v_stream->sd_wrq), PRMPT); + wakeup((caddr_t)RD(vp->v_stream->sd_wrq)); return (error); } @@ -433,7 +390,7 @@ fifo_ioctl(vp, cmd, arg, mode, cr, rvalp) */ if (arg & FLUSHR) { (void) fifo_flush(RD(stp->sd_wrq)); - wakeprocs((caddr_t)vp->v_stream->sd_wrq, PRMPT); + wakeup((caddr_t)vp->v_stream->sd_wrq); } if ((arg & FLUSHW) && (stp->sd_wrq->q_next)) { (void) fifo_flush(stp->sd_wrq->q_next); @@ -441,7 +398,7 @@ fifo_ioctl(vp, cmd, arg, mode, cr, rvalp) wakeadr = (caddr_t)(fnp->fn_mate)->v_stream->sd_wrq; else wakeadr = (caddr_t)vp->v_stream->sd_wrq; - wakeprocs(wakeadr, PRMPT); + wakeup(wakeadr); } /* * run the queues @@ -460,7 +417,6 @@ fifo_ioctl(vp, cmd, arg, mode, cr, rvalp) * block waiting for the server to recieve the file * descriptor. */ - case I_E_RECVFD: case I_RECVFD: if (fnp->fn_flag & FIFOSEND) fifo_rwlock(FTOV(fnp)); @@ -469,7 +425,7 @@ fifo_ioctl(vp, cmd, arg, mode, cr, rvalp) if (fnp->fn_flag & FIFOSEND) { fnp->fn_flag &= ~FIFOSEND; fifo_rwunlock(FTOV(fnp)); - wakeprocs((caddr_t) &fnp->fn_unique, PRMPT); + wakeup((caddr_t) &fnp->fn_unique); } } break; @@ -491,8 +447,6 @@ fifo_getattr(vp, vap, flags, crp) { register int error = 0; register struct fifonode *fnp = VTOF(vp); - struct queue *qp; - struct qband *bandp; if (fnp->fn_realvp) { /* @@ -525,19 +479,11 @@ fifo_getattr(vp, vap, flags, crp) * nblocks is the unread bytes expressed in blocks. */ if (vp->v_stream) { - qp = RD(vp->v_stream->sd_wrq); - if (qp->q_nband == 0) - vap->va_size = qp->q_count; - else { - for (vap->va_size = qp->q_count, bandp = qp->q_bandp; - bandp; - bandp = bandp->qb_next) - vap->va_size += bandp->qb_count; - } - vap->va_nblocks = btod(vap->va_size); + vap->va_size = RD(vp->v_stream->sd_wrq)->q_count; + vap->va_nblocks = vap->va_size/PIPE_BUF; } else { - vap->va_size = 0; vap->va_nblocks = 0; + vap->va_size = 0; } vap->va_vcode = 0; return (0); @@ -637,7 +583,7 @@ fifo_inactive(vp, crp) { register struct fifonode *fnp = VTOF(vp); - if ((fnp->fn_flag & ISPIPE) && !fnp->fn_mate) + if (fnp->fn_flag & ISPIPE) fifoclearid(fnp->fn_ino); if (fnp->fn_realvp) { (void) fifo_fsync(vp, crp); @@ -690,7 +636,7 @@ fifo_rwunlock(vp) fnp->fn_flag &= ~FIFOLOCK; if( fnp->fn_flag & FIFOWANT) { fnp->fn_flag &= ~FIFOWANT; - wakeprocs((caddr_t) fnp, PRMPT); + wakeup((caddr_t) fnp); } } diff --git a/usr/src/uts/3b2/fs/fs.fast.mk b/usr/src/uts/3b2/fs/fs.fast.mk new file mode 100644 index 0000000..0b10f59 --- /dev/null +++ b/usr/src/uts/3b2/fs/fs.fast.mk @@ -0,0 +1,298 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)fs:fs/fs.fast.mk 1.21" +ROOT = +STRIP = strip +INC = $(ROOT)/usr/include +MKBOOT = mkboot +MASTERD = ../master.d +CC = cc + +DASHG = +DASHO = -O +PFLAGS = $(DASHG) -D_KERNEL $(MORECPP) +CFLAGS = $(DASHO) $(PFLAGS) +DEFLIST = +FRC = + +FILES = \ + dnlc.o \ + fs_subr.o \ + fsflush.o \ + lookup.o \ + pathname.o \ + strcalls.o \ + vfs.o \ + vncalls.o \ + vnode.o + +all: fs.o fstypes + +fs.o: $(FILES) + $(LD) -r -o fs.o $(FILES) + +.c.o: + $(CC) $(DEFLIST) -I$(INC) $(CFLAGS) -c $*.c + +fstypes: + @for i in `ls`;\ + do\ + if [ -d $$i -a -f $$i/$$i.mk ];then\ + case $$i in\ + *.*)\ + ;;\ + *)\ + cd $$i;\ + echo "====== $(MAKE) -f $$i.mk \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\"&";\ + $(MAKE) -f $$i.mk "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)"; &\ + cd .. ;; \ + esac;\ + fi;\ + done + +clean: + -rm -f *.o + @for i in `ls`; \ + do \ + if [ -d $$i -a -f $$i/$$i.mk ]; then \ + cd $$i; \ + $(MAKE) -f $$i.mk clean; \ + cd ..; \ + fi; \ + done + +clobber: clean + @for i in `ls`; \ + do \ + if [ -d $$i -a -f $$i/$$i.mk ]; then \ + cd $$i; \ + $(MAKE) -f $$i.mk clobber; \ + cd ..; \ + fi; \ + done + +# +# Header dependencies +# + +dnlc.o: dnlc.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/dnlc.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/user.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/cmn_err.h \ + $(FRC) + +fs_subr.o: fs_subr.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/fcntl.h \ + $(INC)/sys/flock.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/file.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/user.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/poll.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/list.h \ + $(INC)/sys/stream.h \ + $(INC)/sys/rf_comm.h \ + $(INC)/fs/fs_subr.h \ + $(FRC) + +fsflush.o: fsflush.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/tuneable.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/user.h \ + $(INC)/sys/var.h \ + $(INC)/sys/buf.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/swap.h \ + $(INC)/sys/vm.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/sysinfo.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/page.h \ + $(INC)/vm/pvn.h \ + $(FRC) + +lookup.o: lookup.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/sysinfo.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/disp.h \ + $(FRC) + +pathname.o: pathname.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/vnode.h \ + $(FRC) + +strcalls.o: strcalls.c \ + $(INC)/sys/types.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/file.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/var.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/stropts.h \ + $(INC)/sys/stream.h \ + $(FRC) + +vfs.o: vfs.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/user.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/fstyp.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/mount.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/statvfs.h \ + $(INC)/sys/statfs.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/dnlc.h \ + $(INC)/sys/file.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(FRC) + +vncalls.o: vncalls.c \ + $(INC)/sys/param.h \ + $(INC)/sys/types.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/time.h \ + $(INC)/sys/fcntl.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/stat.h \ + $(INC)/sys/ttold.h \ + $(INC)/sys/var.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/file.h \ + $(INC)/sys/mode.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/sysinfo.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/poll.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/filio.h \ + $(INC)/sys/locking.h \ + $(INC)/sys/disp.h \ + $(INC)/sys/mkdev.h \ + $(INC)/sys/time.h \ + $(FRC) + +vnode.o: vnode.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/file.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/stat.h \ + $(INC)/sys/mode.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/disp.h \ + $(INC)/sys/systm.h \ + $(FRC) diff --git a/usr/src/uts/3b2/fs/fs.full.mk b/usr/src/uts/3b2/fs/fs.full.mk new file mode 100644 index 0000000..3a5852f --- /dev/null +++ b/usr/src/uts/3b2/fs/fs.full.mk @@ -0,0 +1,298 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)fs:fs/fs.full.mk 1.22" +ROOT = +STRIP = strip +INC = $(ROOT)/usr/include +MKBOOT = mkboot +MASTERD = ../master.d +CC = cc + +DASHG = +DASHO = -O +PFLAGS = $(DASHG) -D_KERNEL $(MORECPP) +CFLAGS = $(DASHO) $(PFLAGS) +DEFLIST = +FRC = + +FILES = \ + dnlc.o \ + fs_subr.o \ + fsflush.o \ + lookup.o \ + pathname.o \ + strcalls.o \ + vfs.o \ + vncalls.o \ + vnode.o + +all: fs.o fstypes + +fs.o: $(FILES) + $(LD) -r -o fs.o $(FILES) + +.c.o: + $(CC) $(DEFLIST) -I$(INC) $(CFLAGS) -c $*.c + +fstypes: + @for i in `ls`;\ + do\ + if [ -d $$i -a -f $$i/$$i.mk ];then\ + case $$i in\ + *.*)\ + ;;\ + *)\ + cd $$i;\ + echo "====== $(MAKE) -f $$i.mk \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\"";\ + $(MAKE) -f $$i.mk "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)"; \ + cd .. ;; \ + esac;\ + fi;\ + done + +clean: + -rm -f *.o + @for i in `ls`; \ + do \ + if [ -d $$i -a -f $$i/$$i.mk ]; then \ + cd $$i; \ + $(MAKE) -f $$i.mk clean; \ + cd ..; \ + fi; \ + done + +clobber: clean + @for i in `ls`; \ + do \ + if [ -d $$i -a -f $$i/$$i.mk ]; then \ + cd $$i; \ + $(MAKE) -f $$i.mk clobber; \ + cd ..; \ + fi; \ + done + +# +# Header dependencies +# + +dnlc.o: dnlc.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/dnlc.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/user.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/cmn_err.h \ + $(FRC) + +fs_subr.o: fs_subr.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/fcntl.h \ + $(INC)/sys/flock.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/file.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/user.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/poll.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/list.h \ + $(INC)/sys/stream.h \ + $(INC)/sys/rf_comm.h \ + $(INC)/fs/fs_subr.h \ + $(FRC) + +fsflush.o: fsflush.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/tuneable.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/user.h \ + $(INC)/sys/var.h \ + $(INC)/sys/buf.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/swap.h \ + $(INC)/sys/vm.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/sysinfo.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/page.h \ + $(INC)/vm/pvn.h \ + $(FRC) + +lookup.o: lookup.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/sysinfo.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/disp.h \ + $(FRC) + +pathname.o: pathname.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/vnode.h \ + $(FRC) + +strcalls.o: strcalls.c \ + $(INC)/sys/types.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/file.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/var.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/stropts.h \ + $(INC)/sys/stream.h \ + $(FRC) + +vfs.o: vfs.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/user.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/fstyp.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/mount.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/statvfs.h \ + $(INC)/sys/statfs.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/dnlc.h \ + $(INC)/sys/file.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(FRC) + +vncalls.o: vncalls.c \ + $(INC)/sys/param.h \ + $(INC)/sys/types.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/time.h \ + $(INC)/sys/fcntl.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/stat.h \ + $(INC)/sys/ttold.h \ + $(INC)/sys/var.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/file.h \ + $(INC)/sys/mode.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/sysinfo.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/poll.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/filio.h \ + $(INC)/sys/locking.h \ + $(INC)/sys/disp.h \ + $(INC)/sys/mkdev.h \ + $(INC)/sys/time.h \ + $(FRC) + +vnode.o: vnode.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/user.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/file.h \ + $(INC)/sys/pathname.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/stat.h \ + $(INC)/sys/mode.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/disp.h \ + $(INC)/sys/systm.h \ + $(FRC) diff --git a/usr/src/uts/3b2/fs/fs.mk b/usr/src/uts/3b2/fs/fs.mk index 8944509..c991b6d 100644 --- a/usr/src/uts/3b2/fs/fs.mk +++ b/usr/src/uts/3b2/fs/fs.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)fs:fs/fs.mk 1.39" +#ident "@(#)fs:fs/fs.mk 1.33" ROOT = STRIP = strip INC = $(ROOT)/usr/include @@ -84,7 +84,6 @@ dnlc.o: dnlc.c \ $(INC)/sys/types.h \ $(INC)/sys/param.h \ $(INC)/sys/systm.h \ - $(INC)/sys/vfs.h \ $(INC)/sys/vnode.h \ $(INC)/sys/cred.h \ $(INC)/sys/dnlc.h \ @@ -105,9 +104,7 @@ fs_subr.o: fs_subr.c \ $(INC)/sys/errno.h \ $(INC)/sys/fcntl.h \ $(INC)/sys/flock.h \ - $(INC)/sys/statvfs.h \ $(INC)/sys/uio.h \ - $(INC)/sys/unistd.h \ $(INC)/sys/vfs.h \ $(INC)/sys/vnode.h \ $(INC)/sys/file.h \ @@ -123,8 +120,6 @@ fs_subr.o: fs_subr.c \ $(INC)/sys/cmn_err.h \ $(INC)/sys/list.h \ $(INC)/sys/stream.h \ - $(INC)/sys/rf_messg.h \ - $(INC)/sys/rf_comm.h \ $(INC)/sys/rf_comm.h \ $(INC)/fs/fs_subr.h \ $(FRC) @@ -274,7 +269,8 @@ vncalls.o: vncalls.c \ $(INC)/sys/disp.h \ $(INC)/sys/mkdev.h \ $(INC)/sys/time.h \ - $(INC)/sys/unistd.h \ + $(INC)/rpc/types.h \ + $(INC)/nfs/nfs.h \ $(FRC) vnode.o: vnode.c \ diff --git a/usr/src/uts/3b2/fs/fs_subr.c b/usr/src/uts/3b2/fs/fs_subr.c index 79e5662..ad9bc0c 100644 --- a/usr/src/uts/3b2/fs/fs_subr.c +++ b/usr/src/uts/3b2/fs/fs_subr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/fs_subr.c 1.22" +#ident "@(#)fs:fs/fs_subr.c 1.16" /* * Generic vnode operations. @@ -17,9 +17,7 @@ #include "sys/errno.h" #include "sys/fcntl.h" #include "sys/flock.h" -#include "sys/statvfs.h" #include "sys/uio.h" -#include "sys/unistd.h" #include "sys/vfs.h" #include "sys/vnode.h" #include "sys/file.h" @@ -35,7 +33,6 @@ #include "sys/cmn_err.h" #include "sys/list.h" #include "sys/stream.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "fs/fs_subr.h" @@ -110,31 +107,25 @@ fs_frlock(vp, cmd, bfp, flag, offset, cr) case F_O_GETLK: bfp->l_pid = u.u_procp->p_epid; bfp->l_sysid = u.u_procp->p_sysid; - frcmd = 0; - break; - + /* FALLTHROUGH */ case F_RGETLK: - frcmd = RCMDLCK; + frcmd = 0; break; case F_SETLK: bfp->l_pid = u.u_procp->p_epid; bfp->l_sysid = u.u_procp->p_sysid; - frcmd = SETFLCK; - break; - + /* FALLTHROUGH */ case F_RSETLK: - frcmd = SETFLCK|RCMDLCK; + frcmd = SETFLCK; break; case F_SETLKW: bfp->l_pid = u.u_procp->p_epid; bfp->l_sysid = u.u_procp->p_sysid; - frcmd = SETFLCK|SLPFLCK; - break; - + /* FALLTHROUGH */ case F_RSETLKW: - frcmd = SETFLCK|SLPFLCK|RCMDLCK; + frcmd = SETFLCK|SLPFLCK; break; default: @@ -223,75 +214,3 @@ fs_vcode(vp, vcp) } return error; } - -/* - * POSIX pathconf() support. - */ -/* ARGSUSED */ -int -fs_pathconf(vp, cmd, valp, cr) - struct vnode *vp; - int cmd; - u_long *valp; - struct cred *cr; -{ - register u_long val; - register int error = 0; - struct statvfs vfsbuf; - - switch (cmd) { - - case _PC_LINK_MAX: - val = MAXLINK; - break; - - case _PC_MAX_CANON: - val = MAX_CANON; - break; - - case _PC_MAX_INPUT: - val = MAX_INPUT; - break; - - case _PC_NAME_MAX: - struct_zero((caddr_t)&vfsbuf, sizeof(vfsbuf)); - if (error = VFS_STATVFS(vp->v_vfsp, &vfsbuf)) - break; - val = vfsbuf.f_namemax; - break; - - case _PC_PATH_MAX: - val = MAXPATHLEN; - break; - - case _PC_PIPE_BUF: - val = PIPE_BUF; - break; - - case _PC_NO_TRUNC: - if (vp->v_vfsp->vfs_flag & VFS_NOTRUNC) - val = 1; /* NOTRUNC is enabled for vp */ - else - val = (u_long)-1; - break; - - case _PC_VDISABLE: - val = _POSIX_VDISABLE; - break; - - case _PC_CHOWN_RESTRICTED: - if (rstchown) - val = rstchown; /* chown restricted enabled */ - else - val = (u_long)-1; - break; - - default: - error = EINVAL; - break; - } - - if (error == 0) - *valp = val; - return error; -} diff --git a/usr/src/uts/3b2/fs/fs_subr.h b/usr/src/uts/3b2/fs/fs_subr.h index 043ce6b..ddf95fb 100644 --- a/usr/src/uts/3b2/fs/fs_subr.h +++ b/usr/src/uts/3b2/fs/fs_subr.h @@ -5,11 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/fs_subr.h 1.4" +#ident "@(#)fs:fs/fs_subr.h 1.3" #ifndef _FS_FS_SUBR_H #define _FS_FS_SUBR_H -#ident "@(#)fs:fs/fs_subr.h 1.4" +#ident "@(#)fs:fs/fs_subr.h 1.3" /* * Utilities shared among file system implementations. @@ -23,6 +23,5 @@ extern int fs_frlock(); extern int fs_setfl(); extern int fs_poll(); extern int fs_vcode(); -extern int fs_pathconf(); #endif /* _FS_FS_SUBR_H */ diff --git a/usr/src/uts/3b2/fs/fsflush.c b/usr/src/uts/3b2/fs/fsflush.c index da648ad..6717de1 100644 --- a/usr/src/uts/3b2/fs/fsflush.c +++ b/usr/src/uts/3b2/fs/fsflush.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/fsflush.c 1.11" +#ident "@(#)fs:fs/fsflush.c 1.7" #include "sys/types.h" #include "sys/param.h" @@ -30,8 +30,8 @@ #include "vm/page.h" #include "vm/pvn.h" -int doiflush = 1; /* non-zero to turn inode flushing on */ -int dopageflush = 1; /* non-zero to turn page flushing on */ +int dopageflush = 1; /* must be non-zero to turn page flushing on */ +extern struct buf bhdrlist; /* * As part of file system hardening, this daemon is waken @@ -44,14 +44,12 @@ fsflush() register struct buf *bp; register autoup; register struct page *pp = pages; - unsigned int i, s, nscan, pcount, icount, count = 0; + int i, s, nscan, pcount, count = 0; - ASSERT(v.v_autoup > 0); - ASSERT(tune.t_fsflushr > 0); autoup = v.v_autoup * HZ; - nscan = ((epages-pages) * (tune.t_fsflushr))/v.v_autoup; - icount = v.v_autoup / tune.t_fsflushr; + ASSERT(v.v_autoup > 0); + nscan = (epages-pages)/v.v_autoup; loop: s = spl6(); for (bp = bfreelist.av_forw; bp != &bfreelist; bp = bp->av_forw) { @@ -64,8 +62,49 @@ fsflush() } } + /* + * To prevent getfreeblk from hanging for a long + * period of time (up to autoup seconds), free one + * buffer from the buffer cache when someone is + * waiting for a free buffer header. + */ + if (bhdrlist.b_flags & B_WANTED) { + for (bp = bfreelist.av_forw;bp != &bfreelist;bp = bp->av_forw) { + if ((bp->b_flags & B_DELWRI) == 0) { + notavail(bp); + bp->av_forw = bp->av_back = NULL; + bremhash(bp); + kmem_free(bp->b_un.b_addr, (int)bp->b_bufsize); + bfreelist.b_bufsize += bp->b_bufsize; + struct_zero((caddr_t)bp, sizeof(struct buf)); + bp->b_flags |= B_KERNBUF; + bp->av_forw = bhdrlist.av_forw; + bhdrlist.av_forw = bp; + bhdrlist.b_flags &= ~B_WANTED; + wakeup((caddr_t)&bhdrlist); + break; + } + + } + } + + /* + * Every autoup times through the loop, flush cached attribute + * information (e.g. inodes). + */ + if (count++ >= v.v_autoup) { + count = 0; + + /* + * Sync back cached data. + */ + for (i = 1; i < nfstype; i++) + (void)(*vfssw[i].vsw_vfsops->vfs_sync)(NULL, + SYNC_ATTR, u.u_cred); + } + if (!dopageflush) - goto iflush_out; + goto out; /* * Flush dirty pages. @@ -75,9 +114,11 @@ fsflush() /* * Reject pages that don't make sense to free. */ - if (!pp->p_vnode || pp->p_free || pp->p_lock || pp->p_intrans - || pp->p_lckcnt > 0 || pp->p_cowcnt > 0 || pp->p_keepcnt > 0 - || IS_SWAPVP(pp->p_vnode) || pp->p_vnode->v_type == VCHR) { + if (pp->p_lock || pp->p_free || pp->p_intrans || + pp->p_lckcnt > 0 || pp->p_cowcnt > 0 || + pp->p_keepcnt > 0 || !pp->p_vnode || + IS_SWAPVP(pp->p_vnode) || + pp->p_vnode->v_type == VCHR) { if (++pp >= epages) pp = pages; continue; @@ -97,24 +138,6 @@ fsflush() pp = pages; } -iflush_out: - if (!doiflush) - goto out; - - /* - * Flush cached attribute information (e.g. inodes). - */ - if (count++ >= icount) { - count = 0; - - /* - * Sync back cached data. - */ - for (i = 1; i < nfstype; i++) - (void)(*vfssw[i].vsw_vfsops->vfs_sync)(NULL, - SYNC_ATTR, u.u_cred); - } - out: (void) splx(s); sleep((caddr_t)fsflush, PRIBIO); diff --git a/usr/src/uts/3b2/fs/lookup.c b/usr/src/uts/3b2/fs/lookup.c index 0feef35..95e6668 100644 --- a/usr/src/uts/3b2/fs/lookup.c +++ b/usr/src/uts/3b2/fs/lookup.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/lookup.c 1.17" +#ident "@(#)fs:fs/lookup.c 1.13" #include "sys/types.h" #include "sys/param.h" #include "sys/systm.h" @@ -336,7 +313,7 @@ traverse(cvpp) while ((vfsp = cvp->v_vfsmountedhere) != NULL) { if (vfsp->vfs_flag & VFS_MLOCK) { vfsp->vfs_flag |= VFS_MWAIT; - (void) sleep((caddr_t)vfsp, PVFS|PCATCH); + (void) sleep((caddr_t)vfsp, PVFS); goto mloop; } if (error = VFS_ROOT(vfsp, &tvp)) diff --git a/usr/src/uts/3b2/fs/namefs/namevfs.c b/usr/src/uts/3b2/fs/namefs/namevfs.c index b76d99f..062f3ff 100644 --- a/usr/src/uts/3b2/fs/namefs/namevfs.c +++ b/usr/src/uts/3b2/fs/namefs/namevfs.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/namefs/namevfs.c 1.26" +#ident "@(#)fs:fs/namefs/namevfs.c 1.21" /* * This file supports the vfs operations for the NAMEFS file system. */ @@ -63,7 +63,7 @@ char nmap [NMMAP]; * Define the routines in this file. */ int nm_mount(), nm_unmount(), nm_root(); - int nm_sync(), nm_statvfs(); + int nm_statvfs(); struct namenode *namefind(); void nameinsert(), nameremove(); void nmclearid(); @@ -81,7 +81,6 @@ extern int dounmount(), suser(); dev_t namedev; int namefstype; struct namenode *namealloc; -struct vfs *namevfsp; /* * Define the vfs operations vector. @@ -91,7 +90,7 @@ struct vfsops nmvfsops = { nm_unmount, nm_root, nm_statvfs, - nm_sync, + fs_sync, fs_nosys, /* vget */ fs_nosys, /* mountroot */ fs_nosys, /* swapvp */ @@ -99,30 +98,7 @@ struct vfsops nmvfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, -}; -struct vfsops dummyvfsops = { - fs_nosys, /* mount */ - fs_nosys, /* unmount */ - fs_nosys, /* root */ - nm_statvfs, - nm_sync, - fs_nosys, /* vget */ - fs_nosys, /* mountroot */ - fs_nosys, /* swapvp */ - fs_nosys, /* filler */ - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; - /* * File system initialization routine. Save the file system * type, establish a file system device number and initialize @@ -143,18 +119,6 @@ nameinit(vswp, fstype) } namedev = makedevice(dev, 0); namealloc = NULL; - namevfsp = (struct vfs *)kmem_zalloc(sizeof(struct vfs), KM_SLEEP); - namevfsp->vfs_next = NULL; - namevfsp->vfs_op = &dummyvfsops; - namevfsp->vfs_vnodecovered = NULL; - namevfsp->vfs_flag = 0; - namevfsp->vfs_bsize = 1024; - namevfsp->vfs_fstype = namefstype; - namevfsp->vfs_fsid.val[0] = namedev; - namevfsp->vfs_fsid.val[1] = namefstype; - namevfsp->vfs_data = NULL; - namevfsp->vfs_dev = namedev; - namevfsp->vfs_bcount = 0; return (0); } @@ -181,13 +145,13 @@ nm_mount(vfsp, mvp, uap, crp) struct cred *crp; /* user credentials */ { struct namefd namefdp; - struct vnode *vp; /* file descriptor vnode */ - struct file *fp; + struct vnode *fd_vnode; /* file descriptor vnode */ struct vnode *newvp; /* vnode representing this mount */ struct namenode *nodep; /* namenode for this mount */ - struct vattr vattr; /* attributes of file dec. */ + struct vattr fd_vattr; /* attributes of file dec. */ struct vattr *vattrp; /* attributes of this mount */ int error = 0; + struct file *filep; static u_short nodeid = 1; /* @@ -207,9 +171,9 @@ nm_mount(vfsp, mvp, uap, crp) return (EINVAL); if (copyin(uap->dataptr, (caddr_t) &namefdp, uap->datalen)) return (EFAULT); - if (error = getf(namefdp.fd, &fp)) + if (error = getf(namefdp.fd, &filep)) return (error); - vp = fp->f_vnode; + fd_vnode = filep->f_vnode; /* * Make sure the file descriptor is not the root of some @@ -217,9 +181,10 @@ nm_mount(vfsp, mvp, uap, crp) * If it's not, create a reference and allocate a namenode * to represent this mount request. */ - if (vp->v_flag & VROOT) + if (fd_vnode->v_flag & VROOT) return (EBUSY); + VN_HOLD(fd_vnode); nodep = (struct namenode *) kmem_zalloc(sizeof(struct namenode), KM_SLEEP); @@ -227,7 +192,7 @@ nm_mount(vfsp, mvp, uap, crp) if (error = VOP_GETATTR(mvp, vattrp, 0, crp)) goto out; - if (error = VOP_GETATTR(vp, &vattr, 0, crp)) + if (error = VOP_GETATTR(fd_vnode, &fd_vattr, 0, crp)) goto out; /* * Make sure the user is the owner of the mount point with @@ -248,7 +213,7 @@ nm_mount(vfsp, mvp, uap, crp) * If the file descriptor has file/record locking, don't * allow the mount to succeed. */ - if (vp->v_filocks) { + if (fd_vnode->v_filocks) { error = EACCES; goto out; } @@ -256,7 +221,8 @@ nm_mount(vfsp, mvp, uap, crp) * Establish a unique node id to represent the mount. * If can't, return error. */ - if ((nodeid = nmgetid(nodeid)) == 0) { + nodeid = nmgetid(nodeid); + if (nodeid == 0) { error = ENOMEM; goto out; } @@ -264,11 +230,9 @@ nm_mount(vfsp, mvp, uap, crp) /* * Initialize the namenode. */ - if (vp->v_stream) - vp->v_stream->sd_flag |= STRMOUNT; - nodep->nm_filevp = vp; - fp->f_count++; - nodep->nm_filep = fp; + if (fd_vnode->v_stream) + fd_vnode->v_stream->sd_flag |= STRMOUNT; + nodep->nm_filevp = fd_vnode; nodep->nm_mountpt = mvp; /* @@ -277,28 +241,28 @@ nm_mount(vfsp, mvp, uap, crp) * the fields of the attributes structure will be overwritten * by the attributes from the file descriptor. */ - vattrp->va_type = vattr.va_type; + vattrp->va_type = fd_vattr.va_type; vattrp->va_fsid = namedev; vattrp->va_nodeid = nodeid; vattrp->va_nlink = 1; - vattrp->va_size = vattr.va_size; - vattrp->va_rdev = vattr.va_rdev; - vattrp->va_blksize = vattr.va_blksize; - vattrp->va_nblocks = vattr.va_nblocks; - vattrp->va_vcode = vattr.va_vcode; + vattrp->va_size = fd_vattr.va_size; + vattrp->va_rdev = fd_vattr.va_rdev; + vattrp->va_blksize = fd_vattr.va_blksize; + vattrp->va_nblocks = fd_vattr.va_nblocks; + vattrp->va_vcode = fd_vattr.va_vcode; /* * Initialize the new vnode structure for the mounted file * descriptor. */ newvp = NMTOV(nodep); - newvp->v_flag = (vp->v_flag | VROOT); + newvp->v_flag = (fd_vnode->v_flag | VROOT); newvp->v_count = 1; newvp->v_op = &nm_vnodeops; newvp->v_vfsp = vfsp; - newvp->v_stream = vp->v_stream; - newvp->v_type = vp->v_type; - newvp->v_rdev = vp->v_rdev; + newvp->v_stream = fd_vnode->v_stream; + newvp->v_type = fd_vnode->v_type; + newvp->v_rdev = fd_vnode->v_rdev; newvp->v_data = (caddr_t) nodep; /* @@ -318,6 +282,7 @@ nm_mount(vfsp, mvp, uap, crp) out: kmem_free((caddr_t)nodep, sizeof(struct namenode)); + VN_RELE(fd_vnode); return (error); } @@ -337,22 +302,20 @@ nm_unmount(vfsp, crp) struct cred *crp; { struct namenode *nodep = (struct namenode *) vfsp->vfs_data; - struct vnode *vp; - struct file *fp; - int error; + struct vnode *filevp; + int error = 0; - vp = nodep->nm_filevp; - fp = nodep->nm_filep; - if (nodep->nm_vattr.va_uid != crp->cr_uid && !suser(crp)) + filevp = nodep->nm_filevp; + if (nodep->nm_vattr.va_uid != u.u_cred->cr_uid && !suser(crp)) return (EPERM); nameremove(nodep); - if (namefind(vp, NULL) == NULL && vp->v_stream) - vp->v_stream->sd_flag &= ~STRMOUNT; - vfsp->vfs_flag |= ~VFS_UNLINKABLE; - NMTOV(nodep)->v_flag |= ~VROOT; - NMTOV(nodep)->v_vfsp = namevfsp; - error = closef(fp); + if (namefind(filevp, NULL) == NULL && filevp->v_stream) + filevp->v_stream->sd_flag &= ~STRMOUNT; + if (filevp->v_count == 1) + error = VOP_CLOSE(filevp, 0, 0, 0, crp); + + VN_RELE(filevp); return (error); } @@ -403,25 +366,17 @@ nm_statvfs(vfsp, sp) * the VOP_FSYNC operation on the mounted file descriptor. */ int -nm_sync(vfsp, flag, crp) +nm_sync(vfsp) struct vfs *vfsp; - short flag; - struct cred *crp; { struct namenode *nodep = (struct namenode *) vfsp->vfs_data; - if (!vfsp) - return(0); - - if (flag == SYNC_CLOSE) - return (nm_unmountall(nodep->nm_filevp, crp)); - - return (VOP_FSYNC(nodep->nm_filevp, crp)); + return (VOP_FSYNC(nodep->nm_filevp, u.u_cred)); } /* * Insert a namenode into the namealloc hash list. - * namealloc is a doubly linked list that contains namenode + * namealloc is a doubly linked list that caontains namenode * as links. Each link has a unique namenode with a unique * nm_mountvp field. The nm_filevp field of the namenode need not * be unique, since a file descriptor may be mounted to multiple @@ -566,7 +521,7 @@ nm_unmountall(vp, crp) * call dounmount(). */ while ((nodep = namefind(vp, (struct vnode *)NULL)) != NULL) { - if ((vfsp = NMTOV(nodep)->v_vfsp) != namevfsp) { + if ((vfsp = NMTOV(nodep)->v_vfsp) != NULL) { error = dounmount(vfsp, crp); VN_RELE(NMTOV(nodep)); } diff --git a/usr/src/uts/3b2/fs/namefs/namevno.c b/usr/src/uts/3b2/fs/namefs/namevno.c index 1ac1839..5609544 100644 --- a/usr/src/uts/3b2/fs/namefs/namevno.c +++ b/usr/src/uts/3b2/fs/namefs/namevno.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/namefs/namevno.c 1.27.1.2" +#ident "@(#)fs:fs/namefs/namevno.c 1.25" /* * This file defines the vnode operations for mounted file descriptors. * The routines in this file act as a layer between the NAMEFS file @@ -48,7 +48,7 @@ int nm_open(), nm_close(), nm_read(), nm_write(); int nm_ioctl(), nm_getattr(), nm_setattr(), nm_access(); int nm_link(), nm_fsync(), nm_fid(), nm_seek(); int nm_realvp(), nm_poll(); -void nm_inactive(), nm_rwlock(), nm_rwunlock(); +void nm_inactive(), nm_rwlock(), nm_rwunlock(); /* * Define external routines. @@ -95,39 +95,14 @@ struct vnodeops nm_vnodeops = { fs_nosys, /* delmap */ nm_poll, fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, + fs_nosys, /* filler */ + fs_nosys, /* filler */ + fs_nosys, /* filler */ + fs_nosys, /* filler */ + fs_nosys, /* filler */ + fs_nosys, /* filler */ + fs_nosys, /* filler */ }; /* @@ -531,7 +506,7 @@ nm_rwunlock(vp) nodep->nm_flag &= ~NMLOCK; if( nodep->nm_flag & NMWANT) { nodep->nm_flag &= ~NMWANT; - wakeprocs((caddr_t) nodep, PRMPT); + wakeup((caddr_t) nodep); } } diff --git a/usr/src/uts/3b2/fs/nfs/nfs.mk b/usr/src/uts/3b2/fs/nfs/nfs.mk index 0a97fe9..008a117 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs.mk +++ b/usr/src/uts/3b2/fs/nfs/nfs.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)fs:fs/nfs/nfs.mk 1.7" +#ident "@(#)fs:fs/nfs/nfs.mk 1.6" # # # PROPRIETARY NOTICE (Combined) @@ -40,7 +40,6 @@ FRC = FILES = \ nfs_aux.o\ nfs_client.o\ - nfs_cnvt.o\ nfs_common.o\ nfs_export.o\ nfs_server.o\ @@ -102,22 +101,6 @@ nfs_client.o: nfs_client.c \ $(INC)/nfs/rnode.h \ $(FRC) -nfs_cnvt.o: nfs_cnvt.c \ - $(INC)/sys/param.h \ - $(INC)/sys/types.h \ - $(INC)/sys/systm.h \ - $(INC)/sys/cred.h \ - $(INC)/sys/user.h \ - $(INC)/sys/errno.h \ - $(INC)/sys/vfs.h \ - $(INC)/sys/vnode.h \ - $(INC)/sys/file.h \ - $(INC)/sys/proc.h \ - $(INC)/sys/debug.h \ - $(INC)/rpc/types.h \ - $(INC)/nfs/nfs.h \ - $(FRC) - nfs_common.o: nfs_common.c \ $(INC)/sys/errno.h \ $(INC)/sys/param.h \ @@ -247,6 +230,7 @@ nfs_vfsops.o: nfs_vfsops.c \ $(INC)/rpc/xdr.h \ $(INC)/rpc/auth.h \ $(INC)/rpc/clnt.h \ + $(INC)/rpc/pmap_prot.h \ $(INC)/nfs/nfs.h \ $(INC)/nfs/nfs_clnt.h \ $(INC)/nfs/rnode.h \ diff --git a/usr/src/uts/3b2/fs/nfs/nfs_aux.c b/usr/src/uts/3b2/fs/nfs/nfs_aux.c index 4f5deee..4b27cc8 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_aux.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_aux.c @@ -5,11 +5,9 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_aux.c 1.2" +#ident "@(#)fs:fs/nfs/nfs_aux.c 1.1" #include "sys/types.h" #include "sys/vfs.h" -#include "sys/kmem.h" -#include "sys/tiuser.h" /* * PROPRIETARY NOTICE (Combined) @@ -50,10 +48,10 @@ * vfs_getnum() and vfs_putnum() and its own private minor device number map. */ -#define NBBY 8 -#define LOGBBY 3 -#define MAJOR_MIN 128 -#define vfsNVFS (&vfssw[nfstype]) +#define NBBY 8 +#define LOGBBY 3 +#define MAJOR_MIN 128 +#define vfsNVFS (&vfssw[nfstype]) /* * Return the reserved major device number for this filesystem type @@ -109,29 +107,3 @@ vfs_putnum(map, n) if (n >= 0) map[n >> LOGBBY] &= ~(1 << (n - ((n >> LOGBBY) << LOGBBY))); } - -struct netbuf * -nfs_copyin_netbuf(from) - struct netbuf *from; -{ - struct netbuf *addr; - char *userbufptr; - - addr = kmem_alloc(sizeof (struct netbuf), KM_SLEEP); - - if (copyin((caddr_t) from, (caddr_t) addr, sizeof (struct netbuf))) { - kmem_free((caddr_t) addr, sizeof (struct netbuf)); - return ((struct netbuf *) 0); - } - - userbufptr = addr->buf; - addr->buf = kmem_alloc(addr->len, KM_SLEEP); - addr->maxlen = addr->len; - if (copyin(userbufptr, addr->buf, addr->len)) { - kmem_free((caddr_t) addr->buf, addr->len); - kmem_free((caddr_t) addr, sizeof (struct netbuf)); - return ((struct netbuf *) 0); - } - - return (addr); -} diff --git a/usr/src/uts/3b2/fs/nfs/nfs_client.c b/usr/src/uts/3b2/fs/nfs/nfs_client.c index 099bac8..dda8965 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_client.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_client.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_client.c 1.11" +#ident "@(#)fs:fs/nfs/nfs_client.c 1.10" /* @(#)nfs_client.c 1.9 88/08/02 SMI */ @@ -118,13 +118,13 @@ nfs_attrcache(vp, na) { #ifdef VNOCACHE - /* LINTED pointer alignment */ - if ((vp->v_flag & VNOCACHE) || vtomi(vp)->mi_noac) + if ((vp->v_flag & VNOCACHE) || vtomi(vp)->mi_noac) { #else /* LINTED pointer alignment */ - if (vtomi(vp)->mi_noac) + if (vtomi(vp)->mi_noac) { #endif return; + } /* LINTED pointer alignment */ nattr_to_vattr(vp, na, &vtor(vp)->r_attr); set_attrcache_time(vp); @@ -140,13 +140,13 @@ nfs_attrcache_va(vp, va) { #ifdef VNOCACHE - /* LINTED pointer alignment */ - if ((vp->v_flag & VNOCACHE) || vtomi(vp)->mi_noac) + if ((vp->v_flag & VNOCACHE) || vtomi(vp)->mi_noac) { #else /* LINTED pointer alignment */ - if (vtomi(vp)->mi_noac) + if (vtomi(vp)->mi_noac) { #endif return; + } /* LINTED pointer alignment */ vtor(vp)->r_attr = *va; vp->v_type = va->va_type; diff --git a/usr/src/uts/3b2/fs/nfs/nfs_common.c b/usr/src/uts/3b2/fs/nfs/nfs_common.c index 86da119..0f6ff11 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_common.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_common.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_common.c 1.7" +#ident "@(#)fs:fs/nfs/nfs_common.c 1.6" /* @(#)nfs_common.c 1.4 88/09/19 SMI */ @@ -56,10 +56,6 @@ int nfsdebug = 2; nfstsize() { #ifdef SYSV - /* - * Unfortunately, the networking architecture in System V doesn't - * allow us to ask this question of the network interfaces. - */ return (NFS_MAXDATA); #else register struct ifnet *ifp; @@ -126,7 +122,7 @@ vattr_to_nattr(vap, na) * VFIFO type to the special over-the-wire type. (see note in nfs.h) * * BUYER BEWARE: - * If you are porting the NFS to a non-Sun server, you probably + * If you are porting the NFS to a non-SUN server, you probably * don't want to include the following block of code. The * over-the-wire special file types will be changing with the * NFS Protocol Revision. diff --git a/usr/src/uts/3b2/fs/nfs/nfs_export.c b/usr/src/uts/3b2/fs/nfs/nfs_export.c index 7daf2ee..df8c86a 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_export.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_export.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_export.c 1.7" +#ident "@(#)fs:fs/nfs/nfs_export.c 1.6" /* @(#)nfs_export.c 1.11 88/02/08 SMI */ @@ -90,7 +90,6 @@ exportfs(uap) struct exportinfo *tmp; struct fid *fid; struct vfs *vfs; - int mounted_ro; int error; if (! suser(u.u_cred)) @@ -105,7 +104,6 @@ exportfs(uap) return (error); error = VOP_FID(vp, &fid); vfs = vp->v_vfsp; - mounted_ro = vp->v_vfsp->vfs_flag & VFS_RDONLY; VN_RELE(vp); if (error) return (error); @@ -123,26 +121,20 @@ exportfs(uap) /* * Load in everything, and do sanity checking */ - if (copyin((caddr_t) uap->uex, (caddr_t) kex, - (u_int) sizeof(struct export))) { - error = EFAULT; + error = copyin((caddr_t) uap->uex, (caddr_t) kex, + (u_int) sizeof(struct export)); + if (error) { goto error_return; } - if (kex->ex_flags & ~EX_ALL) { + if (kex->ex_flags & ~(EX_RDONLY | EX_RDMOSTLY)) { error = EINVAL; goto error_return; } - if (!(kex->ex_flags & EX_RDONLY) && mounted_ro) { - error = EROFS; - goto error_return; - } - if (kex->ex_flags & EX_EXCEPTIONS) { - error = loadaddrs(&kex->ex_roaddrs); - if (error) - goto error_return; - error = loadaddrs(&kex->ex_rwaddrs); - if (error) + if (kex->ex_flags & EX_RDMOSTLY) { + error = loadaddrs(&kex->ex_writeaddrs); + if (error) { goto error_return; + } } switch (kex->ex_auth) { case AUTH_UNIX: @@ -216,10 +208,17 @@ struct nfs_getfh_args { /* * Get file handle system call. * Takes file name and returns a file handle for it. + * Also recognizes the old getfh() which takes a file + * descriptor instead of a file name, and does the + * right thing. This compatibility will go away in 5.0. + * It goes away because if a file descriptor refers to + * a file, there is no simple way to find its parent + * directory. */ nfs_getfh(uap) register struct nfs_getfh_args *uap; { + /* register struct file *fp; */ fhandle_t fh; struct vnode *vp; struct vnode *dvp; @@ -256,9 +255,8 @@ nfs_getfh(uap) if (!error) { error = makefh(&fh, vp, exi); if (!error) { - if (copyout((caddr_t)&fh, (caddr_t)uap->fhp, - sizeof(fh))) - error = EFAULT; + error = copyout((caddr_t)&fh, (caddr_t)uap->fhp, + sizeof(fh)); } } VN_RELE(vp); @@ -269,6 +267,8 @@ nfs_getfh(uap) } /* + * Common code for both old getfh() and new getfh(). + * If old getfh(), then dvp is NULL. * Strategy: if vp is in the export list, then * return the associated file handle. Otherwise, ".." * once up the vp and try again, until the root of the @@ -354,7 +354,8 @@ makefh(fh, vp, exi) return (EREMOTE); } if (fidp->fid_len + exi->exi_fid->fid_len + sizeof(fsid_t) - > NFS_FHSIZE) { + > NFS_FHSIZE) + { freefid(fidp); return (EREMOTE); } @@ -395,7 +396,7 @@ findexport(fsid, fid) } /* - * Load from user space a list of exception addresses and masks + * Load from user space, a list of internet addresses into kernel space */ loadaddrs(addrs) struct exaddrlist *addrs; @@ -403,31 +404,35 @@ loadaddrs(addrs) char *tmp; int allocsize; register int i; +#ifdef SYSV struct netbuf *uaddrs; - struct netbuf *umasks; +#else + struct sockaddr *uaddrs; +#endif if (addrs->naddrs > EXMAXADDRS) return (EINVAL); +#ifdef SYSV if (addrs->naddrs == 0) return (0); allocsize = addrs->naddrs * sizeof(struct netbuf); +#else + allocsize = addrs->naddrs * sizeof(struct sockaddr); +#endif uaddrs = addrs->addrvec; - umasks = addrs->addrmask; +#ifdef SYSV addrs->addrvec = (struct netbuf *) mem_alloc(allocsize); +#else + addrs->addrvec = (struct sockaddr *) mem_alloc(allocsize); +#endif if (copyin((caddr_t)uaddrs, (caddr_t)addrs->addrvec, (u_int)allocsize)) { mem_free((char *)addrs->addrvec, allocsize); return (EFAULT); } - addrs->addrmask = (struct netbuf *) mem_alloc(allocsize); - if (copyin((caddr_t)umasks, (caddr_t)addrs->addrmask, (u_int)allocsize)) { - mem_free((char *)addrs->addrmask, allocsize); - mem_free((char *)addrs->addrvec, allocsize); - return (EFAULT); - } - +#ifdef SYSV for (i = 0; i < addrs->naddrs; i++) { tmp = (char *) mem_alloc(addrs->addrvec[i].len); if (copyin(addrs->addrvec[i].buf, tmp, (u_int) addrs->addrvec[i].len)) { @@ -436,31 +441,13 @@ loadaddrs(addrs) for (j = 0; j < i; j++) mem_free((char *) addrs->addrvec[j].buf, addrs->addrvec[j].len); mem_free(tmp, addrs->addrvec[i].len); - mem_free((char *)addrs->addrmask, allocsize); mem_free((char *)addrs->addrvec, allocsize); return (EFAULT); } else addrs->addrvec[i].buf = tmp; } - - for (i = 0; i < addrs->naddrs; i++) { - tmp = (char *) mem_alloc(addrs->addrmask[i].len); - if (copyin(addrs->addrmask[i].buf, tmp, (u_int) addrs->addrmask[i].len)) { - register int j; - - for (j = 0; j < i; j++) - mem_free((char *) addrs->addrmask[j].buf, addrs->addrmask[j].len); - mem_free(tmp, addrs->addrmask[i].len); - for (j = 0; j < addrs->naddrs; j++) - mem_free((char *) addrs->addrvec[j].buf, addrs->addrvec[j].len); - mem_free((char *)addrs->addrmask, allocsize); - mem_free((char *)addrs->addrvec, allocsize); - return (EFAULT); - } - else - addrs->addrmask[i].buf = tmp; - } +#endif return (0); } @@ -478,17 +465,23 @@ loadrootnames(kex) char netname[MAXNETNAMELEN+1]; u_int allocsize; - if (kex->ex_des.nnames > EXMAXROOTNAMES) + if (kex->ex_des.nnames > EXMAXROOTNAMES) { return (EINVAL); - if (kex->ex_des.nnames == 0) + } + + if (kex->ex_des.nnames == 0) { return (0); + } /* * Get list of names from user space */ allocsize = kex->ex_des.nnames * sizeof(char *); - if (copyin((char *)kex->ex_des.rootnames, (char *)exnames, allocsize)) - return (EFAULT); + error = copyin((char *)kex->ex_des.rootnames, (char *)exnames, + allocsize); + if (error) { + return (error); + } kex->ex_des.rootnames = (char **) mem_alloc(allocsize); bzero((char *) kex->ex_des.rootnames, allocsize); @@ -544,43 +537,32 @@ exportfree(exi) ex = &exi->exi_export; switch (ex->ex_auth) { case AUTH_UNIX: - for (i = 0; i < ex->ex_unix.rootaddrs.naddrs; i++) { +#ifdef SYSV + for (i = 0; i < ex->ex_unix.rootaddrs.naddrs; i++) mem_free(ex->ex_unix.rootaddrs.addrvec[i].buf, ex->ex_unix.rootaddrs.addrvec[i].len); - mem_free(ex->ex_unix.rootaddrs.addrmask[i].buf, ex->ex_unix.rootaddrs.addrmask[i].len); - } mem_free((char *)ex->ex_unix.rootaddrs.addrvec, (ex->ex_unix.rootaddrs.naddrs * sizeof(struct netbuf))); - mem_free((char *)ex->ex_unix.rootaddrs.addrmask, - (ex->ex_unix.rootaddrs.naddrs * - sizeof(struct netbuf))); +#else + mem_free((char *)ex->ex_unix.rootaddrs.addrvec, + (ex->ex_unix.rootaddrs.naddrs * + sizeof(struct sockaddr))); +#endif break; case AUTH_DES: freenames(ex); break; } - if (ex->ex_flags & EX_EXCEPTIONS) { - for (i = 0; i < ex->ex_roaddrs.naddrs; i++) { - mem_free(ex->ex_roaddrs.addrvec[i].buf, - ex->ex_roaddrs.addrvec[i].len); - mem_free(ex->ex_roaddrs.addrmask[i].buf, - ex->ex_roaddrs.addrmask[i].len); - } - mem_free((char *)ex->ex_roaddrs.addrvec, - ex->ex_roaddrs.naddrs * sizeof(struct netbuf)); - mem_free((char *)ex->ex_roaddrs.addrmask, - ex->ex_roaddrs.naddrs * sizeof(struct netbuf)); - - for (i = 0; i < ex->ex_rwaddrs.naddrs; i++) { - mem_free(ex->ex_rwaddrs.addrvec[i].buf, - ex->ex_rwaddrs.addrvec[i].len); - mem_free(ex->ex_rwaddrs.addrmask[i].buf, - ex->ex_rwaddrs.addrmask[i].len); - } - mem_free((char *)ex->ex_rwaddrs.addrvec, - ex->ex_rwaddrs.naddrs * sizeof(struct netbuf)); - mem_free((char *)ex->ex_rwaddrs.addrmask, - ex->ex_rwaddrs.naddrs * sizeof(struct netbuf)); + if (ex->ex_flags & EX_RDMOSTLY) { +#ifdef SYSV + for (i = 0; i < ex->ex_writeaddrs.naddrs; i++) + mem_free(ex->ex_writeaddrs.addrvec[i].buf, ex->ex_writeaddrs.addrvec[i].len); + mem_free((char *)ex->ex_writeaddrs.addrvec, + ex->ex_writeaddrs.naddrs * sizeof(struct netbuf)); +#else + mem_free((char *)ex->ex_writeaddrs.addrvec, + ex->ex_writeaddrs.naddrs * sizeof(struct sockaddr)); +#endif } freefid(exi->exi_fid); mem_free(exi, sizeof(struct exportinfo)); diff --git a/usr/src/uts/3b2/fs/nfs/nfs_server.c b/usr/src/uts/3b2/fs/nfs/nfs_server.c index 5115886..faefb19 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_server.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_server.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_server.c 1.21" +#ident "@(#)fs:fs/nfs/nfs_server.c 1.12" /* @(#)nfs_server.c 2.87 88/04/12 SMI */ @@ -101,39 +101,20 @@ STATIC void rfsput(); #define VERSIONMAX 2 /* - * Returns true iff exported filesystem is read-only to the given host. - * This can happen in two ways: first, if the default export mode is - * read only, and the host's address isn't in the rw list; second, - * if the default export mode is read-write but the host's address - * is in the ro list. The optimization (checking for EX_EXCEPTIONS) - * is to allow us to skip the calls to hostinlist if no host exception - * lists were loaded. - * - * Note: this macro should be as fast as possible since it's called - * on each NFS modification request. + * Returns true iff exported filesystem is read-only */ -#define rdonly(exi, req) \ - ( \ - ( \ - ((exi)->exi_export.ex_flags & EX_RDONLY) \ - && \ - ( \ - (((exi)->exi_export.ex_flags & EX_EXCEPTIONS) == 0) || \ - !hostinlist(svc_getrpccaller((req)->rq_xprt), \ - &(exi)->exi_export.ex_rwaddrs) \ - ) \ - ) \ - || \ - ( \ - ((exi)->exi_export.ex_flags & EX_RDWR) \ - && \ - ( \ - ((exi)->exi_export.ex_flags & EX_EXCEPTIONS) && \ - hostinlist(svc_getrpccaller((req)->rq_xprt), \ - &(exi)->exi_export.ex_roaddrs) \ - ) \ - ) \ - ) +#ifdef SYSV +#define rdonly(exi, req) (((exi)->exi_export.ex_flags & EX_RDONLY) || \ + (((exi)->exi_export.ex_flags & EX_RDMOSTLY) && \ + !hostinlist(svc_getcaller((req)->rq_xprt), \ + &(exi)->exi_export.ex_writeaddrs))) +#else +#define rdonly(exi, req) (((exi)->exi_export.ex_flags & EX_RDONLY) || \ + (((exi)->exi_export.ex_flags & EX_RDMOSTLY) && \ + !hostinlist((struct sockaddr *)\ + svc_getcaller((req)->rq_xprt), \ + &(exi)->exi_export.ex_writeaddrs))) +#endif struct vnode *fhtovp(); struct file *getsock(); @@ -150,6 +131,8 @@ struct { int reqs[32]; /* count for each request */ } svstat; +/* STATIC int nfs_chars = 50000; */ + struct nfs_svc_args { int fd; }; @@ -158,7 +141,7 @@ STATIC int nfs_server_count = 0; /* * NFS Server system call. * Does all of the work of running a NFS server. - * uap->fd is the fd of an open transport provider + * sock is the fd of an open UDP socket. */ nfs_svc(uap) struct nfs_svc_args *uap; @@ -166,7 +149,10 @@ nfs_svc(uap) struct file *fp; SVCXPRT *xprt; u_long vers; - register int error; + /* int error; */ + + /* disassociate this process from the terminal */ + newsession(); if (getf(uap->fd, &fp)) { return EBADF; @@ -175,11 +161,10 @@ nfs_svc(uap) /* Now, release client memory; we never return back to user */ relvm(u.u_procp); - /* Create a transport handle. */ - if ((error = svc_tli_kcreate(fp, 0, &xprt)) != 0) { + if ((xprt = svc_tli_kcreate(fp, 0, 0)) == (SVCXPRT *)NULL) { if (nfsdprintf) - printf("nfs_svc: svc_tli_kcreate failed %d, exiting\n", - error); + printf("nfs_svc: svc_tli_kcreate failed %d, exiting\n", u.u_error); + /* return (u.u_error); */ exit(CLD_EXITED, 0); } @@ -195,12 +180,12 @@ nfs_svc(uap) } SVC_DESTROY(xprt); u.u_error = EINTR; /* not needed; may help debugging */ + /* sigclearall(u.u_procp); */ /* gone, so duplicate it's effects */ { struct proc *p = u.u_procp; p->p_cursig = 0; if (p->p_curinfo) { - kmem_free((caddr_t)p->p_curinfo, - sizeof(*p->p_curinfo)); + kmem_free((caddr_t)p->p_curinfo, sizeof(*p->p_curinfo)); p->p_curinfo = NULL; } } @@ -215,7 +200,7 @@ nfs_svc(uap) /* * These are the interface routines for the server side of the - * Network File System. See the NFS protocol specification + * Networked File System. See the NFS protocol specification * for a description of this interface. */ @@ -282,13 +267,13 @@ rfs_setattr(args, ns, exi, req) ns->ns_status = NFSERR_STALE; return; } - if (rdonly(exi, req) || (vp->v_vfsp->vfs_flag & VFS_RDONLY)) { + if (rdonly(exi, req)) { error = EROFS; } else { sattr_to_vattr(&args->saa_sa, &va); /* - * Allow System V-compatible option to set access and + * Allow SysV-compatible option to set access and * modified times if root, owner, or write access. * * XXX - Until an NFS Protocol Revision, this may be @@ -300,14 +285,15 @@ rfs_setattr(args, ns, exi, req) * right thing, but will not be disastrous on * unmodified servers. * XXX - 1,000,000 is actually a valid tv_nsec value, - * so we must look in the pre-converted nfssaargs - * field instead. + * but we can't change it because that's what NFS uses. + * So a valid number will produce incorrect results. * XXX - For now, va_mtime.tv_nsec == -1 flags this in - * VOP_SETATTR(), but not all file system setattrs - * respect this convention (for example, s5setattr). + * VOP_SETATTR(). + * XXX - No it doesn't. At least s5setattr() just uses what's + * in vap->va_mtime|vap->va_atime. */ - if ((va.va_mtime.tv_sec != (u_long)-1) && - (args->saa_sa.sa_mtime.tv_usec == 1000000)) { + if ((va.va_mtime.tv_sec != -1UL) && + (va.va_mtime.tv_nsec == 1000000)) { va.va_mtime.tv_sec = hrestime.tv_sec; va.va_mtime.tv_nsec = hrestime.tv_nsec; va.va_atime.tv_sec = va.va_mtime.tv_sec; @@ -365,14 +351,6 @@ rfs_lookup(da, dr, exi) da->da_name, da->da_fhandle.fh_fsid.val[0], da->da_fhandle.fh_fsid.val[1], da->da_fhandle.fh_len); #endif - /* - * Disallow NULL paths - */ - if ((da->da_name == (char *) NULL) || (*da->da_name == '\0')) { - dr->dr_status = NFSERR_ACCES; - return; - } - dvp = fhtovp(&da->da_fhandle, exi); if (dvp == NULL) { dr->dr_status = NFSERR_STALE; @@ -496,16 +474,13 @@ rfs_read(ra, rr, exi) struct exportinfo *exi; { register struct vnode *vp; - register int error, closerr; + register int error; struct vattr va; struct iovec iov; struct uio uio; int offset; char *savedatap; - int opened; - struct vnode *avp; /* addressable */ - opened = 0; #ifdef NFSDEBUG printf("rfs_read %d from fh %x %x %d\n", ra->ra_count, ra->ra_fhandle.fh_fsid.val[0], @@ -523,8 +498,7 @@ rfs_read(ra, rr, exi) error = EISDIR; } else { VOP_RWLOCK(vp); - /* everything but AT_NBLOCKS */ - va.va_mask = AT_STAT|AT_TYPE|AT_BLKSIZE; + va.va_mask = AT_STAT|AT_TYPE|AT_BLKSIZE; /* everything but AT_NBLOCKS */ error = VOP_GETATTR(vp, &va, 0, u.u_cred); } if (error) { @@ -550,14 +524,6 @@ rfs_read(ra, rr, exi) } } - avp = vp; - error = VOP_OPEN(&avp, FREAD, u.u_cred); - vp = avp; - if (error) { - goto bad; - } - opened = 1; - if (ra->ra_offset >= va.va_size) { rr->rr_count = 0; vattr_to_nattr(&va, &rr->rr_attr); @@ -569,13 +535,17 @@ rfs_read(ra, rr, exi) * which would save the copy through the uio. */ offset = ra->ra_offset & MAXBOFFSET; +#ifdef SYSV #ifdef VNOCACHE if (nfsreadmap && (offset + ra->ra_count <= MAXBSIZE) && - (vp->v_flag & VNOCACHE) == 0) + (vp->v_flag & VNOCACHE) == 0) { #else - if (nfsreadmap && (offset + ra->ra_count <= MAXBSIZE)) + if (nfsreadmap && (offset + ra->ra_count <= MAXBSIZE)) { #endif - { +#else /* SYSV */ + if (nfsreadmap && (offset + ra->ra_count <= MAXBSIZE) && + (vp->v_flag & (VNOCACHE | VNOMAP)) == 0) { +#endif /* SYSV */ faultcode_t fault_error; rr->rr_map = segmap_getmap(segkmap, vp, @@ -627,15 +597,6 @@ rfs_read(ra, rr, exi) error = VOP_READ(vp, &uio, IO_SYNC, u.u_cred); if (error) { goto bad; - } else { - /* - * Get attributes again so we can send the latest access - * time to the client side for his cache. - */ - va.va_mask = AT_ALL; - error = VOP_GETATTR(vp, &va, 0, u.u_cred); - if (error) - goto bad; } vattr_to_nattr(&va, &rr->rr_attr); rr->rr_count = ra->ra_count - uio.uio_resid; @@ -656,12 +617,6 @@ rfs_read(ra, rr, exi) rr->rr_count = 0; } done: - if (opened) - closerr = VOP_CLOSE(vp, FREAD, 1, 0, u.u_cred); - else - closerr = 0; - if (!error) - error = closerr; rr->rr_status = puterrno(error); if (vp->v_type == VREG) VOP_RWUNLOCK(vp); @@ -696,15 +651,12 @@ rfs_write(wa, ns, exi, req) register struct exportinfo *exi; struct svc_req *req; { - register int error, closerr; + register int error; register struct vnode *vp; struct vattr va; struct iovec iov; struct uio uio; - int opened; - struct vnode *avp; /* addressable */ - opened = 0; #ifdef NFSDEBUG printf("rfs_write: %d bytes fh %x %x %d\n", wa->wa_count, wa->wa_fhandle.fh_fsid.val[0], @@ -722,6 +674,7 @@ rfs_write(wa, ns, exi, req) error = EISDIR; } else { VOP_RWLOCK(vp); + /* va.va_mask = AT_ALL; /* we want everything */ va.va_mask = AT_UID; /* all we need is the uid */ error = VOP_GETATTR(vp, &va, 0, u.u_cred); } @@ -735,12 +688,6 @@ rfs_write(wa, ns, exi, req) error = VOP_ACCESS(vp, VWRITE, 0, u.u_cred); } if (!error) { - avp = vp; - error = VOP_OPEN(&avp, FWRITE, u.u_cred); - vp = avp; - } - if (!error) { - opened = 1; if (wa->wa_data) { iov.iov_base = wa->wa_data; iov.iov_len = wa->wa_count; @@ -765,27 +712,63 @@ rfs_write(wa, ns, exi, req) error = VOP_WRITE(vp, &uio, IO_SYNC, u.u_cred); } else { /* mbuf hack */ if (nfsdprintf) printf("rfs_write: hit mbuf hack...\n"); +/* + * register struct mbuf *m; + * register struct iovec *iovp; + * register int iovcnt; + * static caddr_t *base10, *base40; + * + * iovcnt = 0; + * for (m = (struct mbuf *)wa->wa_mbuf; m; + * m = m->m_next) { + * iovcnt++; + * } + * if (iovcnt < 10) { + * iovp = (struct iovec *)kmem_fast_alloc( + * (caddr_t *)&base10, + * sizeof (struct iovec) * 10, 10, KM_SLEEP); + * } else if (iovcnt < 40) { + * iovp = (struct iovec *)kmem_fast_alloc( + * (caddr_t *)&base40, + * sizeof (struct iovec) * 40, 10, KM_SLEEP); + * } else { + * iovp = (struct iovec *)kmem_alloc( + * (u_int)(sizeof (struct iovec) * + * iovcnt), KM_SLEEP); + * } + * mbuf_to_iov((struct mbuf *)wa->wa_mbuf, iovp); + * uio.uio_iov = iovp; + * uio.uio_iovcnt = iovcnt; + * uio.uio_segflg = UIO_SYSSPACE; + * uio.uio_offset = wa->wa_offset; + * uio.uio_resid = wa->wa_count; + */ /* * for now we assume no append mode */ +/* + * error = VOP_WRITE(vp, &uio, IO_SYNC, u.u_cred); + * if (iovcnt < 10) { + * kmem_fast_free((caddr_t *)&base10, + * (caddr_t)iovp); + * } else if (iovcnt < 40) { + * kmem_fast_free((caddr_t *)&base40, + * (caddr_t)iovp); + * } else { + * kmem_free((caddr_t)iovp, + * (u_int)(sizeof (struct iovec) * + * iovcnt)); + * } + */ } } } - - if (opened) - closerr = VOP_CLOSE(vp, FWRITE, 1, 0, u.u_cred); - else - closerr = 0; - - if (!error) - error = closerr; - if (!error) { /* * Get attributes again so we send the latest mod * time to the client side for his cache. */ - va.va_mask = AT_ALL; /* now we want everything */ + /* va.va_mask = AT_ALL; /* now we want everything */ error = VOP_GETATTR(vp, &va, 0, u.u_cred); } ns->ns_status = puterrno(error); @@ -800,6 +783,22 @@ if (nfsdprintf) printf("rfs_write: hit mbuf hack...\n"); #endif } +/* +static +mbuf_to_iov(m, iov) + register struct mbuf *m; + register struct iovec *iov; +{ + + while (m) { + iov->iov_base = mtod(m, caddr_t); + iov->iov_len = m->m_len; + iov++; + m = m->m_next; + } +} +*/ + /* * Create a file. * Creates a file with given attributes and returns those attributes @@ -816,21 +815,12 @@ rfs_create(args, dr, exi, req) struct vattr va; struct vnode *vp; register struct vnode *dvp; - register char *name = args->ca_da.da_name; #ifdef NFSDEBUG printf("rfs_create: %s dfh %x %x %d\n", - name, args->ca_da.da_fhandle.fh_fsid.val[0], + args->ca_da.da_name, args->ca_da.da_fhandle.fh_fsid.val[0], args->ca_da.da_fhandle.fh_fsid.val[1], args->ca_da.da_fhandle.fh_len); #endif - /* - * Disallow NULL paths - */ - if (name == (char *) NULL || (*name == '\0')) { - dr->dr_status = NFSERR_ACCES; - return; - } - sattr_to_vattr(&args->ca_sa, &va); /* * This is a completely gross hack to make mknod @@ -843,14 +833,16 @@ rfs_create(args, dr, exi, req) if ((va.va_mode & IFMT) == IFCHR) { va.va_type = VCHR; if (va.va_size == (u_long)NFS_FIFO_DEV) - va.va_type = VFIFO; /* xtra kludge for named pipe */ + va.va_type = VFIFO; /* xtra kludge for namedpipe */ else va.va_rdev = (dev_t)va.va_size; va.va_size = 0; + va.va_mode &= ~IFMT; } else if ((va.va_mode & IFMT) == IFBLK) { va.va_type = VBLK; va.va_rdev = (dev_t)va.va_size; va.va_size = 0; + va.va_mode &= ~IFMT; #ifndef SYSV /* * System V doesn't believe in other file systems with other @@ -863,7 +855,6 @@ rfs_create(args, dr, exi, req) } else { va.va_type = VREG; } - va.va_mode &= ~IFMT; /* * XXX - Should get exclusive flag and use it. @@ -886,7 +877,7 @@ rfs_create(args, dr, exi, req) * The server should always do exclusive create. */ if (va.va_size == 0 && svc_clts_kdup(req)) { - error = VOP_LOOKUP(dvp, name, &vp, + error = VOP_LOOKUP(dvp, args->ca_da.da_name, &vp, (struct pathname *) NULL, 0, (struct vnode *) 0, /* XXX - unused? */ u.u_cred); @@ -904,10 +895,10 @@ rfs_create(args, dr, exi, req) if (va.va_mtime.tv_sec != -1) va.va_mask |= AT_MTIME; - error = VOP_CREATE(dvp, name, + error = VOP_CREATE(dvp, args->ca_da.da_name, &va, NONEXCL, VWRITE, &vp, u.u_cred); if (error && svc_clts_kdup(req)) { - error = VOP_LOOKUP(dvp, name, + error = VOP_LOOKUP(dvp, args->ca_da.da_name, &vp, (struct pathname *) NULL, 0, (struct vnode *) 0, /* XXX - unused? */ u.u_cred); @@ -951,14 +942,6 @@ rfs_remove(da, status, exi, req) da->da_name, da->da_fhandle.fh_fsid.val[0], da->da_fhandle.fh_fsid.val[1], da->da_fhandle.fh_len); #endif - /* - * Disallow NULL paths - */ - if ((da->da_name == (char *) NULL) || (*da->da_name == '\0')) { - *status = NFSERR_ACCES; - return; - } - vp = fhtovp(&da->da_fhandle, exi); if (vp == NULL) { *status = NFSERR_STALE; @@ -1013,17 +996,6 @@ rfs_rename(args, status, exi, req) args->rna_to.da_fhandle.fh_fsid.val[1], args->rna_to.da_fhandle.fh_len); #endif - /* - * Disallow NULL paths - */ - if ((args->rna_from.da_name == (char *) NULL) || - (*args->rna_from.da_name == '\0') || - (args->rna_to.da_name == (char *) NULL) || - (*args->rna_to.da_name == '\0')) { - *status = NFSERR_ACCES; - return; - } - fromvp = fhtovp(&args->rna_from.da_fhandle, exi); if (fromvp == NULL) { *status = NFSERR_STALE; @@ -1078,15 +1050,6 @@ rfs_link(args, status, exi, req) args->la_to.da_fhandle.fh_fsid.val[1], args->la_to.da_fhandle.fh_len); #endif - /* - * Disallow NULL paths - */ - if ((args->la_to.da_name == (char *) NULL) || - (*args->la_to.da_name == '\0')) { - *status = NFSERR_ACCES; - return; - } - fromvp = fhtovp(&args->la_from, exi); if (fromvp == NULL) { *status = NFSERR_STALE; @@ -1145,15 +1108,6 @@ rfs_symlink(args, status, exi, req) args->sla_from.da_fhandle.fh_len, args->sla_tnm); #endif - /* - * Disallow NULL paths - */ - if ((args->sla_from.da_name == (char *) NULL) || - (*args->sla_from.da_name == '\0')) { - *status = NFSERR_ACCES; - return; - } - sattr_to_vattr(&args->sla_sa, &va); va.va_type = VLNK; vp = fhtovp(&args->sla_from.da_fhandle, exi); @@ -1200,21 +1154,12 @@ rfs_mkdir(args, dr, exi, req) struct vattr va; struct vnode *dvp; register struct vnode *vp; - register char *name = args->ca_da.da_name; #ifdef NFSDEBUG printf("rfs_mkdir %s fh %x %x %d\n", - name, args->ca_da.da_fhandle.fh_fsid.val[0], + args->ca_da.da_name, args->ca_da.da_fhandle.fh_fsid.val[0], args->ca_da.da_fhandle.fh_fsid.val[1], args->ca_da.da_fhandle.fh_len); #endif - /* - * Disallow NULL paths - */ - if ((name == (char *) NULL) || (*name == '\0')) { - dr->dr_status = NFSERR_ACCES; - return; - } - sattr_to_vattr(&args->ca_sa, &va); va.va_type = VDIR; /* @@ -1228,26 +1173,13 @@ rfs_mkdir(args, dr, exi, req) if (rdonly(exi, req)) { error = EROFS; } else { - /* set vattr mask bits before mkdir */ - va.va_mask = AT_TYPE|AT_MODE; - if (va.va_size != -1) - va.va_mask |= AT_SIZE; - if (va.va_uid != -1) - va.va_mask |= AT_UID; - if (va.va_gid != -1) - va.va_mask |= AT_GID; - if (va.va_atime.tv_sec != -1) - va.va_mask |= AT_ATIME; - if (va.va_mtime.tv_sec != -1) - va.va_mask |= AT_MTIME; - - error = VOP_MKDIR(vp, name, &va, &dvp, u.u_cred); + error = VOP_MKDIR(vp, args->ca_da.da_name, &va, &dvp, u.u_cred); if (error == EEXIST) { /* * check for dup request */ if (svc_clts_kdup(req)) { - error = VOP_LOOKUP(vp, name, + error = VOP_LOOKUP(vp, args->ca_da.da_name, &dvp, (struct pathname *) NULL, 0, (struct vnode *) 0, /* XXX - unused? */ @@ -1293,14 +1225,6 @@ rfs_rmdir(da, status, exi, req) da->da_name, da->da_fhandle.fh_fsid.val[0], da->da_fhandle.fh_fsid.val[1], da->da_fhandle.fh_len); #endif - /* - * Disallow NULL paths - */ - if ((da->da_name == (char *) NULL) || (*da->da_name == '\0')) { - *status = NFSERR_ACCES; - return; - } - vp = fhtovp(&da->da_fhandle, exi); if (vp == NULL) { *status = NFSERR_STALE; @@ -1329,7 +1253,7 @@ rfs_rmdir(da, status, exi, req) } else if (!error) { svc_clts_kdupsave(req); } else if (error == NFSERR_EXIST) { - /* kludge for incompatible errnos */ + /*kludge for incompatible errnos */ error = NFSERR_NOTEMPTY; } } @@ -1348,15 +1272,11 @@ rfs_readdir(rda, rd, exi, req) struct exportinfo *exi; struct svc_req *req; { - int error, closerr; - int iseof; + int error; struct iovec iov; struct uio uio; register struct vnode *vp; - int opened; - struct vnode *avp; /* addressable */ - opened = 0; #ifdef NFSDEBUG printf("rfs_readdir fh %x %x %d count %d\n", rda->rda_fh.fh_fsid.val[0], rda->rda_fh.fh_fsid.val[1], @@ -1368,13 +1288,6 @@ rfs_readdir(rda, rd, exi, req) return; } VOP_RWLOCK(vp); - if (vp->v_type != VDIR) { -# ifdef NFSDEBUG - printf("rfs_readdir: attempt to read non-directory\n"); -# endif - error = ENOTDIR; - goto bad; - } /* * check read access of dir. we have to do this here because * the opendir doesn't go over the wire. @@ -1384,14 +1297,6 @@ rfs_readdir(rda, rd, exi, req) goto bad; } - avp = vp; - error = VOP_OPEN(&avp, FREAD, u.u_cred); - vp = avp; - if (error) { - goto bad; - } - opened = 1; - if (rda->rda_count == 0) { rd->rd_size = 0; rd->rd_eof = FALSE; @@ -1422,7 +1327,7 @@ rfs_readdir(rda, rd, exi, req) /* * read directory */ - error = VOP_READDIR(vp, &uio, u.u_cred, &iseof); + error = VOP_READDIR(vp, &uio, u.u_cred, (int *)NULL); /* * Clean up @@ -1440,19 +1345,10 @@ rfs_readdir(rda, rd, exi, req) rd->rd_eof = TRUE; } else { rd->rd_size = rda->rda_count - uio.uio_resid; - if (iseof) - rd->rd_eof = TRUE; - else - rd->rd_eof = FALSE; + rd->rd_eof = FALSE; } bad: - if (opened) - closerr = VOP_CLOSE(vp, FREAD, 1, 0, u.u_cred); - else - closerr = 0; - if (!error) - error = closerr; rd->rd_status = puterrno(error); VOP_RWUNLOCK(vp); VN_RELE(vp); @@ -1659,18 +1555,14 @@ rfsput(rs) rfsfreesp = rs; } + /* - * If nfs_portmon is set, then clients are required to use privileged - * ports (ports < IPPORT_RESERVED) in order to get NFS services. - * - * N.B.: this attempt to carry forward the already ill-conceived - * notion of privileged ports for TCP/UDP is really quite ineffectual. - * Not only is it transport-dependent, it's laughably easy to spoof. - * If you're really interested in security, you must start with secure - * RPC instead. + * If nfs_portmon is set, then clients are required to use + * privileged ports (ports < IPPORT_RESERVED) in order to get NFS services. */ int nfs_portmon = 0; + void rfs_dispatch(req, xprt) struct svc_req *req; @@ -1680,7 +1572,7 @@ rfs_dispatch(req, xprt) int vers; caddr_t args = NULL; caddr_t res = NULL; - register struct rfsdisp *disp = (struct rfsdisp *) NULL; + register struct rfsdisp *disp; struct cred *tmpcr; struct cred *newcr = NULL; int error; @@ -1781,14 +1673,12 @@ rfs_dispatch(req, xprt) (*disp->dis_proc)(args, res, exi, req); done: - if (disp) { - /* - * Free arguments struct - */ - if (!SVC_FREEARGS(xprt, disp->dis_xdrargs, args) ) { - printf("nfs_server: bad freeargs\n"); - error++; - } + /* + * Free arguments struct + */ + if (!SVC_FREEARGS(xprt, disp->dis_xdrargs, args) ) { + printf("nfs_server: bad freeargs\n"); + error++; } if (args != NULL) { /* LINTED pointer alignment */ @@ -1875,41 +1765,48 @@ fhtovp(fh, exi) } /* - * Determine whether two addresses are equal. - * - * This is not as easy as it seems, since netbufs are opaque addresses - * and we're really concerned whether the host parts of the addresses - * are equal. The solution is to check the supplied mask, whose address - * bits are 1 if we should compare the corresponding bits in addr1 and - * addr2, and 0 otherwise. + * Determine if two addresses are equal + * Only AF_INET supported for now */ -eqaddr(addr1, addr2, mask) +eqaddr(addr1, addr2) +#ifdef SYSV struct netbuf *addr1; struct netbuf *addr2; - struct netbuf *mask; +#else + struct sockaddr *addr1; + struct sockaddr *addr2; +#endif { - register char *a1, *a2, *m, *mend; - - if ((addr1->len != addr2->len) || (addr1->len != mask->len)) +#ifdef SYSV + return((addr1->len == addr2->len) && !bcmp(addr1->buf, addr2->buf, addr1->len)); +#else + if (addr1->sa_family != addr2->sa_family) { return (0); - - for (a1 = addr1->buf, - a2 = addr2->buf, - m = mask->buf, - mend = mask->buf + mask->len; m < mend; a1++, a2++, m++) - if (((*a1) & (*m)) != ((*a2) & (*m))) - return (0); - return (1); + } + switch (addr1->sa_family) { + case AF_INET: + return (((struct taddr_in *) addr1)->sin_addr.s_addr == + ((struct taddr_in *) addr2)->sin_addr.s_addr); + case AF_NS: + /* coming soon? */ + break; + } + return (0); +#endif } -hostinlist(na, addrs) - struct netbuf *na; +hostinlist(sa, addrs) +#ifdef SYSV + struct netbuf *sa; +#else + struct sockaddr *sa; +#endif struct exaddrlist *addrs; { int i; for (i = 0; i < addrs->naddrs; i++) { - if (eqaddr(na, &addrs->addrvec[i], &addrs->addrmask[i])) { + if (eqaddr(sa, &addrs->addrvec[i])) { return (1); } } @@ -1946,6 +1843,7 @@ checkauth(exi, req, cred) int flavor; short grouplen; +#ifdef SYSV /* * Check for privileged port number * N.B.: this assumes that we know the format of a netbuf. @@ -1960,6 +1858,16 @@ checkauth(exi, req, cred) return (0); } } +#else + /* + * Check for privileged port number + */ + if (nfs_portmon && + ntohs(req->rq_xprt->xp_raddr.sin_port) >= IPPORT_RESERVED) { + printf("NFS request from unprivileged port.\n"); + return (0); + } +#endif /* * Set uid, gid, and gids to auth params @@ -1977,6 +1885,7 @@ checkauth(exi, req, cred) case AUTH_UNIX: /* LINTED pointer alignment */ aup = (struct authunix_parms *)req->rq_clntcred; +#ifdef SYSV if (aup->aup_uid == 0 && !hostinlist(svc_getrpccaller(req->rq_xprt), &exi->exi_export.ex_unix.rootaddrs)) { cred->cr_uid = exi->exi_export.ex_anon; @@ -1989,6 +1898,21 @@ checkauth(exi, req, cred) aup->aup_len * sizeof (cred->cr_groups[0])); cred->cr_ngroups = aup->aup_len; } +#else + if (aup->aup_uid == 0 && + !hostinlist((struct sockaddr *)svc_getcaller(req->rq_xprt), + &exi->exi_export.ex_unix.rootaddrs)) { + cred->cr_uid = exi->exi_export.ex_anon; + cred->cr_gid = exi->exi_export.ex_anon; + cred->cr_ngroups = 0; + } else { + cred->cr_uid = aup->aup_uid; + cred->cr_gid = aup->aup_gid; + bcopy((caddr_t)aup->aup_gids, (caddr_t)cred->cr_groups, + aup->aup_len * sizeof (cred->cr_groups[0])); + cred->cr_ngroups = aup->aup_len; + } +#endif break; @@ -2009,11 +1933,6 @@ checkauth(exi, req, cred) cred->cr_gid = exi->exi_export.ex_anon; grouplen = 0; } - if ((cred->cr_uid == 0) && !rootname(&exi->exi_export, - adc->adc_fullname.name)) { - cred->cr_uid = cred->cr_gid = exi->exi_export.ex_anon; - grouplen = 0; - } cred->cr_ngroups = grouplen; break; diff --git a/usr/src/uts/3b2/fs/nfs/nfs_subr.c b/usr/src/uts/3b2/fs/nfs/nfs_subr.c index 49630bd..a6f09cc 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_subr.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_subr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_subr.c 1.13" +#ident "@(#)fs:fs/nfs/nfs_subr.c 1.10" /* @(#)nfs_subr.c 2.91 88/08/05 SMI */ @@ -82,18 +82,18 @@ extern int nrnode; /* max rnodes to alloc, set in machdep.c */ * client side statistics */ struct { - uint nclsleeps; /* client handle waits */ - uint nclgets; /* client handle gets */ - uint ncalls; /* client requests */ - uint nbadcalls; /* rpc failures */ - uint reqs[32]; /* count of each request */ + int nclsleeps; /* client handle waits */ + int nclgets; /* client handle gets */ + int ncalls; /* client requests */ + int nbadcalls; /* rpc failures */ + int reqs[32]; /* count of each request */ } clstat; int cltoomany = 0; #define MAXCLIENTS 6 struct chtab { - uint ch_timesused; + int ch_timesused; bool_t ch_inuse; CLIENT *ch_client; } chtable[MAXCLIENTS]; @@ -162,9 +162,7 @@ authget(mi, cr) savecred = u.u_cred; u.u_cred = cr; auth = authdes_create(mi->mi_netname, authdes_win, - &mi->mi_syncaddr, - mi->mi_knetconfig->knc_rdev, - (des_block *)NULL, mi->mi_rpctimesync); + (struct sockaddr *)&mi->mi_addr, (des_block *)NULL); u.u_cred = savecred; if (auth == NULL) { @@ -246,7 +244,7 @@ clget(mi, cred) register struct chtab *ch; int retrans; CLIENT *client; - register int error; + CLIENT *clnt_tli_kcreate(); /* XXX - should be in header file */ /* * If soft mount and server is down just try once. @@ -266,19 +264,15 @@ clget(mi, cred) if (!ch->ch_inuse) { ch->ch_inuse = TRUE; if (ch->ch_client == NULL) { - error = - clnt_tli_kcreate(mi->mi_knetconfig, - &mi->mi_addr, NFS_PROGRAM, - NFS_VERSION, 0, - retrans, cred, &ch->ch_client); - if (error != 0) { - cmn_err(CE_PANIC, - "clget: null client in chtable, ch=%x, error %d\n", - (u_long)ch, error); + ch->ch_client = + clnt_tli_kcreate(mi->mi_knetconfig, &mi->mi_addr, + NFS_PROGRAM, NFS_VERSION, 0, 0, + retrans, cred); + if (ch->ch_client == NULL) { + cmn_err(CE_PANIC, "clget: null client in chtable, ch=%x", (u_long)ch); } auth_destroy(ch->ch_client->cl_auth); /* XXX */ } else { - clnt_clts_reopen(ch->ch_client, mi->mi_knetconfig); clnt_clts_init(ch->ch_client, &mi->mi_addr, retrans, cred); } @@ -296,11 +290,10 @@ clget(mi, cred) * To avoid deadlock, don't wait, but just grab another */ cltoomany++; - error = clnt_tli_kcreate(mi->mi_knetconfig, &mi->mi_addr, NFS_PROGRAM, - NFS_VERSION, 0, retrans, cred, &client); - if (error != 0) - cmn_err(CE_WARN, "clget: clnt_tli_kcreate returned error %d\n", - error); + client = clnt_tli_kcreate(mi->mi_knetconfig, &mi->mi_addr, NFS_PROGRAM, + NFS_VERSION, 0, 0, retrans, cred); + if (client == NULL) + cmn_err(CE_PANIC, "clget: null auxiliary client, client=%x", (u_long)client); auth_destroy(client->cl_auth); /* XXX */ client->cl_auth = authget(mi, cred); if (client->cl_auth == NULL) @@ -444,7 +437,6 @@ rfscall(mi, which, xdrargs, argsp, xdrres, resp, cred) if (nfsdprintf) printf("rfscall: Entered op = %d\n", which); rpcerr.re_errno = 0; - rpcerr.re_status = RPC_SUCCESS; newcred = NULL; retry: client = clget(mi, cred); @@ -480,29 +472,28 @@ rfscall(mi, which, xdrargs, argsp, xdrres, resp, cred) case RPC_CANTENCODEARGS: case RPC_CANTDECODERES: case RPC_VERSMISMATCH: - case RPC_PROCUNAVAIL: - case RPC_PROGUNAVAIL: case RPC_PROGVERSMISMATCH: case RPC_CANTDECODEARGS: break; default: - if (status == RPC_INTR) { - tryagain = (bool_t)(mi->mi_hard && !mi->mi_int); - if (tryagain) - continue; - rpcerr.re_status = RPC_INTR; - rpcerr.re_errno = EINTR; - } else - tryagain = (bool_t)mi->mi_hard; - - if (tryagain) { - timeo = backoff(timeo); - if (--count > 0 && timeo < HZ*15) - continue; - if (!mi->mi_printed) { - mi->mi_printed = 1; + if (mi->mi_hard) { + if (mi->mi_int && status == RPC_INTR) { + rpcerr.re_status = RPC_INTR; + rpcerr.re_errno = EINTR; + tryagain = FALSE; + break; + } else { + tryagain = TRUE; + if (status == RPC_INTR) + continue; + timeo = backoff(timeo); + if (--count > 0 && timeo < HZ*15) + continue; + if (!mi->mi_printed) { + mi->mi_printed = 1; printf("NFS server %s not responding still trying\n", mi->mi_hostname); + } } if (timer_type[which] != 0) { /* @@ -512,7 +503,7 @@ rfscall(mi, which, xdrargs, argsp, xdrres, resp, cred) clfree(client); if (newcred) crfree(newcred); - return (ENFS_TRYAGAIN); + return(ENFS_TRYAGAIN); } } } @@ -554,16 +545,6 @@ rfscall(mi, which, xdrargs, argsp, xdrres, resp, cred) if (newcred) { crfree(newcred); } - /* - * This ``should never happen'', but if it ever does it's - * a disaster, since callers of rfscall rely only on re_errno - * to indicate failures. - */ - if (rpcerr.re_status != RPC_SUCCESS && rpcerr.re_errno == 0) { - cmn_err(CE_PANIC, "rfscall: re_status %d, re_errno 0\n", - rpcerr.re_status); - } - #ifdef NFSDEBUG printf("rfscall: returning %d\n", rpcerr.re_errno); #endif @@ -937,19 +918,21 @@ newname() { char *news; register char *s1, *s2; - register uint id; - static uint newnum = 0; - - if (newnum == 0) - newnum = hrestime.tv_sec & 0xffff; + int id; + static int newnum; news = (char *)kmem_alloc((u_int)NFS_MAXNAMLEN, KM_SLEEP); - for (s1 = news, s2 = prefix; s2 < &prefix[PREFIXLEN]; ) + for (s1 = news, s2 = prefix; s2 < &prefix[PREFIXLEN]; ) { *s1++ = *s2++; - id = newnum++; + } + if (newnum == 0) { + id = hrestime.tv_sec & 0xffff; + } + else + id = newnum++; while (id) { *s1++ = "0123456789ABCDEF"[id & 0x0f]; - id >>= 4; + id = id >> 4; } *s1 = '\0'; return (news); @@ -974,3 +957,11 @@ runlockk(rp, file, line) { RUNLOCK(rp); } + +/* +int +nfs_badop() +{ + cmn_err(CE_PANIC, "nfs_badop"); +} +*/ diff --git a/usr/src/uts/3b2/fs/nfs/nfs_vfsops.c b/usr/src/uts/3b2/fs/nfs/nfs_vfsops.c index aab221f..d72738f 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_vfsops.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_vfsops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_vfsops.c 1.15" +#ident "@(#)fs:fs/nfs/nfs_vfsops.c 1.10" /* @(#)nfs_vfsops.c 2.91 88/10/17 SMI */ @@ -27,7 +27,7 @@ * All rights reserved. */ -#define NFSCLIENT +#define NFSCLIENT #include #include @@ -39,6 +39,8 @@ #include #include #include +#include +/* #include */ #include #include #include @@ -47,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -58,13 +61,15 @@ #include #include +#define satosin(sa) ((struct sockaddr_in *)(sa)) + #ifdef NFSDEBUG extern int nfsdebug; #endif STATIC int nfsrootvp(); extern struct vnode *makenfsnode(); -#define MAPSIZE (256/NBBY) +#define MAPSIZE 256/NBBY static char nfs_minmap[MAPSIZE]; /* Map for minor device allocation */ /* @@ -90,13 +95,9 @@ struct vfsops nfs_vfsops = { nfs_mountroot, nfs_swapvp, nfs_nosys, /* filler */ - nfs_nosys, - nfs_nosys, - nfs_nosys, - nfs_nosys, - nfs_nosys, - nfs_nosys, - nfs_nosys + nfs_nosys, /* " */ + nfs_nosys, /* " */ + nfs_nosys /* " */ }; /* @@ -120,120 +121,81 @@ nfsinit(vswp, fstyp) */ /*ARGSUSED*/ STATIC int +/* nfs_mount(vfsp, special, path, flags, data, datalen, cred) */ nfs_mount(vfsp, mvp, uap, cred) struct vfs *vfsp; struct vnode *mvp; struct mounta *uap; struct cred *cred; { + /* char *path = uap->dir; */ + /* int flags = uap->flags; */ char *data = uap->dataptr; int datalen = uap->datalen; int error; struct vnode *rtvp = NULL; /* the server's root */ struct mntinfo *mi; /* mount info, pointed at by vfs */ fhandle_t fh; /* root fhandle */ - struct nfs_args args; /* nfs mount arguments */ - struct netbuf addr; /* server's address */ - int hlen; /* length of hostname */ + struct sockaddr_in saddr; /* server's address */ char shostname[HOSTNAMESZ]; /* server's hostname */ - int nlen; /* length of netname */ + int hlen; /* length of hostname */ char netname[MAXNETNAMELEN+1]; /* server's netname */ - struct netbuf syncaddr; /* AUTH_DES time sync addr */ - struct knetconfig *knconf; /* transport knetconfig structure */ + int nlen; /* length of netname */ + struct nfs_args args; /* nfs mount arguments */ + struct netbuf addr; /* TLI-converted saddr */ + /* int fd; */ /* bound TLI fd */ /* * For now, ignore remount option. */ - if (vfsp->vfs_flag & VFS_REMOUNT) + if (vfsp->vfs_flag & VFS_REMOUNT) { return (0); + } if (mvp->v_type != VDIR) - return (ENOTDIR); - - /* make sure things are zeroed for errout: */ - bzero((caddr_t) &addr, sizeof (addr)); - bzero((caddr_t) &syncaddr, sizeof (syncaddr)); + return ENOTDIR; /* - * get arguments + * XXX - why is this not a generic function? + * XXX - it is now. + */ + /* + * if (flags & MS_RDONLY) + * vfsp->vfs_flag |= VFS_RDONLY; */ - if (datalen != sizeof (args)) - return (EINVAL); - else - if (copyin(data, (caddr_t)&args, sizeof (args))) - return (EFAULT); /* - * A valid knetconfig structure is required. + * get arguments */ - if (args.flags & NFSMNT_KNCONF) { - /* - * Allocate space for a knetconfig structure and - * its strings and copy in from user-land. - */ - knconf = (struct knetconfig *) - kmem_alloc(sizeof (struct knetconfig), KM_SLEEP); - if (copyin((caddr_t) args.knconf, (caddr_t) knconf, - sizeof (struct knetconfig)) == -1) { - kmem_free(knconf, sizeof (struct knetconfig)); - return (EFAULT); - } else { - size_t nmoved_tmp; - char *p, *pf; - - pf = (char *) kmem_alloc(KNC_STRSIZE, KM_SLEEP); - p = (char *) kmem_alloc(KNC_STRSIZE, KM_SLEEP); - error = copyinstr((caddr_t) knconf->knc_protofmly, pf, - KNC_STRSIZE, &nmoved_tmp); - if (!error) { - error = copyinstr((caddr_t) knconf->knc_proto, - p, KNC_STRSIZE, &nmoved_tmp); - if (!error) { - knconf->knc_protofmly = pf; - knconf->knc_proto = p; - } else { - kmem_free(pf, KNC_STRSIZE); - kmem_free(p, KNC_STRSIZE); - kmem_free(knconf, - sizeof (struct knetconfig)); - return (error); - } - } else { - kmem_free(pf, KNC_STRSIZE); - kmem_free(p, KNC_STRSIZE); - kmem_free(knconf, sizeof (struct knetconfig)); - return (error); - } - } - } else - return (EINVAL); + if (datalen != sizeof(args)) + error = EINVAL; + else + error = copyin(data, (caddr_t)&args, sizeof (args)); + if (error) { + goto errout; + } /* * Get server address */ - if (copyin((caddr_t) args.addr, (caddr_t) &addr, - sizeof (struct netbuf))) { - addr.buf = (char *) NULL; - error = EFAULT; - } else { - char *userbufptr = addr.buf; - - addr.buf = kmem_alloc(addr.len, KM_SLEEP); - addr.maxlen = addr.len; - if (copyin(userbufptr, addr.buf, addr.len)) { - kmem_free(addr.buf, addr.len); - addr.buf = (char *) NULL; - error = EFAULT; - } + error = copyin((caddr_t)args.addr, (caddr_t)&saddr, + sizeof (saddr)); + if (error) { + goto errout; } - if (error) + /* + * For now we just support AF_INET + */ + if (saddr.sin_family != AF_INET) { + error = EPFNOSUPPORT; goto errout; + } /* * Get the root fhandle */ - if (copyin((caddr_t)args.fh, (caddr_t)&fh, sizeof (fh))) { - error = EFAULT; + error = copyin((caddr_t)args.fh, (caddr_t)&fh, sizeof (fh)); + if (error) { goto errout; } @@ -247,62 +209,36 @@ nfs_mount(vfsp, mvp, uap, cred) goto errout; } } else - (void) strncpy(shostname, "unknown-host", sizeof (shostname)); - + (void) strncpy(shostname, "unknown-host", sizeof(shostname)); + + /* + * Get server's netname + */ if (args.flags & NFSMNT_SECURE) { - /* - * If using AUTH_DES, get time sync netbuf ... - */ - if (args.syncaddr == (struct netbuf *) NULL) - error = EINVAL; - else { - if (copyin((caddr_t) args.syncaddr, (caddr_t) &syncaddr, - sizeof (struct netbuf))) { - syncaddr.buf = (char *) NULL; - error = EFAULT; - } else { - char *userbufptr = syncaddr.buf; - - syncaddr.buf = kmem_alloc(syncaddr.len, - KM_SLEEP); - syncaddr.maxlen = syncaddr.len; - if (copyin(userbufptr, syncaddr.buf, - syncaddr.len)) { - kmem_free(syncaddr.buf, syncaddr.len); - syncaddr.buf = (char *) NULL; - error = EFAULT; - } - } - - /* - * ... and server's netname - */ - if (!error) - error = copyinstr(args.netname, netname, - sizeof (netname), (u_int *) &nlen); - } + error = copyinstr(args.netname, netname, sizeof (netname), + (u_int *)&nlen); } else { nlen = -1; } - if (error) + + /* + * Convert saddr to a netbuf + */ + if ((addr.buf = (char *) kmem_alloc(sizeof(saddr), KM_SLEEP)) == (char *) NULL) { + error = ENOMEM; goto errout; + } + addr.maxlen = addr.len = sizeof(saddr); + bcopy((caddr_t) &saddr, addr.buf, sizeof(saddr)); /* * Get root vnode. */ - error = nfsrootvp(&rtvp, vfsp, knconf, &addr, &syncaddr, &fh, shostname, + error = nfsrootvp(&rtvp, vfsp, args.tlidev, &addr, &fh, shostname, netname, nlen, args.flags); - if (error) { - kmem_free(knconf->knc_protofmly, KNC_STRSIZE); - kmem_free(knconf->knc_proto, KNC_STRSIZE); - kmem_free(knconf, sizeof (struct knetconfig)); - if (addr.buf) - kmem_free(addr.buf, addr.len); - if (syncaddr.buf) - kmem_free(syncaddr.buf, syncaddr.len); + if (error) return (error); - } /* * Set option fields in mount info record @@ -397,6 +333,8 @@ nfs_mount(vfsp, mvp, uap, cred) mi->mi_acdirmax = MIN(args.acdirmax, ACMAXMAX); } } + mi->mi_authflavor = + (args.flags & NFSMNT_SECURE) ? AUTH_DES : AUTH_UNIX; #ifdef NFSDEBUG printf("nfs_mount: hard %d timeo %d retries %d wsize %d rsize %d\n", @@ -411,24 +349,16 @@ nfs_mount(vfsp, mvp, uap, cred) if (rtvp) { VN_RELE(rtvp); } - kmem_free(knconf->knc_protofmly, KNC_STRSIZE); - kmem_free(knconf->knc_proto, KNC_STRSIZE); - kmem_free(knconf, sizeof (struct knetconfig)); - if (addr.buf) - kmem_free(addr.buf, addr.len); - if (syncaddr.buf) - kmem_free(syncaddr.buf, syncaddr.len); } return (error); } STATIC int -nfsrootvp(rtvpp, vfsp, kp, addr, syncaddr, fh, shostname, netname, nlen, flags) +nfsrootvp(rtvpp, vfsp, dev, addr, fh, shostname, netname, nlen, flags) struct vnode **rtvpp; /* where to return root vp */ register struct vfs *vfsp; /* vfs of fs, if NULL make one */ - struct knetconfig *kp; /* transport knetconfig structure */ + dev_t dev; /* TLI device number */ struct netbuf *addr; /* server address */ - struct netbuf *syncaddr; /* AUTH_DES time sync address */ fhandle_t *fh; /* swap file fhandle */ char *shostname; /* server's hostname */ char *netname; /* server's netname */ @@ -436,13 +366,13 @@ nfsrootvp(rtvpp, vfsp, kp, addr, syncaddr, fh, shostname, netname, nlen, flags) int flags; /* mount flags */ { register struct vnode *rtvp = NULL; /* the server's root */ - register struct mntinfo *mi = NULL; /* mount info */ - /* pointed at by vfs */ + register struct mntinfo *mi = NULL; /* mount info, pointed at by vfs */ struct vattr va; /* root vnode attributes */ struct nfsfattr na; /* root vnode attributes in nfs form */ struct statvfs sb; /* server's file system stats */ register int error; /* struct ifaddr *ifa; */ + /* struct knetconfig *kp; */ /* * Create a mount record and link it to the vfs struct. @@ -451,9 +381,14 @@ nfsrootvp(rtvpp, vfsp, kp, addr, syncaddr, fh, shostname, netname, nlen, flags) mi->mi_hard = ((flags & NFSMNT_SOFT) == 0); mi->mi_int = ((flags & NFSMNT_INT) != 0); mi->mi_addr = *addr; - if (flags & NFSMNT_SECURE) - mi->mi_syncaddr = *syncaddr; - mi->mi_knetconfig = kp; + mi->mi_knetconfig = (struct knetconfig *) kmem_alloc(sizeof (struct knetconfig), KM_SLEEP); + mi->mi_knetconfig->nc_rdev = dev; + /* + * XXX + * Horrible kludge that shouldn't be here - pass in entire + * knetconfig structure instead. + */ + mi->mi_knetconfig->nc_protofmly = AF_INET; mi->mi_retrans = NFS_RETRIES; mi->mi_timeo = NFS_TIMEO; mi->mi_mntno = vfs_getnum(nfs_minmap, MAPSIZE); @@ -467,10 +402,20 @@ nfsrootvp(rtvpp, vfsp, kp, addr, syncaddr, fh, shostname, netname, nlen, flags) mi->mi_netname = (char *)kmem_alloc((u_int)nlen, KM_SLEEP); bcopy(netname, mi->mi_netname, (u_int)nlen); } - mi->mi_authflavor = (flags & NFSMNT_SECURE) ? AUTH_DES : AUTH_UNIX; - mi->mi_rpctimesync = (flags & NFSMNT_RPCTIMESYNC) ? 1 : 0; +#ifdef notdef + /* + * Use heuristic to turn off transfer size adjustment + */ + ifa = ifa_ifwithdstaddr((struct sockaddr *)sin); + if (ifa == (struct ifaddr *)0) + ifa = ifa_ifwithnet((struct sockaddr *)sin); + mi->mi_dynamic = (ifa == (struct ifaddr *)0 || + ifa->ifa_ifp == (struct ifnet *)0 || + ifa->ifa_ifp->if_mtu < ETHERMTU ); +#else /* notdef */ mi->mi_dynamic = 0; +#endif /* notdef */ /* * Make a vfs struct for nfs. We do this here instead of below * because rtvp needs a vfs before we can do a getattr on it. @@ -527,8 +472,7 @@ nfsrootvp(rtvpp, vfsp, kp, addr, syncaddr, fh, shostname, netname, nlen, flags) bad: if (mi) { if (mi->mi_netnamelen >= 0) { - kmem_free((caddr_t)mi->mi_netname, - (u_int)mi->mi_netnamelen); + kmem_free((caddr_t)mi->mi_netname, (u_int)mi->mi_netnamelen); } kmem_free((caddr_t)mi, sizeof (*mi)); } @@ -551,7 +495,7 @@ nfs_unmount(vfsp, cr) struct mntinfo *mi = (struct mntinfo *)vfsp->vfs_data; if (!suser(cr)) - return (EPERM); + return(EPERM); #ifdef NFSDEBUG printf("nfs_unmount(%x) mi = %x\n", vfsp, mi); @@ -562,25 +506,17 @@ nfs_unmount(vfsp, cr) if (mi->mi_refct != 1 || mi->mi_rootvp->v_count != 1) { return (EBUSY); } - /* - * Release root vnode -- but first manually remove its identity - * and pages, since VN_RELE() might decide to hang onto them - */ + VN_RELE(mi->mi_rootvp); /* LINTED pointer alignment */ rp_rmhash(vtor(mi->mi_rootvp)); /* LINTED pointer alignment */ rinactive(vtor(mi->mi_rootvp)); - VN_RELE(mi->mi_rootvp); vfs_putnum(nfs_minmap, mi->mi_mntno); if (mi->mi_netnamelen >= 0) { kmem_free((caddr_t)mi->mi_netname, (u_int)mi->mi_netnamelen); } - kmem_free(mi->mi_addr.buf, mi->mi_addr.len); - if (mi->mi_authflavor == AUTH_DES) - kmem_free(mi->mi_syncaddr.buf, mi->mi_syncaddr.len); - kmem_free(mi->mi_knetconfig->knc_protofmly, KNC_STRSIZE); - kmem_free(mi->mi_knetconfig->knc_proto, KNC_STRSIZE); - kmem_free(mi->mi_knetconfig, sizeof (struct knetconfig)); + kmem_free((caddr_t) mi->mi_addr.buf, mi->mi_addr.len); + kmem_free((caddr_t) mi->mi_knetconfig, sizeof(struct knetconfig)); kmem_free((caddr_t)mi, sizeof (*mi)); return (0); } @@ -636,22 +572,23 @@ nfs_statvfs(vfsp, sbp) mi->mi_curwrite = mi->mi_stsize; } sbp->f_bsize = fs.fs_bsize; + /* sbp->f_frsize = 0; */ /* XXX - does 0 mean unsupported? */ sbp->f_frsize = fs.fs_bsize; sbp->f_blocks = fs.fs_blocks; sbp->f_bfree = fs.fs_bfree; sbp->f_bavail = fs.fs_bavail; - sbp->f_files = (u_long)-1; - sbp->f_ffree = (u_long)-1; - sbp->f_favail = (u_long)-1; + sbp->f_files = -1UL; + sbp->f_ffree = -1UL; +#ifdef notneeded /* - * XXX - This is wrong, should be a real fsid + * XXX - This is wrong, should be a real fsid */ - bcopy((caddr_t)&vfsp->vfs_fsid, (caddr_t)&sbp->f_fsid, - sizeof (fsid_t)); - strncpy(sbp->f_basetype, vfssw[vfsp->vfs_fstype].vsw_name, - FSTYPSZ); + bcopy((caddr_t)&vfsp->vfs_fsid, + (caddr_t)&sbp->f_fsid, sizeof (fsid_t)); +#endif + strncpy(sbp->f_basetype, vfssw[vfsp->vfs_fstype].vsw_name, FSTYPSZ); sbp->f_flag = vf_to_stf(vfsp->vfs_flag); - sbp->f_namemax = (u_long)-1; + sbp->f_namemax = -1UL; } #ifdef NFSDEBUG printf("nfs_statvfs returning %d\n", error); @@ -718,5 +655,5 @@ nfs_swapvp(vfsp, vpp, nm) STATIC int nfs_nosys() { - return (ENOSYS); + return(ENOSYS); } diff --git a/usr/src/uts/3b2/fs/nfs/nfs_vnops.c b/usr/src/uts/3b2/fs/nfs/nfs_vnops.c index a356833..20c1fd1 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_vnops.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_vnops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_vnops.c 1.38" +#ident "@(#)fs:fs/nfs/nfs_vnops.c 1.22" /* @(#)nfs_vnodeops.c 2.167 88/10/19 SMI */ @@ -152,9 +152,9 @@ STATIC void nfs_rwunlock(); STATIC int nfs_seek(); STATIC int nfs_cmp(); STATIC int nfs_frlock(); -STATIC int nfs_space(); extern int fs_nosys(); +/* STATIC int nfs_badop(); */ STATIC int nfs_realvp(); STATIC int nfs_getpage(); @@ -164,6 +164,13 @@ STATIC int nfs_addmap(); STATIC int nfs_delmap(); extern int fs_poll(); +#ifdef notyet +STATIC int nfs_lockctl(); +STATIC int nfs_select(); +STATIC int nfs_noop(); +STATIC int nfs_dump(); +#endif /* notyet */ + struct vnodeops nfs_vnodeops = { nfs_open, nfs_close, @@ -192,7 +199,7 @@ struct vnodeops nfs_vnodeops = { nfs_seek, nfs_cmp, nfs_frlock, - nfs_space, + fs_nosys, /* space */ nfs_realvp, nfs_getpage, nfs_putpage, @@ -201,7 +208,6 @@ struct vnodeops nfs_vnodeops = { nfs_delmap, fs_poll, fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ fs_nosys, fs_nosys, @@ -210,30 +216,6 @@ struct vnodeops nfs_vnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /*ARGSUSED*/ @@ -473,7 +455,7 @@ rwvp(vp, uio, rw, ioflag, cred) */ if (rw == UIO_WRITE && (n == MAXBSIZE || (on == 0 && (off + n) >= rp->r_size))) { - segmap_pagecreate(segkmap, base + on, (u_int)n, 0); + segmap_pagecreate(segkmap, base + on, (u_int)n, 0, 0, 0); pagecreate = 1; } @@ -788,6 +770,18 @@ nfs_ioctl(vp, com, arg, flag, cred, rvalp) return (ENOTTY); } +#ifdef notyet +/*ARGSUSED*/ +STATIC int +nfs_select(vp, which, cred) + struct vnode *vp; + int which; + struct cred *cred; +{ + return (EOPNOTSUPP); +} +#endif /* notyet */ + /*ARGSUSED*/ STATIC int nfs_getattr(vp, vap, flags, cred) @@ -881,10 +875,10 @@ nfs_setattr(vp, vap, flags, cred) vap->va_mtime.tv_nsec = 0; /* make sure we only set the right fields */ - if (!(mask&AT_MODE)) vap->va_mode = (mode_t)-1; + if (!(mask&AT_MODE)) vap->va_mode = -1U; if (!(mask&AT_UID)) vap->va_uid = -1; if (!(mask&AT_GID)) vap->va_gid = -1; - if (!(mask&AT_SIZE)) vap->va_size = (u_long)-1; + if (!(mask&AT_SIZE)) vap->va_size = -1U; /* set if: AT_ATIME not set and AT_MTIME set and ATTR_UTIME not set */ if (!(mask&AT_ATIME) && (!(mask&AT_MTIME) || (flags&ATTR_UTIME))) @@ -904,7 +898,6 @@ nfs_setattr(vp, vap, flags, cred) nfs_cache_check(vp, mtime); nfs_attrcache(vp, &ns->ns_attr); } else { - PURGE_ATTRCACHE(vp); PURGE_STALE_FH(error, vp); } } @@ -1154,19 +1147,6 @@ nfs_oldlookup(dvp, nm, vpp, cred, pnp, flags) *vpp = (struct vnode *)dnlc_lookup(dvp, nm, cred); if (*vpp) { VN_HOLD(*vpp); - - /* - * Make sure we can search this directory (after the - * fact). It's done here because over the wire lookups - * verify permissions on the server. VOP_ACCESS will - * one day go over the wire, so let's use it sparingly. - */ - error = VOP_ACCESS(dvp, VEXEC, 0, cred); - if (error) { - VN_RELE(*vpp); - runlock(vtor(dvp)); - return (error); - } } else { dr = (struct nfsdiropres *)kmem_alloc(sizeof (*dr), KM_SLEEP); setdiropargs(&da, nm, dvp); @@ -1485,17 +1465,12 @@ nfs_rename(odvp, onm, ndvp, nnm, cred) int error; enum nfsstat status; struct nfsrnmargs args; - struct vnode *realvp; #ifdef NFSDEBUG printf("nfs_rename from %s %x '%s' to %s %x '%s'\n", vtomi(odvp)->mi_hostname, odvp, onm, vtomi(ndvp)->mi_hostname, ndvp, nnm); #endif - - if (VOP_REALVP(ndvp, &realvp) == 0) - ndvp = realvp; - if (!strcmp(onm, ".") || !strcmp(onm, "..") || !strcmp(nnm, ".") || !strcmp (nnm, "..")) { error = EINVAL; @@ -1732,15 +1707,6 @@ nfs_readdir(vp, uiop, cred, eofp) } iovp = uiop->uio_iov; alloc_count = count = iovp->iov_len; - - /* - * UGLINESS: SunOS 3.2 servers apparently cannot always handle an - * RFS_READDIR request with rda_count set to more than 0x400. So - * we reduce the request size here purely for compatibility. - */ - if (count > 0x400) - count = 0x400; - #ifdef NFSDEBUG printf("nfs_readdir %s %x count %d offset %ld\n", vtomi(vp)->mi_hostname, vp, count, uiop->uio_offset); @@ -1822,10 +1788,10 @@ nfs_strategy(bp) if (nfs_wakeup_one_biod == 1) { wakeup_one((caddr_t)&async_bufhead); } else { - wakeprocs((caddr_t)&async_bufhead, PRMPT); + wakeup((caddr_t)&async_bufhead); } #else - wakeprocs((caddr_t)&async_bufhead, PRMPT); + wakeup((caddr_t)&async_bufhead); #endif return (0); } else { @@ -1838,6 +1804,9 @@ async_daemon() register struct buf *bp; struct rnode *rp; + /* detach from the terminal */ + newsession(); + relvm(u.u_procp); /* First, release resources */ async_daemon_count++; @@ -1884,12 +1853,12 @@ async_daemon() } } } + /* sigclearall(u.u_procp); */ /* gone, so duplicate it's effects */ { struct proc *p = u.u_procp; p->p_cursig = 0; if (p->p_curinfo) { - kmem_free((caddr_t)p->p_curinfo, - sizeof(*p->p_curinfo)); + kmem_free((caddr_t)p->p_curinfo, sizeof(*p->p_curinfo)); p->p_curinfo = NULL; } } @@ -1927,6 +1896,12 @@ do_bio(bp) long count; int error; int read, async; + /* caddr_t pgaddr; */ + /* int mapped = 0; */ + /* caddr_t rdaddr; */ + /* struct page *pp; */ + /* int cnt, numreqs, bytescnt, i; */ + /* u_int offset; */ read = bp->b_flags & B_READ; async = bp->b_flags & B_ASYNC; @@ -1937,6 +1912,15 @@ do_bio(bp) #endif if (read) { + /* + * kludge to read more than a page: if the logical page size is + * greater than the physical page size, we will be trying to read + * more than a page. But we don't have a valid mapping to several + * contiguous pages. So allocate a buffer, read into the buffer, + * and copy from there into the pages one page at a time. + */ + /* rdaddr = kmem_zalloc (btopr(bp->b_bcount) * PAGESIZE, KM_SLEEP); */ + /* error = bp->b_error = nfsread(bp->b_vp, rdaddr, */ error = bp->b_error = nfsread(bp->b_vp, bp->b_un.b_addr, (u_int)dbtob(bp->b_blkno), (long)bp->b_bcount, (long *)&bp->b_resid, rp->r_cred, &va); @@ -1960,8 +1944,28 @@ do_bio(bp) */ error = NFS_EOF; } + /* copy from our buffer to the pages */ +/* + * ASSERT (bp->b_pages != NULL); + * pp = bp->b_pages; + * + * for (cnt = 0; cnt < btopr(bp->b_bcount); cnt++) { + * pgaddr = (caddr_t) pfntokv (page_pptonum(pp)); + * bcopy (rdaddr + (cnt * PAGESIZE), pgaddr, PAGESIZE); + * pp = pp->p_next; + * } + */ } + /* Free the buffer we just allocated */ + /* kmem_free (rdaddr, btopr(bp->b_bcount) * PAGESIZE); */ } else { + /* make sure we have a valid mapping to the pages we're writing from */ + /* if ((pgaddr = segmap_findaddr (segkmap, bp->b_vp, bp->b_pages->p_offset)) == -1) { */ + /* pgaddr = segmap_getmap (segkmap, bp->b_vp, bp->b_pages->p_offset); */ + /* mapped = 1; */ + /* } */ + /* bp->b_un.b_addr = (caddr_t) pgaddr; */ + /* * If the write fails and it was asynchronous * all future writes will get an error. @@ -1972,6 +1976,32 @@ do_bio(bp) if (count < 0) { cmn_err(CE_PANIC, "do_bio: write count < 0"); } +/* + * if (count > PAGESIZE) { + * numreqs = count / PAGESIZE; + * if (count % PAGESIZE) + * numreqs++; + * bp->b_reqcnt = numreqs; + * } else + * numreqs = 1; + * i = 0; + * pp = bp->b_pages; + * do { + * if (i == (numreqs - 1)) { + * if (count % PAGESIZE) + * bytescnt = count % PAGESIZE; + * else + * bytescnt = PAGESIZE; + * } else + * bytescnt = PAGESIZE; + * offset = (u_int) pp->p_offset; + * pgaddr = (caddr_t) pfntokv (page_pptonum (pp)); + * error = bp->b_error = nfswrite (bp->b_vp, pgaddr, + * (u_int)pp->p_offset, bytescnt, rp->r_cred); + * i++; + * pp = pp->p_next; + * } while (pp != bp->b_pages); + */ error = bp->b_error = nfswrite(bp->b_vp, bp->b_un.b_addr, (u_int)dbtob(bp->b_blkno), count, rp->r_cred); @@ -2002,6 +2032,8 @@ do_bio(bp) * Call pvn_done() to free the bp and pages. If not ASYNC * then we have to call pageio_done() to free the bp. */ + /* if (mapped) */ + /* segmap_release (segkmap, bp->b_un.b_addr, SM_DONTNEED); */ pvn_done(bp); if (!async) { pageio_done(bp); @@ -2016,6 +2048,55 @@ do_bio(bp) return (error); } +#ifdef notyet +STATIC int +nfs_noop() +{ + + return (EREMOTE); +} +#endif /* notyet */ + +#ifdef notyet +/* + * Record-locking requests are passed to the local Lock-Manager daemon. + */ +STATIC int +nfs_lockctl(vp, ld, cmd, cred, clid) + struct vnode *vp; + struct flock *ld; + int cmd; + struct cred *cred; + int clid; +{ + lockhandle_t lh; + +#ifndef lint + if (sizeof (lh.lh_id) != sizeof (fhandle_t)) + cmn_err(CE_PANIC, "fhandle and lockhandle-id are not the same size!"); +#endif +#ifdef VNOCACHE + /* + * If we are setting a lock mark the vnode VNOCACHE so the page + * cache does not give inconsistent results on locked files shared + * between clients. The VNOCACHE flag is never turned off as long + * as the vnode is active because it is hard to figure out when the + * last lock is gone. + * XXX - what if some already has the vnode mapped in? + */ + if (((vp->v_flag & VNOCACHE) == 0) && + (ld->l_type != F_UNLCK) && (cmd != F_GETLK)) { + vp->v_flag |= VNOCACHE; + vtor(vp)->r_error = nfs_putpage(vp, 0, 0, B_INVAL, cred); + } +#endif + lh.lh_vp = vp; + lh.lh_servername = vtomi(vp)->mi_hostname; + bcopy((caddr_t)vtofh(vp), (caddr_t)&lh.lh_id, sizeof (fhandle_t)); + return (klm_lockctl(&lh, ld, cmd, cred, clid)); +} +#endif /* notyet */ + /* ARGSUSED */ STATIC int nfs_fid(vp, fidpp) @@ -2094,19 +2175,11 @@ nfs_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) lbn = off / bsize; blkoff = lbn * bsize; -#ifdef VNOCACHE - if (rp->r_nextr == off && !(vp->v_flag & VNOCACHE)) { - readahead = nfs_nra; - } else { - readahead = 0; - } -#else if (rp->r_nextr == off) { readahead = nfs_nra; } else { readahead = 0; } -#endif #ifdef NFSDEBUG printf("nfs_getapage: nextr %d off %d size %d ra %d ", @@ -2182,7 +2255,7 @@ nfs_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) */ io_len = ptob(btopr(io_len)); - bp = pageio_setup(pp, io_len, vp, pl == NULL ? + bp = pageio_setup(pp, io_len, vp, ppp == NULL ? (B_ASYNC | B_READ) : B_READ); bp->b_blkno = btodb(io_off); @@ -2201,9 +2274,28 @@ nfs_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) * read access to the buffer before copying data. */ if (io_off >= rp->r_size && seg == segkmap) { + /* No contiguous virtual mapping; must zero pages individually */ + /* Yes there is now */ bzero(bp->b_un.b_addr, io_len); +/* + * { + * struct page *pagep = pp; + * int zerolen = io_len; + * do { + * pgaddr = pfntokv (page_pptonum(pagep)); + * if (zerolen >= PAGESIZE) { + * bzero ((caddr_t) pgaddr, PAGESIZE); + * zerolen -= PAGESIZE; + * } else { + * bzero ((caddr_t) pgaddr, zerolen); + * zerolen = 0; + * } + * pagep = pagep->p_next; + * } while (pagep != pp && zerolen); + * } + */ pvn_done(bp); - if (pl != NULL) + if (ppp != NULL) pageio_done(bp); } else { err = nfs_strategy(bp); @@ -2409,10 +2501,8 @@ nfs_getpage(vp, off, len, protp, pl, plsz, seg, addr, rw, cred) * write operation the local file size might not be extended yet. * In this case we want to be able to return pages of zeroes. */ - if (off + len > rp->r_size + PAGEOFFSET && seg != segkmap) { - RUNLOCK(rp); + if (off + len > rp->r_size + PAGEOFFSET && seg != segkmap) return (EFAULT); /* beyond EOF */ - } if (len <= PAGESIZE) err = nfs_getapage(vp, off, protp, pl, plsz, seg, addr, @@ -2664,11 +2754,11 @@ nfs_map(vp, off, as, addrp, len, prot, maxprot, flags, cred) /*ARGSUSED*/ STATIC int -nfs_addmap(vp, off, as, addr, len, prot, maxprot, flags, cred) +nfs_addmap(vp, off, as, addrp, len, prot, maxprot, flags, cred) struct vnode *vp; u_int off; struct as *as; - addr_t addr; + addr_t *addrp; u_int len; u_int prot, maxprot; u_int flags; @@ -2699,11 +2789,9 @@ nfs_frlock(vp, cmd, bfp, flag, offset, cr) { int frcmd, error; lockhandle_t lh; - short whence; #ifdef NFSDEBUG - cmn_err(CE_CONT, "entering nfs_frlock(): cmd %d, flag %d, offset %d, start %d, len %d, whence %d\n", - cmd, flag, offset, bfp->l_start, bfp->l_len, bfp->l_whence); + printf("entering nfs_frlock()....\n"); #endif if (cmd == F_GETLK) @@ -2712,34 +2800,8 @@ nfs_frlock(vp, cmd, bfp, flag, offset, cr) frcmd = SETFLCK; else if (cmd == F_SETLKW) frcmd = SETFLCK|SLPFLCK; - else { -#ifdef NFSDEBUG - cmn_err(CE_CONT, "nfs_frlock: Invalid command %d\n", cmd); -#endif + else return EINVAL; - } - - switch (bfp->l_type) { - case F_RDLCK: - if (!((cmd == F_GETLK) || (cmd == F_RGETLK)) && - !(flag & FREAD)) { - return EBADF; - } - break; - - case F_WRLCK: - if (!((cmd == F_GETLK) || (cmd == F_RGETLK)) && - !(flag & FWRITE)) { - return EBADF; - } - break; - - case F_UNLCK: - break; - - default: - return EINVAL; - } #ifdef VNOCACHE /* @@ -2756,88 +2818,18 @@ nfs_frlock(vp, cmd, bfp, flag, offset, cr) vtor(vp)->r_error = nfs_putpage(vp, 0, 0, B_INVAL, cred); } #endif - - /* Convert start to be relative to beginning of file */ - whence = bfp->l_whence; - if (error = convoff(vp, bfp, 0, offset)) { -#ifdef NFSDEBUG - cmn_err(CE_CONT, "nfs_frlock: convoff: error %d\n", error); -#endif - return (error); - } - - /* Convert l_len to be the end of the rec lock l_end */ - if (bfp->l_len < 0) { -#ifdef NFSDEBUG - cmn_err(CE_CONT, "nfs_frlock: length < 0\n"); -#endif - return EINVAL; - } - if (bfp->l_len == 0) - bfp->l_end = MAXEND; - lh.lh_vp = vp; lh.lh_servername = vtomi(vp)->mi_hostname; bcopy((caddr_t)vtofh(vp), (caddr_t)&lh.lh_id, sizeof (fhandle_t)); error = klm_lockctl(&lh, bfp, cmd, cr, u.u_procp->p_pid); - /* Restore l_len */ - if (bfp->l_end == MAXEND) - bfp->l_len = 0; - (void) convoff(vp, bfp, whence, offset); - - if ((!error) && (cmd == F_SETLK || cmd == F_SETLKW) && - (bfp->l_type != F_UNLCK)) - u.u_procp->p_flag |= SLKDONE; - #ifdef NFSDEBUG - cmn_err(CE_CONT, "NFS_FRLOCK: error=%d\n", error); + printf("NFS_FRLOCK: error=%d\n", error); #endif return (error); } -/* - * Free storage space associated with the specified vnode. The portion - * to be freed is specified by bfp->l_start and bfp->l_len (already - * normalized to a "whence" of 0). - * - * This is an experimental facility whose continued existence is not - * guaranteed. Currently, we only support the special case - * of l_len == 0, meaning free to end of file. - */ -/* ARGSUSED */ -STATIC int -nfs_space(vp, cmd, bfp, flag, offset, cr) - struct vnode *vp; - int cmd; - struct flock *bfp; - int flag; - off_t offset; - struct cred *cr; -{ - int error; - - ASSERT(vp->v_type == VREG); - if (cmd != F_FREESP) - return (EINVAL); - - if ((error = convoff(vp, bfp, 0, offset)) == 0) { - ASSERT(bfp->l_start >= 0); - if (bfp->l_len == 0) { - struct vattr va; - - va.va_size = bfp->l_start; - va.va_mask = AT_SIZE; - error = nfs_setattr(vp, &va, 0, cr); - } - else - error = EINVAL; - } - - return (error); -} - /*ARGSUSED*/ STATIC int nfs_realvp(vp, vpp) @@ -2849,11 +2841,11 @@ nfs_realvp(vp, vpp) /*ARGSUSED*/ STATIC int -nfs_delmap(vp, off, as, addr, len, prot, maxprot, flags, cr) +nfs_delmap(vp, off, as, addrp, len, prot, maxprot, flags, cr) struct vnode *vp; u_int off; struct as *as; - addr_t addr; + addr_t *addrp; u_int len; u_int prot, maxprot; u_int flags; @@ -2874,8 +2866,7 @@ nfs_lockrelease(vp, flag, offset, cred) struct cred *cred; { #ifdef NFSDEBUG - cmn_err(CE_CONT, "enter nfs_lockrelease(): flag %d offset %d\n", - flag, offset); + printf ("enter nfs_lockrelease(): flag %d offset %d\n", flag, offset); #endif /* * Only do extra work if the process has done record-locking. @@ -2892,7 +2883,7 @@ nfs_lockrelease(vp, flag, offset, cred) * Check all open files to see if there's a lock * possibly held for this vnode. */ - for (ufpp = &u.u_flist; ufpp != NULL; ufpp = ufpp->uf_next) + for (ufpp = &u.u_flist; ufpp->uf_next; ufpp = ufpp->uf_next) for (i=0; i < NFPCHUNK; i++) { if (((ufppp = ufpp->uf_ofile[i]) != NULL) && (ufpp->uf_pofile[i] & UF_FDLOCK)) { diff --git a/usr/src/uts/3b2/fs/nfs/nfs_xdr.c b/usr/src/uts/3b2/fs/nfs/nfs_xdr.c index 19012fa..61422d6 100644 --- a/usr/src/uts/3b2/fs/nfs/nfs_xdr.c +++ b/usr/src/uts/3b2/fs/nfs/nfs_xdr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfs_xdr.c 1.6" +#ident "@(#)fs:fs/nfs/nfs_xdr.c 1.5" /* @(#)nfs_xdr.c 2.38 88/02/08 SMI */ @@ -270,7 +270,7 @@ rrokwakeup(rip) { rip->done = 1; - wakeprocs((caddr_t)rip, PRMPT); + wakeup((caddr_t)rip); } */ diff --git a/usr/src/uts/3b2/fs/nfs/nfssys.c b/usr/src/uts/3b2/fs/nfs/nfssys.c index 0d3fcc6..e1f5f71 100644 --- a/usr/src/uts/3b2/fs/nfs/nfssys.c +++ b/usr/src/uts/3b2/fs/nfs/nfssys.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/nfs/nfssys.c 1.3" +#ident "@(#)fs:fs/nfs/nfssys.c 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -45,9 +45,7 @@ rval_t *rvp; switch ((int) uap->opcode) { case NFS_SVC: /* NFS server daemon */ - if (copyin((caddr_t) uap->nfssysarg_svc, - (caddr_t) &a.nfs_svc_args_u, - sizeof(a.nfs_svc_args_u))) + if (copyin((caddr_t) uap->nfssysarg_svc, (caddr_t) &a.nfs_svc_args_u, sizeof(a.nfs_svc_args_u))) return(EFAULT); else return(nfs_svc(&a.nfs_svc_args_u)); @@ -64,10 +62,6 @@ rval_t *rvp; /* get a file handle */ return(nfs_getfh(uap->nfssysarg_getfh)); - case NFS_CNVT: - /* open a file referred to by a file handle */ - return(nfs_cnvt(uap->nfssysarg_cnvt, rvp)); - default: return(EINVAL); } diff --git a/usr/src/uts/3b2/fs/pathname.c b/usr/src/uts/3b2/fs/pathname.c index 95446ff..b3ad3d8 100644 --- a/usr/src/uts/3b2/fs/pathname.c +++ b/usr/src/uts/3b2/fs/pathname.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/pathname.c 1.8" +#ident "@(#)fs:fs/pathname.c 1.7" #include "sys/types.h" #include "sys/param.h" #include "sys/debug.h" diff --git a/usr/src/uts/3b2/fs/proc/prdata.h b/usr/src/uts/3b2/fs/proc/prdata.h index 695c4b5..ea19e56 100644 --- a/usr/src/uts/3b2/fs/proc/prdata.h +++ b/usr/src/uts/3b2/fs/proc/prdata.h @@ -8,7 +8,7 @@ #ifndef _PROC_PRDATA_H #define _PROC_PRDATA_H -#ident "@(#)fs:fs/proc/prdata.h 1.17" +#ident "@(#)fs:fs/proc/prdata.h 1.16" #define min(a,b) ((a) <= (b) ? (a) : (b)) #define max(a,b) ((a) >= (b) ? (a) : (b)) #define round(r) (((r)+sizeof(int)-1)&(~(sizeof(int)-1))) @@ -55,7 +55,6 @@ user_t *prumap(proc_t *); void prunmap(proc_t *); void prgetregs(user_t *, gregset_t); void prsetregs(user_t *, gregset_t); -int prgetpc(gregset_t); int prhasfp(void); void prgetfpregs(proc_t *, fpregset_t *); void prsetfpregs(proc_t *, fpregset_t *); @@ -73,7 +72,6 @@ user_t *prumap(); void prunmap(); void prgetregs(); void prsetregs(); -int prgetpc(); int prhasfp(); void prgetfpregs(); void prsetfpregs(); diff --git a/usr/src/uts/3b2/fs/proc/prmachdep.c b/usr/src/uts/3b2/fs/proc/prmachdep.c index 31b9ee7..074c87a 100644 --- a/usr/src/uts/3b2/fs/proc/prmachdep.c +++ b/usr/src/uts/3b2/fs/proc/prmachdep.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/proc/prmachdep.c 1.8" +#ident "@(#)fs:fs/proc/prmachdep.c 1.7" #include "sys/types.h" #include "sys/param.h" #include "sys/cred.h" @@ -127,16 +127,6 @@ prsetregs(up, rp) ((psw_t *)(®[PS]))->TE = ((psw_t *)&rp[R_PS])->TE; } -/* - * Return the value of the PC from the supplied register set. - */ -int -prgetpc(rp) - gregset_t rp; -{ - return rp[R_PC]; -} - /* * Is there floating-point hardware? */ diff --git a/usr/src/uts/3b2/fs/proc/prsubr.c b/usr/src/uts/3b2/fs/proc/prsubr.c index 4613027..49f38db 100644 --- a/usr/src/uts/3b2/fs/proc/prsubr.c +++ b/usr/src/uts/3b2/fs/proc/prsubr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/proc/prsubr.c 1.42" +#ident "@(#)fs:fs/proc/prsubr.c 1.40" #include "sys/types.h" #include "sys/param.h" #include "sys/cmn_err.h" @@ -93,7 +93,7 @@ prexit(p) ASSERT(pnp->pr_proc); pnp->pr_proc = NULL; } - wakeprocs((caddr_t)p->p_trace, PRMPT); + wakeup((caddr_t)p->p_trace); } /* @@ -158,7 +158,7 @@ prinvalidate(up) premptyset(&p->p_fltmask); /* faults */ p->p_flag &= ~(SPRSTOP|SRUNLCL|SPROCTR|SPRFORK); if (p->p_trace) - wakeprocs((caddr_t)p->p_trace, PRMPT); + wakeup((caddr_t)p->p_trace); } } @@ -272,7 +272,7 @@ prawake(p) { if (p->p_flag & SPRWAKE) { p->p_flag &= ~SPRWAKE; - wakeprocs((caddr_t)&p->p_trace, PRMPT); + wakeup((caddr_t)&p->p_trace); runrun = 1; } } @@ -300,7 +300,7 @@ prunlock(pnp) prpidlock = 0; if (prpidwant) { prpidwant = 0; - wakeprocs((caddr_t)&prpidlock, PRMPT); + wakeup((caddr_t)&prpidlock); } splx(s); } @@ -382,7 +382,7 @@ prgetstatus(p, sp) } else { iov.iov_base = (caddr_t) &instr; uio.uio_resid = iov.iov_len = sizeof(instr); - uio.uio_offset = prgetpc(sp->pr_reg); + uio.uio_offset = sp->pr_reg[R_PC]; uio.uio_iov = &iov; uio.uio_iovcnt = 1; uio.uio_segflg = UIO_SYSSPACE; diff --git a/usr/src/uts/3b2/fs/proc/prvfsops.c b/usr/src/uts/3b2/fs/proc/prvfsops.c index db7b380..5654028 100644 --- a/usr/src/uts/3b2/fs/proc/prvfsops.c +++ b/usr/src/uts/3b2/fs/proc/prvfsops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/proc/prvfsops.c 1.25" +#ident "@(#)fs:fs/proc/prvfsops.c 1.22" #include "sys/types.h" #include "sys/param.h" #include "sys/cred.h" @@ -57,10 +57,6 @@ struct vfsops prvfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* ARGSUSED */ @@ -118,7 +114,7 @@ prunmount(vfsp, cr) struct vfs *vfsp; struct cred *cr; { - register proc_t *p; + register proc_t **p; if (!suser(cr)) return EPERM; @@ -127,11 +123,10 @@ prunmount(vfsp, cr) */ if (prrootnode.pr_vnode.v_count > 1) return EBUSY; - - for (p = practive; p != NULL; p = p->p_next) - if (p->p_trace != NULL) + for (p = nproc; p < v.ve_proc; p++) { + if (*p && (*p)->p_stat != 0 && (*p)->p_trace != NULL) return EBUSY; - + } VN_RELE(&prrootnode.pr_vnode); prmounted = 0; procvfs = NULL; @@ -156,11 +151,8 @@ prstatvfs(vfsp, sp) struct vfs *vfsp; register struct statvfs *sp; { - register int i, n; - - for (n = v.v_proc, i = 0; i < v.v_proc; i++) - if (pid_entry(i) != NULL) - n--; + register proc_t **p; + register long int n; bzero((caddr_t)sp, sizeof(*sp)); sp->f_bsize = 1024; @@ -169,13 +161,15 @@ prstatvfs(vfsp, sp) sp->f_bfree = 0; sp->f_bavail = 0; sp->f_files = v.v_proc + 2; + for (n = v.v_proc, p = nproc; p < v.ve_proc; p++) + if (*p && (*p)->p_stat) + n--; sp->f_ffree = n; sp->f_favail = n; sp->f_fsid = vfsp->vfs_dev; strcpy(sp->f_basetype, vfssw[procfstype].vsw_name); sp->f_flag = vf_to_stf(vfsp->vfs_flag); sp->f_namemax = PNSIZ; - strcpy(sp->f_fstr, "/proc"); - strcpy(&sp->f_fstr[6], "/proc"); + strcpy(sp->f_fstr, "/proc /proc"); return 0; } diff --git a/usr/src/uts/3b2/fs/proc/prvnops.c b/usr/src/uts/3b2/fs/proc/prvnops.c index 35deb70..91d0dba 100644 --- a/usr/src/uts/3b2/fs/proc/prvnops.c +++ b/usr/src/uts/3b2/fs/proc/prvnops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/proc/prvnops.c 1.24" +#ident "@(#)fs:fs/proc/prvnops.c 1.17" #include "sys/types.h" #include "sys/param.h" #include "sys/time.h" @@ -99,30 +99,6 @@ struct vnodeops prvnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; STATIC struct vnode *prget(); @@ -315,7 +291,6 @@ prread(vp, uiop, ioflag, cr) struct prdirect dirbuf; register int i, n, j; int minproc, maxproc, modoff; - proc_t *p; register struct prnode *pnp = VTOP(vp); int error = 0; @@ -340,8 +315,9 @@ prread(vp, uiop, ioflag, cr) for (j = 0; j < PRDIRSIZE; j++) dirbuf.d_name[j] = '\0'; for (i = minproc; i < min(maxproc, v.v_proc); i++) { - if ((p = pid_entry(i)) != NULL) { - n = p->p_pid; + if (nproc[i] && nproc[i]->p_stat != 0 + && nproc[i]->p_stat != SIDL) { + n = nproc[i]->p_pid; dirbuf.d_ino = ptoi(n); for (j = PNSIZ-1; j >= 0; j--) { dirbuf.d_name[j] = n % 10 + '0'; @@ -420,8 +396,8 @@ prgetattr(vp, vap, flags, cr) vap->va_nodeid = PRROOTINO; vap->va_size = (v.v_proc + 2) * PRSDSIZE; } else if ((p = pnp->pr_proc) != NULL) { - vap->va_uid = p->p_cred->cr_uid; - vap->va_gid = p->p_cred->cr_gid; + vap->va_uid = p->p_cred->cr_suid; + vap->va_gid = p->p_cred->cr_sgid; vap->va_nlink = 1; vap->va_nodeid = ptoi(p->p_pid); vap->va_size = rm_assize(p->p_as); @@ -432,9 +408,12 @@ prgetattr(vp, vap, flags, cr) vap->va_mode = pnp->pr_mode; vap->va_fsid = procdev; vap->va_rdev = 0; - vap->va_atime = vap->va_mtime = vap->va_ctime = hrestime; + vap->va_atime.tv_sec = vap->va_mtime.tv_sec = vap->va_ctime.tv_sec + = hrestime.tv_sec; + vap->va_atime.tv_nsec = vap->va_mtime.tv_nsec = vap->va_ctime.tv_nsec + = hrestime.tv_nsec; vap->va_blksize = 1024; - vap->va_nblocks = btod(vap->va_size); + vap->va_nblocks = (vap->va_size + 1023) / 1024; vap->va_vcode = 0; return 0; } @@ -579,7 +558,6 @@ prreaddir(vp, uiop, cr, eofp) register int i, j, n; int oresid, dsize; off_t off; - proc_t *p; if (uiop->uio_offset < 0 || uiop->uio_resid <= 0 || (uiop->uio_offset % PRSDSIZE) != 0) @@ -608,9 +586,10 @@ prreaddir(vp, uiop, cr, eofp) */ if ((i = (off-2*PRSDSIZE)/PRSDSIZE) >= v.v_proc) break; - if ((p = pid_entry(i)) == NULL) + if (nproc[i] == NULL || nproc[i]->p_stat == 0 + || nproc[i]->p_stat == SIDL) continue; - n = p->p_pid; + n = nproc[i]->p_pid; dirent->d_ino = ptoi(n); for (j = PNSIZ-1; j >= 0; j--) { dirent->d_name[j] = n % 10 + '0'; diff --git a/usr/src/uts/3b2/fs/rfs/du.c b/usr/src/uts/3b2/fs/rfs/du.c index f81a2f1..5db8cd5 100644 --- a/usr/src/uts/3b2/fs/rfs/du.c +++ b/usr/src/uts/3b2/fs/rfs/du.c @@ -5,7 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/du.c 1.20" +#ident "@(#)fs:fs/rfs/du.c 1.13.1.1" + #include "sys/types.h" #include "sys/sysinfo.h" #include "sys/fs/rf_acct.h" @@ -54,8 +55,6 @@ #include "rf_auth.h" #include "du.h" #include "sys/inline.h" -#include "sys/buf.h" -#include "vm/page.h" #include "rf_cache.h" /* @@ -99,7 +98,6 @@ STATIC int dusys_utime(); STATIC int dusys_utime_pass(); STATIC int dusys_statfs(); STATIC void du_stat_to_vattr(); -STATIC int du_fs_to_vfs(); STATIC int du_o_flock_to_flock(); STATIC int dusr_vn_open(); STATIC int dusr_vn_create(); @@ -349,7 +347,7 @@ dusys_chdirec(dvp, comp, vpp, pnp, flags, rdirvp, crp) register rf_message_t *msg = RF_MSG(bp); if (!(msg->m_stat & RF_GIFT)) { - gdp_j_accuse("dusys_chdirec: no file reference", + gdp_discon("dusys_chdirec: no file reference", QPTOGP((queue_t *)msg->m_queue)); error = EPROTO; goto out; @@ -359,7 +357,8 @@ dusys_chdirec(dvp, comp, vpp, pnp, flags, rdirvp, crp) /* * Set up for rfcl_findsndd or del_sndd */ - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); + sndd_set(giftsdp, (queue_t *)msg->m_queue, + msg->m_giftid); if (!(error = rfcl_findsndd(&giftsdp, crp, bp, dvp->v_vfsp))) { *vpp = SDTOV(giftsdp); @@ -419,7 +418,7 @@ dusys_exec(dvp, comp, vpp, pnp, flags, rdirvp, crp) register rf_message_t *msg = RF_MSG(bp); if (!(msg->m_stat & RF_GIFT)) { - gdp_j_accuse("dusys_exec: no file reference", + gdp_discon("dusys_exec: no file reference", QPTOGP((queue_t *)msg->m_queue)); error = EPROTO; goto out; @@ -429,7 +428,8 @@ dusys_exec(dvp, comp, vpp, pnp, flags, rdirvp, crp) /* * Set up for rfcl_findsndd or del_sndd */ - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); + sndd_set(giftsdp, (queue_t *)msg->m_queue, + msg->m_giftid); if ((error = rfcl_findsndd(&giftsdp, crp, bp, dvp->v_vfsp)) == 0) { register dustash_t *dstp = dst_alloc(); @@ -586,7 +586,7 @@ dusys_rmount(dvp, comp, vpp, pnp, flags, rdirvp, crp) error = ducl_resetpath(bp, pnp, dvp, vpp); } else { pn_setlast(pnp); - gdp_discon("dusys_rmount mount on remote name", + gdp_discon("dusys_rmount bad response header", QPTOGP(chansdp->sd_queue)); error = EPROTO; } @@ -664,12 +664,10 @@ dusys_stat(dvp, comp, vpp, pnp, flags, rdirvp, crp) rqarg.rqstat_op.buf = (long)&sb; datasz = gp->hetero == NO_CONV ? sizeof(struct stat) : - sizeof(struct stat) + STAT_XP; + sizeof(struct stat) + STAT_XP - MINXPAND; if ((error = ducl_namemsg(chansdp, rdirvp, pnp, comp, crp, DUSTAT, &rqarg, &bp)) == 0 && (error = RF_RESP(bp)->rp_errno) == 0) { - register dustash_t *dstp; - caddr_t rpdata; /* * Either RFDOTDOT or valid stat data was received. @@ -680,45 +678,39 @@ dusys_stat(dvp, comp, vpp, pnp, flags, rdirvp, crp) if (RF_COM(bp)->co_opcode != DUSTAT) { error = ducl_resetpath(bp, pnp, dvp, vpp); - goto out; - } - - if (RF_PULLUP(bp, RFV1_MINRESP, datasz)) { - gdp_j_accuse("dusys_stat bad data", gp); - error = EPROTO; - goto out; - } - dstp = dst_alloc(); - rpdata = rf_msgdata(bp, RFV1_MINRESP); - dstp->dst_pid = u.u_procp->p_pid; - if (gp->hetero != NO_CONV) { - if (!rf_fcanon(STAT_FMT, rpdata, rpdata + - datasz, (caddr_t)&dstp->DST_STAT)) { - gdp_j_accuse("dusys_stat bad data", gp); - error = EPROTO; - goto out; + } else if ((error = RF_PULLUP(bp, RFV1_MINRESP, datasz)) == 0) { + register dustash_t *dstp; + caddr_t rpdata; + + dstp = dst_alloc(); + rpdata = rf_msgdata(bp, RFV1_MINRESP); + dstp->dst_pid = u.u_procp->p_pid; + if (gp->hetero != NO_CONV) { + if (!rf_fcanon(STAT_FMT, rpdata, rpdata + + datasz, (caddr_t)&dstp->DST_STAT)) { + gdp_discon("dusys_stat bad response", + gp); + error = EPROTO; + goto out; + } + } else { + dstp->DST_STAT = *(struct stat *)rpdata; } - } else { - dstp->DST_STAT = *(struct stat *)rpdata; + hibyte(dstp->DST_STAT.st_dev) = ~(gp - gdp); + /* + * Stash under current vnode when don't have + * a new gift. + */ + DST_LINK(chansdp, dstp); + pnp->pn_path += pnp->pn_pathlen; + pnp->pn_pathlen = 0; + /* + * Upper level expects back a reference, will + * VN_RELE + */ + VN_HOLD(dvp); + *vpp = dvp; } - hibyte(dstp->DST_STAT.st_dev) = ~(gp - gdp); - - /* - * Stash under current vnode when don't have - * a new gift. - */ - - DST_LINK(chansdp, dstp); - pnp->pn_path += pnp->pn_pathlen; - pnp->pn_pathlen = 0; - - /* - * Upper level expects back a reference, will - * VN_RELE - */ - - VN_HOLD(dvp); - *vpp = dvp; } out: if (error) { @@ -796,7 +788,7 @@ dusys_link(dvp, comp, vpp, pnp, flags, rdirvp, crp) register rf_message_t *msg = RF_MSG(bp); if (!(msg->m_stat & RF_GIFT)) { - gdp_j_accuse("dulink: no file reference", + gdp_discon("dulink: no file reference", QPTOGP((queue_t *)msg->m_queue)); error = EPROTO; goto out; @@ -806,7 +798,8 @@ dusys_link(dvp, comp, vpp, pnp, flags, rdirvp, crp) /* * Set up for rfcl_findsndd or del_sndd */ - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); + sndd_set(giftsdp, (queue_t *)msg->m_queue, + msg->m_giftid); if (!(error = rfcl_findsndd(&giftsdp, crp, bp, dvp->v_vfsp))) { *vpp = SDTOV(giftsdp); @@ -1015,7 +1008,7 @@ dusys_unlink(dvp, comp, vpp, pnp, flags, rdirvp, crp) * Faking VOP_RENAME is complicated for the system call protocol. * * In the normal case, it involves four calls to du_lookup, hence to - * dusys_rename. + *dusys_rename. * * 1. Get a reference to the existing file's parent directory. * 2. Get a reference to the existing file. @@ -1046,40 +1039,30 @@ dusys_rename(dvp, comp, vpp, pnp, flags, rdirvp, crp) register int error; if (*pnp->pn_path == '\0') { - /* * This is a lookup on a non-directory file. Turning - * off LOOKUP_DIR will coerce dusys_link to get a reference + * off LOOKUP_DIR will coercedusys_link to get a reference * to the file. */ - if ((error =dusys_link(dvp, comp, vpp, pnp, flags & ~LOOKUP_DIR, rdirvp, crp)) == ENOENT) { - /* * Zap the pathname so a lookup that is really * interested only in the directory will pass. */ - pnp->pn_path += pnp->pn_pathlen; pnp->pn_pathlen = 0; } else if (!error && (*vpp)->v_type == VDIR) { - /* - * In general, to link directories is unsafe, because - * ".." needs to be reconstructed, but we are not - * prepared to make that effort. (Note that this - * would succeed on the server only if the current - * iuid maps into root, anyway.) + * Link will do things to directories that rename + * won't, so we fail here to be safe. */ - error = EISDIR; - VN_RELE(*vpp); } } else { - - /* This is a lookup on a directory. */ - + /* + * This is a lookup on a directory. + */ ASSERT(flags & LOOKUP_DIR); error = du_link_chdir(dvp, comp, vpp, pnp, flags, rdirvp, crp); } @@ -1322,6 +1305,7 @@ dusys_utime(dvp, comp, vpp, pnp, flags, rdirvp, crp) for (ntries = nacked = 1; ntries < RFCL_MAXTRIES && nacked; ntries++) { register rf_request_t *reqp; register char *datap; + register long rdirsd_connid; if ((error = rf_allocmsg(RFV1_MINREQ, datasz, BPRI_LO, TRUE, NULLCADDR, NULLFRP, &bp)) != 0) { @@ -1331,10 +1315,11 @@ dusys_utime(dvp, comp, vpp, pnp, flags, rdirvp, crp) reqp = RF_REQ(bp); reqp->rq_utime.buf = (long)iov.iov_base; if (rdirvp && ISRFSVP(rdirvp) && - rdirvp->v_vfsp == dvp->v_vfsp) { - reqp->rq_rrdir_id = VTOSD(rdirvp)->sd_gift.gift_id; + (rdirsd_connid = (VTOSD(rdirvp))->sd_connid) == + chansdp->sd_connid) { + reqp->rq_rrdir = rdirsd_connid; } else { - reqp->rq_rrdir_id = 0; + reqp->rq_rrdir = 0; } datap = rf_msgdata(bp, RFV1_MINREQ); (void)strcpy(datap, comp); @@ -1389,7 +1374,7 @@ dusys_statfs(dvp, comp, vpp, pnp, flags, rdirvp, crp) } *uargp = (struct a *)u.u_ap; datasz = gp->hetero == NO_CONV ? sizeof(struct statfs) : - sizeof(struct statfs) + STATFS_XP; + sizeof(struct statfs) + STATFS_XP - MINXPAND; rqarg.rqstatfs_op.buf = (long)&uargp->sbp; rqarg.rqstatfs_op.len = sizeof(struct statfs); rqarg.rqstatfs_op.fstyp = 0; @@ -1401,10 +1386,7 @@ dusys_statfs(dvp, comp, vpp, pnp, flags, rdirvp, crp) */ if (RF_COM(bp)->co_opcode != DUSTATFS) { error = ducl_resetpath(bp, pnp, dvp, vpp); - } else if (RF_PULLUP(bp, RFV1_MINRESP, datasz)) { - gdp_j_accuse("dusys_statfs bad data", gp); - error = EPROTO; - } else { + } else if ((error = RF_PULLUP(bp, RFV1_MINRESP, datasz)) == 0) { register dustash_t *dstp = dst_alloc(); register caddr_t rpdata = rf_msgdata(bp, RFV1_MINRESP); @@ -1412,7 +1394,7 @@ dusys_statfs(dvp, comp, vpp, pnp, flags, rdirvp, crp) if (gp->hetero != NO_CONV) { if (!rf_fcanon(STATFS_FMT, rpdata, rpdata + datasz, (caddr_t)&dstp->DST_STATFS)) { - gdp_j_accuse("dusys_statfs bad data", + gdp_discon("dusys_statfs bad response", gp); error = EPROTO; goto out; @@ -1555,26 +1537,17 @@ du_fcntl(op, vp, cmd, arg, flag, offset, crp) int nacked; mblk_t *bp = NULL; rcvd_t *rdp; - register sndd_t *chansdp = VTOSD(vp); + register sndd_t *chansdp = VTOSD(vp); register gdp_t *gp = QPTOGP(chansdp->sd_queue); - register size_t datasz = 0; + register size_t datasz = sizeof(o_flock_t); register size_t rqsz; flock_t *flp = (flock_t *)arg; int canon = gp->hetero != NO_CONV; o_flock_t oflock; o_flock_t *oflp; - int sendflock = 0; - switch (cmd) { - case F_O_GETLK: - case F_SETLK: - case F_SETLKW: - case F_FREESP: - sendflock = 1; - datasz = sizeof(o_flock_t); - if (canon) { - datasz += OFLOCK_XP; - } + if (canon) { + datasz += OFLOCK_XP - MINXPAND; } rqsz = RFV1_MINREQ + datasz; @@ -1607,7 +1580,11 @@ du_fcntl(op, vp, cmd, arg, flag, offset, crp) * F_FREESP uses the same structure, so let it go along * for the ride. */ - if (sendflock) { + switch (cmd) { + case F_O_GETLK: + case F_SETLK: + case F_SETLKW: + case F_FREESP: reqp->rq_fcntl.fflag |= DUFRPREWRITE; rqdatap = rf_msgdata(bp, RFV1_MINREQ); if (canon) { @@ -1690,23 +1667,16 @@ du_getattr(vp, vap, flags, crp) } datasz = gp->hetero == NO_CONV ? sizeof(struct stat) : - sizeof(struct stat) + STAT_XP; + sizeof(struct stat) + STAT_XP - MINXPAND; rqarg.rqstat_op.buf = (long)&sbuf; /* woof */ if ((error = rfcl_op(sdp, crp, DUFSTAT, &rqarg, &bp, TRUE)) == 0 && - (error = RF_RESP(bp)->rp_errno) == 0) { - caddr_t rpdata; - - if (RF_PULLUP(bp, RFV1_MINRESP, datasz)) { - gdp_j_accuse("du_getattr bad data", gp); - error = EPROTO; - goto out; - } - - rpdata = rf_msgdata(bp, RFV1_MINRESP); + (error = RF_RESP(bp)->rp_errno) == 0 && + (error = RF_PULLUP(bp, RFV1_MINRESP, datasz)) == 0) { + caddr_t rpdata = rf_msgdata(bp, RFV1_MINRESP); if (gp->hetero != NO_CONV && !rf_fcanon(STAT_FMT, rpdata, rpdata + datasz, rpdata)) { - gdp_j_accuse("du_getattr bad data", gp); + gdp_discon("du_getattr bad server data", gp); error = EPROTO; goto out; } @@ -1814,7 +1784,6 @@ du_rename(fdvp, fnm, tdvp, tnm, crp) * We have to reaquire a reference to the existing file, because * it doesn't come through the interface. */ - pathname_t pathname; vnode_t *fvp; vnode_t *tvp; @@ -1826,34 +1795,26 @@ du_rename(fdvp, fnm, tdvp, tnm, crp) if (error = pn_get(fnm, UIO_SYSSPACE, &pathname)) { return error; } - ASSERT(pn_peekchar(&pathname) != '/'); - pathname.pn_path += pathname.pn_pathlen; pathname.pn_pathlen = 0; if (strlen(fnm) + 1 > DU_DATASIZE) { error = ENOMEM; goto freepn; } - if ((error = dusys_link(fdvp, fnm, &fvp, &pathname, 0, rdir, crp)) != 0) { goto freepn; } VN_RELE(fvp); /* get rid of redundant reference */ - if (fvp->v_type == VDIR) { - error = ENOSYS; - goto freepn; - } - + /* + * Unlink the target file. + */ if (strlen(tnm) + 1 > DU_DATASIZE) { error = ENOMEM; goto freepn; } - - /* Unlink the target file. */ - if ((error = dusys_unlink(tdvp, tnm, &tvp, &pathname, 0, rdir, crp)) != 0 && error != ENOENT) { @@ -1862,26 +1823,26 @@ du_rename(fdvp, fnm, tdvp, tnm, crp) VN_RELE(tvp); /* dusys_unlink fakes a lookup */ } - /* Link the "from" file to the target. */ - + /* + * Link the "from" file to the target. + */ if (error = rf_link(tdvp, fvp, tnm, crp)) { goto freepn; } - /* Unlink the "from" file. */ - + /* + * Unlink the "from" file. + */ pathname.pn_path += pathname.pn_pathlen; pathname.pn_pathlen = 0; if (strlen(fnm) + 1 > DU_DATASIZE) { error = ENOMEM; goto freepn; } - if ((error = dusys_unlink(fdvp, fnm, &fvp, &pathname, 0, rdir, crp)) == 0) { VN_RELE(fvp); /* dusys_unlink fakes a lookup */ } - freepn: pn_free(&pathname); return error; @@ -1990,49 +1951,36 @@ du_fstatfs(vfsp, stvfsp) register gdp_t *gp = QPTOGP(sdp->sd_queue); size_t datasz; + void fs_to_vfs(); + /* * Stashed struct statfs might be associated with the send descriptor * by prior lookup going through du_statfs(). */ if ((dstp = dst_unlink(sdp, u.u_procp->p_pid)) != NULL) { - error = du_fs_to_vfs(&dstp->DST_STATFS, stvfsp, vfsp); + fs_to_vfs(&dstp->DST_STATFS, stvfsp, vfsp); dst_free(dstp); /* done with this stash */ - if (error) { - gdp_j_accuse("du_fstatfs bad server data", gp); - error = EPROTO; - } - return error; + return 0; } VN_HOLD(vp); /* so it won't disappear (impossible?) */ datasz = gp->hetero == NO_CONV ? sizeof(struct statfs) : - sizeof(struct statfs) + STATFS_XP; + sizeof(struct statfs) + STATFS_XP - MINXPAND; rqarg.rqstatfs_op.buf = (long)stvfsp; /* server wants an address */ rqarg.rqstatfs_op.len = sizeof(struct statfs); rqarg.rqstatfs_op.fstyp = 0; if ((error = rfcl_op(sdp, u.u_cred, DUFSTATFS, &rqarg, &bp, TRUE)) == 0 && - (error = RF_RESP(bp)->rp_errno) == 0) { - if (RF_PULLUP(bp, RFV1_MINRESP, datasz)) { - gdp_j_accuse("du_fstatfs bad server data", gp); - error = EPROTO; - } else { - caddr_t rpdata; + (error = RF_RESP(bp)->rp_errno) == 0 && + (error = RF_PULLUP(bp, RFV1_MINRESP, datasz)) == 0) { + caddr_t rpdata = rf_msgdata(bp, RFV1_MINRESP); - rpdata = rf_msgdata(bp, RFV1_MINRESP); - - if (gp->hetero != NO_CONV && - !rf_fcanon(STATFS_FMT, rpdata, rpdata + datasz, - rpdata)) { - gdp_j_accuse("du_fstatfs bad server data", gp); - error = EPROTO; - } - if (!error && - (error = du_fs_to_vfs((struct statfs *)rpdata, stvfsp, - vfsp))) { - gdp_j_accuse("du_fstatfs bad server data", gp); - } + if (gp->hetero != NO_CONV && + !rf_fcanon(STATFS_FMT, rpdata, rpdata + datasz, rpdata)) { + gdp_discon("du_fstatfs bad server data", gp); + error = EPROTO; } + fs_to_vfs((struct statfs *)rpdata, stvfsp, vfsp); rf_freemsg(bp); } VN_RELE(vp); @@ -2219,7 +2167,7 @@ dusys_utime_pass(pnp, bpp, rdp, replysdp, uiop, dvp, vpp) } /* - * pure lookup via chdir for links only, this is not generally useable. + * "pure" lookup via chdir for links only, this is not generally useable. */ STATIC int du_link_chdir(dvp, comp, vpp, pnp, flags, rdirvp, crp) @@ -2304,20 +2252,20 @@ dusys_copen_resp(bp, pnp, dvp, vpp, crp, rqop, giftsdp, fmode) } else if ((error = rp->rp_errno) != 0) { rfcl_giftfree(bp, &giftsdp, crp); } else if (!(msg->m_stat & RF_GIFT)) { - gdp_j_accuse("dusys_copen_resp: no file reference", + gdp_discon("dusys_copen_resp: no file reference", QPTOGP((queue_t *)msg->m_queue)); sndd_free(&giftsdp); error = EPROTO; } else { - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); - if ((error = rfcl_findsndd(&giftsdp, crp, bp, dvp->v_vfsp)) - == 0) { + sndd_set(giftsdp, (queue_t *)msg->m_queue, msg->m_giftid); + if (!(error = rfcl_findsndd(&giftsdp, crp, bp, + dvp->v_vfsp))) { /* * We can update the out parameter consistently, and - * with impunity, with the correct result vp. The + * with impunity with the correct result vp. The * current implementations of lookuppn and vn_create - * will discard the reference if they are interested + * will discard the reference if the are interested * in the parent, and not the child. We don't have to * worry about the vnode disappearing in that case, * because we bump the count when stashing it. If this @@ -2329,24 +2277,40 @@ dusys_copen_resp(bp, pnp, dvp, vpp, crp, rqop, giftsdp, fmode) */ vp = *vpp = SDTOV(giftsdp); + giftsdp->sd_fhandle = rp->rp_fhandle; /* for caching */ + if (rqop == RFOPEN && (vp->v_flag & VTEXT) && + (fmode & FWRITE) && + !(fmode & FEXCL && fmode & FCREAT)) { - giftsdp->sd_fhandle = rp->rp_fhandle; - if (rp->rp_cache & RP_MNDLCK) { - giftsdp->sd_stat |= SDMNDLCK; - } - - pnp->pn_path += pnp->pn_pathlen; - pnp->pn_pathlen = 0; - if (rqop == RFCREATE || rqop == DUCOREDUMP || - fmode & FCREAT) { + /* + * Local text associated with the vnode might + * not have been detected on the server. + */ - /* Need to stash only for creates */ + ASSERT(!(vp->v_vfsp->vfs_flag & VFS_RDONLY)); + ASSERT(fmode & FCREAT || vp->v_type != VDIR && + !vp->v_filocks); - VN_HOLD(vp); - dstp = dst_alloc(); - dstp->DST_VP = vp; - dstp->dst_pid = u.u_procp->p_pid; - DST_LINK(VTOSD(dvp), dstp); + xrele(vp); + if (vp->v_flag & VTEXT) { + VN_RELE(vp); + error = ETXTBSY; + } + } + if (!error) { + pnp->pn_path += pnp->pn_pathlen; + pnp->pn_pathlen = 0; + if (rqop == RFCREATE || rqop == DUCOREDUMP || + fmode & FCREAT) { + /* + * Need to stash only for creates + */ + VN_HOLD(vp); + dstp = dst_alloc(); + dstp->DST_VP = vp; + dstp->dst_pid = u.u_procp->p_pid; + DST_LINK(VTOSD(dvp), dstp); + } } } else { *vpp = NULLVP; @@ -2355,90 +2319,6 @@ dusys_copen_resp(bp, pnp, dvp, vpp, crp, rqop, giftsdp, fmode) return error; } -/* - * Copy the member fields from the referenced statfs structure into the - * referenced statvfs structure, zeroing other fields of the statvfs. - * Returns 0 for success, errno for failure. - */ -STATIC int -du_fs_to_vfs(sfp, svp, vfsp) - register struct statfs *sfp; - register struct statvfs *svp; - register vfs_t *vfsp; -{ - register int i; - register char *cp; - register char *cp2; - register int bmul; - - if (!sfp->f_bsize) { - return EPROTO; - } - - bzero((caddr_t)svp, sizeof(struct statvfs)); - svp->f_bsize = sfp->f_bsize; - svp->f_frsize = !sfp->f_frsize ? sfp->f_bsize : sfp->f_frsize; - - /* statfs blocks/bfree is in terms of 512 byte blocks. */ - - if (svp->f_frsize >= 512) { - bmul = svp->f_frsize / 512; - svp->f_blocks = sfp->f_blocks / bmul; - svp->f_bavail = svp->f_bfree = sfp->f_bfree / bmul; - } else { - bmul = 512 / svp->f_frsize; - svp->f_blocks = sfp->f_blocks * bmul; - svp->f_bavail = svp->f_bfree = sfp->f_bfree * bmul; - } - - svp->f_files = sfp->f_files; - svp->f_ffree = sfp->f_ffree; - svp->f_favail = sfp->f_ffree; - svp->f_fsid = vfsp->vfs_dev; - - /* - * We can't provide the base type because the old statfs structure - * supplies only an fstype number, which is meaningless on the - * client. - */ - - strcpy((caddr_t)svp->f_basetype, "unknown"); - svp->f_flag = vf_to_stf(vfsp->vfs_flag); - - /* Fill f_name, f_pack from variable length strings in f_fstr. */ - - cp = svp->f_fstr; - cp2 = sfp->f_fname; - for (i = 0; i < sizeof(sfp->f_fname); i++, cp2++) { - if (*cp != '\0') { - *cp2 = *cp++; - } else { - *cp2 = '\0'; - } - } - while (cp++ != '\0' && i < sizeof(svp->f_fstr) - - sizeof(sfp->f_fpack)) { - i++; - } - cp2 = sfp->f_fpack; - for (i = 0; i < sizeof(sfp->f_fpack); i++, cp2++) { - if (*cp != '\0') { - *cp2 = *cp++; - } else { - *cp2 = '\0'; - } - } - - /* - * Set namemax to 14, which is DIRSIZ in SVR3.x. This isn't generally - * correct, but the protocol doesn't provide the information. - */ - - svp->f_namemax = 14; - - return 0; -} - int dusr_saccess(stp, ctrlp) register rfsr_state_t *stp; @@ -2500,7 +2380,10 @@ dusr_chdirec(stp, ctrlp) } ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); - return rfsr_gift_setup(stp, vp, u.u_srchan); + if (error = rfsr_gift_setup(stp, vp, u.u_srchan)) { + VN_RELE(vp); + } + return error; } int @@ -2551,10 +2434,26 @@ dusr_coredump(stp, ctrlp) register rfsr_state_t *stp; register rfsr_ctrl_t *ctrlp; { + mblk_t *corebp; + rfsr_fsinfo.fsivop_open++; rfsr_fsinfo.fsivop_create++; rfsr_fsinfo.fsivop_lookup++; + /* + * Kluge to keep interfaces sane for normal ops. + * Assumes absence of data part in block containing + * RFS headers. + */ + + (void)rf_allocmsg((size_t)0, sizeof("core"), BPRI_MED, FALSE, NULLCADDR, + NULLFRP, &corebp); + ASSERT(corebp); + strcpy("core", (caddr_t)corebp->b_rptr); + corebp->b_wptr += sizeof("core"); + RF_MSG(stp->sr_in_bp)->m_size += sizeof("core"); + corebp->b_cont = stp->sr_in_bp->b_cont; + stp->sr_in_bp->b_cont = corebp->b_cont; return dusr_vn_open(FREAD|FWRITE|FCREAT, 0666 & MODEMASK & (int)~RF_REQ(stp->sr_in_bp)->rq_coredump.cmask, stp, ctrlp); @@ -2591,12 +2490,9 @@ dusr_exec(stp, ctrlp) rfsr_fsinfo.fsivop_lookup++; rfsr_fsinfo.fsivop_open++; - if (RF_PULLUP(stp->sr_in_bp, RFV1_MINREQ, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - RFV1_MINREQ)) { - return rfsr_j_accuse("dusr_exec bad data", stp); - } - - if ((error = + if ((error = RF_PULLUP(stp->sr_in_bp, RFV1_MINREQ, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - RFV1_MINREQ)) != 0 || + (error = pn_get(rf_msgdata(stp->sr_in_bp, RFV1_MINREQ), UIO_SYSSPACE, &pn)) != 0) { return error; @@ -2612,24 +2508,29 @@ dusr_exec(stp, ctrlp) VN_RELE(vp); return EACCES; } + if (!(vp->v_flag & VTEXT) && vp->v_count != 1 && filesearch(vp)) { + VN_RELE(vp); + return ETXTBSY; + } + vp->v_flag |= VTEXT; len = pn.pn_pathlen + 1; ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc(len, stp->sr_vcver); rsp = RF_RESP(stp->sr_out_bp); - rsp->rp_v1giftinfo.mode = 0; + rsp->rp_v1gift.mode = 0; vattr.va_mask = AT_MODE; if (error = VOP_GETATTR(vp, &vattr, 0, stp->sr_cred)) { return error; } if (vattr.va_mode & VSUID) { - rsp->rp_v1giftinfo.mode |= VSUID; + rsp->rp_v1gift.mode |= VSUID; } if (vattr.va_mode & VSGID) { - rsp->rp_v1giftinfo.mode |= VSGID; + rsp->rp_v1gift.mode |= VSGID; } if (vattr.va_mode & VSVTX) { - rsp->rp_v1giftinfo.mode |= VSVTX; + rsp->rp_v1gift.mode |= VSVTX; } bcopy((caddr_t)pn.pn_path, (caddr_t)rf_msgdata(stp->sr_out_bp, RFV1_MINRESP), len); @@ -2637,9 +2538,10 @@ dusr_exec(stp, ctrlp) /* * Do this last because it commits resources */ - if (!(error = rfsr_gift_setup(stp, vp, u.u_srchan))) { - stp->sr_gift->rd_stat |= RDTEXT; + if (error = rfsr_gift_setup(stp, vp, u.u_srchan)) { + VN_RELE(vp); } + stp->sr_gift->rd_stat |= RDTEXT; return error; } @@ -2686,7 +2588,7 @@ dusr_fcntl(stp, ctrlp) SR_FREEMSG(stp); ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); - RF_RESP(stp->sr_out_bp)->rp_cache |= RP_MNDLCK; + RF_RESP(stp->sr_out_bp)->rp_cache = RP_MNDLCK; *ctrlp = SR_NACK_RESP; return ENOMEM; } @@ -2725,7 +2627,8 @@ dusr_fcntl(stp, ctrlp) } else if (canon && !rf_fcanon(O_FLOCK_FMT, (caddr_t)&oflock, (caddr_t)&oflock + sizeof(oflock), (caddr_t)&oflock)) { - return rfsr_j_accuse("dusr_fcntl bad data", stp); + return rfsr_discon("dusr_fcntl bad data from client", + stp); } /* @@ -2792,7 +2695,7 @@ dusr_fcntl(stp, ctrlp) ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc(canon ? - sizeof(o_flock_t) + OFLOCK_XP : + sizeof(o_flock_t) + OFLOCK_XP - MINXPAND : sizeof(o_flock_t), stp->sr_vcver); rp = RF_RESP(stp->sr_out_bp); rpdata = rf_msgdata(stp->sr_out_bp, RFV1_MINRESP); @@ -2896,7 +2799,9 @@ dusr_link(stp, ctrlp) if (!(error) && *ctrlp == SR_NORMAL) { ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); - error = rfsr_gift_setup(stp, vp, u.u_srchan); + if (error = rfsr_gift_setup(stp, vp, u.u_srchan)) { + VN_RELE(vp); + } } return error; } @@ -2912,24 +2817,30 @@ dusr_link1(stp, ctrlp) register rfsr_ctrl_t *ctrlp; { register vnode_t *from_vp; + register int rcvindx; register int error = 0; rfsr_fsinfo.fsivop_lookup++; rfsr_fsinfo.fsivop_lookup++; rfsr_fsinfo.fsivop_other++; - - if ((from_vp = - rf_gifttovp(&RF_REQ(stp->sr_in_bp)->rq_link.from, RFS1DOT0)) == - NULL) { - + if ((rcvindx = RF_REQ(stp->sr_in_bp)->rq_rflink.link) != 0) { + /* + * The existing file is on this server. + */ + from_vp = rcvd[rcvindx].rd_vp; + ASSERT(from_vp); + } else { /* * The existing file is not on this server, but we can't * just fail the operation outright, because the target * pathname still might cross back to the client. So * we do a lookup and return EXDEV if the pathname * ends on this server. + * + * This game is needed for 3.X clients because they + * send an arbitrarily long pathname, not just a + * single component. */ - error = rfsr_lookupname(NO_FOLLOW, stp, NULLVPP, NULLVPP, ctrlp); if (*ctrlp == SR_NORMAL && (!error || error == ENOENT)) { @@ -2937,12 +2848,10 @@ dusr_link1(stp, ctrlp) } return error; } - /* * dusr_vn_link is prepared to deal with pathnames crossing * back to the client. */ - return dusr_vn_link(from_vp, rf_msgdata(stp->sr_in_bp, RFV1_MINREQ), stp, ctrlp); } @@ -3169,7 +3078,7 @@ dusr_utime(stp, ctrlp) if (gdpp->hetero != NO_CONV && !rf_fcanon("ll", (caddr_t)stv, (caddr_t)stv + sizeof(stv), (caddr_t)stv)) { - return rfsr_j_accuse("dusr_utime bad data", + return rfsr_discon("dusr_utime bad client data", stp); } stv[0] -= gdpp->timeskew_sec; @@ -3209,6 +3118,7 @@ dusr_vn_open(filemode, createmode, stp, sr_ctrlp) vnode_t *vp; register int mode = 0; register int error = 0; + register int op = RF_COM(stp->sr_in_bp)->co_opcode; vattr_t vattr; if (!(filemode & (FREAD|FWRITE))) { @@ -3247,7 +3157,8 @@ dusr_vn_open(filemode, createmode, stp, sr_ctrlp) /* * Plain open; just look up the name for now. */ - error = rfsr_lookupname(FOLLOW, stp, NULLVPP, &vp, sr_ctrlp); + error = rfsr_lookupname(FOLLOW, stp, (vnode_t **)0, + &vp, sr_ctrlp); SR_FREEMSG(stp); if (error || *sr_ctrlp != SR_NORMAL) { return error; @@ -3270,6 +3181,18 @@ dusr_vn_open(filemode, createmode, stp, sr_ctrlp) VN_RELE(vp); return EROFS; } + /* + * If there's shared text associated with + * the vnode, try to free it up once. + * If we fail, we can't allow writing. + */ + if (vp->v_flag & VTEXT) { + xrele(vp); + if (vp->v_flag & VTEXT) { + VN_RELE(vp); + return ETXTBSY; + } + } /* * Can't truncate files on which mandatory locking * is in effect. @@ -3312,13 +3235,11 @@ dusr_vn_open(filemode, createmode, stp, sr_ctrlp) */ sndd_t *srchan = u.u_srchan; - VN_HOLD(vp); ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); if (!(error = rfsr_gift_setup(stp, vp, srchan))) { rdu_open(stp->sr_gift, stp->sr_gdpp->sysid, - srchan->sd_mntid, filemode); - VN_RELE(vp); + srchan->sd_mntid, op, filemode); } } if (error) { @@ -3326,7 +3247,7 @@ dusr_vn_open(filemode, createmode, stp, sr_ctrlp) * Errors with an open file collected here. * Don't overwrite error */ - (void)VOP_CLOSE(vp, filemode, 1, 0, stp->sr_cred); + (void) VOP_CLOSE(vp, 0, 1, 0, stp->sr_cred); VN_RELE(vp); } return error; @@ -3362,24 +3283,19 @@ dusr_vn_create(vap, excl, mode, vpp, why, stp, sr_ctrlp) dvp = NULL; *vpp = NULL; - if (RF_PULLUP(stp->sr_in_bp, RFV1_MINREQ, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - RFV1_MINREQ)) { - return rfsr_j_accuse("dusr_vn_create bad request", stp); - } - - if ((error = + if ((error = RF_PULLUP(stp->sr_in_bp, RFV1_MINREQ, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - RFV1_MINREQ)) != 0 || + (error = pn_get(rf_msgdata(stp->sr_in_bp, RFV1_MINREQ), UIO_SYSSPACE, &pn)) != 0) { return error; } - /* * lookup will find the parent directory for the vnode. * When it is done the pn holds the name of the entry * in the directory. * If this is a non-exclusive create we also find the node itself. */ - if (excl == EXCL) { error = rfsr_lookuppn(&pn, NO_FOLLOW, stp, &dvp, NULLVPP, sr_ctrlp); @@ -3403,10 +3319,21 @@ dusr_vn_create(vap, excl, mode, vpp, why, stp, sr_ctrlp) VN_RELE(*vpp); } error = EROFS; - } else if (excl == NONEXCL && *vpp != NULLVP) { + } else if (excl == NONEXCL && *vpp != (vnode_t *)0) { /* * The file is already there. - * We throw the vnode away to let VOP_CREATE truncate the + * If we are writing, and there's a shared text + * associated with the vnode, try to free it up once. + * If we fail, we can't allow writing. + */ + if ((mode & VWRITE) && ((*vpp)->v_flag & VTEXT)) { + xrele(*vpp); + if ((*vpp)->v_flag & VTEXT) { + error = ETXTBSY; + } + } + /* + * we throw the vnode away to let VOP_CREATE truncate the * file in a non-racy manner. */ VN_RELE(*vpp); @@ -3448,7 +3375,7 @@ dusr_vn_link(fvp, to, stp, sr_ctrlp) struct pathname pn; register int error; - tdvp = NULLVP; + tdvp = (vnode_t *)0; if (error = pn_get(to, UIO_SYSSPACE, &pn)) { return error; } @@ -3505,12 +3432,9 @@ dusr_vn_remove(dirflag, stp, sr_ctrlp) vp = NULL; - if (RF_PULLUP(stp->sr_in_bp, RFV1_MINREQ, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - RFV1_MINREQ)) { - return rfsr_j_accuse("dusr_vn_remove bad request", stp); - } - - if ((error = + if ((error = RF_PULLUP(stp->sr_in_bp, RFV1_MINREQ, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - RFV1_MINREQ)) != 0 || + (error = pn_get(rf_msgdata(stp->sr_in_bp, RFV1_MINREQ), UIO_SYSSPACE, &pn)) != 0) { return error; @@ -3686,8 +3610,6 @@ dusr_cstatfs(stp, vfsp, len, fstyp, csbp) register vfssw_t *vswp; register struct statfs *sbp; struct statfs statfs; - register char *cp, *cp2; - register int i; if (canon) { sbp = &statfs; @@ -3701,31 +3623,10 @@ dusr_cstatfs(stp, vfsp, len, fstyp, csbp) sbp->f_bfree = statvfs.f_bfree * (statvfs.f_frsize / 512); sbp->f_files = statvfs.f_files; sbp->f_ffree = statvfs.f_ffree; - - /* - * Fill f_name, f_pack from variable length strings in f_fstr. - */ - cp = statvfs.f_fstr; - cp2 = sbp->f_fname; - for (i = 0; i < sizeof(sbp->f_fname); i++, cp2++) { - if (*cp != '\0') { - *cp2 = *cp++; - } else { - *cp2 = '\0'; - } - } - while (cp++ != '\0' && i < sizeof(statvfs.f_fstr) - - sizeof(sbp->f_fpack)) { - i++; - } - cp2 = sbp->f_fpack; - for (i = 0; i < sizeof(sbp->f_fpack); i++, cp2++) { - if (*cp != '\0') { - *cp2 = *cp++; - } else { - *cp2 = '\0'; - } - } + bcopy(&statvfs.f_fstr[0], sbp->f_fname, + sizeof(sbp->f_fname)); + bcopy(&statvfs.f_fstr[sizeof(sbp->f_fname)], sbp->f_fpack, + sizeof(sbp->f_fpack)); if ((vswp = vfs_getvfssw(statvfs.f_basetype)) == NULL) { sbp->f_fstyp = 0; } else { @@ -3761,7 +3662,7 @@ dusr_namesetattr(followlink, vap, flags, stp, sr_ctrlp) vnode_t *vp; register int error; - error = rfsr_lookupname(followlink, stp, NULLVPP, &vp, sr_ctrlp); + error = rfsr_lookupname(followlink, stp, (vnode_t **)0, &vp, sr_ctrlp); SR_FREEMSG(stp); if (error || *sr_ctrlp != SR_NORMAL) { return error; @@ -3797,6 +3698,7 @@ ducl_namemsg(chansdp, rdirvp, pnp, comp, crp, opcode, rqargp, bpp) size_t rqsize; int complen = strlen(comp); size_t datasz = complen + pnp->pn_pathlen + 1; + sndd_t *rootsdp; rcvd_t *rdp; char *data; int ntries; @@ -3820,12 +3722,12 @@ ducl_namemsg(chansdp, rdirvp, pnp, comp, crp, opcode, rqargp, bpp) rqp = RF_REQ(*bpp); rqp->rq_arg = *rqargp; data = rf_msgdata(*bpp, RFV1_MINREQ); - if (rdirvp && ISRFSVP(rdirvp) && - rdirvp->v_vfsp == SDTOV(chansdp)->v_vfsp) { - rqp->rq_rrdir_id = VTOSD(rdirvp)->sd_gift.gift_id; - } else { - rqp->rq_rrdir_id = 0; - } + if (rdirvp && ISRFSVP(rdirvp) && + (rootsdp = VTOSD(rdirvp))->sd_connid == chansdp->sd_connid) { + rqp->rq_rrdir = rootsdp->sd_connid; + } else { + rqp->rq_rrdir = 0; + } (void)strcpy(data, comp); (void)strcpy(data + complen, pnp->pn_path); error = rfcl_xac(bpp, rqsize, rdp, RFS1DOT0, FALSE, &nacked); @@ -3855,15 +3757,11 @@ ducl_resetpath(bp, pnp, dvp, vpp) if ((error = RF_PULLUP(bp, RFV1_MINRESP, (size_t)RF_MSG(bp)->m_size - RFV1_MINRESP)) != 0) { - gdp_j_accuse("ducl_resetpath bad response", - QPTOGP(VTOSD(dvp)->sd_queue)); - return EPROTO; + return error; } - datalen = strlen(rf_msgdata(bp, RFV1_MINRESP)); - if (pnp->pn_pathlen < datalen || RF_COM(bp)->co_opcode != RFDOTDOT) { - gdp_j_accuse("ducl_resetpath bad response", + gdp_discon("ducl_resetpath: invalid response", QPTOGP(VTOSD(dvp)->sd_queue)); return EPROTO; } @@ -3967,16 +3865,7 @@ du_stat_to_vattr(statp, vap) vap->va_mode = statp->st_mode & MODEMASK; vap->va_uid = (uid_t)statp->st_uid; vap->va_gid = (gid_t)statp->st_gid; - - hiword(vap->va_fsid) = hibyte(statp->st_dev); - loword(vap->va_fsid) = lobyte(statp->st_dev); - - /* Nasty machine-dependency: sign-extend a character. */ - - ASSERT(hiword(vap->va_fsid) & 0x80); - - hiword(vap->va_fsid) |= 0xff00; - + vap->va_fsid = (dev_t)statp->st_dev; vap->va_nodeid = (ino_t)statp->st_ino; vap->va_nlink = (nlink_t)statp->st_nlink; vap->va_size = statp->st_size; @@ -3988,7 +3877,7 @@ du_stat_to_vattr(statp, vap) vap->va_ctime.tv_nsec = 0; vap->va_rdev = expdev(statp->st_rdev); vap->va_blksize = DU_DATASIZE; - vap->va_nblocks = btod(statp->st_size); + vap->va_nblocks = (statp->st_size + DU_DATASIZE - 1) / DU_DATASIZE; vap->va_vcode = 0; } @@ -4003,27 +3892,23 @@ du_o_flock_to_flock(bp, flp) register struct flock *flp; { size_t datasz; + int error; register struct o_flock *oflp; gdp_t *gp; gp = QPTOGP((queue_t *)RF_MSG(bp)->m_queue); datasz = gp->hetero == NO_CONV ? sizeof(struct o_flock) : - sizeof(struct o_flock) + STATFS_XP; - - if (RF_PULLUP(bp, RFV1_MINRESP, datasz)) { - gdp_j_accuse("du_o_flock_to_flock bad data", gp); - return EPROTO; + sizeof(struct o_flock) + STATFS_XP - MINXPAND; + if ((error = RF_PULLUP(bp, RFV1_MINRESP, datasz)) != 0) { + return error; } - oflp = (struct o_flock *)rf_msgdata(bp, RFV1_MINRESP); - if (gp->hetero != NO_CONV && !rf_fcanon(O_FLOCK_FMT, (caddr_t)oflp, (caddr_t)oflp + datasz, (caddr_t)oflp)) { - gdp_j_accuse("du_o_flock_to_flock bad data", gp); + gdp_discon("du_o_flock_to_flock bad data", gp); return EPROTO; } - flp->l_type = oflp->l_type; flp->l_whence = oflp->l_whence; flp->l_start = oflp->l_start; diff --git a/usr/src/uts/3b2/fs/rfs/rf_admin.c b/usr/src/uts/3b2/fs/rfs/rf_admin.c index 7f70005..93a4823 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_admin.c +++ b/usr/src/uts/3b2/fs/rfs/rf_admin.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_admin.c 1.4.1.15" +#ident "@(#)fs:fs/rfs/rf_admin.c 1.4.3.1" /* * RFS administrative daemon and associated functions. @@ -23,11 +23,11 @@ #include "sys/cred.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "sys/psw.h" #include "sys/pcb.h" #include "sys/user.h" +#include "sys/rf_messg.h" #include "sys/errno.h" #include "sys/proc.h" #include "sys/wait.h" @@ -46,15 +46,12 @@ #include "sys/statfs.h" #include "rfcl_subr.h" #include "sys/uio.h" -#include "sys/buf.h" -#include "vm/page.h" #include "rf_cache.h" #include "vm/seg_kmem.h" #include "sys/fcntl.h" #include "sys/flock.h" #include "sys/file.h" #include "sys/session.h" -#include "sys/kmem.h" /* imports */ extern int cleanlocks(); @@ -63,9 +60,10 @@ extern int nsrmount; extern int rf_state; extern int waitid(); +proc_t *rf_daemon_procp; int rf_daemon_flag; /* reason for wakeup */ int rf_daemon_lock; -rcvd_t *rf_daemon_rd; +rcvd_t *rf_daemon_rd; /* rd for rf_recovery */ proc_t *rf_recovery_procp; /* sleep address for rf_recovery */ int rf_recovery_flag; /* set to KILL when it's time to exit */ @@ -73,16 +71,12 @@ int rf_recovery_flag; /* set to KILL when it's time to exit */ ls_elt_t rf_umsgq = { &rf_umsgq, &rf_umsgq }; int rf_umsgcnt; -/* rf_daemon stray message queue */ -STATIC ls_elt_t rfd_strayq = { &rfd_strayq, &rfd_strayq }; - -/* queue of asynchronous work to do */ +/* rf_async work queue */ STATIC ls_elt_t rfa_workq = { &rfa_workq, &rfa_workq }; -STATIC proc_t *rf_daemon_procp; +STATIC unsigned n_rf_async = 3; +STATIC unsigned nidle_rf_async; -STATIC void rf_recovery(); -STATIC void rf_tmo(); STATIC void rfadmin_reply(); STATIC void rf_que_umsg(); STATIC void rf_disable_cache(); @@ -95,15 +89,16 @@ STATIC void rf_rec_cleanup(); STATIC void rf_user_msg(); STATIC void rf_cl_fumount(); STATIC void clean_GRD(); +STATIC void rf_async(); /* * RFS administrative daemon, started when file sharing starts. * Forks new servers, calls rf_rec_cleanup() for rf_recovery. - * To reduce stack size, rf_daemon returns a pointer to a function - * to execute (e.g., rf_serve). Otherwise it exits rather than returns. + * To reduce stack size, rf_daemon returns when the invoking code + * should become a server. Otherwise it exits rather than returns. */ -void (* -rf_daemon())() +void +rf_daemon() { int s; int i; @@ -118,77 +113,45 @@ rf_daemon())() int error; int nd; /* n daemons */ pid_t xpid; /* unwanted out param from newproc */ - int nret; - gdp_t *gp; - rfa_work_t *wp; - file_t *fp; - k_siginfo_t sink; - /* disassociate this process from terminal */ - sess_create(); + newsession(); /* ignore all signals */ for (i = 1; sigismember(&fillset, i); i++) { setsigact(i, SIG_IGN, 0, 0); } - + rf_daemon_flag = 0; u.u_procp->p_flag |= SNOWAIT; - u.u_procp->p_cstime = u.u_procp->p_stime = - u.u_procp->p_cutime = u.u_procp->p_utime = 0; - rf_daemon_procp = u.u_procp; - - bcopy("rf_daemon", u.u_comm, sizeof("rf_daemon")); - bcopy("rf_daemon", u.u_psargs, sizeof("rf_daemon")); - relvm(rf_daemon_procp); + for (nd = error = 0; nd < n_rf_async && !error; nd++) { - VN_RELE(u.u_cdir); - u.u_cdir = rootdir; - VN_HOLD(u.u_cdir); + /* TO DO: return to spawn these??? */ - if (u.u_rdir) { - VN_RELE(u.u_rdir); - } - u.u_rdir = NULL; - - for (i = 0; i < u.u_nofiles; i++) { - if (getf(i, &fp) == 0) { - closef(fp); - setf(i, NULLFP); + switch (newproc(NP_FAILOK | NP_NOLAST | NP_SYSPROC, &xpid, + &error)) { + case 0: + break; + case 1: + rf_async(); + default: + cmn_err(CE_WARN, "rf_async newproc failed"); } } - switch (newproc(NP_FAILOK | NP_NOLAST | NP_SYSPROC, &xpid, &error)) { - case 0: - break; - case 1: - return rf_recovery; - default: - cmn_err(CE_WARN, "rf_recovery newproc failed"); - goto out; - } - - switch (newproc(NP_FAILOK | NP_NOLAST | NP_SYSPROC, &xpid, &error)) { - case 0: - break; - case 1: - return rf_tmo; - default: - cmn_err(CE_WARN, "rf_tmo newproc failed"); - goto out; - } - for (nd = error = 0; nd < minserve && !error; nd++) { - if ((nret = newproc(NP_FAILOK | NP_NOLAST | NP_SYSPROC, &xpid, - &error)) < 0) { + switch (newproc(NP_FAILOK | NP_NOLAST | NP_SYSPROC, &xpid, + &error)) { + case 0: + break; + case 1: + return; + default: /* Post signal to the last server so it won't sleep */ if (rfsr_active_procp != NULL) { psignal(rfsr_active_procp, SIGUSR1); } break; - } else if (nret == 1) { - return rf_serve; } } if (nd != minserve) { @@ -203,60 +166,21 @@ rf_daemon())() s = splstr(); - while ((wp = (rfa_work_t *) - LS_REMQUE(&rfa_workq)) != NULL) { - splx(s); - (*wp->rfaw_func)(wp); - s = splstr(); - } - LS_INIT(&rf_umsgq); rf_umsgcnt = 0; reply_port.sd_stat = SDUSED; SDTOV(&reply_port)->v_count = 1; - - /* Discard old stray messages. */ - while ((bp = (mblk_t *)LS_REMQUE(&rfd_strayq)) != NULL) { - rf_freemsg(bp); - } - rf_state = RF_UP; - - /* end of critical section begun in rfsys_start */ - - wakeprocs((caddr_t)&rf_state, PRMPT); + /* + * end of critical section begun in rfstart + */ + wakeup((caddr_t)&rf_state); sleep((caddr_t)&rf_daemon_rd->rd_qslp, PRIBIO); - for (;;) { register rf_message_t *msg; bp = rf_dequeue(rf_daemon_rd); - - if (!bp) { - - /* - * Stray message handling schemes that superficially - * appear more temperate have subtle drawbacks: - * Local processes sleeping on specific RDs are - * left hanging or, if awakened, inititate operations - * on the remote that collide with ops still in - * progress on the remote. E.g., they close files - * that are still being read. - */ - - bp = (mblk_t *)LS_REMQUE(&rfd_strayq); - if (bp) { - splx(s); - gdp_discon("rf_daemon - stray message", - QPTOGP(RF_MSG(bp)->m_queue)); - rf_freemsg(bp); - bp = NULL; - s = splstr(); - continue; - } - } - if (!bp) { if (rf_daemon_flag & RFDDISCON) { @@ -271,20 +195,33 @@ rf_daemon())() tmp->constate = GDPRECOVER; } } - } else if (rf_daemon_flag & RFDASYNC) { - rf_daemon_flag &= ~RFDASYNC; - while ((wp = (rfa_work_t *) - LS_REMQUE(&rfa_workq)) != NULL) { - splx(s); - (*wp->rfaw_func)(wp); - s = splstr(); - } - splx(s); + + /* Give rf_async oppty to fail requests. */ + + wakeup((caddr_t)&rfa_workq); } else if (rf_daemon_flag & RFDKILL) { - splx(s); - goto out; + k_siginfo_t sink; + splx(s); + /* + * Signal all children and wait for them to die + */ + signal(rf_daemon_procp->p_pgrp, SIGKILL); +#ifdef DEBUG + ASSERT(waitid(P_ALL, 0, &sink, WEXITED) == + ECHILD); +#else + (void)waitid(P_ALL, 0, &sink, WEXITED); +#endif + rf_daemon_flag = 0; + rf_daemon_procp = NULL; + if (!rf_recovery_procp) { + rf_commdinit(); + rf_state = RF_DOWN; + wakeup((caddr_t)&rf_state); + } + exit(CLD_EXITED, 0); } else if (rf_daemon_flag & RFDSERVE) { rf_daemon_flag &= ~RFDSERVE; splx(s); @@ -293,7 +230,7 @@ rf_daemon())() case 0: break; case 1: - return rf_serve; + return; default: /* * Post signal to the last server so @@ -309,7 +246,6 @@ rf_daemon())() } break; } - } else { sleep((caddr_t)&rf_daemon_rd->rd_qslp, PRIBIO); continue; @@ -317,265 +253,233 @@ rf_daemon())() s = splstr(); continue; } - splx(s); - msg = RF_MSG(bp); qp = (queue_t *)msg->m_queue; + request = RF_REQ(bp); cop = RF_COM(bp); - gp = QPTOGP(qp); - - if (cop->co_type == RF_REQ_MSG) { - - request = RF_REQ(bp); - sndd_set(&reply_port, qp, &msg->m_gift); - reply_port.sd_mntid = cop->co_mntid; - - switch ((int)cop->co_opcode) { + sndd_set(&reply_port, qp, msg->m_giftid); + reply_port.sd_mntid = cop->co_mntid; + switch ((int)cop->co_opcode) { + case REC_FUMOUNT: { + rf_vfs_t *rf_vfsp = findrfvfs(cop->co_mntid); + long req_srmntid = + request->rq_rec_fumount.srmntid; - case REC_FUMOUNT: { - rf_vfs_t *rf_vfsp; - long req_srmntid ; - - rf_vfsp = findrfvfs(cop->co_mntid); - req_srmntid = request->rq_rec_fumount.srmntid; - rf_freemsg(bp); - bp = NULL; - - /* - * We found an rf_vfs with the right mntid; - * now see if the resource is from the - * originating server. Note that this is - * still ONLY PROBABLISTIC, even though a - * little more cautious than SVR3.X. If the - * rf_vfs has no rootvp, it's because the - * fumount or recovery kicked off in the - * middle of the mount. It's still okay to go - * ahead, though, because we'll mark the rf_vfs - * fumounted, and will fail to find sndds or - * rcvds linked into the rf_vfs. Send message - * to user level only if mount is fully defined. - * Reply to the fumount request in any case. - */ - - if (rf_vfsp) { - vnode_t *rootvp; - - rootvp = rf_vfsp->rfvfs_rootvp; - if (rootvp && - qp == VTOSD(rootvp)->sd_queue && - req_srmntid == - VTOSD(rootvp)->sd_mntid) { - size_t namelen; - - namelen = (size_t) - strlen(rf_vfsp->rfvfs_name); - rf_cl_fumount(rf_vfsp); - rf_user_msg(RFUD_FUMOUNT, - rf_vfsp->rfvfs_name, namelen); - } else if(!rootvp) { - rf_cl_fumount(rf_vfsp); - } + rf_freemsg(bp); + bp = NULL; + /* + * We found an rf_vfs with the right mntid, now see + * if the resource is from the originating server. + * Note that this is still ONLY PROBABLISTIC, even + * though a little more cautious than SVR3.X. If + * the rf_vfs has no rootvp, it's because the fumount + * or rf_recovery kicked off in the middle of the mount. + * It's still okay to go ahead, though, because we'll + * mark the rf_vfs fumounted, and will fail to find + * sndds or rcvds linked into the rf_vfs. + * Send message to user level only if mount is fully + * defined. + * Reply to the fumount request in any case. + */ + if (rf_vfsp) { + if (rf_vfsp->rfvfs_rootvp && + VTOSD(rf_vfsp->rfvfs_rootvp)->sd_queue == + qp && + VTOSD(rf_vfsp->rfvfs_rootvp)->sd_mntid == + req_srmntid) { + rf_cl_fumount(rf_vfsp); + rf_user_msg(RFUD_FUMOUNT, + rf_vfsp->rfvfs_name, + (size_t)strlen(rf_vfsp->rfvfs_name)); + } else if(!rf_vfsp->rfvfs_rootvp) { + rf_cl_fumount(rf_vfsp); } - rfadmin_reply(&reply_port, REC_FUMOUNT); - break; } + rfadmin_reply(&reply_port, REC_FUMOUNT); + break; + } + case REC_MSG: { + size_t datasz = (size_t)request->rq_rec_msg.count; + size_t hdrsz = msg->m_size - datasz; - case REC_MSG: { - size_t datasz; - size_t hdrsz; - - /* - * Got a message for user-level daemon. - * Enque message and wake up daemon. - * - * ASSERT based on circuit manager guarantees. - */ - - hdrsz = RF_MIN_REQ(gp->version); - - ASSERT(bp->b_wptr - bp->b_rptr >= hdrsz); - - datasz = (size_t)request->rq_rec_msg.count; - - if (RF_PULLUP(bp, hdrsz, datasz)) { - gdp_discon("rf_daemon bad REC_MSG", - QPTOGP(qp)); - rf_freemsg(bp); - } else { - strncpy(usr_msg, rf_msgdata(bp, hdrsz), - datasz); - rf_freemsg(bp); - rfadmin_reply(&reply_port, REC_MSG); - rf_user_msg(RFUD_GETUMSG, usr_msg, - datasz); - } - bp = NULL; - break; - } + /* + * Got a message for user-level daemon. + * Enque message and wake up daemon. + */ - case RFSYNCTIME: { - - rfsr_adj_timeskew(gp, - request->rq_synctime.time, 0); - (void)rf_allocmsg(RFV1_MINRESP, (size_t)0, - BPRI_MED, FALSE, NULLCADDR, NULLFRP, - &resp_bp); - response = RF_RESP(resp_bp); - cop = RF_COM(resp_bp); - response->rp_synctime.time = hrestime.tv_sec; - response->rp_errno = 0; - cop->co_type = RF_RESP_MSG; - cop->co_opcode = RFSYNCTIME; - rf_clrrpsigs(response, gp->version); + if (pullupmsg(bp, hdrsz, datasz)) { + gdp_discon("rf_daemon bad REC_MSG", QPTOGP(qp)); rf_freemsg(bp); - bp = NULL; - - /* TO DO: failure??? */ - (void)rf_sndmsg(&reply_port, resp_bp, - RFV1_MINRESP, (rcvd_t *)NULL, FALSE); - break; - } - - case RFTMO: { - int vcver; - size_t respsize; - + } else { + strncpy(usr_msg, rf_msgdata(bp, hdrsz), datasz); rf_freemsg(bp); - bp = NULL; - vcver = gp->version; - respsize = RF_MIN_RESP(vcver); - - (void)rf_allocmsg(respsize, (size_t)0, - BPRI_MED, FALSE, NULLCADDR, NULLFRP, - &resp_bp); - response = RF_RESP(resp_bp); - cop = RF_COM(resp_bp); - response->rp_errno = 0; - cop->co_type = RF_RESP_MSG; - cop->co_opcode = RFTMO; - rf_clrrpsigs(response, vcver); - - /* TO DO: failure??? */ - (void)rf_sndmsg(&reply_port, resp_bp, - respsize, (rcvd_t *)NULL, FALSE); - break; + rfadmin_reply(&reply_port, REC_MSG); + rf_user_msg(RFUD_GETUMSG, usr_msg, datasz); } + bp = NULL; + break; + } + case RFSYNCTIME: { + gdp_t *gp = QPTOGP(qp); + + rfsr_adj_timeskew(gp, request->rq_synctime.time, 0); + (void)rf_allocmsg(RFV1_MINRESP, (size_t)0, + BPRI_MED, FALSE, NULLCADDR, NULLFRP, &resp_bp); + ASSERT(resp_bp); + response = RF_RESP(resp_bp); + cop = RF_COM(resp_bp); + response->rp_synctime.time = hrestime.tv_sec; + response->rp_errno = 0; + cop->co_type = RF_RESP_MSG; + cop->co_opcode = RFSYNCTIME; + rf_clrrpsigs(response, gp->version); + rf_freemsg(bp); + bp = NULL; + /* TO DO: failure??? */ + (void)rf_sndmsg(&reply_port, resp_bp, RFV1_MINRESP, + (rcvd_t *)NULL, FALSE); + break; + } + case RFCACHEDIS: { + register queue_t *qp = (queue_t *)RF_MSG(bp)->m_queue; + size_t respsize = RF_MIN_RESP(QPTOGP(qp)->version); + int vcver = QPTOGP(qp)->version; + /* vcode is defined only from newer servers */ + int vcode = vcver >= RFS2DOT0 ? + request->rq_cachedis.vcode : 0; + + + rf_disable_cache(qp, request->rq_cachedis.fhandle, + (ulong)vcode); + rfc_info.rfci_rcv_dis++; + rf_freemsg(bp); + bp = NULL; + (void)rf_allocmsg(respsize, (size_t)0, BPRI_MED, + FALSE, NULLCADDR, NULLFRP, &resp_bp); + ASSERT(resp_bp); + response = RF_RESP(resp_bp); + cop = RF_COM(resp_bp); + response->rp_errno = 0; + cop->co_type = RF_RESP_MSG; + cop->co_opcode = RFCACHEDIS; + rf_clrrpsigs(response, vcver); + (void)rf_sndmsg(&reply_port, resp_bp, + respsize, (rcvd_t *)NULL, FALSE); + /* + * Link down is the only case that rf_sndmsg + * can fail, if it happens, server rf_recovery + * should take care of losing the message + */ + break; + } + default: + rf_freemsg(bp); + bp = NULL; + } + s = splstr(); + } + /* NOTREACHED */ +} - case RFCACHEDIS: { - int vcver; - size_t respsize; - int vcode; - - vcver = QPTOGP(qp)->version; - respsize = RF_MIN_RESP(vcver); - - /* vcode is defined only from newer servers */ - - vcode = vcver >= RFS2DOT0 ? - request->rq_cachedis.vcode : 0; - - rf_disable_cache(qp, - request->rq_cachedis.fhandle, (ulong)vcode); - rfc_info.rfci_rcv_dis++; - rf_freemsg(bp); - bp = NULL; - (void)rf_allocmsg(respsize, (size_t)0, BPRI_MED, - FALSE, NULLCADDR, NULLFRP, &resp_bp); - ASSERT(resp_bp); - response = RF_RESP(resp_bp); - cop = RF_COM(resp_bp); - response->rp_errno = 0; - cop->co_type = RF_RESP_MSG; - cop->co_opcode = RFCACHEDIS; - rf_clrrpsigs(response, vcver); - (void)rf_sndmsg(&reply_port, resp_bp, - respsize, (rcvd_t *)NULL, FALSE); - - /* - * Link down is the only case that rf_sndmsg - * can fail; if it happens, server rf_recovery - * should take care of losing the message - */ - - break; - } +/* + * Handle asynchronous RF_INACTIVE requests and other drudgery. + * TO DO: We currently have only one of these. Expand interface + * to support an arbitrary number, and then asynchronous read/page + * ahead. Keep nidle_rf_async current. + */ +STATIC void +rf_async() +{ + int s; + rfa_work_t *wp; - default: - rf_freemsg(bp); - bp = NULL; - } + bcopy("rf_async", u.u_comm, sizeof("rf_async")); + bcopy("rf_async", u.u_psargs, sizeof("rf_async")); - } else { + /* + * rf_daemon may have issued a SIGKILL, but that would be discarded + * if this process was still in newproc() since the parent (rf_daemon) + * ignores all signals. Exit if RFS is stopping. + */ + if (rf_daemon_flag & RFDKILL) { + exit(CLD_EXITED, 0); + } - switch ((int)cop->co_opcode) { + nidle_rf_async++; - case RFTMO: - case RFSYNCTIME: + setsigact(SIGKILL, SIG_DFL, 0, 0); - /* Request originated by rf_tmo */ + do { - default: - rf_freemsg(bp); - bp = NULL; - } + --nidle_rf_async; + s = splstr(); + while ((wp = (rfa_work_t *)LS_REMQUE(&rfa_workq)) != NULL) { + ASSERT(wp->rfaw_func); + splx(s); + (*wp->rfaw_func)(wp); + s = splstr(); } + splx(s); + nidle_rf_async++; + + } while (!sleep((caddr_t)&rfa_workq, PREMOTE | PCATCH | PNOSTOP)); + s = splstr(); + while ((wp = (rfa_work_t *)LS_REMQUE(&rfa_workq)) != NULL) { + splx(s); + (*wp->rfaw_func)(wp); s = splstr(); } -out: - - /* - * Wait for children to die. Set flag bit in case we got - * here other than via rfsys_stop, and in case kids are not - * yet accepting SIGKILL. - */ - - rf_daemon_flag |= RFDKILL; - signal(rf_daemon_procp->p_pgrp, SIGKILL); - (void)waitid(P_ALL, 0, &sink, WEXITED); - rf_daemon_flag = 0; - rf_daemon_procp = NULL; - rf_commdinit(); + splx(s); + + --nidle_rf_async; + exit(CLD_EXITED, 0); +} - /* end of critical section begun in rfsys_start */ +/* + * Can return a nonzero errno iff wp->rfaw.canfail. In that case, + * the caller must dispose of its wp and otherwise see that its + * work gets done (probably by calling wp->rfaw_func directly). + */ +int +rfa_workenq(wp) + rfa_work_t *wp; +{ + int s; - rf_state = RF_DOWN; - wakeprocs((caddr_t)&rf_state, PRMPT); - exit(CLD_EXITED, 0); - /* NOTREACHED */ + s = splstr(); + if (wp->rfaw_canfail && !LS_ISEMPTY(&rfa_workq) && !nidle_rf_async) { + splx(s); + return ENOMEM; + } + LS_INSQUE(&rfa_workq, &wp->rfaw_elt); + splx(s); + wakeup((caddr_t)&rfa_workq); + return 0; } /* * Recovery daemon, awakened by rf_rec_cleanup to clean up after - * fumount or disconnect. This part of recovery calls routines that - * can sleep. + * fumount or disconnect. This part of rf_recovery calls + * routines that can sleep. */ -STATIC void +void rf_recovery() { - int slpret = 0; + int sig; - bcopy("rf_recovery", u.u_comm, sizeof("rf_recovery")); - bcopy("rf_recovery", u.u_psargs, sizeof("rf_recovery")); + rf_recovery_flag = 0; /* - * rf_daemon may have issued a SIGKILL, but that would be discarded - * if this process was still in newproc() since the parent (rf_daemon) - * ignores all signals. Exit if RFS is stopping. + * Disassociate this process from terminal + * and ignore all signals. */ - - if (rf_daemon_flag & RFDKILL) { - rf_recovery_flag = 0; - exit(CLD_EXITED, 0); + newsession(); + for (sig = 1; sigismember(&fillset, sig); sig++) { + setsigact(sig, SIG_IGN, 0, 0); } - setsigact(SIGKILL, SIG_DFL, 0, 0); - - u.u_procp->p_cstime = u.u_procp->p_stime = - u.u_procp->p_cutime = u.u_procp->p_utime = 0; - rf_recovery_procp = u.u_procp; - for (;;) { while (rf_recovery_flag) { if (rf_recovery_flag & RFRECDISCON) { @@ -592,141 +496,20 @@ rf_recovery() } else if (rf_recovery_flag & RFRECFUMOUNT) { rf_recovery_flag &= ~RFRECFUMOUNT; rf_srmntck(); - } - } - if (slpret) { - break; - } - slpret = - sleep((caddr_t)&rf_recovery_procp, PZERO + 1 | PCATCH); - } - - if (rf_recovery_procp->p_curinfo) { - kmem_free((caddr_t)rf_recovery_procp->p_curinfo, - sizeof(*rf_recovery_procp->p_curinfo)); - rf_recovery_procp->p_curinfo = NULL; - } - rf_recovery_procp->p_cursig = 0; - rf_recovery_flag = 0; - rf_recovery_procp = NULL; - exit(CLD_EXITED, 0); -} - - -/* - * Provoke timeouts and recovery over transports that do not themselves - * provide an adequate facility (e.g., TCP and it's ~10 minute timeout). - * For now, we use a sixty second timeout, but this should be specifiable - * for each virtual circuit, e.g., as a mount option. - */ -#define RFTMO_TIME (60 * HZ) -STATIC void -rf_tmo() -{ - register gdp_t *endgdp = gdp + maxgdp; - register gdp_t *gp; - register queue_t *qp; - mblk_t *bp; - int tid; - int opcode; - size_t hdrsz; - union rq_arg rqarg; - sndd_t out_port; - - bcopy("rf_tmo", u.u_comm, sizeof("rf_tmo")); - bcopy("rf_tmo", u.u_psargs, sizeof("rf_tmo")); - - /* - * rf_daemon may have issued a SIGKILL, but that would be discarded - * if this process was still in newproc() since the parent (rf_daemon) - * ignores all signals. Exit if RFS is stopping. - */ - - if (rf_daemon_flag & RFDKILL) { - exit(CLD_EXITED, 0); - } - - setsigact(SIGKILL, SIG_DFL, 0, 0); - - u.u_procp->p_cstime = u.u_procp->p_stime = - u.u_procp->p_cutime = u.u_procp->p_utime = 0; - - out_port.sd_stat = SDUSED; - SDTOV(&out_port)->v_count = 1; - - do { - if (!(dudebug & NO_RECOVER)) { - for (gp = gdp; gp < endgdp; gp++) { - if (gp->constate == GDPCONNECT && - (qp = gp->queue) != NULL) { - - /* - * timeout is cleared by any arriving - * message. - */ - - if (gp->timeout) { - gdp_discon( - "rfs virtual circuit timeout", - gp); - continue; - } - - /* - * We send new peers an RFTMO request, - * old ones and RFSYNCTIME. The former - * is not in the old protocol, the - * latter is preserved only for - * compatability outside this context. - * - * In either case, we arrange for the - * response to go to the rf_daemon_rd, - * so we don't have to wait. The - * rf_daemon knows to toss such - * responses. - */ - - rqarg = init_rq_arg; - sndd_set(&out_port, qp, - &rf_daemon_gift); - - if (gp->version < RFS2DOT0) { - rqarg.rqsynctime.time = - hrestime.tv_sec; - opcode = RFSYNCTIME; - hdrsz = RFV1_MINREQ; - } else { - opcode = RFTMO; - hdrsz = RF_MIN_REQ(gp->version); - } - - (void)rf_allocmsg(hdrsz, (size_t)0, - BPRI_MED, FALSE, NULLCADDR, NULLFRP, - &bp); - rfcl_reqsetup(bp, &out_port, u.u_cred, - opcode, ULIMIT); - RF_REQ(bp)->rq_arg = rqarg; - gp->timeout = 1; - (void)rf_sndmsg(&out_port, bp, - hdrsz, rf_daemon_rd, FALSE); + } else if (rf_recovery_flag & RFRECKILL) { + /* RFS stop */ + rf_recovery_flag &= ~RFRECKILL; + rf_recovery_procp = NULL; + if (!rf_daemon_procp) { + rf_commdinit(); + rf_state = RF_DOWN; + wakeup((caddr_t)&rf_state); } + exit(CLD_EXITED, 0); } } - - tid = timeout((void(*)())wakeup, (caddr_t)u.u_procp+1, - RFTMO_TIME); - - } while (!sleep((caddr_t)u.u_procp+1, PZERO + 1 | PCATCH)); - - untimeout(tid); - - if (u.u_procp->p_curinfo) { - kmem_free((caddr_t)u.u_procp->p_curinfo, - sizeof(*u.u_procp->p_curinfo)); - u.u_procp->p_curinfo = NULL; + sleep((caddr_t)&rf_recovery_procp, PREMOTE); } - u.u_procp->p_cursig = 0; - exit(CLD_EXITED, 0); } /* @@ -741,6 +524,7 @@ rf_tmo() * sleeping in resources that have been disconnected. Otherwise * these servers and the recovery daemon can deadlock. */ + STATIC void rf_rec_cleanup(bad_q) queue_t *bad_q; /* stream that has gone away */ @@ -753,7 +537,7 @@ rf_rec_cleanup(bad_q) clean_SRD(bad_q); /* Wakeup procs sleeping on stream head */ - wakeprocs((caddr_t)bad_q->q_ptr, PRMPT); + wakeup((caddr_t)bad_q->q_ptr); bad_sysid = QPTOGP(bad_q)->sysid; @@ -771,7 +555,7 @@ rf_rec_cleanup(bad_q) rsrcp = rsrcp->r_nextp; } rf_recovery_flag |= RFRECDISCON; - wakeprocs((caddr_t)&rf_recovery_procp, PRMPT); + wakeup((caddr_t)&rf_recovery_procp); return; } @@ -779,7 +563,7 @@ rf_rec_cleanup(bad_q) /* * Go through vfs list looking for remote mounts over bad stream. * Send message to user-level daemon for every mount with bad link. - * (Kernel recovery works without this routine.) + * (Kernel rf_recovery works without this routine.) */ STATIC void rf_check_mount(bad_q) @@ -831,7 +615,7 @@ clean_SRD(bad_q) srm_mntid = rd->rd_sdp->sd_mntid; rf_checkq(rd, srm_mntid); rd->rd_stat |= RDLINKDOWN; - wakeprocs((caddr_t)&rd->rd_qslp, PRMPT); + wakeup((caddr_t)&rd->rd_qslp); } } } @@ -846,15 +630,13 @@ clean_SRD(bad_q) STATIC void rf_srmntck() { - rf_resource_t *rsrcp = rf_resource_head.rh_nextp; - register rcvd_t *rd; - queue_t *bad_q; - queue_t *gdp_sysidtoq(); + rf_resource_t *rsrcp = rf_resource_head.rh_nextp; + register rcvd_t *rd; + queue_t * bad_q, *gdp_sysidtoq(); while (rsrcp != (rf_resource_t *)&rf_resource_head) { - sr_mount_t *srmp = rsrcp->r_mountp; - register rf_resource_t *rsrcnextp = rsrcp->r_nextp; - register long mntid = rsrcp->r_mntid; + register sr_mount_t *srmp = rsrcp->r_mountp; + register rf_resource_t *rsrcnextp = rsrcp->r_nextp; while (srmp) { /* srmp becomes dangling reference in clean_GRD @@ -870,24 +652,24 @@ rf_srmntck() } bad_q = gdp_sysidtoq(srmp->srm_sysid); ASSERT(bad_q); - /* - * Now clean up RDGENERAL RDs + /* Hold vnode so it won't go away - + * VN_RELE in dec_srmcnt when doing unmount */ + VN_HOLD(rsrcp->r_rootvp); + /* Now clean up RDGENERAL RDs */ for (rd = rcvd; rd < endrcvd; rd++) { - if (ACTIVE_GRD(rd)) { + if (ACTIVE_GRD(rd)) clean_GRD(&rsrcp, rd, - bad_q, &srmp, mntid); - } + bad_q, srmp); + if (!rsrcp) + break; } } srmp = srmnextp; } /* free this resource if unadvertised and not mounted */ if (rsrcp && !rsrcp->r_mountp && (rsrcp->r_flags & R_UNADV)) { - vnode_t *rvp = rsrcp->r_rootvp; - freersc(&rsrcp); - VN_RELE(rvp); } rsrcp = rsrcnextp; } @@ -957,18 +739,19 @@ clean_sndd(bad_q) */ /* ARGSUSED */ STATIC void -clean_GRD(rsrcpp, rd, bad_q, srmpp, srm_mntid) - rf_resource_t **rsrcpp; - rcvd_t *rd; - queue_t *bad_q; - sr_mount_t **srmpp; - long srm_mntid; +clean_GRD(rsrcpp, rd, bad_q, srmp) + rf_resource_t **rsrcpp; + rcvd_t *rd; + queue_t *bad_q; + sr_mount_t *srmp; { - vnode_t *vp; - rd_user_t *rduptr; - rd_user_t *rdup_next; - cred_t cred; - sysid_t badsysid = QPTOGP(bad_q)->sysid; + register int vcount; + vnode_t *vp; + rd_user_t *rduptr; + rd_user_t *rdup_next; + long srm_mntid = (*rsrcpp)->r_mntid; + cred_t cred; + sysid_t badsysid = QPTOGP(bad_q)->sysid; bzero((caddr_t)&cred, sizeof(cred_t)); crhold(&cred); @@ -981,7 +764,10 @@ clean_GRD(rsrcpp, rd, bad_q, srmpp, srm_mntid) while (rduptr) { ASSERT(rd); - + /* + * Save the next rduser pointer in case the current + * rduser is freed. + */ rdup_next = rduptr->ru_next; if (rduptr->ru_srmntid != srm_mntid || QPTOGP(rduptr->ru_queue)->sysid != badsysid) { @@ -990,43 +776,77 @@ clean_GRD(rsrcpp, rd, bad_q, srmpp, srm_mntid) } /* - * Mimic what a server would do to get rid of references - * from client denoted by rduptr. + * Mimic what a server would do to get rid of reference. */ - (void)cleanlocks(vp, IGN_PID, badsysid); - if (*srmpp) { - ASSERT(rsrcpp && *rsrcpp); - dec_srmcnt(rsrcpp, srmpp, bad_q, rduptr->ru_vcount); + /* Undo opens and creats for this resource. */ + if (rduptr->ru_fcount > 0) { + /* One VN_RELE because each rduser structure + * denotes a single vnode reference, given the + * present implementation of rfcl_sdrele. This + * should not be a problem for VOP_CLOSEs(?) + */ + (void)cleanlocks(vp, IGN_PID, badsysid); + while (rduptr->ru_frcnt) { + VOP_CLOSE(vp, FREAD, rduptr->ru_fcount, + 0, &cred); + rduptr->ru_frcnt--; + rduptr->ru_fcount--; + } + while (rduptr->ru_fwcnt) { + VOP_CLOSE(vp, FWRITE, rduptr->ru_fcount, + 0, &cred); + rduptr->ru_fwcnt--; + rduptr->ru_fcount--; + } + while (rduptr->ru_fcount) { + VOP_CLOSE(vp, FWRITE | FREAD, rduptr->ru_fcount, + 0, &cred); + rduptr->ru_fcount--; + } + } + ASSERT(!rduptr->ru_fcount); + + /* Clean up references to this resource. */ + for (vcount = rduptr->ru_vcount; vcount > 0; --vcount) { + dec_srmcnt(rsrcpp, srmp, bad_q); + rcvd_delete(&rd, QPTOGP(bad_q)->sysid, srm_mntid); + VN_RELE(vp); } - rcvd_delete(&rd, QPTOGP(bad_q)->sysid, srm_mntid, - rduptr->ru_vcount); - rduptr = rdup_next; - } + } /* end while */ } /* - * Decrement the reference count in the sr_mount structure by count. + * Decrement the reference count in the sr_mount structure. * If it goes to zero, do the unmount. */ STATIC void -dec_srmcnt(rsrcpp, srmpp, bad_q, count) +dec_srmcnt(rsrcpp, srmp, bad_q) rf_resource_t **rsrcpp; - sr_mount_t **srmpp; + sr_mount_t *srmp; queue_t *bad_q; { + vnode_t *vp; gdp_t *gdpp; - if (((*srmpp)->srm_refcnt -= count) > 1) { + if (srmp->srm_refcnt > 1) { /* srumount wants refcnt of 1 */ + --srmp->srm_refcnt; return; } /* * Giving up last ref for this sr_mount entry - free it. + * The vnode we're working on is NOT necessarily + * the root of the resource we're unmounting. */ - (void)srm_remove(rsrcpp, srmpp); + vp = (*rsrcpp)->r_rootvp; + + (void)srm_remove(rsrcpp, srmp); + + /* One extra VN_RELE for VN_HOLD in rf_srmntck and fumount. */ + VN_RELE(vp); /* Client usually cleans up circuit, but client is gone. */ gdpp = QPTOGP(bad_q); @@ -1049,8 +869,6 @@ rf_checkq(rd, srmid) slevel = splstr(); - ASSERT(!rd->rd_qslp++); - qcnt = rd->rd_qcnt; for (cnt = 0; cnt < qcnt; cnt++) { bp = (mblk_t *)LS_REMQUE(&rd->rd_rcvdq); @@ -1070,9 +888,6 @@ rf_checkq(rd, srmid) LS_INSQUE(&rd->rd_rcvdq, bp); } } - - ASSERT(!--rd->rd_qslp); - splx(slevel); } @@ -1139,7 +954,7 @@ rf_que_umsg(bp) LS_INIT(bp); LS_INSQUE(&rf_umsgq, bp); splx(s); - wakeprocs((caddr_t)&rf_daemon_lock, PRMPT); + wakeup((caddr_t)&rf_daemon_lock); } /* @@ -1203,43 +1018,8 @@ rf_cl_fumount(rf_vfsp) DUPRINT2(DB_MNT_ADV, "fumount: waking SRD for rf_vfsp %x\n", rf_vfsp); rd->rd_stat |= RDLINKDOWN; - wakeprocs((caddr_t)&rd->rd_qslp, PRMPT); + wakeup((caddr_t)&rd->rd_qslp); } } - rf_daemon_flag &= ~RFDASYNC; - wakeprocs((caddr_t)&rf_daemon_flag, PRMPT); -} - -void -rfd_stray(bp) - mblk_t *bp; -{ - int s; - - if (!(RF_MSG(bp)->m_stat & RF_GIFT)) { - rf_freemsg(bp); - return; - } - - s = splstr(); - LS_INSQUE(&rfd_strayq, bp); - splx(s); - wakeprocs((caddr_t)&rf_daemon_rd->rd_qslp, PRMPT); -} - -/* - * Post work for rf_daemon() to do, wake it up. - */ -int -rfa_workenq(wp) - rfa_work_t *wp; -{ - int s; - - s = splstr(); - LS_INSQUE(&rfa_workq, &wp->rfaw_elt); - rf_daemon_flag |= RFDASYNC; - wakeprocs((caddr_t)&rf_daemon_rd->rd_qslp, PRMPT); - splx(s); - return 0; + wakeup((caddr_t)&rfa_workq); } diff --git a/usr/src/uts/3b2/fs/rfs/rf_admin.h b/usr/src/uts/3b2/fs/rfs/rf_admin.h index 6406213..6f96231 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_admin.h +++ b/usr/src/uts/3b2/fs/rfs/rf_admin.h @@ -8,10 +8,11 @@ #ifndef _FS_RFS_RF_ADMIN_H #define _FS_RFS_RF_ADMIN_H -#ident "@(#)fs:fs/rfs/rf_admin.h 1.4" +#ident "@(#)fs:fs/rfs/rf_admin.h 1.2" /* - * declarations of RFS internal administrative interfaces. + * declarations of RFS internal administrative interfaces and those related + * to the rf_async daemons. */ /* rf_recovery opcodes */ @@ -23,12 +24,12 @@ /* rf_recovery_flag values */ #define RFRECDISCON 0x01 #define RFRECFUMOUNT 0x02 +#define RFRECKILL 0x04 /* * rf_daemon_flag flag */ #define RFDSERVE 0x01 #define RFDDISCON 0x02 #define RFDKILL 0x04 -#define RFDASYNC 0x08 /* This is the structure passed to the user daemon */ #define ULINESIZ 120 /* want a 128-char buffer */ @@ -40,13 +41,13 @@ struct u_d_msg { /* * Structure that may be registered for rf_daemon processing via the - * rfa_workenq operation. rf_daemon always processes its work queue - * by dequeuing a structure, then calling rfaw_func with the structure - * address. - * + * rfa_workenq operation. rf_async always processes its work queue + * before sleeping. It dequeues a structure, calls rfaw_func with + * the structure address, then does not reference the structure further. * The user is reponsible for ALL cleanup, including structure disposal. * - * Passed by reference to rfa_workenq. + * Passed by reference to rfa_workenq. If canfail, caller must be prepared + * to recover. * * NOTE: rfaw_func may be called with RFS in intermediate state, * because the work queue is cleaned up when RFS is started and stopped. @@ -55,19 +56,68 @@ typedef struct rfa_work { ls_elt_t rfaw_elt; void (*rfaw_func)(); caddr_t rfaw_farg; + int rfaw_canfail; } rfa_work_t; extern int rfa_workenq(); +extern void rf_recovery(); extern void rf_signal_serve(); extern void rf_checkq(); -extern void (*rf_daemon())(); -extern void rfd_stray(); /* Handle stray messages.*/ - +extern void rf_daemon(); +extern void rf_recovery(); extern int rf_recovery_flag; extern struct proc *rf_recovery_procp; extern struct rcvd *rf_daemon_rd; +extern struct proc *rf_daemon_procp; extern int rf_daemon_flag; extern int rf_daemon_lock; + +/* + * Structure passed into esballoc to have freeb queue up work for rf_async. + * + * These are allocated and freed by rffr_alloc() and RFFR_FREE(), respectively. + * + * frtn.free_func == rfa_workenq + * frtn.free_arg == &work.rfaw_elt + * work.rfaw_func == func passed into rffr_alloc + * work.rfaw_farg == pointer passed into rffr_alloc + * work.rfaw_canfail == as passed into rffr_alloc + * + * freeb will call rfa_workenq(&work.rfaw_elt) + * rf_async will call rfaw_func(&work) + */ +typedef struct rf_frtn { + frtn_t frtn; + rfa_work_t work; +} rf_frtn_t; + +/* Convert address of rffr_work to address of enclosing structure */ +#define WTOFR(wp) \ + ((rf_frtn_t *)((caddr_t)(wp) - (caddr_t)&((rf_frtn_t *)NULL)->work)) + +#define RFFR_FREE(rffrp) kmem_free((rffrp), sizeof(rf_frtn_t)) + +extern rf_frtn_t *rffr_alloc(); + +/* + * Arg structure passed by rfesb_fbread into rffr_alloc for rfesb_fbrelse, + * which we use with esballoc(). We go to this trouble because we don't + * want the provider to sleep in fbrelse. + * + * fbp == &fbuf returned by fbread, to be passed to fbrelse + * rw == seg arg for fbrelse + */ +typedef struct rf_fba { + struct fbuf *fbp; + enum seg_rw rw; +} rf_fba_t; + +extern int rfesb_fbread(); + +#define NULLCADDR ((caddr_t)NULL) +#define NULLFRP ((frtn_t *)NULL) +#define NULLUIO ((uio_t *)NULL) +#define NULLCRED ((cred_t *)NULL) #endif /* _FS_RFS_RF_ADMIN_H */ diff --git a/usr/src/uts/3b2/fs/rfs/rf_auth.c b/usr/src/uts/3b2/fs/rfs/rf_auth.c index 4db628b..4282a9d 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_auth.c +++ b/usr/src/uts/3b2/fs/rfs/rf_auth.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_auth.c 1.6" +#ident "@(#)fs:fs/rfs/rf_auth.c 1.5" /* * Routines for id mapping @@ -669,9 +669,9 @@ STATIC void rd_unlock() { if (!--Tabwlock && Want_wr) { - wakeprocs((caddr_t)&Tabwlock, PRMPT); + wakeup((caddr_t)&Tabwlock); } else if (Want_rd) { /* This may not be necessary */ - wakeprocs((caddr_t)&Tabrlock, PRMPT); + wakeup((caddr_t)&Tabrlock); } } @@ -694,9 +694,9 @@ wr_unlock() { Tabrlock--; if (Want_wr) { - wakeprocs((caddr_t)&Tabwlock, PRMPT); + wakeup((caddr_t)&Tabwlock); } else if (Want_rd) { - wakeprocs((caddr_t)&Tabrlock, PRMPT); + wakeup((caddr_t)&Tabrlock); } } diff --git a/usr/src/uts/3b2/fs/rfs/rf_cache.c b/usr/src/uts/3b2/fs/rfs/rf_cache.c index 833e41f..d4cbe4a 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_cache.c +++ b/usr/src/uts/3b2/fs/rfs/rf_cache.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_cache.c 1.16" +#ident "@(#)fs:fs/rfs/rf_cache.c 1.10.1.1" #include "sys/list.h" #include "sys/types.h" @@ -37,7 +37,6 @@ #include "sys/vfs.h" #include "sys/stat.h" #include "sys/statfs.h" -#include "sys/buf.h" #include "rf_cache.h" #include "rfcl_subr.h" #include "sys/immu.h" @@ -120,7 +119,6 @@ rfc_pagelist(vp, offset, len, pfxp, sfxp) *pfxp = *sfxp = NULL; for ( ; offset < end; offset += PAGESIZE) { rfc_info.rfci_ptread++; - /* * First find and hold all resident pages in the requested * range. @@ -128,16 +126,13 @@ rfc_pagelist(vp, offset, len, pfxp, sfxp) * Build a resident prefix in *pfxp until we find a nonresident * page, then put any further resident pages into *sfxp. */ - if ((pp = page_lookup(vp, offset)) != NULL) { - - /* page_lookup doesn't hold the page. */ - + /* + * page_lookup doesn't hold the page. + */ PAGE_HOLD(pp); ASSERT(pp->p_keepcnt > 0); - rfc_pagelock(pp); page_sortadd(lnrpoff == -1 ? pfxp : sfxp, pp); - } else { rfc_info.rfci_pmread++; lnrpoff = offset; @@ -154,7 +149,6 @@ rfc_pagelist(vp, offset, len, pfxp, sfxp) while ((pp = *sfxp) != NULL && pp->p_offset < lnrpoff) { rfc_info.rfci_pmread++; page_sub(sfxp, pp); - rfc_pageunlock(pp); ASSERT(pp->p_keepcnt > 0); PAGE_RELE(pp); } @@ -168,31 +162,6 @@ rfc_pagelist(vp, offset, len, pfxp, sfxp) return 0; } -/* - * Lookup the page denoted by vp and off, and sort it into ppp. - * Holds and locks the page. Returns a pointer to the page found - * for success, NULL for failure. - */ -page_t * -rfc_page_lookup(vp, off, ppp) - vnode_t *vp; - off_t off; - page_t **ppp; -{ - page_t *pp; - - ASSERT(!(off & PAGEOFFSET)); - - pp = page_lookup(vp, off); - if (pp) { - PAGE_HOLD(pp); - ASSERT(pp->p_keepcnt > 0); - page_lock(pp); - page_sortadd(ppp, pp); - } - return pp; -} - /* * Move data from incoming streams messages into page cache, and * from page cache into read destination. Handles resident prefix @@ -230,7 +199,7 @@ rfc_readmove(rf_rwap, bpp, chansdp, move_errorp) long copysync = resp->rp_copyout.copysync; rf_message_t *mp = RF_MSG(*bpp); queue_t *qp = (queue_t *)mp->m_queue; - rf_gift_t gift; + long giftid = mp->m_giftid; int error = 0; /* @@ -248,7 +217,6 @@ rfc_readmove(rf_rwap, bpp, chansdp, move_errorp) if (rf_rwap->rd_nextnrb == rf_rwap->rd_firstnrb && !move_error) { move_error = rfc_readrp1(chansdp, rf_rwap); } - gift = mp->m_gift; ctl = *rf_rwap->rd_ctlp; /* may be set by rfc_readrp1 */ if (ctl == RFC_INCACHE && !move_error && (opcode == RFCOPYOUT || !resp->rp_nodata)) { @@ -261,7 +229,7 @@ rfc_readmove(rf_rwap, bpp, chansdp, move_errorp) rf_freemsg(*bpp); *bpp = NULL; if (opcode == RFCOPYOUT && copysync) { - error = rfcl_copysync(rf_rwap->replysdp, qp, &gift); + error = rfcl_copysync(rf_rwap->replysdp, qp, giftid); } else if (opcode == RFREAD && ctl == RFC_INCACHE && !move_error && !error) { move_error = rfc_readend(chansdp, rf_rwap); @@ -451,9 +419,9 @@ rfc_readend(sdp, rf_rwap) /* Zap the balance of the page and make it resident. */ bzero(rfc_pptokv(pp) + on, nleft); + rfc_pageunlock(pp); rf_rwap->rd_nextnrb += nleft; page_sub(&rf_rwap->rd_infix, pp); - rfc_pageunlock(pp); ASSERT(pp->p_keepcnt > 0); PAGE_RELE(pp); ASSERT(!rf_rwap->rd_infix); @@ -511,11 +479,10 @@ rfc_plmove(plp, uiop, end_data) UIO_READ, uiop); } if (end_data >= pp->p_offset + PAGESIZE) { - - /* Whole page. */ - + /* + * Whole page. + */ page_sub(plp, pp); - rfc_pageunlock(pp); ASSERT(pp->p_keepcnt > 0); PAGE_RELE(pp); pp = *plp; @@ -549,7 +516,7 @@ rfc_writefill(vp, uiop, nbytes) register off_t poff = uiop->uio_offset & PAGEMASK; register off_t pon = uiop->uio_offset & PAGEOFFSET; register page_t *pp = page_lookup(vp, poff); - register long nbin = MIN(PAGESIZE - pon, nbytes); + register long nbin = MIN(PAGESIZE, nbytes); rfc_info.rfci_ptwrite++; @@ -659,8 +626,7 @@ rfc_dismsout(rdup, vp, sdp, rdp, vcode) if (gp->constate != GDPCONNECT) { return; } - sndd_set(sdp, qp, &rf_daemon_gift); - rdp->rd_sdp = sdp; + sndd_set(sdp, qp, RECOVER_RD); (void)rf_allocmsg(minreq, (size_t)0, BPRI_MED, FALSE, NULLCADDR, NULLFRP, &bp); ASSERT(bp); @@ -674,7 +640,6 @@ rfc_dismsout(rdup, vp, sdp, rdp, vcode) if (rf_sndmsg(sdp, bp, minreq, rdp, FALSE) == 0) { (void)rf_rcvmsg(rdp, &bp); } - rdp->rd_sdp = NULL; rf_freemsg(bp); } @@ -701,14 +666,14 @@ rfc_sdabort(rfvfsp) /* * Look for a cached send descriptor matching the reference in the response * denoted by rp. Return the send descriptor with sd_queue, sd_stat, and - * sd_gift initialized, or NULL for failure. + * sd_connid initialized, or NULL for failure. */ sndd_t * -rfc_sdsearch(rfvfsp, rp, qp, giftp) +rfc_sdsearch(rfvfsp, rp, qp, connid) rf_vfs_t *rfvfsp; register rf_response_t *rp; register queue_t *qp; - rf_gift_t *giftp; + long connid; { register ls_elt_t *vfhash = &rfvfsp->rfvfs_sdhash; register ls_elt_t *sdhash = vfhash->ls_next; @@ -736,11 +701,9 @@ rfc_sdsearch(rfvfsp, rp, qp, giftp) */ sndd_unhash(sdp); if (sdp->sd_vcode == vcode) { - /* cache hit; define sd */ - sdp->sd_stat |= SDUSED; - sndd_set(sdp, qp, giftp); + sndd_set(sdp, qp, connid); rfvfsp->rfvfs_refcnt++; /* remember SD */ VN_HOLD(SDTOV(sdp)); } else { @@ -926,7 +889,6 @@ rfc_plrele(plp) while ((pp = *plp) != NULL) { page_sub(plp, pp); - rfc_pageunlock(pp); ASSERT(pp->p_keepcnt > 0); PAGE_RELE(pp); } @@ -1129,6 +1091,7 @@ rfc_dopageabort(pp) if (pp->p_keepcnt) { pp->p_gone = 1; } else { + page_hashout(pp); page_abort(pp); } } diff --git a/usr/src/uts/3b2/fs/rfs/rf_cache.h b/usr/src/uts/3b2/fs/rfs/rf_cache.h index f323919..603896f 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_cache.h +++ b/usr/src/uts/3b2/fs/rfs/rf_cache.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_cache.h 1.8" +#ident "@(#)fs:fs/rfs/rf_cache.h 1.7" /* * Interfaces supporting RFS reads and writes through the VM page cache */ @@ -51,11 +51,6 @@ typedef enum rfc_ctl { * condition is necessary because rfcl_esbwrmsg * ultimately gets to rf_getpage to map the pages * in. - * bufp - defined iff kern. non-NULL if I/O pages are covered - * by a buffer header. Guaranteed that b_bcount <= MAXBSIZE - * and that pages are virtually addressable. - * Assumes that cleanup at end of IO will be done at lower level, - * e.g., by using an esballoc-ed steams message. * uio - defined only if cached, used for I/O into page cache. * iovec - defined only if cached, used for I/O into page cache. */ @@ -78,7 +73,6 @@ typedef struct rf_rwa { struct { int ioflag; int kern; - buf_t *bufp; uio_t uio; iovec_t iovec; } wr; @@ -96,7 +90,6 @@ typedef struct rf_rwa { #define rd_endnrb rf_rwa_un.rd.endnrb #define wr_ioflag rf_rwa_un.wr.ioflag #define wr_kern rf_rwa_un.wr.kern -#define wr_bufp rf_rwa_un.wr.bufp #define cwruio rf_rwa_un.wr.uio #define wr_iovec rf_rwa_un.wr.iovec @@ -120,7 +113,6 @@ typedef struct rf_rwa { extern void rfc_pageunlock(); extern int rfc_pagelist(); -extern page_t *rfc_page_lookup(); extern void rfc_plrele(); extern int rfc_readmove(); extern int rfc_plmove(); diff --git a/usr/src/uts/3b2/fs/rfs/rf_canon.c b/usr/src/uts/3b2/fs/rfs/rf_canon.c index 3692786..03f3093 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_canon.c +++ b/usr/src/uts/3b2/fs/rfs/rf_canon.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_canon.c 1.7" +#ident "@(#)fs:fs/rfs/rf_canon.c 1.5" #include "sys/types.h" #include "sys/stream.h" @@ -25,21 +25,20 @@ extern int stoi(); extern int strlen(); /* - * Convert from canonical to local representation. Return length of the - * local representation, or 0 for bad format or data. + * Convert from canonical to local representation. + * Return length of the local representation, or 0 for bad format. */ int rf_fcanon(fmt, from, end, to) register char *fmt; /* conversion format */ - register caddr_t from; /* canonical data */ + register caddr_t from; /* to canonical data */ register caddr_t end; /* of canonical data */ - caddr_t to; /* local data */ + caddr_t to; /* to local data */ { long ltmp; /* intermediate scalar values */ register caddr_t cptr; /* cursor into ltmp */ caddr_t tptr = to; /* cursor into local data */ char *lfmt; /* addressable copy of fmt */ - register int is_string; /* flag "c0" format */ while (*fmt) { if (from >= end) { @@ -97,12 +96,6 @@ rf_fcanon(fmt, from, end, to) if (from >= end) { goto fail; } - - /* - * We use the format-encoded length, and ignore - * that in the data, for character arrays. - */ - lfmt = fmt; ltmp = stoi(&lfmt); fmt = lfmt; @@ -113,36 +106,28 @@ rf_fcanon(fmt, from, end, to) *cptr++ = lobyte(hiword(*from)); *cptr++ = hibyte(loword(*from)); *cptr = lobyte(loword(*from)); - is_string = 1; - } else { - is_string = 0; } /* - * Character array and string sanity checks: - * - * 1 - encoded end of array/string must not exceed - * end of data and - * 2 - must not exceed MAXNAMELEN - * - * Checks for strings only: - * - * 3 - must be null terminated - * 4 - length must equal that specified in data. + * Character string sanity check: + * 1 string must not exceed end of data + * 2 string must not exceed MAXPATHLEN + * 2 string must be null terminated + * 3 string length must equal that specified */ from = LNEXT(from); - if (from + ltmp > end || ltmp > MAXNAMELEN || - is_string && - (*(from + ltmp - 1) != '\0' || - ltmp != strlen(from) + 1)) { + if (from + ltmp >= end || + ltmp > MAXNAMELEN || + *(from + ltmp - 1) != '\0' || + ltmp != strlen(from) + 1) { goto fail; } while (ltmp--) { + *tptr++ = *from++; if (from >= end) { goto fail; } - *tptr++ = *from++; } continue; default: @@ -292,7 +277,7 @@ rf_mcfcanon(bp) { register caddr_t rptr = (caddr_t)bp->b_rptr; - return rf_fcanon(MSGCOM_FMT, rptr, rptr + RF_MCSZ, rptr); + return rf_fcanon(MSGCOM_FMT, rptr, rptr + RF_MCSZ, rptr); } /* diff --git a/usr/src/uts/3b2/fs/rfs/rf_canon.h b/usr/src/uts/3b2/fs/rfs/rf_canon.h index a49772a..bc04868 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_canon.h +++ b/usr/src/uts/3b2/fs/rfs/rf_canon.h @@ -8,7 +8,7 @@ #ifndef _FS_RFS_RF_CANON_H #define _FS_RFS_RF_CANON_H -#ident "@(#)fs:fs/rfs/rf_canon.h 1.4" +#ident "@(#)fs:fs/rfs/rf_canon.h 1.2" /* * Macros describing the format of various structures. @@ -30,46 +30,27 @@ #define MKDENT_FMT "llllllllllllllllllllllllllc0" /* - * String, character array, scalar character, short, integer type expansion; - * string is worst-case estimate. + * character, short, integer type expansion */ -#define STRXPAND (2 * sizeof(long)) -#define CXPAND(len) (sizeof(long) + ((len) % sizeof(long) ? \ - sizeof(long) - (len) % sizeof(long) : 0)) -#define BXPAND (sizeof(long) - 1) +#define CXPAND (2 * sizeof(long)) #define SXPAND (sizeof(long) - sizeof(short)) -#define IXPAND (sizeof(long) - sizeof(int)) +#define IXPAND (sizeof(int)) /* - * Macros for heterogeneity buffer expansion. These are used to allocate - * streams messages and for sanity checking on responses. - * - * NOTE to porters: These are necessarily machine and compiler-specific, - * and derived after considering structure layout and padding. - * - * TO DO: do this with canonical structure representations and expressions - * like sizeof(struct candirent) - sizeof(struct dirent). Just make sure - * that the canonical representation allows for aligning strings. The - * worst case is demonstrated by - * - * -------------------------------------- - * | 'a' | 'b' 'c' 'd' '\0' | - * -------------------------------------- - * - * for the native representation, because the 'a' will require an additional - * long in the canonical representation. + * Macros for heterogeneity buffer expansion. */ -#define DIRENT_XP (SXPAND + STRXPAND) -#define FLOCK_XP (2 * SXPAND) -#define OFLOCK_XP (4 * SXPAND) -#define STAT_XP (6 * SXPAND) -#define STATFS_XP (2 * CXPAND(6)) -#define USTAT_XP (SXPAND + 2 * CXPAND(6) - 2) -#define ATTR_XP 0 -#define RFLKC_XP 0 -#define SYMLNK_XP (CXPAND(256) + STRXPAND) -#define STATVFS_XP (CXPAND(16) + CXPAND(32)) -#define MKDENT_XP STRXPAND +#define MINXPAND (2 * sizeof(long)) /* for misalignment */ +#define DIRENT_XP (SXPAND + CXPAND) /* struct dirent */ +#define FLOCK_XP (MINXPAND + 2*SXPAND) /* struct flock */ +#define OFLOCK_XP (MINXPAND + 4*SXPAND) /* struct oflock */ +#define STAT_XP (MINXPAND + 7*SXPAND) /* struct stat */ +#define STATFS_XP (MINXPAND + SXPAND + 2*CXPAND) /* struct statfs */ +#define USTAT_XP (MINXPAND + SXPAND + 2*CXPAND) /* struct ustat */ +#define ATTR_XP MINXPAND /* struct vattr */ +#define RFLKC_XP MINXPAND /* rflkc_info_t */ +#define SYMLNK_XP (MINXPAND + 2*CXPAND) /* symlnkarg */ +#define STATVFS_XP (MINXPAND + 2*CXPAND) /* struct statvfs */ +#define MKDENT_XP (MINXPAND + CXPAND) /* struct mkdent */ /* * Generic data canonization diff --git a/usr/src/uts/3b2/fs/rfs/rf_cirmgr.c b/usr/src/uts/3b2/fs/rfs/rf_cirmgr.c index 66ae8a1..b0778da 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_cirmgr.c +++ b/usr/src/uts/3b2/fs/rfs/rf_cirmgr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_cirmgr.c 1.10.2.8" +#ident "@(#)fs:fs/rfs/rf_cirmgr.c 1.10.3.1" #include "sys/list.h" #include "sys/param.h" @@ -23,13 +23,13 @@ #include "sys/vnode.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "sys/inline.h" #include "sys/debug.h" #include "sys/nserve.h" #include "sys/rf_cirmgr.h" #include "sys/tihdr.h" +#include "sys/rf_messg.h" #include "sys/hetero.h" #include "sys/systm.h" #include "rf_auth.h" @@ -37,10 +37,6 @@ #include "rf_canon.h" #include "sys/strmdep.h" -#ifdef DEBUG -int gdp_call_demon; -#endif - /* * Streamhead/virtual circuit manager for RFS. * @@ -169,11 +165,7 @@ gdp_init() gp->idmap[0] = 0; gp->idmap[1] = 0; gp->input.oneshot = 0; - gp->timeout = 0; gdp_cleanhdr(gp); -#ifdef DEBUG - gp->inseq = gp->outseq = 0; -#endif } return 0; } @@ -199,20 +191,11 @@ gdp_discon(message, gp) char *message; gdp_t *gp; { - cmn_err(CE_NOTE, "%s: disconnecting on gdp %x, remote %s", + cmn_err(CE_WARN, "%s: disconnecting on gdp %x, remote %s", message, (int)gp, gp->token.t_uname); gdp_dodiscon(gp); } -void -gdp_j_accuse(message, gp) - char *message; - gdp_t *gp; -{ - cmn_err(CE_NOTE, "%s: gdp %x, remote %s", - message, (int)gp, gp->token.t_uname); -} - void gdp_kill() { @@ -220,8 +203,8 @@ gdp_kill() register gdp_t *endgdp = gdp + maxgdp; for (tmp = gdp; tmp < endgdp; tmp++) { - if (tmp->constate == GDPCONNECT) { - gdp_clean_circuit(tmp->queue); + if (tmp->constate != GDPFREE) { + gdp_clean_circuit (tmp->queue); } } } @@ -253,7 +236,7 @@ gdp_rput(q, bp) case M_PROTO: case M_PCPROTO: - /* Assume the 1st block M_PROTO/M_PCPROTO is not fragmented. */ + /*Assume the 1st block M_PROTO/M_PCPROTO is not fragmented. */ Tp = (union T_primitives *)bp->b_rptr; switch ((int)Tp->type) { @@ -338,7 +321,9 @@ asm("gdpbaddiscon:"); case M_ERROR: case M_HANGUP: - gdp_dodiscon(gp); + gp->constate = GDPDISCONN; + rf_daemon_flag |= RFDDISCON; + wakeup((caddr_t)&rf_daemon_rd->rd_qslp); goto free; default: @@ -356,19 +341,8 @@ gdp_rsrv(qp) register mblk_t *splitbp; register gdp_t *gp; -#if defined(u3b2) && !defined(lint) && !defined(CXREF) - ASSERT(ipl() <= 0x1e000); /* splstr */ -#endif gp = QPTOGP(qp); - gp->timeout = 0; - - if (gp->constate != GDPCONNECT) { - while (bp = getq(qp)) { - freeb(bp); - } - return; - } if (gp->input.oneshot) { while (bp = getq(qp)) { @@ -468,8 +442,7 @@ asm("GDPPMC:"); gp->hdr = NULL; gp->idata = NULL; gdp_cleanhdr(gp); - gdp_discon("gdp_rsrv: bad header data", - gp); + gdp_discon("gdp_rsrv: bad data", gp); return; } gp->input.mcdecan = 1; @@ -564,10 +537,10 @@ asm("GDPPR:"); if (gp->hetero == ALL_CONV && !gp->input.rhdecan) { if (!rf_rhfcanon(gp->hdr, gp)) { if (bp && bp != (mblk_t *)1) { + putbq(qp, bp); } - gdp_discon("gdp_rsrv bad header data", - gp); + gdp_discon("gdp_rsrv bad header", gp); return; } gp->input.rhdecan = 1; @@ -633,32 +606,6 @@ asm("GDPGD:"); gdp_cleanhdr(gp); RF_MSG(bp)->m_queue = (long)qp; -#ifdef DEBUG - { - rf_message_t *msg; - - /* - * By checking filler0 for a nonzero value, we - * let non-participants slip by. - */ - - msg = RF_MSG(bp); - if (gp->version > RFS1DOT0 && - msg->filler0 && msg->filler0 != gp->inseq) { - cmn_err(CE_NOTE, - "msg sequence %d gdp sequence %d\n", - msg->filler0, gp->inseq); - if (gdp_call_demon) { - call_demon(); - } - } - gp->inseq = msg->filler0 + 1; - } -#endif - - ASSERT(bp->b_wptr - bp->b_rptr >= - RF_MCSZ + GDP_RHSZ(gp, RF_COM(bp))); - rf_deliver(bp); if (!splitbp || (bp = splitbp) == (mblk_t *)1) { @@ -708,7 +655,7 @@ gdp_wsrv(qp) } } if (canput(qp)) { - wakeprocs(qp->q_ptr, PRMPT); + wakeup(qp->q_ptr); } } @@ -739,9 +686,8 @@ gdp_process(qp, bp) if (gp->hetero == ALL_CONV && !gp->input.mcdecan) { if (!rf_mcfcanon(bp)) { - gdp_discon("gdp_process bad header data", gp); - freeb(bp); - return 1; + gdp_discon("gdp_process bad message header", gp); + return 0; } gp->input.mcdecan = 1; } @@ -751,10 +697,8 @@ gdp_process(qp, bp) if (gp->hetero == ALL_CONV && !gp->input.rhdecan) { if (!rf_rhfcanon(bp, gp)) { - gdp_discon( - "gdp_process bad header type", gp); - freeb(bp); - return 1; + gdp_discon("gdp_process bad header", gp); + return 0; } gp->input.rhdecan = 1; } @@ -762,40 +706,15 @@ gdp_process(qp, bp) /* All headers and data present. */ -#ifdef DEBUG - { - rf_message_t *msg; - - /* - * By checking filler0 for a nonzero value, we - * let non-participants slip by. - */ - - msg = RF_MSG(bp); - if (gp->version > RFS1DOT0 && - msg->filler0 && msg->filler0 != gp->inseq) { - cmn_err(CE_NOTE, - "msg sequence %d gdp sequence %d\n", - msg->filler0, gp->inseq); - if (gdp_call_demon) { - call_demon(); - } - } - gp->inseq = msg->filler0 + 1; - } - -#endif - ASSERT(bp->b_wptr - bp->b_rptr >= - RF_MCSZ + GDP_RHSZ(gp, cop)); - RF_MSG(bp)->m_queue = (long)qp; rf_deliver(bp); return 1; - } else if (msg->m_size < msgsize) { gdp_discon("gdp_process bad size", gp); - freeb(bp); - return 1; + if (cop->co_type == RF_RESP_MSG) { + RF_RESP(bp)->rp_errno = EPROTO; + } + return 0; } } if (gp->input.oneshot && RF_MSG(bp)->m_size != msgsize) { @@ -841,12 +760,10 @@ gdp_init_circuit(fd, gdpp, tokenp, qpp, gmp) stp->sd_flag |= STPLEX; /* in case someone else can open late */ fp->f_count++; /* for consistency */ + /* point gdp at q */ gdpp->queue = qp; gdpp->mntcnt = 0; gdpp->timeskew_sec = 0; -#ifdef DEBUG - gdpp->inseq = gdpp->outseq = 0; -#endif /* point q at gdp structure and intialize q */ @@ -856,10 +773,10 @@ gdp_init_circuit(fd, gdpp, tokenp, qpp, gmp) WR(qp)->q_flag |= QWANTR; gdpp->file = fp; + gdpp->constate = GDPCONNECT; /* * strip M_PROTO:T_GR_IND */ - for (mp = qp->q_first; mp; ) { mblk_t * emp, *tmp; @@ -903,8 +820,6 @@ gdp_init_circuit(fd, gdpp, tokenp, qpp, gmp) gdpp->ngroups_max = gmp->ngroups_max; gdpp->idmap[0] = 0; gdpp->idmap[1] = 0; - gdpp->constate = GDPCONNECT; - bp->b_datap->db_type = M_PCPROTO; ((struct T_info_req *)(bp->b_wptr))->PRIM_type = T_INFO_REQ; bp->b_wptr += sizeof(struct T_info_req); @@ -945,7 +860,6 @@ gdp_clean_circuit(qp) gdpp->version = 0; gdpp->timeskew_sec = 0; gdpp->mntcnt = 0; - gdpp->timeout = 0; gdp_tokclear (gdpp); if (gdpp->idmap[0]) { rf_freeidmap(gdpp->idmap[0]); @@ -957,9 +871,6 @@ gdp_clean_circuit(qp) gdpp->idmap[1] = 0; gdpp->input.oneshot = 0; gdpp->sysid = gdpp - gdp + 1; -#ifdef DEBUG - gdpp->inseq = gdpp->outseq = 0; -#endif gdp_cleanhdr(gdpp); } @@ -1025,11 +936,9 @@ STATIC void gdp_dodiscon(gp) gdp_t *gp; { - if (gp->constate == GDPCONNECT) { - gp->constate = GDPDISCONN; - rf_daemon_flag |= RFDDISCON; - wakeprocs((caddr_t)&rf_daemon_rd->rd_qslp, PRMPT); - } + gp->constate = GDPDISCONN; + rf_daemon_flag |= RFDDISCON; + wakeup((caddr_t)&rf_daemon_rd->rd_qslp); } STATIC void diff --git a/usr/src/uts/3b2/fs/rfs/rf_comm.c b/usr/src/uts/3b2/fs/rfs/rf_comm.c index d4eda53..95a12ce 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_comm.c +++ b/usr/src/uts/3b2/fs/rfs/rf_comm.c @@ -5,9 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_comm.c 1.20.1.15" +#ident "@(#)fs:fs/rfs/rf_comm.c 1.20.3.1" + /* - * Communications routines (and some other subroutines) for RFS. + * Communications routines for RFS (and some other subroutines + * common to client and server.) */ #include "sys/list.h" @@ -46,68 +48,23 @@ #include "sys/fs/rf_acct.h" #include "sys/fs/rf_vfs.h" #include "sys/file.h" -#include "sys/buf.h" +#include "rf_cache.h" #include "sys/kmem.h" #include "sys/fbuf.h" #include "vm/page.h" -#include "vm/pvn.h" -#include "rf_cache.h" - -/* - * Structure passed into esballoc to have freeb queue up work for rf_daemon. - * - * These are allocated and freed by rffr_alloc() and RFFR_FREE(), respectively. - * - * frtn.free_func == rfa_workenq - * frtn.free_arg == &work.rfaw_elt - * work.rfaw_func == func passed into rffr_alloc - * work.rfaw_farg == pointer passed into rffr_alloc - * - * freeb will call rfa_workenq(&work.rfaw_elt) - * rf_daemon will call rfaw_func(&work) - */ -typedef struct rf_frtn { - frtn_t frtn; - rfa_work_t work; -} rf_frtn_t; - -/* Convert address of rffr_work to address of enclosing structure */ -#define WTOFR(wp) \ - ((rf_frtn_t *)((caddr_t)(wp) - (caddr_t)&((rf_frtn_t *)NULL)->work)) - -#define RFFR_FREE(rffrp) kmem_free((rffrp), sizeof(rf_frtn_t)) - -/* - * Arg structure passed by rfesb_fbread into rffr_alloc for rfesb_fbrelse, - * which we use with esballoc(). We go to this trouble because we don't - * want the provider to sleep in fbrelse. - * - * fbp == &fbuf returned by fbread, to be passed to fbrelse - * rw == seg arg for fbrelse - */ -typedef struct rf_fba { - struct fbuf *fbp; - enum seg_rw rw; -} rf_fba_t; - -STATIC void rdu_free(); -STATIC int rf_allocb(); -STATIC void rfesb_fbrelse(); -STATIC void rfesb_pagerele(); -STATIC rf_frtn_t *rffr_alloc(); -STATIC void rfesb_pvn_done(); -STATIC void rf_savesigs(); /* imports */ extern void dst_clean(); +extern void strunbcall(); extern void delay(); -/* Gift templates. */ -rf_gift_t rf_daemon_gift = {DAEMON_RD, 0}; -rf_gift_t rf_null_gift; +STATIC void rdu_free(); +STATIC int rf_allocb(); +STATIC void rfesb_fbrelse(); +STATIC void rfesb_pagerele(); -rcvd_t *mountrd; /* rd for mounts */ rcvd_t *sigrd; /* rd for signals */ +STATIC rcvd_t *mountrd; /* rd for mounts */ STATIC rcvd_t *reserved_rd; /* For critical allocations */ STATIC sndd_t *reserved_sd; /* For critical allocations */ @@ -116,9 +73,9 @@ STATIC ls_elt_t sd_freelist; /* list of free sndds */ STATIC int rd_nfree; /* number of free receive descriptors */ STATIC rd_user_t *rdu_freelist; /* free rd_user structures */ STATIC rcvd_t *rd_freelist; /* free recv desc link list */ +STATIC ushort connid; /* preserved for compatability */ -/* - * Create a send descriptor. Only if canfail, returns ENOMEM for failure, +/* Create a send descriptor. Only if canfail, returns ENOMEM for failure, * NULLING *sdpp. * Returns 0 for success, updating *sdpp with pointer to initialized sd. * NOTE: sndd_create creates reserved_sd, that call must use canfail. @@ -138,7 +95,7 @@ sndd_create(canfail, sdpp) NULL, /* sd_free.ls_prev */ -1, /* sd_size */ SDUSED, /* sd_stat */ - {0, 0}, /* sd_gift */ + -1, /* sd_connid */ -1 /* sd_mntid */ }; /* @@ -162,6 +119,7 @@ sndd_create(canfail, sdpp) } ASSERT(!canfail); if (!(reserved_sd->sd_stat & SDLOCKED)) { + reserved_sd->sd_stat |= SDLOCKED; retsndd = reserved_sd; break; } else { @@ -176,9 +134,6 @@ sndd_create(canfail, sdpp) } } retsndd[0] = initsd; - if (retsndd == reserved_sd) { - reserved_sd->sd_stat |= SDLOCKED; - } LS_INIT(&retsndd->sd_free); LS_INIT(&retsndd->sd_hash); *sdpp = retsndd; @@ -198,7 +153,7 @@ sndd_hash(sdp) ASSERT(LS_ISEMPTY(&sdp->sd_hash)); ASSERT(LS_ISEMPTY(&sdp->sd_free)); sdp->sd_stat &= ~SDUSED; - sdp->sd_gift = rf_null_gift; + sdp->sd_connid = 0; dst_clean(sdp); LS_INS_AFTER(&VFTORF(SDTOV(sdp)->v_vfsp)->rfvfs_sdhash, &sdp->sd_hash); LS_INSQUE(&sd_freelist, &sdp->sd_free); @@ -237,10 +192,10 @@ sndd_free(sdpp) ASSERT(LS_ISEMPTY(&sdp->sd_hash)); ASSERT(LS_ISEMPTY(&sdp->sd_free)); if (sdp == reserved_sd && sdp->sd_stat & SDWANT) { - wakeprocs((caddr_t)&reserved_sd, PRMPT); + wakeup((caddr_t)&reserved_sd); } sdp->sd_stat = SDUNUSED; - sdp->sd_gift = rf_null_gift; + sdp->sd_connid = 0; *sdpp = NULL; if (sdp != reserved_sd) { if (SDTOV(sdp)->v_pages != NULL) { @@ -302,57 +257,50 @@ rf_sndmsg(sd, bp, bytes, gift, retrans) (void)rf_rhfcanon(bp, tgdp); #endif } - } - - /* - * Message allocation earlier set up header block write - * pointers. Here we set up other write pointers as a service - * to callers. Note that, as we set up messages on the send - * end, if any data is not piggybacked with headers, none will - * be. On the receive end, however, no such assumption can be - * made, because transport providers may munge the message - * arbitrarily. - */ + } else { - if (!bp->b_cont) { + /* + * Message allocation earlier set up header block write + * pointers. Here we set up other write pointers as a service + * to callers. Note that, as we set up messages on the send + * end, if any data is not piggybacked with headers, none will + * be. On the receive end, however, no such assumption can be + * made, because transport providers may munge the message + * arbitrarily. + */ - /* Data is piggybacked in header block */ + if (!bp->b_cont) { - ASSERT(bp->b_datap->db_lim - bp->b_datap->db_base >= bytes); + /* Data is piggybacked in header block */ - bp->b_wptr = bp->b_rptr + bytes; - } else { - register mblk_t *databp; - register mblk_t *predatabp; - register size_t sz; - size_t bpsz; - dblk_t *dp; - - predatabp = bp; - databp = bp->b_cont; - for (sz = bytes - (bp->b_wptr - bp->b_rptr); - /* LINTED - stupid lint says bpsz is uninitialized */ - sz; sz -= bpsz) { - - ASSERT(databp); /* but may have extra mblks */ - dp = databp->b_datap; - bpsz = MIN(sz, dp->db_lim - dp->db_base); - databp->b_wptr = databp->b_rptr + bpsz; - predatabp = databp; - databp = predatabp->b_cont; - } - - if (databp) { - ASSERT(predatabp->b_cont == databp); - freemsg(databp); - predatabp->b_cont = NULL; + ASSERT(bp->b_datap->db_lim - bp->b_datap->db_base >= + bytes); + bp->b_wptr = bp->b_rptr + bytes; + } else { + register mblk_t *databp; + register size_t sz; + size_t bpsz; + dblk_t *dp; + + databp = bp->b_cont; + /* LINTED - stupid lint says bpsz is uninitialized */ + for (sz = bytes - (bp->b_wptr - bp->b_rptr); + sz; sz -= bpsz) { + + ASSERT(databp); /* but may have extra mblks */ + dp = databp->b_datap; + bpsz = MIN(sz, dp->db_lim - dp->db_base); + databp->b_wptr = databp->b_rptr + bpsz; + databp = databp->b_cont; + } } } - cop = RF_COM(bp); if (tgdp->version >= RFS2DOT0 && cop->co_type == RF_REQ_MSG) { - /* If 4.0 server, send time in every request. */ + /* + * If 4.0 server, send time in every request. + */ rf_request_t *req = RF_REQ(bp); @@ -368,29 +316,23 @@ rf_sndmsg(sd, bp, bytes, gift, retrans) cop->co_pid = u.u_procp->p_pid; msg = RF_MSG(bp); - msg->m_dest = sd->sd_gift; + msg->m_dest = sd->sd_connid; msg->m_stat |= RF_VER1; msg->m_size = bytes; if (gift) { - ASSERT(gift->rd_stat != RDUNUSED); - msg->m_stat |= RF_GIFT; - msg->m_gift.gift_id = gift - rcvd; - msg->m_gift.gift_gen = gift->rd_gen; + msg->m_giftid = RDTOINX(gift); + ASSERT(gift->rd_stat != RDUNUSED); /* * Keep track of who gets gift. * (Keep track of RDGENERAL RDs in make_gift.) */ - if (gift->rd_qtype & RDSPECIFIC && gift != rf_daemon_rd) { + if (gift->rd_qtype & RDSPECIFIC) { /* TO DO: union */ gift->rd_user_list = (rd_user_t *)rq; } - - ASSERT(gift->rd_qtype == RDSPECIFIC || - gift == mountrd || gift == sigrd || - gift->rd_vp); } /* @@ -417,9 +359,7 @@ rf_sndmsg(sd, bp, bytes, gift, retrans) return ENOLINK; } } -#ifdef DEBUG - msg->filler0 = tgdp->outseq++; -#endif + putq(wq, bp); return 0; } @@ -471,13 +411,12 @@ rf_rcvmsg(rcvdp, bufpp) /* * Found something on the rd. Even if link is down, - * do this first to strip copyin responses, e.g. + * do this first to strip all copyin responses, e.g. */ rfc_info.rfci_rcv_msg++; break; } - if (rcvdp->rd_stat & RDLINKDOWN) { error = ECOMM; break; @@ -495,19 +434,59 @@ rf_rcvmsg(rcvdp, bufpp) * and what isn't. */ - rf_savesigs(&cursig, &curinfo, &sigqueue, &sig); + if (!cursig) { + + /* + * Remember the first current signal context + * to restore later. + */ + + cursig = p->p_cursig; + curinfo = p->p_curinfo; + } else { + + /* + * Put subsequent current signal contexts into + * pending signal context. + */ + + sigaddset(&p->p_sig, cursig); + if (p->p_curinfo) { + p->p_curinfo->sq_next = p->p_sigqueue; + p->p_sigqueue = p->p_curinfo; + } + } + + /* + * Clear current signal context. Save and clear + * pending signal context. + */ + + p->p_cursig = 0; + p->p_curinfo = NULL; + if (!sigisempty(&p->p_sig)) { + + /* + * Preserve time-ordering by appending new + * pending context to that already saved. + */ + sigqueue = sigappend(&sig, sigqueue, + &p->p_sig, p->p_sigqueue); + sigemptyset(&p->p_sig); + p->p_sigqueue = NULL; + } if (!RF_SERVER() && !sigsent && RDTOSD(rcvdp)) { /* * We haven't signalled the server yet, so - * send the signal. If the signal message + * send the signal. If the signal message * is not sent because the link is down, our * rcvd will be marked LINKDOWN. * - * The above check on RDTOSD(rcvdp) prevents - * calls to rfcl_signal() for fumount and cache - * disable messages. + * The check on RDTOSD(rcvdp) prevents calls to + * rfcl_signal() for fumount and cache disable + * messages. */ rfcl_signal(RDTOSD(rcvdp)); @@ -516,16 +495,11 @@ rf_rcvmsg(rcvdp, bufpp) } } - if (!error) { *bufpp = rf_dequeue(rcvdp); ASSERT(*bufpp); } - - if (p->p_cursig) { - rf_savesigs(&cursig, &curinfo, &sigqueue, &sig); - } - + ASSERT(!p->p_cursig && !p->p_curinfo); if (cursig) { /* @@ -536,12 +510,11 @@ rf_rcvmsg(rcvdp, bufpp) p->p_cursig = cursig; p->p_curinfo = curinfo; } - if (!sigisempty(&sig)) { /* - * Preserve time-ordering by prepending saved pending context - * to new. + * Preserve time-ordering by prepending saved + * pending context to new. */ p->p_sigqueue = @@ -552,80 +525,20 @@ rf_rcvmsg(rcvdp, bufpp) return error; } -STATIC void -rf_savesigs(cursigp, curinfop, sigqp, ksigp) - char *cursigp; - sigqueue_t **curinfop; - sigqueue_t **sigqp; - k_sigset_t *ksigp; -{ - char cursig = *cursigp; - sigqueue_t *curinfo = *curinfop; - sigqueue_t *sigqueue = *sigqp; - proc_t *p = u.u_procp; - - if (!cursig) { - - /* - * Remember the first current signal context - * to restore later. - */ - - cursig = p->p_cursig; - curinfo = p->p_curinfo; - } else { - - /* - * Put subsequent current signal contexts into - * pending signal context. - */ - - sigaddset(&p->p_sig, cursig); - if (p->p_curinfo) { - p->p_curinfo->sq_next = p->p_sigqueue; - p->p_sigqueue = p->p_curinfo; - } - } - - /* - * Clear current signal context. Save and clear - * pending signal context. - */ - - p->p_cursig = 0; - p->p_curinfo = NULL; - if (!sigisempty(&p->p_sig)) { - - /* - * Preserve time-ordering by appending new - * pending context to that already saved. - */ - - sigqueue = sigappend(ksigp, sigqueue, - &p->p_sig, p->p_sigqueue); - sigemptyset(&p->p_sig); - p->p_sigqueue = NULL; - } - - *cursigp = cursig; - *curinfop = curinfo; - *sigqp = sigqueue; -} - /* - * Make datasz bytes contiguous in message denoted by bp. Message - * must contain hdrsz bytes of headers. Returns errno. + * Pull up datasz bytes of data into message denoted by bp. Message + * must contain hdrsz bytes of headers. Returns errno or EPROTO. * NOTE: can sleep. */ int rf_pullupmsg(bp, hdrsz, datasz) - register mblk_t *bp; - register size_t hdrsz; - register size_t datasz; + register mblk_t *bp; + register size_t hdrsz; + register size_t datasz; { - register mblk_t *pullupbp; - register mblk_t *dup = NULL; - register rf_message_t *msg = RF_MSG(bp); + register mblk_t *pullupbp; + register mblk_t *dup = NULL; + rf_message_t *msg = RF_MSG(bp); if (msg->m_size != hdrsz + datasz) { @@ -633,6 +546,8 @@ rf_pullupmsg(bp, hdrsz, datasz) * Circuit manager guarantees that m_size == gdp_msgsize(bp). */ + gdp_discon("rf_pullupmsg bad size", + QPTOGP((queue_t *)msg->m_queue)); return EPROTO; } @@ -649,14 +564,19 @@ rf_pullupmsg(bp, hdrsz, datasz) if (bp->b_wptr - bp->b_rptr == hdrsz) { - /* All data is in continuation block(s). */ + /* + * All data is in continuation block(s). + */ pullupbp = bp->b_cont; } else { - /* Some data is in first block. */ + /* + * Some data is in first block. + */ - ASSERT(bp->b_wptr - bp->b_rptr > hdrsz); /* circuit manager */ + /* circuit manager pulls up headers */ + ASSERT(bp->b_wptr - bp->b_rptr > hdrsz); while ((dup = dupb(bp)) == NULL) { delay(10); @@ -667,8 +587,8 @@ rf_pullupmsg(bp, hdrsz, datasz) * interpose dup between bp and b_cont. */ + bp->b_wptr -= hdrsz; dup->b_rptr += hdrsz; - bp->b_wptr = dup->b_rptr; dup->b_cont = bp->b_cont; bp->b_cont = dup; @@ -830,85 +750,6 @@ rf_msgdata(bp, hdrsz) } } -/* - * Convert *giftp to denoted rd, or NULL if *giftp is invalid. vcver - * is the RFS version number of the virtual circuit over which the - * gift was given. - */ -rcvd_t * -rf_gifttord(giftp, vcver) - rf_gift_t *giftp; - int vcver; -{ - long id; - long gen; - rcvd_t *rd; - - id = giftp->gift_id; - gen = giftp->gift_gen; - rd = NULL; - - /* - * We depend on the fact that old clients use MOUNT_RD and DAEMON_RD - * as the gens for those rds, and that new machines never change from - * 0 the gens for them, and that gens (connids in the old protocol) - * are otherwise passed transparently. - */ - - if (id < 0 || id >= nrcvd) { - return NULL; - } - - if (vcver < RFS2DOT0 && - ((id == MOUNT_RD || id == DAEMON_RD) && id == gen || - RF_SERVER() && u.u_syscall == RFLINK)) { - - /* - * Knowledge of original RFS implementation embedded - * here. The server/syscall hook is grotesque, - * but preferable to widening the interface for this - * special case in the syscall protocol. (Old clients - * don't include gen in the link message, so we take - * our chances. - */ - - rd = rcvd + id; - if (rd && rd->rd_stat != RDUNUSED) { - return rd; - } - return NULL; - } - - rd = rcvd + id; - if (rd->rd_gen != giftp->gift_gen) { - rd = NULL; - } - if (rd && rd->rd_stat != RDUNUSED) { - return rd; - } - return NULL; -} - -/* - * Convert *giftp to a vp, or NULL if *giftp does not denote a receive - * descriptor with a vp. vcver is the RFS version number of the virtual - * circuit over which the gift was given. - */ -vnode_t * -rf_gifttovp(giftp, vcver) - rf_gift_t *giftp; - int vcver; -{ - rcvd_t *rd; - - /* - * We don't worry about distinguished rds (e.g. DAEMON_RD) and their - * vps, because those vps are always NULL. - */ - - return (rd = rf_gifttord(giftp, vcver)) == NULL ? NULL : rd->rd_vp; -} - /* * Allocate and intialize iovecs and uio_iovcnt, uio_iov, and uio_resid * describing data in message starting in bp. Assumes bp contains only @@ -940,13 +781,12 @@ rf_iov_alloc(uiop, bp) iovp->iov_base = (caddr_t)databp->b_rptr; uiop->uio_resid += (iovp->iov_len = databp->b_wptr - databp->b_rptr); - ASSERT(iovp <= uiop->uio_iov + (niov - 1) * sizeof(iovec_t)); } return; } /* - * Drop nbytes out of bp. Return balance or NULL if nbytes >= content of bp. + * Drop nbytes out of bp. Return balance or NULL if no empty. */ mblk_t * rf_dropbytes(bp, nbytes) @@ -976,11 +816,13 @@ rf_dropbytes(bp, nbytes) * Return reference to an initialized rf_frtn structure. Can sleep. * work.rfaw_func == func * work.rfaw_farg == farg + * work.rfaw_canfail == canfail */ rf_frtn_t * -rffr_alloc(func, farg) +rffr_alloc(func, farg, canfail) void (*func)(); caddr_t farg; + int canfail; { register rf_frtn_t *frp; @@ -988,6 +830,7 @@ rffr_alloc(func, farg) LS_INIT(&frp->work.rfaw_elt); frp->work.rfaw_func = func; frp->work.rfaw_farg = farg; + frp->work.rfaw_canfail = canfail; frp->frtn.free_func = (void (*)())rfa_workenq; frp->frtn.free_arg = (caddr_t)&frp->work.rfaw_elt; return frp; @@ -1016,14 +859,13 @@ rfesb_fbread(vp, off, len, rw, hdrsz, pri, canfail, bpp) int onepage; off_t poff; - struct fbuf *fbp = (struct fbuf *)NULL; + struct fbuf *fbp; rf_frtn_t *rfrp; int error; rf_fba_t *rfbap; page_t *pp; caddr_t addr; - *bpp = (mblk_t *)NULL; poff = off & PAGEMASK; onepage = poff + PAGESIZE >= off + len; @@ -1036,7 +878,7 @@ rfesb_fbread(vp, off, len, rw, hdrsz, pri, canfail, bpp) PAGE_HOLD(pp); ASSERT(pp->p_keepcnt > 0); - rfrp = rffr_alloc(rfesb_pagerele, (caddr_t)pp); + rfrp = rffr_alloc(rfesb_pagerele, (caddr_t)pp, FALSE); addr = rfc_pptokv(pp) + (off & PAGEOFFSET); } else if ((error = fbread(vp, off, len, rw, &fbp)) == 0) { @@ -1047,15 +889,13 @@ rfesb_fbread(vp, off, len, rw, hdrsz, pri, canfail, bpp) * fbrelsed later. */ - rfrp = rffr_alloc(rfesb_fbrelse, kmem_alloc(sizeof(rf_fba_t), - KM_SLEEP)); + rfrp = rffr_alloc(rfesb_fbrelse, + kmem_alloc(sizeof(rf_fba_t), KM_SLEEP), FALSE); rfbap = (rf_fba_t *)rfrp->work.rfaw_farg; - ASSERT(fbp); rfbap->fbp = fbp; rfbap->rw = rw; addr = fbp->fb_addr; } else { - ASSERT(!fbp); return error; } @@ -1066,7 +906,7 @@ rfesb_fbread(vp, off, len, rw, hdrsz, pri, canfail, bpp) if (error) { if (onepage) { ASSERT(pp->p_keepcnt > 0); - PAGE_RELE(pp); + PAGE_RELE(pp); } else { fbrelse(rfbap->fbp, rfbap->rw); kmem_free(rfrp->work.rfaw_farg, sizeof(rf_fba_t)); @@ -1099,44 +939,58 @@ rfesb_pagerele(wp) } /* - * Return a pointer to an esballoc-ed streams message block covering - * the addresses [bufp->b_un.b_addr + off .. bufp->b_un.b_addr + off + len). - * The message is set up to free the pages when it is freed. If hdrsz is - * 0, no header part will be allocated. + * TO DO: move this into os/move.c + * Move MIN(ruio->uio_resid, wuio->uio_resid) bytes from addresses described + * by ruio to those described by wuio. Both uio structures are updated to + * reflect the move. Returns 0 on success or a non-zero errno on failure. */ - int -rfesb_pageio_setup(bufp, hdrsz, off, len, pri, canfail, bpp) - buf_t *bufp; - size_t hdrsz; - off_t off; - size_t len; - uint pri; - int canfail; - mblk_t **bpp; +uiomvuio(ruio, wuio) + register uio_t *ruio; + register uio_t *wuio; { - rf_frtn_t *rfrp; - int error; - - ASSERT(bufp->b_flags & (B_ASYNC | B_REMAPPED | B_WRITE)); - rfrp = rffr_alloc(rfesb_pvn_done, (caddr_t)bufp); - error = rf_allocmsg(hdrsz, len, pri, canfail, bufp->b_un.b_addr + off, - &rfrp->frtn, bpp); - ASSERT(!error != !*bpp); - if (error) { - RFFR_FREE(rfrp); + register iovec_t *riov; + register iovec_t *wiov; + register long n; + uint cnt; + int kerncp; + + n = MIN(ruio->uio_resid, wuio->uio_resid); + kerncp = ruio->uio_segflg == UIO_SYSSPACE && + wuio->uio_segflg == UIO_SYSSPACE; + + riov = ruio->uio_iov; + wiov = wuio->uio_iov; + while (n) { + while (!wiov->iov_len) { + wiov = ++wuio->uio_iov; + wuio->uio_iovcnt--; + } + while (!riov->iov_len) { + riov = ++ruio->uio_iov; + ruio->uio_iovcnt--; + } + cnt = MIN(wiov->iov_len, MIN(riov->iov_len, n)); + + if (kerncp) + bcopy(riov->iov_base, wiov->iov_base, cnt); + else if (ruio->uio_segflg == UIO_SYSSPACE) { + if (copyout(riov->iov_base, wiov->iov_base, cnt)) + return EFAULT; + } else if (copyin(riov->iov_base, wiov->iov_base, cnt)) + return EFAULT; + + riov->iov_base += cnt; + riov->iov_len -= cnt; + ruio->uio_resid -= cnt; + ruio->uio_offset += cnt; + wiov->iov_base += cnt; + wiov->iov_len -= cnt; + wuio->uio_resid -= cnt; + wuio->uio_offset += cnt; + n -= cnt; } - return error; -} - -STATIC void -rfesb_pvn_done(wp) - rfa_work_t *wp; -{ - ASSERT(((buf_t *)wp->rfaw_farg)->b_flags & - (B_ASYNC | B_REMAPPED | B_WRITE)); - pvn_done((buf_t *)wp->rfaw_farg); - RFFR_FREE(WTOFR(wp)); + return 0; } /* @@ -1156,7 +1010,6 @@ rf_allocb(size, bpri, canfail, base, frp, bpp) mblk_t *bp = NULL; int pri = canfail ? (PREMOTE | PCATCH | PNOSTOP) : PZERO; int error = 0; - int strid; ASSERT(!base == !frp); @@ -1165,8 +1018,8 @@ rf_allocb(size, bpri, canfail, base, frp, bpp) if ((bp = allocb((int)size, bpri)) != NULL) { break; } - if (!(strid = bufcall(size, bpri, (int(*)())setrun, - (long)u.u_procp))) { + if (!bufcall(size, bpri, (int(*)())setrun, + (long)u.u_procp)) { if (canfail) { error = ENOMEM; break; @@ -1179,7 +1032,7 @@ rf_allocb(size, bpri, canfail, base, frp, bpp) != NULL) { break; } - if (!(strid = esbbcall(bpri, setrun, (long)u.u_procp))) { + if (!esbbcall(bpri, setrun, (long)u.u_procp)) { if (canfail) { error = ENOMEM; break; @@ -1190,7 +1043,7 @@ rf_allocb(size, bpri, canfail, base, frp, bpp) } if (sleep((caddr_t)&(u.u_procp->p_flag), pri)) { ASSERT(canfail); - unbufcall(strid); + strunbcall((int)size, u.u_procp); error = EINTR; break; } @@ -1230,6 +1083,7 @@ rcvd_create(canfail, type, rdpp) cmn_err(CE_NOTE, "rcvd_create: not enough rcvds\n"); return ENOMEM; } else if (!(reserved_rd->rd_stat & RDLOCKED)) { + reserved_rd->rd_stat |= RDLOCKED; rdp = reserved_rd; break; } else { @@ -1238,20 +1092,19 @@ rcvd_create(canfail, type, rdpp) } } *rdpp = rdp; - rdp->rd_stat = RDUSED; if (rdp != reserved_rd) { rd_freelist = rdp->rd_next; rdp->rd_next = NULL; rd_nfree--; - } else { - rdp->rd_stat |= RDLOCKED; } rdp->rd_qcnt = 0; rdp->rd_vp = NULL; rdp->rd_refcnt = 1; rdp->rd_qtype = (char)type; rdp->rd_user_list = NULL; + rdp->rd_connid = connid++; LS_INIT(&rdp->rd_rcvdq); + rdp->rd_stat = RDUSED; rdp->rd_qslp = 0; rdp->rd_mtime = 0; if (type == RDSPECIFIC) { @@ -1263,7 +1116,7 @@ rcvd_create(canfail, type, rdpp) } /* - * Give up nrefs references to the denoted receive descriptor, freeing it and + * Give up a reference to the denoted receive descriptor, freeing it and * NULLing *rdpp when it becomes unused. * * mntid is non-negative iff there is an rduser structure associated @@ -1274,11 +1127,10 @@ rcvd_create(canfail, type, rdpp) * do so AFTER the call here. */ void -rcvd_delete(rdpp, sysid, mntid, nrefs) +rcvd_delete(rdpp, sysid, mntid) rcvd_t **rdpp; register sysid_t sysid; long mntid; - int nrefs; { register rcvd_t *rdp = *rdpp; @@ -1290,10 +1142,11 @@ rcvd_delete(rdpp, sysid, mntid, nrefs) * Otherwise no rduser structure associated with * the reference. */ - rdu_del(rdp, sysid, mntid, nrefs); + rdu_del(rdp, sysid, mntid); } - if (!(rdp->rd_refcnt -= nrefs)) { + if (!--rdp->rd_refcnt) { rcvd_free(rdpp); + *rdpp = NULL; } } @@ -1306,26 +1159,12 @@ rcvd_free(rdpp) rcvd_t **rdpp; { register rcvd_t *rdp = *rdpp; - mblk_t *straybp; if (rdp) { ASSERT(rdp->rd_stat != RDUNUSED); - rdp->rd_gen++; - - /* Take care of races with rf_deliver */ - - while ((straybp = rf_dequeue(rdp)) != NULL) { - rfd_stray(straybp); - } - - if (rdp->rd_qtype == RDGENERAL && rdp->rd_vp) { - VN_RELE(rdp->rd_vp); - rdp->rd_vp = NULL; - } - if (rdp == reserved_rd) { if (rdp->rd_stat & RDWANT) { - wakeprocs((caddr_t)&reserved_rd, PRMPT); + wakeup((caddr_t)&reserved_rd); } } else { rd_nfree++; @@ -1334,6 +1173,7 @@ rcvd_free(rdpp) } rdp->rd_stat = RDUNUSED; rdp->rd_user_list = NULL; + rdp->rd_vp = NULL; *rdpp = NULL; } } @@ -1433,7 +1273,8 @@ rdu_get(rd, sysid, mntid, qp) rduptr->ru_srmntid = mntid; rduptr->ru_vcount = 1; rduptr->ru_queue = qp; - rduptr->ru_frwcnt = rduptr->ru_frcnt = rduptr->ru_fwcnt = 0; + rduptr->ru_fcount = rduptr->ru_frcnt = 0; + rduptr->ru_fwcnt = 0; rduptr->ru_cflag = 0; rdu_freelist = rdu_freelist->ru_next; rduptr->ru_next = rd->rd_user_list; @@ -1487,76 +1328,86 @@ rdu_find(rd, sysid, mntid, prev_rdupp) /* * rdu_open() increments file, read and write counts for the given rd, - * sysid, mntid, and fmode. + * sysid, mntid, op, and fmode. */ void -rdu_open(rd, sysid, mntid, fmode) - register rcvd_t *rd; - register sysid_t sysid; - register long mntid; - register int fmode; +rdu_open(rd, sysid, mntid, op, fmode) + register rcvd_t *rd; + register sysid_t sysid; + register long mntid; + register int op; + register int fmode; { - rd_user_t *rdup; - - ASSERT(fmode & (FREAD | FWRITE)); + rd_user_t *rdup; rdup = rdu_find(rd, sysid, mntid, (rd_user_t **)NULL); ASSERT(rdup); - - if ((fmode & (FREAD | FWRITE)) == (FREAD | FWRITE)) { - rdup->ru_frwcnt++; - } else if (fmode & FREAD) { - rdup->ru_frcnt++; - } else { + rdup->ru_fcount++; + if (op == RFOPEN) { + /* + * for fifo case, bump reader/writer counts + */ + if (rd->rd_vp->v_type == VFIFO) { + if (fmode & FREAD) { + rdup->ru_frcnt++; + } + if (fmode & FWRITE) { + rdup->ru_fwcnt++; + } + } + } else if (op == RFCREATE && rd->rd_vp->v_type == VFIFO) { rdup->ru_fwcnt++; } } /* - * A client is giving up nrefs references to this RD in srmount structure - * denoted by sysid and mntid; decrement count in rd_user struct by nrefs. - * If it goes to zero, free it. + * rdu_close() decrements file, read and write counts for the given + * rd, rduser, and file mode. + */ +void +rdu_close(rd, sysid, mntid, fmode) + register rcvd_t *rd; + register sysid_t sysid; + register long mntid; + register long fmode; +{ + rd_user_t *rdup; + + rdup = rdu_find(rd, sysid, mntid, (rd_user_t **)NULL); + ASSERT(rdup); + rdup->ru_fcount--; + if (rd->rd_vp->v_type == VFIFO) { + if (fmode & FREAD) { + rdup->ru_frcnt--; + } + if (fmode & FWRITE) { + rdup->ru_fwcnt--; + } + } + return; +} + +/* + * A client is giving up a reference to this RD in srmount structure + * denoted by sysid and mntid; decrement count in rd_user struct. + * If count in rd_user struct goes to zero, free it. */ void -rdu_del(rdp, sysid, mntid, nrefs) +rdu_del(rdp, sysid, mntid) register rcvd_t *rdp; register sysid_t sysid; register long mntid; - register int nrefs; { rd_user_t *rdup; rd_user_t *pred_rdup; - vnode_t *vp = rdp->rd_vp; - ASSERT(rdp->rd_user_list); + ASSERT(rdp->rd_user_list); /* no users to delete */ rdup = rdu_find(rdp, sysid, mntid, &pred_rdup); - ASSERT(rdup); - if ((rdup->ru_vcount -= nrefs)) { + ASSERT(rdup); /* no users to delete */ + if (--rdup->ru_vcount) { return; } - /* - * Undo any outstanding opens. - */ - while (rdup->ru_frwcnt--) { - VOP_CLOSE(vp, FWRITE | FREAD, 1, 0, u.u_cred); - } - while (rdup->ru_frcnt--) { - VOP_CLOSE(vp, FREAD, 1, 0, u.u_cred); - } - while (rdup->ru_fwcnt--) { - VOP_CLOSE(vp, FWRITE, 1, 0, u.u_cred); - } - - /* - * Remove any remaining mappings. - */ - rfm_lock(rdup); - if (!LS_ISEMPTY(&rdup->ru_mapdlist)) { - rfm_empty(rdup, vp); - } - rfm_unlock(rdup); - - /* last reference - get rid of rd_user */ + /* last reference - get rid of rd_user struct */ if (rdup == rdp->rd_user_list) { rdp->rd_user_list = rdup->ru_next; } else { @@ -1670,8 +1521,6 @@ rf_dequeue(rd) mblk_t *result; slevel = splstr(); - ASSERT(!rd->rd_qslp++); - result = (mblk_t *)LS_REMQUE(&rd->rd_rcvdq); rd->rd_qcnt--; if (RCVDEMP(rd) && rd->rd_qtype & RDGENERAL) { @@ -1680,8 +1529,6 @@ rf_dequeue(rd) */ rfsr_rmmsg(rd); } - - ASSERT(!--rd->rd_qslp); splx(slevel); return result; } @@ -1708,7 +1555,6 @@ rf_comminit() maxserve); } for (nrd = 0; nrd < nrduser - 1; nrd++) { - LS_INIT(&rd_user[nrd].ru_mapdlist); rd_user[nrd].ru_next = &rd_user[nrd+1]; } if (nrduser >= 1) { @@ -1722,7 +1568,6 @@ rf_comminit() cmn_err(CE_WARN, "minserve changed to %d (maxserve)\n", minserve); } - LS_INIT(&sd_freelist); { register sndd_t *endsndd = sndd + nsndd; @@ -1735,13 +1580,12 @@ rf_comminit() } } sd_nfree = nsndd; - { register rcvd_t *endrcvd = rcvd + nrcvd; for (rd = rcvd; rd < endrcvd; rd++) { rd->rd_stat = RDUNUSED; - rd->rd_gen = 0; + rd->rd_connid = 0; rd->rd_next = rd + 1; } } @@ -1750,19 +1594,17 @@ rf_comminit() rd_nfree = nrcvd; /* create well-known RDs & SDs */ - (void)rcvd_create(TRUE, RDGENERAL, &mountrd); (void)rcvd_create(TRUE, RDGENERAL, &sigrd); /* signals */ - (void)rcvd_create(TRUE, RDSPECIFIC, &rf_daemon_rd); /* rf_daemon */ - + (void)rcvd_create(TRUE, RDSPECIFIC, &rf_daemon_rd); /* rf_recovery */ /* * Use a tmp so that rcvd_create correctly updates rd_freelist and * rd_nfree. */ - (void)rcvd_create(TRUE, RDSPECIFIC, &tmprdp); reserved_rd = tmprdp; (void)sndd_create(TRUE, &reserved_sd); + connid = 0; return 0; } @@ -1782,10 +1624,8 @@ rf_commdinit() rcvd_free(&mountrd); rcvd_free(&sigrd); rcvd_free(&rf_daemon_rd); - reserved_rd->rd_stat = RDUSED; reserved_rd = NULL; rcvd_free(&tmp_res_rd); - reserved_sd->sd_stat = SDUSED; reserved_sd = NULL; sndd_free(&tmp_res_sd); @@ -1810,8 +1650,8 @@ rf_commdinit() /* * Put arriving message in right rcvd queue. - * Because it is sometimes called out of streams queue scheduling, - * it protects itself with splstr(). + * This assumes it is called out of streams queue scheduling, therefore + * protects itself with splstr(). */ void rf_deliver(bp) @@ -1819,22 +1659,17 @@ rf_deliver(bp) { register rf_message_t *msgp = RF_MSG(bp); register rcvd_t *rd; - int s; - extern rcvd_t *sigrd; extern int rf_daemon_flag; + int s; - s = splstr(); - -#if defined(u3b2) && !defined(lint) && !defined(CXREF) - ASSERT(ipl() >= (s & 0x1e000)); -#endif - - if ((rd = rf_gifttord(&msgp->m_dest, QPTOGP(msgp->m_queue)->version)) == - NULL || - rd->rd_stat == RDUNUSED) { - rfd_stray(bp); - splx(s); + if (msgp->m_dest < 0 || msgp->m_dest >= nrcvd || + (rd = INXTORD(msgp->m_dest))->rd_stat == RDUNUSED) { + if (!msgp->m_stat & RF_SIGNAL) { + gdp_discon("rf_deliver bad file id in header", + QPTOGP((queue_t *)msgp->m_queue)); + } + rf_freemsg(bp); return; } if (msgp->m_stat & RF_SIGNAL) { @@ -1842,19 +1677,17 @@ rf_deliver(bp) ASSERT(rd->rd_stat != RDUNUSED); } - ASSERT(!rd->rd_qslp++); + s = splstr(); LS_INIT(bp); LS_INSQUE(&rd->rd_rcvdq, bp); rd->rd_qcnt++; if (rd->rd_qtype & RDSPECIFIC) { - wakeprocs((caddr_t)&rd->rd_qslp, PRMPT); + wakeup((caddr_t)&rd->rd_qslp); } else { proc_t *found = rfsr_idle_procp; ASSERT(rfsr_nidle == rfsr_listcount(rfsr_idle_procp)); - ASSERT(!rfsr_idle_lock++); - /* * put message where it can be found and dispatch server */ @@ -1873,54 +1706,13 @@ rf_deliver(bp) rfsr_idle_procp = found->p_rlink; found->p_rlink = NULL; rfsr_nidle--; - wakeprocs((caddr_t)&found->p_srwchan, PRMPT); + wakeup((caddr_t)&found->p_srwchan); } else if (rfsr_nservers < maxserve) { rf_daemon_flag |= RFDSERVE; - wakeprocs((caddr_t)&rf_daemon_rd->rd_qslp, PRMPT); + wakeup((caddr_t)&rf_daemon_rd->rd_qslp); } - - ASSERT(!--rfsr_idle_lock); ASSERT(rfsr_nidle == rfsr_listcount(rfsr_idle_procp)); } - ASSERT(!--rd->rd_qslp); splx(s); } - -#ifdef DEBUG -/* Starting at sdp, print n sndds */ -void -sndd_print(sdp, n) - register sndd_t *sdp; - unsigned n; -{ - register sndd_t *end = sdp + n - 1; - - if (sdp < sndd || - ((caddr_t)sdp - (caddr_t)sndd) % sizeof(sndd_t) || - sdp >= end) { - cmn_err(CE_CONT, "bad args\n"); - return; - } - for (; sdp < end; sdp++) { - cmn_err(CE_CONT, "\nhash\t\t\t\tfree\n"); - cmn_err(CE_CONT, "0x%x\t0x%x\t0x%x\t0x%x\n", - sdp->sd_hash.ls_next, sdp->sd_hash.ls_prev, - sdp->sd_free.ls_next, sdp->sd_free.ls_prev); - cmn_err(CE_CONT, "size\t\tstat\t\tgift\n"); - cmn_err(CE_CONT, "0x%x\t0x%x\t0x%x\t0x%x\n", - sdp->sd_size, sdp->sd_stat, - sdp->sd_gift.gift_id, sdp->sd_gift.gift_gen); - cmn_err(CE_CONT, "mntid\t\tsrvproc\t\tqueue\t\tfhandle\n"); - cmn_err(CE_CONT, "0x%x\t0x%x\t0x%x\t0x%x\n", - sdp->sd_mntid, sdp->sd_srvproc, - sdp->sd_queue, sdp->sd_fhandle); - cmn_err(CE_CONT,"vcode\t\tmapcnt\t\tnextr\t\tstashp\n"); - cmn_err(CE_CONT, "0x%x\t0x%x\t0x%x\n", - sdp->sd_vcode, sdp->sd_nextr, sdp->sd_stashp); - cmn_err(CE_CONT, "remcnt\t\tcrwlock\t\tv_count\n"); - cmn_err(CE_CONT, "0x%x\t0x%x\t0x%x\t0x%x\n", - sdp->sd_remcnt, sdp->sd_crwlock, sdp->sd_vn.v_count); - } -} -#endif diff --git a/usr/src/uts/3b2/fs/rfs/rf_rsrc.c b/usr/src/uts/3b2/fs/rfs/rf_rsrc.c index b2af070..bbabc7b 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_rsrc.c +++ b/usr/src/uts/3b2/fs/rfs/rf_rsrc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_rsrc.c 1.3" +#ident "@(#)fs:fs/rfs/rf_rsrc.c 1.2" /* * utility routines dealing with sr_mount and rf_resource lists */ @@ -280,19 +280,18 @@ srm_free(srpp) } /* - * srm_remove removes the sr_mount structure referenced by *srpp from the - * r_mountp list of the rf_resource structure referenced by *rpp and frees - * its memory. If doing so removes the last mount of an unadvertised - * resource, that resource structure is also freed. + * srm_remove removes the sr_mount structure referenced by srp from the r_mountp + * list of the rf_resource structure referenced by *rpp and frees its memory. + * If doing so removes the last mount of an unadvertised resource, that resource + * structure is also freed. * Returns 0 for success or a non-zero errno for failure. */ int -srm_remove(rpp, srpp) - rf_resource_t **rpp; /* which resource */ - sr_mount_t **srpp; /* which mount */ +srm_remove(rpp, srp) + rf_resource_t **rpp; /* which resource */ + sr_mount_t *srp; /* which mount */ { register struct rf_resource *rp = *rpp; - sr_mount_t *srp = *srpp; if ((rp == NULL) || (srp == NULL)) return ENODEV; @@ -318,6 +317,6 @@ srm_remove(rpp, srpp) ASSERT(rp->r_queuep != NULL); } } - srm_free(srpp); + srm_free(&srp); return 0; } diff --git a/usr/src/uts/3b2/fs/rfs/rf_serve.c b/usr/src/uts/3b2/fs/rfs/rf_serve.c index ee70861..06dbeb8 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_serve.c +++ b/usr/src/uts/3b2/fs/rfs/rf_serve.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_serve.c 1.12" +#ident "@(#)fs:fs/rfs/rf_serve.c 1.7" #include "sys/types.h" #include "sys/param.h" @@ -22,12 +22,12 @@ #include "sys/list.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "sys/psw.h" #include "sys/pcb.h" #include "sys/cred.h" #include "sys/user.h" +#include "sys/rf_messg.h" #include "sys/proc.h" #include "sys/inline.h" #include "sys/cmn_err.h" @@ -40,16 +40,12 @@ #include "sys/acct.h" #include "sys/systm.h" #include "sys/kmem.h" -#include "vm/seg_kmem.h" #include "rf_auth.h" /* imports */ extern void setsigact(); extern int setjmp(); -extern rcvd_t *mountrd; -extern rcvd_t *sigrd; - #define RF_MAX_OPCODE DUIUPDATE #define ULIMSHIFT 9 /* old servers express write limit in blocks; @@ -69,23 +65,24 @@ STATIC void rfsr_ret(); void rf_serve() { - rfsr_state_t state; - register proc_t *p = u.u_procp; - int sig; + rfsr_state_t state; + register rfsr_state_t *stp = &state; + register proc_t *p = u.u_procp; + int sig; ++rfsr_nservers; p->p_cstime = p->p_stime = p->p_cutime = p->p_utime = 0; u.u_start = hrestime.tv_sec; u.u_ticks = lbolt; u.u_acflag = AFORK; - state.sr_cred = crdup(u.u_cred); + stp->sr_cred = crdup(u.u_cred); /* * rf_daemon may have issued a SIGKILL, but that would be discarded * by any server still in newproc() since the parent (rf_daemon) * ignores all signals. Exit if RFS is stopping. */ if (rf_daemon_flag & RFDKILL) { - rfsr_exit(&state); + rfsr_exit(stp); } /* @@ -123,10 +120,10 @@ rf_serve() "1ST rf_server: send descriptor pre-alloc failed\n"); } u.u_srchan = NULL; - rfsr_exit(&state); + rfsr_exit(stp); } bcopy("rf_server", u.u_comm, sizeof("rf_server")); - state.sr_in_bp = NULL; + stp->sr_in_bp = NULL; u.u_syscall = 0; for (;;) { register sndd_t *srchan = u.u_srchan; @@ -163,69 +160,58 @@ rf_serve() sizeof(*p->p_curinfo)); } } - ASSERT(!state.sr_in_bp); + ASSERT(!stp->sr_in_bp); /* * rfsr_rcvmsg won't return if too many servers, or * no messages, or signal. */ - rfsr_rcvmsg(&state.sr_in_bp, srchan, &state); + rfsr_rcvmsg(&stp->sr_in_bp, srchan, stp); newmblk: bcopy ("RF_SERVER", u.u_psargs, sizeof("RF_SERVER")); - msg = RF_MSG(state.sr_in_bp); - req = RF_REQ(state.sr_in_bp); - cop = RF_COM(state.sr_in_bp); + msg = RF_MSG(stp->sr_in_bp); + req = RF_REQ(stp->sr_in_bp); + cop = RF_COM(stp->sr_in_bp); req->rq_ulimit <<= ULIMSHIFT; - state.sr_gift = NULL; - if (!(state.sr_rdp = - rf_gifttord(&msg->m_dest, state.sr_vcver))) { - rfd_stray(state.sr_in_bp); - state.sr_in_bp = NULL; - rfsr_rmactive(p); - continue; - } - - ASSERT(state.sr_rdp->rd_qtype == RDSPECIFIC || - state.sr_rdp == mountrd || state.sr_rdp == sigrd || - state.sr_rdp->rd_vp); - - state.sr_qp = (queue_t *)msg->m_queue; - state.sr_gdpp = QPTOGP(state.sr_qp); - state.sr_vcver = state.sr_gdpp->version; - state.sr_opcode = cop->co_opcode; - state.sr_ret_val = 0; - state.sr_out_bp = NULL; + stp->sr_gift = NULL; + stp->sr_rdp = INXTORD(msg->m_dest); + stp->sr_qp = (queue_t *)msg->m_queue; + stp->sr_gdpp = QPTOGP(stp->sr_qp); + stp->sr_vcver = stp->sr_gdpp->version; + stp->sr_opcode = cop->co_opcode; + stp->sr_ret_val = 0; + stp->sr_out_bp = NULL; error = 0; rfsr_ctrl = SR_NORMAL; /* * gag - still needed, but only for sanity * check in rcopyin/rcopyout */ - u.u_syscall = state.sr_opcode; + u.u_syscall = stp->sr_opcode; p->p_epid = cop->co_pid; /* * Set sysid to index of stream where message came from. * In case of SRMOUNT, sysid won't be set up until * rfsr_mount(). */ - p->p_sysid = state.sr_gdpp->sysid; - state.sr_cred->cr_uid = state.sr_cred->cr_ruid = - gluid(state.sr_gdpp, cop->co_uid); - state.sr_cred->cr_gid = state.sr_cred->cr_rgid = - glgid(state.sr_gdpp, cop->co_gid); - if (state.sr_vcver > RFS1DOT0) { + p->p_sysid = stp->sr_gdpp->sysid; + stp->sr_cred->cr_uid = stp->sr_cred->cr_ruid = + gluid(stp->sr_gdpp, cop->co_uid); + stp->sr_cred->cr_gid = stp->sr_cred->cr_rgid = + glgid(stp->sr_gdpp, cop->co_gid); + if (stp->sr_vcver > RFS1DOT0) { ushort gn; - rfsr_adj_timeskew(state.sr_gdpp, + rfsr_adj_timeskew(stp->sr_gdpp, req->rq_sec, req->rq_nsec); - state.sr_cred->cr_ngroups = - (ushort)MIN(state.sr_gdpp->ngroups_max, + stp->sr_cred->cr_ngroups = + (ushort)MIN(stp->sr_gdpp->ngroups_max, req->rq_ngroups); - for (gn = 0; gn < state.sr_cred->cr_ngroups; gn++) { - state.sr_cred->cr_groups[gn] = - glgid(state.sr_gdpp, req->rq_groups[gn]); + for (gn = 0; gn < stp->sr_cred->cr_ngroups; gn++) { + stp->sr_cred->cr_groups[gn] = + glgid(stp->sr_gdpp, req->rq_groups[gn]); } } else { - state.sr_cred->cr_ngroups = 0; + stp->sr_cred->cr_ngroups = 0; } srchan->sd_srvproc = p; /* keep number of servers w/in bounds */ @@ -233,7 +219,7 @@ rf_serve() psignal(p, SIGUSR1); } else if (rfsr_nidle == 0 && rfsr_nservers < maxserve) { rf_daemon_flag |= RFDSERVE; - wakeprocs((caddr_t)&rf_daemon_rd->rd_qslp, PRMPT); + wakeup((caddr_t)&rf_daemon_rd->rd_qslp); } if (msg->m_stat & RF_SIGNAL) { /* @@ -242,32 +228,31 @@ rf_serve() */ psignal(p, SIGTERM); } - if (state.sr_opcode < 0 || state.sr_opcode > RF_MAX_OPCODE) { - (void)rfsr_undef_op(&state, &rfsr_ctrl); + if (stp->sr_opcode < 0 || stp->sr_opcode > RF_MAX_OPCODE) { + (void)rfsr_undef_op(stp, &rfsr_ctrl); rfsr_rmactive(p); continue; } /* * fail if resource is in funny state - e.g., in fumount */ - if (state.sr_opcode != RFMOUNT && state.sr_opcode != RFUSTAT) { + if (stp->sr_opcode != RFMOUNT && stp->sr_opcode != RFUSTAT) { /* See if resource is fumounted. Note that this * is ONLY PROBABLISTIC with respect to forgeries */ - if ((state.sr_rsrcp = ind_to_rsc(srchan->sd_mntid)) + if ((stp->sr_rsrcp = ind_to_rsc(srchan->sd_mntid)) == NULL || - (state.sr_srmp = id_to_srm(state.sr_rsrcp, - state.sr_gdpp->sysid)) == NULL || - state.sr_srmp->srm_flags & SRM_FUMOUNT){ - SR_FREEMSG(&state); - if (state.sr_opcode != RFCLOSE) { + (stp->sr_srmp = id_to_srm(stp->sr_rsrcp, + stp->sr_gdpp->sysid)) == NULL || + stp->sr_srmp->srm_flags & SRM_FUMOUNT){ + SR_FREEMSG(stp); + if (stp->sr_opcode != RFCLOSE && + stp->sr_opcode != RFINACTIVE) { error = EACCES; } rfsr_rmactive(p); - if (state.sr_opcode != RFRSIGNAL && - state.sr_vcver < RFS2DOT0 || - state.sr_opcode != RFINACTIVE) { - rfsr_ret(&state, SR_NORMAL, error); + if (stp->sr_opcode != RFRSIGNAL) { + rfsr_ret(stp, SR_NORMAL, error); } continue; } @@ -278,27 +263,21 @@ rf_serve() */ if (setjmp(&u.u_qsav)) { error = rfsr_sigck(&rfsr_ctrl, EINTR); - if (state.sr_vcver > RFS1DOT0 && - state.sr_opcode == RFINACTIVE) { - rf_deliver(state.sr_in_bp); - state.sr_in_bp = NULL; - } else { - rfsr_ret(&state, rfsr_ctrl, error); - } rfsr_rmactive(p); + rfsr_ret(stp, rfsr_ctrl, error); } else { - error = - (*rfsr_ops[state.sr_opcode])(&state, &rfsr_ctrl); + error = (*rfsr_ops[stp->sr_opcode])(stp, &rfsr_ctrl); switch(rfsr_ctrl){ case SR_NORMAL: if (!error) { - if (!state.sr_out_bp) { - state.sr_out_bp = + if (!stp->sr_out_bp) { + stp->sr_out_bp = rfsr_rpalloc((size_t)0, - state.sr_vcver); + stp->sr_vcver); } - if (!state.sr_gift && state.sr_out_bp) { - error = rfsr_cacheck(&state, + if (stp->sr_vcver > RFS1DOT0 && + !stp->sr_gift) { + error = rfsr_cacheck(stp, srchan->sd_mntid); } } @@ -307,14 +286,10 @@ rf_serve() case SR_NACK_RESP: error = rfsr_sigck(&rfsr_ctrl, error); rfsr_rmactive(p); - rfsr_ret(&state, rfsr_ctrl, error); + rfsr_ret(stp, rfsr_ctrl, error); continue; case SR_NO_RESP: rfsr_rmactive(p); - if (state.sr_out_bp) { - rf_freemsg(state.sr_out_bp); - state.sr_out_bp = NULL; - } continue; case SR_OUT_OF_BAND: goto newmblk; @@ -385,7 +360,7 @@ rfsr_ret(stp, rfsr_ctrl, error) */ stp->sr_srmp->srm_slpcnt--; if (!stp->sr_srmp->srm_slpcnt) { - wakeprocs((caddr_t)stp->sr_srmp, PRMPT); + wakeup((caddr_t)stp->sr_srmp); } } stp->sr_out_bp = NULL; diff --git a/usr/src/uts/3b2/fs/rfs/rf_serve.h b/usr/src/uts/3b2/fs/rfs/rf_serve.h index 71d5843..6bc33df 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_serve.h +++ b/usr/src/uts/3b2/fs/rfs/rf_serve.h @@ -8,7 +8,7 @@ #ifndef _FS_RFS_SERVE_H #define _FS_RFS_SERVE_H -#ident "@(#)fs:fs/rfs/rf_serve.h 1.9" +#ident "@(#)fs:fs/rfs/rf_serve.h 1.4.1.1" /* * Declarations internal to the RFS/DUFST server * @@ -120,13 +120,7 @@ extern int rsubyte(); extern int rsuword(); extern mblk_t *rfsr_rpalloc(); extern int rfsr_lastdirents(); -extern int rfsr_j_accuse(); -extern int rfm_addmap(); -extern int rfm_check(); -extern void rfm_delmap(); -extern void rfm_empty(); -extern void rfm_lock(); -extern void rfm_unlock(); +extern int rfsr_discon(); extern void rf_serve(); /* main program of RFS server */ @@ -151,10 +145,4 @@ extern int rfsr_nactive; extern int rfsr_nservers; /* total number of servers */ -#ifdef DEBUG -extern int rfsr_idle_lock; -extern int rfsr_active_lock; -extern int rfsr_msg_lock; -#endif - #endif /* _FS_RFS_SERVE_H */ diff --git a/usr/src/uts/3b2/fs/rfs/rf_sys.c b/usr/src/uts/3b2/fs/rfs/rf_sys.c index e0117a2..4936669 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_sys.c +++ b/usr/src/uts/3b2/fs/rfs/rf_sys.c @@ -5,7 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rf_sys.c 1.4.2.12" +#ident "@(#)fs:fs/rfs/rf_sys.c 1.4.3.1" + /* * System calls for remote file sharing. */ @@ -26,8 +27,8 @@ #include "sys/vfs.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" +#include "sys/rf_messg.h" #include "sys/rf_debug.h" #include "sys/debug.h" #include "sys/rf_adv.h" @@ -47,8 +48,6 @@ #include "rf_auth.h" #include "sys/dirent.h" #include "sys/cred.h" -#include "sys/buf.h" -#include "vm/page.h" #include "rf_cache.h" #include "sys/file.h" #include "rfcl_subr.h" @@ -56,13 +55,26 @@ #include "sys/kmem.h" #include "rf_serve.h" +#ifdef RFSUNMOUNTHACK +/* + * capability to get at otherwise unreachable file systems + * + * 0 ucap reserved for kernel use. ucaps are not inheritable + * across forks. They are expired on using them for an unmount. + */ +typedef struct rfsys_cap { + struct rfsys_cap *c_next; + struct rfsys_cap *c_prev; + int c_ucap; /* user manifestation */ + pid_t c_pid; /* of allocating proc */ + vnode_t *c_vp; /* vp in rf_vfs */ +} rfsys_cap_t; +#endif + char rfs_domain[MAXDNAME+1] = ""; /* domain name for this machine */ STATIC int rf_vflg = 0; /* require (1) host verification * or not (0) */ -STATIC int rfud_lastumsg; - -STATIC int rfs_vhigh = RFS2DOT0; -STATIC int rfs_vlow = RFS1DOT0; +STATIC int rfud_lastumsg; extern int rfs_vhigh; extern int rfs_vlow; @@ -70,13 +82,22 @@ extern int rf_state; extern int nsrmount; extern ls_elt_t rf_umsgq; /* queue for user-level daemon */ extern int rf_umsgcnt; /* length of rf_umsgq */ +extern int rf_recovery_flag; /* set KILL bit to kill rf_recovery */ +extern proc_t *rf_recovery_procp; /* sleep address for rf_recovery */ extern int nsndd; +extern int rf_daemon_flag; +extern rcvd_t *rf_daemon_rd; /* imports */ extern int dofusers(); extern int dounmount(); extern int strprefix(); +#ifdef RFSUNMOUNTHACK +/* exports */ +extern int rf_putcap(); +#endif + STATIC int rfsys_fumount(); STATIC int rfsys_sendumsg(); STATIC int rfsys_getumsg(); @@ -97,7 +118,20 @@ STATIC int rfsys_start(); STATIC int rfsys_stop(); STATIC int rfsys_debug(); -STATIC void rf_fuserve(); +#ifdef RFSUNMOUNTHACK +STATIC int rfsys_getcap(); +STATIC int rfsys_putcap(); +STATIC int rfsys_submnts(); +STATIC int rfsys_fusers(); +STATIC int rfsys_unmount(); +STATIC int rf_vfsincaplist(); + +STATIC rfsys_cap_t *rf_findcap(); +STATIC int rf_alloccap(); +#endif + +STATIC void rf_fuserve(); +STATIC void rf_memfree(); /* * nadvertise is the number of resources currently advertised. @@ -154,6 +188,18 @@ rfsys(uap, rvp) return rfsys_stop(uap, rvp); case RF_DEBUG: return rfsys_debug(uap, rvp); +#ifdef RFSUNMOUNTHACK + case RF_GETCAP: + return rfsys_getcap(uap, rvp); + case RF_PUTCAP: + return rfsys_putcap(uap, rvp); + case RF_SUBMNTS: + return rfsys_submnts(uap, rvp); + case RF_FUSERS: + return rfsys_fusers(uap, rvp); + case RF_UNMOUNT: + return rfsys_unmount(uap, rvp); +#endif default: return EINVAL; } @@ -214,16 +260,10 @@ rfsys_fumount(uap, rvp) error = EADV; goto out; } - if (rscp->r_flags & R_FUMOUNT) { - DUPRINT1(DB_MNT_ADV, "rfsys_fumount: already fumounted\n"); - error = EINVAL; - goto out; - } rscp->r_flags |= R_FUMOUNT; DUPRINT2(DB_MNT_ADV, "rfsys_fumount: vnode %x\n", rscp->r_rootvp); (void)sndd_create(FALSE, &sdp); (void)rcvd_create(FALSE, RDSPECIFIC, &rd); - rd->rd_sdp = sdp; srp = rscp->r_mountp; while (srp) { sr_mount_t *nextsrp = srp->srm_nextp; @@ -236,10 +276,10 @@ rfsys_fumount(uap, rvp) RF_MIN_REQ(QPTOGP(client)->version); ASSERT(client); - sndd_set(sdp, client, &rf_daemon_gift); + sndd_set(sdp, client, RECOVER_RD); rf_signal_serve(rscp->r_mntid, srp); - (void)rf_allocmsg(bufsize, (size_t)0, BPRI_MED, FALSE, - NULLCADDR, NULLFRP, &bp); + (void)rf_allocmsg(bufsize, (size_t)0, BPRI_MED, FALSE, NULLCADDR, + NULLFRP, &bp); ASSERT(bp); cop = RF_COM(bp); RF_REQ(bp)->rq_rec_fumount.srmntid = rscp->r_mntid; @@ -250,7 +290,9 @@ rfsys_fumount(uap, rvp) && (tmperr = rf_rcvmsg(rd, &in_bp)) == 0) { rf_fuserve(rscp->r_mntid); srp->srm_flags |= SRM_FUMOUNT; - wakeprocs((caddr_t)client->q_ptr, PRMPT); + wakeup((caddr_t)client->q_ptr); + rf_recovery_flag |= RFRECFUMOUNT; + wakeup((caddr_t)&rf_recovery_procp); rf_freemsg(in_bp); in_bp = NULL; } else { @@ -258,8 +300,6 @@ rfsys_fumount(uap, rvp) } srp = nextsrp; } - rf_recovery_flag |= RFRECFUMOUNT; - wakeprocs((caddr_t)&rf_recovery_procp, PRMPT); out: sndd_free(&sdp); rcvd_free(&rd); @@ -281,10 +321,10 @@ rf_fuserve(srm_mntid) if (ACTIVE_SRD(rd) && rd->rd_vp && (((sndd_t *)(rd->rd_vp))->sd_stat & SDSERVE) && ((sndd_t *)(rd->rd_vp))->sd_mntid == srm_mntid) { - DUPRINT1(DB_MNT_ADV, "rfsys_fumount: waking server\n"); + DUPRINT1(DB_MNT_ADV, "rfsys_fumount: waking server \n"); rd->rd_stat |= RDLINKDOWN; rf_checkq(rd, srm_mntid); - wakeprocs((caddr_t)&rd->rd_qslp, PRMPT); + wakeup((caddr_t)&rd->rd_qslp); } } } @@ -324,14 +364,11 @@ rfsys_sendumsg(uap, rvp) if (datasz > ULINESIZ) { return EINVAL; } - if (rf_state != RF_UP) { - return ENONET; - } if ((cl_queue = gdp_sysidtoq((sysid_t)smp->cl_sysid)) == NULL) { return ECOMM; } (void)sndd_create(FALSE, &chansdp); - sndd_set(chansdp, cl_queue, &rf_daemon_gift); + sndd_set(chansdp, cl_queue, RECOVER_RD); vcver = QPTOGP(chansdp->sd_queue)->version; rqsz = RF_MIN_REQ(vcver); totalsz = rqsz + datasz; @@ -381,10 +418,6 @@ rfsys_getumsg(uap, rvp) if (!suser(u.u_cred)) { return EPERM; } - if (rf_state != RF_UP) { - rvp->r_val1 = RFUD_LASTUMSG; - return 0; - } s = splstr(); while ((bp = (mblk_t *)LS_REMQUE(&rf_umsgq)) == NULL) { if (sleep((caddr_t)&rf_daemon_lock, PZERO + 1 | PCATCH)) { @@ -402,6 +435,9 @@ rfsys_getumsg(uap, rvp) splx(s); rvp->r_val1 = RFUD_LASTUMSG; return 0; + } else if (LS_ISEMPTY(&rf_umsgq)) { + cmn_err(CE_NOTE, + "rfsys_getumsg awakened with empty queue"); } } splx(s); @@ -437,11 +473,8 @@ rfsys_lastumsg(uap, rvp) if (!suser(u.u_cred)) { return EPERM; } - if (rf_state != RF_UP) { - return ENONET; - } rfud_lastumsg = 1; - wakeprocs((caddr_t)&rf_daemon_lock, PRMPT); + wakeup((caddr_t)&rf_daemon_lock); return 0; } @@ -578,11 +611,14 @@ rfsys_setidmap(uap, rvp) rval_t *rvp; { rfsys_setidmapa_t *sap = (rfsys_setidmapa_t *)uap; + int error; if (!suser(u.u_cred)) { return EPERM; } - return rf_setidmap(sap->name, sap->flag, sap->map, u.u_cred); + error = rf_setidmap(sap->name, sap->flag, + sap->map, u.u_cred); + return error; } /* @@ -673,7 +709,7 @@ rfsys_version(uap, rvp) } /* - * Return the current runstate of RFS. + * Return the curren runstate of RFS. */ /* ARGSUSED */ STATIC int @@ -747,9 +783,6 @@ rfsys_clients(uap, rvp) struct client client; char rsrc_name[RFS_NMSZ]; - if (rf_state != RF_UP) { - return ENONET; - } if (error = copyinstr(clap->rscnmp, rsrc_name, RFS_NMSZ, &cpin_count)) { return error; } @@ -809,9 +842,6 @@ rfsys_resources(uap, rvp) register rf_resource_t *endrsc = (rf_resource_t *)&rf_resource_head; - if (rf_state != RF_UP) { - return ENONET; - } rsbp = rap->rsbufp; while (rsrcp != endrsc) { if (!(rsrcp->r_flags & R_FUMOUNT)) { @@ -841,7 +871,8 @@ rfsys_start(uap, rvp) rval_t *rvp; { int s; - register proc_t *p; + register proc_t **p; + register proc_t **endproc = v.ve_proc; pid_t childpid; /* newproc out arg */ int error = 0; size_t datasz = MIN(PAGESIZE, DU_DATASIZE); @@ -852,13 +883,12 @@ rfsys_start(uap, rvp) if (!suser(u.u_cred)) { return EPERM; } - /* * Implicit assumption made explicit. * TO DO: * These should be based on canonical representations. Others??? */ - + rfud_lastumsg = 0; if (datasz < sizeof(flock_t) || datasz < sizeof(o_flock_t) || datasz < sizeof(rf_attr_t) @@ -866,102 +896,142 @@ rfsys_start(uap, rvp) || datasz < sizeof(struct statfs) || datasz < sizeof(struct statvfs) || datasz < RF_MAXDIRENT) { - cmn_err(CE_NOTE, "rfsys_start: RF_DATASIZE too small"); + cmn_err(CE_NOTE, + "rftart: faulty implementation, RF_DATASIZE too small"); return ENOSYS; } - - if (!sndd) { - - /* NULLed by rf_init */ - - cmn_err(CE_NOTE, "rfsys_start: no memory configured"); - return ENOSYS; - } - while (rf_state == RF_INTER) { sleep((caddr_t)&rf_state, PREMOTE); } - - /* This is a critical section that ends in rf_daemon. */ - + /* This is a critical section. Only one process at a time + * can execute this code. + */ if (rf_state == RF_UP) { - DUPRINT1 (DB_RFSTART, "rfsys_start: system already booted\n"); - wakeprocs((caddr_t)&rf_state, PRMPT); + DUPRINT1 (DB_RFSTART, "rftart: system already booted\n"); + wakeup((caddr_t)&rf_state); return EEXIST; } - rf_state = RF_INTER; /* RFS in an intermediate state */ - rfud_lastumsg = 0; - if (rf_comminit()) { rf_state = RF_DOWN; - wakeprocs((caddr_t)&rf_state, PRMPT); + wakeup((caddr_t)&rf_state); return EAGAIN; /* compatability */ } - DUPRINT1(DB_RFSTART, "rfsys_start comm initialized\n"); - + DUPRINT1(DB_RFSTART, "comm initialized\n"); auth_init(); if (error = gdp_init()) { - DUPRINT2 (DB_RFSTART, "rfsys_start gdp_init error %d\n", error); + DUPRINT2 (DB_RFSTART, "rfstart gdp_init error %d\n", error); rf_commdinit(); rf_state = RF_DOWN; - wakeprocs((caddr_t)&rf_state, PRMPT); + wakeup((caddr_t)&rf_state); return error; } - DUPRINT1(DB_RFSTART, "rfsys_start gdp initialized\n"); - - /* enable caching */ - + DUPRINT1(DB_RFSTART, "gdp initialized\n"); + /* + * enable caching + */ if (rc_time != -1) { rfc_time = rc_time * HZ; } else { rfc_time = -1; } - /* * Newproc sets child's pid in out arg; caller * normally passes in &rvp->r_val1, but we don't want * to return it */ - u.u_procp->p_flag |= SNOWAIT; - switch (newproc(NP_FAILOK | NP_NOLAST | NP_SYSPROC, &childpid, &error)) { case 0: break; case 1: - + u.u_procp->p_cstime = u.u_procp->p_stime = + u.u_procp->p_cutime = u.u_procp->p_utime = 0; + rf_recovery_procp = u.u_procp; + rf_memfree(); + bcopy("rf_recovery", u.u_comm, sizeof("rf_recovery")); + bcopy("rf_recovery", u.u_psargs, sizeof("rf_recovery")); + rf_recovery(); + /* NOTREACHED */ + break; + default: + DUPRINT1 (DB_RFSTART, "rftart: cannot fork rf_recovery\n"); + rf_commdinit(); + rf_state = RF_DOWN; + wakeup((caddr_t)&rf_state); + return EAGAIN; + } + switch (newproc(NP_FAILOK | NP_NOLAST | NP_SYSPROC, + &childpid, &error)) { + case 0: + break; + case 1: + u.u_procp->p_cstime = u.u_procp->p_stime = + u.u_procp->p_cutime = u.u_procp->p_utime = 0; + rf_daemon_procp = u.u_procp; + rf_memfree(); + bcopy("rf_daemon", u.u_comm, sizeof("rf_daemon")); + bcopy("rf_daemon", u.u_psargs, sizeof("rf_daemon")); /* - * rf_daemon forks new processes when more daemons are - * required, then returns the function to execute. - * The call is from here so that the stack is smaller. + * The following is not pretty. rf_daemon forks new + * processes when more servers are required. Each + * new child returns here and becomes a server. The + * call is from here so that the stack is smaller. */ - - (*rf_daemon())(); - + rf_daemon(); + rf_serve(); /* only reached if rf_daemon has forked */ /* NOTREACHED */ break; default: - cmn_err(CE_WARN, "rfsys_start: cannot fork rf_daemon\n"); + DUPRINT1 (DB_RFSTART, "rftart: cannot fork rf_daemon\n"); rf_commdinit(); + rf_recovery_flag |= RFRECKILL; + wakeup((caddr_t)&rf_recovery_procp); return EAGAIN; } - /* now allow advertise calls, set all sysid's in proc table */ - s = spl6(); - for (p = practive; p; p = p->p_next) { - p->p_sysid = 0; + for (p = &nproc[0]; p < endproc; p++) { + if (*p) { + (*p)->p_sysid = 0; + } } splx(s); - /* initialize server "device" table */ + /* initialize server device table */ rfsr_dev_init(); return error; } +/* + * Release user memory for proc forked from user proc, but which + * stays in kernel. Also give up unneeded directory references, + * close files. + */ +STATIC void +rf_memfree() +{ + register int i; + file_t *fp; + + relvm(u.u_procp); + VN_RELE(u.u_cdir); + u.u_cdir = rootdir; + VN_HOLD(u.u_cdir); + if (u.u_rdir) { + VN_RELE(u.u_rdir); + } + u.u_rdir = NULL; + for (i = 0; i < u.u_nofiles; i++) { + if (getf(i, &fp) == 0) { + closef(fp); + setf(i, NULLFP); + } + } +} + /* * Stop remote file sharing if everything is quiet. */ @@ -978,62 +1048,59 @@ rfsys_stop(uap, rvp) if (!suser(u.u_cred)) { return EPERM; } - - /* Critical section as in rfsys_start. */ - + /* + * Begin critical section. As in rftart, only one process at a time + * through this section of code. + */ while (rf_state == RF_INTER) { sleep((caddr_t)&rf_state, PREMOTE); } if (rf_state == RF_DOWN) { DUPRINT1(DB_RFSTART, "rfsys_stop: system already stopped\n"); - wakeprocs((caddr_t)&rf_state, PRMPT); + wakeup((caddr_t)&rf_state); return ENONET; } rf_state = RF_INTER; - /* can't stop if anything is remotely mounted */ - + /* + * can't stop if anything is remotely mounted + */ while (vfsp) { if (ISRFSVFSP(vfsp)) { DUPRINT1 (DB_RFSTART, "rfsys_stop: can't stop with remote mounts.\n"); rf_state = RF_UP; - wakeprocs((caddr_t)&rf_state, PRMPT); + wakeup((caddr_t)&rf_state); return EBUSY; } vfsp = vfsp->vfs_next; } - while (rsrcp != (struct rf_resource*)&rf_resource_head) { if (rsrcp->r_mountp) { DUPRINT1 (DB_RFSTART, "rfsys_stop: can't stop with clients."); rf_state = RF_UP; - wakeprocs((caddr_t)&rf_state, PRMPT); + wakeup((caddr_t)&rf_state); return ESRMNT; } if (!(rsrcp->r_flags & R_UNADV)) { DUPRINT1 (DB_RFSTART, "rfsys_stop: can't stop with advertised resources.\n"); rf_state = RF_UP; - wakeprocs((caddr_t)&rf_state, PRMPT); + wakeup((caddr_t)&rf_state); return EADV; } rsrcp = rsrcp->r_nextp; } - - rfud_lastumsg = 1; - wakeprocs((caddr_t)&rf_daemon_lock, PRMPT); - - DUPRINT1(DB_RFSTART, "rfsys_stop: taking down links\n"); + DUPRINT1(DB_RFSTART, "rfsys_stop: taking down links \n"); gdp_kill(); /* cut all connections */ /* kill daemons - rf_state goes to DOWN after both die */ - - DUPRINT1(DB_RFSTART, "rfsys_stop: killing daemon\n"); + DUPRINT1(DB_RFSTART, "rfsys_stop: killing daemons \n"); rf_daemon_flag |= RFDKILL; - wakeprocs((caddr_t)&rf_daemon_rd->rd_qslp, PRMPT); - + wakeup((caddr_t)&rf_daemon_rd->rd_qslp); + rf_recovery_flag |= RFRECKILL; + wakeup((caddr_t)&rf_recovery_procp); DUPRINT1(DB_RFSTART, "rfsys_stop: done\n"); return 0; } @@ -1163,13 +1230,13 @@ rfsys_advfs(uap, rvp) error = EREMOTE; goto bad; } - +#ifndef UNNECESSARYRESTRICTION if (vp->v_type != VDIR) { /* the specified path name was not a directory */ error = ENOTDIR; goto bad; } - +#endif /* * if the file system containing the specified directory was mounted * read only, the advertisement must be read only. @@ -1179,7 +1246,7 @@ rfsys_advfs(uap, rvp) goto bad; } if ((rp = vp_to_rsc(vp)) != NULL) { - if (rp->r_flags & R_FUMOUNT || !(rp->r_flags & R_UNADV)) { + if (!(rp->r_flags & R_UNADV)) { /* already advertised */ error = EADV; goto bad; @@ -1249,15 +1316,8 @@ rfsys_advfs(uap, rvp) /* * allocate a general receive descriptor for the resource */ - if ((giftrd = vtord(vp)) == NULL) { - if ((error = rcvd_create(TRUE, RDGENERAL, &giftrd)) != 0) { - goto bad; - } - giftrd->rd_vp = vp; - VN_HOLD(vp); /* this will be released by rcvd_free */ - } else { - ASSERT(giftrd->rd_vp == vp); - giftrd->rd_refcnt++; + if (error = rcvd_create(TRUE, RDGENERAL, &giftrd)) { + goto bad; } /* * insertrsc finds the next free resource index value, assigning @@ -1271,6 +1331,7 @@ rfsys_advfs(uap, rvp) newrp->r_flags = advp->flag & A_RDONLY; /* 0 or A_RDONLY */ newrp->r_rootvp = vp; strcpy(newrp->r_name, adv_name); + giftrd->rd_vp = vp; newrp->r_queuep = giftrd; DUPRINT2(DB_MNT_ADV, "exit adv: error is %d\n", error); nadvertise++; @@ -1283,9 +1344,7 @@ rfsys_advfs(uap, rvp) if (newrp) { freersc(&newrp); } - if (giftrd) { - rcvd_delete(&giftrd, 0, -1, 1); - } + rcvd_free(&giftrd); return error; } @@ -1329,16 +1388,12 @@ rfsys_unadvfs(uap, rvp) if ((rp = name_to_rsc(adv_name)) == NULL) { /* not advertised */ return ENODEV; } - if (rp->r_flags & R_FUMOUNT || rp->r_flags & R_UNADV) { - /* - * has already been unadvertised - */ + if (rp->r_flags & R_UNADV) { /* has already been unadvertised */ return ENODEV; } rp->r_flags |= R_UNADV; /* mark this as unadvertised */ - rcvd_delete(&rp->r_queuep, (sysid_t)0, (long)-1, 1); + rcvd_delete(&rp->r_queuep, (sysid_t)0, (long)-1); clistp = rp->r_clistp; - rp->r_clistp = NULL; if (!rp->r_mountp) { /* not currently mounted, remove */ rf_resource_t *arp = rp; /* addressable */ @@ -1362,3 +1417,442 @@ rfsys_unadvfs(uap, rvp) --nadvertise; return 0; } + +#ifdef RFSUNMOUNTHACK + +STATIC ls_elt_t rfsys_caphead = {&rfsys_caphead, &rfsys_caphead}; +STATIC int rfsys_cap_cnt = 1; /* 0 is distinguished value */ + +/* + * Update rvp->r_val1 with a value that can be used to operate on + * the rf_vfs containing the file that is named by the longest + * traversible prefix of the path. Update cappath with that prefix. + */ + +typedef struct rfsys_getcapa { + int opcode; + char *path; + char *cappath; +} rfsys_getcapa_t; + +STATIC int +rfsys_getcap(uap, rvp) + caddr_t uap; + rval_t *rvp; +{ + rfsys_getcapa_t *gcp = (rfsys_getcapa_t *)uap; + pathname_t pn; + pathname_t cpn; + rfsys_cap_t *cap; + int error; + vnode_t *cdir; + vnode_t *rootvp; + int pathlen = 0; + int oldpnlen; + + if (!suser(u.u_cred)) { + return EPERM; + } + if (error = pn_get(gcp->path, UIO_USERSPACE, &pn)) { + return error; + } + if (pn_peekchar(&pn) != '/') { + pn_free(&pn); + return EINVAL; + } + pn_alloc(&cpn); + + /* + * Parse the pathname component-at-a-time to find the + * last reachable component. + */ + cdir = u.u_cdir; + VN_HOLD(u.u_cdir = rootdir); + oldpnlen = pn.pn_pathlen; + pn_skipslash(&pn); + while (pn_pathleft(&pn)) { + char comp[MAXNAMELEN]; + vnode_t *vp; + + if (error = pn_stripcomponent(&pn, comp)) { + break; + } + (void)pn_set(&cpn, comp); + if (lookuppn(&cpn, FOLLOW, NULLVPP, &vp)) { + break; + } + VN_RELE(u.u_cdir); + u.u_cdir = vp; + if (vp->v_flag & VROOT) { + pathlen += oldpnlen - pn.pn_pathlen; + oldpnlen = pn.pn_pathlen; + } + pn_skipslash(&pn); + } + /* + * To avoid acting rashly on user typos, we confine + * this facility to RFS file systems. A general + * facility would mitigate the problem. + */ + if (!(error = ISRFSVP(u.u_cdir) ? 0 : EINVAL) && + !(error = VFS_ROOT(u.u_cdir->v_vfsp, &rootvp))) { + if (!(error = + copyout(pn.pn_buf, gcp->cappath, pathlen) ? EFAULT : 0) && + !(error = + subyte(gcp->cappath + pathlen, '\0') ? EFAULT : 0) && + !(error = rf_alloccap(rootvp, u.u_procp->p_epid, &cap))) { + LS_INSQUE(&rfsys_caphead, cap); + rvp->r_val1 = cap->c_ucap; + } else { + VN_RELE(rootvp); + } + } + + VN_RELE(u.u_cdir); + u.u_cdir = cdir; + pn_free(&pn); + pn_free(&cpn); + return error; +} + +/* + * Give up the cap denoted by ucap. + */ + +typedef struct rfsys_putcapa { + int opcode; + int ucap; +} rfsys_putcapa_t; + +/* ARGSUSED */ +STATIC int +rfsys_putcap(uap, rvp) + caddr_t uap; + rval_t *rvp; +{ + int error = 0; + int ucap = ((rfsys_putcapa_t *)uap)->ucap; + + if (!suser(u.u_cred)) { + error = EPERM; + } else if (ucap < 1) { + error = EINVAL; + } else { + error = rf_putcap(ucap, u.u_procp->p_epid); + } + return error; +} + +/* + * Remove from global list and destroy cap(s) denoted by ucap. + */ +int +rf_putcap(ucap, pid) + int ucap; + pid_t pid; +{ + rfsys_cap_t *cap; + + if ((cap = rf_findcap(ucap, pid)) != NULL) { + ls_elt_t head; + ls_elt_t *lp; + + LS_INIT(&head); + LS_INSQUE(&head, cap); + for (lp = head.ls_next; !LS_ISEMPTY(&head); lp = head.ls_next) { + LS_REMOVE(lp); + cap = (rfsys_cap_t *)lp; + VN_RELE(cap->c_vp); + kmem_free(cap, sizeof(rfsys_cap_t)); + } + return 0; + } else { + return EINVAL; + } +} + +/* + * Update buf with values that can be used to operate on the submounts + * of ucap, and rvp->r_val1 with the number of values returned. If + * the number of entries is greater than nebuf (number of elements + * in buf), fail. + */ + +typedef struct rfsys_submntsa { + int opcode; + int ucap; + uint nebuf; + caddr_t buf; +} rfsys_submntsa_t; + +STATIC int +rfsys_submnts(uap, rvp) + caddr_t uap; + rval_t *rvp; +{ + rfsys_submntsa_t *fsup = (rfsys_submntsa_t *)uap; + vfs_t *vfsp; + vfs_t *subvfsp; + rfsys_cap_t *fscp; + rfsys_cap_t *subcap; + uint nsub = 0; + int error = 0; + ls_elt_t *lp; + ls_elt_t uhead; /* handle to clean up errors */ + ls_elt_t pfxhead; /* for VFSs found by looking + * at name of mounpoint */ + + if (!suser(u.u_cred)) { + return EPERM; + } + if (fsup->ucap < 1 || + (fscp = rf_findcap(fsup->ucap, u.u_procp->p_epid)) == NULL) { + return EINVAL; + } + /* rf_findcap does a destructive read of the list */ + LS_INSQUE(&rfsys_caphead, fscp); + LS_INIT(&uhead); + LS_INIT(&pfxhead); + + /* Search vfs list for submounts and save them on list head. */ + vfsp = fscp->c_vp->v_vfsp; + for (subvfsp = rootvfs; subvfsp; subvfsp = subvfsp->vfs_next) { + int pfx = 0; + vnode_t *subroot; + + if (subvfsp->vfs_vnodecovered->v_vfsp != vfsp && + !(pfx = strprefix(vfsp->vfs_namecovered, + subvfsp->vfs_namecovered))) { + continue; + } + if (!pfx && ++nsub > fsup->nebuf) { + error = EOVERFLOW; + break; + } + if (error = VFS_ROOT(subvfsp, &subroot)) { + break; + } + if (error = rf_alloccap(subroot, u.u_procp->p_epid, &subcap)) { + VN_RELE(subroot); + break; + } + if (pfx) { + LS_INSQUE(&pfxhead, subcap); + } else { + LS_INSQUE(&uhead, subcap); + } + } + + /* + * For submounts found through matching pathnames, retain only + * those that are logically immediate submounts. + */ + + while (!LS_ISEMPTY(&pfxhead)) { + lp = pfxhead.ls_next; + LS_REMOVE(lp); + if (!error ) { + vfs_t *coveredvfsp; + + subcap = (rfsys_cap_t *)lp; + coveredvfsp = + subcap->c_vp->v_vfsp->vfs_vnodecovered->v_vfsp; + if (rf_vfsincaplist(coveredvfsp, &uhead) || + rf_vfsincaplist(coveredvfsp, &pfxhead)) { + VN_RELE(subcap->c_vp); + kmem_free(subcap, sizeof(rfsys_cap_t)); + continue; + } + if (++nsub > fsup->nebuf) { + error = EOVERFLOW; + } + } + if (error) { + VN_RELE(subcap->c_vp); + kmem_free(subcap, sizeof(rfsys_cap_t)); + } else { + LS_INSQUE(&uhead, subcap); + } + } + + /* Move ucaps into user space. */ + for (lp = uhead.ls_next; !error && lp != &uhead; lp = lp->ls_next) { + subcap = (rfsys_cap_t *)lp; + if (suword(fsup->buf, subcap->c_ucap)) { + error = EFAULT; + } + fsup->buf += sizeof(subcap->c_ucap); + } + + /* If error, toss list; otherwise save it. */ + for (lp = uhead.ls_next; !LS_ISEMPTY(&uhead); lp = uhead.ls_next) { + LS_REMOVE(lp); + subcap = (rfsys_cap_t *)lp; + if (error) { + VN_RELE(subcap->c_vp); + kmem_free(subcap, sizeof(rfsys_cap_t)); + } else { + LS_INSQUE(&rfsys_caphead, subcap); + } + } + + rvp->r_val1 = nsub; + return error; +} + +/* + * Return 1 if vfsp is denoted by some cap in the list headed by hp, + * 0 otherwise. + */ +STATIC int +rf_vfsincaplist(vfsp, hp) + vfs_t *vfsp; + ls_elt_t *hp; +{ + ls_elt_t *lp; + + for (lp = hp->ls_next; lp != hp; lp = lp->ls_next) { + if(((rfsys_cap_t *)lp)->c_vp->v_vfsp == vfsp) { + return 1; + } + } + return 0; +} + +/* + * Invoke dofusers() with the vnode denoted by ucap, and with the + * args flags, outbp, and rvp. + */ + +typedef struct rfsys_fusersa { + int opcode; + int ucap; + int flags; + char *outbp; +} rfsys_fusersa_t; + +STATIC int +rfsys_fusers(uap, rvp) + caddr_t uap; + rval_t *rvp; +{ + rfsys_fusersa_t *fup = (rfsys_fusersa_t *)uap; + rfsys_cap_t *fscp; + int error; + + if (!suser(u.u_cred)) { + return EPERM; + } + if (fup->ucap < 1 || + (fscp = rf_findcap(fup->ucap, u.u_procp->p_epid)) == NULL) { + error = EINVAL; + } else { + /* rf_findcap does a destructive read of the list */ + LS_INSQUE(&rfsys_caphead, fscp); + error = dofusers(fscp->c_vp, fup->flags, fup->outbp, rvp); + } + return error; +} + +/* + * unmount the vfs with root vp denoted by ucap. + * NOTE: ucap is expired after the call here. + */ + +typedef struct rfsys_unmounta { + int opcode; + int ucap; +} rfsys_unmounta_t; + +/* ARGSUSED */ +STATIC int +rfsys_unmount(uap, rvp) + caddr_t uap; + rval_t *rvp; +{ + rfsys_unmounta_t *ump = (rfsys_unmounta_t *)uap; + rfsys_cap_t *fscp; + int error; + + if (!suser(u.u_cred)) { + return EPERM; + } + if (ump->ucap < 1 || + (fscp = rf_findcap(ump->ucap, u.u_procp->p_epid)) == NULL) { + error = EINVAL; + } else { + vfs_t *vfsp = fscp->c_vp->v_vfsp; + + VN_RELE(fscp->c_vp); + kmem_free(fscp, sizeof(rfsys_cap_t)); + error = dounmount(vfsp, u.u_cred); + } + return error; +} + +/* + * Return a pointer to a list of rfsys_caps matching ucap and epid, + * or NULL if no match. 0 matches all ucaps for pid. + * NOTE: removes the rfsys_caps from the global list. Caller + * must destroy or replace. + */ +STATIC rfsys_cap_t * +rf_findcap(ucap, pid) + int ucap; + pid_t pid; +{ + ls_elt_t head; + rfsys_cap_t *cap; + ls_elt_t *lp; + + LS_INIT(&head); + for (lp = rfsys_caphead.ls_next; + lp != &rfsys_caphead; + lp = lp->ls_next) { + cap = (rfsys_cap_t *)lp; + if (cap->c_pid == pid && (cap->c_ucap == ucap || !ucap)) { + LS_REMOVE(lp); + LS_INSQUE(&head, lp); + if (cap->c_ucap == ucap) { + break; + } + } + } + if (LS_ISEMPTY(&head)) { + cap = NULL; + } else { + cap = (rfsys_cap_t *)head.ls_next; + LS_REMOVE(&head); + } + return cap; +} + +/* + * Allocate a fully initialized rfsys_cap, else fail. + * (list elements intialized to empty) + */ +STATIC int +rf_alloccap (vp, pid, cpp) + vnode_t *vp; + pid_t pid; + rfsys_cap_t **cpp; +{ + rfsys_cap_t *cp = kmem_alloc(sizeof(rfsys_cap_t), KM_SLEEP); + int error = 0; + + if (!cp) { + error = ENOMEM; + } else { + LS_INIT(cp); + cp->c_ucap = rfsys_cap_cnt++; + cp->c_pid = pid; + cp->c_vp = vp; + if (rfsys_cap_cnt == INT_MAX) { + rfsys_cap_cnt = 1; + } + *cpp = cp; + } + return error; +} + +#endif /* RFSUNMOUNTHACK */ diff --git a/usr/src/uts/3b2/fs/rfs/rf_vfsops.c b/usr/src/uts/3b2/fs/rfs/rf_vfsops.c index b2561e6..c51cd6c 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_vfsops.c +++ b/usr/src/uts/3b2/fs/rfs/rf_vfsops.c @@ -1,11 +1,4 @@ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)fs:fs/rfs/rf_vfsops.c 1.35" +#ident "@(#)fs:fs/rfs/rf_vfsops.c 1.28.1.1 UNOFFICIAL" #include "sys/list.h" #include "sys/types.h" #include "sys/sysinfo.h" @@ -24,12 +17,12 @@ #include "sys/pathname.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "sys/systm.h" #include "sys/sysmacros.h" #include "sys/immu.h" #include "sys/proc.h" +#include "sys/rf_messg.h" #include "sys/debug.h" #include "sys/cmn_err.h" #include "sys/rf_debug.h" @@ -51,7 +44,6 @@ #include "rf_canon.h" #include "sys/buf.h" #include "sys/uio.h" -#include "vm/page.h" #include "rf_cache.h" #include "sys/kmem.h" @@ -88,6 +80,9 @@ STATIC int rf_unmount(); STATIC int rf_root(); STATIC int rf_statvfs(); STATIC int rf_sync(); +STATIC int rf_vget(); +STATIC int rf_mountroot(); +STATIC int rf_swapvp(); struct vfsops rf_vfsops = { rf_mount, @@ -95,13 +90,9 @@ struct vfsops rf_vfsops = { rf_root, rf_statvfs, rf_sync, - rf_nosys, /* vget */ - rf_nosys, /* mountroot */ - rf_nosys, /* swapvp */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ + rf_vget, + rf_mountroot, + rf_swapvp, rf_nosys, /* filler */ rf_nosys, /* filler */ rf_nosys, /* filler */ @@ -118,7 +109,7 @@ rf_head_t rf_head = {(rf_vfs_t*)&rf_head, (rf_vfs_t*)&rf_head}; /* * operations on objects of type rf_vfs_t */ -STATIC int getrfvfs(); +STATIC rf_vfs_t *getrfvfs(); STATIC void putrfvfs(); rf_vfs_t *findrfvfs(); @@ -128,20 +119,25 @@ int rfsr_nservers; int rfsr_nidle; int rfsr_nmsg; -/* ARGSUSED */ void rf_clock(pc, psw) caddr_t pc; psw_t psw; { - rf_srv_info.rfsi_nservers += rfsr_nservers; + extern caddr_t waitloc; + + if (!USERMODE(psw) && pc != waitloc && RF_SERVER()) { + /* ticks servicing remote */ + rf_srv_info.rfsi_serve++; + } + rf_srv_info.rfsi_nservers += rfsr_nservers; /* cumul. tally */ if (rfsr_nidle) { rf_srv_info.rfsi_srv_que += rfsr_nidle; - rf_srv_info.rfsi_srv_occ++; + rf_srv_info.rfsi_srv_occ++; /* sec's occ'd */ } if (rfsr_nmsg) { rf_srv_info.rfsi_rcv_que += rfsr_nmsg; - rf_srv_info.rfsi_rcv_occ++; + rf_srv_info.rfsi_rcv_occ++; /* sec's occ'd */ } } @@ -181,7 +177,7 @@ rf_stime(crp) * Minimal sndd should be adequate for * communication and recovery. */ - sndd_set(sdp, qp, &rf_daemon_gift); + sndd_set(sdp, qp, RECOVER_RD); if ((tmperror = rfcl_op(sdp, crp, RFSYNCTIME, &rqarg, &bp, FALSE)) == 0) { if ((tmperror = RF_RESP(bp)->rp_errno) == 0) { @@ -207,8 +203,6 @@ rcvd_t *rcvd; gdp_t *gdp; rd_user_t *rd_user; -STATIC rf_gift_t rf_mount_gift = {MOUNT_RD, 0}; /* template */ - int rf_init(vfswp, fstyp) register vfssw_t *vfswp; @@ -218,21 +212,12 @@ rf_init(vfswp, fstyp) size_t rcvdsz = nrcvd * sizeof(rcvd_t); size_t gdpsz = maxgdp * sizeof(gdp_t); size_t rd_usersz = nrduser * sizeof(rd_user_t); - int error = 0; rfcl_fsinfo.fsivop_other++; - - /* - * Kludge for SVID-compliance is preferable to allocating the - * structure in generic code. - */ - rfsi_servep = &rf_srv_info.rfsi_serve; - + ASSERT(!rf_state); if (nsndd < MINSNDD || nrcvd < MINRCVD || maxgdp < MINGDP || nrduser < 0) { - sndd = NULL; - error = EINVAL; - goto out; + return EINVAL; } if ((sndd = (sndd_t *)kmem_zalloc(snddsz, KM_SLEEP)) != NULL) { if ((rcvd = (rcvd_t *)kmem_zalloc(rcvdsz, KM_SLEEP)) != NULL) { @@ -240,23 +225,20 @@ rf_init(vfswp, fstyp) != NULL) { if ((rd_user = (rd_user_t *) kmem_zalloc(rd_usersz, KM_SLEEP)) != NULL) { - goto out; + goto success; } kmem_free((caddr_t)gdp, gdpsz); - gdp = NULL; } kmem_free((caddr_t)rcvd, rcvdsz); - rcvd = NULL; } kmem_free((caddr_t)sndd, snddsz); - sndd = NULL; } - error = ENOMEM; -out: + return ENOMEM; +success: vfswp->vsw_vfsops = &rf_vfsops; strcpy(vfswp->vsw_name, "rfs"); rf_type = fstyp; - return error; + return 0; } /* @@ -293,10 +275,6 @@ rf_mount(vfsp, mntpt, uap, crp) error = EPERM; goto out; } - if (mntpt->v_type != VDIR) { - error = ENOTDIR; - goto out; - } if (mntpt->v_count != 1 || mntpt->v_flag & VROOT) { error = EBUSY; goto out; @@ -316,6 +294,10 @@ rf_mount(vfsp, mntpt, uap, crp) } DUPRINT3(DB_MNT_ADV, "rf_mount: token.t_id=%x, t_uname=%s\n", rfmdata.rfm_token.t_id, rfmdata.rfm_token.t_uname); + if (RF_SERVER()) { + error = EMULTIHOP; + goto out; + } if (rf_state != RF_UP) { error = ENONET; goto out; @@ -337,7 +319,7 @@ rf_mount(vfsp, mntpt, uap, crp) if (error = sndd_create(TRUE, &chansdp)) { goto out; } - sndd_set(chansdp, mountqp, &rf_mount_gift); + sndd_set(chansdp, mountqp, MOUNT_RD); /* * Allocate send descriptor to hold reference to rf_rsrc. */ @@ -360,7 +342,8 @@ rf_mount(vfsp, mntpt, uap, crp) error = EINVAL; goto out; } - if ((error = getrfvfs(name, &rfvfsp)) != 0) { + if ((rfvfsp = getrfvfs(name)) == NULL) { + error = ENOMEM; goto out; } /* @@ -479,10 +462,9 @@ rf_unmount(vfsp, crp) * server (sd_stat & SDLINKDOWN), if it completed successfully on the * server, or if the link to the server goes down (ECOMM or ENOLINK). */ - if (((error = rfcl_op(sdp, crp, RFUMOUNT, &rqarg, &bp, FALSE)) == 0 && - (error = RF_RESP(bp)->rp_errno) == 0) || - error == ENOLINK || - error == ECOMM) { + if (sdp->sd_stat & SDLINKDOWN || (((error = rfcl_op(sdp, crp, RFUMOUNT, + &rqarg, &bp, FALSE)) == 0 && (error = RF_RESP(bp)->rp_errno) == 0) || + error == ENOLINK || error == ECOMM)) { ASSERT(rootvp->v_count == 1); rfc_mountinval(rfvfsp); QPTOGP(sdp->sd_queue)->mntcnt--; @@ -549,27 +531,22 @@ rf_statvfs(vfsp, stvfsp) return du_fstatfs(vfsp, stvfsp); } datasz = gp->hetero == NO_CONV ? sizeof(statvfs_t) : - sizeof(statvfs_t) + STATVFS_XP; + sizeof(statvfs_t) + STATVFS_XP - MINXPAND; rpsz = RF_MIN_RESP(gp->version); if ((error = rfcl_op(chansdp, u.u_cred, RFSTATVFS, &init_rq_arg, &bp, - TRUE)) == 0 && (error = RF_RESP(bp)->rp_errno) == 0) { + TRUE)) == 0 && (error = RF_RESP(bp)->rp_errno) == 0 && + (error = RF_PULLUP(bp, rpsz, datasz)) == 0) { + caddr_t rpdata = rf_msgdata(bp, rpsz); - if (RF_PULLUP(bp, rpsz, datasz)) { - gdp_j_accuse("rf_statvfs bad data from server", gp); - error = EPROTO; - } else { - caddr_t rpdata = rf_msgdata(bp, rpsz); - - if (gp->hetero != NO_CONV && - !rf_fcanon(STATVFS_FMT, rpdata, rpdata + datasz, + if (gp->hetero != NO_CONV) { + if (!rf_fcanon(STATVFS_FMT, rpdata, rpdata + datasz, (caddr_t)stvfsp)) { - gdp_j_accuse("rf_statvfs bad data from server", + gdp_discon("rf_statvfs bad data from server", gp); error = EPROTO; } - if (!error) { - *stvfsp = *(statvfs_t *)rpdata; - } + } else { + *stvfsp = *(statvfs_t *)rpdata; } } rf_freemsg(bp); @@ -616,6 +593,50 @@ rf_sync(vfsp, flag, crp) return 0; } +/* ARGSUSED */ +STATIC int +rf_vget(vfsp, vpp, fidp) + vfs_t *vfsp; + vnode_t **vpp; + fid_t *fidp; +{ + rfcl_fsinfo.fsivop_other++; + cmn_err(CE_WARN,"rf_vget called\n"); + return ENOSYS; +} + +/* ARGSUSED */ +STATIC int +rf_mountroot(vfsp, why) + vfs_t *vfsp; + whymountroot_t why; +{ + rfcl_fsinfo.fsivop_other++; + cmn_err(CE_WARN,"rf_mountroot called\n"); + return ENOSYS; +} + +/* ARGSUSED */ +STATIC int +rf_swapvp(vfsp, vpp, nm) + vfs_t *vfsp; + vnode_t **vpp; + char *nm; +{ + rfcl_fsinfo.fsivop_other++; + cmn_err(CE_WARN,"rf_swapvp called\n"); + return ENOSYS; +} + +#ifndef UNNECESSARYRESTRICTION +/* + * Only allow a mount of a directory resource on a directory file, of + * a non-directory resource on a non-directory file. + */ +#define rf_vtypematch(covered, root) \ + (((covered)->v_type == VDIR) == ((root)->v_type == VDIR) ? 0 : ENOTDIR) +#endif + /* * Process response to succesfully completed rf_mount. * Return 0 for success, nonzero errno for failure. @@ -654,9 +675,34 @@ rf_mount_resp(mntpt, bp, giftsdpp, vfsp, gp, crp) return error ? error : ENOLINK; } rfvfsp->rfvfs_refcnt = 0; /* incremented by rfcl_findsndd */ - sndd_set(*giftsdpp, (queue_t *)msg->m_queue, &msg->m_gift); + sndd_set(*giftsdpp, (queue_t *)msg->m_queue, msg->m_giftid); +#ifndef UNNECESSARYRESTRICTION + if (!(error = rfcl_findsndd(giftsdpp, crp, bp, vfsp))) { + if ((error = rf_vtypematch(mntpt, + vp = SDTOV(*giftsdpp))) != 0) { + /* + * In local error case, unmount to let the server + * toss it's data structures. rf_mount will clean + * up data structures it passed in. + */ + sndd_t *giftsdp = *giftsdpp; + mblk_t *umbp = NULL; + int tmperr = 0; + + if (!(giftsdp->sd_stat & SDLINKDOWN) && ((tmperr = + rfcl_op(giftsdp, crp, RFUMOUNT, &init_rq_arg, &umbp, + FALSE)) != 0 || (tmperr = RF_RESP(umbp)->rp_errno) != + 0) && tmperr != ENOLINK && tmperr != ECOMM) { + cmn_err(CE_WARN, + "rf_mount left dangling mount on server"); + } + if (umbp != NULL) { + rf_freemsg(umbp); + } + } else { +#else if (!(error = rfcl_findsndd(giftsdpp, crp, bp, vfsp))) { - +#endif /* * With current implementation, rfcl_findsndd will actually * just return the vnode attached to current giftsd, @@ -667,7 +713,6 @@ rf_mount_resp(mntpt, bp, giftsdpp, vfsp, gp, crp) * We make the call primarily to get the vnode filled in; * the following assignment is redundant, then, but harmless. */ - vp = SDTOV(*giftsdpp); vp->v_flag |= VROOT; @@ -700,9 +745,54 @@ rf_mount_resp(mntpt, bp, giftsdpp, vfsp, gp, crp) rfvfsp->rfvfs_mntproc = NULL; gp->mntcnt++; } +#ifndef UNNECESSARYRESTRICTION + } +#endif return error; } +/* + * Copy the member fields from the referenced statfs structure into the + * referenced statvfs structure, zeroing other fields of the statvfs. + */ +void +fs_to_vfs(sfp, svp, vfsp) + register struct statfs *sfp; + register struct statvfs *svp; + register vfs_t *vfsp; +{ + bzero((caddr_t)svp, sizeof(struct statvfs)); + svp->f_bsize = sfp->f_bsize; + svp->f_frsize = !sfp->f_frsize ? sfp->f_bsize : sfp->f_frsize; + /* + * statfs bsize is in terms of 512 byte blocks. + */ + svp->f_blocks = sfp->f_blocks / (sfp->f_bsize / 512); + svp->f_bfree = sfp->f_bfree / (sfp->f_bsize / 512); + svp->f_bavail = sfp->f_bfree; + svp->f_files = sfp->f_files; + svp->f_ffree = sfp->f_ffree; + svp->f_favail = sfp->f_ffree; + svp->f_fsid = vfsp->vfs_dev; /* TO DO: check this in terms of + * ustat + */ + /* + * We can't provide the base type because the old statfs structure + * supplies only an fstype number, which is meaningless on the + * client. + */ + strcpy((caddr_t)svp->f_basetype, "unknown"); + svp->f_flag = vf_to_stf(vfsp->vfs_flag); + bcopy(sfp->f_fname, &svp->f_fstr[0], sizeof(sfp->f_fname)); + bcopy(sfp->f_fpack, &svp->f_fstr[sizeof(sfp->f_fname)], + sizeof(sfp->f_fpack)); + /* + * Set namemax to 14, which is DIRSIZ in SVR3.x. This isn't generally + * correct, but the protocol doesn't provide the information. + */ + svp->f_namemax = 14; +} + /* * primitive operations on objects of type rf_vfs_t */ @@ -717,10 +807,10 @@ rf_mount_resp(mntpt, bp, giftsdpp, vfsp, gp, crp) STATIC ulong rfvfs_map[BT_BITOUL(MAPSZ)]; /* - * If name is a remote resource already mounted, or - * space to mount another remote resource, returns and errno. - * Otherwise returns 0 and updates *rfvfspp with a pointer to a free - * rf_vfs_t with the index and name defined, and linked into the rf_vfs + * If name is a remote resource already mounted, or there is no + * space to mount another remote resource, returns NULL. + * Otherwise returns a pointer to a free rf_vfs_t with + * the index and name defined, and linked into the rf_vfs * chain, but with other members zeroed. * * We link the partially-defined rf_head into the chain because @@ -733,10 +823,9 @@ STATIC ulong rfvfs_map[BT_BITOUL(MAPSZ)]; * It's safe to put the rf_head on the list because the only thing * client fumount does is match on index, then look at root vp. */ -STATIC int -getrfvfs(name, rfvfspp) +STATIC rf_vfs_t * +getrfvfs(name) register char *name; - rf_vfs_t **rfvfspp; { register rf_vfs_t *newrfvfs; register rf_vfs_t *rfp = rf_head.rfh_next; @@ -749,13 +838,12 @@ getrfvfs(name, rfvfspp) * having ascertained absence of duplicates, and putting * the rf_head in the list. */ - if (inx < 0) { - return ENOMEM; + return NULL; } if ((newrfvfs = (rf_vfs_t *)kmem_zalloc(sizeof(rf_vfs_t), KM_SLEEP)) == NULL) { - return ENOMEM; + return NULL; } while (rfp != headp) { /* @@ -765,7 +853,7 @@ getrfvfs(name, rfvfspp) if (!strcmp(rfp->rfvfs_name, name)) { /* duplicate name */ kmem_free((caddr_t)newrfvfs, sizeof(rf_vfs_t)); - return EBUSY; + return NULL; } rfp = rfp->rfvfs_next; } @@ -775,8 +863,7 @@ getrfvfs(name, rfvfspp) LS_INIT(newrfvfs); LS_INIT(&newrfvfs->rfvfs_sdhash); LS_INS_AFTER(headp, newrfvfs); - *rfvfspp = newrfvfs; - return 0; + return newrfvfs; } /* @@ -844,6 +931,9 @@ rf_ustat(dev, ustbuf) size_t rpsz; union rq_arg rqarg = init_rq_arg; + if (RF_SERVER()) { + return EMULTIHOP; + } if (rf_state != RF_UP) { return EINVAL; } @@ -864,26 +954,21 @@ rf_ustat(dev, ustbuf) rqarg.rqustat.dev = (long)lobyte(sdev); datasz = gp->hetero == NO_CONV ? sizeof(struct ustat) : - sizeof(struct ustat) + USTAT_XP; + sizeof(struct ustat) + USTAT_XP - MINXPAND; rpsz = RF_MIN_RESP(gp->version); if ((error = rfcl_op(chansdp, u.u_cred, RFUSTAT, &rqarg, &bp, TRUE)) == - 0 && (error = RF_RESP(bp)->rp_errno) == 0) { - if (RF_PULLUP(bp, rpsz, datasz)) { - gdp_j_accuse("rf_ustat bad data", gp); - error = EPROTO; - } else { - caddr_t rpdata = rf_msgdata(bp, rpsz); + 0 && (error = RF_RESP(bp)->rp_errno) == 0 && + (error = RF_PULLUP(bp, rpsz, datasz)) == 0) { + register caddr_t rpdata = rf_msgdata(bp, rpsz); - if (gp->hetero != NO_CONV && - !rf_fcanon(USTAT_FMT, rpdata, rpdata + datasz, - rpdata)) { - gdp_j_accuse("rf_ustat bad data", gp); - error = EPROTO; - } - if (!error && copyout(rpdata, (caddr_t)ustbuf, - sizeof(struct ustat))) { - error = EFAULT; - } + if (gp->hetero != NO_CONV && + !rf_fcanon(USTAT_FMT, rpdata, rpdata + datasz, rpdata)) { + gdp_discon("rf_ustat bad data from server", gp); + error = EPROTO; + } + if (!error && copyout(rpdata, (caddr_t)ustbuf, + sizeof(struct ustat))) { + error = EFAULT; } } rf_freemsg(bp); @@ -938,7 +1023,7 @@ rf_ustat_sdget(sdev, sdpp, gpp) sndd_free(&sdp); return ENOENT; } else { - sndd_set(sdp, (*gpp)->queue, &rf_mount_gift); + sndd_set(sdp, (*gpp)->queue, MOUNT_RD); sdp->sd_mntid = searchsdp->sd_mntid; *sdpp = sdp; return 0; diff --git a/usr/src/uts/3b2/fs/rfs/rf_vnops.c b/usr/src/uts/3b2/fs/rfs/rf_vnops.c index a00e76e..088539d 100644 --- a/usr/src/uts/3b2/fs/rfs/rf_vnops.c +++ b/usr/src/uts/3b2/fs/rfs/rf_vnops.c @@ -1,11 +1,4 @@ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)fs:fs/rfs/rf_vnops.c 1.32" +#ident "@(#)fs:fs/rfs/rf_vnops.c 1.21.1.1 UNOFFICIAL" #include "sys/list.h" #include "sys/types.h" #include "sys/sysinfo.h" @@ -28,10 +21,10 @@ #include "sys/statvfs.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "sys/nserve.h" #include "sys/rf_cirmgr.h" +#include "sys/rf_messg.h" #include "sys/buf.h" #include "sys/stat.h" #include "sys/statfs.h" @@ -78,7 +71,6 @@ STATIC int rf_ioctl(); STATIC int rf_getattr(); STATIC int rf_setattr(); STATIC int rf_access(); -STATIC int rf_pathconf(); STATIC int rf_lookup(); STATIC int rf_create(); STATIC int rf_remove(); @@ -91,6 +83,7 @@ STATIC int rf_symlink(); STATIC int rf_readlink(); STATIC int rf_fsync(); STATIC void rf_inactive(); +STATIC int rf_fid(); STATIC void rf_rwlock(); STATIC void rf_rwunlock(); STATIC int rf_seek(); @@ -128,7 +121,7 @@ struct vnodeops rf_vnodeops = { rf_readlink, rf_fsync, rf_inactive, - rf_nosys, /* fid */ + rf_fid, rf_rwlock, rf_rwunlock, rf_seek, @@ -143,33 +136,6 @@ struct vnodeops rf_vnodeops = { rf_delmap, rf_poll, rf_nosys, /* dump */ - rf_pathconf, - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ - rf_nosys, /* filler */ rf_nosys, /* filler */ rf_nosys, /* filler */ rf_nosys, /* filler */ @@ -226,6 +192,16 @@ rf_inactive(vp, cr) } /* ARGSUSED */ +STATIC int +rf_fid(vp, fidpp) + vnode_t *vp; + fid_t **fidpp; +{ + rfcl_fsinfo.fsivop_other++; + cmn_err(CE_WARN,"rf_fid called\n"); + return ENOSYS; +} + STATIC void rf_rwlock(vp) vnode_t *vp; @@ -259,6 +235,8 @@ rf_seek(vp, ooff, noffp) return 0; } +/* Ducmp compares two vnodes to see if they refer to the same file. + */ STATIC int rf_cmp(vp1,vp2) vnode_t *vp1, *vp2; @@ -299,6 +277,9 @@ rf_fsync(vp, crp) int error; rfcl_fsinfo.fsivop_other++; + if (RF_SERVER()) { + return EMULTIHOP; + } /* * The pre-SVR4 system call protocol does not recognize this * operation. @@ -337,6 +318,9 @@ rf_access(vp, mode, flags, crp) register sndd_t *sdp = VTOSD(vp); rfcl_fsinfo.fsivop_other++; + if (RF_SERVER()) { + return EMULTIHOP; + } if (mode & VWRITE && vp->v_vfsp->vfs_flag & VFS_RDONLY) { return EROFS; } @@ -371,31 +355,10 @@ rf_access(vp, mode, flags, crp) return error; } -STATIC int -rf_pathconf(vp, cmd, valp, crp) - vnode_t *vp; - int cmd; - u_long *valp; - cred_t *crp; -{ - register int error = 0; - union rq_arg rqarg = init_rq_arg; - mblk_t *bp = NULL; - register sndd_t *sdp = VTOSD(vp); - - rfcl_fsinfo.fsivop_other++; - if (QPTOGP(sdp->sd_queue)->version < RFS2DOT0) { - return ENOSYS; - } - rqarg.rqpathconf.cmd = (long)cmd; - if ((error = rfcl_op(sdp, crp, RFPATHCONF, &rqarg, &bp, TRUE)) == 0) { - *valp = (u_long)RF_RESP(bp)->rp_rval; - rf_freemsg(bp); - } - return error; -} - -/* Close remote file denoted by vp. */ +/* + * Perform close op on the remote file denoted by vp. + * Returns 0 for success, nonzero errno for failure. + */ STATIC int rf_close(vp, flags, cnt, off, crp) vnode_t *vp; @@ -405,7 +368,7 @@ rf_close(vp, flags, cnt, off, crp) cred_t *crp; { register int error; - int nacked = TRUE; + int nacked = 1; mblk_t *bp = NULL; register rf_request_t *reqp; rcvd_t *rdp; @@ -415,6 +378,9 @@ rf_close(vp, flags, cnt, off, crp) int lastclose; rfcl_fsinfo.fsivop_close++; + if (RF_SERVER()) { + return EMULTIHOP; + } /* create an rd on which to receive the response */ if ((error = rcvd_create(FALSE, RDSPECIFIC, &rdp)) != 0) { return error; @@ -512,11 +478,14 @@ rf_create(dvp, nm, vap, ex, mode, vpp, crp) register size_t totalsz; int canon = gp->hetero != NO_CONV; - *vpp = NULLVP; /* vpp is set only in success cases */ + *vpp = NULL; /* vpp is set only in success cases */ bp = NULL; giftsdp = NULL; rdp = NULL; + if (RF_SERVER()) { + return EMULTIHOP; + } rfcl_fsinfo.fsivop_create++; if (vcver < RFS2DOT0) { return du_create(dvp, nm, vap, ex, mode, vpp, crp); @@ -571,15 +540,17 @@ rf_create(dvp, nm, vap, ex, mode, vpp, crp) rf_message_t *msg = RF_MSG(bp); if (!(msg->m_stat & RF_GIFT)) { - gdp_j_accuse("rf_create: no file reference", + gdp_discon("rf_create: no file reference", QPTOGP((queue_t *)msg->m_queue)); error = EPROTO; } else { - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); + sndd_set(giftsdp, (queue_t *)msg->m_queue, + msg->m_giftid); if ((error = rfcl_findsndd(&giftsdp, crp, bp, - dvp->v_vfsp)) == 0) { - *vpp = SDTOV(giftsdp); + dvp->v_vfsp)) != 0) { + *vpp = NULLVP; } + *vpp = SDTOV(giftsdp); } } out: @@ -650,27 +621,18 @@ rf_dofcntl(op, vp, cmd, arg, flag, offset, crp) size_t hdrsz = RF_MIN_REQ(gp->version); caddr_t data; int canon = gp->hetero != NO_CONV; - size_t datasz = 0; - int sendfl = 0; + struct flock *flp = (struct flock *)arg; + size_t datasz; + datasz = canon ? sizeof(struct flock) + FLOCK_XP - MINXPAND : + sizeof(struct flock); + if (RF_SERVER()) { + return EMULTIHOP; + } if (gp->version < RFS2DOT0) { return du_fcntl(op, vp, cmd, arg, flag, offset, crp); } - - /* - * Send record locking data with certain requests only. - */ - switch (cmd) { - case F_GETLK: - case F_O_GETLK: - case F_SETLK: - case F_SETLKW: - case F_FREESP: - datasz = canon ? sizeof(struct flock) + FLOCK_XP : - sizeof(struct flock); - sendfl = 1; - } - + /* create an rd on which to receive the response */ if ((error = rcvd_create(TRUE, RDSPECIFIC, &rdp)) != 0) { return error; } @@ -689,8 +651,15 @@ rf_dofcntl(op, vp, cmd, arg, flag, offset, crp) reqp->rq_fcntl.fcntl = (long)arg; reqp->rq_fcntl.offset = offset; reqp->rq_fcntl.fflag = flag; - - if (sendfl) { + /* + * Send record locking data with request. + */ + switch (cmd) { + case F_GETLK: + case F_O_GETLK: + case F_SETLK: + case F_SETLKW: + case F_FREESP: data = rf_msgdata(bp, hdrsz); if (canon) { reqp->rq_fcntl.prewrite = rf_tcanon(FLOCK_FMT, @@ -706,23 +675,18 @@ rf_dofcntl(op, vp, cmd, arg, flag, offset, crp) hdrsz = RF_MIN_RESP(gp->version); rcvd_free(&rdp); if (!error && (error = RF_RESP(bp)->rp_errno) == 0 && - op == RFFRLOCK && (cmd == F_GETLK || cmd == F_O_GETLK) ) { - - if (RF_PULLUP(bp, hdrsz, datasz)) { - gdp_j_accuse("rf_dofcntl bad data", gp); - error = EPROTO; - } else { - data = rf_msgdata(bp, hdrsz); - if (gp->hetero != NO_CONV && - !rf_fcanon(FLOCK_FMT, data, data + datasz, - (caddr_t)arg)) { - gdp_j_accuse("rf_dofcntl bad data from server", + op == RFFRLOCK && (cmd == F_GETLK || cmd == F_O_GETLK) && + (error = RF_PULLUP(bp, hdrsz, datasz)) == 0) { + data = rf_msgdata(bp, hdrsz); + if (gp->hetero != NO_CONV) { + if (!rf_fcanon(FLOCK_FMT, data, data + datasz, + (caddr_t)flp)) { + gdp_discon("rf_dofcntl bad data from server", gp); error = EPROTO; } - if (!error) { - *(flock_t *)arg = ((struct flock *)data)[0]; - } + } else { + flp[0] = ((struct flock *)data)[0]; } } rf_freemsg(bp); @@ -749,6 +713,9 @@ rf_getattr(vp, vap, flags, crp) size_t datasz; rfcl_fsinfo.fsivop_other++; + if (RF_SERVER()) { + return EMULTIHOP; + } if (gp->version < RFS2DOT0) { return du_getattr(vp, vap, flags, crp); } @@ -757,8 +724,7 @@ rf_getattr(vp, vap, flags, crp) * Use the rf_attr_t in rfcl_lookup_cache if it is valid (its crp is * non-NULL) and matches this vp. */ - if (!(flags & ATTR_COMM) && rfcl_lookup_cache.lkc_crp && - rfcl_lookup_cache.lkc_vp == vp) { + if (rfcl_lookup_cache.lkc_crp && rfcl_lookup_cache.lkc_vp == vp) { rftov_attr(vap, &rfcl_lookup_cache.lkc_attr); if (flags & ATTR_EXEC) { /* shut out unauthorized setuid programs */ @@ -771,61 +737,51 @@ rf_getattr(vp, vap, flags, crp) rfc_info.rfci_vc_miss++; } rqarg.rqgetattr.mask = vap->va_mask; - rqarg.rqgetattr.flags = flags; hdrsz = RF_MIN_RESP(gp->version); datasz = gp->hetero == NO_CONV ? sizeof(rf_attr_t) : - sizeof(rf_attr_t) + ATTR_XP; + sizeof(rf_attr_t) + ATTR_XP - MINXPAND; if ((error = rfcl_op(sdp, crp, RFGETATTR, &rqarg, &bp, TRUE)) == 0 && - (error = RF_RESP(bp)->rp_errno) == 0) { - caddr_t rpdata; + (error = RF_RESP(bp)->rp_errno) == 0 && + (error = RF_PULLUP(bp, hdrsz, datasz)) == 0) { - if (RF_PULLUP(bp, hdrsz, datasz)) { - gdp_j_accuse("rf_getattr bad data", gp); - error = EPROTO; - goto out; - } + caddr_t rpdata = rf_msgdata(bp, hdrsz); /* * Extract the rf_attr_t from the response. */ - - rpdata = rf_msgdata(bp, hdrsz); - if (gp->hetero != NO_CONV && !rf_fcanon(ATTR_FMT, rpdata, rpdata + datasz, rpdata)) { - gdp_j_accuse("rf_getattr bad data", gp); + gdp_discon("rf_getattr bad data from server", gp); error = EPROTO; - goto out; - } - - rftov_attr(vap, (rf_attr_t *)rpdata); - if (flags & ATTR_EXEC) { - rf_common_t *cop = RF_COM(bp); + } else { + rftov_attr(vap, (rf_attr_t *)rpdata); + if (flags & ATTR_EXEC) { + rf_common_t *cop = RF_COM(bp); - /* shut out unauthorized setuid programs */ + /* shut out unauthorized setuid programs */ - vap->va_uid = gluid(gp, cop->co_uid); - vap->va_gid = glgid(gp, cop->co_gid); - } - vap->va_vcode = 0; + vap->va_uid = gluid(gp, cop->co_uid); + vap->va_gid = glgid(gp, cop->co_gid); + } + vap->va_vcode = 0; - /* - * NOTE: If va_fsid becomes other than the dev number, - * the following will be obsolete. It sets the high - * byte of the low word(sic) of that field to the one's - * complement of the gdp index of the circuit to the - * server holding the file. - */ + /* + * NOTE: If va_fsid becomes other than the dev number, + * the following will be obsolete. It sets the high + * byte of the low word(sic) of that field to the one's + * complement of the gdp index of the circuit to the + * server holding the file. + */ #ifdef SHORT_DEVS - hibyte(loword(vap->va_fsid)) = ~(gp - gdp); + hibyte(loword(vap->va_fsid)) = ~(gp - gdp); #else - hiword(vap->va_fsid) = ~(gp - gdp); + hiword(vap->va_fsid) = ~(gp - gdp); #endif - ASSERT((long)vap->va_fsid < 0); + ASSERT((long)vap->va_fsid < 0); + } } -out: rf_freemsg(bp); return error; } @@ -855,6 +811,9 @@ rf_ioctl(vp, cmd, arg, flag, crp) register int vcver = QPTOGP(chansdp->sd_queue)->version; rfcl_fsinfo.fsivop_other++; + if (RF_SERVER()) { + return EMULTIHOP; + } bp = NULL; rdp = NULL; @@ -894,7 +853,9 @@ rf_ioctl(vp, cmd, arg, flag, crp) } out: rcvd_free(&rdp); - sndd_free(&replysdp); + if (error) { + sndd_free(&replysdp); + } return error; } @@ -964,7 +925,7 @@ rf_ioctl_resp(rdp, vcver, bp, giftsdp, replysdp, crp) break; } } else { - gdp_j_accuse("rf_ioctl_pass bad opcode", + gdp_discon("rf_ioctl_pass bad opcode", QPTOGP(chansdp->sd_queue)); error = EPROTO; break; @@ -990,7 +951,7 @@ rf_ioctl_resp(rdp, vcver, bp, giftsdp, replysdp, crp) struct file *fp; /* sink */ int fd; /* sink */ - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); + sndd_set(giftsdp, (queue_t *)msg->m_queue, msg->m_giftid); if (!(error = rfcl_findsndd(&giftsdp, crp, bp, SDTOV(chansdp)->v_vfsp))) { struct vnode *vp = SDTOV(giftsdp); @@ -1033,6 +994,9 @@ rf_link(tdvp, fvp, nm, crp) register size_t totalsz = headsz + datasz; rfcl_fsinfo.fsivop_other++; + if (RF_SERVER()) { + return EMULTIHOP; + } if (fsdp->sd_queue != chansdp->sd_queue) { return EXDEV; } @@ -1047,7 +1011,7 @@ rf_link(tdvp, fvp, nm, crp) break; } rfcl_reqsetup(bp, chansdp, crp, RFLINK, ULIMIT); - RF_REQ(bp)->rq_link.from = fsdp->sd_gift; + RF_REQ(bp)->rq_rflink.link = fsdp->sd_connid; (void)strcpy(rf_msgdata(bp, headsz), nm); error = rfcl_xac(&bp, totalsz, rdp, vcver, FALSE, &nacked); } @@ -1086,7 +1050,10 @@ rf_lookup(dvp, comp, vpp, pnp, flags, rdirvp, crp) rfcl_fsinfo.fsivop_lookup++; *vpp = NULLVP; /* only reset for success */ - + if (RF_SERVER()) { + error = EMULTIHOP; + goto failed; + } if (vcver < RFS2DOT0) { return du_lookup(dvp, comp, vpp, pnp, flags, rdirvp, crp); } @@ -1143,12 +1110,10 @@ rf_lookup(dvp, comp, vpp, pnp, flags, rdirvp, crp) rqp = RF_REQ(bp); data = rf_msgdata(bp, headsz); if (rdirvp && ISRFSVP(rdirvp) && - rdirvp->v_vfsp == dvp->v_vfsp) { - rqp->rq_rrdir_id = VTOSD(rdirvp)->sd_gift.gift_id; - rqp->rq_rrdir_gen = VTOSD(rdirvp)->sd_gift.gift_gen; + VTOSD(rdirvp)->sd_connid == chansdp->sd_connid) { + rqp->rq_rrdir = VTOSD(rdirvp)->sd_connid; } else { - rqp->rq_rrdir_id = 0; - rqp->rq_rrdir_gen = 0; + rqp->rq_rrdir = 0; } (void)strcpy(data, comp); if (!nsubmounts) { @@ -1186,7 +1151,7 @@ rf_lookup(dvp, comp, vpp, pnp, flags, rdirvp, crp) /* * Either RFDOTDOT, RFPATHREVAL, or completed successfully. - * In the non-error cases, update pnp and vpp. Get new reference to + * In the non-error cases, update pnp and vpp . Get new reference to * result vnode and return through vpp. */ STATIC int @@ -1213,10 +1178,10 @@ rf_lookup_pass(dvp, vpp, pnp, flags, rdirvp, crp, bp, giftsdp, nsubmounts) int error = 0; size_t hdrsz = RF_MIN_RESP(vcver); - if (RF_PULLUP(bp, hdrsz, (size_t)RF_MSG(bp)->m_size - hdrsz)) { - gdp_j_accuse("rf_lookup_pass bad response", gp); - sndd_free(&giftsdp); - return EPROTO; + if (RF_COM(bp)->co_opcode != RFLOOKUP && + (error = RF_PULLUP(bp, hdrsz, (size_t)RF_MSG(bp)->m_size - hdrsz)) + != 0) { + return error; } msg = RF_MSG(bp); @@ -1227,17 +1192,15 @@ rf_lookup_pass(dvp, vpp, pnp, flags, rdirvp, crp, bp, giftsdp, nsubmounts) switch ((int)cop->co_opcode) { case RFLOOKUP: if (!(msg->m_stat & RF_GIFT)) { - gdp_j_accuse("rf_lookup_pass: no file reference", gp); + gdp_discon("rf_lookup_pass: no file reference", gp); sndd_free(&giftsdp); return EPROTO; } if (!data) { - gdp_j_accuse("rf_lookup_pass no response data", gp); - sndd_free(&giftsdp); + gdp_discon("rf_lookup_pass no response data", gp); return EPROTO; } if (!nsubmounts) { - /* * Pathname, rather than component, lookup. * @@ -1250,14 +1213,13 @@ rf_lookup_pass(dvp, vpp, pnp, flags, rdirvp, crp, bp, giftsdp, nsubmounts) * end of the pathname and set the pathlen to 0, * as expected by lookuppn(). */ - pnp->pn_path += pnp->pn_pathlen; pnp->pn_pathlen = 0; if (flags & LOOKUP_DIR) { pn_setlast(pnp); } } - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); + sndd_set(giftsdp, (queue_t *)msg->m_queue, msg->m_giftid); if (!(error = rfcl_findsndd(&giftsdp, crp, bp, dvp->v_vfsp))) { vp = SDTOV(giftsdp); @@ -1283,10 +1245,8 @@ rf_lookup_pass(dvp, vpp, pnp, flags, rdirvp, crp, bp, giftsdp, nsubmounts) if (!rf_fcanon(RFLKC_FMT, data, data + sizeof(rflkc_info_t) + RFLKC_XP, info)) { - gdp_j_accuse( - "rf_lookup_pass bad data", - gp); - VN_RELE(vp); + gdp_discon("rf_lookup bad data", + gp); error = EPROTO; break; } @@ -1319,10 +1279,9 @@ rf_lookup_pass(dvp, vpp, pnp, flags, rdirvp, crp, bp, giftsdp, nsubmounts) break; case RFDOTDOT: sndd_free(&giftsdp); - datalen = rp->rp_v2giftinfo.pathlen; + datalen = rp->rp_v2gift.pathlen; if (pnp->pn_pathlen < datalen) { - gdp_j_accuse("rf_lookup_pass too much response data", - gp); + gdp_discon("rf_lookup_pass too much response data", gp); return EPROTO; } pnp->pn_path += pnp->pn_pathlen - datalen; @@ -1333,7 +1292,7 @@ rf_lookup_pass(dvp, vpp, pnp, flags, rdirvp, crp, bp, giftsdp, nsubmounts) case RFPATHREVAL: sndd_free(&giftsdp); if (!data) { - gdp_j_accuse("rf_lookup_pass no response data", gp); + gdp_discon("rf_lookup_pass no response data", gp); return EPROTO; } if ((error = pn_set(pnp, data)) != 0) { @@ -1350,7 +1309,7 @@ rf_lookup_pass(dvp, vpp, pnp, flags, rdirvp, crp, bp, giftsdp, nsubmounts) break; default: sndd_free(&giftsdp); - gdp_j_accuse("rf_lookup_pass bad opcode", gp); + gdp_discon("rf_lookup_pass bad opcode", gp); return EPROTO; } if (!error) { @@ -1381,10 +1340,10 @@ rf_lookup_fail(dvp, pnp, crp, bp, giftsdp, error, nsubmounts) * First condition implies pathname, rather than component, * lookup. */ - register int datalen = RF_RESP(bp)->rp_v2giftinfo.pathlen; + register int datalen = RF_RESP(bp)->rp_v2gift.pathlen; if (pnp->pn_pathlen < datalen) { - gdp_j_accuse("rf_lookup_fail too much response data", + gdp_discon("rf_lookup_fail too much response data", QPTOGP(VTOSD(dvp)->sd_queue)); pn_setlast(pnp); error = EPROTO; @@ -1422,6 +1381,9 @@ rf_mkdir(dvp, nm, vap, vpp, crp) struct rqmkdent rqmkdent; *vpp = NULLVP; + if (RF_SERVER()) { + return EMULTIHOP; + } rfcl_fsinfo.fsivop_other++; if (vcver < RFS2DOT0) { return du_mkdir(dvp, nm, vap, vpp, crp); @@ -1439,7 +1401,10 @@ rf_mkdir(dvp, nm, vap, vpp, crp) return error; } rdp->rd_sdp = chansdp; - + /* + * Calculate datasz, up datasz to worst case + * in heterogeneous environment. + */ headsz = RF_MIN_REQ(vcver); datasz = gp->hetero != NO_CONV ? sizeof(struct rqmkdent) + MKDENT_XP : sizeof(struct rqmkdent); @@ -1464,23 +1429,27 @@ rf_mkdir(dvp, nm, vap, vpp, crp) error = rfcl_xac(&bp, totalsz, rdp, vcver, FALSE, &nacked); } rcvd_free(&rdp); - if (!error && (error = RF_RESP(bp)->rp_errno) == 0) { - register rf_message_t *msg = RF_MSG(bp); + if (!error) { + if ((error = RF_RESP(bp)->rp_errno) == 0) { + register rf_message_t *msg = RF_MSG(bp); - if (!(msg->m_stat & RF_GIFT)) { - gdp_j_accuse("rf_mkdir_pass no file reference", + if (!(msg->m_stat & RF_GIFT)) { + gdp_discon("rf_mkdir_pass file reference", QPTOGP((queue_t *)msg->m_queue)); error = EPROTO; } else { - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); - if ((error = rfcl_findsndd(&giftsdp, crp, bp, - dvp->v_vfsp)) == 0) { - *vpp = SDTOV(giftsdp); + sndd_set(giftsdp, (queue_t *)msg->m_queue, + msg->m_giftid); + if ((error = rfcl_findsndd(&giftsdp, crp, bp, + dvp->v_vfsp)) == 0) { + *vpp = SDTOV(giftsdp); + } } + } else { + sndd_free(&giftsdp); } rf_freemsg(bp); - } - if (error) { + } else { sndd_free(&giftsdp); } return error; @@ -1521,7 +1490,8 @@ rf_open(vpp, filemode, crp) */ vfs_t *vfsp = SDTOV(chansdp)->v_vfsp; - sndd_set(giftsdp, msg->m_queue, &msg->m_gift); + sndd_set(giftsdp, (queue_t *)msg->m_queue, + msg->m_giftid); if (!(error = rfcl_findsndd(&giftsdp, crp, bp, vfsp))) { *vpp = SDTOV(giftsdp); } else { @@ -1563,6 +1533,9 @@ rf_readdir(vp, uiop, crp, eofp) ulong oresid = uiop->uio_resid; rfcl_fsinfo.fsivop_readdir++; + if (RF_SERVER()) { + return EMULTIHOP; + } /* create an rd on which to receive the response */ if ((error = rcvd_create(TRUE, RDSPECIFIC, &rdp)) != 0) { goto out; @@ -1645,7 +1618,8 @@ rf_readdir_resp(rdp, bp, uiop, replysdp, eofp) noffset = rp->rp_offset; if (gp->hetero != NO_CONV && - (error = rf_readdir_fcanon(bp, hdrsz, gp)) != 0) { + (error = rf_readdir_fcanon(bp, hdrsz, gp, &uio_error)) + != 0) { goto out; } @@ -1659,19 +1633,16 @@ rf_readdir_resp(rdp, bp, uiop, replysdp, eofp) } } if (rp_op == RFREADDIR) { - /* * We are forced to believe that the returned offset is - * correct; reset uio_offset accordingly. + * correct, reset uio_offset accordingly. */ - uiop->uio_offset = noffset; /* * signals and rp_errno are meaningful only in the final * response, distinguished here by the RFREADDIR opcode */ - if (!rf_sigisempty(rp, gp->version)) { rf_postrpsigs(rp, gp->version, u.u_procp); } @@ -1683,11 +1654,9 @@ rf_readdir_resp(rdp, bp, uiop, replysdp, eofp) } /* receive a new response message and verify it is error free */ - if ((error = rf_rcvmsg(rdp, &bp)) != 0) { goto out; } - rp = RF_RESP(bp); } out: @@ -1727,7 +1696,7 @@ rf_readlink(vp, uiop, crp) error = rfcl_readmove(&bp, uiop, (sndd_t *)NULL, &uio_error); } else { - gdp_j_accuse("rf_rdlink bad response", + gdp_discon("rf_rdlink bad response", QPTOGP(chansdp->sd_queue)); error = EPROTO; rf_freemsg(bp); @@ -1755,6 +1724,9 @@ rf_read(vp, uiop, f, crp) ulong oresid = uiop->uio_resid; rfcl_fsinfo.fsivop_read++; + if (RF_SERVER()) { + return EMULTIHOP; + } VOP_RWUNLOCK(vp); for (;;) { if (sdp->sd_stat & SDCACHE) { @@ -1772,7 +1744,7 @@ rf_read(vp, uiop, f, crp) if (--sdp->sd_crwlock.nreaders == 0 && sdp->sd_crwlock.want) { sdp->sd_crwlock.want = FALSE; - wakeprocs((caddr_t)&sdp->sd_crwlock, PRMPT); + wakeup((caddr_t)&sdp->sd_crwlock); } /* * !error && RFC_INCACHE == done @@ -1827,8 +1799,15 @@ rf_write(vp, uiop, f, crp) rfcl_fsinfo.fsivop_write++; + if (RF_SERVER()) { + return EMULTIHOP; + } + VOP_RWUNLOCK(vp); + if (f & IO_APPEND && vp->v_type == VREG) { + uiop->uio_offset = VTOSD(vp)->sd_size; + } rf_rwa.uiop = uiop; rf_rwa.cached = FALSE; rf_rwa.wr_ioflag = f; @@ -1852,22 +1831,12 @@ rf_write(vp, uiop, f, crp) * released) at a lower level if caching is disabled */ - sdp->sd_crwlock.writer = TRUE; - rf_rwa.cached = TRUE; - - if (f & IO_APPEND && vp->v_type == VREG) { - uiop->uio_offset = VTOSD(vp)->sd_size; - } - if ((error = rfcl_uioclone(uiop, &rf_rwa, &iovsize)) != 0) { - sdp->sd_crwlock.writer = FALSE; - if (sdp->sd_crwlock.want) { - sdp->sd_crwlock.want = FALSE; - wakeprocs((caddr_t)&sdp->sd_crwlock, PRMPT); - } goto rwlock; } iovp = (caddr_t)rf_rwa.cwruio.uio_iov; + sdp->sd_crwlock.writer = TRUE; + rf_rwa.cached = TRUE; /* * Suppressing this for unmappable files will prevent failing @@ -1875,10 +1844,7 @@ rf_write(vp, uiop, f, crp) * we will copy data in twice. */ - if (!(vp->v_flag & VNOMAP)) { - rf_rwa.wr_kern = TRUE; - rf_rwa.wr_bufp = NULL; - } + rf_rwa.wr_kern = !(vp->v_flag & VNOMAP); } error = rfcl_write_op(VTOSD(vp), crp, RFWRITE, &rf_rwa); @@ -1890,7 +1856,7 @@ rf_write(vp, uiop, f, crp) sdp->sd_crwlock.writer = FALSE; if (sdp->sd_crwlock.want) { sdp->sd_crwlock.want = FALSE; - wakeprocs((caddr_t)&sdp->sd_crwlock, PRMPT); + wakeup((caddr_t)&sdp->sd_crwlock); } } @@ -1938,7 +1904,7 @@ rf_write(vp, uiop, f, crp) STATIC int rf_map(vp, off, as, addrp, len, prot, maxprot, flags, cred) vnode_t *vp; - uint off; + int off; struct as *as; caddr_t *addrp; int len; @@ -1947,23 +1913,31 @@ rf_map(vp, off, as, addrp, len, prot, maxprot, flags, cred) uint flags; cred_t *cred; { - struct segvn_crargs crargs; + struct segvn_crargs crargs; /* args to segvn_create */ ASSERT((maxprot & prot) == prot); - if ((int)off < 0 || (int)(off + len) < 0) { - return EINVAL; - } - if (vp->v_type != VREG && vp->v_type != VBLK) { - return ENODEV; + if (RF_SERVER()){ + return EMULTIHOP; } - if (vp->v_filocks) { - return EAGAIN; + if (off < 0) { + return EINVAL; } if (vp->v_flag & VNOMAP) { return ENOSYS; } + if (off + len > ptob(btopr(VTOSD(vp)->sd_size))) { + /* Don't allow a mapping beyond the last page in the file. */ + return ENXIO; + } + crargs.vp = vp; + crargs.offset = off; + crargs.type = (u_char)(flags & MAP_TYPE); + crargs.prot = (u_char)prot; + crargs.maxprot = (u_char)maxprot; + crargs.cred = cred; + crargs.amp = NULL; if (!(flags & MAP_FIXED)) { (void)map_addr(addrp, len, (off_t)off, 1); if (!*addrp) { @@ -1974,13 +1948,7 @@ rf_map(vp, off, as, addrp, len, prot, maxprot, flags, cred) (void)as_unmap(as, *addrp, len); } - crargs.vp = vp; - crargs.offset = off; - crargs.type = (u_char)(flags & MAP_TYPE); - crargs.prot = (u_char)prot; - crargs.maxprot = (u_char)maxprot; - crargs.cred = cred; - crargs.amp = NULL; + /* as_map takes care of aligning its args. */ return as_map(as, *addrp, len, segvn_create, (caddr_t)&crargs); } @@ -1999,9 +1967,10 @@ rf_map(vp, off, as, addrp, len, prot, maxprot, flags, cred) * starting offset in the file of the mapping * as * address space in which to establish the mapping - * addr - * addr refers to the virtual address in as at which to start - * mapping + * addrp + * if MAP_FIXED is set, addrp refers to the virtual address in + * as at which to start mapping. Otherwise, map_addr() is + * used to set this address. * len * length of mapping * prot @@ -2020,11 +1989,11 @@ rf_map(vp, off, as, addrp, len, prot, maxprot, flags, cred) */ /* ARGSUSED */ STATIC int -rf_addmap(vp, off, as, addr, len, prot, maxprot, flags, cred) +rf_addmap(vp, off, as, addrp, len, prot, maxprot, flags, cred) vnode_t *vp; int off; struct as *as; - caddr_t addr; + caddr_t *addrp; uint len; uint prot; uint maxprot; @@ -2034,28 +2003,25 @@ rf_addmap(vp, off, as, addr, len, prot, maxprot, flags, cred) register sndd_t *sdp = VTOSD(vp); int error = 0; mblk_t *bp = NULL; - union rq_arg rqarg = init_rq_arg; if (vp->v_flag & VNOMAP) { return ENOSYS; } - - rqarg.rqmap.offset = off; - rqarg.rqmap.len = len; - rqarg.rqmap.maxprot = maxprot; - if (!(flags & MAP_SHARED)) { - rqarg.rqmap.maxprot &= ~PROT_WRITE; - } - - if ((error = rfcl_op(sdp, cred, RFADDMAP, &rqarg, &bp, TRUE)) == 0) { + if (!sdp->sd_mapcnt && (error = rfcl_op(sdp, cred, RFMAP, + &init_rq_arg, &bp, TRUE)) == 0) { error = RF_RESP(bp)->rp_errno; rf_freemsg(bp); bp = NULL; } + if (!error) { + sdp->sd_mapcnt += btopr(len); + } return error; } /* + * Decrement mapcnt to correspond to the removal of any mappings to + * the denoted file in the specified range. * Args * NOTE: there are currently no alignment restrictions on off, addr, or * len; they are adjusted internally. It's unclear to what extent this is @@ -2068,7 +2034,7 @@ rf_addmap(vp, off, as, addr, len, prot, maxprot, flags, cred) * starting offset in the file of the area to be unmapped * as * address space of the mapping - * addr + * addrp * virtual address at which the mapping starts. * len * length of mapping @@ -2089,59 +2055,31 @@ rf_addmap(vp, off, as, addr, len, prot, maxprot, flags, cred) */ /* ARGSUSED */ STATIC int -rf_delmap(vp, off, as, addr, len, prot, maxprot, flags, cred) +rf_delmap(vp, off, as, addrp, len, prot, maxprot, flags, cred) vnode_t *vp; uint off; struct as *as; - caddr_t addr; + caddr_t *addrp; uint len; uint prot; uint maxprot; uint flags; cred_t *cred; { - register sndd_t *sdp = VTOSD(vp); - mblk_t *bp = NULL; - int nacked = TRUE; - int vcver = QPTOGP(sdp->sd_queue)->version; - size_t minreq = RF_MIN_REQ(vcver); - rcvd_t *rdp; - union rq_arg rqarg = init_rq_arg; + register sndd_t *sdp = VTOSD(vp); if (vp->v_flag & VNOMAP) { return ENOSYS; } + sdp->sd_mapcnt -= btopr(len); + ASSERT(sdp->sd_mapcnt >= 0); + if (!sdp->sd_mapcnt) { + mblk_t *bp = NULL; - rqarg.rqmap.offset = off; - rqarg.rqmap.len = len; - rqarg.rqmap.maxprot = maxprot; - if (!(flags & MAP_SHARED)) { - rqarg.rqmap.maxprot &= ~PROT_WRITE; - - } else { - - /* - * Servers will generally only accept our putpages while - * mappings are current. Synchronously do them now for the - * range being unmapped. - */ - - (void)VOP_PUTPAGE(vp, off, len, 0, cred); - } - - (void)rcvd_create(FALSE, RDSPECIFIC, &rdp); - rdp->rd_sdp = sdp; - - while (nacked) { - (void)rf_allocmsg(minreq, (size_t)0, BPRI_MED, FALSE, - NULLCADDR, NULLFRP, &bp); - ASSERT(bp); - rfcl_reqsetup(bp, sdp, cred, RFDELMAP, ULIMIT); - RF_REQ(bp)->rq_arg = rqarg; - (void)rfcl_xac(&bp, minreq, rdp, vcver, FALSE, &nacked); + if (!(rfcl_op(sdp, cred, RFUNMAP, &init_rq_arg, &bp, FALSE))) { + rf_freemsg(bp); + } } - rf_freemsg(bp); - rcvd_free(&rdp); return 0; } @@ -2213,6 +2151,9 @@ rf_getpage(vp, off, len, protp, pl, plsz, seg, addr, rw, cred) ASSERT(!(off % PAGESIZE)); rfcl_fsinfo.fsivop_getpage++; + if (RF_SERVER()) { + return EMULTIHOP; + } if (vp->v_flag & VNOMAP) { return ENOSYS; } @@ -2230,7 +2171,7 @@ rf_getpage(vp, off, len, protp, pl, plsz, seg, addr, rw, cred) } /* - * Flush to the backing vnode all dirty pages in the range of file + * Flush to the backing vnode all dirtypages in the range of file * offset [off...off + len), possibly invalidating all pages in the * range. Asumes it is called with vnode unlocked. If the vnode has * no references, returns immediately, else inflates the reference @@ -2279,13 +2220,24 @@ rf_putpage(vp, off, len, flags, cred) int error; rfcl_fsinfo.fsivop_putpage++; + if (RF_SERVER()) { + return EMULTIHOP; + } if (vp->v_flag & VNOMAP) { return ENOSYS; } if (!vp->v_pages) { return 0; } - + if (off >= sdp->sd_size) { + /* + * TO DO: why is this not an error? Also, ufs and NFS + * checked this only after checking len != 0, then set + * dirty = NULL, so they would fall through to the end of + * the function. Why? + */ + return 0; + } /* * If vp->v_count is 0 here, the vnode is already inactive, return. */ @@ -2299,8 +2251,7 @@ rf_putpage(vp, off, len, flags, cred) * PAGESIZE. */ - bsize = QPTOGP(VTOSD(vp)->sd_queue)->datasz; - ASSERT(bsize >= PAGESIZE && !(bsize & PAGEOFFSET)); + bsize = MAX(PAGESIZE, vp->v_vfsp->vfs_bsize); again: sdp->sd_nextr = 0; @@ -2324,11 +2275,13 @@ rf_putpage(vp, off, len, flags, cred) * TO DO: Check for illegal offsets on entry into this * routine, and do reasonable klustering below. */ + uint fsize; /* file size rounded up to PAGESIZE boundary */ uint eoff; /* upper bound of range needed */ uint offlo; /* off rounded down to bsize boundary */ uint offhi; /* eoff rounded up to bsize boundary */ - eoff = off + len; + fsize = ptob(btopr(sdp->sd_size)); + eoff = MIN(off + len, fsize); offlo = off & ~(bsize - 1); offhi = (eoff + bsize) & ~(bsize - 1); @@ -2346,8 +2299,7 @@ rf_putpage(vp, off, len, flags, cred) if (vp->v_vfsp->vfs_flag & VFS_RDONLY && dirty) { error = EROFS; } else { - error = rf_pushpages(&dirty, vp, (flags & ~B_ASYNC), - bsize, cred); + error = rf_pushpages(&dirty, vp, flags, bsize, cred); } /* * The else part below is taken when we're doing synchronous @@ -2586,8 +2538,7 @@ rf_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) cred_t *cred; { register sndd_t *sdp; - register off_t blksize; /* file sys block size */ - size_t blkoff; + register u_int bsize; /* file sys block size */ struct buf *bp; page_t *pp; page_t *pp2; @@ -2596,16 +2547,18 @@ rf_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) daddr_t lbn; off_t io_off; size_t io_len; + size_t blkoff; + off_t blksize; int err; sdp = VTOSD(vp); - blksize = vp->v_vfsp->vfs_bsize; + bsize = vp->v_vfsp->vfs_bsize; reread: err = 0; - lbn = off / blksize; - blkoff = lbn * blksize; + lbn = off / bsize; + blkoff = lbn * bsize; if ((pagefound = page_find(vp, off)) == NULL) { int resid; /* detect fault beyond EOF */ @@ -2614,6 +2567,24 @@ rf_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) * Need to go to server to get a block */ + if (blkoff < sdp->sd_size && blkoff + bsize > sdp->sd_size) { + /* + * If less than a block left in + * file read less than a block. + */ + if (sdp->sd_size <= off) { + /* + * Trying to access beyond EOF, + * set up to get at least one page. + */ + blksize = off + PAGESIZE - blkoff; + } else { + blksize = sdp->sd_size - blkoff; + } + } else { + blksize = bsize; + } + pp = pvn_kluster(vp, off, seg, addr, &io_off, &io_len, blkoff, blksize, 0); @@ -2663,7 +2634,7 @@ rf_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) /* async later */ bp = pageio_setup(pp, io_len, vp, B_READ); - bp->b_blkno = 0; + bp->b_blkno = RF_OFFTOBLK(io_off); bp->b_dev = 0; bp->b_edev = 0; bp_mapin(bp); @@ -2671,10 +2642,21 @@ rf_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cred) err = rfcl_strategy(bp, cred, &resid); /* trashes bp */ bp = NULL; - if (!err) { + if (!err && resid == io_len && sdp->sd_size <= off) { - /* interaction with read - async faultahead later */ + /* + * Faulting beyond EOF. We DO NOT implement + * VOP_READ and VOP_WRITE with mapped I/O. + * (Otherwise this could be an innocent fault.) + */ + ASSERT(seg != segkmap); + + err = EFAULT; + } + + if (!err) { + /* interaction with read - async faultahead later */ sdp->sd_nextr = io_off + io_len; vminfo.v_pgin++; vminfo.v_pgpgin += btopr(io_len); @@ -2763,6 +2745,8 @@ rf_pushpages(ppp, vp, flags, bsize, cred) page_t *io_list; /* pages to write together */ uint lbn_off; /* block-aligned io_list offset */ + sndd_t *sdp = VTOSD(vp); + off_t last_off = sdp->sd_size & PAGEMASK; struct buf *bp; while (!error && (pp = *ppp) != NULL) { @@ -2787,6 +2771,14 @@ rf_pushpages(ppp, vp, flags, bsize, cred) page_sortadd(&io_list, pp); io_len += PAGESIZE; } + if (pp->p_prev->p_offset == last_off) { + + /* + * Last page - make sure not to flush beyond EOF. + */ + + io_len -= PAGESIZE - (sdp->sd_size & PAGEOFFSET); + } /* * ufs and NFS have code to handle the case that the asserted @@ -2810,7 +2802,7 @@ rf_pushpages(ppp, vp, flags, bsize, cred) } else { int sink; - bp->b_blkno = 0; + bp->b_blkno = RF_OFFTOBLK(lbn_off); bp->b_dev = 0; bp->b_edev = 0; bp_mapin(bp); @@ -2850,6 +2842,9 @@ rf_remove(dvp, nm, crp) register size_t datasz; register size_t totalsz; + if (RF_SERVER()) { + return EMULTIHOP; + } rfcl_fsinfo.fsivop_other++; vcver = QPTOGP(chansdp->sd_queue)->version; if (vcver < RFS2DOT0) { @@ -2904,6 +2899,9 @@ rf_rename(fdvp, fnm, tdvp, tnm, crp) size_t totalsz; rfcl_fsinfo.fsivop_other++; + if (RF_SERVER()) { + return EMULTIHOP; + } vcver = QPTOGP(chansdp->sd_queue)->version; if (vcver < RFS2DOT0) { return du_rename(fdvp, fnm, tdvp, tnm, crp); @@ -2931,8 +2929,8 @@ rf_rename(fdvp, fnm, tdvp, tnm, crp) reqp = RF_REQ(bp); rqdatap = rf_msgdata(bp, headsz); - reqp->rq_rename.from = fdsdp->sd_gift; - reqp->rq_rename.to = chansdp->sd_gift; + reqp->rq_rename.frdid = fdsdp->sd_connid; + reqp->rq_rename.trdid = chansdp->sd_connid; (void)strcpy(rqdatap, fnm); (void)strcpy(rqdatap + fnmlen, tnm); error = rfcl_xac(&bp, totalsz, rdp, vcver, FALSE, &nacked); @@ -2963,6 +2961,9 @@ rf_rmdir(dvp, nm, cdvp, crp) size_t datasz; size_t totalsz; + if (RF_SERVER()) { + return EMULTIHOP; + } rfcl_fsinfo.fsivop_other++; vcver = QPTOGP(chansdp->sd_queue)->version; if (vcver < RFS2DOT0) { @@ -2982,16 +2983,15 @@ rf_rmdir(dvp, nm, cdvp, crp) break; } rfcl_reqsetup(bp, chansdp, crp, RFRMDIR, ULIMIT); - /* - * The VOP_RMDIR RFS op specifies that cdvp (the user's + * The VOP_RMDIR interface specifies that cdvp (the user's * current * directory) must not be removed. If it and dvp * (the parent directory of nm) are in the same vfs as seen - * by the client then gift is a cookie for cdvp. Otherwise, - * gift is empty. + * by the client then connid is a cookie for cdvp. Otherwise, + * connid is 0. */ - RF_REQ(bp)->rq_rmdir.dir = cdvp->v_vfsp == dvp->v_vfsp ? - VTOSD(cdvp)->sd_gift : rf_null_gift; + RF_REQ(bp)->rq_rmdir.connid = cdvp->v_vfsp == dvp->v_vfsp ? + VTOSD(cdvp)->sd_connid : 0; (void)strcpy(rf_msgdata(bp, headsz), nm); error = rfcl_xac(&bp, totalsz, rdp, vcver, FALSE, &nacked); } @@ -3022,6 +3022,9 @@ rf_setattr(vp, vap, flags, crp) size_t datasz; size_t totalsz; + if (RF_SERVER()) { + return EMULTIHOP; + } rfcl_fsinfo.fsivop_other++; vcver = QPTOGP(chansdp->sd_queue)->version; if (vcver < RFS2DOT0) { @@ -3089,6 +3092,10 @@ rf_symlink(dvp, linkname, vap, target, crp) size_t datasz; size_t totalsz; + if (RF_SERVER()) { + return EMULTIHOP; + } + /* If remote is older than RFS2DOT0, symlink is not supported. */ if (vcver < RFS2DOT0) { return ENOSYS; @@ -3225,7 +3232,7 @@ rf_symlnk_resp(replysdp, bp, gp, targetln, targetnm, rdp) register caddr_t rpdata; size_t hdrsz = RF_MIN_RESP(gp->version); - sndd_set(replysdp, mp->m_queue, &mp->m_gift); + sndd_set(replysdp, (queue_t *)mp->m_queue, mp->m_giftid); rf_freemsg(bp); (void)rf_allocmsg(hdrsz, targetln, BPRI_MED, FALSE, NULLCADDR, NULLFRP, &bp); @@ -3248,10 +3255,11 @@ rf_symlnk_resp(replysdp, bp, gp, targetln, targetnm, rdp) u.u_procp->p_sig |= resp->rp_v1sig; error = resp->rp_errno; } - } else if (cop->co_opcode != RFSYMLINK || - (error = resp->rp_errno) == 0 && replysdp) { - gdp_j_accuse("rf_symlink bad opcode", gp); + } else if (cop->co_opcode != RFSYMLINK || replysdp) { + gdp_discon("rf_symlink bad opcode", gp); error = EPROTO; + } else { + error = resp->rp_errno; } rf_freemsg(bp); return error; @@ -3297,43 +3305,25 @@ rflkc_acc_hit(vp, crp) * nonzero for fatal errors. May update mblk denoted by bp. */ STATIC int -rf_readdir_fcanon(bp, hdrsz, gp) +rf_readdir_fcanon(bp, hdrsz, gp, uio_errorp) register mblk_t *bp; register size_t hdrsz; gdp_t *gp; + int *uio_errorp; { register size_t datasz; register caddr_t msgdata; register rf_response_t *rp; - register mblk_t *contbp; datasz = RF_MSG(bp)->m_size - hdrsz; - if (RF_PULLUP(bp, hdrsz, datasz)) { - gdp_discon("rf_readdir_fcanon bad data", gp); - return EPROTO; - } - rp = RF_RESP(bp); - msgdata = rf_msgdata(bp, hdrsz); - if ((rp->rp_count = rf_denfcanon(rp->rp_count, msgdata, - msgdata + datasz)) == 0) { - gdp_discon("rf_readdir_fcanon bad data", gp); - return EPROTO; - } - - if ((contbp = bp->b_cont) != NULL) { - - /* Data is contiguous in second block. */ - - ASSERT(msgdata == (caddr_t)contbp->b_rptr); - - contbp->b_wptr = (unsigned char *)msgdata + rp->rp_count; - } else { - - /* Headers and data are contiguous in first block. */ - - ASSERT(msgdata == (caddr_t)bp->b_rptr + hdrsz); - - bp->b_wptr = (unsigned char *)msgdata + rp->rp_count; + if ((*uio_errorp = RF_PULLUP(bp, hdrsz, datasz)) == 0) { + rp = RF_RESP(bp); + msgdata = rf_msgdata(bp, hdrsz); + if ((rp->rp_count = rf_denfcanon(rp->rp_count, msgdata, + msgdata + datasz)) == 0) { + gdp_discon("rf_readdir_fcanon bad data", gp); + return EPROTO; + } } return 0; } diff --git a/usr/src/uts/3b2/fs/rfs/rfcl_subr.c b/usr/src/uts/3b2/fs/rfs/rfcl_subr.c index 902325e..fc837a5 100644 --- a/usr/src/uts/3b2/fs/rfs/rfcl_subr.c +++ b/usr/src/uts/3b2/fs/rfs/rfcl_subr.c @@ -1,11 +1,4 @@ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)fs:fs/rfs/rfcl_subr.c 1.15" +#ident "@(#)fs:fs/rfs/rfcl_subr.c 1.6.1.1 UNOFFICIAL" #include "sys/list.h" #include "sys/types.h" #include "sys/param.h" @@ -42,16 +35,14 @@ #include "sys/kmem.h" #include "sys/mount.h" #include "sys/systm.h" +#include "rf_cache.h" #include "sys/mode.h" #include "sys/pathname.h" #include "vm/page.h" #include "vm/seg_map.h" #include "vm/pvn.h" -#include "rf_cache.h" -/* imports */ extern int rf_state; -extern void bp_mapin(); union rq_arg init_rq_arg; @@ -128,15 +119,8 @@ rfcl_xac(bpp, size, rdp, vcver, retrans, nackp) register sndd_t *chansdp = rdp->rd_sdp; *nackp = 0; /* only reset when appropriate */ - - if (RF_SERVER()) { - rf_freemsg(*bpp); + if ((error = rf_sndmsg(chansdp, *bpp, size, rdp, retrans)) != 0) { *bpp = NULL; - return EMULTIHOP; - } - error = rf_sndmsg(chansdp, *bpp, size, rdp, retrans); - *bpp = NULL; - if (error) { return error; } if ((error = rf_rcvmsg(rdp, bpp)) != 0) { @@ -159,18 +143,15 @@ rfcl_xac(bpp, size, rdp, vcver, retrans, nackp) } if (!error && *nackp) { if (rp->rp_cache & RP_MNDLCK) { - /* * somebody turned on locking behind our back; * disable caching for the file. */ - - if (vcver == RFS1DOT0) { - chansdp->sd_stat |= SDMNDLCK; - /* CONSTCOND */ - rfc_disable(chansdp, 0); - } else { - gdp_j_accuse("rfcl_xac mandlock NACK", + chansdp->sd_stat |= SDMNDLCK; + /* CONSTCOND */ + rfc_disable(chansdp, 0); + if (vcver != RFS1DOT0) { + gdp_discon("rfcl_xac mandlock NACK", QPTOGP(chansdp->sd_queue)); error = EPROTO; *nackp = FALSE; @@ -207,8 +188,6 @@ rfcl_reqsetup(bp, chansdp, crp, opcode, ulim) cop->co_gid = crp->cr_gid; cop->co_mntid = chansdp->sd_mntid; - reqp->rq_ulimit = ulim >> ULIMSHIFT; - /* * Copy as many as the agreed maximum number of groups into * the request, if the server supports multi-groups. @@ -221,34 +200,34 @@ rfcl_reqsetup(bp, chansdp, crp, opcode, ulim) for (gn = 0; gn < (ushort)reqp->rq_ngroups; gn++) { reqp->rq_groups[gn] = crp->cr_groups[gn]; } - } else { + } + reqp->rq_ulimit = ulim >> ULIMSHIFT; - /* - * Since a single sndd represents a given file, another process - * may have set SDMNDLCK in ours, thus each request contains an - * indication of MNDLCK status. - */ + /* + * Since a single sndd represents a given file, another process + * may have set SDMNDLCK in ours, thus each request contains an + * indication of MNDLCK status. + */ - if (chansdp->sd_stat & SDMNDLCK) { - reqp->rq_flags |= RQ_MNDLCK; - } else { - reqp->rq_flags &= ~RQ_MNDLCK; - } + if (chansdp->sd_stat & SDMNDLCK) { + reqp->rq_flags |= RQ_MNDLCK; + } else { + reqp->rq_flags &= ~RQ_MNDLCK; } } /* - * *giftsdpp is assumed to point to a send descriptor whose sd_gift and + * *giftsdpp is assumed to point to a send descriptor whose sd_connid and * sd_queue are well-defined, whose associated vnode has its type and vfsp * defined, and that was allocated only to hold a new reference to a * remote file. *giftsdp must be unlocked. bp must contain a well-defined * response, and vfsp be the vfs in which the file reference resides. * - * Either completes the definition of *giftsdpp, if it is the + * If a protocol misuse is detected, NULLs *giftsdp and returns EPROTO. + * Otherwise either completes the definition of *giftsdp, if it is the * first sndd to refer to a particular file, or frees *giftsdp and - * replaces it with an existing sdp referring to the file. - * - * In error cases, NULLs *giftsdpp and returns error. + * replaces it with an existing sdp referring to the file. In these + * cases, returns 0. * * Global side-effects: updates sdfreelist. */ @@ -265,6 +244,7 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) register rf_response_t *rp = RF_RESP(bp); register sndd_t *sdp; /* candidate */ register sndd_t *endsndd = sndd + nsndd; + register int connid = giftsdp->sd_connid; /* server rd */ register vnode_t *vp; rf_common_t *cop = RF_COM(bp); int vcver = QPTOGP(giftsdp->sd_queue)->version; @@ -288,16 +268,15 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) */ if ((error = rfcl_vn_init(giftsdp, vfsp)) != 0) { + ASSERT(error == EPROTO); sndd_free(giftsdpp); return error; } - vp = SDTOV(giftsdp); sdp = sndd; while (sdp != endsndd) { - if (sdp->sd_gift.gift_id == giftsdp->sd_gift.gift_id && - SDTOV(sdp)->v_vfsp == vfsp && - sdp->sd_stat & SDUSED && !(sdp->sd_stat & SDINTER)) { + if (sdp->sd_connid == connid && SDTOV(sdp)->v_vfsp == vfsp && + sdp->sd_stat & SDUSED && !(sdp->sd_stat & SDINTER)) { /* found the sd */ @@ -309,16 +288,6 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) (void)sleep((caddr_t)sdp, PSNDD); sdp = sndd; continue; - - } else if (sdp->sd_gift.gift_gen != - giftsdp->sd_gift.gift_gen) { - - gdp_j_accuse("rfcl_findsndd bad file reference", - QPTOGP(giftsdp->sd_queue)); - sndd_free(giftsdpp); - --VFTORF(vfsp)->rfvfs_refcnt; - return EPROTO; - } else { break; } @@ -334,16 +303,14 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) vp = SDTOV(sdp); ASSERT(vp->v_vfsp == vfsp); - ASSERT(sdp->sd_queue == giftsdp->sd_queue); - + ASSERT(ISRFSVP(vp)); if (vp->v_type != SDTOV(giftsdp)->v_type) { - gdp_j_accuse("rfcl_findsndd unexpected v_type", + gdp_discon("rfcl_findsndd unexpected v_type", QPTOGP(sdp->sd_queue)); sndd_free(giftsdpp); - --VFTORF(vfsp)->rfvfs_refcnt; return EPROTO; } - + ASSERT(sdp->sd_queue == giftsdp->sd_queue); sdp->sd_size = cop->co_size; VN_HOLD(vp); @@ -357,7 +324,7 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) SDTOV(giftsdp)->v_count = 0; rfcl_sdrele(giftsdpp, crp, 1); } else { - --VFTORF(vfsp)->rfvfs_refcnt; + --VFTORF(vfsp)->rfvfs_refcnt; sdp->sd_remcnt++; sndd_free(giftsdpp); } @@ -365,7 +332,7 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) } else if ((vcver >= RFS2DOT0 || VFTORF(vfsp)->rfvfs_flags & MCACHE) && (sdp = - rfc_sdsearch(VFTORF(vfsp), rp, giftsdp->sd_queue, &giftsdp->sd_gift)) + rfc_sdsearch(VFTORF(vfsp), rp, giftsdp->sd_queue, giftsdp->sd_connid)) != NULL) { /* @@ -386,7 +353,6 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) sdp->sd_remcnt = 1; *giftsdpp = sdp; vp = SDTOV(sdp); - } else { /* @@ -402,8 +368,7 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) sdp->sd_remcnt = 1; vp = SDTOV(sdp); } - - if (vcver < RFS2DOT0 || rp->rp_v2giftinfo.flags & RPG_NOMAP) { + if (vcver < RFS2DOT0 || rp->rp_v2gift.flags & RPG_NOMAP) { /* * Pre-SVR4 servers can't handle page faults. @@ -414,17 +379,10 @@ rfcl_findsndd(giftsdpp, crp, bp, vfsp) vp->v_flag |= VNOMAP; } - - /* - * If remote swap space were used, disconnects, for example, would - * spell disaster for the client. A future, more robust kernel may - * be able to handle this. - */ - vp->v_flag |= VNOSWAP; - if (VFTORF(vfsp)->rfvfs_flags & MCACHE && vp->v_type == VREG && (error = rfcl_ckgiftrp(sdp, bp)) != 0) { + ASSERT(error == EPROTO); VN_RELE(vp); *giftsdpp = NULL; } @@ -452,7 +410,7 @@ rfcl_giftfree(bp, giftsdpp, crp) * set up to give up reference */ cop = RF_COM(bp); - sndd_set(sdp, msgp->m_queue, &msgp->m_gift); + sndd_set(sdp, (queue_t *)msgp->m_queue, msgp->m_giftid); sdp->sd_mntid = cop->co_mntid; sdp->sd_size = cop->co_size; SDTOV(sdp)->v_count = 0; @@ -488,12 +446,11 @@ rfcl_readmove(inbpp, uiop, reply_sdp, uio_errorp) long copysync = resp->rp_copyout.copysync; rf_message_t *mp = RF_MSG(bp); queue_t *qp = (queue_t *)mp->m_queue; - rf_gift_t gift; + long giftid = mp->m_giftid; uio_t ruio; iovec_t *iovp; int niov; - gift = mp->m_gift; if (!*uio_errorp && (bp = rf_dropbytes(bp, RF_MIN_RESP(QPTOGP(qp)->version))) != NULL) { ruio.uio_offset = 0; @@ -520,7 +477,7 @@ rfcl_readmove(inbpp, uiop, reply_sdp, uio_errorp) if (opcode == RFCOPYOUT && copysync) { /* Send a response so the server will not hang */ - error = rfcl_copysync(reply_sdp, qp, &gift); + error = rfcl_copysync(reply_sdp, qp, giftid); } return error; } @@ -556,10 +513,10 @@ rfcl_signal(sdp) * Return nonzero errno for fatal communications error, 0 otherwise. */ int -rfcl_copysync(sdp, qp, giftp) +rfcl_copysync(sdp, qp, giftid) register sndd_t *sdp; queue_t *qp; - rf_gift_t *giftp; + long giftid; { register size_t respsize = RF_MIN_RESP(QPTOGP(qp)->version); mblk_t *bp; @@ -569,12 +526,20 @@ rfcl_copysync(sdp, qp, giftp) NULLFRP, &bp); ASSERT(bp); cop = RF_COM(bp); - sndd_set(sdp, qp, giftp); + sndd_set(sdp, qp, giftid); cop->co_type = RF_RESP_MSG; cop->co_opcode = RFCOPYOUT; return rf_sndmsg(sdp, bp, respsize, (rcvd_t *)NULL, FALSE); } +/* Passed off to rf_async to handle VOP_INACTIVEs that go remote. */ + +typedef struct rfcl_rele { + rfa_work_t work; + sndd_t *sdp; + cred_t *crp; +} rfcl_rele_t; + /* * Give up last reference to remote file. * Call only when denoted vnode has v_count == 0. SDINTER may or may not @@ -590,6 +555,7 @@ rfcl_sdrele(sdpp, crp, goremote) { register sndd_t *sdp = *sdpp; register vnode_t *vp = SDTOV(sdp); + register rfcl_rele_t *rep; ASSERT(sdp->sd_stat & SDUSED); ASSERT(!vp->v_count); @@ -606,17 +572,17 @@ rfcl_sdrele(sdpp, crp, goremote) */ if (vp->v_vfsp) { - /* * Ugh. Under some circumstances, we can get into * this function with a partly-defined sndd. */ - --VFTORF(vp->v_vfsp)->rfvfs_refcnt; } if (goremote) { + /* Lock BEFORE we hand this off to rf_async, to avoid races. */ + ASSERT(!(sdp->sd_stat & SDLOCKED)); SDLOCK(sdp); @@ -631,7 +597,26 @@ rfcl_sdrele(sdpp, crp, goremote) sdp->sd_stat |= SDINTER; } - rfcl_dorele(sdp, crp); + + /* + * rf_async will call rfcl_dorele, which will free its arg + * structure and go remote to give up the reference. + */ + + rep = (rfcl_rele_t *)kmem_alloc(sizeof(rfcl_rele_t), KM_SLEEP); + rep->sdp = sdp; + rep->crp = crp; + crhold(crp); + rep->work.rfaw_func = rfcl_dorele; + rep->work.rfaw_farg = (caddr_t)rep; + rep->work.rfaw_canfail = TRUE; + LS_INIT(&rep->work.rfaw_elt); + if (rfa_workenq(&rep->work) != 0) { + + /* enqueue failed - do it ourselves */ + + rfcl_dorele(&rep->work); + } } else if (vp->v_pages) { /* @@ -663,7 +648,7 @@ rfcl_vn_init(giftsdp, vfsp) register vnode_t *vp = SDTOV(giftsdp); if (vp->v_type <= VNON || vp->v_type >= VBAD) { - gdp_j_accuse("rfcl_vn_init unexpected vtype", + gdp_discon("rfcl_vn_init unexpected vtype", QPTOGP(giftsdp->sd_queue)); return EPROTO; } @@ -699,21 +684,6 @@ rfcl_ckgiftrp(sdp, bp) ASSERT(VFTORF(vp->v_vfsp)->rfvfs_flags & MCACHE); if (QPTOGP(sdp->sd_queue)->version < RFS2DOT0) { - struct a { - char *fname; - int mode; - int crtmode; - } *uap = (struct a *)u.u_ap; - - if ((sdp->sd_stat & SDCACHE || - rp->rp_cache & DU_CACHE_ENABLE) && - (cop->co_opcode == RFCREATE || - cop->co_opcode == RFCREATE && uap->mode & FTRUNC) && - sdp->sd_vcode != rp->rp_rval) { - rfc_pageabort(sdp, (off_t)0, (off_t)0); - rfc_disable(sdp, (ulong)rp->rp_rval); - sdp->sd_size = 0; - } if (rp->rp_cache & DU_CACHE_ENABLE) { sdp->sd_size = (size_t)cop->co_size; rfc_enable(sdp, (ulong)rp->rp_rval, rp->rp_fhandle); @@ -954,7 +924,7 @@ int rfcl_write_op(chansdp, crp, op, rf_rwap) sndd_t *chansdp; cred_t *crp; - int op; + int op; /* RFREAD, RFGETPAGE, etc. */ rf_rwa_t *rf_rwap; { uio_t *uiop = rf_rwap->uiop; @@ -989,17 +959,6 @@ rfcl_write_op(chansdp, crp, op, rf_rwap) base = uiop->uio_iov->iov_base; if (rf_rwap->wr_kern) { - - if (prewrite < uiop->uio_resid) { - - /* - * page-align to increase write cache hits and avoid - * blocking on page locks in RFCOPYIN responses. - */ - - prewrite -= uiop->uio_offset + prewrite & PAGEOFFSET; - } - opoff = uiop->uio_offset; } @@ -1053,7 +1012,7 @@ rfcl_write_op(chansdp, crp, op, rf_rwap) if (ntries == 1) { if (rf_rwap->wr_kern) { - error = rfcl_esbwrmsg(chansdp, rf_rwap, hdrsz, + error = rfcl_esbwrmsg(chansdp, uiop, hdrsz, prewrite, BPRI_LO, TRUE, &bp); if (error) { break; @@ -1068,6 +1027,14 @@ rfcl_write_op(chansdp, crp, op, rf_rwap) } } + if ((dupbp = dupmsg(bp)) == NULL) { + error = EAGAIN; + break; + } + + rfcl_reqsetup(bp, chansdp, crp, op, + (ulong)uiop->uio_limit); + /* set up op specific fields in req message */ reqp = RF_REQ(bp); reqp->rq_xfer.offset = offset; @@ -1076,21 +1043,11 @@ rfcl_write_op(chansdp, crp, op, rf_rwap) reqp->rq_xfer.fmode = uiop->uio_fmode; reqp->rq_xfer.prewrite = prewrite; - if ((dupbp = dupmsg(bp)) == NULL) { - error = EAGAIN; - break; - } - } else if ((bp = dupmsg(dupbp)) == NULL) { error = EAGAIN; break; } - /* - * Repeat this per retry because MANDLOCK status may change. - */ - rfcl_reqsetup(bp, chansdp, crp, op, (ulong)uiop->uio_limit); - error = rfcl_xac(&bp, hdrsz + prewrite, rdp, vcver, ntries == 1 ? FALSE : TRUE, &nacked); @@ -1099,6 +1056,16 @@ rfcl_write_op(chansdp, crp, op, rf_rwap) rf_freemsg(dupbp); dupbp = NULL; + if (rf_rwap->wr_kern && error) { + + /* + * Here we handle error occurring in the initial transmission. + * rfcl_write_pass must abort pages in case of later errors. + */ + + rfc_pageabort(chansdp, opoff, uiop->uio_offset); + } + if (rf_rwap->cached && !(chansdp->sd_stat & SDCACHE)) { /* @@ -1109,19 +1076,11 @@ rfcl_write_op(chansdp, crp, op, rf_rwap) chansdp->sd_crwlock.writer = FALSE; if (chansdp->sd_crwlock.want) { chansdp->sd_crwlock.want = FALSE; - wakeprocs((caddr_t)&chansdp->sd_crwlock, PRMPT); + wakeup((caddr_t)&chansdp->sd_crwlock); } rf_rwap->cached = FALSE; rf_rwap->wr_kern = FALSE; rfc_pageabort(chansdp, opoff, rf_rwap->cwruio.uio_offset); - } else if (rf_rwap->wr_kern && error) { - - /* - * Here we handle error occurring in the initial transmission. - * rfcl_write_pass must abort pages in case of later errors. - */ - - rfc_pageabort(chansdp, opoff, uiop->uio_offset); } if (!error && (error = RF_RESP(bp)->rp_errno) == 0) { @@ -1265,7 +1224,7 @@ rfcl_writemove(in_bpp, rf_rwap, reply_sdp, req_sdp, uio_errorp) int uio_error = *uio_errorp; int error = 0; - sndd_set(reply_sdp, msgp->m_queue, &msgp->m_gift); + sndd_set(reply_sdp, (queue_t *)msgp->m_queue, msgp->m_giftid); rf_freemsg(*in_bpp); *in_bpp = NULL; @@ -1309,12 +1268,11 @@ rfcl_writemove(in_bpp, rf_rwap, reply_sdp, req_sdp, uio_errorp) mblk_t *wbp; register rf_response_t *nresp; register rf_common_t *cop; - size_t msgsz; if (!uio_error) { if (rf_rwap->wr_kern) { - uio_error = rfcl_esbwrmsg(req_sdp, rf_rwap, - hdrsz, nwritten, BPRI_MED, FALSE, &wbp); + uio_error = rfcl_esbwrmsg(req_sdp, uiop, hdrsz, + nwritten, BPRI_MED, FALSE, &wbp); ASSERT(!uio_error != !wbp); if (uio_error) { (void)rf_allocmsg(hdrsz, (size_t)0, @@ -1339,25 +1297,21 @@ rfcl_writemove(in_bpp, rf_rwap, reply_sdp, req_sdp, uio_errorp) nresp = RF_RESP(wbp); cop->co_type = RF_RESP_MSG; cop->co_opcode = RFCOPYIN; - msgsz = hdrsz; - if (*uio_errorp || (*uio_errorp = uio_error) != 0) { - nresp->rp_count = 0; nresp->rp_errno = *uio_errorp; + nresp->rp_count = 0; } else { - msgsz += nwritten; nresp->rp_count = nwritten; nresp->rp_errno = 0; } - if ((error = rf_sndmsg(reply_sdp, wbp, msgsz, (rcvd_t *)NULL, - FALSE)) != 0 || - *uio_errorp) { + if ((error = rf_sndmsg(reply_sdp, wbp, hdrsz + nwritten, + (rcvd_t *)NULL, FALSE)) != 0) { break; } } - if (rf_rwap->wr_kern && (error || uio_error && !*uio_errorp)) { + if (rf_rwap->wr_kern && (error || uio_error & !*uio_errorp)) { /* * We don't fill the cache once an error has occurred (see @@ -1411,7 +1365,7 @@ rfcl_strategy(bp, crp, residp) iovec.iov_len = bp->b_bcount; uio.uio_iov = &iovec; uio.uio_iovcnt = 1; - uio.uio_offset = bp->b_pages->p_offset; + uio.uio_offset = RF_BLKTOOFF(bp->b_blkno); uio.uio_segflg = UIO_SYSSPACE; uio.uio_resid = bp->b_bcount; uio.uio_limit = ULIMIT; @@ -1438,37 +1392,17 @@ rfcl_strategy(bp, crp, residp) bzero(bp->b_un.b_addr + (bp->b_bcount - uio.uio_resid), (size_t)uio.uio_resid); } - - if ((bp->b_error = error) != 0) { - bp->b_flags |= B_ERROR; - } - - /* - * pvn_done removes translations to pages, so they are - * NOT ADDRESSABLE after this call. Also removes pages - * from b_pages, clears p_intrans and p_pagein, does - * PAGE_RELE and unlocks pages. - */ - - pvn_done(bp); + rfcl_fsinfo.fsireadch += bp->b_bcount - uio.uio_resid; + } else { /* - * Throw away the buffer header; calling here assumes - * synchronous IO. Otherwise, the bp would have been - * tossed by pvn_done. + * Set up cwruio for restarting nacked requests. + * TO DO: take advantage of buffer rather than having + * rfcl_write_op do an fbread. */ - pageio_done(bp); - - rfcl_fsinfo.fsireadch += bp->b_bcount - uio.uio_resid; - } else { - unsigned bcount = bp->b_bcount; - rf_rwa.wr_ioflag = 0; rf_rwa.wr_kern = TRUE; - rf_rwa.wr_bufp = bp; - - bp->b_flags |= B_ASYNC; error = rfcl_uioclone(&uio, &rf_rwa, &iovsize); @@ -1477,26 +1411,33 @@ rfcl_strategy(bp, crp, residp) error = rfcl_write_op(chansdp, crp, RFPUTPAGE, &rf_rwa); - bp = NULL; /* bp now a dangling reference */ - - if (rf_rwa.wr_bufp) { - - ASSERT(error); /* B_ASYNC */ - - rf_rwa.wr_bufp->b_flags |= B_ERROR; - pvn_done(rf_rwa.wr_bufp); - } - if (iovsize > sizeof(iovec_t)) { kmem_free(iovp, iovsize); } - rfcl_fsinfo.fsiwritech += bcount - uio.uio_resid; - } else { - bp->b_flags |= B_ERROR; - pvn_done(bp); + rfcl_fsinfo.fsiwritech += bp->b_bcount - uio.uio_resid; } } *residp = uio.uio_resid; + if ((bp->b_error= error) != 0) { + bp->b_flags |= B_ERROR; + } + + /* + * pvn_done removes translations to pages, so they are + * NOT ADDRESSABLE after this call. Also removes pages + * from b_pages, clears p_intrans and p_pagein, does + * PAGE_RELE and unlocks pages. + */ + + pvn_done(bp); + + /* + * Throw away the buffer header; calling here assumes + * synchronous IO. Otherwise, the buffer header would + * be needed for a subsequent call to pvn_done. + */ + + pageio_done(bp); return error; } @@ -1537,7 +1478,7 @@ rfcl_uioclone(uiop, rf_rwap, iovszp) /* * Build an RFS message containing - * 0 < resid <= rf_rwap->uiop->uio_resid <= gdp datasz + * 0 < resid <= uiop->uio_resid <= gdp datasz * bytes of write data, using resident pages as externally supplied * STREAMS data buffers where possible. * @@ -1546,193 +1487,172 @@ rfcl_uioclone(uiop, rf_rwap, iovszp) * NULL *bpp. */ STATIC int -rfcl_esbwrmsg(sdp, rf_rwap, hdrsz, resid, pri, canfail, bpp) - sndd_t *sdp; - rf_rwa_t *rf_rwap; - size_t hdrsz; - size_t resid; - uint pri; - int canfail; - mblk_t **bpp; +rfcl_esbwrmsg(sdp, uiop, hdrsz, resid, pri, canfail, bpp) + sndd_t *sdp; + uio_t *uiop; + size_t hdrsz; + size_t resid; + uint pri; + int canfail; + mblk_t **bpp; { - uio_t *uiop = rf_rwap->uiop; - vnode_t *vp = SDTOV(sdp); - mblk_t *bp = NULL; - mblk_t *lastbp = NULL; - mblk_t *nextbp = NULL; - int error = 0; - off_t poff; /* page-aligned IO offset */ - off_t pend; /* page-aligned IO end */ - off_t opoff; - page_t *pl; /* IO list */ - buf_t *bufp; /* for IO list */ - int resident; /* current state */ - int nextresident; /* next state */ - size_t pchunk; /* page-aligned message block size */ - size_t iochunk; /* actual message block size */ + vnode_t *vp = SDTOV(sdp); + mblk_t *bp = NULL; + mblk_t *lastbp = NULL; + mblk_t *nextbp = NULL; + int error = 0; + ASSERT(resid); ASSERT(resid <= uiop->uio_resid); ASSERT(resid <= QPTOGP(sdp->sd_queue)->datasz); - *bpp = NULL; + /* The first loop trims off any prefix that is not MAXBSIZE aligned. */ - if (rf_rwap->wr_bufp) { + while (!error && resid) { - /* rf_putpage has the pages ready for us. */ + page_t **plp; /* cursor in page list pl */ + page_t **firstpp; /* intervals of (non)resident pages */ + page_t **lastpp; /* intervals of (non)resident pages */ + int resident; /* state var */ + int nextresident; /* next state var */ + page_t *pl[MAXBSIZE/PAGESIZE]; + page_t **endpl; + off_t poff; /* page-aligned file offset */ + off_t mbon; /* MAXBSIZE-unaligned offset */ + off_t nbytes; /* rfesb request */ - ASSERT(rf_rwap->wr_bufp->b_bcount <= - QPTOGP(sdp->sd_queue)->datasz); - ASSERT(rf_rwap->wr_bufp->b_flags & - (B_REMAPPED | B_ASYNC | B_WRITE)); - ASSERT(!(uiop->uio_offset & PAGEOFFSET)); - ASSERT(!(rf_rwap->wr_bufp->b_bcount & PAGEOFFSET)); + poff = uiop->uio_offset & PAGEMASK; + mbon = uiop->uio_offset & MAXBOFFSET; + nbytes = MIN(MAXBSIZE - mbon, resid); + resid -= nbytes; - error = rfesb_pageio_setup(rf_rwap->wr_bufp, hdrsz, - (off_t)0, rf_rwap->wr_bufp->b_bcount, pri, canfail, &bp); + endpl = pl + btopr(nbytes); - if (error) { + /* + * Find and hold all resident pages containing write data. We + * do this to avoid faulting in pages from the server!!! + */ - /* - * B_ASYNC provokes pvn_done to call pageio_done which, - * seeing B_REMAPPED, will call bp_mapout. - */ + for (plp = pl; plp < endpl; plp++, poff += PAGESIZE) { + if ((*plp = page_lookup(vp, poff)) != NULL) { - rf_rwap->wr_bufp->b_flags |= B_ERROR; - pvn_done(rf_rwap->wr_bufp); + /* page_lookup doesn't hold the page. */ + + PAGE_HOLD(*plp); + ASSERT((*plp)->p_keepcnt > 0); + } } - rf_rwap->wr_bufp = NULL; - *bpp = bp; - return error; - } - /* - * Find intervals of resident pages. Allocate a separate - * message block for each contiguous chunk of pages, a separate - * one for each nonresident chunk. Hook the chain of blocks - * into a single RFS message. - * - * In error cases, we dispose of current IO list, depend on caller - * to abort pages that are already in streams message. - * - * Notice extra trip through loop to scavenge last page. - */ + /* + * Find intervals of resident pages. Allocate a separate + * message block for each contiguous chunk of pages, a separate + * one for each nonresident chunk. The chain of blocks will + * be hooked into a single RFS message. At end, release all + * pages held in loop above. + * + * Notice extra trip through loop to scavenge last pages. + */ - poff = uiop->uio_offset & PAGEMASK; - pend = ptob(btopr(uiop->uio_offset + resid)); - pl = NULL; - bufp = NULL; + for (firstpp = lastpp = plp = pl, + resident = nextresident = *firstpp != NULL; + !error && plp <= endpl; + lastpp = plp++) { + size_t chunksz; - error = rf_allocmsg(hdrsz, (size_t)0, pri, canfail, NULLCADDR, NULLFRP, - &bp); - if (error) { - return error; - } - lastbp = bp; + if (plp < endpl) { - nextresident = resident = rfc_page_lookup(vp, poff, &pl) != NULL; - opoff = poff; - poff += PAGESIZE; - for ( ; poff <= pend; poff += PAGESIZE) { - off_t pon; + /* + * else retain previous value and process last + * chunk. + */ - ASSERT(!bufp); - ASSERT(!pl == !resident); - ASSERT(!lastbp->b_cont); + nextresident = *plp != NULL; + } - if (poff < pend) { - nextresident = rfc_page_lookup(vp, poff, &pl) != NULL; - } + if (resident != nextresident || plp == endpl) { - if (nextresident == resident && poff < pend) { - continue; - } + /* + * End of chunk. Otherwise, just update + * lastpp and keep working on chunk. + */ - /* End of chunk. */ + ASSERT(lastpp == plp - 1); - pon = uiop->uio_offset & PAGEOFFSET; - pchunk = poff - opoff; - iochunk = MIN(pchunk - pon, resid); + if (!bp) { - if (resident) { + /* + * This is the first message block. + * We allocate header separately to + * suppress piggybacking, so we can + * copy data in easily. + */ + + error = rf_allocmsg(hdrsz, (size_t)0, + pri, canfail, NULLCADDR, NULLFRP, + &bp); + if (error) { + break; + } + lastbp = bp; + } - /* end resident chunk */ + chunksz = MIN((lastpp - firstpp + 1) * PAGESIZE, + nbytes); + if (resident) { - bufp = pageio_setup(pl, pchunk, vp, B_WRITE | B_ASYNC); - if (!bufp) { - error = ENOMEM; - break; - } + /* end resident chunk */ - bp_mapin(bufp); + error = rfesb_fbread(vp, + uiop->uio_offset, chunksz, S_OTHER, + (size_t)0, pri, canfail, &nextbp); + } else { - bufp->b_blkno = 0; - bufp->b_dev = 0; - bufp->b_edev = 0; + /* end nonresident chunk */ - error = rfesb_pageio_setup(bufp, (size_t)0, - uiop->uio_offset & PAGEOFFSET, iochunk, - pri, canfail, &nextbp); - if (!error) { - bufp = NULL; - pl = NULL; - } - } else { + error = rf_allocmsg((size_t)0, chunksz, + pri, canfail, NULLCADDR, NULLFRP, + &nextbp); + } - /* end nonresident chunk */ + if (error) { + break; + } - error = rf_allocmsg((size_t)0, iochunk, pri, canfail, - NULLCADDR, NULLFRP, &nextbp); - } + lastbp = lastbp->b_cont = nextbp; + nextbp = NULL; + if (lastbp->b_cont) { - if (error) { - break; - } + /* rfesb_fbread does not chain */ - lastbp = lastbp->b_cont = nextbp; - nextbp = NULL; + lastbp = lastbp->b_cont; + } + ASSERT(!lastbp->b_cont); - if (resident) { - uioskip(uiop, iochunk); - } else { - error = uiomove((caddr_t)lastbp->b_rptr, (long)iochunk, - UIO_WRITE, uiop); - } + if (resident) { + uioskip(uiop, chunksz); + } else { + error = uiomove((caddr_t)lastbp->b_rptr, + (long)chunksz, UIO_WRITE, uiop); + } + nbytes -= chunksz; - if (error) { - break; - } + firstpp = plp; + resident = nextresident; - resid -= iochunk; - resident = nextresident; /* state change */ + } /* if end chunk */ - /* - * opoff becomes the offset of the first page in the new chunk. - */ + } /* for */ - opoff = poff; + for (firstpp = pl ; firstpp < endpl; firstpp++) { + if (*firstpp) { + ASSERT((*firstpp)->p_keepcnt > 0); + PAGE_RELE(*firstpp); + } + } - } /* for */ + } /* while */ if (error) { - if (bufp) { - - /* - * Turn B_WRITE off and B_READ on so pageout doesn't - * try to write this later. B_ASYNC provokes pvn_done - * to call pageio_done which, seeing B_REMAPPED, will - * call bp_mapout. - */ - - ASSERT(bufp->b_flags & - (B_REMAPPED | B_ASYNC | B_WRITE)); - - bufp->b_flags &= ~B_WRITE; - bufp->b_flags |= (B_ERROR | B_READ); - pvn_done(bp); - } else if (pl) { - pvn_fail(pl, 0); - } - rf_freemsg(bp); bp = NULL; } @@ -1742,13 +1662,16 @@ rfcl_esbwrmsg(sdp, rf_rwap, hdrsz, resid, pri, canfail, bpp) } /* - * Give up the vnode reference in rep->sdp. sdp must be locked. + * Give up the vnode reference in rep->sdp, using rep->crp; also give up + * the reference to rep->crp and free *rep. sdp must be locked. */ STATIC void -rfcl_dorele(sdp, crp) - sndd_t *sdp; - cred_t *crp; +rfcl_dorele(wp) + rfa_work_t *wp; { + + sndd_t *sdp = ((rfcl_rele_t *)wp->rfaw_farg)->sdp; + cred_t *crp = ((rfcl_rele_t *)wp->rfaw_farg)->crp; int error = 0; vnode_t *vp = SDTOV(sdp); mblk_t *bp = NULL; @@ -1762,42 +1685,38 @@ rfcl_dorele(sdp, crp) ASSERT(sdp->sd_stat & SDLOCKED); ASSERT(!(vp->v_flag & VROOT)); + kmem_free((caddr_t)wp, sizeof(*wp)); + + if (QPTOGP(sdp->sd_queue)->version > RFS1DOT0) { + rqarg.rqrele.vcount = sdp->sd_remcnt; + } + (void)rcvd_create(FALSE, RDSPECIFIC, &rdp); ASSERT(rdp); rdp->rd_sdp = sdp; - if (vcver > RFS1DOT0) { - rqarg.rqrele.vcount = sdp->sd_remcnt; + do { (void)rf_allocmsg(RF_MIN_REQ(vcver), (size_t)0, BPRI_LO, FALSE, NULLCADDR, NULLFRP, &bp); ASSERT(bp); rfcl_reqsetup(bp, sdp, crp, RFINACTIVE, ULIMIT); RF_REQ(bp)->rq_arg = rqarg; - (void)rf_sndmsg(sdp, bp, RF_MIN_REQ(vcver), rdp, FALSE); - } else { - do { - (void)rf_allocmsg(RF_MIN_REQ(vcver), (size_t)0, BPRI_LO, - FALSE, NULLCADDR, NULLFRP, &bp); - ASSERT(bp); - - rfcl_reqsetup(bp, sdp, crp, RFINACTIVE, ULIMIT); - RF_REQ(bp)->rq_arg = rqarg; - - if ((error = rfcl_xac(&bp, RF_MIN_REQ(vcver), rdp, - vcver, FALSE, &nacked)) == 0) { - rf_freemsg(bp); - bp = NULL; - } - } while (nacked); - } + if ((error = rfcl_xac(&bp, RF_MIN_REQ(vcver), rdp, vcver, FALSE, + &nacked)) == 0) { + rf_freemsg(bp); + bp = NULL; + } + + } while (nacked); sdp->sd_stat &= ~SDINTER; SDUNLOCK(sdp); rcvd_free(&rdp); + crfree(crp); if (!error && vp->v_pages) { /* diff --git a/usr/src/uts/3b2/fs/rfs/rfcl_subr.h b/usr/src/uts/3b2/fs/rfs/rfcl_subr.h index 030206f..ce4a282 100644 --- a/usr/src/uts/3b2/fs/rfs/rfcl_subr.h +++ b/usr/src/uts/3b2/fs/rfs/rfcl_subr.h @@ -8,7 +8,19 @@ #ifndef _FS_RFS_RFCL_SUBR_H #define _FS_RFS_RFCL_SUBR_H -#ident "@(#)fs:fs/rfs/rfcl_subr.h 1.4" +#ident "@(#)fs:fs/rfs/rfcl_subr.h 1.3" + +/* + * For IO on mapped files, we use the block IO interface, because we get some + * services from generic VM code that way. By convention we define + * b_blkno as the aligned faulting offset divided by 512. This seems + * safe, because pages and file system blocks are likely to be that big, + * and daddr_t is likely to be big enough to hold the result, + * eventually reconverted and stuffed into uio_offset. + */ +#define RF_BLKSHFT 9 +#define RF_OFFTOBLK(off) ((ulong)(off) >> RF_BLKSHFT) +#define RF_BLKTOOFF(blk) ((ulong)(blk) << RF_BLKSHFT) extern int rfcl_op(); extern int rfcl_xac(); diff --git a/usr/src/uts/3b2/fs/rfs/rfs.mk b/usr/src/uts/3b2/fs/rfs/rfs.mk index f924b81..3d80630 100644 --- a/usr/src/uts/3b2/fs/rfs/rfs.mk +++ b/usr/src/uts/3b2/fs/rfs/rfs.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)fs:fs/rfs/rfs.mk 1.26" +#ident "@(#)fs:fs/rfs/rfs.mk 1.23" ROOT = STRIP = strip @@ -172,13 +172,10 @@ rf_comm.$O: \ $(INC)/sys/fs/rf_vfs.h \ $(INC)/sys/file.h \ rf_admin.h \ - $(INC)/sys/buf.h \ - $(INC)/vm/page.h \ rf_cache.h \ $(INC)/sys/kmem.h \ $(INC)/sys/fbuf.h \ $(INC)/vm/page.h \ - $(INC)/vm/pvn.h \ $(FRC) rf_rsrc.$O: \ @@ -233,15 +230,12 @@ rf_admin.$O: \ rfcl_subr.h \ rf_admin.h \ $(INC)/sys/uio.h \ - $(INC)/sys/buf.h \ - $(INC)/vm/page.h \ rf_cache.h \ $(INC)/vm/seg_kmem.h \ $(INC)/sys/fcntl.h \ $(INC)/sys/flock.h \ $(INC)/sys/file.h \ $(INC)/sys/session.h \ - $(INC)/sys/kmem.h \ $(FRC) rf_canon.$O: \ @@ -298,8 +292,6 @@ rf_sys.$O: \ $(INC)/sys/dirent.h \ rf_admin.h \ $(INC)/sys/cred.h \ - $(INC)/sys/buf.h \ - $(INC)/vm/page.h \ rf_cache.h \ $(INC)/sys/file.h \ rfcl_subr.h \ @@ -351,13 +343,10 @@ rfsr_subr.$O: \ $(INC)/sys/statvfs.h \ rf_auth.h \ rfcl_subr.h \ - $(INC)/vm/page.h \ rf_cache.h \ $(INC)/sys/hetero.h \ rf_canon.h \ $(INC)/sys/sysinfo.h \ - $(INC)/sys/kmem.h \ - $(INC)/sys/mman.h \ $(INC)/sys/fs/rf_acct.h \ $(FRC) @@ -415,11 +404,9 @@ rfsr_ops.$O: \ $(INC)/vm/seg_map.h \ rf_canon.h \ $(INC)/sys/mman.h \ - $(INC)/vm/page.h \ rf_cache.h \ du.h \ $(INC)/sys/kmem.h \ - $(INC)/fs/fs_subr.h \ $(FRC) rf_serve.$O: \ @@ -454,8 +441,6 @@ rf_serve.$O: \ $(INC)/sys/file.h \ $(INC)/sys/acct.h \ $(INC)/sys/systm.h \ - $(INC)/sys/kmem.h \ - $(INC)/vm/seg_kmem.h \ rf_auth.h \ rf_admin.h \ $(FRC) @@ -508,8 +493,6 @@ du.$O: \ rf_auth.h \ du.h \ $(INC)/sys/inline.h \ - $(INC)/sys/buf.h \ - $(INC)/vm/page.h \ rf_cache.h \ $(FRC) @@ -557,7 +540,6 @@ rf_vfsops.$O: \ rf_canon.h \ $(INC)/sys/buf.h \ $(INC)/sys/uio.h \ - $(INC)/vm/page.h \ rf_cache.h \ $(INC)/sys/kmem.h \ $(FRC) @@ -619,7 +601,6 @@ rf_cache.$O: \ $(INC)/sys/vfs.h \ $(INC)/sys/stat.h \ $(INC)/sys/statfs.h \ - $(INC)/sys/buf.h \ rf_cache.h \ rfcl_subr.h \ $(INC)/sys/immu.h \ @@ -669,12 +650,12 @@ rfcl_subr.$O: \ $(INC)/sys/kmem.h \ $(INC)/sys/mount.h \ $(INC)/sys/systm.h \ + rf_cache.h \ $(INC)/sys/mode.h \ $(INC)/sys/pathname.h \ $(INC)/vm/page.h \ $(INC)/vm/seg_map.h \ $(INC)/vm/pvn.h \ - rf_cache.h \ $(FRC) rf_vnops.$O: \ diff --git a/usr/src/uts/3b2/fs/rfs/rfsr_ops.c b/usr/src/uts/3b2/fs/rfs/rfsr_ops.c index 3393f66..d2d3c55 100644 --- a/usr/src/uts/3b2/fs/rfs/rfsr_ops.c +++ b/usr/src/uts/3b2/fs/rfs/rfsr_ops.c @@ -5,13 +5,14 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/rfs/rfsr_ops.c 1.3.1.14" +#ident "@(#)fs:fs/rfs/rfsr_ops.c 1.3.1.6" + /* * Operations for kernel daemon process that handles requests - * for file activity from RFSs. + * for file activity from remote unix systems. */ -#include "sys/types.h" #include "sys/list.h" +#include "sys/types.h" #include "sys/sysinfo.h" #include "sys/time.h" #include "sys/fs/rf_acct.h" @@ -27,7 +28,6 @@ #include "sys/stream.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "sys/psw.h" #include "sys/pcb.h" @@ -37,6 +37,7 @@ #include "sys/nserve.h" #include "sys/rf_cirmgr.h" #include "sys/idtab.h" +#include "sys/rf_messg.h" #include "sys/var.h" #include "sys/file.h" #include "sys/fstyp.h" @@ -64,11 +65,9 @@ #include "vm/seg_map.h" #include "rf_canon.h" #include "sys/mman.h" -#include "vm/page.h" #include "rf_cache.h" #include "du.h" #include "sys/kmem.h" -#include "fs/fs_subr.h" /* * Table indexed by opcode points to these functions, which handle @@ -97,24 +96,6 @@ rfsr_access(stp, ctrlp) } } -/* - * VOP_PATHCONF - */ -/* ARGSUSED */ -STATIC int -rfsr_pathconf(stp, ctrlp) - register rfsr_state_t *stp; - register rfsr_ctrl_t *ctrlp; -{ - register rf_request_t *req = RF_REQ(stp->sr_in_bp); - vnode_t *vp = stp->sr_rdp->rd_vp; - register int cmd = req->rq_pathconf.cmd; - - rfsr_fsinfo.fsivop_other++; - SR_FREEMSG(stp); - return VOP_PATHCONF(vp, cmd, (u_long *)&stp->sr_ret_val, stp->sr_cred); -} - /* * VOP_CLOSE */ @@ -129,107 +110,103 @@ rfsr_close(stp, ctrlp) register vnode_t *vp = rdp->rd_vp; rd_user_t *rdup; int error = 0; - register int fmode = req->rq_close.fmode & (FREAD | FWRITE); + int inflated = 0; /* flag; see below */ vattr_t vattr; rfsr_fsinfo.fsivop_close++; - if (!(rdup = rdu_find(rdp, u.u_procp->p_sysid, u.u_srchan->sd_mntid, - (rd_user_t **)NULL)) || (int)(rdup->ru_frwcnt + rdup->ru_frcnt + - rdup->ru_fwcnt) < 1 || req->rq_close.count < 1 || - fmode & FREAD && !(rdup->ru_frwcnt + rdup->ru_frcnt) || - fmode & FWRITE && !(rdup->ru_frwcnt + rdup->ru_fwcnt)) { - return rfsr_j_accuse("rfsr_close: close unmatched with open", - stp); + rdup = rdu_find(rdp, u.u_procp->p_sysid, u.u_srchan->sd_mntid, + (rd_user_t **)NULL); + if (!rdup) { + cmn_err(CE_NOTE, "rfsr_close cannot find rd_user structure"); + } + if (rdup && rdup->ru_fcount > 1) { + /* + * This may be the last close for some file table entry on + * the client, but is not the last file table entry on the + * client for this file. Inflate the reference count on + * the vnode to avoid losing it. + */ + VN_HOLD(vp); + inflated = 1; + } + /* + * Use file table values of client + */ + error = VOP_CLOSE(vp, req->rq_close.fmode, req->rq_close.count, + req->rq_close.foffset, stp->sr_cred); + if (inflated) { + VN_RELE(vp); } - - /* Use file table values of client */ - - error = VOP_CLOSE(vp, fmode, req->rq_close.count, - req->rq_close.foffset, stp->sr_cred); - if (req->rq_close.count == 1) { - /* * Last reference from a file table entry on client * corresponds to last reference for some giving of this * gift; give up corresponding reference in rduser structure. */ - - if ((fmode & (FREAD | FWRITE)) == (FREAD | FWRITE)) { - --rdup->ru_frwcnt; - } else if (fmode & FREAD) { - --rdup->ru_frcnt; - } else { - --rdup->ru_fwcnt; - } + rdu_close(rdp, stp->sr_gdpp->sysid, u.u_srchan->sd_mntid, + req->rq_close.fmode); } - /* * 3.2 clients need vcode in return value continue cacheing a file upon * each close. */ - if (!error) { vattr.va_mask = AT_VCODE; if (!(error = VOP_GETATTR(vp, &vattr, 0, stp->sr_cred))) { stp->sr_ret_val = vattr.va_vcode; } } - - ASSERT(!stp->sr_out_bp); - stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); - - /* In vnode protocol, clients give up last reference with last close */ - if (stp->sr_vcver > RFS1DOT0 && req->rq_close.lastclose) { STATIC int rfsr_inactive(); error = rfsr_inactive(stp, ctrlp); - *ctrlp = SR_NORMAL; } else { SR_FREEMSG(stp); } return error; } +/* + * 3.x clients give up their only vnode reference with RFINACTIVE. 4.0 clients + * give up vcount references at a time. + */ +/* ARGSUSED */ STATIC int rfsr_inactive(stp, ctrlp) register rfsr_state_t *stp; register rfsr_ctrl_t *ctrlp; { + register vnode_t *vp = stp->sr_rdp->rd_vp; register long vcount; register long mntid = RF_COM(stp->sr_in_bp)->co_mntid; register sysid_t sysid = stp->sr_gdpp->sysid; rfsr_fsinfo.fsivop_other++; - if (stp->sr_vcver == RFS1DOT0) { vcount = 1; } else { vcount = RF_REQ(stp->sr_in_bp)->rq_rele.vcount; - *ctrlp = SR_NO_RESP; } - SR_FREEMSG(stp); if (vcount < 1 || stp->sr_srmp->srm_refcnt < vcount + 1 || !(stp->sr_rdp->rd_stat & RDUSED)) { - return rfsr_j_accuse("rfsr_inactive redundant VN_RELE", stp); + return rfsr_discon("rfsr_inactive redundant VN_RELE", stp); } - + ASSERT(!stp->sr_out_bp); + stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); /* - * There is no need to allocate response for new clients. Either - * we got in here via a VOP_CLOSE, which already allocated a - * response, or we got called via VOP_INACTIVE, in which case no - * response is expected by the client. + * rf_serve() calls rfsr_cacheck too, but in the case of this op, our + * operand vp will be gone. rfsr_cacheck() can fail, but its + * return is discarded so the client will stay happy. */ - - if (stp->sr_vcver < RFS2DOT0) { - ASSERT(!stp->sr_out_bp); - stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); + if (stp->sr_vcver >= RFS2DOT0) { (void)rfsr_cacheck(stp, mntid); } - stp->sr_srmp->srm_refcnt -= vcount; - rcvd_delete(&stp->sr_rdp, sysid, mntid, (int)vcount); + while (vcount--) { + --stp->sr_srmp->srm_refcnt; + rcvd_delete(&stp->sr_rdp, sysid, mntid); + VN_RELE(vp); + } return 0; } @@ -255,8 +232,8 @@ rfsr_create(stp, ctrlp) } rfsr_fsinfo.fsivop_create++; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) { - return rfsr_j_accuse("rfsr_create bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) != 0) { + return error; } req = RF_REQ(stp->sr_in_bp); @@ -264,7 +241,7 @@ rfsr_create(stp, ctrlp) if (stp->sr_gdpp->hetero != NO_CONV && !rf_fcanon(MKDENT_FMT, (caddr_t)rqdp, (caddr_t)rqdp + datasz, (caddr_t)rqdp)) { - return rfsr_j_accuse("rfsr_create bad data", stp); + return rfsr_discon("rfsr_create bad data", stp); } rftov_attr(&vattr, &rqdp->attr); vattr.va_atime.tv_sec -= stp->sr_gdpp->timeskew_sec; @@ -275,8 +252,9 @@ rfsr_create(stp, ctrlp) SR_FREEMSG(stp); ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); - if (!error) { - error = rfsr_gift_setup(stp, vp, u.u_srchan); + if (!error && + (error = rfsr_gift_setup(stp, vp, u.u_srchan))) { + VN_RELE(vp); } return error; } @@ -430,18 +408,17 @@ rfsr_getattr(stp, ctrlp) register int error = 0; register rf_response_t *rp; int canon = stp->sr_gdpp->hetero != NO_CONV; - int flags; vattr_t vattr; rfsr_fsinfo.fsivop_other++; vattr.va_mask = req->rq_getattr.mask; - flags = req->rq_getattr.flags & (ATTR_EXEC | ATTR_COMM); SR_FREEMSG(stp); ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc(stp->sr_gdpp->hetero != NO_CONV ? - sizeof(rf_attr_t) + ATTR_XP : sizeof(rf_attr_t), stp->sr_vcver); + sizeof(rf_attr_t) + ATTR_XP : sizeof(rf_attr_t), + stp->sr_vcver); rp = RF_RESP(stp->sr_out_bp); - if ((error = VOP_GETATTR(rvp, &vattr, flags, stp->sr_cred)) != 0 || + if ((error = VOP_GETATTR(rvp, &vattr, 0, stp->sr_cred)) != 0 || (error = rfsr_vattr_map(stp, &vattr)) != 0) { /* reset these to reflect the failure */ rp->rp_count = 0; @@ -477,15 +454,15 @@ rfsr_setattr(stp, ctrlp) rfsr_fsinfo.fsivop_other++; datasz = hetero == NO_CONV ? sizeof(rf_attr_t) : - sizeof(rf_attr_t) + ATTR_XP; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) { - return rfsr_j_accuse("rfsr_setattr bad data", stp); + sizeof(rf_attr_t) + ATTR_XP - MINXPAND; + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) != 0) { + return error; } rap = (rf_attr_t *)rf_msgdata(stp->sr_in_bp, hdrsz); if (hetero != NO_CONV && !rf_fcanon(ATTR_FMT, (caddr_t)rap, (caddr_t)rap + datasz, (caddr_t)rap)) { - return rfsr_j_accuse("rfsr_setattr bad data", stp); + return rfsr_discon("rfsr_setattr bad data", stp); } rap->rfa_uid = gluid(stp->sr_gdpp, rap->rfa_uid); rap->rfa_gid = glgid(stp->sr_gdpp, rap->rfa_gid); @@ -688,20 +665,10 @@ rfsr_ioctl(stp, ctrlp) if (!stp->sr_out_bp) { stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); } - if (error) { + if (error || (error = rfsr_gift_setup(stp, nvp, u.u_srchan))) { closef(fp); } else { - VN_HOLD(nvp); - if ((error = rfsr_gift_setup(stp, nvp, u.u_srchan))) { - closef(fp); - } else { - ASSERT(stp->sr_gift); - rdu_open(stp->sr_gift, stp->sr_gdpp->sysid, - u.u_srchan->sd_mntid, - (int)(fp->f_flag & (FREAD | FWRITE))); - unfalloc(fp); - VN_RELE(nvp); - } + unfalloc(fp); } setf(0, NULLFP); } @@ -718,6 +685,7 @@ rfsr_link(stp, ctrlp) { register vnode_t *dvp = stp->sr_rdp->rd_vp; register vnode_t *fvp; + int rcvindx; int error = 0; size_t hdrsz = RF_MIN_REQ(stp->sr_vcver); @@ -727,7 +695,7 @@ rfsr_link(stp, ctrlp) rfsr_fsinfo.fsivop_other++; /* - * All pathnames are fully resolved, and the named target file + *All pathnames are fully resolved, and the named target file * is a simple component in the directory represented by the * rd on which the request came. * @@ -737,18 +705,15 @@ rfsr_link(stp, ctrlp) * they're in the same writable VFS. */ - if ((fvp = - rf_gifttovp(&RF_REQ(stp->sr_in_bp)->rq_link.from, stp->sr_vcver)) == - NULL) { + if ((rcvindx = RF_REQ(stp->sr_in_bp)->rq_rflink.link) == 0 || + (fvp = rcvd[rcvindx].rd_vp) == NULL) { error = ENOENT; } else if (fvp->v_vfsp != dvp->v_vfsp) { error = EXDEV; } else if (dvp->v_vfsp->vfs_flag & VFS_RDONLY) { error = EROFS; - } else if (RF_PULLUP(stp->sr_in_bp, hdrsz, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) { - error = rfsr_j_accuse("rfsr_link bad data", stp); - } else { + } else if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) == 0) { error = VOP_LINK(dvp, fvp, rf_msgdata(stp->sr_in_bp, hdrsz), stp->sr_cred); } @@ -782,9 +747,6 @@ rfsr_lookup(stp, ctrlp) if (*ctrlp != SR_NORMAL || error) { return error; } - - ASSERT(vp); - ASSERT(!stp->sr_out_bp); if (hetero) { stp->sr_out_bp = rfsr_rpalloc(sizeof(rflkc_info_t) + @@ -793,17 +755,15 @@ rfsr_lookup(stp, ctrlp) stp->sr_out_bp = rfsr_rpalloc(sizeof(rflkc_info_t), stp->sr_vcver); } - VN_HOLD(vp); - if (!(error = rfsr_gift_setup(stp, vp, u.u_srchan))) { + if (error = rfsr_gift_setup(stp, vp, u.u_srchan)) { + VN_RELE(vp); + } else { /* * Provide some commonly used information about vp. */ register rf_response_t *rp = RF_RESP(stp->sr_out_bp); vattr_t vattr; - ASSERT(vtord(vp)); - ASSERT(vtord(vp)->rd_vp == vp); - vattr.va_mask = AT_ALL; if (!VOP_GETATTR(vp, &vattr, 0, stp->sr_cred) && !rfsr_vattr_map(stp, &vattr)) { @@ -830,109 +790,26 @@ rfsr_lookup(stp, ctrlp) rp->rp_nodata = 1; } } - VN_RELE(vp); return error; } - -/* - * Offset and len are page-normalized here because client and server page - * sizes may vary (in particular the client may have smaller pages). - */ /* ARGSUSED */ STATIC int -rfsr_addmap(stp, ctrlp) - register rfsr_state_t *stp; - register rfsr_ctrl_t *ctrlp; +rfsr_map(stp, ctrlp) + register rfsr_state_t *stp; + register rfsr_ctrl_t *ctrlp; { - register rf_request_t *req = RF_REQ(stp->sr_in_bp); - register vnode_t *vp = stp->sr_rdp->rd_vp; - uint offset = req->rq_map.offset & PAGEMASK; - uint len = (req->rq_map.len + PAGEOFFSET) & PAGEMASK; - uint maxprot = req->rq_map.maxprot; - int error = 0; - rd_user_t *rdup; - - if (vp->v_type != VREG && vp->v_type != VBLK) { - return ENODEV; - } - if (vp->v_filocks) { - return EAGAIN; - } - if (vp->v_flag & VNOMAP) { - return ENOSYS; - } - if ((int)offset < 0 || (int)(offset + len) < 0) { - return EINVAL; - } - - /* - * Since prot is manipulable above the file system interface, only - * maxprot is sent. Verify that the client references the file, - * that if the client is attempting a writable mapping, that it - * has opened the file for writing, or else that it has opened the - * file in some way (to cover PROT_READ and PROT_EXEC mappings). - */ - rdup = rdu_find(stp->sr_rdp, stp->sr_gdpp->sysid, u.u_srchan->sd_mntid, - (rd_user_t **)NULL); - if (rdup == NULL || ((maxprot & PROT_WRITE) > - (uint)(rdup->ru_fwcnt + rdup->ru_frwcnt) - || rdup->ru_fwcnt + rdup->ru_frcnt + rdup->ru_frwcnt == 0) && - !rfm_check(vp, stp->sr_cred, rdup, offset, len, maxprot)) { - /* - * The client should already have verified this stuff, what - * is it trying to do? - */ - return rfsr_j_accuse("rfsr_addmap: mapping not allowed", stp); - } - - /* - * Since prot is manipulable above the file system interface, only - * maxprot is sent, and is used in the VOP_ADDMAP(DELMAP) below. - */ - if (!(error = VOP_ADDMAP(stp->sr_rdp->rd_vp, offset, (struct as *)NULL, - (addr_t)NULL, len, maxprot, maxprot, 0, stp->sr_cred))) { - rfm_lock(rdup); - if ((error = rfm_addmap(rdup, offset, len, maxprot)) != 0) { - (void)VOP_DELMAP(stp->sr_rdp->rd_vp, offset, - (struct as *)NULL, (addr_t)NULL, len, - maxprot, maxprot, 0, stp->sr_cred); - } - rfm_unlock(rdup); - } - return error; + return VOP_ADDMAP(stp->sr_rdp->rd_vp, 0, (struct as *)NULL, + (caddr_t *)NULL, 1, PROT_READ, PROT_READ, 0, stp->sr_cred); } -/* - * Offset and len are page-normalized here because client and server page - * sizes may vary (in particular the client may have smaller pages). - */ /* ARGSUSED */ STATIC int -rfsr_delmap(stp, ctrlp) - register rfsr_state_t *stp; +rfsr_unmap(stp, ctrlp) + register rfsr_state_t *stp; { - register rf_request_t *req = RF_REQ(stp->sr_in_bp); - uint offset = req->rq_map.offset & PAGEMASK; - uint len = (req->rq_map.len + PAGEOFFSET) & PAGEMASK; - uint maxprot = req->rq_map.maxprot; - rd_user_t *rdup = rdu_find(stp->sr_rdp, - stp->sr_gdpp->sysid, u.u_srchan->sd_mntid, - (rd_user_t **)NULL); - - /* - * Since prot is manipulable above the file system interface, - * only maxprot is sent and used. - */ - if (rdup == NULL) { - return rfsr_j_accuse("rfsr_delmap: no map found\n", stp); - } else { - rfm_lock(rdup); - rfm_delmap(rdup, offset, len, maxprot, stp->sr_rdp->rd_vp, - stp->sr_cred); - rfm_unlock(rdup); - return 0; - } + return VOP_DELMAP(stp->sr_rdp->rd_vp, 0, (struct as *)NULL, + (caddr_t *)NULL, 1, PROT_READ, PROT_READ, 0, stp->sr_cred); } /* @@ -956,15 +833,16 @@ rfsr_mkdir(stp, ctrlp) rfsr_fsinfo.fsivop_other++; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) { - return rfsr_j_accuse("rfsr_mkdir bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) != 0) { + SR_FREEMSG(stp); + return error; } rqdp = (struct rqmkdent *)rf_msgdata(stp->sr_in_bp, hdrsz); if (stp->sr_gdpp->hetero != NO_CONV && !rf_fcanon(MKDENT_FMT, (caddr_t)rqdp, (caddr_t)rqdp + datasz, (caddr_t)rqdp)) { - return rfsr_j_accuse("rfsr_mkdir bad data", stp); + return rfsr_discon("rfsr_mkdir bad data", stp); } rftov_attr(&vattr, &rqdp->attr); error = VOP_MKDIR(stp->sr_rdp->rd_vp, rqdp->nm, @@ -973,7 +851,9 @@ rfsr_mkdir(stp, ctrlp) if (!error) { ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); - error = rfsr_gift_setup(stp, vp, u.u_srchan); + if (error = rfsr_gift_setup(stp, vp, u.u_srchan)) { + VN_RELE(vp); + } } return error; } @@ -990,73 +870,35 @@ rfsr_open(stp, ctrlp) vnode_t *vp; vnode_t *ovp; int error = 0; - rcvd_t *rdp; - int amode = 0; if (stp->sr_vcver < RFS2DOT0) { return dusr_open(stp, ctrlp); } rfsr_fsinfo.fsivop_open++; - - rdp = stp->sr_rdp; - ovp = vp = rdp->rd_vp; fmode = RF_REQ(stp->sr_in_bp)->rq_open.fmode; + ovp = vp = stp->sr_rdp->rd_vp; SR_FREEMSG(stp); - - if (fmode & FREAD) { - amode = VREAD; - } - if (fmode & (FWRITE|FTRUNC)) { - amode |= VWRITE; - if (stp->sr_srmp->srm_flags & SRM_RDONLY) { - return EROFS; - } - } - if ((error = VOP_ACCESS(vp, amode, 0, stp->sr_cred)) != 0) { - return error; - } - /* * In case VOP_OPEN swaps vp with another, make sure * it doesn't disappear, because all of a single client's * contribute just 1 to the vnode reference count. */ - VN_HOLD(ovp); - if ((error = VOP_OPEN(&vp, fmode, stp->sr_cred)) == 0) { + if ((error = VOP_OPEN(&vp, fmode, stp->sr_cred)) != 0) { if (vp != ovp) { - /* * VOP_OPEN gave us a new vnode. Client will * release old one in its time. */ - ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); - - /* - * Hold vp for the case that rfsr_gift_setup fails and - * releases it, we still need vp to VOP_CLOSE. - */ - - VN_HOLD(vp); - if ((error = rfsr_gift_setup(stp, vp, u.u_srchan)) + if ((error = rfsr_gift_setup(stp, vp, u.u_srchan)) != 0) { - (void)VOP_CLOSE(vp, fmode, 1, (off_t)0, - stp->sr_cred); - } else { - rdu_open(stp->sr_gift, stp->sr_gdpp->sysid, - u.u_srchan->sd_mntid, fmode); + VN_RELE(vp); } - VN_RELE(vp); - } else { - rdu_open(rdp, stp->sr_gdpp->sysid, - u.u_srchan->sd_mntid, fmode); - VN_RELE(ovp); } - } else { - VN_RELE(ovp); } + VN_RELE(ovp); return error; } @@ -1106,6 +948,25 @@ rfsr_read(stp, ctrlp) if (!stp->sr_out_bp) { stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); } + + if (stp->sr_vcver == RFS1DOT0) { + if (stp->sr_opcode == RFREAD) { + + /* Only call to rfsr_cacheck for 3.2 clients. */ + + error = rfsr_cacheck(stp, u.u_srchan->sd_mntid); + } + if (!error) { + vattr_t vattr; + + vattr.va_mask = AT_SIZE; + if ((error = VOP_GETATTR(vp, &vattr, 0, stp->sr_cred)) + == 0) { + RF_RESP(stp->sr_out_bp)->rp_rdwr.isize = + vattr.va_size; + } + } + } return error; } @@ -1145,13 +1006,11 @@ rfsr_readlink(stp, ctrlp) iovec.iov_base = rpdata; error = VOP_READLINK(vp, &uio, stp->sr_cred); stp->sr_ret_val = resid - uio.uio_resid; - /* * rfsr_rpalloc assigned the following values; correct * them now that the actual * values are known. */ - if ((resp->rp_count = stp->sr_ret_val) == 0) { resp->rp_nodata = 1; } @@ -1177,15 +1036,15 @@ rfsr_symlink(stp, ctrlp) rfsr_fsinfo.fsivop_other++; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) { - return rfsr_j_accuse("rfsr_symlink bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) != 0) { + SR_FREEMSG(stp); + return error; } argp = (struct rqsymlink *)rf_msgdata(stp->sr_in_bp, hdrsz); - if (stp->sr_gdpp->hetero != NO_CONV && !rf_fcanon(SYMLNK_FMT, (caddr_t)argp, (caddr_t)argp + datasz, (caddr_t)argp)) { - return rfsr_j_accuse("rfsr_symlink bad data", stp); + return rfsr_discon("rfsr_symlink bad data", stp); } if (req->rq_slink.tflag) { strcpy(target, argp->target); @@ -1229,14 +1088,11 @@ rfsr_remove(stp, ctrlp) rfsr_fsinfo.fsivop_other++; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) { - return rfsr_j_accuse("rfsr_remove bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) == 0) { + error = VOP_REMOVE(stp->sr_rdp->rd_vp, + rf_msgdata(stp->sr_in_bp, hdrsz), stp->sr_cred); } - - error = VOP_REMOVE(stp->sr_rdp->rd_vp, - rf_msgdata(stp->sr_in_bp, hdrsz), stp->sr_cred); - SR_FREEMSG(stp); return error; } @@ -1255,35 +1111,42 @@ rfsr_rename(stp, ctrlp) vnode_t *tdvp; char *fnm; char *tnm; + int frcvid; + int trcvid; size_t hdrsz = RF_MIN_REQ(stp->sr_vcver); int error = 0; rfsr_fsinfo.fsivop_other++; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) { - return rfsr_j_accuse("rfsr_create bad data", stp); - } - - req = RF_REQ(stp->sr_in_bp); - fnm = rf_msgdata(stp->sr_in_bp, hdrsz); - tnm = fnm + strlen(fnm) + 1; - - if ((fdvp = rf_gifttovp(&req->rq_rename.from, stp->sr_vcver)) == NULL || - (tdvp = rf_gifttovp(&req->rq_rename.to, stp->sr_vcver)) == NULL) { - error = ENOENT; - } else if (fdvp->v_vfsp != tdvp->v_vfsp) { - error = EXDEV; - } else if (tdvp->v_vfsp->vfs_flag & VFS_RDONLY) { - error = EROFS; - } else { - error = VOP_RENAME(fdvp, fnm, tdvp, tnm, stp->sr_cred); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) == 0) { + + req = RF_REQ(stp->sr_in_bp); + frcvid = req->rq_rename.frdid; + trcvid = req->rq_rename.trdid; + fnm = rf_msgdata(stp->sr_in_bp, hdrsz); + tnm = fnm + strlen(fnm) + 1; + + if (frcvid <= 0 || + frcvid >= nrcvd || + trcvid <= 0 || + trcvid >= nrcvd || + (fdvp = rcvd[frcvid].rd_vp) == NULL || + (tdvp = rcvd[trcvid].rd_vp) == NULL) { + error = ENOENT; + } else if (fdvp->v_vfsp != tdvp->v_vfsp) { + error = EXDEV; + } else if (tdvp->v_vfsp->vfs_flag & VFS_RDONLY) { + error = EROFS; + } else { + error = VOP_RENAME(fdvp, fnm, tdvp, tnm, stp->sr_cred); + } } - SR_FREEMSG(stp); - - /* The vnodes (fdvp and tdvp) will be released by the client. */ - + /* + * The vnodes (fdvp and tdvp) will be released by + * the client. + */ return error; } @@ -1295,13 +1158,8 @@ rfsr_rsignal(stp, ctrlp) { register rf_common_t *cop = RF_COM(stp->sr_in_bp); register proc_t *procp; - int s; *ctrlp = SR_NO_RESP; - - s = splstr(); - ASSERT(!rfsr_active_lock++); - for (procp = rfsr_active_procp; procp; procp = procp->p_rlink) { if (procp != u.u_procp && procp->p_epid == (short)cop->co_pid && @@ -1309,15 +1167,11 @@ rfsr_rsignal(stp, ctrlp) break; } } - if (!procp) { /* didn't find surrogate of signalled client */ register mblk_t *sbp; register sndd_t *srchan = u.u_srchan; - ASSERT(!--rfsr_active_lock); - splx(s); - srchan->sd_srvproc = NULL; /* look for request message we are supposed to interrupt */ @@ -1334,7 +1188,8 @@ rfsr_rsignal(stp, ctrlp) stp->sr_in_bp = sbp; msig = RF_MSG(sbp); msig->m_stat |= RF_SIGNAL; - sndd_set(srchan, msig->m_queue, &msig->m_gift); + sndd_set(srchan, (queue_t *)msig->m_queue, + msig->m_giftid); *ctrlp = SR_OUT_OF_BAND; } else { /* @@ -1344,12 +1199,7 @@ rfsr_rsignal(stp, ctrlp) SR_FREEMSG(stp); } } else { - /* found surrogate of signalled client */ - - ASSERT(!--rfsr_active_lock); - splx(s); - psignal(procp, SIGTERM); SR_FREEMSG(stp); } @@ -1364,9 +1214,9 @@ rfsr_rmdir(stp, ctrlp) register rfsr_state_t *stp; register rfsr_ctrl_t *ctrlp; { + long connid = RF_REQ(stp->sr_in_bp)->rq_rmdir.connid; int error = 0; size_t hdrsz = RF_MIN_REQ(stp->sr_vcver); - rf_request_t *req = RF_REQ(stp->sr_in_bp); if (stp->sr_vcver < RFS2DOT0) { return dusr_rmdir(stp, ctrlp); @@ -1374,14 +1224,12 @@ rfsr_rmdir(stp, ctrlp) rfsr_fsinfo.fsivop_other++; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) { - return rfsr_j_accuse("rfsr_rmdir bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) == 0) { + error = VOP_RMDIR(stp->sr_rdp->rd_vp, + rf_msgdata(stp->sr_in_bp, hdrsz), + connid == 0 ? NULLVP : INXTORD(connid)->rd_vp, stp->sr_cred); } - - error = VOP_RMDIR(stp->sr_rdp->rd_vp, rf_msgdata(stp->sr_in_bp, hdrsz), - rf_gifttovp(&req->rq_rmdir.dir, stp->sr_vcver), stp->sr_cred); - SR_FREEMSG(stp); return error; } @@ -1416,8 +1264,7 @@ rfsr_mount(stp, ctrlp) rfsr_fsinfo.fsivop_other++; - if (RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) { - error = rfsr_j_accuse("rfsr_mount bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) != 0) { goto out; } req = RF_REQ(stp->sr_in_bp); @@ -1432,7 +1279,7 @@ rfsr_mount(stp, ctrlp) mdata = rf_msgdata(stp->sr_in_bp, hdrsz); mflags = (int)req->rq_srmount.mntflag; if (!rf_fcanon("c0", mdata, mdata + datasz, resname)) { - error = rfsr_j_accuse("rfsr_mount bad data", stp); + error = rfsr_discon("rfsr_mount bad data", stp); goto out; } if ((error = srm_alloc(&stp->sr_srmp)) != 0) { @@ -1462,10 +1309,12 @@ rfsr_mount(stp, ctrlp) error = ENONET; goto out; } +#ifdef UNNECESSARY_RESTRICTION_REMOVED if (stp->sr_vcver < RFS2DOT0 && rp->r_rootvp->v_type != VDIR) { error = ENOTDIR; goto out; } +#endif if (rp->r_flags & R_UNADV) { error = ENONET; goto out; @@ -1487,11 +1336,7 @@ rfsr_mount(stp, ctrlp) rp->r_mountp->srm_prevp = stp->sr_srmp; } rp->r_mountp = stp->sr_srmp; - - VN_HOLD(rp->r_rootvp); - if (!(error = rfsr_gift_setup(stp, rp->r_rootvp, srchan))) { - gdpp->mntcnt++; - } else { + if ((error = rfsr_gift_setup(stp, rp->r_rootvp, srchan)) != 0) { /* * As awkward as the following is, it is necessary because * rfsr_gift_setup may have slept, allowing our rp and/or srmp @@ -1501,16 +1346,16 @@ rfsr_mount(stp, ctrlp) if ((rp = name_to_rsc(resname)) != NULL && (trash_srmp = id_to_srm(rp, my_sysid)) != NULL) { - (void)srm_remove(&rp, &trash_srmp); + (void)srm_remove(&rp, trash_srmp); stp->sr_srmp = NULL; } } out: - if (error) { - if (stp->sr_srmp) { - srm_free(&stp->sr_srmp); - stp->sr_srmp = NULL; - } + if (!error) { + gdpp->mntcnt++; + VN_HOLD(stp->sr_gift->rd_vp); + } else { + srm_free(&stp->sr_srmp); stp->sr_gift = NULL; } SR_FREEMSG(stp); @@ -1519,6 +1364,11 @@ rfsr_mount(stp, ctrlp) /* * VFS_UMOUNT + * + * Make sure that the reference count in the srmount table for + * this system and this inode is zero. Then free the srmount entry. + * Vnode is locked by routines that call this routine. This routine + * is called by server and by rf_recovery. */ /* ARGSUSED */ STATIC int @@ -1527,6 +1377,7 @@ rfsr_umount(stp, ctrlp) register rfsr_ctrl_t *ctrlp; { register long mntid = u.u_srchan->sd_mntid; + register vnode_t *vp = stp->sr_rsrcp->r_rootvp; register long vcount; register sysid_t sysid = stp->sr_gdpp->sysid; sr_mount_t *srp = stp->sr_srmp; @@ -1539,28 +1390,28 @@ rfsr_umount(stp, ctrlp) vcount = RF_REQ(stp->sr_in_bp)->rq_rele.vcount; } SR_FREEMSG(stp); - - DUPRINT2(DB_MNT_ADV, "rfsr_umount: resource %x\n", stp->sr_rsrcp); - + DUPRINT3(DB_MNT_ADV, + "rfsr_umount: resource %x, vnode %x \n", stp->sr_rsrcp, vp); if (srp->srm_refcnt != vcount) { /* still busy for client machine or recovery is going on */ return EBUSY; } - - srp->srm_refcnt -= vcount; - + while (--vcount) { + --stp->sr_srmp->srm_refcnt; + rcvd_delete(&stp->sr_rdp, sysid, mntid); + VN_RELE(vp); + } /* - * Free sr_mount structure. If R_UNADV flag is set + * Free rfsr_mount structure. If R_UNADV flag is set * in the resource structure and this was the last * rfsr_mount structure, the resource structure will * also be deallocated. */ - if (srp->srm_flags & SRM_FUMOUNT || - !(error = srm_remove(&stp->sr_rsrcp, &srp))) { - stp->sr_srmp = NULL; - rcvd_delete(&stp->sr_rdp, sysid, mntid, (int)vcount); + !(error = srm_remove(&stp->sr_rsrcp, srp))) { + rcvd_delete(&stp->sr_rdp, sysid, mntid); stp->sr_gdpp->mntcnt--; + VN_RELE(vp); } return error; } @@ -1625,9 +1476,6 @@ rfsr_ustat(stp, ctrlp) int canon = stp->sr_gdpp->hetero != NO_CONV; struct statvfs statvfs; struct ustat ustat; - register int i; - register char *cp; - register char *cp2; vfsp = rfsr_dev_dtov((int)req->rq_ustat.dev); SR_FREEMSG(stp); @@ -1659,32 +1507,9 @@ rfsr_ustat(stp, ctrlp) usp->f_tfree = (daddr_t)(statvfs.f_bfree * (statvfs.f_frsize/512)); usp->f_tinode = (o_ino_t)statvfs.f_ffree; - - /* - * Fill f_name, f_pack from variable length strings in f_fstr. - */ - cp = statvfs.f_fstr; - cp2 = usp->f_fname; - for (i = 0; i < sizeof(usp->f_fname); i++, cp2++) { - if (*cp != '\0') { - *cp2 = *cp++; - } else { - *cp2 = '\0'; - } - } - while (cp++ != '\0' && i < sizeof(statvfs.f_fstr) - - sizeof(usp->f_fpack)) { - i++; - } - cp2 = usp->f_fpack; - for (i = 0; i < sizeof(usp->f_fpack); i++, cp2++) { - if (*cp != '\0') { - *cp2 = *cp++; - } else { - *cp2 = '\0'; - } - } - + bcopy(&statvfs.f_fstr[0], usp->f_fpack, sizeof(usp->f_fpack)); + bcopy(&statvfs.f_fstr[sizeof(usp->f_fpack)], usp->f_fname, + sizeof(usp->f_fname)); if (canon) { rp->rp_count = rf_tcanon(USTAT_FMT, (caddr_t)usp, rpdata); } @@ -1719,7 +1544,7 @@ rfsr_write(stp, ctrlp) { /* base is updated for old clients. */ - register rf_request_t *req = RF_REQ(stp->sr_in_bp); + rf_request_t *req = RF_REQ(stp->sr_in_bp); register vnode_t *vp = stp->sr_rdp->rd_vp; caddr_t base = (caddr_t)req->rq_xfer.base; register vtype_t vtype = vp->v_type; @@ -1730,20 +1555,12 @@ rfsr_write(stp, ctrlp) iovec_t iovec; register int error = 0; long prewrite = req->rq_xfer.prewrite; - rd_user_t *rdup = rdu_find(stp->sr_rdp, - u.u_procp->p_sysid, u.u_srchan->sd_mntid, - (rd_user_t **)NULL); if (stp->sr_opcode == RFPUTPAGE) { - req->rq_xfer.fmode = 0; /* prevent FAPPEND */ rfsr_fsinfo.fsivop_putpage++; - if (rdup == NULL) { - return rfsr_j_accuse("rfsr_putpage: no map found\n", - stp); - } else if (!rfm_check(vp, stp->sr_cred, rdup, - (uint)req->rq_xfer.offset, - (uint)req->rq_xfer.count, PROT_WRITE)) { - return EINVAL; + if (vp->v_flag & VNOMAP) { + SR_FREEMSG(stp); + return ENOSYS; } } else { rfsr_fsinfo.fsivop_write++; @@ -1824,7 +1641,7 @@ rfsr_getpage(stp, ctrlp) register rfsr_state_t *stp; register rfsr_ctrl_t *ctrlp; { - rf_request_t *req = RF_REQ(stp->sr_in_bp); + register rf_request_t *req = RF_REQ(stp->sr_in_bp); vnode_t *vp = stp->sr_rdp->rd_vp; off_t resid = req->rq_xfer.count; off_t oresid = resid; @@ -1832,9 +1649,11 @@ rfsr_getpage(stp, ctrlp) size_t datasz = stp->sr_gdpp->datasz; register int error = 0; unsigned disabled; /* flag cache is disabled */ - rd_user_t *rdup = rdu_find(stp->sr_rdp, u.u_procp->p_sysid, - u.u_srchan->sd_mntid, (rd_user_t **)NULL); + rd_user_t *rdup = rdu_find(stp->sr_rdp, + u.u_procp->p_sysid, u.u_srchan->sd_mntid, + (rd_user_t **)NULL); + ASSERT(rdup); rfsr_fsinfo.fsivop_getpage++; SR_FREEMSG(stp); @@ -1846,15 +1665,11 @@ rfsr_getpage(stp, ctrlp) if (resid <= 0) { return EINVAL; } - if (rdup == NULL) { - return EINVAL; - } - if (!rfm_check(vp, stp->sr_cred, rdup, (uint)offset, - (uint)resid, PROT_READ)) { - return EINVAL; + if (vp->v_flag & VNOMAP) { + return ENOSYS; } disabled = stp->sr_srmp->srm_flags & SRM_CACHE && - rdup->ru_cflag & RU_CACHE_DISABLE; + rdup->ru_cflag & RU_CACHE_DISABLE; /* * Iteratively lock down ranges of addresses, esballoc streams @@ -1927,14 +1742,14 @@ rfsr_undef_op(stp, ctrlp) register rfsr_state_t *stp; register rfsr_ctrl_t *ctrlp; { - return rfsr_j_accuse("rfs server undefined op", stp); + return rfsr_discon("rfs server undefined op", stp); } /* indexed by opcode */ int (*rfsr_ops[])() = { rfsr_setfl, /* 0 RFSETFL */ - rfsr_delmap, /* 1 RFDELMAP */ - rfsr_addmap, /* 2 RFADDMAP */ + rfsr_unmap, /* 1 RFUNMAP */ + rfsr_map, /* 2 RFMAP */ rfsr_read, /* 3 RFREAD */ rfsr_write, /* 4 RFWRITE */ rfsr_open, /* 5 DUOPEN */ @@ -1957,7 +1772,7 @@ int (*rfsr_ops[])() = { rfsr_undef_op, /* 22 UNUSED */ rfsr_setattr, /* 23 RFSETATTR */ rfsr_access, /* 24 RFACCESS */ - rfsr_pathconf, /* 25 RFPATHCONF */ + rfsr_undef_op, /* 25 UNUSED */ rfsr_undef_op, /* 26 UNUSED */ rfsr_undef_op, /* 27 UNUSED */ dusr_fstat, /* 28 DUFSTAT */ @@ -2035,8 +1850,8 @@ int (*rfsr_ops[])() = { rfsr_undef_op, /* 100 UNUSED */ rfsr_undef_op, /* 101 UNUSED */ rfsr_undef_op, /* 102 UNUSED */ - rfsr_undef_op, /* 103 UNUSED */ - rfsr_statvfs, /* 104 RFSTATVFS */ + rfsr_statvfs, /* 103 RFSTATVFS */ + rfsr_undef_op, /* 104 UNUSED */ rfsr_undef_op, /* 105 UNUSED */ rfsr_undef_op, /* 106 RFCOPYIN */ rfsr_undef_op, /* 107 RFCOPYOUT */ diff --git a/usr/src/uts/3b2/fs/rfs/rfsr_subr.c b/usr/src/uts/3b2/fs/rfs/rfsr_subr.c index e891a8e..6755115 100644 --- a/usr/src/uts/3b2/fs/rfs/rfsr_subr.c +++ b/usr/src/uts/3b2/fs/rfs/rfsr_subr.c @@ -1,11 +1,4 @@ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)fs:fs/rfs/rfsr_subr.c 1.18" +#ident "@(#)fs:fs/rfs/rfsr_subr.c 1.10.1.1 UNOFFICIAL" /* * Support operations for the RFS server daemon. @@ -23,7 +16,6 @@ #include "sys/stream.h" #include "vm/seg.h" #include "rf_admin.h" -#include "sys/rf_messg.h" #include "sys/rf_comm.h" #include "sys/psw.h" #include "sys/pcb.h" @@ -48,19 +40,18 @@ #include "sys/rf_adv.h" #include "sys/uio.h" #include "sys/fs/rf_vfs.h" +#include "sys/rf_messg.h" #include "sys/dirent.h" #include "rf_serve.h" #include "sys/statfs.h" #include "sys/statvfs.h" #include "rf_auth.h" #include "rfcl_subr.h" -#include "vm/page.h" #include "rf_cache.h" #include "sys/hetero.h" #include "rf_canon.h" #include "sys/sysinfo.h" #include "sys/kmem.h" -#include "sys/mman.h" #include "sys/fs/rf_acct.h" /* imports */ @@ -82,14 +73,6 @@ STATIC int rfsr_dev_find(); STATIC int rfsr_dev_insert(); STATIC void rfsr_dev_clean(); STATIC int rfsr_writev(); -STATIC int rfsr_discon(); -STATIC void rfm_remove(); - -#ifdef DEBUG -int rfsr_idle_lock; -int rfsr_active_lock; -int rfsr_msg_lock; -#endif /* * Translate pathname to vnode, or path crosses back to client, @@ -108,9 +91,9 @@ rfsr_lookupname(followlink, stp, dirvpp, compvpp, sr_ctrlp) register int error; size_t hdrsz = RF_MIN_REQ(stp->sr_vcver); - if (RF_PULLUP(stp->sr_in_bp, hdrsz, - (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) { - return rfsr_j_accuse("rfsr_lookupname bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, + (size_t)RF_MSG(stp->sr_in_bp)->m_size - hdrsz)) != 0) { + return error; } if ((error = pn_get(rf_msgdata(stp->sr_in_bp, hdrsz), UIO_SYSSPACE, &lookpn)) @@ -137,63 +120,40 @@ rfsr_lookupname(followlink, stp, dirvpp, compvpp, sr_ctrlp) */ int rfsr_lookuppn(pnp, followlink, stp, dirvpp, compvpp, sr_ctrlp) - register pathname_t *pnp; /* pathname to lookup */ - symfollow_t followlink; /* (don't) follow sym links */ - rfsr_state_t *stp; - vnode_t **dirvpp; /* parent vnode */ - vnode_t **compvpp; /* entry vnode */ - rfsr_ctrl_t *sr_ctrlp; + register pathname_t *pnp; /* pathname to lookup */ + symfollow_t followlink; /* (don't) follow sym links */ + rfsr_state_t *stp; /* state struct assoc with request */ + vnode_t **dirvpp; /* ptr for parent vnode */ + vnode_t **compvpp; /* ptr for entry vnode */ + rfsr_ctrl_t *sr_ctrlp; { - register vnode_t *vp; /* current directory vp */ - register vnode_t *cvp; /* current component vp */ - vnode_t *tvp; /* addressable temp ptr */ - register vfs_t *vfsp; /* ptr to vfs for mount indir */ - char component[MAXNAMELEN]; - register int error = 0; - register int nlink; - int lookup_flags; - vnode_t *rsc_rootvp; - vnode_t *rdir; /* root directory */ - rf_request_t *req; + register vnode_t *vp; /* current directory vp */ + register vnode_t *cvp; /* current component vp */ + vnode_t *tvp; /* addressable temp ptr */ + register vfs_t *vfsp; /* ptr to vfs for mount indir */ + char component[MAXNAMELEN]; /* buffer for component */ + register int error = 0; + register int nlink; + int lookup_flags; + vnode_t *rsc_rootvp; + vnode_t *rdir; /* root directory */ nlink = 0; cvp = NULLVP; lookup_flags = dirvpp ? LOOKUP_DIR : 0; rsc_rootvp = stp->sr_rsrcp->r_rootvp; - /* start at current directory. */ - + /* + * start at current directory. + */ vp = stp->sr_rdp->rd_vp; VN_HOLD(vp); - /* To avoid special checks */ - - req = RF_REQ(stp->sr_in_bp); - rdir = rootdir; - if (req->rq_rrdir_id) { - if (stp->sr_vcver >= RFS2DOT0) { - rf_gift_t gift; - - gift.gift_id = req->rq_rrdir_id; - gift.gift_gen = req->rq_rrdir_gen; - if ((rdir = rf_gifttovp(&gift, stp->sr_vcver)) == - NULL) { - - /* Client has sent an invalid reference. */ - - return EPROTO; - } - } else if (req->rq_rrdir_id <= 0 || req->rq_rrdir_id >= nrcvd || - (rdir = rcvd[req->rq_rrdir_id].rd_vp) == NULL) { - - /* Client has sent an invalid reference. */ - - return EPROTO; - } - } - + /* To avoid special checks + */ + rdir = RF_REQ(stp->sr_in_bp)->rq_rrdir ? + rcvd[RF_REQ(stp->sr_in_bp)->rq_rrdir].rd_vp : rootdir; begin: - /* * Each time we begin a new name interpretation (e.g. * when first called and after each symbolic link is @@ -201,7 +161,6 @@ rfsr_lookuppn(pnp, followlink, stp, dirvpp, compvpp, sr_ctrlp) * root directory if the name starts with a '/', otherwise * continuing from the current directory. */ - component[0] = 0; if (pn_peekchar(pnp) == '/') { VN_RELE(vp); @@ -210,11 +169,6 @@ rfsr_lookuppn(pnp, followlink, stp, dirvpp, compvpp, sr_ctrlp) VN_HOLD(vp); } - /* - * Eliminate any trailing slashes in the pathname. - */ - pn_fixslash(pnp); - next: /* * Make sure we have a directory. @@ -242,7 +196,7 @@ rfsr_lookuppn(pnp, followlink, stp, dirvpp, compvpp, sr_ctrlp) */ if (dirvpp) { VN_RELE(vp); - return EEXIST; + return EINVAL; } (void) pn_set(pnp, "."); if (compvpp) @@ -413,10 +367,7 @@ rfsr_lookuppn(pnp, followlink, stp, dirvpp, compvpp, sr_ctrlp) } if (vfsp->vfs_flag & VFS_MLOCK) { vfsp->vfs_flag |= VFS_MWAIT; - if ((sleep((caddr_t)vfsp, PVFS | PCATCH)) != 0) { - error = EINTR; - goto bad; - } + (void) sleep((caddr_t)vfsp, PVFS); continue; } if (error = VFS_ROOT(cvp->v_vfsmountedhere, &tvp)) @@ -441,7 +392,7 @@ rfsr_lookuppn(pnp, followlink, stp, dirvpp, compvpp, sr_ctrlp) if (VN_CMP(vp, cvp)) { VN_RELE(vp); VN_RELE(cvp); - return EEXIST; + return EINVAL; } *dirvpp = vp; } else { @@ -519,7 +470,7 @@ reset_len(pnp, opcode, stp) bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); cop = RF_COM(bp); - RF_RESP(bp)->rp_v2giftinfo.pathlen = pnp->pn_pathlen; + RF_RESP(bp)->rp_v2gift.pathlen = pnp->pn_pathlen; cop->co_mntid = stp->sr_srmp->srm_mntid; cop->co_opcode = opcode; return bp; @@ -552,12 +503,10 @@ rfsr_gift_setup(stp, vp, out_port) register rf_response_t *resp = RF_RESP(stp->sr_out_bp); register rf_common_t *cop = RF_COM(stp->sr_out_bp); rcvd_t *giftrd = vtord(vp); - int mandlock; vattr_t vattr; /* if sd went bad, forget it */ if (out_port->sd_stat & SDLINKDOWN) { - VN_RELE(vp); return ENOLINK; } ASSERT(!stp->sr_gift); @@ -570,14 +519,11 @@ rfsr_gift_setup(stp, vp, out_port) * the reference is redundant (for that client). */ giftrd->rd_refcnt++; - VN_RELE(vp); } else { /* - * First remote reference to this file. In this case, the - * vp remains held. rcvd_free will later release it. + * First remote reference to this file. */ if (error = rcvd_create(TRUE, RDGENERAL, &giftrd)) { - VN_RELE(vp); return error; } giftrd->rd_vp = vp; @@ -586,62 +532,48 @@ rfsr_gift_setup(stp, vp, out_port) */ if ((rdup = rdu_get(giftrd, sysid, out_port->sd_mntid, out_port->sd_queue)) == NULL) { - rcvd_delete(&giftrd, (sysid_t)0, (long)-1, 1); + rcvd_delete(&giftrd, (sysid_t)0, (long)-1); return ENOSPC; } vattr.va_mask = AT_UID | AT_GID | AT_NLINK | AT_SIZE | AT_MODE | AT_VCODE; if ((error = VOP_GETATTR(vp, &vattr, 0, stp->sr_cred)) != 0) { - rdu_del(giftrd, sysid, out_port->sd_mntid, 1); - rcvd_delete(&giftrd, sysid, out_port->sd_mntid, 1); + rdu_del(giftrd, sysid, out_port->sd_mntid); + rcvd_delete(&giftrd, sysid, out_port->sd_mntid); return error; } stp->sr_srmp->srm_refcnt++; + cop->co_nlink = vattr.va_nlink; cop->co_uid = vattr.va_uid; cop->co_gid = vattr.va_gid; cop->co_ftype = VTTOIF(vp->v_type); cop->co_size = vattr.va_size; resp->rp_fhandle = (long)vp; if (stp->sr_vcver >= RFS2DOT0) { - resp->rp_v2giftinfo.flags = 0; - if (vp->v_flag & VNOSWAP) { - resp->rp_v2giftinfo.flags |= RPG_NOSWAP; - } - if (vp->v_flag & VNOMAP || vp->v_type == VCHR) { - resp->rp_v2giftinfo.flags |= RPG_NOMAP; + resp->rp_v2gift.flags = 0; + if (vp->v_flag & VNOMAP) { + resp->rp_v2gift.flags |= RPG_NOMAP; } - } else { - cop->co_nlink = vattr.va_nlink; } - - mandlock = MANDLOCK(vp, vattr.va_mode); - if (mandlock && stp->sr_vcver < RFS2DOT0) { - resp->rp_cache |= RP_MNDLCK; - } - if (stp->sr_srmp->srm_flags & SRM_CACHE && vp->v_type == VREG) { - - if (!mandlock && + if (!MANDLOCK(vp, vattr.va_mode) && (lbolt - giftrd->rd_mtime > rfc_time || lbolt < giftrd->rd_mtime)) { rdup->ru_cflag |= RU_CACHE_ON; rdup->ru_cflag &= ~RU_CACHE_DISABLE; } - if (rdup->ru_cflag & RU_CACHE_ON) { if (stp->sr_vcver >= RFS2DOT0) { resp->rp_v2vcode = vattr.va_vcode; } else if (stp->sr_opcode == RFCREATE || stp->sr_opcode == RFOPEN) { - /* * 3.2 clients only expect cacheing * info with gifts obtained via open * and create. rp_rval has * different uses otherwise. */ - resp->rp_cache = DU_CACHE_ENABLE; stp->sr_ret_val = vattr.va_vcode; } @@ -677,9 +609,6 @@ rfsr_chkrdq(rdp, pid, sysid) return NULL; } s = splstr(); - - ASSERT(!rdp->rd_qslp++); - qcnt = rdp->rd_qcnt; current = (mblk_t *)rdp->rd_rcvdq.ls_next; for (mi = 0; mi < qcnt; current = current->b_next, mi++) { @@ -691,16 +620,10 @@ rfsr_chkrdq(rdp, pid, sysid) if (RCVDEMP(rdp)) { rfsr_rmmsg(rdp); } - - ASSERT(!--rdp->rd_qslp); - splx(s); return current; } } - - ASSERT(!--rdp->rd_qslp); - splx(s); return NULL; } @@ -810,8 +733,7 @@ rfsr_adj_timeskew(gp, sec, nsec) } } -/* - * Process request for big reads from raw devices. +/* Process request for big reads from raw devices. * Stp denotes the server state structure with sr_ret_val set to the * residual read count, and sr_cred holding the client credentials. * Vp denotes the file to be read, uiop a uio_t with associated @@ -934,8 +856,6 @@ rfsr_cookedread(stp, vp, uiop, ioflag, base) (rd_user_t **)NULL); ASSERT(rdup); - ASSERT(!stp->sr_out_bp); - VOP_RWLOCK(vp); disabled = stp->sr_srmp->srm_flags & SRM_CACHE && rdup->ru_cflag & RU_CACHE_DISABLE; @@ -1041,28 +961,26 @@ rfsr_rawwrite(stp, vp, uiop, ioflag, base) register caddr_t buf; register caddr_t nextcp; /* in buf */ register caddr_t end; /* beyond end of buf */ - register size_t nleft = stp->sr_ret_val; + size_t cpinsize; /* bytes to rcopyin call */ + size_t nleft; /* bytes still on client */ size_t writerq = 0; /* bytes sent to VOP_WRITE */ size_t prewrite = 0; mblk_t *iobp; int totwrite = 0; int error = 0; - iovec_t *save_iovp = uiop->uio_iov; - int save_iovcnt = uiop->uio_iovcnt; if ((buf = kseg((int)btoc(bufsize))) == NULL) { return ENOMEM; } end = buf + bufsize; - nextcp = buf; + nleft = stp->sr_ret_val; if (stp->sr_in_bp) { ASSERT(RF_REQ(stp->sr_in_bp)->rq_xfer.prewrite); prewrite = RF_REQ(stp->sr_in_bp)->rq_xfer.prewrite; - nleft -= prewrite; /* * Drop the RFS headers, so that all blocks contain only @@ -1073,24 +991,25 @@ rfsr_rawwrite(stp, vp, uiop, ioflag, base) rf_dropbytes(stp->sr_in_bp, RF_MIN_REQ(stp->sr_vcver)); if (prewrite > stp->sr_ret_val || !iobp) { - error = - rfsr_discon("rfsr_rawwrite bad request header", stp); + error = rfsr_discon("rfsr_rawwrite bad request header", + stp); goto out; } } + nleft -= prewrite; while (prewrite) { size_t cpsz; /* Move data from message into buf. */ + nextcp = buf; while (iobp && (cpsz = MIN(end - nextcp, iobp->b_wptr - iobp->b_rptr)) != 0) { bcopy((caddr_t)iobp->b_rptr, nextcp, cpsz); nextcp += cpsz; totwrite += cpsz; - prewrite -= cpsz; if ((iobp->b_rptr += cpsz) == iobp->b_wptr) { stp->sr_in_bp = stp->sr_in_bp->b_cont; iobp->b_cont = NULL; @@ -1099,14 +1018,16 @@ rfsr_rawwrite(stp, vp, uiop, ioflag, base) } } + writerq = nextcp - buf; + base += writerq; + prewrite -= writerq; + if (!prewrite != !iobp) { error = rfsr_discon("rfsr_rawrite bad prewrite", stp); goto out; } - writerq = nextcp - buf; - - if (nextcp == end || nextcp - buf == stp->sr_ret_val) { + if (nextcp == end || !nleft) { /* * Write now only if buffer is full or nothing left @@ -1117,15 +1038,13 @@ rfsr_rawwrite(stp, vp, uiop, ioflag, base) uiop->uio_resid = uiop->uio_iov->iov_len = writerq; if ((error = - VOP_WRITE(vp, uiop, ioflag, stp->sr_cred)) != 0 || + VOP_WRITE(vp, uiop, ioflag, stp->sr_cred)) != 0 || uiop->uio_resid == writerq) { /* Error or can't write any more */ goto out; } - uiop->uio_iov = save_iovp; - uiop->uio_iovcnt = save_iovcnt; if (uiop->uio_resid) { @@ -1137,58 +1056,48 @@ rfsr_rawwrite(stp, vp, uiop, ioflag, base) ovbcopy(nextcp - uiop->uio_resid, buf, (size_t)uiop->uio_resid); - writerq -= uiop->uio_resid; - nextcp = buf + uiop->uio_resid; - } else { - nextcp = buf; } - stp->sr_ret_val -= writerq; - base += writerq; + + stp->sr_ret_val -= writerq - uiop->uio_resid; } #ifdef DEBUG else { - /* Fall through to rcopyin and write */ + /* Fall throught to rcopyin and write */ ASSERT(!prewrite); } #endif } - while (stp->sr_ret_val && !error) { - size_t rcprq; /* bytes to rcopyin */ + while(stp->sr_ret_val && !error) { - rcprq = (size_t)MIN(nleft - (nextcp - buf), end - nextcp); - if (rcprq) { - if ((rcopyin(base, nextcp, rcprq, 1)) != 0) { - error = EFAULT; - goto out; - } - nleft -= rcprq; - base += rcprq; - nextcp += rcprq; + ASSERT(nleft); + + cpinsize = MIN(nleft, end - nextcp); + if (rcopyin(base, nextcp, cpinsize, 1)) { + error = EFAULT; + goto out; } - writerq = nextcp - buf; - uiop->uio_iov->iov_base = buf; - uiop->uio_resid = uiop->uio_iov->iov_len = writerq; + nleft -= cpinsize; + base += cpinsize; + totwrite += cpinsize; + writerq = nextcp + cpinsize - buf; + + uiop->uio_iov->iov_base = nextcp = buf; + uiop->uio_resid = uiop->uio_iov->iov_len = writerq = cpinsize; - if ((error = VOP_WRITE(vp, uiop, ioflag, stp->sr_cred)) != 0 || + if ((error = + VOP_WRITE(vp, uiop, ioflag, stp->sr_cred)) != 0 || uiop->uio_resid == writerq) { goto out; } - uiop->uio_iov = save_iovp; - uiop->uio_iovcnt = save_iovcnt; if (uiop->uio_resid) { ovbcopy(nextcp - uiop->uio_resid, buf, (size_t)uiop->uio_resid); - writerq -= uiop->uio_resid; - nextcp = buf + uiop->uio_resid; - } else { - nextcp = buf; } - stp->sr_ret_val -= writerq; - totwrite += writerq; + stp->sr_ret_val -= writerq - uiop->uio_resid; } out: SR_FREEMSG(stp); @@ -1224,8 +1133,7 @@ rfsr_cookedwrite(stp, vp, uiop, ioflag, base) register size_t nleft; /* bytes on client */ register size_t writerq; /* bytes in message */ register sndd_t *srchan; /* channel to client */ - size_t totwrite = 0; - off_t o_offset; /* original file offset */ + int totwrite = 0; register int error = 0; int tmperror = 0; /* remember errors that don't * immediately break the loop @@ -1233,7 +1141,6 @@ rfsr_cookedwrite(stp, vp, uiop, ioflag, base) VOP_RWLOCK(vp); - o_offset = uiop->uio_offset; nleft = stp->sr_ret_val; srchan = u.u_srchan; @@ -1241,7 +1148,7 @@ rfsr_cookedwrite(stp, vp, uiop, ioflag, base) ASSERT(RF_REQ(stp->sr_in_bp)->rq_xfer.prewrite); - nleft -= writerq = RF_REQ(stp->sr_in_bp)->rq_xfer.prewrite; + writerq = RF_REQ(stp->sr_in_bp)->rq_xfer.prewrite; if (writerq > stp->sr_ret_val) { error = rfsr_discon("rfsr_cookedwrite bad prewrite", @@ -1250,16 +1157,15 @@ rfsr_cookedwrite(stp, vp, uiop, ioflag, base) } if ((error = rfsr_writev(vp, uiop, ioflag, stp, - RF_MIN_REQ(stp->sr_vcver), - (size_t)RF_REQ(stp->sr_in_bp)->rq_xfer.prewrite)) != 0) { + RF_MIN_REQ(stp->sr_vcver))) != 0) { goto out; } - writerq -= uiop->uio_resid; - stp->sr_ret_val -= writerq; - base += writerq; - totwrite += writerq; + stp->sr_ret_val -= writerq - uiop->uio_resid; } + nleft -= writerq; + base += writerq; + totwrite += writerq; if (!stp->sr_ret_val || uiop->uio_resid || error) { goto out; } @@ -1279,7 +1185,6 @@ rfsr_cookedwrite(stp, vp, uiop, ioflag, base) } writerq = RF_RESP(stp->sr_in_bp)->rp_count; - nleft -= writerq; if (writerq > stp->sr_ret_val) { error = rfsr_discon("rfsr_cookedwrite bad copyin", stp); @@ -1288,11 +1193,11 @@ rfsr_cookedwrite(stp, vp, uiop, ioflag, base) if (!tmperror && !uiop->uio_resid) { tmperror = rfsr_writev(vp, uiop, ioflag, stp, - RF_MIN_RESP(stp->sr_vcver), writerq); - writerq -= uiop->uio_resid; - stp->sr_ret_val -= writerq; + RF_MIN_RESP(stp->sr_vcver)); + stp->sr_ret_val -= writerq - uiop->uio_resid; totwrite += writerq; } + nleft -= writerq; rf_freemsg(stp->sr_in_bp); stp->sr_in_bp = NULL; } @@ -1300,20 +1205,15 @@ rfsr_cookedwrite(stp, vp, uiop, ioflag, base) rcvd_free(&rd); SR_FREEMSG(stp); VOP_RWUNLOCK(vp); - if (!error && vp->v_type == VREG) { - (void)VOP_PUTPAGE(vp, o_offset, totwrite, - B_ASYNC, stp->sr_cred); - } stp->sr_srmp->srm_kbcnt += totwrite / 1024; return error ? error : tmperror; } /* * Code common to initialization sequences of rfsr_read, rfsr_write. - * Always returns an error status. If no other errors, and client is - * pre-SVR4, and a change in mandatory lock status has occurred, - * allocates a response, sets its RP_MNDLCK flag, sets *sr_ctrlp to - * SR_NACK_RESP, and returns ENOMEM. + * Always returns an error status. If no errors and a change in mandatory + * lock status has occurred, allocates a response, sets its RP_MNDLCK flag + * and set *sr_ctrlp to SR_NACK_RESP. */ int rfsr_rdwrinit(stp, uiop, vp, flagp, sr_ctrlp) @@ -1328,36 +1228,12 @@ rfsr_rdwrinit(stp, uiop, vp, flagp, sr_ctrlp) register unsigned ioflag = 0; register int error = 0; int chklock; - int op = stp->sr_opcode; - rd_user_t *rdup; - - /* TO DO: checks for GETPAGE/PUTPAGE (here?) */ - - switch (op) { - case RFREAD: - case RFWRITE: - case DUREADI: - case DUWRITEI: - rdup = rdu_find(stp->sr_rdp, - u.u_procp->p_sysid, u.u_srchan->sd_mntid, - (rd_user_t **)NULL); - if (!rdup || - (op == RFREAD || op == DUREADI) && - !rdup->ru_frwcnt && !rdup->ru_frcnt || - (op == RFWRITE || op == DUWRITEI) && - !rdup->ru_frwcnt && !rdup->ru_fwcnt) { - return EPROTO; - } - break; - default: - break; - } chklock = RF_MSG(stp->sr_in_bp)->m_stat & RF_VER1 && - stp->sr_vcver < RFS2DOT0 && !(req->rq_flags & RQ_MNDLCK); - - /* return value of read, write requests in residual char count */ - + !(req->rq_flags & RQ_MNDLCK); + /* + * return value of read, write requests in residual char count + */ stp->sr_ret_val = req->rq_xfer.count; stp->sr_oldoffset = req->rq_xfer.offset; uiop->uio_iovcnt = 1; @@ -1373,41 +1249,18 @@ rfsr_rdwrinit(stp, uiop, vp, flagp, sr_ctrlp) } *flagp = ioflag; - if (chklock || op == RFPUTPAGE) { + if (chklock || stp->sr_opcode == RFPUTPAGE) { vattr.va_mask = AT_MODE | AT_SIZE; if ((error = VOP_GETATTR(vp, &vattr, 0, stp->sr_cred)) == 0) { - if (op == RFPUTPAGE) { - size_t rsz; - - /* - * TO DO: The btoprsz hack tries to mimic - * what a disk file system does in truncating - * putpages. It's not clear this is good - * enough, nor is it clear we can do better - * while continuing to map putpages into - * writes. - */ - - rsz = ptob(btopr(vattr.va_size)); - if (stp->sr_ret_val + uiop->uio_offset > rsz) { - error = EFAULT; - } else if (stp->sr_ret_val + uiop->uio_offset - > vattr.va_size) { - stp->sr_ret_val -= - (rsz - vattr.va_size); - if (req->rq_xfer.prewrite > - stp->sr_ret_val) { - req->rq_xfer.prewrite = - stp->sr_ret_val; - } - } + if (stp->sr_opcode == RFPUTPAGE && + stp->sr_ret_val + uiop->uio_offset >= vattr.va_size) { + error = EFAULT; } else if (chklock && MANDLOCK(vp, vattr.va_mode)) { ASSERT(!stp->sr_out_bp); stp->sr_out_bp = rfsr_rpalloc((size_t)0, stp->sr_vcver); RF_RESP(stp->sr_out_bp)->rp_cache = RP_MNDLCK; *sr_ctrlp = SR_NACK_RESP; - error = ENOMEM; } } } @@ -1422,13 +1275,12 @@ rfsr_rdwrinit(stp, uiop, vp, flagp, sr_ctrlp) * impunity. */ STATIC int -rfsr_writev(vp, uiop, ioflag, stp, hdrsz, nbytes) +rfsr_writev(vp, uiop, ioflag, stp, hdrsz) vnode_t *vp; uio_t *uiop; unsigned ioflag; rfsr_state_t *stp; size_t hdrsz; - size_t nbytes; { iovec_t *iovp; int niov = 0; @@ -1442,7 +1294,6 @@ rfsr_writev(vp, uiop, ioflag, stp, hdrsz, nbytes) } rf_iov_alloc(uiop, stp->sr_in_bp); - uiop->uio_resid = nbytes; iovp = uiop->uio_iov; niov = uiop->uio_iovcnt; @@ -1499,27 +1350,15 @@ rfsr_rcvmsg(bufpp, sdp, stp) rfsr_exit(stp); /* no return */ /* NOTREACHED */ } else { - - /* rf_deliver will take the server off the idle list. */ - - ASSERT(!rfsr_idle_lock++); - + /* Arrmsg will take the server off the idle list + */ ++rfsr_nidle; u.u_procp->p_rlink = rfsr_idle_procp; rfsr_idle_procp = u.u_procp; - - ASSERT(!--rfsr_idle_lock); - if (sleep((caddr_t)&u.u_procp->p_srwchan, PREMOTE | PCATCH | PNOSTOP)) { - - ASSERT(!rfsr_idle_lock++); - rfsr_rmlist(&rfsr_idle_procp, &rfsr_nidle, u.u_procp); - - ASSERT(!--rfsr_idle_lock); - splx(s); rfsr_exit(stp); /* NOTREACHED */ @@ -1537,18 +1376,13 @@ rfsr_rcvmsg(bufpp, sdp, stp) /* * Signal messages don't contain gifts of specific rds. */ - sndd_set(sdp, msg->m_queue, &msg->m_gift); + sndd_set(sdp, (queue_t *)msg->m_queue, msg->m_giftid); } sdp->sd_mntid = RF_COM(bufp)->co_mntid; - - ASSERT(!rfsr_active_lock++); - ++rfsr_nactive; u.u_procp->p_rlink = rfsr_active_procp; rfsr_active_procp = u.u_procp; - ASSERT(!--rfsr_active_lock); - splx(s); } @@ -1601,14 +1435,12 @@ rfsr_rmactive(procp) register struct proc *procp; { rf_delsig(procp, SIGUSR1); - ASSERT(!rfsr_active_lock++); rfsr_rmlist(&rfsr_active_procp, &rfsr_nactive, procp); - ASSERT(!--rfsr_active_lock); } -/* - * Add rcvd to the end of the rfsr_msgs list. Duplicates are ignored - * dbecause interrupts on different receive descriptors can try to put +/* add rcvd to the END of the rfsr_msgs list. + * duplicates are ignored because interrupts on + * different receive descriptors can try to put * the same receive descriptor on the rfsr_msgs list. * * We use splstr because rf_deliver manipulates message and server lists @@ -1623,8 +1455,6 @@ rfsr_addmsg(rcvdp) register rcvd_t *current; register int s = splstr(); - ASSERT(!rfsr_msg_lock++); - if (!rfsr_msgs) { rfsr_msgs = rcvdp; rcvdp->rd_next = NULL; @@ -1640,14 +1470,11 @@ rfsr_addmsg(rcvdp) rfsr_nmsg++; } } - - ASSERT(!--rfsr_msg_lock); - splx(s); } -/* - * If the rd is empty, remove it from the rfsr_msgs list. + +/* If the rd is empty, remove it from the rfsr_msgs list. * Update rfsr_nmsg, NULL rcvdp->rd_next. * * We use splstr because rf_deliver manipulates message and server lists @@ -1660,14 +1487,11 @@ rfsr_rmmsg(rcvdp) register rcvd_t *prev; register int s = splstr(); - ASSERT(!rfsr_msg_lock++); - if (RCVDEMP(rcvdp) && rfsr_msgs) { prev = rfsr_msgs; if (rfsr_msgs == rcvdp) { rfsr_msgs = rfsr_msgs->rd_next; --rfsr_nmsg; - rcvdp->rd_next = NULL; } else { register rcvd_t *current; @@ -1682,9 +1506,6 @@ rfsr_rmmsg(rcvdp) } } } - - ASSERT(!--rfsr_msg_lock); - splx(s); } @@ -2147,24 +1968,24 @@ rsuword(to, w) * receive copyin messages from the client. Otherwise, *rdpp * is undefined. Base is denotes the client io buffer, and is * used only for protocol consistency; clients have this information - * and should ignore server copy. chan is assumed to point to the + * and should ignore server copy. Gift is assumed to point to the * channel to the client; nbytes is the number of bytes of data to request. * * Returns 0 for success, nonzero errno for failure. NULLs *rdpp in * failure cases. */ STATIC int -sendcopyinmsg(rdpp, base, chan, nbytes) +sendcopyinmsg(rdpp, base, gift, nbytes) rcvd_t **rdpp; register caddr_t base; - register sndd_t *chan; + register sndd_t *gift; size_t nbytes; { register rcvd_t *rdp; register int error; register mblk_t *outbp; register rf_response_t *resp; - register int vcver = QPTOGP(chan->sd_queue)->version; + register int vcver = QPTOGP(gift->sd_queue)->version; /* NOTE: because of protocol history, there is NO SUCH * THING AS A RFCOPYIN REQUEST. Messages in both directions @@ -2174,13 +1995,13 @@ sendcopyinmsg(rdpp, base, chan, nbytes) return error; } rdp = *rdpp; - rdp->rd_sdp = chan; + rdp->rd_sdp = gift; outbp = rfsr_rpalloc((size_t)0, vcver); resp = RF_RESP(outbp); RF_COM(outbp)->co_opcode = RFCOPYIN; resp->rp_count = nbytes; resp->rp_xfer.buf = (long)base; - if ((error = rf_sndmsg(chan, outbp, RF_MIN_RESP(vcver), rdp, FALSE)) + if ((error = rf_sndmsg(gift, outbp, RF_MIN_RESP(vcver), rdp, FALSE)) != 0) { rcvd_free(rdpp); } @@ -2224,6 +2045,7 @@ rfsr_copyflock(flp, stp) register caddr_t flp; register rfsr_state_t *stp; { + int error; size_t datasz; size_t hdrsz; register caddr_t rqdata; @@ -2232,10 +2054,12 @@ rfsr_copyflock(flp, stp) stp->sr_vcver >= RFS2DOT0 ? sizeof(flock_t) : sizeof(o_flock_t); hdrsz = RF_MIN_REQ(stp->sr_vcver); if (stp->sr_gdpp->hetero != NO_CONV) { - datasz += (stp->sr_vcver >= RFS2DOT0 ? FLOCK_XP : OFLOCK_XP); + datasz += (stp->sr_vcver >= RFS2DOT0 ? FLOCK_XP : + OFLOCK_XP) - MINXPAND; } - if (RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) { - return rfsr_discon("rfsr_copyflock bad data", stp); + if ((error = RF_PULLUP(stp->sr_in_bp, hdrsz, datasz)) != 0) { + SR_FREEMSG(stp); + return error; } rqdata = rf_msgdata(stp->sr_in_bp, hdrsz); if (stp->sr_gdpp->hetero != NO_CONV && @@ -2325,23 +2149,17 @@ rfsr_lastdirents(dp, uiop, ooff, resid, eofp) * this point error-free, and after they have allocated a response message, * referred to by stp->sr_out_bp. * - * This routine should be used only for connections of version 2 or later, + * This routine should be used only for connections of version 2 or greater, * where the response does not contain a gift. * - * When the response to a version 2 or later client contains a gift, - * rp_v2vcode must refer to the newly referenced file, not the original - * operand vp. Code in rfsr_gift_setup(), rather than this routine, - * handles that case. + * When the response contains a gift, rp_v2vcode refers to + * the newly referenced file. Code in rfsr_gift_setup(), rather than this + * routine, handles that case. * - * For version 2 or later clients, sets rp_v2vcode in the response to - * indicate whether cacheing may be enabled(reenabled) for the file - * referred to by stp->sr_vp. Whenever it sets this to a non-zero value, - * it ensures that the rduptr->ru_cflag is set for this file/client pair. - * - * For old clients, sets the DU_CACHE_ENABLE flag if the current op is - * RFREAD, and if caching should be reenabled. Also sets rp_rdwr.isize - * for RFREAD and DUREADI ops, and sets RP_MNDLCK if mandatory locking - * is enabled for the file. + * rfsr_cacheck() sets rp_v2vcode in the response to indicate whether + * cacheing may be enabled(reenabled) for the file referred to by stp->sr_vp. + * Whenever it sets this to a non-zero value, it ensures that the + * rduptr->ru_cflag is set for this file/client pair. */ int rfsr_cacheck(stp, mntid) @@ -2352,7 +2170,6 @@ rfsr_cacheck(stp, mntid) register rcvd_t *rcvdp = stp->sr_rdp; register vnode_t *vp = RDTOV(rcvdp); register int error; - register int mandlock; /* * vp or rdup can be NULL if we've just given up our last @@ -2361,7 +2178,6 @@ rfsr_cacheck(stp, mntid) */ ASSERT(!stp->sr_gift); - ASSERT(stp->sr_out_bp); if (vp && (rdup = rdu_find(rcvdp, u.u_procp->p_sysid, mntid, (rd_user_t **)NULL)) != NULL) { @@ -2372,25 +2188,9 @@ rfsr_cacheck(stp, mntid) if ((error = VOP_GETATTR(vp, &vattr, 0, stp->sr_cred)) != 0) { return error; } - RF_COM(stp->sr_out_bp)->co_size = vattr.va_size; rp->rp_fhandle = (long)vp; - mandlock = MANDLOCK(vp, vattr.va_mode); - - if (stp->sr_vcver == RFS1DOT0) { - if (stp->sr_opcode == RFREAD || - stp->sr_opcode == DUREADI) { - rp->rp_rdwr.isize = vattr.va_size; - } - if (mandlock) { - rp->rp_cache |= RP_MNDLCK; - } - if (stp->sr_opcode != RFREAD) { - return 0; - } - } - - if (!mandlock && vp->v_type == VREG && + if (!MANDLOCK(vp, vattr.va_mode) && vp->v_type == VREG && stp->sr_srmp->srm_flags & SRM_CACHE && (lbolt - rcvdp->rd_mtime > rfc_time || lbolt < rcvdp->rd_mtime)) { @@ -2402,7 +2202,6 @@ rfsr_cacheck(stp, mntid) } } } - if (rdup->ru_cflag & RU_CACHE_ON && stp->sr_vcver >= RFS2DOT0) { rp->rp_v2vcode = vattr.va_vcode; } @@ -2410,7 +2209,7 @@ rfsr_cacheck(stp, mntid) return 0; } -STATIC int +int rfsr_discon(msg, stp) char *msg; rfsr_state_t *stp; @@ -2419,288 +2218,3 @@ rfsr_discon(msg, stp) SR_FREEMSG(stp); return EPROTO; } - -int -rfsr_j_accuse(msg, stp) - char *msg; - rfsr_state_t *stp; -{ - gdp_j_accuse(msg, stp->sr_gdpp); - SR_FREEMSG(stp); - return EPROTO; -} - -/* - * Record a mapping in rdup's mapping descriptor list, keeping the list in - * order by offsets (but unordered by length). - */ -int -rfm_addmap(rdup, off, len, prot) - rd_user_t *rdup; - uint off; - uint len; - uint prot; -{ - rf_mapd_t *nmp = (rf_mapd_t *)kmem_alloc(sizeof(rf_mapd_t), - KM_SLEEP); - rf_mapd_t *mp = (rf_mapd_t *)rdup->ru_mapdlist.ls_next; - int reads = prot & PROT_READ ? 1 : 0; - int writes = prot & PROT_WRITE ? 1 : 0; - int execs = prot & PROT_EXEC ? 1 : 0; - - if (!nmp) { - return ENOMEM; - } - while (mp != (rf_mapd_t *)&rdup->ru_mapdlist && mp->rfm_off <= off) { - if (mp->rfm_off == off && mp->rfm_len == len) { - mp->rfm_reads += reads; - mp->rfm_writes += writes; - mp->rfm_execs += execs; - kmem_free((caddr_t)nmp, sizeof(rf_mapd_t)); - nmp = NULL; - break; - } - mp = (rf_mapd_t *)mp->rfm_list.ls_next; - } - if (nmp) { - nmp->rfm_off = off; - nmp->rfm_len = len; - nmp->rfm_reads = reads; - nmp->rfm_writes = writes; - nmp->rfm_execs = execs; - LS_INS_BEFORE(mp, nmp); - } - - /* TO DO: list should compact at EVERY update. */ - - return 0; -} - -/* - * delmap off to off + len for vp, updating rdup mapping descriptor list. - */ -void -rfm_delmap(rdup, off, len, prot, vp, crp) - rd_user_t *rdup; - uint off; - uint len; - uint prot; - vnode_t *vp; - cred_t *crp; -{ - rf_mapd_t *rmdp = (rf_mapd_t *)rdup->ru_mapdlist.ls_next; - int reads = prot & PROT_READ ? 1 : 0; - int writes = prot & PROT_WRITE ? 1 : 0; - int execs = prot & PROT_EXEC ? 1 : 0; - - while (len && rmdp != (rf_mapd_t *)&rdup->ru_mapdlist) { - register uint moff = rmdp->rfm_off; - register uint mlen = rmdp->rfm_len; - register uint deloff = MAX(moff, off); - register uint dellen = MIN(off + len, moff + mlen) - deloff; - rf_mapd_t *nextp = (rf_mapd_t *)rmdp->rfm_list.ls_next; - - if (moff <= off + len && moff + mlen >= off) { - if (rmdp->rfm_reads >= reads && - rmdp->rfm_writes >= writes && - rmdp->rfm_execs >= execs) { - (void)VOP_DELMAP(vp, deloff, NULL, NULL, - dellen, prot, prot, 0, crp); - rfm_remove(rdup, vp, rmdp, deloff, dellen, - prot, crp); - off = deloff + dellen; - len -= dellen; - } - } else if (moff > off + len) { - /* - * Now we're out of range since mapdlist is sorted into - * chunks by offset. - */ - break; - } - rmdp = nextp; - } -} - -/* - * Remove an instance of a mapping with prot protections ranging from deloff - * to deloff + dellen. This is a complex undertaking since it can actually - * involve adding two new descriptors in the case that one is split and is - * still referenced in the original form. - * - * NOTE: When it is necessary to add new descriptors and an allocation fails, - * more of a mapping is disposed of (to replace the need for the descriptors). - * Although this might prevent further use of the mapping, it is most important - * to protect the server state. - */ -STATIC void -rfm_remove(rdup, vp, rmdp, deloff, dellen, prot, crp) - rd_user_t *rdup; - vnode_t *vp; - rf_mapd_t *rmdp; - uint deloff; - uint dellen; - uint prot; - cred_t *crp; -{ - register uint moff = rmdp->rfm_off; - register uint mlen = rmdp->rfm_len; - - if (deloff > moff) { - if (rfm_addmap(rdup, moff, deloff - moff, prot)) { - cmn_err(CE_NOTE, "rfm_remove: kmem_alloc failed\n"); - (void)VOP_DELMAP(vp, moff, NULL, NULL, deloff - moff, - prot, prot, 0, crp); - rfm_remove(rdup, vp, rmdp, moff, - dellen + (deloff - moff), prot, crp); - return; - } - } - if (deloff + dellen < moff + mlen) { - if (rfm_addmap(rdup, deloff + dellen, - (moff + mlen) - (deloff + dellen), prot)) { - cmn_err(CE_NOTE, "rfm_remove: kmem_alloc failed\n"); - (void)VOP_DELMAP(vp, deloff + dellen, NULL, NULL, - (moff + mlen) - (deloff + dellen), prot, prot, 0, crp); - rfm_remove(rdup, vp, rmdp, moff, mlen, prot, crp); - return; - } - } - if (rmdp->rfm_reads && (prot & PROT_READ)) { - rmdp->rfm_reads--; - } - if (rmdp->rfm_writes && (prot & PROT_WRITE)) { - rmdp->rfm_writes--; - } - if (rmdp->rfm_execs && (prot & PROT_EXEC)) { - rmdp->rfm_execs--; - } - if (!(rmdp->rfm_reads + rmdp->rfm_writes + rmdp->rfm_execs)) { - ls_remove((ls_elt_t *)rmdp); - kmem_free(rmdp, sizeof(rf_mapd_t)); - } - return; -} - -/* - * remove all mapping descriptors, doing appropriate VOP_DELMAPs - */ -void -rfm_empty(rdup, vp) - rd_user_t *rdup; - vnode_t *vp; -{ - rf_mapd_t *rmdp; - - while ((rmdp = (rf_mapd_t *)LS_REMQUE(&rdup->ru_mapdlist)) != NULL) { - register int i; - - for (i = MAX(MAX(rmdp->rfm_reads, rmdp->rfm_writes), - rmdp->rfm_execs); i; i -= 1) { - uint prot = 0; - - if (rmdp->rfm_reads) { - prot |= PROT_READ; - rmdp->rfm_reads--; - } - if (rmdp->rfm_writes) { - prot |= PROT_WRITE; - rmdp->rfm_writes--; - } - if (rmdp->rfm_execs) { - prot |= PROT_EXEC; - rmdp->rfm_execs--; - } - (void)VOP_DELMAP(vp, rmdp->rfm_off, NULL, NULL, - rmdp->rfm_len, prot, prot, 0, 0); - } - kmem_free(rmdp, sizeof(rf_mapd_t)); - } -} - -/* - * Check whether the client machine making a request to do with a mapping - * has generous enough permissions. Returns 1 if the access is allowed, 0 - * otherwise. - * - * The loosely defined vm/vfs interface allows VOP_GETPAGE/VOP_PUTPAGE - * operations not preceded by VOP_MAPs, in fact, it is cheaper to check - * whether the file is mappable by the client than to verify that a - * mapping exists. We only check for an existing mapping if the cheaper - * check fails. - */ -int -rfm_check(vp, crp, rdup, off, len, prot) - vnode_t *vp; - cred_t *crp; - rd_user_t *rdup; - uint off; - uint len; - uint prot; -{ - rf_mapd_t *rmdp = (rf_mapd_t *)rdup->ru_mapdlist.ls_next; - vattr_t vattr; - int reads = prot & PROT_READ ? 1 : 0; - int writes = prot & PROT_WRITE ? 1 : 0; - int execs = prot & PROT_EXEC ? 1 : 0; - - vattr.va_mask = AT_SIZE; - if (VOP_GETATTR(vp, &vattr, ATTR_COMM, crp) || off > - vattr.va_size) { - return 0; - } - - if (writes <= (int)(rdup->ru_frwcnt + rdup->ru_fwcnt) && - (rdup->ru_frwcnt + rdup->ru_fwcnt + rdup->ru_frcnt) && - !(vp->v_flag & VNOMAP) && !vp->v_filocks && - (vp->v_type == VREG || vp->v_type == VBLK)) { - return 1; - } - - if (off + len > (vattr.va_size + PAGEOFFSET & PAGEMASK)) { - len = vattr.va_size - off; - } - while (rmdp != (rf_mapd_t *)&rdup->ru_mapdlist) { - register uint moff = rmdp->rfm_off; - register uint mlen = rmdp->rfm_len; - - if (moff > off) { - /* - * We're beyond descriptors with off offset in the - * sorted list and didn't find sufficient mappings. - */ - break; - } else if (moff + mlen >= off && rmdp->rfm_reads >= reads && - rmdp->rfm_writes >= writes && rmdp->rfm_execs >= execs) { - if (moff + mlen >= off + len) { - return 1; - } else { - len = (off + len) - (moff + mlen); - off = moff + mlen; - } - } - rmdp = (rf_mapd_t *)rmdp->rfm_list.ls_next; - } - return 0; -} - -void -rfm_lock(rdup) - rd_user_t *rdup; -{ - while (rdup->ru_mapdstat & MAPDLOCK) { - rdup->ru_mapdstat |= MAPDWANT; - sleep((caddr_t)&rdup->ru_mapdstat, PREMOTE | PCATCH); - } - rdup->ru_mapdstat = MAPDLOCK; -} - -void -rfm_unlock(rdup) - rd_user_t *rdup; -{ - if (rdup->ru_mapdstat & MAPDWANT) { - wakeprocs((caddr_t)&rdup->ru_mapdstat, PRMPT); - } - rdup->ru_mapdstat = 0; -} diff --git a/usr/src/uts/3b2/fs/s5/s5alloc.c b/usr/src/uts/3b2/fs/s5/s5alloc.c index e4e26a6..3d8637b 100644 --- a/usr/src/uts/3b2/fs/s5/s5alloc.c +++ b/usr/src/uts/3b2/fs/s5/s5alloc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5alloc.c 1.33" +#ident "@(#)fs:fs/s5/s5alloc.c 1.29" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -28,8 +28,8 @@ #include "vm/pvn.h" -#include "sys/proc.h" -#include "sys/disp.h" +#include "sys/proc.h" /* XXX -- needed for user-context kludge in ILOCK */ +#include "sys/disp.h" /* XXX */ #include "sys/fs/s5param.h" #include "sys/fs/s5fblk.h" @@ -88,7 +88,7 @@ blkalloc(vfsp, bnp) bp->b_flags |= B_STALE|B_AGE; brelse(bp); fp->s_flock = 0; - wakeprocs((caddr_t)&fp->s_flock, PRMPT); + wakeup((caddr_t)&fp->s_flock); } if (fp->s_nfree <= 0 || fp->s_nfree > NICFREE) { prdev("Bad free count", dev); @@ -140,7 +140,7 @@ blkfree(vfsp, bno) fp->s_nfree = 0; bdwrite(bp); fp->s_flock = 0; - wakeprocs((caddr_t)&fp->s_flock, PRMPT); + wakeup((caddr_t)&fp->s_flock); } else if (incore(dev, bno, bsize)) { /* * There may be a leftover in-core buffer for this block; @@ -221,7 +221,7 @@ ialloc(vfsp, mode, nlink, rdev, uid, gid, ipp) if (fp->s_ninode > 0 && (ino = fp->s_inode[--fp->s_ninode])) { if (error = iget(vfsp, ino, &ip)) { fp->s_ilock = 0; - wakeprocs(&fp->s_ilock, PRMPT); + wakeup(&fp->s_ilock); return error; } vp = ITOV(ip); @@ -249,21 +249,21 @@ ialloc(vfsp, mode, nlink, rdev, uid, gid, ipp) ip->i_major = getemajor(rdev); ip->i_minor = geteminor(rdev); ip->i_bcflag |= NDEVFORMAT; - /* - * To preserve backward compatibility we store - * dev in old format if it fits, otherwise - * NODEV is assigned. - */ + + /* to preserve backward compatibility we store + ** dev in old format if it fits, otherwise + ** NODEV is assigned. + */ + if ((oldrdev = cmpdev(rdev)) != (o_dev_t) NODEV) ip->i_oldrdev = (daddr_t)oldrdev; else ip->i_oldrdev = (daddr_t)NODEV; } else if (type == VXNAM) { - /* - * Believe it or not. XENIX stores - * semaphore info in rdev. - */ + /* Believe it or not XENIX stores + ** semaphore info in rdev. + */ ip->i_rdev = rdev; ip->i_oldrdev = rdev; /* need this for iupdat */ } @@ -274,7 +274,7 @@ ialloc(vfsp, mode, nlink, rdev, uid, gid, ipp) fp->s_fmod = 1; iupdat(ip); fp->s_ilock = 0; - wakeprocs(&fp->s_ilock, PRMPT); + wakeup(&fp->s_ilock); *ipp = ip; return 0; } @@ -284,7 +284,7 @@ ialloc(vfsp, mode, nlink, rdev, uid, gid, ipp) cmn_err(CE_NOTE, "ialloc: inode was already allocated\n"); iupdat(ip); fp->s_ilock = 0; - wakeprocs(&fp->s_ilock, PRMPT); + wakeup(&fp->s_ilock); iput(ip); goto loop; } @@ -326,7 +326,7 @@ ialloc(vfsp, mode, nlink, rdev, uid, gid, ipp) fp->s_ninode = 0; fp->s_tinode = 0; fp->s_ilock = 0; - wakeprocs((caddr_t)&fp->s_ilock, PRMPT); + wakeup((caddr_t)&fp->s_ilock); prdev("Out of inodes", dev); return ENOSPC; } @@ -344,9 +344,7 @@ ifree(ip) register struct vnode *vp = ITOV(ip); ASSERT(ip->i_flag & ILOCKED); - /* - * Don't put an already free inode on the free list. - */ + /* Don't put an already free inode on the free list. */ if (ip->i_mode == 0) return 0; ino = ip->i_number; @@ -369,7 +367,7 @@ ifree(ip) } else fp->s_inode[fp->s_ninode++] = ino; fp->s_ilock--; - wakeprocs((caddr_t)&fp->s_ilock, PRMPT); + wakeup((caddr_t)&fp->s_ilock); return 0; } @@ -427,35 +425,6 @@ s5freesp(vp, lp, flag) s5vfsp = S5VFS(vfsp); nindir = s5vfsp->vfs_nindir; - /* - * Check if there is any active mandatory lock on the - * range that will be truncated/expanded. - */ - if (MANDLOCK(vp, ip->i_mode)) { - int save_start; - - save_start = lp->l_start; - - if (ip->i_size < lp->l_start) { - /* - * "Truncate up" case: need to make sure there - * is no lock beyond current end-of-file. To - * do so, we need to set l_start to the size - * of the file temporarily. - */ - lp->l_start = ip->i_size; - } - lp->l_type = F_WRLCK; - lp->l_sysid = u.u_procp->p_sysid; - lp->l_pid = u.u_procp->p_epid; - i = (flag & (FNDELAY|FNONBLOCK)) ? 0 : SLPFLCK; - if ((i = reclock(vp, lp, i, 0, lp->l_start)) != 0 - || lp->l_type != F_UNLCK) - return i ? i : EAGAIN; - - lp->l_start = save_start; - } - if (ip->i_size < lp->l_start) { /* * "Truncate up" case: the file is grown to the size @@ -467,7 +436,7 @@ s5freesp(vp, lp, flag) ILOCK(ip); if (ip->i_map) s5freemap(ip); - if (error = bmapalloc(ip, lastblock, lastblock, 0)) { + if (error = bmapalloc(ip, lastblock, lastblock, 0, 0)) { IUNLOCK(ip); return error; } @@ -478,6 +447,20 @@ s5freesp(vp, lp, flag) return 0; } + /* + * Truncation honors mandatory record locking protocol + * exactly as writing does. + */ + if (MANDLOCK(vp, ip->i_mode)) { + lp->l_type = F_WRLCK; + lp->l_sysid = u.u_procp->p_sysid; + lp->l_pid = u.u_procp->p_epid; + i = (flag & (FNDELAY|FNONBLOCK)) ? 0 : SLPFLCK; + if ((i = reclock(vp, lp, i, 0, lp->l_start)) != 0 + || lp->l_type != F_UNLCK) + return i ? i : EAGAIN; + } + ILOCK(ip); if (ip->i_map) @@ -496,7 +479,7 @@ s5freesp(vp, lp, flag) * of subsequent file growth. */ pvn_vptrunc(vp, lp->l_start, - (u_int)(bsize - (lp->l_start & s5vfsp->vfs_bmask))); + (uint)(bsize - (lp->l_start & s5vfsp->vfs_bmask))); /* * Calculate index into inode's block list of last block diff --git a/usr/src/uts/3b2/fs/s5/s5blklist.c b/usr/src/uts/3b2/fs/s5/s5blklist.c index d2b41ae..55e078f 100644 --- a/usr/src/uts/3b2/fs/s5/s5blklist.c +++ b/usr/src/uts/3b2/fs/s5/s5blklist.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5blklist.c 1.9" +#ident "@(#)fs:fs/s5/s5blklist.c 1.8" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -42,7 +42,7 @@ #include "fs/fs_subr.h" STATIC int s5bldblklst(); -STATIC int s5bldindr(); +STATIC int *s5bldindr(); /* * Allocate and build the block address map. @@ -55,10 +55,9 @@ s5allocmap(ip) register int bsize; register int nblks; register struct vnode *vp = ITOV(ip); - int err = 0; if (ip->i_map) - return err; + return 1; /* * Get number of blocks to be mapped. @@ -68,17 +67,15 @@ s5allocmap(ip) nblks = (ip->i_size + bsize - 1)/bsize; bnptr = (int *)kmem_alloc(sizeof(int)*nblks, KM_NOSLEEP); if (bnptr == NULL) - return ENOMEM; + return 0; /* * Build the actual list of block numbers for the file. */ - if ((err= s5bldblklst(bnptr, ip, nblks)) == 0) - ip->i_map = bnptr; - else - kmem_free(bnptr, sizeof(int) * nblks); + (void) s5bldblklst(bnptr, ip, nblks); + ip->i_map = bnptr; - return err; + return 1; } /* @@ -88,7 +85,7 @@ s5allocmap(ip) STATIC int s5bldblklst(lp, ip, nblks) - int *lp; + register int *lp; register struct inode *ip; register int nblks; { @@ -96,7 +93,6 @@ s5bldblklst(lp, ip, nblks) register int *eptr; register int i; register struct vnode *vp = ITOV(ip); - int err; dev_t dev; /* @@ -109,23 +105,23 @@ s5bldblklst(lp, ip, nblks) *lp++ = ip->i_addr[i]; if (lp >= eptr) - return 0; + return 1; dev = vp->v_vfsp->vfs_dev; while (lp < eptr) { - err = s5bldindr(ip, &lp, eptr, dev, ip->i_addr[i], i-(NADDR-3)); - if (err) - return err; + lp = s5bldindr(ip, lp, eptr, dev, ip->i_addr[i], i-(NADDR-3)); + if (lp == 0) + return 0; i++; } - return 0; + return 1; } STATIC -int +int * s5bldindr(ip, lp, eptr, dev, blknbr, indlvl) struct inode *ip; - register int **lp; + register int *lp; register int *eptr; register dev_t dev; int blknbr; @@ -135,43 +131,34 @@ s5bldindr(ip, lp, eptr, dev, blknbr, indlvl) register int *bnptr; int cnt; struct s5vfs *s5vfsp; - int err = 0; - int bsize, sksize; + int bsize; struct vnode *vp = ITOV(ip); bsize = VBSIZE(vp); - if (blknbr == 0){ - sksize = 1; - for (cnt=0; cnt < (indlvl + 1); cnt++) - sksize *= (bsize/sizeof(int)); - - for (cnt=0; cnt < sksize; cnt++) - *(*lp)++ = 0; - return 0; - } - bp = bread(dev, blknbr, bsize); if (bp->b_flags & B_ERROR) { brelse(bp); - return ENXIO; + return NULL; } bnptr = bp->b_un.b_words; s5vfsp = S5VFS(vp->v_vfsp); cnt = s5vfsp->vfs_nindir; ASSERT(indlvl >= 0); - while (cnt-- && *lp < eptr) { + while (cnt-- && lp < eptr) { if (indlvl == 0) - *(*lp)++ = *bnptr++; + *lp++ = *bnptr++; else { - err = s5bldindr(ip, lp, eptr, dev, *bnptr++, indlvl-1); - if (err) - break; + lp = s5bldindr(ip, lp, eptr, dev, *bnptr++, indlvl-1); + if (lp == 0) { + brelse(bp); + return NULL; + } } } brelse(bp); - return err; + return lp; } /* diff --git a/usr/src/uts/3b2/fs/s5/s5bmap.c b/usr/src/uts/3b2/fs/s5/s5bmap.c index 54df474..d53ad40 100644 --- a/usr/src/uts/3b2/fs/s5/s5bmap.c +++ b/usr/src/uts/3b2/fs/s5/s5bmap.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5bmap.c 1.20" +#ident "@(#)fs:fs/s5/s5bmap.c 1.12" #include "sys/types.h" #include "sys/buf.h" #include "sys/debug.h" @@ -56,7 +56,7 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) register daddr_t bn = lbn; register struct vnode *vp = ITOV(ip); register int bsize = VBSIZE(vp); - register int i, j, k; + register int i, j; dev_t dev = ip->i_dev; daddr_t nb, inb; struct buf *bp; @@ -89,12 +89,8 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) } if (bnp) { *bnp = ip->i_map[lbn]; - if (*bnp == 0) { - ILOCK(ip); - s5freemap(ip); - IUNLOCK(ip); - goto lbmap; - } + if (*bnp == 0) + *bnp = S5_HOLE; } if (rabnp) { if ((lbn + 1) >= nblks) { @@ -107,7 +103,6 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) } return 0; } -lbmap: isdir = (vp->v_type == VDIR); issync = ((ip->i_flag & ISYNC) != 0); if (isdir || issync) @@ -150,29 +145,28 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) * we don't want s5getpage() to allocate the block. */ fbp = NULL; - if (error = blkalloc(vfsp, &nb)) - return error; if (alloc_only == 0 && (error = fbread(vp, lbn << s5vfsp->vfs_bshift, - bsize, S_OTHER, &fbp))) { - blkfree(vfsp, nb); + bsize, S_OTHER, &fbp))) + return error; + if (error = blkalloc(vfsp, &nb)) { + if (fbp) + fbrelse(fbp, S_OTHER); return error; } if (alloc_only == 0) { /* fbread did get called */ blkpp = PAGESIZE/bsize; if (blkpp >= 1) { - poffset = (lbn << s5vfsp->vfs_bshift) - & PAGEMASK; + poffset = (lbn << s5vfsp->vfs_bshift) & PAGEMASK; pp = page_find(vp, poffset); ASSERT(pp != NULL); pp->p_dblist[lbn % blkpp] = nb; } else { ppblk = bsize/PAGESIZE; poffset = lbn << s5vfsp->vfs_bshift; - for (k = 0; k < ppblk; k++) { - poffset = - poffset + (k * PAGESIZE); + for (i=0; ip_dblist[0] = nb; @@ -282,11 +276,11 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) } else if (alloc_only == 0) { int bshift = s5vfsp->vfs_bshift; - if (error = blkalloc(vfsp, &nb)) - return error; if (error = fbread(vp, lbn << bshift, - bsize, S_OTHER, &fbp)) { - blkfree(vfsp, nb); + bsize, S_OTHER, &fbp)) + return error; + if (error = blkalloc(vfsp, &nb)) { + fbrelse(fbp, S_OTHER); return error; } @@ -299,9 +293,8 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) } else { ppblk = bsize/PAGESIZE; poffset = lbn << bshift; - for (k=0; kp_dblist[0] = nb; @@ -330,8 +323,10 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) * Now reacquire the bp so that the new block can * can be recorded. */ - bp = bread(dev, inb, bsize); - if (error = geterror(bp)) { + if ((bp = bread(dev, inb, bsize))->b_flags & B_ERROR) { + if ((error = bp->b_error) == 0 + && (error = bp->b_oerror) == 0) + error = EIO; brelse(bp); return error; } @@ -362,21 +357,26 @@ bmap(ip, lbn, bnp, rabnp, rw, alloc_only) * Allocate all the blocks in the range [first, last]. */ int -bmapalloc(ip, first, last, alloc_only) +bmapalloc(ip, first, last, alloc_only, dblist) struct inode *ip; daddr_t first; daddr_t last; int alloc_only; + daddr_t *dblist; { daddr_t lbn, pbn; + daddr_t *dbp; int error = 0; + dbp = dblist; ILOCK(ip); for (lbn = first; error == 0 && lbn <= last; lbn++) { error = bmap(ip, lbn, (daddr_t *)&pbn, (daddr_t *)NULL, S_WRITE, alloc_only); if (error) break; + if (dbp != NULL) + *dbp++ = pbn; } IUNLOCK(ip); return error; diff --git a/usr/src/uts/3b2/fs/s5/s5dir.c b/usr/src/uts/3b2/fs/s5/s5dir.c index e903739..cdd9ff3 100644 --- a/usr/src/uts/3b2/fs/s5/s5dir.c +++ b/usr/src/uts/3b2/fs/s5/s5dir.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5dir.c 1.15" +#ident "@(#)fs:fs/s5/s5dir.c 1.11" /* * Directory manipulation routines. * From outside this file, only dirlook(), direnter(), and dirremove() @@ -84,8 +84,7 @@ dirlook(dp, namep, ipp, cr) return 0; } ILOCK(dp); - if (((error = dirsearch(dp, namep, ipp, (off_t *) 0)) != 0) - || dp != *ipp) + if (((error = dirsearch(dp, namep, ipp, (off_t *) 0)) != 0) || dp != *ipp) IUNLOCK(dp); if (error == 0) { vp = ITOV(*ipp); @@ -653,9 +652,7 @@ dirmakeinode(tdp, ipp, vap, op, cr) if (op == DE_MKDIR) error = dirmakedirect(ip, tdp); if (error) { - /* - * Throw away the inode we just allocated. - */ + /* Throw away inode we just allocated. */ ip->i_nlink = 0; ip->i_flag |= ICHG; iput(ip); @@ -684,9 +681,7 @@ dirmakedirect(ip, dp) if ((error = rdwri(UIO_WRITE, ip, (caddr_t) newdir, 2*SDSIZ, (off_t) 0, UIO_SYSSPACE, IO_SYNC, (int *) 0)) == 0) { - /* - * Synchronously update link count of parent. - */ + /* Synchronously update link count of parent. */ dp->i_nlink++; dp->i_flag |= ICHG|ISYN; iupdat(dp); @@ -711,10 +706,6 @@ dirremove(dp, namep, oip, cdir, op, cr) int error, dotflag; off_t offset; struct direct dir; - static struct direct emptydirect[] = { - 0, ".", - 0, "..", - }; ip = NULL; ILOCK(dp); @@ -775,13 +766,22 @@ dirremove(dp, namep, oip, cdir, op, cr) goto out; } else if (op == DR_REMOVE) { /* - * unlink(2) requires a different check: allow only - * the super-user to unlink a directory. + * unlink(2) requires different checks: + * (a) Allow only the super-user to unlink a directory. + * (b) Don't allow a busy text file to be removed. */ - if (ITOV(ip)->v_type == VDIR && !suser(cr)) { + struct vnode *vp = ITOV(ip); + if (vp->v_type == VDIR && !suser(cr)) { error = EPERM; goto out; } + if (vp->v_flag & VTEXT) { + xrele(vp); + if ((vp->v_flag & VTEXT) && ip->i_nlink == 1) { + error = ETXTBSY; + goto out; + } + } } /* * Zero the i-number field of the directory entry. Retain the @@ -807,16 +807,6 @@ dirremove(dp, namep, oip, cdir, op, cr) dp->i_nlink--; dnlc_remove(ITOV(ip), ".."); } - /* - * If other references exist, zero the "." and ".. - * entries so they're inaccessible (POSIX requirement). - * If the directory is going away we can avoid doing - * this work. - */ - if (ITOV(ip)->v_count > 1 && ip->i_nlink <= 0) - (void) rdwri(UIO_WRITE, ip, (caddr_t) emptydirect, - min(sizeof(emptydirect), ip->i_size), - (off_t) 0, UIO_SYSSPACE, 0, (int *) 0); } else ip->i_nlink--; @@ -952,7 +942,7 @@ dircheckpath(source, target) * Unserialize. */ if (serialize_flag & RENAME_WAITING) - wakeprocs((caddr_t) &serialize_flag, PRMPT); + wakeup((caddr_t) &serialize_flag); serialize_flag = 0; return error; } diff --git a/usr/src/uts/3b2/fs/s5/s5inode.c b/usr/src/uts/3b2/fs/s5/s5inode.c index c024517..cd0a8fd 100644 --- a/usr/src/uts/3b2/fs/s5/s5inode.c +++ b/usr/src/uts/3b2/fs/s5/s5inode.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5inode.c 1.41" +#ident "@(#)fs:fs/s5/s5inode.c 1.36" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -69,14 +69,12 @@ extern struct vfsops s5vfsops; /* * Allocate and initialize inodes. */ -void inoinit() { register struct inode *ip; register int i; - if ((inode = (inode_t *)kmem_zalloc(ninode*sizeof(inode_t), KM_SLEEP)) - == NULL) + if ((inode = (inode_t *)kmem_zalloc(ninode*sizeof(inode_t), KM_SLEEP)) == NULL) cmn_err(CE_PANIC, "inoinit: no memory for inodes"); ifreelist.av_forw = ifreelist.av_back = (inode_t *) &ifreelist; for (i = 0; i < NHINO; i++) @@ -88,6 +86,7 @@ inoinit() ifreelist.av_forw = ip; ip->av_back = (struct inode *) &ifreelist; } + return 0; } /* @@ -151,7 +150,7 @@ iget(vfsp, ino, ipp) ILOCK(ip); #else ip->i_flag = ILOCKED; - ip->i_owner = curproc->p_slot; /* XXX -- recursive ilocks */ + ip->i_owner = GET_INDEX(curproc->p_pid); /*XXX -- recursive ilocks */ ip->i_nilocks = 1; /* XXX -- recursive ilocks */ #endif @@ -165,8 +164,7 @@ iget(vfsp, ino, ipp) * the inode in the meantime; if so we put it back on the * free list and loop around to find another free inode. */ - if (((vp)->v_vfsp && syncip(ip, B_INVAL) != 0) - || (ip->i_flag & IWANT)) { + if (((vp)->v_vfsp && syncip(ip, B_INVAL) != 0) || (ip->i_flag&IWANT)) { ipfree(ip); IUNLOCK(ip); goto loop; @@ -223,7 +221,7 @@ iget(vfsp, ino, ipp) found: if ((ip->i_flag & (IRWLOCKED|ILOCKED)) - && ip->i_owner != curproc->p_slot) { /* XXX */ + && ip->i_owner != GET_INDEX(curproc->p_pid)) { /* XXX */ ip->i_flag |= IWANT; sleep((caddr_t) ip, PINOD); goto loop; @@ -239,7 +237,7 @@ iget(vfsp, ino, ipp) ip->av_forw->av_back = ip->av_back; } VN_HOLD(vp); - ip->i_owner = curproc->p_slot; /* XXX */ + ip->i_owner = GET_INDEX(curproc->p_pid); /* XXX */ ip->i_nilocks++; /* XXX */ ip->i_flag |= ILOCKED; *ipp = ip; @@ -369,6 +367,7 @@ iflush(vfsp, force) } IUNLOCK(ip); iunhash(ip); + vp->v_vfsp = 0; } else if (force == 0) return -1; } @@ -429,7 +428,9 @@ iread(ip, ino) s5vfsp = S5VFS(vfsp); i = vfsp->vfs_bsize; bp = bread(vfsp->vfs_dev, FsITOD(s5vfsp, ino), i); - if (error = geterror(bp)) { + if (bp->b_flags & B_ERROR) { + if ((error = bp->b_error) == 0 && (error = bp->b_oerror) == 0) + error = EIO; brelse(bp); return error; } @@ -457,10 +458,15 @@ iread(ip, ino) } if (ip->i_mode & IFBLK || ip->i_mode == IFCHR) { + /* is dev stored in new format */ + if (ip->i_bcflag & NDEVFORMAT) - ip->i_rdev = makedevice(ip->i_major, ip->i_minor); - else + ip->i_rdev = makedevice(ip->i_major,ip->i_minor); + else { + /* get dev from old location */ + ip->i_rdev = expdev(ip->i_oldrdev); + } } else if (ip->i_mode & IFNAM) ip->i_rdev = ip->i_oldrdev; @@ -676,14 +682,15 @@ iunlock(ip) int s5fstype; -void s5init(vswp, fstype) struct vfssw *vswp; int fstype; { inoinit(); + vswp->vsw_vfsops = &s5vfsops; s5fstype = fstype; + return 0; } /* @@ -701,8 +708,15 @@ iaccess(ip, mode, cr) { register struct vnode *vp = ITOV(ip); - if ((mode & IWRITE) && (vp->v_vfsp->vfs_flag & VFS_RDONLY)) - return EROFS; + if (mode & IWRITE) { + if (vp->v_vfsp->vfs_flag & VFS_RDONLY) + return EROFS; + if (vp->v_flag & VTEXT) { + xrele(vp); + if (vp->v_flag & VTEXT) + return ETXTBSY; + } + } if (cr->cr_uid == 0) return 0; if (cr->cr_uid != ip->i_uid) { @@ -739,24 +753,3 @@ syncip(ip, flags) return error; } -int -inull(vfsp) - register struct vfs *vfsp; -{ - register struct inode *ip; - register struct vnode *vp, *rvp = S5VFS(vfsp)->vfs_root; - register int i; - dev_t dev = vfsp->vfs_dev; - - ASSERT(rvp != NULL); - - for (i = 0, ip = inode; i < ninode; i++, ip++) - if (ip->i_dev == dev) { - vp = ITOV(ip); - if (vp == rvp) - continue; - vp->v_vfsp = 0; - } - - return 0; -} diff --git a/usr/src/uts/3b2/fs/s5/s5rdwri.c b/usr/src/uts/3b2/fs/s5/s5rdwri.c index 4d3fc75..aeaf42d 100644 --- a/usr/src/uts/3b2/fs/s5/s5rdwri.c +++ b/usr/src/uts/3b2/fs/s5/s5rdwri.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5rdwri.c 1.26" +#ident "@(#)fs:fs/s5/s5rdwri.c 1.18" #include "sys/types.h" #include "sys/buf.h" #include "sys/conf.h" @@ -15,7 +15,6 @@ #include "sys/param.h" #include "sys/swap.h" #include "sys/sysmacros.h" -#include "sys/resource.h" #include "sys/systm.h" #include "sys/uio.h" #include "sys/vfs.h" @@ -144,14 +143,15 @@ writei(ip, uiop, ioflag) register unsigned int n, on; off_t off; daddr_t firstlbn, lastlbn; - caddr_t base, addr; + caddr_t base; + unsigned long int limit = uiop->uio_limit; unsigned long int oresid = uiop->uio_resid; - rlim_t limit = uiop->uio_limit; int mode = ip->i_mode, error = 0, flags, pagecreate; int bsize = VBSIZE(vp); - int alloc_only, i; + int alloc_only; off_t osize; int bcnt, index; + daddr_t dblist[MAXBSIZE/NBPSCTR]; if (MANDLOCK(vp, mode) && (error = chklock(vp, FWRITE, @@ -165,8 +165,12 @@ writei(ip, uiop, ioflag) ip->i_flag |= ISYNC; while (error == 0 && uiop->uio_resid > 0) { + if (vp->v_type == VREG && uiop->uio_offset >= limit) { + error = EFBIG; + goto err; + } if ((vp->v_type == VREG || vp->v_type == VDIR) - && uiop->uio_offset >= ip->i_size + && uiop->uio_offset > ip->i_size && ip->i_map) { ILOCK(ip); s5freemap(ip); @@ -175,19 +179,23 @@ writei(ip, uiop, ioflag) off = uiop->uio_offset & MAXBMASK; on = uiop->uio_offset & MAXBOFFSET; n = MIN(MAXBSIZE-on, uiop->uio_resid); - if (vp->v_type == VREG && uiop->uio_offset + n >= limit) { - if (uiop->uio_offset >= limit) { - error = EFBIG; - goto err; - } - n = limit - uiop->uio_offset; - } base = segmap_getmap(segkmap, vp, off); + /* + * We must ensure that any file blocks are allocated before + * we perform the I/O. + */ + firstlbn = uiop->uio_offset >> s5vfsp->vfs_bshift; + lastlbn = (uiop->uio_offset + n - 1) >> s5vfsp->vfs_bshift; if (uiop->uio_offset + n > ip->i_size) alloc_only = (on % PAGESIZE == 0); else alloc_only = (on % PAGESIZE == 0 && n % PAGESIZE == 0); + error = bmapalloc(ip, firstlbn, lastlbn, alloc_only, &dblist[0]); + if (error) { + (void) segmap_release(segkmap, base, 0); + goto err; + } osize = ip->i_size; if (uiop->uio_offset + n > ip->i_size) { ip->i_size = uiop->uio_offset + n; @@ -197,58 +205,29 @@ writei(ip, uiop, ioflag) * having to read them in. */ if (on % PAGESIZE == 0) { - if (uiop->uio_segflg != UIO_SYSSPACE) { - caddr_t iov_base; - - /* - * Fault in the pages corresponding to - * the from range before - * segmap_pagecreate() is called. - */ - iov_base = uiop->uio_iov->iov_base; - for (i=0, addr=base+on; addruio_segflg != UIO_SYSSPACE) { - caddr_t iov_base; - - /* - * We're writing an exact number of pages, so - * we can can just create them without having - * to read them in. - */ - iov_base = uiop->uio_iov->iov_base; - for (i=0, addr=base+on; addruio_offset >> s5vfsp->vfs_bshift; - lastlbn = (uiop->uio_offset + n - 1) >> s5vfsp->vfs_bshift; - error = bmapalloc(ip, firstlbn, lastlbn, alloc_only); - if (error) { - (void) segmap_release(segkmap, base, SM_INVAL); - ip->i_size = osize; - goto err; - } - error = uiomove(base+on, n, UIO_WRITE, uiop); PREEMPT(); + error = uiomove(base+on, n, UIO_WRITE, uiop); if (pagecreate && uiop->uio_offset < roundup(off + on + n, PAGESIZE)) { diff --git a/usr/src/uts/3b2/fs/s5/s5vfsops.c b/usr/src/uts/3b2/fs/s5/s5vfsops.c index 44da970..4c71fe4 100644 --- a/usr/src/uts/3b2/fs/s5/s5vfsops.c +++ b/usr/src/uts/3b2/fs/s5/s5vfsops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5vfsops.c 1.44" +#ident "@(#)fs:fs/s5/s5vfsops.c 1.36" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -71,10 +71,6 @@ struct vfsops s5vfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; STATIC int @@ -101,7 +97,7 @@ s5mount(vfsp, mvp, uap, cr) return EPERM; if (mvp->v_type != VDIR) return ENOTDIR; - if (remount == 0 && (mvp->v_count > 1 || (mvp->v_flag & VROOT))) + if (remount == 0 && (mvp->v_flag & VROOT)) return EBUSY; /* @@ -110,12 +106,12 @@ s5mount(vfsp, mvp, uap, cr) if (error = lookupname(uap->spec, UIO_USERSPACE, FOLLOW, NULLVPP, &bvp)) return error; - if (bvp->v_type != VBLK) { - VN_RELE(bvp); - return ENOTBLK; - } - dev = bvp->v_rdev; + type = bvp->v_type; + VN_RELE(bvp); + + if (type != VBLK) + return ENOTBLK; /* * Ensure that this device isn't already mounted, unless this is @@ -123,7 +119,6 @@ s5mount(vfsp, mvp, uap, cr) */ dvfsp = vfs_devsearch(dev); if (remount) { - VN_RELE(bvp); /* * Remount requires that the device already be mounted, * and on the same mount point. @@ -138,24 +133,21 @@ s5mount(vfsp, mvp, uap, cr) /* * Ordinary mount. */ - if (dvfsp != NULL) { - VN_RELE(bvp); + if (dvfsp != NULL) return EBUSY; - } /* * Allocate VFS private data. */ if ((s5vfsp = (struct s5vfs *) - kmem_alloc(sizeof(struct s5vfs), KM_SLEEP)) == NULL) { - VN_RELE(bvp); + kmem_alloc(sizeof(struct s5vfs), KM_SLEEP)) == NULL) return EBUSY; - } vfsp->vfs_bcount = 0; vfsp->vfs_data = (caddr_t) s5vfsp; vfsp->vfs_fstype = s5fstype; /* * Open the device. */ + bvp = makespecvp(dev, VBLK); if (error = VOP_OPEN(&bvp, rdonly ? FREAD : FREAD|FWRITE, cr)) goto out; vfsp->vfs_dev = dev; @@ -173,6 +165,7 @@ s5mount(vfsp, mvp, uap, cr) binval(dev); if (remount) { (void) iflush(vfsp, 1); + fbinval(vfsp); } /* * Read the superblock. We do this in the remount case as well @@ -280,10 +273,6 @@ s5unmount(vfsp, cr) if (iflush(vfsp, 0) < 0) return EBUSY; - /* - * Mark inode as stale. - */ - inull(vfsp); /* * Flush root inode to disk. */ @@ -319,6 +308,7 @@ s5unmount(vfsp, cr) } VN_RELE(bvp); binval(dev); + fbinval(vfsp); brelse(s5vfsp->vfs_bufp); iput(rip); iunhash(rip); @@ -375,7 +365,6 @@ s5statvfs(vfsp, sp) } STATIC void s5update(), s5flushsb(); -STATIC int s5updlock, s5updwant; /* ARGSUSED */ STATIC int @@ -384,20 +373,10 @@ s5sync(vfsp, flag, cr) short flag; struct cred *cr; { - while (s5updlock) { - s5updwant = 1; - sleep((caddr_t)&s5updlock, PINOD); - } - s5updlock = 1; if (flag & SYNC_ATTR) s5flushi(SYNC_ATTR); else s5update(); - s5updlock = 0; - if (s5updwant) { - s5updwant = 0; - wakeprocs((caddr_t)&s5updlock, PRMPT); - } return 0; } @@ -410,13 +389,18 @@ STATIC void s5update() { register struct vfs *vfsp; + static int updlock = 0; extern struct vfsops s5vfsops; + if (updlock) + return; + updlock++; for (vfsp = rootvfs; vfsp != NULL; vfsp = vfsp->vfs_next) if (vfsp->vfs_op == &s5vfsops) s5flushsb(vfsp); s5flushi(0); bflush(NODEV); /* XXX */ + updlock = 0; } int @@ -446,6 +430,7 @@ s5flushi(flag) iupdat(ip); else (void) syncip(ip, B_ASYNC); + iput(ip); } } @@ -547,6 +532,7 @@ s5mountroot(vfsp, why) (void) VOP_PUTPAGE(s5vfsp->vfs_devvp, 0, 0, B_INVAL, (struct cred *) NULL); binval(vfsp->vfs_dev); + fbinval(vfsp); fp = getfs(vfsp); if (fp->s_state == FsACTIVE) return EINVAL; @@ -595,7 +581,6 @@ s5mountroot(vfsp, why) fp->s_inode[0] = 0; fp->s_ronly = 0; if (fp->s_magic != FsMAGIC) { - fbrelsei(fbp, S_OTHER); VN_RELE(vp); return EINVAL; } diff --git a/usr/src/uts/3b2/fs/s5/s5vnops.c b/usr/src/uts/3b2/fs/s5/s5vnops.c index 90000f0..3057a65 100644 --- a/usr/src/uts/3b2/fs/s5/s5vnops.c +++ b/usr/src/uts/3b2/fs/s5/s5vnops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/s5/s5vnops.c 1.8.1.47" +#ident "@(#)fs:fs/s5/s5vnops.c 1.8.1.30" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -37,7 +37,6 @@ #include "sys/proc.h" #include "sys/disp.h" #include "sys/user.h" -#include "sys/swap.h" #include "sys/fs/s5param.h" #include "sys/fs/s5dir.h" @@ -67,7 +66,10 @@ STATIC int s5mkdir(), s5rmdir(), s5readdir(); STATIC int s5symlink(), s5readlink(), s5fsync(), s5fid(); STATIC int s5seek(), s5frlock(), s5space(); STATIC int s5getpage(), s5putpage(), s5map(), s5addmap(), s5delmap(); +STATIC int s5bloop(), s5writelbn(); + STATIC void s5inactive(), s5rwlock(), s5rwunlock(); +extern int fs_setfl(); struct vnodeops s5vnodeops = { s5open, @@ -106,7 +108,6 @@ struct vnodeops s5vnodeops = { s5delmap, fs_poll, fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ fs_nosys, fs_nosys, @@ -115,30 +116,6 @@ struct vnodeops s5vnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* @@ -249,7 +226,6 @@ s5getattr(vp, vap, flags, cr) { register struct inode *ip = VTOI(vp); int error = 0; - u_long nlblocks; /* * Return (almost) all the attributes. This should be refined so @@ -281,10 +257,9 @@ s5getattr(vp, vap, flags, cr) else vap->va_blksize = VBSIZE(vp); vap->va_vcode = ip->i_vcode; - if (vap->va_mask & AT_NBLOCKS) { - if ((error = s5getsp(vp, &nlblocks)) == 0) - vap->va_nblocks = FsLTOP(S5VFS(vp->v_vfsp), nlblocks); - } else + if (vap->va_mask & AT_NBLOCKS) + error = s5getsp(vp, &vap->va_nblocks); + else vap->va_nblocks = 0; IUNLOCK(ip); return error; @@ -332,6 +307,8 @@ s5setattr(vp, vap, flags, cr) ip->i_mode &= ~ISGID; } ip->i_flag |= ICHG; + if ((vp->v_flag & VTEXT) && ((ip->i_mode & ISVTX) == 0)) + xrele(vp); if (MANDLOCK(vp, vap->va_mode)) { if (error = fs_vcode(vp, &ip->i_vcode)) goto out; @@ -369,8 +346,7 @@ s5setattr(vp, vap, flags, cr) ip->i_flag |= ICHG; } /* - * Truncate file. Must have write permission and file must not - * be a directory. + * Truncate file. Must have write permission and not be a directory. */ if (mask & AT_SIZE) { if (vap->va_size != 0) { @@ -515,7 +491,7 @@ s5create(dvp, name, vap, excl, mode, vpp, cr) * nothing more we can do here because the resultant vnode may * be of a different file system type. */ - if (ip != NULL && ITOV(ip)->v_vfsmountedhere) { + if (error == 0 && ITOV(ip)->v_vfsmountedhere) { vnode_t *vp = ITOV(ip); IUNLOCK(ip); @@ -670,13 +646,6 @@ s5rename(sdvp, snm, tdvp, tnm, cr) error = EINVAL; goto out; } - /* - * POSIX 1003.3 requires write permission on a directory in order - * to rename it. - */ - if ((sip->i_mode & IFMT) == IFDIR - && (error = iaccess(sip, IWRITE, cr)) != 0) - goto out; /* * Link source to the target. */ @@ -689,7 +658,7 @@ s5rename(sdvp, snm, tdvp, tnm, cr) * If the entry has changed just forget about it. Release * the source inode. */ - if ((error = dirremove(sdp, snm, sip, NULLVP, + if ((error = dirremove(sdp, snm, sip, (struct vnode *) 0, DR_RENAME, cr)) == ENOENT) error = 0; @@ -1040,7 +1009,7 @@ s5frlock(vp, cmd, bfp, flag, offset, cr) /* * If file is being mapped, disallow frlock. */ - if (ip->i_mapcnt > 0 && MANDLOCK(vp, ip->i_mode)) + if (ip->i_mapcnt > 0) return EAGAIN; return fs_frlock(vp, cmd, bfp, flag, offset, cr); @@ -1065,49 +1034,6 @@ s5space(vp, cmd, bfp, flag, offset, cr) return error; } -/* - * Compute the total number of blocks allocated to the file, including - * indirect blocks as well as data blocks, on the assumption that the - * file contains no holes. (It's too expensive to account for holes - * since that requires a complete scan of all indirect blocks.) - */ - -#define NDADDR (NADDR - 3) - -STATIC int -s5getsp(vp, totp) - struct vnode *vp; - u_long *totp; -{ - struct s5vfs *s5vfsp = S5VFS(vp->v_vfsp); - int bshift = s5vfsp->vfs_bshift; - int inshift, indir; - u_long blocks, tot; - - blocks = tot = (VTOI(vp)->i_size + VBSIZE(vp) - 1) >> bshift; - if (blocks > NDADDR) { - inshift = s5vfsp->vfs_nshift; - indir = s5vfsp->vfs_nindir; - tot += ((blocks-NDADDR-1) >> inshift) + 1; - if (blocks > NDADDR + indir) { - tot += ((blocks-NDADDR-indir-1) >> (inshift*2)) + 1; - if (blocks > NDADDR + indir + indir*indir) - tot++; - } - } - *totp = tot; - return 0; -} - -#if 0 - -/* - * This version of s5getsp() actually works, but it's too expensive to - * use. - */ - -STATIC int s5getsp(); - /* * Count total number of blocks allocated to the file. Call s5bloop() * to count indirect blocks. @@ -1142,18 +1068,23 @@ s5getsp(vp, blkcntp) for (i = NADDR - 1; i >= 0; i--) { if ((bn = ip->i_addr[i]) == 0) continue; + switch (i) { + default: (*blkcntp)++; break; + case NADDR-3: if (error = s5bloop(vfsp, bn, 0, 0, blkcntp)) goto out; break; + case NADDR-2: if (error = s5bloop(vfsp, bn, 1, 0, blkcntp)) goto out; break; + case NADDR-1: if (error = s5bloop(vfsp, bn, 1, 1, blkcntp)) goto out; @@ -1211,7 +1142,6 @@ s5bloop(vfsp, bn, f1, f2, blkcntp) return error; } -#endif /* * Page-handling operations: getpage() and putpage(). @@ -1292,24 +1222,24 @@ s5getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) nio = 0; if (multi_io > 1) { - for (i = 0; i < multi_io; i += 2) { - if (ip->i_size <= curoff) - break; + for(i=0; i < multi_io; i=i+2) { bnp2 = bnp + 1; err = bmap(ip, lbn+i, bnp, bnp2, rw, 0); if (err) goto out; - if (ip->i_size > curoff+bsize && *bnp2 == S5_HOLE - && (err = bmap(ip, lbn+i+1, bnp2, 0, rw, 0))) - goto out; - if (protp != NULL - && (*bnp == S5_HOLE - || (*bnp2 == S5_HOLE - && curoff+bsize < ip->i_size))) - *protp &= ~PROT_WRITE; + if((ip->i_size > curoff + bsize) && (*bnp2 == S5_HOLE)) { + err = bmap(ip, lbn+i+1, bnp2, 0, rw, 0); + if (err) + goto out; + } + if (protp != NULL) { + if ((*bnp == S5_HOLE) || ((*bnp2 == S5_HOLE) && + (curoff+bsize < ip->i_size))) + *protp &= ~PROT_WRITE; + } if (*bnp != S5_HOLE) nio++; - if (*bnp2 != S5_HOLE && curoff+bsize < ip->i_size) + if ((*bnp2 != S5_HOLE) && ((curoff + bsize) < ip->i_size)) nio++; bnp = bnp + 2; curoff = curoff + 2*bsize; @@ -1320,11 +1250,12 @@ s5getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) if (err) goto out; nio = 1; - if (s5_ra && ip->i_nextr == off && *bnp2 != S5_HOLE - && lbnoff + bsize < ip->i_size) + if (s5_ra && ip->i_nextr == off && *bnp2 != S5_HOLE && + lbnoff + bsize < ip->i_size) { do_ra = 1; - else + } else { do_ra = 0; + } } bnp = bn; @@ -1359,10 +1290,11 @@ s5getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) */ if (pl != NULL) { pp = rm_allocpage(seg, addr, PAGESIZE, P_CANWAIT); - for (i = 0; i < multi_io; i++) + for (i=0; ip_dblist[i] = bn[i]; if (page_enter(pp, vp, off)) - cmn_err(CE_PANIC, "s5_getapage page_enter"); + cmn_err(CE_PANIC, + "s5_getapage page_enter"); pagezero(pp, 0, PAGESIZE); page_unlock(pp); pp->p_nio = nio; @@ -1382,15 +1314,11 @@ s5getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) ASSERT(pp != NULL); pp2 = pp; - if (bsize < PAGESIZE) { - for (i = 0; i < multi_io; i++) + do { + for (i=0; ip_dblist[i] = bn[i]; - } else { - do { - pp2->p_dblist[0] = bn[0]; - pp2 = pp2->p_next; - } while (pp2 != pp); - } + pp2 = pp2->p_next; + } while (pp2 != pp); if (pl != NULL) { register int sz; @@ -1435,6 +1363,12 @@ s5getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) bp[0]->b_dev = cmpdev(dev); bp[0]->b_blkno = LTOPBLK(*bnp, bsize) + ((io_off - lbnoff) >> SCTRSHFT); +#if 0 /* if smart driver */ + bp[0]->b_un.b_addr = 0; +#else + pgaddr = pfntokv(page_pptonum(pp)); + bp[0]->b_un.b_addr = (caddr_t)pgaddr; +#endif /* * Zero part of page which we are not @@ -1483,7 +1417,12 @@ s5getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) (*bufp)->b_edev = dev; (*bufp)->b_dev = cmpdev(dev); (*bufp)->b_blkno = LTOPBLK(*bnp, bsize); +#if 0 /* if smart driver */ (*bufp)->b_un.b_addr = (caddr_t)pgoff; +#else + pgaddr = pfntokv(page_pptonum(pp2)); + (*bufp)->b_un.b_addr = (caddr_t)(pgaddr + pgoff); +#endif /* * Zero part of page which we are not @@ -1505,29 +1444,28 @@ s5getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) lbnoff += bsize; addr2 = addr + (lbnoff - off); - if (addr2 >= seg->s_base + seg->s_size) + if (addr2 >= seg->s_base + seg->s_size) { pp2 = NULL; - else + } else { pp2 = pvn_kluster(vp, lbnoff, seg, addr2, &io_off, - &io_len, lbnoff, blksz, 1); + &io_len, lbnoff, blksz, 1); + } pgoff = 0; if (pp2 != NULL) { pp = pp2; - do { - pp->p_dblist[0] = bn[1]; - pp = pp->p_next; - } while (pp != pp2); + pp->p_dblist[0] = bn[1]; - *bufp = - pageio_setup(pp2, io_len, devvp, (B_ASYNC | B_READ)); + *bufp = pageio_setup(pp2, io_len, devvp, (B_ASYNC | B_READ)); (*bufp)->b_edev = dev; (*bufp)->b_dev = cmpdev(dev); - (*bufp)->b_blkno = LTOPBLK(*bnp, bsize) + - ((io_off - lbnoff) >> SCTRSHFT); + (*bufp)->b_blkno = LTOPBLK(*bnp, bsize) + ((io_off - lbnoff) >> SCTRSHFT); + pgaddr = pfntokv(page_pptonum(pp2)); + (*bufp)->b_un.b_addr = (caddr_t)pgaddr; xlen = (io_len + pgoff) & PAGEOFFSET; if (xlen != 0) - pagezero(pp2->p_prev, xlen, PAGESIZE - xlen); + pagezero(pp2->p_prev, xlen, + PAGESIZE - xlen); (*bdevsw[getmajor(dev)].d_strategy)(*bufp); vminfo.v_pgin++; vminfo.v_pgpgin += btopr(io_len); @@ -1649,8 +1587,6 @@ s5getpage(vp, off, len, protp, pl, plsz, seg, addr, rw, cr) return err; } -STATIC int s5writelbn(); - /* * Flags are composed of {B_ASYNC, B_INVAL, B_FREE, B_DONTNEED, B_FORCE} * If len == 0, do from off to EOF. @@ -1680,7 +1616,7 @@ s5putpage(vp, off, len, flags, cr) int err = 0, werr; struct s5vfs *s5vfsp = S5VFS(vp->v_vfsp); int fs_bshift, fs_bmask; - int i, nio, curoff, do_bmap; + int i, nio, curoff; if (vp->v_flag & VNOMAP) return ENOSYS; @@ -1755,26 +1691,34 @@ s5putpage(vp, off, len, flags, cr) */ ip->i_nextr = 0; + /* + * If the modified time on the inode has not already been + * set elsewhere (e.g. for write/setattr) and this is not + * a call from msync (B_FORCE) we set the time now. + * This gives us approximate modified times for mmap'ed files + * which are modified via stores in the user address space. + */ + if ((ip->i_flag & IMODTIME) == 0 || (flags & B_FORCE)) { + ip->i_flag |= IUPD; + ITIMES(ip); + } /* * This is an attempt to clean up loose ends left by * applications that store into mapped files. It's * insufficient, strictly speaking, for ill-behaved * applications, but about the best we can do. */ - if ((ip->i_flag & IMODTIME) == 0 || (flags & B_FORCE)) { - ip->i_flag |= IUPD; - ITIMES(ip); - if (vp->v_type == VREG) { - ILOCK(ip); - err = fs_vcode(vp, &ip->i_vcode); - IUNLOCK(ip); - } + if (vp->v_type == VREG) { + ILOCK(ip); + err = fs_vcode(vp, &ip->i_vcode); + IUNLOCK(ip); } } /* * Handle all the dirty pages not yet dealt with. */ + bnp = bn; while (err == 0 && (pp = dirty) != NULL) { /* * Pull off a contiguous chunk that fits in one lbn. @@ -1782,51 +1726,11 @@ s5putpage(vp, off, len, flags, cr) curoff = io_off = pp->p_offset; lbn = io_off >> s5vfsp->vfs_bshift; nio = 0; - do_bmap = 0; - if (!IS_SWAPVP(vp)) { - for (i = 0, bnp = bn; i < multi_io; i++, bnp++) - *bnp = S5_HOLE; - for (i = 0, bnp = bn; i < multi_io; i++, bnp++) { - if (ip->i_size <= curoff) - break; - *bnp = pp->p_dblist[i]; - if (*bnp == S5_HOLE) { - do_bmap = 1; - break; - } else - nio++; - curoff = curoff + bsize; - } - } else - do_bmap = 1; - - if (do_bmap) { - curoff = pp->p_offset; - nio = 0; - for (i = 0, bnp = bn; i < multi_io; i++, bnp++) - *bnp = S5_HOLE; - for (i = 0, bnp = bn; i < multi_io; i += 2) { - if (ip->i_size <= curoff) - break; - bnp2 = bnp + 1; - if (err = bmap(ip, lbn+i, bnp, bnp2, - S_WRITE, 1)) - break; - if (*bnp2 == S5_HOLE - && ip->i_size > curoff + bsize - && (err = bmap(ip, lbn+i+1, bnp2, - 0, S_WRITE, 1))) - break; - if (*bnp != S5_HOLE) - nio++; - if (multi_io > 1 && *bnp2 != S5_HOLE - && curoff + bsize < ip->i_size) - nio++; - bnp = bnp + 2; - curoff = curoff + 2*bsize; - } - if (err) - break; + + for (i = 0, bnp = bn; i < multi_io; i++, bnp++) { + *bnp = pp->p_dblist[i]; + if (*bnp != S5_HOLE) + nio++; } page_sub(&dirty, pp); @@ -1850,7 +1754,7 @@ s5putpage(vp, off, len, flags, cr) * Check for page length rounding problems */ if (io_off + io_len > lbn_off + bsize) { - ASSERT((io_off+io_len) - (lbn_off+bsize) < PAGESIZE); + ASSERT((io_off + io_len) - (lbn_off + bsize) < PAGESIZE); io_len = lbn_off + bsize - io_off; } @@ -1870,10 +1774,10 @@ s5putpage(vp, off, len, flags, cr) *bnp = LTOPBLK(*bnp, bsize); if (multi_io == 1) werr = s5writelbn(ip, *bnp, io_list, - io_len, 0, flags); + io_len, 0, flags); else - werr = s5writelbn(ip, *bnp, io_list, - bsize, bsize*i, flags); + werr = s5writelbn(ip, *bnp, io_list, bsize, + bsize*i, flags); if (err == 0) err = werr; } @@ -1934,7 +1838,11 @@ s5writelbn(ip, bn, pp, len, pgoff, flags) bp->b_edev = ip->i_dev; bp->b_dev = cmpdev(ip->i_dev); bp->b_blkno = bn + ((pp->p_offset & (bsize - 1)) >> SCTRSHFT); +#if 0 bp->b_un.b_addr = (caddr_t)pgoff; +#else + bp->b_un.b_addr = (caddr_t)pfntokv(page_pptonum(pp)) + pgoff; +#endif (*bdevsw[getmajor(ip->i_dev)].d_strategy)(bp); @@ -1966,7 +1874,7 @@ s5map(vp, off, as, addrp, len, prot, maxprot, flags, cr) { struct segvn_crargs vn_a; register int error = 0; - register struct inode *ip = VTOI(vp); + register struct inode *ip; if (vp->v_flag & VNOMAP) return ENOSYS; @@ -1978,15 +1886,15 @@ s5map(vp, off, as, addrp, len, prot, maxprot, flags, cr) return ENODEV; /* - * If file has active mandatory lock, disallow mmap. + * If file is being locked, disallow mmap. */ - if (vp->v_filocks != NULL && MANDLOCK(vp, ip->i_mode)) + if (vp->v_filocks != NULL) return EAGAIN; /* * Don't allow a mapping beyond the last page in the file. */ - if (off + len > ((ip->i_size + PAGEOFFSET) & PAGEMASK)) + if (off + len > ((VTOI(vp)->i_size + PAGEOFFSET) & PAGEMASK)) return ENXIO; if ((flags & MAP_FIXED) == 0) { @@ -2006,6 +1914,7 @@ s5map(vp, off, as, addrp, len, prot, maxprot, flags, cr) * since the only effect, if it failed for some reason (e.g., * lack of memory), will be on performance. */ + ip = VTOI(vp); /* lock the inode to protect the blocklist during construction */ ILOCK(ip); (void) s5allocmap(ip); @@ -2024,11 +1933,11 @@ s5map(vp, off, as, addrp, len, prot, maxprot, flags, cr) /* ARGSUSED */ STATIC int -s5addmap(vp, off, as, addr, len, prot, maxprot, flags, cr) +s5addmap(vp, off, as, addrp, len, prot, maxprot, flags, cr) struct vnode *vp; u_int off; struct as *as; - addr_t addr; + caddr_t *addrp; u_int len; u_int prot, maxprot; u_int flags; @@ -2042,11 +1951,11 @@ s5addmap(vp, off, as, addr, len, prot, maxprot, flags, cr) /* ARGSUSED */ STATIC int -s5delmap(vp, off, as, addr, len, prot, maxprot, flags, cr) +s5delmap(vp, off, as, addrp, len, prot, maxprot, flags, cr) struct vnode *vp; u_int off; struct as *as; - addr_t addr; + caddr_t *addrp; u_int len; u_int prot, maxprot; u_int flags; diff --git a/usr/src/uts/3b2/fs/specfs/specfs.mk b/usr/src/uts/3b2/fs/specfs/specfs.mk index bf0af9b..b80b72d 100644 --- a/usr/src/uts/3b2/fs/specfs/specfs.mk +++ b/usr/src/uts/3b2/fs/specfs/specfs.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)fs:fs/specfs/specfs.mk 1.25" +#ident "@(#)fs:fs/specfs/specfs.mk 1.23" ROOT = STRIP = strip INC = $(ROOT)/usr/include @@ -21,7 +21,7 @@ DEFLIST = FRC = FILES = \ - specgetsz.o \ + specgetsizes.o \ specsubr.o \ specvfsops.o \ specvnops.o @@ -47,7 +47,7 @@ clobber: clean # Header dependencies # -specgetsz.o: specgetsz.c \ +specgetsizes.o: specgetsizes.c \ $(INC)/sys/types.h \ $(INC)/sys/vnode.h \ $(INC)/sys/fs/snode.h \ @@ -72,9 +72,6 @@ specsubr.o: specsubr.c \ $(INC)/sys/file.h \ $(INC)/sys/open.h \ $(INC)/sys/user.h \ - $(INC)/sys/termios.h \ - $(INC)/sys/stream.h \ - $(INC)/sys/strsubr.h \ $(FRC) specvfsops.o: specvfsops.c \ diff --git a/usr/src/uts/3b2/fs/specfs/specgetsizes.c b/usr/src/uts/3b2/fs/specfs/specgetsizes.c new file mode 100644 index 0000000..53f422b --- /dev/null +++ b/usr/src/uts/3b2/fs/specfs/specgetsizes.c @@ -0,0 +1,11 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)fs:fs/specfs/specgetsizes.c 1.2" +#include "sys/types.h" +#include "sys/vnode.h" +#include "sys/fs/snode.h" diff --git a/usr/src/uts/3b2/fs/specfs/specsubr.c b/usr/src/uts/3b2/fs/specfs/specsubr.c index 775e189..b48f162 100644 --- a/usr/src/uts/3b2/fs/specfs/specsubr.c +++ b/usr/src/uts/3b2/fs/specfs/specsubr.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/specfs/specsubr.c 1.40" +#ident "@(#)fs:fs/specfs/specsubr.c 1.30" #include "sys/types.h" #include "sys/param.h" #include "sys/systm.h" @@ -46,11 +23,6 @@ #include "sys/file.h" #include "sys/open.h" #include "sys/user.h" -/* #ifdef MERGE */ -#include "sys/termios.h" -#include "sys/stream.h" -#include "sys/strsubr.h" -/* #endif MERGE */ STATIC int specfstype; STATIC dev_t specdev; @@ -115,8 +87,9 @@ specvp(vp, dev, type, cr) sp->s_mtime = va.va_mtime.tv_sec; sp->s_ctime = va.va_ctime.tv_sec; sp->s_fsid = va.va_fsid; - } else + } else { sp->s_fsid = specdev; + } sp->s_realvp = vp; VN_HOLD(vp); sp->s_dev = dev; @@ -211,17 +184,19 @@ stillreferenced(dev, type) dev_t dev; vtype_t type; { - register struct snode *sp, *csp; - register struct vnode *vp; + register struct snode *sp; + register struct vnode *vp, *cvp; if ((vp = specfind(dev, type)) == NULL) return 0; VN_RELE(vp); sp = VTOS(vp); - csp = VTOS(sp->s_commonvp); - if (csp->s_count > 0) /* another snode exists */ + if (sp->s_count > 0) /* snode is still in use */ + return 1; + cvp = sp->s_commonvp; + if (cvp->v_count > 1) /* another snode exists */ return 1; - if (csp->s_mapcnt > 0) /* mappings to device exist */ + if (VTOS(cvp)->s_mapcnt > 0) /* mappings to device exist */ return 1; return 0; } @@ -262,8 +237,7 @@ common_specvp(vp) { register struct snode *sp; - if ((vp->v_type != VBLK) && (vp->v_type != VCHR) || - vp->v_op != &spec_vnodeops) + if ((vp->v_type != VBLK) && (vp->v_type != VCHR)) return vp; sp = VTOS(vp); return sp->s_commonvp; @@ -274,6 +248,7 @@ common_specvp(vp) * one which is "common" to all the snodes which represent the * same device. For use ONLY by SPECFS. */ +extern int dksize(); STATIC struct vnode * @@ -459,7 +434,11 @@ device_close(vp, flag, cr) case VCHR: if (cdevsw[getmajor(dev)].d_str) error = strclose(sp->s_commonvp, flag, cr); - else + else if (*cdevsw[getmajor(dev)].d_flag & D_OLD) { + (void)(*cdevsw[getmajor(dev)].d_close) + (cmpdev(dev), flag, OTYP_CHR); + error = u.u_error; /* XXX */ + } else error = (*cdevsw[getmajor(dev)].d_close) (dev, flag, OTYP_CHR, cr); break; @@ -474,8 +453,13 @@ device_close(vp, flag, cr) (struct cred *) 0); bflush(dev); binval(dev); - error = (*bdevsw[getmajor(dev)].d_close) - (dev, flag, OTYP_BLK, cr); + if (*bdevsw[getmajor(dev)].d_flag & D_OLD) { + (void)(*bdevsw[getmajor(dev)].d_close) + (cmpdev(dev), flag, OTYP_BLK); + error = u.u_error; /* XXX */ + } else + error = (*bdevsw[getmajor(dev)].d_close) + (dev, flag, OTYP_BLK, cr); break; } @@ -483,40 +467,15 @@ device_close(vp, flag, cr) } struct vnode * -makectty(ovp) - register vnode_t *ovp; +makectty(dev) + register dev_t dev; { register vnode_t *vp; - if (vp = makespecvp(ovp->v_rdev, VCHR)) { + if (vp = makespecvp(dev, VCHR)) { VTOS(vp)->s_count++; VTOS(VTOS(vp)->s_commonvp)->s_count++; } return vp; } - -/* #ifdef MERGE */ -/* - * XENIX rdchk() support. - */ -int -spec_rdchk(vp, cr, rvalp) - struct vnode *vp; - struct cred *cr; - int *rvalp; -{ - dev_t dev; - int error; - - if (vp->v_type != VCHR || vp->v_op != &spec_vnodeops) - return ENOTTY; - dev = VTOS(vp)->s_dev; - if (cdevsw[getmajor(dev)].d_str) - error = strioctl(vp, FIORDCHK, 0, 0, K_TO_K, cr, rvalp); - else - error = - (*cdevsw[getmajor(dev)].d_ioctl)(dev, FIORDCHK, 0, 0, cr, rvalp); - return error; -} -/* #endif MERGE */ diff --git a/usr/src/uts/3b2/fs/specfs/specvfsops.c b/usr/src/uts/3b2/fs/specfs/specvfsops.c index 88a8831..31cfb5f 100644 --- a/usr/src/uts/3b2/fs/specfs/specvfsops.c +++ b/usr/src/uts/3b2/fs/specfs/specvfsops.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/specfs/specvfsops.c 1.15" +#ident "@(#)fs:fs/specfs/specvfsops.c 1.12" #include "sys/types.h" #include "sys/param.h" #include "sys/buf.h" @@ -43,8 +20,6 @@ #include "fs/fs_subr.h" -extern void strpunlink(); - STATIC int spec_sync(); struct vfsops spec_vfsops = { @@ -60,10 +35,6 @@ struct vfsops spec_vfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* @@ -86,9 +57,6 @@ spec_sync(vfsp, flag, cr) spec_lock++; - if (flag & SYNC_CLOSE) - (void) strpunlink(cr); - if (!(flag & SYNC_ATTR)) { for (spp = stable; spp < &stable[STABLESIZE]; spp++) { for (sp = *spp; sp != NULL; sp = sp->s_next) { diff --git a/usr/src/uts/3b2/fs/specfs/specvnops.c b/usr/src/uts/3b2/fs/specfs/specvnops.c index 30ba351..32323da 100644 --- a/usr/src/uts/3b2/fs/specfs/specvnops.c +++ b/usr/src/uts/3b2/fs/specfs/specvnops.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/specfs/specvnops.c 1.67.1.32" +#ident "@(#)fs:fs/specfs/specvnops.c 1.67.1.10" #include "sys/types.h" #include "sys/param.h" #include "sys/systm.h" @@ -83,6 +60,7 @@ STATIC int spec_access(); STATIC int spec_fsync(); STATIC void spec_inactive(); STATIC int spec_fid(); +STATIC int spec_link(); STATIC int spec_seek(); STATIC int spec_frlock(); STATIC int spec_realvp(); @@ -108,7 +86,7 @@ struct vnodeops spec_vnodeops = { fs_nosys, /* lookup */ fs_nosys, /* create */ fs_nosys, /* remove */ - fs_nosys, /* link */ + spec_link, fs_nosys, /* rename */ fs_nosys, /* mkdir */ fs_nosys, /* rmdir */ @@ -132,7 +110,6 @@ struct vnodeops spec_vnodeops = { spec_delmap, spec_poll, fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ fs_nosys, fs_nosys, @@ -141,30 +118,6 @@ struct vnodeops spec_vnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* @@ -180,10 +133,12 @@ spec_open(vpp, flag, cr) register unsigned int maj; register dev_t dev; dev_t newdev; - o_pid_t *oldttyp; + pid_t *oldttyp; struct vnode *nvp; struct vnode *vp = *vpp; struct vnode *cvp = VTOS(vp)->s_commonvp; + struct stdata *tmpsp; + int newdriver = 0; int error = 0; label_t saveq; @@ -210,22 +165,24 @@ spec_open(vpp, flag, cr) u.u_qsav = saveq; return ENXIO; } + if (!(*cdevsw[getmajor(dev)].d_flag & D_OLD)) + newdriver = 1; oldttyp = u.u_ttyp; /* used only by old tty drivers */ if (cdevsw[maj].d_str) { if ((error = stropen(cvp, &newdev, flag, cr)) == 0) { - struct stdata *stp = cvp->v_stream; - if (dev != newdev) { + if (dev != newdev && newdriver) { /* * Clone open. */ + tmpsp = cvp->v_stream; + vp->v_stream = NULL; + cvp->v_stream = NULL; if ((nvp = makespecvp(newdev, VCHR)) == NULL) { strclose(vp, flag, cr); error = ENOMEM; break; } - vp->v_stream = NULL; - cvp->v_stream = NULL; /* * STREAMS clones inherit fsid and * stream. @@ -233,47 +190,37 @@ spec_open(vpp, flag, cr) VTOS(nvp)->s_fsid = VTOS(vp)->s_fsid; VTOS(vp)->s_count--; VTOS(cvp)->s_count--; - nvp->v_vfsp = vp->v_vfsp; - nvp->v_stream = stp; + nvp->v_stream = tmpsp; cvp = VTOS(nvp)->s_commonvp; - cvp->v_stream = stp; - stp->sd_vnode = cvp; - stp->sd_strtab = + cvp->v_stream = nvp->v_stream; + nvp->v_stream->sd_vnode = cvp; + nvp->v_stream->sd_strtab = cdevsw[getmajor(newdev)].d_str; VN_RELE(vp); VTOS(nvp)->s_count++; VTOS(cvp)->s_count++; *vpp = nvp; + if (!(newdriver) && oldttyp == NULL + && u.u_ttyp != oldttyp) + /* + * ctty was allocated, and the + * vnode changed; reallocate + * the ctty. + */ + realloctty(cvp); } else { /* * Normal open. */ - vp->v_stream = stp; - } - if (oldttyp == NULL && u.u_ttyp != NULL) { - /* - * pre SVR4 driver has allocated the - * stream as a controlling terminal - - * check against SVR4 criteria and - * deallocate it if it fails - */ - if ((flag&FNOCTTY) - || !strctty(u.u_procp, stp)) { - *u.u_ttyp = 0; - u.u_ttyp = NULL; - } - } else if (stp->sd_flag & STRISTTY) { - /* - * this is a post SVR4 tty driver - - * try to allocate it as a - * controlling terminal - */ - if (!(flag&FNOCTTY)) - (void)strctty(u.u_procp, stp); + vp->v_stream = cvp->v_stream; } } } else { - if ((error = (*cdevsw[maj].d_open) + if (*cdevsw[maj].d_flag & D_OLD) { + (void)(*cdevsw[maj].d_open) + (cmpdev(dev), flag, OTYP_CHR); + error = u.u_error; /* XXX */ + } else if ((error = (*cdevsw[maj].d_open) (&newdev, flag, OTYP_CHR, cr)) == 0 && dev != newdev) { /* @@ -290,24 +237,12 @@ spec_open(vpp, flag, cr) * Character clones inherit fsid. */ VTOS(nvp)->s_fsid = VTOS(vp)->s_fsid; - nvp->v_vfsp = vp->v_vfsp; VN_RELE(vp); VTOS(nvp)->s_count++; *vpp = nvp; } - if (oldttyp == NULL && u.u_ttyp != NULL) { - register proc_t *pp = u.u_procp; - register sess_t *sp = pp->p_sessp; - if ((flag&FNOCTTY) || pp->p_pid != sp->s_sid) { - *u.u_ttyp = 0; - u.u_ttyp = NULL; - } else { - extern vnode_t *makectty(); - alloctty(pp, - makectty(VTOS(*vpp)->s_commonvp)); - u.u_ttyd = (o_dev_t)cmpdev(sp->s_dev); - } - } + if (!(newdriver) && oldttyp == NULL && u.u_ttyp != oldttyp) + realloctty(VTOS(*vpp)->s_commonvp); } break; @@ -317,7 +252,11 @@ spec_open(vpp, flag, cr) u.u_qsav = saveq; return ENXIO; } - if ((error = (*bdevsw[maj].d_open)(&newdev, flag, + if (*bdevsw[maj].d_flag & D_OLD) { + (void)(*bdevsw[maj].d_open) + (cmpdev(dev), flag, OTYP_BLK); + error = u.u_error; /* XXX */ + } else if ((error = (*bdevsw[maj].d_open)(&newdev, flag, OTYP_BLK, cr)) == 0 && dev != newdev) { /* * Clone open. @@ -421,6 +360,8 @@ spec_read(vp, uiop, ioflag, cr) if (uiop->uio_resid == 0) return 0; + if (uiop->uio_offset < 0) + return EINVAL; ASSERT(vp->v_type == VCHR || vp->v_type == VBLK); @@ -428,7 +369,24 @@ spec_read(vp, uiop, ioflag, cr) smark(sp, SACC); if (cdevsw[getmajor(dev)].d_str) error = strread(vp, uiop, cr); - else + else if (*cdevsw[getmajor(dev)].d_flag & D_OLD) { + /* + * For old device drivers we have to unpack the + * uio information into the u-block and believe + * what it says when it comes back. + */ + u.u_offset = uiop->uio_offset; + u.u_base = uiop->uio_iov->iov_base; + u.u_count = uiop->uio_resid; + u.u_segflg = uiop->uio_segflg; + u.u_fmode = uiop->uio_fmode; + + (void)(*cdevsw[getmajor(dev)].d_read)(cmpdev(dev)); + + uiop->uio_resid = u.u_count; + uiop->uio_offset = u.u_offset; + error = u.u_error; /* XXX */ + } else error = (*cdevsw[getmajor(dev)].d_read)(dev, uiop, cr); return error; } @@ -448,8 +406,11 @@ spec_read(vp, uiop, ioflag, cr) n = MIN(MAXBSIZE - on, uiop->uio_resid); diff = bdevsize - uiop->uio_offset; - if (diff <= 0) + if (diff <= 0) { + if (diff < 0) + error = ENXIO; break; + } if (diff < n) n = diff; @@ -498,14 +459,30 @@ spec_write(vp, uiop, ioflag, cr) off_t off; struct vnode *blkvp; + if (uiop->uio_offset < 0) + return EINVAL; + ASSERT(vp->v_type == VCHR || vp->v_type == VBLK); if (vp->v_type == VCHR) { smark(sp, SUPD|SCHG); if (cdevsw[getmajor(dev)].d_str) error = strwrite(vp, uiop, cr); - else + else if (*cdevsw[getmajor(dev)].d_flag & D_OLD) { + u.u_offset = uiop->uio_offset; + u.u_base = uiop->uio_iov->iov_base; + u.u_count = uiop->uio_resid; + u.u_segflg = uiop->uio_segflg; + u.u_fmode = uiop->uio_fmode; + + (void)(*cdevsw[getmajor(dev)].d_write)(cmpdev(dev)); + + uiop->uio_resid = u.u_count; + uiop->uio_offset = u.u_offset; + error = u.u_error; /* XXX */ + } else error = (*cdevsw[getmajor(dev)].d_write)(dev, uiop, cr); + return error; } @@ -543,7 +520,7 @@ spec_write(vp, uiop, ioflag, cr) */ if (n == MAXBSIZE || (on == 0 && (off + n) == bdevsize)) { SNLOCK(sp); - segmap_pagecreate(segkmap, base + on, (u_int)n, 0); + segmap_pagecreate(segkmap, base + on, (u_int)n, 0, 0, 0); SNUNLOCK(sp); pagecreate = 1; } @@ -613,28 +590,28 @@ spec_ioctl(vp, cmd, arg, mode, cr, rvalp) dev = VTOS(vp)->s_dev; if (cdevsw[getmajor(dev)].d_str) error = strioctl(vp, cmd, arg, mode, U_TO_K, cr, rvalp); - else - error = (*cdevsw[getmajor(dev)].d_ioctl)(dev, cmd, arg, - mode, cr, rvalp); + else if (*cdevsw[getmajor(dev)].d_flag & D_OLD) { + (void)(*cdevsw[getmajor(dev)].d_ioctl)(cmpdev(dev), cmd, arg, mode); + error = u.u_error; /* XXX */ + *rvalp = u.u_rval1; /* XXX */ + } else + error = + (*cdevsw[getmajor(dev)].d_ioctl)(dev, cmd, arg, mode, cr, rvalp); return error; } /* ARGSUSED */ STATIC int spec_getattr(vp, vap, flags, cr) - register struct vnode *vp; + struct vnode *vp; register struct vattr *vap; int flags; struct cred *cr; { int error; - register struct snode *sp; + register struct snode *sp = VTOS(vp); register struct vnode *realvp; - if (flags & ATTR_COMM && vp->v_type == VBLK) - vp = VTOS(vp)->s_commonvp; - - sp = VTOS(vp); if ((realvp = sp->s_realvp) == NULL) { /* * No real vnode behind this one. Fill in the fields @@ -652,7 +629,7 @@ spec_getattr(vp, vap, flags, cr) vap->va_size = sp->s_size; vap->va_rdev = sp->s_dev; vap->va_blksize = MAXBSIZE; - vap->va_nblocks = btod(vap->va_size); + vap->va_nblocks = (vap->va_size + MAXBSIZE - 1) / MAXBSIZE; } else if (error = VOP_GETATTR(realvp, vap, flags, cr)) return error; @@ -716,6 +693,21 @@ spec_access(vp, mode, flags, cr) return 0; /* Allow all access. */ } +STATIC int +spec_link(tdvp, vp, tnm, cr) + struct vnode *tdvp; + struct vnode *vp; + char *tnm; + struct cred *cr; +{ + register struct vnode *realvp; + + if ((realvp = VTOS(vp)->s_realvp) != NULL) + return VOP_LINK(tdvp, realvp, tnm, cr); + else + return ENOENT; +} + /* * In order to sync out the snode times without multi-client problems, * make sure the times written out are never earlier than the times @@ -730,21 +722,11 @@ spec_fsync(vp, cr) register struct vnode *realvp; struct vattr va, vatmp; - /* - * If times didn't change, don't flush anything. - */ - if ((sp->s_flag & (SACC|SUPD|SCHG)) == 0 && vp->v_type != VBLK) + /* If times didn't change, don't flush anything. */ + if ((sp->s_flag & (SACC|SUPD|SCHG)) == 0) return 0; - sp->s_flag &= ~(SACC|SUPD|SCHG); - - if (vp->v_type == VBLK && sp->s_commonvp != vp - && sp->s_commonvp->v_pages != NULL) - (void) VOP_PUTPAGE(sp->s_commonvp, 0, 0, 0, (struct cred *) 0); - - /* - * If no real vnode to update, don't flush anything. - */ + /* If no real vnode to update, don't flush anything. */ if ((realvp = sp->s_realvp) == NULL) return 0; @@ -820,7 +802,7 @@ spec_seek(vp, ooff, noffp) off_t ooff; off_t *noffp; { - return 0; + return *noffp < 0 ? EINVAL : 0; } /* ARGSUSED */ @@ -976,6 +958,9 @@ spec_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) bp->b_dev = cmpdev(vp->v_rdev); bp->b_edev = vp->v_rdev; bp->b_blkno = btodt(io_off); +#if 1 + bp->b_un.b_addr = (caddr_t)pfntokv(page_pptonum(pp)); /* XXX */ +#endif /* * Zero part of page which we are not @@ -1020,6 +1005,9 @@ spec_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) bp2->b_dev = cmpdev(vp->v_rdev); bp2->b_edev = vp->v_rdev; bp2->b_blkno = btodt(io_off); +#if 1 + /* XXX */ bp2->b_un.b_addr = (caddr_t)pfntokv(page_pptonum(pp2)); +#endif /* * Zero part of page which we are not * going to be reading from disk now. @@ -1140,6 +1128,9 @@ spec_wrtblk(vp, pp, off, len, flags) bp->b_dev = cmpdev(vp->v_rdev); bp->b_edev = vp->v_rdev; bp->b_blkno = btodt(off); +#if 1 + bp->b_un.b_addr = (caddr_t) pfntokv(page_pptonum(pp)); /* XXX */ +#endif (*bdevsw[getmajor(vp->v_rdev)].d_strategy)(bp); @@ -1203,7 +1194,7 @@ spec_putpage(vp, off, len, flags, cr) * We refuse to act on behalf of the pageout daemon to push * out a page to an snode which is currently locked. */ - if ((sp->s_flag & SLOCKED) && u.u_procp == proc_pageout) { + if ((sp->s_flag & SLOCKED) && u.u_procp == nproc[2]) { err = EAGAIN; /* XXX EWOULDBLOCK */ goto out; } @@ -1479,11 +1470,11 @@ spec_map(vp, off, as, addrp, len, prot, maxprot, flags, cred) } STATIC int -spec_addmap(vp, off, as, addr, len, prot, maxprot, flags, cred) +spec_addmap(vp, off, as, addrp, len, prot, maxprot, flags, cred) struct vnode *vp; u_int off; struct as *as; - addr_t addr; + addr_t *addrp; u_int len; u_int prot, maxprot; u_int flags; @@ -1500,11 +1491,11 @@ spec_addmap(vp, off, as, addr, len, prot, maxprot, flags, cred) } STATIC int -spec_delmap(vp, off, as, addr, len, prot, maxprot, flags, cred) +spec_delmap(vp, off, as, addrp, len, prot, maxprot, flags, cred) struct vnode *vp; u_int off; struct as *as; - addr_t addr; + addr_t *addrp; u_int len; u_int prot, maxprot; u_int flags; diff --git a/usr/src/uts/3b2/fs/strcalls.c b/usr/src/uts/3b2/fs/strcalls.c index feaffea..9371ff2 100644 --- a/usr/src/uts/3b2/fs/strcalls.c +++ b/usr/src/uts/3b2/fs/strcalls.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/strcalls.c 1.20" +#ident "@(#)fs:fs/strcalls.c 1.17" #include "sys/types.h" #include "sys/sysmacros.h" #include "sys/param.h" @@ -27,7 +27,6 @@ #include "sys/conf.h" #include "sys/stropts.h" #include "sys/stream.h" -#include "sys/strsubr.h" /* * STREAMS system calls. @@ -187,6 +186,8 @@ msgio(uap, rvp, mode, prip, flagsp) vp = fp->f_vnode; if ((vp->v_type != VFIFO && vp->v_type != VCHR) || vp->v_stream == NULL) return (ENOSTR); + if (setjmp(&u.u_qsav)) + return (intrerr(1)); if (uap->ctl && copyin((caddr_t)uap->ctl, (caddr_t)&msgctl, sizeof(struct strbuf))) return (EFAULT); diff --git a/usr/src/uts/3b2/fs/ufs/quota.c b/usr/src/uts/3b2/fs/ufs/quota.c index a1a7125..121935a 100644 --- a/usr/src/uts/3b2/fs/ufs/quota.c +++ b/usr/src/uts/3b2/fs/ufs/quota.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/quota.c 1.3" +#ident "@(#)fs:fs/ufs/quota.c 1.2" /* * Code pertaining to management of the in-core data structures. diff --git a/usr/src/uts/3b2/fs/ufs/quota_ufs.c b/usr/src/uts/3b2/fs/ufs/quota_ufs.c index f6e9459..f566b8e 100644 --- a/usr/src/uts/3b2/fs/ufs/quota_ufs.c +++ b/usr/src/uts/3b2/fs/ufs/quota_ufs.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/quota_ufs.c 1.4" +#ident "@(#)fs:fs/ufs/quota_ufs.c 1.3" /* * Routines used in checking limits on file system usage. diff --git a/usr/src/uts/3b2/fs/ufs/quotacalls.c b/usr/src/uts/3b2/fs/ufs/quotacalls.c index 7907562..4fb4a10 100644 --- a/usr/src/uts/3b2/fs/ufs/quotacalls.c +++ b/usr/src/uts/3b2/fs/ufs/quotacalls.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/quotacalls.c 1.9" +#ident "@(#)fs:fs/ufs/quotacalls.c 1.8" /* * Quota system calls. diff --git a/usr/src/uts/3b2/fs/ufs/ufs.mk b/usr/src/uts/3b2/fs/ufs/ufs.mk index fb4cdd9..f8abc7a 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs.mk +++ b/usr/src/uts/3b2/fs/ufs/ufs.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)fs:fs/ufs/ufs.mk 1.12" +#ident "@(#)fs:fs/ufs/ufs.mk 1.10" ROOT = STRIP = strip @@ -175,13 +175,11 @@ quota_ufs.L: quota_ufs.c \ ufs_alloc.o: ufs_alloc.c \ $(INC)/sys/types.h \ - $(INC)/sys/debug.h \ $(INC)/sys/param.h \ $(INC)/sys/systm.h \ $(INC)/sys/signal.h \ $(INC)/sys/cred.h \ $(INC)/sys/proc.h \ - $(INC)/sys/disp.h \ $(INC)/sys/user.h \ $(INC)/sys/buf.h \ $(INC)/sys/vfs.h \ @@ -192,22 +190,16 @@ ufs_alloc.o: ufs_alloc.c \ $(INC)/sys/errno.h \ $(INC)/sys/time.h \ $(INC)/sys/sysmacros.h \ - $(INC)/sys/file.h \ - $(INC)/sys/fcntl.h \ - $(INC)/sys/flock.h \ - $(INC)/fs/fs_subr.h \ - $(INC)/sys/cmn_err.h + $(INC)/fs/fs_subr.h ${CC} -c ${CFLAGS} ufs_alloc.c ufs_alloc.L: ufs_alloc.c \ $(INC)/sys/types.h \ - $(INC)/sys/debug.h \ $(INC)/sys/param.h \ $(INC)/sys/systm.h \ $(INC)/sys/signal.h \ $(INC)/sys/cred.h \ $(INC)/sys/proc.h \ - $(INC)/sys/disp.h \ $(INC)/sys/user.h \ $(INC)/sys/buf.h \ $(INC)/sys/vfs.h \ @@ -216,13 +208,9 @@ ufs_alloc.L: ufs_alloc.c \ $(INC)/sys/fs/ufs_inode.h \ $(INC)/sys/fs/ufs_quota.h \ $(INC)/sys/errno.h \ - $(INC)/sys/time.h \ + $(INC)/sys/time.h \ $(INC)/sys/sysmacros.h \ - $(INC)/sys/file.h \ - $(INC)/sys/fcntl.h \ - $(INC)/sys/flock.h \ - $(INC)/fs/fs_subr.h \ - $(INC)/sys/cmn_err.h + $(INC)/fs/fs_subr.h @echo ufs_alloc.c: @-(${CPP} ${LCOPTS} ufs_alloc.c | \ ${LINT1} ${LOPTS} > ufs_alloc.L ) 2>&1 | ${LTAIL} diff --git a/usr/src/uts/3b2/fs/ufs/ufs_alloc.c b/usr/src/uts/3b2/fs/ufs/ufs_alloc.c index 2bb8f7b..8dce2e2 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_alloc.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_alloc.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_alloc.c 1.18" +#ident "@(#)fs:fs/ufs/ufs_alloc.c 1.16" #include #include @@ -50,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -1092,7 +1068,17 @@ ufs_freesp(vp, lp, flag) register struct flock *lp; int flag; { +#ifdef notneeded register int i; + register struct vfs *vfsp; + register daddr_t bn; + register daddr_t lastblock; + register long bsize; + long nindir; + daddr_t lastiblock[NIADDR]; + daddr_t save[UFSNADDR]; + struct fs *fs; +#endif register struct inode *ip = VTOI(vp); int error; @@ -1101,48 +1087,125 @@ ufs_freesp(vp, lp, flag) if (lp->l_len != 0) return EINVAL; - if (ip->i_size == lp->l_start) + if (ip->i_size <= lp->l_start) return 0; /* - * Check if there is any active mandatory lock on the - * range that will be truncated/expanded. + * Truncation honors mandatory record locking protocol + * exactly as writing does. */ - if (MANDLOCK(vp, ip->i_mode)) { - int save_start; - - save_start = lp->l_start; - - if (ip->i_size < lp->l_start) { - /* - * "Truncate up" case: need to make sure there - * is no lock beyond current end-of-file. To - * do so, we need to set l_start to the size - * of the file temporarily. - */ - lp->l_start = ip->i_size; - } - lp->l_type = F_WRLCK; - lp->l_sysid = u.u_procp->p_sysid; - lp->l_pid = u.u_procp->p_epid; - i = (flag & (FNDELAY|FNONBLOCK)) ? 0 : SLPFLCK; - if ((i = reclock(vp, lp, i, 0, lp->l_start)) != 0 - || lp->l_type != F_UNLCK) - return i ? i : EAGAIN; - - lp->l_start = save_start; - } ILOCK(ip); - if (vp->v_type == VREG && (error = fs_vcode(vp, &ip->i_vcode))) { - IUNLOCK(ip); - return error; + if (vp->v_type == VREG) { + error = fs_vcode(vp, &ip->i_vcode); + + if (error) { + IUNLOCK(ip); + return error; + } } error = ufs_itrunc(ip, lp->l_start); IUNLOCK(ip); return error; +#if notneeded + if (ip->i_map) { + ufs_freemap(ip); + } + + vfsp = vp->v_vfsp; + bsize = vfsp->vfs_bsize; + fs = ip->i_fs; + + /* + * Update the pages of the file. If the file is not being + * truncated to a block boundary, the contents of the + * pages following the end of the file must be zeroed + * in case they ever become accessible again because + * of subsequent file growth. + */ + pvn_vptrunc(vp, lp->l_start, (uint)(bsize - (lp->l_start & ~(fs->fs_bmask)))); + + /* + * Calculate index into inode's block list of last block + * we want to keep. Lastblock is -1 when the file is + * truncated to 0. + * + * Think of the file as consisting of four separate lists + * of data blocks: one list of up to NDADDR blocks pointed + * to directly from the inode, and three lists of up to + * nindir, nindir**2 and nindir**3 blocks, respectively + * headed by the SINGLE, DOUBLE and TRIPLE indirect block + * pointers. For each of the four lists, we're calculating + * the index within the list of the last block we want to + * keep. If the index for list i is negative, it means + * that said block is not in list i (but perhaps in list i-1), + * hence all blocks in list i are to be discarded; if the + * index is beyond the end of list i, it means that the + * block is not in list i (but perhaps in list i+1), hence + * all blocks in list i are to be kept. + */ + + nindir = NINDIR(fs); + lastblock = + (long)(((ulong)lp->l_start + fs->fs_bsize-1) >> fs->fs_bshift) - 1; + lastiblock[SINGLE] = lastblock - NDADDR; + lastiblock[DOUBLE] = lastiblock[SINGLE] - nindir; + lastiblock[TRIPLE] = lastiblock[DOUBLE] - nindir*nindir; + + /* + * Update file size and block pointers in + * disk inode before we start freeing blocks. + * Also normalize lastiblock values to -1 + * for calls to ufsindirtrunc below. + */ + for (i = UFSNADDR-1; i >= 0; i--) + save[i] = ip->i_db[i]; + + for (i = TRIPLE; i >= SINGLE; i--) + if (lastiblock[i] < 0) { + ip->i_ib[i] = 0; + lastiblock[i] = -1; + } + + for (i = NDADDR-1; i > lastblock; i--) + ip->i_db[i] = 0; + + ip->i_size = lp->l_start; + ip->i_flag |= IUPD|ICHG; + ufs_iupdat(ip, 1); + + /* + * Indirect blocks first. + */ + for (i = TRIPLE; i >= SINGLE; i--) { + if ((bn = save[IB(i)]) != 0) { + ufsindirtrunc(vfsp, fs, bn, lastiblock[i], i, ip); + if (lastiblock[i] < 0) + (void)free(ip, bn, fs->fs_bsize); + } + if (lastiblock[i] >= 0) + return 0; + } + + /* + * Direct blocks. + */ + + for (i = NDADDR-1; i > lastblock; i--) { + if ((bn = save[i]) != 0) + if (ip->i_size < (bn + 1) << fs->fs_bshift) + /* + * We are freeing a fragment + */ + (void)free(ip, bn, fs->fs_fsize); + else + (void)free(ip, bn, fs->fs_bsize); + } + IUNLOCK(ip); + return 0; +#endif } STATIC void diff --git a/usr/src/uts/3b2/fs/ufs/ufs_blklist.c b/usr/src/uts/3b2/fs/ufs/ufs_blklist.c index 0d45cbb..210b02d 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_blklist.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_blklist.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_blklist.c 1.7" +#ident "@(#)fs:fs/ufs/ufs_blklist.c 1.5" #include "sys/types.h" #include "sys/buf.h" #include "sys/cmn_err.h" @@ -165,18 +142,9 @@ int indlvl; int bsize; struct vnode *vp; struct fs *fs; - int sksize; vp = ITOV(ip); bsize = vp->v_vfsp->vfs_bsize; - if (blknbr == 0) { - sksize = 1; - for (cnt = 0; cnt <= indlvl; cnt++) - sksize *= (bsize/sizeof(int)); - for (cnt = 0; cnt < sksize; cnt++) - *lp++ = 0; - return lp; - } fs = getfs(vp->v_vfsp); bp = bread(dev, fragstoblks(fs, blknbr), bsize); if (u.u_error) { diff --git a/usr/src/uts/3b2/fs/ufs/ufs_bmap.c b/usr/src/uts/3b2/fs/ufs/ufs_bmap.c index aacbe40..7757abe 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_bmap.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_bmap.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_bmap.c 1.11" +#ident "@(#)fs:fs/ufs/ufs_bmap.c 1.9" #include #include @@ -37,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -108,16 +84,7 @@ ufs_bmap(ip, lbn, bnp, rabnp, size, rw, alloc_only) if (bnp) { *bnp = ip->i_map[lbn]; if (*bnp == 0) - if (rw != S_WRITE) { - *bnp = UFS_HOLE; - return 0; - } - else { - ILOCK(ip); - ufs_freemap(ip); - IUNLOCK(ip); - goto lbmap; - } + *bnp = UFS_HOLE; } if (rabnp) { if ((lbn + 1) >= nblks) { @@ -130,7 +97,7 @@ ufs_bmap(ip, lbn, bnp, rabnp, size, rw, alloc_only) } return 0; } -lbmap: + fs = ip->i_fs; llbn = lblkno(fs, ip->i_size - 1); isdir = ((ip->i_mode & IFMT) == IFDIR); diff --git a/usr/src/uts/3b2/fs/ufs/ufs_dir.c b/usr/src/uts/3b2/fs/ufs/ufs_dir.c index 6be45bf..3def9da 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_dir.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_dir.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_dir.c 1.15" +#ident "@(#)fs:fs/ufs/ufs_dir.c 1.12" /* * Directory manipulation routines. @@ -1326,14 +1303,22 @@ ufs_dirremove(dp, namep, oip, cdir, op, cr) goto out; } else if (op == DR_REMOVE) { /* - * unlink(2) requires a different check: allow only - * the super-user to unlink a directory. + * unlink(2) requires different checks: + * (a) Allow only the super-user to unlink a directory. + * (b) Don't allow a busy text file to be removed. */ struct vnode *vp = ITOV(ip); if (vp->v_type == VDIR && !suser(cr)) { error = EPERM; goto out; } + if (vp->v_flag & VTEXT) { + xrele(vp); + if ((vp->v_flag & VTEXT) && ip->i_nlink ==1) { + error = ETXTBSY; + goto out; + } + } } /* * Remove the cache'd entry, if any. @@ -1626,7 +1611,7 @@ ufs_dircheckpath(source, target) * Unserialize before relocking target to avoid a race. */ if (serialize_flag & RENAME_WAITING) - wakeprocs((caddr_t)&serialize_flag, PRMPT); + wakeup((caddr_t)&serialize_flag); serialize_flag = 0; if (ip) { diff --git a/usr/src/uts/3b2/fs/ufs/ufs_dsort.c b/usr/src/uts/3b2/fs/ufs/ufs_dsort.c index b7f07d0..5e07cb5 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_dsort.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_dsort.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_dsort.c 1.3" +#ident "@(#)fs:fs/ufs/ufs_dsort.c 1.2" /* * Seek sort for disks. We depend on the driver diff --git a/usr/src/uts/3b2/fs/ufs/ufs_inode.c b/usr/src/uts/3b2/fs/ufs/ufs_inode.c index 417a3a1..12af799 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_inode.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_inode.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_inode.c 1.26" +#ident "@(#)fs:fs/ufs/ufs_inode.c 1.21" #include #include @@ -188,6 +165,7 @@ ufs_iget(vfsp, fs, ino, ipp) register struct inode *iq; register struct vnode *vp; int error; + int checkhash; sysinfo.iget++; /* @@ -202,7 +180,7 @@ ufs_iget(vfsp, fs, ino, ipp) * Found it - check for locks. */ if ((ip->i_flag & (IRWLOCKED | ILOCKED)) && - ip->i_owner != curproc->p_slot) { + ip->i_owner != GET_INDEX(curproc->p_pid)) { ip->i_flag |= IWANT; (void) sleep((caddr_t)ip, PINOD); goto loop; @@ -236,7 +214,9 @@ ufs_iget(vfsp, fs, ino, ipp) * in an attempt to reclaim some inodes. Give up only when * there are no more name cache entries to purge. */ + checkhash = 0; while (ifreeh == NULL) { + checkhash = 1; /* * dnlc_purge1 might go to sleep. So we have to check the hash chain again * to handle possible race condition. @@ -252,29 +232,42 @@ ufs_iget(vfsp, fs, ino, ipp) return (ENFILE); } if (ip->i_mode != 0 && ITOV(ip)->v_pages != NULL) - sysinfo.ufsipage++; - else - sysinfo.ufsinopage++; iq = ip->i_freef; if (iq) - iq->i_freeb = &ifreeh; - ifreeh = iq; + iq->i_freeb = ip->i_freeb; + else + ifreet = ip->i_freeb; + *ip->i_freeb = iq; ip->i_freef = NULL; ip->i_freeb = NULL; ip->i_flag = IREF; ILOCK(ip); - if (ufs_syncip(ip, B_INVAL) != 0 || (ip->i_flag & IWANT) != 0) { - VN_HOLD(ITOV(ip)); - idrop(ip); - goto loop; - } - for (iq = ih->ih_chain[0]; iq != (struct inode *)ih; iq = iq->i_forw) { - if (ino == iq->i_number && vfsp->vfs_dev == iq->i_dev) { + if (ip->i_fs != NULL && ITOV(ip)->v_pages != NULL && + ITOV(ip)->v_type != VCHR) { + int err; + /* We need to invalidate all the pages for the vnode here before we + can reuse the inode. Since we might go to sleep and context switch + here, there is a potential race condition when someone else also + tries to iget the same (dev, ino). + */ + + err = VOP_PUTPAGE(ITOV(ip), 0, 0, B_INVAL, (struct ucred *)0); + if (err != 0 || (ip->i_flag & IWANT) != 0) { VN_HOLD(ITOV(ip)); idrop(ip); goto loop; } + checkhash = 1; + } + if (checkhash) { + for (iq = ih->ih_chain[0]; iq != (struct inode *)ih; iq = iq->i_forw) { + if (ino == iq->i_number && vfsp->vfs_dev == iq->i_dev) { + VN_HOLD(ITOV(ip)); + idrop(ip); + goto loop; + } + } } vp = ITOV(ip); @@ -692,11 +685,9 @@ ufs_itrunc(oip, length) /* caller never check the return code, why bother return errno ? */ return (EINVAL); } - if (length == oip->i_size) { - /* update ctime and mtime to please POSIX tests */ - oip->i_flag |= ICHG |IUPD; + if (length == oip->i_size) return (0); - } + if (((oip->i_mode &IFMT) == IFREG) && oip->i_map) ufs_freemap(oip); @@ -994,6 +985,11 @@ ufs_iaccess(ip, mode, cr) return (EROFS); } } + if (vp->v_flag & VTEXT) { + xrele(vp); + if (vp->v_flag & VTEXT) + return ETXTBSY; + } } /* * If you're the super-user, @@ -1029,7 +1025,6 @@ struct inode *ip; { ip->i_back->i_forw = ip->i_forw; ip->i_forw->i_back = ip->i_back; - ip->i_forw = ip->i_back = ip; return; } diff --git a/usr/src/uts/3b2/fs/ufs/ufs_subr.c b/usr/src/uts/3b2/fs/ufs/ufs_subr.c index 05bead3..6b6ee3d 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_subr.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_subr.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_subr.c 1.20" +#ident "@(#)fs:fs/ufs/ufs_subr.c 1.16" #include #include @@ -59,7 +36,6 @@ #ifdef SUNOS_FBUF int syncprt = 0; #endif -int updlock; void ufs_flushi(); /* @@ -74,12 +50,12 @@ ufs_update() register struct vfs *vfsp; extern struct vfsops ufs_vfsops; struct fs *fs; + static int updlock; - while (updlock) { - (void) sleep((caddr_t)&updlock, PINOD); - } + if (updlock) + return; updlock++; - + #ifdef SUNOS_FBUF if (syncprt) bufstats(); @@ -102,6 +78,7 @@ ufs_update() fs->fs_time = hrestime.tv_sec; sbupdate(vfsp); } + updlock = 0; ufs_flushi(0); @@ -111,8 +88,6 @@ ufs_update() * information (e.g., cg and inode info) to be flushed back. */ bflush((dev_t)NODEV); - updlock = 0; - wakeup((caddr_t)&updlock); return; } @@ -180,12 +155,10 @@ ufs_syncip(ip, flags) error = 0; else error = VOP_PUTPAGE(vp, 0, 0, flags, (struct cred *)0); - if (ip->i_flag & (IUPD |IACC | ICHG | IMOD)) { - if ((flags & B_ASYNC) != 0) { - IUPDAT(ip, 0); - } else { - IUPDAT(ip, 1); - } + if ((flags & B_ASYNC) != 0) { + IUPDAT(ip, 0); + } else { + IUPDAT(ip, 1); } return (error); } @@ -305,7 +278,7 @@ fbzero(vp, off, len, fbpp) (*fbpp)->fb_addr = addr; (*fbpp)->fb_count = len; - segmap_pagecreate(segkmap, addr, len, 1); + segmap_pagecreate(segkmap, addr, len, 1, 0, 0); /* * Now we zero all the memory in the mapping we are interested in. @@ -583,4 +556,3 @@ locc(c, len, cp) #endif notdef #endif !defined(vax) - diff --git a/usr/src/uts/3b2/fs/ufs/ufs_tables.c b/usr/src/uts/3b2/fs/ufs/ufs_tables.c index f0365d8..8283de9 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_tables.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_tables.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_tables.c 1.3" +#ident "@(#)fs:fs/ufs/ufs_tables.c 1.2" #include #include diff --git a/usr/src/uts/3b2/fs/ufs/ufs_vfsops.c b/usr/src/uts/3b2/fs/ufs/ufs_vfsops.c index 39183b0..6823449 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_vfsops.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_vfsops.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_vfsops.c 1.40" +#ident "@(#)fs:fs/ufs/ufs_vfsops.c 1.31" #include #include @@ -46,7 +23,6 @@ #include #include #include -#include #include #include #undef NFS @@ -73,7 +49,7 @@ STATIC int ufs_sync(); STATIC int ufs_vget(); STATIC int ufs_mountroot(); STATIC int ufs_swapvp(); /* XXX */ -void sbupdate(); +STATIC void sbupdate(); struct vfsops ufs_vfsops = { ufs_mount, @@ -88,10 +64,6 @@ struct vfsops ufs_vfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; extern int ufsfstype; @@ -101,7 +73,7 @@ extern int ufsfstype; * UNIX is running off the mini-root. That probably wants to be done * differently. */ -struct vnode *rootvp; +extern struct vnode *rootvp; STATIC int ufs_mount(vfsp, mvp, uap, cr) @@ -236,6 +208,7 @@ ufs_mountroot(vfsp, why) (void)ufs_iflush(vfsp); #endif binval(vfsp->vfs_dev); + fbinval(vfsp); fsp = getfs(vfsp); if (fsp->fs_state == FSACTIVE) return EINVAL; @@ -264,10 +237,8 @@ ufs_mountroot(vfsp, why) /* to mountfs (in S5 case too?) */ if (error) { vfs_unlock(vfsp); - if (rootvp) { - VN_RELE(rootvp); - rootvp = (struct vnode *)0; - } + VN_RELE(rootvp); + rootvp = (struct vnode *)0; return (error); } vfs_add((struct vnode *)0, vfsp, @@ -426,10 +397,8 @@ mountfs(vfsp, why, dev, path, cr, isroot) bwrite(tp); tp = 0; } else { - if (why != ROOT_INIT) { - error = ENOSPC; - goto out; - } + error = ENOSPC; + goto out; } } @@ -521,8 +490,7 @@ unmount1(vfsp, forcibly, cr) struct vnode *bvp, *rvp; struct inode *rip; struct buf *bp; - extern int updlock; - + if (!suser(cr)) return (EPERM); @@ -554,9 +522,6 @@ unmount1(vfsp, forcibly, cr) bvp = ufsvfsp->vfs_devvp; kmem_free((caddr_t)fs->fs_csp[0], (u_int)fs->fs_cssize); flag = !fs->fs_ronly; - while(updlock) - (void)sleep((caddr_t)&updlock, PINOD); - updlock++; if (!fs->fs_ronly) { bflush(dev); fs->fs_time = hrestime.tv_sec; @@ -572,14 +537,14 @@ unmount1(vfsp, forcibly, cr) bp->b_flags |= B_AGE; brelse(bp); } - updlock = 0; - wakeup((caddr_t)&updlock); if (!stillopen) { (void) VOP_PUTPAGE(bvp, 0, 0, B_INVAL, cr); (void) VOP_CLOSE(bvp, flag, 1, 0, cr); VN_RELE(bvp); binval(dev); + fbinval(vfsp); ufs_iput(rip); + remque(rip); kmem_free((caddr_t)ufsvfsp, sizeof(struct ufsvfs)); } return (0); @@ -630,7 +595,7 @@ ufs_statvfs(vfsp, sp) sp->f_fsid = vfsp->vfs_dev; (char *) strcpy(sp->f_basetype, vfssw[vfsp->vfs_fstype].vsw_name); sp->f_flag = vf_to_stf(vfsp->vfs_flag); - sp->f_namemax = MAXNAMLEN; + sp->f_namemax = MAXNAMELEN; blk = fsp->fs_spc * fsp->fs_cpc / NSPF(fsp); for (i = 0; i < blk; i += fsp->fs_frag) /* void */; diff --git a/usr/src/uts/3b2/fs/ufs/ufs_vnops.c b/usr/src/uts/3b2/fs/ufs/ufs_vnops.c index f559d8b..7a9dac3 100644 --- a/usr/src/uts/3b2/fs/ufs/ufs_vnops.c +++ b/usr/src/uts/3b2/fs/ufs/ufs_vnops.c @@ -5,37 +5,13 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/ufs/ufs_vnops.c 1.66" +#ident "@(#)fs:fs/ufs/ufs_vnops.c 1.50" #include #include #include #include #include -#include #include #include #include @@ -153,7 +129,6 @@ struct vnodeops ufs_vnodeops = { ufs_delmap, fs_poll, fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ fs_nosys, fs_nosys, @@ -162,30 +137,6 @@ struct vnodeops ufs_vnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* @@ -269,12 +220,9 @@ ufs_write(vp, uiop, ioflag, cr) */ uiop->uio_offset = ip->i_size; } - if (vp->v_type == VREG && uiop->uio_offset >= ip->i_size) { - if (ip->i_map) { - ILOCK(ip); + if (vp->v_type == VREG && uiop->uio_offset > ip->i_size) { + if (ip->i_map) ufs_freemap(ip); - IUNLOCK(ip); - } } error = rwip(ip, uiop, UIO_WRITE, ioflag); ITIMES(ip); @@ -341,8 +289,8 @@ rwip(ip, uio, rw, ioflag) register int n, on, mapon; register struct fs *fs; struct vnode *vp; + unsigned long int limit = uio->uio_limit << SCTRSHFT; int type, error, pagecreate; - rlim_t limit = uio->uio_limit; u_int flags; int iupdat_flag; long old_blocks; @@ -359,11 +307,6 @@ rwip(ip, uio, rw, ioflag) ASSERT(rw == UIO_READ || rw == UIO_WRITE); type = ip->i_mode & IFMT; ASSERT(type == IFREG || type == IFDIR || type == IFLNK); - vp = ITOV(ip); - if (MANDLOCK(vp, ip->i_mode) - && (error = chklock(vp, rw == UIO_READ ? FREAD : FWRITE, - uio->uio_offset, uio->uio_resid, uio->uio_fmode))) - return (error); if (uio->uio_offset < 0 || (uio->uio_offset + uio->uio_resid) < 0) return (EINVAL); if (uio->uio_resid == 0) @@ -371,6 +314,10 @@ rwip(ip, uio, rw, ioflag) if (rw == UIO_WRITE) { + if (type == IFREG && uio->uio_offset >= limit) { + error = EFBIG; + goto out; + } ip->i_flag |= INOACC; /* don't update ref time in getpage */ } else { ip->i_flag |= IACC; @@ -382,6 +329,7 @@ rwip(ip, uio, rw, ioflag) iupdat_flag = 0; } fs = ip->i_fs; + vp = ITOV(ip); do { off = uio->uio_offset & MAXBMASK; mapon = uio->uio_offset & MAXBOFFSET; @@ -401,13 +349,6 @@ rwip(ip, uio, rw, ioflag) base = segmap_getmap(segkmap, vp, off); if (rw == UIO_WRITE) { - if (type == IFREG && uio->uio_offset + n >= limit) { - if (uio->uio_offset >= limit) { - error = EFBIG; - goto out; - } - n = limit - uio->uio_offset; - } if (uio->uio_offset + n > ip->i_size) { /* * We are extending the length of the file. @@ -434,7 +375,7 @@ rwip(ip, uio, rw, ioflag) */ if (mapon == 0) { segmap_pagecreate(segkmap, base, - (u_int)n, 0); + (u_int)n, 0, 0, 0); pagecreate = 1; } else pagecreate = 0; @@ -454,7 +395,7 @@ rwip(ip, uio, rw, ioflag) (void) segmap_release(segkmap, base, 0); break; } - segmap_pagecreate(segkmap, base, (u_int)n, 0); + segmap_pagecreate(segkmap, base, (u_int)n, 0, 0, 0); pagecreate = 1; } else pagecreate = 0; @@ -529,11 +470,8 @@ rwip(ip, uio, rw, ioflag) flags = SM_WRITE | SM_ASYNC | SM_DONTNEED; } - if (ip->i_map) { - ILOCK(ip); + if (ip->i_map) ufs_freemap(ip); - IUNLOCK(ip); - } ip->i_flag |= IUPD | ICHG; if (u.u_cred->cr_uid != 0) ip->i_mode &= ~(ISUID | ISGID); @@ -640,7 +578,7 @@ ufs_getattr(vp, vap, flags, cr) vap->va_blksize = fsp->fs_fsize; break; } - vap->va_nblocks = ip->i_blocks; + vap->va_nblocks = dbtofsb(fsp, ip->i_blocks); return (0); } @@ -690,6 +628,8 @@ ufs_setattr(vp, vap, flags, cr) ip->i_mode &= ~ISGID; } ip->i_flag |= ICHG; + if ((vp->v_flag & VTEXT) && ((ip->i_mode & ISVTX) == 0)) + xrele(vp); } if (mask & (AT_UID|AT_GID)) { int checksu = 0; @@ -963,7 +903,7 @@ ufs_create(dvp, name, vap, excl, mode, vpp, cr) * nothing more we can do here because the resultant vnode may * be of a different file system type. */ - if (ip != NULL && ITOV(ip)->v_vfsmountedhere) { + if (error == 0 && ITOV(ip)->v_vfsmountedhere) { vnode_t *vp = ITOV(ip); ufs_iunlock(ip); @@ -1133,13 +1073,6 @@ ufs_rename(sdvp, snm, tdvp, tnm, cr) goto out; } - /* - * POSIX 1003.3 requires write permission on a directory in order - * to rename it. - */ - if ((sip->i_mode & IFMT) == IFDIR - && (error = ufs_iaccess(sip, IWRITE, cr)) != 0) - goto out; /* * Link source to the target. */ @@ -1287,13 +1220,12 @@ ufs_readdir(vp, uiop, cr, eofp) /* Read in the next chunk */ if (error = fbread(vp, (long)offset, bytes_wanted, S_OTHER, &fbp)) goto out; - ip->i_flag |= IACC; + incount = 0; idp = (struct direct *)fbp->fb_addr; if (idp->d_ino == 0 && idp->d_reclen == 0 && idp->d_namlen == 0) { cmn_err(CE_WARN, "ufs_readir: bad dir, inumber = %d\n", ip->i_number); - fbrelse(fbp, S_OTHER); error = ENXIO; goto out; } @@ -1698,6 +1630,12 @@ ufs_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) bp->b_dev = cmpdev(dev); bp->b_blkno = fsbtodb(fs, bn) + btodb(blkoff(fs, io_off)); +#if 0 + bp->b_un.b_addr = 0; +#else + pgaddr = pfntokv(page_pptonum(pp)); + bp->b_un.b_addr = (caddr_t)pgaddr; +#endif /* * Zero part of page which we are not @@ -1792,8 +1730,12 @@ ufs_getapage(vp, off, protp, pl, plsz, seg, addr, rw, cr) bp2->b_dev = cmpdev(dev); bp2->b_blkno = fsbtodb(fs, bn2) + btodb(blkoff(fs, io_off)); +#if 0 bp2->b_un.b_addr = (caddr_t)pgoff; - +#else + pgaddr = pfntokv(page_pptonum(pp2)); + bp2->b_un.b_addr = (caddr_t)(pgaddr + pgoff); +#endif /* * Zero part of page which we are not * going to be reading from disk now. @@ -1951,8 +1893,11 @@ ufs_writelbn(ip, bn, pp, len, pgoff, flags) bp->b_dev = cmpdev(ip->i_dev); bp->b_blkno = bn; bp->b_blkno = bn; +#if 0 bp->b_un.b_addr = (addr_t)pgoff; - +#else + bp->b_un.b_addr = (caddr_t)pfntokv(page_pptonum(pp)) + pgoff; +#endif (*bdevsw[getmajor(ip->i_dev)].d_strategy)(bp); /* @@ -2072,20 +2017,27 @@ ufs_putpage(vp, off, len, flags, cr) */ ip->i_nextr = 0; + /* + * If the modified time on the inode has not already been + * set elsewhere (e.g. for write/setattr) and this is not + * a call from msync (B_FORCE) we set the time now. + * This gives us approximate modified times for mmap'ed files + * which are modified via stores in the user address space. + */ + if ((ip->i_flag & IMODTIME) == 0 || (flags & B_FORCE)) { + ip->i_flag |= IUPD; + ITIMES(ip); + } /* * This is an attempt to clean up loose ends left by * applications that store into mapped files. It's * insufficient, strictly speaking, for ill-behaved * applications, but about the best we can do. */ - if ((ip->i_flag & IMODTIME) == 0 || (flags & B_FORCE)) { - ip->i_flag |= IUPD; - ITIMES(ip); - if (vp->v_type == VREG) { - ILOCK(ip); - err = fs_vcode(vp, &ip->i_vcode); - IUNLOCK(ip); - } + if (vp->v_type == VREG) { + ILOCK(ip); + err = fs_vcode(vp, &ip->i_vcode); + IUNLOCK(ip); } } @@ -2105,8 +2057,8 @@ ufs_putpage(vp, off, len, flags, cr) * any dirty pages, we only need to use S_OTHER * here and we should not get back a bn == UFS_HOLE. */ - if (err = ufs_bmap(ip, lbn, &bn, (daddr_t *)0, bsize, S_WRITE, - 1)) + if (err = ufs_bmap(ip, lbn, &bn, (daddr_t *)0, bsize, S_OTHER, + 0)) break; ASSERT(bn != UFS_HOLE); @@ -2243,9 +2195,7 @@ ufs_map(vp, off, as, addrp, len, prot, maxprot, flags, cr) (void) as_unmap(as, *addrp, len); } - ILOCK(VTOI(vp)); error = ufs_allocmap(VTOI(vp)); - IUNLOCK(VTOI(vp)); if (error == 0) return (error); vn_a.vp = vp; @@ -2261,11 +2211,11 @@ ufs_map(vp, off, as, addrp, len, prot, maxprot, flags, cr) /* ARGSUSED */ STATIC int -ufs_addmap(vp, off, as, addr, len, prot, maxprot, flags, cr) +ufs_addmap(vp, off, as, addrp, len, prot, maxprot, flags, cr) struct vnode *vp; uint off; struct as *as; - addr_t addr; + addr_t *addrp; uint len; u_char prot, maxprot; uint flags; @@ -2280,11 +2230,11 @@ ufs_addmap(vp, off, as, addr, len, prot, maxprot, flags, cr) /*ARGSUSED*/ STATIC int -ufs_delmap(vp, off, as, addr, len, prot, maxprot, flags, cr) +ufs_delmap(vp, off, as, addrp, len, prot, maxprot, flags, cr) struct vnode *vp; u_int off; struct as *as; - addr_t addr; + addr_t *addrp; u_int len; u_int prot, maxprot; u_int flags; diff --git a/usr/src/uts/3b2/fs/vfs.c b/usr/src/uts/3b2/fs/vfs.c index 6f1fe3c..cbbaeb5 100644 --- a/usr/src/uts/3b2/fs/vfs.c +++ b/usr/src/uts/3b2/fs/vfs.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/vfs.c 1.35" +#ident "@(#)fs:fs/vfs.c 1.26" #include "sys/types.h" #include "sys/param.h" #include "sys/immu.h" @@ -83,6 +60,14 @@ mount(uap, rvp) struct vfsops *vfsops; register int error; int remount = 0, ovflags; +#ifdef RFSUNMOUNTHACK + struct pathname pn; + char *namecovered; + size_t coveredlen; + + extern size_t strnormlen(); + extern char *strnormcpy(); +#endif /* * Resolve second path name (mount point). @@ -93,7 +78,7 @@ mount(uap, rvp) VN_RELE(vp); return EBUSY; } - + dnlc_purge(); /* * Backward compatibility: require the user program to * supply a flag indicating a new-style mount, otherwise @@ -169,8 +154,40 @@ mount(uap, rvp) vfsp->vfs_flag &= ~VFS_RDONLY; } else { + + /* + * Storing the pathname is an interim measure allowing unmounts + * of file systems under untraversable pathnames, e.g., those + * on crashed NFS and RFS servers. A full solution will appear + * in a later release. + * + * NOTE: To be able to free the space used for the name + * later, we MUST call strnormlen before allocating, so that + * strlen + 1 will later give the correct size of the allocated + * storage. + */ + +#ifdef RFSUNMOUNTHACK + if (error = pn_get(uap->dir, UIO_USERSPACE, &pn)) { + VN_RELE(vp); + return error; + } + + if ((namecovered = + kmem_alloc((coveredlen = strnormlen(pn.pn_buf)) + 1, KM_SLEEP)) + == NULL) { + pn_free(&pn); + VN_RELE(vp); + return EBUSY; + } + (void)strnormcpy(namecovered, pn.pn_buf); + pn_free(&pn); +#endif if ((vfsp = (vfs_t *) kmem_alloc(sizeof(vfs_t), KM_SLEEP)) == NULL) { +#ifdef RFSUNMOUNTHACK + kmem_free(namecovered, coveredlen); +#endif VN_RELE(vp); return EBUSY; } @@ -184,20 +201,24 @@ mount(uap, rvp) if (error = vfs_lock(vfsp)) { VN_RELE(vp); if (!remount) { +#ifdef RFSUNMOUNTHACK + kmem_free(namecovered, coveredlen); +#endif kmem_free((caddr_t) vfsp, sizeof(struct vfs)); } return error; } - - dnlc_purge_vp(vp); - error = VFS_MOUNT(vfsp, vp, uap, u.u_cred); vfs_unlock(vfsp); if (error) { if (remount) vfsp->vfs_flag = ovflags; - else + else { +#ifdef RFSUNMOUNTHACK + kmem_free(namecovered, coveredlen); +#endif kmem_free((caddr_t) vfsp, sizeof(struct vfs)); + } VN_RELE(vp); } else { if (remount) { @@ -205,6 +226,9 @@ mount(uap, rvp) VN_RELE(vp); } else { vfs_add(vp, vfsp, uap->flags); +#ifdef RFSUNMOUNTHACK + vfsp->vfs_namecovered = namecovered; +#endif vp->v_vfsp->vfs_nsubmounts++; } } @@ -230,7 +254,7 @@ umount(uap, rvp) * Lookup user-supplied name. */ if (error = lookupname(uap->pathp, UIO_USERSPACE, FOLLOW, - NULLVPP, &fsrootvp)) + NULLVPP, &fsrootvp)) return error; /* * Find the vfs to be unmounted. The caller may have specified @@ -272,11 +296,7 @@ dounmount(vfsp, cr) if (error = vfs_lock(vfsp)) return error; - /* - * Purge all dnlc entries for this vfs. - */ - dnlc_purge_vfsp(vfsp, 0); - + dnlc_purge(); /* remove dnlc entries for this file sys */ VFS_SYNC(vfsp, 0, cr); if (error = VFS_UNMOUNT(vfsp, cr)) @@ -284,9 +304,13 @@ dounmount(vfsp, cr) else { --coveredvp->v_vfsp->vfs_nsubmounts; ASSERT(vfsp->vfs_nsubmounts == 0); + VN_RELE(coveredvp); vfs_remove(vfsp); +#ifdef RFSUNMOUNTHACK + kmem_free(vfsp->vfs_namecovered, + strlen(vfsp->vfs_vnodecovered) + 1); +#endif kmem_free((caddr_t)vfsp, (u_int)sizeof(*vfsp)); - VN_RELE(coveredvp); } return error; } @@ -296,12 +320,14 @@ dounmount(vfsp, cr) * each file system type, passing it a NULL vfsp to indicate that all * mounted file systems of that type should be updated. */ + void sync() { register int i; for (i = 1; i < nfstype; i++) - (void) (*vfssw[i].vsw_vfsops->vfs_sync)(NULL, 0, u.u_cred); + (void) (*vfssw[i].vsw_vfsops->vfs_sync) + (NULL, 0, u.u_cred); } /* ARGSUSED */ @@ -386,9 +412,9 @@ cstatvfs(vfsp, ubp) /* * statfs(2) and fstatfs(2) have been replaced by statvfs(2) and - * fstatvfs(2) and will be removed from the system in a near-future - * release. + * fstatvfs(2) and will be removed from the system in a near-future release. */ + struct statfsa { char *fname; struct statfs *sbp; @@ -456,8 +482,7 @@ cstatfs(vfsp, sbp, len) { struct statfs sfs; struct statvfs svfs; - register int error, i; - char *cp, *cp2; + register int error; register struct vfssw *vswp; if (len < 0 || len > sizeof(struct statfs)) @@ -475,26 +500,9 @@ cstatfs(vfsp, sbp, len) sfs.f_bfree = svfs.f_bfree * (svfs.f_frsize/512); sfs.f_files = svfs.f_files; sfs.f_ffree = svfs.f_ffree; - - cp = svfs.f_fstr; - cp2 = sfs.f_fname; - i = 0; - while (i++ < sizeof(sfs.f_fname)) - if (*cp != '\0') - *cp2++ = *cp++; - else - *cp2++ = '\0'; - while (*cp != '\0' - && i++ < (sizeof(svfs.f_fstr) - sizeof(sfs.f_fpack))) - cp++; - cp++; - cp2 = sfs.f_fpack; - i = 0; - while (i++ < sizeof(sfs.f_fpack)) - if (*cp != '\0') - *cp2++ = *cp++; - else - *cp2++ = '\0'; + bcopy(&svfs.f_fstr[0], sfs.f_fname, sizeof(sfs.f_fname)); + bcopy(&svfs.f_fstr[sizeof(sfs.f_fname)], sfs.f_fpack, + sizeof(sfs.f_fpack)); if ((vswp = vfs_getvfssw(svfs.f_basetype)) == NULL) sfs.f_fstyp = 0; else @@ -509,6 +517,7 @@ cstatfs(vfsp, sbp, len) /* * System call to map fstype numbers to names, and vice versa. */ + struct fsa { int opcode; }; @@ -557,7 +566,8 @@ sysfsind(uap, rvp) rval_t *rvp; { /* - * Translate fs identifier to an index into the vfssw structure. + * Translate fs identifier to an index into + * the vfssw structure. */ register struct vfssw *vswp; char fsbuf[FSTYPSZ]; @@ -659,6 +669,9 @@ vfs_mountroot() u.u_cdir = rootdir; VN_HOLD(u.u_cdir); u.u_rdir = NULL; +#ifdef RFSUNMOUNTHACK + rootvfs->vfs_namecovered = "/"; +#endif } /* @@ -754,7 +767,7 @@ vfs_lock(vfsp) } /* - * Unlock a locked filesystem. + * Unlock a locked filesystem. Panics if it's not locked. */ void vfs_unlock(vfsp) @@ -769,7 +782,7 @@ vfs_unlock(vfsp) */ if (vfsp->vfs_flag & VFS_MWAIT) { vfsp->vfs_flag &= ~VFS_MWAIT; - wakeprocs((caddr_t)vfsp, PRMPT); + wakeup((caddr_t)vfsp); } } @@ -870,7 +883,7 @@ vfsstray() } void -vfsinit() +fsinit() { register int i; diff --git a/usr/src/uts/3b2/fs/vncalls.c b/usr/src/uts/3b2/fs/vncalls.c index 72e7fad..ccf7505 100644 --- a/usr/src/uts/3b2/fs/vncalls.c +++ b/usr/src/uts/3b2/fs/vncalls.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/vncalls.c 1.95" +#ident "@(#)fs:fs/vncalls.c 1.66" /* * System call routines for operations on files. These manipulate * the global and per-process file table entries which refer to @@ -109,7 +86,10 @@ #include "sys/disp.h" #include "sys/mkdev.h" #include "sys/time.h" -#include "sys/unistd.h" + +#include "rpc/types.h" +#define NFSSERVER +#include "nfs/nfs.h" /* * Open a file. @@ -131,7 +111,7 @@ open(uap, rvp) register struct opena *uap; rval_t *rvp; { - return copen(uap->fname, (int)(uap->fmode-FOPEN), uap->cmode, rvp); + return copen(uap->fname, (int)(uap->fmode - FOPEN), uap->cmode, rvp); } /* @@ -164,9 +144,7 @@ copen(fname, filemode, createmode, rvp) vnode_t *vp; file_t *fp; register int error; - int fd, dupfd; - enum vtype type; - enum create crwhy; + int fd; if ((filemode & (FREAD|FWRITE)) == 0) return EINVAL; @@ -176,34 +154,11 @@ copen(fname, filemode, createmode, rvp) if (error = falloc((vnode_t *)NULL, filemode & FMASK, &fp, &fd)) return error; - - /* - * Last arg is a don't-care term if !(filemode & FCREAT). - */ error = vn_open(fname, UIO_USERSPACE, filemode, - (int)((createmode & MODEMASK) & ~u.u_cmask), &vp, CRCREAT); + (int)((createmode & MODEMASK) & ~u.u_cmask), &vp); if (error) { setf(fd, NULLFP); unfalloc(fp); - } else if (vp->v_flag & VDUP) { - /* - * Special handling for /dev/fd. Give up the file pointer - * and dup the indicated file descriptor (in v_rdev). This - * is ugly, but I've seen worse. - */ - setf(fd, NULLFP); - unfalloc(fp); - dupfd = getminor(vp->v_rdev); - type = vp->v_type; - vp->v_flag &= ~VDUP; - VN_RELE(vp); - if (type != VCHR) - return EINVAL; - if (error = getf(dupfd, &fp)) - return error; - setf(fd, fp); - fp->f_count++; - rvp->r_val1 = fd; } else { fp->f_vnode = vp; rvp->r_val1 = fd; @@ -230,9 +185,8 @@ close(uap, rvp) if (error = getf(uap->fdes, &fp)) return error; - error = closef(fp); setf(uap->fdes, NULLFP); - return error; + return closef(fp); } /* @@ -384,6 +338,19 @@ rdwr(fp, uio, rvp, mode) } vp = fp->f_vnode; type = vp->v_type; + if (type == VREG || type == VDIR) { + /* + * Make sure that the user can write all the way up + * to the rlimit value. + */ + if (type == VREG && mode == FWRITE) { + register ulong rlimit = + u.u_rlimit[RLIMIT_FSIZE].rlim_cur - fp->f_offset; + /* LINTED */ + if (rlimit < uio->uio_resid && rlimit > 0) + uio->uio_resid = rlimit; + } + } count = uio->uio_resid; uio->uio_offset = fp->f_offset; uio->uio_segflg = UIO_USERSPACE; @@ -395,21 +362,17 @@ rdwr(fp, uio, rvp, mode) if (fp->f_flag & FSYNC) ioflag |= IO_SYNC; VOP_RWLOCK(vp); - if (setjmp(&u.u_qsav)) { - error = EINTR; - } else { + if (setjmp(&u.u_qsav)) + error = intrerr(uio->uio_resid == count); + else { if (mode == FREAD) { error = VOP_READ(vp, uio, ioflag, fp->f_cred); } else { error = VOP_WRITE(vp, uio, ioflag, fp->f_cred); } } - VOP_RWUNLOCK(vp); - if (error == EINTR && uio->uio_resid != count) - error = 0; - rvp->r_val1 = count - uio->uio_resid; u.u_ioch += (unsigned)rvp->r_val1; if (type == VFIFO) /* Backward compatibility */ @@ -620,17 +583,13 @@ cmknod(version, fname, fmode, dev, rvp) if (vattr.va_type == VCHR || vattr.va_type == VBLK || vattr.va_type == VXNAM) { if (version == MKNOD_VER && vattr.va_type != VXNAM) { - if (dev == (dev_t)NODEV || - getemajor(dev) == (dev_t)NODEV) - - return EINVAL; - else + if (dev != (u_int)NODEV) vattr.va_rdev = dev; + else + return EINVAL; } else { /* dev is in old format */ - if ((emajor(dev)) == (dev_t)NODEV || - dev == (dev_t)NODEV) - + if ((emajor(dev)) > O_MAXMAJ) return EINVAL; else vattr.va_rdev = expdev(dev); @@ -1191,72 +1150,6 @@ xcstat(vp, ubp) return error; } -#if defined(__STDC__) -STATIC int cpathconf(vnode_t *, int, rval_t *); -#else -STATIC int cpathconf(); -#endif - -/* fpathconf/pathconf interfaces */ - -struct fpathconfa { - int fdes; - int name; -}; - -/* ARGSUSED */ -int -fpathconf(uap, rvp) - register struct fpathconfa *uap; - rval_t *rvp; -{ - file_t *fp; - register int error; - - if (error = getf(uap->fdes, &fp)) - return error; - return cpathconf(fp->f_vnode, uap->name, rvp); -} - -struct pathconfa { - char *fname; - int name; -}; - -/* ARGSUSED */ -int -pathconf(uap, rvp) - register struct pathconfa *uap; - rval_t *rvp; -{ - vnode_t *vp; - register int error; - - if (error = lookupname(uap->fname, UIO_USERSPACE, - FOLLOW, NULLVPP, &vp)) - return error; - error = cpathconf(vp, uap->name, rvp); - VN_RELE(vp); - return error; -} -/* - * Common code for pathconf(), fpathconf() system calls - */ -STATIC int -cpathconf(vp, cmd, rvp) - register vnode_t *vp; - int cmd; - rval_t *rvp; -{ - register int error; - u_long val; - - if ((error = VOP_PATHCONF(vp, cmd, &val, u.u_cred)) == 0) - rvp->r_val1 = val; - - return error; -} - /* * Read the contents of a symbolic link. */ @@ -1365,15 +1258,12 @@ chown(uap, rvp) { struct vattr vattr; - if (uap->uid < (uid_t)-1 || uap->uid > MAXUID - || uap->gid < (gid_t)-1 || uap->gid > MAXUID) - return EINVAL; vattr.va_uid = uap->uid; vattr.va_gid = uap->gid; vattr.va_mask = 0; - if (vattr.va_uid != (uid_t)-1) + if (vattr.va_uid != -1) vattr.va_mask |= AT_UID; - if (vattr.va_gid != (gid_t)-1) + if (vattr.va_gid != -1) vattr.va_mask |= AT_GID; return namesetattr(uap->fname, FOLLOW, &vattr, 0); } @@ -1386,15 +1276,12 @@ lchown(uap, rvp) { struct vattr vattr; - if (uap->uid < (uid_t)-1 || uap->uid > MAXUID - || uap->gid < (gid_t)-1 || uap->gid > MAXUID) - return EINVAL; vattr.va_uid = uap->uid; vattr.va_gid = uap->gid; vattr.va_mask = 0; - if (vattr.va_uid != (uid_t)-1) + if (vattr.va_uid != -1) vattr.va_mask |= AT_UID; - if (vattr.va_gid != (gid_t)-1) + if (vattr.va_gid != -1) vattr.va_mask |= AT_GID; return namesetattr(uap->fname, NO_FOLLOW, &vattr, 0); } @@ -1416,15 +1303,12 @@ fchown(uap, rvp) { struct vattr vattr; - if (uap->uid < (uid_t)-1 || uap->uid > MAXUID - || uap->gid < (gid_t)-1 || uap->gid > MAXUID) - return EINVAL; vattr.va_uid = uap->uid; vattr.va_gid = uap->gid; vattr.va_mask = 0; - if (vattr.va_uid != (uid_t)-1) + if (vattr.va_uid != -1) vattr.va_mask |= AT_UID; - if (vattr.va_gid != (gid_t)-1) + if (vattr.va_gid != -1) vattr.va_mask |= AT_GID; return fdsetattr(uap->fd, &vattr); } @@ -1449,7 +1333,7 @@ chsize(uap, rvp) struct flock bf; if (uap->size < 0L || uap->size > u.u_rlimit[RLIMIT_FSIZE].rlim_cur) - return EFBIG; + return EINVAL; if (error = getf(uap->fdes, &fp)) return error; if ((fp->f_flag & FWRITE) == 0) @@ -1457,6 +1341,11 @@ chsize(uap, rvp) vp = fp->f_vnode; if (vp->v_type != VREG) return EINVAL; /* could have better error */ + if (vp->v_flag & VTEXT) { + xrele(vp); /* try once to free text */ + if (vp->v_flag & VTEXT) + return ETXTBSY; + } bf.l_whence = 0; bf.l_start = uap->size; bf.l_type = F_WRLCK; @@ -1488,19 +1377,11 @@ rdchk(uap, rvp) return EBADF; vp = fp->f_vnode; if (vp->v_type == VCHR || vp->v_type == VFIFO) { - if (vp->v_type == VCHR) { - error = spec_rdchk(vp, u.u_cred, &rvp->r_val1); - } - else if (vp->v_type == VFIFO) { - vattr.va_mask = AT_SIZE; - if (error = VOP_GETATTR(vp, &vattr, 0, u.u_cred)) - return error; - if (vattr.va_size > 0 || fifo_rdchk(vp) <= 0 - || fp->f_flag & (FNDELAY|FNONBLOCK)) - rvp->r_val1 = 1; - else - rvp->r_val1 = 0; - } + vattr.va_mask = AT_SIZE; + if (error = VOP_GETATTR(vp, &vattr, 0, u.u_cred)) + return error; + /* LINTED */ + rvp->r_val1 = (vattr.va_size > 0); } else rvp->r_val1 = 1; @@ -1580,11 +1461,16 @@ locking(uap, rvp) bf.l_len = uap->size; } - error = VOP_FRLOCK(fp->f_vnode, cmd, &bf, fp->f_flag, - fp->f_offset, fp->f_cred); - - if (!error && uap->mode != LK_UNLCK) + if ((error = VOP_FRLOCK(fp->f_vnode, cmd, &bf, fp->f_flag, + fp->f_offset, fp->f_cred)) != 0) { + if (error == EAGAIN) + error = EACCES; + } else if (uap->mode != LK_UNLCK) { + /* + * Turn on lock-enforcement bit. + */ fp->f_vnode->v_flag |= VXLOCKED; + } return error; } @@ -1701,6 +1587,11 @@ struct fcntla { int arg; }; +struct f_cnvt_arg { + fhandle_t *fh; + int filemode; +}; + int fcntl(uap, rvp) register struct fcntla *uap; @@ -1713,7 +1604,13 @@ fcntl(uap, rvp) int flag, fd; struct flock bf; struct o_flock obf; - char flags; + /* the next 7 are for NFS file/record locks */ + struct f_cnvt_arg a; + register struct f_cnvt_arg *ap; + fhandle_t tfh; + register int filemode; + int mode; + struct vnode *myfhtovp(); extern struct fileops vnodefops; if (error = getf(uap->fdes, &fp)) @@ -1730,9 +1627,6 @@ fcntl(uap, rvp) error = EINVAL; else if ((error = ufalloc(i, &fd)) == 0) { setf(fd, fp); - flags = getpof(fd); - flags = flags & ~FCLOSEXEC; - setpof(fd, flags); fp->f_count++; rvp->r_val1 = fd; break; @@ -1772,9 +1666,9 @@ fcntl(uap, rvp) error = EFAULT; break; } - if ((uap->cmd == F_SETLK || uap->cmd == F_SETLKW) && - bf.l_type != F_UNLCK) { - setpof(uap->fdes, getpof(uap->fdes)|UF_FDLOCK); + if (bf.l_type != F_UNLCK) { + u.u_procp->p_flag |= SLKDONE; + setpof (uap->fdes, getpof(uap->fdes) | UF_FDLOCK); } if (error = VOP_FRLOCK(vp, uap->cmd, &bf, flag, offset, fp->f_cred)) { @@ -1785,20 +1679,6 @@ fcntl(uap, rvp) error = EACCES; break; } - - /* - * If command is GETLK and no lock is found, only - * the type field is changed. - */ - if ((uap->cmd == F_O_GETLK || uap->cmd == F_GETLK) - && bf.l_type == F_UNLCK) { - if (copyout((caddr_t)&bf.l_type, - (caddr_t)&((struct flock *)uap->arg)->l_type, - sizeof(bf.l_type))) - error = EFAULT; - break; - } - if (uap->cmd == F_O_GETLK) { /* * Return an SVR3 flock structure to the user. @@ -1828,6 +1708,7 @@ fcntl(uap, rvp) int i; for (i = 0; i < 4; i++) + /* Initialize pad until it's allocated. */ bf.pad[i] = 0; if (copyout((caddr_t)&bf, (caddr_t)uap->arg, sizeof bf)) error = EFAULT; @@ -1847,6 +1728,9 @@ fcntl(uap, rvp) error = EFAULT; break; } + if (bf.l_type != F_UNLCK) { + u.u_procp->p_flag |= SLKDONE; + } if (error = VOP_FRLOCK(vp, uap->cmd, &bf, flag, offset, fp->f_cred)) { /* @@ -1861,6 +1745,126 @@ fcntl(uap, rvp) error = EFAULT; break; + /* + * F_CNVT fcntl: given a pointer to an fhandle_t and a mode, open + * the file corresponding to the fhandle_t with the given mode and + * return a file descriptor. Note: uap->fd is unused. + */ + case F_CNVT: + if (!suser(u.u_cred)) { + error = EPERM; + break; + } + + if (error = copyin((caddr_t) uap->arg, (caddr_t) &a, sizeof(a))) { + break; + } + else + ap = &a; + if (error = copyin((caddr_t) ap->fh, (caddr_t) &tfh, sizeof(tfh))) { + break; + } + + filemode = ap->filemode - FOPEN; + if (filemode & FCREAT) { + error = EINVAL; + break; + } + mode = 0; + if (filemode & FREAD) + mode |= VREAD; + if (filemode & (FWRITE | FTRUNC)) + mode |= VWRITE; + + /* + * Adapted from copen: + */ + error = falloc((struct vnode *)NULL, filemode & FMASK, + &fp, &fd); + if (error) + return error; + + /* + * This takes the place of lookupname in copen. Note that + * we can't use the normal fhtovp function because we want + * this to work on files that may not have been exported. + */ + if ((vp = myfhtovp(&tfh)) == (struct vnode *) NULL) { + error = ESTALE; + goto out; + } + + /* + * Adapted from vn_open: + */ + if (filemode & (FWRITE | FTRUNC)) { + struct vattr vattr; + + if (vp->v_type == VDIR) { + error = EISDIR; + goto out; + } + if (vp->v_vfsp->vfs_flag & VFS_RDONLY) { + error = EROFS; + goto out; + } + /* + * If there's shared text associated with + * the vnode, try to free it up once. + * If we fail, we can't allow writing. + */ + if (vp->v_flag & VTEXT) { + xrele(vp); + if (vp->v_flag & VTEXT) { + error = ETXTBSY; + goto out; + } + } + /* + * Can't truncate files on which mandatory locking + * is in effect. + */ + if ((filemode & FTRUNC) && vp->v_filocks != NULL) { + vattr.va_mask = AT_MODE; + if ((error = VOP_GETATTR(vp, &vattr, 0, u.u_cred)) == 0 + && MANDLOCK(vp, vattr.va_mode)) + error = EAGAIN; + } + if (error) + goto out; + } + /* + * Check permissions. + * Must have read and write permission to open a file for + * private access. + */ + if (error = VOP_ACCESS(vp, mode, 0, u.u_cred)) { + goto out; + } + error = VOP_OPEN(&vp, filemode, u.u_cred); + if ((error == 0) && (filemode & FTRUNC)) { + struct vattr vattr; + + vattr.va_size = 0; + vattr.va_mask = AT_SIZE; + error = VOP_SETATTR(vp, &vattr, 0, u.u_cred); + } + if (error) + goto out; + + /* + * Adapted from copen: + */ + fp->f_vnode = vp; + rvp->r_val1 = fd; + break; +out: + crfree(fp->f_cred); + fp->f_count = 0; + if (vp) + VN_RELE(vp); + break; + case F_CHKFL: /* * This is for internal use only, to allow the vnode layer @@ -1888,6 +1892,22 @@ fcntl(uap, rvp) VOP_SPACE(vp, uap->cmd, &bf, flag, offset, fp->f_cred); break; + case F_BLOCKS: + case F_BLKSIZE: + { + struct vattr vattr; + long int n; + + vattr.va_mask = AT_BLKSIZE | AT_NBLOCKS; + if (error = VOP_GETATTR(vp, &vattr, 0, u.u_cred)) + break; + n = (uap->cmd == F_BLOCKS) ? + vattr.va_nblocks : vattr.va_blksize; + if (copyout((caddr_t)&n, (caddr_t)uap->arg, sizeof(long))) + error = EFAULT; + break; + } + default: error = EINVAL; break; @@ -1896,6 +1916,29 @@ fcntl(uap, rvp) return error; } +/* + * We require a version of fhtovp that simply converts an fhandle_t to + * a vnode without any ancillary checking (e.g., whether it's exported). + */ +STATIC struct vnode * +myfhtovp(fh) + fhandle_t *fh; +{ + int error; + struct vnode *vp; + register struct vfs *vfsp; + + vfsp = getvfs(&fh->fh_fsid); + if (vfsp == (struct vfs *) NULL) { + return ((struct vnode *) NULL); + } + error = VFS_VGET(vfsp, &vp, (struct fid *)&(fh->fh_len)); + if (error || vp == (struct vnode *) NULL) { + return ((struct vnode *) NULL); + } + return (vp); +} + /* * Duplicate a file descriptor. */ @@ -1945,6 +1988,8 @@ ioctl(uap, rvp) if (error = getf(uap->fdes, &fp)) return error; + if (setjmp(&u.u_qsav)) + return intrerr(1); vp = fp->f_vnode; if (vp->v_type == VREG || vp->v_type == VDIR) { @@ -2127,14 +2172,13 @@ poll(uap, rvp) savehp = NULL; } curdat = darray; - php = NULL; for (i = 0; i < uap->nfds; i++) { + php = NULL; if (pollp[i].fd < 0) pollp[i].revents = 0; else if (pollp[i].fd >= u.u_nofiles || getf(pollp[i].fd, &fp)) pollp[i].revents = POLLNVAL; else { - php = NULL; error = VOP_POLL(fp->f_vnode, pollp[i].events, fdcnt, &pollp[i].revents, &php); if (error) diff --git a/usr/src/uts/3b2/fs/vnode.c b/usr/src/uts/3b2/fs/vnode.c index 3d01897..ad5d818 100644 --- a/usr/src/uts/3b2/fs/vnode.c +++ b/usr/src/uts/3b2/fs/vnode.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)fs:fs/vnode.c 1.31" +#ident "@(#)fs:fs/vnode.c 1.19" #include "sys/types.h" #include "sys/param.h" #include "sys/psw.h" @@ -102,6 +79,8 @@ vn_rdwr(rw, vp, base, len, offset, seg, ioflag, ulimit, cr, residp) if (rw == UIO_WRITE) { uio.uio_fmode = FWRITE; error = VOP_WRITE(vp, &uio, ioflag, cr); + if (error == EFBIG) + psignal(u.u_procp, SIGXFSZ); } else { uio.uio_fmode = FREAD; error = VOP_READ(vp, &uio, ioflag, cr); @@ -131,16 +110,15 @@ vn_rele(vp) * Open/create a vnode. * This may be callable by the kernel, the only known use * of user context being that the current user credentials - * are used for permissions. crwhy is defined iff filemode & FCREAT. + * are used for permissions. */ int -vn_open(pnamep, seg, filemode, createmode, vpp, crwhy) +vn_open(pnamep, seg, filemode, createmode, vpp) char *pnamep; enum uio_seg seg; register int filemode; int createmode; struct vnode **vpp; - enum create crwhy; { struct vnode *vp; register int mode; @@ -177,7 +155,7 @@ vn_open(pnamep, seg, filemode, createmode, vpp, crwhy) */ PREEMPT(); if (error = - vn_create(pnamep, seg, &vattr, excl, mode, &vp, crwhy)) + vn_create(pnamep, seg, &vattr, excl, mode, &vp, CRCREAT)) return error; PREEMPT(); } else { @@ -202,6 +180,18 @@ vn_open(pnamep, seg, filemode, createmode, vpp, crwhy) error = EROFS; goto out; } + /* + * If there's shared text associated with + * the vnode, try to free it up once. + * If we fail, we can't allow writing. + */ + if (vp->v_flag & VTEXT) { + xrele(vp); + if (vp->v_flag & VTEXT) { + error = ETXTBSY; + goto out; + } + } /* * Can't truncate files on which mandatory locking * is in effect. @@ -234,9 +224,7 @@ vn_open(pnamep, seg, filemode, createmode, vpp, crwhy) vattr.va_size = 0; vattr.va_mask = AT_SIZE; - if ((error = VOP_SETATTR(vp, &vattr, 0, u.u_cred)) != 0) { - (void)VOP_CLOSE(vp, filemode, 1, 0, u.u_cred); - } + error = VOP_SETATTR(vp, &vattr, 0, u.u_cred); } out: if (error) { @@ -291,8 +279,6 @@ vn_create(pnamep, seg, vap, excl, mode, vpp, why) error = lookuppn(&pn, FOLLOW, &dvp, vpp); if (error) { pn_free(&pn); - if (why == CRMKDIR && error == EINVAL) - error = EEXIST; /* SVID */ return error; } @@ -305,24 +291,19 @@ vn_create(pnamep, seg, vap, excl, mode, vpp, why) error = EROFS; } else if (excl == NONEXCL && *vpp != NULL) { /* - * File is already there. If there is any - * active mandatory lock on the file, - * return EAGAIN. + * The file is already there. + * If we are writing, and there's a shared text + * associated with the vnode, try to free it up once. + * If we fail, we can't allow writing. */ - if ((*vpp)->v_filocks != NULL) { - struct vattr vattr; - if (error = VOP_GETATTR((*vpp), &vattr, 0, u.u_cred)) { - VN_RELE(*vpp); - return error; - } - if (MANDLOCK((*vpp), vattr.va_mode)) { - VN_RELE(*vpp); - return EAGAIN; - } + if ((mode & VWRITE) && ((*vpp)->v_flag & VTEXT)) { + xrele(*vpp); + if ((*vpp)->v_flag & VTEXT) + error = ETXTBSY; } /* - * We throw the vnode away to let VOP_CREATE - * truncate the file in a non-racy manner. + * We throw the vnode away to let VOP_CREATE truncate the + * file in a non-racy manner. */ VN_RELE(*vpp); } @@ -482,7 +463,6 @@ vn_remove(fnamep, seg, dirflag) struct pathname pn; /* name of entry */ enum vtype vtype; register int error; - register int rdonly; if (error = pn_get(fnamep, seg, &pn)) return error; @@ -500,29 +480,28 @@ vn_remove(fnamep, seg, dirflag) goto out; } - rdonly = ((vp->v_vfsp->vfs_flag & VFS_RDONLY) != 0); + /* + * Make sure filesystem is writeable. + */ + if (vp->v_vfsp->vfs_flag & VFS_RDONLY) { + error = EROFS; + goto out; + } /* * Don't unlink the root of a mounted filesystem, unless * it's marked unlinkable. */ if (vp->v_flag & VROOT) { - if (vp->v_vfsp->vfs_flag & VFS_UNLINKABLE) + if (vp->v_vfsp->vfs_flag & VFS_UNLINKABLE) { error = dounmount(vp->v_vfsp, u.u_cred); - else + vp->v_vfsp = NULL; + } else error = EBUSY; if (error) goto out; } - /* - * Make sure filesystem is writeable. - */ - if (rdonly) { - error = EROFS; - goto out; - } - /* * Release vnode before removing. */ diff --git a/usr/src/uts/3b2/fs/xnamfs/xnamvfsops.c b/usr/src/uts/3b2/fs/xnamfs/xnamvfsops.c index 8b3d56a..0b9cbe1 100644 --- a/usr/src/uts/3b2/fs/xnamfs/xnamvfsops.c +++ b/usr/src/uts/3b2/fs/xnamfs/xnamvfsops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/xnamfs/xnamvfsops.c 1.6" +#ident "@(#)fs:fs/xnamfs/xnamvfsops.c 1.5" #include "sys/types.h" #include "sys/param.h" #include "sys/buf.h" @@ -32,8 +32,4 @@ struct vfsops xnam_vfsops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; diff --git a/usr/src/uts/3b2/fs/xnamfs/xnamvnops.c b/usr/src/uts/3b2/fs/xnamfs/xnamvnops.c index d0089a2..cd0a866 100644 --- a/usr/src/uts/3b2/fs/xnamfs/xnamvnops.c +++ b/usr/src/uts/3b2/fs/xnamfs/xnamvnops.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/xnamfs/xnamvnops.c 1.12.1.6" +#ident "@(#)fs:fs/xnamfs/xnamvnops.c 1.12.1.4" #include "sys/types.h" #include "sys/param.h" #include "sys/systm.h" @@ -55,6 +55,7 @@ STATIC int xnam_close(); STATIC int xnam_getattr(); STATIC int xnam_setattr(); STATIC int xnam_access(); +STATIC int xnam_link(); STATIC int xnam_fsync(); STATIC void xnam_inactive(); STATIC int xnam_fid(); @@ -74,7 +75,7 @@ struct vnodeops xnam_vnodeops = { fs_nosys, /* lookup */ fs_nosys, /* create */ fs_nosys, /* remove */ - fs_nosys, /* link */ + xnam_link, /* link */ fs_nosys, /* rename */ fs_nosys, /* mkdir */ fs_nosys, /* rmdir */ @@ -98,7 +99,6 @@ struct vnodeops xnam_vnodeops = { fs_nosys, /* delmap */ fs_nosys, /* poll */ fs_nosys, /* dump */ - fs_pathconf, fs_nosys, /* filler */ fs_nosys, fs_nosys, @@ -107,30 +107,6 @@ struct vnodeops xnam_vnodeops = { fs_nosys, fs_nosys, fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, - fs_nosys, }; /* @@ -235,6 +211,16 @@ xnam_access(vp, mode, flags, cr) return VOP_ACCESS(VTOXNAM(vp)->x_realvp, mode, flags, cr); } +STATIC int +xnam_link(tdvp, vp, tnm, cr) + struct vnode *tdvp; + struct vnode *vp; + char *tnm; + struct cred *cr; +{ + return VOP_LINK(tdvp, VTOXNAM(vp)->x_realvp, tnm, cr); +} + STATIC int xnam_fsync(vp, cr) struct vnode *vp; diff --git a/usr/src/uts/3b2/fs/xnamfs/xsd.c b/usr/src/uts/3b2/fs/xnamfs/xsd.c index a96fe0b..29153ab 100644 --- a/usr/src/uts/3b2/fs/xnamfs/xsd.c +++ b/usr/src/uts/3b2/fs/xnamfs/xsd.c @@ -11,7 +11,7 @@ /* This Module contains Proprietary Information of Microsoft */ /* Corporation and should be treated as Confidential. */ -#ident "@(#)fs:fs/xnamfs/xsd.c 1.12" +#ident "@(#)fs:fs/xnamfs/xsd.c 1.11" /* * @(#)sd.c 1.5 87/06/22 @@ -575,7 +575,7 @@ sdlvcm(sdp) if (*flg & SDI_NTFY) { *flg &= ~(SDI_NTFY); - wakeprocs((caddr_t)sdp->sd_xnamnode, PRMPT); + wakeup((caddr_t)sdp->sd_xnamnode); } } diff --git a/usr/src/uts/3b2/fs/xnamfs/xsem.c b/usr/src/uts/3b2/fs/xnamfs/xsem.c index 98cc4bc..8c2717c 100644 --- a/usr/src/uts/3b2/fs/xnamfs/xsem.c +++ b/usr/src/uts/3b2/fs/xnamfs/xsem.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)fs:fs/xnamfs/xsem.c 1.8" +#ident "@(#)fs:fs/xnamfs/xsem.c 1.7" /* Copyright (c) 1987, 1988 Microsoft Corporation */ /* All Rights Reserved */ @@ -259,7 +259,7 @@ sigsem(uap, rvp) xp->x_sem->x_headw = fp->f_slnk; /* signal 1st waiting process, if there is one */ if((xp->x_sem->x_scount)++ < 0) - wakeprocs((caddr_t)xp->x_sem->x_headw, PRMPT); + wakeup((caddr_t)xp->x_sem->x_headw); xnammark(xp, XNAMACC); out: @@ -371,7 +371,7 @@ closesem(fp, vp) /* cause all processes waiting to error return */ for(tfp = tfp->f_slnk; tfp != NULL; tfp = tfp->f_slnk) { xp->x_sem->x_scount++; - wakeprocs((caddr_t) tfp, PRMPT); + wakeup((caddr_t) tfp); } xnammark(xp, XNAMCHG); xp->x_sem->x_headw = (struct file *)NULL; diff --git a/usr/src/uts/3b2/io/clone.c b/usr/src/uts/3b2/io/clone.c index 78f0b14..da1eae8 100644 --- a/usr/src/uts/3b2/io/clone.c +++ b/usr/src/uts/3b2/io/clone.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/clone.c 1.10" +#ident "@(#)kernel:io/clone.c 1.9" /* * Clone Driver. */ @@ -27,6 +27,7 @@ #include "sys/ddi.h" #include "sys/conf.h" #include "sys/debug.h" +#include "sys/inline.h" #include "sys/cred.h" #include "sys/mkdev.h" diff --git a/usr/src/uts/3b2/io/drivers.mk b/usr/src/uts/3b2/io/drivers.mk index fce42b7..1774a6c 100644 --- a/usr/src/uts/3b2/io/drivers.mk +++ b/usr/src/uts/3b2/io/drivers.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)kernel:io/drivers.mk 1.30" +#ident "@(#)kernel:io/drivers.mk 1.29" ROOT = STRIP = strip INC = $(ROOT)/usr/include @@ -462,7 +462,7 @@ sxt.o: sxt.c \ $(INC)/sys/termio.h \ $(INC)/sys/errno.h \ $(INC)/sys/strtty.h \ - $(INC)/sys/nsxt.h \ + $(INC)/sys/sxt.h \ $(INC)/sys/cmn_err.h \ $(FRC) diff --git a/usr/src/uts/3b2/io/emd.c b/usr/src/uts/3b2/io/emd.c index d8271c1..16a745c 100644 --- a/usr/src/uts/3b2/io/emd.c +++ b/usr/src/uts/3b2/io/emd.c @@ -5,12 +5,12 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)emd:io/emd.c 1.16" +#ident "@(#)emd:io/emd.c 1.9" typedef long CAPP; typedef long RAPP; -#define RQSIZE 10 -#define CQSIZE 25 +#define RQSIZE 8 +#define CQSIZE 8 #define NUM_QUEUES 3 #include "sys/cmn_err.h" @@ -31,6 +31,7 @@ typedef long RAPP; #include "sys/firmware.h" #include "sys/sbd.h" #include "sys/debug.h" +#include "sys/inline.h" #include "sys/systm.h" #include "sys/cred.h" #include "sys/dlpi.h" @@ -38,23 +39,13 @@ typedef long RAPP; #include "sys/emduser.h" #include "sys/emd.h" -/* just need sockaddr for inet statistics */ -struct sockaddr { - u_short sa_family; - char sa_data[14]; -}; - -#include "sys/kmem.h" -#include "net/if.h" - - /* * Streams interface information. */ STATIC int emdopen(), emdclose(), emdwput(), emdwsrv(); STATIC struct module_info emdm_info = { - EMD_MID, EMD_NAME, 0, EMDMAXPSZ-EHEADSIZE, EMD_HIWAT, EMD_LOWAT + EMD_MID, EMD_NAME, 1, EMDMAXPSZ-EHEADSIZE, EMD_HIWAT, EMD_LOWAT }; STATIC struct qinit emdrinit = { @@ -92,10 +83,6 @@ int emddevflag = 0; /* we support a new-style (SVR4) interface */ int emdlog = 0; #endif -extern int inetstats; /* from /etc/master.d/emd */ -extern struct ifstats *ifstats; /* per-interface statistics for inet */ -struct ifstats *emdstats; /* statistics for emd interface */ - /* * Routines defined in this file. */ @@ -116,7 +103,10 @@ STATIC void emdnonfatal(); STATIC void emdfatal(); STATIC void emd_domajors(); STATIC int getboard(); + +#ifdef UNUSED STATIC void emd_time(); +#endif /* * Initialize the EMD data structures. Called from @@ -136,27 +126,13 @@ emdinit() emd_emd[offset].emd_rdq = NULL; emd_emd[offset].emd_head = NULL; emd_emd[offset].emd_tail = NULL; - emd_emd[offset].emd_state = DL_UNBOUND; + emd_emd[offset].emd_state = 0; emd_emd[offset].emd_seq = 0; emd_emd[offset].emd_bid = board; emd_emd[offset].emd_sap = 0; } emd_binit(board); } - if (inetstats) { - if ((emdstats = (struct ifstats *)kmem_zalloc( - (sizeof(struct ifstats) * emd_nbds), KM_NOSLEEP)) - != (struct ifstats *)0) { - for (board = 0; board < emd_nbds; board++) { - emdstats[board].ifs_name = "emd"; - emdstats[board].ifs_unit = board+1; - emdstats[board].ifs_mtu = EMDMAXPSZ-EHEADSIZE; - emdstats[board].ifs_next = ifstats; - ifstats = &emdstats[board]; - } - } - } - return; } /* @@ -181,10 +157,9 @@ emd_binit(bid) for (index = 0; index < RQSIZE+RQSIZE; index++) emd_bd[bid].eb_ind[index] = NULL; emd_bd[bid].eb_state = EB_DOWN; - if (emd_bd[bid].eb_timeid) { /* reset the firmware timer */ + if (emd_bd[bid].eb_timeid) /* reset the firmware timer */ untimeout(emd_bd[bid].eb_timeid); - emd_bd[bid].eb_timeid = 0; - } + emd_bd[bid].eb_timeid = 0; return; } @@ -278,19 +253,8 @@ emdclose(q, flag, credp) if (emd_bd[ep->emd_bid].eb_state & EB_INIT) emd_bd[ep->emd_bid].eb_state = EB_DOWN; emd_bd[ep->emd_bid].eb_initep = NULL; - if (emd_bd[ep->emd_bid].eb_timeid) { - untimeout(emd_bd[ep->emd_bid].eb_timeid); - emd_bd[ep->emd_bid].eb_timeid = 0; - } } splx(s); - if (inetstats && emdstats) { - emdstats[ep->emd_bid].ifs_active = 0; - emdstats[ep->emd_bid].ifs_ipackets = 0; - emdstats[ep->emd_bid].ifs_ierrors = 0; - emdstats[ep->emd_bid].ifs_opackets = 0; - emdstats[ep->emd_bid].ifs_oerrors = 0; - } EMDLOG(EMD_MID, ep - emd_emd, 0, SL_TRACE, "EMD - close", 0); return(0); } @@ -381,15 +345,15 @@ emdwproc(ep, mp) register union DL_primitives *p; queue_t *rq; /* read queue */ struct iocblk *iocp; - unchar vector; - int i, j; + u_char vector; + int i; int len; paddr_t temp; ushort sap, type; struct ehead *hp; struct emd *nep; struct emd_board *bdp; - ulong id; + u_long id; int idx; int nacknum = 0; @@ -514,7 +478,7 @@ emdwproc(ep, mp) s = splemd(); BUMPSEQ(ep); id = emdmkid(ep-emd_emd, ep->emd_seq); - if (emdfw_job(id,_EIDLM,temp,ip->size,((ulong)(ip->address))>>8,ep->emd_bid,GE_QUE) != PASS) { + if (emdfw_job(id,_EIDLM,temp,ip->size,((u_long)(ip->address))>>8,ep->emd_bid,GE_QUE) != PASS) { splx(s); goto iocfail; } @@ -527,7 +491,7 @@ emdwproc(ep, mp) if (bdp->eb_state != EB_LOAD) goto iocfail; s = splemd(); - /* BUMPSEQ(ep); - probably a bug in the firmware */ + /* BUMPSEQ(ep); probably a bug in pupware [sar] */ id = emdmkid(ep-emd_emd, ep->emd_seq); if (emdfw_job(id,_EIFCF,*((long *)mp->b_cont->b_rptr),0,CS_STATUS,ep->emd_bid,GE_QUE) != PASS) { splx(s); @@ -638,14 +602,12 @@ emdwproc(ep, mp) } reqp = (dl_bind_req_t *)mp->b_rptr; sap = reqp->dl_sap; - for (j = 0; j < emd_maxdev; j++) { - i = (ep->emd_bid * emd_maxdev) + j; + for (i = 0; i < (emd_maxdev * emd_nbds); i++) if ((emd_emd[i].emd_state == DL_IDLE) && (sap == emd_emd[i].emd_sap)) { emdnonfatal(rq, mp, DL_BIND_REQ, DL_BADSAP, 0); return(1); } - } /* bind o.k., return dl_bind_ack_t */ if (!REUSEABLE(mp, sizeof(*ackp)+PHYAD_SIZE)) { @@ -679,8 +641,6 @@ emdwproc(ep, mp) ep->emd_state = DL_IDLE; ep->emd_sap = sap; putnext(rq, mp); - if (inetstats && emdstats) - emdstats[ep->emd_bid].ifs_active = 1; return(1); } @@ -719,8 +679,6 @@ emdwproc(ep, mp) ep->emd_state = DL_UNBOUND; ep->emd_sap = 0; putnext(rq, mp); - if (inetstats && emdstats) - emdstats[ep->emd_bid].ifs_active = 0; return(1); } @@ -748,29 +706,24 @@ emdwproc(ep, mp) mp->b_datap->db_type = M_PCPROTO; ackp = (dl_info_ack_t *)mp->b_wptr; ackp->dl_primitive = DL_INFO_ACK; - ackp->dl_max_sdu = EMDMAXPSZ-EHEADSIZE; + ackp->dl_max_sdu = EMDMAXPSZ-EMDMINPSZ; ackp->dl_min_sdu = 1; ackp->dl_addr_length = PHYAD_SIZE; ackp->dl_mac_type = DL_ETHER; ackp->dl_reserved = 0; ackp->dl_current_state = ep->emd_state; - ackp->dl_max_idu = EMDMAXPSZ-EHEADSIZE; + ackp->dl_max_idu = EMDMAXPSZ-EMDMINPSZ; ackp->dl_service_mode = DL_CLDLS; ackp->dl_qos_length = 0; ackp->dl_qos_offset = 0; ackp->dl_qos_range_length = 0; ackp->dl_qos_range_offset = 0; ackp->dl_provider_style = DL_STYLE1; + ackp->dl_addr_offset = sizeof(dl_info_ack_t); ackp->dl_growth = 0; - if (ep->emd_state == DL_IDLE) { - ackp->dl_addr_offset = sizeof(dl_info_ack_t); - mp->b_wptr += sizeof(dl_info_ack_t); - eiacpy(bdp->eb_addr, mp->b_wptr); - mp->b_wptr += PHYAD_SIZE; - } else { - ackp->dl_addr_offset = 0; - mp->b_wptr += sizeof(dl_info_ack_t); - } + mp->b_wptr += sizeof(dl_info_ack_t); + eiacpy(bdp->eb_addr, mp->b_wptr); + mp->b_wptr += PHYAD_SIZE; putnext(rq, mp); return(1); } @@ -779,6 +732,7 @@ emdwproc(ep, mp) { dl_unitdata_req_t *dp; unchar *ap; + int fillsz; struct ehead hdr; EMDLOG(EMD_MID, ep-emd_emd, 0, SL_TRACE, "EMD - datareq", 0); @@ -817,14 +771,29 @@ emdwproc(ep, mp) mp->b_wptr = mp->b_rptr + EHEADSIZE; /* - * Firmware pads packets. + * Pad packet if necessary. */ - len = EHEADSIZE; - for (tmp = mp->b_cont; tmp; tmp = tmp->b_cont) + len = 0; + for (tmp = mp; tmp; tmp = tmp->b_cont) len += tmp->b_wptr - tmp->b_rptr; - if ((len > EMDMAXPSZ) || (len == EHEADSIZE)) { + if (len > EMDMAXPSZ) { nacknum = EMD_PACK_SIZE; goto nackdata; + } else if (len < EMDMINPSZ) { + fillsz = EMDMINPSZ - len; + for (tmp = mp->b_cont; tmp->b_cont; tmp = tmp->b_cont) + ; + if ((tmp->b_datap->db_lim - tmp->b_wptr) >= fillsz) { + tmp->b_wptr += fillsz; + } else { + tmp->b_cont = allocb(fillsz, BPRI_MED); + if (!tmp->b_cont) { + nacknum = EMD_NOMEM; + goto nackdata; + } + tmp->b_cont->b_wptr += fillsz; + } + len += fillsz; } /* @@ -897,10 +866,7 @@ emdwproc(ep, mp) EMDLOG(EMD_MID, ep-emd_emd, 0, SL_TRACE, "EMD - gsend", 0); mp->b_prev = (mblk_t *)ep->emd_seq; emd_add(ep, mp); - emdtimeout(ep->emd_bid); splx(s); - if (inetstats && emdstats) - emdstats[ep->emd_bid].ifs_opackets++; return(1); } @@ -944,8 +910,6 @@ emdwproc(ep, mp) mp->b_datap->db_type = M_PCPROTO; putnext(rq, mp); EMDLOG(EMD_MID, ep-emd_emd, 0, SL_TRACE, "EMD - nacking data, num = %x", nacknum); - if (inetstats && emdstats) - emdstats[ep->emd_bid].ifs_oerrors++; return(1); } } @@ -977,7 +941,7 @@ emdint(bid) if (emdfw_attention(&c_entry, bid) != PASS) return(0); - if ((id = (ulong)c_entry.appl) == 0xffffffff) { + if ((id = (u_long)c_entry.appl) == 0xffffffff) { /* * This is an unsolicited queue entry - it * usually reports a transient problem such as @@ -1113,10 +1077,6 @@ emdcproc(bid, eidx, seqid) } emd_rmv(ep, mp); - if (emd_bd[bid].eb_timeid) { - untimeout(emd_bd[bid].eb_timeid); - emd_bd[bid].eb_timeid = 0; - } mp->b_prev = (mblk_t *)NULL; switch (mp->b_datap->db_type) { @@ -1164,7 +1124,7 @@ emdrproc(bid, index, mp) register mblk_t *bp; register ushort sap; struct ehead hdr; - unchar *sp, *dp; + u_char *sp, *dp; dp = mp->b_rptr; mp->b_rptr += PHYAD_SIZE; @@ -1180,8 +1140,6 @@ emdrproc(bid, index, mp) if (!canput(ep->emd_rdq->q_next)) { EMDLOG(EMD_MID, ep-emd_emd, 0, (SL_TRACE|SL_ERROR), "EMD: upstream queue full, dropping packet on floor", 0); - if (inetstats && emdstats) - emdstats[ep->emd_bid].ifs_ierrors++; free: freemsg(mp); return; @@ -1197,8 +1155,6 @@ emdrproc(bid, index, mp) bp->b_cont = mp; EMDLOG(EMD_MID, ep-emd_emd, 0, SL_TRACE, "EMD - received message %x\n", mp); putnext(ep->emd_rdq, bp); - if (inetstats && emdstats) - emdstats[ep->emd_bid].ifs_ipackets++; } /* @@ -1227,10 +1183,6 @@ emdterm(bid) /* reset the EMD board */ s = splemd(); EMD_RESET(bid); - if (emd_bd[bid].eb_timeid) { - untimeout(emd_bd[bid].eb_timeid); - emd_bd[bid].eb_timeid = 0; - } splx(s); emd_bd[bid].eb_state = EB_DOWN; @@ -1255,6 +1207,7 @@ emdterm(bid) } } +#ifdef UNUSED /* * This function gets called when a timer that was set timed out. * The timeout occured because the EMD hardware gave no response @@ -1280,20 +1233,21 @@ emd_time(board) emd_bd[board].eb_timeid = 0; /* reset the board timer */ EMD_RESET(board); /* reset the emd board */ emd_bd[board].eb_state = EB_DOWN; - cmn_err(CE_NOTE, "EMD: board slot %d timed out\n", - emd_bd[board].eb_major); return; } +#endif STATIC void emdtimeout(bid) int bid; { +#ifdef UNUSED if (emd_bd[bid].eb_timeid) untimeout(emd_bd[bid].eb_timeid); /*reset the timer */ /* start the timer again */ - emd_bd[bid].eb_timeid = timeout(emd_time, (caddr_t)bid, EMDTIME); + emd_bd[bid].eb_timeid = timeout(emd_time, bid, EMDTIME); return; +#endif } /* @@ -1302,10 +1256,10 @@ emdtimeout(bid) */ STATIC short emdfw_job(id, opcode, addr, size, subdev, bid, q) - ulong id; + u_long id; char opcode; /* firmware job opcode */ - ulong addr; /* address for the firmware */ - ulong size; /* size field for the firmware */ + u_long addr; /* address for the firmware */ + u_long size; /* size field for the firmware */ long subdev; /* sub-device number */ long bid; /* EMD board number */ long q; /* EMD firmware que */ @@ -1334,7 +1288,7 @@ emdfw_job(id, opcode, addr, size, subdev, bid, q) */ STATIC short emdfw_init(vect, bid) - unchar vect; + u_char vect; register long bid; /* EMD board number */ { register paddr_t temp; diff --git a/usr/src/uts/3b2/io/gentty.c b/usr/src/uts/3b2/io/gentty.c index 8b10350..a1e238a 100644 --- a/usr/src/uts/3b2/io/gentty.c +++ b/usr/src/uts/3b2/io/gentty.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/gentty.c 1.22" +#ident "@(#)kernel:io/gentty.c 1.20" /* * Indirect driver for controlling tty. */ @@ -29,11 +29,11 @@ #include "sys/ddi.h" #include "sys/debug.h" -int sydevflag = 0; +int sydevflag = 2; STATIC int sycheck(sp) - register sess_t *sp; +register sess_t *sp; { if (sp->s_dev == NODEV) return ENXIO; @@ -59,9 +59,11 @@ syopen(devp, flag, otyp, cr) sydev = sp->s_vp->v_rdev; if (cdevsw[getmajor(sydev)].d_str) error = stropen(sp->s_vp, &sydev, flag, cr); - else - error = (*cdevsw[getmajor(sydev)].d_open) - (&sydev, flag, otyp, cr); + else if (*cdevsw[getmajor(sydev)].d_flag & D_OLD) { + (void)(*cdevsw[getmajor(sydev)].d_open)(cmpdev(sydev), flag); + error = u.u_error; /* XXX */ + } else + error = (*cdevsw[getmajor(sydev)].d_open)(&sydev, flag, otyp, cr); return error; } @@ -91,7 +93,17 @@ syread(dev, uiop, cr) return error; if (cdevsw[getmajor(ttyd)].d_str) error = strread(sp->s_vp, uiop, cr); - else + else if (*cdevsw[getmajor(ttyd)].d_flag & D_OLD) { + u.u_offset = uiop->uio_offset; + u.u_base = uiop->uio_iov->iov_base; + u.u_count = uiop->uio_resid; + u.u_segflg = uiop->uio_segflg; + u.u_fmode = uiop->uio_fmode; + (void)(*cdevsw[getmajor(ttyd)].d_read)(cmpdev(ttyd)); + uiop->uio_resid = u.u_count; + uiop->uio_offset = u.u_offset; + error = u.u_error; /* XXX */ + } else error = (*cdevsw[getmajor(ttyd)].d_read) (ttyd, uiop, cr); return error; } @@ -111,7 +123,17 @@ sywrite(dev, uiop, cr) return error; if (cdevsw[getmajor(ttyd)].d_str) error = strwrite(sp->s_vp, uiop, cr); - else + else if (*cdevsw[getmajor(ttyd)].d_flag & D_OLD) { + u.u_offset = uiop->uio_offset; + u.u_base = uiop->uio_iov->iov_base; + u.u_count = uiop->uio_resid; + u.u_segflg = uiop->uio_segflg; + u.u_fmode = uiop->uio_fmode; + (void)(*cdevsw[getmajor(ttyd)].d_write)(cmpdev(ttyd)); + uiop->uio_resid = u.u_count; + uiop->uio_offset = u.u_offset; + error = u.u_error; /* XXX */ + } else error = (*cdevsw[getmajor(ttyd)].d_write) (ttyd, uiop, cr); return error; } @@ -135,7 +157,11 @@ syioctl(dev, cmd, arg, mode, cr, rvalp) return error; if (cdevsw[getmajor(ttyd)].d_str) error = strioctl(sp->s_vp, cmd, arg, mode, U_TO_K, cr, rvalp); - else + else if (*cdevsw[getmajor(ttyd)].d_flag & D_OLD) { + (void)(*cdevsw[getmajor(ttyd)].d_ioctl) (cmpdev(ttyd), cmd, arg, mode); + error = u.u_error; /* XXX */ + *rvalp = u.u_rval1; /* XXX */ + } else error = (*cdevsw[getmajor(ttyd)].d_ioctl) (ttyd, cmd, arg, mode, cr, rvalp); return error; diff --git a/usr/src/uts/3b2/io/hde.c b/usr/src/uts/3b2/io/hde.c index c913b4e..de62049 100644 --- a/usr/src/uts/3b2/io/hde.c +++ b/usr/src/uts/3b2/io/hde.c @@ -5,10 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/hde.c 1.15" - -/* - * This file contains the Hard Disk Error Log Driver +#ident "@(#)kernel:io/hde.c 1.14" +/* This file contains the Hard Disk Error Log Driver * that is part of the Bad Block Handling Feature. * * This driver provides the hdeeqd() and hdelog() subroutines @@ -84,7 +82,7 @@ STATIC int hdecmp(); STATIC o_dev_t hdeddev(ddev) - o_dev_t ddev; +o_dev_t ddev; { /* The purpose of this function is to get rid of the */ /* extra bit used in the SV file system macros. */ @@ -208,7 +206,11 @@ int flag, otyp; hdeclinp = u.u_procp->p_pid; for (edp = hdeeqdt, i = 0; i < hdeeduc; edp++, i++) { if (edp->hdepid) { - u.u_error = (*cdevsw[major(edp->hdeedev)].d_close) + if (*cdevsw[major(edp->hdeedev)].d_flag & D_OLD) + (*cdevsw[major(edp->hdeedev)].d_close) + (edp->hdeedev, FREAD|FWRITE, OTYP_LYR); + else + u.u_error = (*cdevsw[major(edp->hdeedev)].d_close) (expdev(edp->hdeedev), FREAD|FWRITE, OTYP_LYR, u.u_cred); edp->hdepid = 0; @@ -235,7 +237,11 @@ hdeexit() mypid = u.u_procp->p_pid; for (edp = hdeeqdt, i = 0; i < hdeeduc; edp++, i++) { if (edp->hdepid == mypid) { - u.u_error = (*cdevsw[major(edp->hdeedev)].d_close) + if (*cdevsw[major(edp->hdeedev)].d_flag & D_OLD) + (*cdevsw[major(edp->hdeedev)].d_close) + (edp->hdeedev, FREAD|FWRITE, OTYP_LYR); + else + u.u_error = (*cdevsw[major(edp->hdeedev)].d_close) (expdev(edp->hdeedev), FREAD|FWRITE, OTYP_LYR, u.u_cred); edp->hdepid = 0; @@ -344,7 +350,11 @@ struct hdearg *uap, *kap; bcopy((caddr_t) &khdarg, uadr, sizeof(struct io_arg)); } ddev = kap->hdebody.hdedskio.hdeddev; - u.u_error = (*cdevsw[major(ddev)].d_ioctl) + if (*cdevsw[major(ddev)].d_flag & D_OLD) + (*cdevsw[major(ddev)].d_ioctl) + (ddev, iocmd, uadr, FREAD|FWRITE); + else + u.u_error = (*cdevsw[major(ddev)].d_ioctl) (expdev(ddev), iocmd, uadr, FREAD|FWRITE, u.u_cred, &dummyrval); if (u.u_error) { kap->hderval = HDE_IOE; @@ -436,7 +446,11 @@ struct hdearg *uarg; /* LINTED implicit narrowing */ hdeeqdt[i].hdepid = my_pid; maj = major(karg.hdebody.hdedskio.hdeddev); - { + if (*cdevsw[maj].d_flag & D_OLD) + (*cdevsw[maj].d_open) + (karg.hdebody.hdedskio.hdeddev, + FREAD|FWRITE, OTYP_LYR); + else { dev_t tmpdev; /* new-style drive so expand dev */ tmpdev = expdev(karg.hdebody.hdedskio.hdeddev); @@ -483,7 +497,12 @@ struct hdearg *uarg; break; } maj = major(karg.hdebody.hdedskio.hdeddev); - u.u_error = (*cdevsw[maj].d_close) + if (*cdevsw[maj].d_flag & D_OLD) + (*cdevsw[maj].d_close) + (karg.hdebody.hdedskio.hdeddev, + FREAD|FWRITE, OTYP_LYR); + else + u.u_error = (*cdevsw[maj].d_close) (expdev(karg.hdebody.hdedskio.hdeddev), FREAD|FWRITE, OTYP_LYR, u.u_cred); hdeeqdt[i].hdepid = 0; diff --git a/usr/src/uts/3b2/io/icd.c b/usr/src/uts/3b2/io/icd.c index 0496d04..a740c10 100644 --- a/usr/src/uts/3b2/io/icd.c +++ b/usr/src/uts/3b2/io/icd.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/icd.c 1.18" +#ident "@(#)kernel:io/icd.c 1.15" #include "sys/types.h" #include "sys/param.h" @@ -20,6 +20,7 @@ #include "sys/signal.h" #include "sys/user.h" #include "sys/vtoc.h" +#include "sys/inline.h" #include "sys/systm.h" #include "sys/mkdev.h" #include "sys/ddi.h" @@ -76,7 +77,7 @@ icdinit() void icdwake() { - wakeprocs((caddr_t)&icdblk, PRMPT); + wakeup((caddr_t)&icdblk); } /* ARGSUSED */ @@ -86,10 +87,9 @@ int flag; int otyp; cred_t *cr; { - if (icdstate != PRESENT) { - cmn_err(CE_WARN, "In-Core Disk not existing\n"); + if (icdstate != PRESENT) + /* The state must be ABSENT or NOTSETUP */ return(ENXIO); - } return(0); } @@ -112,7 +112,7 @@ register struct buf *bp; register char *toptr; register char *frmptr; - register int partition; /* partition number */ + register char partition; /* partition number */ register long icd_addr; /* Address of the job */ register long end_addr; /* End address of ICD */ @@ -143,13 +143,13 @@ register struct buf *bp; bcopy(frmptr, toptr, bp->b_bcount); - biodone(bp); + iodone(bp); return; error: bp->b_flags |= B_ERROR; bp->b_error = ENXIO; - biodone(bp); + iodone(bp); return; } @@ -157,10 +157,7 @@ int icdsize(dev) dev_t dev; { - int partition; - - partition = ICDPART(dev); - return(icdvtoc.v_part[partition].p_size); + return icdblk; } dev_t diff --git a/usr/src/uts/3b2/io/id.c b/usr/src/uts/3b2/io/id.c index c86abd1..f0bcd7d 100644 --- a/usr/src/uts/3b2/io/id.c +++ b/usr/src/uts/3b2/io/id.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/id.c 1.18" +#ident "@(#)kernel:io/id.c 1.17" /* * 3B2 UNIX Integral Winchester Disk Driver */ @@ -30,6 +30,7 @@ #include "sys/vtoc.h" #include "sys/hdelog.h" #include "sys/open.h" +#include "sys/inline.h" #include "sys/cred.h" #include "sys/uio.h" #ifdef KPERF diff --git a/usr/src/uts/3b2/io/if.c b/usr/src/uts/3b2/io/if.c index e827a0e..3c6dcf3 100644 --- a/usr/src/uts/3b2/io/if.c +++ b/usr/src/uts/3b2/io/if.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/if.c 1.19" +#ident "@(#)kernel:io/if.c 1.15" /* * * 3B2 Computer UNIX Integral Floppy Disk Driver @@ -39,6 +39,7 @@ #include "sys/uio.h" #include "sys/sysmacros.h" /* define before ddi.h */ #include "sys/ddi.h" +#include "sys/inline.h" #include "sys/debug.h" #include "vm/vm_hat.h" #include "sys/if.h" @@ -67,7 +68,7 @@ STATIC void ifspindn(); STATIC void ifsetup(); STATIC void ifsetblk(); STATIC void ifflush(); -STATIC void ifrest(); +STATIC void ifrest(void); STATIC void ifseek(); STATIC void ifscan(); extern void ifstrategy(); @@ -184,7 +185,7 @@ ifstart() * contain the format buffer. */ - szbuf = btopr(sizeof(struct iftrkfmat)); + szbuf = btoc(sizeof(struct iftrkfmat)); #if 0 memchng = 2 * szbuf - 1; @@ -208,14 +209,14 @@ ifstart() */ if (((fmataddr&MSK64K) + sizeof(struct iftrkfmat)) > BND64K) { - fmat_buf = (struct iftrkfmat *)(fmataddr + ptob(szbuf) - NBPC); + fmat_buf = (struct iftrkfmat *)(fmataddr + ctob(szbuf) - NBPC); #if 0 noneed = fmataddr; #endif } else { fmat_buf = (struct iftrkfmat *)fmataddr; #if 0 - noneed = fmataddr + ptob(szbuf); + noneed = fmataddr + ctob(szbuf); #endif } @@ -225,7 +226,7 @@ ifstart() */ for (i = 0; i < szbuf - 1; i++) { - freepage((int)kvtopfn(noneed + ptob(i))); + freepage((int)kvtopfn(noneed + ctob(i))); } availrmem -= szbuf; availsmem -= szbuf; @@ -396,7 +397,7 @@ ifinit() iftab.b_actl = NULL; iftab.qcnt = NULL; iftab.b_forw = NULL; - iftab.b_back = NULL; + iftab.b_forw = NULL; ifisopen = NULL; ifclosed = SET; ifnoscan = SET; @@ -586,7 +587,7 @@ ifflush() /* * Should use av_back, but it is not set. */ - if ((lp = iftab.b_actf) != NULL) + if ((lp = iftab.b_actf) == 0) while (lp->av_forw) lp = lp->av_forw; iftab.b_actl = lp; diff --git a/usr/src/uts/3b2/io/io.fast.mk b/usr/src/uts/3b2/io/io.fast.mk new file mode 100644 index 0000000..3765a1b --- /dev/null +++ b/usr/src/uts/3b2/io/io.fast.mk @@ -0,0 +1,60 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)kernel:io/io.fast.mk 1.3" +STRIPOPT = -x -r + +ROOT = +INC = $(ROOT)/usr/include +DASHO = -O +CFLAGS = $(DASHO) -I$(INC) -D_KERNEL $(MORECPP) +FRC = + +all: + @for i in `ls`;\ + do\ + case $$i in\ + io*.mk)\ + ;;\ + *.mk)\ + echo "====== $(MAKE) -f $$i \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\" &";\ + $(MAKE) -f $$i "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)" &\ + ;;\ + *)\ + ;;\ + esac;\ + done + +clean: + @for i in `ls`;\ + do\ + case $$i in\ + io*.mk)\ + ;;\ + *.mk)\ + echo "====== $(MAKE) -f $$i clean&";\ + $(MAKE) -f $$i clean;;\ + *)\ + ;;\ + esac;\ + done + +clobber: + @for i in `ls`;\ + do\ + case $$i in\ + io*.mk)\ + ;;\ + *.mk)\ + echo "====== $(MAKE) -f $$i clobber";\ + $(MAKE) -f $$i clobber;;\ + *)\ + ;;\ + esac;\ + done + +FRC: diff --git a/usr/src/uts/3b2/io/io.full.mk b/usr/src/uts/3b2/io/io.full.mk new file mode 100644 index 0000000..a737a28 --- /dev/null +++ b/usr/src/uts/3b2/io/io.full.mk @@ -0,0 +1,60 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)kernel:io/io.full.mk 1.3" +STRIPOPT = -x -r + +ROOT = +INC = $(ROOT)/usr/include +DASHO = -O +CFLAGS = $(DASHO) -I$(INC) -D_KERNEL $(MORECPP) +FRC = + +all: + @for i in `ls`;\ + do\ + case $$i in\ + io*.mk)\ + ;;\ + *.mk)\ + echo "====== $(MAKE) -f $$i \"MAKE=$(MAKE)\" \"AS=$(AS)\" \"CC=$(CC)\" \"LD=$(LD)\" \"FRC=$(FRC)\" \"INC=$(INC)\" \"MORECPP=$(MORECPP)\" \"DASHO=$(DASHO)\" ";\ + $(MAKE) -f $$i "MAKE=$(MAKE)" "AS=$(AS)" "CC=$(CC)" "LD=$(LD)" "FRC=$(FRC)" "INC=$(INC)" "MORECPP=$(MORECPP)" "DASHO=$(DASHO)" ; \ + ;;\ + *)\ + ;;\ + esac;\ + done + +clean: + @for i in `ls`;\ + do\ + case $$i in\ + io*.mk)\ + ;;\ + *.mk)\ + echo "====== $(MAKE) -f $$i clean";\ + $(MAKE) -f $$i clean;;\ + *)\ + ;;\ + esac;\ + done + +clobber: + @for i in `ls`;\ + do\ + case $$i in\ + io*.mk)\ + ;;\ + *.mk)\ + echo "====== $(MAKE) -f $$i clobber";\ + $(MAKE) -f $$i clobber;;\ + *)\ + ;;\ + esac;\ + done + +FRC: diff --git a/usr/src/uts/3b2/io/iuart.c b/usr/src/uts/3b2/io/iuart.c index 4013b92..0099d41 100644 --- a/usr/src/uts/3b2/io/iuart.c +++ b/usr/src/uts/3b2/io/iuart.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/iuart.c 1.36" +#ident "@(#)kernel:io/iuart.c 1.30" /* * 3B2 Integral UART Streams Driver @@ -28,6 +28,7 @@ #include "sys/conf.h" #include "sys/firmware.h" #include "sys/nvram.h" +#include "sys/inline.h" #include "sys/cmn_err.h" #include "sys/stream.h" #include "sys/stropts.h" @@ -38,7 +39,7 @@ #include "sys/cred.h" #include "sys/ddi.h" -#ifdef KPERF /* KPERF is for kernel performance measurement tool */ +#ifdef KPERF /* KPERF is for kernel performance measurment tool */ #include "sys/proc.h" #include "sys/disp.h" #endif /* KPERF */ @@ -47,23 +48,18 @@ #define IUCONTTY 1 /* minor device number for system board second uart */ #define IU_CNT 2 /* number of iuarts on the system board (one duart) */ + /* Values used to designate whether characters should be queued or * processed depending upon the rate characters are being received. */ #define IU_IDLE 0 /* no characters have been rcv for 30ms */ +#define IU_TIMEOUT 1 /* state was active but no chars rcv for 30ms */ #define IU_ACTIVE 2 /* character was rcv within last 30ms */ #define IU_SCAN 3 /* clock ticks for the iuart scan timeout */ +#define IU_BRK 2 /* set in t_dstat if a break of 0.25 sec is to be sent */ #define ISSUE_PIR9 0x01 /* sets the CSR bit for UART lo-IPL handler */ -/* - * t_dstat values - */ -#define IU_TIMEOUT 0x01 /* state was active but no chars rcv for 30ms */ -#define IU_BRK 0x02 /* set if a break of 0.25 sec is to be sent */ -#define IU_CLDRAIN 0x04 /* set if timeout called in close */ -#define IU_DTIMEOUT 0x08 /* set if M_DELAY time delay in progress */ - /* * Register defines for the interrupt mask register and the * output port configuration register used during DMA jobs. @@ -88,7 +84,6 @@ #define DIS_DMAC 0x04 /* disables dmac chan for requested chan */ #define IUCTRHZ 230525 /* counter/timer frequency (CLK/16) */ #define IUCTRMAX 0xffff /* maximum counter/timer value (16 bits) */ -#define CL_TIME 500 /* time to complete output drain on close */ extern struct duart duart; /* system board duart structure */ extern struct dma dmac; /* system board dma controller structure */ @@ -118,7 +113,6 @@ STATIC void iuparam(); STATIC void iurint(); STATIC void iuxint(); STATIC void iubufwake(); -STATIC void iu_nodrain(); STATIC mblk_t *iu_get_buffer(); void iuinit(); @@ -264,7 +258,7 @@ register cred_t *credp; putnext( q, mop); if ( mdev == IUCONSOLE) { - tp->t_iflag = IXON|IXANY|BRKINT|IGNPAR; + tp->t_iflag |= IXON|IXANY|BRKINT|IGNPAR; /* * get control modes from the nvram */ @@ -276,7 +270,7 @@ register cred_t *credp; else tp->t_cflag = consbaud; } else /* default contty setting */ - tp->t_cflag = SSPEED | CS8 | CREAD | HUPCL; + tp->t_cflag |= SSPEED | CS8 | CREAD | HUPCL; iuparam( mdev); } @@ -291,7 +285,7 @@ register cred_t *credp; if ( sleep( (caddr_t)tp->t_rdqp, TTIPRI|PCATCH)) { q->q_ptr = NULL; WR(q)->q_ptr = NULL; - tp->t_state &= ~( WOPEN | BUSY); + tp->t_state &= ~(WOPEN|BUSY); tp->t_rdqp = NULL; splx( oldpri); @@ -299,13 +293,8 @@ register cred_t *credp; } } - tp->t_state &= ~WOPEN; tp->t_state |= ISOPEN; - - /* write service procedure not used - only for canput */ - - noenable( WR( tp->t_rdqp)); splx( oldpri); return( 0); } /* iuopen */ @@ -320,26 +309,13 @@ register cred_t *credp; register struct strtty *tp; register int oldpri; - int tid; - - oldpri = splstr(); tp = (struct strtty *)q->q_ptr; - if ( !( tp->t_state & ISOPEN)) { /* Check if it's closed already */ - splx( oldpri); + if ( !( tp->t_state & ISOPEN)) /* See if it's closed already */ return( 0); - } - - /* - * May need to relieve flow control - */ - if ( tp->t_state & TTSTOP) - iuproc( tp, T_RESUME); - - if ( tp->t_state & TBLOCK) - iuproc( tp, T_UNBLOCK); + oldpri = splstr(); if ( !( oflag & (FNDELAY|FNONBLOCK))) /* * Drain queued output to the console/contty line. @@ -349,30 +325,15 @@ register cred_t *credp; if ( iugetoblk( tp) == 0) { tp->t_state |= TTIOW; - tp->t_dstat |= IU_CLDRAIN; - /* - * Need timeout here to break a deadlock - * condition since the last transaction - * to the duart could have been a suspend output - * or there could be a hardware problem on the - * duart. In either case the transmitter could - * be disabled and further transmission to the - * device is suspended. - */ - tid = timeout( iu_nodrain, (caddr_t)tp, CL_TIME); - sleep( (caddr_t)&tp->t_oflag, PZERO|PCATCH); - if ( tp->t_dstat & IU_CLDRAIN) { - untimeout( tid); - tp->t_dstat &= ~IU_CLDRAIN; - } else { - tp->t_state &= ~( TTIOW | BUSY); + if ( sleep((caddr_t)&tp->t_oflag, PZERO + 1| PCATCH)) { + tp->t_state &= ~TTIOW; break; } } } if ( tp->t_cflag & HUPCL) - iumodem( tp->t_dev, OFF); + iumodem(tp->t_dev, OFF); /* * reinitialize the duart registers for the closing @@ -395,24 +356,13 @@ register cred_t *credp; freeb( tp->t_out.bu_bp); tp->t_out.bu_bp = NULL; } - tp->t_state &= ~( ISOPEN | BUSY); + tp->t_state &= ~(ISOPEN|BUSY); tp->t_rdqp = NULL; splx( oldpri); return( 0); } /* iuclose */ -/* - * Wakeup sleep (waiting for transmitter to become available) in close routine. - */ -STATIC void -iu_nodrain( tp) -register struct strtty *tp; -{ - tp->t_dstat &= ~IU_CLDRAIN; - wakeup( (caddr_t)&tp->t_oflag); -} - /* * This is the console's write put procedure */ @@ -432,6 +382,14 @@ register struct msgb *bp; switch(bp->b_datap->db_type) { case M_DATA: + /* + * If no carrier then just queue the message on the + * driver's write queue + */ + if ( !( tp->t_state & CARR_ON)) { + putq( q, bp); + return( 0); + } while( bp) { bp->b_datap->db_type = M_DATA; bp1 = unlinkb( bp); @@ -441,13 +399,6 @@ register struct msgb *bp; putq( q,bp); bp = bp1; } - /* - * If no carrier then just return - * the message has been queued. - */ - if ( !( tp->t_state & CARR_ON)) { - return( 0); - } if ( q->q_first != NULL) iugetoblk( tp); @@ -491,12 +442,7 @@ register struct msgb *bp; case M_DELAY: s = splstr(); - if ( tp->t_dstat & IU_DTIMEOUT) { - putq( q, bp); - splx( s); - break; - } - tp->t_dstat |= IU_DTIMEOUT; + tp->t_state |= TIMEOUT; timeout( iudelay, (caddr_t)tp, ((int)*(bp->b_rptr))*HZ/60); splx( s); freemsg( bp); @@ -540,9 +486,9 @@ register struct strtty *tp; paddr_t addr; - if ( tp->t_rdqp == NULL) /* Driver not open */ - return( 0); + if ( tp->t_rdqp == NULL) /* Check if driver is open */ + return( 0); q = WR(tp->t_rdqp); if ( tp->t_state & BUSY) @@ -555,7 +501,7 @@ register struct strtty *tp; * wakeup close write queue drain */ if ( tp->t_state & TTIOW) { - tp->t_state &= ~TTIOW; + tp->t_state &= ~(TTIOW); wakeup( (caddr_t)&tp->t_oflag); } splx( s); @@ -566,7 +512,7 @@ register struct strtty *tp; switch ( bp->b_datap->db_type) { case M_DATA: - if ( tp->t_state & (TTSTOP | TIMEOUT | IU_DTIMEOUT)) { + if ( tp->t_state & (TTSTOP | TIMEOUT)) { putbq( q, bp); splx( s); return( 0); @@ -608,17 +554,6 @@ register struct strtty *tp; iusrvioc( q, bp); break; - case M_DELAY: - - if ( tp->t_dstat & IU_DTIMEOUT) { - putbq( q, bp); - break; - } - tp->t_dstat |= IU_DTIMEOUT; - timeout( iudelay, (caddr_t)tp, ((int)*(bp->b_rptr))*HZ/60); - freemsg( bp); - break; - default: freemsg( bp); break; @@ -663,7 +598,7 @@ register mblk_t *bp; case TCSBRK: /* * Run these now if possible if no data - * queued or if the uart is not busy. + * queued of if the uart is not busy. */ if ( q->q_first != NULL || (tp->t_state & BUSY)) { putq( q, bp); @@ -916,9 +851,7 @@ register mblk_t *bp; } arg = *(int *)bp->b_cont->b_rptr; if ( arg == 0) - tp->t_dstat |= IU_BRK; - - iuproc( tp, T_BREAK); + iuproc( tp, T_BREAK); bp->b_datap->db_type = M_IOCACK; bp1 = unlinkb( bp); if ( bp1) @@ -974,18 +907,21 @@ register struct strtty *tp; if ( cmd&FWRITE) { q = WR(tp->t_rdqp); flushq( q, FLUSHDATA); - tp->t_state &= ~BUSY; + tp->t_state &= ~(BUSY); + tp->t_state &= ~(TBLOCK); if ( tp->t_state & TTIOW) { - tp->t_state &= ~TTIOW; + tp->t_state &= ~(TTIOW); wakeup( (caddr_t)&tp->t_oflag); } } if ( cmd&FREAD) { q = tp->t_rdqp; flushq( q, FLUSHDATA); - tp->t_state &= ~TBLOCK; + tp->t_state &= ~(BUSY); + tp->t_state &= ~(TBLOCK); } splx( s); + iugetoblk( tp); } /* iuflush */ @@ -1127,8 +1063,8 @@ iuint() ignore2 = ignore2; /* To satisfy lint only! */ if ( tp->t_cflag & CLOCAL || !(duart.ip_opcr & DCD(dev))) { if ((tp->t_state & CARR_ON) == 0) { - tp->t_state |= CARR_ON; wakeup( (caddr_t)tp->t_rdqp); + tp->t_state |= CARR_ON; /* * May need to print prompt */ @@ -1319,42 +1255,29 @@ register dev; room_left = bpt->b_datap->db_lim - bpt->b_wptr; if ( room_left < lcnt) { /* - * No more room in this message block. - * Check if adding this block to the queue will cause - * the byte count to exceed the hi-water mark + * No more room in this message block. Queue this one + * and allocate another one */ - if ( (int)tp->t_rdqp->q_count + (int)( bpt->b_wptr - bpt->b_rptr) > (int)tp->t_rdqp->q_hiwat) { - if (( tp->t_iflag & IXOFF) && !( tp->t_state & TBLOCK)) + putq( tp->t_rdqp, tp->t_in.bu_bp); + tp->t_in.bu_bp = NULL; + if ( tp->t_rdqp->q_count > tp->t_rdqp->q_hiwat) { + if (( tp->t_iflag & IXOFF) && !(tp->t_state & TBLOCK)) iuproc( tp, T_BLOCK); - - if ( tp->t_rdqp->q_count > MAX_INPUT) { - /* - * Flush the entire read side queue - * and reuse the input buffer. - */ + if ( tp->t_rdqp->q_count > MAX_INPUT) iuflush( tp, FREAD); - putctl1( tp->t_rdqp->q_next, M_FLUSH, FLUSHR); - tp->t_in.bu_bp->b_wptr = tp->t_in.bu_bp->b_rptr = tp->t_in.bu_bp->b_datap->db_base; - return; - } } - /* - * Queue this one and allocate another one - */ - putq( tp->t_rdqp, tp->t_in.bu_bp); - tp->t_in.bu_bp = NULL; if (( bpt = iu_get_buffer( tp)) == NULL) return; } /* - * We have room for more data at this point. + * We have rooma for more data at this point. * Copy the data to this buffer */ bcopy( lbuf, (caddr_t)bpt->b_wptr, lcnt); bpt->b_wptr += lcnt; tp->t_in.bu_cnt += lcnt; - if ( !( tp->t_dstat & IU_TIMEOUT)) { + if (!( tp->t_dstat & IU_TIMEOUT)) { timeout( iuscan, (caddr_t)tp, IU_SCAN); tp->t_dstat |= IU_TIMEOUT; } @@ -1366,37 +1289,18 @@ iuscan( tp) register struct strtty *tp; { register int s; - register int poss_queue_sz; /* The size of current input buffer plus the current queue size */ s = splstr(); - tp->t_dstat &= ~IU_TIMEOUT; if ( tp->t_rdqp) { if ( tp->t_in.bu_cnt) { - poss_queue_sz = tp->t_in.bu_cnt + tp->t_rdqp->q_count; - if (( tp->t_iflag & IXOFF) && !( tp->t_state & TBLOCK) - && ( (int)poss_queue_sz >= (int)tp->t_rdqp->q_hiwat)) - iuproc( tp, T_BLOCK); - - if ( poss_queue_sz > MAX_INPUT) { - /* - * Flush the entire read side stream - * and reuse the same large input buffer - */ - iuflush( tp, FREAD); - putctl1( tp->t_rdqp->q_next, M_FLUSH, FLUSHR); - tp->t_in.bu_bp->b_wptr = tp->t_in.bu_bp->b_rptr = tp->t_in.bu_bp->b_datap->db_base; - splx( s); - return; - } - putq( tp->t_rdqp, tp->t_in.bu_bp); tp->t_in.bu_bp = NULL; iu_get_buffer( tp); } } + tp->t_dstat &= ~IU_TIMEOUT; splx( s); - return; } int @@ -1413,6 +1317,7 @@ iupirint() (*fn)(); } return( 0); + } @@ -1661,9 +1566,9 @@ void (*fn)(); s = splstr(); if ( iutimefn) - cmn_err( CE_PANIC, "iutime race"); + cmn_err( CE_PANIC, "iudelay race"); if ( ms > IUCTRMAX || ( ticks = (IUCTRHZ * ms) / 1000) > IUCTRMAX) - cmn_err( CE_PANIC, "iutime range"); + cmn_err( CE_PANIC, "iudelay range"); iutimefn = fn; ignore = duart.scc_ropbc; /* Stop counter */ duart.ctur = (ticks & 0xff00) >> 8; @@ -1691,7 +1596,6 @@ queue_t *q; tp = (struct strtty *)q->q_ptr; while (( mp = getq( q)) != NULL) { - if ( canput( q->q_next) == 0) { putbq( q, mp); splx( s); @@ -1730,11 +1634,10 @@ register struct strtty *tp; s = splstr(); - tp->t_dstat &= ~IU_DTIMEOUT; + tp->t_state &= ~TIMEOUT; splx( s); iugetoblk( tp); /* Restart any ouput waiting on queue */ } - STATIC mblk_t * iu_get_buffer( tp) register struct strtty *tp; @@ -1743,7 +1646,7 @@ register struct strtty *tp; /* - * if no current message allocate a block for it + * if no current message. allocate a block for it */ if (( bp = tp->t_in.bu_bp) == NULL) { if (( bp = allocb( READBUFSZ, BPRI_HI)) == NULL) { diff --git a/usr/src/uts/3b2/io/kmacct.c b/usr/src/uts/3b2/io/kmacct.c index 1c650c1..3e42924 100644 --- a/usr/src/uts/3b2/io/kmacct.c +++ b/usr/src/uts/3b2/io/kmacct.c @@ -5,10 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/kmacct.c 1.5" - -#ifdef DEBUG - +#ident "@(#)kernel:io/kmacct.c 1.4" #include "sys/types.h" #include "sys/param.h" #include "sys/vnode.h" @@ -22,7 +19,6 @@ #include "sys/errno.h" #include "sys/debug.h" #include "sys/kmacct.h" -#include "sys/kmem.h" #define FALSE 0 #define TRUE 1 @@ -586,642 +582,3 @@ kmaccount(type, size, addr) return 0; } - -/* - * Paranoia code - * - * if Km_Paranoid is set, kmem_worry() will be called on entering and leaving - * kmem_alloc(), kmem_free(), and kmem_coalesce(). - * kmem_worry() calls kmem_check() to check freelist headers. - * if the freelist is trashed, will call demon. - * if Km_CheckAll is also set, kmem_check() will check the entire - * freelist, not just the headers. - * - * if the memory being allocated or freed is from the kma pools (i.e., it's - * not an outsize request), kmem_worry() updates the callrec. - * - * if kmacctflag is set, kmem_worry() calls kmacct to trace memory leaks. - * - * if Km_TraceAddr is set, kmem_worry() will call demon when allocating - * or freeing that addr. - * - * Km_Paranoid, Km_CheckAll, etc may be set from demon proms ("sw Km_Paranoid 1"). - * - */ - -#define MINASMALL 16 /* smallest allocable in small pool */ -#define MAXASMALL 256 /* largest allocable in small pool */ -#define MAXABIG 4096 /* largest allocable in big pool */ -#define MINSIDX 3 /* exp of smallest class in small pool */ -#define MAXBIDX 14 /* exp of largest class in big pool */ -#define MINASIDX 4 /* exp of smallest allocable in small*/ -#define MAXABIDX 12 /* exp of largest allocable in big */ -#define SMINOFFSET (MINASIDX - MINSIDX) -#define BMAXOFFSET (MAXABIDX - MINSIDX) -#define DELAYED 1 - - -typedef struct fbuf { - struct fbuf *fb_nextp; /* next free buffer */ - struct fbuf *fb_prevp; /* previous free buffer */ - ulong fb_mask; /* mask to apply to bitmap */ - union { - struct bpool *fb_poolp; /* corresp. pool */ - ulong fb_state; /* DELAYED or not */ - ulong *fb_mapp; /* corresp. word of bitmap */ - } fb_union; -} freebuf; - -typedef struct flist { - freebuf *fl_nextp; /* first buffer in free list */ - freebuf *fl_prevp; /* last buffer in free list */ - ulong fl_slack; /* state var. for memory mgmt */ - ulong fl_mask; /* mask to apply to bitmap */ - ulong fl_nbits; /* # of bits to mask on/off */ -} freelist; - -typedef struct bpool { - unchar *bp_startp; /* unaligned start address */ - unchar *bp_alignp; /* aligned start address */ - ulong bp_inuse; /* # of MAXA* buffers in use */ - ulong bp_status; /* current status of pool */ - ulong *bp_bitmapp; /* pointer to bitmap */ - ulong bp_expmin; /* exponent of smallest class */ - ulong bp_expmax; /* exponent of largest class */ -} bufpool; - - -/* - * use Km_Alloc and Km_Free to keep track of who alloc'd & freed addrs. - * have NREC of each -- will wrap when full. - */ - -#define NUMCALL 6 -#define NREC 2000 - -struct callrec { - caddr_t caller[NUMCALL]; - unchar *addr; - ulong size; -} Km_Alloc[NREC+1], Km_Free[NREC+1]; - -STATIC int Km_i, Km_j; /* indices for Km_Alloc & Km_Free resp. */ -STATIC int Km_iwrap, Km_jwrap; /* wrap flags */ -STATIC int Km_Max = 5; /* max number of alloc/frees to print */ -STATIC int Km_Low = MINASMALL; -STATIC int Km_High = MAXABIG; - -void kmem_check(); /* check freelist */ -void kmem_trace(); /* trace usage of an address */ -void kmem_find(); /* look for an addr in freelist */ -int cntausers(); /* count allocations of an addr */ -int cntfusers(); /* count free's of an addr */ -void cntusers(); /* count alloc's and free's of an addr */ -void prausers(); /* print alloc's of an addr */ -void prfusers(); /* print free's of an addr */ -void prusers(); /* print alloc's and free's of an addr */ -STATIC void prarange(); /* internal routine for print trace */ -STATIC void prfrange(); /* internal routine for print trace */ -extern int s3blookup(); /* to get symbol names (is in DEBUG) */ - -extern int Km_Paranoid; -extern int Km_CheckAll; -extern int kmacctflag; -extern unchar *Km_TraceAddr; -extern freelist Km_FreeLists[]; - - -void -kmem_worry(s, type, addr, size) -char *s; -int type; -_VOID *addr; -size_t size; -{ - - int i; - - if ( Km_Paranoid ) - kmem_check(s, Km_CheckAll); - - if ( addr == (_VOID *)NULL || size == 0 ) - return; - - if ( Km_Paranoid ) { - if ( size <= MAXABIG ) { - /* - * only keep Km_Alloc[] and Km_Free[] recs - * for bufs from our own pools - */ - if ( type == KMACCT_ALLOC ) { - if ( (i = Km_i++) >= NREC ) { - Km_iwrap++; - i = Km_i = 0; - } - getcaller(NUMCALL, - Km_Alloc[i].caller); - Km_Alloc[i].size = size; - Km_Alloc[i].addr = (unchar *)addr; - } else if ( type == KMACCT_FREE ) { - if ( (i = Km_j++) >= NREC ) { - Km_jwrap++; - i = Km_j = 0; - } - getcaller(NUMCALL, - Km_Free[i].caller); - Km_Free[i].size = size; - Km_Free[i].addr = (unchar *)addr; - } - } - if ( addr == (freebuf *)Km_TraceAddr ) { - cmn_err(CE_NOTE, - "%s: %s traced address %x\n", s, - (type == KMACCT_ALLOC ? "allocating" - : "freeing"), addr); - call_demon(); - } - } - if ( kmacctflag ) - kmaccount(type, size, (caddr_t *)addr); - - return; -} - -/* - * kmem_check(s, all) freelist check - * char s; text to print on error - * int all; whether to walk entire freelist or just headers - * - * for debugging, to be called from demon debugger ("c kmem_check u.u_comm 0" - * or "c kmem_check u.u_comm 1") - * - * also called on entry to or exit from kmem_alloc, kmem_free, kmem_coealesce - * if Km_Paranoid is set. - * - * walks freelist, looking for trashed pointers. - * if all is set, walks entire freelist. if not, just looks at head & tail - * pointers (fl_nextp and fl_prevp) off Km_FreeLists. - * - * if any pointer is trashed, prints warning and calls demon. - * only check pointers that are not one of the elements of the Km_FreeLists - * array. "trashed" if it's not properly aligned or if it's < 0x40000000 - * or > 0x40500000 - * - */ - -#define ADDR1 (freebuf *)0x40000000 -#define ADDR2 (freebuf *)0x40500000 -/* BADADDR1 -- address must be 'size'-aligned */ -#define BADADDR1(x) ( ( (x) < (freebuf *)&Km_FreeLists[SMINOFFSET] \ - || (x) > (freebuf *)&Km_FreeLists[BMAXOFFSET] ) \ - && ( ((ulong)(x) & (ulong)(size-1)) != 0 \ - || ((x) < ADDR1) || ((x) > ADDR2) ) ) -/* BADADDR2 -- only word alignment matters */ -#define BADADDR2(x) ( ((ulong)(x) & (ulong)3) != 0 \ - || ((x) < ADDR1) || ((x) > ADDR2) ) - -/* is this the size request we are interested in */ -#define SIZECHECK(s,b) ((s==0) || ((b <= s) && (b > (s/2)))) - -int Km_DebugInst = NULL; /* set if DEBUG module is in kernel */ - /* after check, will be ENOPKG if */ - /* DEBUG is not in kernel */ - -void -kmem_check(s, all) -char *s; -int all; -{ - register freebuf *head, *tail, *p; - register int i, size; - int bad, stop = 0, oldpri; - void why1(), why2(); - - for ( size = MINASMALL, i = SMINOFFSET; - size <= MAXABIG && i <= BMAXOFFSET; ++i, size *= 2 ) { - - - /* - * have to spl this or interrupts cause bogus failures - */ - oldpri = splhi(); - - if ( (head = Km_FreeLists[i].fl_nextp) == (freebuf *)&Km_FreeLists[i] ) { - splx(oldpri); - continue; /* empty list -- continue in 'for' */ - } - tail = Km_FreeLists[i].fl_prevp; - bad = 0; /* innocent until proven guilty */ - - if ( BADADDR1(head) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist header trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_prevp = 0x%x\n", - s, size, head, tail); - why1(head, size); - bad++; - } else if ( BADADDR1(tail) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist header trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_prevp = 0x%x\n", - s, size, head, tail); - why1(tail, size); - bad++; - } else { - if ( BADADDR1(head->fb_nextp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist head pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_nextp = 0x%x\n\t\tfl_nextp->fb_prevp = 0x%x\n", - s, size, head, head->fb_nextp, head->fb_prevp); - why1(head->fb_nextp, size); - bad++; - } - if ( BADADDR1(head->fb_prevp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist head pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_nextp = 0x%x\n\t\tfl_nextp->fb_prevp = 0x%x\n", - s, size, head, head->fb_nextp, head->fb_prevp); - why1(head->fb_prevp, size); - bad++; - } - if ( BADADDR1(tail->fb_nextp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist tail pointer (fl_prevp) trashed:\n\t\tfl_prevp = 0x%x\n\t\tfl_prevp->fb_nextp = 0x%x\n\t\tfl_prevp->fb_prevp = 0x%x\n", - s, size, tail, tail->fb_nextp, tail->fb_prevp); - why1(tail->fb_nextp, size); - bad++; - } - if ( BADADDR1(tail->fb_prevp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist tail pointer (fl_prevp) trashed:\n\t\tfl_prevp = 0x%x\n\t\tfl_prevp->fb_nextp = 0x%x\n\t\tfl_prevp->fb_prevp = 0x%x\n", - s, size, tail, tail->fb_nextp, tail->fb_prevp); - why1(tail->fb_prevp, size); - bad++; - } - - - /* if union holds a pool or bitmap pointer, check it */ - if ( head->fb_union.fb_state != DELAYED - && BADADDR2((freebuf *)head->fb_union.fb_mapp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist head pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_fb_union.fb_%s = 0x%x\n", - s, size, head, - ( ( size == MAXASMALL || size == MAXABIG) ? - "poolp" : "mapp" ), - head->fb_union.fb_mapp); - why2(head->fb_union.fb_mapp); - bad++; - } - if ( tail->fb_union.fb_state != DELAYED - && BADADDR2((freebuf *)tail->fb_union.fb_mapp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist tail pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_fb_union.fb_%s = 0x%x\n", - s, size, tail, - ( ( size == MAXASMALL || size == MAXABIG) ? - "poolp" : "mapp" ), - tail->fb_union.fb_mapp); - why2(tail->fb_union.fb_mapp); - bad++; - } - - } - stop += bad; - if ( bad || !all ) { /* don't go further with bad pointers */ - splx(oldpri); - continue; /* for */ - } - - /* walk entire freelist */ - for ( p = head->fb_nextp; p != (freebuf *)&Km_FreeLists[i]; - p = p->fb_nextp ) { - if ( BADADDR1(p->fb_nextp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist trashed:\n\t\tbufp = 0x%x\n\t\tbufp->fb_nextp = 0x%x\n\t\tbufp->fb_prevp = 0x%x\n", - s, size, p, p->fb_nextp, p->fb_prevp); - why1(p->fb_nextp, size); - bad++; - break; - } - if ( BADADDR1(p->fb_prevp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist trashed:\n\t\tbufp = 0x%x\n\t\tbufp->fb_nextp = 0x%x\n\t\tbufp->fb_prevp = 0x%x\n", - s, size, p, p->fb_nextp, p->fb_prevp); - why1(p->fb_prevp, size); - bad++; - break; - } - if ( p->fb_union.fb_state != DELAYED - && BADADDR2((freebuf *)p->fb_union.fb_mapp) ) { - cmn_err(CE_WARN, - "^%s: %u-byte freelist trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_fb_union.fb_%s = 0x%x\n", - s, size, p, - ( ( size == MAXASMALL || size == MAXABIG) ? - "poolp" : "mapp" ), - p->fb_union.fb_mapp); - why2(p->fb_union.fb_mapp); - bad++; - } - } - splx(oldpri); - stop += bad; - } - if (stop) - call_demon(); - return; -} - -void -why1(x, size) -freebuf *x; -int size; -{ - cmn_err(CE_CONT, "^kmem_check failed this test:\n"); - cmn_err(CE_CONT, -"^( ( (x) < (freebuf *)&Km_FreeLists[SMINOFFSET]\\\n"); - cmn_err(CE_CONT, -"^ || (x) > (freebuf *)&Km_FreeLists[BMAXOFFSET] ) \\\n"); - cmn_err(CE_CONT, -"^ && ( ((ulong)(x) & (ulong)(size-1)) != 0 \\\n"); - cmn_err(CE_CONT, -"^ || ((x) < ADDR1) || ((x) > ADDR2) ) )\n"); - cmn_err(CE_CONT, -"^( ( 0x%x < 0x%x\\\n", x, &Km_FreeLists[SMINOFFSET]); - cmn_err(CE_CONT, -"^ || 0x%x > 0x%x ) \\\n", x, &Km_FreeLists[BMAXOFFSET]); - cmn_err(CE_CONT, -"^ && ( ((ulong)0x%x & (ulong)(0x%x)) != 0 \\\n", x, (size-1)); - cmn_err(CE_CONT, -"^ || (0x%x < 0x%x) || (0x%x > 0x%x) ) )\n", x, ADDR1, x, ADDR2); - - return; -} - - -void -why2(x) -ulong *x; -{ - cmn_err(CE_CONT, "^kmem_check failed this test:\n"); - cmn_err(CE_CONT, -"^( ((ulong)(x) & (ulong)3) != 0 \\\n"); - cmn_err(CE_CONT, -"^ || ((x) < ADDR1) || ((x) > ADDR2) )\n"); - cmn_err(CE_CONT, -"^( (0x%x & (ulong)3) != 0 \\\n", x); - cmn_err(CE_CONT, -"^ || (0x%x < 0x%x) || (0x%x > 0x%x) )\n", x, ADDR1, x, ADDR2); - - return; -} - -/* - * kmem_trace(addr, flag) trace/count uses of addr - * - * if flag is 0 then print out all uses of addr (and before) addr; - * if flag is !0 then print out number of uses of addr (and before) addr; - */ -void -kmem_trace(addr, flag) -register uint addr; -int flag; -{ - register uint size, mask; - register uint baddr; - - /* since we are only saving records for this range - * we can only find matches in this range - */ - for ( size = Km_Low; size <= Km_High; size *= 2 ) { - - /* - * if addr is on boundary x - * check(addr, x) - * check(addr-x, x) - * NOTE not checking addr + x - * else addr is inside an x-byte buffer - * check(addr&(x-1), x); - */ - - mask = ~(size - 1); - baddr = (uint)addr & (uint)mask; - if ( baddr == addr) { - - if (flag != 0) { /* just do count */ - cntusers(addr, size); - cntusers(addr-size, size); - } else { - prausers(addr, size); - prfusers(addr, size); - prausers(addr-size, size); - prfusers(addr-size, size); - } - } else { - if (flag != 0) { /* just do count */ - cntusers(baddr, size); - } else { - prusers(baddr, size); - } - } - - } -} - -/* cntusers -- count alloc/free's of addr */ -void -cntusers(addr, size) -uint addr, size; -{ - register int cnt; - if (cnt = cntausers(addr, size)) - cmn_err(CE_CONT, "^%d kmem_alloc of size %d at addr 0x%x\n", - cnt, size, addr); - - if (cnt = cntfusers(addr, size)) - cmn_err(CE_CONT, "^%d kmem_free of size %d at addr 0x%x\n", - cnt, size, addr); -} - - -/* count allocs */ -int -cntausers(addr, size) -uint addr, size; -{ - register int i, cnt = 0; - - for ( i = 0; i < NREC; i++ ) { - if ((Km_Alloc[i].addr == (unchar *)addr) && - SIZECHECK(size, Km_Alloc[i].size)) { - cnt++; - } - } - return cnt; -} - -/* count frees */ -int -cntfusers(addr, size) -uint addr, size; -{ - register int i, cnt = 0; - for ( i = 0; i < NREC; i++ ) { - if ((Km_Free[i].addr == (unchar *)addr) && - SIZECHECK(size, Km_Free[i].size)) { - cnt++; - } - } - return cnt; -} - -/* prusers -- print trace of alloc/free's of addr */ -void -prusers(addr, size) -uint addr, size; -{ - prausers(addr, size); - prfusers(addr, size); -} - - -/* print allocs */ -void -prausers(addr, size) -uint addr, size; -{ - int more = 0; - - /* We do this in reverse order to get last usage, - * Km_[ij] always points to next entry - entry is still valid - */ - if (Km_i != 0) { - prarange(Km_i - 1, 0, addr, size, &more); - } - prarange(NREC - 1, Km_i, addr, size, &more); - -} - -/* print frees */ -void -prfusers(addr, size) -uint addr, size; -{ - int more = 0; - - /* We do this in reverse order to get last usage, - * Km_[ij] always points to next entry - entry is still valid - */ - if (Km_j != 0) { - prfrange(Km_j - 1, 0, addr, size, &more); - } - prfrange(NREC - 1, Km_j, addr, size, &more); - -} - -STATIC -void -prarange(start, end, addr, size, more) -int start, end; -uint addr, size; -int *more; -{ - register int i, j; - - if ( Km_DebugInst == NULL ) - Km_DebugInst = s3blookup((uint)Km_Alloc[0].caller[0]); - - for ( i = start; i >= end; i-- ) { - if ((Km_Alloc[i].addr == (unchar *)addr) && - SIZECHECK(size, Km_Alloc[i].size)) { - if ( (*more)++ > Km_Max ) { - cmn_err(CE_CONT, "^Stopping at Km_Max\n"); - break; - } - cmn_err(CE_CONT, "^allocated %u bytes at 0x%x to:\n", - Km_Alloc[i].size, addr ); - for ( j = 0; j < NUMCALL; ++j ) - if (Km_Alloc[i].caller[j]) - if ( Km_DebugInst != ENOPKG ) - cmn_err(CE_CONT, "^\t\t0x%x %s\n", - Km_Alloc[i].caller[j], - (char *)s3blookup((uint)Km_Alloc[i].caller[j])); - else - cmn_err(CE_CONT, "^\t\t0x%x\n", - Km_Alloc[i].caller[j]); - } - } -} - -STATIC -void -prfrange(start, end, addr, size, more) -int start, end; -uint addr, size; -int *more; -{ - register int i, j; - - if ( Km_DebugInst == NULL ) - Km_DebugInst = s3blookup((uint)Km_Free[0].caller[0]); - - for ( i = start; i >= end; i-- ) { - if ((Km_Free[i].addr == (unchar *)addr) && - SIZECHECK(size, Km_Free[i].size)) { - if ( (*more)++ > Km_Max ) { - cmn_err(CE_CONT, "^Stopping at Km_Max\n"); - break; - } - cmn_err(CE_CONT, "^freed %u bytes at 0x%x from:\n", - Km_Free[i].size, addr ); - for ( j = 0; j < NUMCALL; ++j ) - if (Km_Free[i].caller[j]) - if ( Km_DebugInst != ENOPKG ) - cmn_err(CE_CONT, "^\t\t0x%x %s\n", - Km_Free[i].caller[j], - (char *)s3blookup((uint)Km_Free[i].caller[j])); - else - cmn_err(CE_CONT, "^\t\t0x%x\n", - Km_Free[i].caller[j]); - } - } -} - -/* - * The kernel text start address and kernel text length parameters should - * agree with the kernel text origin and length values given in the - * kernel ifile. These are used to detect when we traced back out of - * the kernel stack. - */ - -#define KTXTSTRT 0x40000000 -#define KTXTLEN 0x00160000 - - -/* - * kmem_find: look for 'addr' in freelists - */ -void -kmem_find(addr) -register void *addr; -{ - register freebuf *p; - register int i, size; - - for ( size = MINASMALL, i = SMINOFFSET; - size <= MAXABIG && i <= BMAXOFFSET; - ++i, size *= 2 ) { - for ( p = Km_FreeLists[i].fl_nextp; - p != (freebuf *)&Km_FreeLists[i]; - p = p->fb_nextp ) { - if ( p == (freebuf *)addr ) { - cmn_err(CE_NOTE, - "^kmem_find: found address 0x%x in %u-byte freelist\nprev ptr = 0x%x, next = 0x%x\n", - p, size, p->fb_prevp, p->fb_nextp); - return; - } - if ( BADADDR1(p) ) { - cmn_err(CE_WARN, - "^kmem_find: %u-byte freelist trashed:\n\t\tbufp = 0x%x\n", - size, p); - break; - } - } - } - return; -} -#endif /* DEBUG */ diff --git a/usr/src/uts/3b2/io/ldterm.c b/usr/src/uts/3b2/io/ldterm.c index f76cea0..11aca66 100644 --- a/usr/src/uts/3b2/io/ldterm.c +++ b/usr/src/uts/3b2/io/ldterm.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/ldterm.c 1.36" +#ident "@(#)kernel:io/ldterm.c 1.28" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -23,7 +23,7 @@ * Notice of copyright on this source code product does not indicate * publication. * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. * @@ -103,12 +103,12 @@ int ldterm_debug = 0; * matter how much bigger than the high water mark it is. */ static struct module_info ldtermmiinfo = { - 0x0bad, + 0xABCD, "ldterm", 0, - 256, 512, - 200 + 300, + 100 }; static struct qinit ldtermrinit = { @@ -121,12 +121,12 @@ static struct qinit ldtermrinit = { }; static struct module_info ldtermmoinfo = { - 0x0bad, + 0xABCD, "ldterm", 0, - INFPSZ, - 1, - 0 + 512, + 300, + 200 }; static struct qinit ldtermwinit = { @@ -323,17 +323,11 @@ ldtermopen(q, devp, oflag, sflag, crp) (void) splx(s); } strop = (struct stroptions *)bp->b_wptr; -#ifdef SVR32 strop->so_flags = SO_READOPT|SO_HIWAT|SO_LOWAT|SO_NDELON|SO_ISTTY; -#endif /* SVR32 */ -#ifdef SVR40 - strop->so_flags = - SO_READOPT|SO_HIWAT|SO_LOWAT|SO_NDELON|SO_ISTTY|SO_STRHOLD; -#endif /* SVR40 */ strop->so_readopt = RMSGN; - strop->so_hiwat = 512; - strop->so_lowat = 128; + strop->so_hiwat = 300; + strop->so_lowat = 200; bp->b_wptr += sizeof (struct stroptions); bp->b_datap->db_type = M_SETOPTS; putnext(q, bp); @@ -476,7 +470,7 @@ ldtermrput(q, mp) */ if ((mp->b_wptr - mp->b_rptr) != sizeof (struct iocblk)) { - DEBUG3 (("Non standard M_CTL received by the ldterm module\n")); + cmn_err (CE_NOTE,"Non standard M_CTL received by the ldterm module\n"); /* May be for someone else; pass it on */ putnext (q, mp); return; @@ -489,7 +483,7 @@ ldtermrput(q, mp) DEBUG3(("ldtermrput: M_CTL Query Reply\n")); if (!mp->b_cont) { - DEBUG3 (("No information in Query Message\n")); + cmn_err (CE_NOTE,"No information in Query Message\n"); break; } if ((mp->b_cont->b_wptr - mp->b_cont->b_rptr) == @@ -543,7 +537,8 @@ ldtermrput(q, mp) break; } #ifdef SVR40 - drv_setparm(SYSRAWC, msgdsize(mp)); + if (mp->b_wptr - mp->b_rptr) + drv_setparm(SYSRAWC, (mp->b_wptr - mp->b_rptr)); #endif /* SVR40 */ /* @@ -636,7 +631,6 @@ ldtermrput(q, mp) if (c == tp->t_modes.c_cc[VSTOP] || c == tp->t_modes.c_cc[VSTART]) continue; - } /* * Check for "literal next" character * and "flush output" character. @@ -663,6 +657,7 @@ ldtermrput(q, mp) continue; } } + } tp->t_modes.c_lflag &= ~FLUSHO; @@ -825,18 +820,14 @@ ldtermrsrv(q) while ((mp = getq(q)) != NULL) { if (mp->b_datap->db_type <= QPCTL && !canput(q->q_next)) { /* - * Stream head is flow controlled. If echo is turned on, - * flush the read side or send a bell down the line - * to stop input and process the current message. - * Otherwise(putbq) the user will not see any response to - * to the typed input. Typically happens if there is no - * reader process. Note that you will loose the data - * in this case if the data is coming too fast. There - * is an assumption here that if ECHO is turned on its - * some user typing the data on a terminal and its not network. + * Stream head flow controlled + * In non-canonical mode its ok to put it back on the + * the queue but in canonical there will be no echo + * if there is no reader, flush the read side and + * process the current message and ship it up */ - if (tp->t_modes.c_lflag & ECHO) { + if (CANON_MODE) { if (tp->t_modes.c_iflag & IMAXBEL) { ldterm_outchar(CTRL('g'), WR(q), 4, tp); } @@ -982,6 +973,11 @@ ldtermrsrv(q) * implementation. */ +#ifdef SVR40 + if (bp->b_wptr - bp->b_rptr) + drv_setparm(SYSCANC, + (bp->b_wptr - bp->b_rptr)); +#endif /* SVR40 */ while (bp->b_rptr < bp->b_wptr) { c = *bp->b_rptr++; if ((bpt = ldterm_docanon(c, bpt, @@ -1353,9 +1349,8 @@ ldterm_trim(tp) register mblk_t *bpt; register mblk_t *bp; - ASSERT(tp->t_endmsg); - bpt = tp->t_endmsg; - + if ((bpt = tp->t_endmsg) == NULL) + panic("ldterm_trim called with no message"); if (bpt->b_rptr == bpt->b_wptr) { /* * This mblk is now empty. @@ -1365,8 +1360,8 @@ ldterm_trim(tp) bp = tp->t_message; if (bp != bpt) { while (bp->b_cont != bpt) { - ASSERT(bp->b_cont); - bp = bp->b_cont; + if ((bp = bp->b_cont) == NULL) + panic("ldterm_unget: current input line mislinked"); } bp->b_cont = NULL; freeb(bpt); @@ -1918,14 +1913,13 @@ DEBUG4 (("Unsetting TS_RTO, msglen = %d\n", tp->t_msglen)); else if (V_TIME) { DEBUG4 (("ldterm_dononcanon VTIME set\n")); - if (!(tp->t_state & TS_TACT)) { - DEBUG4 (("ldterm_dononcanon ldterm_vmin_timeout called\n")); + if (!(tp->t_state & TS_TACT)) + DEBUG4 (("ldterm_dononcanon VTIME set\n")); ldterm_vmin_timeout (q); - } } if (free_flag) - DEBUG4 (("CAUTION message block not freed\n")); + cmn_err (CE_NOTE, "CAUTION message block not freed\n"); return (newmsg(tp)); } @@ -1969,9 +1963,8 @@ ldterm_echo(c, q, ebsize, tp) } ldterm_outchar(c, q, ebsize, tp); return (i + 1); - /* echo only special control character and the Bell */ } else if ((c > 037 && c != 0177) || c == '\t' || c == '\n' - || c == '\r' || c == '\b' || c == 007) { + || c == '\r' || c == '\b') { ldterm_outchar(c, q, ebsize, tp); return (i + 1); } @@ -2087,7 +2080,7 @@ ldterm_msg_upstream(q, tp) #ifdef SVR40 if (CANON_MODE) { - drv_setparm(SYSCANC, msgdsize(bp)); + drv_setparm(SYSCANC, (bp->b_wptr - bp->b_rptr)); } #endif /* SVR40 */ tp->t_message = NULL; @@ -2202,7 +2195,8 @@ ldtermwput(q, mp) } /* Update sysinfo outch */ #ifdef SVR40 - drv_setparm(SYSOUTC, msgdsize(mp)); + if (mp->b_wptr - mp->b_rptr) + drv_setparm(SYSOUTC, (mp->b_wptr - mp->b_rptr)); #endif /* SVR40 */ putnext(q, mp); break; @@ -2233,9 +2227,6 @@ ldterm_output_msg(q, imp, omp, tp, bsize, echoing) register int count, ctype; register int bytes_left; - mblk_t *bp; /* block to stuff an M_DELAY message in */ - - /* * Allocate a new block into which to put bytes. * If we can't, we just drop the rest of the message on the @@ -2537,9 +2528,9 @@ ldterm_output_msg(q, imp, omp, tp, bsize, echoing) count = 0; break; } + *obp->b_wptr++ = c; + bytes_left--; } - *obp->b_wptr++ = c; - bytes_left--; } break; @@ -2601,24 +2592,14 @@ ldterm_output_msg(q, imp, omp, tp, bsize, echoing) bytes_left--; } while (--count != 0); } else { - if ((tp->t_modes.c_lflag & FLUSHO) + if (!(tp->t_modes.c_lflag & FLUSHO) && (tp->t_modes.c_lflag & IEXTEN)) { - freemsg(omp); /* drop on floor */ - } else { - /* Update sysinfo outch */ -#ifdef SVR40 - drv_setparm(SYSOUTC, msgdsize(omp)); -#endif /* SVR40 */ + /** tk_nout += msgdsize(omp); **/ putnext(q, omp); - /* - * Send M_DELAY downstream - */ - if (( bp = allocb( 1, BPRI_MED)) != NULL) { - bp->b_datap->db_type = M_DELAY; - *bp->b_wptr++ = count; - (*q->q_next->q_qinfo->qi_putp)( q->q_next, bp); - } - } + (void) putctl1(q->q_next, + M_DELAY, count); + } else + freemsg(omp); /* drop on floor */ bytes_left = 0; /* * We have to start a new message; @@ -2694,11 +2675,7 @@ ldterm_dosig(q, sig, c, mtype, mode) { register ldtermstd_state_t *tp = (ldtermstd_state_t *)q->q_ptr; - /* - * c == \0 is brk case; need to flush on BRKINT even - * if noflsh is set. - */ - if ((!(tp->t_modes.c_lflag & NOFLSH)) || (c == '\0')) { + if (!(tp->t_modes.c_lflag & NOFLSH)) { if (mode) { /* * Flush read or write side @@ -3268,25 +3245,17 @@ ldterm_vmin_timeout (q) register ldtermstd_state_t *tp; int s; - DEBUG4(("ldterm_vmin_timeout:\n")); - /* - * LDTERM may be popped when a function is pending in callout table. - * We could instead untimeout on the close but checking the q validity - * is fullproof - just in case multiple timers are active. - */ - if (!q) { - DEBUG4( ("ldterm_vmin_timeout returning with a bad q pointer\n")); - return; - } tp = (ldtermstd_state_t *)q->q_ptr; + DEBUG4(("ldterm_vmin_timeout:\n")); if (!tp) { DEBUG4( ("ldterm_vmin_timeout returning with a bad tp pointer\n")); return; } + tp->t_state &= ~TS_TACT; if (CANON_MODE || (tp->t_state & TS_CLOSE)) { DEBUG4 (("OOPS: CANON MODE or CLOSE interrupted\n")); return; @@ -3294,15 +3263,12 @@ ldterm_vmin_timeout (q) /* if VMIN has any value, the timer is to be started after one * char has been received only (if need be). Hence t_msglen * should never be equal to zero here if VMIN > 0. - * However, this can happens in some situations like flush - * followed by input before the timer expires etc. */ if ((tp->t_msglen == 0) && V_MIN) { DEBUG4 (("OOPS: Timer messed up\n")); return; } - tp->t_state &= ~TS_TACT; if (!(tp->t_state & TS_RTO )) { tp->t_state |= TS_RTO | TS_TACT; DEBUG4( ("calling timeout from ldterm_vmin_timeout\n")); diff --git a/usr/src/uts/3b2/io/log.c b/usr/src/uts/3b2/io/log.c index 0734943..2ec6fb8 100644 --- a/usr/src/uts/3b2/io/log.c +++ b/usr/src/uts/3b2/io/log.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/log.c 1.14" +#ident "@(#)kernel:io/log.c 1.12" /* * Streams log driver. @@ -18,10 +18,10 @@ #include "sys/stream.h" #include "sys/strstat.h" #include "sys/log.h" -#include "sys/inline.h" #include "sys/strlog.h" #include "sys/systm.h" #include "sys/debug.h" +#include "sys/inline.h" #include "sys/cred.h" #include "sys/file.h" #include "sys/ddi.h" @@ -190,7 +190,6 @@ logwput(q, bp) register struct log *lp; struct log_ctl *lcp; mblk_t *cbp, *pbp; - int size; lp = (struct log *)q->q_ptr; switch (bp->b_datap->db_type) { @@ -233,11 +232,8 @@ logwput(q, bp) goto lognak; } s = splhi(); - if (putbufwpos > putbufrpos) - size = putbufwpos - putbufrpos; - else - size = putbufsz - putbufrpos + putbufwpos; - if (!(pbp = allocb(size, BPRI_HI))) { + if (!(pbp = allocb((putbufwpos - putbufrpos), + BPRI_HI))) { splx(s); freeb(cbp); iocp->ioc_error = EAGAIN; @@ -679,9 +675,8 @@ logcons(mp) register mblk_t *mp; { register int s, i; - register unsigned char *cp; register struct log *lp; - mblk_t *bp; + register unsigned char *cp; struct log_ctl *lcp; int nlog = 0; int didsee = 0; @@ -690,24 +685,21 @@ logcons(mp) * Assumption that only short messages get logged to the * console. That's why we don't use bcopy(). */ - bp = mp; s = splhi(); - for (mp = mp->b_cont; mp; mp = mp->b_cont) { - cp = mp->b_rptr; - while (cp < mp->b_wptr) { - if (++putbufwpos >= putbufsz) - putbufwpos = 0; - putbuf[putbufwpos] = *cp++; - } + cp = mp->b_cont->b_rptr; + while (cp < mp->b_cont->b_wptr) { + if (++putbufwpos >= putbufsz) + putbufwpos = 0; + putbuf[putbufwpos] = *cp++; } - lcp = (struct log_ctl *)bp->b_rptr; + lcp = (struct log_ctl *)mp->b_rptr; lcp->seq_no = log_conseq; i = CLONEMIN + 1; for (lp = &log_log[i]; i < log_cnt; i++, lp++) if (lp->log_state & LOGCONS) { nlog++; - didsee += sendmsg(lp, bp); + didsee += sendmsg(lp, mp); } if (didsee) diff --git a/usr/src/uts/3b2/io/mau.c b/usr/src/uts/3b2/io/mau.c index dc32e32..62f590b 100644 --- a/usr/src/uts/3b2/io/mau.c +++ b/usr/src/uts/3b2/io/mau.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/mau.c 1.8" +#ident "@(#)kernel:io/mau.c 1.6.1.3" /* * support functions for the WE 32106 Math Accelerator Unit @@ -106,9 +106,6 @@ void mau_save() { - /* Send NOP to MAU to clear hang problem */ - asm(" SPOPRS &0x4e7f, $0x0"); - /* Only need to save context if process used mau during */ /* last time slice as indicated by non-zero CSC bit */ @@ -211,9 +208,6 @@ k_siginfo_t *infop; return; } - /* Send NOP to MAU to clear hang problem */ - asm(" SPOPRS &0x4e7f, $0x0"); - /* Get the ASR from the MAU and store it in asr */ movfa(asr.word); @@ -474,9 +468,6 @@ caddr_t *fault_addr; /* used to contain/return fault addr */ extern int chkprob(); - /* Send NOP to MAU to clear hang problem */ - asm(" SPOPRS &0x4e7f, $0x0"); - /* clear out probe flag in ublock */ u.u_pgproc = 0; /* get pc for instruction that faulted */ diff --git a/usr/src/uts/3b2/io/mem.c b/usr/src/uts/3b2/io/mem.c index 85016c5..efceb43 100644 --- a/usr/src/uts/3b2/io/mem.c +++ b/usr/src/uts/3b2/io/mem.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/mem.c 1.16" +#ident "@(#)kernel:io/mem.c 1.14" #include "sys/types.h" #include "sys/sbd.h" #include "sys/param.h" @@ -48,7 +48,7 @@ STATIC int mmrw(); #define M_NULL 2 /* /dev/null - EOF & Rathole */ #define M_ZERO 3 /* /dev/zero - source of private memory */ -int mmdevflag = 0; +int mmdevflag = 2; /* * Avoid addressing invalid kernel page. This can happen, for example, @@ -79,8 +79,8 @@ mmclose(dev, flag, cr) /* ARGSUSED */ int -mmioctl(dev, cmd, arg, flag, cr, rvalp) - dev_t dev; +mmioctl(vp, cmd, arg, flag, cr, rvalp) + register struct vnode *vp; int cmd; int arg; int flag; diff --git a/usr/src/uts/3b2/io/nppc.c b/usr/src/uts/3b2/io/nppc.c index 53a5468..97b54e7 100644 --- a/usr/src/uts/3b2/io/nppc.c +++ b/usr/src/uts/3b2/io/nppc.c @@ -8,7 +8,7 @@ /* * PPC Peripheral (3B2) STREAMS PORT Controller Driver */ -#ident "@(#)kernel:io/nppc.c 1.34" +#ident "@(#)kernel:io/nppc.c 1.28" #include "sys/param.h" #include "sys/types.h" @@ -44,9 +44,6 @@ extern int npp_bnbr; clock_t npp_tm_delay = 30; /* Time delay for terminal to settle after self test */ int nppdevflag = 0; /* Indicates new interface for open and close to cunix */ -int npp_max_input = 1024; /* Maximum number of input chars. on the queue before -they are discarded */ - /* * function return codes @@ -93,7 +90,6 @@ char nppc_speeds[16] = { SG_DBLK nsg_dblk; /* Data block for sysgen. See queue.h */ -int npp_dbg = 0; int pmpopen = 0; /* global pump flag */ int nversflag; int nloadflag; @@ -107,7 +103,7 @@ int nloadflag; #define TP(b,p) &npp_tty[b*5+p] /* tp from board and port */ /* - * npp_setparm slpnd values + * nppsetparm slpind values */ #define CANSLEEP 1 /* Sleep possible because of user context */ #define DONTSLEEP 0 /* Sleep impossible because of lack of user context */ @@ -125,19 +121,18 @@ extern int nlla_cqueue(); extern int splx(); extern int splstr(); extern paddr_t kvtophys(); +extern int bufawake(); extern void nlla_express(); -STATIC int npp_putioc(); -STATIC int npp_srvioc(); -STATIC int npp_setparm(); -STATIC void npp_flush(); -STATIC int npp_versreq(); +STATIC int putioc(); +STATIC int srvioc(); +STATIC int nppsetparm(); +STATIC void nttflush(); +STATIC int nversreq(); STATIC int npp_ba_mctl(); -STATIC int npp_abuf_to_ppc(); -STATIC int npp_copy_to_lbuf(); -STATIC int npp_bufawake(); -STATIC void npp_nodrain(); -STATIC int npp_getoblk(); +STATIC int abuf_to_ppc(); +STATIC int copy_to_lbuf(); +STATIC int getoblk(); /************************ * Streams Declarations * @@ -147,7 +142,7 @@ STATIC int nppopen(), nppclose(), nppoput(), npposrv(), nppisrv(); struct module_info ppc_info = { 99, "pp", 0, 512, 512, 256}; /* init: put srv open close admin stat */ -STATIC struct qinit npprinit = { NULL, nppisrv, nppopen, nppclose, NULL, &ppc_info, NULL}; +STATIC struct qinit npprinit = { putq, nppisrv, nppopen, nppclose, NULL, &ppc_info, NULL}; STATIC struct qinit nppwinit = { nppoput, npposrv, NULL, NULL, NULL, &ppc_info, NULL}; struct streamtab nppinfo = { &npprinit, &nppwinit, NULL, NULL}; @@ -173,9 +168,10 @@ cred_t *credp; mblk_t *mop; int sx; + int nbufs; /* number of buffers allocated on PPC */ int mdev; /* the minor device number */ int i; /* for loop variable */ - int npp_ret; /* return from npp_setparm() */ + int npp_ret; /* return from nppsetparm() */ int lmaj; /* lastmajor, used in itoemajor */ @@ -257,7 +253,7 @@ cred_t *credp; * controlling terminal. */ while (( mop = allocb( sizeof( struct stroptions), BPRI_HI)) == NULL) { - bufcall( sizeof( struct stroptions), BPRI_MED, npp_bufawake, (long)tp); + bufcall( sizeof( struct stroptions), BPRI_MED, bufawake, (long)tp); if ( sleep( (caddr_t)&tp->t_cc[3], TTIPRI | PCATCH)) { splx( sx); return( EINTR); @@ -291,7 +287,7 @@ cred_t *credp; tp->t_ioctlp = NULL; splx( sx); - if ( npp_ret = npp_setparm( tp, CANSLEEP)) + if ( npp_ret = nppsetparm( tp, CANSLEEP)) return( npp_ret); } else { /* @@ -314,7 +310,7 @@ cred_t *credp; if ( sleep( (caddr_t)&tp->t_line, TTIPRI | PCATCH)) { /* * Free the message buffer that was - * allocated in npp_setparm() + * allocated in nppsetparm() */ if ( tp->t_in.bu_bp != NULL) { freeb( tp->t_in.bu_bp); @@ -334,9 +330,13 @@ cred_t *credp; /* * set up to allocate receive buffers */ - if (( ppcp->qcb < MAX_RBUF) && nppcpid[mdev] != CENTRONICS) { + if ( !( tp->t_dstat & SUPBUF) && nppcpid[mdev] != CENTRONICS) { + + if ( ppcp->dcb == 0) /* first open */ + ppcp->dcb += INITCB; + ppcp->dcb += CB_PER_PPC; - ppcp->dcb = MAX_RBUF; + tp->t_dstat |= SUPBUF; tp->t_in.bu_ptr = NULL; tp->t_in.bu_cnt = 0; @@ -344,41 +344,53 @@ cred_t *credp; /* * Allocate some recv blocks and send the buf ptrs to the PPC. */ + nbufs = 0; while ( ppcp->dcb > ppcp->qcb) { if (( bp = allocb( PPBUFSIZ, BPRI_MED)) == NULL) { /* * wait until a buffer becomes available */ tp->t_state |= TTIOW; - bufcall( PPBUFSIZ, BPRI_MED, npp_bufawake, (long)tp); + bufcall( PPBUFSIZ, BPRI_MED, bufawake, (long)tp); if ( sleep( (caddr_t)&tp->t_cc[3], TTIPRI | PCATCH)) { tp->t_state &= ~TTIOW; + tp->t_dstat &= ~SUPBUF; /* * Flush and disconnect the PPC. */ - nlla_regular( nppcbid[tp->t_dev], TRUE, 0, nppcpid[tp->t_dev], PPC_DISC, 0, (char)0, GR_DTR|GR_CREAD); + nlla_regular( nppcbid[tp->t_dev], TRUE, 0, nppcpid[tp->t_dev], PPC_DISC, 0, (char)nbufs, GR_DTR|GR_CREAD); + + ppcp->dcb -= CB_PER_PPC; + if ( ppcp->dcb == INITCB) + ppcp->dcb -= INITCB; splx( sx); return( EINTR); } } - tp->t_lbuf = NULL; - if ( npp_abuf_to_ppc( tp, bp) == E_LLA_QUEUE) { + if ( abuf_to_ppc( tp, bp) == E_LLA_QUEUE) { /* * Hardware failure + */ + tp->t_dstat &= ~SUPBUF; + + /* * Flush and disconnect the PPC. */ - nlla_regular( nppcbid[tp->t_dev], TRUE, 0, nppcpid[tp->t_dev], PPC_DISC, 0, (char)0, GR_DTR|GR_CREAD); + nlla_regular( nppcbid[tp->t_dev], TRUE, 0, nppcpid[tp->t_dev], PPC_DISC, 0, (char)nbufs, GR_DTR|GR_CREAD); + ppcp->dcb -= CB_PER_PPC; + if ( ppcp->dcb == INITCB) + ppcp->dcb -= INITCB; splx( sx); return( EIO); } + nbufs++; ppcp->qcb++; } } tp->t_state |= ISOPEN; /* Mark TTY as open. */ - noenable( WR( tp->t_rdqp)); splx( sx); return( 0); } @@ -387,12 +399,12 @@ cred_t *credp; /* * Awakens an open waiting for receive buffers to become available. */ -STATIC int -npp_bufawake( tp) +int +bufawake( tp) register struct strtty *tp; { - tp->t_state &= ~TTIOW; - wakeup( (caddr_t)&tp->t_cc[3]); + tp->t_state &= ~(TTIOW); + wakeup( (caddr_t) & tp->t_cc[3]); } @@ -410,29 +422,18 @@ register cred_t *credp; register struct ppcboard *ppcp; int sx; - int tid; + int eflush; char dcode; - sx = splstr(); /* * Get the tty structure for the terminal */ tp = (struct strtty *)qp->q_ptr; - if ( !( tp->t_state & ISOPEN)) { /* Check if it's closed already. */ - splx( sx); + if ( !( tp->t_state & ISOPEN)) /* See if it's closed already. */ return( 0); - } - - /* - * May need to releive flow control - */ - if (( tp->t_state & TBLOCK) && ( tp->t_iflag & IXOFF)) { - nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_UNB); - tp->t_state &= ~TBLOCK; - } pmpopen = 0; nversflag = 0; @@ -447,42 +448,31 @@ register cred_t *credp; || tp->t_state & ( BUSY | WIOC) || tp->t_out.bu_bp != NULL)) { - if ( npp_getoblk( tp) == 0) { + if ( getoblk( tp) == 0) { + sx = splstr(); tp->t_state |= TTIOW; - tp->t_dstat |= CLDRAIN; - /* - * Need timeout here to break a deadlock - * condition since the last transaction - * to the ppc could have been a suspend output - * or there could be a hardware problem on the - * board. In either case the transmitter could - * be disabled and further transmission to the - * port is suspended. - */ - tid = timeout( npp_nodrain, (caddr_t)tp, CL_TIME); - sleep( (caddr_t)&tp->t_oflag, PZERO|PCATCH); - if ( tp->t_dstat & CLDRAIN) { - untimeout( tid); - tp->t_dstat &= ~CLDRAIN; - } else { - tp->t_state &= ~(TTIOW | BUSY | WIOC); + if ( sleep( (caddr_t)&tp->t_oflag, PZERO + 1|PCATCH)) { + tp->t_state &= ~TTIOW; + splx( sx); break; } + splx( sx); } } + sx = splstr(); if ( tp->t_state & CARR_ON) { if ( tp->t_dstat & OPDRAIN) { - tp->t_dstat &= ~OPDRAIN; + tp->t_dstat &= ~(OPDRAIN); wakeup( (caddr_t)&tp->t_cc[1]); } } else { if ( tp->t_state & BUSY) - tp->t_state &= ~BUSY; + tp->t_state &= ~(BUSY); nlla_ldeuld( nppcbid[tp->t_dev], nppcpid[tp->t_dev]); } - tp->t_state &= ~ISOPEN; /* TTY marked closed. */ + tp->t_state &= ~(ISOPEN); /* TTY marked closed. */ /* * deallocate buffers */ @@ -499,6 +489,12 @@ register cred_t *credp; tp->t_in.bu_ptr = NULL; + ppcp->dcb -= CB_PER_PPC; + if ( ppcp->dcb <= INITCB) + ppcp->dcb -= INITCB; + + if ( ppcp->dcb <= 0) /* this is the last close on the board */ + ppcp->dcb = 0; } if ( tp->t_ioctlp != NULL) { /* dump the ioctl buffer */ @@ -512,6 +508,11 @@ register cred_t *credp; } tp->t_out.bu_ptr = NULL; + tp->t_dstat &= ~(SUPBUF); /* No bufs requested for this TTY. */ + + /* + * Send the final disconnect request to the PORTS board. + */ while ( !( nlla_xfree( nppcbid[tp->t_dev], nppcpid[tp->t_dev]))) { tp->t_dstat |= WENTRY; if ( sleep( (caddr_t)&tp->t_cc[1], TTOPRI | PCATCH)) { @@ -521,7 +522,15 @@ register cred_t *credp; } } - tp->t_state &= ~CARR_ON; + /* + * Calculate the number of message buffers to free out of the PPC. + * For each buffer that is released by the PCC board a + * PPC_RECV will be received( see nppint()) by the host after the + * PPC board has received the Disconnect(PPC_DISC) from the host. + */ + if (( eflush = ppcp->qcb - ppcp->dcb) < 0) + eflush = 0; + tp->t_state &= ~(CARR_ON); if ( tp->t_cflag & HUPCL) /* Hang up on disconnect. */ dcode = (GR_DTR | GR_CREAD); else @@ -531,27 +540,16 @@ register cred_t *credp; * process could have opened the ports line with * O_NDELAY off and another with the flag on. */ - tp->t_state &= ~WOPEN; - tp->t_rdqp = NULL; + tp->t_state &= ~WOPEN; /* * Flush and disconnect the PPC. */ - nlla_regular( nppcbid[tp->t_dev], TRUE, 0, nppcpid[tp->t_dev], PPC_DISC, 0, (char)0, dcode); + nlla_regular( nppcbid[tp->t_dev], TRUE, 0, nppcpid[tp->t_dev], PPC_DISC, 0, (char)eflush, dcode); splx( sx); return( 0); } -/* - * Wakeup sleep in close routine. - */ -STATIC void -npp_nodrain( tp) -register struct strtty *tp; -{ - tp->t_dstat &= ~CLDRAIN; - wakeup( (caddr_t)&tp->t_oflag); -} /**************************************** * * @@ -580,8 +578,13 @@ register mblk_t *bp; case M_DATA: /* - * Translate complex messages to simple messages + * Delay sending data to terminal if carrier not + * present */ + if ( !( tp->t_state & CARR_ON)) { + putq( qp, bp); + return( 0); + } while ( bp != NULL) { msgbp = unlinkb( bp); bp->b_cont = NULL; @@ -592,31 +595,24 @@ register mblk_t *bp; bp = msgbp; } - /* - * Delay sending data to terminal if carrier not - * present - */ - if ( !( tp->t_state & CARR_ON)) - return( 0); - if ( qp->q_first != NULL) - npp_getoblk( tp); + getoblk( tp); break; case M_IOCTL: - npp_putioc( qp, bp); + putioc( qp, bp); if ( qp->q_first != NULL) - npp_getoblk( tp); + getoblk( tp); break; case M_FLUSH: sx = splstr(); if ( *bp->b_rptr & FLUSHW) { - npp_flush( tp, FWRITE); + nttflush( tp, FWRITE); *bp->b_rptr &= ~FLUSHW; } if ( *bp->b_rptr & FLUSHR) { - npp_flush( tp, FREAD); + nttflush( tp, FREAD); putnext( RD( qp), bp); } else freemsg( bp); @@ -627,10 +623,10 @@ register mblk_t *bp; case M_START: sx = splstr(); nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_RES); - tp->t_state &= ~BUSY; + tp->t_state &= ~(BUSY | TBLOCK | WIOC); splx( sx); freemsg( bp); - npp_getoblk( tp); + getoblk( tp); break; case M_STOP: @@ -644,7 +640,7 @@ register mblk_t *bp; case M_STARTI: sx = splstr(); nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_UNB); - tp->t_state &= ~TBLOCK; + tp->t_state &= ~(TBLOCK); splx( sx); freemsg( bp); break; @@ -688,7 +684,7 @@ register struct strtty *tp; sx = splstr(); if ( tp->t_out.bu_bp == NULL) { /* nothing to send */ - tp->t_state &= ~BUSY; + tp->t_state &= ~(BUSY); tp->t_out.bu_ptr = NULL; tp->t_out.bu_cnt = 0; splx( sx); @@ -720,7 +716,7 @@ register struct strtty *tp; * Called by Xmit Complete interrupt handler and bufcall() routines. */ STATIC int -npp_getoblk( tp) +getoblk( tp) register struct strtty *tp; { register mblk_t *msgbp; @@ -728,16 +724,10 @@ register struct strtty *tp; int sx; - sx = splstr(); - if ( !tp->t_rdqp) { /* If the stream has gone away just return */ - splx( sx); - return( 0); - } - if ( tp->t_state & (BUSY | WIOC)) { - splx( sx); + splx(sx); return( 0); } @@ -747,7 +737,7 @@ register struct strtty *tp; * wakeup close write queue drain */ if ( tp->t_state & TTIOW) { - tp->t_state &= ~TTIOW; + tp->t_state &= ~(TTIOW); wakeup((caddr_t) &tp->t_oflag); } splx( sx); @@ -768,12 +758,12 @@ register struct strtty *tp; tp->t_out.bu_bp = NULL; tp->t_out.bu_ptr = NULL; tp->t_out.bu_cnt = 0; - tp->t_state &= ~BUSY; + tp->t_state &= ~(BUSY); } break; case M_IOCTL: - npp_srvioc( qp, msgbp); + srvioc( qp, msgbp); break; default: @@ -789,7 +779,7 @@ register struct strtty *tp; * ioctl handler for output PUT procedure */ STATIC int -npp_putioc( qp, bp) +putioc( qp, bp) register queue_t *qp; register mblk_t *bp; { @@ -838,7 +828,7 @@ register mblk_t *bp; putq( qp, bp); break; } - npp_srvioc( qp, bp); + srvioc( qp, bp); break; case TCSETA: { /* immediate parm set */ @@ -864,7 +854,7 @@ register mblk_t *bp; bcopy( (caddr_t)cb->c_cc, (caddr_t)tp->t_cc, NCC); tp->t_ioctlp = NULL; - if ( err_ret = npp_setparm( tp, DONTSLEEP)) { + if ( err_ret = nppsetparm( tp, DONTSLEEP)) { bp->b_datap->db_type = M_IOCNAK; msgb1p = unlinkb( bp); freeb( msgb1p); @@ -908,7 +898,7 @@ register mblk_t *bp; bcopy( (caddr_t)cb->c_cc, (caddr_t)tp->t_cc, NCCS); tp->t_ioctlp = NULL; - if ( err_ret = npp_setparm( tp, DONTSLEEP)) { + if ( err_ret = nppsetparm( tp, DONTSLEEP)) { bp->b_datap->db_type = M_IOCNAK; msgb1p = unlinkb( bp); freeb( msgb1p); @@ -931,7 +921,7 @@ register mblk_t *bp; if (( msgbp = allocb( sizeof(struct termio), BPRI_MED)) == NULL) { putbq( qp, bp); - bufcall( sizeof( struct termio), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof( struct termio), BPRI_MED, getoblk, (long)tp); return( 0); } if ( bp->b_cont) @@ -946,7 +936,7 @@ register mblk_t *bp; cb->c_line = tp->t_line; bcopy( (caddr_t)tp->t_cc, (caddr_t)cb->c_cc, NCC); - bp->b_cont->b_wptr += sizeof( struct termio); + bp->b_cont->b_wptr += sizeof(struct termio); bp->b_datap->db_type = M_IOCACK; iocbp->ioc_count = sizeof(struct termio); putnext( RD(qp), bp); @@ -959,9 +949,9 @@ register mblk_t *bp; if ( bp->b_cont) freemsg( bp->b_cont); /* Bad user formatted I_STR */ - if (( msgbp = allocb( sizeof( struct termios), BPRI_MED)) == NULL) { + if (( msgbp = allocb( sizeof(struct termios), BPRI_MED)) == NULL) { putbq( qp, bp); - bufcall( sizeof( struct termios), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof( struct termios), BPRI_MED, getoblk, (long)tp); return( 0); } bp->b_cont = msgbp; @@ -1000,11 +990,11 @@ register mblk_t *bp; if (( msgbp = allocb( 4, BPRI_HI)) == NULL) { putbq( qp, bp); - bufcall( 4, BPRI_HI, npp_getoblk, (long)tp); + bufcall( 4, BPRI_HI, getoblk, (long)tp); return( 0); } bp->b_cont = msgbp; - if ( err_ret = npp_versreq( nppcbid[tp->t_dev])) { + if ( err_ret = nversreq( nppcbid[tp->t_dev])) { bp->b_datap->db_type = M_IOCNAK; iocbp->ioc_error = err_ret; putnext( RD( qp), bp); @@ -1218,7 +1208,7 @@ register mblk_t *bp; * */ STATIC int -npp_srvioc( qp, bp) +srvioc( qp, bp) register queue_t *qp; register mblk_t *bp; { @@ -1253,7 +1243,7 @@ register mblk_t *bp; register struct termio *cb; - npp_flush( tp, FREAD); + nttflush( tp, FREAD); putctl1( RD(qp)->q_next, M_FLUSH, FLUSHR); if ( !bp->b_cont) { @@ -1277,10 +1267,10 @@ register mblk_t *bp; else tp->t_ioctlp = NULL; - if (( err_ret = npp_setparm( tp, DONTSLEEP)) == EAGAIN) { + if (( err_ret = nppsetparm( tp, DONTSLEEP)) == EAGAIN) { tp->t_ioctlp = NULL; putbq( qp, bp); - bufcall( sizeof( Options), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof( Options), BPRI_MED, getoblk, (long)tp); return( 0); } else if ( err_ret != 0) { tp->t_ioctlp = NULL; @@ -1332,10 +1322,10 @@ register mblk_t *bp; else tp->t_ioctlp = NULL; - if (( err_ret = npp_setparm( tp, DONTSLEEP)) == EAGAIN) { + if (( err_ret = nppsetparm( tp, DONTSLEEP)) == EAGAIN) { tp->t_ioctlp = NULL; putbq( qp, bp); - bufcall( sizeof( Options), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof( Options), BPRI_MED, getoblk, (long)tp); return( 0); } else if ( err_ret != 0) { tp->t_ioctlp = NULL; @@ -1367,7 +1357,7 @@ register mblk_t *bp; register struct termios *cb; - npp_flush( tp, FREAD); + nttflush( tp, FREAD); putctl1( RD(qp)->q_next, M_FLUSH, FLUSHR); if ( !bp->b_cont) { @@ -1391,10 +1381,10 @@ register mblk_t *bp; else tp->t_ioctlp = NULL; - if (( err_ret = npp_setparm( tp, DONTSLEEP)) == EAGAIN) { + if (( err_ret = nppsetparm( tp, DONTSLEEP)) == EAGAIN) { tp->t_ioctlp = NULL; putbq( qp, bp); - bufcall( sizeof( Options), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof( Options), BPRI_MED, getoblk, (long)tp); return( 0); } else if ( err_ret != 0) { tp->t_ioctlp = NULL; @@ -1447,10 +1437,10 @@ register mblk_t *bp; else tp->t_ioctlp = NULL; - if (( err_ret = npp_setparm( tp, DONTSLEEP)) == EAGAIN) { + if (( err_ret = nppsetparm( tp, DONTSLEEP)) == EAGAIN) { tp->t_ioctlp = NULL; putbq( qp, bp); - bufcall( sizeof( Options), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof( Options), BPRI_MED, getoblk, (long)tp); return( 0); } else if ( err_ret != 0) { tp->t_ioctlp = NULL; @@ -1483,7 +1473,7 @@ register mblk_t *bp; if (( msgbp = allocb( sizeof( struct termio), BPRI_MED)) == NULL) { putbq( qp, bp); - bufcall( sizeof(struct termio), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof(struct termio), BPRI_MED, getoblk, (long)tp); return( 0); } if ( bp->b_cont) @@ -1510,7 +1500,7 @@ register mblk_t *bp; if (( msgbp = allocb( sizeof(struct termios), BPRI_MED)) == NULL) { putbq( qp, bp); - bufcall( sizeof(struct termios), BPRI_MED, npp_getoblk, (long)tp); + bufcall( sizeof(struct termios), BPRI_MED, getoblk, (long)tp); return( 0); } if ( bp->b_cont) @@ -1565,12 +1555,12 @@ register mblk_t *bp; /* * Sets parameters on the PPC board. - * Called from npp_putioc() and npp_srvioc(). + * Called from putioc() and srvioc(). * NOTE: this routine can be called form routines that may or may not * have a user context */ STATIC int -npp_setparm( tp, slpind) +nppsetparm( tp, slpind) register struct strtty *tp; register int slpind; /* = CANSLEEP if sleep possible, = DONTSLEEP otherwise */ { @@ -1601,7 +1591,7 @@ register int slpind; /* = CANSLEEP if sleep possible, = DONTSLEEP otherwise */ if ( sleep( (caddr_t)&tp->t_cc[1], TTOPRI + 1 | PCATCH)) { /* * Sleep called with PCATCH so that on user - * interrupt of the open call the processor + * interupt of the open call the processor * priority is reset before control is returned * to the user */ @@ -1637,7 +1627,7 @@ register int slpind; /* = CANSLEEP if sleep possible, = DONTSLEEP otherwise */ freeb( bp); tp->t_state &= ~WIOC; splx( sx); - return( EINVAL); + return( EIO); } if ( nppcpid[tp->t_dev] == CENTRONICS) @@ -1703,47 +1693,10 @@ register struct strtty *tp; tp->t_in.bu_ptr = NULL; - /* - * If input flow control is on and we hit the hi-water mark - * then transmit a STOP character. - */ - if (( tp->t_iflag & IXOFF) && !( tp->t_state & TBLOCK) - && ( (int)tp->t_in.bu_cnt + (int)tp->t_rdqp->q_count >= (int)tp->t_rdqp->q_hiwat)) { - nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_BLK); - tp->t_state |= TBLOCK; - } - /* - * Check if there is room in the queue to hold the message. - */ - if ( (int)tp->t_in.bu_cnt + (int)tp->t_rdqp->q_count > npp_max_input) { - /* - * Dump all data in the input stream - * by first flushing the read queue and then - * sending upstream an M_FLUSH and - * reuse the large buffer. - */ - flushq( tp->t_rdqp, FLUSHDATA); - putctl1( tp->t_rdqp->q_next, M_FLUSH, FLUSHR); - if ( tp->t_lbuf) - tp->t_lbuf->b_rptr = tp->t_lbuf->b_wptr = tp->t_lbuf->b_datap->db_base; - /* - * May need to relieve flow control - */ - if (( tp->t_state & TBLOCK) && ( tp->t_iflag & IXOFF)) { - nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_UNB); - tp->t_state &= ~TBLOCK; - } - splx( sx); - /* - * Return the current buffer address to the ppc - */ - return( npp_abuf_to_ppc( tp, bp)); - } - /* * Copy buffer just received to a large buffer */ - if (( fn_ret = npp_copy_to_lbuf( tp, bp)) != SUCCESS) { + if (( fn_ret = copy_to_lbuf( tp, bp)) != SUCCESS) { ppcp->rbp[i].bp = bp; splx( sx); return( fn_ret); @@ -1753,7 +1706,7 @@ register struct strtty *tp; */ if (( mp = dupb( tp->t_lbuf)) == NULL) { /* - * Have to undo the npp_copy_to_lbuf + * Have to undo the copy_to_lbuf */ tp->t_lbuf->b_wptr -= tp->t_in.bu_cnt; ppcp->rbp[i].bp = bp; @@ -1764,7 +1717,7 @@ register struct strtty *tp; /* * Return the current buffer address to the ppc */ - if (( fn_ret = npp_abuf_to_ppc( tp, bp)) != SUCCESS) { + if (( fn_ret = abuf_to_ppc( tp, bp)) != SUCCESS) { tp->t_lbuf->b_wptr -= tp->t_in.bu_cnt; freeb( mp); splx( sx); @@ -1847,12 +1800,9 @@ register short bid; sx = splstr(); for ( i = 0; i < MAX_RBUF; i++) { if (( ppcp->rbp[i].bp != NULL) && ( ppcp->rbp[i].sp == (long)tp->t_in.bu_ptr)) { - bp = ppcp->rbp[i].bp; + freeb( ppcp->rbp[i].bp); ppcp->rbp[i].bp = NULL; - if ( npp_abuf_to_ppc( tp, bp) == E_LLA_QUEUE) { - putctl1( tp->t_rdqp->q_next, M_ERROR, EIO); - cmn_err( CE_WARN, "PORTS: Hardware error board %d, port %d. Can't get buffer\n", nppcbid[tp->t_dev], nppcpid[tp->t_dev]); - } + ppcp->qcb--; break; } } @@ -1875,7 +1825,7 @@ register short bid; if (( ppcp->rbp[i].bp != NULL) && ( ppcp->rbp[i].sp == (long)tp->t_in.bu_ptr)) { bp = ppcp->rbp[i].bp; ppcp->rbp[i].bp = NULL; - if ( npp_abuf_to_ppc( tp, bp) == E_LLA_QUEUE) { + if ( abuf_to_ppc( tp, bp) == E_LLA_QUEUE) { putctl1( tp->t_rdqp->q_next, M_ERROR, EIO); cmn_err( CE_WARN, "PORTS: Hardware error board %d, port %d. Can't get buffer\n", nppcbid[tp->t_dev], nppcpid[tp->t_dev]); } @@ -1889,7 +1839,7 @@ register short bid; if (( npp_ret = npp_in( tp)) != SUCCESS) { if ( npp_ret == E_LLA_QUEUE) { putctl1( tp->t_rdqp->q_next, M_ERROR, EIO); - npp_flush( tp, FREAD|FWRITE); + nttflush( tp, FREAD|FWRITE); cmn_err( CE_WARN, "PORTS: Hardware error board %d, port %d. Can't get buffer\n", nppcbid[tp->t_dev], nppcpid[tp->t_dev]); } else if ( npp_ret == E_NO_LBUFS) /* Ran out of "large" STREAMS buffers */ bufcall( LARGEBUFSZ, BPRI_MED, npp_in, (long)tp); @@ -1919,14 +1869,14 @@ register short bid; if ( tp->t_out.bu_cnt > PPBUFSIZ) tp->t_out.bu_cnt = PPBUFSIZ; else - tp->t_dstat &= ~SPLITMSG; + tp->t_dstat &= ~(SPLITMSG); if (( tp->t_state & WIOC) || ( npp_out( tp) == 0)) { tp->t_out.bu_bp->b_rptr -= ocnt; putbq( WR(tp->t_rdqp), tp->t_out.bu_bp); tp->t_out.bu_bp = NULL; - tp->t_state &= ~BUSY; - npp_getoblk( tp); /* try again */ + tp->t_state &= ~(BUSY); + getoblk( tp); /* try again */ } } else { if ( tp->t_out.bu_bp != NULL) { @@ -1935,17 +1885,15 @@ register short bid; } tp->t_out.bu_ptr = NULL; tp->t_out.bu_cnt = 0; - tp->t_state &= ~BUSY; - npp_getoblk( tp); /* get another block to send */ + tp->t_state &= ~(BUSY); + getoblk( tp); /* get another block to send */ } break; case PPC_ASYNC: - switch ( cqe.appl.pc[0]) { case AC_BRK: - drv_setparm( SYSRINT, 1); putctl( tp->t_rdqp->q_next, M_BREAK); @@ -1953,49 +1901,45 @@ register short bid; tp->t_state |= BUSY; nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_ABX); + break; case AC_DIS: - drv_setparm( SYSMINT, 1); - tp->t_state &= ~CARR_ON; - if ( tp->t_state & ISOPEN) { + tp->t_state &= ~(CARR_ON); + if ( tp->t_state & ISOPEN) putctl( tp->t_rdqp->q_next, M_HANGUP); - npp_flush( tp, (FREAD | FWRITE)); - } + nttflush( tp, (FREAD | FWRITE)); break; case AC_CON: - drv_setparm( SYSMINT, 1); tp->t_state |= CARR_ON; if ( tp->t_state & WOPEN) { tp->t_state &= ~WOPEN; - wakeup( (caddr_t)&tp->t_line); + wakeup( (caddr_t) & tp->t_line); } if (( WR( tp->t_rdqp)->q_first) != NULL) { drv_usecwait( drv_hztousec( npp_tm_delay)); /* delay npp_tm_delay ticks */ - npp_getoblk( tp); + getoblk( tp); } break; case AC_FLU: - if ( tp->t_dstat & WENTRY) { tp->t_dstat &= ~(SETOPT | WENTRY); wakeup( (caddr_t) & tp->t_cc[1]); } tp->t_state &= ~BUSY; if (( WR( tp->t_rdqp)->q_first) != NULL) - npp_getoblk( tp); + getoblk( tp); break; } break; case PPC_OPTIONS: - /* * Ack original TCSET??? ioctl here, since the * queues on the board are certainly drained @@ -2020,22 +1964,22 @@ register short bid; if ( tp->t_dstat & WENTRY) { tp->t_dstat &= ~(SETOPT | WENTRY); - wakeup( (caddr_t)&tp->t_cc[1]); + wakeup( (caddr_t) & tp->t_cc[1]); } - tp->t_state &= ~WIOC; + tp->t_state &= ~(WIOC); if (( WR( tp->t_rdqp)->q_first) != NULL) - npp_getoblk( tp); + getoblk( tp); break; case PPC_DISC: case PPC_CONN: if ( tp->t_dstat & WENTRY) { tp->t_dstat &= ~(SETOPT | WENTRY); - wakeup( (caddr_t)&tp->t_cc[1]); + wakeup( (caddr_t) & tp->t_cc[1]); } if (( WR( tp->t_rdqp)->q_first) != NULL) - npp_getoblk( tp); + getoblk( tp); break; case PPC_DEVICE: @@ -2055,7 +1999,7 @@ register short bid; break; case PPC_BRK: - tp->t_state &= ~WIOC; + tp->t_state &= ~(WIOC); /* * Ack original TCSBRK ioctl here, since the * queues on the board are certainly drained @@ -2073,7 +2017,7 @@ register short bid; } if (( WR( tp->t_rdqp)->q_first) != NULL) - npp_getoblk( tp); + getoblk( tp); break; case SYSGEN: @@ -2151,7 +2095,7 @@ register short bid; } } wakeup( (caddr_t)&ppcp->qcb); - npp_getoblk( tp); + getoblk( tp); break; default: @@ -2172,7 +2116,7 @@ register short bid; * flush TTY queues */ STATIC void -npp_flush( tp, cmd) +nttflush( tp, cmd) register struct strtty *tp; register int cmd; { @@ -2191,20 +2135,20 @@ register int cmd; * Dump the current xmit buffer */ if (( tp->t_out.bu_bp != NULL) && ( tp->t_dstat & SPLITMSG)) - tp->t_dstat &= ~SPLITMSG; + tp->t_dstat &= ~(SPLITMSG); if ( tp->t_out.bu_bp != NULL) { freemsg( tp->t_out.bu_bp); tp->t_out.bu_bp = NULL; } - tp->t_state &= ~BUSY; + tp->t_state &= ~(BUSY); /* * Awaken the close waiting for output to drain */ if ( tp->t_state & TTIOW) { - tp->t_state &= ~TTIOW; - wakeup( (caddr_t)&tp->t_oflag); + tp->t_state &= ~(TTIOW); + wakeup((caddr_t) &tp->t_oflag); } /* @@ -2218,19 +2162,15 @@ register int cmd; */ flushq( tp->t_rdqp, FLUSHDATA); - /* - * Reuse the large input buffer - */ - if ( tp->t_lbuf) - tp->t_lbuf->b_rptr = tp->t_lbuf->b_wptr = tp->t_lbuf->b_datap->db_base; - /* * Abort reception on the PPC */ nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_ABR); if ( tp->t_state & TBLOCK) { - tp->t_state &= ~TBLOCK; + tp->t_state &= ~(TBLOCK); + tp->t_state &= ~(WIOC); + tp->t_state &= ~(BUSY); nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_UNB); } } @@ -2302,7 +2242,7 @@ nppclr() } STATIC int -npp_versreq( bid) +nversreq( bid) short bid; { register struct ppcboard *tb; @@ -2336,31 +2276,43 @@ register queue_t *qp; { register mblk_t *mp; register struct strtty *tp; - register int sx; + + int sx; - sx = splstr(); tp = (struct strtty *)qp->q_ptr; + if (( tp->t_iflag & IXOFF) && ( tp->t_state & TBLOCK)) { + sx = splstr(); + nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_UNB); + tp->t_state &= ~(TBLOCK); + splx(sx); + } while (( mp = getq( qp)) != NULL) { - - if ( canput( qp->q_next) == 0) { - putbq( qp, mp); - splx( sx); - return( 0); - } - - putnext( qp, mp); /* - * May need to relieve flow control + * Note: only put back non-prioity messages + * send up all priority messages immediately these + * cannot be queued */ - if (( tp->t_state & TBLOCK) && ( tp->t_iflag & IXOFF) - && ( tp->t_rdqp->q_count <= tp->t_rdqp->q_lowat)) { - nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_UNB); - tp->t_state &= ~TBLOCK; - } + if ((( mp->b_datap->db_type & QPCTL) == QNORM) && ( canput( qp->q_next) == 0)) { + /* + * Should block the terminal from sending any more + * characters at this time. + * Set state to T_BLOCK and block out transmission. + * this procedure will be back enabled when + * the module upstream executes a getq(). + */ + putbq( qp, mp); + if ( tp->t_iflag & IXOFF) { + sx = splstr(); + nlla_express( nppcbid[tp->t_dev], 0, 0, nppcpid[tp->t_dev], PPC_DEVICE, 0L, DR_BLK); + tp->t_state |= TBLOCK; + splx( sx); + } + return( 0); + } else + putnext( qp, mp); } - splx( sx); return( 0); } /* @@ -2429,11 +2381,11 @@ register queue_t *qp; } /* - * Pass the address of the stream buffer bp->b_datap->db_base to the PPC + * Tell ppc the address of the stream buffer bp->b_datap->db_base */ STATIC int -npp_abuf_to_ppc( tp, bp) +abuf_to_ppc( tp, bp) register struct strtty *tp; register mblk_t *bp; { @@ -2468,7 +2420,7 @@ register mblk_t *bp; */ STATIC int -npp_copy_to_lbuf( tp, bp) +copy_to_lbuf( tp, bp) register struct strtty *tp; register mblk_t *bp; { diff --git a/usr/src/uts/3b2/io/opts.c b/usr/src/uts/3b2/io/opts.c new file mode 100644 index 0000000..238512c --- /dev/null +++ b/usr/src/uts/3b2/io/opts.c @@ -0,0 +1,218 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:io/opts.c 1.4" +/********************************************************************** + * PSEUDO TELETYPE DRIVER + * (Actually two drivers, requiring two entries in 'cdevsw') + * + * A pseudo-teletype is a special device which is similar to a pipe. + * It is used to communicate between two processes. However, it allows + * one to simulate a teletype, including mode setting, interrupt, and + * multiple end of files (all not possible on a pipe). + * + * There are really two drivers here. One is the device which looks like + * a terminal and can be thought of as the slave device, and hence + * its routines are prefixed with 'pts' (PTY Slave). + * The other driver can be thought of as the controlling device, + * and its routines are prefixed + * by 'ptc' (PTY Controller). To type on the simulated keyboard of the + * PTY, one does a 'write' to the controlling device. To get the + * simulated printout from the PTY, one does a 'read' on the controlling + * device. Normally, the controlling device is called 'ptyx' and the + * slave device is called 'ttyx' (where x is a number) + * (to make programs like 'who' happy). + *********************************************************************/ + +/* TTY HEADERS FOR PTY'S */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/sbd.h" +#include "sys/signal.h" +#include "sys/immu.h" +#include "sys/errno.h" +#include "sys/sysmacros.h" +#include "macros.h" +#include "sys/systm.h" +#include "sys/termio.h" +#include "sys/tty.h" +#include "sys/psw.h" +#include "sys/pcb.h" +#include "sys/user.h" +#include "sys/conf.h" +#include "sys/buf.h" +#include "sys/file.h" +#include "sys/proc.h" + +extern int pts_cnt; +extern struct tty pts_tty[]; + +int ptsproc(), nulldev(); + +/********************************************************************** + * SLAVE HALF + *********************************************************************/ + + +/********************************************************************** + * PTSOPEN + * Open slave half (waiting for controlling half, just like + * real hardware would wait for carrier). + *********************************************************************/ + +ptsopen(dev, flag) +dev_t dev; +{ + register struct tty *tp; + + if (minor(dev) >= pts_cnt) { + u.u_error = ENXIO; + return; + } + + tp = &pts_tty[minor(dev)]; + + if ((tp->t_state & ISOPEN) == 0) { + ttinit(tp); /* Set up default chars */ + } + + if (tp->t_proc == ptsproc) /* Ctrlr still around. */ + tp->t_state |= CARR_ON; + + while ((tp->t_state & CARR_ON) == 0) { + tp->t_state |= WOPEN; + sleep((caddr_t) & tp->t_rawq, TTIPRI); + } + + (*linesw[tp->t_line].l_open)(tp); +} + + +/*********************************************************************** + * PTSCLOSE + * + * Close slave half. + **********************************************************************/ + +ptsclose(dev) +dev_t dev; +{ + register struct tty *tp; + + tp = &pts_tty[minor(dev)]; + (*linesw[tp->t_line].l_close)(tp); + wakeup((caddr_t) & tp->t_outq.c_cf); /* jab reader of controlling half */ +} + + +/********************************************************************* + * PTSREAD + * + * Read from PTY, i.e., data from the controlling "hardware" + ********************************************************************/ + +ptsread(dev) +dev_t dev; +{ + register struct tty *tp; + + tp = &pts_tty[minor(dev)]; + if (tp->t_proc == ptsproc) { + (*linesw[tp->t_line].l_read)(tp); + /* Wakeup other half if sleeping */ + wakeup((caddr_t) & tp->t_rawq.c_cf); + } +} + + +/********************************************************************* + * PTSWRITE + * + * Write on PTY, i.e., data to the controlling "hardware" + ********************************************************************/ + +ptswrite(dev) +dev_t dev; +{ + register struct tty *tp; + + tp = &pts_tty[minor(dev)]; + + /* Make sure controlling half is really there */ + if (tp->t_proc == ptsproc) + (*linesw[tp->t_line].l_write)(tp); +} + + +/********************************************************************* + * PTSPROC + * + * Perform driver "proc" functions (suspend, resume, etc.) + ********************************************************************/ + +ptsproc(tp, cmd) +register struct tty *tp; +{ + register unit; + int dev; + extern ttrstrt(); + + switch (cmd) { + + case T_TIME: + tp->t_state &= ~TIMEOUT; + goto start; + + case T_WFLUSH: + tp->t_tbuf.c_size -= tp->t_tbuf.c_count; + tp->t_tbuf.c_count = 0; + + case T_RESUME: + tp->t_state &= ~TTSTOP; + goto start; + + case T_OUTPUT: +start: + { + register struct ccblock *tbuf; + + if (tp->t_state & (BUSY | TTSTOP)) + break; + tbuf = &tp->t_tbuf; + if (tbuf->c_ptr == NULL || tbuf->c_count == 0) { + if (tbuf->c_ptr) + tbuf->c_ptr -= tbuf->c_size - tbuf->c_count; + if (!(CPRES & (*linesw[tp->t_line].l_output)(tp))) + break; + } + tp->t_state |= BUSY; + wakeup((caddr_t) & tp->t_outq.c_cf); + break; + } + + case T_SUSPEND: + tp->t_state |= TTSTOP; + break; + + case T_BLOCK: + tp->t_state &= ~TTXON; + tp->t_state |= TTXOFF | TBLOCK; + break; + + case T_RFLUSH: + if (!(tp->t_state & TBLOCK)) + break; + case T_UNBLOCK: + tp->t_state &= ~(TTXOFF | TBLOCK); + tp->t_state |= TTXON; + break; + + case T_BREAK: + break; + } +} diff --git a/usr/src/uts/3b2/io/pckt.c b/usr/src/uts/3b2/io/pckt.c index 247eb6a..2a3525c 100644 --- a/usr/src/uts/3b2/io/pckt.c +++ b/usr/src/uts/3b2/io/pckt.c @@ -12,7 +12,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/pckt.c 1.9" +#ident "@(#)kernel:io/pckt.c 1.7.2.3" /* * Description: The PCKT module packitizes meesages on * its read queue by pre-fixing an M_PROTO diff --git a/usr/src/uts/3b2/io/physdsk.c b/usr/src/uts/3b2/io/physdsk.c index 35ca522..f353111 100644 --- a/usr/src/uts/3b2/io/physdsk.c +++ b/usr/src/uts/3b2/io/physdsk.c @@ -5,14 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)kernel:io/physdsk.c 1.8" +#ident "@(#)kernel:io/physdsk.c 1.7" /* * 3B2 Computer UNIX Integral Disk Driver Common * DMA break-up routine (used by integral hard and @@ -221,22 +214,14 @@ register struct buf *bp; brelse(nbp); return; } - if (bp->b_flags & B_KERNBUF) { - bcopy(nbp->b_un.b_addr, - bp->b_un.b_addr, cc); - } else if (copyout(nbp->b_un.b_addr, - bp->b_un.b_addr, cc)) { + if (copyout(nbp->b_un.b_addr, bp->b_un.b_addr, cc)) { brelse(nbp); bp->b_flags |= B_ERROR|B_DONE; bp->b_error = EFAULT; return; } } else { - if (bp->b_flags & B_KERNBUF) { - bcopy(bp->b_un.b_addr, - nbp->b_un.b_addr, cc); - } else if (copyin(bp->b_un.b_addr, - nbp->b_un.b_addr, cc)) { + if (copyin(bp->b_un.b_addr, nbp->b_un.b_addr, cc)) { brelse(nbp); bp->b_flags |= B_ERROR|B_DONE; bp->b_error = EFAULT; diff --git a/usr/src/uts/3b2/io/ptc.c b/usr/src/uts/3b2/io/ptc.c new file mode 100644 index 0000000..8530891 --- /dev/null +++ b/usr/src/uts/3b2/io/ptc.c @@ -0,0 +1,256 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:io/ptc.c 1.4" +/********************************************************************** + * PSEUDO TELETYPE DRIVER + * (Actually two drivers, requiring two entries in 'cdevsw') + * + * A pseudo-teletype is a special device which is similar to a pipe. + * It is used to communicate between two processes. However, it allows + * one to simulate a teletype, including mode setting, interrupt, and + * multiple end of files (all not possible on a pipe). + * + * There are really two drivers here. One is the device which looks like + * a terminal and can be thought of as the slave device, and hence + * its routines are prefixed with 'pts' (PTY Slave). + * The other driver can be thought of as the controlling device, + * and its routines are prefixed + * by 'ptc' (PTY Controller). To type on the simulated keyboard of the + * PTY, one does a 'write' to the controlling device. To get the + * simulated printout from the PTY, one does a 'read' on the controlling + * device. Normally, the controlling device is called 'ptyx' and the + * slave device is called 'ttyx' (where x is a number) + * (to make programs like 'who' happy). + *********************************************************************/ + +/* TTY HEADERS FOR PTY'S */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/sbd.h" +#include "sys/signal.h" +#include "sys/immu.h" +#include "sys/errno.h" +#include "sys/sysmacros.h" +#include "macros.h" +#include "sys/systm.h" +#include "sys/termio.h" +#include "sys/tty.h" +#include "sys/psw.h" +#include "sys/pcb.h" +#include "sys/user.h" +#include "sys/conf.h" +#include "sys/buf.h" +#include "sys/file.h" +#include "sys/proc.h" + +extern int pts_cnt; +extern struct tty pts_tty[]; + +int ptsproc(), nulldev(); + + +/******************************************************************* + * CONTROLLING HALF + * + * The half that simulates hardware. + ******************************************************************/ + + +/******************************************************************* + * PTCOPEN + * + * Open controlling half (simulated "hardware" side) + ******************************************************************/ + +ptcopen(dev, flag) +dev_t dev; +{ + register struct tty *tp; + + if (minor(dev) >= pts_cnt) { + u.u_error = ENXIO; + return; + } + tp = &pts_tty[minor(dev)]; + + /* already open is an error */ + if (tp->t_proc == ptsproc) { + u.u_error = EIO; + return; + } + + tp->t_proc = ptsproc; /* Set address of proc routine */ + if (tp->t_state & WOPEN) + wakeup((caddr_t) & tp->t_rawq); + tp->t_state |= CARR_ON; +} + + +/********************************************************************* + * PTCCLOSE + * + * Close controlling half. + ********************************************************************/ + +ptcclose(dev) +dev_t dev; +{ + register struct tty *tp; + + tp = &pts_tty[minor(dev)]; + if (tp->t_state & ISOPEN) + signal(tp->t_pgrp, SIGHUP); + tp->t_state &= ~CARR_ON; /* Virtual carrier is gone */ + ttyflush(tp, FREAD | FWRITE); /* Clean things up */ + tp->t_proc = nulldev; /* Mark as closed */ +} + + +/*********************************************************************** + * PTCREAD + * + * Pretend you are a device interupt routine and are + * putting data out to the hardware by taking data from + * the slave side buffers and passing it to the controlling process. + **********************************************************************/ + +ptcread(dev) +dev_t dev; +{ + register struct tty *tp; + register done; + + tp = &pts_tty[minor(dev)]; + + /* BUSY means there are chars ready for us */ + /* passc returns negative when read call is done */ + + done = 0; + +loop: + if (tp->t_state & (CARR_ON | ISOPEN) == 0) + return; + while ((tp->t_state & BUSY) == 0) + sleep((caddr_t) & tp->t_outq.c_cf, TTIPRI); + if (tp->t_tbuf.c_count) { + done = passc(*tp->t_tbuf.c_ptr++); + tp->t_tbuf.c_count--; + } + tp->t_state &= ~BUSY; + + ptsproc(tp, T_OUTPUT); + if (tp->t_outq.c_cc == 0) + return; + if (done >= 0) + goto loop; + return; +} + + +/********************************************************************* + * PTCWRITE + * + * Pretend you are a device interrupt routine and put + * characters into the slave input buffer. + * Depending on compilation flag PTYFLOW, either + * perform flow control, or don't. However + * However, must scan all that is sent to us for + * STOP/START/INTERRUPT characters anyway. + ********************************************************************/ + +ptcwrite(dev) +dev_t dev; +{ + register struct tty *tp; + register int cc; + register int s; + register int c; + + tp = &pts_tty[minor(dev)]; + if ((tp->t_state & (CARR_ON | ISOPEN)) == 0) + return; + + s = spl6(); + + /* allocate an input buffer if necessary */ + if (tp->t_rbuf.c_ptr == NULL) { + while ((tp->t_rbuf.c_ptr = getcf()->c_data) + == ((struct cblock *)NULL)->c_data) { + tp->t_rbuf.c_ptr = NULL; + cfreelist.c_flag = 1; + sleep(&cfreelist, TTOPRI); + } + tp->t_rbuf.c_count = cfreelist.c_size; + tp->t_rbuf.c_size = cfreelist.c_size; + } + + /* get a character and perform optional IXON processing */ + while ((c = cpass()) >= 0) { + if (tp->t_iflag & IXON) { + register char ctmp; + ctmp = c & 0177; + if (tp->t_state & TTSTOP) { + if (ctmp == CSTART || tp->t_iflag & IXANY) + (*tp->t_proc)(tp, T_RESUME); + } else { + if (ctmp == CSTOP) + (*tp->t_proc)(tp, T_SUSPEND); + } + if (ctmp == CSTART || ctmp == CSTOP) + continue; + } + + /* perform optional ISTRIP processing */ + if (tp->t_iflag & ISTRIP) + c &= 0177; + else + c &= 0377; + + /* put character into rbuf */ + *tp->t_rbuf.c_ptr++ = c; + tp->t_rbuf.c_count--; + tp->t_rbuf.c_ptr -= + tp->t_rbuf.c_size - tp->t_rbuf.c_count; + (*linesw[tp->t_line].l_input)(tp); + } + splx(s); +} + + +/********************************************************************** + * IOCTL + * + * Slave and Controlling half IOCTL calls. + * Only the Slave half has terminal modes. However, we let + * Controlling half change the modes of the slave half. + *********************************************************************/ + +ptsioctl(dev, cmd, arg, mode) +dev_t dev; +{ + ttiocom(&pts_tty[minor(dev)], cmd, arg, mode); +} + + +ptcioctl(dev, cmd, arg, mode) +dev_t dev; +{ + register struct tty *tp; + + tp = &pts_tty[minor(dev)]; + /* Flush to prevent a hang */ + while (getc(&tp->t_outq) >= 0) + ; + ttiocom(tp, cmd, arg, mode); +} + + + + + diff --git a/usr/src/uts/3b2/io/ptem.c b/usr/src/uts/3b2/io/ptem.c index d0f1444..cd4f7a1 100644 --- a/usr/src/uts/3b2/io/ptem.c +++ b/usr/src/uts/3b2/io/ptem.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/ptem.c 1.13" +#ident "@(#)kernel:io/ptem.c 1.11.1.2" /* * Description: The PTEM streams module is used as a pseudo * driver emulator. Its purpose is to emulate @@ -726,35 +726,12 @@ register mblk_t *mp; /* Pointer to current message block */ freemsg( mp); break; - case M_STOP: - /* - * Set the output flow control state - */ - ntp->state |= OFLOW_CTL; - putnext( q, mp); - break; - - case M_START: + case M_DATA: /* - * Relieve the output flow control state + * Free all zero length messages */ - ntp->state &= ~OFLOW_CTL; - putnext( q, mp); - while (( mp = getq( q)) != NULL) - putnext( q, mp); - break; - - case M_DATA: if (( mp->b_wptr - mp->b_rptr) <= 0) - /* - * Free all zero length messages - */ freemsg( mp); - else if ( ntp->state & OFLOW_CTL) - /* - * Queue data messages in the flow control case - */ - putq( q, mp); else putnext( q, mp); break; diff --git a/usr/src/uts/3b2/io/sad.c b/usr/src/uts/3b2/io/sad.c index 6d43112..8569147 100644 --- a/usr/src/uts/3b2/io/sad.c +++ b/usr/src/uts/3b2/io/sad.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/sad.c 1.19" +#ident "@(#)kernel:io/sad.c 1.18" /* * STREAMS Administrative Driver @@ -336,9 +336,7 @@ apush_iocdata(qp, mp) freemsg(mp); return; } - if (mp->b_cont) - /* sap needed only if mp->b_cont is set */ - sap = (struct strapush *)mp->b_cont->b_rptr; + sap = (struct strapush *)mp->b_cont->b_rptr; switch (csp->cp_cmd) { case SAD_SAP: switch ((int)csp->cp_private) { diff --git a/usr/src/uts/3b2/io/sddrv.c b/usr/src/uts/3b2/io/sddrv.c index 266fad7..8234598 100644 --- a/usr/src/uts/3b2/io/sddrv.c +++ b/usr/src/uts/3b2/io/sddrv.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/sddrv.c 1.13" +#ident "@(#)kernel:io/sddrv.c 1.10.1.6" #include "sys/types.h" #include "sys/sbd.h" #include "sys/param.h" @@ -29,6 +29,7 @@ #include "sys/vfs.h" #include "sys/vnode.h" #include "sys/cmn_err.h" +#include "sys/inline.h" #include "sys/kmem.h" #include "vm/page.h" #include "sys/cred.h" @@ -192,13 +193,193 @@ dev_t dev; ifint(); } +STATIC void +sdiodone(bp) + register struct buf *bp; +{ + register struct buf *parentbp; + + if (bp->b_chain == (struct buf *)NULL) { + biodone(bp); + return; + } + bp->b_iodone = (int(*)()) NULL; + + parentbp = bp->b_chain; + if (bp->b_error) + parentbp->b_error = bp->b_error; + else if (bp->b_oerror) + parentbp->b_error = bp->b_oerror; + if (bp->b_flags & B_ASYNC) { + pageio_done(bp); + parentbp->b_reqcnt--; + if ((bp->b_flags & B_READ) == 0) + basyncnt--; + if (parentbp->b_reqcnt == 0) { + biodone(parentbp); + return; + } + } else { + biodone(bp); + return; + } +} + +#define MAXIOREQ 28 /* this is really arbitrary */ + void sdstrategy(bp) struct buf *bp; { - if (bp->b_edev & 0x80) - ifstrategy(bp); - else - idstrategy(bp); - return; + register struct page *pp; + register int i, flags; + struct buf *bufp[MAXIOREQ]; + int bytescnt, s, req, err; + int blkincr; + + if (bp->b_bcount <= PAGESIZE) { + if (bp->b_edev & 0x80) + ifstrategy(bp); + else + idstrategy(bp); + return; + } + blkincr = PAGESIZE / NBPSCTR; + req = bp->b_bcount / PAGESIZE; + if (bp->b_bcount % PAGESIZE) + req++; + bp->b_reqcnt = req; + + pp = bp->b_pages; + if (pp == NULL) { + ASSERT((int)bp->b_un.b_addr > MAINSTORE + && (int)bp->b_un.b_addr < UVBASE); + (void)buf_breakup(sdstrategy, bp); + return; + } + i = 0; + do { + /* Assumption: pages in the list was sorted. */ + if (i == (req - 1)) { /* last I/O */ + if (bp->b_bcount % PAGESIZE) + bytescnt = bp->b_bcount % PAGESIZE; + else + bytescnt = PAGESIZE; + } else { + bytescnt = PAGESIZE; + } + flags = (bp->b_flags & B_ASYNC) ? B_ASYNC : 0; + flags |= (bp->b_flags & B_READ) ? B_READ : B_WRITE; + bufp[i] = pageio_setup(pp, bytescnt, bp->b_vp, flags); + bufp[i]->b_edev = bp->b_vp->v_rdev; + bufp[i]->b_blkno = bp->b_blkno + (blkincr * i); + bufp[i]->b_chain = bp; + bufp[i]->b_iodone = (int(*)())sdiodone; + bufp[i]->b_flags &= ~B_PAGEIO; + bufp[i]->b_un.b_addr = (caddr_t)pfntokv(page_pptonum(pp)); + if (bp->b_edev & 0x80) + ifstrategy(bufp[i]); + else + idstrategy(bufp[i]); + i++; + pp = pp->p_next; + } while (pp != bp->b_pages); + + if (!(bp->b_flags & B_ASYNC)) { + err = 0; + for (i=0; ib_reqcnt--; + } + /* arbitrary picking up one of the errors */ + if (err) + bp->b_error = err; + ASSERT(bp->b_reqcnt == 0); + ASSERT((bp->b_flags & B_DONE) == 0); + s = spl6(); + biodone(bp); + splx(s); + } +} + +STATIC char sbuffer[512]; +STATIC struct buf sbuf; +STATIC int sbuf_inuse = 0; + +int +dksize(dev) + dev_t dev; +{ + register int maj, error, max, min, middle; + register char saved_error; + int (*size)(); +#if 0 + int old; +#endif + + if ((maj = getmajor(dev)) >= bdevcnt) + return(-1); + size = bdevsw[maj].d_size; + if (size != nodev) + return((*size)(dev)); + + /* Avoid multiple access of the buffer header */ + while (sbuf_inuse) + (void) sleep((caddr_t)&sbuf, PSWP+2); + sbuf_inuse = 1; + + saved_error = u.u_error; + u.u_error = 0; + (void)(*bdevsw[maj].d_open)(dev, 0, OTYP_BLK); + if (u.u_error) { + (void)(*bdevsw[maj].d_close)(dev, 0, OTYP_BLK); + u.u_error = saved_error; + sbuf_inuse = 0; + return(-1); + } + +#if 0 + if (*bdevsw[maj].d_flag & D_OLD) { + old = 1; + (void)(*bdevsw[maj].d_open)(dev, 0, OTYP_BLK); + error = u.u_error; + } else { + old = 0; + error = (*bdevsw[maj].d_open)(dev, 0, OTYP_BLK, cr); + } + if (error) { + if (old) + u.u_error = saved_error; + return ENXIO; + } +#endif + bzero((caddr_t)&sbuf, sizeof(struct buf)); + sbuf.b_edev = dev; + sbuf.b_bcount = NBPSCTR; + sbuf.b_un.b_addr = &sbuffer[0]; + + max = 8 * 1024 * 1024; + min = 0; + do { + middle = (max + min) / 2; + sbuf.b_blkno = middle; + sbuf.b_flags = B_KERNBUF | B_BUSY | B_READ; + sbuf.b_error = 0; + (*bdevsw[maj].d_strategy)(&sbuf); + error = biowait(&sbuf); + if (error) + max = middle; + else + min = middle; + } while (max != (min + 1)); + + (void)(*bdevsw[maj].d_close)(dev, 0, OTYP_BLK); + u.u_error = saved_error; + sbuf_inuse = 0; + wakeup((caddr_t)&sbuf); + return (max - 1); } diff --git a/usr/src/uts/3b2/io/sockmod.c b/usr/src/uts/3b2/io/sockmod.c index ba6a644..74bce21 100644 --- a/usr/src/uts/3b2/io/sockmod.c +++ b/usr/src/uts/3b2/io/sockmod.c @@ -5,10 +5,33 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/sockmod.c 1.10" +#ident "@(#)kernel:io/sockmod.c 1.4.2.6" /* - * Socket Interface Library cooperating module - issue 1 + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ + +/* + * Socket Interface Library cooperating module */ #include #include @@ -36,7 +59,7 @@ #define SIMOD_ID 50 #define SIMWAIT (1*HZ) -#define MSGBLEN(A) (int)((A)->b_wptr - (A)->b_rptr) +#define MSGBLEN(A) ((A)->b_wptr - (A)->b_rptr) #define MBLKLEN(A) (int)((A)->b_datap->db_lim - (A)->b_datap->db_base) #define _S_RECOVER(A, B, C) \ { \ @@ -81,49 +104,14 @@ struct so_so { mblk_t *bigmsg; struct so_ux so_ux; ulong msgcnt; - int sndbuf; - int rcvbuf; - int sndlowat; - int rcvlowat; - int linger; - int sndtimeo; - int rcvtimeo; - int prototype; }; extern struct so_so so_so[]; extern int so_cnt; extern int nulldev(); -#if defined(__STDC__) -static int tlitosyserr(int); -static long _t_setsize(long); -STATIC int so_options(queue_t *, mblk_t *); -STATIC mblk_t *_s_getmblk(mblk_t *, size_t); -STATIC void snd_ERRACK(queue_t *, mblk_t *, int, int); -STATIC void snd_OKACK(queue_t *, mblk_t *, int); -STATIC int so_init(struct so_so *, struct T_info_ack *); -STATIC void strip_zerolen(mblk_t *); -STATIC void save_addr(struct netbuf *, caddr_t, size_t); -STATIC void snd_SIGPIPE(queue_t *); -STATIC void snd_ZERO(queue_t *); -STATIC void snd_FLUSHR(queue_t *); -STATIC void snd_ERRORW(queue_t *); -STATIC void snd_IOCNAK(queue_t *, mblk_t *, int); -STATIC void ux_dellink(struct so_so *); -STATIC void ux_addlink(struct so_so *); -STATIC struct so_so *ux_findlink(caddr_t, size_t); -STATIC void ux_restoreaddr(struct so_so *, mblk_t *, - caddr_t, size_t); -STATIC void ux_saveraddr(struct so_so *, struct bind_ux *); -STATIC void fill_udata_req_addr(mblk_t *, caddr_t, size_t); -STATIC void fill_udata_ind_addr(mblk_t *, caddr_t, size_t); -STATIC mblk_t *_s_makeopt(struct so_so *); -STATIC void _s_setopt(mblk_t *, struct so_so *); -STATIC void do_ERROR(struct so_so *, queue_t *, mblk_t *); -#else -static int tlitosyserr(); -static long _t_setsize(); +STATIC int tlitosyserr(); +STATIC long _t_setsize(); STATIC int so_options(); STATIC mblk_t *_s_getmblk(); STATIC void snd_ERRACK(); @@ -143,10 +131,6 @@ STATIC void ux_restoreaddr(); STATIC void ux_saveraddr(); STATIC void fill_udata_req_addr(); STATIC void fill_udata_ind_addr(); -STATIC mblk_t *_s_makeopt(); -STATIC void _s_setopt(); -STATIC void do_ERROR(); -#endif int socklog = 0; #define SOCKLOG(S, A, B, C, D, E, F) \ @@ -239,17 +223,9 @@ SOCKLOG((struct so_so *)NULL, SIMOD_ID, 0, 0, SL_TRACE, "sockmodopen: Allocated so->consave = NULL; so->oob = NULL; so->so_error = 0; + so->so_option = 0; so->so_conn = NULL; so->msgcnt = 0; - so->so_option = 0; - so->sndbuf = 0; - so->rcvbuf = 0; - so->sndlowat = 0; - so->rcvlowat = 0; - so->linger = 0; - so->sndtimeo = 0; - so->rcvtimeo = 0; - so->prototype = 0; bzero((caddr_t)&so->udata, sizeof(struct si_udata)); bzero((caddr_t)&so->lux_dev, sizeof(struct ux_extaddr)); @@ -263,19 +239,19 @@ SOCKLOG((struct so_so *)NULL, SIMOD_ID, 0, 0, SL_TRACE, "sockmodopen: Allocated /* Send down T_INFO_REQ and wait for a reply */ if ((bp = allocb(sizeof(struct T_info_req) + - sizeof(struct T_info_ack), BPRI_LO)) == (mblk_t *)NULL) { + sizeof(struct T_info_ack), BPRI_LO)) == NULL) { so->flags = 0; return ENOSR; } so->flags |= S_WINFO; bp->b_datap->db_type = M_PCPROTO; - *(long *)bp->b_wptr = (long)T_INFO_REQ; + *(long *)bp->b_wptr = T_INFO_REQ; bp->b_wptr += sizeof(struct T_info_req); putnext(WR(q), bp); while (so->flags & S_WINFO) { - if (sleep((caddr_t)so, (int)(PZERO+1|PCATCH))) { + if (sleep(so, PZERO+1|PCATCH)) { /* Interrupted */ so->flags = 0; @@ -292,7 +268,7 @@ SOCKLOG((struct so_so *)NULL, SIMOD_ID, 0, 0, SL_TRACE, "sockmodopen: Allocated * addresses. */ if ((so->laddr.buf = (char *)kmem_alloc(so->udata.addrsize, - KM_SLEEP)) == (caddr_t)NULL) { + KM_SLEEP)) == NULL) { so->flags = 0; return EAGAIN; } @@ -301,7 +277,7 @@ SOCKLOG((struct so_so *)NULL, SIMOD_ID, 0, 0, SL_TRACE, "sockmodopen: Allocated (void)bzero(so->laddr.buf, so->udata.addrsize); if ((so->raddr.buf = (char *)kmem_alloc(so->udata.addrsize, - KM_SLEEP)) == (caddr_t)NULL) { + KM_SLEEP)) == NULL) { so->flags = 0; kmem_free(so->laddr.buf, so->laddr.maxlen); return EAGAIN; @@ -326,7 +302,7 @@ SOCKLOG(so, SIMOD_ID, 0, 0, SL_TRACE, "sockmodopen: WRq maxpsz %x\n", OTHERQ(q)- * Set M_READ and discard M_PROTO/M_PASSFP * messages in strread(). */ - if ((bp = allocb(sizeof(*stropt), BPRI_MED)) == (mblk_t *)NULL) { + if ((bp = allocb(sizeof(*stropt), BPRI_MED)) == NULL) { so->flags = 0; return ENOSR; } @@ -387,8 +363,6 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodclose: Entered\n", 0); ux_dellink(so); #endif so->flags = 0; - - return 0; } @@ -418,18 +392,6 @@ sockmodrput(q, mp) case M_FLUSH: SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrput: Got M_FLUSH\n", 0); - /* This is a kludge until something better - * is done. If this is a AF_UNIX socket, - * ignore the M_FLUSH and don't propogate it. - */ - if (so->laddr.len > 0 && - ((sockaddr_t)so->laddr.buf)->sa_family == - AF_UNIX) { -SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrput: Ignoring M_FLUSH\n", 0); - freemsg(mp); - return 0; - } - if (*mp->b_rptr & FLUSHW) flushq(WR(q), FLUSHDATA); if (*mp->b_rptr & FLUSHR) @@ -449,14 +411,13 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrput: Got M_IOCACK\n", 0); return 0; case TI_GETPEERNAME: + if (so->udata.servtype == T_CLTS) + so->udata.so_state |= SS_ISCONNECTED; + /* Deliberate fall thru. + */ case TI_GETMYNAME: ASSERT(so->iocsave != NULL); freemsg(so->iocsave); - - if (iocbp->ioc_cmd == TI_GETPEERNAME && - so->udata.servtype == T_CLTS) - so->udata.so_state |= SS_ISCONNECTED; - so->iocsave = NULL; so->flags &= ~WAITIOCACK; putnext(q, mp); @@ -553,7 +514,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrput: Got T_UNITDATA_IND\n" } else { if (bcmp(so->raddr.buf, - (caddr_t)(mp->b_rptr+udata_ind->SRC_offset), + mp->b_rptr+udata_ind->SRC_offset, so->raddr.len) != 0) { /* Log error and free the msg. */ @@ -578,14 +539,13 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrput: Got T_UNITDATA_IND\n" if (((sockaddr_t)so->raddr.buf)->sa_family == AF_UNIX) { #ifdef _AF_UNIX register struct so_so *oso; - register size_t size; + register int size; register char *addr; addr = (caddr_t)(mp->b_rptr + udata_ind->SRC_offset); if ((oso = ux_findlink(addr, - (size_t)udata_ind->SRC_length)) == - NULL) { + udata_ind->SRC_length)) == NULL) { freemsg(mp); return 0; } @@ -594,8 +554,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrput: Got T_UNITDATA_IND\n" if (MBLKLEN(mp) < size) { register mblk_t *bp; - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { putq(q, mp); return 0; } @@ -692,14 +652,14 @@ sockmodrsrv(q) register mblk_t *bp; register mblk_t *mp; register int s; - register size_t size; + register int size; ASSERT(q != NULL); so = (struct so_so *)q->q_ptr; ASSERT(so != NULL); rgetnext: - if ((mp = getq(q)) == (mblk_t *)NULL) { + if ((mp = getq(q)) == NULL) { if (so->flags & S_RBLOCKED) so->flags &= ~S_RBLOCKED; return 0; @@ -725,37 +685,47 @@ sockmodrsrv(q) case T_DISCON_IND: SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_DISCON_IND Reason: %d\n", pptr->discon_ind.DISCON_reason); + so->udata.so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE); so->so_error = pptr->discon_ind.DISCON_reason; - /* If this is in response to a connect, + /* If this is in response to a disconnect, * and the caller is waiting, then send the * disconnect up. */ - if (so->udata.so_state & SS_ISCONNECTING) { - if ((so->flags & S_WRDISABLE) == 0) { - /* Send the disconnect up, so that - * the reason can be extracted. - */ - putnext(q, mp); - } - else { - /* Enable the write service queue to - * be scheduled, and schedule it. - */ - enableok(WR(q)); - qenable(WR(q)); - freemsg(mp); + if (so->udata.so_state & SS_ISCONNECTING && + !(so->flags & S_WRDISABLE)) { + /* Make sure we can get a buffer before we + * carry on. + */ + if ((bp = _s_getmblk(NULL, 2)) == NULL) { + _S_RECOVER(q, mp, 2); + return 0; } + /* Send the disconnect up, so that + * the reason can be extracted. + */ + putnext(q, mp); + mp = bp; } else { - /* Just wake any readers. - */ - freemsg(mp); - snd_ZERO(q); + mp->b_rptr = mp->b_wptr = mp->b_datap->db_base; + freemsg(mp->b_cont); + mp->b_cont = NULL; } - so->udata.so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE); - so->udata.so_state &= ~(SS_ISCONNECTED|SS_ISCONNECTING); + /* Send up an M_ERROR with the disconnect reason + */ +SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Sending up M_ERROR\n",0); + /* New M_ERROR flavour. + */ + mp->b_datap->db_type = M_ERROR; + *mp->b_wptr++ = so->so_error; + *mp->b_wptr++ = EPIPE; + putnext(q, mp); + + /* Send a SIGPIPE for good luck. + */ + snd_SIGPIPE(q); goto rgetnext; @@ -777,7 +747,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_CONN_IND\n", 0) /* Make sure we can dup the new * message before proceeding. */ - if ((nbp = dupmsg(mp)) == (mblk_t *)NULL) { + if ((nbp = dupmsg(mp)) == NULL) { _S_RECOVER(q, mp, sizeof(mblk_t)); return 0; } @@ -798,16 +768,15 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_CONN_IND\n", 0) addr = (caddr_t)(mp->b_rptr + conn_ind->SRC_offset); if ((oso = ux_findlink(addr, - (size_t)conn_ind->SRC_length)) == - NULL) { + conn_ind->SRC_length)) == NULL) { freemsg(mp); goto rgetnext; } size = sizeof(*nconn_ind) + oso->laddr.len; if (MBLKLEN(mp) < size) { - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { _S_RECOVER(q, mp, size); freemsg(nbp); return 0; @@ -823,8 +792,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_CONN_IND\n", 0) } conn_ind = (struct T_conn_ind *)mp->b_rptr; (void)bcopy(oso->laddr.buf, - (caddr_t)(mp->b_rptr + - conn_ind->SRC_offset), + mp->b_rptr + conn_ind->SRC_offset, oso->laddr.len); conn_ind->SRC_length = oso->laddr.len; @@ -879,8 +847,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_CONN_CON\n", 0) register struct T_conn_con *nconn_con; register mblk_t *bp; - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -905,8 +873,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_CONN_CON\n", 0) #endif } else save_addr(&so->raddr, - (caddr_t)(mp->b_rptr+conn_con->RES_offset), - (size_t)conn_con->RES_length); + mp->b_rptr+conn_con->RES_offset, + conn_con->RES_length); putnext(q, mp); goto rgetnext; @@ -935,8 +903,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_UNITDATA_IND\n" udata_ind->SRC_offset); if ((oso = ux_findlink(addr, - (size_t)udata_ind->SRC_length)) == - NULL) { + udata_ind->SRC_length)) == NULL) { freemsg(mp); goto rgetnext; } @@ -945,8 +912,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_UNITDATA_IND\n" if (MBLKLEN(mp) < size) { register mblk_t *bp; - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -1001,7 +968,7 @@ SOCKLOG(so, SIMOD_ID, -1, 0, SL_TRACE, "sockmodrput: Got zero length msg\n", 0); goto rgetnext; case T_EXDATA_IND: { - register mblk_t *nmp, *nbp; + register mblk_t *nmp; SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_EXDATA_IND\n", 0); /* If the socket is marked such that we don't * want to get anymore data then free it. @@ -1040,44 +1007,32 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_EXDATA_IND\n", * Make sure that we can allocate the * message block for the SIGURG as well. */ - if ((nmp = _s_getmblk((mblk_t *)NULL, size)) - == (mblk_t *)NULL || - (bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL || - (nbp = _s_getmblk((mblk_t *)NULL, - (size_t)2)) == (mblk_t *)NULL) { + if ((nmp = _s_getmblk(NULL, size)) == NULL || + (bp = _s_getmblk(NULL, size)) == NULL) { if (nmp) freemsg(nmp); - if (bp) - freemsg(bp); - _S_RECOVER(q, mp, size*2+2); + _S_RECOVER(q, mp, size*2); return 0; } + nmp->b_datap->db_type = M_PROTO; + *(long *)nmp->b_wptr = T_EXDATA_IND; + nmp->b_wptr += size; + nmp->b_flag |= MSGMARK; + putnext(q, nmp); - if (so->oob) + nmp = mp->b_cont; + if (so->oob) freemsg(so->oob); - so->oob = mp->b_cont; - mp->b_cont = NULL; - freeb(mp); - - mp = nmp; - mp->b_datap->db_type = M_PROTO; - *(long *)mp->b_wptr = (long)T_EXDATA_IND; - mp->b_wptr += size; - mp->b_flag |= MSGMARK; + so->oob = nmp; + nmp->b_cont = NULL; + freeb(mp); } else { - /* Allocate the SIGURG message block, - * and the M_FLUSH. + /* Allocate the SIGURG message block. */ - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL || - (nbp = _s_getmblk((mblk_t *)NULL, - (size_t)2)) == (mblk_t *)NULL) { - if (bp) - freemsg(bp); - _S_RECOVER(q, mp, size+2); + if ((bp = _s_getmblk(NULL, size)) == NULL) { + _S_RECOVER(q, mp, size); return 0; } /* Send up the OOB data. @@ -1085,6 +1040,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_EXDATA_IND\n", strip_zerolen(mp); mp->b_band = 0; mp->b_flag |= MSGMARK; + putnext(q, mp); } /* Cause a SIGURG to be sent irrespective @@ -1103,18 +1059,6 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_EXDATA_IND\n", bp->b_band = 1; putnext(q, bp); - /* Flush it so that I_ATMARK works okay if - * there is no other data at the stream head. - */ - nbp->b_datap->db_type = M_FLUSH; - *nbp->b_wptr++ = FLUSHR|FLUSHBAND; - *nbp->b_wptr++ = 1; /* Band to flush */ - putnext(q, nbp); - - /* Now send up the mark or OOB data. - */ - putnext(q, mp); - goto rgetnext; } @@ -1135,7 +1079,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_ERROR_ACK\n", 0 so->so_error = pptr->error_ack.UNIX_error; else so->so_error = - tlitosyserr((int)pptr->error_ack.TLI_error); + tlitosyserr(pptr->error_ack.TLI_error); /* The error is a result of * our internal unbind request. @@ -1151,7 +1095,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_ERROR_ACK\n", 0 so->so_error = pptr->error_ack.UNIX_error; else so->so_error = - tlitosyserr((int)pptr->error_ack.TLI_error); + tlitosyserr(pptr->error_ack.TLI_error); so->flags &= ~S_WINFO; wakeup(so); @@ -1182,21 +1126,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_ERROR_ACK\n", 0 } else if (pptr->error_ack.ERROR_prim == T_OPTMGMT_REQ) { -SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, - "sockmodrsrv: T_ERROR_ACK-optmgmt- %x\n", - so->so_option); - if (pptr->error_ack.TLI_error == TBADOPT && - so->so_option) { - /* Must have been a T_NEGOTIATE - * for a socket option. Make it - * all work. - */ - freemsg(mp); - mp = _s_makeopt(so); + if (so->so_option) so->so_option = 0; - goto out; - } - else so->so_option = 0; } switch (pptr->error_ack.ERROR_prim) { @@ -1229,12 +1160,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, case T_OK_ACK: SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_OK_ACK\n", 0); - if (pptr->ok_ack.CORRECT_prim == T_CONN_RES) { - register struct so_so *oso; - - oso = so->so_conn; - oso->udata.so_state |= SS_ISCONNECTED; + so->so_conn->udata.so_state |= SS_ISCONNECTED; so->so_conn = NULL; } if (so->flags & S_WUNBIND && @@ -1304,7 +1231,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_BIND_ACK\n", 0) if (so->lux_dev.size == 0) { (void)bcopy(addr, (caddr_t)&so->lux_dev.addr, - (size_t)bind_ack->ADDR_length); + bind_ack->ADDR_length); so->lux_dev.size = bind_ack->ADDR_length; } @@ -1313,14 +1240,13 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_BIND_ACK\n", 0) * string part of the address as well as * the actual address bound to. */ - size = sizeof(struct bind_ux) + - sizeof(*bind_ack); + size = sizeof(struct bind_ux) + sizeof(*bind_ack); if (MBLKLEN(mp) < size) { register struct T_bind_ack *nbind_ack; register mblk_t *bp; - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -1331,7 +1257,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_BIND_ACK\n", 0) *nbind_ack = *bind_ack; ux_restoreaddr(so, bp, addr, - (size_t)bind_ack->ADDR_length); + bind_ack->ADDR_length); bp->b_wptr = bp->b_rptr + size; freemsg(mp); @@ -1339,7 +1265,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_BIND_ACK\n", 0) } else { ux_restoreaddr(so, mp, addr, - (size_t)bind_ack->ADDR_length); + bind_ack->ADDR_length); mp->b_wptr = mp->b_rptr + size; } } @@ -1348,8 +1274,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_BIND_ACK\n", 0) /* Remember the bound address. */ save_addr(&so->laddr, - (caddr_t)(mp->b_rptr+bind_ack->ADDR_offset), - (size_t)bind_ack->ADDR_length); + mp->b_rptr+bind_ack->ADDR_offset, + bind_ack->ADDR_length); } so->udata.so_state |= SS_ISBOUND; @@ -1361,18 +1287,12 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_BIND_ACK\n", 0) SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_OPTMGMT_ACK\n", 0); if (so->flags & WAITIOCACK) { ASSERT(so->iocsave != NULL); - if (*(long *)so->iocsave->b_cont->b_rptr != - T_OPTMGMT_REQ) { + if (*(long *)so->iocsave->b_cont->b_rptr != T_OPTMGMT_REQ) { putnext(q, mp); goto rgetnext; } if (so->so_option) { -SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, - "sockmodrsrv: T_OPTMGMT_ACK option %x\n", so->so_option); - /* Check that the value negotiated is - * the one that we stored. - */ - _s_setopt(mp, so); + so->udata.so_options |= so->so_option; so->so_option = 0; } goto out; @@ -1386,6 +1306,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodrsrv: Got T_INFO_ACK\n", 0) so->so_error = so_init(so, (struct T_info_ack *)pptr); + so->flags &= ~S_WINFO; wakeup(so); freemsg(mp); @@ -1440,7 +1361,7 @@ sockmodwput(q, mp) register struct so_so *so; register union T_primitives *pptr; register mblk_t *bp; - register size_t size; + register int size; register int s; ASSERT(q != NULL); @@ -1520,11 +1441,6 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: Got M_IOCDATA\n", 0); case M_DATA: SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: Got M_DATA state %x\n", so->udata.so_state); - if (so->udata.so_state & SS_CANTSENDMORE) { - do_ERROR(so, RD(q), mp); - return 0; - } - if ( !(so->udata.so_state & SS_ISCONNECTED)) { /* Set so_error, and free the message. */ @@ -1532,6 +1448,17 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: Got M_DATA state %x\n freemsg(mp); return 0; } + if (so->udata.so_state & SS_CANTSENDMORE) { + /* Set so_error, send SIGPIPE, + * followed by new M_ERROR. + */ + freemsg(mp); + so->so_error = EPIPE; + snd_SIGPIPE(RD(q)); + snd_ERRORW(RD(q)); + return 0; + } + /* Pre-pend the M_PROTO header. */ if (so->udata.servtype == T_CLTS) { @@ -1539,8 +1466,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: Got M_DATA state %x\n #ifdef _AF_UNIX size = sizeof(struct T_unitdata_req) + so->rux_dev.size; - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { putq(q, mp); return 0; } @@ -1555,8 +1481,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: M_DATA: size %x\n", s */ size = sizeof(struct T_unitdata_req) + so->raddr.len; - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { putq(q, mp); return 0; } @@ -1597,10 +1522,14 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: canput returned true\ case T_DATA_REQ: SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: Got T_DATA_REQ\n", 0); if (so->udata.so_state & SS_CANTSENDMORE) { - do_ERROR(so, RD(q), mp); + /* Set so_error and send SIGPIPE + */ + freemsg(mp); + so->so_error = EPIPE; + snd_SIGPIPE(RD(q)); + snd_ERRORW(RD(q)); return 0; } - if ( !(so->udata.so_state & SS_ISCONNECTED)) { /* Set so_error and free the message. */ @@ -1630,10 +1559,15 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: T_DATA_REQ len %d\n", SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: Got T_UNITDATA_REQ state %x\n", so->udata.so_state); if (so->udata.so_state & SS_CANTSENDMORE) { - do_ERROR(so, RD(q), mp); + /* Set so_error, send SIGPIPE, + * followed by new M_ERROR. + */ + freemsg(mp); + so->so_error = EPIPE; + snd_SIGPIPE(RD(q)); + snd_ERRORW(RD(q)); return 0; } - /* If no destination address then make it look * like a plain M_DATA and try again. */ @@ -1644,7 +1578,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwput: Bad unitdata header % return 0; } if (udata_req->DEST_length == 0) { - if (mp->b_cont == (mblk_t *)NULL) { + if (mp->b_cont == NULL) { /* Zero length message. */ mp->b_datap->db_type = M_DATA; @@ -1691,14 +1625,14 @@ sockmodwsrv(q) register mblk_t *bp; register union T_primitives *pptr; register int s; - register size_t size; + register int size; ASSERT(q != NULL); so = (struct so_so *)q->q_ptr; ASSERT(so != NULL); wgetnext: - if ((mp = getq(q)) == (mblk_t *)NULL) { + if ((mp = getq(q)) == NULL) { /* If we have been blocking downstream writes * in the put procedure, then re-enable them. */ @@ -1742,7 +1676,13 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCDATA\n", 0); SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_DATA %x bytes\n", MSGBLEN(mp)); if (so->udata.so_state & SS_CANTSENDMORE) { - do_ERROR(so, RD(q), mp); + /* Set so_error, send SIGPIPE, + * followed by new M_ERROR message. + */ + freemsg(mp); + so->so_error = EPIPE; + snd_SIGPIPE(RD(q)); + snd_ERRORW(RD(q)); goto wgetnext; } @@ -1753,8 +1693,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_DATA %x bytes\n #ifdef _AF_UNIX size = sizeof(struct T_unitdata_req) + so->rux_dev.size; - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -1766,8 +1705,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_DATA %x bytes\n else { size = sizeof(struct T_unitdata_req) + so->raddr.len; - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -1811,7 +1749,13 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: canput returned false case T_DATA_REQ: SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: got T_[UNIT]DATA_REQ\n", 0); if (so->udata.so_state & SS_CANTSENDMORE) { - do_ERROR(so, RD(q), mp); + /* Set so_error, send SIGPIPE, + * followed by new M_ERROR message. + */ + freemsg(mp); + so->so_error = EPIPE; + snd_SIGPIPE(RD(q)); + snd_ERRORW(RD(q)); goto wgetnext; } @@ -1845,8 +1789,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got T_CONN_REQ\n", 0) */ size = max(sizeof(struct T_error_ack), sizeof(struct T_ok_ack)); - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -1909,7 +1852,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: T_CONN_REQ(CLTS) on U /* Not UNIX domain. */ save_addr(&so->raddr, (caddr_t)addr, - (size_t)con_req->DEST_length); + con_req->DEST_length); } so->udata.so_state |= SS_ISCONNECTED; @@ -1961,8 +1904,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: T_CONN_REQ(CLTS) on U * is to work. */ size = q->q_hiwat; - if ((nmp = _s_getmblk((mblk_t *)NULL, size)) == - NULL) { + if ((nmp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); freemsg(bp); return 0; @@ -1995,8 +1937,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: T_CONN_REQ(COTS) on U ux_saveraddr(so, bind_ux); (void)bcopy((caddr_t)&so->rux_dev.addr, - (caddr_t)addr, - (size_t)so->rux_dev.size); + addr, so->rux_dev.size); con_req->DEST_length = so->rux_dev.size; mp->b_wptr = mp->b_rptr + con_req->DEST_offset @@ -2038,8 +1979,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Putting big msg %d\n" SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got T_CONN_RES\n", 0); if (MSGBLEN(mp) < sizeof(*conn_res)) { size = sizeof(struct T_error_ack); - if ((bp = _s_getmblk((mblk_t *)mp, size)) == - NULL) { + if ((bp = _s_getmblk(mp, size)) == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -2070,7 +2010,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got T_CONN_RES\n", 0) } } } - if (soq == (queue_t *)NULL) { + if (soq == NULL) { /* Something wrong here * let the transport provider * find it. @@ -2113,10 +2053,9 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: No queue_t\n", 0); if (((sockaddr_t)so->laddr.buf)->sa_family == AF_UNIX) { register struct so_so *nso; - if ((nso = ux_findlink((caddr_t)(bp->b_rptr + - conn_ind->SRC_offset), - (size_t)conn_ind->SRC_length)) == - NULL) { + if ((nso = ux_findlink(bp->b_rptr + + conn_ind->SRC_offset, + conn_ind->SRC_length)) == NULL) { SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: UNIX: No peer\n", 0); oso->raddr.len = 0; } @@ -2133,16 +2072,9 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: UNIX: No peer\n", 0); } } else save_addr(&oso->raddr, - (caddr_t)(bp->b_rptr+conn_ind->SRC_offset), + bp->b_rptr+conn_ind->SRC_offset, conn_ind->SRC_length); - /* The new socket inherits the properties of the - * old socket. - */ - oso->udata.so_state = so->udata.so_state; - oso->udata.so_options = so->udata.so_options; - oso->linger = so->linger; - freemsg(bp); putnext(q, mp); @@ -2196,16 +2128,14 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); if (mp->b_cont) { /* Make sure there is a peer. */ - if (ux_findlink((caddr_t)mp->b_cont->b_rptr, - (size_t)MSGBLEN(mp->b_cont)) == - NULL) { + if (ux_findlink(mp->b_cont->b_rptr, + MSGBLEN(mp->b_cont)) == NULL) { snd_IOCNAK(q, mp, ECONNREFUSED); goto wgetnext; } size = sizeof(*tcl_sictl) + MSGBLEN(mp->b_cont); - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -2221,8 +2151,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); } size = sizeof(*tcl_sictl) + so->rux_dev.size; - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -2234,9 +2163,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); tcl_sictl->type = TCL_LINK; tcl_sictl->ADDR_len = addrlen; tcl_sictl->ADDR_offset = sizeof(*tcl_sictl); - (void)bcopy(addr, - (caddr_t)(bp->b_wptr + tcl_sictl->ADDR_offset), - (size_t)tcl_sictl->ADDR_len); + (void)bcopy(addr, bp->b_wptr + tcl_sictl->ADDR_offset, + tcl_sictl->ADDR_len); bp->b_datap->db_type = M_CTL; bp->b_wptr += (tcl_sictl->ADDR_offset + tcl_sictl->ADDR_len); @@ -2262,8 +2190,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); /* Format an M_CTL and send it down. */ size = sizeof(long); - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); goto wgetnext; } @@ -2284,7 +2211,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); register int olen; register mblk_t *ibp; register mblk_t *obp; - register caddr_t pos; + register u_char *pos; int error; error = 0; @@ -2294,11 +2221,11 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); (so->udata.servtype & (T_COTS | T_COTS_ORD)) == 0) error = EOPNOTSUPP; else - if (mp->b_cont == (mblk_t *)NULL || + if (mp->b_cont == NULL || so->udata.so_options & SO_OOBINLINE) error = EINVAL; else - if (so->oob == (mblk_t *)NULL) + if (so->oob == NULL) error = EWOULDBLOCK; if (error) { @@ -2312,14 +2239,14 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); iocbp->ioc_count = 0; obp = mp->b_cont; ibp = so->oob; - pos = (caddr_t)ibp->b_rptr; + pos = ibp->b_rptr; for (;;) { ilen = MSGBLEN(ibp); olen = MSGBLEN(obp); size = MIN(olen, ilen); obp->b_wptr = obp->b_rptr; - (void)bcopy(pos, (caddr_t)obp->b_wptr, size); + (void)bcopy(pos, obp->b_wptr, size); pos += size; if ( !(iocbp->ioc_cmd & MSG_PEEK)) @@ -2348,7 +2275,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got M_IOCTL\n", 0); */ if (ibp->b_cont) { ibp = ibp->b_cont; - pos = (caddr_t)ibp->b_rptr; + pos = ibp->b_rptr; continue; } /* No more oob data, finished. @@ -2388,7 +2315,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_LISTEN\n", 0); } if (iocbp->ioc_count < (sizeof(*bind_req) + so->laddr.len) || - mp->b_cont == (mblk_t *)NULL) { + mp->b_cont == NULL) { snd_IOCNAK(q, mp, EINVAL); goto wgetnext; } @@ -2396,8 +2323,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_LISTEN\n", 0); /* Set up the T_UNBIND_REQ request. */ size = sizeof(struct T_unbind_req); - if ((bp = _s_getmblk((mblk_t *)NULL, size)) == - (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -2432,8 +2358,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_LISTEN\n", 0); error = EINVAL; else { (void)bcopy(so->laddr.buf, - (caddr_t)(mp->b_cont->b_rptr + - bind_req->ADDR_offset), + (caddr_t)bind_req + + bind_req->ADDR_offset, size); bind_req->ADDR_length = size; } @@ -2455,13 +2381,12 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_LISTEN\n", 0); case SI_GETUDATA: SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_GETUDATA\n", 0); if (iocbp->ioc_count < sizeof(struct si_udata) || - mp->b_cont == (mblk_t *)NULL) { + mp->b_cont == NULL) { snd_IOCNAK(q, mp, EINVAL); goto wgetnext; } - (void)bcopy((caddr_t)&so->udata, - (caddr_t)mp->b_cont->b_rptr, + (void)bcopy((caddr_t)&so->udata, mp->b_cont->b_rptr, sizeof(struct si_udata)); mp->b_datap->db_type = M_IOCACK; iocbp->ioc_count = sizeof(struct si_udata); @@ -2494,7 +2419,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: peer len %d\n", so->r } /* See if the transport provider supports it. */ - if ((bp = copymsg(mp)) == (mblk_t *)NULL) { + if ((bp = copymsg(mp)) == NULL) { snd_IOCNAK(q, mp, EAGAIN); goto wgetnext; } @@ -2528,7 +2453,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got TI_GETMYNAME stat /* See if the transport provider supports it. */ - if ((bp = copymsg(mp)) == (mblk_t *)NULL) { + if ((bp = copymsg(mp)) == NULL) { snd_IOCNAK(q, mp, EAGAIN); goto wgetnext; } @@ -2550,7 +2475,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_SETPEERNAME\n" else if (iocbp->ioc_count == 0 || iocbp->ioc_count > so->raddr.maxlen || - (bp = mp->b_cont) == (mblk_t *)NULL) + (bp = mp->b_cont) == NULL) iocbp->ioc_error = EINVAL; if (iocbp->ioc_error) { @@ -2559,8 +2484,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_SETPEERNAME\n" } so->udata.so_state |= SS_ISCONNECTED; - save_addr(&so->raddr, (caddr_t)bp->b_rptr, - iocbp->ioc_count); + save_addr(&so->raddr, bp->b_rptr, iocbp->ioc_count); mp->b_datap->db_type = M_IOCACK; iocbp->ioc_count = 0; @@ -2575,7 +2499,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_SETMYNAME\n", if ( !iocbp->ioc_count || !(so->udata.so_state & SS_ISBOUND) || iocbp->ioc_count > so->laddr.maxlen || - (bp = mp->b_cont) == (mblk_t *)NULL) + (bp = mp->b_cont) == NULL) iocbp->ioc_error = EINVAL; if (iocbp->ioc_error) { @@ -2583,8 +2507,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_SETMYNAME\n", goto wgetnext; } - save_addr(&so->laddr, (caddr_t)bp->b_rptr, - iocbp->ioc_count); + save_addr(&so->laddr, bp->b_rptr, iocbp->ioc_count); mp->b_datap->db_type = M_IOCACK; iocbp->ioc_count = 0; @@ -2596,7 +2519,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_SETMYNAME\n", SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Got SI_SHUTDOWN\n", 0); if (iocbp->ioc_count < sizeof(int) || - mp->b_cont == (mblk_t *)NULL) + mp->b_cont == NULL) iocbp->ioc_error = EINVAL; if ((how = *(int *)mp->b_cont->b_rptr) > 2 || how < 0) @@ -2623,8 +2546,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: SI_SHUTDOWN how %d\n" /* Send an orderly release. */ size = sizeof(struct T_ordrel_req); - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -2645,8 +2568,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: SI_SHUTDOWN how %d\n" SS_CANTSENDMORE); if (so->udata.servtype == T_COTS_ORD) { size = sizeof(struct T_ordrel_req); - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -2662,8 +2585,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: SI_SHUTDOWN how %d\n" register struct T_discon_req *req; size = sizeof(struct T_discon_req); - if ((bp = _s_getmblk((mblk_t *)NULL, - size)) == (mblk_t *)NULL) { + if ((bp = _s_getmblk(NULL, size)) + == NULL) { _S_RECOVER(q, mp, size); return 0; } @@ -2701,7 +2624,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: SI_SHUTDOWN how %d\n" case TI_UNBIND: case TI_GETINFO: case TI_OPTMGMT: - if (mp->b_cont == (mblk_t *)NULL) { + if (mp->b_cont == NULL) { snd_IOCNAK(q, mp, EINVAL); goto wgetnext; } @@ -2746,7 +2669,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: UNIX domain BIND\n", /* Remember the address string */ bind_ux = (struct bind_ux *)addr; - save_addr(&so->laddr, (caddr_t)addr, + save_addr((caddr_t)&so->laddr, + (caddr_t)addr, sizeof(struct sockaddr_un)); /* If the user specified an address @@ -2772,8 +2696,8 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: Non null BIND\n", 0); */ (void)bcopy( (caddr_t)&so->lux_dev.addr, - (caddr_t)bind_ux, - so->lux_dev.size); + (caddr_t)bind_ux, + so->lux_dev.size); bind_req->ADDR_length = so->lux_dev.size; @@ -2818,7 +2742,7 @@ SOCKLOG(so, SIMOD_ID, so-so_so, 0, SL_TRACE, "sockmodwsrv: BIND length %d\n", bi } } - if ((bp = copymsg(mp->b_cont)) == (mblk_t *)NULL) { + if ((bp = copymsg(mp->b_cont)) == NULL) { snd_IOCNAK(q, mp, ENOSR); goto wgetnext; } @@ -2855,6 +2779,7 @@ so_options(q, mp) */ register struct T_optmgmt_req *opt_req; register struct opthdr *opt; + register int *optval; register struct so_so *so; so = (struct so_so *)q->q_ptr; @@ -2875,320 +2800,88 @@ so_options(q, mp) /* Retrieve current value. */ switch(opt->name) { - case SO_ERROR: - *(int *)OPTVAL(opt) = so->so_error; - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - so->so_error = 0; - return 1; - case SO_DEBUG: - case SO_OOBINLINE: - case SO_REUSEADDR: - case SO_BROADCAST: - case SO_KEEPALIVE: - case SO_DONTROUTE: - case SO_USELOOPBACK: - *(int *)OPTVAL(opt) = so->udata.so_options & opt->name; - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - return 1; - - case SO_LINGER: { - struct linger *l; - - if (opt->len != sizeof(struct linger)) - return -EINVAL; - - l = (struct linger *)OPTVAL(opt); - if (so->udata.so_options & SO_LINGER) { - l->l_onoff = 1; - l->l_linger = so->linger; - } - else { - l->l_onoff = 0; - l->l_linger = 0; - } - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(struct linger); - return 1; - } - - case SO_SNDBUF: - *(int *)OPTVAL(opt) = so->sndbuf; + *(int *)OPTVAL(opt) = so->udata.so_options & SO_DEBUG; opt_req->PRIM_type = T_OPTMGMT_ACK; opt->len = sizeof(int); return 1; - case SO_RCVBUF: - *(int *)OPTVAL(opt) = so->rcvbuf; + case SO_ERROR: + *(int *)OPTVAL(opt) = so->so_error; opt_req->PRIM_type = T_OPTMGMT_ACK; opt->len = sizeof(int); + so->so_error = 0; return 1; - case SO_SNDLOWAT: - *(int *)OPTVAL(opt) = so->sndlowat; + case SO_OOBINLINE: + *(int *)OPTVAL(opt) = + so->udata.so_options & SO_OOBINLINE; opt_req->PRIM_type = T_OPTMGMT_ACK; opt->len = sizeof(int); return 1; - case SO_RCVLOWAT: - *(int *)OPTVAL(opt) = so->rcvlowat; - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - return 1; - - case SO_SNDTIMEO: - *(int *)OPTVAL(opt) = so->sndtimeo; - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - return 1; - - case SO_RCVTIMEO: - *(int *)OPTVAL(opt) = so->rcvtimeo; - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - return 1; - - case SO_PROTOTYPE: - *(int *)OPTVAL(opt) = so->prototype; - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - return 1; - default: - return -ENOPROTOOPT; + return 0; } + break; case T_NEGOTIATE: - /* We wait until the negotiated option comes - * back before setting most of these. + /* Set new value. + * if value is non-zero, then the option should + * be set, otherwise it is reset. */ switch(opt->name) { + case SO_DEBUG: case SO_ERROR: - return -EINVAL; - - case SO_LINGER: - if (opt->len != OPTLEN(sizeof(struct linger))) - return -EINVAL; - break; - case SO_OOBINLINE: - if (*(int *)OPTVAL(opt)) - so->udata.so_options |= SO_OOBINLINE; - else so->udata.so_options &= ~SO_OOBINLINE; - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - return 1; - - case SO_DEBUG: - case SO_USELOOPBACK: - case SO_REUSEADDR: - case SO_BROADCAST: - case SO_KEEPALIVE: - case SO_DONTROUTE: case SO_SNDBUF: case SO_RCVBUF: - case SO_SNDLOWAT: - case SO_RCVLOWAT: - case SO_SNDTIMEO: - case SO_RCVTIMEO: - case SO_PROTOTYPE: if (opt->len != OPTLEN(sizeof(int))) return -EINVAL; - break; - - default: - return -ENOPROTOOPT; - } - } - /* Set so_option so that we know what - * we are dealing with. - */ - so->so_option = opt->name; - return 0; -} - -/* The transport provider does not support the option, - * but we must because it is a SOL_SOCKET option. - * If value is non-zero, then the option should - * be set, otherwise it is reset. - */ -STATIC mblk_t * -_s_makeopt(so) - register struct so_so *so; -{ - register mblk_t *bp; - struct T_optmgmt_req *opt_req; - struct linger *l; - register struct opthdr *opt; - /* Get the saved request. - */ - opt_req = (struct T_optmgmt_req *)so->iocsave->b_cont->b_rptr; - opt = (struct opthdr *)(so->iocsave->b_cont->b_rptr + - opt_req->OPT_offset); - switch(opt->name) { - case SO_LINGER: - l = (struct linger *)OPTVAL(opt); - if (l->l_onoff) { - so->udata.so_options |= SO_LINGER; - so->linger = l->l_linger; - } - else { - so->udata.so_options &= ~SO_LINGER; - so->linger = 0; - } - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(struct linger); - break; - - case SO_DEBUG: - case SO_KEEPALIVE: - case SO_DONTROUTE: - case SO_USELOOPBACK: - case SO_BROADCAST: - case SO_REUSEADDR: - if (*(int *)OPTVAL(opt)) - so->udata.so_options |= opt->name; - else so->udata.so_options &= ~opt->name; - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - - case SO_SNDBUF: - so->sndbuf = *(int *)OPTVAL(opt); - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - - case SO_RCVBUF: - so->rcvbuf = *(int *)OPTVAL(opt); - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - - case SO_SNDLOWAT: - so->sndlowat = *(int *)OPTVAL(opt); - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - - case SO_RCVLOWAT: - so->rcvlowat = *(int *)OPTVAL(opt); - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - - case SO_SNDTIMEO: - so->sndtimeo = *(int *)OPTVAL(opt); - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - - case SO_RCVTIMEO: - so->rcvtimeo = *(int *)OPTVAL(opt); - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - - case SO_PROTOTYPE: - so->prototype = *(int *)OPTVAL(opt); - - opt_req->PRIM_type = T_OPTMGMT_ACK; - opt->len = sizeof(int); - break; - } - - bp = so->iocsave->b_cont; - so->iocsave->b_cont = NULL; - return bp; -} + optval = (int *)OPTVAL(opt); -/* The transport provider returned T_OPTMGMT_ACK, - * copy the values it negotiated. - */ -STATIC void -_s_setopt(mp, so) - register mblk_t *mp; - register struct so_so *so; -{ - struct T_optmgmt_ack *opt_ack; - register struct opthdr *opt; - register struct linger *l; - - opt_ack = (struct T_optmgmt_ack *)mp->b_rptr; - opt = (struct opthdr *)(mp->b_rptr + opt_ack->OPT_offset); - - switch(opt->name) { - case SO_DEBUG: - case SO_USELOOPBACK: - case SO_REUSEADDR: - case SO_BROADCAST: - case SO_KEEPALIVE: - case SO_DONTROUTE: - if (*(int *)OPTVAL(opt)) - so->udata.so_options |= opt->name; - else so->udata.so_options &= ~opt->name; - break; + switch (opt->name) { + case SO_DEBUG: + if (*optval) + so->udata.so_options |= SO_DEBUG; + else so->udata.so_options &= ~SO_DEBUG; + return 0; - case SO_LINGER: - l = (struct linger *)OPTVAL(opt); - if (l->l_onoff) { - so->udata.so_options |= SO_LINGER; - so->linger = l->l_linger; - } - else { - so->udata.so_options &= ~SO_LINGER; - so->linger = 0; + case SO_ERROR: + so->so_error = *optval; + return 1; + + case SO_OOBINLINE: + if (*optval) + so->udata.so_options |= SO_OOBINLINE; + else so->udata.so_options &= ~SO_OOBINLINE; + opt_req->PRIM_type = T_OPTMGMT_ACK; + return 1; + + case SO_SNDBUF: + /* Never allow it above the max. + */ + q->q_maxpsz = so->udata.tidusize = + MIN(*optval * 2, SB_MAX); + return 0; + + case SO_RCVBUF: + RD(q)->q_maxpsz = MIN(*optval * 2, SB_MAX); + return 0; + } + default: + return 0; } - break; - - case SO_SNDBUF: - so->sndbuf = *(int *)OPTVAL(opt); - break; - - case SO_RCVBUF: - so->rcvbuf = *(int *)OPTVAL(opt); - break; - - case SO_SNDLOWAT: - so->sndlowat = *(int *)OPTVAL(opt); - break; - - case SO_RCVLOWAT: - so->rcvlowat = *(int *)OPTVAL(opt); - break; - - case SO_SNDTIMEO: - so->sndtimeo = *(int *)OPTVAL(opt); - break; - - case SO_RCVTIMEO: - so->rcvtimeo = *(int *)OPTVAL(opt); - break; - - case SO_PROTOTYPE: - so->prototype = *(int *)OPTVAL(opt); - break; } + return 0; } - /* * Set sizes of buffers */ #define DEFSIZE 128 -static long +STATIC long _t_setsize(infosize) long infosize; { @@ -3206,7 +2899,7 @@ _t_setsize(infosize) /* * Translate a TLI error into a system error as best we can. */ -static ushort tli_errs[] = { +STATIC ushort tli_errs[] = { 0, /* no error */ EADDRNOTAVAIL, /* TBADADDR */ ENOPROTOOPT, /* TBADOPT */ @@ -3229,13 +2922,13 @@ static ushort tli_errs[] = { EPROTO, /* TSTATECHNG */ }; -static int +STATIC int tlitosyserr(terr) register int terr; { if (terr > (sizeof(tli_errs) / sizeof(ushort))) return EPROTO; - else return (int)tli_errs[terr]; + else return tli_errs[terr]; } /* This function will walk through the message block given @@ -3250,14 +2943,14 @@ tlitosyserr(terr) STATIC mblk_t * _s_getmblk(mp, size) register mblk_t *mp; - register size_t size; + register int size; { register mblk_t *nmp; register mblk_t *bp; bp = mp; while (bp) { - if (MBLKLEN(bp) >= (int)size) { + if (MBLKLEN(bp) >= size) { bp->b_rptr = bp->b_wptr = bp->b_datap->db_base; while (mp && bp != mp) { /* Free each block up to the one @@ -3280,11 +2973,11 @@ _s_getmblk(mp, size) bp = bp->b_cont; } - if ((bp = allocb(size, BPRI_MED)) == (mblk_t *)NULL) { + if ((bp = allocb(size, BPRI_MED)) == NULL) { /* But we have not touched mp. */ SOCKLOG((struct so_so *)NULL, SIMOD_ID, -1, 0, SL_TRACE, "_s_getmblk: No memory\n", 0); - return (mblk_t *)NULL; + return NULL; } else { SOCKLOG((struct so_so *)NULL, SIMOD_ID, -1, 0, SL_TRACE, "_s_getmblk: Allocated %d bytes\n", size); @@ -3351,9 +3044,6 @@ so_init(so, info_ack) so->udata.optsize = so->tp_info.options = _t_setsize(info_ack->OPT_size); - so->udata.etsdusize = so->tp_info.etsdu = - _t_setsize(info_ack->ETSDU_size); - switch(info_ack->SERV_type) { case T_CLTS: switch(info_ack->CURRENT_state) { @@ -3425,9 +3115,9 @@ STATIC void save_addr(save, buf, len) register struct netbuf *save; register char *buf; - register size_t len; + register int len; { - register size_t llen; + register int llen; llen = min(save->maxlen, len); SOCKLOG((struct so_so *)NULL, SIMOD_ID, -1, 0, SL_TRACE, "save_addr: Copying %d bytes\n", llen); @@ -3441,7 +3131,7 @@ snd_ZERO(q) { register mblk_t *mp; - if ((mp = _s_getmblk((mblk_t *)NULL, (size_t)1)) == (mblk_t *)NULL) { + if ((mp = _s_getmblk(NULL, 1)) == NULL) { if (!bufcall(1, BPRI_MED, snd_ZERO, (caddr_t)q)) (void)timeout(snd_ZERO, (caddr_t)q, SIMWAIT); } @@ -3457,12 +3147,14 @@ snd_ERRORW(q) { register mblk_t *mp; - if ((mp = _s_getmblk((mblk_t *)NULL, (size_t)2)) == (mblk_t *)NULL) + if ((mp = _s_getmblk(NULL, 2)) == NULL) if (!bufcall(2, BPRI_MED, snd_ERRORW, (caddr_t)q)) (void)timeout(snd_ERRORW, (caddr_t)q, SIMWAIT); mp->b_datap->db_type = M_ERROR; +#ifdef noerror *mp->b_wptr++ = NOERROR; +#endif *mp->b_wptr++ = EPIPE; SOCKLOG((struct so_so *)NULL, SIMOD_ID, -1, 0, SL_TRACE, "snd_ERRORW: Sending up M_ERROR\n",0); putnext(q, mp); @@ -3505,50 +3197,6 @@ snd_IOCNAK(q, mp, error) qreply(q, mp); } -/* The following complicated procedure is an attempt to get the - * semantics right for generating SIGPIPE and closing the socket - * down. - */ -STATIC void -do_ERROR(so, q, mp) - register struct so_so *so; - register queue_t *q; - register mblk_t *mp; -{ -SOCKLOG(so, SIMOD_ID, -1, 0, SL_TRACE, "do_ERROR: Sending up SIGPIPE\n",0); - snd_SIGPIPE(q); - if (so->udata.servtype == T_CLTS) { - freemsg(mp); -SOCKLOG(so, SIMOD_ID, -1, 0, SL_TRACE, "do_ERROR: Closing write side\n",0); - snd_ERRORW(q); - } - else { - /* If a disconnect has been received send - * an M_ERROR. If a shutdown(2) has been done - * just close down the write side, the read side - * will automatically get EOF. - */ - if (so->udata.so_state & SS_CANTRCVMORE && - (so->udata.so_state & SS_ISCONNECTED) == 0) { - /* Disconnect received. Send up new M_ERROR - * with read side set to disconnect error - * and write side set to EPIPE. - */ -SOCKLOG(so, SIMOD_ID, -1, 0, SL_TRACE, "do_ERROR: Sending up M_ERROR\n",0); - mp->b_wptr = mp->b_rptr = mp->b_datap->db_base; - mp->b_datap->db_type = M_ERROR; - *mp->b_wptr++ = so->so_error; - *mp->b_wptr++ = EPIPE; - putnext(q, mp); - } - else { -SOCKLOG(so, SIMOD_ID, -1, 0, SL_TRACE, "do_ERROR: Closing write side\n",0); - freemsg(mp); - snd_ERRORW(q); - } - } -} - #ifdef _AF_UNIX /* Looks up the socket structure which has as * its local dev/ino the same as passed in. @@ -3556,7 +3204,7 @@ SOCKLOG(so, SIMOD_ID, -1, 0, SL_TRACE, "do_ERROR: Closing write side\n",0); STATIC struct so_so * ux_findlink(addr, len) register char *addr; - register size_t len; + register int len; { register struct so_so *so; @@ -3573,10 +3221,10 @@ ux_dellink(so) { register struct so_so *oso; - if ((oso = so->so_ux.next) != (struct so_so *)NULL) + if (oso = so->so_ux.next) oso->so_ux.prev = so->so_ux.prev; - if ((oso = so->so_ux.prev) != (struct so_so *)NULL) + if (oso = so->so_ux.prev) oso->so_ux.next = so->so_ux.next; else so_ux_list = so->so_ux.next; } @@ -3601,7 +3249,7 @@ ux_restoreaddr(so, mp, addr, addrlen) register struct so_so *so; register mblk_t *mp; register char *addr; - register size_t addrlen; + register int addrlen; { struct T_bind_ack *bind_ack; struct bind_ux *bind_ux; @@ -3630,7 +3278,7 @@ ux_saveraddr(so, bind_ux) register struct so_so *so; register struct bind_ux *bind_ux; { - save_addr(&so->raddr, (caddr_t)&bind_ux->name, + save_addr((caddr_t)&so->raddr, (caddr_t)&bind_ux->name, sizeof(struct sockaddr_un)); (void)bcopy((caddr_t)&bind_ux->extaddr, @@ -3644,14 +3292,14 @@ STATIC void fill_udata_req_addr(bp, addr, len) register mblk_t *bp; register char *addr; - register size_t len; + register int len; { register struct T_unitdata_req *udata_req; udata_req = (struct T_unitdata_req *)bp->b_rptr; udata_req->DEST_length = len; udata_req->DEST_offset = sizeof(*udata_req); - (void)bcopy(addr, (caddr_t)(bp->b_rptr + udata_req->DEST_offset), len); + (void)bcopy(addr, bp->b_rptr + udata_req->DEST_offset, len); udata_req->PRIM_type = T_UNITDATA_REQ; udata_req->OPT_length = 0; @@ -3667,20 +3315,16 @@ STATIC void fill_udata_ind_addr(bp, addr, len) register mblk_t *bp; register char *addr; - register size_t len; + register int len; { register struct T_unitdata_ind *udata_ind; udata_ind = (struct T_unitdata_ind *)bp->b_rptr; udata_ind->SRC_length = len; udata_ind->SRC_offset = sizeof(*udata_ind); - (void)bcopy(addr, (caddr_t)(bp->b_rptr + udata_ind->SRC_offset), len); + (void)bcopy(addr, bp->b_rptr + udata_ind->SRC_offset, len); bp->b_datap->db_type = M_PROTO; bp->b_wptr = bp->b_rptr + sizeof(*udata_ind) + len; } #endif - - - - diff --git a/usr/src/uts/3b2/io/stream.c b/usr/src/uts/3b2/io/stream.c index ffdf815..8497a5f 100644 --- a/usr/src/uts/3b2/io/stream.c +++ b/usr/src/uts/3b2/io/stream.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/stream.c 1.45" +#ident "@(#)kernel:io/stream.c 1.37" #include "sys/types.h" #include "sys/param.h" @@ -32,8 +32,6 @@ extern struct mdbblock *mdbfreelist; extern struct msgb *msgfreelist; -extern struct strinfo Strinfo[]; /* dynamic resource info */ -extern long Strcount; extern queue_t *qhead; @@ -48,18 +46,11 @@ struct mdbblock *xmdballoc(); struct msgb *xmsgalloc(); -#ifdef DEBUG -int _streams_crash = 1; /* to signal the crash routines */ -#else -int _streams_crash = 0; -#endif - - /* * Pointer types: * (struct mdbblock *) mdbfreelist * (struct msgb *) msgfreelist - * (struct mbinfo *) m_prev, m_next + * (struct msgb *) m_prev, m_next */ @@ -67,14 +58,12 @@ int _streams_crash = 0; ((struct msgb *)(mdbp))->b_next = (struct msgb *) mdbfreelist; \ mdbfreelist = (mdbp); \ strst.mdbblock.use--; \ - _DELETE_MDB_INUSE(mdbp); \ } #define FREEMSGBLOCK( mesgp ) { \ (mesgp)->b_next = (struct msgb *) msgfreelist; \ msgfreelist = mesgp; \ strst.msgblock.use--; \ - _DELETE_MSG_INUSE((struct mbinfo *)mesgp); \ } @@ -82,7 +71,6 @@ int _streams_crash = 0; mdbp = mdbfreelist; \ mdbfreelist = (struct mdbblock *)(((struct msgb *)mdbp)->b_next );\ BUMPUP(strst.mdbblock); \ - _INSERT_MDB_INUSE(mdbp); \ } @@ -90,7 +78,6 @@ int _streams_crash = 0; mesgp = msgfreelist; \ msgfreelist = mesgp->b_next; \ BUMPUP(strst.msgblock); \ - _INSERT_MSG_INUSE((struct mbinfo *)mesgp); \ } /* Status flags for triplets */ @@ -104,28 +91,6 @@ int _streams_crash = 0; #define _NOT_D 2 #define _XCONN 3 - -/* Convenient macros for accessing fields */ - -#define m_bdatap m_mblock.b_datap -#define m_bnext m_mblock.b_next -#define m_bprev m_mblock.b_prev -#define m_bcont m_mblock.b_cont -#define m_brptr m_mblock.b_rptr -#define m_bwptr m_mblock.b_wptr -#define m_bband m_mblock.b_band -#define m_bflag m_mblock.b_flag - -#define d_dbfreep d_dblock.db_freep -#define d_dbfrtnp d_dblock.db_frtnp -#define d_dbbase d_dblock.db_base -#define d_dblim d_dblock.db_lim -#define d_dbref d_dblock.db_ref -#define d_dbtype d_dblock.db_type -#define d_dbiswhat d_dblock.db_iswhat -#define d_dbsize d_dblock.db_size -#define d_dbmsgaddr d_dblock.db_msgaddr - #define _DUPB( newbp, oldbp) { \ ASSERT((oldbp)); \ if (!msgfreelist){ \ @@ -133,7 +98,6 @@ int _streams_crash = 0; } \ else { \ ALLOCMSGBLOCK( newbp ); \ - saveaddr(&(((struct mbinfo *)newbp)->m_func)); \ ((newbp)->b_datap = (oldbp)->b_datap)->db_ref++; \ (newbp)->b_next = NULL; \ (newbp)->b_prev = NULL; \ @@ -154,25 +118,23 @@ int _streams_crash = 0; FREEMSGBLOCK(msgp); \ } \ else { \ - if (((struct mdbblock *)msgp)->datblk.d_dbiswhat == _NOT_D) { \ + if (((struct mdbblock *)msgp)->datblk.db_iswhat == _NOT_D) { \ FREEMDBBLOCK((struct mdbblock *)msgp); \ } \ - else ((struct mdbblock *)msgp)->datblk.d_dbiswhat = _NOT_M; \ + else ((struct mdbblock *)msgp)->datblk.db_iswhat = _NOT_M; \ } \ if ( --(dbp->db_ref) == 0 ) { \ - if ((char *)dbp + sizeof(struct dbinfo) != (char *)(dbp->db_base)) { \ - if (dbp->db_frtnp == NULL) { \ + if ((char *)dbp + sizeof(struct datab) != (char *)(dbp->db_base)) { \ + if (dbp->db_frtnp == NULL) \ kmem_free(dbp->db_base, \ ((char *)(dbp->db_lim) - (char *)(dbp->db_base))); \ - Strcount -= (dbp->db_lim - dbp->db_base); \ - } \ else { \ if (dbp->db_frtnp->free_func) \ (*dbp->db_frtnp->free_func)(dbp->db_frtnp->free_arg); \ } \ } \ if (dbp->db_iswhat == _NOT_M) { \ - msgp = (struct msgb *)((char *)dbp - sizeof(struct mbinfo)); \ + msgp = (struct msgb *)((char *)dbp - sizeof(struct msgb)); \ FREEMDBBLOCK((struct mdbblock *)msgp); \ } \ else \ @@ -180,86 +142,6 @@ int _streams_crash = 0; } \ } -# ifdef DEBUG - -/* routines for managing in-use lists : only in DEBUG mode */ - -delete_msg_inuse(msgptr) -register struct mbinfo *msgptr; -{ - if (msgptr->m_prev) { - msgptr->m_prev->m_next = msgptr->m_next; - if (msgptr->m_next) - msgptr->m_next->m_prev = msgptr->m_prev; - } - else { - Strinfo[DYN_MSGBLOCK].sd_head = (void *)(msgptr->m_next); - if (msgptr->m_next) - msgptr->m_next->m_prev = NULL; - } -} - -delete_mdb_inuse(mdbptr) -struct mdbblock *mdbptr; -{ - register struct mbinfo *msgptr = &(mdbptr->msgblk); - register struct dbinfo *datptr = &(mdbptr->datblk); - - if (msgptr->m_prev) { - msgptr->m_prev->m_next = msgptr->m_next; - if (msgptr->m_next) - msgptr->m_next->m_prev = msgptr->m_prev; - } - else { - Strinfo[DYN_MSGBLOCK].sd_head = (void *)(msgptr->m_next); - if (msgptr->m_next) - msgptr->m_next->m_prev = NULL; - } - if (datptr->d_prev) { - datptr->d_prev->d_next = datptr->d_next; - if (datptr->d_next) - datptr->d_next->d_prev = datptr->d_prev; - } - else { - Strinfo[DYN_MDBBLOCK].sd_head = (void *)(datptr->d_next); - if (datptr->d_next) - datptr->d_next->d_prev = NULL; - } -} - -insert_msg_inuse(msgptr) -register struct mbinfo *msgptr; -{ - msgptr->m_next = (struct mbinfo *)(Strinfo[DYN_MSGBLOCK].sd_head); - Strinfo[DYN_MSGBLOCK].sd_head = (void *)(msgptr); - if (msgptr->m_next) - msgptr->m_next->m_prev = (struct mbinfo *)msgptr; - msgptr->m_prev = NULL; -} - -insert_mdb_inuse(mdbptr) -struct mdbblock *mdbptr; -{ - register struct mbinfo *msgptr = &(mdbptr->msgblk); - register struct dbinfo *datptr = &(mdbptr->datblk); - - msgptr->m_next = (struct mbinfo *)(Strinfo[DYN_MSGBLOCK].sd_head); - Strinfo[DYN_MSGBLOCK].sd_head = (void *)(msgptr); - if (msgptr->m_next) - msgptr->m_next->m_prev = (struct mbinfo *)msgptr; - msgptr->m_prev = NULL; - - datptr->d_next = (struct dbinfo *)(Strinfo[DYN_MDBBLOCK].sd_head); - Strinfo[DYN_MDBBLOCK].sd_head = (void *)(datptr); - if (datptr->d_next) - datptr->d_next->d_prev = (struct dbinfo *)datptr; - datptr->d_prev = NULL; -} - -# endif - - - /* * NOTE: Some code in streamio.c relies on knowledge of the underlying * message-data-buffer pool structure. @@ -292,22 +174,20 @@ uint pri; } splx(s); - /* save return address */ - saveaddr(&(((struct mbinfo *)mdbptr)->m_func)); ((struct msgb *)mdbptr)->b_datap = - (struct datab *)(((char *)mdbptr) + sizeof(struct mbinfo)); + (struct datab *)(((char *)mdbptr) + sizeof(struct msgb)); ((struct msgb *)mdbptr)->b_next = NULL; ((struct msgb *)mdbptr)->b_prev = NULL; ((struct msgb *)mdbptr)->b_cont = NULL; - mdbptr->datblk.d_dbfrtnp = NULL; + mdbptr->datblk.db_frtnp = NULL; ((struct msgb *)mdbptr)->b_band = 0; ((struct msgb *)mdbptr)->b_flag = 0; - (mdbptr->datblk).d_dbtype = M_DATA; - (mdbptr->datblk).d_dbref = 1; - (mdbptr->datblk).d_dbmsgaddr = (caddr_t)mdbptr; - (mdbptr->datblk).d_dbiswhat = _MDBBLK; + (mdbptr->datblk).db_type = M_DATA; + (mdbptr->datblk).db_ref = 1; + (mdbptr->datblk).db_msgaddr = (caddr_t)mdbptr; + (mdbptr->datblk).db_iswhat = _MDBBLK; if (size > (int)FASTBUF) { if ((buf = kmem_alloc(size, KM_NOSLEEP)) == NULL ) { @@ -319,24 +199,23 @@ uint pri; else { ((struct msgb *)mdbptr)->b_rptr = ((struct msgb *)mdbptr)->b_wptr = - (mdbptr->datblk).d_dbbase = buf; - (mdbptr->datblk).d_dbsize = size; - (mdbptr->datblk).d_dblim = ((unsigned char *)buf) + size; - Strcount += size; + (mdbptr->datblk).db_base = buf; + (mdbptr->datblk).db_size = size; + (mdbptr->datblk).db_lim = ((unsigned char *)buf) + size; } } else { ((struct msgb *)mdbptr)->b_rptr = ((struct msgb *)mdbptr)->b_wptr = - (mdbptr->datblk).d_dbbase = + (mdbptr->datblk).db_base = (unsigned char *)(&(mdbptr->databuf)); if (size == 0 ) - (mdbptr->datblk).d_dbsize = 4; + (mdbptr->datblk).db_size = 4; else - (mdbptr->datblk).d_dbsize = size; + (mdbptr->datblk).db_size = size; - (mdbptr->datblk).d_dblim = + (mdbptr->datblk).db_lim = (unsigned char *)mdbptr + sizeof(struct mdbblock); } @@ -532,11 +411,11 @@ freeb(bp) FREEMSGBLOCK(bp); } else { - if (((struct mdbblock *)bp)->datblk.d_dbiswhat == _NOT_D) { + if (((struct mdbblock *)bp)->datblk.db_iswhat == _NOT_D) { FREEMDBBLOCK((struct mdbblock *)bp); } else - ((struct mdbblock *)bp)->datblk.d_dbiswhat = _NOT_M; + ((struct mdbblock *)bp)->datblk.db_iswhat = _NOT_M; } if ( --(dbp->db_ref) > 0 ) { @@ -545,12 +424,10 @@ freeb(bp) } /* seperate databuffer? */ - if ((char *)dbp + sizeof(struct dbinfo) != (char *)(dbp->db_base)) { - if (dbp->db_frtnp == NULL) { + if ((char *)dbp + sizeof(struct datab) != (char *)(dbp->db_base)) { + if (dbp->db_frtnp == NULL) kmem_free(dbp->db_base, ((char *)(dbp->db_lim) - (char *)(dbp->db_base) )); - Strcount -= (dbp->db_lim - dbp->db_base); - } else { if (dbp->db_frtnp->free_func) (*dbp->db_frtnp->free_func)(dbp->db_frtnp->free_arg); @@ -562,7 +439,7 @@ freeb(bp) * not in use */ if (dbp->db_iswhat == _NOT_M) { - bp = (struct msgb *)((char *)dbp - sizeof(struct mbinfo)); + bp = (struct msgb *)((char *)dbp - sizeof(struct msgb)); FREEMDBBLOCK((struct mdbblock *)bp); } else /* @@ -625,9 +502,6 @@ dupb(bp) (nbp->b_datap = bp->b_datap)->db_ref++; splx(s); - /* save return address */ - saveaddr(&(((struct mbinfo *)nbp)->m_func)); - nbp->b_next = NULL; nbp->b_prev = NULL; nbp->b_cont = NULL; @@ -886,10 +760,7 @@ register int len; if ((newmp = allocb(len, BPRI_MED)) == NULL ) return(0); - /* save return address */ - saveaddr(&(((struct mbinfo *)newmp)->m_func)); - - ((struct mdbblock *)newmp)->datblk.d_dbtype = dbp->db_type; + ((struct mdbblock *)newmp)->datblk.db_type = dbp->db_type; --( dbp->db_ref ); /*--- copy the data into the new data buffer ---*/ @@ -921,11 +792,11 @@ register int len; s = splstr(); if (dbp->db_msgaddr == (caddr_t)mp) { - ((struct mdbblock *)newmp)->datblk.d_dbmsgaddr = (caddr_t)mp; - if (((struct mdbblock *)mp)->datblk.d_dbiswhat != _NOT_D) - ((struct mdbblock *)mp)->datblk.d_dbiswhat = _XCONN; + ((struct mdbblock *)newmp)->datblk.db_msgaddr = (caddr_t)mp; + if (((struct mdbblock *)mp)->datblk.db_iswhat != _NOT_D) + ((struct mdbblock *)mp)->datblk.db_iswhat = _XCONN; } - ((struct mdbblock *)newmp)->datblk.d_dbiswhat = _NOT_M; + ((struct mdbblock *)newmp)->datblk.db_iswhat = _NOT_M; mp->b_datap = newmp->b_datap; mp->b_rptr = newmp->b_rptr; @@ -948,7 +819,6 @@ register int len; * set the db_lim. */ dbp->db_size = len; - Strcount += len; /* * Copy data into the new data buffer. @@ -974,13 +844,11 @@ register int len; /* Release previous data buffer is it was seperate * from the data header. */ - if ((unsigned char *)dbp + sizeof(struct dbinfo) + if ((unsigned char *)dbp + sizeof(struct datab) != dbp->db_base) { - if (dbp->db_frtnp == NULL) { + if (dbp->db_frtnp == NULL) kmem_free(dbp->db_base, ((char *)(dbp->db_lim) - (char *)(dbp->db_base))); - Strcount -= (dbp->db_lim - dbp->db_base); - } else { if (dbp->db_frtnp->free_func) (*dbp->db_frtnp->free_func)(dbp->db_frtnp->free_arg); @@ -1033,7 +901,7 @@ adjmsg(mp, len) if (fromhead) { bp = mp; - while (len) { + while (len && bp) { ASSERT(bp->b_wptr >= bp->b_rptr); n = min(bp->b_wptr - bp->b_rptr, len); bp->b_rptr += n; @@ -1045,7 +913,8 @@ adjmsg(mp, len) register unsigned char type; type = mp->b_datap->db_type; - while (len) { + bp = mp; + while (len && bp) { bp = mp; save_bp = NULL; while (bp && bp->b_datap->db_type == type) { @@ -1191,7 +1060,7 @@ getq(q) ; if (q) { qenable(q); - setqback(q, bp ? bp->b_band : 0); + setqback(q, bp->b_band); } } splx(s); @@ -1449,12 +1318,6 @@ flushband(q, pri, flag) } mp = nmp; } - if (mp && mp->b_band == pri) { - if (flag || datamsg(mp->b_datap->db_type)) { - rmvq(q, mp); - freemsg(mp); - } - } } splx(s); } @@ -2002,7 +1865,7 @@ putctl(q, type) { register mblk_t *bp; - if ((datamsg(type) && (type != M_DELAY)) || !(bp = allocb(0, BPRI_HI))) + if (datamsg(type) || !(bp = allocb(0, BPRI_HI))) return(0); bp->b_datap->db_type = type; (*q->q_qinfo->qi_putp)(q, bp); @@ -2018,7 +1881,7 @@ putctl1(q, type, param) { register mblk_t *bp; - if ((datamsg(type) && (type != M_DELAY)) || !(bp = allocb(1, BPRI_HI))) + if (datamsg(type) ||!(bp = allocb(1, BPRI_HI))) return(0); bp->b_datap->db_type = type; *bp->b_wptr++ = param; diff --git a/usr/src/uts/3b2/io/sxt.c b/usr/src/uts/3b2/io/sxt.c index 065164f..01d0fdb 100644 --- a/usr/src/uts/3b2/io/sxt.c +++ b/usr/src/uts/3b2/io/sxt.c @@ -5,7 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/sxt.c 1.7" + +#ident "@(#)kernel:io/sxt.c 1.4" /* * SXT -- STREAMS Multiplexing Driver for Shell Layers */ @@ -27,8 +28,7 @@ #include "sys/termio.h" #include "sys/errno.h" #include "sys/strtty.h" -#include "sys/nsxt.h" -#include "sys/fcntl.h" +#include "sys/sxt.h" #include "sys/cmn_err.h" /* @@ -82,11 +82,6 @@ queue_t *q; chan = CHAN(dev); - if ( ( sxtctl[LINK(dev)].sxt_ttyq == (struct queue *)0 ) - && !(chan == 0 && oflag & O_EXCL) ) { - u.u_error = EINVAL; - return(OPENFAIL); - } if( chan == 0 ) /* opening control channel */ { if( sxtctl[LINK(dev)].sxt_actq ) /* open this only once! */ @@ -155,9 +150,6 @@ queue_t *q; mblk_t *bp; chanp = (struct sxt_chan *)q->q_ptr; - if(!chanp) { - return(-1); - } if( chanp->schan_chflg&SXTCTL ) /* closing control channel */ { @@ -524,14 +516,12 @@ struct sxt_chan *chanp; break; case SXTIOCSTAT: -#if 0 if( !(chanp->schan_chflg&SXTCTL) ) { /* must be ctl chan for this ioctl */ bp->b_datap->db_type = M_IOCNAK; break; } -#endif if( (bpt = allocb(sizeof(struct sxtblock), BPRI_MED)) == NULL ) { bp->b_datap->db_type = M_IOCNAK; diff --git a/usr/src/uts/3b2/io/ticlts.c b/usr/src/uts/3b2/io/ticlts.c index 72110f3..3c06eb7 100644 --- a/usr/src/uts/3b2/io/ticlts.c +++ b/usr/src/uts/3b2/io/ticlts.c @@ -5,15 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)kernel:io/ticlts.c 1.8" - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ +#ident "@(#)kernel:io/ticlts.c 1.4.3.1" /* * TPI loopback transport provider. * Datagram mode. @@ -41,65 +33,6 @@ #include #include -int ticlts_tracealloc=0; -int ticlts_tracefree=0; - -#if defined(__STDC__) - -#define KMEM_alloc(a,b) Kmem_alloc(a,b,__LINE__,#a,#b) -#define KMEM_free(a,b) Kmem_free(a,b,__LINE__,#a,#b) - -char *Kmem_alloc(a,b,c,d,e) -unsigned int a; -int b; -char *c,*d,*e; -{ -char *r; -r=kmem_alloc(a,b); -if (ticlts_tracealloc) -printf("kmem_alloc(%d,%d)=%x from %d (%s,%s)\n",a,b,r,c,d,e); -return(r); -} - -void Kmem_free(a,b,c,d,e) -char * a; -int b; -char *c,*d,*e; -{ -if (ticlts_tracefree) -printf("kmem_free(%x,%d) from %d (%s,%s)\n",a,b,c,d,e); -kmem_free(a,b); -} - -#else - -#define KMEM_alloc(a,b) Kmem_alloc(a,b,__LINE__) -#define KMEM_free(a,b) Kmem_free(a,b,__LINE__) - -char *Kmem_alloc(a,b,c) -unsigned int a; -int b; -char *c; -{ -char *r; -r=kmem_alloc(a,b); -if (ticlts_tracealloc) -printf("kmem_alloc(%d,%d)=%x from %d\n",a,b,r,c); -return(r); -} - -void Kmem_free(a,b,c) -char * a; -int b; -char *c; -{ -if (ticlts_tracefree) -printf("kmem_free(%x,%d) from %d\n",a,b,c); -kmem_free(a,b); -} - -#endif - extern char ti_statetbl[TE_NOEVENTS][TS_NOSTATES]; extern int nulldev(); @@ -111,6 +44,7 @@ STATIC int tcl_bequal(),tcl_bind(),tcl_blink(),tcl_ckopt(), tcl_rsrv(),tcl_sumbytes(),tcl_uderr(),tcl_unbind(), tcl_unblink(),tcl_unconnect(),tcl_unolink(),tcl_wput(), tcl_wropt(),tcl_wsrv(); +STATIC void tcl_link(); STATIC tcl_endpt_t *tcl_endptinit(),*tcl_getendpt(); STATIC tcl_addr_t *tcl_addrinit(),*tcl_getaddr(); @@ -205,7 +139,7 @@ tcl_unolink(te) /* * free te */ - (void)KMEM_free(te,sizeof(tcl_endpt_t)); + (void)kmem_free(te,sizeof(tcl_endpt_t)); return(TCL_PASS); } @@ -281,8 +215,8 @@ tcl_unblink(te) /* * free ta */ - (void)KMEM_free(tcl_abuf(ta),tcl_alen(ta)); - (void)KMEM_free(ta,sizeof(tcl_addr_t)); + (void)kmem_free(tcl_abuf(ta),tcl_alen(ta)); + (void)kmem_free(ta,sizeof(tcl_addr_t)); } return(TCL_PASS); } @@ -331,7 +265,7 @@ tcl_cpabuf(to,from) ASSERT(tcl_abuf(from) != NULL); if (tcl_abuf(to) == NULL) { ASSERT(tcl_alen(to) == 0); - abuf = (char *)KMEM_alloc(tcl_alen(from),KM_NOSLEEP); + abuf = (char *)kmem_alloc(tcl_alen(from),KM_NOSLEEP); if (abuf == NULL) { return(TCL_FAIL); } @@ -363,7 +297,7 @@ tcl_endptinit(min) /* * get an endpt */ - te1 = (tcl_endpt_t *)KMEM_alloc(sizeof(tcl_endpt_t),KM_NOSLEEP); + te1 = (tcl_endpt_t *)kmem_alloc(sizeof(tcl_endpt_t),KM_NOSLEEP); if (te1 == NULL) { u.u_error = ENOMEM; return(NULL); @@ -397,7 +331,7 @@ tcl_endptinit(min) /* * wrapped around */ - (void)KMEM_free(te1,sizeof(tcl_endpt_t)); + (void)kmem_free(te1,sizeof(tcl_endpt_t)); u.u_error = ENOSPC; return(NULL); } @@ -447,7 +381,7 @@ tcl_addrinit(ta) /* * get an address */ - ta1 = (tcl_addr_t *)KMEM_alloc(sizeof(tcl_addr_t),KM_NOSLEEP); + ta1 = (tcl_addr_t *)kmem_alloc(sizeof(tcl_addr_t),KM_NOSLEEP); if (ta1 == NULL) { return(NULL); } @@ -484,7 +418,7 @@ tcl_addrinit(ta) } } if (tcl_cpabuf(ta1,ta) == TCL_FAIL) { - (void)KMEM_free(ta1,sizeof(tcl_addr_t)); + (void)kmem_free(ta1,sizeof(tcl_addr_t)); return(NULL); } /* @@ -501,7 +435,7 @@ tcl_addrinit(ta) * an abuf was requested; copy it in */ if (tcl_cpabuf(ta1,ta) == TCL_FAIL) { - (void)KMEM_free(ta1,sizeof(tcl_addr_t)); + (void)kmem_free(ta1,sizeof(tcl_addr_t)); return(NULL); } } @@ -918,6 +852,14 @@ tcl_close(q) ASSERT(q != NULL); te = (tcl_endpt_t *)q->q_ptr; ASSERT(te != NULL); + + /* If the queue was looped then + * unloop it. + */ + if ((WR(q))->q_next != NULL) { + (WR(q))->q_next = NULL; + } + (void)tcl_unconnect(te); (void)tcl_unblink(te); STRLOG(TCL_ID,tcl_min(te),4,SL_TRACE, @@ -956,6 +898,27 @@ tcl_wput(q,mp) "tcl_wput _%d_: got illegal msg, M_type=%d",__LINE__,mp->b_datap->db_type); (void)freemsg(mp); return(UNIX_FAIL); + + case M_CTL: + switch(*(long *)mp->b_rptr) { + default: + break; + + case TCL_LINK: + tcl_link(q, mp); + break; + + case TCL_UNLINK: + /* Unlink the endpoint. + */ + if (q->q_next) + q->q_next = NULL; + break; + + } + freemsg(mp); + return(UNIX_PASS); + case M_IOCTL: /* no ioctl's supported */ STRLOG(TCL_ID,tcl_min(te),4,SL_TRACE, @@ -1307,7 +1270,7 @@ tcl_fatal(q,mp) { register tcl_endpt_t *te; -printf("FATAL tcl_fatal called %x %x\n",q,mp); + ASSERT(q != NULL); ASSERT(mp != NULL); te = (tcl_endpt_t *)q->q_ptr; @@ -1604,8 +1567,8 @@ tcl_bind(q,mp) if ((mp2 = allocb(msz2,BPRI_HI)) == NULL) { STRLOG(TCL_ID,tcl_min(te),2,SL_TRACE, "tcl_bind _%d_ errack: tli_err=TSYSERR, unix_err=ENOMEM",__LINE__); - (void)KMEM_free(tcl_abuf(ta),tcl_alen(ta)); - (void)KMEM_free(ta,sizeof(tcl_addr_t)); + (void)kmem_free(tcl_abuf(ta),tcl_alen(ta)); + (void)kmem_free(ta,sizeof(tcl_addr_t)); te->te_state = NEXTSTATE(TE_ERROR_ACK,te->te_state); ASSERT(te->te_state != NR); (void)tcl_errack(q,mp,TSYSERR,ENOMEM); @@ -1978,7 +1941,7 @@ tcl_uderr(q,mp,err) tcl_addr_t addr,addr1; int alen,olen; -#ifndef NO_UDERR + ASSERT(q != NULL); ASSERT(mp != NULL); te = (tcl_endpt_t *)q->q_ptr; @@ -2053,10 +2016,6 @@ tcl_uderr(q,mp,err) (void)qreply(q,mp1); } return(TCL_PASS); -#else - (void)freemsg(mp); - return(TCL_PASS); -#endif } @@ -2102,8 +2061,7 @@ tcl_data(q,mp) || ((olen > 0) && ((ooff + olen) > msz))) { STRLOG(TCL_ID,tcl_min(te),1,SL_TRACE, "tcl_data _%d_ fatal: bad control info",__LINE__); - /*(void)tcl_fatal(q,mp); /* or tcl_uderr() ?? */ - (void)tcl_uderr(q,mp,TCL_BADADDR); + (void)tcl_fatal(q,mp); /* or tcl_uderr() ?? */ return(TCL_FAIL); } if ((alen <= 0) || (alen > TCL_ADDRSZ)) { @@ -2163,12 +2121,8 @@ tcl_data(q,mp) if (!canput(te1->te_rq->q_next)) { STRLOG(TCL_ID,tcl_min(te),3,SL_TRACE, "tcl_data _%d_: canput() failure",__LINE__); -#ifndef NO_FLOW_CONTROL te1->te_backwq = q; putbq(q,mp); -#else - (void)freemsg(mp); /*Very reasonable thing to do for datagram*/ -#endif return(TCL_FAIL); } /* @@ -2250,3 +2204,30 @@ tcl_data(q,mp) (void)putnext(te1->te_rq,mp1); return(TCL_PASS); } + +static void +tcl_link(q, mp) + register queue_t *q; + register mblk_t *mp; +{ + tcl_addr_t addr; + register tcl_addr_t *ta; + register struct tcl_sictl *tcl_sictl; + register tcl_endpt_t *te1; + + tcl_sictl = (struct tcl_sictl *)mp->b_rptr; + + addr.ta_alen = tcl_sictl->ADDR_len; + addr.ta_abuf = (caddr_t)(mp->b_rptr + tcl_sictl->ADDR_offset); + addr.ta_ahash = tcl_mkahash(&addr); + + if ((ta = tcl_getaddr(TCL_DEST, &addr)) != NULL) { + /* Link my write queue to the + * destinations read queue. + */ + te1 = ta->ta_blist; + + if (q->q_next == NULL) + q->q_next = te1->te_rq; + } +} diff --git a/usr/src/uts/3b2/io/ticots.c b/usr/src/uts/3b2/io/ticots.c index e3d0e5b..3261678 100644 --- a/usr/src/uts/3b2/io/ticots.c +++ b/usr/src/uts/3b2/io/ticots.c @@ -5,16 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ - -#ident "@(#)kernel:io/ticots.c 1.7" - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - +#ident "@(#)kernel:io/ticots.c 1.4.3.1" /* * TPI loopback transport provider. * Virtual-circuit mode. @@ -981,6 +972,14 @@ tco_close(q) ASSERT(q != NULL); te = (tco_endpt_t *)q->q_ptr; ASSERT(te != NULL); + + /* If the queue was linked then + * unlink it. + */ + if ((WR(q))->q_next != NULL) { + (WR(q))->q_next = NULL; + } + (void)tco_unconnect(te); (void)tco_unblink(te); (void)tco_unolink(te); @@ -1261,7 +1260,7 @@ tco_wsrv(q) if (tco_data(q,mp,TE_DATA_REQ) == TCO_FAIL) { STRLOG(TCO_ID,tco_min(te),3,SL_TRACE, "tco_wsrv _%d_: tco_data() failure",__LINE__); - /*return(UNIX_FAIL); /* or just break ?? */ + return(UNIX_FAIL); /* or just break ?? */ } break; case M_PROTO: @@ -1280,7 +1279,7 @@ tco_wsrv(q) if (tco_data(q,mp,TE_DATA_REQ) == TCO_FAIL) { STRLOG(TCO_ID,tco_min(te),3,SL_TRACE, "tco_wsrv _%d_: tco_data() failure",__LINE__); - /*return(UNIX_FAIL); /* or just break ?? */ + return(UNIX_FAIL); /* or just break ?? */ } break; case T_EXDATA_REQ: @@ -1289,7 +1288,7 @@ tco_wsrv(q) if (tco_data(q,mp,TE_EXDATA_REQ) == TCO_FAIL) { STRLOG(TCO_ID,tco_min(te),3,SL_TRACE, "tco_wsrv _%d_: tco_data() failure",__LINE__); - /*return(UNIX_FAIL); /* or just break ?? */ + return(UNIX_FAIL); /* or just break ?? */ } break; #ifdef TICOTSORD @@ -1299,7 +1298,7 @@ tco_wsrv(q) if (tco_data(q,mp,TE_ORDREL_REQ) == TCO_FAIL) { STRLOG(TCO_ID,tco_min(te),3,SL_TRACE, "tco_wsrv _%d_: tco_data() failure",__LINE__); - /*return(UNIX_FAIL); /* or just break ?? */ + return(UNIX_FAIL); /* or just break ?? */ } break; #endif @@ -1799,6 +1798,7 @@ tco_bind(q,mp) if (ta == NULL) { STRLOG(TCO_ID,tco_min(te),2,SL_TRACE, "tco_bind _%d_ errack: tli_err=TSYSERR, unix_err=ENOMEM",__LINE__); + (void)freemsg(mp2); te->te_state = NEXTSTATE(TE_ERROR_ACK,te->te_state); ASSERT(te->te_state != NR); (void)tco_errack(q,mp,TSYSERR,ENOMEM); @@ -2652,6 +2652,12 @@ tco_cres(q,mp) mp3->b_cont = mp->b_cont; mp->b_cont = NULL; (void)freeb(mp); + + /* link queues so that I_SENDFD will work. + */ + WR(te1->te_rq)->q_next = te3->te_rq; + WR(te3->te_rq)->q_next = te1->te_rq; + /* * send confirmation msg */ @@ -3181,7 +3187,8 @@ tco_data(q,mp,evtype) ASSERT((int)&prim->exdata_req.PRIM_type - (int)&prim->exdata_req == (int)&prim->exdata_ind.PRIM_type - (int)&prim->exdata_ind); ASSERT((int)&prim->exdata_req.MORE_flag - (int)&prim->exdata_req - == (int)&prim->exdata_ind.MORE_flag - (int)&prim->exdata_ind); + == (int)&prim->exdata_ind.MORE_type - (int)&prim->exdata_ind); + /* MORE_type should be MORE_flag -- bug in tihdr.h */ prim->type = T_EXDATA_IND; break; #ifdef TICOTSORD diff --git a/usr/src/uts/3b2/io/timod.c b/usr/src/uts/3b2/io/timod.c index db03700..dc8b249 100644 --- a/usr/src/uts/3b2/io/timod.c +++ b/usr/src/uts/3b2/io/timod.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/timod.c 1.10" +#ident "@(#)kernel:io/timod.c 1.7.1.4" /* * Transport Interface Library cooperating module - issue 2 */ @@ -315,7 +315,6 @@ register queue_t *q; register struct tim_tim *tp; register struct iocblk *iocbp; register mblk_t *nbp; - mblk_t *tmp; ASSERT(q != NULL); @@ -454,12 +453,9 @@ register queue_t *q; if (tp->tim_flags & WAITIOCACK) { ASSERT(tp->tim_iocsave != NULL); - ASSERT(((mp->b_wptr - mp->b_rptr) == sizeof(struct T_info_ack)) - || - ((mp->b_wptr - mp->b_rptr) == - (sizeof(struct T_info_ack) - sizeof(long)))); - if (*(long *)tp->tim_iocsave->b_cont->b_rptr != T_INFO_REQ) { + if (*(long *)tp->tim_iocsave->b_cont->b_rptr != + T_INFO_REQ) { putnext(q, mp); return (0); } @@ -471,20 +467,6 @@ register queue_t *q; } else if (pptr->info_ack.SERV_type == T_CLTS) { tp->tim_flags = (tp->tim_flags & ~COTS) | CLTS; } - - /* - * make sure the message sent back is the size of - * a T_info_ack. - */ - if ((mp->b_wptr - mp->b_rptr) < sizeof(struct T_info_ack)) { - tmp = allocb(sizeof(long), BPRI_MED); - tmp->b_wptr = (tmp->b_wptr + (sizeof(long))); - tmp->b_datap->db_type = mp->b_datap->db_type; - linkb(mp, tmp); - pullupmsg(mp, -1); - pptr = (union T_primitives *)mp->b_rptr; - pptr->info_ack.PROVIDER_flag = 0; - } goto out; } putnext(q, mp); diff --git a/usr/src/uts/3b2/io/tirdwr.c b/usr/src/uts/3b2/io/tirdwr.c index 9c340f7..955fc04 100644 --- a/usr/src/uts/3b2/io/tirdwr.c +++ b/usr/src/uts/3b2/io/tirdwr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/tirdwr.c 1.4" +#ident "@(#)kernel:io/tirdwr.c 1.2.2.1" /* * Transport Interface Library read/write module - issue 1 */ diff --git a/usr/src/uts/3b2/io/ttcompat.c b/usr/src/uts/3b2/io/ttcompat.c index 7dcce72..05fd6f9 100644 --- a/usr/src/uts/3b2/io/ttcompat.c +++ b/usr/src/uts/3b2/io/ttcompat.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/ttcompat.c 1.7" +#ident "@(#)kernel:io/ttcompat.c 1.4" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. * @@ -241,16 +241,13 @@ ttcompatwput(q, mp) switch (iocbp->ioc_cmd) { default: - /* these are ioctls with no arguments or are known to stream head */ + /* these are ioctls with int arguments or are known to stream head */ /* process them right away */ ttcompat_do_ioctl(tp, q, mp); return; case TIOCSETN: case TIOCSLTC: case TIOCSETC: - case TIOCLBIS: - case TIOCLBIC: - case TIOCLSET: if (iocbp->ioc_count != TRANSPARENT) { putnext(q, mp); return; @@ -268,15 +265,6 @@ ttcompatwput(q, mp) case TIOCSETC: cqp->cq_size = sizeof(struct ltchars); break; - case TIOCLBIS: - cqp->cq_size = sizeof(struct ltchars); - break; - case TIOCLBIC: - cqp->cq_size = sizeof(struct ltchars); - break; - case TIOCLSET: - cqp->cq_size = sizeof(struct ltchars); - break; default: break; } @@ -300,15 +288,11 @@ ttcompatwput(q, mp) case TIOCSETN: case TIOCSLTC: case TIOCSETC: - case TIOCLBIS: - case TIOCLBIC: - case TIOCLSET: tp->t_state &= ~TS_W_IN; if (csp->cp_rval) { /* failure */ freemsg(mp); } else { /* make it look like an ioctl */ mp->b_datap->db_type = M_IOCTL; - mp->b_wptr = mp->b_rptr + sizeof(struct iocblk); iocbp = (struct iocblk *)mp->b_rptr; iocbp->ioc_count = mp->b_cont->b_wptr - mp->b_cont->b_rptr; iocbp->ioc_error = 0; @@ -318,7 +302,6 @@ ttcompatwput(q, mp) return; case TIOCGLTC: - case TIOCLGET: case TIOCGETC: tp->t_state &= ~TS_W_OUT; if (csp->cp_rval) { /* failure */ @@ -377,7 +360,6 @@ ttcompat_do_ioctl(tp, q, mp) * structure. Save the existing code and pass it down as a TCGETS. */ case TIOCGETC: - case TIOCLGET: case TIOCGLTC: if (iocp->ioc_count != TRANSPARENT) { mp->b_datap->db_type = M_IOCNAK; @@ -396,6 +378,7 @@ ttcompat_do_ioctl(tp, q, mp) mp->b_cont = NULL; iocp->ioc_count = 0; /* fall thru */ + case TIOCLGET: case TIOCGETP: goto dogets; @@ -757,15 +740,12 @@ ttcompat_ioctl_ack(q, mp) /* recycle the reply's buffer */ *(int *)datap->b_wptr = ((unsigned) tp->t_curstate.t_flags) >> 16; datap->b_wptr += (sizeof (int))/(sizeof *datap->b_wptr); -#if 0 iocp->ioc_count = sizeof (int); tp->t_state &= ~TS_IOCWAIT; /* we got what we wanted */ iocp->ioc_rval = 0; iocp->ioc_cmd = tp->t_ioccmd; putnext(q, mp); return; -#endif - break; #ifdef SUN case TIOCGETX: @@ -970,7 +950,6 @@ ttcompat_ioctl_ack(q, mp) */ tp->t_state &= ~TS_IOCWAIT; mp->b_datap->db_type = M_IOCTL; - mp->b_wptr = mp->b_rptr + sizeof(struct iocblk); putnext(WR(q), mp); } /* Called from ttcompatrput M_IOCACK processing. */ @@ -996,9 +975,6 @@ ttcopyout(q, mp) case TIOCGETC: cqp->cq_size = sizeof(struct tchars); break; - case TIOCLGET: - cqp->cq_size = sizeof(int); - break; default: cmn_err(CE_CONT,"TTCOMPAT: Unknown ioctl to copyout\n"); break; diff --git a/usr/src/uts/3b2/io/xt.c b/usr/src/uts/3b2/io/xt.c index 34f1f56..3e83144 100644 --- a/usr/src/uts/3b2/io/xt.c +++ b/usr/src/uts/3b2/io/xt.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:io/xt.c 1.15" +#ident "@(#)kernel:io/xt.c 1.12.3.1" /* * XT -- STREAMS Driver for AT&T windowing terminals (5620, 615, 620, 630) @@ -3219,16 +3219,6 @@ mblk_t *bp; */ size = msgdsize(bp); - /* For some reason, emacs sends down type M_DATA message blocks - * with msgdsize of 0. Since size is 0 there is nothing to send, - * so just free the mesage and return. - */ - if(size == 0) { - freemsg(bp); - return(1); - } - - /* ** PATH 1: This is network xt and we are able to send the ** entire mblk_t as one packet because either flow control is diff --git a/usr/src/uts/3b2/klm/klm.mk b/usr/src/uts/3b2/klm/klm.mk index 4769b7d..1d2051e 100644 --- a/usr/src/uts/3b2/klm/klm.mk +++ b/usr/src/uts/3b2/klm/klm.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)klm:klm/klm.mk 1.4" +#ident "@(#)klm:klm/klm.mk 1.2" # # PROPRIETARY NOTICE (Combined) # @@ -34,7 +34,7 @@ MASTERD = ../master.d DASHG = DASHO = -O -PFLAGS = $(DASHG) -D_KERNEL -DSYSV $(MORECPP) +PFLAGS = $(DASHG) -D_KERNEL -DSYSV $(MORECPP) -DLOCKDEBUG CFLAGS = $(DASHO) $(PFLAGS) DEFLIST = FRC = @@ -81,7 +81,7 @@ klm_kprot.o: klm_kprot.c \ $(INC)/rpc/auth_des.h \ $(INC)/rpc/svc.h \ $(INC)/rpc/svc_auth.h \ - klm_prot.h \ + $(INC)/rpcsvc/klm_prot.h \ $(FRC) klm_lkmgr.o: klm_lkmgr.c \ @@ -107,7 +107,7 @@ klm_lkmgr.o: klm_lkmgr.c \ $(INC)/rpc/auth.h \ $(INC)/rpc/clnt.h \ $(INC)/klm/lockmgr.h \ - klm_prot.h \ + $(INC)/rpcsvc/klm_prot.h \ $(INC)/net/if.h \ $(INC)/nfs/nfs.h \ $(INC)/nfs/nfs_clnt.h \ diff --git a/usr/src/uts/3b2/klm/klm_kprot.c b/usr/src/uts/3b2/klm/klm_kprot.c index 90ce70f..21ba465 100644 --- a/usr/src/uts/3b2/klm/klm_kprot.c +++ b/usr/src/uts/3b2/klm/klm_kprot.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)klm:klm/klm_kprot.c 1.2" +#ident "@(#)klm:klm/klm_kprot.c 1.1" /* * PROPRIETARY NOTICE (Combined) * @@ -27,7 +27,7 @@ * All rights reserved. */ #include -#include "klm_prot.h" +#include bool_t diff --git a/usr/src/uts/3b2/klm/klm_lkmgr.c b/usr/src/uts/3b2/klm/klm_lkmgr.c index be44c3c..49cab61 100644 --- a/usr/src/uts/3b2/klm/klm_lkmgr.c +++ b/usr/src/uts/3b2/klm/klm_lkmgr.c @@ -5,9 +5,9 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)klm:klm/klm_lkmgr.c 1.11" +#ident "@(#)klm:klm/klm_lkmgr.c 1.4" #ifndef lint -static char sccsid[] = "@(#)klm_lkmgr.c 1.11 89/09/22 SMI"; +static char sccsid[] = "@(#)klm_lkmgr.c 1.4 89/07/12 SMI"; #endif /* * PROPRIETARY NOTICE (Combined) @@ -44,21 +44,23 @@ static char sccsid[] = "@(#)klm_lkmgr.c 1.11 89/09/22 SMI"; #include #include -#include +#include #include #include #include #include +/* #include */ #include #include #include #include #include #include -#include -#include +#include #include -#include +/* +#include +*/ /* files included by */ #include @@ -69,19 +71,33 @@ static char sccsid[] = "@(#)klm_lkmgr.c 1.11 89/09/22 SMI"; #include #include -#include "klm_prot.h" +#include +/* #include */ #include #include #include -#define NC_LOOPBACK "loopback" /* XXX */ +#undef wakeup + +extern void wakeup(); /* reference the function, not the */ + /* macro */ -static struct knetconfig config; /* avoid loopupname next time */ +static struct sockaddr_in lm_sa; /* talk to portmapper & lock-manager */ -STATIC int talk_to_lockmgr(); +static talk_to_lockmgr(); /* Define static parameters for run-time tuning */ +#ifdef NOTUSE +static int backoff_timeout = 1; /* time to wait on klm_denied_nolocks */ +static int first_retry = 0; /* first attempt if klm port# known */ +static int first_timeout = 1; +static int normal_retry = 1; /* attempts after new port# obtained */ +static int normal_timeout = 1; +static int working_retry = 0; /* attempts after klm_working */ +static int working_timeout = 1; +#endif + static int backoff_timeout = 30; /* time to wait on klm_denied_nolocks */ static int first_retry = 0; /* first attempt if klm port# known */ static int first_timeout = 30; @@ -115,9 +131,11 @@ klm_lockctl(lh, bfp, cmd, cred, clid) xdrproc_t xdrreply; int timeid; -#ifdef LOCKDEBUG - cmn_err(CE_CONT, "entering klm_lockctl() : cmd %d clid %d\n", cmd, clid); -#endif + /* initialize sockaddr_in used to talk to local processes */ + if (lm_sa.sin_port == 0) { + lm_sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + lm_sa.sin_family = AF_INET; + } if (!bfp->l_pid) bfp->l_pid = clid; /* FIXME */ @@ -183,8 +201,7 @@ klm_lockctl(lh, bfp, cmd, cred, clid) requestloop: /* send the request out to the local lock-manager and wait for reply */ error = talk_to_lockmgr(xdrproc, xdrargs, args, xdrreply, &reply, cred); - if (error == ENOLCK || error == RPC_UDERROR) { - error = ENOLCK; + if (error == ENOLCK) { goto ereturn; /* no way the request could have gotten out */ } @@ -274,8 +291,11 @@ klm_lockctl(lh, bfp, cmd, cred, clid) /* NOTREACHED */ nolocks_wait: - timeid = timeout(wakeup, (caddr_t)&config, (backoff_timeout * HZ)); - (void) sleep((caddr_t)&config, PZERO|PCATCH); + timeid = timeout(wakeup, (caddr_t)&lm_sa, (backoff_timeout * HZ)); + (void) sleep((caddr_t)&lm_sa, PZERO|PCATCH); +#ifdef NOTUSE + untimeout(wakeup, (caddr_t)&lm_sa); +#endif untimeout(timeid); goto requestloop; /* now try again */ @@ -327,7 +347,7 @@ klm_lockctl(lh, bfp, cmd, cred, clid) * 3) A drastic error occurs (e.g., the local lock-manager has never * been activated OR cannot create a client-handle) (returns ENOLCK). */ -STATIC int +static talk_to_lockmgr(xdrproc, xdrargs, args, xdrreply, reply, cred) u_long xdrproc; xdrproc_t xdrargs; @@ -336,107 +356,151 @@ talk_to_lockmgr(xdrproc, xdrargs, args, xdrreply, reply, cred) klm_testrply *reply; struct cred *cred; { - struct timeval tmo; - struct netbuf netaddr; - CLIENT *client; - enum clnt_stat stat; - struct vnode *vp; - int error, timeid; - static char keyname[SYS_NMLN+16]; - -#ifdef LOCKDEBUG - cmn_err(CE_CONT, "entering talk_to_lockmgr()...\n"); -#endif - - strcpy(keyname, utsname.nodename); - netaddr.len = strlen(keyname); - strcpy(&keyname[netaddr.len], ".lockd"); - netaddr.buf = keyname; - netaddr.len = netaddr.maxlen = netaddr.len + 6; + extern int clone_no, udp_no; /* got from ../io/conf.c */ + CLIENT *client; + struct timeval tmo; + register int error; + struct knetconfig config; + struct netbuf netaddr, addr; + int timeid; + + /* set up a client handle to talk to the local lock manager */ + netaddr.buf = (char *)&lm_sa; + netaddr.len = sizeof(lm_sa); + netaddr.maxlen = sizeof(lm_sa); /* * filch a knetconfig structure. */ - if (config.knc_rdev == 0){ - if ((error = lookupname("/dev/ticlts", UIO_SYSSPACE, FOLLOW, - NULLVPP, &vp)) != 0) { - cmn_err(CE_CONT, "klm_lkmgr: lookupname: %d\n", error); - return (error); - } - config.knc_rdev = vp->v_rdev; - config.knc_protofmly = NC_LOOPBACK; - VN_RELE(vp); - } + if (!udp_no) udp_no = 56; + config.nc_protofmly = AF_INET; + config.nc_rdev = makedevice(clone_no, udp_no); + config.nc_proto = 17; /*IPPROTO_UDP*/ -#ifdef LOCKDEBUG - cmn_err(CE_CONT, "calling clnt_tli_kcreate()\n"); -#endif /* * now call the proper stuff. */ - if ((error = clnt_tli_kcreate(&config, &netaddr, (u_long)KLM_PROG, - (u_long)KLM_VERS, 0, first_retry, cred, &client)) != 0) { - cmn_err(CE_CONT, "klm_lkmgr: clnt_tli_kcreate: %d\n", error); + client = (CLIENT *)clnt_tli_kcreate(&config, &netaddr, (u_long)KLM_PROG, + (u_long)KLM_VERS, 0, 0, first_retry, cred); + if (client == (CLIENT *) NULL) { return (ENOLCK); } tmo.tv_sec = first_timeout; tmo.tv_usec = 0; -retryloop: - /* retry the request until completion, timeout, or error */ +#ifdef NOTUSE + /* + * If cached port number, go right to CLNT_CALL(). + * This works because timeouts go back to the portmapper to + * refresh the port number. + */ + if (lm_sa.sin_port != 0) { + goto retryloop; /* skip first portmapper query */ + } +#endif + for (;;) { - error = (int) CLNT_CALL(client, xdrproc, - xdrargs, (caddr_t)args, xdrreply, - (caddr_t)reply, tmo); +remaploop: + /* + * go get the port number from the portmapper(rpcbinder)... + * if return 0, the server is not registered + * if return -1, an error in contacting the portmapper + * else, got a port number + */ + lm_sa.sin_port = htonl(PMAPPORT); + lm_sa.sin_port = getport_loop(&netaddr, + (u_long)KLM_PROG, (u_long)KLM_VERS, &config); #ifdef LOCKDEBUG - cmn_err(CE_CONT, "klm_lkmgr: CLNT_CALL: error %d\n", error); + cmn_err(CE_CONT, "lm_sa.sin_port=%d\n",lm_sa.sin_port); #endif - switch (error) { - case RPC_SUCCESS: - case klm_denied: - error = (int) reply->stat; - if (error == (int) klm_working) { - if (ISSIG(u.u_procp, 0)) { - error = EINTR; - goto out; - } - /* lock-mgr is up...can wait longer */ - /* addr is already set up */ - clnt_clts_init(client, &netaddr, - working_retry, cred); - tmo.tv_sec = working_timeout; - continue; /* retry */ - } - goto out; /* got a legitimate answer */ + switch(lm_sa.sin_port) { + case 0: + case (u_short)-1: + cmn_err(CE_CONT, + "fcntl: local NFS lock manager not registered\n"); + error = ENOLCK; + goto out; + } - case RPC_UDERROR: + /* + * If a signal occurred, pop back out to the higher + * level to decide what action to take. If we just + * got a port number from the portmapper, the next + * call into this subroutine will jump to retryloop. + */ + if (ISSIG(u.u_procp, 0)) { + error = EINTR; goto out; + } - case RPC_TIMEDOUT: - goto retryloop; /* ask for port# again */ + /* reset the lock-manager client handle */ + addr.buf = (char *)&lm_sa; + addr.len = sizeof(lm_sa); + addr.maxlen = sizeof(lm_sa); - case klm_denied_nolocks: - goto out; + clnt_clts_init(client, &addr, normal_retry, cred); + tmo.tv_sec = normal_timeout; - default: - cmn_err(CE_CONT, - "lock-manager: RPC error: %s\n", - clnt_sperrno((enum clnt_stat) error)); - - /* on RPC error, wait a bit and try again */ - timeid = timeout(wakeup, (caddr_t)&config, - (normal_timeout * HZ)); - error = sleep((caddr_t)&config, PZERO|PCATCH); - untimeout(timeid); - if (error) { - error = EINTR; - goto out; - } - goto retryloop; /* ask for port# again */ +retryloop: + /* retry the request until completion, timeout, or error */ + for (;;) { + error = (int) CLNT_CALL(client, xdrproc, + xdrargs, (caddr_t)args, xdrreply, + (caddr_t)reply, tmo); + switch (error) { + case RPC_SUCCESS: + case klm_denied: + error = (int) reply->stat; + if (error == (int) klm_working) { + if (ISSIG(u.u_procp, 0)) { + error = EINTR; + goto out; + } + /* lock-mgr is up...can wait longer */ + addr.buf = (char *)&lm_sa; + addr.len = sizeof(lm_sa); + addr.maxlen = sizeof(lm_sa); + clnt_clts_init(client, &addr, + working_retry, cred); + tmo.tv_sec = working_timeout; + continue; /* retry */ + } + goto out; /* got a legitimate answer */ + + case RPC_TIMEDOUT: + goto remaploop; /* ask for port# again */ + + case klm_denied_nolocks: + goto out; + + default: + cmn_err(CE_CONT, + "lock-manager: RPC error: %s\n", + clnt_sperrno((enum clnt_stat) error)); + + /* on RPC error, wait a bit and try again */ +#ifdef LOCKDEBUG + cmn_err(CE_CONT, "BEFORE TIMEOUT: %d\n", + normal_timeout * HZ); +#endif + timeid = timeout(wakeup, (caddr_t)&lm_sa, + (normal_timeout * HZ)); + error = sleep((caddr_t)&lm_sa, PZERO|PCATCH); +#ifdef NOTUSE + untimeout(wakeup, (caddr_t)&lm_sa); +#endif + untimeout(timeid); + if (error) { + error = EINTR; + goto out; + } + goto remaploop; /* ask for port# again */ + + } /* switch */ - } /* switch */ + } /* for */ /* loop until timeout, error, or completion */ - } /* for */ /* loop until timeout, error, or completion */ + } /* for */ /* loop until signal or completion */ out: AUTH_DESTROY(client->cl_auth); /* drop the authenticator */ diff --git a/usr/src/uts/3b2/ktli/ktli.mk b/usr/src/uts/3b2/ktli/ktli.mk index d76a1fe..0c4d2db 100644 --- a/usr/src/uts/3b2/ktli/ktli.mk +++ b/usr/src/uts/3b2/ktli/ktli.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)ktli:ktli/ktli.mk 1.3" +#ident "@(#)ktli:ktli/ktli.mk 1.2" # # @(#)ktli.mk 1.2 89/01/11 SMI # @@ -42,8 +42,8 @@ DEFLIST = FRC = KTLIOBJ = t_kclose.o t_kgtstate.o t_ksndudat.o t_kutil.o t_kalloc.o \ - t_kconnect.o t_kopen.o t_kspoll.o t_kbind.o t_kunbind.o t_kfree.o \ - t_krcvudat.o + t_kconnect.o t_kopen.o t_kspoll.o t_kbind.o t_kfree.o \ + t_krcvudat.o all: KTLI @@ -81,8 +81,7 @@ t_kalloc.o: t_kalloc.c \ $(INC)/sys/errno.h \ $(INC)/sys/signal.h \ $(INC)/sys/t_kuser.h \ - $(INC)/sys/kmem.h \ - $(FRC) + $(INC)/sys/kmem.h t_kbind.o: t_kbind.c \ $(INC)/sys/param.h \ @@ -100,27 +99,7 @@ t_kbind.o: t_kbind.c \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ $(INC)/sys/t_kuser.h \ - $(INC)/sys/kmem.h \ - $(FRC) - -t_kunbind.o: t_kunbind.c \ - $(INC)/sys/param.h \ - $(INC)/sys/types.h \ - $(INC)/sys/proc.h \ - $(INC)/sys/file.h \ - $(INC)/sys/user.h \ - $(INC)/sys/errno.h \ - $(INC)/sys/stream.h \ - $(INC)/sys/strsubr.h \ - $(INC)/sys/ioctl.h \ - $(INC)/sys/stropts.h \ - $(INC)/sys/vnode.h \ - $(INC)/sys/tihdr.h \ - $(INC)/sys/timod.h \ - $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(INC)/sys/kmem.h \ - $(FRC) + $(INC)/sys/kmem.h t_kclose.o: t_kclose.c \ $(INC)/sys/param.h \ @@ -134,8 +113,7 @@ t_kclose.o: t_kclose.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h t_kconnect.o: t_kconnect.c \ $(INC)/sys/param.h \ @@ -150,8 +128,7 @@ t_kconnect.o: t_kconnect.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h t_kfree.o: t_kfree.c \ $(INC)/sys/param.h \ @@ -165,8 +142,7 @@ t_kfree.o: t_kfree.c \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ $(INC)/sys/errno.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h t_kgtstate.o: t_kgtstate.c \ $(INC)/sys/param.h \ @@ -183,8 +159,7 @@ t_kgtstate.o: t_kgtstate.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h t_kopen.o: t_kopen.c \ $(INC)/sys/param.h \ @@ -202,9 +177,7 @@ t_kopen.o: t_kopen.c \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ $(INC)/sys/t_kuser.h \ - $(INC)/sys/kmem.h \ - $(INC)/sys/cmn_err.h \ - $(FRC) + $(INC)/sys/kmem.h t_krcvudat.o: t_krcvudat.c \ $(INC)/sys/param.h \ @@ -219,8 +192,7 @@ t_krcvudat.o: t_krcvudat.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h t_ksndudat.o: t_ksndudat.c \ $(INC)/sys/param.h \ @@ -236,8 +208,7 @@ t_ksndudat.o: t_ksndudat.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h t_kspoll.o: t_kspoll.c \ $(INC)/sys/param.h \ @@ -254,8 +225,7 @@ t_kspoll.o: t_kspoll.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h t_kutil.o: t_kutil.c \ $(INC)/sys/param.h \ @@ -272,5 +242,4 @@ t_kutil.o: t_kutil.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/timod.h \ $(INC)/sys/tiuser.h \ - $(INC)/sys/t_kuser.h \ - $(FRC) + $(INC)/sys/t_kuser.h diff --git a/usr/src/uts/3b2/ktli/t_kalloc.c b/usr/src/uts/3b2/ktli/t_kalloc.c index 586cf00..b3e4a20 100644 --- a/usr/src/uts/3b2/ktli/t_kalloc.c +++ b/usr/src/uts/3b2/ktli/t_kalloc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kalloc.c 1.3" +#ident "@(#)ktli:ktli/t_kalloc.c 1.2" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kalloc.c 1.2 89/01/11 SMI" #endif @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)t_kalloc.c 1.2 89/01/11 SMI" * Kernel TLI-like function to allocate memory for the * various TLI primitives. * - * Returns 0 on success or a positive error value. - * On success, ptr is set the structure required. + * Returns a pointer to the allocated structure or + * NULL. */ #include @@ -55,13 +55,13 @@ static char sccsid[] = "@(#)t_kalloc.c 1.2 89/01/11 SMI" #include static void _alloc_buf(); +static unsigned int getsz(); -int -t_kalloc(tiptr, struct_type, fields, ptr) - register TIUSER *tiptr; - register int struct_type; - register int fields; - char **ptr; +char * +t_kalloc(tiptr, struct_type, fields) +register TIUSER *tiptr; +register int struct_type; +register int fields; { register union structptrs { char *caddr; @@ -73,10 +73,7 @@ t_kalloc(tiptr, struct_type, fields, ptr) struct t_uderr *uderr; struct t_info *info; } p; - register unsigned dsize; - - if (ptr == NULL) - return EINVAL; + register unsigned dsize; /* * allocate appropriate structure and the specified @@ -90,8 +87,7 @@ t_kalloc(tiptr, struct_type, fields, ptr) if (fields & T_ADDR) { _alloc_buf(&p.bind->addr, tiptr->tp_info.addr); } - *ptr = ((char *)p.bind); - return 0; + return ((char *)p.bind); case T_CALL: p.call = (struct t_call *) @@ -106,8 +102,7 @@ t_kalloc(tiptr, struct_type, fields, ptr) dsize = max(tiptr->tp_info.connect, tiptr->tp_info.discon); _alloc_buf(&p.call->opt, dsize); } - *ptr = ((char *)p.call); - return 0; + return((char *)p.call); case T_OPTMGMT: p.opt = (struct t_optmgmt *) @@ -115,8 +110,7 @@ t_kalloc(tiptr, struct_type, fields, ptr) if (fields & T_OPT){ _alloc_buf(&p.opt->opt, tiptr->tp_info.options); } - *ptr = ((char *)p.opt); - return 0; + return((char *)p.opt); case T_DIS: p.dis = (struct t_discon *) @@ -124,8 +118,7 @@ t_kalloc(tiptr, struct_type, fields, ptr) if (fields & T_UDATA){ _alloc_buf(&p.dis->udata, tiptr->tp_info.discon); } - *ptr = ((char *)p.dis); - return 0; + return((char *)p.dis); case T_UNITDATA: p.udata = (struct t_kunitdata *) @@ -143,12 +136,11 @@ t_kalloc(tiptr, struct_type, fields, ptr) if (fields & T_UDATA){ p.udata->udata.udata_mp = NULL; p.udata->udata.buf = NULL; - p.udata->udata.maxlen = tiptr->tp_info.tsdu; + p.udata->udata.maxlen = getsz(tiptr->tp_info.tsdu); p.udata->udata.len = 0; } else p.udata->udata.maxlen = p.udata->udata.len = 0; - *ptr = (char *)p.udata; - return 0; + return (char *)p.udata; case T_UDERROR: p.uderr = (struct t_uderr *) @@ -159,20 +151,34 @@ t_kalloc(tiptr, struct_type, fields, ptr) if (fields & T_OPT){ _alloc_buf(&p.uderr->opt, tiptr->tp_info.options); } - *ptr = (char *)p.uderr; - return 0; + return (char *)p.uderr; case T_INFO: p.info = (struct t_info *) kmem_zalloc((u_int)sizeof(struct t_info), KM_SLEEP); - *ptr = (char *)p.info; - return 0; + return (char *)p.info; default: - return EINVAL; + u.u_error= EINVAL; + return NULL; } } +static unsigned int +getsz(n) +register int n; + +{ + switch (n) { + case -1: + return 1024; + case 0: + case -2: + return 0; + default: + return n; + } +} static void _alloc_buf(buf, n) diff --git a/usr/src/uts/3b2/ktli/t_kbind.c b/usr/src/uts/3b2/ktli/t_kbind.c index f023cd8..461461a 100644 --- a/usr/src/uts/3b2/ktli/t_kbind.c +++ b/usr/src/uts/3b2/ktli/t_kbind.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kbind.c 1.4" +#ident "@(#)ktli:ktli/t_kbind.c 1.3" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kbind.c 1.2 89/01/11 SMI" #endif @@ -35,7 +35,8 @@ static char sccsid[] = "@(#)t_kbind.c 1.2 89/01/11 SMI" * Kernel TLI-like function to bind a transport endpoint * to an address. * - * Returns 0 on success or positive error code. + * Returns 0 on success and ret is set if non-NULL, + * else -1. * */ @@ -58,21 +59,18 @@ static char sccsid[] = "@(#)t_kbind.c 1.2 89/01/11 SMI" int t_kbind(tiptr, req, ret) - register TIUSER *tiptr; - register struct t_bind *req; - register struct t_bind *ret; +register TIUSER *tiptr; +register struct t_bind *req, *ret; { - register struct T_bind_req *bind_req; - register struct T_bind_ack *bind_ack; - register int bindsz; - register struct vnode *vp; - register struct file *fp; - register char *buf; - struct strioctl strioc; - int retval; - int error; - - error = 0; + register struct T_bind_req *bind_req; + register struct T_bind_ack *bind_ack; + register int bindsz; + register struct vnode *vp; + register struct file *fp; + register char *buf; + struct strioctl strioc; + int retval; + retval = 0; fp = tiptr->fp; vp = fp->f_vnode; @@ -80,10 +78,8 @@ t_kbind(tiptr, req, ret) /* send the ioctl request and wait * for a reply. */ - bindsz = max(TBINDREQSZ, TBINDACKSZ); - bindsz += max(req == NULL ? 0 : req->addr.len , tiptr->tp_info.addr); + bindsz = max(TBINDREQSZ, TBINDACKSZ) +(req == NULL ? 0 : req->addr.len); buf = (char *)kmem_alloc(bindsz, KM_SLEEP); - /* LINTED pointer alignment */ bind_req = (struct T_bind_req *)buf; bind_req->PRIM_type = T_BIND_REQ; @@ -101,40 +97,39 @@ t_kbind(tiptr, req, ret) strioc.ic_dp = buf; strioc.ic_len = TBINDREQSZ+bind_req->ADDR_length; - error = strdoioctl(vp->v_stream, &strioc, NULL, K_TO_K, + u.u_error = strdoioctl(vp->v_stream, &strioc, NULL, K_TO_K, (char *)NULL, u.u_cred, &retval); - if (error) + if (u.u_error) goto badbind; if (retval) { if ((retval & 0xff) == TSYSERR) - error = (retval >> 8) & 0xff; - else error = t_tlitosyserr(retval & 0xff); + u.u_error = (retval >> 8) & 0xff; + else u.u_error = tlitosyserr(retval & 0xff); goto badbind; } /* LINTED pointer alignment */ bind_ack = (struct T_bind_ack *)strioc.ic_dp; if (strioc.ic_len < TBINDACKSZ || bind_ack->ADDR_length == 0) { - error = EIO; + u.u_error = EIO; goto badbind; } /* copy bind data into users buffer */ - if (ret) { - if (ret->addr.maxlen > bind_ack->ADDR_length) - ret->addr.len = bind_ack->ADDR_length; - else ret->addr.len = ret->addr.maxlen; - + if (ret && ret->addr.maxlen >= bind_ack->ADDR_length) { bcopy(buf+bind_ack->ADDR_offset, ret->addr.buf, - ret->addr.len); + (int)bind_ack->ADDR_length); + ret->addr.len = bind_ack->ADDR_length; ret->qlen = bind_ack->CONIND_number; } badbind: kmem_free(buf, (u_int)bindsz); - return error; + if (u.u_error) + return -1; + return 0; } /******************************************************************************/ diff --git a/usr/src/uts/3b2/ktli/t_kclose.c b/usr/src/uts/3b2/ktli/t_kclose.c index 1ddd3d1..240061e 100644 --- a/usr/src/uts/3b2/ktli/t_kclose.c +++ b/usr/src/uts/3b2/ktli/t_kclose.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kclose.c 1.3" +#ident "@(#)ktli:ktli/t_kclose.c 1.2" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kclose.c 1.1 88/12/12 SMI" #endif @@ -35,7 +35,7 @@ static char sccsid[] = "@(#)t_kclose.c 1.1 88/12/12 SMI" * Much like closef(). * * Returns: - * 0 + * errno or 0 */ #include @@ -54,10 +54,10 @@ static char sccsid[] = "@(#)t_kclose.c 1.1 88/12/12 SMI" int t_kclose(tiptr, callclosef) - register TIUSER *tiptr; - register int callclosef; +register TIUSER *tiptr; +register int callclosef; { - register struct file *fp; + register struct file *fp; fp = tiptr->fp; diff --git a/usr/src/uts/3b2/ktli/t_kconnect.c b/usr/src/uts/3b2/ktli/t_kconnect.c index 04484f8..dd20446 100644 --- a/usr/src/uts/3b2/ktli/t_kconnect.c +++ b/usr/src/uts/3b2/ktli/t_kconnect.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kconnect.c 1.4" +#ident "@(#)ktli:ktli/t_kconnect.c 1.3" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kconnect.c 1.2 89/01/11 SMI" #endif @@ -38,9 +38,10 @@ static char sccsid[] = "@(#)t_kconnect.c 1.2 89/01/11 SMI" * before returning. * * Returns: - * 0 on success, and if rcvcall is non-NULL it shall be - * filled with the connection confirm data. - * Otherwise a positive error code. + * 0 on success, and if rcvcall is non-NULL it shall be + * filled with the connection confirm data. + * -1 on failure. + * */ #include @@ -60,30 +61,25 @@ static char sccsid[] = "@(#)t_kconnect.c 1.2 89/01/11 SMI" int t_kconnect(tiptr, sndcall, rcvcall) - register TIUSER *tiptr; - register struct t_call *sndcall; - register struct t_call *rcvcall; +register TIUSER *tiptr; +register struct t_call *sndcall; +register struct t_call *rcvcall; { - register int len; - register int msgsz; - register int hdrsz; - register struct T_conn_req *creq; - register union T_primitives *pptr; - register mblk_t *nbp; - register struct file *fp; - mblk_t *bp; - int error; - - error = 0; + register int len, retval, msgsz, hdrsz; + register struct T_conn_req *creq; + register union T_primitives *pptr; + register mblk_t *nbp; + register struct file *fp; + mblk_t *bp; fp = tiptr->fp; msgsz = TCONNREQSZ; - while (!(bp = allocb(msgsz, BPRI_LO))) { + while (!(bp = allocb(msgsz, BPRI_LO))) if (strwaitbuf(msgsz, BPRI_LO)) { - return ENOSR; + u.u_error = ENOSR; + return -1; } - } /* LINTED pointer alignment */ creq = (struct T_conn_req *)bp->b_wptr; @@ -112,27 +108,29 @@ t_kconnect(tiptr, sndcall, rcvcall) /* if CO then we would allocate a data block and * put the users connect data into it. */ - KTLILOG(1, "Attempt to send connectionless data on T_CONN_REQ\n", 0); - return EPROTO; + printf("Attempt to send connectionless data on T_CONN_REQ\n"); + return -1; } /* send it */ - if ((error = tli_send(tiptr, bp, fp->f_flag)) != 0) - return error; + if (tli_send(tiptr, bp, fp->f_flag) < 0) + return -1; /* wait for acknowledgment */ - if ((error = get_ok_ack(tiptr, T_CONN_REQ, fp->f_flag)) != 0) - return error; + if (get_ok_ack(tiptr, T_CONN_REQ, fp->f_flag) < 0) + return -1; /* wait for CONfirm */ - if ((error = tli_recv(tiptr, &bp, fp->f_flag)) != 0) - return error; + if (tli_recv(tiptr, &bp, fp->f_flag) < 0) + return -1; - if (bp->b_datap->db_type != M_PROTO) - return EPROTO; + if (bp->b_datap->db_type != M_PROTO) { + u.u_error = EPROTO; + return -1; + } /* LINTED pointer alignment */ pptr = (union T_primitives *)bp->b_rptr; @@ -147,8 +145,7 @@ t_kconnect(tiptr, sndcall, rcvcall) pptr->conn_con.OPT_offset) || hdrsz < (pptr->conn_con.RES_length+ pptr->conn_con.RES_offset) ) { - error = EPROTO; - break; + u.u_error = EPROTO; } if (rcvcall != NULL) { @@ -178,13 +175,15 @@ t_kconnect(tiptr, sndcall, rcvcall) } } else freemsg(bp); + retval = 0; break; default: - error = EPROTO; + u.u_error = EPROTO; + retval = -1; break; } - return error; + return retval; } /******************************************************************************/ diff --git a/usr/src/uts/3b2/ktli/t_kfree.c b/usr/src/uts/3b2/ktli/t_kfree.c index 038a3a4..1d5879c 100644 --- a/usr/src/uts/3b2/ktli/t_kfree.c +++ b/usr/src/uts/3b2/ktli/t_kfree.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kfree.c 1.4" +#ident "@(#)ktli:ktli/t_kfree.c 1.3" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kfree.c 1.1 88/12/12 SMI" #endif @@ -35,8 +35,8 @@ static char sccsid[] = "@(#)t_kfree.c 1.1 88/12/12 SMI" * Free the specified kernel tli data structure. * * Returns: - * 0 on success or - * positive error code. + * 0 on success. + * -1 on failure and u.u_error */ #include @@ -56,21 +56,18 @@ static char sccsid[] = "@(#)t_kfree.c 1.1 88/12/12 SMI" /*ARGSUSED*/ int t_kfree(tiptr, ptr, struct_type) - register TIUSER *tiptr; - register char *ptr; - register int struct_type; +register TIUSER *tiptr; +register char *ptr; +register int struct_type; { union structptrs { - struct t_bind *bind; - struct t_call *call; - struct t_discon *dis; - struct t_optmgmt *opt; - struct t_kunitdata *udata; - struct t_uderr *uderr; + struct t_bind *bind; + struct t_call *call; + struct t_discon *dis; + struct t_optmgmt *opt; + struct t_kunitdata *udata; + struct t_uderr *uderr; } p; - int error; - - error = 0; /* * Free all the buffers associated with the appropriate @@ -120,22 +117,26 @@ t_kfree(tiptr, ptr, struct_type) p.udata = (struct t_kunitdata *)ptr; if (p.udata->udata.udata_mp) { - KTLILOG(2, "t_kfree: freeing mblk_t %x, ", - p.udata->udata.udata_mp); - KTLILOG(2, "ref %d\n", - p.udata->udata.udata_mp->b_datap->db_ref); +#ifdef KTLIDEBUG +printf("t_kfree: freeing mblk_t %x, ref %d\n", p.udata->udata.udata_mp, p.udata->udata.udata_mp->b_datap->db_ref); +#endif freemsg(p.udata->udata.udata_mp); } - if (p.udata->opt.buf != NULL) + if (p.udata->opt.buf != NULL) { +#ifdef KTLIDEBUG +printf("t_kfree: freeing options\n"); +#endif kmem_free(p.udata->opt.buf, (u_int)p.udata->opt.maxlen); + } if (p.udata->addr.buf != NULL) { - KTLILOG(2, "t_kfree: freeing address %x, ", - p.udata->addr.buf); - KTLILOG(2, "len %d\n", - p.udata->addr.maxlen); +#ifdef KTLIDEBUG +printf("t_kfree: freeing address %x, %d\n", p.udata->addr.buf, p.udata->addr.maxlen); +#endif kmem_free(p.udata->addr.buf, (u_int)p.udata->addr.maxlen); } - KTLILOG(2, "t_kfree: freeing t_kunitdata\n", 0); +#ifdef KTLIDEBUG +printf("t_kfree: freeing t_kunitdata\n"); +#endif kmem_free(ptr, (u_int)sizeof(struct t_kunitdata)); break; @@ -153,11 +154,11 @@ t_kfree(tiptr, ptr, struct_type) break; default: - error = EINVAL; - break; + u.u_error = EINVAL; + return(-1); } - return error; + return(0); } /******************************************************************************/ diff --git a/usr/src/uts/3b2/ktli/t_kgtstate.c b/usr/src/uts/3b2/ktli/t_kgtstate.c index f8ed94c..2e4e9c8 100644 --- a/usr/src/uts/3b2/ktli/t_kgtstate.c +++ b/usr/src/uts/3b2/ktli/t_kgtstate.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kgtstate.c 1.3" +#ident "@(#)ktli:ktli/t_kgtstate.c 1.2" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kgetstate.c 1.2 89/01/11 SMI" #endif @@ -37,8 +37,7 @@ static char sccsid[] = "@(#)t_kgetstate.c 1.2 89/01/11 SMI" * endpoint. * * Returns: - * 0 on success and "state" is set to the current state, - * or a positive error code. + * The state or -1 on failure. * */ @@ -60,80 +59,61 @@ static char sccsid[] = "@(#)t_kgetstate.c 1.2 89/01/11 SMI" int -t_kgetstate(tiptr, state) - register TIUSER *tiptr; - register int *state; +t_kgetstate(tiptr) +register TIUSER *tiptr; { - struct T_info_ack inforeq; - struct strioctl strioc; - int retval; - register struct vnode *vp; - register struct file *fp; - int error; + struct T_info_ack inforeq; + struct strioctl strioc; + int retval; + register struct vnode *vp; + register struct file *fp; - error = 0; retval = 0; fp = tiptr->fp; vp = fp->f_vnode; - if (state == NULL) - return EINVAL; - inforeq.PRIM_type = T_INFO_REQ; strioc.ic_cmd = TI_GETINFO; strioc.ic_timout = 0; strioc.ic_dp = (char *)&inforeq; strioc.ic_len = sizeof(struct T_info_req); - error = strdoioctl(vp->v_stream, &strioc, NULL, K_TO_K, + u.u_error = strdoioctl(vp->v_stream, &strioc, NULL, K_TO_K, (char *)NULL, u.u_cred, &retval); - if (error) - return error; + if (u.u_error) + return -1; if (retval) { if ((retval & 0xff) == TSYSERR) - error = (retval >> 8) & 0xff; - else error = t_tlitosyserr(retval & 0xff); - return error; + u.u_error = (retval >> 8) & 0xff; + else u.u_error = tlitosyserr(retval & 0xff); + return -1; } - if (strioc.ic_len != sizeof(struct T_info_ack)) - return EPROTO; + if (strioc.ic_len != sizeof(struct T_info_ack)) { + u.u_error = EPROTO; + return -1; + } switch (inforeq.CURRENT_state) { case TS_UNBND: - *state = T_UNBND; - break; - + return(T_UNBND); case TS_IDLE: - *state = T_IDLE; - break; - + return(T_IDLE); case TS_WRES_CIND: - *state = T_INCON; - break; - + return(T_INCON); case TS_WCON_CREQ: - *state = T_OUTCON; - break; - + return(T_OUTCON); case TS_DATA_XFER: - *state = T_DATAXFER; - break; - + return(T_DATAXFER); case TS_WIND_ORDREL: - *state = T_OUTREL; - break; - + return(T_OUTREL); case TS_WREQ_ORDREL: - *state = T_INREL; - break; - + return(T_INREL); default: - error = EPROTO; - break; + u.u_error = EPROTO; + return(-1); } - return error; } /******************************************************************************/ diff --git a/usr/src/uts/3b2/ktli/t_kopen.c b/usr/src/uts/3b2/ktli/t_kopen.c index c3f8338..06832b1 100644 --- a/usr/src/uts/3b2/ktli/t_kopen.c +++ b/usr/src/uts/3b2/ktli/t_kopen.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kopen.c 1.6" +#ident "@(#)ktli:ktli/t_kopen.c 1.5" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kopen.c 1.2 89/03/19 SMI" #endif @@ -37,8 +37,9 @@ static char sccsid[] = "@(#)t_kopen.c 1.2 89/03/19 SMI" * endpoint using the protocol specified. * * Returns: - * 0 on success and "tiptr" is set to a valid transport pointer, - * else a positive error code. + * A valid file pointer on success or -1 on failure. + * On success, if info is non-NULL it will be filled with + * transport provider values. * */ @@ -58,40 +59,39 @@ static char sccsid[] = "@(#)t_kopen.c 1.2 89/03/19 SMI" #include #include #include -#include static _t_setsize(); -int -t_kopen(fp, rdev, flags, tiptr) - struct file *fp; - register int flags; - register dev_t rdev; - TIUSER **tiptr; +TIUSER * +t_kopen(fp, rdev, flags, info) +struct file *fp; +register int flags; +register dev_t rdev; +register struct t_info *info; { - extern struct vnode *makespecvp(); + extern struct vnode *makespecvp(); - register int madefp = 0; - struct T_info_ack inforeq; - int retval; - struct vnode *vp; - struct strioctl strioc; - int error; - TIUSER *ntiptr; + register TIUSER *tiptr; + register int madefp = 0; + struct T_info_ack inforeq; + int retval; + struct vnode *vp; + struct strioctl strioc; - KTLILOG(2, "t_kopen: fp %x, ", fp); - KTLILOG(2, "rdev %x, ", rdev); - KTLILOG(2, "flags %x\n", flags); +#ifdef KTLIDEBUG +printf("t_kopen: fp %x, rdev %x, flags %x, info %x\n", fp, rdev, flags, info); +#endif - error = 0; + u.u_error = 0; retval = 0; if (fp == NULL) { int fd; if (rdev == 0) { - KTLILOG(1, "t_kopen: null device\n", 0); - return EINVAL; + u.u_error = EINVAL; + printf("t_kopen: null device\n"); + return NULL; } /* make a vnode. */ @@ -100,16 +100,17 @@ t_kopen(fp, rdev, flags, tiptr) /* this will call the streams open * for us. */ - if ((error = VOP_OPEN(&vp, flags, u.u_cred)) != 0) { - KTLILOG(1, "t_kopen: VOP_OPEN: %d\n", error); - return error; + if (u.u_error = VOP_OPEN(&vp, flags, u.u_cred)) { + printf("t_kopen: VOP_OPEN: %d\n", u.u_error); + return NULL; } /* allocate a file pointer, but * no file descripter. */ - while ((error = falloc(vp, flags, &fp, &fd)) != 0) { - KTLILOG(1, "t_kopen: falloc: %d\n", error); - (void)delay(HZ); + if ((u.u_error = falloc(vp, flags, &fp, &fd)) != 0) { + (void)VOP_CLOSE(vp, flags, 0, (off_t)0, u.u_cred); + printf("t_kopen: falloc: %d\n", u.u_error); + return NULL; } setf(fd, NULLFP); @@ -119,47 +120,35 @@ t_kopen(fp, rdev, flags, tiptr) /* allocate a new transport structure */ - ntiptr = (TIUSER *)kmem_alloc((u_int)TIUSERSZ, KM_SLEEP); - ntiptr->fp = fp; + tiptr = (TIUSER *)kmem_alloc((u_int)TIUSERSZ, KM_SLEEP); + tiptr->fp = fp; - KTLILOG(2, "t_kopen: vp %x, ", vp); - KTLILOG(2, "stp %x\n", vp->v_stream); +#ifdef KTLIDEBUG +printf("t_kopen: fp %x, vp %x, stp %x\n", fp, vp, vp->v_stream); +#endif /* see if TIMOD is already pushed */ - error = strioctl(vp, I_FIND, "timod", 0, K_TO_K, u.u_cred, &retval); - if (error) { - kmem_free((caddr_t)ntiptr, (u_int)TIUSERSZ); + u.u_error = strioctl(vp, I_FIND, "timod", 0, K_TO_K, u.u_cred, &retval); + if (u.u_error) { + kmem_free((caddr_t)tiptr, (u_int)TIUSERSZ); if (madefp) closef(fp); - KTLILOG(1, "t_kopen: strioctl(I_FIND, timod): %d\n", error); - return error; + printf("t_kopen: strioctl(I_FIND, timod): %d\n", u.u_error); + return NULL; } if (retval == 0) { -tryagain: - error = strioctl(vp, I_PUSH, "timod", 0, K_TO_K, u.u_cred, + u.u_error = strioctl(vp, I_PUSH, "timod", 0, K_TO_K, u.u_cred, &retval); - if (error) { - switch(error) { - case ENOSPC: - case EAGAIN: - case ENOSR: - /* This probably means the master file - * should be tuned. - */ - cmn_err(CE_WARN, "t_kopen: I_PUSH of timod failed, error %d\n", error); - (void)delay(HZ); - error = 0; - goto tryagain; - - default: - kmem_free((caddr_t)ntiptr, (u_int)TIUSERSZ); - if (madefp) - closef(fp); - KTLILOG(1, "t_kopen: I_PUSH (timod): %d", error); - return error; - } + if (u.u_error) { + kmem_free((caddr_t)tiptr, (u_int)TIUSERSZ); + if (madefp) + closef(fp); + printf("t_kopen: I_PUSH (timod): %d", u.u_error); + u.u_error = TSYSERR; + printf(", vp %x, fp %x, stp %x\n", vp, fp, vp->v_stream); + return NULL; } } @@ -169,46 +158,55 @@ t_kopen(fp, rdev, flags, tiptr) strioc.ic_dp = (char *)&inforeq; strioc.ic_len = sizeof(struct T_info_req); - error = strdoioctl(vp->v_stream, &strioc, NULL, K_TO_K, + u.u_error = strdoioctl(vp->v_stream, &strioc, NULL, K_TO_K, (char *)NULL, u.u_cred, &retval); - if (error) { - kmem_free((caddr_t)ntiptr, (u_int)TIUSERSZ); + if (u.u_error) { + kmem_free((caddr_t)tiptr, (u_int)TIUSERSZ); if (madefp) closef(fp); - KTLILOG(1, "t_kopen: strdoioctl(T_INFO_REQ): %d\n", error); - return error; + printf("t_kopen: strdoioctl(T_INFO_REQ): %d\n", u.u_error); + return NULL; } if (retval) { if ((retval & 0xff) == TSYSERR) - error = (retval >> 8) & 0xff; - else error = t_tlitosyserr(retval & 0xff); - kmem_free((caddr_t)ntiptr, (u_int)TIUSERSZ); + u.u_error = (retval >> 8) & 0xff; + else u.u_error = tlitosyserr(retval & 0xff); + kmem_free((caddr_t)tiptr, (u_int)TIUSERSZ); if (madefp) closef(fp); - KTLILOG(1, "t_kopen: strdoioctl(T_INFO_REQ): retval: 0x%x\n", retval); - return error; + printf("t_kopen: strdoioctl(T_INFO_REQ): retval: 0x%x, %d\n", retval, u.u_error); + return NULL; } if (strioc.ic_len != sizeof(struct T_info_ack)) { - kmem_free((caddr_t)ntiptr, (u_int)TIUSERSZ); + kmem_free((caddr_t)tiptr, (u_int)TIUSERSZ); if (madefp) closef(fp); - KTLILOG(1, "t_kopen: strioc.ic_len != sizeof (struct T_info_ack): %d\n", strioc.ic_len); - return EPROTO; + u.u_error = EPROTO; + printf("t_kopen: strioc.ic_len != sizeof (struct T_info_ack): %d\n", u.u_error); + return NULL; } - ntiptr->tp_info.addr = _t_setsize(inforeq.ADDR_size); - ntiptr->tp_info.options = _t_setsize(inforeq.OPT_size); - ntiptr->tp_info.tsdu = _t_setsize(inforeq.TSDU_size); - ntiptr->tp_info.etsdu = _t_setsize(inforeq.ETSDU_size); - ntiptr->tp_info.connect = _t_setsize(inforeq.CDATA_size); - ntiptr->tp_info.discon = _t_setsize(inforeq.DDATA_size); - ntiptr->tp_info.servtype = inforeq.SERV_type; + if (info != NULL) { + info->addr = _t_setsize(inforeq.ADDR_size); + info->options = _t_setsize(inforeq.OPT_size); + info->tsdu = _t_setsize(inforeq.TSDU_size); + info->etsdu = _t_setsize(inforeq.ETSDU_size); + info->connect = _t_setsize(inforeq.CDATA_size); + info->discon = _t_setsize(inforeq.DDATA_size); + info->servtype = inforeq.SERV_type; + } - *tiptr = ntiptr; + tiptr->tp_info.addr = inforeq.ADDR_size; + tiptr->tp_info.options = inforeq.OPT_size; + tiptr->tp_info.tsdu = inforeq.TSDU_size; + tiptr->tp_info.etsdu = inforeq.ETSDU_size; + tiptr->tp_info.connect = inforeq.CDATA_size; + tiptr->tp_info.discon = inforeq.DDATA_size; + tiptr->tp_info.servtype = inforeq.SERV_type; - return (0); + return (tiptr); } #define DEFSIZE 128 diff --git a/usr/src/uts/3b2/ktli/t_krcvudat.c b/usr/src/uts/3b2/ktli/t_krcvudat.c index 0130317..a458265 100644 --- a/usr/src/uts/3b2/ktli/t_krcvudat.c +++ b/usr/src/uts/3b2/ktli/t_krcvudat.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_krcvudat.c 1.4" +#ident "@(#)ktli:ktli/t_krcvudat.c 1.3" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_krcvudata.c 1.1 88/12/12 SMI" #endif @@ -36,13 +36,9 @@ static char sccsid[] = "@(#)t_krcvudata.c 1.1 88/12/12 SMI" * transport endpoints stream head. * * Returns: - * 0 On success or positive error code. - * On sucess, type is set to: * T_DATA If normal data has been received - * T_UDERR If an error indication has been received, - * in which case uderr contains the unitdata - * error number. - * T_ERROR + * T_UDERR If an error indication has been received. + * -1 On failure * */ @@ -62,230 +58,229 @@ static char sccsid[] = "@(#)t_krcvudata.c 1.1 88/12/12 SMI" int -t_krcvudata(tiptr, unitdata, type, uderr) - register TIUSER *tiptr; - register struct t_kunitdata *unitdata; - register int *type; - register int *uderr; +t_krcvudata(tiptr, unitdata, errtype) +register TIUSER *tiptr; +register struct t_kunitdata *unitdata; +register long *errtype; { - register int len; - register int hdrsz; - register union T_primitives *pptr; - register struct file *fp; - mblk_t *bp; - register mblk_t *nbp; - register mblk_t *mp; - register mblk_t *tmp; - register int error; + register int len, retval, hdrsz; + register union T_primitives *pptr; + register struct file *fp; + mblk_t *bp; + register mblk_t *nbp, *mp, *tmp; fp = tiptr->fp; - if (type == NULL || uderr == NULL) - return EINVAL; - - error = 0; + retval = 0; unitdata->udata.buf = (char *)NULL; if (unitdata->udata.udata_mp) { - KTLILOG(2, "t_krcvudata: freeing existing message block\n", 0); +#ifdef KTLIDEBUG +printf("t_krcvudata: freeing existing message block\n"); +#endif freemsg(unitdata->udata.udata_mp); unitdata->udata.udata_mp = NULL; } - if ((error = tli_recv(tiptr, &bp, fp->f_flag)) != 0) - return error; + if (tli_recv(tiptr, &bp, fp->f_flag) < 0) + return -1; /* Got something */ switch (bp->b_datap->db_type) { - case M_PROTO: - /* LINTED pointer alignment */ - pptr = (union T_primitives *)bp->b_rptr; - switch (pptr->type) { - case T_UNITDATA_IND: - KTLILOG(2, "t_krcvudata: Got T_UNITDATA_IND\n", 0); - hdrsz = bp->b_wptr - bp->b_rptr; - - /* check everything for consistency - */ - if (hdrsz < TUNITDATAINDSZ || - hdrsz < (pptr->unitdata_ind.OPT_length+ - pptr->unitdata_ind.OPT_offset) || - hdrsz < (pptr->unitdata_ind.SRC_length+ - pptr->unitdata_ind.SRC_offset) ) { - error = EPROTO; - freemsg(bp); - break; - } - - /* okay, so now we copy them - */ - len = min(pptr->unitdata_ind.SRC_length, - unitdata->addr.maxlen); - bcopy(bp->b_rptr+pptr->unitdata_ind.SRC_offset, - unitdata->addr.buf, len); - unitdata->addr.len = len; - - len = min(pptr->unitdata_ind.OPT_length, - unitdata->opt.maxlen); - bcopy(bp->b_rptr+pptr->unitdata_ind.OPT_offset, - unitdata->opt.buf, len); - unitdata->opt.len = len; - - bp->b_rptr += hdrsz; - - /* we assume that the client knows - * how to deal with a set of linked - * mblks, so all we do is make a pass - * and remove any that are zero length. - */ - nbp = NULL; - mp = bp; - while (mp) { - if (!(bp->b_wptr-bp->b_rptr)){ - KTLILOG(2, - "t_krcvudata: zero length block\n", 0); - tmp = mp->b_cont; - if (nbp) - nbp->b_cont = tmp; - else bp = tmp; - - freeb(mp); - mp = tmp; - } - else { - nbp = mp; - mp = mp->b_cont; - } - } -#ifdef DEBUG -{ - mblk_t *tp; - - tp = bp; - while (tp) { - struct datab *dmp; - - dmp = tp->b_datap; - - KTLILOG(2, "t_krcvudata: bp %x, ", tp); - KTLILOG(2, "db_size %x, ", dmp->db_size); - KTLILOG(2, "db_ref %x", dmp->db_ref); - - if (dmp->db_frtnp) { - KTLILOG(2, ", func: %x", dmp->db_frtnp->free_func); - KTLILOG(2, ", arg %x\n", dmp->db_frtnp->free_arg); - } else - KTLILOG(2, "\n", 0); - tp = tp->b_cont; - } -} + case M_DATA: +#ifdef KTLIDEBUG +printf("t_krcvudata: tli_recv returned M_DATA\n"); #endif - - /* now just point the users mblk - * pointer to what we received. - */ - if (bp == NULL) { - KTLILOG(2, "t_krcvudata: No data\n", 0); - error = EPROTO; - break; + while (bp->b_cont && bp->b_rptr >= bp->b_wptr) { + nbp = bp; + bp = bp->b_cont; + freeb(nbp); } if ((bp->b_wptr - bp->b_rptr) != 0) { - if (!str_aligned(bp->b_rptr)) - if (!pullupmsg(bp, bp->b_wptr - bp->b_rptr)) { - KTLILOG(1, - "t_krcvudata: pullupmsg failed\n", 0); - error = EIO; - freemsg(bp); - break; - } unitdata->udata.buf = (char *)bp->b_rptr; unitdata->udata.len = bp->b_wptr-bp->b_rptr; - - KTLILOG(2, - "t_krcvudata: got %d bytes\n", unitdata->udata.len); unitdata->udata.udata_mp = bp; } - else { - KTLILOG(2, - "t_krcvudata: 0 length data message\n", 0); - freemsg(bp); - unitdata->udata.len = 0; - } - *type = T_DATA; + retval = T_DATA; break; - case T_UDERROR_IND: - KTLILOG(2, "t_krcvudata: Got T_UDERROR_IND\n", 0); - hdrsz = bp->b_wptr - bp->b_rptr; - - /* check everything for consistency - */ - if (hdrsz < TUDERRORINDSZ || - hdrsz < (pptr->uderror_ind.OPT_length+ - pptr->uderror_ind.OPT_offset) || - hdrsz < (pptr->uderror_ind.DEST_length+ - pptr->uderror_ind.DEST_offset) ) { - error = EPROTO; - freemsg(bp); - break; - } - - if (pptr->uderror_ind.DEST_length > - (int)unitdata->addr.maxlen || - pptr->uderror_ind.OPT_length > - (int)unitdata->opt.maxlen) { - error = EMSGSIZE; - freemsg(bp); - break; - } - - /* okay, so now we copy them - */ - bcopy(bp->b_rptr+pptr->uderror_ind.DEST_offset, - unitdata->addr.buf, - (int)pptr->uderror_ind.DEST_length); - unitdata->addr.len = pptr->uderror_ind.DEST_length; + case M_PROTO: + /* LINTED pointer alignment */ + pptr = (union T_primitives *)bp->b_rptr; + switch (pptr->type) { + case T_UNITDATA_IND: +#ifdef KTLIDEBUG +printf("t_krcvudata: Got T_UNITDATA_IND\n"); +#endif + hdrsz = bp->b_wptr - bp->b_rptr; + + /* check everything for consistency + */ + if (hdrsz < TUNITDATAINDSZ || + hdrsz < (pptr->unitdata_ind.OPT_length+ + pptr->unitdata_ind.OPT_offset) || + hdrsz < (pptr->unitdata_ind.SRC_length+ + pptr->unitdata_ind.SRC_offset) ) { + u.u_error = EPROTO; + retval = -1; + break; + } - bcopy(bp->b_rptr+pptr->uderror_ind.OPT_offset, - unitdata->opt.buf, - (int)pptr->uderror_ind.OPT_length); - unitdata->opt.len = pptr->uderror_ind.OPT_length; + /* okay, so now we copy them + */ + len = min(pptr->unitdata_ind.SRC_length, + unitdata->addr.maxlen); + bcopy(bp->b_rptr+pptr->unitdata_ind.SRC_offset, + unitdata->addr.buf, len); + unitdata->addr.len = len; + + len = min(pptr->unitdata_ind.OPT_length, + unitdata->opt.maxlen); + bcopy(bp->b_rptr+pptr->unitdata_ind.OPT_offset, + unitdata->opt.buf, len); + unitdata->opt.len = len; + + bp->b_rptr += hdrsz; + + /* we assume that the client knows + * how to deal with a set of linked + * mblks, so all we do is make a pass + * and remove any that are zero length. + */ + nbp = NULL; + mp = bp; + while (mp) { + if (!(bp->b_wptr-bp->b_rptr)){ +#ifdef KTLIDEBUG +printf("t_krcvudata: zero length block\n"); +#endif + tmp = mp->b_cont; + if (nbp) + nbp->b_cont = tmp; + else bp = tmp; + + freeb(mp); + mp = tmp; + } + else { + nbp = mp; + mp = mp->b_cont; + } + } +#ifdef KTLIDEBUG +{ +mblk_t *tp; +tp = bp; +while (tp) { + struct datab *dmp; - *uderr = pptr->uderror_ind.ERROR_type; + dmp = tp->b_datap; +/* + printf("t_krcvudata: bp %x, b_cont %x, rptr %x, wptr %x\n", tp, tp->b_cont, tp->b_rptr, tp->b_wptr); + printf("t_krcvudata: db_base %x, db_lim %x, db_size %x, db_class %d, db_ref %x, db_type %x\n", dmp->db_base, dmp->db_lim, dmp->db_size, dmp->db_class, dmp->db_ref, dmp->db_type); +*/ + if (tp->b_datap->db_size < 0) + printf("t_krcvudata: bp %x, func: %x, arg %x\n", tp, dmp->db_frtnp->free_func, dmp->db_frtnp->free_arg); + tp = tp->b_cont; +} +} +#endif - unitdata->udata.buf = NULL; - unitdata->udata.udata_mp = NULL; - unitdata->udata.len = 0; + /* now just point the users mblk + * pointer to what we received. + */ + if (bp == NULL) { + printf("t_krcvudata: No data\n"); + u.u_error = EPROTO; + retval = -1; + break; + } + if ((bp->b_wptr - bp->b_rptr) != 0) { + if (!str_aligned(bp->b_rptr)) + if (!pullupmsg(bp, bp->b_wptr - bp->b_rptr)) { + printf("t_krcvudata: pullupmsg failed\n"); + retval = -1; + break; + } + unitdata->udata.buf = (char *)bp->b_rptr; + unitdata->udata.len = bp->b_wptr-bp->b_rptr; + +#ifdef KTLIDEBUG +printf("t_krcvudata: got %d bytes\n", unitdata->udata.len); +#endif + unitdata->udata.udata_mp = bp; + } + else printf("t_krcvudata: 0 length data message\n"); + retval = T_DATA; + break; + + /* only other thing that can be there with + * CLTS is a datagram error indication. + */ + case T_UDERROR_IND: +#ifdef KTLIDEBUG +printf("t_krcvudata: Got T_UDERROR_IND\n"); +#endif + hdrsz = bp->b_wptr - bp->b_rptr; + + /* check everything for consistency + */ + if (hdrsz < TUDERRORINDSZ || + hdrsz < (pptr->uderror_ind.OPT_length+ + pptr->uderror_ind.OPT_offset) || + hdrsz < (pptr->uderror_ind.DEST_length+ + pptr->uderror_ind.DEST_offset) ) { + u.u_error = EPROTO; + retval = -1; + break; + } - freemsg(bp); + if (pptr->uderror_ind.DEST_length > + (int)unitdata->addr.maxlen || + pptr->uderror_ind.OPT_length > + (int)unitdata->opt.maxlen) { + u.u_error = TBUFOVFLW; + retval = -1; + break; + } - *type = T_UDERR; + /* okay, so now we copy them + */ + bcopy(bp->b_rptr+pptr->uderror_ind.DEST_offset, + unitdata->addr.buf, + (int)pptr->uderror_ind.DEST_length); + unitdata->addr.len = pptr->uderror_ind.DEST_length; + + bcopy(bp->b_rptr+pptr->uderror_ind.OPT_offset, + unitdata->opt.buf, + (int)pptr->uderror_ind.OPT_length); + unitdata->addr.len = pptr->uderror_ind.OPT_length; + + *errtype = pptr->uderror_ind.ERROR_type; + unitdata->udata.buf = NULL; + unitdata->udata.udata_mp = NULL; + + freemsg(bp); + + retval = T_UDERR; + break; + default: + printf("t_krcvudata: Unknown transport primitive type %d\n", pptr->type); + break; + } break; + default: - KTLILOG(1, - "t_krcvudata: Unknown transport primitive %d\n", pptr->type); - error = EPROTO; - freemsg(bp); +#ifdef KTLIDEBUG +printf("t_krcvudata: tli_recv returned unknown message type\n"); +#endif + u.u_error = EPROTO; + retval = -1; break; - } - break; - - case M_FLUSH: - KTLILOG(1, "t_krcvudata: tli_recv returned M_FLUSH\n", 0); - freemsg(bp); - *type = T_ERROR; - break; - - default: - KTLILOG(1, "t_krcvudata: unknown message type %x\n", - bp->b_datap->db_type); - freemsg(bp); - *type = T_ERROR; - break; } - return error; + return retval; } /******************************************************************************/ diff --git a/usr/src/uts/3b2/ktli/t_ksndudat.c b/usr/src/uts/3b2/ktli/t_ksndudat.c index 59b6fce..39699e1 100644 --- a/usr/src/uts/3b2/ktli/t_ksndudat.c +++ b/usr/src/uts/3b2/ktli/t_ksndudat.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_ksndudat.c 1.5" +#ident "@(#)ktli:ktli/t_ksndudat.c 1.4" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_ksndudata.c 1.3 89/01/12 SMI" #endif @@ -36,7 +36,9 @@ static char sccsid[] = "@(#)t_ksndudata.c 1.3 89/01/12 SMI" * transport endpoint. * * Returns: - * 0 on success or positive error code. + * -1 on failure. + * 0 on success, no data on receive queue. + * TLOOK on success, and data pending on receive queue. * */ @@ -58,28 +60,24 @@ static char sccsid[] = "@(#)t_ksndudata.c 1.3 89/01/12 SMI" int t_ksndudata(tiptr, unitdata, frtn) - register TIUSER *tiptr; - register struct t_kunitdata *unitdata; - register frtn_t *frtn; +register TIUSER *tiptr; +register struct t_kunitdata *unitdata; +register frtn_t *frtn; { - register int msgsz; - register int minsz; - register int maxsz; - register struct file *fp; - register struct vnode *vp; - register struct stdata *stp; - register mblk_t *bp; - register mblk_t *dbp; - register struct T_unitdata_req *udreq; - int error; - - error = 0; + register int msgsz, minsz, maxsz; + register struct file *fp; + register struct vnode *vp; + register struct stdata *stp; + register mblk_t *bp, *dbp; + register struct T_unitdata_req *udreq; + fp = tiptr->fp; vp = fp->f_vnode; stp = vp->v_stream; if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) { - return ((stp->sd_flag&STPLEX) ? EINVAL : stp->sd_werror); + u.u_error = ((stp->sd_flag&STPLEX) ? EINVAL : stp->sd_werror); + return -1; } /* check size constraints @@ -88,13 +86,17 @@ t_ksndudata(tiptr, unitdata, frtn) maxsz = stp->sd_wrq->q_next->q_maxpsz; msgsz = unitdata->udata.len; - if (msgsz > maxsz || msgsz < minsz) - return ERANGE; + if (msgsz > maxsz || msgsz < minsz) { + u.u_error = ERANGE; + return -1; + } /* now check tsdu */ - if (msgsz <= 0 || msgsz > tiptr->tp_info.tsdu) - return ERANGE; + if (msgsz <= 0 || msgsz > tiptr->tp_info.tsdu) { + u.u_error = ERANGE; + return -1; + } /* See if Class 0 is required */ @@ -104,19 +106,22 @@ t_ksndudata(tiptr, unitdata, frtn) * up. */ if ((dbp = (mblk_t *)esballoc(unitdata->udata.buf, - msgsz, BPRI_LO, frtn)) == NULL) - return ENOSR; - + msgsz, BPRI_LO, frtn)) == NULL) { + u.u_error = ENOSR; + return -1; + } dbp->b_datap->db_type = M_DATA; - KTLILOG(2, "t_ksndudata: bp %x, ", dbp); - KTLILOG(2, "len %d, ", msgsz); - KTLILOG(2, "free func %x\n", frtn->free_func); +#ifdef KTLIDEBUG +printf("t_ksndudata: bp %x, len %d, free func %x\n",dbp,msgsz,frtn->free_func); +#endif } else if (unitdata->udata.buf) { while (!(dbp = allocb(msgsz, BPRI_LO))) - if (strwaitbuf(msgsz, BPRI_LO)) - return ENOSR; + if (strwaitbuf(msgsz, BPRI_LO)) { + u.u_error = ENOSR; + return -1; + } bcopy(unitdata->udata.buf, dbp->b_wptr, unitdata->udata.len); dbp->b_datap->db_type = M_DATA; @@ -145,7 +150,8 @@ t_ksndudata(tiptr, unitdata, frtn) BPRI_LO))) if (strwaitbuf(msgsz, BPRI_LO)) { freeb(dbp); - return ENOSR; + u.u_error = ENOSR; + return -1; } /* LINTED pointer alignment */ @@ -177,13 +183,19 @@ t_ksndudata(tiptr, unitdata, frtn) /* Put it to the transport provider */ - if ((error = tli_send(tiptr, bp, fp->f_flag)) != 0) - return error; + if (tli_send(tiptr, bp, fp->f_flag) < 0) + return -1; unitdata->udata.udata_mp = 0; unitdata->udata.buf = 0; unitdata->udata.len = 0; + /* before we return, see if there is anything waiting + * on our read queue. + */ + if (RD(stp->sd_wrq)->q_first) + return TLOOK; + return 0; } diff --git a/usr/src/uts/3b2/ktli/t_kspoll.c b/usr/src/uts/3b2/ktli/t_kspoll.c index a0e656d..c4d81b2 100644 --- a/usr/src/uts/3b2/ktli/t_kspoll.c +++ b/usr/src/uts/3b2/ktli/t_kspoll.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kspoll.c 1.7" +#ident "@(#)ktli:ktli/t_kspoll.c 1.6" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kspoll.c 1.3 89/01/27 SMI" #endif @@ -38,8 +38,7 @@ static char sccsid[] = "@(#)t_kspoll.c 1.3 89/01/27 SMI" * a non-zero timeout, then all will be woken. * * Returns: - * 0 on success or positive error code. On - * success, "events" is set to + * -1 on failure * 0 on timeout or no events(timout = 0), * 1 if desired event has occurred * @@ -68,54 +67,55 @@ static char sccsid[] = "@(#)t_kspoll.c 1.3 89/01/27 SMI" STATIC void ktli_poll(); int -t_kspoll(tiptr, timo, waitflg, events) - register TIUSER *tiptr; - register int waitflg; - register int timo; - register int *events; +t_kspoll(tiptr, timo, waitflg) +register TIUSER *tiptr; +register int waitflg; +register int timo; { - register int s; - register struct file *fp; - register struct vnode *vp; - register struct stdata *stp; - register int timeid; - int error; - k_sigset_t sig; - sigqueue_t *sigqueue = NULL; - char cursig = 0; - sigqueue_t *curinfo = NULL; - proc_t *p = u.u_procp; - - error = 0; + register int s; + register int errs; + register struct file *fp; + register struct vnode *vp; + register struct stdata *stp; + register int timeid; + k_sigset_t sig; + sigqueue_t *sigqueue = NULL; + char cursig = 0; + sigqueue_t *curinfo = NULL; + proc_t *p = u.u_procp; + fp = tiptr->fp; vp = fp->f_vnode; stp = vp->v_stream; - if (events == NULL || waitflg != READWAIT) - return EINVAL; - again: - if (stp->sd_flag & (STRDERR|STPLEX)) - return (stp->sd_flag & STPLEX) ? EINVAL : stp->sd_rerror; - if ((RD(stp->sd_wrq))->q_first != NULL) { - *events = 1; - return 0; + if (waitflg != READWAIT) { + u.u_error = EINVAL; + return -1; } - if (timo == 0) { - *events = 0; - return 0; + errs = STRDERR|STPLEX; + if (stp->sd_flag & errs) { + u.u_error = (stp->sd_flag & STPLEX) ? EINVAL : stp->sd_rerror; + return -1; } + if ((RD(stp->sd_wrq))->q_first != NULL) + return 1; + + if (timo == 0) + return 0; + /* set timer and sleep. */ if (timo > 0) { - KTLILOG(2, "t_kspoll: timo %x\n", timo); - timeid = timeout(ktli_poll, (caddr_t)tiptr, (long)timo); + if ((timeid = timeout(ktli_poll, tiptr, timo)) < 0) { + printf("t_kspoll: Can't set timer\n"); + return -1; + } } - s = splstr(); stp->sd_flag |= RSLEEP; /* remove any pending signals before sleep */ @@ -135,17 +135,17 @@ t_kspoll(tiptr, timo, waitflg, events) /* don't need to restore saved signal if there wasn't one */ if (cursig) { /* - * restore any saved signals before any new signal: + * restore any saved signals before the new signal: * 1) put the new sig at the head of any new queue * 2) restore the old signal info before any new ones */ - if (p->p_curinfo) { - sigaddset (&p->p_sig, p->p_cursig); - if (p->p_sigqueue) { - p->p_curinfo->sq_next = p->p_sigqueue; - } - p->p_sigqueue = p->p_curinfo; + ASSERT(p->p_curinfo); + ASSERT(p->p_cursig); + sigaddset (&p->p_sig, p->p_cursig); + if (p->p_sigqueue) { + p->p_curinfo->sq_next = p->p_sigqueue; } + p->p_sigqueue = p->p_curinfo; p->p_cursig = cursig; p->p_curinfo = curinfo; if (!sigisempty(&sig)) { @@ -160,7 +160,8 @@ t_kspoll(tiptr, timo, waitflg, events) if (fp->f_count <= 1) /* shouldn't ever be < 1 */ stp->sd_flag &= ~RSLEEP; (void) splx(s); - return EINTR; + u.u_error = EINTR; + return -1; } /* restore any saved signals */ if (cursig) { @@ -179,18 +180,18 @@ t_kspoll(tiptr, timo, waitflg, events) &sig, sigqueue); } } - KTLILOG(2, "t_kspoll: pid %d, woken from sleep\n", u.u_procp->p_pid); +#ifdef KTLIDEBUG +printf("t_kspoll: pid %d, woken from sleep\n", u.u_procp->p_pid); +#endif if (timo > 0) untimeout(timeid); - if (fp->f_count <= 1) - stp->sd_flag &= ~RSLEEP; + stp->sd_flag &= ~RSLEEP; (void)splx(s); /* see if the timer expired */ if (tiptr->flags & TIME_UP) { tiptr->flags &= ~ TIME_UP; - *events = 0; return 0; } @@ -201,12 +202,12 @@ t_kspoll(tiptr, timo, waitflg, events) STATIC void ktli_poll(tiptr) - register TIUSER *tiptr; +register TIUSER *tiptr; { - register struct vnode *vp; - register struct file *fp; - register struct stdata *stp; + register struct vnode *vp; + register struct file *fp; + register struct stdata *stp; fp = tiptr->fp; vp = fp->f_vnode; @@ -220,3 +221,4 @@ ktli_poll(tiptr) + diff --git a/usr/src/uts/3b2/ktli/t_kutil.c b/usr/src/uts/3b2/ktli/t_kutil.c index 4f6470a..ec33835 100644 --- a/usr/src/uts/3b2/ktli/t_kutil.c +++ b/usr/src/uts/3b2/ktli/t_kutil.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)ktli:ktli/t_kutil.c 1.5" +#ident "@(#)ktli:ktli/t_kutil.c 1.4" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)t_kutil.c 1.2 89/01/11 SMI" #endif @@ -63,185 +63,144 @@ extern char qrunflag; /* should be in stream.h */ int tli_send(tiptr, bp, fmode) - register TIUSER *tiptr; - register mblk_t *bp; - register int fmode; +register TIUSER *tiptr; +register mblk_t *bp; +register int fmode; { - int retval; - register int s; - register struct file *fp; - register struct vnode *vp; - register struct stdata *stp; - int error; + int retval; + register int s; + register struct file *fp; + register struct vnode *vp; + register struct stdata *stp; retval = 0; - error = 0; fp = tiptr->fp; vp = fp->f_vnode; stp = vp->v_stream; s = splstr(); while (!canput(stp->sd_wrq->q_next)) { - if ((error = strwaitq(stp, WRITEWAIT, (off_t)0, fmode, + if ((u.u_error = strwaitq(stp, WRITEWAIT, (off_t)0, fmode, &retval)) || retval) { - return error; + return -1; } } (void)splx(s); putnext(stp->sd_wrq, bp); + if (qready()) + runqueues(); return 0; } int tli_recv(tiptr, bp, fmode) - register TIUSER *tiptr; - register mblk_t **bp; - register int fmode; +register TIUSER *tiptr; +register mblk_t **bp; +register int fmode; { - int retval; - register int s; - register struct file *fp; - register struct vnode *vp; - register struct stdata *stp; - int error; + int retval; + register int s; + register struct file *fp; + register struct vnode *vp; + register struct stdata *stp; retval = 0; - error = 0; fp = tiptr->fp; vp = fp->f_vnode; stp = vp->v_stream; s = splstr(); if (stp->sd_flag & (STRDERR|STPLEX)) { - error = (stp->sd_flag&STPLEX) ? EINVAL : stp->sd_rerror; + u.u_error = ((stp->sd_flag&STPLEX) ? EINVAL : stp->sd_rerror); (void)splx(s); - return error; + return -1; } while ( !(*bp = getq(RD(stp->sd_wrq)))) { - if ((error = strwaitq(stp, READWAIT, (off_t)0, fmode, + if ((u.u_error = strwaitq(stp, READWAIT, (off_t)0, fmode, &retval)) || retval) { (void)splx(s); - return error; + return -1; } } - if (stp->sd_flag) + if (stp->sd_flag) { stp->sd_flag &= ~STRPRI; + } (void)splx(s); + if (qready()) + runqueues(); + +#ifdef KTLIDEBUG +{ +mblk_t *tp; +tp = *bp; +while (tp) { + if (tp->b_datap->db_size < 0) + printf("tli_recv: tp %x, func %x\n", tp, tp->b_datap->db_frtnp->free_func); + tp = tp->b_cont; +} +} +#endif return 0; } int get_ok_ack(tiptr, type, fmode) - register TIUSER *tiptr; - register int type; - register int fmode; +register TIUSER *tiptr; +register int type, fmode; { - register int msgsz; - register union T_primitives *pptr; - mblk_t *bp; - int error; + register int msgsz, retval; + register union T_primitives *pptr; + mblk_t *bp; - error = 0; + retval = 0; /* wait for ack */ - if ((error = tli_recv(tiptr, &bp, fmode)) != 0) - return error; + if (tli_recv(tiptr, &bp, fmode) < 0) + return 1; - if ((msgsz = (bp->b_wptr - bp->b_rptr)) < sizeof(long)) - return EPROTO; + if ((msgsz = (bp->b_wptr - bp->b_rptr)) < sizeof(long)) { + u.u_error = EPROTO; + return -1; + } /* LINTED pointer alignment */ pptr = (union T_primitives *)bp->b_rptr; switch(pptr->type) { case T_OK_ACK: if (msgsz < TOKACKSZ || - pptr->ok_ack.CORRECT_prim != type) - error = EPROTO; + pptr->ok_ack.CORRECT_prim != type) { + u.u_error = EPROTO; + retval = -1; + } break; case T_ERROR_ACK: if (msgsz < TERRORACKSZ) { - error = EPROTO; + u.u_error = EPROTO; + retval = -1; break; } if (pptr->error_ack.TLI_error == TSYSERR) - error = pptr->error_ack.UNIX_error; - else error = t_tlitosyserr(pptr->error_ack.TLI_error); + u.u_error = pptr->error_ack.UNIX_error; + else u.u_error = tlitosyserr(pptr->error_ack.TLI_error); + retval = -1; break; default: - error = EPROTO; + u.u_error = EPROTO; + retval = -1; break; } - return error; -} - -/* - * Translate a TLI error into a system error as best we can. - */ -static ushort tli_errs[] = { - 0, /* no error */ - EADDRNOTAVAIL, /* TBADADDR */ - ENOPROTOOPT, /* TBADOPT */ - EACCES, /* TACCES */ - EBADF, /* TBADF */ - EADDRNOTAVAIL, /* TNOADDR */ - EPROTO, /* TOUTSTATE */ - EPROTO, /* TBADSEQ */ - 0, /* TSYSERR - will never get */ - EPROTO, /* TLOOK - should never be sent by transport */ - EMSGSIZE, /* TBADDATA */ - EMSGSIZE, /* TBUFOVFLW */ - EPROTO, /* TFLOW */ - EWOULDBLOCK, /* TNODATA */ - EPROTO, /* TNODIS */ - EPROTO, /* TNOUDERR */ - EINVAL, /* TBADFLAG */ - EPROTO, /* TNOREL */ - EOPNOTSUPP, /* TNOTSUPPORT */ - EPROTO, /* TSTATECHNG */ -}; - -int -t_tlitosyserr(terr) - register int terr; -{ - if (terr > (sizeof(tli_errs) / sizeof(ushort))) - return EPROTO; - else return tli_errs[terr]; -} - -#ifdef DEBUG -int ktlilog = 0; - -/* - * Kernel level debugging aid. The global variable "ktlilog" is a bit - * mask which allows various types of debugging messages to be printed - * out. - * - * ktlilog & 1 will cause actual failures to be printed. - * ktlilog & 2 will cause informational messages to be - * printed. - */ -int -ktli_log(level, str, a1) - register int level; - register char *str; - register int a1; - -{ - if (level & ktlilog) - printf(str, a1); + return retval; } -#endif diff --git a/usr/src/uts/3b2/master.d/emd b/usr/src/uts/3b2/master.d/emd index 76f80a0..cd64018 100644 --- a/usr/src/uts/3b2/master.d/emd +++ b/usr/src/uts/3b2/master.d/emd @@ -1,4 +1,4 @@ -*#ident "@(#)emd:master.d/emd 1.5" +*#ident "@(#)emd:master.d/emd 1.3" * * EMD 3b2 streams driver * @@ -6,9 +6,6 @@ fa 1 emd - 10 12 emd_nbds (%i) = {#C} emd_maxdev (%i) = {#D} - inetstats (%i) = {INETSTATS} emd_emd[#D] (%l%l%l%s%s%s%s) - emd_bd[#C] (%0x388) + emd_bd[#C] (%0x254) $$$ -* provide stats for internet 'netstat' cmd if INETSTATS is set -INETSTATS = 0 diff --git a/usr/src/uts/3b2/master.d/ip b/usr/src/uts/3b2/master.d/ip index 82cc904..7c65b44 100644 --- a/usr/src/uts/3b2/master.d/ip +++ b/usr/src/uts/3b2/master.d/ip @@ -1,4 +1,4 @@ -*#ident "@(#)kernel:master.d/ip 1.4" +*#ident "@(#)kernel:master.d/ip 1.1" * * * PROPRIETARY NOTICE (Combined) @@ -27,12 +27,6 @@ fs - ip - - - provider[IPPROVCNT](%116) ipcnt(%i) = {IPCNT} ipprovcnt(%i) = {IPPROVCNT} - ipforwarding(%i) = {IPFORWARDING} - ipsendredirects(%i) = {IPSENDREDIRECTS} $$ IPCNT = 8 IPPROVCNT = 16 -* if IPFORWARDING is set, hosts will act as gateways -IPFORWARDING = 0 -* if IPSENDREDIRECTS is set, gateways may send ICMP redirects -IPSENDREDIRECTS = 0 diff --git a/usr/src/uts/3b2/master.d/iuart b/usr/src/uts/3b2/master.d/iuart index 1b7166a..b4ff043 100644 --- a/usr/src/uts/3b2/master.d/iuart +++ b/usr/src/uts/3b2/master.d/iuart @@ -1,7 +1,7 @@ -*#ident "@(#)kernel:master.d/iuart 1.8" +*#ident "@(#)kernel:master.d/iuart 1.7" * * IUART * *FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES orsnf13 1 iu 0 2 13 - iu_tty[2] (%0x50) + iu_tty[2] (%0x4c) diff --git a/usr/src/uts/3b2/master.d/kernel b/usr/src/uts/3b2/master.d/kernel index ae3c195..b3c8efd 100644 --- a/usr/src/uts/3b2/master.d/kernel +++ b/usr/src/uts/3b2/master.d/kernel @@ -1,4 +1,4 @@ -*#ident "@(#)kernel:master.d/kernel 1.72" +*#ident "@(#)kernel:master.d/kernel 1.56.1.1" * * KERNEL * @@ -8,14 +8,17 @@ none - - - - - ={ &cinit, &binit, - &vfsinit, + &fsinit, &finit, &strinit, &debuginit, &aioinit, 0} + buf[NBUF] (%0x58) pbuf[NPBUF] (%0x58) hbuf[NHBUF] (%0x10) + nproc[NPROC] (%0x4) + pincr[NPROC] (%0x8) callout[NCALL] (%0x10) sptmap[SPTMAP] (%0x8) putbuf[PUTBUFSZ] (%c) @@ -26,7 +29,7 @@ none - - - - - ={NBUF, NCALL, NPROC, - 0, + &nproc+NPROC*#nproc, 0, MAXCLSYSPRI, NCLIST, @@ -63,13 +66,13 @@ none - - - - - *tuneable.h tune(%i%i%i%i%i%i%i%i%i%i%i) ={ GPGSLO, + GPGSHI, 0, 0, 0, 0, 0, - 0, - 0, + MAXUMEM, FSFLUSHR, MINARMEM, MINASMEM @@ -78,8 +81,8 @@ none - - - - - exec_ncargs(%i) = {ARG_MAX} * file and record locking * - flckinfo(%l%l) - = {0, 0} + flckinfo(%l%l%l%l) + = {FLCKREC} * shared libraries * shlbinfo(%l%l%l%l) = {SHLBMAX, 0, 0, 0} @@ -99,7 +102,7 @@ none - - - - - * sysinfo architecture(%6c%c) ={ARCHITECTURE,0} - hw_serial(%1c%c) + hw_serial(%13c%c) ={HW_SERIAL,0} hw_provider(%4c%c) ={HW_PROVIDER,0} @@ -110,7 +113,6 @@ none - - - - - nstrpush (%i) ={NSTRPUSH} strmsgsz (%i) ={STRMSGSZ} strctlsz (%i) ={STRCTLSZ} - strthresh(%l) ={STRTHRESH} * Multiple groups and chown(2) restrictions rstchown (%i) = { RSTCHOWN } @@ -129,20 +131,17 @@ none - - - - - * state of locore trapping s3btlc_state (%i) = { S3BTLC_DISABLE } -* head of inet statistics list - ifstats (%l) - $$$ -SYS ="UNIX_System_V" +SYS ="UNIX System V" NODE ="unix" REL = "4.0" VER = "2" ARCHITECTURE="m32100" -HW_SERIAL="" +HW_SERIAL="serial number" HW_PROVIDER="AT&T" -SRPC_DOMAIN="" +SRPC_DOMAIN="rpcdomain" * * The following entries form the tunable parameter table. @@ -156,7 +155,7 @@ NCLIST = 0 * The following stuff is for streams. NSTRPUSH = 9 -STRCTLSZ = 1024 +STRCTLSZ = 9000 * * strmsgsz is the size for the maximum streams message a user can create. @@ -165,14 +164,6 @@ STRCTLSZ = 1024 * STRMSGSZ = 0 -* -* strthresh is a cap to the amount of dynamic memory that the -* streams subsystem can consume. Once passed, pushes, opens of -* streams devices, and writes will fail for non-root processes. -* strthresh is in bytes; a value of 0 means no limit -* -STRTHRESH = 0 - * maxup is the maximum number of processes per user MAXUP = 25 @@ -182,6 +173,10 @@ MAXUP = 25 NHBUF = 64 NPBUF = 20 +* File region locking + +FLCKREC = 100 + * Shared Libraries: Maximum number of libraries that can be * attached to a process at one time. @@ -189,7 +184,7 @@ SHLBMAX = 2 * Delay for delayed writes -NAUTOUP = 60 +NAUTOUP = 10 * default per process resource limits (set to -1 for infinite limits) * -1 is an infinite limit @@ -219,9 +214,11 @@ HVMMLIM = 0x1000000 * added for paging -SPTMAP = 100 +SPTMAP = 50 MAXPMEM = 0 GPGSLO = 25 +GPGSHI = 40 +MAXUMEM = 8192 FSFLUSHR = 1 MINARMEM = 25 MINASMEM = 25 @@ -244,8 +241,8 @@ SYS_NAME = "SYS" INITCLASS = "TS" * XENIX Tunables for shared data -XSDSEGS = 25 -XSDSLOTS = 3 +XSDSEGS = 0 +XSDSLOTS = 0 * Buffer cache tunables BUFHWM = 200 diff --git a/usr/src/uts/3b2/master.d/nfs b/usr/src/uts/3b2/master.d/nfs index 602f0ea..cd5f71b 100644 --- a/usr/src/uts/3b2/master.d/nfs +++ b/usr/src/uts/3b2/master.d/nfs @@ -1,4 +1,4 @@ -*#ident "@(#)kernel:master.d/nfs 1.4" +*#ident "@(#)kernel:master.d/nfs 1.2" * * * PROPRIETARY NOTICE (Combined) diff --git a/usr/src/uts/3b2/master.d/opts b/usr/src/uts/3b2/master.d/opts new file mode 100644 index 0000000..76e84ad --- /dev/null +++ b/usr/src/uts/3b2/master.d/opts @@ -0,0 +1,10 @@ +#ident "@(#)kernel:master.d/opts 1.1" +* +* PTTY - slave half driver +* +*FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES +ocs - pts 26 10 - + pts_cnt(%i) ={NPTTY} + pts_tty[NPTTY] (%0x58) +$$$ +NPTTY = 10 diff --git a/usr/src/uts/3b2/master.d/ports b/usr/src/uts/3b2/master.d/ports index d3443f2..55e2cd2 100644 --- a/usr/src/uts/3b2/master.d/ports +++ b/usr/src/uts/3b2/master.d/ports @@ -18,4 +18,4 @@ af 1 npp - 5 10 nsv_expq_unload[#C] (%i) $$$ -SAVEXP = 125 +SAVEXP = 5 diff --git a/usr/src/uts/3b2/master.d/ptc b/usr/src/uts/3b2/master.d/ptc new file mode 100644 index 0000000..9daa662 --- /dev/null +++ b/usr/src/uts/3b2/master.d/ptc @@ -0,0 +1,6 @@ +*#ident "@(#)kernel:master.d/ptc 1.1" +* +* PTTY - controlling half driver +* +*FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES +ocs - ptc 25 10 - diff --git a/usr/src/uts/3b2/master.d/rfs b/usr/src/uts/3b2/master.d/rfs index cbb0546..ed43031 100644 --- a/usr/src/uts/3b2/master.d/rfs +++ b/usr/src/uts/3b2/master.d/rfs @@ -1,9 +1,10 @@ -*#ident "@(#)fs:master.d/rfs 1.9" +*#ident "@(#)fs:master.d/rfs 1.8" * * RFS * *FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES oxj - rf_ - - - + rf_flag(%l) ={FLAGRFS} rf_name(%12c)= {NAMERFS} nsrmount (%i) ={ NSRMOUNT } nrcvd (%i) ={ NRCVD } @@ -12,10 +13,13 @@ oxj - rf_ - - - minserve (%i) ={ MINSERVE } maxserve (%i) ={ MAXSERVE } nrduser (%i) ={ NRDUSER } + rfs_vhigh (%i) = { RFS_VHIGH } + rfs_vlow (%i) = { RFS_VLOW } rc_time (%i) ={ RCACHETIME } $$$ +FLAGRFS = 1 NAMERFS = "RFS" NSRMOUNT = 20 MAXGDP = 24 @@ -24,4 +28,6 @@ NRDUSER = 250 NSNDD = 150 MINSERVE = 3 MAXSERVE = 6 +RFS_VHIGH = 2 +RFS_VLOW = 1 RCACHETIME = 10 diff --git a/usr/src/uts/3b2/master.d/shm b/usr/src/uts/3b2/master.d/shm index 8c1af79..08cc140 100644 --- a/usr/src/uts/3b2/master.d/shm +++ b/usr/src/uts/3b2/master.d/shm @@ -1,4 +1,4 @@ -*#ident "@(#)kernel:master.d/shm 1.3" +*#ident "@(#)kernel:master.d/shm 1.2" * * SHM * @@ -12,11 +12,12 @@ ox - shm - - - ipc shmtext(){} shmem[SHMMNI] (%0x70) shmmap[SHMMNI/2+2] (%l%l) - shminfo(%i%i%i%i) + shminfo(%i%i%i%i%i) ={SHMMAX, SHMMIN, SHMMNI, - SHMSEG} + SHMSEG, + SHMALL} $$$ @@ -25,3 +26,4 @@ SHMMAX = 131072 SHMMIN = 1 SHMMNI = 100 SHMSEG = 6 +SHMALL = 512 diff --git a/usr/src/uts/3b2/master.d/sockmod b/usr/src/uts/3b2/master.d/sockmod index 4949113..996a742 100644 --- a/usr/src/uts/3b2/master.d/sockmod +++ b/usr/src/uts/3b2/master.d/sockmod @@ -1,9 +1,30 @@ -*#ident "@(#)kernel:master.d/sockmod 1.4" +*#ident "@(#)kernel:master.d/sockmod 1.2" +* +* +* PROPRIETARY NOTICE (Combined) +* +* This source code is unpublished proprietary information +* constituting, or derived under license from AT&T's Unix(r) System V. +* In addition, portions of such source code were derived from Berkeley +* 4.3 BSD under license from the Regents of the University of +* California. +* +* +* +* Copyright Notice +* +* Notice of copyright on this source code product does not indicate +* publication. +* +* (c) 1986,1987,1988,1989 Sun Microsystems, Inc. +* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. +* All rights reserved. +* * * SOCKMOD Socket module * *FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES m - sock - so_so[#C] (%0xb8) + so_so[#C] (%0x88) so_cnt (%i) = { #C } $$ diff --git a/usr/src/uts/3b2/master.d/stubs b/usr/src/uts/3b2/master.d/stubs index b7ee96b..08fddba 100644 --- a/usr/src/uts/3b2/master.d/stubs +++ b/usr/src/uts/3b2/master.d/stubs @@ -1,4 +1,4 @@ -*#ident "@(#)kernel:master.d/stubs 1.30" +*#ident "@(#)kernel:master.d/stubs 1.29" * * STUBS * Used to define all functions referenced in the kernel @@ -103,4 +103,3 @@ ox nfssys(){nopkg} getcoffshlibs(){nopkg} coffexec_err(){} - nm_unmountall(){nopkg} diff --git a/usr/src/uts/3b2/master.d/tcp b/usr/src/uts/3b2/master.d/tcp index c1bef5a..e8c0716 100644 --- a/usr/src/uts/3b2/master.d/tcp +++ b/usr/src/uts/3b2/master.d/tcp @@ -1,4 +1,4 @@ -*#ident "@(#)kernel:master.d/tcp 1.4" +*#ident "@(#)kernel:master.d/tcp 1.1" * * * PROPRIETARY NOTICE (Combined) @@ -23,11 +23,11 @@ * *FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES fs - tcp - - - - tcp_debug[TCPDEBUG](%0xe4) tcp_dev[(NTCP+7)/8](%c) - tcp_ndebug(%i) = {TCPDEBUG} + tcpalldebug(%i) = {TCPALLDEBUG} + net_tcpwindow(%i) = {TCPWINDOW} ntcp(%i) = {NTCP} $$ +TCPALLDEBUG = 1 +TCPWINDOW = 0 NTCP = 512 -* make TCPDEBUG same size as NTCP to enable debugging via trpt -TCPDEBUG = 4 diff --git a/usr/src/uts/3b2/master.d/xnamfs b/usr/src/uts/3b2/master.d/xnamfs index c70fc29..5a6513b 100644 --- a/usr/src/uts/3b2/master.d/xnamfs +++ b/usr/src/uts/3b2/master.d/xnamfs @@ -1,4 +1,4 @@ -*#ident "@(#)fs:master.d/xnamfs 1.4" +*#ident "@(#)fs:master.d/xnamfs 1.3" * * SPECFS * @@ -14,4 +14,4 @@ oxj - xnam - - - $$$ NAMEXNAM = "xnamfs" -XSEMMAX = 60 +XSEMMAX = 0 diff --git a/usr/src/uts/3b2/mk.fastsys b/usr/src/uts/3b2/mk.fastsys new file mode 100644 index 0000000..cd8b6e8 --- /dev/null +++ b/usr/src/uts/3b2/mk.fastsys @@ -0,0 +1,49 @@ +#ident "@(#)kernel:mk.fastsys 1.1" +i=`id` +prog=`basename $0 mk` +mver=`echo $prog | cut -c4-7` +inc=`pwd` + +ENV3B2=/xe/3b2sgs/2.0p/p2/bin + +: ${MORECPP:=-DDEBUG} + +if [ $# -gt 0 ] +then + eval $* +fi + +ver= +dat=`date +%m%d` +for i in "" a b c d e f g h i j k l m n o p q r s t u v w x y z +do + if [ ! -r kernel$dat$i ] + then + ver=$dat$i + break + fi +done +if [ x$ver = x ] +then + echo Too many systems! + exit 1 +fi + +ln unix.${mver}.mk unix.mk +if [ $mver != "noio" ] +then + ln io/io.${mver}.mk io/io.mk +fi + +ln fs/fs.${mver}.mk fs/fs.mk +echo Making kernel$ver + +if u3b +then + PATH=$ENV3B2:$PATH $ENV3B2/make MORECPP=${MORECPP} \ + INC=$inc VER=$ver -e -f unix.${mver}.mk +else + make MORECPP=${MORECPP} INC=$inc VER=$ver -f unix.${mver}.mk +fi + +echo Done diff --git a/usr/src/uts/3b2/mk.fullsys b/usr/src/uts/3b2/mk.fullsys new file mode 100644 index 0000000..1a16aed --- /dev/null +++ b/usr/src/uts/3b2/mk.fullsys @@ -0,0 +1,49 @@ +#ident "@(#)kernel:mk.fullsys 1.2" +i=`id` +prog=`basename $0 mk` +mver=`echo $prog | cut -c4-7` +inc=`pwd` + +ENV3B2=/xe/3b2sgs/2.0p/p2/bin + +: ${MORECPP:=-DDEBUG} + +if [ $# -gt 0 ] +then + eval $* +fi + +ver= +dat=`date +%m%d` +for i in "" a b c d e f g h i j k l m n o p q r s t u v w x y z +do + if [ ! -r kernel$dat$i ] + then + ver=$dat$i + break + fi +done +if [ x$ver = x ] +then + echo Too many systems! + exit 1 +fi + +ln unix.${mver}.mk unix.mk +if [ $mver != "noio" ] +then + ln io/io.${mver}.mk io/io.mk +fi + +ln fs/fs.${mver}.mk fs/fs.mk +echo Making kernel$ver + +if u3b +then + PATH=$ENV3B2:$PATH $ENV3B2/make MORECPP=${MORECPP} \ + INC=$inc VER=$ver -e -f unix.${mver}.mk +else + make MORECPP=${MORECPP} INC=$inc VER=$ver -f unix.${mver}.mk +fi + +echo Done diff --git a/usr/src/uts/3b2/ml/cdump.c b/usr/src/uts/3b2/ml/cdump.c index 3f8e4ad..b7fcf35 100644 --- a/usr/src/uts/3b2/ml/cdump.c +++ b/usr/src/uts/3b2/ml/cdump.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:ml/cdump.c 1.10" +#ident "@(#)kernel:ml/cdump.c 1.9" #include "sys/sbd.h" #include "sys/types.h" @@ -426,8 +426,9 @@ cdump() /* SPMEM is start of kernel text */ - crash_iptr = (int *)SPMEM - howmany(CHDR_OFFSET, sizeof(int *)); - *((struct crash_hdr *) crash_iptr) = crash_hdr; /* structure copy */ + bcopy((caddr_t)&crash_hdr, + (char *)SPMEM - CHDR_OFFSET, + sizeof(struct crash_hdr)); crash_iptr = (int *)SPMEM - howmany(CHDR_OFFSET, sizeof(int *)) diff --git a/usr/src/uts/3b2/ml/gate.c b/usr/src/uts/3b2/ml/gate.c index 1bd00c8..87df840 100644 --- a/usr/src/uts/3b2/ml/gate.c +++ b/usr/src/uts/3b2/ml/gate.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:ml/gate.c 1.27" +#ident "@(#)kernel:ml/gate.c 1.21" #include "sys/types.h" #include "sys/psw.h" @@ -314,7 +314,18 @@ struct kpcb *Ivect[256] = { extern int Xsyscall(); -struct gate_l2 gates[142] ={ { GPSW, Xsyscall }, +struct gate_l2 gates[153] ={ { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, + { GPSW, Xsyscall }, { GPSW, Xsyscall }, { GPSW, Xsyscall }, { GPSW, Xsyscall }, @@ -500,18 +511,7 @@ struct gate_l2 gaten ={ GPSW, nrmx_YY }; * The structure is static, since no one else needs to * know it is here. */ -struct gate_l2 gatefiller[207] = { {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, - {GPSW, nrmx_YY}, +struct gate_l2 gatefiller[196] = { {GPSW, nrmx_YY}, {GPSW, nrmx_YY}, {GPSW, nrmx_YY}, {GPSW, nrmx_YY}, diff --git a/usr/src/uts/3b2/ml/misc.s b/usr/src/uts/3b2/ml/misc.s index e8ab620..2e70445 100644 --- a/usr/src/uts/3b2/ml/misc.s +++ b/usr/src/uts/3b2/ml/misc.s @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)kernel:ml/misc.s 1.23" +#ident "@(#)kernel:ml/misc.s 1.19" # The following sets are used in icode. @@ -16,7 +16,7 @@ .set u_caddrflt,0x130 # Offset to u_caddrflt in u-block. .set u_procp, 0x4e4 # Offset to u_procp in u-block. .set u_flist, 0x6e4 # Offset to u_flist in u-block. - .set p_sysid, 0x88 # Offset to p_sysid in proc table. + .set p_sysid, 0x8c # Offset to p_sysid in proc table. .text # @@ -305,7 +305,7 @@ kzero: MOVAW bzeroflt,u+u_caddrflt # set up ours MOVW 0(%ap),%r1 # %r1 = addr MOVW 4(%ap),%r0 # %r0 = len - BEH bzdone +# BEH bzdone # shouldn't be needed bzalgn: # align addr to word boundary BITW &3,%r1 # if (addr is word aligned) BEB bzwrds # goto word zero section; @@ -1440,7 +1440,7 @@ kplenerr: # # This code is the init process; it is copied to user text space -# and it then does exec( "/sbin/init", "/sbin/init", 0 ); +# and it then does exec( "/etc/init", "/etc/init", 0 ); # .data .align 4 @@ -1464,7 +1464,7 @@ icode: MOVW %sp,%fp # Init frame pointer to empty stack. MOVAW u+u_pcb,u+u_pcbp # Set ptr to current pcb. - PUSHAW sbin_off(%r0) # address of sbin_init + PUSHAW etc_off(%r0) # address of etc_init PUSHAW argv_off(%r0) # argv[] array CALL -8(%sp),icode1_off(%r0) # call icode1 @@ -1472,19 +1472,19 @@ icode1: .set icode1_off,.-icode MOVW &4,%r0 MOVW &_exec,%r1 - GATE # exec( "/sbin/init", argv ) + GATE # exec( "/etc/init", argv ) icode2: BRB icode2 .align 4 argv: # argv area .set argv_off,.-icode - .word UVTEXT+sbin_off + .word UVTEXT+etc_off .word 0 -sbin_init: # /sbin/init - .set sbin_off,.-icode - .byte 0x2f,0x73,0x62,0x69,0x6e,0x2f,0x69,0x6e,0x69,0x74,0 +etc_init: # /etc/init + .set etc_off,.-icode + .byte 0x2f,0x65,0x74,0x63,0x2f,0x69,0x6e,0x69,0x74,0 icode_end: .data @@ -1857,19 +1857,3 @@ uslbaddr: MOVW &-1, %r0 # return error (-1) on ret &0 -# -# void -# setintret(pc) -# tmp = isp - 4; -# (struct pcb *)(*tmp)->pc = pc; -# -# - -.set pcb_pc, 4 # Offset to pc in pcb - -.globl setintret - -setintret: - MOVW -4(%isp), %r0 - MOVW 0(%ap), pcb_pc(%r0) - RET diff --git a/usr/src/uts/3b2/ml/pstart.c b/usr/src/uts/3b2/ml/pstart.c index db0b6ff..2b654f1 100644 --- a/usr/src/uts/3b2/ml/pstart.c +++ b/usr/src/uts/3b2/ml/pstart.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:ml/pstart.c 1.12" +#ident "@(#)kernel:ml/pstart.c 1.11" #include "sys/types.h" #include "sys/psw.h" @@ -47,11 +47,15 @@ extern void cdump(); struct pcb phys_pcb = { KPSW0, 0, 0, 0, 0, {0,0,0,0,0,0,0,0,0,0,0}, 0}; /* - * These addresses are set by cunix - * based on the addresses indicated in the COFF - * ifile or ELF mapfile. + * Virtual addresses */ + /* + ** These addresses are set by cunix + ** based on the addresses indicated in the COFF + ** ifile or ELF mapfile. + */ + int sgate = 0x0; int sboot = 0x0; int stext = 0x0; @@ -96,10 +100,9 @@ STATIC int crashsw = 0; /* software switch for crash dump dump may be made */ -/* - * Physical start-up routine; this routine is the very first C routine - * executed immediately after control is transferred to SPMEM from boot. - */ +/* Physical start-up routine; this routine is the very first C routine +** executed immediately after control is transferred to SPMEM from boot. +*/ void pstart() @@ -116,8 +119,8 @@ pstart() struct user *pu; /* - * Set the physical addresses - */ + ** Set the physical addresses + */ Sgate = (((sboot + 2047 >> 11) + (((int)bootSIZE + 2047) >> 11)) << 11); @@ -129,23 +132,27 @@ pstart() Ebss = Sbss + (int)bssSIZE -1; END = Sbss + (int)bssSIZE - 1; - if (SERNO->serial0 > 0xB && SERNO->serial0 < 0x20 - && ((int)SERNO) == 0xfff0) - P_SYMTELL((char *)Sdata + ((char *)&sys3bsym - (char *)sdata)); + /* check to see if this is the second time this point + has been reached since boot. If so, generate a crash dump */ - /* - * Check to see if this is the second time this point - * has been reached since boot. If so, generate a crash dump. - */ - - if (crashsw == 1) { /* generate crash dump */ + if (crashsw == 1) + { /* generate crash dump */ cdump(); /* return to firmware control */ RUNFLG = REENTRY; RST = ON; - } else { /* first time */ + } + + else /* first time */ + { crashsw = 1; + if (SERNO->serial0 > 0xB && SERNO->serial0 < 0x20 && + ((int)SERNO) == 0xfff0) + P_SYMTELL((char *)Sdata + + ((char *)&sys3bsym - + (char *)sdata)); + /* set runflag in case of hw reset */ RUNFLG = FATAL; @@ -161,19 +168,17 @@ pstart() - /* - * Clear mmu configuration register so that ste - * reference and modify bits are mot set. - */ + /* Clear mmu configuration register so that ste + ** reference and modify bits are mot set. + */ *(int *)&mmucr = 0; *(int *)&mmufltcr = 0; *(int *)&mmufltar = 0; - /* - * The first available free memory after the kernel - * .bss section - */ + /* The first available free memory after the kernel + ** .bss section + */ mmst = btoc(END); @@ -353,7 +358,7 @@ pstart() } STATIC void -mmusetup(vaddr, paddr, clks, prot, valid) +mmusetup(vaddr,paddr,clks,prot,valid) int vaddr, paddr, clks, prot, valid; { register sde_t *sde; @@ -395,19 +400,22 @@ int vaddr, paddr, clks, prot, valid; } } -/* Zero a word aligned area of memory. We can't use - * the bzero routine because it is in the virtual - * address space which isn't mapped yet. - * - * wzero(adr, byte_count); - */ +/* Zero a word aligned area of memory. We can't use +** the bzero routine because it is in the virtual +** address space which isn't mapped yet. +** +** wzero(adr, byte_count); +*/ STATIC void wzero(ptr, count) - register int *ptr; - register int count; +register int *ptr; +register int count; { - count >>= 2; /* Convert byte count to words. */ + /* Convert byte count to words. + */ + + count >>= 2; while (count--) *ptr++ = 0; diff --git a/usr/src/uts/3b2/ml/ttrap.s b/usr/src/uts/3b2/ml/ttrap.s index b78bf9e..35e4d9a 100644 --- a/usr/src/uts/3b2/ml/ttrap.s +++ b/usr/src/uts/3b2/ml/ttrap.s @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. - .ident "@(#)kernel:ml/ttrap.s 1.29" + .ident "@(#)kernel:ml/ttrap.s 1.25" # # NOTE -- CHANGES TO USER.H, PROC.H AND CLASS.H MAY REQUIRE # CORRESPONDING CHANGES TO THE FOLLOWING .SETs. @@ -31,8 +31,8 @@ .set u_fpovr,0x4ac # offset of u_fpovr .set u_procp,0x4e4 # offset of u_procp .set u_tracepc,0x1cc # offset to u_tracepc - .set p_clproc,0xe0 # offset to p_clproc - .set p_clfuncs,0xe4 # offset to p_clfuncs + .set p_clproc,0xe4 # offset to p_clproc + .set p_clfuncs,0xe8 # offset to p_clfuncs .set cl_trapret,0x4c # offset to cl_trapret in classfuncs struct .set PSW_TE,0x20000 # TM bit in psw. @@ -538,8 +538,7 @@ nrmx_ilc: signal_ilc: PUSHAW -sigframe(%sp) # push address of user context - PUSHW -20(%sp) # push possibly corrected pc value - CALL -8(%sp),retsig # restore user context after RETG + CALL -4(%sp),retsig # restore user context after RETG MOVW %r0,%ap # returns AP at time of sendsig ilcskip: @@ -549,16 +548,9 @@ ilcskip: ORW2 &0x00000080,u+u_ipcb+u_psw # I=1 TSTW u+u_fpovr # user trapping on ovrflow ? - BEB check_oe # branch if not. - ORW2 &0x00400000,u+u_ipcb+u_psw # restore OE bit + BEB nrmx_ilc2 # branch if not. -# Chip bug work-around: if the OE bit is on, the V bit must be -# off. Otherwise the chip will get upset and UNIX will panic -# with a process exception. -# -check_oe: - BITW &0x00400000,u+u_ipcb+u_psw # is the OE bit on ? - BEB nrmx_ilc2 # branch if not + ORW2 &0x00400000,u+u_ipcb+u_psw # restore OE bit ANDW2 &0xfff7ffff,u+u_ipcb+u_psw # Turn off V bit. # The following label must be immediately before the TSTB @@ -685,12 +677,6 @@ Xsyscall: # +---------------+ # | rest of stack | # - .data - .align 4 -nrmx_pcb: - .word 16 - - .text .globl nrmx_KK @@ -705,32 +691,7 @@ nrmx_KK: # normal exception while on kernel stack # r0ptr[PS] == PSW. CALL -4(%sp),k_trap - jz nrmx_KK_ok - - MOVW -5*4(%sp), nrmx_pcb+0x00 # psw - MOVW -6*4(%sp), nrmx_pcb+0x04 # pc - MOVAW -6*4(%sp), nrmx_pcb+0x08 # sp - MOVW %ap, nrmx_pcb+0x14 # ap - MOVW %fp, nrmx_pcb+0x18 # fp - MOVW -3*4(%sp), nrmx_pcb+0x1c # r0 - MOVW -2*4(%sp), nrmx_pcb+0x20 # r1 - MOVW -1*4(%sp), nrmx_pcb+0x24 # r2 - MOVW %r3, nrmx_pcb+0x28 - MOVW %r4, nrmx_pcb+0x2c - MOVW %r5, nrmx_pcb+0x30 - MOVW %r6, nrmx_pcb+0x34 - MOVW %r7, nrmx_pcb+0x38 - MOVW %r8, nrmx_pcb+0x3c - - MOVAW nrmx_pcb+0x1c, save_r0ptr - - PUSHW -0x14(%sp) # push saved PSW - CALL -4(%sp),krnlflt - -# don't expect krnlflt to ever return - -nrmx_KK_ok: POPW %r2 # restore user registers POPW %r1 POPW %r0 diff --git a/usr/src/uts/3b2/net/if.h b/usr/src/uts/3b2/net/if.h index 9a29ef4..80de48f 100644 --- a/usr/src/uts/3b2/net/if.h +++ b/usr/src/uts/3b2/net/if.h @@ -8,7 +8,7 @@ #ifndef _NET_IF_H #define _NET_IF_H -#ident "@(#)head.sys:sys/net/if.h 1.3" +#ident "@(#)head.sys:sys/net/if.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -68,7 +68,7 @@ * (Would like to call this struct ``if'', but C isn't PL/1.) */ struct ifnet { - char *if_name; /* name, e.g. ``emd'' or ``lo'' */ + char *if_name; /* name, e.g. ``en'' or ``lo'' */ short if_unit; /* sub-unit for lower level driver */ short if_mtu; /* maximum transmission unit */ short if_flags; /* up/down, broadcast, etc. */ @@ -236,7 +236,7 @@ struct ifaddr { */ struct ifreq { #define IFNAMSIZ 16 - char ifr_name[IFNAMSIZ]; /* if name, e.g. "emd1" */ + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; diff --git a/usr/src/uts/3b2/netinet/arp.c b/usr/src/uts/3b2/netinet/arp.c index c40ffc5..98bd083 100644 --- a/usr/src/uts/3b2/netinet/arp.c +++ b/usr/src/uts/3b2/netinet/arp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/arp.c 1.5" +#ident "@(#)netinet:netinet/arp.c 1.4" /* * System V STREAMS TCP - Release 2.0 @@ -684,8 +684,8 @@ arpuwput(q, bp) lp = (struct linkblk *) bp->b_cont->b_rptr; for (i = 0; i < N_ARP; i++) { - if (arp_pcb[i].arp_qtop && - arp_pcb[i].arp_index == lp->l_index) { + if (arp_pcb[i].arp_qtop == RD(q) + && arp_pcb[i].arp_index == lp->l_index) { ar = (struct arp_pcb *) & arp_pcb[i]; break; } diff --git a/usr/src/uts/3b2/netinet/in.c b/usr/src/uts/3b2/netinet/in.c index b1a28b0..ebecc85 100644 --- a/usr/src/uts/3b2/netinet/in.c +++ b/usr/src/uts/3b2/netinet/in.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/in.c 1.4" +#ident "@(#)netinet:netinet/in.c 1.3" /* * System V STREAMS TCP - Release 2.0 @@ -88,7 +88,7 @@ extern struct ip_provider provider[]; extern struct ip_pcb ip_pcb[]; extern struct ip_provider *lastprov; -extern struct ifstats *ifstats; /* from /etc/master.d/kernel */ +struct ifstats *ifstats; inet_hash(in, hp) struct in_addr in; diff --git a/usr/src/uts/3b2/netinet/in.h b/usr/src/uts/3b2/netinet/in.h index 9c28274..8cffa46 100644 --- a/usr/src/uts/3b2/netinet/in.h +++ b/usr/src/uts/3b2/netinet/in.h @@ -8,7 +8,7 @@ #ifndef _NETINET_IN_H #define _NETINET_IN_H -#ident "@(#)head.sys:sys/netinet/in.h 1.3" +#ident "@(#)head.sys:sys/netinet/in.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -191,17 +191,14 @@ struct sockaddr_in { }; /* - * The transport providers allow any address length between - * IN_MINADDRLEN and IN_MAXADDRLEN. The minimum length corresponds to - * a sockaddr_in without the sin_zero field. The maximum length is - * the size of the sockaddr_in structure. - * - * in_chkaddrlen returns true if the given length is valid. + * Internet address structure used by transport provider + * (use this format with TLI) */ - -#define IN_MINADDRLEN (sizeof(struct sockaddr_in) - 8) -#define IN_MAXADDRLEN (sizeof(struct sockaddr_in)) -#define in_chkaddrlen(x) ((x) >= IN_MINADDRLEN && (x) <= IN_MAXADDRLEN) +struct taddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; +}; /* * Options for use with [gs]etsockopt at the IP level. diff --git a/usr/src/uts/3b2/netinet/in_pcb.c b/usr/src/uts/3b2/netinet/in_pcb.c index 0abdb14..f5b68f8 100644 --- a/usr/src/uts/3b2/netinet/in_pcb.c +++ b/usr/src/uts/3b2/netinet/in_pcb.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/in_pcb.c 1.7" +#ident "@(#)netinet:netinet/in_pcb.c 1.4" /* * System V STREAMS TCP - Release 2.0 @@ -116,7 +116,7 @@ in_pcbbind(inp, nam) mblk_t *nam; { register struct inpcb *head = inp->inp_head; - register struct sockaddr_in *sin; + register struct taddr_in *sin; u_short lport = 0; if (inp->inp_lport || inp->inp_laddr.s_addr != INADDR_ANY) @@ -125,7 +125,7 @@ in_pcbbind(inp, nam) STRLOG(IPM_ID, 1, 5, SL_TRACE, "null in_pcbbind"); goto noname; } - sin = (struct sockaddr_in *) nam->b_rptr; + sin = (struct taddr_in *) nam->b_rptr; if ((nam->b_wptr - nam->b_rptr) < sizeof(*sin)) return (EINVAL); STRLOG(IPM_ID, 1, 6, SL_TRACE, "in_pcbbind port %d addr %x", @@ -184,11 +184,9 @@ in_pcbconnect(inp, nam) { register struct ip_provider *prov; struct ip_provider *first_prov = (struct ip_provider *) NULL, tempprov; - register struct sockaddr_in *sin = (struct sockaddr_in *) nam->b_rptr; - int len; + register struct taddr_in *sin = (struct taddr_in *) nam->b_rptr; - len = nam->b_wptr - nam->b_rptr; - if (!in_chkaddrlen(len)) + if ((nam->b_wptr - nam->b_rptr) != sizeof(*sin)) return (EINVAL); if (sin->sin_family != AF_INET) return (EAFNOSUPPORT); @@ -249,9 +247,9 @@ in_pcbconnect(inp, nam) */ ro = &inp->inp_route; if (ro->ro_rt && - (satosin(&ro->ro_dst)->sin_addr.s_addr != - sin->sin_addr.s_addr || - inp->inp_protoopt & SO_DONTROUTE)) { + satosin(&ro->ro_dst)->sin_addr.s_addr != + sin->sin_addr.s_addr || + inp->inp_protoopt & SO_DONTROUTE) { RTFREE(ro->ro_rt); ro->ro_rt = (mblk_t *) 0; } @@ -298,14 +296,14 @@ in_pcbconnect(inp, nam) inp->inp_laddr = *PROV_INADDR(prov); } if (inp->inp_laddr.s_addr == INADDR_ANY) { - mblk_t *bp = allocb(sizeof(struct sockaddr_in), BPRI_HI); - struct sockaddr_in *sin1 = (struct sockaddr_in *) bp->b_rptr; + mblk_t *bp = allocb(sizeof(struct taddr_in), BPRI_HI); + struct taddr_in *sin1 = (struct taddr_in *) bp->b_rptr; int error; if (bp == (mblk_t *) NULL) { return (ENOSR); } - bp->b_wptr += sizeof(struct sockaddr_in); + bp->b_wptr += sizeof(struct taddr_in); sin1->sin_family = AF_INET; sin1->sin_addr = *PROV_INADDR(prov); sin1->sin_port = inp->inp_lport; @@ -351,7 +349,7 @@ in_setsockaddr(inp, nam) register struct inpcb *inp; mblk_t *nam; { - register struct sockaddr_in *sin = (struct sockaddr_in *) nam->b_rptr; + register struct taddr_in *sin = (struct taddr_in *) nam->b_rptr; nam->b_wptr = nam->b_rptr + sizeof(*sin); bzero((caddr_t) sin, sizeof(*sin)); @@ -364,7 +362,7 @@ in_setpeeraddr(inp, nam) register struct inpcb *inp; mblk_t *nam; { - register struct sockaddr_in *sin = (struct sockaddr_in *) nam->b_rptr; + register struct taddr_in *sin = (struct taddr_in *) nam->b_rptr; nam->b_wptr = nam->b_rptr + sizeof(*sin); bzero((caddr_t) sin, sizeof(*sin)); @@ -380,7 +378,7 @@ in_setpeeraddr(inp, nam) */ in_pcbnotify(head, dst, errno, notify) struct inpcb *head; - register struct sockaddr_in *dst; + register struct taddr_in *dst; int errno, (*notify) (); { register struct inpcb *inp, *oinp; diff --git a/usr/src/uts/3b2/netinet/in_switch.c b/usr/src/uts/3b2/netinet/in_switch.c index 6839518..7153918 100644 --- a/usr/src/uts/3b2/netinet/in_switch.c +++ b/usr/src/uts/3b2/netinet/in_switch.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/in_switch.c 1.5" +#ident "@(#)netinet:netinet/in_switch.c 1.4" /* * System V STREAMS TCP - Release 2.0 @@ -87,7 +87,7 @@ #include #define mtod(m,t) ((t)((m)->b_rptr)) -/* #define ATOL(sa) (((struct sockaddr_in *)(sa))->sin_addr.s_addr) */ +/* #define ATOL(sa) (((struct taddr_in *)(sa))->sin_addr.s_addr) */ #define ATOL(sa) ((sa)->s_addr) #define satosin(sa) ((struct sockaddr_in *) (sa)) @@ -329,11 +329,11 @@ slcheckuse(rt) sldocall(addr) register struct in_addr *addr; { - struct sockaddr_in sock; + struct taddr_in sock; register mblk_t *m, **mpp; register int s; - bzero((caddr_t) & sock, sizeof(struct sockaddr_in)); + bzero((caddr_t) & sock, sizeof(struct taddr_in)); sock.sin_family = AF_INET; sock.sin_addr = *addr; s = splstr(); @@ -354,7 +354,7 @@ sldocall(addr) #endif SYSV return; } - if ((m = allocb(sizeof(struct sockaddr_in), BPRI_MED)) == NULL) { + if ((m = allocb(sizeof(struct taddr_in), BPRI_MED)) == NULL) { splx(s); #ifdef SYSV cmn_err(CE_CONT, "switched slip: no space\n"); @@ -363,8 +363,8 @@ sldocall(addr) #endif SYSV return; } - m->b_wptr += sizeof(struct sockaddr_in); - *(struct sockaddr_in *) (m->b_wptr) = sock; + m->b_wptr += sizeof(struct taddr_in); + *(struct taddr_in *) (m->b_wptr) = sock; m->b_cont = 0; for (mpp = &Slreq.waiting; *mpp; mpp = &((*mpp)->b_cont)); *mpp = m; diff --git a/usr/src/uts/3b2/netinet/in_transp.c b/usr/src/uts/3b2/netinet/in_transp.c index 3bdf96f..efe7aaa 100644 --- a/usr/src/uts/3b2/netinet/in_transp.c +++ b/usr/src/uts/3b2/netinet/in_transp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/in_transp.c 1.2" +#ident "@(#)netinet:netinet/in_transp.c 1.1" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -75,8 +75,8 @@ inet_doname(q, bp) mblk_t *bp; { struct inpcb *inp = qtoinp(q); - struct sockaddr_in localaddr; - struct sockaddr_in remoteaddr; + struct taddr_in localaddr; + struct taddr_in remoteaddr; if (inp == (struct inpcb *) 0) { /* strlog this */ diff --git a/usr/src/uts/3b2/netinet/ip.mk b/usr/src/uts/3b2/netinet/ip.mk index da5ee03..3521d45 100644 --- a/usr/src/uts/3b2/netinet/ip.mk +++ b/usr/src/uts/3b2/netinet/ip.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)netinet:netinet/ip.mk 1.8" +#ident "@(#)netinet:netinet/ip.mk 1.7" # # # PROPRIETARY NOTICE (Combined) @@ -40,7 +40,7 @@ FRC = PRODUCTS = IP ICMP RAWIP OBJ = in.o in_cksum.o in_pcb.o in_switch.o in_transp.o ip_input.o \ - ip_output.o ip_main.o netlib.o route.o ip_vers.o + ip_output.o ip_main.o netlib.o route.o ROBJ= raw_ip_main.o raw_ip.o raw_ip_cb.o CLEAN = ip.o ip_icmp.o icmp.o $(OBJ) $(ROBJ) diff --git a/usr/src/uts/3b2/netinet/ip_icmp.c b/usr/src/uts/3b2/netinet/ip_icmp.c index 39d9893..c84de60 100644 --- a/usr/src/uts/3b2/netinet/ip_icmp.c +++ b/usr/src/uts/3b2/netinet/ip_icmp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/ip_icmp.c 1.9" +#ident "@(#)netinet:netinet/ip_icmp.c 1.7" /* * System V STREAMS TCP - Release 2.0 @@ -466,7 +466,7 @@ icmp_state(q, bp) register struct inpcb *inp = qtoinp(q); int error = 0; mblk_t *head; - struct sockaddr_in *sin; + struct taddr_in *sin; struct in_addr laddr; /* @@ -511,7 +511,7 @@ icmp_state(q, bp) t_prim->info_ack.ETSDU_size = 1; t_prim->info_ack.CDATA_size = -2; /* ==> not supported */ t_prim->info_ack.DDATA_size = -2; - t_prim->info_ack.ADDR_size = sizeof(struct sockaddr_in); + t_prim->info_ack.ADDR_size = sizeof(struct taddr_in); t_prim->info_ack.OPT_size = -1; t_prim->info_ack.TIDU_size = 16 * 1024; t_prim->info_ack.SERV_type = T_CLTS; @@ -531,12 +531,13 @@ icmp_state(q, bp) if (t_prim->bind_req.ADDR_length == 0) { error = in_pcbbind(inp, (mblk_t *) NULL); } else { - if (!in_chkaddrlen(t_prim->bind_req.ADDR_length)) { + if (t_prim->bind_req.ADDR_length + != sizeof(struct taddr_in)) { T_errorack(q, bp, TBADADDR, 0); break; } bp->b_rptr += t_prim->bind_req.ADDR_offset; - sin = (struct sockaddr_in *) bp->b_rptr; + sin = (struct taddr_in *) bp->b_rptr; if (sin->sin_port == 0) sin->sin_port = 1; error = in_pcbbind(inp, bp); @@ -546,19 +547,19 @@ icmp_state(q, bp) break; inp->inp_tstate = TS_IDLE; if ((bp = reallocb(bp, sizeof(struct T_bind_ack) - + sizeof(struct sockaddr_in), 1)) + + sizeof(struct taddr_in), 1)) == NULL) { return; } t_prim = (union T_primitives *) bp->b_rptr; t_prim->bind_ack.PRIM_type = T_BIND_ACK; - t_prim->bind_ack.ADDR_length = sizeof(struct sockaddr_in); + t_prim->bind_ack.ADDR_length = sizeof(struct taddr_in); t_prim->bind_ack.ADDR_offset = sizeof(struct T_bind_ack); - sin = (struct sockaddr_in *) + sin = (struct taddr_in *) (bp->b_rptr + sizeof(struct T_bind_ack)); bp->b_wptr = (unsigned char *) - (((caddr_t) sin) + sizeof(struct sockaddr_in)); - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + (((caddr_t) sin) + sizeof(struct taddr_in)); + bzero((caddr_t) sin, sizeof(struct taddr_in)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_laddr; sin->sin_port = inp->inp_lport; @@ -588,7 +589,7 @@ icmp_state(q, bp) break; } bp->b_rptr += t_prim->conn_req.DEST_offset; - sin = (struct sockaddr_in *) bp->b_rptr; + sin = (struct taddr_in *) bp->b_rptr; if (sin->sin_port == 0) sin->sin_port = 1; if (error = in_pcbconnect(inp, bp)) @@ -638,7 +639,7 @@ icmp_state(q, bp) break; } bp->b_rptr += t_prim->unitdata_req.DEST_offset; - sin = (struct sockaddr_in *) bp->b_rptr; + sin = (struct taddr_in *) bp->b_rptr; if (sin->sin_port == 0) sin->sin_port = 1; if (error = in_pcbconnect(inp, bp)) @@ -852,7 +853,7 @@ icmp_error(oip, type, code, q, dest) static struct in_addr icmpsrc; static struct in_addr icmpdst; static struct in_addr icmpgw; -static struct sockaddr_in icmpsin = {AF_INET}; +static struct taddr_in icmpsin = {AF_INET}; /* * Process a received ICMP message. @@ -1052,21 +1053,21 @@ icmp_input(q, bp) icmpsin.sin_addr = ip->ip_src; Obp = allocb(sizeof(struct T_unitdata_ind) + - sizeof(struct sockaddr_in), BPRI_HI); + sizeof(struct taddr_in), BPRI_HI); if (Obp == 0) { goto free; } Obp->b_datap->db_type = M_PROTO; hdr = (struct T_unitdata_ind *) Obp->b_rptr; Obp->b_wptr += sizeof(struct T_unitdata_ind) + - sizeof(struct sockaddr_in); + sizeof(struct taddr_in); hdr->PRIM_type = T_UNITDATA_IND; - hdr->SRC_length = sizeof(struct sockaddr_in); + hdr->SRC_length = sizeof(struct taddr_in); hdr->SRC_offset = sizeof(struct T_unitdata_ind); hdr->OPT_length = 0; hdr->OPT_offset = 0; bcopy((caddr_t) & icmpsin, (caddr_t) Obp->b_rptr + - sizeof(struct T_unitdata_ind), sizeof(struct sockaddr_in)); + sizeof(struct T_unitdata_ind), sizeof(struct taddr_in)); Obp->b_cont = bp; for (inp = icmb.inp_next; inp != &icmb; inp = inp->inp_next) { @@ -1277,7 +1278,7 @@ struct inpcb *inp; { mblk_t *mp; struct T_uderror_ind *uderr; - struct sockaddr_in *sin; + struct taddr_in *sin; if (!inp->inp_q) return; @@ -1292,7 +1293,7 @@ struct inpcb *inp; uderr->OPT_length = 0; uderr->OPT_offset = 0; uderr->ERROR_type = inp->inp_error; - sin = (struct sockaddr_in *) (mp->b_rptr+sizeof(struct T_uderror_ind)); + sin = (struct taddr_in *) (mp->b_rptr+sizeof(struct T_uderror_ind)); bzero(sin, sizeof(*sin)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_faddr; @@ -1308,7 +1309,7 @@ icmp_uderr(bp) mblk_t *bp; { struct N_uderror_ind *uderr; - struct sockaddr_in sin; + struct taddr_in sin; uderr = (struct N_uderror_ind *) bp->b_rptr; if (uderr->ERROR_type == ENOSR) { diff --git a/usr/src/uts/3b2/netinet/ip_input.c b/usr/src/uts/3b2/netinet/ip_input.c index e65b1e2..073e5e2 100644 --- a/usr/src/uts/3b2/netinet/ip_input.c +++ b/usr/src/uts/3b2/netinet/ip_input.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/ip_input.c 1.8" +#ident "@(#)netinet:netinet/ip_input.c 1.6" /* * System V STREAMS TCP - Release 2.0 @@ -926,10 +926,15 @@ u_char inetctlerrmap[PRC_NCMDS] = { ENOPROTOOPT }; +#ifndef IPFORWARDING +#define IPFORWARDING 1 +#endif +#ifndef IPSENDREDIRECTS +#define IPSENDREDIRECTS 1 +#endif int ipprintfs = 0; - -extern int ipforwarding; /* from /etc/master.d/ip */ -extern int ipsendredirects; /* from /etc/master.d/ip */ +int ipforwarding = IPFORWARDING; +int ipsendredirects = IPSENDREDIRECTS; /* * Forward a packet. If some error occurs return the sender an icmp packet. @@ -967,8 +972,21 @@ ip_forward(q, bp) printf ("ip_forward: cant forward\n"); } ipstat.ips_cantforward++; - freemsg(bp); - return; + + /* + ** This was #ifdef gateway in 4.3BSD. Rather than have + ** that, only send these packets if ipsendredirects is on. + ** This way, if both forwarding and sendredirects are off, + ** we won't flood the network with this excess traffic. + */ + + if (ipsendredirects) { + type = ICMP_UNREACH, code = ICMP_UNREACH_NET; + goto sendicmp; + } else { + freemsg(bp); + return; + } } if (in_canforward(ip->ip_dst) == 0) { if (ipdprintf) { diff --git a/usr/src/uts/3b2/netinet/ip_main.c b/usr/src/uts/3b2/netinet/ip_main.c index bd00ce8..45f7134 100644 --- a/usr/src/uts/3b2/netinet/ip_main.c +++ b/usr/src/uts/3b2/netinet/ip_main.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/ip_main.c 1.9" +#ident "@(#)netinet:netinet/ip_main.c 1.7" /* * System V STREAMS TCP - Release 2.0 @@ -129,7 +129,6 @@ extern struct ip_provider provider[]; extern int ipcnt; extern int ipprovcnt; -static int ipversprinted; /* ARGSUSED */ ipopen(q, dev, flag, sflag) @@ -139,10 +138,6 @@ ipopen(q, dev, flag, sflag) mblk_t *bp; struct stroptions *sop; - if (!ipversprinted) { - ipversion(); - ipversprinted = 1; - } if (!ipinited && (ipinit(), !ipinited)) return (OPENFAIL); dev = minor(dev); diff --git a/usr/src/uts/3b2/netinet/ip_str.h b/usr/src/uts/3b2/netinet/ip_str.h index 8af1fc1..7990574 100644 --- a/usr/src/uts/3b2/netinet/ip_str.h +++ b/usr/src/uts/3b2/netinet/ip_str.h @@ -8,7 +8,7 @@ #ifndef _NETINET_IP_STR_H #define _NETINET_IP_STR_H -#ident "@(#)head.sys:sys/netinet/ip_str.h 1.3" +#ident "@(#)head.sys:sys/netinet/ip_str.h 1.2" /* * System V STREAMS TCP - Release 2.0 @@ -72,7 +72,7 @@ struct ip_pcb { #define IPOPEN 1 /* Minor device open when set */ struct ip_provider { /* The description of each link service */ - char name[IFNAMSIZ]; /* provider name (e.g., emd1) */ + char name[IFNAMSIZ]; /* provider name (e.g., en0) */ queue_t *qbot; /* lower write queue */ int l_index;/* unique ID of lower stream */ int if_flags; /* up/down, broadcast, etc. */ diff --git a/usr/src/uts/3b2/netinet/netlib.c b/usr/src/uts/3b2/netinet/netlib.c index 243734d..a640438 100644 --- a/usr/src/uts/3b2/netinet/netlib.c +++ b/usr/src/uts/3b2/netinet/netlib.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/netlib.c 1.4" +#ident "@(#)netinet:netinet/netlib.c 1.3" /* * System V STREAMS TCP - Release 2.0 @@ -259,25 +259,25 @@ T_conn_con(inp) struct inpcb *inp; { mblk_t *bp; - struct sockaddr_in *sin; + struct taddr_in *sin; struct T_conn_con *conn_con; - if (!(bp = allocb(sizeof(struct T_conn_con) + sizeof(struct sockaddr_in), + if (!(bp = allocb(sizeof(struct T_conn_con) + sizeof(struct taddr_in), BPRI_HI))) { - bufcall(sizeof(struct T_conn_con) + sizeof(struct sockaddr_in), + bufcall(sizeof(struct T_conn_con) + sizeof(struct taddr_in), BPRI_HI, T_conn_con, inp); return; } - bp->b_wptr += sizeof(struct T_conn_con) + sizeof(struct sockaddr_in); + bp->b_wptr += sizeof(struct T_conn_con) + sizeof(struct taddr_in); bp->b_datap->db_type = M_PROTO; conn_con = (struct T_conn_con *) bp->b_rptr; - sin = (struct sockaddr_in *) (bp->b_rptr + sizeof(struct T_conn_con)); + sin = (struct taddr_in *) (bp->b_rptr + sizeof(struct T_conn_con)); conn_con->PRIM_type = T_CONN_CON; - conn_con->RES_length = sizeof(struct sockaddr_in); + conn_con->RES_length = sizeof(struct taddr_in); conn_con->RES_offset = sizeof(struct T_conn_con); conn_con->OPT_length = 0; conn_con->OPT_offset = 0; - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + bzero((caddr_t) sin, sizeof(struct taddr_in)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_faddr; sin->sin_port = inp->inp_fport; diff --git a/usr/src/uts/3b2/netinet/raw_ip.c b/usr/src/uts/3b2/netinet/raw_ip.c index aab4887..9de49ea 100644 --- a/usr/src/uts/3b2/netinet/raw_ip.c +++ b/usr/src/uts/3b2/netinet/raw_ip.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/raw_ip.c 1.4" +#ident "@(#)netinet:netinet/raw_ip.c 1.3" /* * System V STREAMS TCP - Release 2.0 @@ -88,7 +88,7 @@ extern struct inpcb rawcb; extern queue_t *rip_qbot; extern u_char ip_protox[]; -static struct sockaddr_in ripsrc = {AF_INET}; +static struct taddr_in ripsrc = {AF_INET}; /* * Setup generic address and protocol structures for raw_input routine, then * pass them along with mblk chain. @@ -112,23 +112,23 @@ rip_input(q, bp0) ripsrc.sin_addr = ip_src = ip->ip_src; ip_dst = ip->ip_dst; ip_p = ip->ip_p; - bp0 = allocb(sizeof(struct T_unitdata_ind) + sizeof(struct sockaddr_in), + bp0 = allocb(sizeof(struct T_unitdata_ind) + sizeof(struct taddr_in), BPRI_HI); if (!bp0) { freemsg(bp); return; } bp0->b_datap->db_type = M_PROTO; - bp0->b_wptr += sizeof(struct T_unitdata_ind) + sizeof(struct sockaddr_in); + bp0->b_wptr += sizeof(struct T_unitdata_ind) + sizeof(struct taddr_in); ind = (struct T_unitdata_ind *) bp0->b_rptr; ind->PRIM_type = T_UNITDATA_IND; - ind->SRC_length = sizeof(struct sockaddr_in); + ind->SRC_length = sizeof(struct taddr_in); ind->SRC_offset = sizeof(struct T_unitdata_ind); ind->OPT_length = 0; ind->OPT_offset = 0; bcopy((caddr_t) & ripsrc, (caddr_t) bp0->b_rptr + sizeof(struct T_unitdata_ind), - sizeof(struct sockaddr_in)); + sizeof(struct taddr_in)); bp0->b_cont = bp; for (inp = rawcb.inp_next; inp != &rawcb; inp = inp->inp_next) { if (inp->inp_state & SS_CANTRCVMORE || diff --git a/usr/src/uts/3b2/netinet/raw_ip_cb.c b/usr/src/uts/3b2/netinet/raw_ip_cb.c index 4e91b4c..d098d41 100644 --- a/usr/src/uts/3b2/netinet/raw_ip_cb.c +++ b/usr/src/uts/3b2/netinet/raw_ip_cb.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/rip_cb.c 1.5" +#ident "@(#)netinet:netinet/rip_cb.c 1.4" /* * System V STREAMS TCP - Release 2.0 @@ -126,7 +126,7 @@ rip_disconnect(inp) rip_bind(inp, addr) register struct inpcb *inp; - struct sockaddr_in *addr; + struct taddr_in *addr; { /* BEGIN DUBIOUS */ @@ -156,7 +156,7 @@ rip_bind(inp, addr) */ rip_connaddr(inp, addr) struct inpcb *inp; - struct sockaddr_in *addr; + struct taddr_in *addr; { if (addr->sin_family != AF_INET) return(EAFNOSUPPORT); diff --git a/usr/src/uts/3b2/netinet/raw_ip_main.c b/usr/src/uts/3b2/netinet/raw_ip_main.c index 27346b7..9b28e1b 100644 --- a/usr/src/uts/3b2/netinet/raw_ip_main.c +++ b/usr/src/uts/3b2/netinet/raw_ip_main.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/rip_main.c 1.7" +#ident "@(#)netinet:netinet/rip_main.c 1.5" /* * System V STREAMS TCP - Release 2.0 @@ -293,9 +293,9 @@ ripuwsrv(q) while (bp = getq(q)) { t_prim = (union T_primitives *)bp->b_rptr; if (t_prim->type == T_UNITDATA_REQ) { - struct sockaddr_in *sin; + struct taddr_in *sin; - sin = (struct sockaddr_in *)(bp->b_rptr + + sin = (struct taddr_in *)(bp->b_rptr + t_prim->unitdata_req.DEST_offset); error = rip_connaddr(inp, sin); if (!error) { @@ -496,7 +496,7 @@ ripioctl(q, bp) * this is the subfunction of the upper put routine which handles data and * protocol packets for us. */ -static struct sockaddr_in ripsin = { AF_INET, INADDR_ANY }; +static struct taddr_in ripsin = { AF_INET, INADDR_ANY }; rip_state(q, bp) queue_t *q; @@ -505,7 +505,7 @@ rip_state(q, bp) register union T_primitives *t_prim; register struct inpcb *inp = qtoinp(q); int error = 0; - struct sockaddr_in *sin; + struct taddr_in *sin; /* * check for pending error, or a broken state machine @@ -544,7 +544,7 @@ rip_state(q, bp) t_prim->info_ack.ETSDU_size = 1; t_prim->info_ack.CDATA_size = -2; /* ==> not supported */ t_prim->info_ack.DDATA_size = -2; - t_prim->info_ack.ADDR_size = sizeof(struct sockaddr_in); + t_prim->info_ack.ADDR_size = sizeof(struct taddr_in); t_prim->info_ack.OPT_size = -1; t_prim->info_ack.TIDU_size = 16 * 1024; t_prim->info_ack.SERV_type = T_CLTS; @@ -564,11 +564,12 @@ rip_state(q, bp) if (t_prim->bind_req.ADDR_length == 0) { error = rip_bind(inp, &ripsin); } else { - if (!in_chkaddrlen(t_prim->bind_req.ADDR_length)) { + if (t_prim->bind_req.ADDR_length != + sizeof(struct taddr_in)) { T_errorack(q, bp, TBADADDR, 0); break; } - sin = (struct sockaddr_in *) + sin = (struct taddr_in *) (bp->b_rptr + t_prim->bind_req.ADDR_offset); error = rip_bind(inp, sin); } @@ -576,19 +577,19 @@ rip_state(q, bp) break; inp->inp_tstate = TS_IDLE; if ((bp = reallocb(bp, sizeof(struct T_bind_ack) - + sizeof(struct sockaddr_in), 1)) + + sizeof(struct taddr_in), 1)) == NULL) { return; } t_prim = (union T_primitives *) bp->b_rptr; t_prim->bind_ack.PRIM_type = T_BIND_ACK; - t_prim->bind_ack.ADDR_length = sizeof(struct sockaddr_in); + t_prim->bind_ack.ADDR_length = sizeof(struct taddr_in); t_prim->bind_ack.ADDR_offset = sizeof(struct T_bind_ack); - sin = (struct sockaddr_in *) + sin = (struct taddr_in *) (bp->b_rptr + sizeof(struct T_bind_ack)); bp->b_wptr = (unsigned char *) - (((caddr_t) sin) + sizeof(struct sockaddr_in)); - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + (((caddr_t) sin) + sizeof(struct taddr_in)); + bzero((caddr_t) sin, sizeof(struct taddr_in)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_laddr; qreply(q, bp); @@ -609,7 +610,7 @@ rip_state(q, bp) T_errorack(q, bp, TOUTSTATE, 0); break; } - sin = (struct sockaddr_in *) + sin = (struct taddr_in *) (bp->b_rptr + t_prim->conn_req.DEST_offset); error = rip_connaddr(inp, sin); if (error) { @@ -776,7 +777,7 @@ struct inpcb *inp; { mblk_t *mp; struct T_uderror_ind *uderr; - struct sockaddr_in *sin; + struct taddr_in *sin; if (!inp->inp_q) return; @@ -791,7 +792,7 @@ struct inpcb *inp; uderr->OPT_length = 0; uderr->OPT_offset = 0; uderr->ERROR_type = inp->inp_error; - sin = (struct sockaddr_in *) (mp->b_rptr+sizeof(struct T_uderror_ind)); + sin = (struct taddr_in *) (mp->b_rptr+sizeof(struct T_uderror_ind)); bzero(sin, sizeof(*sin)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_faddr; @@ -808,7 +809,7 @@ rip_uderr(bp) mblk_t *bp; { struct N_uderror_ind *uderr; - struct sockaddr_in sin; + struct taddr_in sin; uderr = (struct N_uderror_ind *) bp->b_rptr; if (uderr->ERROR_type == ENOSR) { @@ -826,7 +827,7 @@ rip_ctlinput(bp) struct ip_ctlmsg *ctl; extern u_char inetctlerrmap[]; int in_rtchange(); - struct sockaddr_in sin; + struct taddr_in sin; ctl = (struct ip_ctlmsg *) bp->b_rptr; if ((unsigned) ctl->command > PRC_NCMDS) @@ -863,7 +864,7 @@ rip_ctlinput(bp) rip_notify(head, dst, proto, errno) struct inpcb *head; - register struct sockaddr_in *dst; + register struct taddr_in *dst; int proto, errno; { register struct inpcb *inp; diff --git a/usr/src/uts/3b2/netinet/route.c b/usr/src/uts/3b2/netinet/route.c index 3103926..564f396 100644 --- a/usr/src/uts/3b2/netinet/route.c +++ b/usr/src/uts/3b2/netinet/route.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/route.c 1.4" +#ident "@(#)netinet:netinet/route.c 1.3" /* * System V STREAMS TCP - Release 2.0 @@ -365,6 +365,27 @@ rtrequest(req, bp) if (prov == 0 && (entry->rt_flags & RTF_GATEWAY) == 0 && (entry->rt_flags & RTF_HOST)) prov = prov_withdstaddr(satosin(&entry->rt_dst)->sin_addr); + /* check for pre-existing route to gateway */ + /* if there is an intermediate gateway, use it instead */ + if (prov == 0) { + struct route route; + + bzero((caddr_t) & route, sizeof(route)); + route.ro_dst = entry->rt_gateway; + rtalloc(&route, 0); + if (route.ro_rt) { + if (RT(route.ro_rt)->rt_flags & RTF_SWITCHED) { + entry->rt_flags |= (RTF_SWITCHED | RTF_TOSWITCH); + prov = loopprov; + } else { + prov = RT(route.ro_rt)->rt_prov; + if (RT(route.ro_rt)->rt_flags & RTF_GATEWAY) + entry->rt_gateway = + RT(route.ro_rt)->rt_gateway; + } + rtfree(route.ro_rt); + } + } if (prov == 0 && (entry->rt_flags & RTF_GATEWAY) == 0) prov = prov_withaddr(satosin(&entry->rt_gateway)->sin_addr); if (prov == 0) @@ -445,4 +466,3 @@ rtdetach(prov) } } } - diff --git a/usr/src/uts/3b2/netinet/tcp.h b/usr/src/uts/3b2/netinet/tcp.h index abf504c..d408faf 100644 --- a/usr/src/uts/3b2/netinet/tcp.h +++ b/usr/src/uts/3b2/netinet/tcp.h @@ -8,7 +8,7 @@ #ifndef _NETINET_TCP_H #define _NETINET_TCP_H -#ident "@(#)head.sys:sys/netinet/tcp.h 1.3" +#ident "@(#)head.sys:sys/netinet/tcp.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -31,26 +31,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - - typedef u_long tcp_seq; /* * TCP header. @@ -93,9 +73,6 @@ struct tcphdr { #ifdef lint #define TCP_MSS 536 #else -#ifndef IP_MSS -#define IP_MSS 576 -#endif #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) #endif diff --git a/usr/src/uts/3b2/netinet/tcp_debug.c b/usr/src/uts/3b2/netinet/tcp_debug.c index dc90883..af6dcaa 100644 --- a/usr/src/uts/3b2/netinet/tcp_debug.c +++ b/usr/src/uts/3b2/netinet/tcp_debug.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/tcp_debug.c 1.5" +#ident "@(#)netinet:netinet/tcp_debug.c 1.3" /* * PROPRIETARY NOTICE (Combined) @@ -28,31 +28,12 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - - +#ifdef TCPDEBUG #define TCPSTATES #define TCPTIMERS #define TANAMES #define PRUREQUESTS -#define TLI_PRIMS +#endif #define STRNET @@ -68,9 +49,6 @@ #include #include #include -#ifdef SYSV -#include -#endif #include #include @@ -88,9 +66,11 @@ #include #include -int tcpconsdebug = 0; /* send debug printfs to console if set */ -int tcpalldebug = 0; /* trace all connections if set */ +#ifdef TCPDEBUG +struct tcp_debug tcp_debug[TCP_NDEBUG]; int tcp_debx; +int tcpconsdebug = 0; +#endif TCPDEBUG /* * Tcp debug routines @@ -102,11 +82,12 @@ tcp_trace(act, ostate, tp, ti, req) struct tcpiphdr *ti; int req; { +#ifdef TCPDEBUG tcp_seq seq, ack; int len, flags; struct tcp_debug *td = &tcp_debug[tcp_debx++]; - if (tcp_debx == tcp_ndebug) + if (tcp_debx == TCP_NDEBUG) tcp_debx = 0; td->td_time = iptime(); td->td_act = act; @@ -124,22 +105,10 @@ tcp_trace(act, ostate, tp, ti, req) if (tcpconsdebug == 0) return; if (tp) -#ifdef SYSV - cmn_err(CE_CONT,"%x %s:", tp, tcpstates[ostate]); -#else printf("%x %s:", tp, tcpstates[ostate]); -#endif else -#ifdef SYSV - cmn_err(CE_CONT,"???????? "); -#else printf("???????? "); -#endif -#ifdef SYSV - cmn_err(CE_CONT,"%s ", tanames[act]); -#else printf("%s ", tanames[act]); -#endif switch (act) { case TA_INPUT: @@ -158,93 +127,37 @@ tcp_trace(act, ostate, tp, ti, req) if (act == TA_OUTPUT) len -= sizeof (struct tcphdr); if (len) -#ifdef SYSV - cmn_err(CE_CONT,"[%lx..%lx]", seq, seq + len); -#else - printf("[%lx..%lx]", seq, seq + len); -#endif + printf("[%x..%x)", seq, seq+len); else -#ifdef SYSV - cmn_err(CE_CONT,"%lx", seq); -#else - printf("%lx", seq); -#endif -#ifdef SYSV - cmn_err(CE_CONT,"@%lx, urp=%lx", ack, ti->ti_urp); -#else - printf("@%lx, urp=%lx", ack, ti->ti_urp); -#endif + printf("%x", seq); + printf("@%x, urp=%x", ack, ti->ti_urp); flags = ti->ti_flags; if (flags) { #ifndef lint - char *cp = "<"; -#ifdef SYSV -#define pf(f) { if (ti->ti_flags & f) { cmn_err(CE_CONT,"%s%s", cp, "f"); cp = ","; } } -#else -#define pf(f) { if (ti->ti_flags & f) { printf("%s%s", cp, "f"); cp = ","; } } + char *cp = "<"; +#define pf(f) { if (ti->ti_flags&TH_/**/f) { printf("%s%s", cp, "f"); cp = ","; } } + pf(SYN); pf(ACK); pf(FIN); pf(RST); pf(PUSH); pf(URG); #endif - pf(TH_SYN); - pf(TH_ACK); - pf(TH_FIN); - pf(TH_RST); - pf(TH_PUSH); - pf(TH_URG); -#endif -#ifdef SYSV - cmn_err(CE_CONT,">"); -#else printf(">"); -#endif } break; case TA_USER: -#ifdef SYSV - cmn_err(CE_CONT,"%s", tli_primitives[req & 0xff]); -#else - printf("%s", tli_primitives[req & 0xff]); -#endif - break; - case TA_TIMER: -#ifdef SYSV - cmn_err(CE_CONT,"<%s>", tcptimers[req]); -#else - printf("<%s>", tcptimers[req]); -#endif - break; - default: + printf("%s", prurequests[req&0xff]); + if ((req & 0xff) == PRU_SLOWTIMO) + printf("<%s>", tcptimers[req>>8]); break; } if (tp) - if (tp->t_state > TCP_NSTATES || tp->t_state < 0) { -#ifdef SYSV - cmn_err(CE_CONT," -> Bad State (%d)", tp->t_state); -#else - printf(" -> Bad State (%d)", tp->t_state); -#endif - } else { -#ifdef SYSV - cmn_err(CE_CONT," -> %s", tcpstates[tp->t_state]); -#else - printf(" -> %s", tcpstates[tp->t_state]); -#endif - } + printf(" -> %s", tcpstates[tp->t_state]); /* print out internal state of tp !?! */ -#ifdef SYSV - cmn_err(CE_CONT,"\n"); -#else printf("\n"); -#endif if (tp == 0) return; -#ifdef SYSV - cmn_err(CE_CONT,"\trcv_(nxt,wnd,up) (%lx,%lx,%x) snd_(una,nxt,max) (%lx,%lx,%lx)\n", tp->rcv_nxt, tp->rcv_wnd, tp->rcv_up, tp->snd_una, tp->snd_nxt, tp->snd_max); -#else - printf("\trcv_(nxt,wnd,up) (%lx,%lx,%x) snd_(una,nxt,max) (%lx,%lx,%lx)\n", tp->rcv_nxt, tp->rcv_wnd, tp->rcv_up, tp->snd_una, tp->snd_nxt, tp->snd_max); -#endif -#ifdef SYSV - cmn_err(CE_CONT,"\tsnd_(wl1,wl2,wnd) (%x,%x,%x) snd_cwnd %x\n", tp->snd_wl1, tp->snd_wl2, tp->snd_wnd, tp->snd_cwnd); -#else - printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x) snd_cwnd %x\n", tp->snd_wl1, tp->snd_wl2, tp->snd_wnd, tp->snd_cwnd); -#endif + printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n", + tp->rcv_nxt, tp->rcv_wnd, tp->rcv_up, tp->snd_una, tp->snd_nxt, + tp->snd_max); + printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n", + tp->snd_wl1, tp->snd_wl2, tp->snd_wnd); +#endif TCPDEBUG } diff --git a/usr/src/uts/3b2/netinet/tcp_debug.h b/usr/src/uts/3b2/netinet/tcp_debug.h index ee3ee01..72a8a98 100644 --- a/usr/src/uts/3b2/netinet/tcp_debug.h +++ b/usr/src/uts/3b2/netinet/tcp_debug.h @@ -8,7 +8,7 @@ #ifndef _NETINET_TCP_DEBUG_H #define _NETINET_TCP_DEBUG_H -#ident "@(#)head.sys:sys/netinet/tcp_debug.h 1.3" +#ident "@(#)head.sys:sys/netinet/tcp_debug.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -53,9 +53,5 @@ char *tanames[] = { "input", "output", "user", "respond", "drop", "timer" }; #endif -#ifdef _KERNEL -extern int tcp_ndebug, tcp_debx; -extern struct tcp_debug tcp_debug[]; -#endif /* _KERNEL */ - +#define TCP_NDEBUG 100 #endif /* _NETINET_TCP_DEBUG_H */ diff --git a/usr/src/uts/3b2/netinet/tcp_fsm.h b/usr/src/uts/3b2/netinet/tcp_fsm.h index a5b78ff..20090c4 100644 --- a/usr/src/uts/3b2/netinet/tcp_fsm.h +++ b/usr/src/uts/3b2/netinet/tcp_fsm.h @@ -8,7 +8,7 @@ #ifndef _NETINET_TCP_FSM_H #define _NETINET_TCP_FSM_H -#ident "@(#)head.sys:sys/netinet/tcp_fsm.h 1.3" +#ident "@(#)head.sys:sys/netinet/tcp_fsm.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -31,25 +31,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - /* * TCP FSM state definitions. * Per RFC793, September, 1981. @@ -100,6 +81,10 @@ u_char tcp_outflags[TCP_NSTATES] = { }; #endif +#ifdef KPROF +int tcp_acounts[TCP_NSTATES][PRU_NREQ]; +#endif + #ifdef TCPSTATES char *tcpstates[] = { "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", diff --git a/usr/src/uts/3b2/netinet/tcp_input.c b/usr/src/uts/3b2/netinet/tcp_input.c index 2301b2e..3f6fac9 100644 --- a/usr/src/uts/3b2/netinet/tcp_input.c +++ b/usr/src/uts/3b2/netinet/tcp_input.c @@ -5,7 +5,25 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/tcp_input.c 1.10" +#ident "@(#)netinet:netinet/tcp_input.c 1.6.1.1" + +/* + * System V STREAMS TCP - Release 2.0 + * + * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) All Rights Reserved. + * + * The copyright above and this notice must be preserved in all copies of this + * source code. The copyright above does not evidence any actual or intended + * publication of this source code. + * + * This is unpublished proprietary trade secret source code of Lachman + * Associates. This source code may not be copied, disclosed, distributed, + * demonstrated or licensed except as expressly authorized by Lachman + * Associates. + * + * System V STREAMS TCP was jointly developed by Lachman Associates and + * Convergent Technologies. + */ /* * PROPRIETARY NOTICE (Combined) @@ -28,26 +46,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - - #define STRNET #ifdef INET @@ -88,14 +86,11 @@ #include #include #ifdef SYSV -#ifdef SYSV #include -#endif #endif SYSV #include -int tcpdprintf = 0; int tcpprintfs = 0; int tcpcksum = 1; int tcprexmtthresh = 3; @@ -385,7 +380,7 @@ int urp; ind = (struct T_exdata_ind *) bp2->b_rptr; bp2->b_wptr += sizeof (struct T_exdata_ind); ind->PRIM_type = T_EXDATA_IND; - ind->MORE_flag = 0; + ind->MORE_type = 0; if ((bp2->b_cont = allocb(1, BPRI_HI)) == (mblk_t *) NULL) { if (bp1) freemsg(bp1); @@ -446,11 +441,12 @@ headerize(bp) #ifdef SYSV cmn_err(CE_WARN, "headerize: dupb failed"); #else - printf( "headerize: dupb failed"); -#endif + printf ("headerize: dupb failed\n"); +#endif SYSV return (bp0); } +int tcpdprintf = 0; /* * TCP input routine, follows pages 65-76 of the protocol specification dated @@ -478,11 +474,7 @@ tcp_linput(q, bp) if (msgblen(bp) < sizeof(struct tcpiphdr)) { if ((pullupmsg(bp, sizeof(struct tcpiphdr))) == 0) { if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_linput: too short\n"); -#else - printf( "tcp_linput: too short\n"); -#endif + printf ("tcp_linput: too short\n"); tcpstat.tcps_rcvshort++; freemsg(bp); return; @@ -504,11 +496,8 @@ tcp_linput(q, bp) ti->ti_x1 = 0; if (ti->ti_sum = in_cksum(bp, len)) { if (tcpprintfs) -#ifdef SYSV - cmn_err(CE_NOTE,"tcp sum: src %lx, sum %x", ntohl(ti->ti_src), ti->ti_sum); -#else - printf("tcp sum: src %lx, sum %x", ntohl(ti->ti_src), ti->ti_sum); -#endif + printf("tcp sum: src %x, sum %x\n", ti->ti_src, + ti->ti_sum); tcpstat.tcps_rcvbadsum++; goto drop; } @@ -545,11 +534,7 @@ tcp_linput(q, bp) } if (tp->t_state == TCPS_CLOSED) { if (tcpprintfs) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_linput: state == CLOSED\n"); -#else - printf( "tcp_linput: state == CLOSED\n"); -#endif + printf ("tcp_linput: state == CLOSED\n"); goto drop; } tcp_io(tp, TF_NEEDIN, bp); @@ -562,11 +547,7 @@ tcp_linput(q, bp) * broadcast. */ if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_linput: drop with reset\n"); -#else - printf( "tcp_linput: drop with reset\n"); -#endif + printf ("tcp_linput: drop with reset\n"); tiflags = ti->ti_flags; if ((tiflags & TH_RST) || in_broadcast(ti->ti_dst)) goto drop; @@ -584,22 +565,17 @@ tcp_linput(q, bp) drop: if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_linput: drop\n"); -#else - printf( "tcp_linput: drop\n"); -#endif + printf ("tcp_linput: drop\n"); freemsg(bp); return; } -struct tcpcb * tcp_uinput(tp0) struct tcpcb *tp0; { - register struct tcpcb *tp = NULL; + register struct tcpcb *tp; register struct tcpiphdr *ti; - struct inpcb *inp; + struct inpcb *inp = tp0->t_inpcb; int len; int off; register mblk_t *bp; @@ -614,24 +590,17 @@ tcp_uinput(tp0) int s; if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_uinput\n"); -#else - printf( "tcp_uinput\n"); -#endif + printf ("tcp_uinput\n"); moreinput: - tp = tp0 ? tp0 : tp; - tp0 = NULL; - + tp = tp0; s = splstr(); - if (!tp || !(bp = tp->t_inq)) { - if (tp) - tp->t_flags &= ~TF_NEEDIN; + bp = tp->t_inq; + if (!bp) { + tp->t_flags &= ~TF_NEEDIN; splx(s); - return(tp); + return; } tp->t_inq = bp->b_next; - inp = tp->t_inpcb; splx(s); optbp = (mblk_t *)NULL; @@ -646,11 +615,7 @@ tcp_uinput(tp0) off = ti->ti_off << 2; if (off < sizeof(struct tcphdr) || off > ti->ti_len) { if (tcpprintfs) -#ifdef SYSV - cmn_err(CE_NOTE,"tcp off: src %lx off %d", ntohl(ti->ti_src), off); -#else - printf("tcp off: src %lx off %d", ntohl(ti->ti_src), off); -#endif + printf("tcp off: src %x off %d\n", ti->ti_src, off); tcpstat.tcps_rcvbadoff++; goto drop; } @@ -660,11 +625,7 @@ tcp_uinput(tp0) if (pullupmsg(bp, (int) sizeof(struct ip) + off) == 0) { if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_uinput: too short\n"); -#else - printf( "tcp_uinput: too short\n"); -#endif + printf ("tcp_uinput: too short\n"); tcpstat.tcps_rcvshort++; goto drop; } @@ -673,11 +634,7 @@ tcp_uinput(tp0) optbp = allocb((int) (off - sizeof(struct tcphdr)), BPRI_HI); if (optbp == 0) { if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_uinput: can't allocb opt buf"); -#else - printf( "tcp_uinput: can't allocb opt buf"); -#endif + printf ("tcp_uinput: can't allocb opt buf"); goto drop; } optbp->b_wptr += off - sizeof(struct tcphdr); @@ -721,8 +678,7 @@ tcp_uinput(tp0) dropsocket++; inp->inp_laddr = ti->ti_dst; inp->inp_lport = ti->ti_dport; - inp->inp_options = ip_srcroute(0); - tp0 = tp; + inp->inp_options = ip_srcroute(); tp = intotcpcb(inp); tp->t_state = TCPS_LISTEN; } @@ -777,7 +733,7 @@ tcp_uinput(tp0) */ case TCPS_LISTEN:{ mblk_t *am; - register struct sockaddr_in *sin; + register struct taddr_in *sin; if (tiflags & TH_RST) goto drop; @@ -787,11 +743,11 @@ tcp_uinput(tp0) goto drop; if (in_broadcast(ti->ti_dst)) goto drop; - am = allocb(sizeof(struct sockaddr_in), BPRI_HI); + am = allocb(sizeof(struct taddr_in), BPRI_HI); if (am == NULL) goto drop; - am->b_wptr += sizeof(struct sockaddr_in); - sin = (struct sockaddr_in *) am->b_rptr; + am->b_wptr += sizeof(struct taddr_in); + sin = (struct taddr_in *) am->b_rptr; sin->sin_family = AF_INET; sin->sin_addr = ti->ti_src; sin->sin_port = ti->ti_sport; @@ -1242,13 +1198,11 @@ tcp_uinput(tp0) */ { u_int incr = tp->t_maxseg; - register tmp; if (tp->snd_cwnd > tp->snd_ssthresh) incr = MAX(incr * incr / tp->snd_cwnd, 1); - tmp = (int)tp->snd_cwnd + incr; - tp->snd_cwnd = MIN(tmp, IP_MAXPACKET); /* XXX */ + tp->snd_cwnd = MIN(tp->snd_cwnd + incr, IP_MAXPACKET); /* XXX */ } ourfinisacked = (tp->t_flags & TF_SENTFIN) && (ti->ti_ack == tp->snd_max); @@ -1260,14 +1214,14 @@ tcp_uinput(tp0) if (usq) tcp_qdrop(WR(usq), qsize); STRLOG(TCPM_ID, 2, 9, SL_TRACE, - "setting q size to 0"); + "setting q size to 0\n"); } else if (acked) { tp->snd_wnd -= acked; tp->t_qsize -= acked; if (usq) tcp_qdrop(WR(usq), acked); STRLOG(TCPM_ID, 2, 9, SL_TRACE, - "subtracting %d from q size, new value is %d", + "subtracting %d from q size, new value is %d\n", acked, tp->t_qsize); acked = 0; } @@ -1328,7 +1282,7 @@ tcp_uinput(tp0) if (ourfinisacked) { tcp_cancelinger(tp); tp->t_state = TCPS_CLOSED; - tp = tcp_close(tp, 0); + tcp_close(tp, 0); goto drop; } break; @@ -1371,7 +1325,7 @@ tcp_uinput(tp0) /* * Process segments with URG. */ - if ((tiflags & TH_URG) && ti->ti_urp && + if ((ti->ti_flags & TH_URG) && ti->ti_urp && TCPS_HAVERCVDFIN(tp->t_state) == 0) { mblk_t *sigbp; @@ -1396,6 +1350,18 @@ tcp_uinput(tp0) tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA); } + /* + ** now send an M_SIG to notify the stream head + */ + + sigbp = allocb(1, BPRI_HI); + if (sigbp) { + struct inpcb *ipp = tp->t_inpcb; + sigbp->b_datap->db_type = M_PCSIG; + *sigbp->b_wptr++ = SIGURG; + putnext(ipp->inp_q, sigbp); + } + ti->ti_urp--; /* XXX - 4.2 BSD compatibility */ } else /* @@ -1542,11 +1508,7 @@ tcp_uinput(tp0) drop: if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcp_uinput: drop\n"); -#else - printf( "tcp_uinput: drop\n"); -#endif + printf ("tcp_uinput: drop\n"); if (optbp) (void) freemsg(optbp); /* @@ -1645,8 +1607,6 @@ tcp_mss(tp) } } mss = prov->if_maxtu - sizeof(struct tcpiphdr); - if (mss > 1024) - mss = (mss / 1024) * 1024; if (in_localaddr(inp->inp_faddr)) return (mss); mss = MIN(mss, TCP_MSS); diff --git a/usr/src/uts/3b2/netinet/tcp_main.c b/usr/src/uts/3b2/netinet/tcp_main.c index 39ef190..d561d32 100644 --- a/usr/src/uts/3b2/netinet/tcp_main.c +++ b/usr/src/uts/3b2/netinet/tcp_main.c @@ -5,7 +5,25 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/tcp_main.c 1.4.3.7" +#ident "@(#)netinet:netinet/tcp_main.c 1.4.3.2" + +/* + * System V STREAMS TCP - Release 2.0 + * + * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) All Rights Reserved. + * + * The copyright above and this notice must be preserved in all copies of this + * source code. The copyright above does not evidence any actual or intended + * publication of this source code. + * + * This is unpublished proprietary trade secret source code of Lachman + * Associates. This source code may not be copied, disclosed, distributed, + * demonstrated or licensed except as expressly authorized by Lachman + * Associates. + * + * System V STREAMS TCP was jointly developed by Lachman Associates and + * Convergent Technologies. + */ /* * PROPRIETARY NOTICE (Combined) @@ -28,26 +46,6 @@ * All rights reserved. */ - -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - /* * This is the main stream interface module for the DoD Transmission Control * Protocol (TCP). Here, we deal with the stream setup and tear-down. The @@ -55,7 +53,6 @@ * handling happens in tcp_input.c and tcp_output.c */ - #define STRNET #ifdef INET @@ -72,9 +69,6 @@ #ifdef SYSV #include #include -#ifdef SYSV -#include -#endif #endif /* SYSV */ #include #include @@ -108,6 +102,7 @@ #include #include #include +#include #include int nodev(), tcpopen(), tcpclose(), tcp_deqdata(), tcpuwput(), tcpuwsrv(); @@ -139,6 +134,9 @@ int tcp_index; extern int tcpfastid, tcpslowid; extern int tcpdprintf; +extern int ntcp; +int tcp_ndebug, tcp_debx = 0; + static int tcpinited; tcp_seq tcp_iss; @@ -149,6 +147,7 @@ mblk_t *tcp_dihdr; /* configurable parameters */ extern unsigned char tcp_dev[]; /* bit mask of minor devs */ extern int ntcp; +extern int tcpalldebug; #define PLINGER PZERO+1 @@ -198,7 +197,6 @@ tcpopen(q, dev, flag, sflag) setuerror(EINVAL); return (OPENFAIL); } - if (error = tcp_attach(q)) { setuerror((unsigned short) error); return (OPENFAIL); @@ -235,8 +233,6 @@ tcpopen(q, dev, flag, sflag) } else { setuerror(0); /* suser sets u_error, so clear */ } - if ((inp->inp_protoopt & SO_LINGER) && inp->inp_linger == 0) - inp->inp_linger = TCP_LINGERTIME; STRLOG(TCPM_ID, 1, 5, SL_TRACE, "tcpopen succeeded wq %x tcb %x", WR(q), inp->inp_ppcb); tcp_dev[i] |= 1 << j; @@ -248,12 +244,9 @@ tcpclose(q) { struct tcpcb *tp; struct inpcb *inp; - short saveminor; short i, j; - extern void lingertimer(); - int ss; + extern void lingertimer(); - ss = splstr(); ASSERT(q != NULL); inp = qtoinp(q); STRLOG(TCPM_ID, 1, 5, SL_TRACE, "tcpclose: wq %x pcb %x", @@ -262,7 +255,10 @@ tcpclose(q) ASSERT(inp == qtoinp(WR(q))); tp = (struct tcpcb *) inp->inp_ppcb; ASSERT(tp->t_inpcb == inp); - saveminor = tp->t_inpcb->inp_minor; + i = tp->t_inpcb->inp_minor; + j = i % 8; + i = i / 8; + tcp_dev[i] &= ~(1 << j); if (inp->inp_protoopt & SO_ACCEPTCONN) { struct tcpcb *ctp; @@ -277,47 +273,44 @@ tcpclose(q) } } inp->inp_state |= SS_NOFDREF | SS_CANTRCVMORE; - inp->inp_tstate = TS_UNBND; if (tp->t_state > TCPS_LISTEN) tp = tcp_disconnect(tp); else tp = tcp_close(tp, 0); - if (tp && tp->t_qsize) { + if (tp && tp->t_qsize) if (inp->inp_protoopt & SO_LINGER && inp->inp_linger) { - lingerstart(tp); - - /* - * In case sleep returns prematurely, which it can, - * check that we're still doing the linger boogie. - */ - - while (tp->t_linger) { - if (sleep((caddr_t) tp, PLINGER | PCATCH)) { - /* - * Caught signal, so later. - */ - tp->t_linger = 0; - tp->t_timer[TCPT_LINGER] = 0; - tcpstat.tcps_lingerabort++; + int *idp, s; + + if (!(idp = (int *) kmem_alloc(sizeof(int), KM_NOSLEEP))) { + tp->t_qsize = 0; + inp->inp_q = NULL; + q->q_ptr = NULL; + return; + } + s = splnet(); + tp->t_ltidp = idp; + *idp = timeout(lingertimer, (caddr_t)tp, inp->inp_linger * HZ); + splx(s); + if (sleep((caddr_t) tp, PLINGER | PCATCH)) { + s = splnet(); + if (*idp) { + untimeout(*idp); + tp->t_ltidp = NULL; tp->t_qsize = 0; - break; - } + splx(s); + u.u_error == EINTR; + } else + splx(s); } + kmem_free(idp, sizeof(int)); } else { tp->t_qsize = 0; } - } - if (q->q_ptr == (caddr_t) inp) { - inp->inp_q = NULL; - q->q_ptr = NULL; - } - i = saveminor; - j = i % 8; - i = i / 8; - tcp_dev[i] &= ~(1 << j); - splx(ss); + inp->inp_q = NULL; + q->q_ptr = NULL; } + /* * tcpuwput is the upper write put routine. It takes messages from user * level for processing. Protocol requests can fed into the state machine in @@ -416,7 +409,7 @@ tcpioctl(q, bp) mblk_t *bp; { struct iocblk *iocbp; - struct sockaddr_in *sin; + struct taddr_in *sin; struct inpcb *inp; iocbp = (struct iocblk *) bp->b_rptr; @@ -510,22 +503,22 @@ tcpioctl(q, bp) case SIOCGETNAME: /* obsolete - replaced by TI_GETMYNAME */ iocbp->ioc_count = 0; - if ((bp->b_cont = allocb(sizeof(struct sockaddr_in), BPRI_LO)) + if ((bp->b_cont = allocb(sizeof(struct taddr_in), BPRI_LO)) == NULL) { bp->b_datap->db_type = M_IOCNAK; iocbp->ioc_error = ENOSR; qreply(q, bp); return; } - bp->b_cont->b_wptr += sizeof(struct sockaddr_in); - sin = (struct sockaddr_in *) bp->b_cont->b_rptr; - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + bp->b_cont->b_wptr += sizeof(struct taddr_in); + sin = (struct taddr_in *) bp->b_cont->b_rptr; + bzero((caddr_t) sin, sizeof(struct taddr_in)); inp = qtoinp(q); sin->sin_family = AF_INET; sin->sin_port = inp->inp_lport; sin->sin_addr = inp->inp_laddr; bp->b_datap->db_type = M_IOCACK; - iocbp->ioc_count = sizeof(struct sockaddr_in); + iocbp->ioc_count = sizeof(struct taddr_in); qreply(q, bp); return; @@ -538,21 +531,21 @@ tcpioctl(q, bp) qreply(q, bp); return; } - if ((bp->b_cont = allocb(sizeof(struct sockaddr_in), BPRI_LO)) + if ((bp->b_cont = allocb(sizeof(struct taddr_in), BPRI_LO)) == NULL) { bp->b_datap->db_type = M_IOCNAK; iocbp->ioc_error = ENOSR; qreply(q, bp); return; } - bp->b_cont->b_wptr += sizeof(struct sockaddr_in); - sin = (struct sockaddr_in *) bp->b_cont->b_rptr; - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + bp->b_cont->b_wptr += sizeof(struct taddr_in); + sin = (struct taddr_in *) bp->b_cont->b_rptr; + bzero((caddr_t) sin, sizeof(struct taddr_in)); sin->sin_family = AF_INET; sin->sin_port = inp->inp_fport; sin->sin_addr = inp->inp_faddr; bp->b_datap->db_type = M_IOCACK; - iocbp->ioc_count = sizeof(struct sockaddr_in); + iocbp->ioc_count = sizeof(struct taddr_in); qreply(q, bp); return; @@ -624,10 +617,27 @@ tcpioctl(q, bp) tcpinit() { +#ifdef TCPDEBUG + extern int net_tcpdebug; +#endif TCPDEBUG struct T_data_ind *di; STRLOG(TCPM_ID, 0, 9, SL_TRACE, "tcpinit starting"); +#ifdef TCPDEBUG + tcp_ndebug = net_tcpdebug; + + if (tcp_ndebug) { +#ifdef LATER + tcp_debug = (struct tcp_debug *) + kmem_alloc((int) (tcp_ndebug * sizeof(struct tcp_debug)), KM_NOSLEEP); +#endif + if (tcp_debug == NULL) { + setuerror(ENOSR); + return; + } + } +#endif TCPDEBUG /* allocate header for T_DATA_IND messages */ if (!(tcp_dihdr = allocb(sizeof(struct T_data_ind), BPRI_HI))) { @@ -646,7 +656,6 @@ tcpinit() tcp_slowtimo(); tcp_fasttimo(); - ipinit(); ipregister(); tcpinited = 1; @@ -702,11 +711,7 @@ tcplrput(q, bp) case N_UNITDATA_IND: if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcplrput: got N_UNITDATA_IND\n"); -#else - printf( "tcplrput: got N_UNITDATA_IND\n"); -#endif + printf ("tcplrput: got N_UNITDATA_IND\n"); head = bp; bp = bp->b_cont; freeb(head); @@ -734,22 +739,14 @@ tcplrput(q, bp) struct iocblk_in *iocbp = (struct iocblk_in *) bp->b_rptr; if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcplrput: got M_IOCACK/NAK\n"); -#else - printf( "tcplrput: got M_IOCACK/NAK\n"); -#endif + printf ("tcplrput: got M_IOCACK/NAK\n"); putnext(iocbp->ioc_transport_client, bp); break; } case M_CTL: if (tcpdprintf) -#ifdef SYSV - cmn_err(CE_NOTE, "tcplrput: got M_CTL\n"); -#else - printf( "tcplrput: got M_CTL\n"); -#endif + printf ("tcplrput: got M_CTL\n"); tcp_ctlinput(bp); freemsg(bp); break; diff --git a/usr/src/uts/3b2/netinet/tcp_output.c b/usr/src/uts/3b2/netinet/tcp_output.c index 0adac82..5a0b76b 100644 --- a/usr/src/uts/3b2/netinet/tcp_output.c +++ b/usr/src/uts/3b2/netinet/tcp_output.c @@ -5,7 +5,25 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/tcp_output.c 1.8" +#ident "@(#)netinet:netinet/tcp_output.c 1.6" + +/* + * System V STREAMS TCP - Release 2.0 + * + * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) All Rights Reserved. + * + * The copyright above and this notice must be preserved in all copies of this + * source code. The copyright above does not evidence any actual or intended + * publication of this source code. + * + * This is unpublished proprietary trade secret source code of Lachman + * Associates. This source code may not be copied, disclosed, distributed, + * demonstrated or licensed except as expressly authorized by Lachman + * Associates. + * + * System V STREAMS TCP was jointly developed by Lachman Associates and + * Convergent Technologies. + */ /* * PROPRIETARY NOTICE (Combined) @@ -28,25 +46,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - #define STRNET #ifdef INET @@ -84,9 +83,7 @@ #include #include #ifdef SYSV -#ifdef SYSV #include -#endif #endif SYSV /* @@ -94,6 +91,7 @@ */ u_char tcp_initopt[4] = {TCPOPT_MAXSEG, 4, 0x0, 0x0,}; extern int tcpcksum; +/*extern void bcopy();*/ extern int tcpalldebug; extern queue_t *tcp_qbot; mblk_t *tcp_dupblks(); @@ -107,7 +105,6 @@ tcp_out(tp) tcp_io(tp, TF_NEEDOUT, NULL); } -struct tcpcb * tcp_output(tp) register struct tcpcb *tp; { @@ -188,10 +185,12 @@ tcp_output(tp) } if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + tp->t_qsize)) flags &= ~TH_FIN; +#ifdef OSDEBUG else if (flags & TH_FIN) strlog(TCPM_ID, 1, 9, SL_TRACE, "FIN not suppressed: %d >= %d", tp->snd_nxt + len, tp->snd_una + tp->t_qsize); +#endif /* OSDEBUG */ /* calculate receive window */ win = recvspace - tp->t_iqsize; @@ -272,7 +271,7 @@ tcp_output(tp) /* * No reason to send a segment, just return. */ - return(tp); + return; send: /* @@ -283,7 +282,7 @@ tcp_output(tp) bp = allocb(sizeof(struct tcpiphdr), BPRI_HI); if (bp == NULL) { bufcall(sizeof(struct tcpiphdr), BPRI_HI, tcp_out, (long) tp); - return(tp); + return; } bp->b_rptr = bp->b_datap->db_lim - sizeof(struct tcpiphdr); bp->b_wptr = bp->b_datap->db_lim; @@ -313,12 +312,12 @@ tcp_output(tp) ti = (struct tcpiphdr *) bp->b_rptr; if (tp->t_template == 0) -#ifdef SYSV - cmn_err(CE_PANIC, "tcp_output: null t_template"); + +#ifdef SYSV + cmn_err(CE_PANIC, "tcp_output"); #else - panic( "tcp_output: null t_template"); -#endif - + panic ("tcp_output"); +#endif SYSV bcopy((caddr_t) tp->t_template, (caddr_t) ti, sizeof(struct tcpiphdr)); /* @@ -346,8 +345,6 @@ tcp_output(tp) opt[2] = mss >> 8 & 0xff; opt[3] = mss & 0xff; } - else - mss = IP_MSS - sizeof(struct tcpiphdr); } if (opt) { bp0 = bp->b_cont; @@ -356,7 +353,7 @@ tcp_output(tp) (void) freeb(bp); freemsg(bp0); bufcall(optlen + 4, BPRI_HI, tcp_out, (long) tp); - return(tp); + return; } bp->b_cont->b_cont = bp0; bp0 = bp->b_cont; @@ -478,7 +475,7 @@ tcp_output(tp) freemsg(bp); bufcall(sizeof(struct ip_unitdata_req), BPRI_HI, tcp_out, (long) tp); - return(tp); + return; } bp0->b_cont = bp; bp = bp0; @@ -513,7 +510,6 @@ tcp_output(tp) if (sendalot) goto again; tp->t_force = 0; - return(tp); } tcp_setpersist(tp) @@ -522,11 +518,7 @@ tcp_setpersist(tp) register t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; if (tp->t_timer[TCPT_REXMT]) -#ifdef SYSV - cmn_err(CE_PANIC,"tcp_output REXMT"); -#else panic("tcp_output REXMT"); -#endif /* * Start/restart persistance timer. */ @@ -551,7 +543,7 @@ tcp_dupblks(q, off, len) mblk_t *head, *newhead; int n; int origoff = off; - int blocks = 0; /* count of data blocks we've dup'd */ + int blocks = 0; /* count of data blocks we've duped */ STRLOG(TCPM_ID, 2, 9, SL_TRACE, "tcp_dupblks q %x off %d len %d", q, off, len); @@ -594,8 +586,8 @@ tcp_dupblks(q, off, len) #ifdef SYSV cmn_err(CE_PANIC, "tcp_dupblks"); #else - panic( "tcp_dupblks"); -#endif + panic ("tcp_dupblks"); +#endif SYSV } nbp->b_wptr += len; /* adjust to correct size (len <= 0) */ nbp->b_cont = NULL; diff --git a/usr/src/uts/3b2/netinet/tcp_seq.h b/usr/src/uts/3b2/netinet/tcp_seq.h index 698fe79..34bdbc4 100644 --- a/usr/src/uts/3b2/netinet/tcp_seq.h +++ b/usr/src/uts/3b2/netinet/tcp_seq.h @@ -8,7 +8,7 @@ #ifndef _NETINET_TCP_SEQ_H #define _NETINET_TCP_SEQ_H -#ident "@(#)head.sys:sys/netinet/tcp_seq.h 1.3" +#ident "@(#)head.sys:sys/netinet/tcp_seq.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -31,43 +31,15 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - - /* * TCP sequence numbers are 32 bit integers operated * on with modular arithmetic. These macros can be * used to compare such integers. */ - -#ifdef vax #define SEQ_LT(a,b) ((int)((a)-(b)) < 0) #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) -#else -#define SEQ_LT(a,b) (((a)-(b))&0x80000000) -#define SEQ_LEQ(a,b) (!SEQ_GT(a,b)) -#define SEQ_GT(a,b) SEQ_LT(b,a) -#define SEQ_GEQ(a,b) (!SEQ_LT(a,b)) -#endif /* * Macros to initialize tcp sequence numbers for @@ -84,7 +56,7 @@ #define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ #ifdef _KERNEL -extern tcp_seq tcp_iss; /* tcp initial send seq # */ +tcp_seq tcp_iss; /* tcp initial send seq # */ #endif #endif /* _NETINET_TCP_SEQ_H */ diff --git a/usr/src/uts/3b2/netinet/tcp_state.c b/usr/src/uts/3b2/netinet/tcp_state.c index 5eb3449..b7e0d73 100644 --- a/usr/src/uts/3b2/netinet/tcp_state.c +++ b/usr/src/uts/3b2/netinet/tcp_state.c @@ -5,7 +5,25 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/tcp_state.c 1.9" +#ident "@(#)netinet:netinet/tcp_state.c 1.5" + +/* + * System V STREAMS TCP - Release 2.0 + * + * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) All Rights Reserved. + * + * The copyright above and this notice must be preserved in all copies of this + * source code. The copyright above does not evidence any actual or intended + * publication of this source code. + * + * This is unpublished proprietary trade secret source code of Lachman + * Associates. This source code may not be copied, disclosed, distributed, + * demonstrated or licensed except as expressly authorized by Lachman + * Associates. + * + * System V STREAMS TCP was jointly developed by Lachman Associates and + * Convergent Technologies. + */ /* * PROPRIETARY NOTICE (Combined) @@ -28,25 +46,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - #define STRNET #ifdef INET @@ -55,6 +54,7 @@ #include #include + #include #include #include @@ -89,9 +89,7 @@ #include #include #ifdef SYSV -#ifdef SYSV #include -#endif #endif SYSV #include @@ -148,7 +146,7 @@ static char ti_statetbl[TE_NOEVENTS + 2][TS_NOSTATES] = { ti_statetbl[X][Y] ) #endif /* OSDEBUG */ -#define BADSTATE nr /* unreachable state */ +#define BADSTATE 127 /* unreachable state */ /* * Mapping of TLI T_primitive types to state machine events @@ -181,7 +179,6 @@ extern int tcpalldebug; extern struct inpcb *in_pcballoc(); extern struct tcpcb *tcp_newtcpcb(); - mblk_t *reallocb(); #define CHECKSIZE(bp,size) if (((bp) = reallocb((bp), (size),0)) == NULL) {\ @@ -205,11 +202,10 @@ tcp_state(q, bp) queue_t *newq; mblk_t *head; short ostate; /* used for tracing */ - struct sockaddr_in *sin; + struct taddr_in *sin; int otype; register int s; short tstate; - extern int tcpopen(); tp = intotcpcb(inp); ostate = tp->t_state; @@ -241,7 +237,7 @@ tcp_state(q, bp) (struct tcpiphdr *) 0, T_DATA_REQ); } else { CHECKSIZE(bp, sizeof(struct T_error_ack)); - bp->b_datap->db_type = M_PCPROTO; + bp->b_datap->db_type = M_PROTO; t_prim = (union T_primitives *) bp->b_rptr; bp->b_wptr = bp->b_rptr + sizeof(struct T_error_ack); t_prim->type = T_ERROR_ACK; @@ -271,12 +267,11 @@ tcp_state(q, bp) t_prim->info_ack.ETSDU_size = 1; t_prim->info_ack.CDATA_size = -2; /* ==> not supported */ t_prim->info_ack.DDATA_size = -2; - t_prim->info_ack.ADDR_size = sizeof(struct sockaddr_in); + t_prim->info_ack.ADDR_size = sizeof(struct taddr_in); t_prim->info_ack.OPT_size = -1; t_prim->info_ack.TIDU_size = 16 * 1024; t_prim->info_ack.SERV_type = T_COTS_ORD; t_prim->info_ack.CURRENT_state = inp->inp_tstate; - bp->b_datap->db_type = M_PCPROTO; /* make sure */ qreply(q, bp); break; @@ -289,7 +284,8 @@ tcp_state(q, bp) if (t_prim->bind_req.ADDR_length == 0) { error = in_pcbbind(inp, NULL); } else { - if (!in_chkaddrlen(t_prim->bind_req.ADDR_length)) { + if (t_prim->bind_req.ADDR_length + != sizeof(struct taddr_in)) { T_errorack(q, bp, TBADADDR, 0); break; } @@ -302,11 +298,6 @@ tcp_state(q, bp) error = 0; break; } - else if (error == EINVAL) { - T_errorack(q, bp, TBADADDR, 0); - error = 0; - break; - } else if (error) break; inp->inp_tstate = TS_IDLE; @@ -316,23 +307,22 @@ tcp_state(q, bp) inp->inp_protoopt |= SO_ACCEPTCONN; } if ((bp = reallocb(bp, sizeof(struct T_bind_ack) - + sizeof(struct sockaddr_in), 1)) + + sizeof(struct taddr_in), 1)) == NULL) { return; } t_prim = (union T_primitives *) bp->b_rptr; t_prim->bind_ack.PRIM_type = T_BIND_ACK; - t_prim->bind_ack.ADDR_length = sizeof(struct sockaddr_in); + t_prim->bind_ack.ADDR_length = sizeof(struct taddr_in); t_prim->bind_ack.ADDR_offset = sizeof(struct T_bind_req); - sin = (struct sockaddr_in *) + sin = (struct taddr_in *) (bp->b_rptr + sizeof(struct T_bind_ack)); bp->b_wptr = (unsigned char *) - (((caddr_t) sin) + sizeof(struct sockaddr_in)); - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + (((caddr_t) sin) + sizeof(struct taddr_in)); + bzero((caddr_t) sin, sizeof(struct taddr_in)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_laddr; sin->sin_port = inp->inp_lport; - bp->b_datap->db_type = M_PCPROTO; qreply(q, bp); break; @@ -372,15 +362,9 @@ tcp_state(q, bp) break; } bp->b_rptr += t_prim->conn_req.DEST_offset; - error = in_pcbconnect(inp, bp); - bp->b_rptr -= t_prim->conn_req.DEST_offset; - if (error == EINVAL) { - T_errorack(q, bp, TBADADDR, 0); - error = 0; - break; - } - else if (error) + if (error = in_pcbconnect(inp, bp)) break; + bp->b_rptr -= t_prim->conn_req.DEST_offset; tp->t_template = tcp_template(tp); if (tp->t_template == 0) { in_pcbdisconnect(inp); @@ -410,19 +394,9 @@ tcp_state(q, bp) T_errorack(q, bp, TOUTSTATE, 0); break; } - /* - * Don't do this accept if it's not a TCP queue. - */ - - newq = t_prim->conn_res.QUEUE_ptr; - if (newq->q_qinfo->qi_qopen != tcpopen) { - T_errorack(q, bp, TBADF, 0); - break; - } - inp->inp_tstate = NEXTSTATE(prim_to_event[t_prim->type], inp->inp_tstate); - + newq = t_prim->conn_res.QUEUE_ptr; if (newq != RD(q)) { newinp = (struct inpcb *) newq->q_ptr; ASSERT(newinp); @@ -489,8 +463,6 @@ tcp_state(q, bp) T_errorack(q, bp, TOUTSTATE, 0); break; } - if (bp) - freemsg(bp); tcp_disconnect(tp); break; @@ -572,19 +544,15 @@ tcp_state(q, bp) tp = intotcpcb(inp); head = bp; bp = bp->b_cont; - if (bp == NULL) { - freeb(head); + freeb(head); + if (bp == NULL) break; - } s = splstr(); tp->t_qsize += msgdsize(bp); - if (((struct T_exdata_req *)head->b_rptr)->MORE_flag == 0) { - tp->snd_up = tp->snd_una + tp->t_qsize; - tp->t_force = 1; - } + tp->snd_up = tp->snd_una + tp->t_qsize; + tp->t_force = 1; putq(q, bp); splx(s); - freeb(head); break; default: @@ -844,39 +812,42 @@ inpisconnected(inp) register struct inpcb *head; mblk_t *bp; struct T_conn_ind *conn_ind; - struct sockaddr_in *sin; + struct taddr_in *sin; int cnt; STRLOG(TCPM_ID, 1, 5, SL_TRACE, "inpisconn inp %x tp %x head %x", inp, tp, htp); + cnt = MAX((sizeof(struct T_conn_ind) + sizeof(struct taddr_in)), + (sizeof(struct T_conn_con) + sizeof(struct taddr_in) + + 4)); /* sizeof (MSS option) == 4 */ + + if ((bp = allocb(cnt, BPRI_HI)) == NULL) { + STRLOG(TCPM_ID, 1, 2, SL_TRACE, "inpisconn alloc fail inp %x", inp); + return; + } + bp->b_wptr += cnt; + bp->b_datap->db_type = M_PROTO; if (htp) { head = htp->t_inpcb; - cnt = sizeof(struct T_conn_ind) + sizeof(struct sockaddr_in); - if ((bp = allocb(cnt, BPRI_HI)) == NULL) { - STRLOG(TCPM_ID, 1, 2, SL_TRACE, "inpisconn alloc fail inp %x", inp); - return; - } - bp->b_wptr += cnt; - bp->b_datap->db_type = M_PROTO; head->inp_tstate = NEXTSTATE(TE_CONN_IND, head->inp_tstate); inp->inp_tstate = TS_DATA_XFER; if (tpqremque(tp, 0) == 0) #ifdef SYSV - cmn_err(CE_PANIC, "inpisconnected: tpqremque failed"); + cmn_err(CE_PANIC, "soisconnected"); #else - panic( "inpisconnected: tpqremque failed"); -#endif + panic ("soisconnected"); +#endif SYSV tpqinsque(htp, tp, 1); conn_ind = (struct T_conn_ind *) bp->b_rptr; - sin = (struct sockaddr_in *) (bp->b_rptr + + sin = (struct taddr_in *) (bp->b_rptr + sizeof(struct T_conn_ind)); conn_ind->PRIM_type = T_CONN_IND; - conn_ind->SRC_length = sizeof(struct sockaddr_in); + conn_ind->SRC_length = sizeof(struct taddr_in); conn_ind->SRC_offset = sizeof(struct T_conn_ind); conn_ind->OPT_length = 0; conn_ind->OPT_offset = 0; @@ -887,21 +858,13 @@ inpisconnected(inp) caddr_t p; int mss; - /* sizeof (MSS option) == 4 */ - cnt = sizeof(struct T_conn_con) + sizeof(struct sockaddr_in) + 4; - if ((bp = allocb(cnt, BPRI_HI)) == NULL) { - STRLOG(TCPM_ID, 1, 2, SL_TRACE, "inpisconn alloc fail inp %x", inp); - return; - } - bp->b_wptr += cnt; - bp->b_datap->db_type = M_PROTO; inp->inp_tstate = NEXTSTATE(TE_CONN_CON, inp->inp_tstate); conn_con = (struct T_conn_con *) bp->b_rptr; - sin = (struct sockaddr_in *) (bp->b_rptr + + sin = (struct taddr_in *) (bp->b_rptr + sizeof(struct T_conn_con) + 4); conn_con->PRIM_type = T_CONN_CON; - conn_con->RES_length = sizeof(struct sockaddr_in); + conn_con->RES_length = sizeof(struct taddr_in); conn_con->RES_offset = sizeof(struct T_conn_con) + 4; conn_con->OPT_length = 4; conn_con->OPT_offset = sizeof(struct T_conn_con); @@ -944,14 +907,15 @@ inpordrelind(inp) STRLOG(TCPM_ID, 1, 5, SL_TRACE, "inpordrel inp %x", inp); + if ((bp = allocb(sizeof(struct T_ordrel_ind), BPRI_HI)) == NULL) + return 0; + if (NEXTSTATE(TE_ORDREL_IND, inp->inp_tstate) == BADSTATE) { STRLOG(TCPM_ID, 1, 4, SL_TRACE, "inpordrel inp %x, bad state %d", inp, inp->inp_tstate); return 1; } - if ((bp = allocb(sizeof(struct T_ordrel_ind), BPRI_HI)) == NULL) - return 0; inp->inp_tstate = NEXTSTATE(TE_ORDREL_IND, inp->inp_tstate); bp->b_datap->db_type = M_PROTO; ind = (struct T_ordrel_ind *) bp->b_rptr; @@ -1023,7 +987,7 @@ tcp_uderr(bp) mblk_t *bp; { struct N_uderror_ind *uderr; - struct sockaddr_in sin; + struct taddr_in sin; uderr = (struct N_uderror_ind *) bp->b_rptr; if (uderr->ERROR_type == ENOSR) diff --git a/usr/src/uts/3b2/netinet/tcp_subr.c b/usr/src/uts/3b2/netinet/tcp_subr.c index c2fb67c..21d4ba8 100644 --- a/usr/src/uts/3b2/netinet/tcp_subr.c +++ b/usr/src/uts/3b2/netinet/tcp_subr.c @@ -5,7 +5,25 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/tcp_subr.c 1.7" +#ident "@(#)netinet:netinet/tcp_subr.c 1.5" + +/* + * System V STREAMS TCP - Release 2.0 + * + * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) All Rights Reserved. + * + * The copyright above and this notice must be preserved in all copies of this + * source code. The copyright above does not evidence any actual or intended + * publication of this source code. + * + * This is unpublished proprietary trade secret source code of Lachman + * Associates. This source code may not be copied, disclosed, distributed, + * demonstrated or licensed except as expressly authorized by Lachman + * Associates. + * + * System V STREAMS TCP was jointly developed by Lachman Associates and + * Convergent Technologies. + */ /* * PROPRIETARY NOTICE (Combined) @@ -28,25 +46,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - #define STRNET #ifdef INET @@ -71,9 +70,7 @@ #endif SYSV #include #ifdef SYSV -#ifdef SYSV #include -#endif #endif SYSV #include @@ -167,8 +164,6 @@ tcp_respond(bp, tp, ti, ack, seq, flags) if (tp) { if (tp->t_inpcb->inp_q && !(tp->t_inpcb->inp_state & SS_CANTRCVMORE)) { win = tp->t_inpcb->inp_q->q_hiwat - tp->t_iqsize; - if (win < (long)(tp->rcv_adv - tp->rcv_nxt)) - win = (long)(tp->rcv_adv - tp->rcv_nxt); } ro = &tp->t_inpcb->inp_route; } else { @@ -273,11 +268,10 @@ tcp_newtcpcb(inp) TCPT_RANGESET(tp->t_rxtcur, ((TCPTV_SRTTBASE >> 2) + (TCPTV_SRTTDFLT << 2)) >> 1, TCPTV_MIN, TCPTV_REXMTMAX); - tp->t_linger = 0; + tp->t_ltidp = NULL; tp->t_inq = NULL; tp->snd_cwnd = 65535; tp->snd_ssthresh = 65535; /* XXX */ - tp->t_maxwin = inp->inp_q->q_hiwat; /* XXX -- is this right?? */ tp->t_iqurp = -1; /* no urgent data present */ inp->inp_ppcb = (caddr_t) tp; STRLOG(TCPM_ID, 1, 5, SL_TRACE, "newtcpcb tcb %x inp %x", tp, inp); @@ -368,8 +362,8 @@ tcp_freespc(tp) #ifdef SYSV cmn_err(CE_PANIC, "tcp_freespc remque"); #else - panic( "tcp_freespc remque"); -#endif + panic ("tcp_freespc remque"); +#endif SYSV } bp = tp->t_inq; while (bp) { @@ -393,7 +387,7 @@ tcp_ctlinput(bp) struct ip_ctlmsg *ctl; extern u_char inetctlerrmap[]; int tcp_quench(), in_rtchange(); - struct sockaddr_in sin; + struct taddr_in sin; int tcp_errdiscon(); ctl = (struct ip_ctlmsg *) bp->b_rptr; @@ -401,7 +395,7 @@ tcp_ctlinput(bp) return; if (ctl->ctl_addr.s_addr == INADDR_ANY) return; - sin.sin_family = htons(AF_INET); + sin.sin_family = AF_INET; sin.sin_addr.s_addr = ctl->ctl_addr.s_addr; sin.sin_port = 0; @@ -458,6 +452,7 @@ tcp_enqdata(tp, bp, urp) tp->t_qlast = bp; } else { tp->t_qfirst = tp->t_qlast = bp; + } if (urp != -1) @@ -499,8 +494,8 @@ tcp_deqdata(q) #ifdef SYSV cmn_err(CE_WARN, "tcp_deqdata: null q_ptr wq %x", WR(q)); #else - printf( "tcp_deqdata: null q_ptr wq %x", WR(q)); -#endif + printf ("tcp_deqdata: null q_ptr wq %x", WR(q)); +#endif SYSV return; } @@ -564,7 +559,8 @@ tcp_deqdata(q) } } -struct tcpcb *tcp_output(), *tcp_uinput(), *tcp_dotimers(); +#define swap(x,y,t) {t=x; x=y; y=t;} +void tcp_output(), tcp_uinput(); tcp_io(tp, flag, bp) register struct tcpcb *tp; @@ -573,35 +569,41 @@ tcp_io(tp, flag, bp) { int s; int oflag, tflag; - struct tcpcb *(*func)(); + void (*func)(), (*ofunc)(), (*tfunc)(); mblk_t **bpp; s = splstr(); - if (flag == TF_NEEDIN) { + if (flag == TF_NEEDOUT) { + func = tcp_output; + oflag = TF_NEEDIN; + ofunc = tcp_uinput; + } else { + func = tcp_uinput; + oflag = TF_NEEDOUT; + ofunc = tcp_output; for (bpp = &tp->t_inq; *bpp; bpp = &(*bpp)->b_next) ; *bpp = bp; bp->b_next = NULL; } - tp->t_flags |= flag; - if (!(tp->t_flags & TF_IOLOCK)) { + if (tp->t_flags & TF_IOLOCK) { + tp->t_flags |= flag; + } else { tp->t_flags |= TF_IOLOCK; for (;;) { /* TF_NEED* flags cleared by service routines */ - if (tp->t_flags & TF_NEEDTIMER) - func = tcp_dotimers; - else if (tp->t_flags & TF_NEEDOUT) - func = tcp_output; - else if (tp->t_flags & TF_NEEDIN) - func = tcp_uinput; - else { - tp->t_flags &= ~TF_IOLOCK; - break; - } splx(s); - if (!(*func)(tp)) - return; + (*func)(tp); s = splstr(); + if (tp->t_flags & oflag) { + swap(flag, oflag, tflag); + swap(func, ofunc, tfunc); + } else if (tp->t_flags & flag) { + continue; + } else { + tp->t_flags &= ~TF_IOLOCK; + break; + } } } splx(s); diff --git a/usr/src/uts/3b2/netinet/tcp_timer.c b/usr/src/uts/3b2/netinet/tcp_timer.c index abe6702..6c92252 100644 --- a/usr/src/uts/3b2/netinet/tcp_timer.c +++ b/usr/src/uts/3b2/netinet/tcp_timer.c @@ -5,7 +5,25 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/tcp_timer.c 1.5" +#ident "@(#)netinet:netinet/tcp_timer.c 1.4" + +/* + * System V STREAMS TCP - Release 2.0 + * + * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) All Rights Reserved. + * + * The copyright above and this notice must be preserved in all copies of this + * source code. The copyright above does not evidence any actual or intended + * publication of this source code. + * + * This is unpublished proprietary trade secret source code of Lachman + * Associates. This source code may not be copied, disclosed, distributed, + * demonstrated or licensed except as expressly authorized by Lachman + * Associates. + * + * System V STREAMS TCP was jointly developed by Lachman Associates and + * Convergent Technologies. + */ /* * PROPRIETARY NOTICE (Combined) @@ -28,25 +46,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - #define STRNET #ifdef INET @@ -77,9 +76,6 @@ #include #include #include -#ifdef SYSV -#include -#endif int tcpnodelack = 0; int tcp_keepidle = TCPTV_KEEP_IDLE; @@ -113,38 +109,12 @@ tcp_fasttimo() /* * Tcp protocol timeout routine called every 500 ms. Updates the timers in * all active tcb's and causes finite state machine actions if timers expire. - * (tcp_slowtimo now processes timers by calling tcp_dotimers under the - * I/O lock.) */ -struct tcpcb * -tcp_dotimers(tp) -struct tcpcb *tp; -{ - register int i; - - i = splstr(); - tp->t_flags &= ~TF_NEEDTIMER; - splx(i); - for (i = 0; i < TCPT_NTIMERS; i++) { - if (tp->t_timer[i] && --tp->t_timer[i] == 0) { - if (!tcp_timers(tp, i)) - return (struct tcpcb *) 0; - if ((tp->t_inpcb->inp_protoopt & SO_DEBUG) - || tcpalldebug != 0) - tcp_trace(TA_TIMER, tp->t_state, tp, - (struct tcpiphdr *) 0, i); - } - } - tp->t_idle++; - if (tp->t_rtt) - tp->t_rtt++; - return tp; -} - tcp_slowtimo() { register struct inpcb *ip, *ipnxt; register struct tcpcb *tp; + register int i; tcp_maxidle = TCPTV_KEEPCNT * tcp_keepintvl; /* @@ -157,8 +127,25 @@ tcp_slowtimo() for (; ip != &tcb; ip = ipnxt) { ipnxt = ip->inp_next; tp = intotcpcb(ip); - if (tp) - tcp_io(tp, TF_NEEDTIMER, NULL); + if (tp == 0) { + continue; + } + for (i = 0; i < TCPT_NTIMERS; i++) { + if (tp->t_timer[i] && --tp->t_timer[i] == 0) { + tcp_timers(tp, i); + if ((tp->t_inpcb->inp_protoopt & SO_DEBUG) + || tcpalldebug != 0) + tcp_trace(TA_TIMER, tp->t_state, tp, + (struct tcpiphdr *) 0, i); + if (ipnxt->inp_prev != ip) + goto tpgone; + } + } + tp->t_idle++; + if (tp->t_rtt) + tp->t_rtt++; +tpgone: + ; } tcp_iss += TCP_ISSINCR / PR_SLOWHZ; /* increment iss */ #ifdef TCP_COMPAT_42 @@ -192,8 +179,6 @@ tcp_timers(tp, timer) { register int rexmt; - extern void lingertimer(); - switch (timer) { /* @@ -279,7 +264,7 @@ tcp_timers(tp, timer) tp->snd_cwnd = tp->t_maxseg; tp->snd_ssthresh = win * tp->t_maxseg; } - tcp_output(tp); + tcp_io(tp, TF_NEEDOUT, NULL); break; /* @@ -290,7 +275,7 @@ tcp_timers(tp, timer) tcpstat.tcps_persisttimeo++; tcp_setpersist(tp); tp->t_force = 1; - tcp_output(tp); + tcp_io(tp, TF_NEEDOUT, NULL); break; /* @@ -333,15 +318,11 @@ tcp_timers(tp, timer) } else tp->t_timer[TCPT_KEEP] = tcp_keepidle; break; -dropit: + dropit: tcpstat.tcps_keepdrops++; tp = tcp_drop(tp, ETIMEDOUT); break; - case TCPT_LINGER: - lingertimer(tp); - break; - default: panic("tcp_timers"); break; @@ -349,59 +330,31 @@ tcp_timers(tp, timer) return (tp); } -lingerstart(tp) - struct tcpcb *tp; -{ - if (tp) { - tp->t_linger = 1; - tcpstat.tcps_linger++; - tp->t_timer[TCPT_LINGER] = (tp->t_inpcb->inp_linger * PR_SLOWHZ); - } else { -#ifdef SYSV - cmn_err(CE_WARN, "lingerstart: null tp"); -#else - printf( "lingerstart: null tp"); -#endif - } -} - void lingertimer(tp) struct tcpcb *tp; { - if (!tp) { -#ifdef SYSV - cmn_err(CE_WARN, "lingertimer: null tp"); -#else - printf( "lingertimer: null tp"); -#endif - return; - } - tp->t_qsize = 0; - tp->t_linger = 0; - tp->t_timer[TCPT_LINGER] = 0; - tcpstat.tcps_lingerexp++; + *tp->t_ltidp = 0; + tp->t_ltidp = NULL; + tp->t_inpcb->inp_q = NULL; wakeup((caddr_t) tp); tcp_io(tp, TF_NEEDOUT, NULL); - return; } tcp_cancelinger(tp) struct tcpcb *tp; { - if (!tp) { -#ifdef SYSV - cmn_err(CE_WARN, "tcp_cancelinger: null tp"); -#else - printf( "tcp_cancelinger: null tp"); -#endif - return; - } - if (tp->t_linger) { - tp->t_linger = 0; - tp->t_timer[TCPT_LINGER] = 0; - wakeup((caddr_t) tp); - tcpstat.tcps_lingercan++; - } + int s; + + s = splnet(); + if (tp->t_ltidp) { + untimeout(*tp->t_ltidp); + *tp->t_ltidp = 0; + tp->t_ltidp = NULL; + tp->t_inpcb->inp_q = NULL; + splx(s); + wakeup((caddr_t) tp); + } else + splx(s); } diff --git a/usr/src/uts/3b2/netinet/tcp_timer.h b/usr/src/uts/3b2/netinet/tcp_timer.h index 9384fe5..283f8c1 100644 --- a/usr/src/uts/3b2/netinet/tcp_timer.h +++ b/usr/src/uts/3b2/netinet/tcp_timer.h @@ -8,7 +8,7 @@ #ifndef _NETINET_TCP_TIMER_H #define _NETINET_TCP_TIMER_H -#ident "@(#)head.sys:sys/netinet/tcp_timer.h 1.3" +#ident "@(#)head.sys:sys/netinet/tcp_timer.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -31,37 +31,17 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - /* * Definitions of the TCP timers. These timers are counted * down PR_SLOWHZ times a second. */ -#define TCPT_NTIMERS 5 +#define TCPT_NTIMERS 4 -#define TCPT_REXMT 0 /* retransmit */ -#define TCPT_PERSIST 1 /* retransmit persistance */ -#define TCPT_KEEP 2 /* keep alive */ -#define TCPT_2MSL 3 /* 2*msl quiet time timer */ -#define TCPT_LINGER 4 /* linger on close imer */ +#define TCPT_REXMT 0 /* retransmit */ +#define TCPT_PERSIST 1 /* retransmit persistance */ +#define TCPT_KEEP 2 /* keep alive */ +#define TCPT_2MSL 3 /* 2*msl quiet time timer */ /* * The TCPT_REXMT timer is used to force retransmissions. @@ -124,8 +104,8 @@ #define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ #ifdef TCPTIMERS -char *tcptimers[] = -{"REXMT", "PERSIST", "KEEP", "2MSL", "LINGER"}; +char *tcptimers[] = + { "REXMT", "PERSIST", "KEEP", "2MSL" }; #endif /* diff --git a/usr/src/uts/3b2/netinet/tcp_var.h b/usr/src/uts/3b2/netinet/tcp_var.h index c7026ab..638d078 100644 --- a/usr/src/uts/3b2/netinet/tcp_var.h +++ b/usr/src/uts/3b2/netinet/tcp_var.h @@ -8,7 +8,7 @@ #ifndef _NETINET_TCP_VAR_H #define _NETINET_TCP_VAR_H -#ident "@(#)head.sys:sys/netinet/tcp_var.h 1.6" +#ident "@(#)head.sys:sys/netinet/tcp_var.h 1.4" /* * PROPRIETARY NOTICE (Combined) @@ -31,25 +31,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - /* * Kernel variables for tcp. */ @@ -69,7 +50,7 @@ struct tcpcb { short t_dupacks; /* consecutive dup acks recd */ u_short t_maxseg; /* maximum segment size */ char t_force; /* 1 if forcing out a byte */ - u_short t_flags; + u_char t_flags; #define TF_ACKNOW 0x01 /* ack peer immediately */ #define TF_DELACK 0x02 /* ack, but try to delay it */ #define TF_NODELAY 0x04 /* don't delay packets to coalesce */ @@ -79,7 +60,6 @@ struct tcpcb { #define TF_IOLOCK 0x20 #define TF_NEEDIN 0x40 #define TF_NEEDOUT 0x80 -#define TF_NEEDTIMER 0x0100 #endif STRNET struct tcpiphdr *t_template; /* skeletal packet for transmit */ #ifdef STRNET @@ -112,7 +92,6 @@ struct tcpcb { tcp_seq snd_max; /* highest sequence number sent * used to recognize retransmits */ - u_long t_maxwin; /* max window size to use */ /* congestion control (for slow start, source quench, retransmit after loss) */ u_long snd_cwnd; /* congestion-controlled window */ u_long snd_ssthresh; /* snd_cwnd size threshhold for @@ -151,14 +130,14 @@ struct tcpcb { u_long t_qsize; /* number of data chars on outq */ /* * here we save mblks that arrive before the connection is accepted - * by the user and those received when the user's queue is full. + * by the user and those received when the user's queue is full. */ mblk_t *t_qfirst; /* beginning of queued data */ mblk_t *t_qlast; /* end of queued data */ int t_iqsize; /* amount of data on input queue */ int t_iqurp; /* offset of urgent byte on input q */ mblk_t *t_inq; /* pending input */ - short t_linger; /* linger flag */ + int *t_ltidp; /* ptr to linger timer id */ #endif STRNET }; @@ -223,10 +202,6 @@ struct tcpstat { u_long tcps_rcvackpack; /* rcvd ack packets */ u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ u_long tcps_rcvwinupd; /* rcvd window update packets */ - u_long tcps_linger; /* connections that lingered */ - u_long tcps_lingerabort; /* lingers aborted by signal */ - u_long tcps_lingerexp; /* linger timer expired */ - u_long tcps_lingercan; /* linger timer cancelled */ }; #ifdef STRNET @@ -249,3 +224,4 @@ struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed(); #define TCP_COMPAT_42 #endif #endif /* _NETINET_TCP_VAR_H */ + diff --git a/usr/src/uts/3b2/netinet/tcpip.h b/usr/src/uts/3b2/netinet/tcpip.h index c52df4f..c91726e 100644 --- a/usr/src/uts/3b2/netinet/tcpip.h +++ b/usr/src/uts/3b2/netinet/tcpip.h @@ -8,7 +8,7 @@ #ifndef _NETINET_TCPIP_H #define _NETINET_TCPIP_H -#ident "@(#)head.sys:sys/netinet/tcpip.h 1.3" +#ident "@(#)head.sys:sys/netinet/tcpip.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -31,25 +31,6 @@ * All rights reserved. */ -/* - * System V STREAMS TCP - Release 3.0 - * - * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) - * All Rights Reserved. - * - * The copyright above and this notice must be preserved in all copies of this - * source code. The copyright above does not evidence any actual or intended - * publication of this source code. - * - * This is unpublished proprietary trade secret source code of Lachman - * Associates. This source code may not be copied, disclosed, distributed, - * demonstrated or licensed except as expressly authorized by Lachman - * Associates. - * - * System V STREAMS TCP was jointly developed by Lachman Associates and - * Convergent Technologies. - */ - /* * Tcp+ip header, after ip options removed. */ diff --git a/usr/src/uts/3b2/netinet/udp_io.c b/usr/src/uts/3b2/netinet/udp_io.c index 56f7726..89c5e98 100644 --- a/usr/src/uts/3b2/netinet/udp_io.c +++ b/usr/src/uts/3b2/netinet/udp_io.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/udp_io.c 1.4" +#ident "@(#)netinet:netinet/udp_io.c 1.3" /* * System V STREAMS TCP - Release 2.0 @@ -99,7 +99,7 @@ int udpcksum = 0; /* XXX */ int udp_ttl = UDP_TTL; -struct sockaddr_in udp_in = {AF_INET}; +struct taddr_in udp_in = {AF_INET}; struct udpstat udpstat; /*ARGSUSED*/ @@ -192,7 +192,7 @@ udp_input(q, bp0) udp_in.sin_addr = ui->ui_src; bp->b_rptr += sizeof(struct udpiphdr); bp0 = allocb(sizeof(struct T_unitdata_ind) + - sizeof(struct sockaddr_in), BPRI_MED); + sizeof(struct taddr_in), BPRI_MED); if (bp0 == NULL) { goto bad; } @@ -200,15 +200,15 @@ udp_input(q, bp0) bp = bp0; bp->b_datap->db_type = M_PROTO; bp->b_wptr += sizeof(struct T_unitdata_ind) + - sizeof(struct sockaddr_in); + sizeof(struct taddr_in); ind = (struct T_unitdata_ind *) bp->b_rptr; ind->PRIM_type = T_UNITDATA_IND; - ind->SRC_length = sizeof(struct sockaddr_in); + ind->SRC_length = sizeof(struct taddr_in); ind->SRC_offset = sizeof(struct T_unitdata_ind); ind->OPT_length = 0; ind->OPT_offset = 0; bcopy((caddr_t) & udp_in, (caddr_t) bp->b_rptr + - sizeof(struct T_unitdata_ind), sizeof(struct sockaddr_in)); + sizeof(struct T_unitdata_ind), sizeof(struct taddr_in)); STRLOG(UDPM_ID, 2, 9, SL_TRACE, "put to inp_q->q_next %x", inp->inp_q->q_next); putnext(inp->inp_q, bp); return; @@ -223,7 +223,7 @@ udp_ctlinput(bp) struct ip_ctlmsg *ctl; extern u_char inetctlerrmap[]; int in_rtchange(); - struct sockaddr_in sin; + struct taddr_in sin; int udp_snduderr(); ctl = (struct ip_ctlmsg *) bp->b_rptr; diff --git a/usr/src/uts/3b2/netinet/udp_main.c b/usr/src/uts/3b2/netinet/udp_main.c index 164e588..b9d80f8 100644 --- a/usr/src/uts/3b2/netinet/udp_main.c +++ b/usr/src/uts/3b2/netinet/udp_main.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/udp_main.c 1.3.3.3" +#ident "@(#)netinet:netinet/udp_main.c 1.3.4.1" /* * System V STREAMS TCP - Release 2.0 @@ -316,7 +316,7 @@ udpioctl(q, bp) mblk_t *bp; { struct iocblk *iocbp; - struct sockaddr_in *sin; + struct taddr_in *sin; struct inpcb *inp; iocbp = (struct iocblk *) bp->b_rptr; @@ -410,22 +410,22 @@ udpioctl(q, bp) case SIOCGETNAME: /* obsolete - replaced by TI_GETMYNAME */ iocbp->ioc_count = 0; - if ((bp->b_cont = allocb(sizeof(struct sockaddr_in), BPRI_LO)) + if ((bp->b_cont = allocb(sizeof(struct taddr_in), BPRI_LO)) == NULL) { bp->b_datap->db_type = M_IOCNAK; iocbp->ioc_error = ENOSR; qreply(q, bp); return; } - bp->b_cont->b_wptr += sizeof(struct sockaddr_in); - sin = (struct sockaddr_in *) bp->b_cont->b_rptr; - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + bp->b_cont->b_wptr += sizeof(struct taddr_in); + sin = (struct taddr_in *) bp->b_cont->b_rptr; + bzero((caddr_t) sin, sizeof(struct taddr_in)); inp = qtoinp(q); sin->sin_family = AF_INET; sin->sin_port = inp->inp_lport; sin->sin_addr = inp->inp_laddr; bp->b_datap->db_type = M_IOCACK; - iocbp->ioc_count = sizeof(struct sockaddr_in); + iocbp->ioc_count = sizeof(struct taddr_in); qreply(q, bp); return; @@ -438,21 +438,21 @@ udpioctl(q, bp) qreply(q, bp); return; } - if ((bp->b_cont = allocb(sizeof(struct sockaddr_in), BPRI_LO)) + if ((bp->b_cont = allocb(sizeof(struct taddr_in), BPRI_LO)) == NULL) { bp->b_datap->db_type = M_IOCNAK; iocbp->ioc_error = ENOSR; qreply(q, bp); return; } - bp->b_cont->b_wptr += sizeof(struct sockaddr_in); - sin = (struct sockaddr_in *) bp->b_cont->b_rptr; - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + bp->b_cont->b_wptr += sizeof(struct taddr_in); + sin = (struct taddr_in *) bp->b_cont->b_rptr; + bzero((caddr_t) sin, sizeof(struct taddr_in)); sin->sin_family = AF_INET; sin->sin_port = inp->inp_fport; sin->sin_addr = inp->inp_faddr; bp->b_datap->db_type = M_IOCACK; - iocbp->ioc_count = sizeof(struct sockaddr_in); + iocbp->ioc_count = sizeof(struct taddr_in); qreply(q, bp); return; @@ -636,7 +636,7 @@ struct inpcb *inp; { mblk_t *mp; struct T_uderror_ind *uderr; - struct sockaddr_in *sin; + struct taddr_in *sin; if (!inp->inp_q) return; @@ -651,7 +651,7 @@ struct inpcb *inp; uderr->OPT_length = 0; uderr->OPT_offset = 0; uderr->ERROR_type = inp->inp_error; - sin = (struct sockaddr_in *) (mp->b_rptr+sizeof(struct T_uderror_ind)); + sin = (struct taddr_in *) (mp->b_rptr+sizeof(struct T_uderror_ind)); bzero((caddr_t)sin, sizeof(*sin)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_faddr; @@ -668,7 +668,7 @@ udp_uderr(bp) mblk_t *bp; { struct N_uderror_ind *uderr; - struct sockaddr_in sin; + struct taddr_in sin; uderr = (struct N_uderror_ind *) bp->b_rptr; if (uderr->ERROR_type == ENOSR) { diff --git a/usr/src/uts/3b2/netinet/udp_state.c b/usr/src/uts/3b2/netinet/udp_state.c index a354312..2babbda 100644 --- a/usr/src/uts/3b2/netinet/udp_state.c +++ b/usr/src/uts/3b2/netinet/udp_state.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)netinet:netinet/udp_state.c 1.5" +#ident "@(#)netinet:netinet/udp_state.c 1.3" /* * System V STREAMS TCP - Release 2.0 @@ -104,7 +104,7 @@ udp_state(q, bp) register struct inpcb *inp = qtoinp(q); int error = 0; mblk_t *head; - struct sockaddr_in *sin; + struct taddr_in *sin; struct in_addr laddr; /* @@ -149,7 +149,7 @@ udp_state(q, bp) t_prim->info_ack.ETSDU_size = -2; t_prim->info_ack.CDATA_size = -2; /* ==> not supported */ t_prim->info_ack.DDATA_size = -2; - t_prim->info_ack.ADDR_size = sizeof(struct sockaddr_in); + t_prim->info_ack.ADDR_size = sizeof(struct taddr_in); t_prim->info_ack.OPT_size = -1; t_prim->info_ack.TIDU_size = 16 * 1024; t_prim->info_ack.SERV_type = T_CLTS; @@ -165,7 +165,8 @@ udp_state(q, bp) if (t_prim->bind_req.ADDR_length == 0) { error = in_pcbbind(inp, (mblk_t *) NULL); } else { - if (!in_chkaddrlen(t_prim->bind_req.ADDR_length)) { + if (t_prim->bind_req.ADDR_length + != sizeof(struct taddr_in)) { T_errorack(q, bp, TBADADDR, 0); break; } @@ -182,19 +183,19 @@ udp_state(q, bp) break; inp->inp_tstate = TS_IDLE; if ((bp = reallocb(bp, sizeof(struct T_bind_ack) - + sizeof(struct sockaddr_in), 1)) + + sizeof(struct taddr_in), 1)) == NULL) { return; } t_prim = (union T_primitives *) bp->b_rptr; t_prim->bind_ack.PRIM_type = T_BIND_ACK; - t_prim->bind_ack.ADDR_length = sizeof(struct sockaddr_in); + t_prim->bind_ack.ADDR_length = sizeof(struct taddr_in); t_prim->bind_ack.ADDR_offset = sizeof(struct T_bind_req); - sin = (struct sockaddr_in *) + sin = (struct taddr_in *) (bp->b_rptr + sizeof(struct T_bind_ack)); bp->b_wptr = (unsigned char *) - (((caddr_t) sin) + sizeof(struct sockaddr_in)); - bzero((caddr_t) sin, sizeof(struct sockaddr_in)); + (((caddr_t) sin) + sizeof(struct taddr_in)); + bzero((caddr_t) sin, sizeof(struct taddr_in)); sin->sin_family = AF_INET; sin->sin_addr = inp->inp_laddr; sin->sin_port = inp->inp_lport; diff --git a/usr/src/uts/3b2/nfs/export.h b/usr/src/uts/3b2/nfs/export.h index c71c87e..a230d0e 100644 --- a/usr/src/uts/3b2/nfs/export.h +++ b/usr/src/uts/3b2/nfs/export.h @@ -8,7 +8,7 @@ #ifndef _NFS_EXPORT_H #define _NFS_EXPORT_H -#ident "@(#)head.sys:sys/nfs/export.h 1.4" +#ident "@(#)head.sys:sys/nfs/export.h 1.3" /* @(#)export.h 1.7 88/08/19 SMI */ @@ -34,24 +34,20 @@ * exported vfs flags. */ -#define EX_RDONLY 0x01 /* exported read only */ -#define EX_RDMOSTLY 0x02 /* exported read mostly */ -#define EX_RDWR 0x04 /* exported read-write */ -#define EX_EXCEPTIONS 0x08 /* exported with ``exceptions'' lists */ -#define EX_ALL (EX_RDONLY | EX_RDMOSTLY | EX_RDWR | EX_EXCEPTIONS) +#define EX_RDONLY 0x01 /* exported read only */ +#define EX_RDMOSTLY 0x02 /* exported read mostly */ -#define EXMAXADDRS 256 /* max number in address list */ +#define EXMAXADDRS 256 /* max number in address list */ struct exaddrlist { unsigned naddrs; /* number of addresses */ struct netbuf *addrvec; /* pointer to array of addresses */ - struct netbuf *addrmask; /* mask of comparable bits of addrvec */ }; /* * Associated with AUTH_UNIX is an array of internet addresses * to check root permission. */ -#define EXMAXROOTADDRS 256 /* should be config option */ +#define EXMAXROOTADDRS 256 /* should be config option */ struct unixexport { struct exaddrlist rootaddrs; }; @@ -61,7 +57,7 @@ struct unixexport { * root permission, plus a time window to check for expired * credentials. */ -#define EXMAXROOTNAMES 256 /* should be config option */ +#define EXMAXROOTNAMES 256 /* should be config option */ struct desexport { unsigned nnames; char **rootnames; @@ -73,29 +69,28 @@ struct desexport { * The export information passed to exportfs() */ struct export { - int ex_flags; /* flags */ - unsigned ex_anon; /* uid for unauthenticated requests */ - int ex_auth; /* switch */ + int ex_flags; /* flags */ + unsigned ex_anon; /* uid for unauthenticated requests */ + int ex_auth; /* switch */ union { - struct unixexport exunix; /* case AUTH_UNIX */ - struct desexport exdes; /* case AUTH_DES */ + struct unixexport exunix; /* case AUTH_UNIX */ + struct desexport exdes; /* case AUTH_DES */ } ex_u; - struct exaddrlist ex_roaddrs; - struct exaddrlist ex_rwaddrs; + struct exaddrlist ex_writeaddrs; }; -#define ex_des ex_u.exdes -#define ex_unix ex_u.exunix +#define ex_des ex_u.exdes +#define ex_unix ex_u.exunix -#ifdef _KERNEL +#ifdef _KERNEL /* * A node associated with an export entry on the list of exported * filesystems. */ struct exportinfo { - struct export exi_export; - fsid_t exi_fsid; - struct fid *exi_fid; - struct exportinfo *exi_next; + struct export exi_export; + fsid_t exi_fsid; + struct fid *exi_fid; + struct exportinfo *exi_next; }; extern struct exportinfo *findexport(); #endif diff --git a/usr/src/uts/3b2/nfs/mount.h b/usr/src/uts/3b2/nfs/mount.h index e2fe713..5fc8ad7 100644 --- a/usr/src/uts/3b2/nfs/mount.h +++ b/usr/src/uts/3b2/nfs/mount.h @@ -8,7 +8,7 @@ #ifndef _NFS_MOUNT_H #define _NFS_MOUNT_H -#ident "@(#)head.sys:sys/nfs/mount.h 1.5" +#ident "@(#)head.sys:sys/nfs/mount.h 1.4" /* * PROPRIETARY NOTICE (Combined) @@ -31,43 +31,41 @@ #ifdef NFSCLIENT struct nfs_args { - struct netbuf *addr; /* file server address */ - struct netbuf *syncaddr; /* secure NFS time sync address */ - struct knetconfig *knconf; /* transport knetconfig struct */ - char *hostname; /* server's hostname */ - char *netname; /* server's netname */ + struct sockaddr *addr; /* file server address */ caddr_t fh; /* File handle to be mounted */ int flags; /* flags */ int wsize; /* write size in bytes */ int rsize; /* read size in bytes */ int timeo; /* initial timeout in .1 secs */ int retrans; /* times to retry send */ + char *hostname; /* server's hostname */ int acregmin; /* attr cache file min secs */ int acregmax; /* attr cache file max secs */ int acdirmin; /* attr cache dir min secs */ int acdirmax; /* attr cache dir max secs */ + char *netname; /* server's netname */ + dev_t tlidev; /* TLI device number */ }; /* * NFS mount option flags */ -#define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */ -#define NFSMNT_WSIZE 0x002 /* set write size */ -#define NFSMNT_RSIZE 0x004 /* set read size */ -#define NFSMNT_TIMEO 0x008 /* set initial timeout */ -#define NFSMNT_RETRANS 0x010 /* set number of request retrys */ -#define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */ -#define NFSMNT_INT 0x040 /* allow interrupts on hard mount */ -#define NFSMNT_NOAC 0x080 /* don't cache attributes */ -#define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */ -#define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */ -#define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */ -#define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */ -#define NFSMNT_SECURE 0x1000 /* secure mount */ -#define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */ -#define NFSMNT_KNCONF 0x4000 /* transport's knetconfig structure */ -#define NFSMNT_GRPID 0x8000 /* System V-style gid inheritance */ -#define NFSMNT_RPCTIMESYNC 0x10000 /* use RPC to do secure NFS time sync */ -#endif /* NFSCLIENT */ +#define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */ +#define NFSMNT_WSIZE 0x002 /* set write size */ +#define NFSMNT_RSIZE 0x004 /* set read size */ +#define NFSMNT_TIMEO 0x008 /* set initial timeout */ +#define NFSMNT_RETRANS 0x010 /* set number of request retrys */ +#define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */ +#define NFSMNT_INT 0x040 /* allow interrupts on hard mount */ +#define NFSMNT_NOAC 0x080 /* don't cache attributes */ +#define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */ +#define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */ +#define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */ +#define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */ +#define NFSMNT_SECURE 0x1000 /* secure mount */ +#define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */ +#define NFSMNT_TLIDEV 0x4000 /* TLI device number */ +#define NFSMNT_GRPID 0x8000 /* System V-style gid inheritance */ +#endif /* NFSCLIENT */ #endif /* _NFS_MOUNT_H */ diff --git a/usr/src/uts/3b2/nfs/nfs.h b/usr/src/uts/3b2/nfs/nfs.h index 55d23c1..7a56d89 100644 --- a/usr/src/uts/3b2/nfs/nfs.h +++ b/usr/src/uts/3b2/nfs/nfs.h @@ -8,7 +8,7 @@ #ifndef _NFS_NFS_H #define _NFS_NFS_H -#ident "@(#)head.sys:sys/nfs/nfs.h 1.5" +#ident "@(#)head.sys:sys/nfs/nfs.h 1.4" /* @(#)nfs.h 2.38 88/08/19 SMI */ @@ -99,7 +99,7 @@ enum nfsftype { #define NFS_FIFO_TYPE NFCHR #define NFS_FIFO_MODE S_IFCHR /* #define NFS_FIFO_DEV (~0) */ -#define NFS_FIFO_DEV ((u_long)-1) +#define NFS_FIFO_DEV (-1UL) /* identify fifo in nfs attributes */ #define NA_ISFIFO(NA) (((NA)->na_type == NFS_FIFO_TYPE) && \ diff --git a/usr/src/uts/3b2/nfs/nfs_clnt.h b/usr/src/uts/3b2/nfs/nfs_clnt.h index b6723bb..a64346f 100644 --- a/usr/src/uts/3b2/nfs/nfs_clnt.h +++ b/usr/src/uts/3b2/nfs/nfs_clnt.h @@ -8,7 +8,7 @@ #ifndef _NFS_NFS_CLNT_H #define _NFS_NFS_CLNT_H -#ident "@(#)head.sys:sys/nfs/nfs_clnt.h 1.8" +#ident "@(#)head.sys:sys/nfs/nfs_clnt.h 1.7" /* @(#)nfs_clnt.h 2.28 88/08/19 SMI */ @@ -54,12 +54,12 @@ #define ACMINMAX 3600 /* 1 hr is longest min timeout */ #define ACMAXMAX 36000 /* 10 hr is longest max timeout */ -#define NFS_CALLTYPES 3 /* Lookups, Reads, Writes */ +#define NFS_CALLTYPES 3 /* Lookups, Reads, Writes */ /* * Fake errno passed back from rfscall to indicate transfer size adjustment */ -#define ENFS_TRYAGAIN 999 +#define ENFS_TRYAGAIN 999 /* * NFS private data per mounted file system @@ -67,17 +67,15 @@ struct mntinfo { struct knetconfig *mi_knetconfig; /* bound TLI fd */ struct netbuf mi_addr; /* server's address */ - struct netbuf mi_syncaddr; /* AUTH_DES time sync addr */ struct vnode *mi_rootvp; /* root vnode */ - u_int mi_hard:1; /* hard or soft mount */ - u_int mi_printed:1; /* not responding message printed */ - u_int mi_int:1; /* interrupts allowed on hard mount */ - u_int mi_down:1; /* server is down */ - u_int mi_noac:1; /* don't cache attributes */ - u_int mi_nocto:1; /* no close-to-open consistency */ - u_int mi_dynamic:1; /* dynamic transfer size adjustment */ - u_int mi_grpid:1; /* System V group id inheritance */ - u_int mi_rpctimesync:1; /* RPC time sync */ + u_int mi_hard : 1; /* hard or soft mount */ + u_int mi_printed : 1;/* not responding message printed */ + u_int mi_int : 1; /* interrupts allowed on hard mount */ + u_int mi_down : 1; /* server is down */ + u_int mi_noac : 1; /* don't cache attributes */ + u_int mi_nocto : 1; /* no close-to-open consistency */ + u_int mi_dynamic : 1;/* dynamic transfer size adjustment */ + u_int mi_grpid : 1; /* System V group id inheritance */ int mi_refct; /* active vnodes for this vfs */ long mi_tsize; /* transfer size (bytes) */ /* really read size */ @@ -107,8 +105,7 @@ struct mntinfo { /* * Mark cached attributes as timed out */ -#define PURGE_ATTRCACHE(vp) {vtor(vp)->r_attrtime.tv_sec = hrestime.tv_sec; \ - vtor(vp)->r_attrtime.tv_usec = hrestime.tv_nsec / 1000;} +#define PURGE_ATTRCACHE(vp) (vtor(vp)->r_attrtime.tv_sec = hrestime.tv_sec) /* * Mark cached attributes as uninitialized (must purge all caches first) @@ -118,8 +115,8 @@ struct mntinfo { /* * If returned error is ESTALE flush all caches. */ -#define PURGE_STALE_FH(errno, vp) \ - if ((errno) == ESTALE) { pvn_vptrunc(vp, 0, 0); nfs_purge_caches(vp); } +#define PURGE_STALE_FH(errno, vp) \ + if ((errno) == ESTALE) {pvn_vptrunc(vp, 0, 0); nfs_purge_caches(vp);} /* * Is cache valid? @@ -130,7 +127,7 @@ struct mntinfo { #define CACHE_VALID(rp, mtime) \ ((rtov(rp)->v_flag & VISSWAP) == VISSWAP || \ (rp)->r_attrtime.tv_sec == 0 || \ - ((mtime).tv_sec == (rp)->r_attr.va_mtime.tv_sec && \ - (mtime).tv_nsec == (rp)->r_attr.va_mtime.tv_nsec)) + ((mtime).tv_sec == (rp)->r_attr.va_mtime.tv_sec && \ + (mtime).tv_nsec == (rp)->r_attr.va_mtime.tv_nsec)) #endif /* _NFS_NFS_CLNT_H */ diff --git a/usr/src/uts/3b2/nfs/nfssys.h b/usr/src/uts/3b2/nfs/nfssys.h index 801ee71..d3e211e 100644 --- a/usr/src/uts/3b2/nfs/nfssys.h +++ b/usr/src/uts/3b2/nfs/nfssys.h @@ -8,7 +8,7 @@ #ifndef _NFS_NFSSYS_H #define _NFS_NFSSYS_H -#ident "@(#)head.sys:nfs/nfssys.h 1.5" +#ident "@(#)head.sys:nfs/nfssys.h 1.2" /* * PROPRIETARY NOTICE (Combined) @@ -34,7 +34,7 @@ * this file. */ -enum nfssys_op { NFS_SVC, ASYNC_DAEMON, EXPORTFS, NFS_GETFH, NFS_CNVT }; +enum nfssys_op { NFS_SVC, ASYNC_DAEMON, EXPORTFS, NFS_GETFH }; struct nfs_svc_args { int fd; @@ -50,19 +50,12 @@ struct nfs_getfh_args { fhandle_t *fhp; }; -struct nfs_cnvt_args { - fhandle_t *fh; - int filemode; - int *fd; -}; - #ifdef _KERNEL union nfssysargs { /* async_daemon args: none */ struct exportfs_args *exportfs_args_u; /* exportfs args */ struct nfs_getfh_args *nfs_getfh_args_u; /* nfs_getfh args */ struct nfs_svc_args *nfs_svc_args_u; /* nfs_svc args */ - struct nfs_cnvt_args *nfs_cnvt_args_u; /* nfs_cnvt args */ }; struct nfssysa { @@ -71,7 +64,6 @@ struct nfssysa { #define nfssysarg_exportfs arg.exportfs_args_u #define nfssysarg_getfh arg.nfs_getfh_args_u #define nfssysarg_svc arg.nfs_svc_args_u -#define nfssysarg_cnvt arg.nfs_cnvt_args_u }; #endif #endif /* !_NFS_NFSSYS_H */ diff --git a/usr/src/uts/3b2/nfs/rnode.h b/usr/src/uts/3b2/nfs/rnode.h index f6b0686..3c6ea26 100644 --- a/usr/src/uts/3b2/nfs/rnode.h +++ b/usr/src/uts/3b2/nfs/rnode.h @@ -8,7 +8,7 @@ #ifndef _NFS_RNODE_H #define _NFS_RNODE_H -#ident "@(#)head.sys:sys/nfs/rnode.h 1.3" +#ident "@(#)head.sys:sys/nfs/rnode.h 1.2" /* @(#)rnode.h 1.23 88/08/19 SMI */ @@ -123,7 +123,7 @@ printf("RUNLOCK: called from %s, lineno %d\n", file, line); \ (rp)->r_flags &= ~RLOCKED; \ if ((rp)->r_flags & RWANT) { \ (rp)->r_flags &= ~RWANT; \ - wakeprocs((caddr_t)(rp), PRMPT); \ + wakeup((caddr_t)(rp)); \ } \ } \ } @@ -137,7 +137,7 @@ printf("RUNLOCK: called from %s, lineno %d\n", file, line); \ (rp)->r_flags &= ~RLOCKED; \ if ((rp)->r_flags & RWANT) { \ (rp)->r_flags &= ~RWANT; \ - wakeprocs((caddr_t)(rp), PRMPT); \ + wakeup((caddr_t)(rp)); \ } \ } \ } @@ -167,7 +167,7 @@ printf("RUNLOCK: called from %s, lineno %d\n", file, line); \ (rp)->r_flags &= ~RLOCKED; \ if ((rp)->r_flags & RWANT) { \ (rp)->r_flags &= ~RWANT; \ - wakeprocs((caddr_t)(rp), PRMPT); \ + wakeup((caddr_t)(rp)); \ } \ } \ } diff --git a/usr/src/uts/3b2/os/acct.c b/usr/src/uts/3b2/os/acct.c index b523a07..f38c50a 100644 --- a/usr/src/uts/3b2/os/acct.c +++ b/usr/src/uts/3b2/os/acct.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/acct.c 1.18" +#ident "@(#)kernel:os/acct.c 1.16" #include "sys/types.h" #include "sys/sysmacros.h" @@ -58,38 +58,30 @@ sysacct(uap, rvp) aclock++; if (uap->fname == NULL) { if (acctvp) { - if (error = VOP_CLOSE(acctvp, FWRITE, 1, 0, u.u_cred)) - goto out; VN_RELE(acctvp); acctvp = NULL; } } else { - if (error = vn_open(uap->fname, UIO_USERSPACE, FWRITE, - 0, &vp, (enum create)0)) { - /* SVID compliance */ - if (error == EISDIR) - error = EACCES; + if (error = lookupname(uap->fname, UIO_USERSPACE, + FOLLOW, NULLVPP, &vp)) goto out; - } if (acctvp && VN_CMP(acctvp, vp)) { error = EBUSY; - goto closevp; + VN_RELE(vp); + goto out; } - if (vp->v_type != VREG) { + if (vp->v_type != VREG) error = EACCES; - goto closevp; + else + error = VOP_ACCESS(vp, VWRITE, 0, u.u_cred); + if (error) { + VN_RELE(vp); + goto out; } - if (acctvp) { - if (error = VOP_CLOSE(acctvp, FWRITE, 1, 0, u.u_cred)) - goto closevp; + if (acctvp) VN_RELE(acctvp); - } acctvp = vp; } - goto out; -closevp: - (void)VOP_CLOSE(vp, FWRITE, 1, 0, u.u_cred); - VN_RELE(vp); out: aclock--; return error; @@ -129,7 +121,7 @@ void #ifdef __STDC__ acct(char st) #else -acct(st) +acct(char) char st; #endif { diff --git a/usr/src/uts/3b2/os/bio.c b/usr/src/uts/3b2/os/bio.c index 390524e..06aac73 100644 --- a/usr/src/uts/3b2/os/bio.c +++ b/usr/src/uts/3b2/os/bio.c @@ -5,14 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)kernel:os/bio.c 1.42" +#ident "@(#)kernel:os/bio.c 1.38.1.6" #include "sys/types.h" #include "sys/sysmacros.h" #include "sys/sbd.h" @@ -42,18 +35,15 @@ #include "sys/kmem.h" #include "vm/page.h" -/* - * Convert logical block number to a physical number - * given block number and block size of the file system. - * Assumes 512 byte blocks (see param.h). - */ +/* Convert logical block number to a physical number */ +/* given block number and block size of the file system */ +/* Assumes 512 byte blocks (see param.h). */ #define LTOPBLK(blkno, bsize) (blkno * ((bsize>>SCTRSHFT))) /* count and flag for outstanding async writes */ int basyncnt, basynwait; struct buf bhdrlist; /* free buf header list */ -int nbuf; /* number of buffer headers allocated */ void printbuf(); @@ -99,7 +89,7 @@ bread(dev, blkno, bsize) u.u_ior++; sysinfo.bread++; (void) biowait(bp); - return bp; + return(bp); } /* @@ -211,10 +201,10 @@ brelse(bp) register s; if (bp->b_flags & B_WANTED) - wakeprocs((caddr_t)bp, PRMPT); + wakeup((caddr_t)bp); if (bfreelist.b_flags & B_WANTED) { bfreelist.b_flags &= ~B_WANTED; - wakeprocs((caddr_t)&bfreelist, PRMPT); + wakeup((caddr_t)&bfreelist); } if (bp->b_flags & B_ERROR) { bp->b_flags |= B_STALE|B_AGE; @@ -300,26 +290,38 @@ getfreeblk(bsize) } else { bremhash(bp); - if (savebp == NULL && bp->b_bufsize == bsize) + if (savebp == NULL && bp->b_bufsize == bsize) { savebp = bp; + } + /* + * If size doesn't match, free it. + */ else { - /* - * If size doesn't match, free it. - */ kmem_free(bp->b_un.b_addr, bp->b_bufsize); bfreelist.b_bufsize += bp->b_bufsize; struct_zero(bp, sizeof(struct buf)); bp->b_flags |= B_KERNBUF; bp->av_forw = bhdrlist.av_forw; bhdrlist.av_forw = bp; + /* + * notavail() decremented b_bcount already. + * + * bfreelist.b_bcount--; + */ + if (bhdrlist.b_flags&B_WANTED) { + bhdrlist.b_flags &= ~B_WANTED; + wakeup((caddr_t)&bhdrlist); + } + } } (void)splx(s); goto loop; } (void)splx(s); - if (savebp != NULL) - return savebp; + if (savebp != NULL) { + return (savebp); + } /* * If not enough memory for this buffer, sleep. When we * return from sleep(), we must return to the caller to @@ -333,28 +335,14 @@ getfreeblk(bsize) } /* * Allocate a new buffer. Get a buffer header first. - * If no free buffer header, allocate a chunk of - * buffer headers. + * If no free buffer header, sleep. When we return from + * sleep(), we must return to the caller to check the + * hash queue again. */ if (bhdrlist.av_forw == NULL) { - struct buf *dp; - int i; - - dp = (struct buf *)kmem_zalloc(sizeof(struct buf) * v.v_buf, - KM_SLEEP); - ASSERT(dp != NULL); - bhdrlist.av_forw = dp; - nbuf += v.v_buf; - - for (i = 0; i < v.v_buf-1; i++,dp++) { - dp->b_dev = (o_dev_t)NODEV; - dp->b_edev = (dev_t)NODEV; - dp->b_un.b_addr = NULL; - dp->av_forw = dp + 1; - dp->b_flags = B_KERNBUF; - dp->b_bcount = 0; - } - + bhdrlist.b_flags |= B_WANTED; + sleep((caddr_t)&bhdrlist, PRIBIO + 1); + return NULL; } bp = bhdrlist.av_forw; bhdrlist.av_forw = bp->av_forw; @@ -378,14 +366,13 @@ getblk(dev, blkno, bsize) { register struct buf *bp; register struct buf *dp; - register int s; if (getmajor(dev) >= bdevcnt) cmn_err(CE_PANIC,"blkdev"); blkno = LTOPBLK(blkno, bsize); loop: - s = spl0(); + spl0(); if ((dp = bhash(dev, blkno)) == NULL) cmn_err(CE_PANIC,"devtab"); for (bp = dp->b_forw; bp != dp; bp = bp->b_forw) { @@ -400,13 +387,12 @@ getblk(dev, blkno, bsize) syswait.iowait--; goto loop; } - splx(s); + spl0(); bp->b_flags &= ~B_AGE; notavail(bp); return bp; } - splx(s); bp = getfreeblk(bsize); if (bp == NULL) goto loop; @@ -437,7 +423,8 @@ ngeteblk(bsize) loop: dp = &bfreelist; - if ((bp = getfreeblk(bsize)) == NULL) + bp = getfreeblk(bsize); + if (bp == NULL) goto loop; found: @@ -462,6 +449,7 @@ geteblk() return ngeteblk((long)1024); } + /* * Wait for I/O completion on the buffer; return errors * to the user. @@ -602,6 +590,7 @@ void binit() { register struct buf *bp; + register struct buf *dp; register unsigned i; /* @@ -610,10 +599,19 @@ binit() */ bfreelist.b_bufsize = v.v_bufhwm * 1024; - bp = &bfreelist; - bp->b_forw = bp->b_back = bp->av_forw = bp->av_back = bp; - bhdrlist.av_forw = NULL; - + dp = &bfreelist; + dp->b_forw = dp->b_back = dp->av_forw = dp->av_back = dp; + bhdrlist.av_forw = bp = buf; + + for (i = 0; i < v.v_buf-1; i++,bp++) { + bp->b_dev = (o_dev_t)NODEV; + bp->b_edev = (dev_t)NODEV; + bp->b_un.b_addr = NULL; + bp->av_forw = bp + 1; + bp->b_flags = B_KERNBUF; + bp->b_bcount = 0; + } + bp->av_forw = NULL; pfreecnt = v.v_pbuf; pfreelist.av_forw = bp = pbuf; for (; bp < &pbuf[v.v_pbuf-1]; bp++) @@ -636,21 +634,22 @@ biowait(bp) syswait.iowait++; s = spl6(); - curproc->p_swlocks++; - curproc->p_flag |= SSWLOCKS; while ((bp->b_flags & B_DONE) == 0) { + curproc->p_swlocks++; + curproc->p_flag |= SSWLOCKS; bp->b_flags |= B_WANTED; (void) sleep((caddr_t)bp, PRIBIO); } - if (--curproc->p_swlocks == 0) + if(--curproc->p_swlocks == 0) curproc->p_flag &= ~SSWLOCKS; (void) splx(s); syswait.iowait--; error = geterror(bp); if ((bp->b_flags & B_ASYNC) == 0) { - if (bp->b_flags & B_PAGEIO) + if (bp->b_flags & B_PAGEIO) { pvn_done(bp); + } else if (bp->b_flags & B_REMAPPED) bp_mapout(bp); } @@ -676,7 +675,7 @@ biodone(bp) basyncnt--; if (basyncnt == 0 && basynwait) { basynwait = 0; - wakeprocs((caddr_t)&basyncnt, PRMPT); + wakeup((caddr_t)&basyncnt); } if (bp->b_flags & (B_PAGEIO|B_REMAPPED)) swdone(bp); @@ -684,8 +683,9 @@ biodone(bp) brelse(bp); /* release bp to 1k freelist */ } else { bp->b_flags &= ~B_WANTED; - wakeprocs((caddr_t)bp, PRMPT); + wakeup((caddr_t)bp); } + return; } /* @@ -701,14 +701,9 @@ geterror(bp) { int error = 0; - if (bp->b_flags & B_ERROR) { - if (bp->b_flags & B_KERNBUF) - error = bp->b_error; - if (!error) - error = bp->b_oerror; - if (!error) - error = EIO; - } + if ((bp->b_flags & B_ERROR) + && (error = bp->b_error) == 0 && (error = bp->b_oerror) == 0) + error = EIO; return error; } @@ -729,7 +724,7 @@ STATIC struct bufhd pageio_out = { (struct buf *)&pageio_out, }; -#define NOMEMWAIT() (u.u_procp == proc_pageout) +#define NOMEMWAIT() (u.u_procp == nproc[2]) /* * Allocate and initialize a buf struct for use with pageio. @@ -857,8 +852,9 @@ buf_breakup(strat, obp) sleep((caddr_t)bp, PRIBIO); } (void) splx(s); - if (bp->b_flags & B_ERROR) + if (bp->b_flags & B_ERROR) { goto out; + } bp->b_blkno += btod(cc); bp->b_un.b_addr += cc; iocount -= cc; @@ -878,6 +874,7 @@ buf_breakup(strat, obp) s = spl6(); biodone(obp); splx(s); + return; } /* @@ -901,6 +898,13 @@ printbuf() printf("%x\n", bp); printf("bhdrlist %x\n", bp->av_forw); + for (i = 0, bp = buf; i < v.v_buf; i++, bp++) { + printf("%x %x %x %x %x %x %d\n", + bp, + bp->av_forw, bp->av_back, bp->b_forw, bp->b_back, + bp->b_flags, + bp->b_bufsize); + } } #endif diff --git a/usr/src/uts/3b2/os/clock.c b/usr/src/uts/3b2/os/clock.c index d634bad..e2ae945 100644 --- a/usr/src/uts/3b2/os/clock.c +++ b/usr/src/uts/3b2/os/clock.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/clock.c 1.34" +#ident "@(#)kernel:os/clock.c 1.31.1.10" #include "sys/param.h" #include "sys/types.h" @@ -56,11 +56,11 @@ unsigned prfstat; extern int fsflush(); extern struct buf *bclnlist; -extern int desfree; +extern int desfree; + extern int tickdelta; extern long timedelta; extern int doresettodr; -extern int idleswtch; /* flag set while idle in pswtch() */ extern int (*io_poll[])(); /* driver entry points to poll every tick */ @@ -74,18 +74,13 @@ int fsflushcnt; /* counter for t_fsflushr */ int calllimit = -1; /* index of last valid entry in table */ -/* - * Kludge for SVID-compliance is preferable to allocating the - * structure in generic code. rf_init points this at a - * counter. - */ -time_t *rfsi_servep; - #ifdef DEBUG int catchmenowcnt; /* counter for debuging interrupt */ int catchmestart = 60; /* counter for debuging interrupt */ -int idlecntdown; -int idlemsg; +#endif +#ifdef DEBUG +int idlecntdown; +int idlemsg; #endif int @@ -94,7 +89,7 @@ clock(pc, ps) psw_t ps; { extern void clkreld(); - register struct proc *pp; + register struct proc *pp,**ppp; register int retval; register rlim_t rlim_cur; static rqlen, sqlen; @@ -159,8 +154,6 @@ clock(pc, ps) } else { sysinfo.cpu[CPU_KERNEL]++; pp->p_stime++; - if (rfsi_servep && RF_SERVER()) - (*rfsi_servep)++; /* * Enforce CPU rlimit. */ @@ -184,9 +177,6 @@ clock(pc, ps) CL_TICK(pp, pp->p_clproc); } - if (idleswtch == 0 && pp->p_cpu < 80) - pp->p_cpu++; - lbolt++; /* time in ticks */ /* @@ -260,19 +250,23 @@ clock(pc, ps) rqlen = 0; sqlen = 0; - - for (pp = practive; pp != NULL; pp = pp->p_next) { - if (pp->p_clktim) - if (--pp->p_clktim == 0) - psignal(pp, SIGALRM); - pp->p_cpu >>= 1; - if (pp->p_stat == SRUN || pp->p_stat == SONPROC) - if (pp->p_flag & SLOAD) - rqlen++; - else - sqlen++; + for (ppp = &nproc[0]; ppp < v.ve_proc; ppp++) { + if (*ppp == NULL) /*not used */ + continue; + + if ((*ppp)->p_stat) { + if ((*ppp)->p_clktim) + if (--(*ppp)->p_clktim == 0) + psignal((*ppp), SIGALRM); + (*ppp)->p_cpu >>= 1; + + if ((*ppp)->p_stat == SRUN || (*ppp)->p_stat == SONPROC) + if ((*ppp)->p_flag & SLOAD) + rqlen++; + else + sqlen++; + } } - if (rqlen) { sysinfo.runque += rqlen; sysinfo.runocc++; @@ -299,7 +293,7 @@ clock(pc, ps) */ if (--fsflushcnt <= 0) { fsflushcnt = tune.t_fsflushr; - wakeprocs((caddr_t)fsflush, PRMPT); + wakeup((caddr_t)fsflush); } /* * XXX @@ -310,14 +304,14 @@ clock(pc, ps) vmmeter(); if (runin != 0) { runin = 0; - setrun(proc_sched); + setrun(nproc[0]); } if (((freemem <= tune.t_gpgslo) || sqlen) && runout != 0) { runout = 0; - setrun(proc_sched); + setrun(nproc[0]); } if (bclnlist != NULL || freemem < desfree) { - wakeprocs((caddr_t)proc_pageout, PRMPT); + wakeup((caddr_t)nproc[2]); } one_sec = 0; } @@ -578,6 +572,9 @@ heap_down(t, j) } #define PDELAY (PZERO-1) +#undef wakeup /* we want to refer to the function, not the macro */ + +extern void wakeup(); void delay(ticks) diff --git a/usr/src/uts/3b2/os/cmn_err.c b/usr/src/uts/3b2/os/cmn_err.c index ba151d6..9a50b9d 100644 --- a/usr/src/uts/3b2/os/cmn_err.c +++ b/usr/src/uts/3b2/os/cmn_err.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/cmn_err.c 1.17" +#ident "@(#)kernel:os/cmn_err.c 1.15.1.12" #include "sys/param.h" #include "sys/types.h" @@ -130,7 +130,7 @@ int r0() {} * Printf should not be used for chit-chat. */ -STATIC void +static void xprintf(fmtp) char **fmtp; { @@ -185,7 +185,7 @@ xprintf(fmtp) goto loop; } -STATIC void +static void xpanic(msgp) char **msgp; { @@ -250,8 +250,8 @@ xpanic(msgp) rtnfirm(); } -void -xxcmn_err(level, fmtp) +static void +xcmn_err(level, fmtp) register int level; char **fmtp; @@ -328,6 +328,11 @@ xxcmn_err(level, fmtp) printf("\n"); splx(x); + /* + * If the registers were not saved, + * save them now. + */ + xpanic(fmtp); /* NOTREACHED */ @@ -356,35 +361,6 @@ xxcmn_err(level, fmtp) not_cmn = 0; } -STATIC pcb_t regsave_pcb; - -STATIC void -xcmn_err(level, fmtp) - register int level; - char **fmtp; -{ - - if (level == CE_PANIC && save_r0ptr == NULL) { - asm(" MOVW %psw, regsave_pcb+0x00"); - asm(" MOVW %r0, regsave_pcb+0x1c"); - asm(" MOVW %r1, regsave_pcb+0x20"); - asm(" MOVW %r2, regsave_pcb+0x24"); - asm(" MOVW %r3, regsave_pcb+0x28"); - asm(" MOVW %r4, regsave_pcb+0x2c"); - asm(" MOVW %r5, regsave_pcb+0x30"); - asm(" MOVW %r6, regsave_pcb+0x34"); - asm(" MOVW %r7, regsave_pcb+0x38"); - asm(" MOVW %r8, regsave_pcb+0x3c"); - asm(" MOVW -7*4(%fp), %r0"); /* get fp to r0 */ - asm(" MOVW -9*4(%r0), regsave_pcb+0x04"); /* pc */ - asm(" MOVAW -9*4(%r0), regsave_pcb+0x08"); /* sp */ - asm(" MOVW -8*4(%r0), regsave_pcb+0x14"); /* ap */ - asm(" MOVW -7*4(%r0), regsave_pcb+0x18"); /* fp */ - save_r0ptr = ®save_pcb.regsave[K_R0]; - } - xxcmn_err(level, fmtp); -} - /*PRINTFLIKE1*/ void #ifdef __STDC__ @@ -455,7 +431,7 @@ panic(msg) char *msg; #endif { - xcmn_err(CE_PANIC, &msg); + xpanic(&msg); } /* @@ -503,12 +479,9 @@ pansave(p) struct systate *p; { /* - * save_r0ptr is set by nrmx_KK in ttrap.s before krnlflt - * is entered, or in xcmn_err if it was not already set. - * So the registers will be correct for krnflts, - * calls to cmn_err(CE_PANIC,...) and panic(). - * By the time we get here, we have save_r0ptr pointing - * at r0 in a pcb that has the registers filled in. + * save_r0ptr is set in trap when trap is entered. + * save_r0ptr points to R0 in the stack after the trap. + * The format of the stack is in ttrap.s. * ofp gets the fp of the process that caused the trap. * lfp gets the last frame pointer (of pansave). */ @@ -527,7 +500,6 @@ pansave(p) p->osp = save_r0ptr[SP]; p->ofp = save_r0ptr[FP]; } - MOVW(p->lfp, %fp, int) MOVW(p->isp, %isp, int) MOVW(p->pcbp, %pcbp, int) @@ -554,6 +526,40 @@ cmn_err(level, fmt) char *fmt; #endif { + pcb_t regsave_pcb; + if (level == CE_PANIC) { + int *reg; + if (save_r0ptr == NULL) { + save_r0ptr = ®save_pcb.regsave[K_R0]; + MOVW(reg, %fp, int *); + save_r0ptr[R0] = reg[0]; + save_r0ptr[R1] = reg[1]; + save_r0ptr[R2] = reg[2]; + MOVAW(reg, -9*4(%fp), int *); + save_r0ptr[PC] = reg[0]; + save_r0ptr[AP] = reg[1]; + save_r0ptr[FP] = reg[2]; + save_r0ptr[R3] = reg[3]; + save_r0ptr[R4] = reg[4]; + save_r0ptr[R5] = reg[5]; + save_r0ptr[R6] = reg[6]; + save_r0ptr[R7] = reg[7]; + save_r0ptr[R8] = reg[8]; + } else { + reg = save_r0ptr; + save_r0ptr = ®save_pcb.regsave[K_R0]; + save_r0ptr[PC] = reg[PC]; + save_r0ptr[PS] = reg[PS]; + save_r0ptr[AP] = reg[0]; + save_r0ptr[FP] = reg[1]; + save_r0ptr[R3] = reg[2]; + save_r0ptr[R4] = reg[3]; + save_r0ptr[R5] = reg[4]; + save_r0ptr[R6] = reg[5]; + save_r0ptr[R7] = reg[6]; + save_r0ptr[R8] = reg[7]; + } + } xcmn_err(level, &fmt); } @@ -564,6 +570,10 @@ printnvram() struct xtra_nvr nvram_copy; register int oldpri; + asm(" PUSHW %r0"); + asm(" PUSHW %r1"); + asm(" PUSHW %r2"); + oldpri = splhi(); rnvram(&sbdnvram+XTRA_OFSET, (caddr_t)&nvram_copy, sizeof(nvram_copy)); @@ -571,6 +581,9 @@ printnvram() splx(oldpri); + asm(" POPW %r2"); + asm(" POPW %r1"); + asm(" POPW %r0"); } void @@ -782,6 +795,10 @@ printputbuf() int delay; struct tty *errlayer(); + asm(" PUSHW %r0"); + asm(" PUSHW %r1"); + asm(" PUSHW %r2"); + opl = splhi(); pbi = putbufrpos % putbufsz; @@ -804,6 +821,9 @@ printputbuf() splx(opl); + asm(" POPW %r2"); + asm(" POPW %r1"); + asm(" POPW %r0"); } #endif diff --git a/usr/src/uts/3b2/os/core.c b/usr/src/uts/3b2/os/core.c index d8e5a3d..599425b 100644 --- a/usr/src/uts/3b2/os/core.c +++ b/usr/src/uts/3b2/os/core.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/core.c 1.15" +#ident "@(#)kernel:os/core.c 1.12" #include "sys/param.h" #include "sys/types.h" #include "sys/psw.h" @@ -18,7 +18,6 @@ #include "sys/user.h" #include "sys/errno.h" #include "sys/proc.h" -#include "sys/disp.h" #include "sys/signal.h" #include "sys/siginfo.h" #include "sys/fault.h" @@ -35,7 +34,6 @@ #include "sys/mman.h" #include "sys/rf_messg.h" #include "sys/exec.h" -#include "sys/file.h" #include "vm/as.h" @@ -53,28 +51,18 @@ core(fp, pp, credp, rlimit, sig) extern int nexectype; struct vnode *vp; struct vattr vattr; - register int error, i, closerr; + register int error, i; register cred_t *crp = pp->p_cred; - mode_t umask = PTOU(pp)->u_cmask; if (crp->cr_uid != crp->cr_ruid || !hasprocperm(crp, credp)) return EPERM; - /* - * The original intent of the core function interface was to - * be able to core dump any process, not just the context we - * are currently in. Unfortunately, we never got around to - * writing the code to deal with any other context but the current. - * This is not so bad as currently there is no user interface to - * get here with a non-current context. We will fix this later when - * an interface is provided to core dump a selected process. - */ - if (pp != curproc) /* only support current context for now */ - return EINVAL; - + vattr.va_type = VREG; + vattr.va_mode = 0666; + vattr.va_mask = AT_TYPE|AT_MODE; PTOU(pp)->u_syscall = DUCOREDUMP; /* RFS */ - error = vn_open(fp, UIO_SYSSPACE, FWRITE | FTRUNC | FCREAT, - (0666 & ~umask) & PERMMASK, &vp, CRCORE); + error = vn_create(fp, UIO_SYSSPACE, &vattr, NONEXCL, VWRITE, + &vp, CRCORE); if (error) return error; @@ -96,18 +84,15 @@ core(fp, pp, credp, rlimit, sig) error = ENOSYS; } - closerr = VOP_CLOSE(vp, FWRITE, 1, 0, credp); VN_RELE(vp); - - return error ? error : closerr; + return error; } /* * Common code to core dump process memory. */ int -core_seg(pp, vp, offset, addr, size, rlimit, credp) - proc_t *pp; +core_seg(vp, offset, addr, size, rlimit, credp) vnode_t *vp; off_t offset; register caddr_t addr; @@ -119,6 +104,7 @@ core_seg(pp, vp, offset, addr, size, rlimit, credp) addr_t base; u_int len; register int err = 0; + register proc_t *pp = u.u_procp; eaddr = (addr_t)(addr + size); for (base = addr; base < eaddr; base += len) { diff --git a/usr/src/uts/3b2/os/cred.c b/usr/src/uts/3b2/os/cred.c index fb13302..1bcb377 100644 --- a/usr/src/uts/3b2/os/cred.c +++ b/usr/src/uts/3b2/os/cred.c @@ -5,31 +5,8 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)kernel:os/cred.c 1.2" +#ident "@(#)kernel:os/cred.c 1.1" #include "sys/types.h" #include "sys/sysmacros.h" diff --git a/usr/src/uts/3b2/os/ddi.c b/usr/src/uts/3b2/os/ddi.c index d76d7be..7206989 100644 --- a/usr/src/uts/3b2/os/ddi.c +++ b/usr/src/uts/3b2/os/ddi.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/ddi.c 1.39" +#ident "@(#)kernel:os/ddi.c 1.36" /* UNIX Device Driver Interface functions @@ -59,6 +59,44 @@ extern char MINOR[256]; +/* function: btoc() + * macro in: sysmacros.h + * purpose: convert size in bytes to size in clicks (pages) + */ + +unsigned long +btoc(bytes) +register unsigned long bytes; +{ + +#ifdef BPCSHIFT + return(((unsigned)(bytes)+(NBPC-1))>>BPCSHIFT); +#else + return(((unsigned)(bytes)+(NBPC-1))/NBPC); +#endif + +} + + + +/* function: ctob() + * macro in: sysmacros.h + * purpose: convert size in clicks (pages) to bytes + */ + +unsigned long +ctob(clicks) +register unsigned long clicks; +{ +#ifdef BPCSHIFT + return(((clicks)< MAXMAJ || MAJOR[emajnum] >= max(cdevcnt, bdevcnt)) + if (emajnum > MAXMAJ) return (-1); /* invalid external major */ return ( (int) MAJOR[emajnum]); @@ -331,7 +369,8 @@ putnext(q, mp) register queue_t *q; register mblk_t *mp; { - return ((*q->q_next->q_qinfo->qi_putp)(q->q_next, mp)); + (*q->q_next->q_qinfo->qi_putp)(q->q_next, mp); + return(0); } @@ -473,7 +512,8 @@ register unsigned long value; } -/* function: physiock() + +/* function: physio() * purpose: perform raw device I/O on block devices * * The arguments are @@ -499,7 +539,7 @@ daddr_t devsize; register struct uio *uiop; { register struct iovec *iov; - register unsigned over,cnt,iovlen; + register unsigned over; register off_t upper, limit; struct a { int fdes; @@ -516,7 +556,7 @@ register struct uio *uiop; limit = devsize << SCTRSHFT; if (uiop->uio_offset >= (off_t) limit) { - if (rw == B_WRITE) + if (uiop->uio_offset > limit || rw == B_WRITE) return(ENXIO); return(0); } @@ -526,25 +566,15 @@ register struct uio *uiop; * read(2) system call. */ - iovlen = 0; - for (cnt = 0,iov = uiop->uio_iov; cnt < uiop->uio_iovcnt; cnt++,iov++) - iovlen += (off_t) iov->iov_len; - - upper = uiop->uio_offset + iovlen; - - if (upper > limit) { + iov = uiop->uio_iov; + upper = uiop->uio_offset + (off_t) iov->iov_len; + if (upper > limit) + { over = upper - limit; + iov->iov_len -= over; + uiop->uio_resid -= over; uap = (struct a *)u.u_ap; uap->count -= over; - for (cnt = 0,iov = uiop->uio_iov; cnt < uiop->uio_iovcnt; cnt++,iov++) - if (iov->iov_len <= over) - over -= iov->iov_len; - else if (over > 0) { - iov->iov_len -= over; - over = 0; - } - else /* over == 0 */ - iov->iov_len = 0; } diff --git a/usr/src/uts/3b2/os/exec.c b/usr/src/uts/3b2/os/exec.c index bc248a1..2fa65ca 100644 --- a/usr/src/uts/3b2/os/exec.c +++ b/usr/src/uts/3b2/os/exec.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/exec.c 1.56" +#ident "@(#)kernel:os/exec.c 1.50" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" @@ -108,45 +108,38 @@ exece(uap, rvp) pn_free(&pn); return error; } - strncpy(exec_file, pn.pn_path, PSCOMSIZ); + pn_free(&pn); struct_zero(&args, sizeof(args)); - if (uap->argp) { - switch (arglistsz(uap->argp, &args.argc, &args.argsize, - exec_ncargs)) { - case -2: - error = E2BIG; - goto done; - case -1: - error = EFAULT; - goto done; - default: - args.argp = uap->argp; - break; - } + if (uap->argp) + switch (arglistsz(uap->argp, &args.argc, &args.argsize, exec_ncargs)) { + case -2: + return E2BIG; + case -1: + return EFAULT; + default: + args.argp = uap->argp; + break; } - if (uap->envp) { - switch (arglistsz(uap->envp, &args.envc, &args.envsize, - exec_ncargs - args.argsize)) { - case -2: - error = E2BIG; - goto done; - case -1: - error = EFAULT; - goto done; - default: - args.envp = uap->envp; - break; - } + if (uap->envp) + switch (arglistsz(uap->envp, &args.envc, &args.envsize, + exec_ncargs - args.argsize)) { + case -2: + return E2BIG; + case -1: + return EFAULT; + default: + args.envp = uap->envp; + break; } - args.fname = pn.pn_buf; + args.fname = uap->fname; PREEMPT(); - if (error = gexec(&vp, &args, 0, &execsz)) + if (error = gexec(vp, &args, 0, &execsz)) goto done; PREEMPT(); @@ -160,9 +153,9 @@ exece(uap, rvp) if ((error = setregs(&args)) != 0) psignal(u.u_procp, SIGKILL); + done: PREEMPT(); - pn_free(&pn); VN_RELE(vp); return error; } @@ -182,13 +175,14 @@ exec(uap, rvp) exhdmap_t *exhd_freelist; int exhd_freeincr = 8; -STATIC int +STATIC +int exhd_getfbuf(ehdap, off, size, keep, mappp) - exhda_t *ehdap; - off_t off; - int size; - int keep; - exhdmap_t **mappp; + exhda_t *ehdap; + off_t off; + int size; + int keep; + exhdmap_t **mappp; { register exhdmap_t *mapp; extern struct as kas; @@ -218,7 +212,7 @@ exhd_getfbuf(ehdap, off, size, keep, mappp) S_READ); if (err) { if (FC_CODE(err) == FC_OBJERR) - return FC_ERRNO(err); + return(FC_ERRNO(err)); else return EIO; } @@ -235,7 +229,7 @@ exhd_getfbuf(ehdap, off, size, keep, mappp) S_READ); if (err) { if (FC_CODE(err) == FC_OBJERR) - return FC_ERRNO(err); + return(FC_ERRNO(err)); else return EIO; } @@ -257,7 +251,7 @@ exhd_getfbuf(ehdap, off, size, keep, mappp) error = fbread(ehdap->vp, bpoff, epoff - bpoff, S_READ, &mapp->fbufp); if (error) { kmem_fast_free((caddr_t *) &exhd_freelist, (caddr_t)mapp); - return error; + return(error); } mapp->nextmap = ehdap->maplist; ehdap->maplist = mapp; @@ -268,13 +262,14 @@ exhd_getfbuf(ehdap, off, size, keep, mappp) return 0; } -STATIC int +STATIC +int exhd_nomap(ehdap, off, size, flags, cpp) - exhda_t *ehdap; - off_t off; - int size; - int flags; - caddr_t cpp; + exhda_t *ehdap; + off_t off; + int size; + int flags; + caddr_t cpp; { register exhdmap_t *mapp; register exhdmap_t **mpp; @@ -291,13 +286,14 @@ exhd_nomap(ehdap, off, size, flags, cpp) poff = off & PAGEMASK; epoff = (eoff + (PAGESIZE-1)) & PAGEMASK; - /* - * The code rejects doing the autofree for VNOMAP files + /* the code rejects doing the autofree for VNOMAP files * to avoid losing this hidden cache. * So, only non-vnode pages are autofreed. */ + for (mpp = &ehdap->maplist; (mapp = *mpp) != NULL; ) { - if (mapp->keepcnt || mapp->cureoff) { + if (mapp->keepcnt + || mapp->cureoff) { mpp = &mapp->nextmap; continue; } @@ -322,9 +318,8 @@ exhd_nomap(ehdap, off, size, flags, cpp) copymapp = mapp; } - /* - * Keep the maplist sorted by offset and allow no overlaps. - */ + /* keep the maplist sorted by offset and allow no overlaps */ + for (mpp = &ehdap->maplist; (mapp = *mpp) != NULL; ) { if (mapp->cureoff == 0) { mpp = &mapp->nextmap; @@ -339,10 +334,8 @@ exhd_nomap(ehdap, off, size, flags, cpp) if (copymapp != NULL) { *((caddr_t *)cpp) = copymapp->bndrycasep; - bcopy(mapp->bndrycasep - + off - mapp->curoff, - copymapp->bndrycasep, - size); + bcopy(mapp->bndrycasep + off - mapp->curoff, + copymapp->bndrycasep, size); return 0; } *((caddr_t *)cpp) = mapp->bndrycasep @@ -377,13 +370,12 @@ exhd_nomap(ehdap, off, size, flags, cpp) mapp->cureoff = epoff; error = vn_rdwr(UIO_READ, vp, mapp->bndrycasep, cnt, poff, UIO_SYSSPACE, 0, (long) 0, u.u_cred, &resid); - if (error || (resid && resid + ehdap->vnsize != epoff)) { - kmem_fast_free((caddr_t *) &exhd_freelist, - (caddr_t)mapp); + if (error || resid) { + kmem_fast_free((caddr_t *) &exhd_freelist, (caddr_t)mapp); ehdap->state = EXHDA_HADERROR; if (error) - return error; - return ENOEXEC; + return(error); + return(ENOEXEC); } mapp->nextmap = *mpp; *mpp = mapp; @@ -407,11 +399,11 @@ exhd_nomap(ehdap, off, size, flags, cpp) return 0; } } - /* - * A partial overlap: + /* a partial overlap: * copy to a separate buffer * rather than fiddling with merging vnode pages. */ + if (!(flags & EXHD_COPY)) { if (copymapp) tcp = copymapp->bndrycasep; @@ -463,8 +455,8 @@ exhd_nomap(ehdap, off, size, flags, cpp) if (error || resid) { ehdap->state = EXHDA_HADERROR; if (error) - return error; - return ENOEXEC; + return(error); + return(ENOEXEC); } mapp->curoff = poff; mapp->cureoff = poff + cnt; @@ -475,7 +467,7 @@ exhd_nomap(ehdap, off, size, flags, cpp) cnt = size; bcopy(mapp->bndrycasep + off - mapp->curoff, tcp, cnt); if ((size -= cnt) <= 0) - return 0; + return(0); off += cnt; tcp += cnt; mpp = &mapp->nextmap; @@ -497,22 +489,22 @@ exhd_nomap(ehdap, off, size, flags, cpp) if (error || resid) { ehdap->state = EXHDA_HADERROR; if (error) - return error; - return ENOEXEC; + return(error); + return(ENOEXEC); } mapp->curoff = off; mapp->cureoff = off + cnt; bcopy(mapp->bndrycasep, tcp, size); - return 0; + return(0); } int exhd_getmap(ehdap, off, size, flags, cpp) - exhda_t *ehdap; - off_t off; - int size; - int flags; - caddr_t cpp; + exhda_t *ehdap; + off_t off; + int size; + int flags; + caddr_t cpp; { register exhdmap_t *mapp; register exhdmap_t **mpp; @@ -524,21 +516,20 @@ exhd_getmap(ehdap, off, size, flags, cpp) ASSERT(size > 0); if (ehdap->state == EXHDA_HADERROR) - return ENOEXEC; /* we failed previously */ + return(ENOEXEC); /* we failed previously */ eoff = off + size; if (eoff < off || eoff > ehdap->vnsize) { ehdap->state = EXHDA_HADERROR; - return ENOEXEC; + return(ENOEXEC); } - /* - * Assumption: the mappability of a vnode is constant during exec. - */ + /* assumption: the mappability of a vnode is constant during exec */ + /* if (ehdap->vp->v_flag & VNOMAP) */ - if (ehdap->nomap) - return exhd_nomap(ehdap, off, size, flags, cpp); + if(ehdap->nomap) + return(exhd_nomap(ehdap, off, size, flags, cpp)); boff = off & MAXBMASK; eboff = (eoff-1) & MAXBMASK; for (mpp = &ehdap->maplist; (mapp = *mpp) != NULL; ) { @@ -557,18 +548,18 @@ exhd_getmap(ehdap, off, size, flags, cpp) } if (!(flags & EXHD_COPY || boff != eboff || !((flags & EXHD_4BALIGN) == 0 || (off & 3) == 0))) { - /* - * The simple case of returning a pointer to seg_map space - */ + + /* the simple case of returning a pointer to seg_map space */ + error = exhd_getfbuf(ehdap, off, size, flags & EXHD_KEEPMAP, &curmapp); if (error) { ehdap->state = EXHDA_HADERROR; - return error; + return(error); } mapp = curmapp; *((caddr_t *)cpp) = mapp->fbufp->fb_addr + (off - mapp->curoff); - return 0; + return(0); } if (flags & EXHD_COPY) @@ -593,43 +584,40 @@ exhd_getmap(ehdap, off, size, flags, cpp) &curmapp); if (error) { ehdap->state = EXHDA_HADERROR; - return error; + return(error); } mapp = curmapp; fcp = mapp->fbufp->fb_addr + (off - mapp->curoff); eoff = mapp->cureoff; cnt = eoff - off; - if (cnt > size) - cnt = size; + if (cnt > size) cnt = size; for (;;) { bcopy(fcp, tcp, cnt); if ((size -= cnt) <= 0) - return 0; + return(0); tcp += cnt; off += cnt; error = exhd_getfbuf(ehdap, off, size, flags & EXHD_KEEPMAP, &curmapp); if (error) { ehdap->state = EXHDA_HADERROR; - return error; + return(error); } mapp = curmapp; fcp = mapp->fbufp->fb_addr + (off - mapp->curoff); eoff = mapp->cureoff; cnt = eoff - off; - if (cnt > size) - cnt = size; + if (cnt > size) cnt = size; } } void exhd_release(hdp) - register exhda_t *hdp; + register exhda_t *hdp; { register exhdmap_t *mapp, *nmapp; - if (hdp == NULL) - return; + if (hdp == NULL) return; for (mapp = hdp->maplist; mapp != NULL; mapp = nmapp) { if (mapp->bndrycasep) kmem_free(mapp->bndrycasep, mapp->bndrycasesz); @@ -642,17 +630,16 @@ exhd_release(hdp) int execpermissions(vp, vattrp, ehdp, args) - struct vnode *vp; - struct vattr *vattrp; - exhda_t *ehdp; - struct uarg *args; +struct vnode *vp; +struct vattr *vattrp; +exhda_t *ehdp; +struct uarg *args; { int error; - register proc_t *p = u.u_procp; struct_zero(ehdp, sizeof(*ehdp)); vattrp->va_mask = AT_MODE|AT_UID|AT_GID|AT_SIZE; - if (error = VOP_GETATTR(vp, vattrp, ATTR_EXEC, p->p_cred)) + if (error = VOP_GETATTR(vp, vattrp, ATTR_EXEC, u.u_cred)) return error; /* * Check the access mode. @@ -665,12 +652,12 @@ execpermissions(vp, vattrp, ehdp, args) return error; } - if ((p->p_trace || (p->p_flag & (STRC|SPROCTR))) + if ((u.u_procp->p_trace || (u.u_procp->p_flag & (STRC|SPROCTR))) && (error = VOP_ACCESS(vp, VREAD, 0, u.u_cred))) { /* * If process is traced via ptrace(2), fail the exec(2). */ - if (p->p_flag & STRC) + if (u.u_procp->p_flag & STRC) goto bad; /* * Process is traced via /proc. @@ -689,119 +676,88 @@ execpermissions(vp, vattrp, ehdp, args) return error; } -STATIC int -execsetid(vp, vattrp, uidp, gidp) - struct vnode *vp; - struct vattr *vattrp; - uid_t *uidp; - uid_t *gidp; -{ - proc_t *pp = u.u_procp; - uid_t uid, gid; - - /* - * Remember credentials. - */ - uid = pp->p_cred->cr_uid; - gid = pp->p_cred->cr_gid; - - if ((vp->v_vfsp->vfs_flag & VFS_NOSUID) == 0) { - if (vattrp->va_mode & VSUID) - uid = vattrp->va_uid; - if (vattrp->va_mode & VSGID) - gid = vattrp->va_gid; - } - - /* - * Set setuid/setgid protections, if no tracing. - * For the super-user, honor setuid/setgid even in - * the presence of tracing. - */ - if (((pp->p_flag & STRC) == 0 || pp->p_cred->cr_uid == 0) - && (pp->p_cred->cr_uid != uid - || pp->p_cred->cr_gid != gid - || pp->p_cred->cr_suid != uid - || pp->p_cred->cr_sgid != gid)) { - *uidp = uid; - *gidp = gid; - return 1; - } - return 0; -} - int -gexec(vpp, args, level, execsz) - struct vnode **vpp; +gexec(vp, args, level, execsz) + struct vnode *vp; struct uarg *args; int level; long *execsz; { register proc_t *pp = u.u_procp; register int i; - register vnode_t *vp; - int error = 0, closerr = 0; + int error = 0; int resid; uid_t uid, gid; struct vattr vattr; short magic; char *mcp; exhda_t ehda; - int setid; - vp = *vpp; if ((error = execpermissions(vp, &vattr, &ehda, args)) != 0) - goto out; + goto bad; - if ((error = VOP_OPEN(vpp, FREAD, u.u_cred) != 0)) - goto out; - - vp = *vpp; - if ((error = exhd_getmap(&ehda, 0, 2, EXHD_NOALIGN, (caddr_t)&mcp)) - != 0) { + if ((error = exhd_getmap(&ehda, 0, 2, EXHD_NOALIGN, (caddr_t)&mcp)) != 0) { exhd_release(&ehda); - goto closevp; + goto bad; } magic = getexmag(mcp); - setid = execsetid(vp, &vattr, &uid, &gid); - for (i = 0; i < nexectype; i++) { if (magic == *execsw[i].exec_magic) { - error = (*execsw[i].exec_func) - (vp, args, level, execsz, &ehda, setid); + error = (*execsw[i].exec_func)(vp, args, level, execsz, &ehda); break; } } exhd_release(&ehda); - if (i >= nexectype && !error) - error = ENOEXEC; - if (error) - goto closevp; + if (i >= nexectype || error) + goto bad; if (level == 0) { - if (setid) { + + /* + * Remember credentials. + */ + + uid = u.u_cred->cr_uid; + gid = u.u_cred->cr_gid; + + if ((vp->v_vfsp->vfs_flag & VFS_NOSUID) == 0) { + if (vattr.va_mode & VSUID) + uid = vattr.va_uid; + if (vattr.va_mode & VSGID) + gid = vattr.va_gid; + } + + /* + * Set setuid/setgid protections, if no tracing. + * For the super-user, honor setuid/setgid even in + * the presence of tracing. + */ + + if (((pp->p_flag & STRC) == 0 || u.u_cred->cr_uid == 0) + && (u.u_cred->cr_uid != uid || u.u_cred->cr_gid != gid)) { + /* - * Prevent unprivileged processes from enforcing + * prevent unprivledged processes from enforcint * resource limitations on setuid/setgid processes - * by reinitializing them to system defaults. */ for (i = 0; i < RLIM_NLIMITS; i++) { u.u_rlimit[i].rlim_cur = rlimits[i].rlim_cur; u.u_rlimit[i].rlim_max = rlimits[i].rlim_max; } - pp->p_cred = crcopy(pp->p_cred); - pp->p_cred->cr_uid = uid; - pp->p_cred->cr_gid = gid; - pp->p_cred->cr_suid = uid; - pp->p_cred->cr_sgid = gid; - if (uid < USHRT_MAX) + u.u_cred = crcopy(u.u_cred); + u.u_cred->cr_uid = uid; + u.u_cred->cr_gid = gid; + u.u_cred->cr_suid = uid; + u.u_cred->cr_sgid = gid; + if ( uid < USHRT_MAX) u.u_uid = (o_uid_t) uid; else u.u_uid = (o_uid_t) UID_NOBODY; - if (gid < USHRT_MAX) + if ( gid < USHRT_MAX) u.u_gid = (o_gid_t) gid; else u.u_gid = (o_gid_t) UID_NOBODY; @@ -810,6 +766,7 @@ gexec(vpp, args, level, execsz) * If process is traced via /proc, arrange to * invalidate the associated /proc vnode. */ + if (pp->p_trace || (pp->p_flag & SPROCTR)) args->traceinval = 1; } @@ -820,10 +777,12 @@ gexec(vpp, args, level, execsz) if (args->traceinval) prinvalidate(&u); } -closevp: - closerr = VOP_CLOSE(vp, FREAD, 1, 0, u.u_cred); -out: - return error ? error : closerr; + + return 0; +bad: + if (error == 0) + error = ENOEXEC; + return error; } int @@ -841,9 +800,11 @@ execmap(vp, addr, len, zfodlen, offset, prot) proc_t *p = u.u_procp; off_t oldoffset; + if (((long)offset & PAGEOFFSET) == ((long)addr & PAGEOFFSET) - && (!(vp->v_flag & VNOMAP))) + && (!(vp->v_flag & VNOMAP))) { page = 1; + } oldaddr = addr; addr = (caddr_t)((long)addr & PAGEMASK); @@ -855,7 +816,7 @@ execmap(vp, addr, len, zfodlen, offset, prot) if (page) { if (error = VOP_MAP(vp, offset, p->p_as, &addr, len, prot, PROT_ALL, - MAP_PRIVATE | MAP_FIXED, p->p_cred)) + MAP_PRIVATE | MAP_FIXED, u.u_cred)) goto bad; /* * If the segment can fit, then we prefault @@ -867,6 +828,7 @@ execmap(vp, addr, len, zfodlen, offset, prot) (void) as_fault(p->p_as, (caddr_t)addr, len, F_INVAL, S_READ); } + } else { if (error = as_map(p->p_as, addr, len, segvn_create, zfod_argsp)) @@ -876,7 +838,7 @@ execmap(vp, addr, len, zfodlen, offset, prot) */ if (error = vn_rdwr(UIO_READ, vp, (caddr_t)oldaddr, oldlen, oldoffset, UIO_USERSPACE, 0, - (u_long) 0, p->p_cred, (int *)0)) + (u_long) 0, u.u_cred, (int *)0)) goto bad; /* * Now set protections. @@ -885,34 +847,36 @@ execmap(vp, addr, len, zfodlen, offset, prot) } } - if (zfodlen) { + if (zfodlen){ end = (size_t)addr + len; zfodbase = (caddr_t)roundup(end, PAGESIZE); zfoddiff = (size_t)zfodbase - end; if (zfoddiff != 0) bzeroba((caddr_t)end, zfoddiff); - if (zfodlen > zfoddiff) { + if ( zfodlen > zfoddiff){ zfodlen -= zfoddiff; if (error = as_map(p->p_as, (caddr_t)zfodbase, zfodlen, - segvn_create, zfod_argsp)) + segvn_create, zfod_argsp)) goto bad; (void)as_setprot(p->p_as, (caddr_t)zfodbase, - zfodlen, prot); + zfodlen, prot); } } + return 0; bad: return error; } /* - * Machine-independent final setup code goes in setexecenv(). + * machine independent final setup code goes in setexecenv(). */ + void setexecenv(ep) - struct execenv *ep; +struct execenv *ep; { register int i; register struct proc *p = u.u_procp; @@ -921,11 +885,7 @@ setexecenv(ep) u.u_execid = (int)ep->ex_magic; p->p_brkbase = ep->ex_brkbase; p->p_brksize = 0; - if (p->p_exec) - VN_RELE(p->p_exec); /* out with the old */ p->p_exec = ep->ex_vp; - if (p->p_exec) - VN_HOLD(p->p_exec); /* in with the new */ u.u_oldcontext = 0; @@ -933,12 +893,12 @@ setexecenv(ep) u.u_signodefer = 0; u.u_sigonstack = 0; - u.u_sigaltstack.ss_sp = 0; - u.u_sigaltstack.ss_size = 0; - u.u_sigaltstack.ss_flags = SS_DISABLE; + u.u_altsp = 0; + u.u_altsize = 0; + u.u_altflags = SS_DISABLE; /* - * Any pending signals remain held, so don't clear p_hold and + * Any pending signal remain held, so don't clear p_hold and * p_sig. */ @@ -963,11 +923,10 @@ setexecenv(ep) p->p_flag &= ~(SNOWAIT|SJCTL); p->p_flag |= SEXECED; - pgdetach(p); + detachcld(p); - /* - * Clear illegal opcode handler. - */ + + /* Clear illegal opcode handler. */ u.u_iop = NULL; for (i = 0; i < u.u_nofiles; i++) { @@ -993,8 +952,9 @@ remove_proc(args) u.u_prof.pr_scale = 0; - if (error = extractarg(args)) - return error; + if (error = extractarg(args)) { + return(error); + } ev_exec(p); if (u.u_nshmseg) @@ -1016,62 +976,12 @@ remove_proc(args) return 0; } -int -execopen(vpp, fdp) - struct vnode **vpp; - int *fdp; -{ - struct vnode *vp = *vpp; - struct cred *credp; - file_t *fp; - int error = 0; - int filemode = FREAD; - - VN_HOLD(vp); /* open reference */ - if (error = falloc((struct vnode *)NULL, filemode, &fp, fdp)) { - VN_RELE(vp); - *fdp = -1; /* just in case falloc changed value */ - return error; - } - credp = crdup(u.u_cred); - credp->cr_uid = 0; /* make sure we can open file */ - credp->cr_gid = 0; - if (error = VOP_OPEN(&vp, filemode, credp)){ - VN_RELE(vp); - setf(*fdp, NULLFP); - unfalloc(fp); - *fdp = -1; - return error; - } - (void) crfree(credp); - *vpp = vp; /* vnode should not have changed */ - fp->f_vnode = vp; - return 0; -} - -int -execclose(fd) - int fd; -{ - int error; - file_t *fp; - - if (error = getf(fd, &fp)) - return error; - setf(fd, NULLFP); - return closef(fp); -} - - - /* ARGSUSED */ -int -noexec(vp, args, level, ehdp, setid) +noexec(vp, args, level, ehdp) struct vnode *vp; struct uarg *args; int level; exhda_t *ehdp; - int setid; { cmn_err(CE_WARN, "missing exec capability for %s\n", args->fname); return ENOEXEC; diff --git a/usr/src/uts/3b2/os/exit.c b/usr/src/uts/3b2/os/exit.c index 95da059..d3355b6 100644 --- a/usr/src/uts/3b2/os/exit.c +++ b/usr/src/uts/3b2/os/exit.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/exit.c 1.74" +#ident "@(#)kernel:os/exit.c 1.67" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" @@ -127,14 +127,18 @@ exit(why, what) sigemptyset(&p->p_sigmask); sigdelq(p, 0); - closeall(1); + closeall(0); ev_signal(p, 0); (void)hrt_cancel_proc(); - if (sp->s_sidp == p->p_pidp && sp->s_vp != NULL) + if (sp->s_vp && *sp->s_sidp == p->p_pid) { + signal(*sp->s_fgidp,SIGHUP); + if (sp->s_vp->v_stream) + strclearctty(sp->s_vp->v_stream); freectty(sp); + } ufp = u.u_flist.uf_next; while (ufp) { @@ -175,30 +179,16 @@ exit(why, what) p->p_utime += p->p_cutime; p->p_stime += p->p_cstime; - if ((q = p->p_orphan) != NULL) { - - register proc_t *nokp = p->p_nextofkin; - - for (; ; q = q->p_nextorph) { - q->p_nextofkin = nokp; - if (q->p_nextorph == NULL) - break; - } - - q->p_nextorph = nokp->p_orphan; - nokp->p_orphan = p->p_orphan; - p->p_orphan = NULL; - - } + detachcld(p); if ((q = p->p_child) != NULL) { - pgdetach(p); + register proc_t *proc1 = nproc[1]; for (; ; q = q->p_sibling) { q->p_ppid = 1; q->p_oppid = 1; - q->p_parent = proc_init; + q->p_parent = proc1; if (q->p_flag & STRC) psignal(q, SIGKILL); sigcld(q); @@ -206,11 +196,11 @@ exit(why, what) break; } - q->p_sibling = proc_init->p_child; - proc_init->p_child = p->p_child; + q->p_sibling = proc1->p_child; + proc1->p_child = p->p_child; p->p_child = NULL; - } + } /* end if children */ /* @@ -227,9 +217,6 @@ exit(why, what) preempt(); } - if (p->p_exec) - VN_RELE(p->p_exec); - /* * These MUST be set here because parents waiting for children * will only check p_wcode since more conditions than zombie @@ -241,7 +228,7 @@ exit(why, what) p->p_wdata = what; if (p->p_trace) - wakeprocs((caddr_t)p->p_trace, PRMPT); + wakeup((caddr_t)p->p_trace); sigcld(p); @@ -378,9 +365,6 @@ waitid(idtype, id, ip, options) return 0; } - if (idtype == P_PID) - break; - } while ((cp = cp->p_sibling) != NULL); if (!found || ready == found) @@ -391,11 +375,8 @@ waitid(idtype, id, ip, options) return 0; } - if (idtype == P_PID) - sleep((caddr_t)cp, PWAIT); - else - sleep((caddr_t)pp, PWAIT); - + if (sleep((caddr_t)pp, PWAIT | PCATCH)) + return intrerr(1); } return ECHILD; } @@ -461,37 +442,28 @@ void freeproc(p) proc_t *p; { - register proc_t *q; + register proc_t *q; - ASSERT(p->p_stat == SZOMB); + ASSERT(p->p_stat == SZOMB); - p->p_nextofkin->p_cutime += p->p_utime; - p->p_nextofkin->p_cstime += p->p_stime; + leavepg(p); + exitsession(p); - if (p->p_trace) + q = p->p_parent; + q->p_cutime += p->p_utime; + q->p_cstime += p->p_stime; + if (p->p_trace) prexit(p); - - if ((q = p->p_nextofkin)->p_orphan == p) - q->p_orphan = p->p_nextorph; - else { - for (q = q->p_orphan; q; q = q->p_nextorph) - if (q->p_nextorph == p) - break; - ASSERT(q && q->p_nextorph == p); - q->p_nextorph = p->p_nextorph; - } - - if ((q = p->p_parent)->p_child == p) + if (q->p_child == p) q->p_child = p->p_sibling; else { for (q = q->p_child; q; q = q->p_sibling) if (q->p_sibling == p) - break; + break; ASSERT(q && q->p_sibling == p); q->p_sibling = p->p_sibling; } - - pid_exit(p); /* frees pid and proc structure */ + pid_release(p->p_pid); /* frees pid and proc structure */ } /* diff --git a/usr/src/uts/3b2/os/fbio.c b/usr/src/uts/3b2/os/fbio.c index 6628df1..d94092d 100644 --- a/usr/src/uts/3b2/os/fbio.c +++ b/usr/src/uts/3b2/os/fbio.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/fbio.c 1.10" +#ident "@(#)kernel:os/fbio.c 1.8" #include "sys/types.h" #include "sys/buf.h" @@ -99,7 +99,7 @@ fbzero(vp, off, len, fbpp) (*fbpp)->fb_addr = addr; (*fbpp)->fb_count = len; - segmap_pagecreate(segkmap, addr, len, 1); + segmap_pagecreate(segkmap, addr, len, 1, 0, 0); /* * Now we zero all the memory in the mapping we are interested in. @@ -236,3 +236,10 @@ fbiwrite(fbp, devvp, bn, bsize) return error; } + +void +fbinval(vfsp) + struct vfs *vfsp; +{ + segmap_inval(segkmap, vfsp); +} diff --git a/usr/src/uts/3b2/os/flock.c b/usr/src/uts/3b2/os/flock.c index d2ea20c..d6ccabe 100644 --- a/usr/src/uts/3b2/os/flock.c +++ b/usr/src/uts/3b2/os/flock.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/flock.c 1.17" +#ident "@(#)kernel:os/flock.c 1.15.1.1" /* * This file contains all of the file/record locking specific routines. @@ -42,7 +42,7 @@ #define SLEEP(ptr, pri) sleep((caddr_t)(ptr), pri) #define WAKEUP(ptr) if (ptr->stat.wakeflg) { \ - wakeprocs((caddr_t)(ptr), PRMPT); \ + wakeup((caddr_t)(ptr)); \ ptr->stat.wakeflg = 0 ; \ } #define SAMEOWNER(a, b) (((a)->l_pid == (b)->l_pid) && \ @@ -434,19 +434,13 @@ reclock(vp, lckdat, cmd, flag, offset) (struct filock *)NULL)) == NULL) retval = ENOLCK; else { - if (cmd & RCMDLCK) - return EINTR; found->stat.wakeflg++; sf->stat.blk.pid = found->set.l_pid; sf->stat.blk.sysid = found->set.l_sysid; - if (cmd & INOFLCK) - VOP_RWUNLOCK(vp); if (SLEEP(found, PCATCH|(PZERO+1))) retval = EINTR; else contflg = 1; - if (cmd & INOFLCK) - VOP_RWLOCK(vp); sf->stat.blk.pid = 0; sf->stat.blk.sysid = 0; delflck(&sleeplcks, sf); @@ -499,7 +493,7 @@ chklock(vp, iomode, offset, len, fmode) bf.l_len = len; bf.l_pid = u.u_procp->p_epid; bf.l_sysid = u.u_procp->p_sysid; - i = (fmode & (FNDELAY|FNONBLOCK)) ? INOFLCK : INOFLCK|SLPFLCK; + i = (fmode & (FNDELAY|FNONBLOCK)) ? 0 : SLPFLCK; if ((i = reclock(vp, &bf, i, 0, offset)) || bf.l_type != F_UNLCK) error = i ? i : EAGAIN; return error; diff --git a/usr/src/uts/3b2/os/fork.c b/usr/src/uts/3b2/os/fork.c index fb8d45a..9ca6154 100644 --- a/usr/src/uts/3b2/os/fork.c +++ b/usr/src/uts/3b2/os/fork.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/fork.c 1.63" +#ident "@(#)kernel:os/fork.c 1.56" #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" @@ -46,10 +46,12 @@ #include "vm/seg_u.h" #if defined(__STDC__) +STATIC pid_t pid_assign(int, proc_t **); STATIC int procdup(proc_t *, proc_t *, int); STATIC void setuctxt(proc_t *, user_t *); STATIC int fork1(char *, rval_t *, int); #else +STATIC pid_t pid_assign(); STATIC int procdup(); STATIC void setuctxt(); STATIC int fork1(); @@ -171,15 +173,15 @@ newproc(cond, pidp, perror) cp->p_cred = pp->p_cred; crhold(pp->p_cred); cp->p_ignore = pp->p_ignore; + cp->p_sig = pp->p_sig; + cp->p_cursig = pp->p_cursig; cp->p_hold = pp->p_hold; - cp->p_siginfo = pp->p_siginfo; cp->p_stat = SIDL; cp->p_clktim = 0; - cp->p_flag = SLOAD | (pp->p_flag & (SJCTL|SNOWAIT)); - cp->p_sessp = pp->p_sessp; - SESS_HOLD(pp->p_sessp); - pgjoin(cp, pp->p_pgidp); - cp->p_exec = pp->p_exec; + cp->p_flag = SLOAD | (pp->p_flag & (SDETACHED|SJCTL|SNOWAIT)); + forksession(cp, pp->p_sessp); + joinpg(cp, pp->p_pgrp); + cp->p_siginfo = pp->p_siginfo; if (cond & NP_SYSPROC) cp->p_flag |= (SSYS | SLOCK); @@ -211,7 +213,7 @@ newproc(cond, pidp, perror) cp->p_sigmask = pp->p_sigmask; cp->p_fltmask = pp->p_fltmask; } else { - sigemptyset(&cp->p_sigmask); + premptyset(&cp->p_sigmask); premptyset(&cp->p_fltmask); /* * Syscall tracing flags are in the u-block. @@ -222,8 +224,13 @@ newproc(cond, pidp, perror) cp->p_clfuncs = pp->p_clfuncs; if (CL_FORK(pp, pp->p_clproc, cp, &cp->p_stat, &cp->p_pri, &cp->p_flag, &cp->p_cred, &cp->p_clproc)) { + cp->p_stat = 0; + cp->p_ppid = 0; + cp->p_oppid = 0; crfree(cp->p_cred); - pid_exit(cp); /* free the proc table entry */ + leavepg(cp); + exitsession(cp); + pid_release(cp->p_pid); /* free the proc table entry */ return -1; } @@ -241,11 +248,6 @@ newproc(cond, pidp, perror) cp->p_sibling = pp->p_child; cp->p_parent = pp; pp->p_child = cp; - - cp->p_nextorph = pp->p_orphan; - cp->p_nextofkin = pp; - pp->p_orphan = cp; - cp->p_sysid = pp->p_sysid; /* RFS HOOK */ /* @@ -256,6 +258,8 @@ newproc(cond, pidp, perror) fp->f_count++; } + sigdupq(cp, pp); + VN_HOLD(u.u_cdir); if (u.u_rdir) VN_HOLD(u.u_rdir); @@ -283,10 +287,15 @@ newproc(cond, pidp, perror) * them here. */ pp->p_child = cp->p_sibling; - pp->p_orphan = cp->p_nextorph; - + cp->p_parent = NULL; + cp->p_sibling = NULL; + cp->p_stat = 0; + cp->p_ppid = 0; + cp->p_oppid = 0; crfree(cp->p_cred); - pid_exit(cp); /* free the proc table entry */ + leavepg(cp); + exitsession(cp); + pid_release(cp->p_pid); /* free the proc table entry */ if (pidp) *pidp = -1; return -1; @@ -351,8 +360,6 @@ Verify that %s class is properly configured.", initclass, initclass); if (pidp) *pidp = cp->p_pid; /* parent returns pid of child */ - if (cp->p_exec) - VN_HOLD(cp->p_exec); return 0; } @@ -509,7 +516,7 @@ relvm(p) } else { p->p_flag &= ~SVFORK; /* no longer a vforked process */ p->p_as = NULL; /* no longer using parent's adr space */ - wakeprocs((caddr_t)p, PRMPT); /* wake up parent */ + wakeup((caddr_t)p); /* wake up parent */ while ((p->p_flag & SVFDONE) == 0) { /* wait for parent */ (void) sleep((caddr_t)p, PZERO - 1); } @@ -551,5 +558,171 @@ vfwait(pid) * Wake up child, send it on its way. */ cp->p_flag |= SVFDONE; - wakeprocs((caddr_t)cp, PRMPT); + wakeup((caddr_t)cp); +} + +/* + * This function assigns a pid for use in a fork request. It checks + * to see that there is an empty slot in the proc table, that the + * requesting user does not have too many processes already active, + * and that the last slot in the proc table is not being allocated to + * anyone who should not use it. + * + * After a proc slot is allocated, it will try to allocate a proc + * structure for the new process. + * + * If all goes well, pid_assign() will return a new pid and set up the + * proc structure pointer for the child process. Otherwise it will + * return -1. + */ +STATIC pid_t +pid_assign(cond, pp) + int cond; /* allow assignment of last slot? */ + proc_t **pp; /* child process proc structure pointer */ +{ + register pincr_t *cp; + register proc_t **p; + register proc_t **endp = &nproc[v.v_proc]; + register uid_t ruid = u.u_cred->cr_ruid; + int uid_procs, slot; + + /* + * Assign a slot. + */ + if ((cp = pfreelisthead) == NULL) { /* no free proc entry */ + syserr.procovf++; + return -1; + } + + if (cp->pi_link == NULL) { /* last entry */ + if (cond & NP_NOLAST) + return -1; + pfreelisttail = NULL; + } + + pfreelisthead = cp->pi_link; + + /* + * If not super-user then make certain that the maximum + * number of children don't already exist. + */ + if (u.u_cred->cr_uid && ruid) { + uid_procs = 0; + + for (p = &nproc[0]; p < endp; ++p) { + if (*p && (*p)->p_cred->cr_ruid == ruid) + uid_procs++; + } + + if (uid_procs >= v.v_maxup) { /* make cp head of list again */ + pfreelisthead = cp; + if (pfreelisttail == NULL) + pfreelisttail = cp; + return -1; + } + } + + cp->pi_link = NULL; + + /* + * Allocate a proc structure. + */ + + slot = GET_INDEX(cp->pi_pid); + + *pp = (proc_t *)kmem_zalloc(sizeof(proc_t), KM_NOSLEEP); + + if (*pp == NULL) { /* out of memory now! */ + pid_release(cp->pi_pid); /* clean up */ + return -1; + } else + nproc[slot] = *pp; + + return cp->pi_pid; +} + +/* + * This function deactivates a proc table entry and returns + * it to the free list. + */ +void +pid_release(pid) + pid_t pid; +{ + register proc_t *p; + register pincr_t *pip; /* slot to be returned */ + int slot; /* slot number for the given pid */ + + slot = GET_INDEX(pid); + pip = &pincr[slot]; + + if ((p = nproc[slot]) != NULL) { + + /* Free the proc structure and proc slot. */ + + nproc[slot] = NULL; + kmem_free(p, sizeof(proc_t)); + + /* + * Put this entry at the end of the free list so it is + * reassigned last. Bump the incarnation count. + */ + + INC_INCAR(pip->pi_pid); + pip->pi_link = NULL; + if (pfreelisttail) { + pfreelisttail->pi_link = pip; + pfreelisttail = pip; + } else { + pfreelisthead = pip; + pfreelisttail = pip; + } + } else { + + /* + * This slot was never actually used; put it on the + * head of the list so it will be reused first. + */ + + if (pfreelisthead) { + pip->pi_link = pfreelisthead; + pfreelisthead = pip; + } else { + pip->pi_link = NULL; + pfreelisthead = pip; + pfreelisttail = pip; + } + } +} + +/* + * This routine is called from mlsetup() to initialize the process table + * pointers, pids and status fields before they are first used. + */ + +void +ptbl_init() +{ + register proc_t **pp; + register pincr_t *pip; + ushort pid; + + pp = &nproc[0]; + pip = &pincr[0]; + + for (pid = 0; pp < v.ve_proc; pp++, pip++) { + *pp = NULL; + pip->pi_pid = pid++; + pip->pi_link = pip + 1; + } + + /* + * Set up the pointers to process table entry 1 + * and the first and last free entry. + */ + + pfreelisthead = &pincr[1]; + pip--; + pip->pi_link = NULL; + pfreelisttail = pip; } diff --git a/usr/src/uts/3b2/os/grow.c b/usr/src/uts/3b2/os/grow.c index 3627879..fc382fb 100644 --- a/usr/src/uts/3b2/os/grow.c +++ b/usr/src/uts/3b2/os/grow.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/grow.c 1.35" +#ident "@(#)kernel:os/grow.c 1.33" #include "sys/types.h" #include "sys/bitmasks.h" #include "sys/param.h" @@ -75,7 +75,7 @@ db_brk(size) if (nva > (caddr_t) UVUBLK || size < 0 - || (size > p->p_brksize && size > u.u_rlimit[RLIMIT_DATA].rlim_cur)) + || size > u.u_rlimit[RLIMIT_DATA].rlim_cur) return ENOMEM; change = nva - ova; @@ -132,7 +132,7 @@ grow(sp) register int ssize; register int lckflag = 0; - ssize = btoc(p->p_stksize); + ssize = btoc(p->p_stksize*sizeof(int *)); si = btoc((u_int)sp - (u_int)p->p_stkbase) - ssize + SINCR; if (si == 0 || (u_int) sp >= UVSHM) @@ -148,7 +148,7 @@ grow(sp) lckflag = 1; } } - if (as_map(p->p_as, p->p_stkbase + ctob(ssize), + if (as_map(p->p_as, (caddr_t)p->p_stkbase + ctob(ssize), (u_int)ctob(si), segvn_create, zfod_argsp) != 0) { if (lckflag) p->p_as->a_paglck = 0; @@ -161,11 +161,11 @@ grow(sp) * Release mapping to shrink UNIX stack segment */ (void) as_unmap(p->p_as, - p->p_stkbase + ctob(ssize+si), (u_int)ctob(-si)); + (caddr_t)p->p_stkbase + ctob(ssize+si), (u_int)ctob(-si)); } - p->p_stksize += ctob(si); - u.u_pcb.sub = (int *)(_VOID *)(p->p_stkbase + p->p_stksize); + p->p_stksize += howmany(ctob(si), sizeof(int *)); + u.u_pcb.sub = p->p_stkbase + p->p_stksize; return (1); diff --git a/usr/src/uts/3b2/os/kma.c b/usr/src/uts/3b2/os/kma.c index 7347097..5ef7fbb 100644 --- a/usr/src/uts/3b2/os/kma.c +++ b/usr/src/uts/3b2/os/kma.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/kmem.c 1.50" +#ident "@(#)kernel:os/kmem.c 1.43.1.1" /* * kernel memory allocator @@ -29,6 +29,9 @@ * */ +#define PARANOID 1 /* include debugging/tracing */ + /* this should eventually go in */ + /* kmacct driver */ #include "sys/types.h" #include "sys/param.h" @@ -43,9 +46,10 @@ #include "sys/stream.h" #include "sys/strsubr.h" #include "sys/systm.h" -#ifdef DEBUG +#ifdef PARANOID #include "sys/kmacct.h" -#endif /* DEBUG */ +#include "sys/errno.h" +#endif /* PARANOID */ /******************************CONSTANTS*********************************/ @@ -65,7 +69,7 @@ #define BIGBYTES 16384 /* big pool size in bytes */ #define BIGCLICKS btoc(BIGBYTES) /* ... in pages */ -#define NIDLEP 128 /* size of list of free pools */ +#define NIDLEP 32 /* size of list of free pools */ #ifndef _KERNEL #define MAXPOOLS 256 /* # pools for user-level debug trace */ @@ -208,17 +212,11 @@ typedef struct bpool { unchar *bp_startp; /* unaligned start address */ unchar *bp_alignp; /* aligned start address */ ulong bp_inuse; /* # of MAXA* buffers in use */ - ulong bp_status; /* current status of pool */ ulong *bp_bitmapp; /* pointer to bitmap */ ulong bp_expmin; /* exponent of smallest class */ ulong bp_expmax; /* exponent of largest class */ } bufpool; -/* - * Buffer pool status flags; bp_status. - */ -#define BP_IDLE 0x1 - /* * Hash structure * To make the VALID check more efficient, we duplicate the pool @@ -236,16 +234,6 @@ typedef struct hpool { /*******************************MACROS***********************************/ -#ifdef DEBUG -#define PARANOID(a,b,c,d) \ - if (Km_Paranoid || kmacctflag) kmem_worry((a),(b),(c),(d)) -#else -#define PARANOID(a,b,c,d) -#endif /* DEBUG */ - - - - /* Buffer free list macros (macros rather than routines for speed) */ /* @@ -424,6 +412,8 @@ STATIC int Km_SmAllocOn; /* TRUE -> are in the middle of */ /* allocating a small pool */ STATIC int Km_BgAllocOn; /* TRUE -> are in the middle of */ /* allocating a big pool */ +STATIC int Km_FreeOn; /* TRUE -> are in the middle of */ + /* freeing a pool */ int Km_pools[KMEM_NCLASS]; /* # of pools in each class */ int Km_allocspool; /* # of calls to kmem_allocspool */ @@ -438,29 +428,48 @@ int Km_freepool; /* # of calls to kmem_freepool */ */ unchar *Km_Golden[2]; -#ifdef DEBUG +#ifdef PARANOID /* - * stuff to help debug panics caused by drivers/modules using memory - * after it's freed, or writing past the end of allocated memory. - * - * if Km_Paranoid is set, we'll call kmem_worry() to check freelist headers + * if Km_Paranoid is set, will call kmem_check() to check freelist headers * on entering and leaving kmem_alloc(), kmem_free(), and kmem_coalesce(). - * if Km_CheckAll is also set, will check entire freelist, instead of just - * headers + * Km_Paranoid may be set from demon proms ("sw Km_Paranoid 1"). + * if the freelist is trashed, will call demon. + * if Km_Paranoid and Km_CheckAll both are set, it will check the entire + * freelist, not just the headers. * * if kmacctflag is set, the KMACCT driver will collect counts of memory * usage to detect memory allocated but never freed. * - * if Km_TraceAddr is set, kmem_worry() will call demon when allocating or - * freein that addr. + * if Km_TraceAddr is set, will call demon when allocate or free that addr. * */ int Km_Paranoid = FALSE; int Km_CheckAll = FALSE; -int kmacctflag = FALSE; +int kmacctflag = FALSE; /* for KMACCT driver */ +int Km_Recurse; /* count recursion depth in kmem_coalsece */ unchar *Km_TraceAddr = (unchar *)NULL; -extern void kmem_worry(); -#endif /* DEBUG */ + +/* + * use Km_Alloc and Km_Free to keep track of who alloc'd & freed addrs. + * have NREC of each -- will wrap when full. + */ + +#define NUMCALL 6 +#define NREC 500 + +struct callrec { + caddr_t caller[NUMCALL]; + unchar *addr; + ulong size; +} Km_Alloc[NREC+1], Km_Free[NREC+1]; + +STATIC int Km_i, Km_j; /* indices for Km_Alloc & Km_Free resp. */ +STATIC int Km_iwrap, Km_jwrap; /* wrap flags */ +STATIC int Km_Low = MINASMALL; +STATIC int Km_High = MAXABIG; +STATIC int Km_Max = 5; /* max number of alloc/frees to print */ + +#endif /* PARANOID */ /* kmem routines */ @@ -477,6 +486,22 @@ STATIC int kmem_allocspool(); STATIC int kmem_allocbpool(); STATIC void kmem_coalesce(); +#ifdef PARANOID +void kmem_check(); /* check freelist */ +void kmem_trace(); /* trace usage of an address */ +int cntausers(); /* count allocations of an addr */ +int cntfusers(); /* count free's of an addr */ +void cntusers(); /* count alloc's and free's of an addr */ +void prausers(); /* print alloc's of an addr */ +void prfusers(); /* print free's of an addr */ +void prusers(); /* print alloc's and free's of an addr */ +STATIC void prarange(); /* internal routine for print trace */ +STATIC void prfrange(); /* internal routine for print trace */ +STATIC void kmem_getcaller();/* get stack trace */ +void kmem_trace(); /* trace address usage */ + +extern int s3blookup(); /* to get symbol names (is in DEBUG) */ +#endif /* PARANOID */ /* external variables */ @@ -571,7 +596,7 @@ int flags; /* flags */ if ( ((availrmem - SMALLCLICKS) < tune.t_minarmem) || ((availsmem - SMALLCLICKS) < tune.t_minasmem) ) { Km_SmAllocOn = FALSE; - wakeprocs((caddr_t)&Km_SmAllocOn, PRMPT); + wakeup((caddr_t)&Km_SmAllocOn); return(FAILURE); } availrmem -= SMALLCLICKS; @@ -582,7 +607,7 @@ int flags; /* flags */ availrmem += SMALLCLICKS; availsmem += SMALLCLICKS; Km_SmAllocOn = FALSE; - wakeprocs((caddr_t)&Km_SmAllocOn, PRMPT); + wakeup((caddr_t)&Km_SmAllocOn); return(FAILURE); } pages_pp_kernel += SMALLCLICKS; @@ -620,7 +645,6 @@ int flags; /* flags */ poolp->bp_startp = startp; poolp->bp_alignp = memp; poolp->bp_inuse = 0; - poolp->bp_status = 0; poolp->bp_expmin = MINSIDX; poolp->bp_expmax = MAXSIDX; @@ -683,7 +707,7 @@ int flags; /* flags */ Km_NewSmall = poolp; Km_SmAllocOn = FALSE; - wakeprocs((caddr_t)&Km_SmAllocOn, PRMPT); + wakeup((caddr_t)&Km_SmAllocOn); return(SUCCESS); } @@ -743,7 +767,7 @@ int flags; /* flags */ if ( ((availrmem - BIGCLICKS) < tune.t_minarmem) || ((availsmem - BIGCLICKS) < tune.t_minasmem) ) { Km_BgAllocOn = FALSE; - wakeprocs((caddr_t)&Km_BgAllocOn, PRMPT); + wakeup((caddr_t)&Km_BgAllocOn); return(FAILURE); } availrmem -= BIGCLICKS; @@ -754,7 +778,7 @@ int flags; /* flags */ availrmem += BIGCLICKS; availsmem += BIGCLICKS; Km_BgAllocOn = FALSE; - wakeprocs((caddr_t)&Km_BgAllocOn, PRMPT); + wakeup((caddr_t)&Km_BgAllocOn); return(FAILURE); } startp = memp; @@ -780,7 +804,7 @@ int flags; /* flags */ availrmem += BIGCLICKS; availsmem += BIGCLICKS; Km_BgAllocOn = FALSE; - wakeprocs((caddr_t)&Km_BgAllocOn, PRMPT); + wakeup((caddr_t)&Km_BgAllocOn); return(FAILURE); } pages_pp_kernel += BIGCLICKS; @@ -790,7 +814,6 @@ int flags; /* flags */ poolp->bp_startp = startp; poolp->bp_alignp = memp; poolp->bp_inuse = 0; - poolp->bp_status = 0; poolp->bp_expmin = MINBIDX; poolp->bp_expmax = MAXBIDX; @@ -847,7 +870,7 @@ int flags; /* flags */ Km_NewBig = poolp; Km_BgAllocOn = FALSE; - wakeprocs((caddr_t)&Km_BgAllocOn, PRMPT); + wakeup((caddr_t)&Km_BgAllocOn); return(SUCCESS); } @@ -892,8 +915,10 @@ int flags; /* flags */ if ( size == 0 ) return((_VOID *)NULL); - - PARANOID("entering kmem_alloc", KMACCT_ALLOC, (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("entering kmem_alloc", Km_CheckAll); +#endif /* PARANOID */ if ( size <= MAXASMALL ) { listp = Km_FreeLists + SMINOFFSET; tmpsiz = MINASMALL; @@ -920,8 +945,10 @@ int flags; /* flags */ (void) sleep((caddr_t)&Km_OsizeWanted, PZERO); goto osizeagain; } - PARANOID("leaving kmem_alloc", KMACCT_ALLOC, - (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("leaving kmem_alloc", Km_CheckAll); +#endif /* PARANOID */ return((_VOID *)NULL); } @@ -941,14 +968,38 @@ int flags; /* flags */ goto osizeagain; } ++kmeminfo.km_fail[KMEM_OSIZE]; - PARANOID("leaving kmem_alloc", KMACCT_ALLOC, - (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("leaving kmem_alloc", Km_CheckAll); +#endif /* PARANOID */ return((_VOID *)NULL); } pages_pp_kernel += clicks; kmeminfo.km_alloc[KMEM_OSIZE] += (ulong)ctob(clicks); - PARANOID("leaving kmem_alloc", KMACCT_ALLOC, - (_VOID *)bufp, size); +#ifdef PARANOID + if ( Km_Paranoid ) { + int i; + + kmem_check("leaving kmem_alloc", Km_CheckAll); + if ( size >= Km_Low && size <= Km_High ) { + if ( (i = Km_i++) >= NREC ) { + Km_iwrap++; + i = Km_i = 0; + } + kmem_getcaller(NUMCALL, Km_Alloc[i].caller); + Km_Alloc[i].size = size; + Km_Alloc[i].addr = (unchar *)bufp; + } + } + if ( kmacctflag ) + kmaccount(KMACCT_ALLOC, size, (caddr_t *)bufp); + if ( bufp == (freebuf *)Km_TraceAddr ) { + cmn_err(CE_NOTE, + "^kmem_alloc: returning traced address 0x%x\n", + bufp); + call_demon(); + } +#endif /* PARANOID */ return((_VOID *)bufp); } @@ -969,7 +1020,10 @@ int flags; /* flags */ * kmem_coalesce(). fb_mapp, fb_mask will have been init'd * in kmem_coalesce(). */ - PARANOID("kmem_alloc @allocMaxagain", KMACCT_ALLOC, (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("kmem_alloc @allocMaxagain", Km_CheckAll); +#endif /* PARANOID */ if ( (bufp = listp->fl_nextp) != (freebuf *)listp ) { if ( tmpsiz < max && bufp->fb_union.fb_state != DELAYED ) { *bufp->fb_union.fb_mapp |= bufp->fb_mask; @@ -992,8 +1046,30 @@ int flags; /* flags */ else kmeminfo.km_alloc[KMEM_LARGE] += (ulong)tmpsiz; - PARANOID("leaving kmem_alloc", KMACCT_ALLOC, - (_VOID *)bufp, size); +#ifdef PARANOID + if ( Km_Paranoid ) { + int i; + + kmem_check("leaving kmem_alloc", Km_CheckAll); + if ( size >= Km_Low && size <= Km_High ) { + if ( (i = Km_i++) >= NREC ) { + Km_iwrap++; + i = Km_i = 0; + } + kmem_getcaller(NUMCALL, Km_Alloc[i].caller); + Km_Alloc[i].size = size; + Km_Alloc[i].addr = (unchar *)bufp; + } + } + if ( kmacctflag ) + kmaccount(KMACCT_ALLOC, size, (caddr_t *)bufp); + if ( bufp == (freebuf *)Km_TraceAddr ) { + cmn_err(CE_NOTE, + "^kmem_alloc: returning traced address 0x%x\n", + bufp); + call_demon(); + } +#endif /* PARANOID */ return((_VOID *)bufp); } @@ -1010,8 +1086,10 @@ int flags; /* flags */ ++listp; allocagain: - PARANOID("kmem_alloc @allocagain", KMACCT_ALLOC, - (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("kmem_alloc @allocagain", Km_CheckAll); +#endif /* PARANOID */ if ( (bufp = listp->fl_nextp) != (freebuf *)listp ) { /* * We found a buffer. Take it from the list. @@ -1046,8 +1124,31 @@ int flags; /* flags */ kmeminfo.km_alloc[KMEM_SMALL] += (ulong)newsiz; else kmeminfo.km_alloc[KMEM_LARGE] += (ulong)newsiz; - PARANOID("leaving kmem_alloc", KMACCT_ALLOC, - (_VOID *)bufp, size); +#ifdef PARANOID + if ( Km_Paranoid ) { + int i; + + kmem_check("leaving kmem_alloc", Km_CheckAll); + if ( size >= Km_Low && size <= Km_High ) { + if ( (i = Km_i++) >= NREC ) { + Km_iwrap++; + i = Km_i = 0; + } + kmem_getcaller(NUMCALL, + Km_Alloc[i].caller); + Km_Alloc[i].size = size; + Km_Alloc[i].addr = (unchar *)bufp; + } + } + if ( kmacctflag ) + kmaccount(KMACCT_ALLOC, size, (caddr_t *)bufp); + if ( bufp == (freebuf *)Km_TraceAddr ) { + cmn_err(CE_NOTE, + "^kmem_alloc: returning traced address 0x%x\n", + bufp); + call_demon(); + } +#endif /* PARANOID */ return((_VOID *)bufp); } @@ -1146,7 +1247,10 @@ int flags; /* flags */ * We can't get another buffer pool, and we can't sleep * until memory is freed up. */ - PARANOID("leaving kmem_alloc", KMACCT_ALLOC, (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("leaving kmem_alloc", Km_CheckAll); +#endif /* PARANOID */ return((_VOID *)NULL); } @@ -1275,7 +1379,30 @@ size_t size; /* size (in bytes) */ return; bufp = (freebuf *)addr; - PARANOID("entering kmem_free", KMACCT_FREE, addr, size); +#ifdef PARANOID + if ( Km_Paranoid ) { + int j; + + kmem_check("entering kmem_free", Km_CheckAll); + if ( size >= Km_Low && size <= Km_High ) { + if ( (j = Km_j++) >= NREC ) { + Km_jwrap++; + j = Km_j = 0; + } + kmem_getcaller(NUMCALL, Km_Free[j].caller); + Km_Free[j].size = size; + Km_Free[j].addr = (unchar *)bufp; + } + } + if ( kmacctflag ) + kmaccount(KMACCT_FREE, size, (caddr_t *)addr); + if ( bufp == (freebuf *)Km_TraceAddr ) { + cmn_err(CE_NOTE, + "^kmem_free: freeing traced address 0x%x\n", + bufp); + call_demon(); + } +#endif /* PARANOID */ if ( size > MAXABIG ) { @@ -1287,7 +1414,10 @@ size_t size; /* size (in bytes) */ /* * address must be aligned on page boundary */ - ASSERT ( ((ulong)bufp & (ulong)(PAGESIZE-1)) == 0 ); + if ( ((ulong)bufp & (ulong)(PAGESIZE-1)) != 0 ) + cmn_err(CE_PANIC, + "kmem_free: buffer 0x%x (size 0x%x bytes) not aligned for PAGESIZE 0x%x\n", + bufp, size, PAGESIZE); clicks = btoc(size); sptfree((caddr_t)addr, (int)clicks, 1); @@ -1301,13 +1431,16 @@ size_t size; /* size (in bytes) */ */ if ( Km_OsizeWanted > 0 && Km_OsizeWanted <= size ) { Km_OsizeWanted = 0; - wakeprocs((caddr_t)&Km_OsizeWanted, PRMPT); + wakeup((caddr_t)&Km_OsizeWanted); } if ( strbcwait && !strbcflag ) { setqsched(); strbcflag = TRUE; } - PARANOID("leaving kmem_free", KMACCT_FREE, (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("leaving kmem_free", Km_CheckAll); +#endif /* PARANOID */ return; } @@ -1361,19 +1494,15 @@ size_t size; /* size (in bytes) */ if ( --(bufp->fb_union.fb_poolp->bp_inuse) == 0 && bufp->fb_union.fb_poolp != Km_NewSmall && bufp->fb_union.fb_poolp != Km_NewBig ) { - if ( Km_IdleI < NIDLEP ) { - if ( (bufp->fb_union.fb_poolp->bp_status & BP_IDLE) == 0 ) { - Km_Idlep[Km_IdleI++] = - bufp->fb_union.fb_poolp; - bufp->fb_union.fb_poolp->bp_status |= BP_IDLE; - } - } + if ( Km_IdleI < NIDLEP ) + Km_Idlep[Km_IdleI++] = + bufp->fb_union.fb_poolp; #ifdef DEBUG else cmn_err(CE_WARN, "kmem_free: idle list full\n"); #endif /* DEBUG */ - wakeprocs((caddr_t)Km_Idlep, PRMPT); + wakeup((caddr_t)Km_Idlep); } } } else { @@ -1403,18 +1532,21 @@ size_t size; /* size (in bytes) */ if ( size <= MAXASMALL ) { if ( Km_SmallWanted > 0 && Km_SmallWanted <= size ) { Km_SmallWanted = 0; - wakeprocs((caddr_t)&Km_SmallWanted, PRMPT); + wakeup((caddr_t)&Km_SmallWanted); } } else if ( Km_BigWanted > 0 && Km_BigWanted <= size ) { Km_BigWanted = 0; - wakeprocs((caddr_t)&Km_BigWanted, PRMPT); + wakeup((caddr_t)&Km_BigWanted); } if ( strbcwait && !strbcflag ) { setqsched(); strbcflag = TRUE; } - PARANOID("leaving kmem_free", KMACCT_FREE, (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("leaving kmem_free", Km_CheckAll); +#endif /* PARANOID */ return; } @@ -1457,7 +1589,11 @@ ulong max; /* max size for class */ ulong bmask; /* correctly-shifted buddy mask */ freebuf *buf2p; /* for accelerated coalescing */ - PARANOID("entering kmem_coalesce", KMACCT_FREE, (_VOID *)NULL, 0); +#ifdef PARANOID + ++Km_Recurse; + if ( Km_Paranoid ) + kmem_check("entering kmem_coalesce", Km_CheckAll); +#endif /* PARANOID */ /* * find the associated pool * compute the mask for this buffer @@ -1474,7 +1610,10 @@ ulong max; /* max size for class */ freeagain: - PARANOID("kmem_coalesce @freeagain", KMACCT_FREE, (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("kmem_coalesce @freeagain", Km_CheckAll); +#endif /* PARANOID */ /* * Compute the mask for the buddy @@ -1514,20 +1653,14 @@ ulong max; /* max size for class */ bufp->fb_union.fb_poolp = poolp; if ( --(poolp->bp_inuse) == 0 && poolp != Km_NewSmall && poolp != Km_NewBig ) { - if ( Km_IdleI < NIDLEP ) { - if ( (poolp->bp_status & BP_IDLE) == 0 ) { - Km_Idlep[Km_IdleI++] = - poolp; - poolp->bp_status |= - BP_IDLE; - } - } + if ( Km_IdleI < NIDLEP ) + Km_Idlep[Km_IdleI++] = poolp; #ifdef DEBUG else cmn_err(CE_WARN, "kmem_coalesce: idle list full\n"); #endif /* DEBUG */ - wakeprocs((caddr_t)Km_Idlep, PRMPT); + wakeup((caddr_t)Km_Idlep); } } /* @@ -1537,12 +1670,11 @@ ulong max; /* max size for class */ if ( Km_SmallWanted > 0 && Km_SmallWanted <= tmpsiz ) { Km_SmallWanted = 0; - wakeprocs((caddr_t)&Km_SmallWanted, - PRMPT); + wakeup((caddr_t)&Km_SmallWanted); } } else if ( Km_BigWanted > 0 && Km_BigWanted <= tmpsiz ) { Km_BigWanted = 0; - wakeprocs((caddr_t)&Km_BigWanted, PRMPT); + wakeup((caddr_t)&Km_BigWanted); } } else { /* @@ -1555,14 +1687,17 @@ ulong max; /* max size for class */ if ( listp->fl_slack == 0 && (buf2p = listp->fl_nextp) != (freebuf *)listp && buf2p->fb_union.fb_state == DELAYED ) { - UNLINKHEAD(listp, buf2p); - kmem_coalesce(buf2p, listp, tmpsiz, max); + UNLINKHEAD(listp, buf2p); + kmem_coalesce(buf2p, listp, tmpsiz, max); } else listp->fl_slack = 0; goto freeagain; } - PARANOID("leaving kmem_coalesce", KMACCT_FREE, - (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("leaving kmem_coalesce", Km_CheckAll); + --Km_Recurse; +#endif /* PARANOID */ return; } /* @@ -1576,7 +1711,11 @@ ulong max; /* max size for class */ bufp->fb_union.fb_mapp = wordp; bufp->fb_mask = mask; TAILFREE(listp, bufp); - PARANOID("leaving kmem_coalesce", KMACCT_FREE, (_VOID *)NULL, 0); +#ifdef PARANOID + if ( Km_Paranoid ) + kmem_check("leaving kmem_coalesce", Km_CheckAll); + --Km_Recurse; +#endif /* PARANOID */ return; } @@ -1608,6 +1747,12 @@ kmem_freepool() for ( ;; ) { ++Km_freepool; /* count "calls" to kmem_freepool() */ + /* + * if already in process of freeing a pool, don't start again + */ + if ( Km_FreeOn == TRUE ) + goto fp_sleep; + Km_FreeOn = TRUE; /* * copy the pools to be freed from Km_Idlep to Km_Idle2p. @@ -1623,9 +1768,8 @@ kmem_freepool() while ( --Km_IdleJ >= 0 ) { - poolp = Km_Idle2p[Km_IdleJ]; - - ASSERT(poolp != (bufpool *)NULL); + if ( (poolp = Km_Idle2p[Km_IdleJ]) == (bufpool *)NULL ) + continue; /* while */ /* * find max-size freelist for this class pool @@ -1649,7 +1793,6 @@ kmem_freepool() oldpri = splhi(); if ( poolp->bp_inuse > 0 ) { - poolp->bp_status &= ~BP_IDLE; splx(oldpri); continue; /* while */ } @@ -1669,6 +1812,7 @@ kmem_freepool() splx(oldpri); /* find hash structure for this pool */ + hashp = (hashpool *)NULL; i = HASH(poolp->bp_startp); if ( max == MAXABIG ) j = HASH(poolp->bp_startp + BIGBYTES - 1); @@ -1683,6 +1827,7 @@ kmem_freepool() "kmem_freepool %d: no hashpool in HashList[%d] for pool 0x%x\n", __LINE__, i, poolp); } + psize = (ulong)(hashp->hp_endp) - (ulong)(hashp->hp_alignp); oldpri = splhi(); DELHASH(hashp, i); splx(oldpri); @@ -1702,12 +1847,6 @@ kmem_freepool() } if ( max == MAXABIG ) { - kmeminfo.km_mem[KMEM_LARGE] -= - ((ulong)(hashp->hp_endp) - - (ulong)(hashp->hp_alignp)); - --Km_pools[KMEM_LARGE]; - psize = BIGCLICKS; - sptfree((caddr_t)poolp->bp_startp, BIGCLICKS, 1); availrmem += BIGCLICKS; availsmem += BIGCLICKS; @@ -1720,21 +1859,20 @@ kmem_freepool() kmem_free((_VOID *)poolp, (sizeof(bufpool) + (2*sizeof(hashpool)) + (BIGBYTES/(MINBIG*8)))); + kmeminfo.km_mem[KMEM_LARGE] -= psize; + --Km_pools[KMEM_LARGE]; } else { /* * freeing the pool will also free associated * structures and bitmap */ - kmeminfo.km_mem[KMEM_SMALL] -= - ((ulong)(hashp->hp_endp) - - (ulong)(hashp->hp_alignp) - (2*MAXASMALL)); - --Km_pools[KMEM_SMALL]; - psize = SMALLCLICKS; - sptfree((caddr_t)poolp->bp_startp, SMALLCLICKS, 1); availrmem += SMALLCLICKS; availsmem += SMALLCLICKS; pages_pp_kernel -= SMALLCLICKS; + + kmeminfo.km_mem[KMEM_SMALL] -= psize; + --Km_pools[KMEM_SMALL]; } if ( Km_OsizeWanted > 0 && Km_OsizeWanted <= psize ) { /* @@ -1743,12 +1881,14 @@ kmem_freepool() * waiting for memory */ Km_OsizeWanted = 0; - wakeprocs((caddr_t)&Km_OsizeWanted, PRMPT); + wakeup((caddr_t)&Km_OsizeWanted); } + poolp = (bufpool *)NULL; } /* end "while ( --Km_IdleJ >= 0 )" */ + Km_FreeOn = FALSE; fp_sleep: - wakeprocs((caddr_t)&Km_SmAllocOn, PRMPT); /*insurance against race*/ - wakeprocs((caddr_t)&Km_BgAllocOn, PRMPT); /*insurance against race*/ + wakeup((caddr_t)&Km_SmAllocOn); /* insurance against race */ + wakeup((caddr_t)&Km_BgAllocOn); /* insurance against race */ sleep((caddr_t)Km_Idlep, PZERO); } } @@ -1769,3 +1909,555 @@ kmem_avail() + (kmeminfo.km_mem[KMEM_LARGE] - kmeminfo.km_alloc[KMEM_LARGE]) )); } + +#ifdef PARANOID +/* + * kmem_check(s, all) freelist check + * char s; text to print on error + * int all; whether to walk entire freelist or just headers + * + * for debugging, to be called from demon debugger ("c kmem_check u.u_comm 0" + * or "c kmem_check u.u_comm 1") + * + * also called on entry to or exit from kmem_alloc, kmem_free, kmem_coealesce + * if Km_Paranoid is set. + * + * walks freelist, looking for trashed pointers. + * if all is set, walks entire freelist. if not, just looks at head & tail + * pointers (fl_nextp and fl_prevp) off Km_FreeLists. + * + * if any pointer is trashed, prints warning and calls demon. + * only check pointers that are not one of the elements of the Km_FreeLists + * array. "trashed" if it's not properly aligned or if it's < 0x40000000 + * or > 0x40500000 + * + */ + +#define ADDR1 (freebuf *)0x40000000 +#define ADDR2 (freebuf *)0x40500000 +/* BADADDR1 -- address must be 'size'-aligned */ +#define BADADDR1(x) ( ( (x) < (freebuf *)&Km_FreeLists[SMINOFFSET] \ + || (x) > (freebuf *)&Km_FreeLists[BMAXOFFSET] ) \ + && ( ((ulong)(x) & (ulong)(size-1)) != 0 \ + || ((x) < ADDR1) || ((x) > ADDR2) ) ) +/* BADADDR2 -- only word alignment matters */ +#define BADADDR2(x) ( ((ulong)(x) & (ulong)3) != 0 \ + || ((x) < ADDR1) || ((x) > ADDR2) ) + +/* is this the size request we are interested in */ +#define SIZECHECK(s,b) ((s==0) || ((b <= s) && (b > (s/2)))) + +int Km_DebugInst = NULL; /* set if DEBUG module is in kernel */ + /* after check, will be ENOPKG if */ + /* DEBUG is not in kernel */ + +void +kmem_check(s, all) +char *s; +int all; +{ + register freebuf *head, *tail, *p; + register int i, size; + int bad, stop = 0, oldpri; + void why1(), why2(); + + for ( size = MINASMALL, i = SMINOFFSET; + size <= MAXABIG && i <= BMAXOFFSET; ++i, size *= 2 ) { + + + /* + * have to spl this or interrupts cause bogus failures + */ + oldpri = splhi(); + + if ( (head = Km_FreeLists[i].fl_nextp) == (freebuf *)&Km_FreeLists[i] ) { + splx(oldpri); + continue; /* empty list -- continue in 'for' */ + } + tail = Km_FreeLists[i].fl_prevp; + bad = 0; /* innocent until proven guilty */ + + if ( BADADDR1(head) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist header trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_prevp = 0x%x\n", + s, size, head, tail); + why1(head, size); + bad++; + } else if ( BADADDR1(tail) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist header trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_prevp = 0x%x\n", + s, size, head, tail); + why1(tail, size); + bad++; + } else { + if ( BADADDR1(head->fb_nextp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist head pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_nextp = 0x%x\n\t\tfl_nextp->fb_prevp = 0x%x\n", + s, size, head, head->fb_nextp, head->fb_prevp); + why1(head->fb_nextp, size); + bad++; + } + if ( BADADDR1(head->fb_prevp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist head pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_nextp = 0x%x\n\t\tfl_nextp->fb_prevp = 0x%x\n", + s, size, head, head->fb_nextp, head->fb_prevp); + why1(head->fb_prevp, size); + bad++; + } + if ( BADADDR1(tail->fb_nextp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist tail pointer (fl_prevp) trashed:\n\t\tfl_prevp = 0x%x\n\t\tfl_prevp->fb_nextp = 0x%x\n\t\tfl_prevp->fb_prevp = 0x%x\n", + s, size, tail, tail->fb_nextp, tail->fb_prevp); + why1(tail->fb_nextp, size); + bad++; + } + if ( BADADDR1(tail->fb_prevp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist tail pointer (fl_prevp) trashed:\n\t\tfl_prevp = 0x%x\n\t\tfl_prevp->fb_nextp = 0x%x\n\t\tfl_prevp->fb_prevp = 0x%x\n", + s, size, tail, tail->fb_nextp, tail->fb_prevp); + why1(tail->fb_prevp, size); + bad++; + } + + + /* if union holds a pool or bitmap pointer, check it */ + if ( head->fb_union.fb_state != DELAYED + && BADADDR2((freebuf *)head->fb_union.fb_mapp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist head pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_fb_union.fb_%s = 0x%x\n", + s, size, head, + ( ( size == MAXASMALL || size == MAXABIG) ? + "poolp" : "mapp" ), + head->fb_union.fb_mapp); + why2(head->fb_union.fb_mapp); + bad++; + } + if ( tail->fb_union.fb_state != DELAYED + && BADADDR2((freebuf *)tail->fb_union.fb_mapp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist tail pointer (fl_nextp) trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_fb_union.fb_%s = 0x%x\n", + s, size, tail, + ( ( size == MAXASMALL || size == MAXABIG) ? + "poolp" : "mapp" ), + tail->fb_union.fb_mapp); + why2(tail->fb_union.fb_mapp); + bad++; + } + + } + stop += bad; + if ( bad || !all ) { /* don't go further with bad pointers */ + splx(oldpri); + continue; /* for */ + } + + /* walk entire freelist */ + for ( p = head->fb_nextp; p != (freebuf *)&Km_FreeLists[i]; + p = p->fb_nextp ) { + if ( BADADDR1(p->fb_nextp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist trashed:\n\t\tbufp = 0x%x\n\t\tbufp->fb_nextp = 0x%x\n\t\tbufp->fb_prevp = 0x%x\n", + s, size, p, p->fb_nextp, p->fb_prevp); + why1(p->fb_nextp, size); + bad++; + break; + } + if ( BADADDR1(p->fb_prevp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist trashed:\n\t\tbufp = 0x%x\n\t\tbufp->fb_nextp = 0x%x\n\t\tbufp->fb_prevp = 0x%x\n", + s, size, p, p->fb_nextp, p->fb_prevp); + why1(p->fb_prevp, size); + bad++; + break; + } + if ( p->fb_union.fb_state != DELAYED + && BADADDR2((freebuf *)p->fb_union.fb_mapp) ) { + cmn_err(CE_WARN, + "^%s: %u-byte freelist trashed:\n\t\tfl_nextp = 0x%x\n\t\tfl_nextp->fb_fb_union.fb_%s = 0x%x\n", + s, size, p, + ( ( size == MAXASMALL || size == MAXABIG) ? + "poolp" : "mapp" ), + p->fb_union.fb_mapp); + why2(p->fb_union.fb_mapp); + bad++; + } + } + splx(oldpri); + stop += bad; + } + if (stop) + call_demon(); + return; +} + +void +why1(x, size) +freebuf *x; +int size; +{ + cmn_err(CE_CONT, "^kmem_check failed this test:\n"); + cmn_err(CE_CONT, +"^( ( (x) < (freebuf *)&Km_FreeLists[SMINOFFSET]\\\n"); + cmn_err(CE_CONT, +"^ || (x) > (freebuf *)&Km_FreeLists[BMAXOFFSET] ) \\\n"); + cmn_err(CE_CONT, +"^ && ( ((ulong)(x) & (ulong)(size-1)) != 0 \\\n"); + cmn_err(CE_CONT, +"^ || ((x) < ADDR1) || ((x) > ADDR2) ) )\n"); + cmn_err(CE_CONT, +"^( ( 0x%x < 0x%x\\\n", x, &Km_FreeLists[SMINOFFSET]); + cmn_err(CE_CONT, +"^ || 0x%x > 0x%x ) \\\n", x, &Km_FreeLists[BMAXOFFSET]); + cmn_err(CE_CONT, +"^ && ( ((ulong)0x%x & (ulong)(0x%x)) != 0 \\\n", x, (size-1)); + cmn_err(CE_CONT, +"^ || (0x%x < 0x%x) || (0x%x > 0x%x) ) )\n", x, ADDR1, x, ADDR2); + + return; +} + + +void +why2(x) +ulong *x; +{ + cmn_err(CE_CONT, "^kmem_check failed this test:\n"); + cmn_err(CE_CONT, +"^( ((ulong)(x) & (ulong)3) != 0 \\\n"); + cmn_err(CE_CONT, +"^ || ((x) < ADDR1) || ((x) > ADDR2) )\n"); + cmn_err(CE_CONT, +"^( (0x%x & (ulong)3) != 0 \\\n", x); + cmn_err(CE_CONT, +"^ || (0x%x < 0x%x) || (0x%x > 0x%x) )\n", x, ADDR1, x, ADDR2); + + return; +} + +/* + * kmem_trace(addr, flag) trace/count uses of addr + * + * if flag is 0 then print out all uses of addr (and before) addr; + * if flag is !0 then print out number of uses of addr (and before) addr; + */ +void +kmem_trace(addr, flag) +register uint addr; +int flag; +{ + register uint size, mask; + register uint baddr; + + /* since we are only saving records for this range + * we can only find matches in this range + */ + for ( size = Km_Low; size <= Km_High; size *= 2 ) { + + /* + * if addr is on boundary x + * check(addr, x) + * check(addr-x, x) + * NOTE not checking addr + x + * else addr is inside an x-byte buffer + * check(addr&(x-1), x); + */ + + mask = ~(size - 1); + baddr = (uint)addr & (uint)mask; + if ( baddr == addr) { + + if (flag != 0) { /* just do count */ + cntusers(addr, size); + cntusers(addr-size, size); + } else { + prausers(addr, size); + prfusers(addr, size); + prausers(addr-size, size); + prfusers(addr-size, size); + } + } else { + if (flag != 0) { /* just do count */ + cntusers(baddr, size); + } else { + prusers(baddr, size); + } + } + + } +} + +/* cntusers -- count alloc/free's of addr */ +void +cntusers(addr, size) +uint addr, size; +{ + register int cnt; + if (cnt = cntausers(addr, size)) + cmn_err(CE_CONT, "^%d kmem_alloc of size %d at addr 0x%x\n", + cnt, size, addr); + + if (cnt = cntfusers(addr, size)) + cmn_err(CE_CONT, "^%d kmem_free of size %d at addr 0x%x\n", + cnt, size, addr); +} + + +/* count allocs */ +int +cntausers(addr, size) +uint addr, size; +{ + register int i, cnt = 0; + + for ( i = 0; i < NREC; i++ ) { + if ((Km_Alloc[i].addr == (unchar *)addr) && + SIZECHECK(size, Km_Alloc[i].size)) { + cnt++; + } + } + return cnt; +} + +/* count frees */ +int +cntfusers(addr, size) +uint addr, size; +{ + register int i, cnt = 0; + for ( i = 0; i < NREC; i++ ) { + if ((Km_Free[i].addr == (unchar *)addr) && + SIZECHECK(size, Km_Free[i].size)) { + cnt++; + } + } + return cnt; +} + +/* prusers -- print trace of alloc/free's of addr */ +void +prusers(addr, size) +uint addr, size; +{ + prausers(addr, size); + prfusers(addr, size); +} + + +/* print allocs */ +void +prausers(addr, size) +uint addr, size; +{ + int more = 0; + + /* We do this in reverse order to get last usage, + * Km_[ij] always points to next entry - entry is still valid + */ + if (Km_i != 0) { + prarange(Km_i - 1, 0, addr, size, &more); + } + prarange(NREC - 1, Km_i, addr, size, &more); + +} + +/* print frees */ +void +prfusers(addr, size) +uint addr, size; +{ + int more = 0; + + /* We do this in reverse order to get last usage, + * Km_[ij] always points to next entry - entry is still valid + */ + if (Km_j != 0) { + prfrange(Km_j - 1, 0, addr, size, &more); + } + prfrange(NREC - 1, Km_j, addr, size, &more); + +} + +STATIC +void +prarange(start, end, addr, size, more) +int start, end; +uint addr, size; +int *more; +{ + register int i, j; + + if ( Km_DebugInst == NULL ) + Km_DebugInst = s3blookup((uint)Km_Alloc[0].caller[0]); + + for ( i = start; i >= end; i-- ) { + if ((Km_Alloc[i].addr == (unchar *)addr) && + SIZECHECK(size, Km_Alloc[i].size)) { + if ( (*more)++ > Km_Max ) { + cmn_err(CE_CONT, "^Stopping at Km_Max\n"); + break; + } + cmn_err(CE_CONT, "^allocated %u bytes at 0x%x to:\n", + Km_Alloc[i].size, addr ); + for ( j = 0; j < NUMCALL; ++j ) + if (Km_Alloc[i].caller[j]) + if ( Km_DebugInst != ENOPKG ) + cmn_err(CE_CONT, "^\t\t0x%x %s\n", + Km_Alloc[i].caller[j], + (char *)s3blookup((uint)Km_Alloc[i].caller[j])); + else + cmn_err(CE_CONT, "^\t\t0x%x\n", + Km_Alloc[i].caller[j]); + } + } +} + +STATIC +void +prfrange(start, end, addr, size, more) +int start, end; +uint addr, size; +int *more; +{ + register int i, j; + + if ( Km_DebugInst == NULL ) + Km_DebugInst = s3blookup((uint)Km_Free[0].caller[0]); + + for ( i = start; i >= end; i-- ) { + if ((Km_Free[i].addr == (unchar *)addr) && + SIZECHECK(size, Km_Free[i].size)) { + if ( (*more)++ > Km_Max ) { + cmn_err(CE_CONT, "^Stopping at Km_Max\n"); + break; + } + cmn_err(CE_CONT, "^freed %u bytes at 0x%x from:\n", + Km_Free[i].size, addr ); + for ( j = 0; j < NUMCALL; ++j ) + if (Km_Free[i].caller[j]) + if ( Km_DebugInst != ENOPKG ) + cmn_err(CE_CONT, "^\t\t0x%x %s\n", + Km_Free[i].caller[j], + (char *)s3blookup((uint)Km_Free[i].caller[j])); + else + cmn_err(CE_CONT, "^\t\t0x%x\n", + Km_Free[i].caller[j]); + } + } +} + +/* + * The following routines and macros are machine dependent. They + * backtrack through the stack, collecting return PC's. + */ + + asm int +getfp() +{ + MOVW %fp, %r0 +} + + asm int +getsp() +{ + MOVW %sp, %r0 +} + + asm int +getap() +{ + MOVW %ap, %r0 +} + +/* + * The kernel text start address and kernel text length parameters should + * agree with the kernel text origin and length values given in the + * kernel ifile. These are used to detect when we traced back out of + * the kernel stack. + */ + +#define KTXTSTRT 0x40000000 +#define KTXTLEN 0x00160000 + +/* + * kmem_getcaller(num, pcstack) backtracks through the stack to retrieve + * the previous NUM calling routines; PCSTACK is a pointer to an + * array of at least NUM entries where the addresses are to be + * placed. The first address is always the routine that called + * kmem_getcaller(). This code is taken from debug/trace.c. + * There is no guarantee that all NUM entries belong in the same + * trace, and there is no protection against stack underflow. + */ + +STATIC void +kmem_getcaller(num, pcstack) + int num; + caddr_t pcstack[]; +{ + register int fp = getfp(); + register int sp = getsp(); + register int ap = getap(); + register caddr_t *pc = pcstack; + register int i; + register int *oldpcptr; + + for (i = 0; i < num; i++) { + + if (fp > ap) + oldpcptr = (int *)(fp - 9 * sizeof(char *)); + else + oldpcptr = (int *)(sp - 2 * sizeof(char *)); + + *pc = (caddr_t) *oldpcptr++; + + if ((*pc < (caddr_t) KTXTSTRT) || + (*pc > (caddr_t) (KTXTSTRT + KTXTLEN))) { + *pc++ = (caddr_t) NULL; + break; + } + + ++pc; + sp = ap; + ap = *oldpcptr++; + if (fp > sp) + fp = *oldpcptr; + } + + while (i < num) { + *pc++ = (caddr_t) NULL; + ++i; + } +} + +/* + * kmem_find: look for 'addr' in freelists + */ +void +kmem_find(addr) +register void *addr; +{ + register freebuf *p; + register int i, size; + + for ( size = MINASMALL, i = SMINOFFSET; + size <= MAXABIG && i <= BMAXOFFSET; + ++i, size *= 2 ) { + for ( p = Km_FreeLists[i].fl_nextp; + p != (freebuf *)&Km_FreeLists[i]; + p = p->fb_nextp ) { + if ( p == (freebuf *)addr ) { + cmn_err(CE_NOTE, + "^kmem_find: found address 0x%x in %u-byte freelist\nprev ptr = 0x%x, next = 0x%x\n", + p, size, p->fb_prevp, p->fb_nextp); + return; + } + if ( BADADDR1(p) ) { + cmn_err(CE_WARN, + "^kmem_find: %u-byte freelist trashed:\n\t\tbufp = 0x%x\n", + size, p); + break; + } + } + } + return; +} +#endif /* PARANOID */ diff --git a/usr/src/uts/3b2/os/kperf.c b/usr/src/uts/3b2/os/kperf.c index ab83209..388bdf0 100644 --- a/usr/src/uts/3b2/os/kperf.c +++ b/usr/src/uts/3b2/os/kperf.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/kperf.c 1.5" +#ident "@(#)kernel:os/kperf.c 1.4" #include "sys/types.h" #ifdef KPERF #include "sys/param.h" @@ -99,10 +99,10 @@ proc_t *kproc; /* don't write any more records, otherwise infinite loop */ outbuf = 1; kpftraceflg = 0; - wakeprocs((caddr_t) &kpft[takephase*NUMRC], PRMPT); + wakeup((caddr_t) &kpft[takephase*NUMRC]); return; } - wakeprocs((caddr_t)&kpft[takephase*NUMRC], PRMPT); + wakeup((caddr_t)&kpft[takephase*NUMRC]); } /* get out of critical section */ /* restore psw before exiting the critical section */ diff --git a/usr/src/uts/3b2/os/lock.c b/usr/src/uts/3b2/os/lock.c index cbc3995..7be9892 100644 --- a/usr/src/uts/3b2/os/lock.c +++ b/usr/src/uts/3b2/os/lock.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/lock.c 1.34" +#ident "@(#)kernel:os/lock.c 1.31" #include "sys/types.h" #include "sys/bitmap.h" #include "sys/sysmacros.h" @@ -55,10 +55,11 @@ STATIC int ublock(); STATIC int proclock(); STATIC void tunlock(); STATIC void dunlock(); -STATIC void ubunlock(); +STATIC int ubunlock(); int punlock(); #endif + /* ARGSUSED */ int lock_mem(uap, rvp) @@ -131,9 +132,12 @@ STATIC void tunlock() { register struct proc *p = u.u_procp; + register int error; - (void) as_ctl(p->p_as, 0, 0, MC_UNLOCKAS, PROC_TEXT|PRIVATE|PROT_USER, + error = as_ctl(p->p_as, 0, 0, MC_UNLOCKAS, PROC_TEXT|PRIVATE|PROT_USER, 0, (ulong *)NULL, (size_t)NULL); + if (error) + cmn_err(CE_PANIC, "tunlock(): unlock failed %d\n", error); u.u_lock &= ~TXTLOCK; } @@ -164,9 +168,12 @@ STATIC void dunlock() { register struct proc *p = u.u_procp; + register int error; - (void) as_ctl(p->p_as, 0, 0, MC_UNLOCKAS, PROC_DATA|PRIVATE|PROT_USER, + error = as_ctl(p->p_as, 0, 0, MC_UNLOCKAS, PROC_DATA|PRIVATE|PROT_USER, 0, (ulong *)NULL, (size_t)NULL); + if (error) + cmn_err(CE_PANIC, "dunlock(): unlock failed %d\n", error); u.u_lock &= ~DATLOCK; } @@ -175,16 +182,12 @@ dunlock() * Ublocks for system processes are counted in segu_alloc and segu_free. * SSYS processes are also SLOCK'ed. We will only do the accounting for * non SSYS processes. - * Allow user to mix plock and memlockall. */ STATIC int ublock() { - /* return if already locked */ - if (u.u_lock & (PROCLOCK|MEMLOCK)) - return 0; if ((u.u_procp->p_flag & (SSYS|SLOCK)) == 0) { if ((availrmem - USIZE) < tune.t_minarmem) { nomemmsg("proclock", USIZE, 0, 1); @@ -201,9 +204,6 @@ STATIC void ubunlock() { - /* return if still locked */ - if (u.u_lock & (PROCLOCK|MEMLOCK)) - return; if ((u.u_procp->p_flag & (SSYS|SLOCK)) == SLOCK) { u.u_procp->p_flag &= ~SLOCK; availrmem += USIZE; @@ -239,8 +239,8 @@ punlock() if ((u.u_lock & (PROCLOCK|TXTLOCK|DATLOCK)) == 0) return EINVAL; if (u.u_lock & PROCLOCK) { - u.u_lock &= ~PROCLOCK; ubunlock(); + u.u_lock &= ~PROCLOCK; } if (u.u_lock & TXTLOCK) tunlock(); @@ -328,7 +328,6 @@ memcntl(uap, rvp) /* do ublock availrmem accounting */ if ((error = ublock()) != 0) return error; - u.u_lock |= MEMLOCK; sseg = seg = as_pp->a_segs; if (seg == NULL) return 0; @@ -348,9 +347,6 @@ memcntl(uap, rvp) (u_int)raddr; break; case MC_UNLOCKAS: - /* remove claim for ublock */ - u.u_lock &= ~MEMLOCK; - ubunlock(); case MC_UNLOCK: mlock_map = NULL; mlock_size = NULL; @@ -370,7 +366,6 @@ memcntl(uap, rvp) if (error) { if (uap->cmd == MC_LOCKAS) { /* remove claim for ublock */ - u.u_lock &= ~MEMLOCK; ubunlock(); inx = 0; diff --git a/usr/src/uts/3b2/os/machdep.c b/usr/src/uts/3b2/os/machdep.c index 57077a9..bee9d40 100644 --- a/usr/src/uts/3b2/os/machdep.c +++ b/usr/src/uts/3b2/os/machdep.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/machdep.c 1.30" +#ident "@(#)kernel:os/machdep.c 1.26.1.8" #include "sys/sysmacros.h" #include "sys/param.h" #include "sys/types.h" @@ -202,6 +202,7 @@ extractarg(args) struct uarg *args; { int error; + extern int userstrlen(); int fnsize; caddr_t nsp; int stgsize; @@ -216,7 +217,10 @@ extractarg(args) stgsize = args->argsize + args->envsize + args->prefixsize; /* Now allow for the fname prefix change to old argv0: */ if (args->prefixc) { - fnsize = strlen(args->fname) + 1; + fnsize = userstrlen(args->fname) + 1; + if (fnsize < 0) + return(EFAULT); + fnsize++; /* for the NULL byte */ stgsize += fnsize; } stgsize = (stgsize + NBPW-1) & ~(NBPW-1); @@ -238,8 +242,7 @@ extractarg(args) args->estksize = bsize; args->stacklow = (addr_t) userstack; /* and create it */ - if (error = as_map(u.u_procp->p_as, nsp, bsize, - segvn_create, zfod_argsp)) + if (error = as_map(u.u_procp->p_as, nsp, bsize, segvn_create, zfod_argsp)) return error; /* @@ -315,10 +318,12 @@ extractarg(args) as_unmap(u.u_procp->p_as, nsp, bsize); return EFAULT; } - - argv0 = cp + args->argsize + args->envsize + args->prefixsize; - bcopy(args->fname, argv0, fnsize); - + if (copyout(args->fname, (argv0 = + cp + args->argsize + args->envsize + args->prefixsize), + fnsize)) { + as_unmap(u.u_procp->p_as, nsp, bsize); + return EFAULT; + } argv0 += ptrdelta; if (suword((int *)(ptrstart + NBPW * (1 + args->prefixc)), (int)argv0)) { @@ -359,8 +364,8 @@ setregs(args) } *sp = '\0'; - p->p_stksize = args->estksize; - p->p_stkbase = (caddr_t)userstack; + p->p_stksize = howmany(args->estksize, sizeof(int *)); + p->p_stkbase = userstack; u.u_pcb.sub = (int *)((u_int)userstack + args->estksize); @@ -545,17 +550,14 @@ restorecontext(ucp) if (ucp->uc_flags & UC_STACK) { if (pp->p_stkbase != ucp->uc_stack.ss_sp) { pp->p_stkbase = ucp->uc_stack.ss_sp; - u.u_pcb.slb = (int *)(_VOID *)ucp->uc_stack.ss_sp; + u.u_pcb.slb = ucp->uc_stack.ss_sp; pp->p_stksize = ucp->uc_stack.ss_size; - u.u_pcb.sub = (int *)(_VOID *)(pp->p_stkbase - + pp->p_stksize); + u.u_pcb.sub = pp->p_stkbase + pp->p_stksize; + if (ucp->uc_stack.ss_sp == u.u_altsp) + u.u_altflags |= SS_ONSTACK; + else + u.u_altflags &= ~SS_ONSTACK; } - if (ucp->uc_stack.ss_flags & SS_ONSTACK) - bcopy((caddr_t)&ucp->uc_stack, - (caddr_t)&u.u_sigaltstack, - sizeof(struct sigaltstack)); - else - u.u_sigaltstack.ss_flags &= ~SS_ONSTACK; } if (ucp->uc_flags & UC_CPU) @@ -586,8 +588,6 @@ savecontext(ucp, mask) ucp->uc_stack.ss_sp = pp->p_stkbase; ucp->uc_stack.ss_size = pp->p_stksize; ucp->uc_stack.ss_flags = 0; - if (pp->p_stkbase == u.u_sigaltstack.ss_sp) - ucp->uc_stack.ss_flags |= SS_ONSTACK; /* * Save machine context. @@ -610,16 +610,15 @@ savecontext(ucp, mask) psw_t sendsig_psw = SIGPSW; int -sendsig(sig, sip, hdlr) +sendsig(sig, hdlr) int sig; - k_siginfo_t *sip; register void (*hdlr)(); { ucontext_t uc; psw_t ill_psw; siginfo_t si; int newstack; /* if true, switching to alternate stack */ - int minstacksz; /* size of stack required to catch signal */ + int stacksz; /* size of stack required to catch signal */ register int *sp, *ap; proc_t *p = u.u_procp; struct { @@ -634,33 +633,34 @@ sendsig(sig, sip, hdlr) argpframe.signo = sig; - minstacksz = + stacksz = sizeof(ucontext_t) + /* user context structure */ sizeof(argpframe) + /* current signal */ sizeof(retgframe); /* for binary compatibility */ - if (sip != NULL) { - bzero((caddr_t)&si, sizeof(si)); - bcopy((caddr_t)sip, (caddr_t)&si, sizeof(k_siginfo_t)); - minstacksz += sizeof(siginfo_t); + bzero((caddr_t)&si, sizeof(si)); + if (p->p_curinfo && sigismember(&p->p_siginfo, sig)) { + bcopy((caddr_t)&p->p_curinfo->sq_info, + (caddr_t)&si, sizeof(k_siginfo_t)); + stacksz += sizeof(siginfo_t); } newstack = (sigismember(&u.u_sigonstack, sig) - && !(u.u_sigaltstack.ss_flags & (SS_ONSTACK|SS_DISABLE))); + && !(u.u_altflags & (SS_ONSTACK|SS_DISABLE))); if (newstack != 0) { - if (minstacksz >= u.u_sigaltstack.ss_size) + if (stacksz >= u.u_altsize) return 0; - sp = (int *)(_VOID *)u.u_sigaltstack.ss_sp; + sp = (int *)u.u_altsp; } else { register int *sub; - sub = u.u_pcb.sp + minstacksz / NBPW; + sub = u.u_pcb.sp + stacksz / NBPW; if (sub >= u.u_pcb.sub && !grow(sub)) return 0; sp = u.u_pcb.sp; } - if (sip != NULL) { + if (p->p_curinfo && sigismember(&p->p_siginfo, sig)) { if (copyout((caddr_t)&si, (caddr_t)sp, sizeof(siginfo_t)) < 0) return 0; argpframe.sip = (siginfo_t *)sp; @@ -711,12 +711,11 @@ sendsig(sig, sip, hdlr) u.u_pcb.psw.OE = ill_psw.OE; if (newstack) { - u.u_sigaltstack.ss_flags |= SS_ONSTACK; - u.u_pcb.slb = (int *)(_VOID *)u.u_sigaltstack.ss_sp; - u.u_pcb.sub = (int *)(_VOID *)(u.u_sigaltstack.ss_sp - + u.u_sigaltstack.ss_size); - u.u_procp->p_stkbase = u.u_sigaltstack.ss_sp; - u.u_procp->p_stksize = u.u_sigaltstack.ss_size; + u.u_altflags |= SS_ONSTACK; + u.u_pcb.slb = (int *)u.u_altsp; + u.u_pcb.sub = u.u_altsp + u.u_altsize; + u.u_procp->p_stkbase = u.u_altsp; + u.u_procp->p_stksize = howmany(u.u_altsize, sizeof(int *)); } return 1; @@ -728,14 +727,13 @@ sendsig(sig, sip, hdlr) * so that it may be restored in ttrap.s. */ int * -retsig(ucp, pc) +retsig(ucp) register ucontext_t *ucp; - register unsigned int pc; { u.u_oldcontext = ucp->uc_link; u.u_ipcb.sp = (int *)ucp; - u.u_ipcb.pc = (void(*)())pc; + u.u_ipcb.pc = (void(*)())ucp->uc_mcontext.gregs[R_PC]; u.u_ipcb.psw = *(psw_t *)&(ucp->uc_mcontext.gregs[R_PS]); fixuserpsw(&u.u_ipcb.psw); diff --git a/usr/src/uts/3b2/os/main.c b/usr/src/uts/3b2/os/main.c index aa40bed..ae16685 100644 --- a/usr/src/uts/3b2/os/main.c +++ b/usr/src/uts/3b2/os/main.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/main.c 1.31" +#ident "@(#)kernel:os/main.c 1.28" #include "sys/types.h" #include "sys/param.h" #include "sys/psw.h" @@ -33,18 +33,11 @@ #include "sys/var.h" #include "sys/debug.h" #include "sys/conf.h" -#include "sys/utsname.h" #include "sys/cmn_err.h" #include "vm/as.h" #include "vm/seg_vn.h" -/* well known processes */ -proc_t *proc_sched; /* memory scheduler */ -proc_t *proc_init; /* init */ -proc_t *proc_pageout; /* pageout daemon */ -proc_t *proc_bdflush; /* buffer cache flush daemon */ - int physmem; /* Physical memory size in clicks. */ int maxmem; /* Maximum available memory in clicks. */ int freemem; /* Current available memory in clicks. */ @@ -79,7 +72,6 @@ main() int error = 0; startup(); - inituname(); clkstart(); cred_init(); dnlc_init(); @@ -108,10 +100,6 @@ main() u.u_error = 0; /* XXX kludge for SCSI driver */ vfs_mountroot(); /* Mount the root file system */ - - cmn_err(CE_CONT, "\nUNIX(R) System V Release %s AT&T %s Version %s\n", - utsname.release, utsname.machine, utsname.version); - cmn_err(CE_CONT, "Total real memory = %d\n", ctob(physmem)); cmn_err(CE_CONT, "Available memory = %d\n\n", ctob(freemem)); @@ -127,6 +115,12 @@ main() u.u_start = hrestime.tv_sec; + /* + * This call to inituname must come after + * root has been mounted. + */ + inituname(); + /* * This call to swapconf must come after * root has been mounted. @@ -147,7 +141,6 @@ main() if (newproc(NP_INIT, NULL, &error)) { register proc_t *p = u.u_procp; - proc_init = p; p->p_cstime = p->p_stime = p->p_cutime = p->p_utime = 0; @@ -181,11 +174,9 @@ main() u.u_pcb.sub = (int *)((uint)userstack + ctob(SSIZE)); return UVTEXT; } - if (newproc(NP_SYSPROC, NULL, &error)) { - register proc_t *p = u.u_procp; - proc_pageout = p; - p->p_cstime = p->p_stime = p->p_cutime = p->p_utime = 0; + u.u_procp->p_cstime = u.u_procp->p_stime = 0; + u.u_procp->p_cutime = u.u_procp->p_utime = 0; bcopy("pageout", u.u_psargs, 8); bcopy("pageout", u.u_comm, 7); pageout(); @@ -193,9 +184,8 @@ main() } if (newproc(NP_SYSPROC, NULL, &error)) { - register proc_t *p = u.u_procp; - proc_bdflush = p; - p->p_cstime = p->p_stime = p->p_cutime = p->p_utime = 0; + u.u_procp->p_cstime = u.u_procp->p_stime = 0; + u.u_procp->p_cutime = u.u_procp->p_utime = 0; bcopy("fsflush", u.u_psargs, 8); bcopy("fsflush", u.u_comm, 7); fsflush(); @@ -220,8 +210,6 @@ main() cmn_err(CE_PANIC, "main: return from kmem_freepool()"); } - pid_setmin(); - bcopy("sched", u.u_psargs, 6); bcopy("sched", u.u_comm, 5); return (int)sched; diff --git a/usr/src/uts/3b2/os/malloc.c b/usr/src/uts/3b2/os/malloc.c index b60c2f8..d482b87 100644 --- a/usr/src/uts/3b2/os/malloc.c +++ b/usr/src/uts/3b2/os/malloc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/malloc.c 1.12" +#ident "@(#)kernel:os/malloc.c 1.10" #include "sys/param.h" #include "sys/types.h" #include "sys/systm.h" @@ -30,13 +30,10 @@ * (also see mfree/rmfree below) */ -unsigned long -malloc(mp, size) -register struct map *mp; -register size_t size; -{ - return(rmalloc(mp, size)); -} +asm(" .text"); /* ensure symbol refers to text section */ +asm(" .align 4"); /* functions aligned on word boundaries */ +asm(" .globl malloc"); /* make symbol tab storage class extern */ +asm("malloc: "); /* define label. will be same as rmalloc */ unsigned long rmalloc(mp, size) @@ -75,14 +72,10 @@ register size_t size; * */ -void -mfree(mp, size, a) -register struct map *mp; -register size_t size; -register unsigned long a; -{ - rmfree(mp, size, a); -} +asm(" .text"); +asm(" .align 4"); +asm(" .globl mfree"); +asm("mfree: "); void rmfree(mp, size, a) @@ -143,7 +136,7 @@ register unsigned long a; } if (mapwant(mp)) { mapwant(mp) = 0; - wakeprocs((caddr_t)mp, PRMPT); + wakeup((caddr_t)mp); } } diff --git a/usr/src/uts/3b2/os/mapin.c b/usr/src/uts/3b2/os/mapin.c new file mode 100644 index 0000000..d6fa58b --- /dev/null +++ b/usr/src/uts/3b2/os/mapin.c @@ -0,0 +1,153 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:os/mapin.c 1.2" +#include "sys/types.h" +#include "sys/param.h" +#include "sys/systm.h" +#include "sys/sysmacros.h" +#include "sys/map.h" +#include "sys/immu.h" +#include "sys/mman.h" +#include "sys/proc.h" +#include "sys/buf.h" +#include "sys/debug.h" +#include "sys/cmn_err.h" + +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/hat.h" +#include "vm/anon.h" +#include "vm/page.h" +#include "vm/seg_kmem.h" + +STATIC long mapin_count = 0; + +#ifdef __STDC__ +STATIC void bp_map(struct buf *, caddr_t); +#else +STATIC void bp_map(); +#endif + +/* + * Map the data referred to by the buffer bp into the kernel + * at kernel virtual address kaddr. Used to map in data for + * DVMA, among other things. + */ + +STATIC void +bp_map(bp, addr) + register struct buf *bp; + caddr_t addr; +{ + register struct page *pp; + register int npf; + register pte_t *ppte; + register sde_t *sdeptr; + + npf = btoc(bp->b_bcount + ((int)bp->b_un.b_addr & PAGEOFFSET)); + + if (bp->b_flags & B_PAGEIO) { + pp = bp->b_pages; + ASSERT(pp != NULL); + while (npf--) { + flushaddr(addr); + sdeptr = (sde_t *)kvtokstbl(addr); + ppte = (pte_t *)vatopte(addr, sdeptr); + ppte->pg_pte = (u_int)mkpte(PG_V, page_pptonum(pp)); + pp = pp->p_next; + addr += PAGESIZE; + } + } else + cmn_err(CE_PANIC, "bp_map - non B_PAGEIO\n"); +} + +/* + * Called to convert bp for pageio/physio to a kernel addressable location. + * We allocate virtual space from the kernelmap and then use bp_map to do + * most of the real work. + */ + +void +bp_mapin(bp) + register struct buf *bp; +{ + int npf, o; + caddr_t addr; + + mapin_count++; + + if ((bp->b_flags & (B_PAGEIO | B_PHYS)) == 0 || + (bp->b_flags & B_REMAPPED) != 0) + return; /* no pageio/physio or already mapped in */ + + if ((bp->b_flags & (B_PAGEIO | B_PHYS)) == (B_PAGEIO | B_PHYS)) + cmn_err(CE_PANIC, "bp_mapin"); + + o = (int)bp->b_un.b_addr & PAGEOFFSET; + npf = btoc(bp->b_bcount + o); + + /* + * Allocate kernel virtual space for remapping. + */ + + while ((addr = (caddr_t)malloc(sptmap, npf)) == 0) { + mapwant(sptmap)++; + (void) sleep((caddr_t)sptmap, PSWP); + } + addr = (caddr_t)((u_long)addr << PAGESHIFT); + + /* map the bp into the virtual space we just allocated */ + bp_map(bp, addr); + + bp->b_flags |= B_REMAPPED; + bp->b_un.b_addr = addr + o; +} + +/* + * bp_mapout will release all the resources associated with a bp_mapin call. + * We call hat_unload to release the work done by bp_map which will insure + * that the reference and modified bits from this mapping are not OR'ed in. + */ + +void +bp_mapout(bp) + register struct buf *bp; +{ + register int npf, saved_npf; + register pte_t *ppte; + register sde_t *sdeptr; + register struct page *pp; + caddr_t addr; + u_long saved_addr; + + mapin_count--; + + if (bp->b_flags & B_REMAPPED) { + pp = bp->b_pages; + npf = btoc(bp->b_bcount + ((int)bp->b_un.b_addr & PAGEOFFSET)); + saved_npf = npf; + saved_addr = ((u_long)bp->b_un.b_addr & PAGEMASK); + addr = (caddr_t)saved_addr; + while (npf--) { + ASSERT(pp != NULL); + sdeptr = (sde_t *)kvtokstbl(addr); + ppte = (pte_t *)vatopte(addr, sdeptr); + /* don't want to propagate from this pte to the page struct */ + /* pp->p_ref |= ppte->pgm.pg_ref; */ + /* pp->p_mod |= ppte->pgm.pg_mod; */ + ppte->pg_pte = 0; + flushaddr(addr); + addr += PAGESIZE; + pp = pp->p_next; + } + saved_addr = (saved_addr >> PAGESHIFT); + rmfree(sptmap, saved_npf, saved_addr); + bp->b_un.b_addr = (caddr_t)((int)bp->b_un.b_addr & PAGEOFFSET); + bp->b_flags &= ~B_REMAPPED; + } +} diff --git a/usr/src/uts/3b2/os/move.c b/usr/src/uts/3b2/os/move.c index 9a1bb0e..20c4600 100644 --- a/usr/src/uts/3b2/os/move.c +++ b/usr/src/uts/3b2/os/move.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/move.c 1.12" +#ident "@(#)kernel:os/move.c 1.9.1.2" #include "sys/types.h" #include "sys/sysmacros.h" @@ -240,60 +240,6 @@ uioskip(uiop, n) } } -/* - * Move MIN(ruio->uio_resid, wuio->uio_resid) bytes from addresses described - * by ruio to those described by wuio. Both uio structures are updated to - * reflect the move. Returns 0 on success or a non-zero errno on failure. - */ -int -uiomvuio(ruio, wuio) - register uio_t *ruio; - register uio_t *wuio; -{ - register iovec_t *riov; - register iovec_t *wiov; - register long n; - uint cnt; - int kerncp; - - n = MIN(ruio->uio_resid, wuio->uio_resid); - kerncp = ruio->uio_segflg == UIO_SYSSPACE && - wuio->uio_segflg == UIO_SYSSPACE; - - riov = ruio->uio_iov; - wiov = wuio->uio_iov; - while (n) { - while (!wiov->iov_len) { - wiov = ++wuio->uio_iov; - wuio->uio_iovcnt--; - } - while (!riov->iov_len) { - riov = ++ruio->uio_iov; - ruio->uio_iovcnt--; - } - cnt = MIN(wiov->iov_len, MIN(riov->iov_len, n)); - - if (kerncp) - bcopy(riov->iov_base, wiov->iov_base, cnt); - else if (ruio->uio_segflg == UIO_SYSSPACE) { - if (copyout(riov->iov_base, wiov->iov_base, cnt)) - return EFAULT; - } else if (copyin(riov->iov_base, wiov->iov_base, cnt)) - return EFAULT; - - riov->iov_base += cnt; - riov->iov_len -= cnt; - ruio->uio_resid -= cnt; - ruio->uio_offset += cnt; - wiov->iov_base += cnt; - wiov->iov_len -= cnt; - wuio->uio_resid -= cnt; - wuio->uio_offset += cnt; - n -= cnt; - } - return 0; -} - /* * Overlapping bcopy (source and target may overlap arbitrarily). */ diff --git a/usr/src/uts/3b2/os/msg.c b/usr/src/uts/3b2/os/msg.c index fffa145..f34a91b 100644 --- a/usr/src/uts/3b2/os/msg.c +++ b/usr/src/uts/3b2/os/msg.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/msg.c 1.15" +#ident "@(#)kernel:os/msg.c 1.13" /* * Inter-Process Communication Message Facility. */ @@ -108,7 +108,7 @@ msgfree(qp, pmp, mp) qp->msg_qnum--; if (qp->msg_perm.mode & MSG_WWAIT) { qp->msg_perm.mode &= ~MSG_WWAIT; - wakeprocs((caddr_t)qp, PRMPT); + wakeup((caddr_t)qp); } /* Free up message text. */ @@ -118,7 +118,7 @@ msgfree(qp, pmp, mp) /* Free up header */ mp->msg_next = msgfp; if (msgfp == NULL) - wakeprocs((caddr_t)&msgfp, PRMPT); + wakeup((caddr_t)&msgfp); msgfp = mp; } @@ -144,7 +144,7 @@ msgconv(id, qpp) if ((qp->msg_perm.mode & IPC_ALLOC) == 0 || id / msginfo.msgmni != qp->msg_perm.seq) { *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return EINVAL; } *qpp = qp; @@ -192,9 +192,9 @@ msgctl(uap, rvp) else qp->msg_perm.seq++; if (qp->msg_perm.mode & MSG_RWAIT) - wakeprocs((caddr_t)&qp->msg_qnum, PRMPT); + wakeup((caddr_t)&qp->msg_qnum); if (qp->msg_perm.mode & MSG_WWAIT) - wakeprocs((caddr_t)qp, PRMPT); + wakeup((caddr_t)qp); qp->msg_perm.mode = 0; break; @@ -213,10 +213,6 @@ msgctl(uap, rvp) error = EPERM; break; } - if (ods.msg_perm.uid > MAXUID || ods.msg_perm.gid > MAXUID){ - error = EINVAL; - break; - } qp->msg_perm.uid = ods.msg_perm.uid; qp->msg_perm.gid = ods.msg_perm.gid; qp->msg_perm.mode = @@ -240,11 +236,6 @@ msgctl(uap, rvp) error = EPERM; break; } - if (ds.msg_perm.uid < (uid_t)0 || ds.msg_perm.uid > MAXUID || - ds.msg_perm.gid < (gid_t)0 || ds.msg_perm.gid > MAXUID){ - error = EINVAL; - break; - } qp->msg_perm.uid = ds.msg_perm.uid; qp->msg_perm.gid = ds.msg_perm.gid; qp->msg_perm.mode = @@ -311,7 +302,7 @@ msgctl(uap, rvp) } *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return error; } @@ -409,14 +400,14 @@ msgrcv(uap, rvp) } smp = spmp = NULL; *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); findmsg: if (msgconv(uap->msqid, &qp1) != 0) return EIDRM; if (qp1 != qp) { lockp = MSGLOCK(qp1); *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return EIDRM; } pmp = NULL; @@ -472,7 +463,7 @@ msgrcv(uap, rvp) } qp->msg_perm.mode |= MSG_RWAIT; *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); if (sleep((caddr_t)&qp->msg_qnum, PMSG|PCATCH)) return EINTR; goto findmsg; @@ -480,7 +471,7 @@ msgrcv(uap, rvp) msgrcv_out: *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return error; } @@ -520,7 +511,7 @@ msgsnd(uap, rvp) goto msgsnd_out; } *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); getres: /* Be sure that q has not been removed. */ @@ -529,7 +520,7 @@ msgsnd(uap, rvp) if (qp1 != qp) { lockp = MSGLOCK(qp1); *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return EIDRM; } @@ -541,7 +532,7 @@ msgsnd(uap, rvp) } qp->msg_perm.mode |= MSG_WWAIT; *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); if (sleep((caddr_t)qp, PMSG|PCATCH)) { if (error = msgconv(uap->msqid, &qp1)) return error; @@ -549,11 +540,11 @@ msgsnd(uap, rvp) if (qp1 != qp) { lockp = MSGLOCK(qp1); *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return error; } qp->msg_perm.mode &= ~MSG_WWAIT; - wakeprocs((caddr_t)qp, PRMPT); + wakeup((caddr_t)qp); goto msgsnd_out; } goto getres; @@ -564,7 +555,7 @@ msgsnd(uap, rvp) goto msgsnd_out; } *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); if (sleep((caddr_t)&msgfp, PMSG|PCATCH)) { if (error = msgconv(uap->msqid, &qp1)) return error; @@ -572,7 +563,7 @@ msgsnd(uap, rvp) if (qp1 != qp) { lockp = MSGLOCK(qp1); *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return error; } goto msgsnd_out; @@ -589,10 +580,10 @@ msgsnd(uap, rvp) mapwant(msgmap)++; mp->msg_next = msgfp; if (msgfp == NULL) - wakeprocs((caddr_t)&msgfp, PRMPT); + wakeup((caddr_t)&msgfp); msgfp = mp; *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); if (sleep((caddr_t)msgmap, PMSG|PCATCH)) { if (error = msgconv(uap->msqid, &qp1)) return error; @@ -600,7 +591,7 @@ msgsnd(uap, rvp) if (qp1 != qp) { lockp = MSGLOCK(qp1); *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return error; } goto msgsnd_out; @@ -632,7 +623,7 @@ msgsnd(uap, rvp) } if (qp->msg_perm.mode & MSG_RWAIT) { qp->msg_perm.mode &= ~MSG_RWAIT; - wakeprocs((caddr_t)&qp->msg_qnum, PRMPT); + wakeup((caddr_t)&qp->msg_qnum); } rvp->r_val1 = 0; @@ -642,13 +633,13 @@ msgsnd(uap, rvp) mp->msg_next = msgfp; if (msgfp == NULL) - wakeprocs((caddr_t)&msgfp, PRMPT); + wakeup((caddr_t)&msgfp); msgfp = mp; msgsnd_out: *lockp = 0; - wakeprocs(lockp, PRMPT); + wakeup(lockp); return error; } diff --git a/usr/src/uts/3b2/os/os.mk b/usr/src/uts/3b2/os/os.mk index a0f1d97..b527b3a 100644 --- a/usr/src/uts/3b2/os/os.mk +++ b/usr/src/uts/3b2/os/os.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)kernel:os/os.mk 1.62" +#ident "@(#)kernel:os/os.mk 1.59.1.9" ROOT = STRIP = strip @@ -23,7 +23,6 @@ FILES = \ $(LIBNAME)(bio.o) \ $(LIBNAME)(bitmap.o) \ $(LIBNAME)(bitmasks.o) \ - $(LIBNAME)(predki.o) \ $(LIBNAME)(clock.o) \ $(LIBNAME)(cmn_err.o) \ $(LIBNAME)(core.o) \ @@ -46,7 +45,6 @@ FILES = \ $(LIBNAME)(malloc.o) \ $(LIBNAME)(move.o) \ $(LIBNAME)(pgrp.o) \ - $(LIBNAME)(pid.o) \ $(LIBNAME)(pipe.o) \ $(LIBNAME)(procset.o) \ $(LIBNAME)(scalls.o) \ @@ -367,26 +365,6 @@ $(LIBNAME)(bitmap.o): bitmap.c \ $(LIBNAME)(bitmasks.o): bitmasks.c \ $(FRC) -$(LIBNAME)(predki.o): predki.c \ - $(INC)/sys/types.h \ - $(INC)/sys/param.h \ - $(INC)/sys/sbd.h \ - $(INC)/sys/conf.h \ - $(INC)/sys/systm.h \ - $(INC)/sys/errno.h \ - $(INC)/sys/debug.h \ - $(INC)/sys/user.h \ - $(INC)/sys/buf.h \ - $(INC)/sys/iobuf.h \ - $(INC)/sys/var.h \ - $(INC)/sys/vnode.h \ - $(INC)/sys/cmn_err.h \ - $(INC)/vm/page.h \ - $(INC)/sys/cred.h \ - $(INC)/sys/uio.h \ - $(INC)/sys/ddi.h \ - $(FRC) - $(LIBNAME)(clock.o): clock.c \ $(INC)/sys/param.h \ $(INC)/sys/types.h \ @@ -473,7 +451,6 @@ $(LIBNAME)(core.o): core.c \ $(INC)/sys/uio.h \ $(INC)/sys/exec.h \ $(INC)/sys/mman.h \ - $(INC)/sys/file.h \ $(INC)/vm/as.h \ $(FRC) @@ -991,28 +968,6 @@ $(LIBNAME)(pgrp.o): pgrp.c \ $(INC)/sys/strsubr.h \ $(FRC) -$(LIBNAME)(pid.o): pid.c \ - $(INC)/sys/file.h \ - $(INC)/sys/vfs.h \ - $(INC)/sys/vnode.h \ - $(INC)/sys/types.h \ - $(INC)/sys/param.h \ - $(INC)/sys/sysmacros.h \ - $(INC)/sys/session.h \ - $(INC)/sys/debug.h \ - $(INC)/sys/proc.h \ - $(INC)/sys/kmem.h \ - $(INC)/sys/tuneable.h \ - $(INC)/sys/inline.h \ - $(INC)/sys/var.h \ - $(INC)/sys/debug.h \ - $(INC)/sys/cmn_err.h \ - $(INC)/sys/cred.h \ - $(INC)/sys/user.h \ - $(INC)/sys/systm.h \ - $(INC)/sys/sysinfo.h \ - $(FRC) - $(LIBNAME)(pipe.o): pipe.c \ $(INC)/sys/types.h \ $(INC)/sys/sysmacros.h \ @@ -1113,7 +1068,6 @@ $(LIBNAME)(scalls.o): scalls.c \ $(INC)/sys/hrtcntl.h \ $(INC)/sys/disp.h \ $(INC)/sys/systeminfo.h \ - $(INC)/sys/unistd.h \ $(INC)/vm/hat.h \ $(INC)/vm/as.h \ $(INC)/vm/seg.h \ @@ -1294,7 +1248,6 @@ $(LIBNAME)(startup.o): startup.c \ $(INC)/vm/seg_u.h \ $(INC)/vm/seg_map.h \ $(INC)/vm/page.h \ - $(INC)/vm/bootconf.h \ $(FRC) $(LIBNAME)(streamio.o): streamio.c \ diff --git a/usr/src/uts/3b2/os/pgrp.c b/usr/src/uts/3b2/os/pgrp.c index b77f052..3491a9d 100644 --- a/usr/src/uts/3b2/os/pgrp.c +++ b/usr/src/uts/3b2/os/pgrp.c @@ -5,15 +5,15 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/pgrp.c 1.24" +#ident "@(#)kernel:os/pgrp.c 1.22" #include "sys/types.h" #include "sys/sysmacros.h" #include "sys/param.h" #include "sys/systm.h" -#include "sys/file.h" #include "sys/cred.h" #include "sys/vnode.h" +#include "sys/file.h" #include "sys/fstyp.h" #include "sys/errno.h" #include "sys/sbd.h" @@ -37,187 +37,292 @@ #include "sys/stream.h" #include "sys/strsubr.h" +#define NHSQUE 64 +#define hashpg(X) (&pgque[(X) & (NHSQUE-1)]) + +STATIC proc_t *pgque[NHSQUE]; + /* * Return 1 if process pointed to by 'cp' has a parent that would - * prevent its process group from being orphaned, 0 otherwise + * prevent its process group from being orphaned. */ STATIC int -pglinked(cp) +linkedpg(cp) register proc_t *cp; { register proc_t *pp = cp->p_parent; - if (pp->p_pgidp != cp->p_pgidp && pp->p_sessp == cp->p_sessp) + if (pp->p_pgrp != cp->p_pgrp && pp->p_sessp == cp->p_sessp) return 1; return 0; } /* - * Send the specified signal to all processes whose process group ID is - * equal to 'pgid' + * Send the specified signal to all processes with 'pgid' as + * process group ID. */ void -pgsignal(pidp, sig) - register struct pid *pidp; +signal(pgid, sig) + register pid_t pgid; int sig; { - register proc_t *prp; + register proc_t *p; - for (prp = pidp->pid_pglink; prp; prp = prp->p_pglink) - psignal(prp, sig); + if (pgid == 0) + return; + + for (p = *hashpg(pgid); p; p = p->p_pglink) + if (p->p_pgrp == pgid) + psignal(p, sig); } /* - * Add a process to a process group + * For each child of process 'pp', detach that child's process group if + * the process group will become orphaned without 'pp'. + * + * If the process group is already detached, or if 'dp' would not prevent + * the process group from being orphaned, return immediately. + * + * Otherwise, search for another member of the process group that will + * prevent the group from being orphaned. If one is found, return. + * + * Otherwise, mark all member of the group detached. If any members + * of the group were stopped, continue and hangup the whole group. + * (The continue is necessary to keep an orphaned process group + * from lingering. The hangup is necessary, since we are resuming + * stopped jobs without the user's knowledge) */ void -pgjoin(p, pgp) - register proc_t *p; - register struct pid *pgp; +detachcld(pp) + register proc_t *pp; { + int stopped; + int linked; + register struct proc *cp; + register struct proc *mp; + register pid_t pgid; + + for (cp = pp->p_child; cp; cp = cp->p_sibling) { + if (cp->p_flag & SDETACHED) + continue; + pgid = cp->p_pgrp; + stopped = 0; + linked = 0; + for (mp = *hashpg(pgid); mp; mp = mp->p_pglink) { + if (mp->p_pgrp != pgid) + continue; + if (mp->p_parent != pp && linkedpg(mp)) { + linked++; + break; + } + if ((mp->p_stat == SSTOP + && mp->p_whystop == PR_JOBCONTROL) + || sigintset(&mp->p_sig, &stopdefault)) + stopped++; + } + if (linked) + continue; + for (mp = *hashpg(pgid); mp; mp = mp->p_pglink) { + if (mp->p_pgrp != pgid) + continue; + mp->p_flag |= SDETACHED; + if (stopped) { + psignal(mp, SIGHUP); + psignal(mp, SIGCONT); + } + } + } +} - ASSERT(pgp->pid_pglink != NULL); - ASSERT(p->p_pgidp == NULL); - ASSERT(p->p_pglink == NULL); +/* + * Add a process to a process group + */ +void +joinpg(p, pgid) + register proc_t *p; + pid_t pgid; +{ + register proc_t **pp; - if (pgp->pid_pgorphaned && pglinked(p)) - pgp->pid_pgorphaned = 0; + if (pgid == 0) + return; - p->p_pgidp = pgp; - if (pgp->pid_id <= SHRT_MAX) - p->p_opgrp = (o_pid_t)pgp->pid_id; + pp = hashpg(pgid); + p->p_pglink = *pp; + *pp = p; + p->p_pgrp = pgid; + if (pgid <= SHRT_MAX) + p->p_opgrp = (o_pid_t)pgid; else - p->p_opgrp = (o_pid_t)NOPID; - p->p_pglink = pgp->pid_pglink; - pgp->pid_pglink = p; + p->p_opgrp = (o_pid_t)NOPID; } void -pgcreate(p) +attachpg(p) register proc_t *p; { - register proc_t *prp; - register struct pid *pgp; - - ASSERT(p->p_pidp != NULL); - ASSERT(p->p_pgidp == NULL); - ASSERT(p->p_pglink == NULL); + register proc_t *q; + register pid_t pgid; - pgp = p->p_pidp; + pgid = p->p_pgrp; - PID_HOLD(pgp); + /* creating new process group */ + if (p->p_pid == pgid) { + for (q = p->p_parent; q->p_pgrp == pgid; q = q->p_parent) + continue; + if (q->p_sessp == p->p_sessp) + p->p_flag &= ~SDETACHED; + else + p->p_flag |= SDETACHED; + return; + } + + /* joining existing process group, find a member */ + for (q = *hashpg(pgid); q == p || q->p_pgrp != pgid; q = q->p_pglink) + continue; - pgp->pid_pglink = p; - p->p_pgidp = pgp; - if (pgp->pid_id <= SHRT_MAX) - p->p_opgrp = (o_pid_t)pgp->pid_id; - else - p->p_opgrp = (o_pid_t)NOPID; + /* if group is not detached, then neither is the newest member */ + if (!(q->p_flag & SDETACHED)) + p->p_flag &= ~SDETACHED; - for (prp = p->p_parent; prp->p_pgidp == pgp; prp = prp->p_parent) { - ASSERT(prp != NULL); - continue; - } + /* this process may be attaching the group */ + else if (linkedpg(p)) + do { + q->p_flag &= ~SDETACHED; + do q = q->p_pglink; + while (q && q->p_pgrp != pgid); + } while (q); - if (prp->p_sessp == p->p_sessp) - pgp->pid_pgorphaned = 0; - else - pgp->pid_pgorphaned = 1; + else + p->p_flag |= SDETACHED; } +/* + * Remove a process from a process group + * If it is the last member of the process group, it's parent (which + * may be waiting for a member of this process group to change + * state) is awaken. + * If it is the last member of a controlling terminal's foreground + * process group, the controlling process's process group is made + * foreground process group + * If it is not the last member of the process group, and this process + * will cause the process group to be orphaned, detach the process group + */ + void -pgexit(prp) - proc_t *prp; +leavepg(p) + proc_t *p; { - register proc_t *p; - register proc_t **pp; - register struct pid *pgp; - - pgp = prp->p_pgidp; - - for (pp = &pgp->pid_pglink; ; pp = &(*pp)->p_pglink) { - ASSERT(*pp != NULL); - if (*pp == prp) { - *pp = prp->p_pglink; - break; + register proc_t **pp, *t; + int members, attached; + pid_t pgid; + + if ((pgid = p->p_pgrp) == 0) + return; + + for (members = 0, attached = 0, pp = hashpg(pgid); *pp; ) { + t = *pp; + if (t == p) { + *pp = p->p_pglink; + p->p_pglink = NULL; + } else { + if (t->p_pgrp == pgid) { + members++; + if (linkedpg(t)) + attached++; + } + pp = &t->p_pglink; } } - prp->p_pgidp = NULL; - prp->p_pglink = NULL; - prp->p_opgrp = 0; - - if ((p = pgp->pid_pglink) == NULL) - PID_RELE(pgp); - else if (pgp->pid_pgorphaned == 0) { - do { - if (pglinked(p)) - return; - } while ((p = p->p_pglink) != NULL); - pgp->pid_pgorphaned = 1; + if (members == 0) { + register sess_t *sp = p->p_sessp; + + strclearpg(pgid); + if (sp->s_vp && *sp->s_fgidp == pgid) + *sp->s_fgidp = 0; + wakeup((caddr_t)p->p_parent); + } else if (attached == 0 && !(p->p_flag & SDETACHED)) { + for (t = *hashpg(pgid); t; t = t->p_pglink) { + if (t->p_pgrp != pgid) + continue; + t->p_flag |= SDETACHED; + } } + p->p_pgrp = 0; + p->p_opgrp = 0; } /* - * process 'pp' is exiting or execing - check to see if this will - * orphan its children's process groups + * Return 1 if pgid is the process group ID of an existing process group + * whose session ID is equal to sid. + * + * Otherwise, return 0 */ -void -pgdetach(pp) - proc_t *pp; +int +checkpg(sid, pgid) + register pid_t sid; + register pid_t pgid; { - int stopped; - register proc_t *cp; - register proc_t *mp; - register struct pid *pgp; + register proc_t *pp; - for (cp = pp->p_child; cp; cp = cp->p_sibling) { - if ((pgp = cp->p_pgidp)->pid_pgorphaned) - continue; - stopped = 0; - mp = pgp->pid_pglink; - ASSERT(mp != NULL); - for (;;) { - if (mp != pp && mp->p_parent != pp && pglinked(mp)) - break; - if (mp->p_stat == SSTOP - && mp->p_whystop == PR_JOBCONTROL) - stopped++; - if ((mp = mp->p_pglink) == NULL) { - pgp->pid_pgorphaned = 1; - if (stopped) { - pgsignal(pgp, SIGHUP); - pgsignal(pgp, SIGCONT); - } - break; - } + for (pp = *hashpg(pgid); pp; pp = pp->p_pglink) { + if (pp->p_pgrp == pgid) { + if (pp->p_sessp->s_sid == sid) + return 1; + break; } } + + return 0; } /* * Return 1 if pgid is the process group ID of an existing process group - * that has members not the process group leader in it. + * that has members not the process group leader in it. * * Otherwise, return 0. */ - int -pgmembers(pgid) +memberspg(pgid) register pid_t pgid; { - register proc_t *prp; + register proc_t *p; - for (prp = pgfind(pgid); prp; prp = prp->p_pglink) - if (prp->p_pid != pgid) - return 1; + for (p = *hashpg(pgid); p; p = p->p_pglink) { + if (p->p_pgrp != pgid) + continue; + if (p->p_pgrp == p->p_pid) + continue; + return 1; + } return 0; } +int +detachedpg(pgid) + register pid_t pgid; +{ + register proc_t *p; + + if (pgid == 0) + return 1; + + for (p = *hashpg(pgid); p; p = p->p_pglink) { + if (p->p_pgrp == pgid) { + if (p->p_flag & SDETACHED) + return 1; + else + return 0; + } + } + + return 1; +} diff --git a/usr/src/uts/3b2/os/pipe.c b/usr/src/uts/3b2/os/pipe.c index 928803e..0199b03 100644 --- a/usr/src/uts/3b2/os/pipe.c +++ b/usr/src/uts/3b2/os/pipe.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/pipe.c 1.11" +#ident "@(#)kernel:os/pipe.c 1.10" #include "sys/types.h" #include "sys/sysmacros.h" #include "sys/param.h" @@ -45,11 +45,9 @@ pipe(uap, rvp) extern int strclose(); extern struct vnode *makepipe(); struct vnode *vp1, *vp2; - extern ushort fifogetid(); struct file *fp1, *fp2; register int error = 0; int fd1, fd2; - static ushort pipeino = 1; /* * Allocate and initialize two vnodes. @@ -95,9 +93,6 @@ pipe(uap, rvp) */ VTOF(vp1)->fn_mate = vp2; VTOF(vp2)->fn_mate = vp1; - pipeino = fifogetid(pipeino); - VTOF(vp1)->fn_ino = VTOF(vp2)->fn_ino = pipeino; - /* * Return the file descriptors to the user. They now * point to two different vnodes which have different diff --git a/usr/src/uts/3b2/os/procset.c b/usr/src/uts/3b2/os/procset.c index 251c53e..a611827 100644 --- a/usr/src/uts/3b2/os/procset.c +++ b/usr/src/uts/3b2/os/procset.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/procset.c 1.25" +#ident "@(#)kernel:os/procset.c 1.23" #include "sys/types.h" #include "sys/sysmacros.h" @@ -66,7 +66,7 @@ dotoprocs(psp, funcp, arg) int (*funcp)(); char *arg; { - register proc_t *prp; /* A process from the set */ + register proc_t **prp; /* A process from the set */ register int error; register int nfound; /* Nbr of processes found. */ register proc_t *lastprp; /* Last proc found. */ @@ -97,31 +97,31 @@ dotoprocs(psp, funcp, arg) nfound = 0; error = 0; - for (prp = practive; prp != NULL; prp = prp->p_next) { - if (prp->p_stat == SIDL || prp->p_stat == SZOMB) + for (prp = &nproc[0]; prp < v.ve_proc; prp++) { + if (*prp == NULL || (*prp)->p_stat == SZOMB) continue; - if(procinset(prp, psp)){ + if(procinset(*prp, psp)){ nfound++; - lastprp = prp; - if (funcp != NULL && prp != proc_init) { - error = (*funcp)(prp, arg); - if (error == -1) + lastprp = *prp; + if (funcp != NULL && (*prp)->p_pid != P_INITPID) { + error = (*funcp)(*prp, arg); + if (error == -1) { return 0; - else if (error) + } else if (error) { return error; + } } } } - - if (nfound == 0) + if (nfound == 0) { return ESRCH; + } - if (nfound == 1 && lastprp == proc_init && funcp != NULL) + if (nfound == 1 && lastprp->p_pid == P_INITPID && funcp != NULL) { error = (*funcp)(lastprp, arg); - + } if (error == -1) error = 0; - return error; } diff --git a/usr/src/uts/3b2/os/scalls.c b/usr/src/uts/3b2/os/scalls.c index 8df9381..e450516 100644 --- a/usr/src/uts/3b2/os/scalls.c +++ b/usr/src/uts/3b2/os/scalls.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/scalls.c 1.78" +#ident "@(#)kernel:os/scalls.c 1.74.3.1" #include "sys/param.h" #include "sys/types.h" #include "sys/sysmacros.h" @@ -53,7 +53,6 @@ #include "sys/ulimit.h" #include "sys/todc.h" #include "sys/kmem.h" -#include "sys/unistd.h" #include "vm/hat.h" #include "vm/as.h" @@ -92,10 +91,10 @@ stime(uap, rvp) wtodc(); (void)rf_stime(u.u_cred); /* RFS */ return 0; - } else + } else { return EPERM; + } } - struct sysconfiga { int which; }; @@ -110,8 +109,11 @@ sysconfig(uap, rvp) default: return EINVAL; - case _CONFIG_CLK_TCK: - rvp->r_val1 = HZ; /* 3b2 clock frequency per second */ + case _CONFIG_CHOWN_RST: + /* + * 1 if chown(2) is restricted to super-user, 0 otherwise. + */ + rvp->r_val1 = rstchown; break; case _CONFIG_NGROUPS: @@ -136,16 +138,12 @@ sysconfig(uap, rvp) break; case _CONFIG_POSIX_VER: - rvp->r_val1 = _POSIX_VERSION; /* current POSIX version */ + rvp->r_val1 = _POSIX_VERSION; /* defined in param.h */ break; case _CONFIG_PAGESIZE: rvp->r_val1 = PAGESIZE; break; - - case _CONFIG_XOPEN_VER: - rvp->r_val1 = _XOPEN_VERSION; /* current XOPEN version */ - break; } return 0; @@ -157,9 +155,9 @@ struct adjtimea { }; int tickadj = MICROSEC/HZ; /* "standard" clock skew, - * msec per tick */ + * msec per tick */ int tickdelta; /* current clock skew, - * msecs per tick */ + * msecs per tick */ long timedelta; /* unapplied time correction, msecs */ long bigadj = MICROSEC ; /* bigger skew */ int doresettodr; /* reset clock flag */ @@ -221,7 +219,7 @@ setuid(uap, rvp) register uid_t uid; int error = 0; - if ((uid = uap->uid) > MAXUID || uid < (uid_t) 0) + if ((uid = uap->uid) >= MAXUID) return EINVAL; if (u.u_cred->cr_uid && (uid == u.u_cred->cr_ruid || uid == u.u_cred->cr_suid)) { @@ -236,10 +234,11 @@ setuid(uap, rvp) u.u_cred->cr_uid = uid; u.u_cred->cr_ruid = uid; u.u_cred->cr_suid = uid; - if (uid < USHRT_MAX) + if ( uid < USHRT_MAX) u.u_uid = (o_uid_t) uid; else u.u_uid = (o_uid_t) UID_NOBODY; + u.u_procp->p_uid = (o_uid_t) uid; /* XXX */ } else error = EPERM; @@ -271,14 +270,14 @@ setgid(uap, rvp) register gid_t gid; int error = 0; - if ((gid = uap->gid) > MAXUID || gid < (gid_t) 0) + if ((gid = uap->gid) >= MAXUID) return EINVAL; if (u.u_cred->cr_uid && (gid == u.u_cred->cr_rgid || gid == u.u_cred->cr_sgid)) { u.u_cred = crcopy(u.u_cred); u.u_cred->cr_gid = gid; - if (gid < USHRT_MAX) - u.u_gid = (o_gid_t) gid; /* XXX */ + if ( gid < USHRT_MAX) + u.u_gid = (o_gid_t) gid; /* XXX */ else u.u_gid = (o_gid_t) UID_NOBODY; } else if (suser(u.u_cred)) { @@ -286,8 +285,8 @@ setgid(uap, rvp) u.u_cred->cr_gid = gid; u.u_cred->cr_rgid = gid; u.u_cred->cr_sgid = gid; - if (gid < USHRT_MAX) - u.u_gid = (o_gid_t) gid; /* XXX */ + if ( gid < USHRT_MAX) + u.u_gid = (o_gid_t) gid; /* XXX */ else u.u_gid = (o_gid_t) UID_NOBODY; } else @@ -371,7 +370,7 @@ setegid(uap, rvp) u.u_cred = crcopy(u.u_cred); u.u_cred->cr_gid = gid; - if (gid < USHRT_MAX) + if ( gid < USHRT_MAX) u.u_gid = (o_gid_t) gid; /* XXX */ else u.u_gid = (o_gid_t) UID_NOBODY; @@ -426,7 +425,7 @@ setgroups(uap, rvp) } struct getgroupsa { - int gidsetsize; + u_int gidsetsize; gid_t *gidset; }; @@ -436,10 +435,10 @@ getgroups(uap, rvp) rval_t *rvp; { register struct cred *cr = u.u_cred; - register gid_t n = cr->cr_ngroups; + register u_short n = cr->cr_ngroups; if (uap->gidsetsize != 0) { - if ((gid_t)uap->gidsetsize < n) + if (uap->gidsetsize < n) return EINVAL; if (copyout((caddr_t)cr->cr_groups, (caddr_t)uap->gidset, n * sizeof(gid_t))) @@ -467,28 +466,26 @@ setpgrp(uap, rvp) switch (uap->flag) { case 1: /* setpgrp() */ - if (p->p_sessp->s_sidp != p->p_pidp && !pgmembers(p->p_pid)) - sess_create(); + if (p->p_sessp->s_sid != p->p_pid && !memberspg(p->p_pid)) + newsession(); rvp->r_val1 = p->p_sessp->s_sid; return 0; case 3: /* setsid() */ - if (p->p_pgidp == p->p_pidp || pgmembers(p->p_pid)) + if (p->p_pgrp == p->p_pid || memberspg(p->p_pid)) return EPERM; - sess_create(); + newsession(); rvp->r_val1 = p->p_sessp->s_sid; return 0; case 5: /* setpgid() */ { - register pid_t pgid; - register pid_t pid; - - if ((pid = uap->pid) == 0) - pid = p->p_pid; - else if (pid < 0 || pid >= MAXPID) + register pid_t pgid = uap->pgid; + register pid_t pid = uap->pid; + if (pid < 0 || pgid < 0 + || pid >= MAXPID || pgid >= MAXPID) return EINVAL; - else if (pid != p->p_pid) { + if (pid != p->p_pid && pid != 0) { for (p = p->p_child; ; p = p->p_sibling) { if (p == NULL) return ESRCH; @@ -497,33 +494,19 @@ setpgrp(uap, rvp) } if (p->p_flag & SEXECED) return EACCES; - if (p->p_sessp != u.u_procp->p_sessp) - return EPERM; } - - if (p->p_sessp->s_sid == pid) - return EPERM; - - if ((pgid = uap->pgid) == 0) + if (pgid == 0) pgid = p->p_pid; - else if (pgid < 0 || pgid >= MAXPID) - return EINVAL; - if (p->p_pgrp == pgid) break; - else if (p->p_pid == pgid) { - pgexit(p); - pgcreate(p); - } else { - register proc_t *q; - if ((q = pgfind(pgid)) == NULL - || q->p_sessp != p->p_sessp) - return EPERM; - pgexit(p); - pgjoin(p, q->p_pgidp); - } - - wakeprocs((caddr_t)p->p_parent, PRMPT); + if (p->p_sessp->s_sid == p->p_pid + || (p->p_pgrp == p->p_pid && memberspg(p->p_pid)) + || p->p_sessp != u.u_procp->p_sessp + || pgid != p->p_pid && !checkpg(p->p_sessp->s_sid, pgid)) + return EPERM; + leavepg(p); + joinpg(p, pgid); + attachpg(p); break; } @@ -550,8 +533,7 @@ setpgrp(uap, rvp) } /* - * Indefinite wait. No one should call wakeup() or wakeprocs() - * with a chan of &u. + * Indefinite wait. No one should wakeup(&u). */ void @@ -701,7 +683,7 @@ sigaltstack(uap, rvp) * save before copying out. */ if (uap->ss) { - if (u.u_sigaltstack.ss_flags & SS_ONSTACK) + if (u.u_altflags & SS_ONSTACK) return EPERM; if (copyin((caddr_t) uap->ss, (caddr_t) &ss, sizeof(ss))) return EFAULT; @@ -828,13 +810,14 @@ sigaction(uap, rvp) if (sig <= 0 || sig >= NSIG || sigismember(&cantmask, sig)) return EINVAL; - /* - * act and oact might be the same address, so copyin act first. - */ - if (uap->act && copyin((caddr_t)uap->act, (caddr_t)&act, sizeof(act))) - return EFAULT; + /* act and oact might be the same address, so copyin act first */ + if (uap->act) { + if (copyin((caddr_t)uap->act, (caddr_t)&act, sizeof(act))) + return EFAULT; + } if (uap->oact) { + struct sigaction oact; register flags; register void (*disp)(); @@ -899,7 +882,6 @@ kill(uap, rvp) { register id_t id; register idtype_t idtype; - procset_t set; if (uap->sig < 0 || uap->sig >= NSIG) return EINVAL; @@ -918,8 +900,22 @@ kill(uap, rvp) id = (id_t)(-uap->pid); } + return sigsend(idtype, id, uap->sig); +} + +/* + * Device driver interface to sigsend. + */ +int +sigsend(idtype, id, sig) + register idtype_t idtype; + register id_t id; + register sig; +{ + procset_t set; + setprocset(&set, POP_AND, idtype, id, P_ALL, P_MYID); - return sigsendset(&set, uap->sig); + return sigsendset(&set, sig); } struct sigsenda { @@ -1057,23 +1053,21 @@ ulimit(uap, rvp) register struct ulimita *uap; rval_t *rvp; { - switch (uap->cmd) { + register rlim_t lim; + register int error = 0; - case UL_GFILLIM: /* Return current file size limit. */ - rvp->r_off = (u.u_rlimit[RLIMIT_FSIZE].rlim_cur >> SCTRSHFT); - break; + switch (uap->cmd) { case UL_SFILLIM: /* Set new file size limit. */ - { - register int error = 0; - register rlim_t lim; - lim = uap->arg << SCTRSHFT; if (error = rlimit(RLIMIT_FSIZE, lim, lim)) return error; - rvp->r_off = uap->arg; + /* FALLTHROUGH */ + + case UL_GFILLIM: /* Return current file size limit. */ + rvp->r_off = u.u_rlimit[RLIMIT_FSIZE].rlim_cur >> SCTRSHFT; break; - } + case UL_GMEMLIM: /* Return maximum possible break value. */ { @@ -1092,11 +1086,11 @@ ulimit(uap, rvp) sseg = seg = as->a_segs; if (seg != NULL) { do { - if (seg->s_base >= brkend) { - nextseg = seg; - break; - } - seg = seg->s_next; + if (seg->s_base >= brkend) { + nextseg = seg; + break; + } + seg = seg->s_next; } while (seg != sseg); } @@ -1126,19 +1120,34 @@ ulimit(uap, rvp) else size = 0; rvp->r_off = min(rvp->r_off, (off_t)(brkend + size)); - break; + + return 0; } case UL_GDESLIM: /* Return approximate number of open files */ rvp->r_off = u.u_rlimit[RLIMIT_NOFILE].rlim_cur; break; + case UL_GTXTOFF: /* 64 - for XENIX compatibility */ + /* Return number of bytes between the beginning of + * user text and the text address given by 'arg'. + * Only valid for 386 binaries. 286 XENIX binaries + * will have this ulimit() call handled by the emulator. + * + * Just return the text offset the user sent as the argument, + * since we're small model... + */ + rvp->r_off = uap->arg; + break; + default: - return EINVAL; + error = EINVAL; + break; } - return 0; + return error; + } struct rlimita { @@ -1263,8 +1272,6 @@ utssys(uap, rvp) register struct vfs *vfsp; struct ustat ust; struct statvfs stvfs; - char *cp, *cp2; - int i; extern int rf_ustat(); /* @@ -1293,26 +1300,9 @@ utssys(uap, rvp) ust.f_tfree = (daddr_t) (stvfs.f_bfree * (stvfs.f_frsize/512)); ust.f_tinode = (o_ino_t) stvfs.f_ffree; - - cp = stvfs.f_fstr; - cp2 = ust.f_fname; - i = 0; - while (i++ < sizeof(ust.f_fname)) - if (*cp != '\0') - *cp2++ = *cp++; - else - *cp2++ = '\0'; - while (*cp != '\0' - && (i++ < sizeof(stvfs.f_fstr) - sizeof(ust.f_fpack))) - cp++; - cp++; - cp2 = ust.f_fpack; - i = 0; - while (i++ < sizeof(ust.f_fpack)) - if (*cp != '\0') - *cp2++ = *cp++; - else - *cp2++ = '\0'; + bcopy(&stvfs.f_fstr[0], ust.f_fpack, sizeof(ust.f_fpack)); + bcopy(&stvfs.f_fstr[sizeof(ust.f_fpack)], ust.f_fname, + sizeof(ust.f_fname)); if (copyout((caddr_t)&ust, uap->ub.cbuf, sizeof(ust))) error = EFAULT; break; @@ -1349,13 +1339,13 @@ uts_fusers(path, flags, outbp, rvp) char *outbp; rval_t *rvp; { - vnode_t *fvp = NULL; + vnode_t *fvp = NULL; int error; extern int lookupname(); - int dofusers(); + int dofusers(); - if ((error = lookupname(path, UIO_USERSPACE, FOLLOW, NULLVPP, &fvp)) + if ((error = lookupname(path, UIO_USERSPACE, FOLLOW, NULLVPP, &fvp)) != 0) { return error; } @@ -1372,7 +1362,7 @@ dofusers(fvp, flags, outbp, rvp) char *outbp; rval_t *rvp; { - register proc_t *prp; + register proc_t **prpp; register int pcnt = 0; /* number of f_user_t's copied out */ int error = 0; register int contained = (flags == F_CONTAINED); @@ -1396,13 +1386,15 @@ dofusers(fvp, flags, outbp, rvp) } cvfsp = fvp->v_vfsp; ASSERT(cvfsp); - for (prp = practive; prp != NULL; prp = prp->p_next) { + for (prpp = nproc; prpp < v.ve_proc; prpp++) { register user_t *up; + register proc_t *procp; - if (prp->p_stat == SZOMB || prp->p_stat == SIDL) + if ((procp = *prpp) == NULL || procp->p_stat == 0 || + procp->p_stat == SZOMB || procp->p_stat == SIDL) { continue; - - up = (user_t *)KUSER(prp->p_segu); + } + up = (user_t *)KUSER(procp->p_segu); if (up->u_cdir && (VN_CMP(fvp, up->u_cdir) || contained && up->u_cdir->v_vfsp == cvfsp)) { use_flag |= F_CDIR; @@ -1411,17 +1403,17 @@ dofusers(fvp, flags, outbp, rvp) up->u_rdir->v_vfsp == cvfsp)) { use_flag |= F_RDIR; } - if (prp->p_exec && (VN_CMP(fvp, prp->p_exec) || - contained && prp->p_exec->v_vfsp == cvfsp)) { + if (up->u_exdata.vp && (VN_CMP(fvp, up->u_exdata.vp) || + contained && up->u_exdata.vp->v_vfsp == cvfsp)) { use_flag |= F_TEXT; } - if (prp->p_trace && (VN_CMP(fvp, prp->p_trace) || - contained && prp->p_trace->v_vfsp == cvfsp)) { + if (procp->p_trace && (VN_CMP(fvp, procp->p_trace) || + contained && procp->p_trace->v_vfsp == cvfsp)) { use_flag |= F_TRACE; } - if (prp->p_sessp && (VN_CMP(fvp,prp->p_sessp->s_vp) || - contained && prp->p_sessp->s_vp && - prp->p_sessp->s_vp->v_vfsp == cvfsp)) { + if (procp->p_sessp && (VN_CMP(fvp,procp->p_sessp->s_vp) || + contained && procp->p_sessp->s_vp && + procp->p_sessp->s_vp->v_vfsp == cvfsp)) { use_flag |= F_TTY; } ufp = &(up->u_flist); @@ -1441,9 +1433,9 @@ dofusers(fvp, flags, outbp, rvp) * mmap usage?? */ if (use_flag) { - fuentry->fu_pid = prp->p_pid; + fuentry->fu_pid = procp->p_pid; fuentry->fu_flags = use_flag; - fuentry->fu_uid = (uid_t) prp->p_uid; + fuentry->fu_uid = (uid_t) procp->p_uid; fuentry++; pcnt++; use_flag = 0; @@ -1470,67 +1462,36 @@ nuname(uap, rvp) rval_t *rvp; { register int error = 0; - register struct utsname *buf = uap->cbuf; + register struct utsname *buf = uap->cbuf; - if (copyout(utsname.sysname, buf->sysname, strlen(utsname.sysname)+1)) { - error = EFAULT; - return error; - } - if (copyout(utsname.nodename, buf->nodename, - strlen(utsname.nodename)+1)) { - error = EFAULT; - return error; - } - if (copyout(utsname.release, buf->release, strlen(utsname.release)+1)) { - error = EFAULT; - return error; - } - if (copyout(utsname.version, buf->version, strlen(utsname.version)+1)) { - error = EFAULT; - return error; - } - if (copyout(utsname.machine, buf->machine, strlen(utsname.machine)+1)) { - error = EFAULT; - return error; - } + if (copyout(utsname.sysname, buf->sysname, strlen(utsname.sysname)+1)) +{ + error = EFAULT; + return error; + } + if (copyout(utsname.nodename, buf->nodename, strlen(utsname.nodename)+1)) { + error = EFAULT; + return error; + } + if (copyout(utsname.release, buf->release, strlen(utsname.release)+1)) +{ + error = EFAULT; + return error; + } + if (copyout(utsname.version, buf->version, strlen(utsname.version)+1)) +{ + error = EFAULT; + return error; + } + if (copyout(utsname.machine, buf->machine, strlen(utsname.machine)+1)) +{ + error = EFAULT; + return error; + } rvp->r_val1 = 1; return error; } -#define UADMIN_SYNC 0 -#define UADMIN_UMOUNT 1 - -STATIC void -dis_vfs(op) - int op; -{ - register struct vfs *pvfsp, *cvfsp, *ovfsp; - - pvfsp = rootvfs; - cvfsp = pvfsp->vfs_next; - - while (cvfsp != NULL) { - ovfsp = cvfsp; - - switch (op) { - case UADMIN_SYNC: - (void)VFS_SYNC(cvfsp, SYNC_CLOSE, u.u_cred); - break; - case UADMIN_UMOUNT: - (void)dounmount(cvfsp, u.u_cred); - break; - default: - break; - } - - cvfsp = pvfsp->vfs_next; - if (cvfsp == ovfsp) { - pvfsp = cvfsp; - cvfsp = cvfsp->vfs_next; - } - } -} - /* * Administrivia system call. */ @@ -1548,41 +1509,26 @@ uadmin(uap, rvp) rval_t *rvp; { static ualock; + register struct proc **p; int error = 0; if (ualock) return 0; - if (uap->cmd != A_SWAPCTL && !suser(u.u_cred)) + if ((uap->cmd != A_SWAPCTL) && !suser(u.u_cred)) return EPERM; ualock = 1; switch (uap->cmd) { case A_SHUTDOWN: { - register struct proc *p; - - /* - * Hold all signals so we don't die. - */ - sigfillset(&u.u_procp->p_hold); - - psignal(proc_init, SIGKILL); - sleep((caddr_t)proc_init, PWAIT); -checkagain: - for (p = practive; p != NULL; p = p->p_next) { - if (p->p_exec != NULL /* kernel daemons */ - && p->p_stat != SZOMB - && p != u.u_procp) { - psignal(p, SIGKILL); - (void) sleep((caddr_t)p, PWAIT); - goto checkagain; - } + p = &nproc[1]; + for (; p < v.ve_proc; p++) { + if (*p == NULL || (*p)->p_stat == 0) + continue; + if ((*p) != u.u_procp) + psignal(*p, SIGKILL); } - dis_vfs(UADMIN_SYNC); - dis_vfs(UADMIN_UMOUNT); -/* - bdwait(); -*/ + delay(HZ); /* allow other procs to exit */ (void) VFS_MOUNTROOT(rootvfs, ROOT_UNMOUNT); /* FALLTHROUGH */ } @@ -1647,16 +1593,14 @@ setcontext(uap, rvp) return 0; case SETCONTEXT: - if (uap->ucp == NULL) - exit(0, 0); if (copyin((caddr_t)uap->ucp,(caddr_t)&uc,sizeof(ucontext_t))) return EFAULT; restorecontext(&uc); - /* - * On return from system calls, r0 and r1 are overwritten with - * r_val1 and r_val2 respectively, so set r_val1 and r_val2 to - * r0 and r1 here. - */ + /* + * On return from system calls, r0 and r1 are overwritten with + * r_val1 and r_val2 respectively, so set r_val1 and r_val2 to + * r0 and r1 here. + */ rvp->r_val1 = u.u_pcb.regsave[K_R0]; rvp->r_val2 = u.u_pcb.regsave[K_R1]; return 0; @@ -1688,9 +1632,10 @@ systeminfo(uap, rvp) error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; @@ -1701,9 +1646,10 @@ systeminfo(uap, rvp) error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; @@ -1714,9 +1660,10 @@ systeminfo(uap, rvp) error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; @@ -1727,9 +1674,10 @@ systeminfo(uap, rvp) error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; @@ -1740,9 +1688,10 @@ systeminfo(uap, rvp) error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; @@ -1767,9 +1716,10 @@ systeminfo(uap, rvp) error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; @@ -1780,83 +1730,127 @@ systeminfo(uap, rvp) error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; - case SI_SRPC_DOMAIN: + case SI_GET_INET_DOMAIN: getcnt = ((strcnt = strlen(srpc_domain)) >= uap->count) ? uap->count : strcnt + 1; if (copyout(srpc_domain, uap->buf, getcnt)) { error = EFAULT; break; } - if (strcnt >= uap->count - && subyte(uap->buf+uap->count-1, 0) < 0) + if ((strcnt >= uap->count) + && subyte(uap->buf+uap->count-1, 0) < 0) { error = EFAULT; + } rvp->r_val1 = strcnt + 1; break; case SI_SET_HOSTNAME: - { - size_t len; - char name[SYS_NMLN]; - - if (!suser(u.u_cred)) { - error = EPERM; - break; - } + { + struct vnode *vp; + int len = 0; + int limit; + char name[SYS_NMLN]; + char *c = name; + + if (!suser(u.u_cred)) { + error = EPERM; + break; + } - if ((error = copyinstr(uap->buf, name, SYS_NMLN, &len)) != 0) - break; + do { + if (copyin(uap->buf++, c, 1)) { + error = EFAULT; + break; + } + len++; + } while ((len < SYS_NMLN) && *c++); + if (error) + break; - /* - * Must be non-NULL string and string - * must be less than SYS_NMLN chars. - */ - if (len < 2 || (len == SYS_NMLN && name[SYS_NMLN-1] != '\0')) { - error = EINVAL; + /* + * must be non-NULL string and string + * must be less than SYS_NMLN chars. + */ + if ((len < 2) || ((len == SYS_NMLN) && (*c != '\0'))) { + error = EINVAL; + break; + } + + /* + * Copy name into file /etc/nodename. + * NOTE: + * The name of the system is stored in a file for use + * when booting because the non-volatile RAM on the + * porting base will not allow storage of the full + * internet standard nodename. + * If sufficient non-volatile RAM is available on + * the hardware, however, storing the name there would + * be preferable to storing it in a file. + */ + limit = u.u_rlimit[RLIMIT_FSIZE].rlim_cur >> SCTRSHFT; + if (vn_open("/etc/nodename", UIO_SYSSPACE, + FWRITE|FCREAT|FTRUNC, 0, &vp) != 0) { + error = EFAULT; + break; + } else if (vn_rdwr(UIO_WRITE, vp, (caddr_t)name, + len, 0, UIO_SYSSPACE, 0, limit, u.u_cred, + NULL) != 0) { + error = EFAULT; + break; + } + /* + * Copy the name into the global utsname structure. + */ + strcpy(utsname.nodename, name); + rvp->r_val1 = len; break; - } - - /* - * Copy the name into the global utsname structure. - */ - strcpy(utsname.nodename, name); - rvp->r_val1 = len; - break; - } + } - case SI_SET_SRPC_DOMAIN: - { - char name[SYS_NMLN]; - size_t len; - - if (!suser(u.u_cred)) { - error = EPERM; - break; - } - if ((error = copyinstr(uap->buf, name, SYS_NMLN, &len)) != 0) - break; - /* - * If string passed in is longer than length - * allowed for domain name, fail. - */ - if (len == SYS_NMLN && name[SYS_NMLN-1] != '\0') { - error = EINVAL; + case SI_SET_INET_DOMAIN: + { + char name[SYS_NMLN]; + char *c = name; + int len = 0; + + if (!suser(u.u_cred)) { + error = EPERM; + break; + } + do { + if (copyin(uap->buf++, c, 1)) { + error = EFAULT; + break; + } + len++; + } while ((len < SYS_NMLN) && *c++); + if (error) + break; + /* + * If string passed in is longer than length + * allowed for domain name, fail. + */ + if ((len == SYS_NMLN) && (*c != '\0')) { + error = EINVAL; + break; + } + strcpy(srpc_domain, name); + rvp->r_val1 = len; break; } - strcpy(srpc_domain, name); - rvp->r_val1 = len; - break; - } default: error = EINVAL; break; } + if (error) + rvp->r_val1 = -1; return error; } diff --git a/usr/src/uts/3b2/os/sem.c b/usr/src/uts/3b2/os/sem.c index 8a83fee..40f8f72 100644 --- a/usr/src/uts/3b2/os/sem.c +++ b/usr/src/uts/3b2/os/sem.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/sem.c 1.17" +#ident "@(#)kernel:os/sem.c 1.13" /* * Inter-Process Communication Semaphore Facility. */ @@ -104,13 +104,13 @@ semaoe(val, id, num) return 0; if (val > seminfo.semaem || val < -seminfo.semaem) return ERANGE; - if ((up = sem_undo[u.u_procp->p_slot]) == NULL) + if ((up = sem_undo[GET_INDEX(u.u_procp->p_pid)]) == NULL) if ((up = semfup) == NULL) return ENOSPC; else { semfup = up->un_np; up->un_np = NULL; - sem_undo[u.u_procp->p_slot] = up; + sem_undo[GET_INDEX(u.u_procp->p_pid)] = up; } for (uup = up->un_ent, found = i = 0;i < up->un_cnt;i++) { if (uup->un_id < id @@ -295,11 +295,11 @@ semctl(uap, rvp) for (i = sp->sem_nsems, p = sp->sem_base;i--;p++) { p->semval = p->sempid = 0; if (p->semncnt) { - wakeprocs((caddr_t)&p->semncnt, PRMPT); + wakeup((caddr_t)&p->semncnt); p->semncnt = 0; } if (p->semzcnt) { - wakeprocs((caddr_t)&p->semzcnt, PRMPT); + wakeup((caddr_t)&p->semzcnt); p->semzcnt = 0; } } @@ -320,9 +320,6 @@ semctl(uap, rvp) if (copyin((caddr_t)uap->arg, (caddr_t)&semtmp.ods, sizeof(semtmp.ods))) return EFAULT; - if (semtmp.ods.sem_perm.uid > MAXUID || - semtmp.ods.sem_perm.gid > MAXUID) - return(EINVAL); sp->sem_perm.uid = semtmp.ods.sem_perm.uid; sp->sem_perm.gid = semtmp.ods.sem_perm.gid; sp->sem_perm.mode = semtmp.ods.sem_perm.mode & 0777 | IPC_ALLOC; @@ -337,10 +334,6 @@ semctl(uap, rvp) if (copyin((caddr_t)uap->arg, (caddr_t)&semtmp.ds, sizeof(semtmp.ds))) return EFAULT; - if (semtmp.ds.sem_perm.uid < (uid_t)0 || semtmp.ds.sem_perm.uid > MAXUID - || semtmp.ds.sem_perm.gid < (gid_t)0 || - semtmp.ds.sem_perm.gid > MAXUID) - return(EINVAL); sp->sem_perm.uid = semtmp.ds.sem_perm.uid; sp->sem_perm.gid = semtmp.ds.sem_perm.gid; sp->sem_perm.mode = semtmp.ds.sem_perm.mode & 0777 | IPC_ALLOC; @@ -448,11 +441,11 @@ semctl(uap, rvp) if ((p->semval = uap->arg) != 0) { if (p->semncnt) { p->semncnt = 0; - wakeprocs((caddr_t)&p->semncnt, PRMPT); + wakeup((caddr_t)&p->semncnt); } } else if (p->semzcnt) { p->semzcnt = 0; - wakeprocs((caddr_t)&p->semzcnt, PRMPT); + wakeup((caddr_t)&p->semzcnt); } p->sempid = u.u_procp->p_pid; semunrm(uap->semid, uap->semnum, uap->semnum); @@ -474,11 +467,11 @@ semctl(uap, rvp) if ((p->semval = semtmp.semvals[i++]) != 0) { if (p->semncnt) { p->semncnt = 0; - wakeprocs((caddr_t)&p->semncnt, PRMPT); + wakeup((caddr_t)&p->semncnt); } } else if (p->semzcnt) { p->semzcnt = 0; - wakeprocs((caddr_t)&p->semzcnt, PRMPT); + wakeup((caddr_t)&p->semzcnt); } } return 0; @@ -502,7 +495,7 @@ semexit() register long v; /* adjusted value */ register struct sem *semp; /* semaphore ptr */ - if ((up = sem_undo[u.u_procp->p_slot]) == NULL) + if ((up = sem_undo[GET_INDEX(u.u_procp->p_pid)]) == NULL) return; if (up->un_cnt == 0) goto cleanup; @@ -516,11 +509,11 @@ semexit() semp->semval = (ushort) v; if (v == 0 && semp->semzcnt) { semp->semzcnt = 0; - wakeprocs((caddr_t)&semp->semzcnt, PRMPT); + wakeup((caddr_t)&semp->semzcnt); } if (up->un_ent[i].un_aoe > 0 && semp->semncnt) { semp->semncnt = 0; - wakeprocs((caddr_t)&semp->semncnt, PRMPT); + wakeup((caddr_t)&semp->semncnt); } } up->un_cnt = 0; @@ -535,7 +528,7 @@ semexit() cleanup: up->un_np = semfup; semfup = up; - sem_undo[u.u_procp->p_slot] = up; + sem_undo[GET_INDEX(u.u_procp->p_pid)] = up; } /* @@ -673,11 +666,11 @@ semop(uap, rvp) semp->semval += op->sem_op; if (semp->semncnt) { semp->semncnt = 0; - wakeprocs((caddr_t)&semp->semncnt, PRMPT); + wakeup((caddr_t)&semp->semncnt); } if (semp->semzcnt && !semp->semval) { semp->semzcnt = 0; - wakeprocs((caddr_t)&semp->semzcnt, PRMPT); + wakeup((caddr_t)&semp->semzcnt); } continue; } @@ -694,8 +687,7 @@ semop(uap, rvp) semp->semval += op->sem_op; if (semp->semzcnt && !semp->semval) { semp->semzcnt = 0; - wakeprocs((caddr_t)&semp->semzcnt, - PRMPT); + wakeup((caddr_t)&semp->semzcnt); } continue; } @@ -707,8 +699,7 @@ semop(uap, rvp) if (sleep((caddr_t)&semp->semncnt, PCATCH|PSEMN)) { if ((semp->semncnt)-- <= 1) { semp->semncnt = 0; - wakeprocs((caddr_t)&semp->semncnt, - PRMPT); + wakeup((caddr_t)&semp->semncnt); } return EINTR; } @@ -723,8 +714,7 @@ semop(uap, rvp) if (sleep((caddr_t)&semp->semzcnt, PCATCH|PSEMZ)) { if ((semp->semzcnt)-- <= 1) { semp->semzcnt = 0; - wakeprocs((caddr_t)&semp->semzcnt, - PRMPT); + wakeup((caddr_t)&semp->semzcnt); } return EINTR; } diff --git a/usr/src/uts/3b2/os/session.c b/usr/src/uts/3b2/os/session.c index 2589aa0..65c6638 100644 --- a/usr/src/uts/3b2/os/session.c +++ b/usr/src/uts/3b2/os/session.c @@ -5,101 +5,125 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/session.c 1.36" +#ident "@(#)kernel:os/session.c 1.27" #include "sys/types.h" #include "sys/sysmacros.h" #include "sys/param.h" #include "sys/systm.h" -#include "sys/file.h" #include "sys/vfs.h" +#include "sys/cred.h" #include "sys/vnode.h" -#include "sys/errno.h" #include "sys/signal.h" +#include "sys/evecb.h" +#include "sys/hrtcntl.h" +#include "sys/priocntl.h" +#include "sys/events.h" +#include "sys/evsys.h" +#include "sys/file.h" +#include "sys/errno.h" #include "sys/sbd.h" #include "sys/immu.h" #include "sys/psw.h" #include "sys/pcb.h" -#include "sys/cred.h" #include "sys/user.h" #include "sys/buf.h" #include "sys/var.h" #include "sys/conf.h" #include "sys/debug.h" #include "sys/proc.h" +#include "sys/stream.h" +#include "sys/strsubr.h" #include "sys/session.h" +#include "sys/priocntl.h" #include "sys/kmem.h" sess_t session0 = { - 1, /* s_ref */ + 0, /* s_procs */ 0555, /* s_mode */ + 0, /* s_sid */ 0, /* s_uid */ 0, /* s_gid */ - 0, /* s_ctime */ NODEV, /* s_dev */ - NULL, /* s_vp */ - &pid0, /* s_sidp */ - NULL /* s_cred */ + 0, /* s_sidp */ + 0, /* s_fgidp */ + 0 /* s_vp */ }; -int -sess_rele(sp) - register sess_t *sp; -{ - ASSERT(sp != &session0); - PID_RELE(sp->s_sidp); - kmem_free(sp,sizeof(sess_t)); - return 1; -} - void -sess_create() +freectty(sp) +register sess_t *sp; { - register proc_t *pp; - register sess_t *sp; + register vnode_t *vp = sp->s_vp; + register i; + extern void ssinvalidate(); - pp = u.u_procp; + ASSERT(vp != NULL); - pgexit(pp); - SESS_RELE(pp->p_sessp); + ssinvalidate(sp); - sp = (sess_t *)kmem_zalloc(sizeof (sess_t), KM_SLEEP); - sp->s_sidp = pp->p_pidp; - sp->s_ref = 1; - sp->s_dev = NODEV; - pp->p_sessp = sp; + for (i = vp->v_count; i; i--) { + VOP_CLOSE(vp, 0, 1, (off_t)0, nproc[1]->p_cred); + VN_RELE(vp); + } - pgcreate(pp); + *sp->s_sidp = 0; + *sp->s_fgidp = 0; + sp->s_vp = NULL; +} - PID_HOLD(sp->s_sidp); +void +forksession(pp,sp) +proc_t *pp; +sess_t *sp; +{ + pp->p_sessp = sp; + ++(sp->s_procs); } void -freectty(sp) - register sess_t *sp; +exitsession(pp) +proc_t *pp; { - register vnode_t *vp; - int i; + register sess_t *sp; + sp = pp->p_sessp; + pp->p_sessp = NULL; - vp = sp->s_vp; - ASSERT(vp != NULL); + ASSERT(sp); + ASSERT(sp->s_procs > 0); - if (vp->v_stream != NULL) - strfreectty(vp->v_stream); - else { /* may be clist driver */ - ASSERT(u.u_ttyp != NULL); - signal((pid_t)(*u.u_ttyp), SIGHUP); - *u.u_ttyp = 0; + if (--(sp->s_procs) == 0) { + ASSERT(sp != &session0); + strclearsid(sp->s_sid); + kmem_free(sp,sizeof(sess_t)); } +} - for (i = vp->v_count; i; i--) { - VOP_CLOSE(vp, 0, 1, (off_t)0, sp->s_cred); - VN_RELE(vp); - } +void +newsession() +{ + register proc_t *pp; + register sess_t *sp; + + pp = u.u_procp; + sp = pp->p_sessp; + + ASSERT(pp->p_pid != sp->s_sid); + + sp = (sess_t *)kmem_alloc(sizeof (sess_t), 0); - crfree(sp->s_cred); + leavepg(pp); + joinpg(pp,pp->p_pid); + + exitsession(pp); + + sp->s_procs = 1; + sp->s_sid = pp->p_pid; + sp->s_dev = NODEV; sp->s_vp = NULL; + pp->p_sessp = sp; + pp->p_flag |= SDETACHED; } dev_t @@ -113,97 +137,138 @@ proc_t *pp; } void -alloctty(pp, vp) +alloctty(pp,vp,sidp,fgidp) register proc_t *pp; vnode_t *vp; +pid_t *sidp; +pid_t *fgidp; { + extern vnode_t *makectty(); register sess_t *sp = pp->p_sessp; - register cred_t *crp = pp->p_cred; + register struct user *up = PTOU(pp); - sp->s_vp = vp; + sp->s_vp = makectty(vp->v_rdev); sp->s_dev = vp->v_rdev; - - crhold(crp); - sp->s_cred = crp; - sp->s_uid = crp->cr_uid; - sp->s_ctime = hrestime.tv_sec; + sp->s_sidp = sidp; + sp->s_fgidp = fgidp; + *sidp = pp->p_pid; + *fgidp = pp->p_pid; + sp->s_uid = pp->p_cred->cr_uid; if (session0.s_mode & VSGID) sp->s_gid = session0.s_gid; else - sp->s_gid = crp->cr_gid; - sp->s_mode = (0666 & ~(PTOU(pp)->u_cmask)); -} + sp->s_gid = pp->p_cred->cr_gid; + sp->s_mode = (0666 & ~(up->u_cmask)); -int -hascttyperm(sp, cr, mode) - register sess_t *sp; - register cred_t *cr; - register mode_t mode; -{ + /* populate the user area for binary compatibility */ + /* NODEV is assigned for device numbers that don't fit in o_dev_t. */ - if (cr->cr_uid == 0) - return 1; + up->u_ttyp = (pid_t *)sp->s_sidp; + up->u_ttyd = (o_dev_t)cmpdev(sp->s_dev); - if (cr->cr_uid != sp->s_uid) { - mode >>= 3; - if (!groupmember(sp->s_gid, cr)) - mode >>= 3; - } +} - if ((sp->s_mode & mode) == mode) - return 1; +#define cantsend(pp,sig) \ + (sigismember(&pp->p_ignore,sig) || sigismember(&pp->p_hold,sig)) - return 0; -} +/* + * Perform job control discipline access checks. + * Return 0 for success and the errno for failure. + */ int -realloctty(frompp, sid) - proc_t *frompp; - pid_t sid; +accsctty(vp, mode, tostop) +vnode_t *vp; +int tostop; +enum jcaccess mode; { - proc_t *topp; - register sess_t *fromsp; - register sess_t *tosp; - cred_t *fromcr; - vnode_t *fromvp; - - fromsp = frompp->p_sessp; - fromvp = fromsp->s_vp; - fromcr = frompp->p_cred; - - if (!hascttyperm(&session0, fromcr, VEXEC|VWRITE)) - return EACCES; - - if ((session0.s_mode & VSVTX) - && fromcr->cr_uid != session0.s_uid - && (!hascttyperm(fromsp, fromcr, VWRITE))) - return EACCES; - - if (sid == 0) { - freectty(fromsp); - return 0; - } - - if (fromvp->v_stream == NULL) - return ENOSYS; + register proc_t *pp; + register sess_t *sp; - if ((topp = prfind(sid)) == NULL) - return ESRCH; + pp = u.u_procp; + sp = pp->p_sessp; + + for (;;) { + + /* + * if this is not the calling process's controlling terminal + * or the calling process is already in the foreground + * then allow access + */ + + if (sp->s_dev != vp->v_rdev || pp->p_pgrp == *sp->s_fgidp) + return 0; + + /* + * if calling process's session ID is not the terminal's + * session ID, then either the session leader exited + * or allocated a new controlling terminal + */ + + if (sp->s_sid != *sp->s_sidp) { /* caller lost ctty */ + if (cantsend(pp,SIGHUP)) + return EIO; + signal(pp->p_pgrp, SIGHUP); + } + + else if (mode == JCGETP) + return 0; + + else if (mode == JCREAD) { + if (cantsend(pp,SIGTTIN) || (pp->p_flag & SDETACHED)) + return EIO; + signal(pp->p_pgrp,SIGTTIN); + } + + else { /* mode == JCWRITE or JCSETP */ + if (mode == JCWRITE && !tostop || cantsend(pp,SIGTTOU)) + return 0; + if (pp->p_flag & SDETACHED) + return EIO; + signal(pp->p_pgrp, SIGTTOU); + } + + /* + * This mimics code in sleep(). + * This is not a real sleep, but it should + * look like one to the debugger interface. + */ + pp->p_flag |= SASLEEP; + u.u_sysabort = 0; + if (ISSIG(pp, FORREAL) || u.u_sysabort || EV_ISTRAP(pp)) { + /* + * Signal pending or debugger aborted the syscall. + */ + pp->p_flag &= ~SASLEEP; + u.u_sysabort = 0; + longjmp(&u.u_qsav); + } + pp->p_flag &= ~SASLEEP; + } +} - tosp = topp->p_sessp; +void +realloctty(vp) +struct vnode *vp; +{ + register proc_t *pp; + register sess_t *sp; - if (tosp->s_sidp != topp->p_pidp - || tosp->s_vp != NULL - || !hasprocperm(topp->p_cred, frompp->p_cred)) - return EPERM; + pp = u.u_procp; + sp = pp->p_sessp; - strfreectty(fromvp->v_stream); - crfree(fromsp->s_cred); + /* the controlling terminal should be allocated by now */ + /* if so, at least the following must be true */ - alloctty(topp, fromvp); - stralloctty(tosp, fromvp->v_stream); + if (u.u_ttyp == NULL || *u.u_ttyp != pp->p_pid) + return; - fromsp->s_vp = NULL; + if (pp->p_pid != sp->s_sid) { + *u.u_ttyp = 0; + u.u_ttyp = NULL; + sp->s_vp = NULL; + return; + } - return 0; + alloctty(u.u_procp, vp, u.u_ttyp, u.u_ttyp); } diff --git a/usr/src/uts/3b2/os/shm.c b/usr/src/uts/3b2/os/shm.c index 4613d2b..9bbcade 100644 --- a/usr/src/uts/3b2/os/shm.c +++ b/usr/src/uts/3b2/os/shm.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)kernel:os/shm.c 1.37" +#ident "@(#)kernel:os/shm.c 1.33" #include "sys/types.h" #include "sys/param.h" #include "sys/cred.h" @@ -200,9 +177,9 @@ shmat(uap, rvp) crargs.offset = 0; crargs.type = MAP_SHARED; crargs.amp = sp->shm_amp; + crargs.maxprot = PROT_ALL; crargs.prot = (uap->flag & SHM_RDONLY) ? (PROT_ALL & ~PROT_WRITE) : PROT_ALL; - crargs.maxprot = crargs.prot; error = as_map(pp->p_as, addr, size, segvn_create, (caddr_t)&crargs); if (error) @@ -289,10 +266,6 @@ shmctl(uap, rvp) error = EFAULT; break; } - if (ods.shm_perm.uid > MAXUID || ods.shm_perm.gid > MAXUID){ - error = EINVAL; - break; - } sp->shm_perm.uid = ods.shm_perm.uid; sp->shm_perm.gid = ods.shm_perm.gid; sp->shm_perm.mode = @@ -311,11 +284,6 @@ shmctl(uap, rvp) error = EFAULT; break; } - if (ds.shm_perm.uid < (uid_t)0 || ds.shm_perm.uid > MAXUID || - ds.shm_perm.gid < (gid_t)0 || ds.shm_perm.gid > MAXUID){ - error = EINVAL; - break; - } sp->shm_perm.uid = ds.shm_perm.uid; sp->shm_perm.gid = ds.shm_perm.gid; sp->shm_perm.mode = diff --git a/usr/src/uts/3b2/os/sig.c b/usr/src/uts/3b2/os/sig.c index 5a82c84..0cecc87 100644 --- a/usr/src/uts/3b2/os/sig.c +++ b/usr/src/uts/3b2/os/sig.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/sig.c 1.52" +#ident "@(#)kernel:os/sig.c 1.49.2.1" #include "sys/param.h" #include "sys/types.h" #include "sys/psw.h" @@ -158,7 +158,7 @@ isjobstop(sig) if (sigismember(&p->p_sig, SIGCONT)) { sigdelset(&p->p_sig, SIGCONT); sigdelq(p, SIGCONT); - } else if (sig == SIGSTOP || p->p_detached == 0) { + } else if (sig == SIGSTOP || !(p->p_flag & SDETACHED)) { if (stop(p, PR_JOBCONTROL, sig, 0)) swtch(); p->p_wcode = CLD_CONTINUED; @@ -307,7 +307,7 @@ issig(why) /* * Put the specified process into the stopped state and notify - * tracers via wakeprocs(). Returns 0 if process can't be stopped. + * tracers via wakeup(). Returns 0 if process can't be stopped. * Returns non-zero in the normal case. */ int @@ -344,7 +344,7 @@ stop(p, why, what, firststop) if (p->p_flag & STRC) { /* ptrace() */ p->p_wcode = CLD_TRAPPED; p->p_wdata = what; - wakeprocs((caddr_t)p->p_parent, PRMPT); + wakeup((caddr_t)p->p_parent); if (!firststop || !sigismember(&p->p_sigmask, what)) { p->p_flag |= SPSTART; break; @@ -357,7 +357,7 @@ stop(p, why, what, firststop) p->p_flag |= SXSTART; p->p_flag &= ~SPRSTOP; if (p->p_trace) /* /proc */ - wakeprocs((caddr_t)p->p_trace, PRMPT); + wakeup((caddr_t)p->p_trace); break; } @@ -401,18 +401,6 @@ psig() ASSERT(sig); ASSERT(!sigismember(&p->p_ignore, sig)); if ((func = u.u_signal[sig-1]) != SIG_DFL) { - k_siginfo_t *sip; - - /* - * save siginfo pointer here, in case the - * the signal's reset bit is on - */ - - if (p->p_curinfo && sigismember(&p->p_siginfo, sig)) - sip = &p->p_curinfo->sq_info; - else - sip = NULL; - if (u.u_sigflag & SOMASK) u.u_sigflag &= ~SOMASK; else @@ -422,7 +410,7 @@ psig() sigaddset(&p->p_hold, sig); if (sigismember(&u.u_sigresethand, sig)) setsigact(sig, SIG_DFL, 0, 0); - rc = sendsig(sig, sip, func); + rc = sendsig(sig, func); p->p_cursig = 0; if (p->p_curinfo) { kmem_free((caddr_t)p->p_curinfo, @@ -559,7 +547,7 @@ ptrace(uap, rvp) else rvp->r_val1 = ipc.ip_data; ipc.ip_lock = 0; - wakeprocs((caddr_t)&ipc, PRMPT); + wakeup((caddr_t)&ipc); return error; } @@ -699,12 +687,12 @@ procxmt() p->p_curinfo = NULL; } } - wakeprocs((caddr_t)&ipc, PRMPT); + wakeup((caddr_t)&ipc); return 1; case 8: /* force exit */ - wakeprocs((caddr_t)&ipc, PRMPT); + wakeup((caddr_t)&ipc); p->p_flag |= SPTRX; return 1; @@ -712,7 +700,7 @@ procxmt() error: ipc.ip_req = -1; } - wakeprocs((caddr_t)&ipc, PRMPT); + wakeup((caddr_t)&ipc); return 0; } @@ -792,14 +780,12 @@ sigcld(cp) case CLD_EXITED: case CLD_DUMPED: case CLD_KILLED: - wakeprocs((caddr_t)cp, PRMPT); - wakeprocs((caddr_t)pp, PRMPT); + wakeup((caddr_t)pp); break; case CLD_STOPPED: case CLD_CONTINUED: - wakeprocs((caddr_t)cp, PRMPT); - wakeprocs((caddr_t)pp, PRMPT); + wakeup((caddr_t)pp); if (pp->p_flag & SJCTL) break; @@ -934,6 +920,44 @@ sigaddq(p, infop, km_flags) sigtoproc(p, sig, infop->si_code <= 0); } +/* + * Duplicate siginfo_t structures. Called from newproc(). + */ +void +sigdupq(cp, pp) + proc_t *cp; /* child process */ + proc_t *pp; /* parent process */ +{ + register sigqueue_t *sqp; + register sigqueue_t *nsqp; + register sigqueue_t **psqp = &cp->p_sigqueue; + + /* + * Duplicate the queue of pending siginfo_t's. + */ + for (sqp = pp->p_sigqueue; sqp; sqp = sqp->sq_next) { + nsqp = (sigqueue_t *)kmem_alloc(sizeof(sigqueue_t), KM_SLEEP); + bcopy((caddr_t)&sqp->sq_info, (caddr_t)&nsqp->sq_info, + sizeof(k_siginfo_t)); + *psqp = nsqp; + psqp = &nsqp->sq_next; + } + *psqp = NULL; + + /* + * Duplicate the current siginfo_t, if any. + */ + if ((sqp = pp->p_curinfo) == NULL) + cp->p_curinfo = NULL; + else { + nsqp = (sigqueue_t *)kmem_alloc(sizeof(sigqueue_t), KM_SLEEP); + bcopy((caddr_t)&sqp->sq_info, (caddr_t)&nsqp->sq_info, + sizeof(k_siginfo_t)); + nsqp->sq_next = NULL; + cp->p_curinfo = nsqp; + } +} + sigqueue_t * sigappend(toks, toqueue, fromks, fromqueue) register k_sigset_t *toks; @@ -965,14 +989,9 @@ sigprepend(toks, toqueue, fromks, fromqueue) register k_sigset_t *fromks; register sigqueue_t *fromqueue; { - register sigqueue_t *endqueue; - sigorset(toks, fromks); if (fromqueue != NULL) { - for (endqueue = fromqueue; endqueue->sq_next; - endqueue = endqueue->sq_next) - ; - endqueue->sq_next = toqueue; + fromqueue->sq_next = toqueue; toqueue = fromqueue; } return toqueue; diff --git a/usr/src/uts/3b2/os/slp.c b/usr/src/uts/3b2/os/slp.c index 2e0faa0..9e21ee7 100644 --- a/usr/src/uts/3b2/os/slp.c +++ b/usr/src/uts/3b2/os/slp.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/slp.c 1.31" +#ident "@(#)kernel:os/slp.c 1.29" #include "sys/types.h" #include "sys/param.h" #include "sys/sbd.h" @@ -61,7 +61,7 @@ struct sleepq { /* * This is used to hold the addr of each process being awaken up * for that chan so they will be written to the buffer at the end - * of wakeprocs call. + * of wakeup call. */ caddr_t wpp[1024]; @@ -159,7 +159,7 @@ sleep(chan, disp) ASSERT(pp->p_stat == SSLEEP); if (runin != 0) { runin = 0; - wakeprocs((caddr_t)&runin, PRMPT); + wakeup((caddr_t)&runin); } pp->p_flag &= ~SASLEEP; @@ -304,7 +304,7 @@ wakeprocs(chan, preemptflg) *plinkp = pp->p_link; if (pp->p_stat == SSLEEP) { pp->p_stat = SRUN; - if (preemptflg == NOPRMPT) + if (preemptflg == NOPREEMPT) npwakecnt++; /* @@ -328,7 +328,7 @@ wakeprocs(chan, preemptflg) if (runout > 0) runsched = 1; } else if (pp->p_pri > curpri && - preemptflg != NOPRMPT) + preemptflg != NOPREEMPT) runrun = 1; } } else { @@ -339,7 +339,7 @@ wakeprocs(chan, preemptflg) sqp->sq_last = rp; if (runsched) { runout = 0; - setrun(proc_sched); + setrun(nproc[0]); } #ifdef KPERF if (kpftraceflg && outbuf == 0) { @@ -405,7 +405,7 @@ setrun(pp) */ if ((pp->p_flag & SPSTART) && pp->p_whystop == PR_SIGNALLED) - wakeprocs((caddr_t)pp->p_parent, PRMPT); + wakeup((caddr_t)pp->p_parent); splx(s); return; } @@ -433,7 +433,7 @@ setrun(pp) if ((pp->p_flag & SLOAD) == 0) { if (runout > 0) { runout = 0; - setrun(proc_sched); + setrun(nproc[0]); } } else if (pp->p_pri > curpri) runrun = 1; @@ -442,9 +442,17 @@ setrun(pp) } +/* + * The following is for binary compatibility only. New code + * which calls wakeup() should be including the sysmacros.h + * header file which defines wakeup() and wakeupnp() macro + * interfaces to the wakeprocs() function. + */ +#undef wakeup + void wakeup(chan) register caddr_t chan; { - wakeprocs(chan, PRMPT); + wakeprocs(chan, PREEMPTOK); } diff --git a/usr/src/uts/3b2/os/space.c b/usr/src/uts/3b2/os/space.c index 00bad8a..785049c 100644 --- a/usr/src/uts/3b2/os/space.c +++ b/usr/src/uts/3b2/os/space.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/space.c 1.17" +#ident "@(#)kernel:os/space.c 1.16" #include "sys/types.h" #include "sys/param.h" #include "sys/immu.h" @@ -74,3 +74,10 @@ int kpbase; */ pte_t *kptbl; + +/* new structure for proc table restructure */ + +proc_t *pactivelist; /* the active processes header */ +pincr_t *pfreelisthead; /* the first free pincr table entry pointer */ +pincr_t *pfreelisttail; /* the last free pincr table entry pointer */ + diff --git a/usr/src/uts/3b2/os/startup.c b/usr/src/uts/3b2/os/startup.c index 42d75a3..4588e95 100644 --- a/usr/src/uts/3b2/os/startup.c +++ b/usr/src/uts/3b2/os/startup.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/startup.c 1.50" +#ident "@(#)kernel:os/startup.c 1.41" #include "sys/param.h" #include "sys/types.h" #include "sys/psw.h" @@ -39,7 +39,6 @@ #include "sys/sys3b.h" #include "sys/file.h" #include "sys/uio.h" -#include "sys/conf.h" #include "vm/seg.h" #include "vm/seg_kmem.h" @@ -47,7 +46,6 @@ #include "vm/seg_u.h" #include "vm/seg_map.h" #include "vm/page.h" -#include "vm/bootconf.h" extern void dmainit(); @@ -65,7 +63,7 @@ STATIC void p0init(); STATIC void devinit(); #endif -int icdblk = 0; +STATIC int icdblk = 0; /* * The following page table is used for the first @@ -97,6 +95,7 @@ mlsetup(physclick) register sde_t *sde; extern int sbss; /* Start of kernel bss. */ extern int bssSIZE[]; /* Size of bss in bytes.*/ + extern int ptbl_init(); int zero; /* @@ -180,6 +179,10 @@ mlsetup(physclick) nextclick = sysseginit(physclick); + /* Initialize the proc table */ + + ptbl_init(); + /* * Initialize the map used to allocate kernel virtual space. */ @@ -219,9 +222,6 @@ mlsetup(physclick) */ p0init(); - - pid_init(); - } @@ -587,7 +587,7 @@ p0init() if(pp == NULL){ cmn_err(CE_PANIC, "process 0 - creation failed\n"); } - proc_sched = pp; + nproc[0] = pp; u.u_procp = pp; u.u_cmask = (mode_t) CMASK; @@ -601,20 +601,17 @@ p0init() curpri = v.v_maxsyspri; pp->p_stat = SONPROC; - pp->p_flag = SLOAD | SSYS | SLOCK | SULOAD; + pp->p_flag = SLOAD | SSYS | SLOCK | SULOAD | SDETACHED; pp->p_pri = v.v_maxsyspri; pp->p_cid = 0; pp->p_clfuncs = class[0].cl_funcs; pp->p_clproc = (caddr_t)pp; - pp->p_pidp = &pid0; - pp->p_pgidp = &pid0; - pp->p_sessp = &session0; - pid0.pid_pglink = pp; + forksession(nproc[0],&session0); pp->p_segu = (struct seguser *)p0seguser; addr = (caddr_t)p0seguser; - ptptr = (pte_t *)ubptbl(pp); + ptptr = (pte_t *)ubptbl(nproc[0]); for (ii = 0; ii < USIZE; ii++, ptptr++) { ptptr->pg_pte = mkpte(PG_V, btoc(kvtophys((char *)&u + ctob(ii)))); @@ -633,9 +630,31 @@ p0init() void inituname() { + struct vnode *vp; + int resid; + char buf[256]; + int len; extern char *release; extern char *version; + /* + * Get nodename if stored. + * NOTE: Name of machine is stored in a file because the + * non-volatile RAM on the porting base is not large enough + * to hold an internet protocol hostname. If a machine + * has non-volatile RAM which is large enough, however, it + * would be preferable to store the nodename there. + */ + if (vn_open("/etc/nodename", UIO_SYSSPACE, FREAD, 0, &vp) == 0) { + if (vn_rdwr(UIO_READ, vp, (caddr_t)buf, SYS_NMLN-1, 0, + UIO_SYSSPACE, 0, 0, u.u_cred, &resid) == 0) { + len = (SYS_NMLN - 1) - resid; + if (len != 0) { + strncpy(utsname.nodename, buf, len); + utsname.nodename[len] = '\0'; + } + } + } /* * Get the release and version of the system. */ @@ -647,8 +666,14 @@ inituname() strncpy(utsname.version, version, SYS_NMLN-1); utsname.version[SYS_NMLN-1] = '\0'; } + cmn_err(CE_CONT, "\nUNIX(R) System V Release %s AT&T %s Version %s\n", + utsname.release, utsname.machine, utsname.version); + cmn_err(CE_CONT, "Node %s\n", utsname.nodename); + cmn_err(CE_CONT, "Total real memory = %d\n", ctob(physmem)); + return; } + /* * Machine-dependent startup code. */ @@ -656,11 +681,6 @@ inituname() void startup() { - /* - * This is for (pre-4.0 binary drivers) backward compatibility. - */ - fix_swtbls(); - /* * Confirm that the configured number of supplementary groups * is between the min and the max. If not, print a message @@ -700,9 +720,5 @@ devinit() extern dev_t icdmkdev(); rootdev = icdmkdev(ICDROOT); - swapfile.bo_size = 400; /* The size of swap partition - in ICD. This value should - consistent with the swap - size in the ICD vtoc. */ } } diff --git a/usr/src/uts/3b2/os/streamio.c b/usr/src/uts/3b2/os/streamio.c index 32f0c4a..fbb54d7 100644 --- a/usr/src/uts/3b2/os/streamio.c +++ b/usr/src/uts/3b2/os/streamio.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/streamio.c 1.83" +#ident "@(#)kernel:os/streamio.c 1.75.1.13" #include "sys/types.h" #include "sys/sysmacros.h" @@ -39,7 +39,6 @@ #include "sys/sad.h" #include "sys/priocntl.h" #include "sys/hrtcntl.h" -#include "sys/jioctl.h" #include "sys/procset.h" #include "sys/events.h" #include "sys/evsys.h" @@ -53,6 +52,10 @@ */ STATIC long ioc_id; +/* + * id value used to distinguish between different multiplexor links + */ +STATIC long lnk_id; /* * Qinit structure and Module_info structures @@ -66,8 +69,6 @@ struct qinit stwdata = { NULL, strwsrv, NULL, NULL, NULL, &stwm_info, NULL }; extern struct streamtab fifoinfo; extern char qrunflag; -extern long Strcount; -extern long strthresh; STATIC int strhold = 1; /* switch for small message consolidation feature */ @@ -85,14 +86,13 @@ stropen(vp, devp, flag, crp) register struct stdata *stp; register queue_t *qp; register int s; - dev_t dummydev, savedev; + pid_t *oldttyp = u.u_ttyp; + dev_t dummydev; struct autopush *ap; int error = 0; int freed = 0; extern vnode_t *specfind(); - savedev = *devp; - /* * If the stream already exists, wait for any open in progress * to complete, then call the open function of each module and @@ -140,7 +140,7 @@ stropen(vp, devp, flag, crp) if (qp->q_flag & QOLD) { /* old interface */ dev_t oldev; - /* check if dev is too large for old interface */ + /* check if dev is too large for old interface */ if ((oldev = cmpdev(*devp)) == NODEV){ error = ENXIO; break; @@ -183,8 +183,10 @@ stropen(vp, devp, flag, crp) strclose(vp, flag, crp); } } + } else { + strctty(stp, oldttyp, flag); } - wakeprocs((caddr_t)stp, PRMPT); + wakeup((caddr_t)stp); return (error); } @@ -192,13 +194,8 @@ stropen(vp, devp, flag, crp) * This vnode isn't streaming. SPECFS already * checked for multiple vnodes pointing to the * same stream, so create a stream to the driver. - * - * firewall - don't use too much memory */ - if (strthresh && (Strcount > strthresh) && !suser(u.u_cred)) - return (ENOSR); - if (!(qp = allocq())) { cmn_err(CE_CONT, "stropen: out of queues\n"); return (ENOSR); @@ -223,8 +220,8 @@ stropen(vp, devp, flag, crp) stp->sd_mark = NULL; stp->sd_closetime = STRTIMOUT * HZ; splx(s); - stp->sd_sidp = NULL; - stp->sd_pgidp = NULL; + stp->sd_sid = 0; + stp->sd_pgrp = 0; stp->sd_vnode = vp; stp->sd_rerror = 0; stp->sd_werror = 0; @@ -320,7 +317,7 @@ stropen(vp, devp, flag, crp) s = splstr(); stp->sd_flag &= ~STWOPEN; splx(s); - wakeprocs((caddr_t)stp, PRMPT); + wakeup((caddr_t)stp); if (error) { if (!freed) { vp->v_stream = NULL; @@ -331,6 +328,7 @@ stropen(vp, devp, flag, crp) return (error); } + strctty(stp, oldttyp, flag); return (0); } @@ -364,13 +362,6 @@ strclose(vp, flag, crp) ASSERT(stp->sd_pollist.ph_list == NULL); - /* freectty should have been called by now */ - ASSERT(stp->sd_sidp == NULL); - - /* cleanup any possible sockets references */ - if (stp->sd_pgidp != NULL) - PID_RELE(stp->sd_pgidp); - s = splstr(); stp->sd_flag |= STRCLOSE; @@ -405,9 +396,6 @@ strclose(vp, flag, crp) putnext(qp, mp); } - stp->sd_flag &= ~(STRDERR|STWRERR); /* help unlink succeed */ - stp->sd_rerror = 0; - stp->sd_werror = 0; (void) munlinkall(stp, LINKCLOSE|LINKNORMAL, crp, &rval); while (SAMESTR(qp)) { @@ -468,7 +456,7 @@ strclose(vp, flag, crp) vp->v_stream = NULL; stp->sd_flag &= ~STRCLOSE; splx(s); - wakeprocs((caddr_t)stp, PRMPT); + wakeup((caddr_t)stp); shfree(stp); return (0); } @@ -490,6 +478,14 @@ strclean(vp) stp = vp->v_stream; psep = NULL; s = splstr(); + if ((stp->sd_pgrp < 0) && (-stp->sd_pgrp == u.u_procp->p_pid)) { + /* + * This is a compromise rather than searching the list + * of stream heads when the process exits. + */ + stp->sd_pgrp = 0; + stp->sd_procp = 0; + } sep = stp->sd_siglist; while (sep) { if (sep->se_procp == u.u_procp) { @@ -653,7 +649,7 @@ strread(vp, uiop, crp) case M_DATA: ismdata: - if (msgdsize(bp) == 0) { + if ((bp->b_wptr - bp->b_rptr) == 0) { if (mark || delim) { freemsg(bp); } else if (rflg) { @@ -871,10 +867,7 @@ strrput(q, bp) */ if (stp->sd_flag & RSLEEP) { stp->sd_flag &= ~RSLEEP; - if (stp->sd_vnode->v_type == VFIFO) - wakeprocs((caddr_t)q, NOPRMPT); /*don't thrash*/ - else - wakeprocs((caddr_t)q, PRMPT); + wakeupnp((caddr_t)q); } putq(q, bp); @@ -947,9 +940,9 @@ strrput(q, bp) } splx(s); if (rw) { - wakeprocs((caddr_t)q, PRMPT); /* readers */ - wakeprocs((caddr_t)WR(q), PRMPT); /* writers */ - wakeprocs((caddr_t)stp, PRMPT); /* ioctllers */ + wakeup((caddr_t)q); /* the readers */ + wakeup((caddr_t)WR(q)); /* the writers */ + wakeup((caddr_t)stp); /* the ioctllers */ s = splstr(); if (stp->sd_sigflags & S_ERROR) @@ -976,9 +969,9 @@ strrput(q, bp) stp->sd_rerror = *bp->b_rptr; stp->sd_werror = *bp->b_rptr; splx(s); - wakeprocs((caddr_t)q, PRMPT); /* the readers */ - wakeprocs((caddr_t)WR(q), PRMPT); /* the writers */ - wakeprocs((caddr_t)stp, PRMPT); /* the ioctllers */ + wakeup((caddr_t)q); /* the readers */ + wakeup((caddr_t)WR(q)); /* the writers */ + wakeup((caddr_t)stp); /* the ioctllers */ s = splstr(); if (stp->sd_sigflags & S_ERROR) @@ -1010,23 +1003,28 @@ strrput(q, bp) /* * send signal if controlling tty */ - - if (stp->sd_sidp) { - prsignal(stp->sd_sidp, SIGHUP); - if (stp->sd_sidp != stp->sd_pgidp) - pgsignal(stp->sd_pgidp, SIGTSTP); + if (stp->sd_sid) { + ASSERT(stp->sd_pgrp >= 0); + psignal(prfind(stp->sd_sid), SIGHUP); + if (stp->sd_sid != stp->sd_pgrp) + signal(stp->sd_pgrp, SIGTSTP); } - wakeprocs((caddr_t)q, PRMPT); /* the readers */ - wakeprocs((caddr_t)WR(q), PRMPT); /* the writers */ - wakeprocs((caddr_t)stp, PRMPT); /* the ioctllers */ + wakeup((caddr_t)q); /* the readers */ + wakeup((caddr_t)WR(q)); /* the writers */ + wakeup((caddr_t)stp); /* the ioctllers */ /* * wake up read, write, and exception pollers and * reset wakeup mechanism. */ - - strhup(stp); + s = splstr(); + if (stp->sd_sigflags & S_HANGUP) + strsendsig(stp->sd_siglist, S_HANGUP, 0L); + pollwakeup(&stp->sd_pollist, POLLHUP); + if (stp->sd_eventflags & S_HANGUP) + strevpost(stp, S_HANGUP, 0L); + splx(s); return; @@ -1152,18 +1150,11 @@ strrput(q, bp) if (mp->b_datap->db_type == M_PASSFP) closef(((struct strrecvfd *) mp->b_rptr)->f.fp); - rmvq(q, mp); - freemsg(mp); + rmvq(q, mp); + freemsg(mp); } mp = nmp; } - if (mp && mp->b_band == pri) { - if (mp->b_datap->db_type == M_PASSFP) - closef(((struct strrecvfd *) - mp->b_rptr)->f.fp); - rmvq(q, mp); - freemsg(mp); - } } } else { /* flush entire queue */ mp = q->q_first; @@ -1185,7 +1176,7 @@ strrput(q, bp) freemsg(mp); mp = nmp; } - bzero((caddr_t)qbf, NBAND); + bzero((caddr_t)qbf, 256); bpri = 1; for (qbp = q->q_bandp; qbp; qbp = qbp->qb_next) { if ((qbp->qb_flag & QB_WANTW) && @@ -1256,7 +1247,7 @@ strrput(q, bp) */ stp->sd_iocblk = bp; splx(s); - wakeprocs((caddr_t)stp, PRMPT); + wakeup((caddr_t)stp); return; case M_COPYIN: @@ -1291,7 +1282,7 @@ strrput(q, bp) */ stp->sd_iocblk = bp; splx(s); - wakeprocs((caddr_t)stp, PRMPT); + wakeup((caddr_t)stp); return; case M_SETOPTS: @@ -1387,8 +1378,6 @@ strrput(q, bp) #ifndef _STYPES if (sop->so_flags & SO_NODELIM) stp->sd_flag &= ~STRDELIM; - if (sop->so_flags & SO_STRHOLD) - stp->sd_flag |= STRHOLD; #endif /* _STYPES */ freemsg(bp); @@ -1503,19 +1492,9 @@ strwrite(vp, uiop, crp) if (error = straccess(stp, JCWRITE)) return (error); - /* this is for POSIX compatibility */ - if (stp->sd_flag & STRHUP) - return(EIO); - if (stp->sd_flag & (STWRERR|STPLEX)) + if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) return ((stp->sd_flag & STPLEX) ? EINVAL : stp->sd_werror); - /* - * firewall - don't use too much memory - */ - - if (strthresh && (Strcount > strthresh) && !suser(u.u_cred)) - return (ENOSR); - /* * Check the min/max packet size constraints. If min packet size * is non-zero, the write cannot be split into multiple messages @@ -1613,21 +1592,23 @@ strwrite(vp, uiop, crp) iosize = uiop->uio_resid; else iosize = MIN(uiop->uio_resid, rmax); - if ((error = strmakemsg((struct strbuf *)NULL, - iosize, uiop, stp, (long)0, &)) || !amp) + if (error = strmakemsg((struct strbuf *)NULL, + iosize, uiop, stp, (long)0, &)) return (error); mp = amp; /* - * When explicitly enabled (typically for TTYs), check to - * see if data might be coalesced for better performance. - * * Policy: Use the size of this write as predictor of the * size of the next write. If this msg buffer has space for * another write of the same size, hold onto it for a while. + * + * Since pipes are sometimes used with small (single byte) + * writes as a "fast" interprocess sychronization mechanism, + * the hold feature is disabled for streams pipes. */ - if (strhold && (stp->sd_flag & STRHOLD) && - size <= (mp->b_datap->db_lim - mp->b_wptr)) { + if (strhold && (vp->v_type != VFIFO) && + size <= (mp->b_datap->db_lim - mp->b_wptr) && + size == iosize && !(stp->sd_flag & STRDELIM)) { extern struct queue *scanqhead, *scanqtail; extern strscanflag; @@ -1704,10 +1685,7 @@ strwsrv(q) if (stp->sd_flag & WSLEEP) { stp->sd_flag &= ~WSLEEP; - if (stp->sd_vnode->v_type == VFIFO) - wakeprocs((caddr_t)q, NOPRMPT); /*don't thrash*/ - else - wakeprocs((caddr_t)q, PRMPT); + wakeupnp((caddr_t)q); } if ((tq = q->q_next) == NULL) { @@ -1732,7 +1710,7 @@ strwsrv(q) isevent = 0; i = 1; - bzero((caddr_t)qbf, NBAND); + bzero((caddr_t)qbf, 256); myqbp = q->q_bandp; for (qbp = tq->q_bandp; qbp; qbp = qbp->qb_next) { ASSERT(myqbp); @@ -1778,6 +1756,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) struct strioctl strioc; struct uio uio; struct iovec iov; + pid_t *oldttyp = u.u_ttyp; enum jcaccess access; int error = 0; int done = 0; @@ -1787,24 +1766,6 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) ASSERT(copyflag == U_TO_K || copyflag == K_TO_K); stp = vp->v_stream; - /* - * if a message is being "held" awaiting possible consolidation, - * send it downstream before processing ioctl. - */ - { - register queue_t *q = stp->sd_wrq; - register mblk_t *mp; - - s = splstr(); - if (mp = q->q_first) { - q->q_first = NULL; - - splx(s); - putnext(q, mp); - } - else splx(s); - } - switch (cmd) { case I_RECVFD: case I_E_RECVFD: @@ -1820,8 +1781,6 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) case TCGETS: case TIOCGETP: case TIOCGPGRP: - case SIOCGPGRP: - case JWINSIZE: case TIOCGSID: case TIOCMGET: case LDGETT: @@ -1973,6 +1932,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) case I_NREAD: case FIONREAD: + case FIORDCHK: /* * Return number of bytes of data in first message * in queue in "arg" and return the number of messages @@ -1991,23 +1951,6 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) *rvalp = qsize(RD(stp->sd_wrq)); return (error); } - case FIORDCHK: - /* - * FIORDCHK does not use arg value (like FIONREAD), - * instead a count is returned. I_NREAD value may - * not be accurate but safe. The real thing to do is - * to add the msgdsizes of all data messages until - * a non-data message. - */ - { - int size = 0; - mblk_t *bp; - - if (bp = RD(stp->sd_wrq)->q_first) - size = msgdsize(bp); - *rvalp = size; - return (0); - } case I_FIND: /* @@ -2055,13 +1998,6 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) return (ENXIO); if (stp->sd_pushcnt >= nstrpush) return (EINVAL); - - /* - * firewall - don't use too much memory - */ - - if (strthresh && (Strcount > strthresh) && !suser(u.u_cred)) - return (ENOSR); /* * Get module name and look up in fmodsw. @@ -2095,6 +2031,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) dummydev = vp->v_rdev; if ((error = qattach(RD(stp->sd_wrq), &dummydev, 0, FMODSW, i, crp)) == 0) { + strctty(stp, oldttyp, flag); stp->sd_pushcnt++; } @@ -2113,7 +2050,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) s = splstr(); stp->sd_flag &= ~STWOPEN; splx(s); - wakeprocs((caddr_t)stp, PRMPT); + wakeup((caddr_t)stp); return (error); } @@ -2226,9 +2163,9 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) * waiting on the lower stream. These will all * error out. */ - wakeprocs((caddr_t)rq, PRMPT); - wakeprocs((caddr_t)WR(rq), PRMPT); - wakeprocs((caddr_t)stpdown, PRMPT); + wakeup((caddr_t)rq); + wakeup((caddr_t)WR(rq)); + wakeup((caddr_t)stpdown); *rvalp = linkp->li_lblk.l_index; return (0); } @@ -2245,6 +2182,8 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) struct linkinfo *linkp; int type; + if (stp->sd_flag & STRHUP) + return (ENXIO); if (vp->v_type == VFIFO) return (EINVAL); if (cmd == I_UNLINK) @@ -2274,7 +2213,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) * FLUSHRW - flush read/write queue */ if (stp->sd_flag & STRHUP) - return (ENXIO); + return (EINVAL); if (arg & ~FLUSHRW) return (EINVAL); while (!putctl1(stp->sd_wrq->q_next, M_FLUSH, arg)) @@ -2295,7 +2234,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) if (error) return (error); if (stp->sd_flag & STRHUP) - return (ENXIO); + return (EINVAL); if (binfo.bi_flag & ~FLUSHRW) return (EINVAL); while (!(mp = allocb(2, BPRI_HI))) { @@ -2779,9 +2718,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) long rmin, rmax; int strmakemsg(); - if (stp->sd_flag & STRHUP) - return (ENXIO); - if (stp->sd_flag & (STRDERR|STWRERR|STPLEX)) + if (stp->sd_flag & (STRDERR|STWRERR|STRHUP|STPLEX)) return ((stp->sd_flag & STPLEX) ? EINVAL : (stp->sd_werror ? stp->sd_werror : stp->sd_rerror)); error = strcopyin((caddr_t)arg, (caddr_t)&strfdinsert, @@ -2858,9 +2795,9 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) UIO_SYSSPACE; uio.uio_fmode = 0; uio.uio_resid = iov.iov_len; - if ((error = strmakemsg(&strfdinsert.ctlbuf, + if (error = strmakemsg(&strfdinsert.ctlbuf, strfdinsert.databuf.len, &uio, stp, - strfdinsert.flags, &mp)) || !mp) + strfdinsert.flags, &mp)) return (error); /* @@ -2902,8 +2839,8 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) mp->b_wptr += sizeof(struct strrecvfd); mp->b_datap->db_type = M_PASSFP; srf->f.fp = fp; - srf->uid = u.u_cred->cr_uid; - srf->gid = u.u_cred->cr_gid; + srf->uid = crp->cr_uid; + srf->gid = crp->cr_gid; fp->f_count++; strrput(qp, mp); return (0); @@ -3075,7 +3012,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) queue_t *q = RD(stp->sd_wrq); qband_t *qbp; - if ((arg < 0) || (arg >= NBAND)) + if (arg < 0) return (EINVAL); if (arg > (int)q->q_nband) { *rvalp = 0; @@ -3134,7 +3071,7 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) { char band; - if ((arg < 0) || (arg >= NBAND)) + if ((arg > 255) || (arg < 0)) return (EINVAL); band = (char)arg; *rvalp = bcanput(stp->sd_wrq->q_next, band); @@ -3174,110 +3111,82 @@ strioctl(vp, cmd, arg, flag, copyflag, crp, rvalp) return (error); } - case TIOCSSID: + case TIOCGSID: { - pid_t sid; - register error; - - if (stp->sd_sidp != u.u_procp->p_sessp->s_sidp) - return ENOTTY; - if (error = strcopyin(arg, (caddr_t)&sid, sizeof(pid_t), - STRPIDT, copyflag)) - return error; - return realloctty(u.u_procp, sid); + pid_t sid = stp->sd_sid; + return strcopyout((caddr_t)&sid, arg, sizeof(pid_t), + STRPIDT, copyflag); } - case TIOCGSID: - if (stp->sd_sidp == NULL) - return ENOTTY; - return strcopyout((caddr_t)&stp->sd_sidp->pid_id, - arg, sizeof(pid_t), STRPIDT, copyflag); + case TIOCGPGRP: + { + pid_t pgrp = stp->sd_pgrp; + + if (u.u_procp->p_sessp->s_sid != stp->sd_sid) + return (ENOTTY); + if (pgrp == 0) + return (EACCES); + if (pgrp < 0) /* it's a socket, not a terminal */ + return (EINVAL); + return (strcopyout((caddr_t)&pgrp, arg, sizeof(pid_t), + STRPIDT, copyflag)); + } case TIOCSPGRP: { - pid_t pgrp; - proc_t *q, *pgfind(); - + pid_t pgrp; - if (stp->sd_sidp != u.u_procp->p_sessp->s_sidp) - return ENOTTY; + if (u.u_procp->p_sessp->s_sid != stp->sd_sid) + return (ENOTTY); if (error = strcopyin(arg, (caddr_t)&pgrp, sizeof(pid_t), - STRPIDT, copyflag)) + STRPIDT, copyflag)) return (error); - if (pgrp == stp->sd_pgidp->pid_id) - return 0; if (pgrp <= 0 || pgrp >= MAXPID) - return EINVAL; - if ((q = pgfind(pgrp)) == NULL - || q->p_sessp != u.u_procp->p_sessp) - return EPERM; - PID_RELE(stp->sd_pgidp); - stp->sd_pgidp = q->p_pgidp; - PID_HOLD(stp->sd_pgidp); - return 0; + return (EINVAL); + if (!checkpg(u.u_procp->p_sessp->s_sid, pgrp)) + return (EPERM); + stp->sd_pgrp = pgrp; + return (0); } - case TIOCGPGRP: - if (stp->sd_sidp == NULL) - return ENOTTY; - return strcopyout((caddr_t)&stp->sd_pgidp->pid_id, - arg, sizeof(pid_t), STRPIDT, copyflag); - /* * The next two are for sockets. The user expects pgrp * to be positive for a process id and negative for a * process group. The stream head stores it oppositely. */ + case SIOCGPGRP: + { + pid_t pgrp = -stp->sd_pgrp; + + return (strcopyout((caddr_t)&pgrp, arg, sizeof(pid_t), + STRPIDT, copyflag)); + } case SIOCSPGRP: { - pid_t pid; - proc_t *prp; - struct pid *pidp; - - if (stp->sd_sidp != NULL) - return EPERM; - if (error = strcopyin(arg, (caddr_t)&pid, sizeof(pid_t), - STRPIDT, copyflag)) - return error; - if (pid == 0) - pidp = NULL; - else if (pid < 0) { /* it's a pgrp */ - if ((prp = pgfind(-pid)) == NULL) - return ESRCH; - if (prp->p_sessp != u.u_procp->p_sessp) - return EPERM; - pidp = prp->p_pgidp; - stp->sd_flag &= ~STRPID; + pid_t pgrp; + + if (stp->sd_sid != 0) + return (EPERM); + if (error = strcopyin(arg, (caddr_t)&pgrp, sizeof(pid_t), + STRPIDT, copyflag)) + return (error); + if (pgrp == 0) + return (EINVAL); + if (pgrp < 0) { /* it's a pgrp */ + pgrp = -pgrp; + if (pgrp >= MAXPID) + return (EINVAL); + if (!checkpg(u.u_procp->p_sessp->s_sid, pgrp)) + return (EPERM); } else { /* it's a pid */ - if ((prp = prfind(pid)) == NULL) - return ESRCH; - if (prp->p_sessp != u.u_procp->p_sessp) - return EPERM; - pidp = prp->p_pidp; - stp->sd_flag |= STRPID; - } - if (pidp != stp->sd_pgidp) { - if (pidp != NULL) - PID_HOLD(pidp); - if (stp->sd_pgidp != NULL) - PID_RELE(stp->sd_pgidp); - stp->sd_pgidp = pidp; + if (pgrp != u.u_procp->p_pid) + return (EINVAL); + pgrp = -pgrp; + stp->sd_procp = u.u_procp; } - return 0; - } - - case SIOCGPGRP: - { - pid_t pid; - if (stp->sd_pgidp != NULL) { - pid = stp->sd_pgidp->pid_id; - if (!(stp->sd_flag & STRPID)) - pid = -pid; - } else - pid = 0; - return (strcopyout((caddr_t)&pid, arg, sizeof(pid_t), - STRPIDT, copyflag)); + stp->sd_pgrp = pgrp; + return (0); } case FIONBIO: @@ -3472,7 +3381,7 @@ strdoioctl(stp, strioc, ebp, copyflag, fmtp, crp, rvalp) if (strioc->ic_timout >= 0) untimeout(id); splx(s); - wakeprocs((caddr_t)&(stp->sd_iocwait), PRMPT); + wakeup((caddr_t)&(stp->sd_iocwait)); crfree(crp); return (error); } @@ -3509,7 +3418,7 @@ strdoioctl(stp, strioc, ebp, copyflag, fmtp, crp, rvalp) } else freemsg(bp); } - wakeprocs((caddr_t)&(stp->sd_iocwait), PRMPT); + wakeup((caddr_t)&(stp->sd_iocwait)); crfree(crp); return (error); } @@ -3522,7 +3431,7 @@ strdoioctl(stp, strioc, ebp, copyflag, fmtp, crp, rvalp) if (strioc->ic_timout >= 0) untimeout(id); splx(s); - wakeprocs((caddr_t)&(stp->sd_iocwait), PRMPT); + wakeup((caddr_t)&(stp->sd_iocwait)); } else { splx(s); } @@ -4016,13 +3925,6 @@ strputmsg(vp, mctl, mdata, pri, flag, fmode) if (stp->sd_flag & (STRHUP|STWRERR|STPLEX)) return ((stp->sd_flag & STPLEX) ? EINVAL : stp->sd_werror); - /* - * firewall - don't use too much memory - */ - - if (strthresh && (Strcount > strthresh) && !suser(u.u_cred)) - return (ENOSR); - /* * Check for legal flag value. */ @@ -4080,7 +3982,7 @@ strputmsg(vp, mctl, mdata, pri, flag, fmode) uio.uio_segflg = UIO_USERSPACE; uio.uio_fmode = 0; uio.uio_resid = iov.iov_len; - if ((error = strmakemsg(mctl, mdata->len, &uio, stp, (long)flag, &mp)) || !mp) + if (error = strmakemsg(mctl, mdata->len, &uio, stp, (long)flag, &mp)) return (error); mp->b_band = pri; diff --git a/usr/src/uts/3b2/os/strsubr.c b/usr/src/uts/3b2/os/strsubr.c index 18acbab..7ef3186 100644 --- a/usr/src/uts/3b2/os/strsubr.c +++ b/usr/src/uts/3b2/os/strsubr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/strsubr.c 1.32" +#ident "@(#)kernel:os/strsubr.c 1.23.1.7" #include "sys/types.h" #include "sys/sysmacros.h" @@ -81,7 +81,7 @@ struct queue *scanqtail; /* last queue */ char strbcwait; /* bufcall functions waiting */ char strbcflag; /* bufcall functions ready to go */ struct bclist strbcalls; /* list of waiting bufcalls */ -unsigned char qbf[NBAND]; /* band flushing backenable flags */ +unsigned char qbf[256]; /* band flushing backenable flags */ int strscanflag; /* true when strscan timeout is pending */ struct strstat strst; /* Streams statistics structure */ @@ -91,17 +91,8 @@ struct strstat strst; /* Streams statistics structure */ */ struct msgb *msgfreelist; struct mdbblock *mdbfreelist; -STATIC struct seinfo *sefreelist; STATIC struct mux_node *mux_nodes; /* mux info for cycle checking */ -#define SECACHE 10 -STATIC struct seinfo Secache[SECACHE]; /* emergency cache of seinfo's */ - /* in case memory runs out */ -STATIC struct seinfo *secachep; /* cache list head */ -struct strinfo Strinfo[NDYNAMIC]; /* dynamic resource info */ -long Strcount; /* count of streams resources */ - /* in bytes */ -extern long strthresh; /* threshold for stopping some */ - /* streams operations */ +struct strinfo Strinfo[NDYNAMIC]; /* dynamic resource info */ extern struct qinit strdata; extern struct qinit stwdata; @@ -127,17 +118,6 @@ strinit() */ mdbfreelist = NULL; msgfreelist = NULL; - - /* - * set up seinfo cache (if memory runs out, we need a few of - * these so things have a chance to recover) - */ - sefreelist = NULL; - for (i = 0; i < SECACHE; ++i) { - Secache[i].s_next = secachep; - secachep = &Secache[i]; - } - /* * Set up mux_node structures. */ @@ -183,11 +163,9 @@ strgiveback() n = mdbfree >> 3; for (j = 0; j < n; ++j) { mdbp = mdbfreelist; - mdbfreelist = - (struct mdbblock *)( mdbp->msgblk.m_mblock.b_next); + mdbfreelist = (struct mdbblock *)( mdbp->msgblk.b_next); kmem_free(mdbp, sizeof(struct mdbblock)); Strinfo[DYN_MDBBLOCK].sd_cnt--; - Strcount -= sizeof(struct mdbblock); } } if (msgfree > msgavguse) { @@ -196,9 +174,8 @@ strgiveback() for (j = 0; j < n; ++j) { msgp = msgfreelist; msgfreelist = msgp->b_next; - kmem_free(msgp, sizeof(struct mbinfo)); + kmem_free(msgp, sizeof(struct msgb)); Strinfo[DYN_MSGBLOCK].sd_cnt--; - Strcount -= sizeof(struct mbinfo); } } timeout(strgiveback, 0, 60 * HZ); @@ -488,7 +465,7 @@ strtime(stp) struct stdata *stp; { if (stp->sd_flag & STRTIME) { - wakeprocs((caddr_t)stp->sd_wrq, PRMPT); + wakeup((caddr_t)stp->sd_wrq); stp->sd_flag &= ~STRTIME; } } @@ -507,7 +484,7 @@ str2time(stp) struct stdata *stp; { if (stp->sd_flag & STR2TIME) { - wakeprocs((caddr_t)&stp->sd_iocwait, PRMPT); + wakeup((caddr_t)&stp->sd_iocwait); stp->sd_flag &= ~STR2TIME; } } @@ -526,7 +503,7 @@ str3time(stp) struct stdata *stp; { if (stp->sd_flag & STR3TIME) { - wakeprocs((caddr_t)stp, PRMPT); + wakeup((caddr_t)stp); stp->sd_flag &= ~STR3TIME; } } @@ -670,7 +647,6 @@ alloclink(qup, qdown, fpdown) linkp->li_fpdown = fpdown; BUMPUP(strst.linkblk); Strinfo[DYN_LINKBLK].sd_cnt++; - Strcount += sizeof(struct linkinfo); linkp->li_next = (struct linkinfo *) Strinfo[DYN_LINKBLK].sd_head; if (linkp->li_next) linkp->li_next->li_prev = linkp; @@ -702,7 +678,6 @@ lbfree(linkp) } kmem_free(linkp, sizeof(struct linkinfo)); Strinfo[DYN_LINKBLK].sd_cnt--; - Strcount -= sizeof(struct linkinfo); strst.linkblk.use--; splx(s); return; @@ -1034,7 +1009,6 @@ strmakemsg(mctl, count, uiop, stp, flag, mpp) */ if ((mctl != NULL) && (mctl->len >= 0)) { register int ctlcount; - int allocsz; if (flag & RS_HIPRI) msgtype = M_PCPROTO; @@ -1044,22 +1018,13 @@ strmakemsg(mctl, count, uiop, stp, flag, mpp) ctlcount = mctl->len; base = mctl->buf; - /* - * Give modules a better chance to reuse M_PROTO/M_PCPROTO - * blocks by increasing the size to something more usable. - */ - allocsz = MAX(ctlcount, 64); - /* * Range checking has already been done; simply try * to allocate a message block for the ctl part. */ - while (!(bp = allocb(allocsz, pri))) { - if (uiop->uio_fmode & (FNDELAY|FNONBLOCK)) - return (EAGAIN); - if (error = strwaitbuf(allocsz, pri)) + while (!(bp = allocb(ctlcount, pri))) + if (error = strwaitbuf(ctlcount, pri)) return (error); - } bp->b_datap->db_type = msgtype; if (copyin(base, (caddr_t) bp->b_wptr, ctlcount)) { @@ -1089,14 +1054,11 @@ strmakemsg(mctl, count, uiop, stp, flag, mpp) register int size; size = count + (offlg ? 0 : wroff); - while ((bp = allocb(size, pri)) == NULL) { - if (uiop->uio_fmode & (FNDELAY|FNONBLOCK)) - return (EAGAIN); + while ((bp = allocb(size, pri)) == NULL) if (error = strwaitbuf(size, pri)) { freemsg(mp); return (error); } - } if (wroff && !offlg++ && (wroff < bp->b_datap->db_lim - bp->b_wptr)) { bp->b_rptr += wroff; @@ -1211,7 +1173,6 @@ strwaitq(stp, flag, count, fmode, done) caddr_t slpadr; mblk_t *mp; long *rd_count; - int bid; if (fmode & (FNDELAY|FNONBLOCK)) { if (!(flag & NOINTR)) @@ -1234,9 +1195,8 @@ strwaitq(stp, flag, count, fmode, done) if ((flag & READWAIT) && (stp->sd_flag & SNDMREAD)) { while ((mp = allocb(sizeof(long), BPRI_MED)) == NULL) { s = splstr(); - bid = bufcall(sizeof(long), BPRI_MED, strqbuf, - stp); - if (bid == 0) { + if (bufcall(sizeof(long), BPRI_MED, strqbuf, + stp) == 0) { splx(s); *done = 1; return (EAGAIN); @@ -1246,7 +1206,6 @@ strwaitq(stp, flag, count, fmode, done) if (stp->sd_flag & RDBUFWAIT) { /* interrupted sleep */ stp->sd_flag &= ~RDBUFWAIT; - unbufcall(bid); splx(s); *done = 1; return (EINTR); @@ -1287,7 +1246,7 @@ strwaitq(stp, flag, count, fmode, done) if (sleep(slpadr, slppri|PCATCH)) { stp->sd_flag &= ~slpflg; splx(s); - wakeprocs(slpadr, PRMPT); + wakeup(slpadr); if (!(flag & NOINTR)) error = EINTR; *done = 1; @@ -1372,74 +1331,55 @@ strqbuf(stp) s = splstr(); stp->sd_flag &= ~RDBUFWAIT; splx(s); - wakeprocs((caddr_t)RD(stp->sd_wrq), PRMPT); + wakeup((caddr_t)RD(stp->sd_wrq)); } } +/* + * Allocate a controlling terminal. + */ +int +strctty(stp, oldttyp, flag) + register struct stdata *stp; + pid_t *oldttyp; + int flag; +{ + register proc_t *pp = u.u_procp; + + if (stp->sd_flag & (STRHUP|STRDERR|STWRERR|STPLEX)) { + if ((oldttyp == NULL) && (u.u_ttyp != NULL)) { + *u.u_ttyp = 0; + u.u_ttyp = NULL; + } + return; + } + if (oldttyp == NULL && u.u_ttyp != NULL) { + stp->sd_flag |= STRISTTY; + realloctty(stp->sd_vnode); + } else if (((stp->sd_flag & (STRISTTY|STRCTTY)) == STRISTTY) && + (stp->sd_sid == 0) && (stp->sd_rerror == 0) && + (stp->sd_werror == 0) && !(flag & FNOCTTY) && + (pp->p_sessp->s_sid == pp->p_pid) && + (cttydev(pp) == NODEV)) { + alloctty(pp, stp->sd_vnode, &stp->sd_sid, &stp->sd_pgrp); + stp->sd_flag |= STRCTTY; + } +} + /* * Perform job control discipline access checks. * Return 0 for success and the errno for failure. */ - -#define cantsend(pp,sig) \ - (sigismember(&pp->p_ignore,sig) || sigismember(&pp->p_hold,sig)) - int straccess(stp, mode) struct stdata *stp; enum jcaccess mode; { - register proc_t *pp; - register sess_t *sp; - - if (stp->sd_sidp == NULL) - return 0; - - pp = u.u_procp; - sp = pp->p_sessp; - - for (;;) { - - /* - * if this is not the calling process's controlling terminal - * or the calling process is already in the foreground - * then allow access - */ + register struct proc *p = u.u_procp; - if (sp->s_dev != stp->sd_vnode->v_rdev - || pp->p_pgidp == stp->sd_pgidp) - return 0; - - /* - * check to see if controlling terminal has been deallocated - */ - - if (sp->s_vp == NULL) { - if (cantsend(pp,SIGHUP)) - return EIO; - pgsignal(pp->p_pgidp, SIGHUP); - } - - else if (mode == JCGETP) - return 0; - - else if (mode == JCREAD) { - if (cantsend(pp,SIGTTIN) || pp->p_detached) - return EIO; - pgsignal(pp->p_pgidp,SIGTTIN); - } - - else { /* mode == JCWRITE or JCSETP */ - if (mode == JCWRITE && !(stp->sd_flag & STRTOSTOP) - || cantsend(pp,SIGTTOU)) - return 0; - if (pp->p_detached) - return EIO; - pgsignal(pp->p_pgidp, SIGTTOU); - } - - (void) sleep((caddr_t)&lbolt, STIPRI); - } + if (!(stp->sd_flag & STRCTTY)) + return (0); + return (accsctty(stp->sd_vnode, mode, stp->sd_flag&STRTOSTOP)); } /* @@ -1487,7 +1427,6 @@ shalloc(qp) stp->sd_wrq = WR(qp); BUMPUP(strst.stream); Strinfo[DYN_STREAM].sd_cnt++; - Strcount += sizeof(struct shinfo); shp->sh_next = (struct shinfo *) Strinfo[DYN_STREAM].sd_head; if (shp->sh_next) shp->sh_next->sh_prev = shp; @@ -1521,7 +1460,6 @@ shfree(stp) } kmem_free(shp, sizeof(struct shinfo)); Strinfo[DYN_STREAM].sd_cnt--; - Strcount -= sizeof(struct shinfo); strst.stream.use--; splx(s); return; @@ -1540,15 +1478,13 @@ xmsgalloc() { register struct msgb *mp; - if ((mp = (struct msgb *) kmem_zalloc(sizeof(struct mbinfo), SE_NOSLP)) + if ((mp = (struct msgb *) kmem_zalloc(sizeof(struct msgb), SE_NOSLP)) == NULL) { strst.msgblock.fail++; return NULL; } BUMPUP(strst.msgblock); Strinfo[DYN_MSGBLOCK].sd_cnt++; - Strcount += sizeof(struct mbinfo); - _INSERT_MSG_INUSE((struct mbinfo *)mp); return((mblk_t *)mp); } @@ -1574,8 +1510,6 @@ xmdballoc() BUMPUP(strst.mdbblock); Strinfo[DYN_MDBBLOCK].sd_cnt++; - Strcount += sizeof(struct mdbblock); - _INSERT_MDB_INUSE(mp); return(mp); } @@ -1636,7 +1570,6 @@ allocq() BUMPUP(strst.queue); BUMPUP(strst.queue); Strinfo[DYN_QUEUE].sd_cnt += 2; - Strcount += sizeof(struct queinfo); qip->qu_next = (struct queinfo *) Strinfo[DYN_QUEUE].sd_head; if (qip->qu_next) qip->qu_next->qu_prev = qip; @@ -1683,7 +1616,6 @@ freeq(qp) qip->qu_prev->qu_next = qip->qu_next; } kmem_free(qip, sizeof(struct queinfo)); - Strcount -= sizeof(struct queinfo); /* for accounting purposes, count individually */ strst.queue.use -= 2; Strinfo[DYN_QUEUE].sd_cnt -= 2; @@ -1706,7 +1638,6 @@ allocband() return(NULL); } Strinfo[DYN_QBAND].sd_cnt++; - Strcount += sizeof(struct qbinfo); qbip->qbi_next = (struct qbinfo *) Strinfo[DYN_QBAND].sd_head; if (qbip->qbi_next) qbip->qbi_next->qbi_prev = qbip; @@ -1739,7 +1670,6 @@ freeband(qbp) qbip->qbi_prev->qbi_next = qbip->qbi_next; } kmem_free(qbip, sizeof(struct qbinfo)); - Strcount -= sizeof(struct qbinfo); Strinfo[DYN_QBAND].sd_cnt--; splx(s); return; @@ -1756,36 +1686,13 @@ sealloc(slpflag) register struct seinfo *sep; s = splstr(); - if (sefreelist) { - sep = sefreelist; - sefreelist = sep->s_next; - sep->s_strevent.se_procp = NULL; - sep->s_strevent.se_events = 0; - sep->s_strevent.se_next = NULL; - } - else if (sep = (struct seinfo *) kmem_zalloc(sizeof(struct seinfo), slpflag)) { - Strinfo[DYN_STREVENT].sd_cnt++; - Strcount += sizeof(struct seinfo); - } - else { - if (slpflag == SE_NOSLP) { - /* use the cache for these */ - if (secachep) { - sep = secachep; - secachep = secachep->s_next; - sep->s_strevent.se_procp = NULL; - sep->s_strevent.se_events = 0; - sep->s_strevent.se_next = NULL; - } - } - if (sep == NULL) { - /* failed anyhow */ - strst.strevent.fail++; - splx(s); - return(NULL); - } + if ((sep = (struct seinfo *) kmem_zalloc(sizeof(struct seinfo), slpflag)) == NULL) { + strst.strevent.fail++; + splx(s); + return(NULL); } BUMPUP(strst.strevent); + Strinfo[DYN_STREVENT].sd_cnt++; sep->s_next = (struct seinfo *) Strinfo[DYN_STREVENT].sd_head; if (sep->s_next) sep->s_next->s_prev = sep; @@ -1817,15 +1724,8 @@ sefree(sep) seip->s_next->s_prev = seip->s_prev; seip->s_prev->s_next = seip->s_next; } - if (seip >= &Secache[0] && seip <= &Secache[SECACHE]) { - /* it's from the cache */ - seip->s_next = secachep; - secachep = seip; - } - else { - seip->s_next = sefreelist; - sefreelist = seip; - } + kmem_free(seip, sizeof(struct seinfo)); + Strinfo[DYN_STREVENT].sd_cnt--; strst.strevent.use--; splx(s); return; @@ -1850,7 +1750,6 @@ queuerun() register int count; register struct strevent *sep; register qband_t *qbp; - register int nevent; mblk_t *mp; s = splstr(); @@ -1877,14 +1776,6 @@ queuerun() if (strbcflag) { strbcwait = strbcflag = 0; - /* - * count how many events are on the list - * now so we can check to avoid looping - * in low memory situations - */ - nevent = 0; - for (sep = strbcalls.bc_head; sep; sep = sep->se_next) - nevent++; /* * get estimate of available memory from kmem_avail(). * awake all bufcall functions waiting for @@ -1892,34 +1783,13 @@ queuerun() * by 'count' memory and let 'em fight for it. */ count = kmem_avail(); - while ( (sep = strbcalls.bc_head) && nevent ) { - --nevent; + while ( (sep = strbcalls.bc_head) ) { if ( sep->se_size <= count ) { strbcalls.bc_head = sep->se_next; (*sep->se_func)(sep->se_arg); sefree(sep); } - else { - /* - * too big, try again later - note - * that nevent was decremented above - * so we won't retry this one on this - * iteration of the loop - */ - strbcalls.bc_head = sep->se_next; - sep->se_next = NULL; - strbcalls.bc_tail->se_next = sep; - strbcalls.bc_tail = sep; - } } - if (strbcalls.bc_head) - /* - * still some bufcalls we couldn't do - * let kmem_free know - */ - strbcwait = 1; - else - strbcalls.bc_tail = NULL; } while (q = qhead) { @@ -1969,7 +1839,7 @@ runqueues() register s; s = splhi(); - if (qrunflag && !queueflag) { + if (qrunflag & !queueflag) { queueflag = 1; splx(s); queuerun(); @@ -2002,6 +1872,51 @@ findmod(name) } +/* + * Make sure no streams reference process group pgid. + */ +void +strclearpg(pgid) + pid_t pgid; +{ + register stdata_t *stp; + register struct shinfo *shp; + + for (shp = (struct shinfo *) Strinfo[DYN_STREAM].sd_head; shp; shp = shp->sh_next) { + stp = (stdata_t *) shp; + if (stp->sd_pgrp == pgid) + stp->sd_pgrp = 0; + } +} + +/* + * Make sure no streams reference session id sid. + */ +void +strclearsid(sid) + pid_t sid; +{ + register stdata_t *stp; + register struct shinfo *shp; + + for (shp = (struct shinfo *) Strinfo[DYN_STREAM].sd_head; shp; shp = shp->sh_next) { + stp = (stdata_t *) shp; + if (stp->sd_sid == sid) + stp->sd_sid = 0; + } +} + +/* + * Shut off the STRCTTY flag (occurs when either the session leader + * exits or when the last reference to the file is closed). + */ +void +strclearctty(stp) + register stdata_t *stp; +{ + stp->sd_flag &= ~STRCTTY; +} + /* * Set the QBACK or QB_BACK flag in the given queue for * the given priority band. @@ -2100,95 +2015,16 @@ strsignal(stp, sig, band) splx(s); break; - default: - if (stp->sd_pgidp) { - if (stp->sd_flag & STRPID) - prsignal(stp->sd_pgidp, sig); - else - pgsignal(stp->sd_pgidp, sig); - } + case SIGTSTP: + if ((stp->sd_pgrp > 0) && !detachedpg(stp->sd_pgrp)) + signal(stp->sd_pgrp, SIGTSTP); break; - } -} - -strhup(stp) - struct stdata *stp; -{ - int s; - - s = splstr(); - if (stp->sd_sigflags & S_HANGUP) - strsendsig(stp->sd_siglist, S_HANGUP, 0L); - pollwakeup(&stp->sd_pollist, POLLHUP); - if (stp->sd_eventflags & S_HANGUP) - strevpost(stp, S_HANGUP, 0L); - splx(s); -} -stralloctty(sp, stp) - register sess_t *sp; - register struct stdata *stp; -{ - stp->sd_sidp = sp->s_sidp; - stp->sd_pgidp = sp->s_sidp; - stp->sd_flag &= ~STRPID; - PID_HOLD(stp->sd_pgidp); - PID_HOLD(stp->sd_sidp); -} - -strfreectty(stp) - register struct stdata *stp; -{ - pgsignal(stp->sd_pgidp, SIGHUP); - PID_RELE(stp->sd_pgidp); - PID_RELE(stp->sd_sidp); - stp->sd_pgidp = NULL; - stp->sd_sidp = NULL; - if (! (stp->sd_flag & STRHUP) ) - strhup(stp); -} - -/* - * Unlink "all" persistant links. - */ -void -strpunlink(crp) - struct cred *crp; -{ - struct stdata *stp; - struct shinfo *shp; - int rval; - /* - * for each allocated stream head, call munlinkall() - * with flag of LINKPERSIST to unlink any/all persistant - * links for the device. - */ - - shp = (struct shinfo *) Strinfo[DYN_STREAM].sd_head; - while(shp) - { - stp = (struct stdata *) shp; - (void) munlinkall(stp, LINKIOCTL|LINKPERSIST, crp, &rval); - shp = shp->sh_next; + default: + if (stp->sd_pgrp > 0) + signal(stp->sd_pgrp, sig); + else if (stp->sd_pgrp < 0) + psignal(stp->sd_procp, sig); + break; } } - -int -strctty(pp, stp) - register proc_t *pp; - register struct stdata *stp; -{ - extern vnode_t *makectty(); - register sess_t *sp = pp->p_sessp; - - if ((stp->sd_flag & (STRHUP|STRDERR|STWRERR|STPLEX)) == 0 - && stp->sd_sidp == NULL /* not allocated as ctty */ - && stp->sd_pgidp == NULL /* not allocated as socket */ - && sp->s_sidp == pp->p_pidp /* session leader */ - && sp->s_vp == NULL) { /* without ctty */ - alloctty(pp, makectty(stp->sd_vnode)); - stralloctty(sp, stp); - return 1; - } - return 0; -} diff --git a/usr/src/uts/3b2/os/subr.c b/usr/src/uts/3b2/os/subr.c index e708a2f..063f25d 100644 --- a/usr/src/uts/3b2/os/subr.c +++ b/usr/src/uts/3b2/os/subr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/subr.c 1.42" +#ident "@(#)kernel:os/subr.c 1.37.1.5" #include "sys/types.h" #include "sys/sysmacros.h" @@ -78,6 +78,28 @@ getudev() return -1; } +/* + * Find a proc table pointer given a process id. The code attempts + * to optimize the case in which repeated calls return successive + * proc table slots (as with ps(1)) by remembering where the search + * left off the last time. Interspersed calls can defeat the + * optimization but ordinarily this won't happen. + */ +proc_t * +prfind(pid) + register pid_t pid; +{ + + unsigned int index; + + index = GET_INDEX(pid); + if (index >= v.v_proc || nproc[index] == NULL || nproc[index]->p_stat ==0){ + return NULL; + } else{ + return(nproc[index]); + } +} + /* * C-library string functions. Assembler versions of others are in * ml/string.s. @@ -137,6 +159,27 @@ bcmp(s1, s2, len) return 0; } +int +intrerr(v) +{ + register proc_t *prp; + + if (!v) + return 0; + + prp = u.u_procp; + if (prp->p_cursig) { + if (sigismember(&u.u_sigrestart, prp->p_cursig)) { + return ERESTART; + } + } + else if (ev_intr_restart(u.u_procp)) { + return ERESTART; + } + + return EINTR; +} + int memlow() { @@ -169,34 +212,6 @@ stoi(str) return n; } -/* - * Simple-minded conversion of a long into a null-terminated character - * string. Caller must ensure there's enough space to hold the result. - */ -void -numtos(num, s) - u_long num; - char *s; -{ - register int i = 0; - register u_long mm = 1000000000; - int t; - - if (num < 10) { - *s++ = num + '0'; - *s = '\0'; - } else while (mm) { - t = num / mm; - if (i || t) { - i++; - *s++ = t + '0'; - num -= t * mm; - } - mm = mm / 10; - } - *s = '\0'; -} - int rlimit(resource, softlimit, hardlimit) int resource; diff --git a/usr/src/uts/3b2/os/sys3b.c b/usr/src/uts/3b2/os/sys3b.c index 36a6c58..77ac6d0 100644 --- a/usr/src/uts/3b2/os/sys3b.c +++ b/usr/src/uts/3b2/os/sys3b.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/sys3b.c 1.35" +#ident "@(#)kernel:os/sys3b.c 1.33.1.10" #include "sys/param.h" #include "sys/types.h" #include "sys/psw.h" @@ -666,7 +666,8 @@ sys3b(uap, rvp) error = ESRCH; break; } - if (p->p_stat == SIDL || p->p_stat == SZOMB) { + if (p->p_stat == 0 || p->p_stat == SIDL + || p->p_stat == SZOMB) { error = EINVAL; break; } @@ -796,7 +797,7 @@ sys3b(uap, rvp) if (kpftraceflg == 1) if (takephase == putphase ) { kpchildslp = 1; - wakeprocs((caddr_t) &kpchildslp, PRMPT); + wakeup((caddr_t) &kpchildslp); sleep((caddr_t) &kpft[takephase*NUMRC],PPIPE); } /* full buffer i.e. abnormal termination */ @@ -825,7 +826,7 @@ sys3b(uap, rvp) kperf_write(KPT_END,Kpc,curproc); pre_trace = 0; kpftraceflg = 0; - wakeprocs((caddr_t) &kpft[takephase*NUMRC], PRMPT); + wakeup((caddr_t) &kpft[takephase*NUMRC]); break; } #endif /* KPERF */ @@ -1040,7 +1041,7 @@ call_demon() * the file ml/gate.c. */ -#define GATE_ENTRIES 155+16+1+194 /* # of second-level gate entries */ +#define GATE_ENTRIES 138+16+1+211 /* # of second-level gate entries */ extern struct gate_l2 gates[]; extern struct kpcb *Xproc, *Ivect[], kpcb_pswtch; @@ -1052,7 +1053,7 @@ cache_off() register struct kpcb *ptr; register struct kpcb **ptr2; register struct gate_l2 *ptr1; - register proc_t *pp; + register proc_t **pp; register user_t *up; sde_t *sdeptr; int oprot; @@ -1082,8 +1083,10 @@ cache_off() sendsig_psw.CSH_D = sendsig_psw.CSH_F_D = 1; p0init_psw.CSH_D = p0init_psw.CSH_F_D = 1; - for (pp = practive; pp != NULL; pp = pp->p_next) { - up = (user_t *)KUSER(pp->p_segu); + for (pp = nproc; pp < v.ve_proc; pp++) { + if (*pp == NULL || (*pp)->p_stat == 0) + continue; + up = (user_t *)KUSER((*pp)->p_segu); ptr = (struct kpcb *)&up->u_ipcb; ptr->psw.CSH_D = ptr->psw.CSH_F_D = 1; ptr->ipcb.psw.CSH_D = ptr->ipcb.psw.CSH_F_D = 1; @@ -1111,7 +1114,7 @@ cache_on() register struct kpcb *ptr; register struct kpcb **ptr2; register struct gate_l2 *ptr1; - register proc_t *pp; + register proc_t **pp; register user_t *up; sde_t *sdeptr; int oprot; @@ -1141,8 +1144,10 @@ cache_on() sendsig_psw.CSH_D = sendsig_psw.CSH_F_D = 0; p0init_psw.CSH_D = p0init_psw.CSH_F_D = 0; - for (pp = practive; pp != NULL; pp = pp->p_next) { - up = (user_t *)KUSER(pp->p_segu); + for (pp = nproc; pp < v.ve_proc; pp++) { + if (*pp == NULL || (*pp)->p_stat == 0) + continue; + up = (user_t *)KUSER((*pp)->p_segu); ptr = (struct kpcb *)&up->u_ipcb; ptr->psw.CSH_D = ptr->psw.CSH_F_D = 0; ptr->ipcb.psw.CSH_D = ptr->ipcb.psw.CSH_F_D = 0; diff --git a/usr/src/uts/3b2/os/sysent.c b/usr/src/uts/3b2/os/sysent.c index aa87d68..a160de1 100644 --- a/usr/src/uts/3b2/os/sysent.c +++ b/usr/src/uts/3b2/os/sysent.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/sysent.c 1.51" +#ident "@(#)kernel:os/sysent.c 1.44" #include "sys/param.h" #include "sys/types.h" #include "sys/systm.h" @@ -47,7 +47,7 @@ int hrtsys(); int priocntlsys(); int waitsys(); int sigsendsys(); -int mincore(), mmap(), mprotect(), munmap(), vfork(); +int mctl(), mincore(), mmap(), mprotect(), munmap(), getpagesize(), vfork(); int xstat(), lxstat(), fxstat(); int xmknod(); int nuname(), lchown(); @@ -59,18 +59,18 @@ int adjtime(); int systeminfo(); int setegid(), seteuid(); int nfssys(); -int pathconf(), fpathconf(); #ifdef MEGA int uexch(); #endif /* MEGA */ -struct sysent sysent[] = { +struct sysent sysent[] = +{ 0, 0, nosys, /* 0 = indir */ 1, 0, (int(*)())rexit, /* 1 = exit */ 0, 0, fork, /* 2 = fork */ - 3, SETJUMP|ASYNC|IOSYS, read, /* 3 = read */ - 3, SETJUMP|ASYNC|IOSYS, write, /* 4 = write */ + 3, SETJUMP | ASYNC |IOSYS, read, /* 3 = read */ + 3, SETJUMP | ASYNC |IOSYS, write, /* 4 = write */ 3, SETJUMP, open, /* 5 = open */ 1, SETJUMP, close, /* 6 = close */ 0, SETJUMP, wait, /* 7 = wait */ @@ -106,7 +106,7 @@ struct sysent sysent[] = { 2, 0, kill, /* 37 = kill */ 4, 0, fstatfs, /* 38 = fstatfs */ 3, 0, setpgrp, /* 39 = setpgrp */ - 0, SETJUMP, cxenix, /* 40 = cxenix */ + 0, SETJUMP, cxenix, /* 40 = cxenix */ 1, 0, dup, /* 41 = dup */ 0, SETJUMP, pipe, /* 42 = pipe */ 1, 0, times, /* 43 = times */ @@ -134,30 +134,31 @@ struct sysent sysent[] = { 1, 0, chroot, /* 61 = chroot */ 3, SETJUMP, fcntl, /* 62 = fcntl */ 2, 0, ulimit, /* 63 = ulimit */ + /* * The following 6 entries were reserved for the UNIX PC. */ - 0, 0, nosys, /* 64 = unused */ - 0, 0, nosys, /* 65 = unused */ - 0, 0, nosys, /* 66 = unused */ + 0, 0, nosys, /* 64 = nosys */ + 0, 0, nosys, /* 65 = nosys */ + 0, 0, nosys, /* 66 = nosys */ 0, 0, nosys, /* 67 = file locking call */ 0, 0, nosys, /* 68 = local system calls */ 0, 0, nosys, /* 69 = inode open */ 0, 0, nosys, /* 70 = was advfs */ 0, 0, nosys, /* 71 = was unadvfs */ - 0, 0, nosys, /* 72 = unused */ - 0, 0, nosys, /* 73 = unused */ + 0, 0, nosys, /* 72 = was notused */ + 0, 0, nosys, /* 73 = was notused */ 0, 0, nosys, /* 74 = was rfstart */ - 0, 0, nosys, /* 75 = unused */ + 0, 0, nosys, /* 75 = not used */ 0, 0, nosys, /* 76 = was rdebug */ 0, 0, nosys, /* 77 = was rfstop */ 6, SETJUMP, rfsys, /* 78 = rfsys */ 1, 0, rmdir, /* 79 = rmdir */ 2, 0, mkdir, /* 80 = mkdir */ 3, 0, getdents, /* 81 = getdents */ - 0, 0, nosys, /* 82 = was libattach */ - 0, 0, nosys, /* 83 = was libdetach */ + 0, 0, nosys, /* 82 = libattach - removed */ + 0, 0, nosys, /* 83 = libdetach - removed */ 3, 0, sysfs, /* 84 = sysfs */ 4, SETJUMP, getmsg, /* 85 = getmsg */ 4, SETJUMP, putmsg, /* 86 = putmsg */ @@ -179,29 +180,30 @@ struct sysent sysent[] = { 0, 0, ev_evtrapret, /* 102 = evtrapret */ 2, 0, statvfs, /* 103 = statvfs */ 2, 0, fstatvfs, /* 104 = fstatvfs */ - 0, 0, nosys, /* 105 = reserved */ - 2, 0, nfssys, /* 106 = nfssys */ + 0, 0, nosys, /* 105 = not used */ + 0, 0, nosys, /* 106 = not used */ 4, SETJUMP, waitsys, /* 107 = waitset */ 2, 0, sigsendsys, /* 108 = sigsendset */ 5, SETJUMP, hrtsys, /* 109 = hrtsys */ 3, 0, async_cancel, /* 110 = acancel */ 3, 0, async, /* 111 = async */ 4, 0, priocntlsys, /* 112 = priocntlsys */ - 2, 0, pathconf, /* 113 = pathconf */ + 4, 0, mctl, /* 113 = mctl */ 3, 0, mincore, /* 114 = mincore */ 6, 0, mmap, /* 115 = mmap */ 3, 0, mprotect, /* 116 = mprotect */ 2, 0, munmap, /* 117 = munmap */ - 2, 0, fpathconf, /* 118 = fpathconf */ + 0, 0, getpagesize, /* 118 = getpagesize */ 0, 0, vfork, /* 119 = vfork */ 1, 0, fchdir, /* 120 = fchdir */ 3, 0, readv, /* 121 = readv */ 3, 0, writev, /* 122 = writev */ - 3, 0, xstat, /* 123 = xstat */ - 3, 0, lxstat, /* 124 = lxstat */ - 3, 0, fxstat, /* 125 = fxstat */ - 4, 0, xmknod, /* 126 = xmknod */ - 5, SETJUMP, clocal, /* 127 = clocal */ + 3, 0, xstat, /* 123 = xstat expanded stat*/ + 3, 0, lxstat, /* 124 = lxstat expanded symbolic + ** link stat */ + 3, 0, fxstat, /* 125 = fxstat expanded fd stat */ + 4, 0, xmknod, /* 126 = xmknod for dev_t expansion */ + 5, SETJUMP, clocal, /* 127 = clocal */ 2, 0, setrlimit, /* 128 = setrlimit */ 2, 0, getrlimit, /* 129 = getrlimit */ 3, 0, lchown, /* 130 = lchown */ @@ -210,12 +212,24 @@ struct sysent sysent[] = { 5, SETJUMP, putpmsg, /* 133 = putpmsg */ 2, 0, rename, /* 134 = rename */ 1, 0, nuname, /* 135 = nuname */ - 1, 0, setegid, /* 136 = setegid */ + 0, 0, nosys, /* 136 (not reserved) */ 1, 0, sysconfig, /* 137 = sysconfig */ 2, 0, adjtime, /* 138 = adjtime */ 3, 0, systeminfo, /* 139 = systeminfo */ - 0, 0, nosys, /* 140 = reserved */ + 1, 0, setegid, /* 140 = setegid */ 1, 0, seteuid, /* 141 = seteuid */ + /* 141-151 reserved for 3b4000 */ + 0, 0, nosys, /* 142 */ + 0, 0, nosys, /* 143 */ + 0, 0, nosys, /* 144 */ + 0, 0, nosys, /* 145 */ + 0, 0, nosys, /* 146 */ + 0, 0, nosys, /* 147 */ + 0, 0, nosys, /* 148 */ + 0, 0, nosys, /* 149 */ + 0, 0, nosys, /* 150 */ + 0, 0, nosys, /* 151 */ + 2, 0, nfssys, /* 152 = nfssys */ }; unsigned sysentsize = sizeof(sysent)/sizeof(struct sysent); diff --git a/usr/src/uts/3b2/os/todc.c b/usr/src/uts/3b2/os/todc.c index d44c049..1cd5826 100644 --- a/usr/src/uts/3b2/os/todc.c +++ b/usr/src/uts/3b2/os/todc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/todc.c 1.8" +#ident "@(#)kernel:os/todc.c 1.6.1.3" /* * This file contains routines to access the hardware * time of day clock: rtodc to read it, wtodc to write it. diff --git a/usr/src/uts/3b2/os/trap.c b/usr/src/uts/3b2/os/trap.c index 42d7489..31659cc 100644 --- a/usr/src/uts/3b2/os/trap.c +++ b/usr/src/uts/3b2/os/trap.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)kernel:os/trap.c 1.44" +#ident "@(#)kernel:os/trap.c 1.35.2.2" #include "sys/sysmacros.h" #include "sys/param.h" @@ -51,6 +51,7 @@ #include "vm/as.h" #include "vm/seg.h" +#include "sys/immu.h" #include "vm/seg_vn.h" #include "vm/seg_kmem.h" #include "vm/faultcode.h" @@ -62,19 +63,18 @@ extern int rf_state; extern void systrap(); -extern void setintret(); #if __STDC__ STATIC int usrxmemflt(caddr_t, psw_t, k_siginfo_t *); STATIC int krnxmemflt(caddr_t, psw_t); STATIC int stop_on_fault(u_int, k_siginfo_t *); -void krnlflt(psw_t); +STATIC void krnlflt(psw_t); STATIC void fault_to_info(int, k_siginfo_t *); #else STATIC int usrxmemflt(); STATIC int krnxmemflt(); STATIC int stop_on_fault(); -void krnlflt(); +STATIC void krnlflt(); STATIC void fault_to_info(); #endif @@ -111,115 +111,6 @@ STATIC char spopcode[256] = { }; int *save_r0ptr; /* pansave() uses this to find the registers */ -STATIC int fltcr_type; /* used to pass fltcr to krnlflt */ - -#ifdef DEBUG -/* - * Data watchpoint to help with debugging. - */ -u_long watchpt = 0; -int wp_fault = 0; -int wp_hit = 0; -paddr_t wp_pdt = 0; -pte_t *wp_pte = 0; -static u_long pdt[NPGPT + 7]; - -void -wpset(wp) - register u_long wp; -{ - register u_int pfn; - register u_int seglen; - register int i; - register pte_t *pte; - register sde_t *sde; - - if (watchpt != 0) { - cmn_err(CE_CONT, "For now, only one watchpoint at a time.\n"); - return; - } - - /* - * Sanity checking on the address. - */ - if ( (SECNUM(wp) != SCN1) || - ((wp & 0x3) != 0) || - (SEGNUM(wp) > sramb[SCN1].SDTlen) || - (!SD_ISVALID(sde = (sde_t *)srama[SCN1] + SEGNUM(wp))) ){ - /* - * other checks: like not in the page containing an - * interrupt stack, not in a page needed by the trap - * code, ... - */ - cmn_err(CE_CONT, "Bad addr 0x%x . Watchpoint not set.\n", wp); - return; - } - - if (SD_ISCONTIG(sde)) { - wp_pdt = kvtophys(((u_long)pdt + 0x1F) & (~0x1F)); - pte = (pte_t *)wp_pdt; - pfn = phystopfn(sde->wd2.address); - seglen = SD_LASTPG(sde); - for (i = 0; i <= seglen; ++i, ++pfn, ++pte) - pte->pg_pte = mkpte(PG_V, pfn); - for (;i < NPPS; ++i, ++pfn, ++pte) - pte->pg_pte = 0; - - sde->seg_flags &= ~SDE_C_bit; - sde->wd2.address = wp_pdt; - pte = (pte_t *)wp_pdt; - } else { - pte = (pte_t *)sde->wd2.address; - } - - watchpt = wp; - pte += PAGNUM(wp); - wp_pte = pte; - PG_SETW(pte); - - /* - * XXX - I don't think we care if the rest of the segment - * gets flushed. We only care about the page containing our - * watchpoint. - * - * I'm not sure, flush whole segment for now just to be safe. - * I'll check later. - * - * flushaddr(wp); - */ - flushmmu((addr_t)(wp & ~SOFFMASK), NPPS); -} - -void -wpclr(wp) - register u_long wp; -{ - register sde_t *sde; - - if (wp != watchpt) { - cmn_err(CE_CONT, "There is no watchpoint at 0x%x .\n", wp); - return; - } - - if (wp_pdt == NULL) { - /* - * We can assume the fault-on-write bit was off before - * we set the watchpoint. If it were on, the kernel - * would have panic'd; the kernel doesn't copy-on-write. - */ - PG_CLRW(wp_pte); - } else { - sde = (sde_t *)srama[SCN1] + SEGNUM(wp); - sde->wd2.address = kvtophys(wp & ~SOFFMASK); - sde->seg_flags |= SDE_C_bit; - flushmmu((addr_t)(wp & ~SOFFMASK), NPPS); - wp_pdt = NULL; - } - - watchpt = 0; - wp_pte = NULL; -} -#endif STATIC void trapsig(pp, ip) @@ -306,7 +197,7 @@ addupc_clk() * Called from ttrap.s if a trap occurs while on the kernel stack. */ -int +void k_trap(r0ptr) register int *r0ptr; { @@ -317,13 +208,10 @@ k_trap(r0ptr) int cint; } ps; - ps.cint = r0ptr[PS]; + /* save pointer to r0 for use by pansave() */ - if (Rcsr & CSRTIMO && u.u_caddrflt) { - Wcsr->c_sanity = 0; - r0ptr[PC] = u.u_caddrflt; - return 0; - } + save_r0ptr = r0ptr; + ps.cint = r0ptr[PS]; /* * If we were moving data to or from a user's @@ -344,19 +232,13 @@ k_trap(r0ptr) if (valid_usr_range((caddr_t)*fltar, 1)) i = usrxmemflt(r0ptr[PC], ps, &info); else { -#ifdef KPERF + #ifdef KPERF if (kpftraceflg) { asm(" MOVAW 0(%pc),Kpc "); kperf_write(KPT_UXMEMF, Kpc, curproc); } -#endif /* KPERF */ + #endif /* KPERF */ i = krnxmemflt(r0ptr[PC], ps); -#ifdef DEBUG - if (wp_fault != 0) { - ps.cps.TE = 1; - r0ptr[PS] = ps.cint; - } -#endif } /* @@ -369,9 +251,10 @@ k_trap(r0ptr) u.u_caddrflt = caddrsave; if (i != 0) - r0ptr[PC] = caddrsave; + r0ptr[PC] = u.u_caddrflt; else u.u_pgproc = 0; + save_r0ptr = NULL; #ifdef KPERF if (kpftraceflg) { @@ -380,41 +263,18 @@ k_trap(r0ptr) } #endif /* KPERF */ - return 0; + return; } else { - if ((i = krnxmemflt(r0ptr[PC], ps)) == 0) { -#ifdef DEBUG - if (wp_fault != 0) { - ps.cps.TE = 1; - r0ptr[PS] = ps.cint; - } -#endif - return 0; - } - } - } -#ifdef DEBUG - if (ps.cps.FT == ON_NORMAL && ps.cps.ISC == TRCTRAP && wp_fault != 0) { - if (wp_hit) { - cmn_err(CE_CONT, "Hit watchpoint 0x%x:\n", watchpt); - call_demon(); + if ((i = krnxmemflt(r0ptr[PC], ps)) == 0) + return; } - ps.cps.TE = 0; - r0ptr[PS] = ps.cint; - wp_fault = 0; - wp_hit = 0; - if (watchpt != 0) { - PG_SETW(wp_pte); - flushaddr(watchpt); - } - return 0; } -#endif cmn_err(CE_CONT, "TRAP\nproc = %x psw = %x\npc = %x", u.u_procp, ps.cint, r0ptr[PC]); - return 1; + krnlflt(ps.cps); + cmn_err(CE_PANIC, "Krnlflt returned to k_trap."); } /* @@ -718,7 +578,7 @@ systrap() if (rf_state) uptr->u_syscall = scall; if ((callp->sy_flags & SETJUMP) && setjmp(&uptr->u_qsav)) { - if ((error = uptr->u_error) == 0) + if (uptr->u_error == 0) error = EINTR; } else { #ifdef KPERF @@ -735,23 +595,12 @@ systrap() } if (error) { - #ifdef DEBUG sysout(); #endif - if (error == EFBIG) - psignal(uptr->u_procp, SIGXFSZ); - else if (error == EINTR) { - register int cursig = uptr->u_procp->p_cursig; - if ((cursig && sigismember(&uptr->u_sigrestart, cursig)) - || ev_intr_restart(uptr->u_procp)) - error = ERESTART; - } - uptr->u_pcb.regsave[K_R0] = error; uptr->u_error = 0; ((psw_t *)(uptr->u_pcb.regsave))[K_PS].NZVC |= PS_C; - } else { #ifdef DEBUG sysok(); @@ -881,10 +730,7 @@ intsyserr() } if ((Rcsr & CSRTIMO) != 0) { Wcsr->c_sanity = 0; - if (u.u_caddrflt) - setintret(u.u_caddrflt); - else - cmn_err(CE_PANIC,"SYSTEM BUS TIME OUT INTERRUPT"); + cmn_err(CE_PANIC,"SYSTEM BUS TIME OUT INTERRUPT"); } } @@ -898,7 +744,7 @@ intsyserr() void intspwr() { - psignal(proc_init, SIGPWR); + psignal(nproc[1], SIGPWR); } /* @@ -1156,6 +1002,10 @@ fault_to_info(flt, infop) } } +#ifdef DEBUG +caddr_t ufaultadr; +int ureqacc, uftype; +#endif STATIC int usrxmemflt(pc, ps, infop) @@ -1163,6 +1013,26 @@ usrxmemflt(pc, ps, infop) psw_t ps; k_siginfo_t *infop; { +#ifdef DEBUG + int rval; + + rval = db_usrxmemflt(pc, ps, infop); + if (rval) + sysoops(); + ureqacc = uftype = 0; + ufaultadr = 0; + return rval; +} + +int +db_usrxmemflt(pc, ps, infop) + register char *pc; + psw_t ps; + k_siginfo_t *infop; +{ +#endif + register pte_t *pte; + register sde_t *sde; struct seg *sp; struct as *asp; FLTCR faultcr; @@ -1180,6 +1050,12 @@ usrxmemflt(pc, ps, infop) infop->si_addr = faultadr; +#ifdef DEBUG + ureqacc = faultcr.reqacc; + uftype = faultcr.ftype; + ufaultadr = faultadr; +#endif + #ifdef KPERF if (kpftraceflg) { asm(" MOVAW 0(%pc),Kpc "); @@ -1225,7 +1101,7 @@ usrxmemflt(pc, ps, infop) case F_SDTLEN: case F_PTLEN: if (sp != NULL - || (faultadr >= u.u_procp->p_stkbase + u.u_procp->p_stksize + || (faultadr >= (caddr_t)u.u_procp->p_stkbase + u.u_procp->p_stksize && grow((int *)(_VOID *)faultadr))) { if ((flt = as_fault(asp, faultadr, 1, ftype, rw)) == 0 && spopcode[lfubyte(pc)] == MAU_SPECIAL @@ -1240,7 +1116,7 @@ usrxmemflt(pc, ps, infop) case F_P_N_P: if (sp == NULL - && faultadr >= u.u_procp->p_stkbase + u.u_procp->p_stksize + && faultadr >= (caddr_t)u.u_procp->p_stkbase + u.u_procp->p_stksize && !grow((int *)(_VOID *)faultadr)) { infop->si_signo = SIGSEGV; infop->si_code = SEGV_MAPERR; @@ -1254,6 +1130,13 @@ usrxmemflt(pc, ps, infop) break; case F_PWRITE: + sde = vatosde(faultadr); + pte = vatopte(faultadr, sde); + if (!PG_ISVALID(pte) + && (flt = as_fault(asp, faultadr, 1, ftype, rw))) { + fault_to_info(flt, infop); + break; + } if ((flt = as_fault(asp, faultadr, 1, F_PROT, rw)) == 0 && spopcode[lfubyte(pc)] == MAU_SPECIAL && faultcr.reqacc == AT_SPOPWRITE) @@ -1327,6 +1210,10 @@ usrxmemflt(pc, ps, infop) return infop->si_signo; } +#ifdef DEBUG +int kreqacc, kftype; +caddr_t kfaultadr; +#endif /* ARGSUSED */ STATIC int @@ -1334,7 +1221,26 @@ krnxmemflt(pc, ps) register caddr_t pc; psw_t ps; { +#ifdef DEBUG + int rval; + + rval = db_krnxmemflt(pc, ps); + if (rval) + sysoops(); + kreqacc = kftype = 0; + kfaultadr = 0; + return rval; +} + +int +db_krnxmemflt(pc, ps) + register char *pc; + psw_t ps; +{ +#endif register int sig; + register pte_t *pte; + register sde_t *sde; struct seg *sp; struct as *asp; FLTCR faultcr; @@ -1346,7 +1252,12 @@ krnxmemflt(pc, ps) faultadr = (caddr_t)*fltar; *(int *)fltcr = 0; *(int *)fltar = 0; - fltcr_type = faultcr.ftype; /* for krnlflt */ + +#ifdef DEBUG + kreqacc = faultcr.reqacc; + kftype = faultcr.ftype; + kfaultadr = faultadr; +#endif ftype = F_INVAL; rw = S_READ; @@ -1380,23 +1291,16 @@ krnxmemflt(pc, ps) break; case F_PWRITE: -#ifdef DEBUG - if (watchpt != 0 && - ((u_int)faultadr & ~POFFMASK) == (watchpt & ~POFFMASK)) { - wp_fault = 1; - if (((u_int)faultadr & ~0x3) == watchpt) - wp_hit = 1; - else - wp_hit = 0; - PG_CLRW(wp_pte); - flushaddr(faultadr); - return 0; + sde = vatosde(faultadr); + pte = vatopte(faultadr, sde); + if (!PG_ISVALID(pte) + && (sig = as_fault(asp, faultadr, 1, ftype, rw))) { + sig = 1; + break; } -#endif if ((sig = as_fault(asp, faultadr, 1, F_PROT, rw)) != 0) sig = 1; break; - default: sig = 1; break; @@ -1405,7 +1309,7 @@ krnxmemflt(pc, ps) return sig; } -void +STATIC void krnlflt(ps) psw_t ps; /* previous PSW content */ { @@ -1469,6 +1373,10 @@ krnlflt(ps) if (ps.FT == ON_NORMAL) if (ps.ISC == XMEMFLT) { + int fltcr_type; + + fltcr_type = fltcr->ftype; + *(int *)fltcr = 0; for (i = 0; i < sizeof(mmu_err)/sizeof(mmu_err[0]); i++) if (mmu_err[i].errno == fltcr_type) diff --git a/usr/src/uts/3b2/os/vm_meter.c b/usr/src/uts/3b2/os/vm_meter.c index 5e25e25..5f29ee8 100644 --- a/usr/src/uts/3b2/os/vm_meter.c +++ b/usr/src/uts/3b2/os/vm_meter.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)kernel:os/vm_meter.c 1.15" +#ident "@(#)kernel:os/vm_meter.c 1.11" #include "sys/types.h" #include "sys/param.h" @@ -123,11 +100,13 @@ vmmeter() sum.v_swpout += cnt.v_swpout; cnt.v_swpout = 0; } - if (avefree < minfree && runout) { + if (avefree < minfree && runout + /* || nproc[0]->p_slptime > maxslp/2 */ + ) { runout = 0; runin = 0; - wakeprocs((caddr_t)&runin, PRMPT); - wakeprocs((caddr_t)&runout, PRMPT); + wakeup((caddr_t)&runin); + wakeup((caddr_t)&runout); } } @@ -145,28 +124,30 @@ vmmeter() void vmtotal() { - register struct proc *p; + register struct proc **p; int nrun = 0; bzero((caddr_t)&total, sizeof (total)); - for (p = practive; p != NULL ; p = p->p_next) { - if (p->p_flag & SSYS) + for (p = &nproc[0]; p < v.ve_proc; p++) { + if ( *p == NULL ) /* NOT USED */ + continue; + if ((*p)->p_flag & SSYS) continue; - total.t_rm += rm_asrss(p->p_as); - switch (p->p_stat) { + total.t_rm += rm_asrss((*p)->p_as); + switch ((*p)->p_stat) { case SSLEEP: case SSTOP: - if (p->p_pri <= PZERO) + if ((*p)->p_pri <= PZERO) nrun++; - if (p->p_flag & SLOAD) { - if (p->p_pri <= PZERO) + if ((*p)->p_flag & SLOAD) { + if ((*p)->p_pri <= PZERO) total.t_dw++; - else /* if (p->p_slptime < maxslp) */ + else /* if ((*p)->p_slptime < maxslp) */ total.t_sl++; - } else /* if (p->p_slptime < maxslp) */ + } else /* if ((*p)->p_slptime < maxslp) */ total.t_sw++; - /* if (p->p_slptime < maxslp) + /* if ((*p)->p_slptime < maxslp) goto active; */ break; @@ -174,12 +155,12 @@ vmtotal() case SRUN: case SIDL: nrun++; - if (p->p_flag & SLOAD) + if ((*p)->p_flag & SLOAD) total.t_rq++; else total.t_sw++; active: - total.t_arm += rm_asrss(p->p_as); + total.t_arm += rm_asrss((*p)->p_as); break; } } diff --git a/usr/src/uts/3b2/os/vm_pageout.c b/usr/src/uts/3b2/os/vm_pageout.c index 9b43fc4..b01b8c4 100644 --- a/usr/src/uts/3b2/os/vm_pageout.c +++ b/usr/src/uts/3b2/os/vm_pageout.c @@ -5,30 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -#ident "@(#)kernel:os/vm_pageout.c 1.18" +#ident "@(#)kernel:os/vm_pageout.c 1.14" #include "sys/types.h" #include "sys/param.h" @@ -209,7 +186,7 @@ schedpaging() nz(lotsfree) / RATETOSCHEDPAGING; if (freemem < lotsfree) { trace1(TR_PAGEOUT_CALL, 3); - wakeprocs((caddr_t)proc_pageout, PRMPT); + wakeup((caddr_t)nproc[2]); } timeout(schedpaging, (caddr_t)0, HZ / RATETOSCHEDPAGING); } @@ -277,7 +254,7 @@ pageout() goto loop; } pageout_asleep = 1; - (void) sleep((caddr_t)proc_pageout, PSWP+1); + (void) sleep((caddr_t)nproc[2], PSWP+1); pageout_asleep = 0; (void) spl0(); if (!dopageout) goto loop; @@ -332,7 +309,7 @@ pageout() { for(;;) { - (void) sleep((caddr_t)proc_pageout, PSWP+1); + (void) sleep((caddr_t)nproc[2], PSWP+1); loop: /* * XXX: Add trace points to the loop below. @@ -510,7 +487,7 @@ swdone(bp) if (pp) { do { if (pp->p_want) { - wakeprocs((caddr_t)pp, PRMPT); + wakeup((caddr_t)pp); pp->p_want = 0; break; } @@ -523,7 +500,7 @@ swdone(bp) */ if ((bp->b_flags & B_PHYS) && pfreecnt == 0 && (pfreelist.b_flags & B_WANTED)) - wakeprocs((caddr_t)&pfreelist, PRMPT); + wakeup((caddr_t)&pfreelist); } /* diff --git a/usr/src/uts/3b2/os/vm_subr.c b/usr/src/uts/3b2/os/vm_subr.c index eeb540c..17bcaca 100644 --- a/usr/src/uts/3b2/os/vm_subr.c +++ b/usr/src/uts/3b2/os/vm_subr.c @@ -5,37 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ -/* The copyright notice above does not evidence any */ -/* actual or intended publication of such source code. */ - -#ident "@(#)kernel:os/vm_subr.c 1.24" +#ident "@(#)kernel:os/vm_subr.c 1.19" #include "sys/types.h" #include "sys/param.h" #include "sys/errno.h" @@ -127,11 +97,11 @@ uiophysio(strat, bp, dev, rw, uio) register struct iovec *iov; register int c; faultcode_t fault_err; - struct proc *procp; - struct as *asp; char *a; int hpf, s, error = 0; + ASSERT(uio->uio_iovcnt == 1); /* XXX */ + ASSERT(syswait.physio >= 0); syswait.physio++; if (rw) @@ -155,14 +125,6 @@ uiophysio(strat, bp, dev, rw, uio) splx(s); } - if (uio->uio_segflg == UIO_USERSPACE) { - procp = u.u_procp; - asp = procp->p_as; - } else { - procp = NULL; - asp = &kas; - } - while(uio->uio_iovcnt > 0) { iov = uio->uio_iov; if ((uio->uio_segflg == UIO_USERSPACE) && @@ -179,8 +141,7 @@ uiophysio(strat, bp, dev, rw, uio) bp->b_oerror = 0; /* old error field */ bp->b_error = 0; - bp->b_proc = procp; - + bp->b_proc = u.u_procp; while (iov->iov_len > 0) { if (uio->uio_resid == 0) break; @@ -197,8 +158,9 @@ uiophysio(strat, bp, dev, rw, uio) */ a = bp->b_un.b_addr = iov->iov_base; c = bp->b_bcount = MIN(iov->iov_len, uio->uio_resid); - fault_err = as_fault(asp, a, (uint)c, F_SOFTLOCK, - rw == B_READ? S_WRITE : S_READ); + fault_err = + as_fault(u.u_procp->p_as, a, (uint)c, F_SOFTLOCK, + rw == B_READ? S_WRITE : S_READ); if (fault_err != 0) { /* * Even though the range of addresses were @@ -216,7 +178,7 @@ uiophysio(strat, bp, dev, rw, uio) bp->b_error = error; (void) spl6(); if (bp->b_flags & B_WANTED) - wakeprocs((caddr_t)bp, PRMPT); + wakeup((caddr_t)bp); (void) splx(s); bp->b_flags &= ~(B_BUSY|B_WANTED|B_PHYS); break; @@ -238,13 +200,13 @@ uiophysio(strat, bp, dev, rw, uio) !(error = bp->b_oerror)) error = EIO; } - if (as_fault(asp, a, (uint)c, F_SOFTUNLOCK, - rw == B_READ ? S_WRITE : S_READ) != 0) + if (as_fault(u.u_procp->p_as, a, (uint)c, F_SOFTUNLOCK, + rw == B_READ? S_WRITE : S_READ) != 0) cmn_err(CE_PANIC, "physio unlock"); (void) spl6(); if (bp->b_flags & B_WANTED) - wakeprocs((caddr_t)bp, PRMPT); + wakeup((caddr_t)bp); (void) splx(s); c -= bp->b_resid; @@ -269,7 +231,7 @@ uiophysio(strat, bp, dev, rw, uio) bp->av_forw = pfreelist.av_forw; pfreelist.av_forw = bp; pfreecnt++; - wakeprocs((caddr_t)&pfreelist, PRMPT); + wakeup((caddr_t)&pfreelist); splx(s); } diff --git a/usr/src/uts/3b2/os/xsys.c b/usr/src/uts/3b2/os/xsys.c index bb08749..6dba2f4 100644 --- a/usr/src/uts/3b2/os/xsys.c +++ b/usr/src/uts/3b2/os/xsys.c @@ -11,7 +11,7 @@ /* This Module contains Proprietary Information of Microsoft */ /* Corporation and should be treated as Confidential. */ -#ident "@(#)kernel:os/xsys.c 1.13" +#ident "@(#)kernel:os/xsys.c 1.11" /* #ifdef MERGE */ @@ -38,7 +38,9 @@ #include "sys/var.h" #include "sys/cmn_err.h" +#undef wakeup extern u_int timer_resolution; +extern void wakeup(); /* reference the function, not the macro */ /* * Nap for the specified number of milliseconds. @@ -142,28 +144,39 @@ proctl(uap, rvp) struct proctla *uap; rval_t *rvp; { - register struct proc *p; + register struct proc **p, *q; register pid_t pid; int found = 0; + register struct cred *pcred, *ucred; + pid = uap->pid; - - for (p = practive; p != NULL; p = p->p_next) { - if (pid > 0) { - if (p->p_pid != pid) - continue; - } else if (p == proc_init) + if (pid > 0) + p = &nproc[1]; + else + p = &nproc[2]; + q = u.u_procp; + if (pid == 0 && q->p_pgrp == 0) + return ESRCH; + for(; p < v.ve_proc; p++) { + if (*p == NULL || (*p)->p_stat == NULL) continue; - if (pid == 0 && p->p_pgidp != u.u_procp->p_pgidp) + if (pid > 0 && (*p)->p_pid != pid) continue; - if (pid < -1 && p->p_pgrp != -pid) + if (pid == 0 && (*p)->p_pgrp != q->p_pgrp) continue; - if (!hasprocperm(p->p_cred, u.u_cred)) { - if (pid > 0) + if (pid < -1 && (*p)->p_pgrp != -pid) + continue; + ucred = u.u_cred; + pcred = (*p)->p_cred; + + if (ucred->cr_uid != 0 && ucred->cr_uid != pcred->cr_uid && ucred->cr_ruid != pcred->cr_uid + && ucred->cr_uid != pcred->cr_suid && ucred->cr_ruid != pcred->cr_suid + && u.u_procp != *p) + if (pid > 0) { return EPERM; - else + } else continue; - } found++; switch(uap->cmd) { case PRHUGEX: @@ -181,7 +194,6 @@ proctl(uap, rvp) if (pid > 0) break; } - if (found == 0) return ESRCH; return 0; diff --git a/usr/src/uts/3b2/rpc/auth.h b/usr/src/uts/3b2/rpc/auth.h index dd8a423..5a23ac7 100644 --- a/usr/src/uts/3b2/rpc/auth.h +++ b/usr/src/uts/3b2/rpc/auth.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/rpc/auth.h 1.4" +#ident "@(#)head.sys:sys/rpc/auth.h 1.3" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -23,7 +23,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/rpc/auth_des.c b/usr/src/uts/3b2/rpc/auth_des.c index 25e21a4..6780bdd 100644 --- a/usr/src/uts/3b2/rpc/auth_des.c +++ b/usr/src/uts/3b2/rpc/auth_des.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/auth_des.c 1.8" +#ident "@(#)krpc:krpc/auth_des.c 1.7" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)auth_des.c 1.2 89/01/11 SMI" #endif @@ -51,6 +51,12 @@ static char sccsid[] = "@(#)auth_des.c 1.2 89/01/11 SMI" #include #endif +/* + * #ifndef DEBUG + * #define cmn_err(type, msg) + * #endif + */ + #define MILLION 1000000L #define RTIME_TIMEOUT 5 /* seconds to wait for sync */ @@ -76,8 +82,6 @@ struct ad_private { u_int ad_window; /* client specified window */ bool_t ad_dosync; /* synchronize? */ struct netbuf ad_syncaddr; /* remote host to synch with */ - dev_t ad_synctp; /* Maj/Min of host transport device */ - int ad_calltype; /* use rpc or straight call for sync */ struct timeval ad_timediff; /* server's time - client's time */ u_long ad_nickname; /* server's nickname for client */ struct authdes_cred ad_cred; /* storage for credential */ @@ -92,13 +96,11 @@ struct ad_private { */ /*ARGSUSED*/ AUTH * -authdes_create(servername, window, syncaddr, synctp, ckey, calltype) +authdes_create(servername, window, syncaddr, ckey) char *servername; /* network name of server */ u_int window; /* time to live */ struct netbuf *syncaddr; /* optional addr of host to sync with */ des_block *ckey; /* optional conversation key to use*/ - dev_t synctp; /* Device of tp to sync with. */ - int calltype; { AUTH *auth; @@ -134,16 +136,16 @@ authdes_create(servername, window, syncaddr, synctp, ckey, calltype) */ bcopy(namebuf, ad->ad_fullname, (int)(ad->ad_fullnamelen + 1)); bcopy(servername, ad->ad_servername, (int)(ad->ad_servernamelen + 1)); +#ifdef nosyncyet if (syncaddr != NULL) { ad->ad_syncaddr = *syncaddr; - ad->ad_synctp = synctp; ad->ad_dosync = TRUE; - ad->ad_calltype = calltype; } else { - ad->ad_timediff.tv_sec = 0; - ad->ad_timediff.tv_usec = 0; ad->ad_dosync = FALSE; } +#else + ad->ad_dosync = FALSE; /*in case this is crashing it*/ +#endif ad->ad_window = window; if (ckey == NULL) { if (key_gendes(&auth->ah_key) < 0) { @@ -375,9 +377,10 @@ authdes_refresh(auth) struct ad_private *ad = AUTH_PRIVATE(auth); struct authdes_cred *cred = &ad->ad_cred; + if (!ad->ad_dosync) + ad->ad_timediff.tv_sec = ad->ad_timediff.tv_usec = 0; if (ad->ad_dosync && - !synchronize(ad->ad_synctp, &ad->ad_syncaddr, - ad->ad_calltype, &ad->ad_timediff)) { + !synchronize(&ad->ad_syncaddr, &ad->ad_timediff)) { /* * Hope the clocks are synced! */ @@ -391,9 +394,9 @@ authdes_refresh(auth) ad->ad_xkey = auth->ah_key; if (key_encryptsession(ad->ad_servername, &ad->ad_xkey) < 0) { #ifdef _KERNEL - cmn_err(CE_NOTE, "authdes_refresh: unable to encrypt conversation key"); + cmn_err(CE_NOTE, "authdes_create: unable to encrypt conversation key"); #else - (void) syslog(LOG_ERR, "authdes_refresh: unable to encrypt conversation key"); + (void) syslog(LOG_ERR, "authdes_create: unable to encrypt conversation key"); #endif return (FALSE); } @@ -427,18 +430,16 @@ authdes_destroy(auth) * adjust timep to reflect the delta between our clocks */ STATIC bool_t -synchronize(synctp, syncaddr, calltype, timep) - dev_t synctp; - struct netbuf *syncaddr; +synchronize(syncaddr, timep) + struct netbuf *syncaddr; struct timeval *timep; - int calltype; { struct timeval mytime; struct timeval timeout; timeout.tv_sec = RTIME_TIMEOUT; timeout.tv_usec = 0; - if (rtime(synctp, syncaddr, calltype, timep, &timeout) < 0) { + if (rtime(syncaddr, timep, &timeout) < 0) { return (FALSE); } (void) gettimeofday(&mytime, (struct timezone *)NULL); diff --git a/usr/src/uts/3b2/rpc/auth_sys.h b/usr/src/uts/3b2/rpc/auth_sys.h index b670509..3586d1f 100644 --- a/usr/src/uts/3b2/rpc/auth_sys.h +++ b/usr/src/uts/3b2/rpc/auth_sys.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:rpc/auth_sys.h 1.3" +#ident "@(#)head.sys:rpc/auth_sys.h 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/rpc/auth_unix.h b/usr/src/uts/3b2/rpc/auth_unix.h index b33b5a0..9fc00ce 100644 --- a/usr/src/uts/3b2/rpc/auth_unix.h +++ b/usr/src/uts/3b2/rpc/auth_unix.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/rpc/auth_unix.h 1.3" +#ident "@(#)head.sys:sys/rpc/auth_unix.h 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/rpc/authdesubr.c b/usr/src/uts/3b2/rpc/authdesubr.c index a7e0960..362dc0b 100644 --- a/usr/src/uts/3b2/rpc/authdesubr.c +++ b/usr/src/uts/3b2/rpc/authdesubr.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/authdesubr.c 1.11" +#ident "@(#)krpc:krpc/authdesubr.c 1.8" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)authdesubr.c 1.3 89/03/19 SMI" #endif @@ -60,178 +60,102 @@ static char sccsid[] = "@(#)authdesubr.c 1.3 89/03/19 SMI" #include #include #include +#include #include -#include #include #include -#include -#define USEC_PER_SEC 1000000 -#define TOFFSET ((u_long)86400*(365*70 + (70/4))) -#define WRITTEN ((u_long)86400*(365*86 + (86/4))) +#ifndef DEBUG +#define cmn_err(CE_NOTE, msg) /* turn off debugging */ +#endif -#define NC_INET "inet" /* XXX */ +#define USEC_PER_SEC 1000000 +#define TOFFSET (86400U*(365*70 + (70/4))) +#define WRITTEN (86400U*(365*86 + (86/4))) -rtime(synctp, addrp, calltype, timep, wait) - dev_t synctp; - struct netbuf *addrp; - int calltype; - struct timeval *timep; - struct timeval *wait; +/* +rtime_wakeup(so) + struct socket *so; { - extern timestruc_t time; - int error; - int timo; - time_t thetime; - int dummy; - struct t_kunitdata *unitdata; - TIUSER *tiptr; - struct vnode *vp; - int type; - int uderr; - int retries; + so->so_error = ETIMEDOUT; + sbwakeup(so, &so->so_rcv); +} +*/ - retries = 5; - if (calltype == 0) { - /* Use old method. - */ -again: - RPCLOG(8, "rtime: using old method\n", 0); - if ((error = t_kopen(NULL, synctp, - FREAD|FWRITE|FNDELAY, &tiptr)) != 0) { - RPCLOG(1, "rtime: t_kopen %d\n", error); - return -1; - } - - if ((error = t_kbind(tiptr, NULL, NULL)) != 0) { - (void)t_kclose(tiptr, 1); - RPCLOG(1, "rtime: t_kbind %d\n", error); - return -1; - } - - if ((error = t_kalloc(tiptr, T_UNITDATA, T_UDATA|T_ADDR, - (char **)&unitdata)) != 0) { - RPCLOG(1, "rtime: t_kalloc %d\n", error); - (void)t_kclose(tiptr, 1); - return -1; - } - - unitdata->addr.len = addrp->len; - bcopy(addrp->buf, unitdata->addr.buf, unitdata->addr.len); - - unitdata->udata.buf = (caddr_t)&dummy; - unitdata->udata.len = sizeof(dummy); - - if ((error = t_ksndudata(tiptr, unitdata, NULL)) != 0) { - RPCLOG(1, "rtime: t_ksndudata %d\n", error); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void)t_kclose(tiptr, 1); - return -1; - } - - timo = (int)(wait->tv_sec * HZ + - (wait->tv_usec * HZ) / USEC_PER_SEC); - RPCLOG(8, "rtime: timo %x\n", timo); - if ((error = t_kspoll(tiptr, timo, READWAIT, &type)) != 0) { - RPCLOG(1, "rtime: t_kspoll %d\n", error); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void)t_kclose(tiptr, 1); - return -1; - } - - if (type == 0) { - RPCLOG(1, "rtime: t_kspoll timed out\n", 0); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void)t_kclose(tiptr, 1); - return -1; - } - - if ((error =t_krcvudata(tiptr, unitdata, &type, &uderr)) != 0) { - RPCLOG(1, "rtime: t_krcvudata %d\n", error); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void)t_kclose(tiptr, 1); - return -1; - } - - if (type != T_DATA) { - RPCLOG(1, "rtime: t_krcvudata rtnd type %d\n", type); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void)t_kclose(tiptr, 1); - if (retries-- == 0) - return -1; - else goto again; - } - - if (unitdata->udata.len < sizeof(u_long)) { - RPCLOG(1, "rtime: bad rcvd length %d\n", - unitdata->udata.len); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void)t_kclose(tiptr, 1); - if (retries-- == 0) - return -1; - else goto again; - } - - /* LINTED pointer alignment */ - thetime = (time_t) ntohl(*(u_long *)unitdata->udata.buf); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void)t_kclose(tiptr, 1); +rtime(addrp, timep, wait) + struct netbuf *addrp; + struct timeval *timep; + struct timeval *wait; +{ + int error, timo; + u_long thetime; + /* int s; */ + int dummy; + register struct t_kunitdata *unitdata; + register TIUSER *tiptr; + /* extern int clone_no, udp_no; */ + struct vnode *vp; + + if ((error = lookupname ("/dev/udp", UIO_SYSSPACE, FOLLOW, NULLVPP, &vp)) != 0) + return -1; + if ((tiptr = t_kopen(NULL, vp->v_rdev, O_RDWR|O_NDELAY, + (struct t_info *)NULL)) == NULL) { + VN_RELE(vp); + return -1; + } + VN_RELE(vp); + if (t_kbind(tiptr, NULL, NULL) < 0) { + t_kclose(tiptr, 1); + return -1; + } + if ((unitdata = (struct t_kunitdata *)t_kalloc(tiptr, T_UNITDATA, + /* LINTED pointer alignment */ + T_UDATA|T_ADDR)) == (struct t_kunitdata *)NULL) { + printf("rtime: t_kalloc %d\n", u.u_error); + t_kclose(tiptr, 1); + return -1; + } + + unitdata->addr.len = addrp->len; + bcopy(addrp->buf, unitdata->addr.buf, unitdata->addr.len); + unitdata->udata.buf = (caddr_t)&dummy; + unitdata->udata.len = sizeof(dummy); + + if (t_ksndudata(tiptr, unitdata, NULL) < 0) { + t_kclose(tiptr, 1); + return -1; + } + + timo = (int)(wait->tv_sec * HZ + (wait->tv_usec * HZ) / USEC_PER_SEC); + if (t_kspoll(tiptr, timo, READWAIT) < 0) { + t_kclose(tiptr, 1); + return -1; } - else { - CLIENT *client; - struct knetconfig config; - struct timeval timeout; - RPCLOG(1, "rtime: using new method\n", 0); + if (t_krcvudata(tiptr, unitdata, &error) < 0) { + t_kclose(tiptr, 1); + return -1; + } - /* We talk to rpcbind. - */ - config.knc_rdev = synctp; - config.knc_protofmly = NC_INET; /* XXX */ - error = clnt_tli_kcreate(&config, addrp, (u_long)RPCBPROG, - (u_long)RPCBVERS, 0, retries, - u.u_procp->p_cred, &client); - - if (error != 0) { - RPCLOG(1, - "key_call: clnt_tli_kcreate rtned error %d", error); - return -1; - } - timeout.tv_sec = 60; - timeout.tv_usec = 0; - error = clnt_call(client, RPCBPROC_GETTIME, xdr_void, NULL, - xdr_u_long, (caddr_t)&thetime, timeout); - auth_destroy(client->cl_auth); - clnt_destroy(client); - if (error != RPC_SUCCESS) { - RPCLOG(1, - "rtime: time sync clnt_call failed: error %x", error); - RPCLOG(1, clnt_sperrno(error), 0); - error = EIO; - return -1; - } + if (unitdata->udata.len < sizeof(u_long)) { + printf("rtime: bad rcvd length %d\n", unitdata->udata.len); + t_kclose(tiptr, 1); + return -1; } - if (calltype != 0) - thetime += TOFFSET; + t_kclose(tiptr, 1); - RPCLOG(8, "rtime: thetime = %x\n", thetime); + /* LINTED pointer alignment */ + thetime = *(u_long *)unitdata->udata.buf; if (thetime < WRITTEN) { - RPCLOG(1, "rtime: time returned is too far in past %x", - thetime); - RPCLOG(1, "rtime: WRITTEN %x", WRITTEN); - return -1; + cmn_err(CE_NOTE, "time returned is too far in past"); + return(-1); } - thetime -= TOFFSET; - - timep->tv_sec = thetime; - RPCLOG(8, "rtime: timep->tv_sec = %x\n", timep->tv_sec); - RPCLOG(8, "rtime: machine time = %x\n", hrestime.tv_sec); + timep->tv_sec = thetime - TOFFSET; timep->tv_usec = 0; - RPCLOG(8, "rtime: returning success\n", 0); - return 0; + return(0); } diff --git a/usr/src/uts/3b2/rpc/clnt.h b/usr/src/uts/3b2/rpc/clnt.h index 726ca38..2c06c78 100644 --- a/usr/src/uts/3b2/rpc/clnt.h +++ b/usr/src/uts/3b2/rpc/clnt.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/rpc/clnt.h 1.9" +#ident "@(#)head.sys:sys/rpc/clnt.h 1.7" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ @@ -54,7 +54,6 @@ enum clnt_stat { RPC_CANTRECV=4, /* failure in receiving result */ RPC_TIMEDOUT=5, /* call timed out */ RPC_INTR=18, /* call interrupted */ - RPC_UDERROR=23, /* recv got uderr indication */ /* * remote errors */ @@ -133,7 +132,7 @@ typedef struct { void (*cl_geterr)(); /* get specific error code */ bool_t (*cl_freeres)();/* frees results */ void (*cl_destroy)();/* destroy this structure */ - bool_t (*cl_control)();/* the ioctl() of rpc */ + bool_t (*cl_control)();/* the ioctl() of rpc */ } *cl_ops; caddr_t cl_private; /* private stuff */ #ifndef _KERNEL @@ -155,19 +154,26 @@ struct rpc_timers { /* * Feedback values used for possible congestion and rate control */ -#define FEEDBACK_REXMIT1 1 /* first retransmit */ -#define FEEDBACK_OK 2 /* no retransmits */ +#define FEEDBACK_REXMIT1 1 /* first retransmit */ +#define FEEDBACK_OK 2 /* no retransmits */ -#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ +#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ -#define KNC_STRSIZE 128 /* maximum length of knetconfig strings */ +#ifdef _KERNEL +#define UDPMSGSIZE 8800 /* temporary */ struct knetconfig { - unsigned long knc_semantics; /* token name */ - char *knc_protofmly; /* protocol family */ - char *knc_proto; /* protocol */ - dev_t knc_rdev; /* device id */ - unsigned long knc_unused[8]; + char *nc_netid; + unsigned long nc_semantics; + unsigned long nc_flag; + unsigned long nc_protofmly; + unsigned long nc_proto; + char *nc_device; + unsigned long nc_nlookups; + char **nc_lookups; + dev_t nc_rdev; + unsigned long nc_unused[8]; }; +#endif /* * client side rpc interface ops @@ -202,8 +208,8 @@ struct knetconfig { * CLNT_GETERR(rh); * CLIENT *rh; */ -#define CLNT_GETERR(rh, errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) -#define clnt_geterr(rh, errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) +#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) +#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) /* * bool_t @@ -218,29 +224,29 @@ struct knetconfig { /* * bool_t * CLNT_CONTROL(cl, request, info) - * CLIENT *cl; - * u_int request; - * char *info; + * CLIENT *cl; + * u_int request; + * char *info; */ -#define CLNT_CONTROL(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in)) -#define clnt_control(cl, rq, in) ((*(cl)->cl_ops->cl_control)(cl, rq, in)) +#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) +#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* * control operations that apply to all transports */ -#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ -#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ -#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ -#define CLGET_FD 6 /* get connections file descriptor */ -#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ -#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ -#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ +#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ +#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ +#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ +#define CLGET_FD 6 /* get connections file descriptor */ +#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */ +#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ +#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ /* * Connectionless only control operations */ -#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ -#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ +#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ +#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ /* * void @@ -257,20 +263,20 @@ struct knetconfig { * and network administration. */ -#define RPCTEST_PROGRAM ((u_long)1) -#define RPCTEST_VERSION ((u_long)1) -#define RPCTEST_NULL_PROC ((u_long)2) -#define RPCTEST_NULL_BATCH_PROC ((u_long)3) +#define RPCTEST_PROGRAM ((u_long)1) +#define RPCTEST_VERSION ((u_long)1) +#define RPCTEST_NULL_PROC ((u_long)2) +#define RPCTEST_NULL_BATCH_PROC ((u_long)3) /* * By convention, procedure 0 takes null arguments and returns them */ -#define NULLPROC ((u_long)0) +#define NULLPROC ((u_long)0) /* * Below are the client handle creation routines for the various - * implementations of client side rpc. They can return NULL if a + * implementations of client side rpc. They can return NULL if a * creation failure occurs. */ @@ -314,7 +320,7 @@ clnt_tli_create(/*fd, netconf, svcaddr, prog, vers, sendsz, recvsz*/); /* */ /* - * Low level clnt create routine for connectionful transports, e.g. tcp. + * Low level clnt create routine for connectionful transports e,g. tcp. */ extern CLIENT * clnt_vc_create(/*fd, svcaddr, prog, vers, sendsz, recvsz*/); /* @@ -327,7 +333,7 @@ clnt_vc_create(/*fd, svcaddr, prog, vers, sendsz, recvsz*/); /* */ /* - * Low level clnt create routine for connectionless transports, e.g. udp. + * Low level clnt create routine for connectionless transports e,g. udp. */ extern CLIENT * clnt_dg_create(/*fd, svcaddr, program, version, sendsz, recvsz*/); /* @@ -357,7 +363,7 @@ char *clnt_spcreateerror(/* char *msg */); /* string */ /* * Like clnt_perror(), but is more verbose in its output - */ + */ void clnt_perrno(/* enum clnt_stat num */); /* stderr */ /* @@ -366,7 +372,7 @@ void clnt_perrno(/* enum clnt_stat num */); /* stderr */ void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */ char *clnt_sperror(/* CLIENT *clnt, char *msg */); /* string */ -/* +/* * If a creation fails, the following allows the user to figure out why. */ struct rpc_createerr { diff --git a/usr/src/uts/3b2/rpc/clnt_clts.c b/usr/src/uts/3b2/rpc/clnt_clts.c index 738c661..ebaa4f1 100644 --- a/usr/src/uts/3b2/rpc/clnt_clts.c +++ b/usr/src/uts/3b2/rpc/clnt_clts.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/clnt_clts.c 1.13" +#ident "@(#)krpc:krpc/clnt_clts.c 1.6" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)clnt_clts.c 1.3 89/01/11 SMI" #endif @@ -40,10 +40,13 @@ static char sccsid[] = "@(#)clnt_clts.c 1.3 89/01/11 SMI" #include #include #include -#include #include #include #include +/*#include */ +/*#include */ +/*#include */ +/*#include */ #include #include #include @@ -59,13 +62,9 @@ static char sccsid[] = "@(#)clnt_clts.c 1.3 89/01/11 SMI" #include #include #include -#include - -#define NC_INET "inet" /* XXX */ int ckuwakeup(); void clnt_clts_init(); -void clnt_clts_reopen(); enum clnt_stat clnt_clts_kcallit(); void clnt_clts_kabort(); @@ -95,14 +94,12 @@ struct cku_private { CLIENT cku_client; /* client handle */ int cku_retrys; /* request retrys */ TIUSER *cku_tiptr; /* open tli file pointer */ - dev_t cku_device; /* device cku_tiptr has open */ struct netbuf cku_addr; /* remote address */ struct rpc_err cku_err; /* error status */ XDR cku_outxdr; /* xdr routine for output */ XDR cku_inxdr; /* xdr routine for input */ u_int cku_outpos; /* position of in output mbuf */ char *cku_outbuf; /* output buffer */ - u_int cku_outbuflen; /* size of output buffer */ char *cku_inbuf; /* input buffer */ struct t_kunitdata *cku_inudata; /* input tli buf */ struct cred *cku_cred; /* credentials */ @@ -124,10 +121,14 @@ struct { int rcnewcreds; int rcbadverfs; int rctimers; - int rctoobig; - int rcnomem; - int rccantsend; + int rctoobig;/*cpj*/ + int rcnomem;/*cpj*/ + int rccantsend;/*cpj*/ + int rcbufbusy1;/*cpj*/ + int rcbufbusy2;/*cpj*/ int rcbufulocks; + int kludge1; + int kludge2; } rcstat; @@ -140,14 +141,12 @@ struct { #define CKU_WANTED 0x004 #define CKU_BUFBUSY 0x008 #define CKU_BUFWANTED 0x010 -#define CKU_LOANEDBUF 0x020 /* Times to retry */ #define RECVTRIES 2 #define SNDTRIES 4 -#define CKU_MAXSIZE 8800 int clnt_clts_xid; /* transaction id used by all clients */ @@ -155,13 +154,11 @@ STATIC void buffree(p) struct cku_private *p; { - RPCLOG(2, "buffree: (client) entered p %x\n", p); p->cku_flags &= ~CKU_BUFBUSY; if (p->cku_flags & CKU_BUFWANTED) { - RPCLOG(2, "buffree: (client) waking sleepers p %x\n", p); p->cku_flags &= ~CKU_BUFWANTED; rcstat.rcbufulocks++; - wakeprocs((caddr_t)&p->cku_outbuf, PRMPT); + wakeup((caddr_t)&p->cku_outbuf); } } @@ -170,34 +167,24 @@ buffree(p) * Allocates space for the handle structure and the private data, and * opens a socket. Note sockets and handles are one to one. */ -/* ARGSUSED */ -int -clnt_clts_kcreate(tiptr, rdev, addr, pgm, vers, sendsz, retrys, cred, cl) - register TIUSER *tiptr; - dev_t rdev; - struct netbuf *addr; - u_long pgm; - u_long vers; - int retrys; - struct cred *cred; - u_int sendsz; - CLIENT **cl; +/*ARGSUSED*/ +CLIENT * +clnt_clts_kcreate(tiptr, addr, pgm, vers, sendsz, recvsz, retrys, cred) +register TIUSER *tiptr; +struct netbuf *addr; +u_long pgm; +u_long vers; +int retrys; +struct cred *cred; +u_int sendsz, recvsz; { - register CLIENT *h; - register struct cku_private *p; - struct rpc_msg call_msg; - int error; - - RPCLOG(2, "clnt_clts_kcreate: pgm %d, ", pgm); - RPCLOG(2, "vers %d, ", vers); - RPCLOG(2, "retries %d\n", retrys); - - if (cl == NULL) - return EINVAL; - - *cl = NULL; - error = 0; + register CLIENT *h; + register struct cku_private *p; + struct rpc_msg call_msg; +#ifdef RPCDEBUG + printf("clnt_clts_kcreate(%d, %d, %d\n", pgm, vers, retrys); +#endif p = (struct cku_private *)kmem_zalloc(sizeof(*p), KM_SLEEP); h = ptoh(p); @@ -223,80 +210,61 @@ clnt_clts_kcreate(tiptr, rdev, addr, pgm, vers, sendsz, retrys, cred, cl) /* private */ clnt_clts_init(h, addr, retrys, cred); - - sendsz = MIN(tiptr->tp_info.tsdu, CKU_MAXSIZE); - RPCLOG(2, "clnt_clts_kcreate: sendsz %d\n", sendsz); - - p->cku_outbuflen = sendsz; - p->cku_outbuf = (char *)kmem_alloc(sendsz, KM_SLEEP); - xdrmem_create(&p->cku_outxdr, p->cku_outbuf, sendsz, XDR_ENCODE); + p->cku_outbuf = (char *)kmem_alloc((u_int)UDPMSGSIZE, KM_SLEEP); + xdrmem_create(&p->cku_outxdr, p->cku_outbuf, UDPMSGSIZE, XDR_ENCODE); /* pre-serialize call message header */ if (! xdr_callhdr(&(p->cku_outxdr), &call_msg)) { printf("clnt_clts_kcreate - Fatal header serialization error."); - error = EINVAL; /* XXX */ goto bad; } p->cku_outpos = XDR_GETPOS(&(p->cku_outxdr)); p->cku_tiptr = tiptr; - p->cku_device = rdev; - *cl = h; - return (0); + return (h); bad: - if (p->cku_outbuflen) - kmem_free((caddr_t)p->cku_outbuf, p->cku_outbuflen); + kmem_free((caddr_t)p->cku_outbuf, (u_int)UDPMSGSIZE); kmem_free((caddr_t)p, (u_int)sizeof (struct cku_private)); - - RPCLOG(1, "clnt_clts_kcreate: create failed error %d\n", error); - - return (error); +#ifdef RPCDEBUG + printf("create failed\n"); +#endif + return ((CLIENT *)NULL); } void clnt_clts_init(h, addr, retrys, cred) - CLIENT *h; - struct netbuf *addr; - register int retrys; - struct cred *cred; +CLIENT *h; +struct netbuf *addr; +register int retrys; +struct cred *cred; { /* LINTED pointer alignment */ - struct cku_private *p = htop(h); + struct cku_private *p = htop(h); p->cku_retrys = retrys; - if (p->cku_addr.maxlen < addr->len) { - if (p->cku_addr.maxlen != 0 && p->cku_addr.buf != NULL) - (void) kmem_free(p->cku_addr.buf, p->cku_addr.maxlen); - - p->cku_addr.buf = (char *)kmem_zalloc(addr->maxlen, KM_SLEEP); - p->cku_addr.maxlen = addr->maxlen; - } - + p->cku_addr.buf = (char *)kmem_zalloc(addr->maxlen, KM_SLEEP); p->cku_addr.len = addr->len; - RPCLOG(2, "clnt_clts_init: addr.len %d, ", addr->len); - RPCLOG(2, "addr.maxlen %d\n", addr->maxlen); + p->cku_addr.maxlen = addr->len; bcopy(addr->buf, p->cku_addr.buf, addr->len); p->cku_cred = cred; p->cku_xid = 0; p->cku_flags &= (CKU_BUFBUSY | CKU_BUFWANTED); - p->cku_flags |= CKU_LOANEDBUF; } /* * set the timers. Return current retransmission timeout. */ clnt_clts_settimers(h, t, all, minimum, feedback, arg) - CLIENT *h; - struct rpc_timers *t; - struct rpc_timers *all; - unsigned int minimum; - void (*feedback)(); - caddr_t arg; +CLIENT *h; +struct rpc_timers *t, *all; +unsigned int minimum; +void (*feedback)(); +caddr_t arg; { /* LINTED pointer alignment */ - struct cku_private *p = htop(h); + struct cku_private *p = htop(h); int value; p->cku_feedback = feedback; @@ -318,8 +286,6 @@ clnt_clts_settimers(h, t, all, minimum, feedback, arg) #define MAXTIMO (20 * HZ) #define backoff(tim) ((((tim) << 1) > MAXTIMO) ? MAXTIMO : ((tim) << 1)) -STATIC int retry_poll_timo = 30*HZ; - /* * Call remote procedure. * Most of the work of rpc is done here. We serialize what is left @@ -334,55 +300,47 @@ STATIC int retry_poll_timo = 30*HZ; enum clnt_stat clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, sin) - register CLIENT *h; - u_long procnum; - xdrproc_t xdr_args; - caddr_t argsp; - xdrproc_t xdr_results; - caddr_t resultsp; - struct timeval wait; - struct netbuf *sin; +register CLIENT *h; +u_long procnum; +xdrproc_t xdr_args; +caddr_t argsp; +xdrproc_t xdr_results; +caddr_t resultsp; +struct timeval wait; +struct netbuf *sin; { /* LINTED pointer alignment */ - register struct cku_private *p = htop(h); - register XDR *xdrs; - register TIUSER *tiptr = p->cku_tiptr; - int rtries; - int stries = p->cku_retrys; - int s; - struct cred *tmpcred; - int timohz; - int ret; - u_long xid; - u_int rempos = 0; - int refreshes = 2; /* number of times - to refresh credential */ - int round_trip; /* time the RPC */ - struct t_kunitdata *unitdata; - int type; - int uderr; - frtn_t *cku_frtn; - int error; + register struct cku_private *p = htop(h); + register XDR *xdrs; + register TIUSER *tiptr = p->cku_tiptr; + int rtries; + int stries = p->cku_retrys; + int s; + struct cred *tmpcred; + int timohz, ret; + u_long xid; + u_int rempos = 0; + int refreshes = 2; /* number of times to refresh credential */ + int round_trip; /* time the RPC */ + struct t_kunitdata *unitdata; + int flags; /* # define time_in_hz (hrestime.tv_sec*hz + hrestime.tv_usec/(1000000/hz)) */ #define time_in_hz lbolt - RPCLOG(2, "clnt_clts_kcallit_addr entered\n", 0); - +#ifdef RPCDEBUG + printf("cku_callit\n"); +#endif rcstat.rccalls++; - s = splstr(); while (p->cku_flags & CKU_BUSY) { - RPCLOG(2, "clnt_clts_kcallit_addr: pid %d cku busy - sleeping\n", u.u_procp->p_pid); rcstat.rcwaits++; p->cku_flags |= CKU_WANTED; (void) sleep((caddr_t)h, PZERO-2); } p->cku_flags |= CKU_BUSY; - (void)splx(s); - RPCLOG(2, "clnt_clts_kcallit_addr: pid %d cku not busy\n", u.u_procp->p_pid); /* * Set credentials into the u structure @@ -410,13 +368,23 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, */ s = splstr(); while (p->cku_flags & CKU_BUFBUSY) { - RPCLOG(2, "clnt_clts_kcallit_addr: pid %d loaned buffer busy\n", u.u_procp->p_pid); p->cku_flags |= CKU_BUFWANTED; - (void)sleep((caddr_t)&p->cku_outbuf, PZERO-3); + rcstat.rcbufbusy1++; + /* + * This is a kludge to avoid deadlock in the case of a + * the server to free the mbuf while the server is blocked + * waiting for the client to free the reply mbuf. Avoid this + * by flushing the input queue every once in a while while + * we are waiting. + */ + if (cpjsleep((caddr_t)&p->cku_outbuf, PZERO-3, 10*100)<0){ + printf("cpjsleep: kludge1 buffer not sent in 10 secs\n"); + rcstat.kludge1++; + buffree(p); /*bogus*/ + } } p->cku_flags |= CKU_BUFBUSY; (void) splx(s); - RPCLOG(2, "clnt_clts_kcallit_addr: pid %d loaned buffer not busy\n", u.u_procp->p_pid); xdrs = &p->cku_outxdr; /* @@ -426,7 +394,7 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, /* LINTED pointer alignment */ (*(u_long *)(p->cku_outbuf)) = xid; - xdrmem_create(xdrs, p->cku_outbuf, p->cku_outbuflen, XDR_ENCODE); + xdrmem_create(xdrs, p->cku_outbuf, UDPMSGSIZE, XDR_ENCODE); if (rempos != 0) { XDR_SETPOS(xdrs, rempos); @@ -446,91 +414,70 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, } round_trip = time_in_hz; - if ((error = t_kalloc(tiptr, T_UNITDATA, T_UDATA|T_ADDR, - (char **)&unitdata)) != 0) { + if ((unitdata = (struct t_kunitdata *)t_kalloc(tiptr, T_UNITDATA, + /* LINTED pointer alignment */ + T_UDATA|T_ADDR)) == (struct t_kunitdata *)NULL) { rcstat.rcnomem++; - buffree(p); + buffree(p); /*cpj*/ goto done; } - RPCLOG(2, "clnt_clts_kcallit_addr: addr.maxlen %d\n", unitdata->addr.maxlen); - RPCLOG(2, "clnt_clts_kcallit_addr: cku_addr.len %d\n", p->cku_addr.len); - bcopy(p->cku_addr.buf, unitdata->addr.buf, p->cku_addr.len); - unitdata->addr.len = p->cku_addr.len; + bcopy(p->cku_addr.buf, unitdata->addr.buf, unitdata->addr.maxlen); + unitdata->addr.len = unitdata->addr.maxlen; unitdata->udata.buf = p->cku_outbuf; - unitdata->udata.maxlen = p->cku_outbuflen; + if (rempos >unitdata->udata.maxlen) { + printf("clnt_clts_kcallit_addr: buffer too long, need %d, maxlen %d\n",rempos, unitdata->udata.maxlen); + rcstat.rctoobig++; + if (t_kfree(tiptr, unitdata, T_UNITDATA) < 0) + printf("clnt_clts_kcallit_addr: t_kfree: error %d\n", u.u_error); + buffree(p); + goto done; + } unitdata->udata.len = rempos; - - if (p->cku_flags & CKU_LOANEDBUF) { - p->cku_frtn.free_func = buffree; - p->cku_frtn.free_arg = (char *)p; - cku_frtn = &p->cku_frtn; - } - else cku_frtn = NULL; - if ((error = t_ksndudata(tiptr, unitdata, cku_frtn)) != 0) { + p->cku_frtn.free_func = buffree; + p->cku_frtn.free_arg = (char *)p; + + if ((ret = t_ksndudata(tiptr, unitdata, &p->cku_frtn)) < 0) { p->cku_err.re_status = RPC_CANTSEND; - p->cku_err.re_errno = error; - - RPCLOG(1, "clnt_clts_kcallit_addr: t_ksndudata: error %d\n",error); - - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); + p->cku_err.re_errno = u.u_error; + printf("clnt_clts_kcallit_addr: t_ksndudata: error %d\n", u.u_error); /*cpj*/ + if (t_kfree(tiptr, unitdata, T_UNITDATA) < 0) + printf ("clnt_clts_kcallit_addr: t_kfree: error %d\n", u.u_error); rcstat.rccantsend++; - buffree(p); + buffree(p); /*cpj*/ goto done; } - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - - /* If the rpc user did not use a loaned buffer then - * we can reset the buffer busy flag. - */ - if ((p->cku_flags & CKU_LOANEDBUF) == 0) - buffree(p); - -tryread: + if (t_kfree(tiptr, unitdata, T_UNITDATA) < 0) + printf("clnt_clts_kcallit_addr: t_kfree: error %d\n", u.u_error); for (rtries = RECVTRIES; rtries; rtries--) { - if ((error = t_kalloc(tiptr, T_UNITDATA, T_UDATA|T_ADDR, - (char **)&unitdata)) != 0) + if ((unitdata = (struct t_kunitdata *)t_kalloc(tiptr, T_UNITDATA, + /* LINTED pointer alignment */ + T_UDATA|T_ADDR)) == (struct t_kunitdata *)NULL) { goto done; - - RPCLOG(2, "clnt_clts_kcallit_addr (pid %d): ", u.u_procp->p_pid); - RPCLOG(2, "calling t_kspoll (timeout %x)\n", timohz); - if ((error = t_kspoll(tiptr, timohz, READWAIT, &ret)) != 0) { - if (error == EINTR) { - RPCLOG(1, "clnt_clts_kcallit_addr (pid %d): t_kspoll interrupted\n", u.u_procp->p_pid); + } + if ((ret = t_kspoll(tiptr, timohz, READWAIT)) < 0) { + if (u.u_error == EINTR) { p->cku_err.re_status = RPC_INTR; p->cku_err.re_errno = EINTR; - (void)t_kfree(tiptr, (char *)unitdata, - T_UNITDATA); goto done; } - RPCLOG(1, "clnt_clts_kcallit_addr (pid %d): ", u.u_procp->p_pid); - RPCLOG(1, "t_kspoll: error %d\n", error); - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); continue; /* is this correct? */ } if (ret == 0) { - RPCLOG(1, "clnt_clts_kcallit_addr (pid %d): t_kspoll timed out\n", u.u_procp->p_pid); p->cku_err.re_status = RPC_TIMEDOUT; p->cku_err.re_errno = ETIMEDOUT; rcstat.rctimeouts++; - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); goto done; } /* something waiting, so read it in */ - if ((error = t_krcvudata(tiptr, unitdata, &type, &uderr)) != 0) { - p->cku_err.re_errno = error; - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); + if (t_krcvudata(tiptr, unitdata, &flags) < 0) { goto done; } - if (type != T_DATA) { - (void)t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - continue; - } if (sin) { bcopy(unitdata->addr.buf, sin->buf, unitdata->addr.len); sin->len = unitdata->addr.len; @@ -540,8 +487,8 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, p->cku_inbuf = unitdata->udata.buf; if (p->cku_inudata->udata.len < sizeof (u_long)) { - RPCLOG(1, "clnt_clts_kcallit_addr: len too small %d\n", p->cku_inudata->udata.len); - (void)t_kfree(tiptr, (char *)p->cku_inudata, T_UNITDATA); + printf("clnt_clts_kcallit_addr: len too small %d\n", p->cku_inudata->udata.len); + t_kfree(tiptr, p->cku_inudata, T_UNITDATA); continue; } @@ -552,8 +499,8 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, /* LINTED pointer alignment */ if (*((u_long *)(p->cku_inbuf)) != *((u_long *)(p->cku_outbuf))) { rcstat.rcbadxids++; - (void)t_kfree(tiptr, (char *)p->cku_inudata, - T_UNITDATA); + if (t_kfree(tiptr, p->cku_inudata, T_UNITDATA) < 0) + printf("clnt_clts_kcallit_addr: t_kfree: %d\n", u.u_error); continue; } break; @@ -631,22 +578,6 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, p->cku_err.re_status = RPC_AUTHERROR; p->cku_err.re_why = AUTH_INVALIDRESP; rcstat.rcbadverfs++; - /* - * See if another message is here. If so, - * maybe it is the right response. - */ - (void)t_kspoll(tiptr, retry_poll_timo, READWAIT, &ret); - if (ret != 0) { - RPCLOG(1, - "clnt_clts_kcallit_addr (pid %d): validation failure: found another message\n", u.u_procp->p_pid); - (void)t_kfree(tiptr, - (char *)p->cku_inudata, - T_UNITDATA); - p->cku_inudata = NULL; - goto tryread; - } else - RPCLOG(1, - "clnt_clts_kcallit_addr (pid %d): validation failure: no messages waiting\n", u.u_procp->p_pid); } if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) { @@ -673,11 +604,13 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, } } - (void)t_kfree(tiptr, (char *)p->cku_inudata, T_UNITDATA); + t_kfree(tiptr, p->cku_inudata, T_UNITDATA); p->cku_inudata = NULL; - RPCLOG(2, "clnt_clts_kcallit_addr done\n", 0); +#ifdef RPCDEBUG + printf("cku_callit done\n"); +#endif done: if ((p->cku_err.re_status != RPC_SUCCESS) && (p->cku_err.re_status != RPC_INTR) && @@ -692,11 +625,10 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, if (p->cku_err.re_status == RPC_SYSTEMERROR || p->cku_err.re_status == RPC_CANTSEND) { /* - * Errors due to lack of resources, wait a bit + * Errors due to lack o resources, wait a bit * and try again. */ - (void) delay(10); - /* (void) sleep((caddr_t)&lbolt, PZERO-4); */ + (void) sleep((caddr_t)&lbolt, PZERO-4); } if (--stries > 0) { rcstat.rcretrans++; @@ -709,17 +641,20 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, */ s = splstr(); while (p->cku_flags & CKU_BUFBUSY) { - RPCLOG(2, "clnt_clts_kcallit_addr: pid %d loaned buffer busy - sleeping\n", u.u_procp->p_pid); + rcstat.rcbufbusy2++; p->cku_flags |= CKU_BUFWANTED; - (void)sleep((caddr_t)&p->cku_outbuf, PZERO-3); + if (cpjsleep((caddr_t)&p->cku_outbuf, PZERO-5, 10*100)<0){ + printf("cpjsleep: kludge2 buffer not sent in 10 secs\n"); + rcstat.kludge2++; + buffree(p); /*bogus*/ + } } (void) splx(s); - RPCLOG(2, "clnt_clts_kcallit_addr: pid %d loaned buffer not busy\n", u.u_procp->p_pid); p->cku_flags &= ~CKU_BUSY; if (p->cku_flags & CKU_WANTED) { p->cku_flags &= ~CKU_WANTED; - wakeprocs((caddr_t)h, PRMPT); + wakeup((caddr_t)h); } if (p->cku_err.re_status != RPC_SUCCESS) { rcstat.rcbadcalls++; @@ -729,13 +664,13 @@ clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, enum clnt_stat clnt_clts_kcallit(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait) - register CLIENT *h; - register u_long procnum; - register xdrproc_t xdr_args; - register caddr_t argsp; - register xdrproc_t xdr_results; - register caddr_t resultsp; - struct timeval wait; +register CLIENT *h; +register u_long procnum; +register xdrproc_t xdr_args; +register caddr_t argsp; +register xdrproc_t xdr_results; +register caddr_t resultsp; +struct timeval wait; { return (clnt_clts_kcallit_addr(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait, (struct netbuf *)0)); @@ -747,24 +682,24 @@ clnt_clts_kcallit(h, procnum, xdr_args, argsp, xdr_results, resultsp, wait) */ void clnt_clts_kerror(h, err) - register CLIENT *h; - register struct rpc_err *err; +register CLIENT *h; +register struct rpc_err *err; { /* LINTED pointer alignment */ - register struct cku_private *p = htop(h); + register struct cku_private *p = htop(h); *err = p->cku_err; } STATIC bool_t clnt_clts_kfreeres(cl, xdr_res, res_ptr) - register CLIENT *cl; - register xdrproc_t xdr_res; - register caddr_t res_ptr; +register CLIENT *cl; +register xdrproc_t xdr_res; +register caddr_t res_ptr; { /* LINTED pointer alignment */ - register struct cku_private *p = (struct cku_private *)cl->cl_private; - register XDR *xdrs = &(p->cku_outxdr); + register struct cku_private *p = (struct cku_private *)cl->cl_private; + register XDR *xdrs = &(p->cku_outxdr); xdrs->x_op = XDR_FREE; return ((*xdr_res)(xdrs, res_ptr)); @@ -776,23 +711,9 @@ clnt_clts_kabort() } bool_t -clnt_clts_kcontrol(h, cmd, arg) - register CLIENT *h; +clnt_clts_kcontrol() { - register struct cku_private *p = htop(h); - - switch(cmd) { - case CKU_LOANEDBUF: - /* Use a loaned buffer or not. - */ - if (arg) - p->cku_flags |= CKU_LOANEDBUF; - else p->cku_flags &= ~CKU_LOANEDBUF; - break; - default: - return FALSE; - } - return TRUE; + return (FALSE); } @@ -803,107 +724,20 @@ clnt_clts_kcontrol(h, cmd, arg) */ void clnt_clts_kdestroy(h) - register CLIENT *h; +register CLIENT *h; { /* LINTED pointer alignment */ - register struct cku_private *p = htop(h); - register TIUSER *tiptr; - - RPCLOG(2, "clnt_clts_kdestroy %x\n", h); + register struct cku_private *p = htop(h); + register TIUSER *tiptr; +#ifdef RPCDEBUG + printf("clnt_clts_destroy %x\n", h); +#endif tiptr = p->cku_tiptr; - kmem_free((caddr_t)p->cku_outbuf, p->cku_outbuflen); + kmem_free((caddr_t)p->cku_outbuf, (u_int)UDPMSGSIZE); kmem_free((caddr_t)p->cku_addr.buf, p->cku_addr.maxlen); kmem_free((caddr_t)p, sizeof (*p)); - (void)t_kclose(tiptr, 1); -} - -/* - * Ensure that the client handle's transport is opened over the transport - * provider we expect. - */ -void -clnt_clts_reopen(h, kncp) - register CLIENT *h; - struct knetconfig *kncp; -{ - /* LINTED pointer alignment */ - register struct cku_private *p = htop(h); - struct cred *tmpcred; - struct cred *savecred; - struct rpc_msg call_msg; - int error; - - if (p->cku_device != kncp->knc_rdev) { - /* first close the old transport */ - while ((error = t_kclose(p->cku_tiptr, 1)) != 0) { - RPCLOG(1, "clnt_clts_reopen: t_kclose: error %d\n", error); - (void)delay(HZ); - } - - /* Now open a new one, as root */ - do { - tmpcred = crdup(u.u_cred); - savecred = u.u_cred; - u.u_cred = tmpcred; - u.u_cred->cr_uid = 0; - error = t_kopen(NULL, kncp->knc_rdev, FREAD|FWRITE|FNDELAY, - &p->cku_tiptr); - u.u_cred = savecred; - crfree(tmpcred); - if (error) { - RPCLOG(1, "clnt_clts_reopen: t_kopen: error %d\n", error); - (void)delay(HZ); - } - } while (error); - - /* Now bind the new transport to an address */ - if (strcmp(kncp->knc_protofmly, NC_INET) == 0) { - while ((error = bindresvport(p->cku_tiptr)) != 0) { - RPCLOG(1, "clnt_clts_reopen: bindresvport failed: error %d\n", error); - (void)delay(HZ); - } - } - else { - while ((error = t_kbind(p->cku_tiptr, NULL, NULL)) != 0) { - RPCLOG(1, "clnt_clts_reopen: t_kbind: %d\n", error); - (void)delay(HZ); - } - } - - p->cku_device = kncp->knc_rdev; - - /* reallocate the output buffer if necessary */ - if (p->cku_outbuf && p->cku_outbuflen && - (p->cku_outbuflen < - MIN(p->cku_tiptr->tp_info.tsdu, CKU_MAXSIZE))) { - - /* call message, just used to pre-serialize below */ - call_msg.rm_xid = 0; - call_msg.rm_direction = CALL; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - /* LINTED pointer alignment */ - call_msg.rm_call.cb_prog = *((u_long *)p->cku_outbuf+3); - /* LINTED pointer alignment */ - call_msg.rm_call.cb_vers = *((u_long *)p->cku_outbuf+4); - - (void)kmem_free(p->cku_outbuf, p->cku_outbuflen); - p->cku_outbuflen = MIN(p->cku_tiptr->tp_info.tsdu, - CKU_MAXSIZE); - p->cku_outbuf = kmem_alloc(p->cku_outbuflen, KM_SLEEP); - - xdrmem_create(&p->cku_outxdr, p->cku_outbuf, - p->cku_outbuflen, XDR_ENCODE); - - /* pre-serialize call message header */ - while (! xdr_callhdr(&(p->cku_outxdr), &call_msg)) { - RPCLOG(1, "clnt_clts_reopen - header serialization error.", 0); - (void)delay(HZ); - } - p->cku_outpos = XDR_GETPOS(&(p->cku_outxdr)); - } - return; - } + t_kclose(tiptr, 1); } #endif diff --git a/usr/src/uts/3b2/rpc/clnt_gen.c b/usr/src/uts/3b2/rpc/clnt_gen.c index bd5eccd..3d32c55 100644 --- a/usr/src/uts/3b2/rpc/clnt_gen.c +++ b/usr/src/uts/3b2/rpc/clnt_gen.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/clnt_gen.c 1.10" +#ident "@(#)krpc:krpc/clnt_gen.c 1.6" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)clnt_gen.c 1.2 89/02/24 SMI" #endif @@ -53,36 +53,32 @@ static char sccsid[] = "@(#)clnt_gen.c 1.2 89/02/24 SMI" #include #include -#define NC_INET "inet" - -int clnt_clts_kcreate(); - -int -clnt_tli_kcreate(config, svcaddr, prog, vers, sendsz, retrys, cred, ncl) - register struct knetconfig *config; - struct netbuf *svcaddr; /* Servers address */ - u_long prog; /* Program number */ - u_long vers; /* Version number */ - u_int sendsz; /* send size */ - int retrys; - struct cred *cred; - CLIENT **ncl; +CLIENT *clnt_clts_kcreate(); + +CLIENT * +clnt_tli_kcreate(config, svcaddr, prog, vers, sendsz, recvsz, retrys, cred) +register struct knetconfig *config; +struct netbuf *svcaddr; /* Servers address */ +u_long prog; /* Program number */ +u_long vers; /* Version number */ +u_int sendsz; /* send size */ +u_int recvsz; /* recv size */ +int retrys; +struct cred *cred; { - CLIENT *cl; /* Client handle */ - TIUSER *tiptr; - register struct file *fp; - struct cred *tmpcred; - struct cred *savecred; - int error; - - error = 0; - cl = NULL; - - RPCLOG(2, "clnt_tli_kcreate: Entered prog %x\n", prog); - - if (config == NULL || config->knc_protofmly == NULL || ncl == NULL) { - RPCLOG(1, "clnt_tli_kcreate: bad config or handle\n", 0); - return EINVAL; + register CLIENT *cl = NULL; /* Client handle */ + /* register int fd, state; */ /* Current state of provider */ + register TIUSER *tiptr; + register struct file *fp; + struct cred *tmpcred, *savecred; + +#ifdef RPCDEBUG +printf("clnt_tli_kcreate: Entered fd %d, svcaddr %x\n", fd, svcaddr); +#endif + if (config == NULL) { + u.u_error = EINVAL; + printf("clnt_tli_kcreate: null config\n"); + return NULL; } /* the transport should be opened as root */ @@ -91,108 +87,119 @@ clnt_tli_kcreate(config, svcaddr, prog, vers, sendsz, retrys, cred, ncl) u.u_cred = tmpcred; u.u_cred->cr_uid = 0; fp = NULL; - error = t_kopen(fp, config->knc_rdev, FREAD|FWRITE|FNDELAY, &tiptr); + if ((tiptr = t_kopen(fp, config->nc_rdev, FREAD|FWRITE|FNDELAY, + (struct t_info *)NULL)) == NULL) { + printf("clnt_tli_kcreate: t_kopen: %d\n", u.u_error); + return NULL; + } u.u_cred = savecred; crfree(tmpcred); - if (error) { - RPCLOG(1, "clnt_tli_kcreate: t_kopen: %d\n", error); - return error; - } /* must bind the endpoint. */ - if (strcmp(config->knc_protofmly, NC_INET) == 0) { - while ((error = bindresvport(tiptr)) != 0) { - RPCLOG(1, "clnt_tli_kcreate: bindresvport failed error %d\n", error); - (void)delay(HZ); + if (config->nc_protofmly == AF_INET) { + if (bindresvport(tiptr) < 0) { + printf("clnt_tli_kcreate: bindresvport failed\n"); + goto err; } } else { - if ((error = t_kbind(tiptr, NULL, NULL)) != 0) { - RPCLOG(1, "clnt_tli_kcreate: t_kbind: %d\n", error); - goto err; + if (t_kbind(tiptr, NULL, NULL) < 0) { + printf("clnt_tli_kcreate: t_kbind: %d\n", u.u_error); + t_kclose(tiptr, 1); + return NULL; } } switch(tiptr->tp_info.servtype) { case T_CLTS: - error = clnt_clts_kcreate(tiptr, config->knc_rdev, - svcaddr, prog, vers, sendsz, retrys, cred, &cl); - if (error != 0) { - RPCLOG(1, "clnt_tli_kcreate: clnt_clts_kcreate failed error %d\n", error); + cl = clnt_clts_kcreate(tiptr, svcaddr, prog, vers, sendsz, recvsz, retrys, cred); + if (cl == (CLIENT *)NULL) { + printf("clnt_tli_kcreate: clnt_clts_kcreate failed\n"); goto err; } break; default: - error = EINVAL; - RPCLOG(1, "clnt_tli_kcreate: Bad service type %d\n", - tiptr->tp_info.servtype); + printf("clnt_tli_kcreate: Bad service type\n"); + u.u_error = EINVAL; goto err; } - *ncl = cl; - return 0; + return cl; err: t_kclose(tiptr, 1); - return error; + return (CLIENT *)NULL; } /* * try to bind to a reserved port */ -int bindresvport(tiptr) - register TIUSER *tiptr; +register TIUSER *tiptr; { - struct sockaddr_in *sin; - register int i; - struct t_bind *req; - struct t_bind *ret; - int error; - - error = 0; - -#define MAX_PRIV (IPPORT_RESERVED-1) -#define MIN_PRIV (IPPORT_RESERVED/2) - - RPCLOG(2, "bindresvport: calling t_kalloc tiptr = %x\n", tiptr); - - if ((error = t_kalloc(tiptr, T_BIND, T_ADDR, (char **)&req)) != 0) { - RPCLOG(1, "bindresvport: t_kalloc %d\n", error); - return error; + struct taddr_in *sin; + register int i; + int error; + struct cred *tmpcred; + struct cred *savecred; + struct t_bind *req, *ret; + +# define MAX_PRIV (IPPORT_RESERVED-1) +# define MIN_PRIV (IPPORT_RESERVED/2) + +#ifdef RPCDEBUG +printf("bindresvport: calling t_kalloc tiptr = %x\n", tiptr); +#endif + /* LINTED pointer alignment */ + if ((req = (struct t_bind *)t_kalloc(tiptr, T_BIND, T_ADDR)) == (struct t_bind *)NULL) { + printf("bindresvport: t_kalloc %d\n", u.u_error); + return u.u_error; } - RPCLOG(4, "bindresvport: calling t_kalloc tiptr = %x\n", tiptr); - - if ((error = t_kalloc(tiptr, T_BIND, T_ADDR, (char **)&ret)) != 0) { - RPCLOG(1, "bindresvport: t_kalloc %d\n", error); - (void)t_kfree(tiptr, req, T_BIND); - return error; +#ifdef RPCDEBUG +printf("bindresvport: calling t_kalloc tiptr = %x\n", tiptr); +#endif + /* LINTED pointer alignment */ + if ((ret = (struct t_bind *)t_kalloc(tiptr, T_BIND, T_ADDR)) == (struct t_bind *)NULL) { + printf("bindresvport: t_kalloc %d\n", u.u_error); + return u.u_error; } /* LINTED pointer alignment */ - sin = (struct sockaddr_in *)req->addr.buf; + sin = (struct taddr_in *)req->addr.buf; sin->sin_family = AF_INET; sin->sin_addr.s_addr = INADDR_ANY; - req->addr.len = sizeof(struct sockaddr_in); + req->addr.len = sizeof(struct taddr_in); + + /* + * Only root can bind to a privileged port number, so + * temporarily change the uid to 0 to do the bind. + */ + tmpcred = (struct cred *)crdup(u.u_procp->p_cred); + savecred = u.u_procp->p_cred; + u.u_procp->p_cred = tmpcred; + tmpcred->cr_uid = 0; error = EADDRINUSE; for (i = MAX_PRIV; error == EADDRINUSE && i >= MIN_PRIV; i--) { sin->sin_port = htons(i); - RPCLOG(2, "bindresvport: calling t_kbind tiptr = %x\n", tiptr); - if ((error = t_kbind(tiptr, req, ret)) != 0) - RPCLOG(1, "bindresvport: t_kbind: %d\n", error); +#ifdef RPCDEBUG +printf("bindresvport: calling t_kbind tiptr = %x\n", tiptr); +#endif + if ((error = t_kbind(tiptr, req, ret)) < 0) { + printf("bindresvport: t_kbind: %d\n", u.u_error); + error = u.u_error; + } else - if (bcmp((caddr_t)req->addr.buf, (caddr_t)ret->addr.buf, - ret->addr.len) != 0) { - RPCLOG(1, "bindresvport: bcmp error\n", 0); - (void)t_kunbind(tiptr); - error = EADDRINUSE; + if (bcmp((caddr_t)req, (caddr_t)ret, sizeof(req)) != 0) { + printf("bindresvport: bcmp error\n"); + error = EIO; } - else error = 0; } - if (error == 0) - RPCLOG(2, "bindresvport: port assigned %d\n", sin->sin_port); - (void)t_kfree(tiptr, req, T_BIND); - (void)t_kfree(tiptr, ret, T_BIND); - return error; + if (t_kfree(tiptr, req, T_BIND) < 0 || + t_kfree(tiptr, ret, T_BIND) < 0) { + printf("bindresvport: error on t_kfree\n"); + } + u.u_procp->p_cred = savecred; + crfree(tmpcred); + return (error); } diff --git a/usr/src/uts/3b2/rpc/cpjsleep.c b/usr/src/uts/3b2/rpc/cpjsleep.c new file mode 100644 index 0000000..4338564 --- /dev/null +++ b/usr/src/uts/3b2/rpc/cpjsleep.c @@ -0,0 +1,120 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)krpc:rpc/cpjsleep.c 1.2" +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)cpjsleep.c 1.3 89/01/27 SMI" +#endif + +/* + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's Unix(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988,1989 Sun Microsystems, Inc. + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + */ + +int cpjsleeps; +/* + * This function waits for timo clock ticks for something + * + * Returns: + * -1 on failure + * -2 on timeout + * 0 if desired event has occurred + * + * Most of the code is from strwaitq(). + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +int cpjflag; + +static void ktli_poll(); + +int +cpjsleep(ptr, prio,timo) +register int timo; +int ptr; +int prio; + +{ + register int s; + register int timeid; + register int status; + + + /* set timer and sleep. + */ + s = splstr(); + cpjflag = 0; + if (timo > 0) { + if ((timeid = timeout(ktli_poll, ptr, timo)) < 0) { + printf("cpjsleep: Can't set timer\n"); + return -1; + } + } + if (sleep((caddr_t)ptr, prio|PCATCH)) { + if (timo > 0) + untimeout(timeid); + (void) splx(s); + u.u_error = EINTR; + return -1; + } + + if(cpjflag != 0){ + printf("cpjsleep: woken from sleep -- ip or ether lost buffer free callback.\n"); + cpjsleeps++; + status = -2 ; + } + else status = 0; + + if (timo > 0) + untimeout(timeid); + (void)splx(s); + + return(status); +} + + + +static void +ktli_poll(ptr) +int ptr; + +{ + cpjflag = -1; + wakeup(ptr); +} + +/******************************************************************************/ diff --git a/usr/src/uts/3b2/rpc/key_call.c b/usr/src/uts/3b2/rpc/key_call.c index 2f481a7..a3588e0 100644 --- a/usr/src/uts/3b2/rpc/key_call.c +++ b/usr/src/uts/3b2/rpc/key_call.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/key_call.c 1.8" +#ident "@(#)krpc:krpc/key_call.c 1.6" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)key_call.c 1.5 89/01/13 SMI" #endif @@ -33,9 +33,10 @@ static char sccsid[] = "@(#)key_call.c 1.5 89/01/13 SMI" /* * key_call.c, Interface to keyserver - * key_encryptsession(agent, deskey) - encrypt a session key to talk to agent - * key_decryptsession(agent, deskey) - decrypt ditto - * key_gendes(deskey) - generate a secure des key + * setsecretkey(key) - set your secret key + * encryptsessionkey(agent, deskey) - encrypt a session key to talk to agent + * decryptsessionkey(agent, deskey) - decrypt ditto + * gendeskey(deskey) - generate a secure des key * netname2user(...) - get unix credential for given name (kernel only) */ #include @@ -48,16 +49,44 @@ static char sccsid[] = "@(#)key_call.c 1.5 89/01/13 SMI" #include #include #include +#include /*XXX*/ /*cpj*/ #include #include #include -#include #endif -#define KEY_TIMEOUT 30 /* per-try timeout in seconds */ -#define KEY_NRETRY 6 /* number of retries */ +#define KEY_TIMEOUT 5 /* per-try timeout in seconds */ +#define KEY_NRETRY 12 /* number of retries */ + +/*cpj#define debug(msg) /* turn off debugging */ +#define debug(msg) printf("key_call:%s\n",msg) + +extern CLIENT *clnt_tli_kcreate(); + +static struct timeval trytimeout = { KEY_TIMEOUT, 0 }; +#ifndef _KERNEL +static struct timeval tottimeout = { KEY_TIMEOUT * KEY_NRETRY, 0 }; +#endif + +#ifndef _KERNEL +key_setsecret(secretkey) + char *secretkey; +{ + keystatus status; + + if (!key_call((u_long)KEY_SET, xdr_keybuf, secretkey, xdr_keystatus, + (char*)&status)) + { + return (-1); + } + if (status != KEY_SUCCESS) { + debug("set status is nonzero"); + return (-1); + } + return (0); +} +#endif -static struct timeval keytrytimeout = { KEY_TIMEOUT, 0 }; key_encryptsession(remotename, deskey) char *remotename; @@ -74,7 +103,7 @@ key_encryptsession(remotename, deskey) return (-1); } if (res.status != KEY_SUCCESS) { - RPCLOG(1, "key_encryptsession: encrypt status is nonzero\n", 0); + debug("encrypt status is nonzero"); return (-1); } *deskey = res.cryptkeyres_u.deskey; @@ -97,7 +126,7 @@ key_decryptsession(remotename, deskey) return (-1); } if (res.status != KEY_SUCCESS) { - RPCLOG(1, "key_decryptsession: decrypt status is nonzero\n", 0); + debug("decrypt status is nonzero"); return (-1); } *deskey = res.cryptkeyres_u.deskey; @@ -107,9 +136,37 @@ key_decryptsession(remotename, deskey) key_gendes(key) des_block *key; { +#ifdef _KERNEL if (!key_call((u_long)KEY_GEN, xdr_void, (char *)NULL, xdr_des_block, - (char *)key)) + (char *)key)) + { + return (-1); + } +#else + struct sockaddr_in sin; + CLIENT *client; + int socket; + enum clnt_stat stat; + + + sin.sin_family = AF_INET; + sin.sin_port = 0; + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + bzero(sin.sin_zero, sizeof(sin.sin_zero)); + socket = RPC_ANYSOCK; + client = clntudp_bufcreate(&sin, (u_long)KEY_PROG, (u_long)KEY_VERS, + trytimeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + if (client == NULL) { + return (-1); + } + stat = clnt_call(client, KEY_GEN, xdr_void, NULL, + xdr_des_block, key, tottimeout); + clnt_destroy(client); + (void) close(socket); + if (stat != RPC_SUCCESS) { return (-1); + } +#endif return (0); } @@ -128,7 +185,7 @@ netname2user(name, uid, gid, len, groups) if (!key_call((u_long)KEY_GETCRED, xdr_netnamestr, (char *)&name, xdr_getcredres, (char *)&res)) { - RPCLOG(1, "netname2user: timed out?\n", 0); + debug("netname2user: timed out?"); return (0); } if (res.status != KEY_SUCCESS) { @@ -142,73 +199,149 @@ netname2user(name, uid, gid, len, groups) #endif #ifdef _KERNEL - -#define NC_LOOPBACK "loopback" /* XXX */ -char loopback_name[] = NC_LOOPBACK; - STATIC key_call(procn, xdr_args, args, xdr_rslt, rslt) - u_long procn; - bool_t (*xdr_args)(); - char *args; - bool_t (*xdr_rslt)(); - char *rslt; + u_long procn; + bool_t (*xdr_args)(); + char *args; + bool_t (*xdr_rslt)(); + char *rslt; { - static struct knetconfig config; /* avoid lookupname next time*/ - struct netbuf netaddr; - CLIENT *client; - enum clnt_stat stat; - struct vnode *vp; - int error; - static char keyname[SYS_NMLN+16]; - - strcpy(keyname, utsname.nodename); - netaddr.len = strlen(keyname); - strcpy(&keyname[netaddr.len], ".keyserv"); - - netaddr.buf = keyname; - /* 8 = strlen(".keyserv"); - */ - netaddr.len = netaddr.maxlen = netaddr.len + 8; + /* extern int clone_no, udp_no; /* got from ../io/conf.c */ + + struct sockaddr_in sin; + struct knetconfig config; + struct netbuf netaddr; + CLIENT *client; + enum clnt_stat stat; + struct vnode *vp; + int error; + + /*currently we talk to the portmapper using udp*/ + /*perhaps we will talk to the rpcbinder using local transport someday*/ + /*Instead we will probably use a well known local address for + keyserv instead --cpj*/ + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + sin.sin_port = htonl(PMAPPORT); /*cpj*/ + bzero(sin.sin_zero, sizeof(sin.sin_zero)); + + netaddr.buf = (char *)&sin; + /*netaddr.len = sizeof(sin); + netaddr.maxlen = sizeof(sin);*/ + netaddr.len=8;/*cpj*/ + netaddr.maxlen=8;/*cpj*/ /* filch a knetconfig structure. */ - if (config.knc_rdev == 0){ - if ((error = lookupname("/dev/ticlts", UIO_SYSSPACE, - FOLLOW, NULLVPP, &vp)) != 0) { - RPCLOG(1, "key_call: lookupname: %d\n", error); - return (0); - } - config.knc_rdev = vp->v_rdev; - config.knc_protofmly = loopback_name; - VN_RELE(vp); - } - RPCLOG(8, "key_call: procn %d, ", procn); - RPCLOG(8, "rdev %x, ", config.knc_rdev); - RPCLOG(8, "len %d, ", netaddr.len); - RPCLOG(8, "maxlen %d, ", netaddr.maxlen); - RPCLOG(8, "name %x\n", netaddr.buf); + config.nc_protofmly = AF_INET; + if ((error = lookupname("/dev/udp", UIO_SYSSPACE, FOLLOW, NULLVPP, &vp)) != 0) { + printf ("key_call: lookupname: %d\n", error); + return (0); + } + config.nc_rdev = vp->v_rdev; + VN_RELE(vp); + /* config.nc_rdev = makedevice(clone_no, udp_no); */ + config.nc_proto = 17; /*IPPROTO_UDP*/ + + /*getport loop returns -1 on portmap error 0 on no keyserver*/ + if ((sin.sin_port = getport_loop(&netaddr, (u_long)KEY_PROG, + (u_long)KEY_VERS, &config)) <= 0) /*cpj*/ + { + debug("unable to get port number for keyserver"); + return (0); + } /* now call the proper stuff. */ - error = clnt_tli_kcreate(&config, &netaddr, (u_long)KEY_PROG, - (u_long)KEY_VERS, 0, KEY_NRETRY, u.u_procp->p_cred, &client); + client = clnt_tli_kcreate(&config, &netaddr, (u_long)KEY_PROG, + (u_long)KEY_VERS, 0, 0, KEY_NRETRY, u.u_procp->p_cred); - if (error != 0) { - RPCLOG(1, "key_call: clnt_tli_kcreate rtned error %d", error); +/* + client = clntkudp_create(&sin, (u_long)KEY_PROG, (u_long)KEY_VERS, + KEY_NRETRY, u.u_procp->p_cred); +*/ + if (client == NULL) { + debug("could not create keyserver client"); return (0); } stat = clnt_call(client, procn, xdr_args, args, xdr_rslt, rslt, - keytrytimeout); + trytimeout); auth_destroy(client->cl_auth); clnt_destroy(client); if (stat != RPC_SUCCESS) { - RPCLOG(1, "key_call: keyserver clnt_call failed: stat %x",stat); - RPCLOG(1, clnt_sperrno(stat), 0); + debug("keyserver clnt_call failed: "); + debug(clnt_sperrno(stat)); return (0); } - RPCLOG(8, "key call: (%d) ok\n", procn); return (1); } +#else + +#include +#include + + +static +key_call(proc, xdr_arg, arg, xdr_rslt, rslt) + u_long proc; + bool_t (*xdr_arg)(); + char *arg; + bool_t (*xdr_rslt)(); + char *rslt; +{ + XDR xdrargs; + XDR xdrrslt; + FILE *fargs; + FILE *frslt; + void (*osigchild)(); + union wait status; + pid_t pid; + int success; + uid_t ruid; + uid_t euid; + static char MESSENGER[] = "/usr/etc/keyenvoy"; + + success = 1; + osigchild = signal(SIGCHLD, SIG_IGN); + + /* + * We are going to exec a set-uid program which makes our effective uid + * zero, and authenticates us with our real uid. We need to make the + * effective uid be the real uid for the setuid program, and + * the real uid be the effective uid so that we can change things back. + */ + euid = geteuid(); + ruid = getuid(); + (void) setreuid(euid, ruid); + pid = _openchild(MESSENGER, &fargs, &frslt); + (void) setreuid(ruid, euid); + if (pid < 0) { + debug("open_streams"); + return (0); + } + xdrstdio_create(&xdrargs, fargs, XDR_ENCODE); + xdrstdio_create(&xdrrslt, frslt, XDR_DECODE); + + if (!xdr_u_long(&xdrargs, &proc) || !(*xdr_arg)(&xdrargs, arg)) { + debug("xdr args"); + success = 0; + } + (void) fclose(fargs); + + if (success && !(*xdr_rslt)(&xdrrslt, rslt)) { + debug("xdr rslt"); + success = 0; + } + + (void) fclose(frslt); + if (wait4(pid, &status, 0, NULL) < 0 || status.w_retcode != 0) { + debug("wait4"); + success = 0; + } + (void)signal(SIGCHLD, osigchild); + + return (success); +} #endif diff --git a/usr/src/uts/3b2/rpc/pmap_kport.c b/usr/src/uts/3b2/rpc/pmap_kport.c new file mode 100644 index 0000000..68e9f88 --- /dev/null +++ b/usr/src/uts/3b2/rpc/pmap_kport.c @@ -0,0 +1,191 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)krpc:krpc/pmap_kport.c 1.6" +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)pmap_kgetport.c 1.5 89/01/13 SMI" +#endif + +/* + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's Unix(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988,1989 Sun Microsystems, Inc. + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + */ + +/* + * pmap_kgetport.c + * Kernel interface to pmap rpc service. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +static struct cred cred; +#define retries 4 +static struct timeval tottimeout = { 1, 0 }; +static char nullstring[] = "\000"; + +#ifndef DEBUG +#define cmn_err(type, msg) +#endif + +/* + * Find the mapped port for program,version. + * Calls the pmap service remotely to do the lookup. + * The 'address' argument is used to locate the portmapper. + * + * Returns: + * port number if successfully looked up. + * -1 otherwise. + */ +int +pmap_kgetport(address, program, version, config) + struct netbuf *address; + u_long program; + u_long version; + struct knetconfig *config; +{ + u_short port = 0; + register CLIENT *pmapclient, *rpcbclient; + struct pmap pmapparms; + struct rpcb rpcbparms; + char *ua, *uaddress; + struct netbuf *na, *uaddr2taddr(); + int error = -1;/*cpj*/ + extern bool_t xdr_wrapstring(); + + if (cred.cr_ref == 0) { + /* + * Reduce the number of groups in the cred from NGROUPS to 0. + */ + cred.cr_ngroups = 0; + /* cred.cr_ref = 0; */ /* redundant */ + } + + /* now call the proper stuff. + */ + /* first try RPCBPROG */ + rpcbclient = (CLIENT *)clnt_tli_kcreate(config, address, (u_long)RPCBPROG, + RPCBVERS, 0, 0, retries, &cred); + if (rpcbclient != (CLIENT *)NULL) { + uaddress = (char *) mem_alloc(1024); + ua = uaddress; + rpcbparms.r_prog = program; + rpcbparms.r_vers = version; + rpcbparms.r_netid = "udp"; /* for now */ + rpcbparms.r_addr = nullstring; /* not needed or used */ + if (CLNT_CALL(rpcbclient, RPCBPROC_GETADDR, xdr_rpcb, &rpcbparms, + xdr_wrapstring, &ua, tottimeout) != RPC_SUCCESS){ + error = -1; /* error contacting rpcbinder */ + } else if (ua[0] == NULL) { + error = 0; /* program not registered */ + } else { + na = uaddr2taddr(config, uaddress); + error = ((struct sockaddr_in *)na->buf)->sin_port; + mem_free (na->buf, na->maxlen); + mem_free ((char *)na, sizeof (struct netbuf)); + } + mem_free (uaddress, 1024); + AUTH_DESTROY(rpcbclient->cl_auth); + CLNT_DESTROY(rpcbclient); + } + + /* if RPCBPROG failed try PMAPPROG */ + if (error <= 0 && (pmapclient = (CLIENT *)clnt_tli_kcreate(config, address, + (u_long)PMAPPROG, PMAPVERS, 0, 0, retries, &cred)) != + (CLIENT *)NULL) { + pmapparms.pm_prog = program; + pmapparms.pm_vers = version; + pmapparms.pm_prot = config->nc_proto; + pmapparms.pm_port = 0; /* not needed or used */ + if (CLNT_CALL(pmapclient, PMAPPROC_GETPORT, xdr_pmap, &pmapparms, + xdr_u_short, &port, tottimeout) != RPC_SUCCESS){ + error = -1; /* error contacting portmapper */ + } else if (port == 0) { + error = 0; /* program not registered */ + } else { + error = port; + } + AUTH_DESTROY(pmapclient->cl_auth); + CLNT_DESTROY(pmapclient); + } + + return (error); +} + +/* + * getport_loop -- kernel interface to pmap_kgetport() + * + * Talks to the portmapper using the netbuf supplied by 'address', + * to lookup the specified 'program'. + * + * If the portmapper does not respond, prints console message (once). + * Retries forever, unless a signal is received. + * + * Returns: + * -1 on error + * 0= no port + * port number on success. + */ +getport_loop(address, program, version, config) + struct netbuf *address; + u_long program; + u_long version; + struct knetconfig *config; +{ + register int pe = 0; + register int i = 0; + + /* sit in a tight loop until the portmapper responds */ + while ((i = pmap_kgetport(address, program, version, config)) < 0) { + + /* test to see if a signal has come in */ + if (ISSIG(u.u_procp, 0)) { + cmn_err(CE_NOTE, "Portmapper not responding; giving up\n"); + goto out; /* got a signal */ + } + /* print this message only once */ + if (pe++ == 0) { + cmn_err(CE_NOTE, "Portmapper not responding; still trying\n"); + } + } /* go try the portmapper again */ + + /* got a response...print message if there was a delay */ + if (pe != 0) { + cmn_err(CE_NOTE, "Portmapper ok\n"); + } +out: + return(i); /* may return <0 if portmap dead */ +} diff --git a/usr/src/uts/3b2/rpc/pmap_prot.c b/usr/src/uts/3b2/rpc/pmap_prot.c new file mode 100644 index 0000000..10889db --- /dev/null +++ b/usr/src/uts/3b2/rpc/pmap_prot.c @@ -0,0 +1,56 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)krpc:krpc/pmap_prot.c 1.2" +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)pmap_prot.c 1.1 88/12/14 SMI" +#endif + +/* + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's Unix(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988,1989 Sun Microsystems, Inc. + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + */ + +/* + * pmap_prot.c + * Protocol for the local binder service, or pmap. + */ + +#include +#include +#include +#include + + +bool_t +xdr_pmap(xdrs, regs) + XDR *xdrs; + struct pmap *regs; +{ + + if (xdr_u_long(xdrs, ®s->pm_prog) && + xdr_u_long(xdrs, ®s->pm_vers) && + xdr_u_long(xdrs, ®s->pm_prot)) + return (xdr_u_long(xdrs, ®s->pm_port)); + return (FALSE); +} diff --git a/usr/src/uts/3b2/rpc/rpc.mk b/usr/src/uts/3b2/rpc/rpc.mk index 0fdfd77..849fddd 100644 --- a/usr/src/uts/3b2/rpc/rpc.mk +++ b/usr/src/uts/3b2/rpc/rpc.mk @@ -5,7 +5,7 @@ # The copyright notice above does not evidence any # actual or intended publication of such source code. -#ident "@(#)krpc:krpc/krpc.mk 1.8" +#ident "@(#)krpc:krpc/krpc.mk 1.6" # # @(#)rpc.mk 1.4 89/01/03 SMI # @@ -41,12 +41,12 @@ CFLAGS = $(DASHO) $(PFLAGS) -DSYSV DEFLIST = FRC = -KRPCOBJ = clnt_clts.o clnt_gen.o svc_gen.o svc_clts.o \ +KRPCOBJ = cpjsleep.o clnt_clts.o clnt_gen.o svc_gen.o svc_clts.o \ xdr_mblk.o xdr_mem.o svc.o auth_kern.o rpc_prot.o \ rpc_calmsg.o xdr.o svc_auth.o authu_prot.o \ svcauthdes.o svc_authu.o xdr_array.o key_call.o \ - key_prot.o clnt_perr.o \ - auth_des.o authdesprt.o authdesubr.o rpc_subr.o + key_prot.o pmap_kport.o pmap_prot.o clnt_perr.o \ + auth_des.o authdesprt.o authdesubr.o rpcb_prot.o all: KRPC @@ -80,8 +80,7 @@ auth_des.o: auth_des.c \ $(INC)/rpc/xdr.h \ $(INC)/netinet/in.h \ $(INC)/sys/cmn_err.h \ - $(INC)/sys/debug.h \ - $(FRC) + $(INC)/sys/debug.h auth_kern.o: auth_kern.c \ $(INC)/sys/param.h \ @@ -97,15 +96,13 @@ auth_kern.o: auth_kern.c \ $(INC)/sys/utsname.h \ $(INC)/sys/cred.h \ $(INC)/sys/kmem.h \ - $(INC)/sys/sysmacros.h \ - $(FRC) + $(INC)/sys/sysmacros.h authdesprt.o: authdesprt.c \ $(INC)/rpc/types.h \ $(INC)/rpc/xdr.h \ $(INC)/rpc/auth.h \ - $(INC)/rpc/auth_des.h \ - $(FRC) + $(INC)/rpc/auth_des.h authdesubr.o: authdesubr.c \ $(INC)/sys/param.h \ @@ -125,8 +122,7 @@ authdesubr.o: authdesubr.c \ $(INC)/sys/utsname.h \ $(INC)/sys/vnode.h \ $(INC)/sys/uio.h \ - $(INC)/sys/systeminfo.h \ - $(FRC) + $(INC)/sys/systeminfo.h authu_prot.o: authu_prot.c \ $(INC)/rpc/types.h \ @@ -138,8 +134,7 @@ authu_prot.o: authu_prot.c \ $(INC)/rpc/xdr.h \ $(INC)/rpc/auth.h \ $(INC)/rpc/auth_unix.h \ - $(INC)/sys/utsname.h \ - $(FRC) + $(INC)/sys/utsname.h clnt_clts.o: clnt_clts.c \ $(INC)/sys/param.h \ @@ -162,8 +157,7 @@ clnt_clts.o: clnt_clts.c \ $(INC)/sys/t_kuser.h \ $(INC)/sys/fcntl.h \ $(INC)/sys/errno.h \ - $(INC)/sys/kmem.h \ - $(FRC) + $(INC)/sys/kmem.h clnt_gen.o: clnt_gen.c \ $(INC)/sys/param.h \ @@ -186,15 +180,13 @@ clnt_gen.o: clnt_gen.c \ $(INC)/sys/socket.h \ $(INC)/sys/sysmacros.h \ $(INC)/sys/errno.h \ - $(INC)/sys/cred.h \ - $(FRC) + $(INC)/sys/cred.h clnt_perr.o: clnt_perr.c \ $(INC)/sys/types.h \ $(INC)/rpc/types.h \ $(INC)/rpc/auth.h \ - $(INC)/rpc/clnt.h \ - $(FRC) + $(INC)/rpc/clnt.h key_call.o: key_call.c \ $(INC)/sys/param.h \ @@ -208,14 +200,34 @@ key_call.o: key_call.c \ $(INC)/sys/sysmacros.h \ $(INC)/sys/vnode.h \ $(INC)/sys/uio.h \ - $(INC)/sys/debug.h \ - $(FRC) + $(INC)/sys/debug.h key_prot.o: key_prot.c \ $(INC)/sys/types.h \ $(INC)/rpc/rpc.h \ - $(INC)/rpc/key_prot.h \ - $(FRC) + $(INC)/rpc/key_prot.h + +pmap_kport.o: pmap_kport.c \ + $(INC)/rpc/types.h \ + $(INC)/netinet/in.h \ + $(INC)/rpc/xdr.h \ + $(INC)/rpc/auth.h \ + $(INC)/rpc/clnt.h \ + $(INC)/rpc/rpc.h \ + $(INC)/rpc/pmap_prot.h \ + $(INC)/rpc/rpcb_clnt.h \ + $(INC)/sys/time.h \ + $(INC)/sys/socket.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/param.h \ + $(INC)/sys/user.h \ + $(INC)/sys/proc.h + +pmap_prot.o: pmap_prot.c \ + $(INC)/sys/types.h \ + $(INC)/rpc/types.h \ + $(INC)/rpc/xdr.h \ + $(INC)/rpc/pmap_prot.h rpc_calmsg.o: rpc_calmsg.c \ $(INC)/sys/param.h \ @@ -225,8 +237,7 @@ rpc_calmsg.o: rpc_calmsg.c \ $(INC)/rpc/auth.h \ $(INC)/rpc/clnt.h \ $(INC)/rpc/rpc_msg.h \ - $(INC)/netinet/in.h \ - $(FRC) + $(INC)/netinet/in.h rpc_prot.o: rpc_prot.c \ $(INC)/sys/param.h \ @@ -236,8 +247,7 @@ rpc_prot.o: rpc_prot.c \ $(INC)/rpc/auth.h \ $(INC)/rpc/clnt.h \ $(INC)/rpc/rpc_msg.h \ - $(INC)/netinet/in.h \ - $(FRC) + $(INC)/netinet/in.h svc.o: svc.c \ $(INC)/sys/param.h \ @@ -261,8 +271,7 @@ svc.o: svc.c \ $(INC)/sys/stream.h \ $(INC)/sys/strsubr.h \ $(INC)/sys/tihdr.h \ - $(INC)/sys/debug.h \ - $(FRC) + $(INC)/sys/debug.h svc_auth.o: svc_auth.c \ $(INC)/sys/param.h \ @@ -277,8 +286,7 @@ svc_auth.o: svc_auth.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/t_kuser.h \ $(INC)/rpc/svc.h \ - $(INC)/rpc/svc_auth.h \ - $(FRC) + $(INC)/rpc/svc_auth.h svc_authu.o: svc_authu.c \ $(INC)/sys/param.h \ @@ -295,8 +303,7 @@ svc_authu.o: svc_authu.c \ $(INC)/sys/t_kuser.h \ $(INC)/rpc/svc.h \ $(INC)/rpc/auth_unix.h \ - $(INC)/rpc/svc_auth.h \ - $(FRC) + $(INC)/rpc/svc_auth.h svc_clts.o: svc_clts.c \ $(INC)/sys/param.h \ @@ -318,8 +325,7 @@ svc_clts.o: svc_clts.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/fcntl.h \ $(INC)/sys/errno.h \ - $(INC)/sys/kmem.h \ - $(FRC) + $(INC)/sys/kmem.h svc_gen.o: svc_gen.c \ $(INC)/sys/param.h \ @@ -336,8 +342,7 @@ svc_gen.o: svc_gen.c \ $(INC)/sys/stream.h \ $(INC)/sys/tihdr.h \ $(INC)/sys/fcntl.h \ - $(INC)/sys/errno.h \ - $(FRC) + $(INC)/sys/errno.h svcauthdes.o: svcauthdes.c \ $(INC)/rpc/des_crypt.h \ @@ -354,22 +359,19 @@ svcauthdes.o: svcauthdes.c \ $(INC)/sys/tihdr.h \ $(INC)/sys/t_kuser.h \ $(INC)/rpc/svc.h \ - $(INC)/rpc/rpc_msg.h \ - $(FRC) + $(INC)/rpc/rpc_msg.h xdr.o: xdr.c \ $(INC)/sys/param.h \ $(INC)/sys/types.h \ $(INC)/rpc/types.h \ - $(INC)/rpc/xdr.h \ - $(FRC) + $(INC)/rpc/xdr.h xdr_array.o: xdr_array.c \ $(INC)/sys/param.h \ $(INC)/sys/types.h \ $(INC)/rpc/types.h \ - $(INC)/rpc/xdr.h \ - $(FRC) + $(INC)/rpc/xdr.h xdr_mblk.o: xdr_mblk.c \ $(INC)/sys/param.h \ @@ -377,18 +379,18 @@ xdr_mblk.o: xdr_mblk.c \ $(INC)/rpc/types.h \ $(INC)/sys/stream.h \ $(INC)/rpc/xdr.h \ - $(INC)/netinet/in.h \ - $(FRC) + $(INC)/netinet/in.h xdr_mem.o: xdr_mem.c \ $(INC)/sys/param.h \ $(INC)/sys/types.h \ $(INC)/netinet/in.h \ $(INC)/rpc/types.h \ - $(INC)/rpc/xdr.h \ - $(FRC) + $(INC)/rpc/xdr.h -rpc_subr.o: rpc_subr.c \ +rpcb_prot.o: rpcb_prot.c \ $(INC)/sys/types.h \ $(INC)/sys/param.h \ - $(FRC) + $(INC)/rpc/types.h \ + $(INC)/rpc/xdr.h \ + $(INC)/rpc/rpcb_prot.h diff --git a/usr/src/uts/3b2/rpc/rpc_com.h b/usr/src/uts/3b2/rpc/rpc_com.h index 6c9df52..a004b6b 100644 --- a/usr/src/uts/3b2/rpc/rpc_com.h +++ b/usr/src/uts/3b2/rpc/rpc_com.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/rpc/rpc_com.h 1.4" +#ident "@(#)head.sys:sys/rpc/rpc_com.h 1.3" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/rpc/rpcb_prot.c b/usr/src/uts/3b2/rpc/rpcb_prot.c new file mode 100644 index 0000000..612f33c --- /dev/null +++ b/usr/src/uts/3b2/rpc/rpcb_prot.c @@ -0,0 +1,118 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)krpc:rpc/rpcb_prot.c 1.2" +#if !defined(lint) && defined(SCCSIDS) +static char sccsid[] = "@(#)rpcb_kprot.c 1.1 89/05/18 SMI" +#endif + +/* + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's Unix(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988,1989 Sun Microsystems, Inc. + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + */ + +/* + * rpcb_kprot.c.c + * Kernel rpcb protocol routines. + * (+ TCP/IP uaddr2taddr ) + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +bool_t +xdr_rpcb(xdrs, objp) + XDR *xdrs; + RPCB *objp; +{ + if (!xdr_u_long(xdrs, &objp->r_prog)) { + return (FALSE); + } + if (!xdr_u_long(xdrs, &objp->r_vers)) { + return (FALSE); + } + if (!xdr_string(xdrs, &objp->r_netid, ~0)) { + return (FALSE); + } + if (!xdr_string(xdrs, &objp->r_addr, ~0)) { + return (FALSE); + } + return (TRUE); +} + +/* TCP/IP specific uaddr2taddr - for now we know we're talking to UDP */ +/* addr format a1.a2.a3.a4.p1.p2 */ +struct netbuf * +uaddr2taddr(tp, addr) + struct knetconfig *tp; + char *addr; +{ + struct sockaddr_in *sin; + struct netbuf *result; + u_long inaddr = 0; + u_short inport = 0; + char *cp = addr; + int i; + + result = mem_alloc(sizeof(struct netbuf)); + result->maxlen = 8; + result->len = 8; + result->buf = mem_alloc(result->maxlen); + sin = (struct sockaddr_in *)result->buf; + for (i=3; i>=0; i--) { + while (*cp != '.') cp++; + *cp++ = '\0'; + inaddr += atoi(addr) << (i*8); + addr = cp; + } + for (i=1; i>=0; i--) { + while (*cp != '.' && *cp != '\0') cp++; + *cp++ = '\0'; + inport += atoi(addr) << (i*8); + addr = cp; + } + + sin->sin_family = AF_INET; + sin->sin_port = inport; + sin->sin_addr.s_addr = inaddr; + return (result); +} + +static int +atoi(s) + char *s; +{ + int i, n = 0; + + for (i=0; s[i] >= '0' && s[i] <= '9'; i++) + n = 10 * n + (s[i] - '0'); + return n; +} diff --git a/usr/src/uts/3b2/rpc/rpcb_prot.h b/usr/src/uts/3b2/rpc/rpcb_prot.h index c7825a3..2a4a3fa 100644 --- a/usr/src/uts/3b2/rpc/rpcb_prot.h +++ b/usr/src/uts/3b2/rpc/rpcb_prot.h @@ -6,7 +6,7 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/rpc/rpcb_prot.h 1.6" +#ident "@(#)head.sys:sys/rpc/rpcb_prot.h 1.4" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -24,7 +24,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ @@ -100,7 +100,6 @@ struct rpcb { u_long r_vers; /* version number */ char *r_netid; /* network id */ char *r_addr; /* universal address */ - char *r_owner; /* owner of the mapping */ }; typedef struct rpcb RPCB; extern bool_t xdr_rpcb(); diff --git a/usr/src/uts/3b2/rpc/rpcent.h b/usr/src/uts/3b2/rpc/rpcent.h index 85ea7ba..95f5a1c 100644 --- a/usr/src/uts/3b2/rpc/rpcent.h +++ b/usr/src/uts/3b2/rpc/rpcent.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/rpc/rpcent.h 1.3" +#ident "@(#)head.sys:sys/rpc/rpcent.h 1.2" /* @(#)rpcent.h 1.1 88/12/06 SMI */ @@ -36,9 +36,6 @@ * */ -#ifndef _RPC_RPCENT_H -#define _RPC_RPCENT_H - struct rpcent { char *r_name; /* name of server for this rpc program */ char **r_aliases; /* alias list */ @@ -49,4 +46,3 @@ extern struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); extern int setrpcent(); extern void endrpcent(); -#endif /* _RPC_RPCENT_H */ diff --git a/usr/src/uts/3b2/rpc/svc.c b/usr/src/uts/3b2/rpc/svc.c index 39c3e92..cf9c317 100644 --- a/usr/src/uts/3b2/rpc/svc.c +++ b/usr/src/uts/3b2/rpc/svc.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/svc.c 1.9" +#ident "@(#)krpc:krpc/svc.c 1.7" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)svc.c 1.1 88/12/12 SMI" #endif @@ -348,7 +348,7 @@ svc_getreq(xprt) } /* now match message with a registered service*/ prog_found = FALSE; - low_vers = (u_long)-1; + low_vers = -1UL; high_vers = 0; for (s = svc_head; s != NULL_SVC; s = s->sc_next) { if (s->sc_prog == r.rq_prog) { @@ -398,23 +398,19 @@ void svc_run(xprt) SVCXPRT *xprt; { - int error; - int events; - /* CONSTCOND */ while (TRUE) { - RPCLOG(4, "svc_run: calling t_kspoll pid %d, ", u.u_procp->p_pid); - RPCLOG(4, "tiptr = %x\n", xprt->xp_tiptr); - events = 0; - while (events == 0 && (error = t_kspoll(xprt->xp_tiptr, 0, - READWAIT, &events)) == 0) { - if ((error = t_kspoll(xprt->xp_tiptr, -1, READWAIT, - &events)) != 0) +#ifdef RPCDEBUG +printf("svc_run: pid %d calling t_kspoll tiptr = %x\n", u.u_procp->p_pid, xprt->xp_tiptr); +#endif + while (t_kspoll(xprt->xp_tiptr, 0, READWAIT) == 0) + if (t_kspoll(xprt->xp_tiptr, -1, READWAIT) == -1) break; - } - if (error) { - RPCLOG(1, "svc_run: Server going down due to errno: %d\n", error); + if (u.u_error) { +#ifdef RPCDEBUG +printf("svc_run: Server going down due to errno: %d\n", u.u_error); +#endif SVC_DESTROY(xprt); /* sigclearall(u.u_procp); */ /* gone, so duplicate it's effects */ { @@ -428,8 +424,9 @@ svc_run(xprt) exit(CLD_EXITED, 0); } - RPCLOG(4, "svc_run: calling svc_getreq pid %d, ", u.u_procp->p_pid); - RPCLOG(4, "tiptr = %x\n", xprt->xp_tiptr); +#ifdef RPCDEBUG +printf("svc_run: pid %d, calling svc_getreq tiptr = %x\n", u.u_procp->p_pid, xprt->xp_tiptr); +#endif svc_getreq(xprt); Rpccnt++; } diff --git a/usr/src/uts/3b2/rpc/svc.h b/usr/src/uts/3b2/rpc/svc.h index b35874f..fca9855 100644 --- a/usr/src/uts/3b2/rpc/svc.h +++ b/usr/src/uts/3b2/rpc/svc.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/rpc/svc.h 1.6" +#ident "@(#)head.sys:sys/rpc/svc.h 1.5" /* @(#)svc.h 1.35 88/12/17 SMI */ @@ -103,9 +103,6 @@ typedef struct { #endif struct opaque_auth xp_verf; /* raw response verifier */ caddr_t xp_p1; /* private: for use by svc ops */ -#ifdef _KERNEL - u_int xp_p1len; /* size of p1 */ -#endif caddr_t xp_p2; /* private: for use by svc ops */ caddr_t xp_p3; /* private: for use by svc lib */ } SVCXPRT; @@ -359,6 +356,6 @@ svc_raw_create(); #else /* kernel based rpc */ -extern int svc_tli_kcreate(); +extern SVCXPRT *svc_tli_kcreate(); #endif /* !_KERNEL */ #endif /* !_RPC_SVC_H */ diff --git a/usr/src/uts/3b2/rpc/svc_authu.c b/usr/src/uts/3b2/rpc/svc_authu.c index 3bfa4cb..d6dc551 100644 --- a/usr/src/uts/3b2/rpc/svc_authu.c +++ b/usr/src/uts/3b2/rpc/svc_authu.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/svc_authu.c 1.4" +#ident "@(#)krpc:krpc/svc_authu.c 1.3" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)svc_auth_unix.c 1.3 89/01/11 SMI" #endif @@ -88,7 +88,7 @@ _svcauth_unix(rqst, msg) area = (struct area *) rqst->rq_clntcred; aup = &area->area_aup; aup->aup_machname = area->area_machname; - aup->aup_gids = (gid_t *)area->area_gids; + aup->aup_gids = area->area_gids; auth_len = (u_int)msg->rm_call.cb_cred.oa_length; xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len,XDR_DECODE); buf = XDR_INLINE(&xdrs, auth_len); diff --git a/usr/src/uts/3b2/rpc/svc_clts.c b/usr/src/uts/3b2/rpc/svc_clts.c index 7351085..982e6fa 100644 --- a/usr/src/uts/3b2/rpc/svc_clts.c +++ b/usr/src/uts/3b2/rpc/svc_clts.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/svc_clts.c 1.9" +#ident "@(#)krpc:krpc/svc_clts.c 1.5" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)svc_clts.c 1.2 89/01/11 SMI" #endif @@ -40,7 +40,6 @@ static char sccsid[] = "@(#)svc_clts.c 1.2 89/01/11 SMI" #include #include -#include #include #include #include @@ -59,10 +58,8 @@ static char sccsid[] = "@(#)svc_clts.c 1.2 89/01/11 SMI" #include #include #include -#include #define rpc_buffer(xprt) ((xprt)->xp_p1) -#define rpc_bufferlen(xprt) ((xprt)->xp_p1len) static void unhash(); @@ -103,7 +100,6 @@ struct udp_data { frtn_t ud_frtn; /* message free routine */ }; -#define UD_MAXSIZE 8800 /* * Flags @@ -129,31 +125,22 @@ struct { * There is one transport record per user process which implements a * set of services. */ -/* ARGSUSED */ -int -svc_clts_kcreate(tiptr, sendsz, nxprt) - register TIUSER *tiptr; - register u_int sendsz; - register SVCXPRT **nxprt; -{ - register struct udp_data *ud; - int error; - SVCXPRT *xprt; - - RPCLOG(4, "svc_clts_kcreate: Entered tiptr %x\n", tiptr); - if (nxprt == NULL) - return EINVAL; +/*ARGSUSED*/ +SVCXPRT * +svc_clts_kcreate(tiptr, sendsz, recvsz) +register TIUSER *tiptr; +register u_int sendsz, recvsz; +{ + register SVCXPRT *xprt; + register struct udp_data *ud; - sendsz = MIN(tiptr->tp_info.tsdu, UD_MAXSIZE); - RPCLOG(4, "svc_clts_kcreate: sendsz %d\n", sendsz); +#ifdef RPCDEBUG +printf("svc_clts_kcreate: Entered tiptr %x\n", tiptr); +#endif xprt = (SVCXPRT *)kmem_alloc((u_int)sizeof(SVCXPRT), KM_SLEEP); - - - rpc_buffer(xprt) = (caddr_t)kmem_alloc(sendsz, KM_SLEEP); - rpc_bufferlen(xprt) = sendsz; - + rpc_buffer(xprt) = (caddr_t)kmem_alloc((u_int)UDPMSGSIZE, KM_SLEEP); ud = (struct udp_data *)kmem_alloc((u_int)sizeof(struct udp_data), KM_SLEEP); bzero((caddr_t)ud, sizeof(*ud)); xprt->xp_p2 = (caddr_t)ud; @@ -161,22 +148,8 @@ svc_clts_kcreate(tiptr, sendsz, nxprt) xprt->xp_verf.oa_base = ud->ud_verfbody; xprt->xp_ops = &svc_clts_op; xprt->xp_tiptr = tiptr; - - xprt->xp_ltaddr.buf = NULL; - xprt->xp_ltaddr.maxlen = 0; - xprt->xp_ltaddr.len = 0; - - /* Allocate receive address buffer. - */ - xprt->xp_rtaddr.buf = kmem_alloc(tiptr->tp_info.addr, KM_SLEEP); - xprt->xp_rtaddr.maxlen = tiptr->tp_info.addr; - xprt->xp_rtaddr.len = 0; - RPCLOG(4, "svc_clts_kcreate: receive address size %d\n", - tiptr->tp_info.addr); - - *nxprt = xprt; - - return (0); + bzero((caddr_t)&xprt->xp_ltaddr, sizeof(struct netbuf)); + return (xprt); } /* @@ -185,26 +158,25 @@ svc_clts_kcreate(tiptr, sendsz, nxprt) */ void svc_clts_kdestroy(xprt) - register SVCXPRT *xprt; + register SVCXPRT *xprt; { /* LINTED pointer alignment */ - register struct udp_data *ud = (struct udp_data *)xprt->xp_p2; - int error; + register struct udp_data *ud = (struct udp_data *)xprt->xp_p2; + /* register struct file *tiptr; */ - RPCLOG(4, "svc_clts_kdestroy %x\n", xprt); - - if (ud->ud_inudata) - (void)t_kfree(xprt->xp_tiptr, (char *)ud->ud_inudata, - T_UNITDATA); +#ifdef RPCDEBUG + printf("usr_destroy %x\n", xprt); +#endif + if (ud->ud_inudata) { + if (t_kfree(xprt->xp_tiptr, (char *)ud->ud_inudata, T_UNITDATA) < 0) + printf("svc_clts_kdestroy: t_kfree: %d\n", u.u_error); + } if (xprt->xp_ltaddr.buf) kmem_free(xprt->xp_ltaddr.buf, xprt->xp_ltaddr.maxlen); - if (xprt->xp_rtaddr.buf) - kmem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen); - t_kclose(xprt->xp_tiptr, 0); kmem_free((caddr_t)ud, (u_int)sizeof(struct udp_data)); - kmem_free((caddr_t)rpc_buffer(xprt), rpc_bufferlen(xprt)); + kmem_free((caddr_t)rpc_buffer(xprt), (u_int)UDPMSGSIZE); kmem_free((caddr_t)xprt, (u_int)sizeof(SVCXPRT)); } @@ -215,74 +187,65 @@ svc_clts_kdestroy(xprt) */ bool_t svc_clts_krecv(xprt, msg) - register SVCXPRT *xprt; - struct rpc_msg *msg; + register SVCXPRT *xprt; + struct rpc_msg *msg; { /* LINTED pointer alignment */ - register struct udp_data *ud = (struct udp_data *)xprt->xp_p2; - register XDR *xdrs = &(ud->ud_xdrin); - struct t_kunitdata *inudata; - int type; - int uderr; - int error; - - RPCLOG(4, "svc_clts_krecv %x\n", xprt); + register struct udp_data *ud = (struct udp_data *)xprt->xp_p2; + register XDR *xdrs = &(ud->ud_xdrin); + register struct t_kunitdata *inudata; + int flags; +#ifdef RPCDEBUG + printf("svc_clts_krecv %x\n", xprt); +#endif /* get a receive buffer */ - if ((error = t_kalloc(xprt->xp_tiptr, T_UNITDATA, T_ADDR|T_UDATA, - (char **)&inudata)) != 0) { - RPCLOG(1, "svc_clts_krecv: t_kalloc: %d\n", error); + if ((inudata = (struct t_kunitdata *)t_kalloc(xprt->xp_tiptr, + /* LINTED pointer alignment */ + T_UNITDATA, T_ADDR|T_UDATA)) == (struct t_kunitdata *)NULL) { + printf("svc_clts_krecv: t_kalloc: %d\n", u.u_error); goto bad; } rsstat.rscalls++; - if ((error = t_krcvudata(xprt->xp_tiptr, inudata, &type, &uderr)) - != 0) { - RPCLOG(1, "svc_clts_krecv: t_krcvudata: %d\n", error); - if (error == EAGAIN) { + if (t_krcvudata(xprt->xp_tiptr, inudata, &flags) < 0) { + printf("svc_clts_krecv: t_krcvudata: %d\n", u.u_error); + if (u.u_error == EAGAIN) { rsstat.rsnullrecv++; return FALSE; } else goto bad; } - if (type != T_DATA) { - RPCLOG(1, "svc_clts_krecv: t_krcvudata: bad type %d\n", type); - /* Got T_UDERROR_IND - */ - goto bad; - } - - RPCLOG(4, "svc_clts_krecv: t_krcvudata returned %d bytes\n", inudata->udata.len); - - if (inudata->addr.len > xprt->xp_rtaddr.maxlen) { - RPCLOG(4, "svc_clts_krecv: Bad address len %d\n", - inudata->addr.len); - goto bad; - } - bcopy(inudata->addr.buf, xprt->xp_rtaddr.buf, inudata->addr.len); +#ifdef RPCDEBUG +printf("svc_clts_krecv: t_krcvudata returned %d bytes\n", inudata->udata.len); +#endif + xprt->xp_rtaddr.buf = kmem_alloc (inudata->addr.len, KM_SLEEP); xprt->xp_rtaddr.len = inudata->addr.len; + xprt->xp_rtaddr.maxlen = inudata->addr.maxlen; + bcopy (inudata->addr.buf, xprt->xp_rtaddr.buf, xprt->xp_rtaddr.len); if (inudata->udata.len < 4*sizeof(u_long)) { - RPCLOG(1, "svc_clts_krecv: bad length %d\n", inudata->udata.len); - + printf("svc_clts_krecv: bad length %d\n", inudata->udata.len); rsstat.rsbadlen++; goto bad; } xdrmblk_init(xdrs, inudata->udata.udata_mp, XDR_DECODE); if (! xdr_callmsg(xdrs, msg)) { - RPCLOG(1, "svc_clts_krecv: bad xdr_callmsg\n", 0); + printf("svc_clts_krecv: bad xdr_callmsg\n"); rsstat.rsxdrcall++; goto bad; } ud->ud_xid = msg->rm_xid; ud->ud_inudata = inudata; - RPCLOG(4, "svc_clts_krecv done\n", 0); - +#ifdef RPCDEBUG + printf("svc_clts_krecv done\n"); +#endif return (TRUE); bad: - (void)t_kfree(xprt->xp_tiptr, (char *)inudata, T_UNITDATA); + if (t_kfree(xprt->xp_tiptr, (char *)inudata, T_UNITDATA) < 0) + printf("svc_clts_krecv: t_kfree %d\n", u.u_error); ud->ud_inudata = NULL; rsstat.rsbadcalls++; @@ -294,12 +257,10 @@ static void buffree(ud) register struct udp_data *ud; { - RPCLOG(4, "buffree: (svc) entered ud %x\n", ud); ud->ud_flags &= ~UD_BUSY; if (ud->ud_flags & UD_WANTED) { ud->ud_flags &= ~UD_WANTED; - RPCLOG(4, "buffree: (svc) waking sleeper\n", 0); - wakeprocs((caddr_t)ud, PRMPT); + wakeup((caddr_t)ud); } } @@ -311,37 +272,35 @@ buffree(ud) bool_t /* ARGSUSED */ svc_clts_ksend(xprt, msg) - register SVCXPRT *xprt; - struct rpc_msg *msg; + register SVCXPRT *xprt; + struct rpc_msg *msg; { /* LINTED pointer alignment */ - register struct udp_data *ud = (struct udp_data *)xprt->xp_p2; - register XDR *xdrs = &(ud->ud_xdrout); - register int slen; - register int stat = FALSE; - int s; - struct t_kunitdata *unitdata; - int error; - - RPCLOG(4, "svc_clts_ksend %x\n", xprt); - + register struct udp_data *ud = (struct udp_data *)xprt->xp_p2; + register XDR *xdrs = &(ud->ud_xdrout); + register int slen; + register int stat = FALSE; + int s; + struct t_kunitdata *unitdata; + +#ifdef RPCDEBUG + printf("svc_clts_ksend %x\n", xprt); +#endif s = splstr(); while (ud->ud_flags & UD_BUSY) { - RPCLOG(4, "svc_clts_ksend: pid %d UD_BUSY set - sleeping\n", u.u_procp->p_pid); ud->ud_flags |= UD_WANTED; (void) sleep((caddr_t)ud, PZERO-2); } ud->ud_flags |= UD_BUSY; (void) splx(s); - - RPCLOG(4, "svc_clts_ksend: pid %d UD_BUSY notset\n", u.u_procp->p_pid); - xdrmem_create(xdrs, rpc_buffer(xprt), rpc_bufferlen(xprt), XDR_ENCODE); + xdrmem_create(xdrs, rpc_buffer(xprt), UDPMSGSIZE, XDR_ENCODE); msg->rm_xid = ud->ud_xid; if (xdr_replymsg(xdrs, msg)) { slen = (int)XDR_GETPOS(xdrs); - if ((error = t_kalloc(xprt->xp_tiptr, T_UNITDATA, - T_ADDR|T_UDATA, (char **)&unitdata)) != 0) { - RPCLOG(1, "svc_clts_ksend: t_kalloc: %d\n", error); + if ((unitdata = (struct t_kunitdata *)t_kalloc(xprt->xp_tiptr, + /* LINTED pointer alignment */ + T_UNITDATA, T_ADDR)) == (struct t_kunitdata *)NULL) { + printf("svc_clts_ksend: t_kalloc: %d\n", u.u_error); } else { unitdata->addr.len = xprt->xp_rtaddr.len; @@ -353,24 +312,29 @@ svc_clts_ksend(xprt, msg) ud->ud_frtn.free_func = buffree; ud->ud_frtn.free_arg = (char *)ud; -RPCLOG(4, "svc_clts_ksend: calling t_ksndudata fd = %x\n", xprt->xp_tiptr); -RPCLOG(4, "svc_clts_ksend: calling t_ksndudata bytes = %d\n", unitdata->udata.len); - if ((error = t_ksndudata(xprt->xp_tiptr, unitdata, - &ud->ud_frtn)) != 0) { - RPCLOG(1, - "svc_clts_ksend: t_ksndudata: %d\n", error); +#ifdef RPCDEBUG +printf("svc_clts_ksend: calling t_ksndudata fd = %x, bytes = %d\n", xprt->xp_tiptr, unitdata->udata.len); +#endif + if (t_ksndudata(xprt->xp_tiptr, unitdata, &ud->ud_frtn) < 0) { + printf("svc_clts_ksend: t_ksndudata: %d\n", + u.u_error); } else { stat = TRUE; } /* now we have to free up the unitdata */ - (void)t_kfree(xprt->xp_tiptr, (char *)unitdata, - T_UNITDATA); + if (t_kfree(xprt->xp_tiptr, (char *)unitdata, T_UNITDATA) < 0) + printf("svc_clts_ksend: t_kfree: %d\n", +u.u_error); } } else { - RPCLOG(4, "svc_clts_ksend: xdr_replymsg failed\n", 0); +#ifdef RPCDEBUG +printf("svc_clts_ksend: xdr_replymsg failed\n"); +#endif buffree (ud); + /* not allocated, so don't free it */ + /* t_kfree(xprt->xp_tiptr, (char *)unitdata, T_UNITDATA); */ } /* * This is completely disgusting. If public is set it is @@ -383,8 +347,9 @@ RPCLOG(4, "svc_clts_ksend: calling t_ksndudata bytes = %d\n", unitdata->udata.le /* LINTED pointer alignment */ (**((int (**)())xdrs->x_public))(xdrs->x_public); } - RPCLOG(4, "svc_clts_ksend done\n", 0); - +#ifdef RPCDEBUG + printf("svc_clts_ksend done\n"); +#endif return (stat); } @@ -405,9 +370,9 @@ svc_clts_kstat(xprt) */ bool_t svc_clts_kgetargs(xprt, xdr_args, args_ptr) - SVCXPRT *xprt; - xdrproc_t xdr_args; - caddr_t args_ptr; + SVCXPRT *xprt; + xdrproc_t xdr_args; + caddr_t args_ptr; { /* LINTED pointer alignment */ @@ -416,23 +381,19 @@ svc_clts_kgetargs(xprt, xdr_args, args_ptr) bool_t svc_clts_kfreeargs(xprt, xdr_args, args_ptr) - SVCXPRT *xprt; - xdrproc_t xdr_args; - caddr_t args_ptr; + SVCXPRT *xprt; + xdrproc_t xdr_args; + caddr_t args_ptr; { /* LINTED pointer alignment */ - register XDR *xdrs; + register XDR *xdrs = &(((struct udp_data *)(xprt->xp_p2))->ud_xdrin); /* LINTED pointer alignment */ - register struct udp_data *ud; - int error; - - xdrs = &(((struct udp_data *)(xprt->xp_p2))->ud_xdrin); - ud = (struct udp_data *)xprt->xp_p2; - - if (ud->ud_inudata) - (void)t_kfree(xprt->xp_tiptr, (char *)ud->ud_inudata, - T_UNITDATA); + register struct udp_data *ud = (struct udp_data *)xprt->xp_p2; + if (ud->ud_inudata) { + if (t_kfree(xprt->xp_tiptr, (char *)ud->ud_inudata, T_UNITDATA) < 0) + printf("svc_clts_kfreeargs: t_kfree: %d\n", u.u_error); + } ud->ud_inudata = (struct t_kunitdata *)NULL; if (args_ptr) { xdrs->x_op = XDR_FREE; @@ -528,10 +489,9 @@ svc_clts_kdup(req) dr->dr_prog != req->rq_prog || dr->dr_vers != req->rq_vers || dr->dr_proc != req->rq_proc || - dr->dr_addr.len != req->rq_xprt->xp_rtaddr.len || - bcmp((caddr_t)&dr->dr_addr.buf, - (caddr_t)&req->rq_xprt->xp_rtaddr.buf, - dr->dr_addr.len) != 0) { + bcmp((caddr_t)&dr->dr_addr, + (caddr_t)&req->rq_xprt->xp_rtaddr, + sizeof(dr->dr_addr)) != 0) { dr = dr->dr_chain; continue; } else { diff --git a/usr/src/uts/3b2/rpc/svc_gen.c b/usr/src/uts/3b2/rpc/svc_gen.c index 1015c30..a3bd085 100644 --- a/usr/src/uts/3b2/rpc/svc_gen.c +++ b/usr/src/uts/3b2/rpc/svc_gen.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/svc_gen.c 1.5" +#ident "@(#)krpc:krpc/svc_gen.c 1.3" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)svc_generic.c 1.1 88/12/12 SMI" #endif @@ -53,24 +53,25 @@ static char sccsid[] = "@(#)svc_generic.c 1.1 88/12/12 SMI" #include #include -int -svc_tli_kcreate(fp, sendsz, nxprt) - register struct file *fp; /* connection end point */ - u_int sendsz; /* max sendsize */ - SVCXPRT **nxprt; -{ - SVCXPRT *xprt = NULL; /* service handle */ - TIUSER *tiptr = NULL; - int error; - - error = 0; +SVCXPRT *svc_clts_kcreate(); - if (fp == NULL || nxprt == NULL) - return EINVAL; +SVCXPRT * +svc_tli_kcreate(fp, sendsz, recvsz) +register struct file *fp; /* connection end point */ +u_int sendsz; /* max sendsize */ +u_int recvsz; /* max recvsize */ +{ + register SVCXPRT *xprt; /* service handle */ + register TIUSER *tiptr; - if ((error = t_kopen(fp, -1, FREAD|FWRITE|FNDELAY, &tiptr)) != 0) { - RPCLOG(1, "svc_tli_kcreate: t_kopen: %d\n", error); - return error; + if (fp == NULL) { + u.u_error = EINVAL; + return NULL; + } + if ((tiptr = t_kopen(fp, -1, O_RDWR|O_NDELAY, + (struct t_info *)NULL)) == NULL) { + printf("svc_tli_kcreate: t_kopen: %d\n", u.u_error); + return NULL; } /* @@ -78,27 +79,32 @@ svc_tli_kcreate(fp, sendsz, nxprt) */ switch(tiptr->tp_info.servtype) { case T_CLTS: - error = svc_clts_kcreate(tiptr, sendsz, &xprt); + xprt = svc_clts_kcreate(tiptr, sendsz, recvsz); break; default: - RPCLOG(1, "svc_tli_kcreate: Bad service type %d\n", - tiptr->tp_info.servtype); - error = EINVAL; - break; + (void)printf("svc_tli_kcreate: Bad service type\n"); + u.u_error = EINVAL; + goto freedata; } - if (error != 0) + if (xprt == NULL) goto freedata; - xprt->xp_port = (u_short)-1; /* To show that it is tli based. Switch */ + xprt->xp_port = -1UL; /* To show that it is tli based. Switch */ + + /* remote address + */ + xprt->xp_rtaddr.buf = NULL; + xprt->xp_rtaddr.len = 0; + xprt->xp_rtaddr.maxlen = 0; - *nxprt = xprt; - return 0; + return (xprt); freedata: + if (xprt) SVC_DESTROY(xprt); - return error; + return ((SVCXPRT *)NULL); } diff --git a/usr/src/uts/3b2/rpc/svc_soc.h b/usr/src/uts/3b2/rpc/svc_soc.h index b6e14c3..68f2f3b 100644 --- a/usr/src/uts/3b2/rpc/svc_soc.h +++ b/usr/src/uts/3b2/rpc/svc_soc.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:rpc/svc_soc.h 1.3" +#ident "@(#)head.sys:rpc/svc_soc.h 1.2" /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * PROPRIETARY NOTICE (Combined) @@ -23,7 +23,7 @@ * Notice of copyright on this source code product does not indicate * publication. * -* (c) 1986,1987,1988,1989 Sun Microsystems, Inc +* (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. */ diff --git a/usr/src/uts/3b2/rpc/svcauthdes.c b/usr/src/uts/3b2/rpc/svcauthdes.c index 37c1058..a0dc64b 100644 --- a/usr/src/uts/3b2/rpc/svcauthdes.c +++ b/usr/src/uts/3b2/rpc/svcauthdes.c @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)krpc:krpc/svcauthdes.c 1.9" +#ident "@(#)krpc:krpc/svcauthdes.c 1.8" #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)svcauth_des.c 1.3 89/01/11 SMI" #endif @@ -61,6 +61,7 @@ static char sccsid[] = "@(#)svcauth_des.c 1.3 89/01/11 SMI" #include #include #include +#include #ifdef _KERNEL /* @@ -71,6 +72,10 @@ static char sccsid[] = "@(#)svcauth_des.c 1.3 89/01/11 SMI" #include #endif +#ifndef DEBUG +#define cmn_err(type, msg) +#endif + extern char *strcpy(); #define USEC_PER_SEC ((u_long) 1000000L) @@ -190,7 +195,7 @@ _svcauth_des(rqst, msg) if (key_decryptsession(cred->adc_fullname.name, sessionkey) < 0) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: key_decryptsessionkey failed\n", 0); + cmn_err(CE_NOTE, "key_decryptsessionkey failed"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: key_decryptsessionkey failed"); #endif @@ -200,7 +205,7 @@ _svcauth_des(rqst, msg) sid = cred->adc_nickname; if (sid >= AUTHDES_CACHESZ) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: bad nickname %d\n", sid); + cmn_err(CE_NOTE, "bad nickname"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: bad nickname"); #endif @@ -227,7 +232,7 @@ _svcauth_des(rqst, msg) } if (DES_FAILED(status)) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: decryption failure\n", 0); + cmn_err(CE_NOTE, "decryption failure"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: decryption failure"); #endif @@ -257,7 +262,7 @@ _svcauth_des(rqst, msg) winverf = IXDR_GET_U_LONG(ixdr); if (winverf != window - 1) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: window verifier mismatch %d\n", winverf); + cmn_err(CE_NOTE, "window verifier mismatch"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: window verifier mismatch"); #endif @@ -267,7 +272,7 @@ _svcauth_des(rqst, msg) ×tamp); if (sid < 0) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: replayed credential sid %d\n", sid); + cmn_err(CE_NOTE, "replayed credential"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: replayed credential"); #endif @@ -281,7 +286,7 @@ _svcauth_des(rqst, msg) if ((u_long)timestamp.tv_usec >= USEC_PER_SEC) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: invalid usecs %d\n", timestamp.tv_usec); + cmn_err(CE_NOTE, "invalid usecs"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: invalid usecs"); #endif @@ -291,8 +296,7 @@ _svcauth_des(rqst, msg) if (nick && BEFORE(×tamp, &authdes_cache[sid].laststamp)) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: timestamp before last seen\n", 0); - + cmn_err(CE_NOTE, "timestamp before last seen"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: timestamp before last seen"); #endif @@ -307,7 +311,7 @@ _svcauth_des(rqst, msg) current.tv_sec -= window; /* allow for expiration */ if (!BEFORE(¤t, ×tamp)) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: timestamp expired\n", 0); + cmn_err(CE_NOTE, "timestamp expired"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: timestamp expired"); #endif @@ -335,7 +339,7 @@ _svcauth_des(rqst, msg) sizeof(des_block), DES_ENCRYPT); if (DES_FAILED(status)) { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: encryption failure\n", 0); + cmn_err(CE_NOTE, "encryption failure"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: encryption failure"); #endif @@ -376,7 +380,7 @@ _svcauth_des(rqst, msg) (void) strcpy(entry->rname, cred->adc_fullname.name); } else { #ifdef _KERNEL - RPCLOG(1, "_svcauth_des: out of memory\n", 0); + cmn_err(CE_NOTE, "out of memory"); #else (void) syslog(LOG_DEBUG, "_svcauth_des: out of memory"); #endif @@ -531,7 +535,7 @@ authdes_getucred(adc, uid, gid, grouplen, groups) sid = adc->adc_nickname; if (sid >= AUTHDES_CACHESZ) { #ifdef _KERNEL - RPCLOG(1, "authdes_getucred: invalid nickname\n", 0); + cmn_err(CE_NOTE, "authdes_getucred: invalid nickname"); #else (void) syslog(LOG_DEBUG, "authdes_getucred: invalid nickname"); #endif @@ -552,7 +556,7 @@ authdes_getucred(adc, uid, gid, grouplen, groups) &i_grouplen, groups)) { #ifdef _KERNEL - RPCLOG(1, "authdes_getucred: unknown netname\n", 0); + cmn_err(CE_NOTE, "authdes_getucred: unknown netname"); #else (void) syslog(LOG_DEBUG, "authdes_getucred: unknown netname"); #endif @@ -560,7 +564,7 @@ authdes_getucred(adc, uid, gid, grouplen, groups) return (0); } #ifdef _KERNEL - RPCLOG(1, "authdes_getucred: missed ucred cache\n", 0); + cmn_err(CE_NOTE, "authdes_getucred: missed ucred cache"); #else (void) syslog(LOG_DEBUG, "authdes_getucred: missed ucred cache"); #endif diff --git a/usr/src/uts/3b2/rpc/types.h b/usr/src/uts/3b2/rpc/types.h index bcb8560..b647792 100644 --- a/usr/src/uts/3b2/rpc/types.h +++ b/usr/src/uts/3b2/rpc/types.h @@ -8,7 +8,7 @@ #ifndef _RPC_TYPES_H #define _RPC_TYPES_H -#ident "@(#)head.sys:sys/rpc/types.h 1.5" +#ident "@(#)head.sys:sys/rpc/types.h 1.1" /* @(#)types.h 1.23 88/10/25 SMI */ @@ -55,6 +55,7 @@ #endif #ifndef _KERNEL +extern char *malloc(); #define mem_alloc(bsize) malloc(bsize) #define mem_free(ptr, bsize) free(ptr) #else @@ -62,26 +63,6 @@ extern _VOID *kmem_alloc(); #define mem_alloc(bsize) kmem_alloc((u_int)bsize, KM_SLEEP) #define mem_free(ptr, bsize) kmem_free((caddr_t)(ptr), (u_int)(bsize)) - -#ifdef DEBUG -extern int rpc_log(); -extern int rpclog; - -#define RPCLOG(A, B, C) ((void)((rpclog) && rpc_log((A), (B), (C)))) -#else -#define RPCLOG(A, B, C) -#endif - -#endif - -#ifdef _NSL_RPC_ABI -/* For internal use only when building the libnsl RPC routines */ -#define select _abi_select -#define gettimeofday _abi_gettimeofday -#define syslog _abi_syslog -#define getgrent _abi_getgrent -#define endgrent _abi_endgrent -#define setgrent _abi_setgrent #endif #include diff --git a/usr/src/uts/3b2/rpcsvc/klm_prot.h b/usr/src/uts/3b2/rpcsvc/klm_prot.h new file mode 100644 index 0000000..5c5e981 --- /dev/null +++ b/usr/src/uts/3b2/rpcsvc/klm_prot.h @@ -0,0 +1,122 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:rpcsvc/klm_prot.h 1.1" +/* + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's Unix(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988,1989 Sun Microsystems, Inc. + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include + + +#define KLM_PROG ((u_long)100020) +#define KLM_VERS ((u_long)1) +#define KLM_TEST ((u_long)1) +#define KLM_LOCK ((u_long)2) +#define KLM_CANCEL ((u_long)3) +#define KLM_UNLOCK ((u_long)4) +#define LM_MAXSTRLEN 1024 + +enum klm_stats { + klm_granted = 0, + klm_denied = 1, + klm_denied_nolocks = 2, + klm_working = 3, + klm_deadlck = 5, +}; +typedef enum klm_stats klm_stats; +bool_t xdr_klm_stats(); + +struct klm_lock { + char *server_name; + netobj fh; + int base; + int length; + int type; + int granted; + int color; + int LockID; + int pid; + int class; + long rsys; + long rpid; +}; +typedef struct klm_lock klm_lock; +bool_t xdr_klm_lock(); + +struct klm_holder { + bool_t exclusive; + int base; + int length; + int type; + int granted; + int color; + int LockID; + int pid; + int class; + long rsys; + long rpid; +}; +typedef struct klm_holder klm_holder; +bool_t xdr_klm_holder(); + +struct klm_stat { + klm_stats stat; +}; +typedef struct klm_stat klm_stat; +bool_t xdr_klm_stat(); + +struct klm_testrply { + klm_stats stat; + union { + struct klm_holder holder; + } klm_testrply_u; +}; +typedef struct klm_testrply klm_testrply; +bool_t xdr_klm_testrply(); + +struct klm_lockargs { + bool_t block; + bool_t exclusive; + struct klm_lock alock; +}; +typedef struct klm_lockargs klm_lockargs; +bool_t xdr_klm_lockargs(); + +struct klm_testargs { + bool_t exclusive; + struct klm_lock alock; +}; +typedef struct klm_testargs klm_testargs; +bool_t xdr_klm_testargs(); + +struct klm_unlockargs { + struct klm_lock alock; +}; +typedef struct klm_unlockargs klm_unlockargs; +bool_t xdr_klm_unlockargs(); diff --git a/usr/src/uts/3b2/sys/acct.h b/usr/src/uts/3b2/sys/acct.h index eaec174..cf2005c 100644 --- a/usr/src/uts/3b2/sys/acct.h +++ b/usr/src/uts/3b2/sys/acct.h @@ -8,7 +8,7 @@ #ifndef _SYS_ACCT_H #define _SYS_ACCT_H -#ident "@(#)head.sys:sys/acct.h 11.9" +#ident "@(#)head.sys:sys/acct.h 11.8" /* * Accounting structures */ @@ -58,13 +58,12 @@ struct o_acct extern struct acct acctbuf; extern struct vnode *acctp; /* vnode of accounting file */ -#if !defined(_KERNEL) + #if defined(__STDC__) -extern int acct(const char *); +extern void acct(char); #else -extern int acct(); +extern void acct(); #endif -#endif /* !defined(_KERNEL) */ #define AFORK 01 /* has executed fork, but no exec */ #define ASU 02 /* used super-user privileges */ diff --git a/usr/src/uts/3b2/sys/buf.h b/usr/src/uts/3b2/sys/buf.h index c3b34b3..2b04d8d 100644 --- a/usr/src/uts/3b2/sys/buf.h +++ b/usr/src/uts/3b2/sys/buf.h @@ -8,7 +8,7 @@ #ifndef _SYS_BUF_H #define _SYS_BUF_H -#ident "@(#)head.sys:sys/buf.h 11.21" +#ident "@(#)head.sys:sys/buf.h 11.18" /* * Each buffer in the pool is usually doubly linked into 2 lists: @@ -49,7 +49,7 @@ typedef struct buf { clock_t b_start; /* request start time */ struct proc *b_proc; /* process doing physical or swap I/O */ struct page *b_pages; /* page list for PAGEIO */ - clock_t b_reltime; /* previous release time */ + unsigned long b_reltime; /* previous release time */ /* Begin new stuff */ #define b_actf av_forw #define b_actl av_back @@ -80,6 +80,7 @@ struct diskhd { long b_bcount; /* active flag */ }; +extern struct buf buf[]; /* The buffer pool itself */ extern struct buf bfreelist; /* head of available list */ struct pfree { int b_flags; @@ -224,7 +225,9 @@ int biowait(); int get_error(); struct buf *pageio_setup(); void pageio_done(); +void dkstrategy(); void biodone(); +int dksize(); void buf_breakup(); #if defined(__STDC__) diff --git a/usr/src/uts/3b2/sys/class.h b/usr/src/uts/3b2/sys/class.h index f9c2a4a..5524cf7 100644 --- a/usr/src/uts/3b2/sys/class.h +++ b/usr/src/uts/3b2/sys/class.h @@ -8,7 +8,7 @@ #ifndef _SYS_CLASS_H #define _SYS_CLASS_H -#ident "@(#)head.sys:sys/class.h 1.14" +#ident "@(#)head.sys:sys/class.h 1.12" /* @@ -56,7 +56,7 @@ typedef struct classfuncs { void (*cl_trapret)(); /* Don't move without changing */ /* .set in ml/ttrap.s */ void (*cl_wakeup)(); - int (*cl_filler[11])(); + void (*cl_filler[11])(); } classfuncs_t; @@ -65,7 +65,8 @@ typedef struct classfuncs { #define CL_ENTERCLASS(clp, clparmsp, pp, pstatp, pprip, pflagp, pcredpp, clprocpp, reqpcid, reqpcredp) \ (*(clp)->cl_funcs->cl_enterclass)\ - (clparmsp, pp, pstatp, pprip, pflagp, pcredpp, clprocpp, reqpcid, reqpcredp) + (clparmsp, pp, pstatp, pprip, pflagp, pcredpp, clprocpp, reqpcid,\ + reqpcredp) #define CL_EXITCLASS(pp, clprocp) (*(pp)->p_clfuncs->cl_exitclass)(clprocp) @@ -85,9 +86,10 @@ typedef struct classfuncs { #define CL_PARMSGET(pp, clprocp, clparmsp) \ (*(pp)->p_clfuncs->cl_parmsget)(clprocp, clparmsp) -#define CL_PARMSIN(clp, clparmsp, rqpcid, rqpcredp, tgpcid, tgpcredp, tgpclpp) \ -(*(clp)->cl_funcs->cl_parmsin)\ -(clparmsp, rqpcid, rqpcredp, tgpcid, tgpcredp, tgpclpp) +#define CL_PARMSIN(clp, clparmsp, reqpcid, reqpcredp, \ +targpcid, targpcredp, targpclpp) \ +(*(clp)->cl_funcs->cl_parmsin)(clparmsp, reqpcid, reqpcredp, \ +targpcid, targpcredp, targpclpp) #define CL_PARMSOUT(clp, clparmsp, reqpcid, reqpcredp, targpcredp) \ (*(clp)->cl_funcs->cl_parmsout)(clparmsp, reqpcid, reqpcredp, targpcredp) diff --git a/usr/src/uts/3b2/sys/conf.h b/usr/src/uts/3b2/sys/conf.h index 2157461..ada0acc 100644 --- a/usr/src/uts/3b2/sys/conf.h +++ b/usr/src/uts/3b2/sys/conf.h @@ -8,7 +8,7 @@ #ifndef _SYS_CONF_H #define _SYS_CONF_H -#ident "@(#)head.sys:sys/conf.h 11.21" +#ident "@(#)head.sys:sys/conf.h 11.16" /* * Declaration of block device switch. Each entry (row) is @@ -25,9 +25,7 @@ struct bdevsw { int (*d_xhalt)(); int *d_flag; }; - extern struct bdevsw bdevsw[]; -extern struct bdevsw shadowbsw[]; /* * Character device switch. @@ -47,27 +45,18 @@ struct cdevsw { struct streamtab *d_str; int *d_flag; }; - extern struct cdevsw cdevsw[]; -extern struct cdevsw shadowcsw[]; /* * Device flags. - * - * Bit 0 to bit 15 are reserved for kernel. - * Bit 16 to bit 31 are reserved for different machines. */ #define D_NEW 0x00 /* new-style driver */ -#define D_OLD 0x01 /* old-style driver */ +#define D_OLD 0x01 /* Old-style driver */ /* * Added for UFS. */ #define D_SEEKNEG 0x04 /* Negative seek offsets are OK */ #define D_TAPE 0x08 /* Magtape device (no bdwrite when cooked) */ -/* - * Added for pre-4.0 drivers backward compatibility. - */ -#define D_NOBRKUP 0x10 /* No breakup needed for new drivers */ #define FMNAMESZ 8 diff --git a/usr/src/uts/3b2/sys/cred.h b/usr/src/uts/3b2/sys/cred.h index 640669c..aeb130c 100644 --- a/usr/src/uts/3b2/sys/cred.h +++ b/usr/src/uts/3b2/sys/cred.h @@ -5,33 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - #ifndef _SYS_CRED_H #define _SYS_CRED_H -#ident "@(#)head.sys:sys/cred.h 1.8" +#ident "@(#)head.sys:sys/cred.h 1.7" /* * User credentials. The size of the cr_groups[] array is configurable * but is the same (ngroups_max) for all cred structures; cr_ngroups diff --git a/usr/src/uts/3b2/sys/ddi.h b/usr/src/uts/3b2/sys/ddi.h index ce1445a..8ec6b58 100644 --- a/usr/src/uts/3b2/sys/ddi.h +++ b/usr/src/uts/3b2/sys/ddi.h @@ -8,7 +8,7 @@ #ifndef _SYS_DDI_H #define _SYS_DDI_H -#ident "@(#)head.sys:sys/ddi.h 1.19" +#ident "@(#)head.sys:sys/ddi.h 1.18" /* ddi.h -- the flag and function definitions needed by DDI-conforming * drivers. This header file contains #undefs to undefine macros that @@ -84,6 +84,11 @@ extern int physiock(); #undef cmpdev #undef expdev +#undef btoc +#undef ctob + +extern unsigned long btoc(); +extern unsigned long ctob(); extern major_t getemajor(); extern minor_t geteminor(); extern major_t getmajor(); diff --git a/usr/src/uts/3b2/sys/dnlc.h b/usr/src/uts/3b2/sys/dnlc.h index ddb7409..1160728 100644 --- a/usr/src/uts/3b2/sys/dnlc.h +++ b/usr/src/uts/3b2/sys/dnlc.h @@ -5,33 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - #ifndef _SYS_DNLC_H #define _SYS_DNLC_H -#ident "@(#)head.sys:sys/dnlc.h 1.4.1.2" +#ident "@(#)head.sys:sys/dnlc.h 1.3" /* * This structure describes the elements in the cache of recent * names looked up. @@ -45,7 +22,7 @@ struct ncache { struct ncache *lru_next; /* LRU chain */ struct ncache *lru_prev; struct vnode *vp; /* vnode the name refers to */ - struct vnode *dp; /* vnode of parent of name */ + struct vnode *dp; /* vno of parent of name */ char namlen; /* length of name */ char name[NC_NAMLEN]; /* segment name */ struct cred *cred; /* credentials */ @@ -83,7 +60,6 @@ vnode_t *dnlc_lookup(vnode_t *, char *, cred_t *); void dnlc_purge(void); int dnlc_purge1(void); void dnlc_purge_vp(vnode_t *); -int dnlc_purge_vfsp(vfs_t *, int); void dnlc_remove(vnode_t *, char *); #else @@ -94,7 +70,6 @@ vnode_t *dnlc_lookup(); void dnlc_purge(); int dnlc_purge1(); void dnlc_purge_vp(); -int dnlc_purge_vfsp(); void dnlc_remove(); #endif diff --git a/usr/src/uts/3b2/sys/elf.h b/usr/src/uts/3b2/sys/elf.h index 37e0634..5e1c3a1 100644 --- a/usr/src/uts/3b2/sys/elf.h +++ b/usr/src/uts/3b2/sys/elf.h @@ -8,7 +8,7 @@ #ifndef _SYS_ELF_H #define _SYS_ELF_H -#ident "@(#)head.sys:sys/elf.h 1.4" +#ident "@(#)head.sys:sys/elf.h 1.3" #include @@ -82,9 +82,6 @@ typedef struct { #define ET_CORE 4 #define ET_NUM 5 -#define ET_LOPROC 0xff00 /* processor specific range */ -#define ET_HIPROC 0xffff - #define EM_NONE 0 /* e_machine */ #define EM_M32 1 /* AT&T WE 32100 */ #define EM_SPARC 2 /* Sun SPARC */ @@ -95,7 +92,6 @@ typedef struct { #define EM_860 7 /* Intel i860 */ #define EM_NUM 8 - #define EV_NONE 0 /* e_version, EI_VERSION */ #define EV_CURRENT 1 #define EV_NUM 2 @@ -124,15 +120,10 @@ typedef struct { #define PT_PHDR 6 #define PT_NUM 7 -#define PT_LOPROC 0x70000000 /* processor specific range */ -#define PT_HIPROC 0x7fffffff - #define PF_R 0x4 /* p_flags */ #define PF_W 0x2 #define PF_X 0x1 -#define PF_MASKPROC 0xf0000000 /* processor specific values */ - /* Section header */ @@ -166,24 +157,16 @@ typedef struct { #define SHT_LOUSER 0x80000000 #define SHT_HIUSER 0xffffffff -#define SHT_LOPROC 0x70000000 /* processor specific range */ -#define SHT_HIPROC 0x7fffffff - #define SHF_WRITE 0x1 /* sh_flags */ #define SHF_ALLOC 0x2 #define SHF_EXECINSTR 0x4 -#define SHF_MASKPROC 0xf0000000 /* processor specific values */ - #define SHN_UNDEF 0 /* special section numbers */ #define SHN_LORESERVE 0xff00 #define SHN_ABS 0xfff1 #define SHN_COMMON 0xfff2 #define SHN_HIRESERVE 0xffff -#define SHN_LOPROC 0xff00 /* processor specific range */ -#define SHN_HIPROC 0xff1f - /* Symbol table */ @@ -215,9 +198,6 @@ typedef struct { #define STB_WEAK 2 #define STB_NUM 3 -#define STB_LOPROC 13 /* processor specific range */ -#define STB_HIPROC 15 - #define STT_NOTYPE 0 /* TYPE */ #define STT_OBJECT 1 #define STT_FUNC 2 @@ -225,9 +205,6 @@ typedef struct { #define STT_FILE 4 #define STT_NUM 5 -#define STT_LOPROC 13 /* processor specific range */ -#define STT_HIPROC 15 - /* Relocation */ diff --git a/usr/src/uts/3b2/sys/elf_386.h b/usr/src/uts/3b2/sys/elf_386.h index 9df10b2..928a5e7 100644 --- a/usr/src/uts/3b2/sys/elf_386.h +++ b/usr/src/uts/3b2/sys/elf_386.h @@ -5,11 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/elf_386.h 1.2" - #ifndef _SYS_ELF_I386_H #define _SYS_ELF_I386_H +#ident "@(#)head.sys:sys/elf_386.h 1.1" + #define R_386_NONE 0 /* relocation type */ #define R_386_32 1 #define R_386_PC32 2 @@ -23,6 +23,4 @@ #define R_386_GOTPC 10 #define R_386_NUM 11 -#define ELF_386_MAXPGSZ 0x1000 /* maximum page size */ - #endif diff --git a/usr/src/uts/3b2/sys/elf_M32.h b/usr/src/uts/3b2/sys/elf_M32.h index e323f2a..2172ecd 100644 --- a/usr/src/uts/3b2/sys/elf_M32.h +++ b/usr/src/uts/3b2/sys/elf_M32.h @@ -5,12 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/elf_M32.h 1.3" - - #ifndef _SYS_ELF_M32_H #define _SYS_ELF_M32_H +#ident "@(#)head.sys:sys/elf_M32.h 1.2" + #define EF_M32_MAU 1 /* e_flags */ #define R_M32_NONE 0 /* relocation type */ @@ -26,6 +25,4 @@ #define R_M32_RELATIVE_S 10 #define R_M32_NUM 11 /* must be >last */ -#define ELF_M32_MAXPGSZ 0x2000 /* maximum page size */ - #endif diff --git a/usr/src/uts/3b2/sys/elf_SPARC.h b/usr/src/uts/3b2/sys/elf_SPARC.h index 029f716..01f48cd 100644 --- a/usr/src/uts/3b2/sys/elf_SPARC.h +++ b/usr/src/uts/3b2/sys/elf_SPARC.h @@ -5,11 +5,11 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/elf_SPARC.h 1.2" - #ifndef _SYS_ELF_SPARC_H #define _SYS_ELF_SPARC_H +#ident "@(#)head.sys:sys/elf_SPARC.h 1.1" + #define R_SPARC_NONE 0 /* relocation type */ #define R_SPARC_8 1 #define R_SPARC_16 2 @@ -36,7 +36,4 @@ #define R_SPARC_UA32 23 #define R_SPARC_NUM 24 /* must be >last */ -#define ELF_SPARC_MAXPGSZ 0x10000 /* maximum page size */ - - #endif diff --git a/usr/src/uts/3b2/sys/emd.h b/usr/src/uts/3b2/sys/emd.h index 5794d95..3b2f8d2 100644 --- a/usr/src/uts/3b2/sys/emd.h +++ b/usr/src/uts/3b2/sys/emd.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)emd:sys/emd.h 1.10" +#ident "@(#)emd:sys/emd.h 1.9" /* * Ethernet Media Driver header file. @@ -49,7 +49,7 @@ struct emd { * each item in this structure. */ struct emd_board { - long eb_major; /* major dev number of the EMD board */ + int eb_major; /* major dev number of the EMD board */ struct emd *eb_emdp; /* start of emd structures for board */ RQUEUE eb_rq; /* EMD request queue */ CQUEUE eb_cq; /* EMD completion queue */ diff --git a/usr/src/uts/3b2/sys/erec.h b/usr/src/uts/3b2/sys/erec.h new file mode 100644 index 0000000..87ab036 --- /dev/null +++ b/usr/src/uts/3b2/sys/erec.h @@ -0,0 +1,204 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_EREC_H +#define _SYS_EREC_H + +#ident "@(#)head.sys:sys/erec.h 11.3" +/* + * Every error record has a header as follows. + */ + + + +struct errhdr { + short e_type; /* record type */ + short e_len; /* bytes in record (with header) */ + time_t e_time; /* time of day */ +}; + +/* + * Error record types + */ + +#define E_GOTS 010 /* Start for UNIX/TS */ +#define E_GORT 011 /* Start for UNIX/RT */ +#define E_STOP 012 /* Stop */ +#define E_TCHG 013 /* Time change */ +#define E_CCHG 014 /* Configuration change */ +#define E_BLK 020 /* Block device error */ +#define E_STRAY 030 /* Stray interrupt */ +#define E_MEM 031 /* Memory error */ +#define E_CNTL 041 /* IO Controller error */ +#define E_SYS 042 /* System error */ +#define E_CAC 043 /* Cache error */ +#define E_PF 044 /* Prefetch error MAC 32 only */ + + +/* Device descriptors for logging start up record. */ + +struct ddesc { + char d_name[9]; /* Device name */ + long lb_addr; /* Device address */ + long su_equip; /* Device equippage */ +}; + + +/* + * Error logging startup record. One of these is + * sent to the logging daemon when logging is + * first activated. + */ + +struct estart { + short e_cpu; /* cpu type */ + struct utsname e_name; /* system names */ + int e_mmcnt; /* Memory size */ + struct ddesc e_conf[NBEDT]; /* Configured hardware */ + long e_dcnt; /* # devices found in EDT */ +}; + +/* + * Error logging termination record that is sent to the daemon + * when it stops error logging. + */ + +#define eend errhdr + +/* + * A time change record is sent to the daemon whenever + * the system's time of day is changed. + */ + +struct etimchg { + time_t e_ntime; /* new time */ +}; + + +/* + * A configuration change message is sent to + * the error logging daemon whenever a block device driver + * is attached or detached (MERT only). + */ + +struct econfchg { + char e_trudev; /* "true" major device number */ + char e_cflag; /* driver attached or detached */ +}; + +#define E_ATCH 1 +#define E_DTCH 0 + +/* + * Template for the error record that is logged by block device + * drivers. + */ + +struct eblock { + o_dev_t e_num; /* device number (major + minor) */ + ushort e_bytes; /* number of bytes to transfer */ + short e_bflags; /* read/write, error, etc */ + daddr_t e_bnum; /* logical block number */ + struct iostat e_stats; /* unit I/O statistics */ + paddr_t e_badd; /* physical buffer address */ + unsigned long e_stat1; /* job completion status */ + unsigned long e_stat2; /* extended err status 1 */ + unsigned long e_stat3; /* extended err status 2 */ +}; + +/* + * Flags (selected subset of flags in buffer header) + */ + +#define E_WRITE 0 +#define E_READ 1 +#define E_NOIO 02 +#define E_PHYS 04 +#define E_MAP 010 +#define E_ERROR 020 + +/* + * Template for the stray interrupt record that is logged + * every time an unexpected interrupt occurs. + */ + +struct estray { + unsigned int e_saddr; /* stray loc or device addr */ +}; + +/* + * Memory error record that is logged whenever one + * of those things occurs + */ + +struct emem { + long e_mcsr[2]; /* registers: MASC CSR0, CSR1 */ +}; + +/* + * Template for the IO controller error reported via SYSERR + */ + +struct ecntl { + char dev_name[9]; /* device name */ + long lb_addr; /* bus address */ + long unit_equip; /* device equippage */ + long d_csr; /* device csr content */ + long d_errcode; /* device error code */ +}; + +/* + * Template for local bus SYSERR + */ + +struct esys { + char md_name[9]; /* master device name */ + long mlb_addr; /* master local bus address */ + long e_mcsr; /* CSR content of local bus master */ + char sd_name[9]; /* slave device name */ + long slb_addr; /* slave local bus address */ + long e_scsr; /* CSR content of local bus slave */ +}; + + +/* This structure will be used to log a prefetch error reported via + * the dedicated PFERR interrupt. + */ + +struct epf { + long e_pc; /* PC address of error */ + long e_psw; /* PSW on error */ + long e_cccsr; /* CC CSR on error */ + char e_dname[9]; /* Slave device name */ + long e_lbaddr; /* Slave local bus address */ + long e_scsr1; /* Slave CSR content */ + long e_scsr2; /* Slave CSR content */ +}; + +/* This structure will be used to log a cache error */ + +struct ecache { + long e_cccsr; /* CC CSR on error */ + char e_dname[9]; /* Slave device name */ + long e_lbaddr; /* Slave local bus address */ + long e_scsr1; /* Slave CSR content */ + long e_scsr2; /* Slave CSR content */ +}; + + +/* + * The following structure is used by geru() which finds and clears + * error data in device control and status registers. + */ + +struct eunit { + struct edt *edtp; /* edt pointer to error device */ + long csr1; /* device control and status register */ + long csr2; /* address trap register if MASC is err dev */ +}; + +#endif /* _SYS_EREC_H */ diff --git a/usr/src/uts/3b2/sys/errno.h b/usr/src/uts/3b2/sys/errno.h index 2fe7d47..deb4069 100644 --- a/usr/src/uts/3b2/sys/errno.h +++ b/usr/src/uts/3b2/sys/errno.h @@ -8,7 +8,7 @@ #ifndef _SYS_ERRNO_H #define _SYS_ERRNO_H -#ident "@(#)head.sys:sys/errno.h 11.18" +#ident "@(#)head.sys:sys/errno.h 11.17" /* * PROPRIETARY NOTICE (Combined) @@ -122,7 +122,6 @@ #define ELIBSCN 85 /* .lib section in a.out corrupted. */ #define ELIBMAX 86 /* Attempting to link in too many libs. */ #define ELIBEXEC 87 /* Attempting to exec a shared library. */ -#define EILSEQ 88 /* Illegal byte sequence. */ #define ENOSYS 89 /* Unsupported file system operation */ #define ELOOP 90 /* Symbolic link loop */ #define ERESTART 91 /* Restartable system call */ @@ -132,42 +131,41 @@ /* BSD Networking Software */ /* argument errors */ -#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 socket */ -#define EPFNOSUPPORT 123 /* Protocol family not supported */ -#define EAFNOSUPPORT 124 /* Address family not supported by +#define ENOTSOCK 96 /* Socket operation on non-socket */ +#define EDESTADDRREQ 97 /* Destination address required */ +#define EMSGSIZE 98 /* Message too long */ +#define EPROTOTYPE 99 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 100 /* Protocol not available */ +#define EPROTONOSUPPORT 101 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 102 /* Socket type not supported */ +#define EOPNOTSUPP 103 /* Operation not supported on socket */ +#define EPFNOSUPPORT 104 /* Protocol family not supported */ +#define EAFNOSUPPORT 105 /* Address family not supported by protocol family */ -#define EADDRINUSE 125 /* Address already in use */ -#define EADDRNOTAVAIL 126 /* Can't assign requested address */ +#define EADDRINUSE 106 /* Address already in use */ +#define EADDRNOTAVAIL 107 /* Can't assign requested address */ /* operational errors */ -#define ENETDOWN 127 /* Network is down */ -#define ENETUNREACH 128 /* Network is unreachable */ -#define ENETRESET 129 /* Network dropped connection because +#define ENETDOWN 108 /* Network is down */ +#define ENETUNREACH 109 /* Network is unreachable */ +#define ENETRESET 110 /* 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 /* Socket is already connected */ -#define ENOTCONN 134 /* Socket is not connected */ -/* XENIX has 135 - 142 */ -#define ESHUTDOWN 143 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 144 /* Too many references: can't 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 ECONNABORTED 111 /* Software caused connection abort */ +#define ECONNRESET 112 /* Connection reset by peer */ +#define ENOBUFS 113 /* No buffer space available */ +#define EISCONN 114 /* Socket is already connected */ +#define ENOTCONN 115 /* Socket is not connected */ +#define ESHUTDOWN 116 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 117 /* Too many references: can't splice */ +#define ETIMEDOUT 118 /* Connection timed out */ +#define ECONNREFUSED 119 /* Connection refused */ +#define EHOSTDOWN 120 /* Host is down */ +#define EHOSTUNREACH 121 /* No route to host */ #define EWOULDBLOCK EAGAIN -#define EALREADY 149 /* operation already in progress */ -#define EINPROGRESS 150 /* operation now in progress */ +#define EALREADY 123 +#define EINPROGRESS 124 /* SUN Network File System */ -#define ESTALE 151 /* Stale NFS file handle */ +#define ESTALE 122 /* Stale NFS file handle */ /* #ifdef MERGE */ /* XENIX error numbers */ diff --git a/usr/src/uts/3b2/sys/exec.h b/usr/src/uts/3b2/sys/exec.h index 85aeacb..97930e2 100644 --- a/usr/src/uts/3b2/sys/exec.h +++ b/usr/src/uts/3b2/sys/exec.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/exec.h 1.15" +#ident "@(#)head.sys:sys/exec.h 1.12" #define getexmag(x) (x[0] << 8) + x[1] @@ -71,8 +71,6 @@ typedef struct exhda { #define EXHDA_HADERROR 1 -#ifdef _KERNEL - #if defined(__STDC__) extern int exhd_getmap(exhda_t *, off_t, int, int, char *); @@ -81,8 +79,8 @@ extern int remove_proc(struct uarg *); extern int execmap(vnode_t *, caddr_t, size_t, size_t, off_t, int); extern void setexecenv(struct execenv *); extern int setregs(struct uarg *); -extern int core_seg(proc_t *, vnode_t *, off_t, caddr_t, size_t, rlim_t, cred_t *); -extern int gexec(vnode_t **, struct uarg *, int, long *); +extern int core_seg(vnode_t *, off_t, caddr_t, size_t, rlim_t, cred_t *); +extern int gexec(vnode_t *, struct uarg *, int, long *); extern caddr_t execstk_addr(int, u_int *); extern int execpermissions(struct vnode *, struct vattr *, exhda_t *, struct uarg *); @@ -101,8 +99,6 @@ extern int execpermissions(); #endif /* __STDC__ */ -#endif /* _KERNEL */ - /* flags for exhd_getmap(): */ #define EXHD_NOALIGN 0 #define EXHD_4BALIGN 1 /* align on 4 byte boundary */ diff --git a/usr/src/uts/3b2/sys/fbuf.h b/usr/src/uts/3b2/sys/fbuf.h index 34366c5..f2e7d14 100644 --- a/usr/src/uts/3b2/sys/fbuf.h +++ b/usr/src/uts/3b2/sys/fbuf.h @@ -8,7 +8,7 @@ #ifndef _SYS_FBUF_H #define _SYS_FBUF_H -#ident "@(#)head.sys:sys/fbuf.h 1.3" +#ident "@(#)head.sys:sys/fbuf.h 1.2" /* * A struct fbuf is used to get a mapping to part of a file using the @@ -29,5 +29,6 @@ extern void fbzero(/* vp, off, len, fbpp */); extern int fbwrite(/* fbp */); extern int fbiwrite(/* fbp, vp, bn, bsize */); extern void fbrelse(/* fbp, rw */); +extern void fbinval(/* vfsp */); #endif /* _SYS_FBUF_H */ diff --git a/usr/src/uts/3b2/sys/fcntl.h b/usr/src/uts/3b2/sys/fcntl.h index b3f8b51..69bc3d9 100644 --- a/usr/src/uts/3b2/sys/fcntl.h +++ b/usr/src/uts/3b2/sys/fcntl.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/fcntl.h 11.38" +#ident "@(#)head.sys:sys/fcntl.h 11.33" #ifndef _SYS_FCNTL_H #define _SYS_FCNTL_H @@ -39,6 +39,8 @@ #define F_SETFD 2 /* Set fildes flags */ #define F_GETFL 3 /* Get file flags */ #define F_SETFL 4 /* Set file flags */ +#define F_SETLK 6 /* Set file lock */ +#define F_SETLKW 7 /* Set file lock and wait */ /* * Applications that read /dev/mem must be built like the kernel. A @@ -61,17 +63,23 @@ #define F_SETLK 6 /* Set file lock */ #define F_SETLKW 7 /* Set file lock and wait */ -#define F_CHKFL 8 /* Unused */ +#define F_CHKFL 8 /* Unused */ #define F_ALLOCSP 10 /* Reserved */ #define F_FREESP 11 /* Free file space */ +#define F_BLOCKS 18 /* Get number of BLKSIZE blocks allocated */ +#define F_BLKSIZE 19 /* Get optimal I/O block size */ #define F_RSETLK 20 /* Remote SETLK for NFS */ #define F_RGETLK 21 /* Remote GETLK for NFS */ #define F_RSETLKW 22 /* Remote SETLKW for NFS */ -#define F_GETOWN 23 /* Get owner (socket emulation) */ -#define F_SETOWN 24 /* Set owner (socket emulation) */ +#define F_GETOWN 23 /* Get owner */ +#define F_SETOWN 24 /* Set owner */ + +#define F_CNVT 25 /* For NFS Lock Manager */ + +#define LOCKMGR 26 /* Indicates lock manager lock */ /* * File segment locking set data type - information passed to system by user. @@ -138,7 +146,7 @@ typedef struct flock { * POSIX constants */ -#define O_ACCMODE 3 /* Mask for file access modes */ +#define O_ACCMODE 03477 /* Mask for file access modes */ #define FD_CLOEXEC 1 /* close on exec flag */ #endif /* _SYS_FCNTL_H */ diff --git a/usr/src/uts/3b2/sys/file.h b/usr/src/uts/3b2/sys/file.h index 25ca9ee..3af8e26 100644 --- a/usr/src/uts/3b2/sys/file.h +++ b/usr/src/uts/3b2/sys/file.h @@ -8,7 +8,7 @@ #ifndef _SYS_FILE_H #define _SYS_FILE_H -#ident "@(#)head.sys:sys/file.h 11.28" +#ident "@(#)head.sys:sys/file.h 11.23" /* * One file structure is allocated for each open/creat/pipe call. * Main use is to hold the read/write pointer associated with @@ -37,17 +37,18 @@ typedef struct file { #define FNDELAY 0x04 #define FAPPEND 0x08 #define FSYNC 0x10 + #define FNONBLOCK 0x80 #define FMASK 0xFF /* should be disjoint from FASYNC */ +#define FASYNC 0x100 /* open-only modes */ -#define FCREAT 0x0100 -#define FTRUNC 0x0200 -#define FEXCL 0x0400 -#define FNOCTTY 0x0800 -#define FASYNC 0x1000 +#define FCREAT 0x100 +#define FTRUNC 0x200 +#define FEXCL 0x400 +#define FNOCTTY 0x800 /* file descriptor flags */ #define FCLOSEXEC 001 /* close on exec */ diff --git a/usr/src/uts/3b2/sys/flock.h b/usr/src/uts/3b2/sys/flock.h index a137717..57a048e 100644 --- a/usr/src/uts/3b2/sys/flock.h +++ b/usr/src/uts/3b2/sys/flock.h @@ -8,14 +8,13 @@ #ifndef _SYS_FLOCK_H #define _SYS_FLOCK_H -#ident "@(#)head.sys:sys/flock.h 11.11" +#ident "@(#)head.sys:sys/flock.h 11.9" -#define INOFLCK 1 /* Vnode is locked when reclock() is called. */ -#define SETFLCK 2 /* Set a file lock. */ -#define SLPFLCK 4 /* Wait if blocked. */ -#define RCMDLCK 8 /* RGETLK/RSETLK/RSETLKW specified */ +#define INOFLCK 1 /* Vnode is locked when reclock() is called. */ +#define SETFLCK 2 /* Set a file lock. */ +#define SLPFLCK 4 /* Wait if blocked. */ -#define IGN_PID (-1) /* ignore epid when cleaning locks */ +#define IGN_PID -1 /* ignore epid when cleaning locks */ /* file locking structure (connected to vnode) */ @@ -41,7 +40,9 @@ typedef struct filock { /* file and record locking configuration structure */ /* record use total may overflow */ struct flckinfo { + long recs; /* number of records configured on system */ long reccnt; /* number of records currently in use */ + long recovf; /* number of times system ran out of record locks. */ long rectot; /* number of records used since system boot */ }; diff --git a/usr/src/uts/3b2/sys/fs/bfs.h b/usr/src/uts/3b2/sys/fs/bfs.h index cb03d79..8497a1e 100644 --- a/usr/src/uts/3b2/sys/fs/bfs.h +++ b/usr/src/uts/3b2/sys/fs/bfs.h @@ -8,23 +8,27 @@ #ifndef _FS_BFS_H #define _FS_BFS_H -#ident "@(#)head.sys:sys/fs/bfs.h 1.14" - -#include - +#ident "@(#)head.sys:sys/fs/bfs.h 1.8" #define BFS_MAXFNLEN 14 /* Maximum file length */ #define BFS_MAXFNLENN (BFS_MAXFNLEN+1) /* Used for NULL terminated copies */ struct bfsvattr { + long va_mask; /* bit-mask of attributes */ vtype_t va_type; /* vnode type (for create) */ mode_t va_mode; /* file access mode */ uid_t va_uid; /* owner user id */ uid_t va_gid; /* owner group id */ + dev_t va_fsid; /* file system id (dev for now) */ + o_ino_t va_nodeid; /* node id */ nlink_t va_nlink; /* number of references to file */ + ulong va_size; /* file size in bytes */ time_t va_atime; /* time of last access */ time_t va_mtime; /* time of last modification */ time_t va_ctime; /* time file ``created'' */ - long va_filler[4]; /* padding */ + dev_t va_rdev; /* device the file represents */ + ulong va_blksize; /* fundamental block size */ + ulong va_nblocks; /* # of blocks allocated */ + long va_filler[7]; /* padding */ }; /* @@ -35,16 +39,16 @@ struct bfsvattr { */ struct bfs_dirent { - ushort d_ino; /* inode */ + o_ino_t d_ino; /* inode */ daddr_t d_sblock; /* Start block */ daddr_t d_eblock; /* End block */ daddr_t d_eoffset; /* EOF disk offset (absolute) */ - struct bfsvattr d_fattr; /* File attributes */ + struct bfsvattr d_fattr; /* File attributes */ }; struct bfs_ldirs { - ushort l_ino; + o_ino_t l_ino; char l_name[BFS_MAXFNLEN]; }; @@ -93,7 +97,7 @@ struct bsuper /* The disk superbuff */ struct bdsuper { - long bdsup_bfsmagic; /* Magic number */ + long bdsup_bfsmagic; /* Magic number */ off_t bdsup_start; /* Filesystem data start offset */ off_t bdsup_end; /* Filesystem data end offset */ @@ -105,7 +109,6 @@ struct bdsuper daddr_t bdcp_toblock; /* "To" block of current transfer */ daddr_t bdcpb_fromblock; /* Backup of "from" block */ daddr_t bdcpb_toblock; /* Backup of "to" block */ - long bdsup_filler[121]; /* Padding */ }; /* Used to overlay the kernel struct fid */ @@ -115,20 +118,30 @@ struct bfs_fid_overlay long o_offset; }; +/* Used to overlay the kernel struct dirent */ +struct bfs_drent_overlay +{ + ino_t d_ino; + off_t d_off; + unsigned short d_reclen; + char d_name[BFS_MAXFNLENN]; +}; -#define BFS_MAGIC 0x1BADFACE + +#define BFS_MAGIC 016234671456 #define BFS_SUPEROFF 0 #define BFS_DIRSTART (BFS_SUPEROFF + sizeof(struct bdsuper)) -#define BFS_DEVNODE(vfsp) ((struct bsuper *)vfsp->vfs_data)->bsup_devnode +#define BFS_ROOTOFF (&(((struct bdsuper *)BFS_SUPEROFF)->bdsup_rootattrs)) #define BFS_BSIZE 512 -#define BFS_ULT RLIM_INFINITY /* file size limit not enforced */ +#define BFS_ULT (ulong)5000 +#define BFS_DEVNODE(vfsp) ((struct bsuper *)vfsp->vfs_data)->bsup_devnode #define BFS_YES (char)1 #define BFS_NO (char)0 #define CHUNKSIZE 4096 #define BIGFILE 500 #define SMALLFILE 10 #define BFSROOTINO 2 -#define DIRBUFSIZE 1024 +#define DIRBUFSIZE 1024 /* Typical size in bytes of directory */ #define BFS_OFF2INO(offset) \ ((offset - BFS_DIRSTART) / sizeof(struct bfs_dirent)) + BFSROOTINO @@ -159,6 +172,6 @@ struct bfs_fid_overlay #define BFS_IOBEGIN(bs) bs->bsup_ioinprog++ #define BFS_IOEND(bs) if (!(--bs->bsup_ioinprog)) \ - wakeprocs((caddr_t)&bs->bsup_ioinprog, PRMPT) + wakeup((caddr_t)&bs->bsup_ioinprog) #endif /* _FS_BFS_H */ diff --git a/usr/src/uts/3b2/sys/fs/bfs_compact.h b/usr/src/uts/3b2/sys/fs/bfs_compact.h index 89d4931..079955c 100644 --- a/usr/src/uts/3b2/sys/fs/bfs_compact.h +++ b/usr/src/uts/3b2/sys/fs/bfs_compact.h @@ -8,7 +8,12 @@ #ifndef _FS_BFS_COMPACT_H #define _FS_BFS_COMPACT_H -#ident "@(#)head.sys:sys/fs/bfs_compact.h 1.6" +#ident "@(#)head.sys:sys/fs/bfs_compact.h 1.5" +#ifdef _KERNEL + +#define BFS_CCT_GETINODE(bvp, offset, buf,cr) \ + vn_rdwr(UIO_READ, bvp, (caddr_t)buf, sizeof(struct bfs_dirent), \ + offset, UIO_SYSSPACE, 0, 0, cr, 0) #define BFS_CCT_READ(bvp, offset, len, buf,cr) \ vn_rdwr(UIO_READ, bvp, (caddr_t)buf, len, offset, \ @@ -18,6 +23,25 @@ vn_rdwr(UIO_WRITE, bvp, (caddr_t)buf, len, offset, \ UIO_SYSSPACE, IO_SYNC, BFS_ULT, cr, (int *)0) -#define BFS_SANITYWSTART (BFS_SUPEROFF + (sizeof(long)*3)) +#define BFS_CCT_PUTINODE(bvp, offset, buf,cr) \ + vn_rdwr(UIO_WRITE, bvp, (caddr_t)buf, sizeof(struct bfs_dirent), offset, \ + UIO_SYSSPACE, IO_SYNC, BFS_ULT, cr, (int *)0) + +#else + +#define BFS_CCT_GETINODE(fd, offset, buf, cr) \ + seek_read(fd, offset, sizeof(struct bfs_dirent), buf); + +#define BFS_CCT_READ(fd, offset, len, buf, cr) \ + seek_read(fd, offset, len, buf); + +#define BFS_CCT_WRITE(fd, offset, len, buf, cr) \ + seek_write(fd, offset, len, buf); + +#define BFS_CCT_PUTINODE(fd, offset, buf, cr) \ + seek_write(fd, offset, sizeof(struct bfs_dirent), buf); +#endif + +#define BFS_COMPACTSTART (BFS_SUPEROFF + (sizeof(long)*3)) #endif /* _FS_BFS_COMPACT_H */ diff --git a/usr/src/uts/3b2/sys/fs/fifonode.h b/usr/src/uts/3b2/sys/fs/fifonode.h index f56ec85..c1a53ec 100644 --- a/usr/src/uts/3b2/sys/fs/fifonode.h +++ b/usr/src/uts/3b2/sys/fs/fifonode.h @@ -8,7 +8,7 @@ #ifndef _FS_FIFONODE_H #define _FS_FIFONODE_H -#ident "@(#)head.sys:sys/fs/fifonode.h 1.15" +#ident "@(#)head.sys:sys/fs/fifonode.h 1.13" /* * Each FIFOFS object is identified by a struct fifonode/vnode pair. @@ -20,7 +20,6 @@ struct fifonode { ushort fn_ino; /* node id for pipes */ short fn_wcnt; /* number of writers */ short fn_rcnt; /* number of readers */ - short fn_open; /* open count of node*/ struct vnode *fn_unique; /* new vnode created by CONNLD */ ushort fn_flag; /* flags as defined below */ time_t fn_atime; /* creation times for pipe */ @@ -41,9 +40,6 @@ struct fifonode { #define FIFOREAD 040 /* process is blocked waiting to read */ #define FIFOPASS 0100 /* CONNLD passed a new vnode in fn_unique */ -/* #ifdef MERGE */ -extern int fifo_rdchk(); -/* #endif MERGE */ /* * Macros to convert a vnode to a fifnode, and vice versa. diff --git a/usr/src/uts/3b2/sys/fs/namenode.h b/usr/src/uts/3b2/sys/fs/namenode.h index 2a4756e..9535518 100644 --- a/usr/src/uts/3b2/sys/fs/namenode.h +++ b/usr/src/uts/3b2/sys/fs/namenode.h @@ -8,7 +8,7 @@ #ifndef _FS_NAMENODE_H #define _FS_NAMENODE_H -#ident "@(#)head.sys:sys/fs/namenode.h 1.3" +#ident "@(#)head.sys:sys/fs/namenode.h 1.2" /* * This structure is used to pass a file descriptor from user @@ -27,7 +27,6 @@ struct namenode { ushort nm_flag; /* flags defined below */ struct vattr nm_vattr; /* attributes of mounted STREAM */ struct vnode *nm_filevp; /* file desc. prior to mounting */ - struct file *nm_filep; /* file pointer of nm_filevp */ struct vnode *nm_mountpt; /* mount point prior to mounting */ struct namenode *nm_nextp; /* next link in the linked list */ struct namenode *nm_backp; /* back link in linked list */ diff --git a/usr/src/uts/3b2/sys/fs/rf_acct.h b/usr/src/uts/3b2/sys/fs/rf_acct.h index 00f4067..6dd1469 100644 --- a/usr/src/uts/3b2/sys/fs/rf_acct.h +++ b/usr/src/uts/3b2/sys/fs/rf_acct.h @@ -8,7 +8,7 @@ #ifndef _SYS_FS_RF_ACCT_H #define _SYS_FS_RF_ACCT_H -#ident "@(#)head.sys:sys/fs/rf_acct.h 1.8" +#ident "@(#)head.sys:sys/fs/rf_acct.h 1.6" #include "sys/types.h" #include "sys/sysinfo.h" @@ -37,13 +37,13 @@ typedef struct rfc_info { typedef struct rf_srv_info { /* ELEMENT FOR sar -Du */ - time_t rfsi_serve; /* ticks in rfs server since boot */ + time_t rfsi_serve; /* ticks in serve() since boot */ /* ELEMENTS FOR sar -S */ ulong rfsi_nservers; /* sum of all servers since boot */ ulong rfsi_srv_que; /* sum of server queue length since boot */ - ulong rfsi_srv_occ; /* seconds server queue found occupied */ + ulong rfsi_srv_occ; /* ticks server queue found occupied */ ulong rfsi_rcv_que; /* sum of server work list length since boot */ - ulong rfsi_rcv_occ; /* seconds server work list found occupied */ + ulong rfsi_rcv_occ; /* ticks server work list found occupied */ } rf_srv_info_t; #if defined(_KERNEL) @@ -53,13 +53,11 @@ extern fsinfo_t rfcl_fsinfo; extern fsinfo_t rfsr_fsinfo; extern rf_srv_info_t rf_srv_info; -extern time_t *rfsi_servep; /* SVID compliance hack for sar(1) */ - -extern int minserve; /* tunable: server low water mark */ -extern int maxserve; /* tunable: server high water mark */ -extern int rf_nservers; /* total servers in system */ -extern int n_idleserver; /* idle servers in system */ -extern int rf_n_sr_msgs; /* rcvds in server work list */ +extern int minserve; /* RFS tunable: server low water mark */ +extern int maxserve; /* RFS tunable: server high water mark */ +extern int rf_nservers; /* total servers in system */ +extern int n_idleserver; /* idle servers in system */ +extern int rf_n_sr_msgs; /* receive descriptors in server work list */ extern void rf_clock(); diff --git a/usr/src/uts/3b2/sys/fs/s5inode.h b/usr/src/uts/3b2/sys/fs/s5inode.h index 8fac29b..0938987 100644 --- a/usr/src/uts/3b2/sys/fs/s5inode.h +++ b/usr/src/uts/3b2/sys/fs/s5inode.h @@ -8,7 +8,7 @@ #ifndef _FS_S5INODE_H #define _FS_S5INODE_H -#ident "@(#)head.sys:sys/fs/s5inode.h 11.28" +#ident "@(#)head.sys:sys/fs/s5inode.h 11.26" #include "sys/proc.h" /* XXX -- needed for user-context kludge in ILOCK */ #include "sys/disp.h" /* XXX */ @@ -165,7 +165,7 @@ struct s5vfs { (ip)->i_flag |= IWANT; \ (void) sleep((caddr_t)(ip), PINOD); \ } \ - (ip)->i_rwowner = curproc->p_slot; \ + (ip)->i_rwowner = (GET_INDEX(curproc->p_pid)); \ (ip)->i_flag |= IRWLOCKED; \ if ((ip)->i_vnode.v_flag & VISSWAP) { \ curproc->p_swlocks++; \ @@ -182,16 +182,17 @@ struct s5vfs { (ip)->i_flag &= ~IRWLOCKED; \ if ((ip)->i_flag & IWANT) { \ (ip)->i_flag &= ~IWANT; \ - wakeprocs((caddr_t)(ip), PRMPT); \ + wakeup((caddr_t)(ip)); \ } \ } #define ILOCK(ip) { \ - while (((ip)->i_flag & ILOCKED) && (ip)->i_owner != curproc->p_slot) { \ + while (((ip)->i_flag & ILOCKED) && \ + (ip)->i_owner != (GET_INDEX(curproc->p_pid))) { \ (ip)->i_flag |= IWANT; \ (void) sleep((caddr_t)(ip), PINOD); \ } \ - (ip)->i_owner = curproc->p_slot; \ + (ip)->i_owner = (GET_INDEX(curproc->p_pid)); \ (ip)->i_nilocks++; \ (ip)->i_flag |= ILOCKED; \ if ((ip)->i_vnode.v_flag & VISSWAP) { \ @@ -212,7 +213,7 @@ struct s5vfs { (ip)->i_flag &= ~ILOCKED; \ if ((ip)->i_flag & IWANT) { \ (ip)->i_flag &= ~IWANT; \ - wakeprocs((caddr_t)(ip), PRMPT); \ + wakeup((caddr_t)(ip)); \ } \ } \ } diff --git a/usr/src/uts/3b2/sys/fs/snode.h b/usr/src/uts/3b2/sys/fs/snode.h index 1b58c0c..8f145d5 100644 --- a/usr/src/uts/3b2/sys/fs/snode.h +++ b/usr/src/uts/3b2/sys/fs/snode.h @@ -8,7 +8,7 @@ #ifndef _FS_SNODE_H #define _FS_SNODE_H -#ident "@(#)head.sys:sys/fs/snode.h 1.21" +#ident "@(#)head.sys:sys/fs/snode.h 1.19" /* * The snode represents a special file in any filesystem. There is * one snode for each active special file. Filesystems that support @@ -84,7 +84,7 @@ extern struct proc *curproc; /* XXX vm debugging */ curproc->p_flag &= ~SSWLOCKS; \ if ((sp)->s_flag & SWANT) { \ (sp)->s_flag &= ~SWANT; \ - wakeprocs((caddr_t)(sp), PRMPT); \ + wakeup((caddr_t)(sp)); \ } \ (sp)->s_powns = NULL; \ } @@ -118,10 +118,6 @@ extern int openprivwait(); extern int setprivwait(); extern void privsig(); -/* #ifdef MERGE */ -extern int spec_rdchk(); -/* #endif MERGE */ - /* * If driver does not have a size routine (e.g. old drivers), the size of the * device is assumed to be infinite. diff --git a/usr/src/uts/3b2/sys/fs/ufs_inode.h b/usr/src/uts/3b2/sys/fs/ufs_inode.h index 08d61c0..5774bbf 100644 --- a/usr/src/uts/3b2/sys/fs/ufs_inode.h +++ b/usr/src/uts/3b2/sys/fs/ufs_inode.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/fs/ufs_inode.h 1.16" +#ident "@(#)head.sys:sys/fs/ufs_inode.h 1.12" #ifndef _SYS_FS_UFS_INODE_H #define _SYS_FS_UFS_INODE_H @@ -41,7 +41,7 @@ struct inode { struct inode *i_freef; /* free list forward */ struct inode **i_freeb; /* free list back */ ulong i_vcode; /* version code attribute */ - long i_mapcnt; /* mappings to file pages */ + ulong i_mapcnt; /* mappings to file pages */ int *i_map; /* block list for the corresponding file */ struct icommon { o_mode_t ic_smode; /* 0: mode and type of file */ @@ -227,7 +227,7 @@ extern int vttoif_tab[]; (ip)->i_flag |= IWANT; \ (void) sleep((caddr_t)(ip), PINOD); \ } \ - (ip)->i_rwowner = curproc->p_slot; \ + (ip)->i_rwowner = (GET_INDEX(curproc->p_pid)); \ (ip)->i_flag |= IRWLOCKED; \ if (((ip)->i_vnode.v_flag & VISSWAP) != 0){ \ curproc->p_swlocks++; \ @@ -239,21 +239,21 @@ extern int vttoif_tab[]; ASSERT((ip)->i_flag & IRWLOCKED); \ if (((ip)->i_vnode.v_flag & VISSWAP) != 0) \ if (--curproc->p_swlocks == 0) \ - curproc->p_flag &= ~SSWLOCKS; \ + curproc->p_flag |= SSWLOCKS; \ (ip)->i_flag &= ~IRWLOCKED; \ if ((ip)->i_flag & IWANT) { \ (ip)->i_flag &= ~IWANT; \ - wakeprocs((caddr_t)(ip), PRMPT); \ + wakeup((caddr_t)(ip)); \ } \ } #define ILOCK(ip) { \ while (((ip)->i_flag & ILOCKED) && \ - (ip)->i_owner != curproc->p_slot) { \ + (ip)->i_owner != (GET_INDEX(curproc->p_pid))) { \ (ip)->i_flag |= IWANT; \ (void) sleep((caddr_t)(ip), PINOD); \ } \ - (ip)->i_owner = curproc->p_slot; \ + (ip)->i_owner = (GET_INDEX(curproc->p_pid)); \ (ip)->i_count++; \ (ip)->i_flag |= ILOCKED; \ if (((ip)->i_vnode.v_flag & VISSWAP) != 0){ \ @@ -267,12 +267,12 @@ extern int vttoif_tab[]; panic("IUNLOCK"); \ if (((ip)->i_vnode.v_flag & VISSWAP) != 0) \ if (--curproc->p_swlocks == 0) \ - curproc->p_flag &= ~SSWLOCKS; \ + curproc->p_flag |= SSWLOCKS; \ if ((ip)->i_count == 0) { \ (ip)->i_flag &= ~ILOCKED; \ if ((ip)->i_flag & IWANT) { \ (ip)->i_flag &= ~IWANT; \ - wakeprocs((caddr_t)(ip), PRMPT); \ + wakeup((caddr_t)(ip)); \ } \ } \ } diff --git a/usr/src/uts/3b2/sys/fs/ufs_quota.h b/usr/src/uts/3b2/sys/fs/ufs_quota.h index a1dfaae..94c3180 100644 --- a/usr/src/uts/3b2/sys/fs/ufs_quota.h +++ b/usr/src/uts/3b2/sys/fs/ufs_quota.h @@ -5,11 +5,16 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/fs/ufs_quota.h 1.5" +#ident "@(#)head.sys:sys/fs/ufs_quota.h 1.3" #ifndef _SYS_FS_UFS_QUOTA_H #define _SYS_FS_UFS_QUOTA_H +/* + * Various junk to do with various quotas (etc) imposed upon + * the average user (big brother finally hits UNIX). + */ + /* * The following constants define the default amount of time given a user * before the soft limits are treated as hard limits (usually resulting @@ -102,7 +107,7 @@ extern void dqupdate(); /* update dquot on disk */ (dqp)->dq_flags &= ~DQ_LOCKED; \ if ((dqp)->dq_flags & DQ_WANT) { \ (dqp)->dq_flags &= ~DQ_WANT; \ - wakeprocs((caddr_t)(dqp), PRMPT); \ + wakeup((caddr_t)(dqp)); \ } \ } #endif diff --git a/usr/src/uts/3b2/sys/fs/xnamnode.h b/usr/src/uts/3b2/sys/fs/xnamnode.h index c85b670..589601f 100644 --- a/usr/src/uts/3b2/sys/fs/xnamnode.h +++ b/usr/src/uts/3b2/sys/fs/xnamnode.h @@ -8,7 +8,7 @@ #ifndef _FS_XNAMNODE_H #define _FS_XNAMNODE_H -#ident "@(#)head.sys:sys/fs/xnamnode.h 1.5" +#ident "@(#)head.sys:sys/fs/xnamnode.h 1.4" /* * The xnamnode represents a special XENIX file in any filesystem. There is * one xnamnode for each active special XENIX file. Filesystems that support @@ -102,7 +102,7 @@ extern struct proc *curproc; /* XXX vm debugging */ curproc->p_flag &= ~SSWLOCKS; \ if ((xp)->x_flag & XNAMWANT) { \ (xp)->x_flag &= ~XNAMWANT; \ - wakeprocs((caddr_t)(xp), PRMPT); \ + wakeup((caddr_t)(xp)); \ } \ (xp)->x_powns = NULL; \ } diff --git a/usr/src/uts/3b2/sys/gdpstr.h b/usr/src/uts/3b2/sys/gdpstr.h new file mode 100644 index 0000000..8ae7676 --- /dev/null +++ b/usr/src/uts/3b2/sys/gdpstr.h @@ -0,0 +1,78 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_GDPSTR_H +#define _SYS_GDPSTR_H + +#ident "@(#)head.sys:sys/gdpstr.h 11.2" +/* + * commands for virtual circuits set up + */ + +#define PM_DATA 0 +#define PM_LISTEN 1 +#define PM_CONNECT 2 +#define PM_ACCEPT 3 +#define PM_DISCONNECT 4 + +/* + * reason for disconnect + */ + +#define VC_REJECT 1 /* reject a conection request */ +#define VC_CLOSE 2 /* closed by the other end */ +#define VC_CONNFAIL 3 /* fail to contact remote side */ +#define VC_LINKDOWN 4 /* link down */ +#define VC_NORMAL 6 /* normal disconnect link not needed */ + +/* + * messages passed from the upper modules + * to the protocol module + */ + +/* connection request */ + +struct pm_connect { + naddr_t dstnadr; /* destination network address */ + ushort dstmdev; /* destination minor device number */ + ushort nretry; /* number of retries for set up */ + ushort interval; /* time interval between retries */ +}; + + +/* accept the connection request */ + +struct pm_accept { + naddr_t dstnadr; /* destination network address */ + ushort dstmdev; /* destination minor device number */ + ushort respmdev; /* responding minor device number */ +}; + + +/* reject the connection request or + disconnect a virtual circuit */ + +struct pm_disconnect { + naddr_t dstnadr; /* destination network address */ + ushort dstmdev; /* destination minor device number */ + short reason; /* reason for disconnect */ +}; + + +/* + * messages returned from the protocol module + * to the upper modules + */ + +struct resp_msg { + short cmd; /* command */ + short reason; /* reason for disconnect */ + naddr_t srcnadr; /* source network address */ + ushort srcmdev; /* source minor device number */ +}; + +#endif /* _SYS_GDPSTR_H */ diff --git a/usr/src/uts/3b2/sys/immu.h b/usr/src/uts/3b2/sys/immu.h index 434c2de..bf7194d 100644 --- a/usr/src/uts/3b2/sys/immu.h +++ b/usr/src/uts/3b2/sys/immu.h @@ -8,25 +8,25 @@ #ifndef _SYS_IMMU_H #define _SYS_IMMU_H -#ident "@(#)head.sys:sys/immu.h 11.18" +#ident "@(#)head.sys:sys/immu.h 11.15" /* * Page Table Entry Definitions */ typedef union pte { /* page table entry */ - -/* DEBUG */ -/* only */ -/* +---------------------+---+---+-+-+-+-+-+-+ */ -/* | pfn |tag| |r|w| |l|m|v| */ -/* +---------------------+---+---+-+-+-+-+-+-+ */ -/* 21 3 2 1 1 1 1 1 1 */ -/* */ +/* */ +/* +---------------------+---+--+--+--+-+-+-+-+-+-+ */ +/* | pfn |lck|nr| | |r|w| |l|m|v| */ +/* +---------------------+---+--+--+--+-+-+-+-+-+-+ */ +/* 21 1 1 1 2 1 1 1 1 1 1 */ +/* */ struct { uint pg_pfn : 21, /* Physical page frame number */ - pg_tag : 3, /* Unused software bits. */ - : 2, /* Reserved by hardware. */ + pg_lock : 1, /* Lock in core (software) */ + pg_ndref : 1, /* Needs reference (software). */ + : 1, /* Unused software bit. */ + : 2, /* Reserved by hardware. */ pg_ref : 1, /* Page has been referenced */ pg_w : 1, /* Fault on write */ : 1, /* Reserved by hardware. */ @@ -65,9 +65,8 @@ typedef struct ptbl { /* Page descriptor (table) entry field masks */ #define PG_ADDR 0xFFFFF800 /* physical page address */ -#ifdef DEBUG -#define PG_LOCK 0x00000700 /* mapping SOFTLOCK count (software) */ -#endif +#define PG_LOCK 0x00000400 /* page lock bit (software) */ +#define PG_NDREF 0x00000200 /* need reference bit (software) */ #define PG_REF 0x00000020 /* reference bit */ #define PG_W 0x00000010 /* fault on write bit */ #define PG_LAST 0x00000004 /* last page bit */ @@ -96,45 +95,28 @@ typedef struct ptbl { #define mkpte(mode,pfn) (mode | ((pfn) << PNUMSHFT)) -/* The following macros are used to set/check the values +/* The following macros are used to check the value + * of the bits in a page table entry + */ + +#define PG_ISVALID(pte) ((pte)->pgm.pg_v) +#define PG_ISLOCKED(pte) ((pte)->pgm.pg_lock) + +/* The following macros are used to set the value * of the bits in a page descrptor (table) entry * * Atomic instruction is available to clear the present bit, * other bits are set or cleared in a word operation. */ -#define PG_ISVALID(pte) ((pte)->pgm.pg_v) #define PG_SETVALID(pte) ((pte)->pg_pte |= PG_V) #define PG_CLRVALID(pte) ((pte)->pg_pte &= ~PG_V) #define PG_SETNDREF(pte) ((pte)->pg_pte |= PG_NDREF) #define PG_CLRNDREF(pte) ((pte)->pg_pte &= ~PG_NDREF) -#ifdef DEBUG - -/* - * Macros to keep track of SOFTLOCKs on a mapping. - */ - -#define PG_ISLOCKED(pte) ((pte)->pgm.pg_tag) -#define PG_SETLOCK(pte) { \ - if ((pte)->pgm.pg_tag == 7) \ - cmn_err(CE_PANIC, "Too many SOFTLOCKs on mapping !\n"); \ - ++(pte)->pgm.pg_tag; \ -} -#define PG_CLRLOCK(pte) { \ - if ((pte)->pgm.pg_tag == 0) \ - cmn_err(CE_PANIC, "SOFTUNLOCK on an unlocked mapping !\n"); \ - --(pte)->pgm.pg_tag; \ -} - -#else - -#define PG_ISLOCKED(pte) -#define PG_SETLOCK(pte) -#define PG_CLRLOCK(pte) - -#endif +#define PG_SETLOCK(pte) ((pte)->pg_pte |= PG_LOCK) +#define PG_CLRLOCK(pte) ((pte)->pg_pte &= ~PG_LOCK) #define PG_SETMOD(pte) ((pte)->pg_pte |= PG_M) #define PG_CLRMOD(pte) ((pte)->pg_pte &= ~PG_M) @@ -212,7 +194,7 @@ typedef struct sde { /* segment descriptor (table) entry */ #define SD_ISCONTIG(sde) ((sde)->seg_flags & SDE_C_bit) #define SD_ISTRAP(sde) ((sde)->seg_flags & SDE_T_bit) #define SD_SEGBYTES(sde) (int)((((sde)->seg_len) + 1) << 3) -#define SD_LASTPG(sde) (((sde)->seg_len) >> 8) +#define SD_LASTPG(sde) ((sde)->seg_len) >> 8) #define SD_U_ACCESS(sde) (((sde)->seg_prot) & UACCESS) #define SD_K_ACCESS(sde) (((sde)->seg_prot) & KACCESS) #define SD_SEGINDX(addr) ((int)addr & MSK_IDXSEG) @@ -221,7 +203,6 @@ typedef struct sde { /* segment descriptor (table) entry */ /* Segment descriptor (table) dependent constants. */ #define NBPS 0x20000 /* Number of bytes per segment. */ -#define NPPS 64 /* Number of pages per segment. */ #define PPSSHFT 6 /* Shift for pages per segment. */ #define SOFFMASK 0x1FFFF /* Mask for offset into segment. */ #define SEGOFF(x) ((uint)(x) & SOFFMASK) @@ -412,6 +393,7 @@ extern int availsmem; /* Available swapable memory in */ */ extern paddr_t svirtophys(/* va */); +extern paddr_t kvtophys(/* va */); #define phystokv(paddr) (paddr) diff --git a/usr/src/uts/3b2/sys/ioctl.h b/usr/src/uts/3b2/sys/ioctl.h index a678b67..9313f7d 100644 --- a/usr/src/uts/3b2/sys/ioctl.h +++ b/usr/src/uts/3b2/sys/ioctl.h @@ -8,27 +8,22 @@ #ifndef _SYS_IOCTL_H #define _SYS_IOCTL_H -#ident "@(#)head.sys:sys/ioctl.h 11.8" +#ident "@(#)head.sys:sys/ioctl.h 11.5" /* - * There are some inherent problems in having a single file - * ioctl.h, with both System V and BSD flags. Introducing - * BSD flags into this file creates compilation problems - * with flags such as ECHO, NL1 etc., if termio.h and ioctl.h - * are included by the same file. Since these two files can - * be only included by System V applications, /usr/inclule/sys/ioctl.h - * will be System V mode and all the BSD flags will be turned off - * using #ifdef BSD_COMP. This file will also exist in - * /usr/ucbinclude/sys/ioctl.h for BSD applications but without the - * BSD flags turned off. System V appliactions can use ioctl.h without - * any changes, System V applications requiring BSD flags should - * -D BSD_COMP when compiling (and be warned about the common - * flags between System V and BSD) and BSD applications should - * use /usr/ucbinclude/sys/ioctl.h. - * + * Currently only used by BSD applications. + * Includes ttold.h for BSD terminal definitions. + * ioctl.h should not be included when + * termios.h is included. + * LIOC/DIOC defines are commented because we want + * get rid of these ioctls (eventually). */ - #define IOCTYPE 0xff00 +#if 0 +/* note this is commented */ +/* if no software is using these ioctls */ +/* they should be removed */ + #define LIOC ('l'<<8) #define LIOCGETP (LIOC|1) #define LIOCSETP (LIOC|2) @@ -40,13 +35,9 @@ #define DIOCGETB (DIOC|2) #define DIOCSETE (DIOC|3) -/* BSD related defines */ +#endif /* end if 0 */ -#ifdef BSD_COMP - -#include -#include -#include +#include "sys/ttold.h" #define TANDEM O_TANDEM #define CBREAK O_CBREAK @@ -98,9 +89,8 @@ #define DECCTQ O_DECCTQ #define NOFLSH O_NOFLSH -#include -#include - -#endif /* BSD_COMP */ +/* SUN has these files included, are they required in SVR4.0? */ +/* #include "sys/filio.h" */ +/* #include "sys/sockio.h" */ #endif /* _SYS_IOCTL_H */ diff --git a/usr/src/uts/3b2/sys/lock.h b/usr/src/uts/3b2/sys/lock.h index 291fb59..f7783a3 100644 --- a/usr/src/uts/3b2/sys/lock.h +++ b/usr/src/uts/3b2/sys/lock.h @@ -8,7 +8,7 @@ #ifndef _SYS_LOCK_H #define _SYS_LOCK_H -#ident "@(#)head.sys:sys/lock.h 11.7" +#ident "@(#)head.sys:sys/lock.h 11.6" /* * flags for locking procs and texts */ @@ -19,8 +19,6 @@ #ifdef _KERNEL -#define MEMLOCK 8 - #if defined(__STDC__) int punlock(void); #else diff --git a/usr/src/uts/3b2/sys/mkdev.h b/usr/src/uts/3b2/sys/mkdev.h index 728c823..6548e94 100644 --- a/usr/src/uts/3b2/sys/mkdev.h +++ b/usr/src/uts/3b2/sys/mkdev.h @@ -8,7 +8,7 @@ #ifndef _SYS_MKDEV_H #define _SYS_MKDEV_H -#ident "@(#)head.sys:sys/mkdev.h 1.6" +#ident "@(#)head.sys:sys/mkdev.h 1.5" /* SVR3 device number constants */ @@ -49,10 +49,10 @@ minor_t __minor(const int, const dev_t); #else -dev_t makedev(); +dev_t makdev(); major_t major(); minor_t minor(); -dev_t __makedev(); +dev_t __makdev(); major_t __major(); minor_t __minor(); diff --git a/usr/src/uts/3b2/sys/mman.h b/usr/src/uts/3b2/sys/mman.h index 0137024..1276228 100644 --- a/usr/src/uts/3b2/sys/mman.h +++ b/usr/src/uts/3b2/sys/mman.h @@ -5,33 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - #ifndef _SYS_MMAN_H #define _SYS_MMAN_H -#ident "@(#)head.sys:sys/mman.h 1.14" +#ident "@(#)head.sys:sys/mman.h 1.12" /* * Protections are chosen from these bits, or-ed together. diff --git a/usr/src/uts/3b2/sys/netcspace.h b/usr/src/uts/3b2/sys/netcspace.h new file mode 100644 index 0000000..dce8ce2 --- /dev/null +++ b/usr/src/uts/3b2/sys/netcspace.h @@ -0,0 +1,55 @@ +#ident "@(#)head.sys:sys/netcspace.h 1.1" +/* TEMPORARY - added for kernel rpc */ + +struct nc_data { + char *string; + unsigned long value; +}; + +static struct nc_data nc_semantics[] = { + "tpi_clts", NC_TPI_CLTS, + "tpi_cots", NC_TPI_COTS, + "tpi_cots_ord", NC_TPI_COTS_ORD, + "npi_raw", NC_NPI_RAW, + NULL, (unsigned)-1L +}; + +static struct nc_data nc_flag[] = { + "-", NC_NOFLAG, + "v", NC_VISIBLE, + NULL, (unsigned)-1L +}; + +static struct nc_data nc_protofmly[] = { + "-", NC_NOPROTOFMLY, + "loopback", NC_LOOPBACK, + "inet", NC_INET, + "implink", NC_IMPLINK, + "pup", NC_PUP, + "chaos", NC_CHAOS, + "ns", NC_NS, + "nbs", NC_NBS, + "ecma", NC_ECMA, + "datakit", NC_DATAKIT, + "ccitt", NC_CCITT, + "sna", NC_SNA, + "decnet", NC_DECNET, + "dli", NC_DLI, + "lat", NC_LAT, + "hylink", NC_HYLINK, + "appletalk", NC_APPLETALK, + "nit", NC_NIT, + "ieee802", NC_IEEE802, + "osi", NC_OSI, + "x25", NC_X25, + "osinet", NC_OSINET, + "gosip", NC_GOSIP, + NULL, (unsigned)-1L +}; + +static struct nc_data nc_proto[] = { + "-", NC_NOPROTO, + "tcp", NC_TCP, + "udp", NC_UDP, + NULL, (unsigned)-1L +}; diff --git a/usr/src/uts/3b2/sys/param.h b/usr/src/uts/3b2/sys/param.h index d96a52f..4c9543b 100644 --- a/usr/src/uts/3b2/sys/param.h +++ b/usr/src/uts/3b2/sys/param.h @@ -5,33 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - #ifndef _SYS_PARAM_H #define _SYS_PARAM_H -#ident "@(#)head.sys:sys/param.h 11.26" +#ident "@(#)head.sys:sys/param.h 11.22" #include "sys/types.h" @@ -39,16 +16,8 @@ * Fundamental variables; don't change too often. */ -#ifndef _POSIX_VDISABLE -#define _POSIX_VDISABLE 0 /* Disable special character functions */ -#endif - -#ifndef MAX_INPUT -#define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ -#endif - -#ifndef MAX_CANON -#define MAX_CANON 256 /* Maximum bytes in a line for canoical processing */ +#ifndef _POSIX_VERSION +#define _POSIX_VERSION 198808L #endif #define UID_NOBODY 60001 diff --git a/usr/src/uts/3b2/sys/pathname.h b/usr/src/uts/3b2/sys/pathname.h index d6622eb..654395d 100644 --- a/usr/src/uts/3b2/sys/pathname.h +++ b/usr/src/uts/3b2/sys/pathname.h @@ -5,33 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - #ifndef _SYS_PATHNAME_H #define _SYS_PATHNAME_H -#ident "@(#)head.sys:sys/pathname.h 1.7" +#ident "@(#)head.sys:sys/pathname.h 1.6" /* * Pathname structure. * System calls that operate on path names gather the path name diff --git a/usr/src/uts/3b2/sys/proc.h b/usr/src/uts/3b2/sys/proc.h index 3caf555..3e41b98 100644 --- a/usr/src/uts/3b2/sys/proc.h +++ b/usr/src/uts/3b2/sys/proc.h @@ -8,7 +8,7 @@ #ifndef _SYS_PROC_H #define _SYS_PROC_H -#ident "@(#)head.sys:sys/proc.h 11.65" +#ident "@(#)head.sys:sys/proc.h 11.59" #include "sys/immu.h" @@ -25,7 +25,7 @@ typedef struct proc { u_char p_swlocks; /* number of swap vnode locks held */ u_int p_flag; /* flags defined below */ o_uid_t p_uid; /* for binary compatibility - real user id */ - o_pid_t p_oppid; /* process id of parent*/ + struct cred *p_cred; /* process credentials */ /* the following pid fields declared o_pid_t are for ** binary compatibility only. They will be removed in @@ -34,7 +34,7 @@ typedef struct proc { o_pid_t p_opgrp; /* name of process group leader */ o_pid_t p_opid; /* unique process id*/ - struct cred *p_cred; /* process credentials */ + o_pid_t p_oppid; /* process id of parent*/ struct sess *p_sessp; /* session information */ int p_pri; /* scheduling priority */ @@ -49,7 +49,7 @@ typedef struct proc { caddr_t p_brkbase; /* base address of heap */ u_int p_brksize; /* heap size in bytes */ - caddr_t p_stkbase; /* base address of stack */ + int * p_stkbase; /* base address of stack */ int p_stksize; /* stack size in words */ u_int p_swrss; /* resident set size before last swap */ @@ -106,48 +106,101 @@ typedef struct proc { caddr_t *p_segacct; /* segment accounting info */ struct seguser *p_segu; /* u segment */ struct vnode *p_exec; /* pointer to a.out vnode */ + pid_t p_pgrp; /* name of process group leader */ + pid_t p_pid; /* unique process id*/ pid_t p_ppid; /* process id of parent*/ - struct pid *p_pidp; /* process ID info */ - struct pid *p_pgidp; /* process group ID info */ +/* #ifdef MERGE */ struct sd *p_sdp; /* pointer to XENIX shared data */ - struct proc *p_next; /* active chain link */ - struct proc *p_nextofkin; /* gets accounting info at exit */ - struct proc *p_orphan; - struct proc *p_nextorph; +/* #endif MERGE */ } proc_t; -/* active process chain */ +/* + * The incarnation structure: one-to-one correspondence with + * the proc table. + */ +typedef struct pincr { + struct pincr *pi_link; + pid_t pi_pid; +} pincr_t; -extern proc_t *practive; +typedef struct nproc_dummy { /* for demon use only */ + int dummy_demon; /* to make demon work for nproc[n] */ +} nproc_t; -/* Well known processes */ +extern proc_t *nproc[]; /* the proc table itself */ +extern pincr_t pincr[]; /* the incarnation table */ +extern pincr_t *pfreelisthead; /* the first free pincr table entry pointer */ +extern pincr_t *pfreelisttail; /* the last free pincr table entry pointer */ -extern proc_t *proc_sched; /* memory scheduler */ -extern proc_t *proc_init; /* init */ -extern proc_t *proc_pageout; /* pageout daemon */ -extern proc_t *proc_bdflush; /* block cache flush daemon */ +#if defined(_KERNEL) -/* process ID info */ +#if defined(__STDC__) -struct pid { - unsigned int pid_prinactive :1; - unsigned int pid_pgorphaned :1; - unsigned int pid_ref :6; - unsigned int pid_prslot :24; - pid_t pid_id; - struct proc *pid_pglink; - struct pid *pid_link; -}; +/* process management functions */ +extern caddr_t findvaddr(proc_t *); +extern paddr_t vtop(caddr_t, proc_t *); +extern void pexit(void); +extern int newproc(int, pid_t *, int *); +extern void pid_release(pid_t); +extern void vfwait(pid_t); +extern void freeproc(proc_t *); +extern proc_t *prfind(pid_t); +extern void sigcld(proc_t *); +extern void psig(void); +extern int stop(proc_t *, int, int, int); +extern int issig(int); +extern void psignal(proc_t *, int); +extern void sigtoproc(proc_t *, int, int); +extern void setrun(proc_t *); +extern void unsleep(proc_t *); +extern void exit(int, int); +extern void relvm(proc_t *); + +/* process group management functions (defined in os/pgrp.c) */ +extern void signal(pid_t, int); +extern void detachcld(proc_t *); +extern void joinpg(proc_t *, pid_t); +extern void attachpg(proc_t *); +extern void leavepg(proc_t *); +extern int checkpg(pid_t, pid_t); +extern int memberspg(pid_t); +extern int detachedpg(pid_t); -extern struct pid pid0; +#else -#define p_pgrp p_pgidp->pid_id -#define p_pid p_pidp->pid_id -#define p_slot p_pidp->pid_prslot -#define p_detached p_pidp->pid_pgorphaned +/* process management functions */ +extern caddr_t findvaddr(); +extern paddr_t vtop(); +extern void pexit(); +extern int newproc(); +extern void pid_release(); +extern void vfwait(); +extern void freeproc(); +extern proc_t *prfind(); +extern void sigcld(); +extern void psig(); +extern int stop(); +extern int issig(); +extern void psignal(); +extern void sigtoproc(); +extern void setrun(); +extern void unsleep(); +extern void exit(); +extern void relvm(); -#define PID_HOLD(pidp) (++(pidp)->pid_ref) -#define PID_RELE(pidp) ((pidp)->pid_ref>1 ? --(pidp)->pid_ref : pid_rele(pidp)) +/* process group management functions (defined in os/pgrp.c) */ +extern void signal(); +extern void detachcld(); +extern void joinpg(); +extern void attachpg(); +extern void leavepg(); +extern int checkpg(); +extern int memberspg(); +extern int detachedpg(); + +#endif /* __STDC__ */ + +#endif /* _KERNEL */ /* stat codes */ @@ -182,13 +235,16 @@ extern struct pid pid0; #define SUSWAP 0x00040000 /* u-block is being swapped in or out */ #define SUWANT 0x00080000 /* waiting for u-block swap to complete */ #define SEXECED 0x00100000 /* this process has execed */ -#define SSWLOCKS 0x00200000 /* process has swap locks */ -#define SXSTART 0x00400000 /* setrun() by SIGCONT or ptrace() */ -#define SPSTART 0x00800000 /* setrun() by /proc */ +#define SDETACHED 0x00200000 /* this process detached from ctty */ +/* unused 0x00400000 */ +/* unused 0x00800000 */ #define SJCTL 0x01000000 /* SIGCLD sent when children stop/continue */ #define SNOWAIT 0x02000000 /* children never become zombies */ #define SVFORK 0x04000000 /* process resulted from vfork */ #define SVFDONE 0x08000000 /* vfork child releasing parent as */ +#define SSWLOCKS 0x10000000 /* process has swap locks */ +#define SXSTART 0x20000000 /* setrun() by SIGCONT or ptrace() */ +#define SPSTART 0x40000000 /* setrun() by /proc */ /* pollflags */ @@ -225,89 +281,17 @@ extern struct pid pid0; #define FORREAL 0 /* Usual side-effects */ #define JUSTLOOKING 1 /* Don't stop the process */ -#ifdef _KERNEL - -#ifdef __STDC__ - -/* process management functions */ -extern caddr_t findvaddr(proc_t *); -extern paddr_t vtop(caddr_t, proc_t *); -extern void pexit(void); -extern int newproc(int, pid_t *, int *); -extern void vfwait(pid_t); -extern void freeproc(proc_t *); -extern void setrun(proc_t *); -extern void unsleep(proc_t *); -extern void exit(int, int); -extern void relvm(proc_t *); - -extern void sigcld(proc_t *); -extern void psig(void); -extern int stop(proc_t *, int, int, int); -extern int issig(int); -extern void psignal(proc_t *, int); -extern void sigtoproc(proc_t *, int, int); - -void pid_setmin(void); -pid_t pid_assign(int, proc_t **); -int pid_rele(struct pid *); -void pid_exit(proc_t *); -proc_t *prfind(pid_t); -proc_t *pgfind(pid_t); -void pid_init(void); -proc_t *pid_entry(int); -int pid_slot(proc_t *); -void signal(pid_t, int); -void prsignal(struct pid *, int); - -void pgsignal(struct pid *, int); -void pgjoin(proc_t *, struct pid *); -void pgcreate(proc_t *); -void pgexit(proc_t *); -void pgdetach(proc_t *); -int pgmembers(pid_t); - -#else - -extern caddr_t findvaddr(); -extern paddr_t vtop(); -extern void pexit(); -extern int newproc(); -extern void vfwait(); -extern void freeproc(); -extern void setrun(); -extern void unsleep(); -extern void exit(); -extern void relvm(); +/* Macros for pid manipulation */ -extern void sigcld(); -extern void psig(); -extern int stop(); -extern int issig(); -extern void psignal(); -extern void sigtoproc(); +#define PIDSHIFT 12 /* 2^PIDSHIFT >= NPROC */ +#define PIDINDEXMAX 0x0fff /* = 2^PIDSHIFT-1 */ +#define PIDINCARMAX 0x7000 /* 3 bits for incarnation number as of 08/15/88 */ -void pid_setmin(); -pid_t pid_assign(); -int pid_rele(); -void pid_exit(); -proc_t *prfind(); -proc_t *pgfind(); -void pid_init(); -proc_t *pid_entry(); -int pid_slot(); -void signal(); -void prsignal(); - -void pgsignal(); -void pgjoin(); -void pgcreate(); -void pgexit(); -void pgdetach(); -int pgmembers(); - -#endif /* __STDC__ */ - -#endif /* _KERNEL */ +#define GET_INDEX(PI_PID) ((PI_PID)&(PIDINDEXMAX)) +#define GET_INCAR(PI_PID) (((unsigned)((PI_PID)&(PIDINCARMAX))) >> (PIDSHIFT)) +#define INC_INCAR(PI_PID) ((PI_PID) = (((unsigned)(PI_PID) + ((0x1)<<(PIDSHIFT)))&((PIDINDEXMAX)|(PIDINCARMAX)))) +#define INC_INDEX(PI_PID) PUT_INDEX(PI_PID,(GET_INDEX(PI_PID)+1)%NPROC) +#define PUT_INCAR(PI_PID,INCAR) ((PI_PID) = (((PI_PID)&(PIDINDEXMAX)) | (((INCAR)<<(PIDSHIFT))&(PIDINCARMAX)))) +#define PUT_INDEX(PI_PID,INDEX) ((PI_PID) = (((PI_PID)&(PIDINCARMAX)) | ((INDEX)&(PIDINDEXMAX)))) #endif /* _SYS_PROC_H */ diff --git a/usr/src/uts/3b2/sys/procfs.h b/usr/src/uts/3b2/sys/procfs.h index c8f67e1..0f2af2b 100644 --- a/usr/src/uts/3b2/sys/procfs.h +++ b/usr/src/uts/3b2/sys/procfs.h @@ -8,7 +8,7 @@ #ifndef _SYS_PROCFS_H #define _SYS_PROCFS_H -#ident "@(#)head.sys:sys/procfs.h 1.23" +#ident "@(#)head.sys:sys/procfs.h 1.22" #include "sys/types.h" #include "sys/time.h" @@ -201,9 +201,9 @@ typedef struct prcred { uid_t pr_euid; /* Effective user id */ uid_t pr_ruid; /* Real user id */ uid_t pr_suid; /* Saved user id (from exec) */ - gid_t pr_egid; /* Effective group id */ - gid_t pr_rgid; /* Real group id */ - gid_t pr_sgid; /* Saved group id (from exec) */ + uid_t pr_egid; /* Effective group id */ + uid_t pr_rgid; /* Real group id */ + uid_t pr_sgid; /* Saved group id (from exec) */ u_int pr_ngroups; /* Number of supplementary groups */ } prcred_t; diff --git a/usr/src/uts/3b2/sys/prsystm.h b/usr/src/uts/3b2/sys/prsystm.h index e295fe9..732de6a 100644 --- a/usr/src/uts/3b2/sys/prsystm.h +++ b/usr/src/uts/3b2/sys/prsystm.h @@ -8,7 +8,7 @@ #ifndef _SYS_PRSYSTM_H #define _SYS_PRSYSTM_H -#ident "@(#)head.sys:sys/prsystm.h 1.3" +#ident "@(#)head.sys:sys/prsystm.h 1.2" #include "sys/procfs.h" @@ -23,7 +23,7 @@ extern void prgetstatus(proc_t *, prstatus_t *); #else extern void prawake(); extern void prinvalidate(); -extern void prgetpsinfo(); +extern void prgetpsinfo(proc_t *, struct prpsinfo *); extern void prgetfpregs(); extern int prnsegs(); extern void prexit(); diff --git a/usr/src/uts/3b2/sys/ptem.h b/usr/src/uts/3b2/sys/ptem.h index 992aedb..4011904 100644 --- a/usr/src/uts/3b2/sys/ptem.h +++ b/usr/src/uts/3b2/sys/ptem.h @@ -8,7 +8,7 @@ #ifndef _SYS_PTEM_H #define _SYS_PTEM_H -#ident "@(#)head.sys:sys/ptem.h 11.6" +#ident "@(#)head.sys:sys/ptem.h 11.5" /* * The ptem data structure used to define the global data @@ -26,8 +26,7 @@ struct ptem * state flags * if state is zero then ptem entry is free to be allocated */ -#define INUSE 0x1 /* Internal ptem entry in use */ -#define OFLOW_CTL 0x2 /* Outflow control on */ +#define INUSE 0x1 /* * Constants used to distinguish between a common function invoked * from the read or write side put procedures diff --git a/usr/src/uts/3b2/sys/resource.h b/usr/src/uts/3b2/sys/resource.h index 3e96b6d..0041683 100644 --- a/usr/src/uts/3b2/sys/resource.h +++ b/usr/src/uts/3b2/sys/resource.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/resource.h 1.12" +#ident "@(#)head.sys:sys/resource.h 1.11" #ifndef _SYS_RESOURCE_H #define _SYS_RESOURCE_H @@ -30,7 +30,6 @@ #define RLIMIT_CORE 4 /* core file size */ #define RLIMIT_NOFILE 5 /* file descriptors */ #define RLIMIT_VMEM 6 /* maximum mapped memory */ -#define RLIMIT_AS RLIMIT_VMEM #define RLIM_NLIMITS 7 /* number of resource limits */ diff --git a/usr/src/uts/3b2/sys/rf_cirmgr.h b/usr/src/uts/3b2/sys/rf_cirmgr.h index 15bc984..9848aab 100644 --- a/usr/src/uts/3b2/sys/rf_cirmgr.h +++ b/usr/src/uts/3b2/sys/rf_cirmgr.h @@ -8,7 +8,7 @@ #ifndef _SYS_RF_CIRMGR_H #define _SYS_RF_CIRMGR_H -#ident "@(#)head.sys:sys/rf_cirmgr.h 1.10" +#ident "@(#)head.sys:sys/rf_cirmgr.h 1.6" #define MAXTOKLEN sizeof(rf_token_t) /* maximum token length in bytes */ @@ -45,7 +45,6 @@ struct gdp { long timeskew_sec; /* time skew in sec */ rf_token_t token; /* circuit identification */ char *idmap[2]; /* 0=uid=UID_DEV, 1=gid=GID_DEV */ - ushort timeout; struct msgb *hdr; /* message header collected so far */ struct msgb *idata; /* request/response collected so far */ size_t hlen; /* header length yet to be collected */ @@ -54,10 +53,6 @@ struct gdp { size_t maxpsz; /* max TIDU size of the provider */ int ngroups_max; /* max # suppl. groups per user */ size_t datasz; /* max data in RFS message */ -#ifdef DEBUG - ulong outseq; - ulong inseq; -#endif }; typedef struct gdp gdp_t; @@ -70,7 +65,7 @@ typedef struct gdp gdp_t; * TO DO: network-unique sysids */ #define SDTOSYSID(sdp) ((gdp_t *)(sdp)->sd_queue->q_ptr)->sysid -#define QPTOGP(qp) ((gdp_t *)((queue_t *)(qp))->q_ptr) +#define QPTOGP(qp) ((gdp_t *)(qp)->q_ptr) extern int maxgdp; extern gdp_t *gdp; @@ -99,7 +94,6 @@ extern int gdp_get_circuit(); extern void gdp_put_circuit(); extern int gdp_init(); extern void gdp_discon(); -extern void gdp_j_accuse(); extern void gdp_kill(); #endif /* _KERNEL */ diff --git a/usr/src/uts/3b2/sys/rf_comm.h b/usr/src/uts/3b2/sys/rf_comm.h index 88b9c11..c0207ba 100644 --- a/usr/src/uts/3b2/sys/rf_comm.h +++ b/usr/src/uts/3b2/sys/rf_comm.h @@ -8,7 +8,7 @@ #ifndef _SYS_RF_COMM_H #define _SYS_RF_COMM_H -#ident "@(#)head.sys:sys/rf_comm.h 1.19" +#ident "@(#)head.sys:sys/rf_comm.h 1.13" /* parameters of this implementation */ @@ -27,6 +27,10 @@ #define NULL 0 #endif +/* convert rcvd to an index */ +#define RDTOINX(x) ((x) - rcvd) +/* convert index to a rcvd ptr */ +#define INXTORD(x) (&rcvd[x]) /* is a receive queue empty? */ #define RCVDEMP(RD) LS_ISEMPTY(&(RD)->rd_rcvdq) @@ -36,7 +40,7 @@ typedef struct naddr { } naddr_t; /* - * receive descriptor structure + * receive descriptor structure */ typedef struct rcvd { @@ -50,12 +54,12 @@ typedef struct rcvd { struct rd_user *rd_user_list; /* one for each time RD is a gift * - meaningful only for general RD */ struct rcvd *rd_next; /* pointer to next rcvd */ - long rd_gen; /* generation for gifts */ int rd_qslp; /* recv desc queue sleep lock */ char rd_stat; /* flags */ char rd_qtype; /* RDGENERAL or RDSPECIFIC */ ushort rd_qcnt; /* how many msgs queued */ - int rd_refcnt; /* how many remote clients */ + ushort rd_refcnt; /* how many remote clients */ + ushort rd_connid; /* connection id */ } rcvd_t; #define rd_vp rd_un.rdun_vp @@ -104,7 +108,7 @@ extern rcvd_t *rcvd; * reference, and as a temporary channel for a transient reference. * * Each server has its own private send descriptor that it uses to - * send replies. This send descriptor on the server does not point + * send replies. This send descriptor on the server does not point * to any particular resource. * * For the client side send descriptor, the sd_mntid is a cookie @@ -118,12 +122,13 @@ typedef struct sndd { ls_elt_t sd_free; /* for free list links */ long sd_size; char sd_stat; - rf_gift_t sd_gift; /* for the remote rcvd */ + long sd_connid; /* connect id for the remote rcvd */ long sd_mntid; /* denotes remote srmount entry */ struct proc *sd_srvproc; /* points to proc of dedicated server */ struct queue *sd_queue; /* points to stream head queue */ long sd_fhandle; /* file handle for client caching */ ulong sd_vcode; /* file vcode for client caching */ + long sd_mapcnt; /* number of mappings of pages */ daddr_t sd_nextr; /* read-ahead offset */ /* * Clients talking to 3.x servers sometimes hide stuff in sd_stashp. @@ -153,7 +158,6 @@ typedef struct sndd { #define SDWANT 0x10 #define SDCACHE 0x20 /* remote file is cacheable */ #define SDMNDLCK 0x40 /* remote file mandatory lock set - * Old protocol only. * (not updated if someone turns off mandatory * lock with chmod on remote file before * last file close) @@ -191,7 +195,7 @@ typedef struct sndd { (sdp)->sd_stat &= ~SDLOCKED; \ if ((sdp)->sd_stat & SDWANT) { \ (sdp)->sd_stat &= ~SDWANT; \ - wakeprocs((caddr_t)(sdp), PRMPT); \ + wakeup((caddr_t)(sdp)); \ } \ } @@ -214,15 +218,15 @@ typedef struct rd_user { long ru_srmntid; /* which srmount entry */ struct rd_user *ru_next; /* next user */ struct queue *ru_queue; /* which stream queue */ - int ru_vcount; /* references to denoted vnode */ - ushort ru_frwcnt; /* n r/w opens */ - ushort ru_frcnt; /* n read opens */ - ushort ru_fwcnt; /* n write opens */ + ushort ru_fcount; /* n opens and creates */ + ushort ru_vcount; /* references to denoted vnode */ + ushort ru_frcnt; /* n opens/creates for reading pipes */ + ushort ru_fwcnt; /* n opens/creates for writing pipes */ ushort ru_cflag; /* cache flag */ - int ru_mapdstat; /* for locking */ - ls_elt_t ru_mapdlist; /* heads list of mapping descriptors */ } rd_user_t; +extern rd_user_t *rd_user; + /* cache flags */ #define RU_CACHE_ON 0x1 /* remote cacheing is enabled */ #define RU_CACHE_DISABLE 0x2 /* remote cacheing is disabled @@ -233,27 +237,6 @@ typedef struct rd_user { * vcode and fhandle with gifts. */ -/* - * Each rd_user_t has a list of rf_mapd_t's describing a client machine's - * mappings to a file. rfm_reads, rfm_writes, and rfm_execs are counts - * of the number of times that the PROT_READ, PROT_WRITE, and PROT_EXEC bits - * respectively are included in the maxprot of mappings to an - * offset/length pair. - */ -typedef struct rf_mapd { - ls_elt_t rfm_list; /* heads list of mapping descriptors */ - off_t rfm_off; /* file offset of mapping */ - size_t rfm_len; /* length of mapping */ - int rfm_reads; - int rfm_writes; - int rfm_execs; -} rf_mapd_t; - -#define MAPDLOCK 0x1 -#define MAPDWANT 0x2 - -extern rd_user_t *rd_user; - /* tunables */ extern int nrcvd; /* number of receive descriptors */ extern int nsndd; /* number of send descriptors */ @@ -265,21 +248,19 @@ extern int minserve; extern void rf_freeb(); extern void rf_freemsg(); - extern mblk_t *rf_dequeue(); extern int sndd_create(); extern void sndd_free(); #if defined(DEBUG) -#define sndd_set(sd, queue, giftp) \ - ((void)(ASSERT((sd)->sd_stat & SDUSED), \ - (sd)->sd_queue = (queue_t *)(queue), (sd)->sd_gift = (giftp)[0])) +#define sndd_set(sd, queue, connid) \ + ((void)(ASSERT((sd)->sd_stat & SDUSED), \ + (sd)->sd_queue = (queue), (sd)->sd_connid = (connid))) #else -#define sndd_set(sd, queue, giftp) \ - ((void)((sd)->sd_queue = (queue_t *)(queue), \ - (sd)->sd_gift = (giftp)[0])) -#endif /* DEBUG */ +#define sndd_set(sd, queue, connid) \ + ((void)((sd)->sd_queue = (queue), (sd)->sd_connid = (connid))) +#endif /* ASSERT */ extern int rf_sndmsg(); extern rf_rcvmsg(); @@ -303,14 +284,6 @@ extern int rdu_match(); (QPTOGP((rdup)->ru_queue)->sysid == (sid) && (rdup)->ru_srmntid == (mntid)) #endif -extern int rfesb_fbread(); -extern int rfesb_pageio_setup(); - -#define NULLFRP ((frtn_t *)NULL) -#define NULLCADDR ((caddr_t)NULL) -#define NULLUIO ((uio_t *)NULL) -#define NULLCRED ((cred_t *)NULL) - /* * Signal conversion ops. * rf_response_t *rp; @@ -343,21 +316,16 @@ extern rd_user_t *rdu_get(); extern rd_user_t *rdu_find(); extern void rdu_del(); extern void rdu_open(); +extern void rdu_close(); extern void rftov_attr(); extern void vtorf_attr(); extern int rf_pullupmsg(); +extern int uiomvuio(); /* Move this to sys/uio.h */ extern void rf_iov_alloc(); extern mblk_t *rf_dropbytes(); extern caddr_t rf_msgdata(); -extern rcvd_t *rf_gifttord(); -extern vnode_t *rf_gifttovp(); - -/* Gift templates. */ -extern rf_gift_t rf_daemon_gift; -extern rf_gift_t rf_null_gift; - #define RF_IOV_FREE(iovp, niov) \ kmem_free((caddr_t)(iovp), (size_t)((niov) * sizeof(iovec_t))) @@ -373,13 +341,5 @@ extern rf_gift_t rf_null_gift; rf_pullupmsg((bp), (hdrsz), (datasz))) #endif -#if defined(u3b2) && !defined(lint) && !defined(CXREF) -asm int -ipl() -{ - ANDW3 &0x1e000,%psw,%r0 -} -#endif - #endif /* _KERNEL */ #endif /* _SYS_RF_COMM_H */ diff --git a/usr/src/uts/3b2/sys/rf_messg.h b/usr/src/uts/3b2/sys/rf_messg.h index 9dda96c..0df9eeb 100644 --- a/usr/src/uts/3b2/sys/rf_messg.h +++ b/usr/src/uts/3b2/sys/rf_messg.h @@ -8,7 +8,7 @@ #ifndef _SYS_RF_MESSG_H #define _SYS_RF_MESSG_H -#ident "@(#)head.sys:sys/rf_messg.h 1.24" +#ident "@(#)head.sys:sys/rf_messg.h 1.17" /* * RFS network message definitions @@ -24,20 +24,6 @@ */ #define RF_MAXGROUPS 32 -/* - * A gift denotes a reference to a remote receive descriptor. If the - * gift denotes a GENERAL receive descriptor, the receive descriptor - * is on a server, is persistent, and in turn denotes a file - * on the server. Otherwise the receive descriptor is SPECIFIC, - * transient, and is merely one end of a communications channel. - * gift_gen tags instances of the denoted receive descriptor, is - * undefined for old clients/servers. - */ -typedef struct rf_gift { - long gift_id; - long gift_gen; -} rf_gift_t; - #ifdef _KERNEL #define DU_DATASIZE 1024 /* max data bytes in old protocol message */ @@ -75,12 +61,14 @@ typedef struct rf_sigset { * The message structure is the header to every message. */ typedef struct rf_message { - long filler0; /* used as sequence w/ DEBUG */ - long m_stat; /* see stat values below */ - rf_gift_t m_dest; /* rcvd to which this goes */ - rf_gift_t m_gift; /* rcvd of reference we are giving */ - long m_size; /* size of this message */ - long m_queue; /* streams queue message came in on */ + long filler0; /* not used */ + long m_stat; /* see stat values below */ + long m_dest; /* rcvd index to which this goes */ + long filler1; /* not used */ + long m_giftid; + long filler2; /* not used */ + long m_size; /* size of this message */ + long m_queue; /* streams queue message came in on */ } rf_message_t; /* @@ -97,11 +85,17 @@ typedef struct rf_message { /* * Well-known receive queue indices. - * SIGRDX used to be 1, but that symbol was unused. DAEMON_RD + * SIGRDX used to be 1, but that symbol was unused. RECOVER_RD * remains 2 for compatibility. */ #define MOUNT_RD 0L /* Mount request receive descriptor */ -#define DAEMON_RD 2L /* Recovery receive descriptor */ +#define RECOVER_RD 2L /* Recovery receive descriptor */ + +/* tags for variant message types + */ +#define RF_REQ_MSG 1 /* request message type */ +#define RF_RESP_MSG 2 /* response message type */ +#define RF_NACK_MSG 3 /* RFS flow control nack message type */ /* * In the original remote system call protocol, opcodes for remote service @@ -118,8 +112,8 @@ typedef struct rf_message { * is of no concern, and opcodes can be chosen arbitrarily. */ #define RFSETFL 0 -#define RFDELMAP 1 -#define RFADDMAP 2 +#define RFUNMAP 1 +#define RFMAP 2 #define RFREAD 3 #define RFWRITE 4 #define RFOPEN 5 @@ -144,10 +138,8 @@ typedef struct rf_message { #define DUUMOUNT 22 /* retained for compatability; * umount(2), not old rumount(2) * must '..' back to client */ -#define RFSETATTR 23 /* VOP_SETATTR */ -#define RFACCESS 24 /* VOP_ACCESS */ -#define RFPATHCONF 25 /* VOP_PATHCONF */ -#define RFTMO 26 /* virtual circuit timeout */ +#define RFSETATTR 23 /* for VOP_SETATTR */ +#define RFACCESS 24 /* pure VOP_ACCESS */ #define DUFSTAT 28 #define DUUTIME 30 @@ -178,8 +170,8 @@ typedef struct rf_message { * 3.X turned this into another op */ #define RFUMOUNT 98 /* differs from sys call for compatability; * 3.X turned this into another op */ -#define DUSTATVFS 103 /* name-based */ -#define RFSTATVFS 104 /* vnode-based */ +#define RFSTATVFS 103 /* vnode-based */ +#define DUSTATVFS 104 /* name-based */ #define RFCOPYIN 106 #define RFCOPYOUT 107 #define RFLINK 109 @@ -228,23 +220,11 @@ typedef struct rf_common { long co_uid; /* client uid */ long co_gid; /* client gid */ long co_ftype; - union { - long nlink; /* RFS1DOT0 only */ - long svr4pad; - } co_un; + long co_nlink; long co_size; long co_mntid; } rf_common_t; -#define co_nlink co_un.nlink - -/* - * co_type values are tags for variant message types - */ -#define RF_REQ_MSG 1 /* request message */ -#define RF_RESP_MSG 2 /* response message */ -#define RF_NACK_MSG 3 /* RFS flow control nack message */ - #define RF_COM(bp) ((rf_common_t *)(RF_MSG(bp) + 1)) #define RF_MCSZ (sizeof(rf_message_t) + sizeof(rf_common_t)) @@ -274,23 +254,6 @@ struct rqrele { long vcount; /* unused in SVR3 */ }; -/* unused in SVR3 */ -struct rqpathconf { - long cmd; -}; - -/* - * Used by RFADDMAP, and RFDELMAP. The server is able to record - * current mapping because addmaps and delmaps also go remote. Only maxprot - * is sent in all cases because prot may be manipulated above the file - * system interface. - */ -struct rqmap { - long offset; - ulong len; - ulong maxprot; -}; - struct rqclose { long vcount; /* used only when lastclose */ long count; @@ -391,15 +354,10 @@ struct rqslink { long targetln; }; -struct rqlink { - rf_gift_t from; /* gen meaningful only SVR4 and later */ +struct rqrflink { + long link; }; -/* - * Client pathname should be in "normal" form before it is sent with - * a RFLOOKUP request. Otherwise, path displacement with ".." or - * ENOENT will be unexpected. - */ struct rqlookup { long flags; }; @@ -410,8 +368,8 @@ struct rqlookup { * call will fail gracefully. */ struct rqrename { - rf_gift_t from; - rf_gift_t to; + long frdid; + long trdid; }; struct rqcoredump { @@ -433,16 +391,14 @@ struct rqcachedis { struct rqgetattr { long mask; - long flags; }; struct rqsetattr { long flags; }; -/* SVR4 and later */ struct rqrmdir { - rf_gift_t dir; + long connid; }; /* RECOVERY OPCODES @@ -463,8 +419,6 @@ union rq_arg { struct rqmode_op rqmode_op; struct rqchown rqchown; struct rqrele rqrele; - struct rqpathconf rqpathconf; - struct rqmap rqmap; struct rqclose rqclose; struct rqcreate rqcreate; struct rqopen rqopen; @@ -481,7 +435,7 @@ union rq_arg { struct rqustat rqustat; struct rqxfer rqxfer; struct rqsrmount rqsrmount; - struct rqlink rqlink; + struct rqrflink rqrflink; struct rqlookup rqlookup; struct rqrename rqrename; struct rqsynctime rqsynctime; @@ -501,8 +455,7 @@ union rq_arg { struct rqv2 { long rqv2_ngroups; long rqv2_groups[RF_MAXGROUPS]; - long rqv2_rrdir_gen; - long pad[2]; /* with RF_MAXGROUPS at 32, takes the + long pad[3]; /* with RF_MAXGROUPS at 32, takes the * message + request less data to 256 bytes */ }; @@ -536,7 +489,7 @@ struct rqsymlink { #define ULIMIT (u.u_rlimit[RLIMIT_FSIZE].rlim_cur) typedef struct rf_request { - long rq_rrdir_id; + long rq_rrdir; daddr_t rq_ulimit; union rq_arg rq_arg; long rq_flags; @@ -548,8 +501,6 @@ typedef struct rf_request { #define rq_mode_op rq_arg.rqmode_op #define rq_chown rq_arg.rqchown #define rq_rele rq_arg.rqrele -#define rq_pathconf rq_arg.rqpathconf -#define rq_map rq_arg.rqmap #define rq_close rq_arg.rqclose #define rq_create rq_arg.rqcreate #define rq_open rq_arg.rqopen @@ -566,7 +517,7 @@ typedef struct rf_request { #define rq_ustat rq_arg.rqustat #define rq_xfer rq_arg.rqxfer #define rq_srmount rq_arg.rqsrmount -#define rq_link rq_arg.rqlink +#define rq_rflink rq_arg.rqrflink #define rq_lookup rq_arg.rqlookup #define rq_rename rq_arg.rqrename #define rq_synctime rq_arg.rqsynctime @@ -578,7 +529,6 @@ typedef struct rf_request { #define rq_rmdir rq_arg.rqrmdir #define rq_ngroups rqv2.rqv2_ngroups #define rq_groups rqv2.rqv2_groups -#define rq_rrdir_gen rqv2.rqv2_rrdir_gen #define RF_REQ(bp) ((rf_request_t *)(RF_COM(bp) + 1)) @@ -591,9 +541,8 @@ typedef struct rf_request { #define RF_MIN_REQ(version) (((version) == 1) ? RFV1_MINREQ : RFV2_MINREQ) /* request flags (rq_flags) */ -#define RQ_MNDLCK 0x1 /* used only by old protocol, suppresses - * inode locking on remote op and caching - * of mand lock-enabled files */ +#define RQ_MNDLCK 0x1 + /* Arg structures for RFS response opcodes. * @@ -627,18 +576,18 @@ struct rp_all { /* * For old protocol ops that return new file references. */ -struct rpv1giftinfo { +struct rpv1gift { long svr3pad0; long mode; }; /* pathlen set by lookup, not by flakey /proc ioctl that opens a file */ -struct rpv2giftinfo { +struct rpv2gift { long pathlen; long flags; }; -#define RPG_NOMAP 0x01 -#define RPG_NOSWAP 0x02 + +#define RPG_NOMAP 1 /* RFREAD(I), RFWRITE(I) - used only by SVR4 server talking to old client */ struct rprdwr { @@ -678,8 +627,8 @@ struct rpv2 { }; union rp_arg { - struct rpv1giftinfo rpv1giftinfo; - struct rpv2giftinfo rpv2giftinfo; + struct rpv1gift rpv1gift; + struct rpv2gift rpv2gift; struct rprdwr rprdwr; struct rpxfer rpxfer; struct rpcopyout rpcopyout; @@ -697,17 +646,15 @@ typedef struct rf_response { struct rpv2 rpv2; } rf_response_t; -#define RP_MNDLCK 0x8000 /* used only by old protocol, suppresses - * inode locking on remote op and caching - * of mand lock-enabled files */ +#define RP_MNDLCK 0x8000 /* mandatory lock set */ #define RP_CACHE_ON 0x1 /* This file's data may be cached. When * this is set, rpv2_vcode is also set. */ #define DU_CACHE_ENABLE 0x2 /* remote cacheing is enabled by 3.X server */ -#define rp_v1giftinfo rp_arg.rpv1giftinfo -#define rp_v2giftinfo rp_arg.rpv2giftinfo +#define rp_v1gift rp_arg.rpv1gift +#define rp_v2gift rp_arg.rpv2gift #define rp_rdwr rp_arg.rprdwr #define rp_xfer rp_arg.rpxfer #define rp_copyout rp_arg.rpcopyout diff --git a/usr/src/uts/3b2/sys/session.h b/usr/src/uts/3b2/sys/session.h index fe0e494..041c7ee 100644 --- a/usr/src/uts/3b2/sys/session.h +++ b/usr/src/uts/3b2/sys/session.h @@ -6,27 +6,23 @@ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/session.h 1.17" +#ident "@(#)head.sys:sys/session.h 1.12" #ifndef _SYS_SESSION_H #define _SYS_SESSION_H typedef struct sess { - - short s_ref; /* reference count */ - short s_mode; /* /sess current permissions */ - uid_t s_uid; /* /sess current user ID */ - gid_t s_gid; /* /sess current group ID */ - ulong s_ctime; /* /sess change time */ - dev_t s_dev; /* tty's device number */ + short s_procs; /* reference count */ + short s_mode; /* session permissions */ + pid_t s_sid; /* session ID */ + uid_t s_uid; /* user ID */ + gid_t s_gid; /* group ID */ + dev_t s_dev; /* session device number */ + pid_t *s_sidp; /* tty's copy of session ID */ + pid_t *s_fgidp; /* foreground process group ID */ struct vnode *s_vp; /* tty's vnode */ - struct pid *s_sidp; /* session ID info */ - struct cred *s_cred; /* allocation credentials */ - } sess_t; -#define s_sid s_sidp->pid_id - extern sess_t session0; /* @@ -41,28 +37,30 @@ enum jcaccess { JCGETP /* get ctty parameters */ }; -#define SESS_HOLD(sp) (++(sp)->s_ref) -#define SESS_RELE(sp) (--(sp)->s_ref > 0 ? 0 : sess_rele(sp)) #if defined(__STDC__) -extern int sess_rele(sess_t *); -extern void sess_create(void); -extern void freectty(sess_t *); -extern void alloctty(proc_t *, vnode_t *); -extern int realloctty(proc_t *, pid_t); -extern dev_t cttydev(proc_t *); -extern int hascttyperm(sess_t *, cred_t *, mode_t); +dev_t cttydev(proc_t *); +void freectty(sess_t *); +void forksession(proc_t *, sess_t *); +void exitsession(proc_t *); +void newsession(); +void closctty(); +void alloctty(proc_t *, vnode_t *, pid_t *, pid_t *); +void realloctty(vnode_t *); +int accsctty(vnode_t *, enum jcaccess, int); #else -extern int sess_rele(); -extern void sess_create(); -extern void freectty(); -extern void alloctty(); -extern int realloctty(); -extern dev_t cttydev(); -extern int hascttyperm(); +dev_t cttydev(); +void freectty(); +void forksession(); +void exitsession(); +void newsession(); +void closctty(); +void alloctty(); +void realloctty(); +int accsctty(); #endif diff --git a/usr/src/uts/3b2/sys/shm.h b/usr/src/uts/3b2/sys/shm.h index 9d6d82d..a58ccde 100644 --- a/usr/src/uts/3b2/sys/shm.h +++ b/usr/src/uts/3b2/sys/shm.h @@ -5,33 +5,10 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ - #ifndef _SYS_SHM_H #define _SYS_SHM_H -#ident "@(#)head.sys:sys/shm.h 11.19" +#ident "@(#)head.sys:sys/shm.h 11.15" /* ** IPC Shared Memory Facility. @@ -73,7 +50,7 @@ (sp)->shm_perm.mode &= ~SHM_LOCKED; \ if ((sp)->shm_perm.mode & SHM_LOCKWAIT) { \ (sp)->shm_perm.mode &= ~SHM_LOCKWAIT; \ - wakeprocs((caddr_t)(sp), PRMPT); \ + wakeup((caddr_t)(sp)); \ } \ } @@ -170,8 +147,10 @@ struct shminfo { int shmmax, /* max shared memory segment size */ shmmin, /* min shared memory segment size */ shmmni, /* # of shared memory identifiers */ - shmseg; /* max attached shared memory */ + shmseg, /* max attached shared memory */ /* segments per process */ + shmall; /* max total shared memory system */ + /* wide (in clicks) */ }; diff --git a/usr/src/uts/3b2/sys/sigaction.h b/usr/src/uts/3b2/sys/sigaction.h new file mode 100644 index 0000000..b1d90a0 --- /dev/null +++ b/usr/src/uts/3b2/sys/sigaction.h @@ -0,0 +1,32 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/sigaction.h 1.5" + +#ifndef _SYS_SIGACTION_H +#define _SYS_SIGACTION_H + +struct sigaction { + int sa_flags; + void (*sa_handler)(); + sigset_t sa_mask; + int sa_resv[2]; +}; + +/* definitions for the sa_flags field */ + +#define SA_ONSTACK 0x00000001 +#define SA_RESETHAND 0x00000002 +#define SA_RESTART 0x00000004 +#define SA_SIGINFO 0x00000008 +#define SA_NODEFER 0x00000010 + +/* these are only valid for SIGCLD */ +#define SA_NOCLDWAIT 0x00010000 /* don't save zombie children */ +#define SA_NOCLDSTOP 0x00020000 /* don't send job control SIGCLD's */ + +#endif /* _SYS_SIGACTION_H */ diff --git a/usr/src/uts/3b2/sys/signal.h b/usr/src/uts/3b2/sys/signal.h index a0a84db..7c89f5e 100644 --- a/usr/src/uts/3b2/sys/signal.h +++ b/usr/src/uts/3b2/sys/signal.h @@ -8,7 +8,7 @@ #ifndef _SYS_SIGNAL_H #define _SYS_SIGNAL_H -#ident "@(#)head.sys:sys/signal.h 11.42" +#ident "@(#)head.sys:sys/signal.h 11.39" #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt (rubout) */ @@ -45,7 +45,19 @@ #define SIGXCPU 30 /* exceeded cpu limit */ #define SIGXFSZ 31 /* exceeded file size limit */ -#define SIG_DFL (void(*)())0 +#if (__STDC__ != 1) +#define NSIG 32 /* valid signals range from 1 to NSIG-1 */ +#define MAXSIG 32 /* size of u_signal[], NSIG-1 <= MAXSIG */ +#endif + +#define S_SIGNAL 1 +#define S_SIGSET 2 +#define S_SIGACTION 3 +#define S_NONE 4 + +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 #if defined(lint) #define SIG_ERR (void(*)())0 @@ -56,21 +68,10 @@ #define SIG_IGN (void (*)())1 #define SIG_HOLD (void(*)())2 #endif +#define SIG_DFL (void(*)())0 -#define SIG_BLOCK 1 -#define SIG_UNBLOCK 2 -#define SIG_SETMASK 3 - -#define SIGNO_MASK 0xFF -#define SIGDEFER 0x100 -#define SIGHOLD 0x200 -#define SIGRELSE 0x400 -#define SIGIGNORE 0x800 -#define SIGPAUSE 0x1000 - -#if __STDC__ - 0 == 0 typedef struct { /* signal set type */ - unsigned long sigbits[4]; + unsigned long word[4]; } sigset_t; struct sigaction { @@ -80,14 +81,8 @@ struct sigaction { int sa_resv[2]; }; -/* these are only valid for SIGCLD */ -#define SA_NOCLDSTOP 0x00020000 /* don't send job control SIGCLD's */ -#endif - -#if (__STDC__ - 0 == 0) && !defined(_XOPEN_SOURCE) && !defined(_POSIX_SOURCE) - /* non-comformant ANSI compilation */ - /* definitions for the sa_flags field */ + #define SA_ONSTACK 0x00000001 #define SA_RESETHAND 0x00000002 #define SA_RESTART 0x00000004 @@ -96,36 +91,34 @@ struct sigaction { /* these are only valid for SIGCLD */ #define SA_NOCLDWAIT 0x00010000 /* don't save zombie children */ - -#define NSIG 32 /* valid signals range from 1 to NSIG-1 */ -#define MAXSIG 32 /* size of u_signal[], NSIG-1 <= MAXSIG */ - -#define S_SIGNAL 1 -#define S_SIGSET 2 -#define S_SIGACTION 3 -#define S_NONE 4 - -#define MINSIGSTKSZ 512 -#define SIGSTKSZ 8192 - -#define SS_ONSTACK 0x00000001 -#define SS_DISABLE 0x00000002 +#define SA_NOCLDSTOP 0x00020000 /* don't send job control SIGCLD's */ struct sigaltstack { - char *ss_sp; - int ss_size; + int *ss_sp; + int ss_size; /* number of words of type (int *) */ int ss_flags; }; typedef struct sigaltstack stack_t; -#endif +#define MINSIGSTKSZ (512/sizeof(int *)) +#define SIGSTKSZ (8192/sizeof(int *)) + +#define SS_ONSTACK 0x00000001 /* this is current execution stack */ +#define SS_DISABLE 0x00000002 /* this stack cannot be used */ + +#define SIGNO_MASK 0xFF +#define SIGDEFER 0x100 +#define SIGHOLD 0x200 +#define SIGRELSE 0x400 +#define SIGIGNORE 0x800 +#define SIGPAUSE 0x1000 #ifdef _KERNEL extern k_sigset_t - - fillset, /* valid signals, guaranteed contiguous */ + fillset, /* set of valid signals, + * guaranteed contiguous */ holdvfork, /* held while doing vfork */ cantmask, /* cannot be caught or ignored */ cantreset, /* cannot be reset after catching */ @@ -133,6 +126,7 @@ extern k_sigset_t stopdefault, /* stop by default */ coredefault; /* dumps core by default */ + #define sigmask(n) ((unsigned long)1 << ((n) - 1)) #define sigemptyset(s) (*(s) = 0) @@ -144,11 +138,12 @@ extern k_sigset_t #define sigorset(s1,s2) (*(s1) |= *(s2)) #define sigandset(s1,s2) (*(s1) &= *(s2)) #define sigdiffset(s1,s2) (*(s1) &= ~(*(s2))) -#define sigutok(us,ks) (*(ks) = (us)->sigbits[0]) -#define sigktou(ks,us) ((us)->sigbits[0] = *(ks), \ - (us)->sigbits[1] = 0, \ - (us)->sigbits[2] = 0, \ - (us)->sigbits[3] = 0) +#define sigintset(s1,s2) (*(s1) & *(s2)) +#define sigutok(us,ks) (*(ks) = (us)->word[0]) +#define sigktou(ks,us) ((us)->word[0] = *(ks), \ + (us)->word[1] = 0, \ + (us)->word[2] = 0, \ + (us)->word[3] = 0) typedef struct { int sig; diff --git a/usr/src/uts/3b2/sys/socket.h b/usr/src/uts/3b2/sys/socket.h index ec80dba..fa3bf49 100644 --- a/usr/src/uts/3b2/sys/socket.h +++ b/usr/src/uts/3b2/sys/socket.h @@ -8,7 +8,7 @@ #ifndef _SYS_SOCKET_H #define _SYS_SOCKET_H -#ident "@(#)head.sys:sys/socket.h 1.10" +#ident "@(#)head.sys:sys/socket.h 1.8" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -27,7 +27,7 @@ * Notice of copyright on this source code product does not indicate * publication. * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. * @@ -54,8 +54,8 @@ #define SOCK_STREAM NC_TPI_COTS /* stream socket */ #define SOCK_DGRAM NC_TPI_CLTS /* datagram socket */ #define SOCK_RAW NC_TPI_RAW /* raw-protocol interface */ -#define SOCK_RDM 5 /* reliably-delivered message */ -#define SOCK_SEQPACKET 6 /* sequenced packet stream */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ /* * Option flags per-socket. diff --git a/usr/src/uts/3b2/sys/sockio.h b/usr/src/uts/3b2/sys/sockio.h index 71da253..57598bb 100644 --- a/usr/src/uts/3b2/sys/sockio.h +++ b/usr/src/uts/3b2/sys/sockio.h @@ -8,7 +8,7 @@ #ifndef _SYS_SOCKIO_H #define _SYS_SOCKIO_H -#ident "@(#)head.sys:sys/sockio.h 1.8" +#ident "@(#)head.sys:sys/sockio.h 1.6" /* * PROPRIETARY NOTICE (Combined) diff --git a/usr/src/uts/3b2/sys/sockmod.h b/usr/src/uts/3b2/sys/sockmod.h index a92544e..e01279c 100644 --- a/usr/src/uts/3b2/sys/sockmod.h +++ b/usr/src/uts/3b2/sys/sockmod.h @@ -8,7 +8,7 @@ #ifndef _SYS_SOCKMOD_H #define _SYS_SOCKMOD_H -#ident "@(#)head.sys:sys/sockmod.h 1.10" +#ident "@(#)head.sys:sys/sockmod.h 1.7" /* * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -27,15 +27,15 @@ * Notice of copyright on this source code product does not indicate * publication. * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. * */ - #include /* for sockaddr_un */ + /* internal flags - in addition to the ones in timod.h */ #define S_WINFO 0x01000 /* waiting for T_info to complete */ #define S_WRDISABLE 0x02000 /* write service queue disabled */ @@ -65,7 +65,6 @@ struct si_udata { int tidusize; /* TIDU size */ int addrsize; /* address size */ int optsize; /* options size */ - int etsdusize; /* expedited size */ int servtype; /* service type */ int so_state; /* socket states */ int so_options; /* socket options */ @@ -104,7 +103,6 @@ struct bind_ux { struct ux_extaddr ux_extaddr; }; -#ifndef _KERNEL extern struct _si_user *_s_checkfd(); extern struct _si_user *_s_open(); extern void _s_aligned_copy(); @@ -121,14 +119,4 @@ extern int _s_getfamily(); extern int _s_uxpathlen(); extern void (*sigset())(); -/* Socket library debugging - */ -extern int _s_sockdebug; -#define SOCKDEBUG(S, A, B) \ - if ((((S) && (S)->udata.so_options & SO_DEBUG)) || \ - _s_sockdebug) { \ - (void)syslog(LOG_ERR, (A), (B)); \ - } -#endif /* !_KERNEL */ - #endif /* _SYS_SOCKMOD_H */ diff --git a/usr/src/uts/3b2/sys/stat.h b/usr/src/uts/3b2/sys/stat.h index cd59a5b..5ca6e41 100644 --- a/usr/src/uts/3b2/sys/stat.h +++ b/usr/src/uts/3b2/sys/stat.h @@ -8,7 +8,7 @@ #ifndef _SYS_STAT_H #define _SYS_STAT_H -#ident "@(#)head.sys:sys/stat.h 11.24" +#ident "@(#)head.sys:sys/stat.h 11.22" #include "sys/time.h" @@ -116,7 +116,6 @@ struct stat { #define S_IFBLK 0x6000 /* block special */ #define S_IFREG 0x8000 /* regular */ #define S_IFLNK 0xA000 /* symbolic link */ -#define S_IFSOCK 0140000/* socket */ #define S_ISUID 04000 /* set user id on execution */ #define S_ISGID 02000 /* set group id on execution */ #define S_ISVTX 01000 /* save swapped text even after use */ @@ -139,11 +138,11 @@ struct stat { /* the following macros are for POSIX conformance */ -#define S_ISFIFO(mode) ((mode&S_IFMT) == S_IFIFO) -#define S_ISCHR(mode) ((mode&S_IFMT) == S_IFCHR) -#define S_ISDIR(mode) ((mode&S_IFMT) == S_IFDIR) -#define S_ISBLK(mode) ((mode&S_IFMT) == S_IFBLK) -#define S_ISREG(mode) ((mode&S_IFMT) == S_IFREG) +#define S_ISFIFO(mode) (mode & S_IFIFO) +#define S_ISCHR(mode) (mode & S_IFCHR) +#define S_ISDIR(mode) (mode & S_IFDIR) +#define S_ISBLK(mode) (mode & S_IFBLK) +#define S_ISREG(mode) (mode & S_IFREG) /* a version number is part of the new stat function interface */ diff --git a/usr/src/uts/3b2/sys/stream.h b/usr/src/uts/3b2/sys/stream.h index ce610a4..98b0cda 100644 --- a/usr/src/uts/3b2/sys/stream.h +++ b/usr/src/uts/3b2/sys/stream.h @@ -8,7 +8,7 @@ #ifndef _SYS_STREAM_H #define _SYS_STREAM_H -#ident "@(#)head.sys:sys/stream.h 11.42" +#ident "@(#)head.sys:sys/stream.h 11.38" /* * For source compatibility @@ -260,8 +260,8 @@ struct datab { unsigned char db_type; unsigned char db_iswhat; /* status of the mesg/data/buffer triplet */ unsigned int db_size; + long db_filler[3]; /* reserved for future use */ caddr_t db_msgaddr; /* triplet mesg header that points to datab */ - long db_filler; /* reserved for future use */ }; #endif /* _STYPES */ @@ -308,6 +308,15 @@ typedef struct msgb mblk_t; typedef struct datab dblk_t; typedef struct free_rtn frtn_t; +/* convenient power of 2 */ +#define FASTBUF (128 - sizeof(struct msgb) - sizeof(struct datab)) + +struct mdbblock { + struct msgb msgblk; + struct datab datblk; + char databuf[FASTBUF]; +}; + /* * Message flags. These are interpreted by the stream head. @@ -534,7 +543,6 @@ struct stroptions { #define SO_DELIM 0x8000 /* messages are delimited */ #ifndef _STYPES #define SO_NODELIM 0x010000 /* turn off delimiters */ -#define SO_STRHOLD 0x020000 /* enable strwrite message coalescing */ #endif /* _STYPES */ /* diff --git a/usr/src/uts/3b2/sys/strsubr.h b/usr/src/uts/3b2/sys/strsubr.h index 3dba501..0e85918 100644 --- a/usr/src/uts/3b2/sys/strsubr.h +++ b/usr/src/uts/3b2/sys/strsubr.h @@ -8,7 +8,7 @@ #ifndef _SYS_STRSUBR_H #define _SYS_STRSUBR_H -#ident "@(#)head.sys:sys/strsubr.h 1.15" +#ident "@(#)head.sys:sys/strsubr.h 1.12" /* * WARNING: @@ -31,8 +31,8 @@ typedef struct stdata { long sd_flag; /* state/flags */ long sd_iocid; /* ioctl id */ ushort sd_iocwait; /* count of procs waiting to do ioctl */ - struct pid *sd_sidp; /* controlling session info */ - struct pid *sd_pgidp; /* controlling process group info */ + pid_t sd_sid; /* controlling session ID */ + pid_t sd_pgrp; /* foreground process group ID */ ushort sd_wroff; /* write offset */ int sd_rerror; /* read error to set u.u_error */ int sd_werror; /* write error to set u.u_error */ @@ -45,6 +45,7 @@ typedef struct stdata { struct msgb *sd_mark; /* "marked" message on read queue */ int sd_closetime; /* time to wait to drain q in close */ clock_t sd_rtime; /* time to release held message */ + struct proc *sd_procp; /* for sending signals */ } stdata_t; /* @@ -75,10 +76,9 @@ typedef struct stdata { #define RDPROTDIS 0x00200000 /* discard M_[PC]PROTO blocks and */ /* retain data blocks */ #define STRMOUNT 0x00400000 /* stream is mounted */ -#define STRPID 0x00800000 /* controlling process not group */ +#define STRCTTY 0x00800000 /* stream is a controlling terminal */ #define STRDELIM 0x01000000 /* generate delimited messages */ #define STWRERR 0x02000000 /* fatal write error from M_ERROR */ -#define STRHOLD 0x04000000 /* enable strwrite message coalescing */ /* @@ -206,69 +206,6 @@ struct shinfo { struct shinfo *sh_prev; /* previous in list */ }; -/* - * data block info - */ -#ifdef DEBUG -struct dbinfo { - dblk_t d_dblock; /* the data block itself */ - struct dbinfo *d_next; /* next data block */ - struct dbinfo *d_prev; /* previous */ -}; - -/* - * message block info - */ -struct mbinfo { - mblk_t m_mblock; /* the message block itself */ - struct mbinfo *m_next; /* next message block */ - struct mbinfo *m_prev; /* previous message block */ - void (*m_func)(); /* address of allocation function */ -}; -#else -/* - * data block info - */ -struct dbinfo { - dblk_t d_dblock; -}; -/* - * message block info - */ -struct mbinfo { - mblk_t m_mblock; - void (*m_func)(); -}; -#endif - - - -/* convenient power of 2 */ -#define FASTBUF (128 - sizeof(struct mbinfo) - sizeof(struct dbinfo)) - -/* - * triplet - */ -struct mdbblock { - struct mbinfo msgblk; - struct dbinfo datblk; - char databuf[FASTBUF]; -}; - - -#ifdef DEBUG -#define _INSERT_MSG_INUSE(x) insert_msg_inuse(x) -#define _INSERT_MDB_INUSE(y) insert_mdb_inuse(y) -#define _DELETE_MSG_INUSE(x) delete_msg_inuse(x) -#define _DELETE_MDB_INUSE(y) delete_mdb_inuse(y) -#else -#define _INSERT_MSG_INUSE(x) -#define _INSERT_MDB_INUSE(y) -#define _DELETE_MSG_INUSE(x) -#define _DELETE_MDB_INUSE(y) -#endif - - /* * Stream event info */ diff --git a/usr/src/uts/3b2/sys/swap.h b/usr/src/uts/3b2/sys/swap.h index c5a62e7..6256434 100644 --- a/usr/src/uts/3b2/sys/swap.h +++ b/usr/src/uts/3b2/sys/swap.h @@ -8,37 +8,16 @@ #ifndef _SYS_SWAP_H #define _SYS_SWAP_H -#ident "@(#)head.sys:sys/swap.h 11.16" +#ident "@(#)head.sys:sys/swap.h 11.14" -/* - * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * PROPRIETARY NOTICE (Combined) - * - * This source code is unpublished proprietary information - * constituting, or derived under license from AT&T's UNIX(r) System V. - * In addition, portions of such source code were derived from Berkeley - * 4.3 BSD under license from the Regents of the University of - * California. - * - * - * - * Copyright Notice - * - * Notice of copyright on this source code product does not indicate - * publication. - * - * (c) 1986,1987,1988,1989 Sun Microsystems, Inc - * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. - * All rights reserved. - * - */ +#include "sys/stat.h" -/* The following are for the swapctl system call */ +/* The following are for the new swapctl system call */ #define SC_ADD 1 /* add a specified resource for swapping */ #define SC_LIST 2 /* list all the swapping resources */ #define SC_REMOVE 3 /* remove the specified swapping resource */ -#define SC_GETNSWP 4 /* get number of swapping resources configued */ +#define SC_GETNSWP 4 /* get the number of swapping resources configued */ typedef struct swapres { char *sr_name; /* pathname of the resource specified */ @@ -47,7 +26,7 @@ typedef struct swapres { } swapres_t; typedef struct swapent { - char *ste_path; /* get the name of the swap file */ + char *ste_path; /* get the name of the swap file */ off_t ste_start; /* starting block for swapping */ off_t ste_length; /* length of swap area */ long ste_pages; /* numbers of pages for swapping */ diff --git a/usr/src/uts/3b2/sys/sxt.h b/usr/src/uts/3b2/sys/sxt.h new file mode 100644 index 0000000..3ecca77 --- /dev/null +++ b/usr/src/uts/3b2/sys/sxt.h @@ -0,0 +1,99 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_SXT_H +#define _SYS_SXT_H + +#ident "@(#)head.sys:sys/sxt.h 11.3" + +/* sxt.h: STREAMS SXT driver header */ + +/* + ** Multiplexed channels driver header + */ + +#define SXTRACE 0 /* 1 to include tracing */ + +#define MAXLINKS 32 +#define CHAN(dev) (dev&CHANMASK) +#define LINK(dev) ((dev>>CHANBITS)&(0xff>>CHANBITS)) + +#if (MAXPCHAN*MAXLINKS) > 256 + ERROR -- product cannot be greater than minor(dev) +#endif + +/* + * Flags for virtual TTY channels + */ +#define SXTCTL 1 +#define SXTBLK 2 +#define SXT_IOCTL 4 + +/* + * Flags for control channel + */ +#define WAITSW 2 /* M_CTL (+ others, maybe) queued waiting for ACK/NAK */ +#define SXTIOCWAIT 4 /* waiting for ACK/NAK on active virtual TTY */ + +struct Channel +{ + struct strtty tty; /* Virtual tty for this channel */ +}; + +typedef struct Channel *Ch_p; + +struct Link +{ + struct strtty *line; /* Real tty for this link */ + char controllingtty; /* the current top dog */ + char old; /* Old line discipline for line */ + char nchans; /* Number of channels allowed */ + unsigned char chanmask; /* Allowable channel bits */ + char open; /* Channel open bits */ + char xopen; /* Exclusive open bits */ + char wpending; /* pending writes/channel */ + char iblocked; /* channels blocked for input */ + char oblocked; /* channels blocked for output*/ + char lwchan; /* Last channel written bit */ + char wrcnt; /* Number of writes on last channel written */ + dev_t dev; /* major and minor device # */ + struct Channel chans[1]; /* Array of channels for this link */ +}; + +typedef struct Link * Link_p; + +/* +** Ioctl args +*/ + +#define SXTIOCLINK ('b'<<8) +#define SXTIOCTRACE (SXTIOCLINK|1) +#define SXTIOCNOTRACE (SXTIOCLINK|2) +#define SXTIOCSWTCH (SXTIOCLINK|3) +#define SXTIOCWF (SXTIOCLINK|4) +#define SXTIOCBLK (SXTIOCLINK|5) +#define SXTIOCUBLK (SXTIOCLINK|6) +#define SXTIOCSTAT (SXTIOCLINK|7) + + +/* the following structure is used for the SXTIOCSTAT ioctl call */ +struct sxtblock +{ + char input; /* channels blocked on input */ + char output; /* channels blocked on output */ +}; + + + +#define t_link t_dstat /* Use dstat in real tty for linknumber */ + +#define MAXPCHAN 8 /* Maximum channel number */ +#define CHANBITS 3 /* Bits for channel number */ +#define CHANMASK 07 /* 2**CHANBITS - 1 */ +#define SXTHOG 2 /* Channel consecutive write limit */ + +#endif /* _SYS_SXT_H */ diff --git a/usr/src/uts/3b2/sys/syscall.h b/usr/src/uts/3b2/sys/syscall.h index 743bd38..7cf1a7f 100644 --- a/usr/src/uts/3b2/sys/syscall.h +++ b/usr/src/uts/3b2/sys/syscall.h @@ -8,7 +8,7 @@ #ifndef _SYS_SYSCALL_H #define _SYS_SYSCALL_H -#ident "@(#)head.sys:sys/syscall.h 1.17" +#ident "@(#)head.sys:sys/syscall.h 1.12" /* * system call numbers @@ -184,20 +184,20 @@ #define SYS_evtrapret 102 #define SYS_statvfs 103 #define SYS_fstatvfs 104 - /* 105 reserved */ -#define SYS_nfssys 106 +#define SYS_fmount 105 +#define SYS_funmount 106 #define SYS_waitsys 107 #define SYS_sigsendsys 108 #define SYS_hrtsys 109 #define SYS_acancel 110 #define SYS_async 111 #define SYS_priocntlsys 112 -#define SYS_pathconf 113 +#define SYS_mctl 113 #define SYS_mincore 114 #define SYS_mmap 115 #define SYS_mprotect 116 #define SYS_munmap 117 -#define SYS_fpathconf 118 +#define SYS_getpagesize 118 #define SYS_vfork 119 #define SYS_fchdir 120 #define SYS_readv 121 @@ -215,11 +215,14 @@ #define SYS_putpmsg 133 #define SYS_rename 134 #define SYS_uname 135 -#define SYS_setegid 136 -#define SYS_sysconfig 137 -#define SYS_adjtime 138 -#define SYS_systeminfo 139 +#define SYS_sbrk 136 +#define SYS_sysconfig 137 +#define SYS_adjtime 138 +#define SYS_systeminfo 139 +#define SYS_setegid 140 #define SYS_seteuid 141 + /* 141-151 reserved for 3b4000 */ +#define SYS_nfssys 152 #ifndef _SYS_SYS_S diff --git a/usr/src/uts/3b2/sys/sysconfig.h b/usr/src/uts/3b2/sys/sysconfig.h index d76a51e..a43f5c4 100644 --- a/usr/src/uts/3b2/sys/sysconfig.h +++ b/usr/src/uts/3b2/sys/sysconfig.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/sysconfig.h 1.5" +#ident "@(#)head.sys:sys/sysconfig.h 1.2" /* cmd values for _sysconfig system call. ** WARNING: This is an undocumented system call, @@ -13,11 +13,9 @@ ** guaranteed. */ -#define UNUSED 1 -#define _CONFIG_NGROUPS 2 /* number of configured supplemental groups */ -#define _CONFIG_CHILD_MAX 3 /* max # of processes per uid session */ -#define _CONFIG_OPEN_FILES 4 /* max # of open files per process */ -#define _CONFIG_POSIX_VER 5 /* POSIX version */ -#define _CONFIG_PAGESIZE 6 /* system page size */ -#define _CONFIG_CLK_TCK 7 /* ticks per second */ -#define _CONFIG_XOPEN_VER 8 /* XOPEN version */ +#define _CONFIG_CHOWN_RST 1 /* chown restricted enabled */ +#define _CONFIG_NGROUPS 2 /* number of configured supplemental groups */ +#define _CONFIG_CHILD_MAX 3 /* max # of processes per uid session */ +#define _CONFIG_OPEN_FILES 4 /* max # of open files per process */ +#define _CONFIG_POSIX_VER 5 /* POSIX version */ +#define _CONFIG_PAGESIZE 6 /* system page size */ diff --git a/usr/src/uts/3b2/sys/sysmacros.h b/usr/src/uts/3b2/sys/sysmacros.h index f279a0b..2802242 100644 --- a/usr/src/uts/3b2/sys/sysmacros.h +++ b/usr/src/uts/3b2/sys/sysmacros.h @@ -8,7 +8,7 @@ #ifndef _SYS_SYSMACROS_H #define _SYS_SYSMACROS_H -#ident "@(#)head.sys:sys/sysmacros.h 11.12" +#ident "@(#)head.sys:sys/sysmacros.h 11.11" #include "sys/param.h" @@ -145,15 +145,13 @@ extern char MINOR[256]; * eminor() allows kernel/driver code to print external minor numbers */ -#define emajor(x) (int)(((unsigned long)(x)>>O_BITSMINOR) > O_MAXMAJ) ? \ - NODEV : (((unsigned long)(x)>>O_BITSMINOR)&O_MAXMAJ) +#define emajor(x) (int)(((unsigned)(x)>>O_BITSMINOR)&O_MAXMAJ) #define eminor(x) (int)((x)&O_MAXMIN) /* get external major and minor device ** components from expanded device number */ -#define getemajor(x) (int)(((unsigned long)(x)>>L_BITSMINOR) > L_MAXMAJ) ? \ - NODEV : (((unsigned long)(x)>>L_BITSMINOR)&L_MAXMAJ) +#define getemajor(x) (int)(((unsigned)(x)>>L_BITSMINOR)&L_MAXMAJ) #define geteminor(x) (int)((x)&L_MAXMIN) diff --git a/usr/src/uts/3b2/sys/systeminfo.h b/usr/src/uts/3b2/sys/systeminfo.h index 39ec5c9..3acf707 100644 --- a/usr/src/uts/3b2/sys/systeminfo.h +++ b/usr/src/uts/3b2/sys/systeminfo.h @@ -5,7 +5,7 @@ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ -#ident "@(#)head.sys:sys/systeminfo.h 1.4" +#ident "@(#)head.sys:sys/systeminfo.h 1.3" extern char architecture[]; extern char hw_serial[]; @@ -25,15 +25,15 @@ extern char srpc_domain[SYS_NMLN]; #define SI_ARCHITECTURE 6 /* return instruction set arch */ #define SI_HW_SERIAL 7 /* return hardware serial number */ #define SI_HW_PROVIDER 8 /* return hardware manufacturer */ -#define SI_SRPC_DOMAIN 9 /* return secure RPC domain */ +#define SI_GET_INET_DOMAIN 9 /* return Internet domain */ /* * These commands are unpublished interfaces to sysinfo(). */ #define SI_SET_HOSTNAME 258 /* set name of node */ /* -unpublished option */ -#define SI_SET_SRPC_DOMAIN 265 /* set secure RPC domain */ +#define SI_SET_INET_DOMAIN 265 /* set Internet domain */ /* -unpublished option */ - + #if defined(__STDC__) && !defined(_KERNEL) int sysinfo(int, char *, long); #endif diff --git a/usr/src/uts/3b2/sys/systm.h b/usr/src/uts/3b2/sys/systm.h index 5ce2dec..b99382a 100644 --- a/usr/src/uts/3b2/sys/systm.h +++ b/usr/src/uts/3b2/sys/systm.h @@ -8,7 +8,7 @@ #ifndef _SYS_SYSTM_H #define _SYS_SYSTM_H -#ident "@(#)head.sys:sys/systm.h 11.49" +#ident "@(#)head.sys:sys/systm.h 11.41" /* * Random set of variables used by more than one routine. */ @@ -39,7 +39,6 @@ extern int rstchown; /* 1 ==> restrictive chown(2) semantics */ extern void iomove(caddr_t, int, int); extern int is32b(void); extern void wakeprocs(caddr_t, int); -extern void wakeup(caddr_t); extern int sleep(caddr_t, int); extern int min(int, int); extern int max(int, int); @@ -51,12 +50,14 @@ extern int nodev(void); extern int nulldev(void); extern int getudev(void); extern int bcmp(char *, char *, size_t); +extern int intrerr(int); extern int memlow(void); extern int stoi(char **); -extern void numtos(u_long, char *); +extern char *strcpy(char *, char *); extern char *strncpy(char *, char *, size_t); extern int strcmp(char *, char *); extern int strncmp(char *, char *, size_t); +extern int strlen(char *); extern int copyin(caddr_t, caddr_t, size_t); extern int lcopyin(caddr_t, caddr_t, size_t); extern int copyout(caddr_t, caddr_t, size_t); @@ -87,7 +88,6 @@ extern int userstrlen(caddr_t); extern void iomove(); extern int is32b(); extern void wakeprocs(); -extern void wakeup(); extern int sleep(); extern int min(); extern int max(); @@ -99,12 +99,14 @@ extern int nodev(); extern int nulldev(); extern int getudev(); extern int bcmp(); +extern int intrerr(); extern int memlow(); extern int stoi(); -extern void numtos(); +extern char *strcpy(); extern char *strncpy(); extern int strcmp(); extern int strncmp(); +extern int strlen(); extern int copyin(); extern int lcopyin(); extern int copyout(); @@ -135,11 +137,13 @@ extern int userstrlen(); #endif /* - * Arguments to wakeprocs() to specify preemptive vs. - * non-preemptive wakeup + * Preemptive and non-preemptive wakeup calls */ -#define NOPRMPT 0 -#define PRMPT 1 +#define NOPREEMPT 0 +#define PREEMPTOK 1 + +#define wakeup(chan) wakeprocs((chan), PREEMPTOK) +#define wakeupnp(chan) wakeprocs((chan), NOPREEMPT) #endif /* _KERNEL */ @@ -182,6 +186,8 @@ typedef union rval rval_t; extern int Dstflag; extern int Timezone; +#endif /* _SYS_SYSTM_H */ + #ifdef KPERF /* This is the structure for the kernel performance */ @@ -205,8 +211,8 @@ extern int Timezone; typedef struct kernperf { unsigned char kp_type; /* the record type as defined below */ unsigned char kp_level; /* A priority level. */ - pid_t kp_pid; /* A process id. */ - clock_t kp_time; /* A relative time in 10 */ + unsigned short kp_pid; /* A process id. */ + unsigned long kp_time; /* A relative time in 10 */ /* microseconds units */ unsigned long kp_pc; /* A pc (kernel address). */ } kernperf_t; @@ -282,5 +288,3 @@ extern int exitflg; extern void swtch(); #endif /* KPERF */ - -#endif /* _SYS_SYSTM_H */ diff --git a/usr/src/uts/3b2/sys/t_kuser.h b/usr/src/uts/3b2/sys/t_kuser.h index 34b4bc5..aa30697 100644 --- a/usr/src/uts/3b2/sys/t_kuser.h +++ b/usr/src/uts/3b2/sys/t_kuser.h @@ -8,7 +8,7 @@ #ifndef _T_KUSER_H #define _T_KUSER_H -#ident "@(#)head.sys:sys/t_kuser.h 1.4" +#ident "@(#)head.sys:sys/t_kuser.h 1.1" /* @(#)t_kuser.h 1.1 88/12/12 SMI */ @@ -56,33 +56,23 @@ struct t_kunitdata { struct knetbuf udata; }; -#ifdef DEBUG -extern int ktli_log(); -extern int ktlilog; - -#define KTLILOG(A, B, C) ((void)((ktlilog) && ktli_log((A), (B), (C)))) -#else -#define KTLILOG(A, B, C) -#endif - /* flags */ #define TIME_UP 0x01 -extern int t_kalloc(); -extern int t_kbind(); -extern int t_kclose(); -extern int t_kconnect(); -extern int t_kfree(); -extern int t_kgetstate(); -extern int t_kopen(); -extern int t_krcvudata(); -extern int t_ksndudata(); -extern int t_kspoll(); -extern int t_kunbind(); -extern int tli_send(); -extern int tli_recv(); -extern int get_ok_ack(); +extern TIUSER *t_kopen(); +extern char *t_kalloc(); +extern int t_kbind(); +extern int t_kgetstate(); +extern int t_kconnect(); +extern int t_kfree(); +extern int t_ksndudata(); +extern int t_krcvudata(); +extern int t_kclose(); +extern int t_kspoll(); +extern int tli_send(); +extern int tli_recv(); +extern int get_ok_ack(); /* these make life a lot easier */ diff --git a/usr/src/uts/3b2/sys/termios.h b/usr/src/uts/3b2/sys/termios.h index 5d641fd..2793053 100644 --- a/usr/src/uts/3b2/sys/termios.h +++ b/usr/src/uts/3b2/sys/termios.h @@ -8,18 +8,18 @@ #ifndef _SYS_TERMIOS_H #define _SYS_TERMIOS_H -#ident "@(#)head.sys:sys/termios.h 1.25" +#ident "@(#)head.sys:sys/termios.h 1.20" -#include +/* + * ttold.h should always be included after termios.h. Otherwise, there + * will be clashes in defines. We want termios.h codes to take precedence + * over ttold.h codes. + */ #ifndef _SYS_TYPES_H #include "sys/types.h" #endif -#ifndef _POSIX_VDISABLE -#define _POSIX_VDISABLE 0 /* Disable special character functions */ -#endif - #define CTRL(c) ((c)&037) #define IBSHIFT 16 @@ -29,6 +29,17 @@ /* some defines required by POSIX */ #define NCCS 19 +#ifndef _POSIX_VDISABLE +#define _POSIX_VDISABLE 0 /* Disable special character functions */ +#endif + +#ifndef MAX_INPUT +#define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ +#endif + +#ifndef MAX_CANON +#define MAX_CANON 256 /* Maximum bytes in a line for canoical processing */ +#endif /* * types defined by POSIX. These are better off in types.h, but @@ -43,8 +54,6 @@ typedef unsigned long speed_t; * These functions get mapped into ioctls. */ -#ifndef _KERNEL - extern speed_t cfgetospeed (/* termios *termios_p */); extern int cfsetospeed (/* termios *termios_p, speed_t speed */); extern speed_t cfgetispeed (/* termios *termios_p */); @@ -55,11 +64,10 @@ extern int tcsendbreak (/* int fildes, int duration */); extern int tcdrain (/* int fildes */); extern int tcflush (/* int fildes, int queue_selector */); extern int tcflow (/* int fildes, int action */); -extern int tcsetpgrp (/* int fildes, pid_t pgrp_id */); extern pid_t tcgetpgrp (/* int fildes */); -extern pid_t tcgetsid (/* int fildes */); +extern int tcsetpgrp (/* int fildes, pid_t pgrp_id */); + -#endif /* control characters */ #define VINTR 0 @@ -167,6 +175,24 @@ extern pid_t tcgetsid (/* int fildes */); /* control modes */ #define CBAUD 0000017 +#define B0 0 +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define EXTA 0000016 +#define B38400 0000017 +#define EXTB 0000017 #define CSIZE 0000060 #define CS5 0 #define CS6 0000020 @@ -272,11 +298,7 @@ extern pid_t tcgetsid (/* int fildes */); #define TIOCFLUSH (tIOC|16) #define TIOCSETC (tIOC|17) #define TIOCGETC (tIOC|18) -/* - * BSD ioctls that are not the same as XENIX are included here. - * There are also some relevant ioctls from SUN/BSD sys/ttycom.h - * BSD pty ioctls like TIOCPKT are not supported in SVR4. - */ +/* BSD ioctls that are not the same as XENIX */ #define TIOCLBIS (tIOC|127) /* bis local mode bits */ #define TIOCLBIC (tIOC|126) /* bic local mode bits */ @@ -288,7 +310,6 @@ extern pid_t tcgetsid (/* int fildes */); #define TIOCCDTR (tIOC|120) /* clear data terminal ready */ #define TIOCSLTC (tIOC|117) /* set local special chars */ #define TIOCGLTC (tIOC|116) /* get local special chars */ -#define TIOCOUTQ (tIOC|115) /* driver output queue size */ #define TIOCNOTTY (tIOC|113) /* void tty association */ #define TIOCSTOP (tIOC|111) /* stop output, like ^S */ #define TIOCSTART (tIOC|110) /* start output, like ^Q */ @@ -370,7 +391,6 @@ struct termios { cc_t c_cc[NCCS]; /* control chars */ }; -#ifndef _SYS_TTOLD_H /* Windowing structure to support JWINSIZE/TIOCSWINSZ/TIOCGWINSZ */ struct winsize { @@ -380,6 +400,4 @@ struct winsize { unsigned short ws_ypixel; /* vertical size, pixels */ }; -#endif /* end _SYS_TTOLD_H */ - #endif /* _SYS_TERMIOS_H */ diff --git a/usr/src/uts/3b2/sys/ticots.h b/usr/src/uts/3b2/sys/ticots.h index cd9da37..9292f1f 100644 --- a/usr/src/uts/3b2/sys/ticots.h +++ b/usr/src/uts/3b2/sys/ticots.h @@ -211,4 +211,55 @@ typedef struct tco_addr tco_addr_t; #define TCO_NOOPOPT 0x02 /* for tco_ckopt() */ #define TCO_BADFORMAT 0x04 /* for tco_ckopt() */ #define TCO_BADTYPE 0x08 /* for tco_ckopt() */ -#define TCO_BADVALUE 0 \ No newline at end of file +#define TCO_BADVALUE 0x10 /* for tco_ckopt() */ +#define UNIX_PASS 0 /* should be standardized */ +#define UNIX_FAIL (!UNIX_PASS) /* should be standardized */ +#define BADSEQNUM ((long)(-1)) /* should be standardized */ + +/* + * internal defines + */ +#define TCO_BIND 1 +#define TCO_CONN 2 +#define TCO_OPEN 3 +#define TCO_RQ 4 +#define TCO_IDFLG_ALL (TCO_IDFLG_UID | TCO_IDFLG_GID | TCO_IDFLG_RUID | TCO_IDFLG_RGID) +#define TCO_MHASH 5 +#define TCO_NMHASH (1 << TCO_MHASH) /* num of hash buckets in open endpt table */ +#define TCO_MMASK (TCO_NMHASH - 1) +#define TCO_RQHASH 5 /* must be <= NBBY*sizeof(te_rqhash) */ +#define TCO_NRQHASH (1 << TCO_RQHASH) /* num of hash buckets in te_rq table */ +#define TCO_RQMASK (TCO_NRQHASH - 1) +/* following magic number and shift factor for fibonacci hash function */ +#define TCO_RQMAGIC 0x9ce14b36 +#define TCO_RQSHIFT (NBBY*sizeof(int) - TCO_RQHASH) +#define TCO_AHASH 5 /* must be <= NBBY*sizeof(ta_ahash) */ +#define TCO_NAHASH (1 << TCO_AHASH) /* num of hash buckets in bound addr table */ +#define TCO_AMASK (TCO_NAHASH - 1) + +/* + * some useful macros + */ +#define tco_min(TE) ((TE)->te_min) +#define tco_mkmhash(TE) ((unsigned)(tco_min(TE)) & TCO_MMASK) +#define tco_mhash(TE) tco_mkmhash(TE) +#define tco_mkrqhash(TE) (((((unsigned)((TE)->te_rq))*TCO_RQMAGIC) >> TCO_RQSHIFT) & TCO_RQMASK) +#define tco_rqhash(TE) ((unsigned)(TE)->te_rqhash) +#define tco_alen(TA) ((TA)->ta_alen) +#define tco_abuf(TA) ((TA)->ta_abuf) +#define tco_ahash(TA) ((unsigned)(TA)->ta_ahash) +#define tco_mkahash(TA) ((unsigned)(tco_sumbytes(tco_abuf(TA),tco_alen(TA)) & TCO_AMASK)) +#define tco_eqabuf(TA,TB) ((tco_alen(TA) == tco_alen(TB)) \ + && tco_bequal(tco_abuf(TA),tco_abuf(TB),tco_alen(TA))) + +/* + * STRLOG tracing levels: + * + * 0 = urgent + * 1 = fatal + * 2 = errack + * 3 = interesting stuff + * 4 = chit-chat + */ + +#endif /* _KERNEL */ diff --git a/usr/src/uts/3b2/sys/ticotsord.h b/usr/src/uts/3b2/sys/ticotsord.h new file mode 100644 index 0000000..b4ca5e7 --- /dev/null +++ b/usr/src/uts/3b2/sys/ticotsord.h @@ -0,0 +1,265 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/ticotsord.h 1.3" +/* + * ticotsord provider-dependent info + * (provider-independent applications must not include this header file) + */ + +/* + * disconnect reason codes (see t_rcvdis()) + */ +#define TCOO_NOPEER 1 /* no listener on dest addr */ +#define TCOO_PEERNOROOMONQ 2 /* peer has no room on incoming queue */ +#define TCOO_PEERBADSTATE 3 /* peer in wrong state */ +#define TCOO_PEERINITIATED 4 /* peer-initiated disconnect */ +#define TCOO_PROVIDERINITIATED 5 /* provider-initiated disconnect */ + +/* + * options (flattened linked-list of flattened C-structures) + */ +#define TCOO_OPT_NOHDR 0 /* invalid nexthdr offset (end of list) */ + +#define TCOO_OPT_NOOP 1 /* no-op opt -- default */ +#define TCOO_OPT_SETID 2 /* set ident */ +#define TCOO_OPT_GETID 3 /* get ident */ +#define TCOO_OPT_UID 4 /* uid info */ +#define TCOO_OPT_GID 5 /* gid info */ +#define TCOO_OPT_RUID 6 /* ruid info */ +#define TCOO_OPT_RGID 7 /* rgid info */ + +#define TCOO_IDFLG_UID 0x1 /* uid flag */ +#define TCOO_IDFLG_GID 0x2 /* gid flag */ +#define TCOO_IDFLG_RUID 0x4 /* ruid flag */ +#define TCOO_IDFLG_RGID 0x8 /* rgid flag */ + +/* header for maintaining list of opts; one for each opt in list; + offsets are measured from beginning of options buffer; + headers must occur in increasing order, to avoid loops */ +struct tcoo_opt_hdr { + long hdr_thisopt_off; /* offset to current opt */ + long hdr_nexthdr_off; /* offset to next hdr */ +}; + +/* no-op opt -- the default */ +struct tcoo_opt_noop { + long noop_type; /* TCOO_OPT_NOOP; must be first */ +}; + +/* set ident opt -- subsequent t_rcvudata()'s + (i.e., T_UNITDATA_IND) will contain peer's ident info */ +struct tcoo_opt_setid { + long setid_type; /* TCOO_OPT_SETID; must be first */ + long setid_flg; /* which id opts to set */ +}; + +/* get ident opt */ +struct tcoo_opt_getid { + long getid_type; /* TCOO_OPT_GETID; must be first */ + long getid_flg; /* which id opts are set */ +}; + +/* uid info opt */ +struct tcoo_opt_uid { + long uid_type; /* TCOO_OPT_UID; must be first */ + uid_t uid_val; /* effective user id */ +}; + +/* gid info opt */ +struct tcoo_opt_gid { + long gid_type; /* TCOO_OPT_GID; must be first */ + gid_t gid_val; /* effective group id */ +}; + +/* ruid info opt */ +struct tcoo_opt_ruid { + long ruid_type; /* TCOO_OPT_RUID; must be first */ + uid_t ruid_val; /* real user id */ +}; + +/* rgid info opt */ +struct tcoo_opt_rgid { + long rgid_type; /* TCOO_OPT_RGID; must be first */ + gid_t rgid_val; /* real group id */ +}; + +/* union of all the opts */ +union tcoo_opt { + long opt_type; /* opt type; must be first */ + struct tcoo_opt_noop opt_noop; /* noop opt */ + struct tcoo_opt_setid opt_setid; /* set ident opt */ + struct tcoo_opt_getid opt_getid; /* get ident opt */ + struct tcoo_opt_uid opt_uid; /* uid info opt */ + struct tcoo_opt_gid opt_gid; /* gid info opt */ + struct tcoo_opt_ruid opt_ruid; /* ruid info opt */ + struct tcoo_opt_rgid opt_rgid; /* rgid info opt */ +}; + +/******************************************************************************/ + +#ifdef _KERNEL + +/* + * transport endpoint structure + */ +struct tcoo_endpt { + struct tcoo_endpt *te_folist; /* forw ptr, list of open endpts */ + struct tcoo_endpt *te_bolist; /* back ptr, list of open endpts */ + struct tcoo_endpt *te_frqlist; /* forw ptr, te_rq list */ + struct tcoo_endpt *te_brqlist; /* back ptr, te_rq list */ + struct tcoo_endpt *te_fblist; /* forw ptr, list of endpts bound to addr */ + struct tcoo_endpt *te_bblist; /* back ptr, list of endpts bound to addr */ + queue_t *te_rq; /* stream read queue */ + struct tcoo_addr *te_addr; /* addr bound to this endpt */ + minor_t te_min; /* minor number */ + unsigned short te_rqhash; /* te_rq hash bucket */ + char te_state; /* state of interface */ + char te_flg; /* internal flags */ + long te_idflg; /* ident flags */ + unsigned char te_qlen; /* max incoming connect reqs pending */ + unsigned char te_nicon; /* num of incoming connect reqs pending */ +#define TCOO_MAXQLEN 8 /* must be <= (1 << (NBBY*sizeof(te_nicon))) */ + struct tcoo_endpt *te_icon[TCOO_MAXQLEN]; /* incoming connect requests pending */ + struct tcoo_endpt *te_ocon; /* outgoing connect request pending */ + struct tcoo_endpt *te_con; /* connected endpt */ + uid_t te_uid; /* uid */ + gid_t te_gid; /* gid */ + uid_t te_ruid; /* ruid */ + gid_t te_rgid; /* rgid */ +}; +typedef struct tcoo_endpt tcoo_endpt_t; + +/* + * transport addr structure + */ +struct tcoo_addr { + struct tcoo_addr *ta_falist; /* forw ptr, list of bound addrs */ + struct tcoo_addr *ta_balist; /* back ptr, list of bound addrs */ + struct tcoo_endpt *ta_hblist; /* head ptr, list of endpts bound to this addr */ + struct tcoo_endpt *ta_tblist; /* tail ptr, list of endpts bound to this addr */ + unsigned short ta_ahash; /* addr hash bucket */ + long ta_alen; /* length of abuf */ + char *ta_abuf; /* the addr itself */ +}; +typedef struct tcoo_addr tcoo_addr_t; + +/* + * registered id + */ +#ifdef TICOTS +#define TCOO_ID 10002 +#endif +#ifdef TICOTSORD +#define TCOO_ID 10003 +#endif + +/* + * macro to change state + * NEXTSTATE(event,current state) + */ +#define NEXTSTATE(X,Y) ti_statetbl[X][Y] /* should be standardized */ +#define NR 127 /* unreachable state */ /* should be standardized */ + +/* + * basic constants + */ +#define TCOO_NENDPT (MAXMIN+1) +#ifdef TICOTS +#define TCOO_SERVTYPE T_COTS +#endif +#ifdef TICOTSORD +#define TCOO_SERVTYPE T_COTS_ORD +#endif +#define TCOO_TIDUSZ (8*1024) /* max packet size */ +#define TCOO_DEFAULTADDRSZ 4 /* default addr sz */ +/* can't make the following 4 sizes -1 (unlimited), because of bug in TLI/TPI specs: + unlimited data can be sent but cannot received in a well-specified way + (receiver doesn't know how big to make buffer, and T_MORE flag can't be used) */ +#define TCOO_ADDRSZ (TCOO_TIDUSZ-16) /* 16 = sizeof(struct T_bind_req) + = sizeof(struct T_bind_ack) */ +#define TCOO_OPTSZ (TCOO_TIDUSZ-16) /* 16 = sizeof(struct T_optmgmt_req) + = sizeof(struct T_optmgmt_ack) */ +#define TCOO_CDATASZ (TCOO_TIDUSZ-24) /* 24 = sizeof(struct T_conn_req) + 4 + = sizeof(struct T_conn_ind) + = sizeof(struct T_conn_res) + 4 + = sizeof(struct T_conn_con) + 4 */ +#define TCOO_DDATASZ (TCOO_TIDUSZ-12) /* 8 = sizeof(struct T_discon_req) + 4 + = sizeof(struct T_discon_ind) */ +#define TCOO_TSDUSZ -1 /* unlimited */ +#define TCOO_ETSDUSZ -1 /* unlimited */ +#define TCOO_MINPSZ 0 +#define TCOO_MAXPSZ TCOO_TIDUSZ +#define TCOO_LOWAT (TCOO_TIDUSZ/4) +#define TCOO_HIWAT (4*TCOO_TIDUSZ) + +/* + * te_flg + */ +#define TCOO_ZOMBIE 0x1 /* fatal error on endpoint */ + +/* + * pass/fail indicators + */ +#define TCOO_PASS 0 +#define TCOO_FAIL (!TCOO_PASS) +#define TCOO_REALOPT 0x01 /* for tcoo_ckopt() */ +#define TCOO_NOOPOPT 0x02 /* for tcoo_ckopt() */ +#define TCOO_BADFORMAT 0x04 /* for tcoo_ckopt() */ +#define TCOO_BADTYPE 0x08 /* for tcoo_ckopt() */ +#define TCOO_BADVALUE 0x10 /* for tcoo_ckopt() */ +#define UNIX_PASS 0 /* should be standardized */ +#define UNIX_FAIL (!UNIX_PASS) /* should be standardized */ +#define BADSEQNUM ((long)(-1)) /* should be standardized */ + +/* + * internal defines + */ +#define TCOO_BIND 1 +#define TCOO_CONN 2 +#define TCOO_OPEN 3 +#define TCOO_RQ 4 +#define TCOO_IDFLG_ALL (TCOO_IDFLG_UID | TCOO_IDFLG_GID | TCOO_IDFLG_RUID | TCOO_IDFLG_RGID) +#define TCOO_MHASH 5 +#define TCOO_NMHASH (1 << TCOO_MHASH) /* num of hash buckets in open endpt table */ +#define TCOO_MMASK (TCOO_NMHASH - 1) +#define TCOO_RQHASH 5 /* must be <= NBBY*sizeof(te_rqhash) */ +#define TCOO_NRQHASH (1 << TCOO_RQHASH) /* num of hash buckets in te_rq table */ +#define TCOO_RQMASK (TCOO_NRQHASH - 1) +/* following magic number and shift factor for fibonacci hash function */ +#define TCOO_RQMAGIC 0x9ce14b36 +#define TCOO_RQSHIFT (NBBY*sizeof(int) - TCOO_RQHASH) +#define TCOO_AHASH 5 /* must be <= NBBY*sizeof(ta_ahash) */ +#define TCOO_NAHASH (1 << TCOO_AHASH) /* num of hash buckets in bound addr table */ +#define TCOO_AMASK (TCOO_NAHASH - 1) + +/* + * some useful macros + */ +#define tcoo_min(TE) ((TE)->te_min) +#define tcoo_mkmhash(TE) ((unsigned)(tcoo_min(TE)) & TCOO_MMASK) +#define tcoo_mhash(TE) tcoo_mkmhash(TE) +#define tcoo_mkrqhash(TE) (((((unsigned)((TE)->te_rq))*TCOO_RQMAGIC) >> TCOO_RQSHIFT) & TCOO_RQMASK) +#define tcoo_rqhash(TE) ((unsigned)(TE)->te_rqhash) +#define tcoo_alen(TA) ((TA)->ta_alen) +#define tcoo_abuf(TA) ((TA)->ta_abuf) +#define tcoo_ahash(TA) ((unsigned)(TA)->ta_ahash) +#define tcoo_mkahash(TA) ((unsigned)(tcoo_sumbytes(tcoo_abuf(TA),tcoo_alen(TA)) & TCOO_AMASK)) +#define tcoo_eqabuf(TA,TB) ((tcoo_alen(TA) == tcoo_alen(TB)) \ + && tcoo_bequal(tcoo_abuf(TA),tcoo_abuf(TB),tcoo_alen(TA))) + +/* + * STRLOG tracing levels: + * + * 0 = urgent + * 1 = fatal + * 2 = errack + * 3 = interesting stuff + * 4 = chit-chat + */ + +#endif /* _KERNEL */ diff --git a/usr/src/uts/3b2/sys/tihdr.h b/usr/src/uts/3b2/sys/tihdr.h new file mode 100644 index 0000000..0f0bc62 --- /dev/null +++ b/usr/src/uts/3b2/sys/tihdr.h @@ -0,0 +1,368 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TIHDR_H +#define _SYS_TIHDR_H + +#ident "@(#)head.sys:sys/tihdr.h 11.2" + +/* + * The following is all the information + * needed by the Transport Service Interface. + */ + + + +/* + * The following are the definitions of the Transport + * Service Interface primitives. + */ + +/* + * Primitives that are initiated by the transport user. + */ + +#define T_CONN_REQ 0 /* connection request */ +#define T_CONN_RES 1 /* connection response */ +#define T_DISCON_REQ 2 /* disconnect request */ +#define T_DATA_REQ 3 /* data request */ +#define T_EXDATA_REQ 4 /* expedited data request */ +#define T_INFO_REQ 5 /* information request */ +#define T_BIND_REQ 6 /* bind request */ +#define T_UNBIND_REQ 7 /* unbind request */ +#define T_UNITDATA_REQ 8 /* unitdata request */ +#define T_OPTMGMT_REQ 9 /* manage options req */ +#define T_ORDREL_REQ 10 /* orderly release req */ + +/* + * Primitives that are initiated by the transport provider. + */ + +#define T_CONN_IND 11 /* connection indication */ +#define T_CONN_CON 12 /* connection confirmation */ +#define T_DISCON_IND 13 /* disconnect indication */ +#define T_DATA_IND 14 /* data indication */ +#define T_EXDATA_IND 15 /* expeditied data indication */ +#define T_INFO_ACK 16 /* information acknowledgment */ +#define T_BIND_ACK 17 /* bind acknowledment */ +#define T_ERROR_ACK 18 /* error acknowledgment */ +#define T_OK_ACK 19 /* ok acknowledgment */ +#define T_UNITDATA_IND 20 /* unitdata indication */ +#define T_UDERROR_IND 21 /* unitdata error indication */ +#define T_OPTMGMT_ACK 22 /* manage options ack */ +#define T_ORDREL_IND 23 /* orderly release ind */ + +/* + * The following are the events that drive the state machine + */ +/* Initialization events */ +#define TE_BIND_REQ 0 /* bind request */ +#define TE_UNBIND_REQ 1 /* unbind request */ +#define TE_OPTMGMT_REQ 2 /* manage options req */ +#define TE_BIND_ACK 3 /* bind acknowledment */ +#define TE_OPTMGMT_ACK 4 /* manage options ack */ +#define TE_ERROR_ACK 5 /* error acknowledgment */ +#define TE_OK_ACK1 6 /* ok ack seqcnt == 0 */ +#define TE_OK_ACK2 7 /* ok ack seqcnt == 1, q == resq */ +#define TE_OK_ACK3 8 /* ok ack seqcnt == 1, q != resq */ +#define TE_OK_ACK4 9 /* ok ack seqcnt > 1 */ + +/* Connection oriented events */ +#define TE_CONN_REQ 10 /* connection request */ +#define TE_CONN_RES 11 /* connection response */ +#define TE_DISCON_REQ 12 /* disconnect request */ +#define TE_DATA_REQ 13 /* data request */ +#define TE_EXDATA_REQ 14 /* expedited data request */ +#define TE_ORDREL_REQ 15 /* orderly release req */ +#define TE_CONN_IND 16 /* connection indication */ +#define TE_CONN_CON 17 /* connection confirmation */ +#define TE_DATA_IND 18 /* data indication */ +#define TE_EXDATA_IND 19 /* expedited data indication */ +#define TE_ORDREL_IND 20 /* orderly release ind */ +#define TE_DISCON_IND1 21 /* disconnect indication seq == 0 */ +#define TE_DISCON_IND2 22 /* disconnect indication seq == 1 */ +#define TE_DISCON_IND3 23 /* disconnect indication seq > 1 */ +#define TE_PASS_CONN 24 /* pass connection */ + +/* Unit data events */ +#define TE_UNITDATA_REQ 25 /* unitdata request */ +#define TE_UNITDATA_IND 26 /* unitdata indication */ +#define TE_UDERROR_IND 27 /* unitdata error indication */ + +#define TE_NOEVENTS 28 +/* + * The following are the possible states of the Transport + * Service Interface + */ + +#define TS_UNBND 0 /* unbound */ +#define TS_WACK_BREQ 1 /* waiting ack of BIND_REQ */ +#define TS_WACK_UREQ 2 /* waiting ack of UNBIND_REQ */ +#define TS_IDLE 3 /* idle */ +#define TS_WACK_OPTREQ 4 /* wait ack options request */ +#define TS_WACK_CREQ 5 /* waiting ack of CONN_REQ */ +#define TS_WCON_CREQ 6 /* waiting confirm of CONN_REQ */ +#define TS_WRES_CIND 7 /* waiting response of CONN_IND */ +#define TS_WACK_CRES 8 /* waiting ack of CONN_RES */ +#define TS_DATA_XFER 9 /* data transfer */ +#define TS_WIND_ORDREL 10 /* releasing rd but not wr */ +#define TS_WREQ_ORDREL 11 /* wait to release wr but not rd*/ +#define TS_WACK_DREQ6 12 /* waiting ack of DISCON_REQ */ +#define TS_WACK_DREQ7 13 /* waiting ack of DISCON_REQ */ +#define TS_WACK_DREQ9 14 /* waiting ack of DISCON_REQ */ +#define TS_WACK_DREQ10 15 /* waiting ack of DISCON_REQ */ +#define TS_WACK_DREQ11 16 /* waiting ack of DISCON_REQ */ + +#define TS_NOSTATES 17 + + +/* + * The following structure definitions define the format of the + * stream message block of the above primitives. + * (everything is declared long to ensure proper alignment + * across different machines) + */ + +/* connection request */ + +struct T_conn_req { + long PRIM_type; /* always T_CONN_REQ */ + long DEST_length; /* dest addr length */ + long DEST_offset; /* dest addr offset */ + long OPT_length; /* options length */ + long OPT_offset; /* options offset */ +}; + +/* connect response */ + +struct T_conn_res { + long PRIM_type; /* always T_CONN_RES */ + queue_t *QUEUE_ptr; /* responding queue ptr */ + long OPT_length; /* options length */ + long OPT_offset; /* options offset */ + long SEQ_number; /* sequence number */ +}; + +/* disconnect request */ + +struct T_discon_req { + long PRIM_type; /* always T_DISCON_REQ */ + long SEQ_number; /* sequnce number */ +}; + +/* data request */ + +struct T_data_req { + long PRIM_type; /* always T_DATA_REQ */ + long MORE_flag; /* more data */ +}; + +/* expedited data request */ + +struct T_exdata_req { + long PRIM_type; /* always T_EXDATA_REQ */ + long MORE_flag; /* more data */ +}; + +/* information request */ + +struct T_info_req { + long PRIM_type; /* always T_INFO_REQ */ +}; + +/* bind request */ + +struct T_bind_req { + long PRIM_type; /* always T_BIND_REQ */ + long ADDR_length; /* addr length */ + long ADDR_offset; /* addr offset */ + unsigned long CONIND_number; /*connect indications requested */ +}; + +/* unbind request */ + +struct T_unbind_req { + long PRIM_type; /* always T_UNBIND_REQ */ +}; + +/* unitdata request */ + +struct T_unitdata_req { + long PRIM_type; /* always T_UNITDATA_REQ */ + long DEST_length; /* dest addr length */ + long DEST_offset; /* dest addr offset */ + long OPT_length; /* options length */ + long OPT_offset; /* options offset */ +}; + +/* manage options request */ + +struct T_optmgmt_req { + long PRIM_type; /* always T_OPTMGMT_REQ */ + long OPT_length; /* options length */ + long OPT_offset; /* options offset */ + long MGMT_flags; /* options flags */ +}; + +/* orderly release request */ + +struct T_ordrel_req { + long PRIM_type; /* always T_ORDREL_REQ */ +}; + +/* connect indication */ + +struct T_conn_ind { + long PRIM_type; /* always T_CONN_IND */ + long SRC_length; /* src addr length */ + long SRC_offset; /* src addr offset */ + long OPT_length; /* option length */ + long OPT_offset; /* option offset */ + long SEQ_number; /* sequnce number */ +}; + +/* connect confirmation */ + +struct T_conn_con { + long PRIM_type; /* always T_CONN_CON */ + long RES_length; /* responding addr length */ + long RES_offset; /* responding addr offset */ + long OPT_length; /* option length */ + long OPT_offset; /* option offset */ +}; + +/* disconnect indication */ + +struct T_discon_ind { + long PRIM_type; /* always T_DISCON_IND */ + long DISCON_reason; /* disconnect reason */ + long SEQ_number; /* sequnce number */ +}; + +/* data indication */ + +struct T_data_ind { + long PRIM_type; /* always T_DATA_IND */ + long MORE_flag; /* more data */ +}; + +/* expedited data indication */ + +struct T_exdata_ind { + long PRIM_type; /* always T_EXDATA_IND */ + long MORE_type; /* more data */ +}; + +/* information acknowledgment */ + +struct T_info_ack { + long PRIM_type; /* always T_INFO_ACK */ + long TSDU_size; /* max TSDU size */ + long ETSDU_size; /* max ETSDU size */ + long CDATA_size; /* max connect data size */ + long DDATA_size; /* max discon data size */ + long ADDR_size; /* address size */ + long OPT_size; /* options size */ + long TIDU_size; /* max TIDU size */ + long SERV_type; /* provider service type */ + long CURRENT_state; /* current state */ +}; + +/* bind acknowledgment */ + +struct T_bind_ack { + long PRIM_type; /* always T_BIND_ACK */ + long ADDR_length; /* addr length */ + long ADDR_offset; /* addr offset */ + unsigned long CONIND_number; /* connect ind to be queued */ +}; + +/* error acknowledgment */ + +struct T_error_ack { + long PRIM_type; /* always T_ERROR_ACK */ + long ERROR_prim; /* primitive in error */ + long TLI_error; /* TLI error code */ + long UNIX_error; /* UNIX error code */ +}; + +/* ok acknowledgment */ + +struct T_ok_ack { + long PRIM_type; /* always T_OK_ACK */ + long CORRECT_prim; /* correct primitive */ +}; + +/* unitdata indication */ + +struct T_unitdata_ind { + long PRIM_type; /* always T_UNITDATA_IND */ + long SRC_length; /* source addr length */ + long SRC_offset; /* source addr offset */ + long OPT_length; /* options length */ + long OPT_offset; /* options offset */ +}; + +/* unitdata error indication */ + +struct T_uderror_ind { + long PRIM_type; /* always T_UDERROR_IND */ + long DEST_length; /* dest addr length */ + long DEST_offset; /* dest addr offset */ + long OPT_length; /* options length */ + long OPT_offset; /* options offset */ + long ERROR_type; /* error type */ +}; + +/* manage options ack */ + +struct T_optmgmt_ack { + long PRIM_type; /* always T_OPTMGMT_ACK */ + long OPT_length; /* options length */ + long OPT_offset; /* options offset */ + long MGMT_flags; /* managment flags */ +}; + +/* orderly release indication */ + +struct T_ordrel_ind { + long PRIM_type; /* always T_ORDREL_IND */ +}; + +/* + * The following is a union of the primitives + */ +union T_primitives { + long type; /* primitive type */ + struct T_conn_req conn_req; /* connect request */ + struct T_conn_res conn_res; /* connect response */ + struct T_discon_req discon_req; /* disconnect request */ + struct T_data_req data_req; /* data request */ + struct T_exdata_req exdata_req; /* expedited data req */ + struct T_info_req info_req; /* information req */ + struct T_bind_req bind_req; /* bind request */ + struct T_unbind_req unbind_req; /* unbind request */ + struct T_unitdata_req unitdata_req; /* unitdata requset */ + struct T_optmgmt_req optmgmt_req; /* manage opt req */ + struct T_ordrel_req ordrel_req; /* orderly rel req */ + struct T_conn_ind conn_ind; /* connect indication */ + struct T_conn_con conn_con; /* connect corfirm */ + struct T_discon_ind discon_ind; /* discon indication */ + struct T_data_ind data_ind; /* data indication */ + struct T_exdata_ind exdata_ind; /* expedited data ind */ + struct T_info_ack info_ack; /* info ack */ + struct T_bind_ack bind_ack; /* bind ack */ + struct T_error_ack error_ack; /* error ack */ + struct T_ok_ack ok_ack; /* ok ack */ + struct T_unitdata_ind unitdata_ind; /* unitdata ind */ + struct T_uderror_ind uderror_ind; /* unitdata error ind */ + struct T_optmgmt_ack optmgmt_ack; /* manage opt ack */ + struct T_ordrel_ind ordrel_ind; /* orderly rel ind */ +}; + + +#endif /* _SYS_TIHDR_H */ diff --git a/usr/src/uts/3b2/sys/time.h b/usr/src/uts/3b2/sys/time.h new file mode 100644 index 0000000..51a0642 --- /dev/null +++ b/usr/src/uts/3b2/sys/time.h @@ -0,0 +1,94 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TIME_H +#define _SYS_TIME_H + +#ident "@(#)head.sys:sys/time.h 1.5" + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ +#define DST_GB 7 /* Great Britain and Eire */ +#define DST_RUM 8 /* Rumania */ +#define DST_TUR 9 /* Turkey */ +#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ + +/* + * Operations on timevals. + * + * NB: timercmp does not work for >= or <=. + */ +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + ((tvp)->tv_sec cmp (uvp)->tv_sec || \ + (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* + * Time expressed in seconds and nanoseconds + */ + +typedef struct timestruc { + unsigned long tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +} timestruc_t; + +#ifdef _KERNEL +/* + * Bump a timestruc by a small number of nsec + */ + +#define BUMPTIME(t, nsec, flag) { \ + register timestruc_t *tp = (t); \ +\ + tp->tv_nsec += (nsec); \ + if (tp->tv_nsec >= 1000000000) { \ + tp->tv_nsec -= 1000000000; \ + tp->tv_sec++; \ + flag = 1; \ + } \ +} + +extern timestruc_t hrestime; +#endif + +#ifndef _KERNEL +#include +#endif + +#endif /* _SYS_TIME_H */ diff --git a/usr/src/uts/3b2/sys/timeb.h b/usr/src/uts/3b2/sys/timeb.h new file mode 100644 index 0000000..ddcc8af --- /dev/null +++ b/usr/src/uts/3b2/sys/timeb.h @@ -0,0 +1,43 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +/* Copyright (c) 1987, 1988 Microsoft Corporation */ +/* All Rights Reserved */ + +/* This Module contains Proprietary Information of Microsoft */ +/* Corporation and should be treated as Confidential. */ + +#ident "@(#)head.sys:sys/timeb.h 1.2" + +/* + * @(#) timeb.h 1.2 88/05/04 head.sys:timeb.h + */ + + + + +/* + * THIS FILE CONTAINS CODE WHICH IS DESIGNED TO BE + * PORTABLE BETWEEN DIFFERENT MACHINE ARCHITECTURES + * AND CONFIGURATIONS. IT SHOULD NOT REQUIRE ANY + * MODIFICATIONS WHEN ADAPTING XENIX TO NEW HARDWARE. + */ + + +#pragma pack(2) + +/* + * Structure returned by ftime system call + */ +struct timeb { + time_t time; /* time, seconds since the epoch */ + unsigned short millitm;/* 1000 msec of additional accuracy */ + short timezone; /* timezone, minutes west of GMT */ + short dstflag; /* daylight savings when appropriate? */ +}; + +#pragma pack() diff --git a/usr/src/uts/3b2/sys/times.h b/usr/src/uts/3b2/sys/times.h new file mode 100644 index 0000000..6e8b037 --- /dev/null +++ b/usr/src/uts/3b2/sys/times.h @@ -0,0 +1,26 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TIMES_H +#define _SYS_TIMES_H + +#ident "@(#)head.sys:sys/times.h 11.6" +/* + * Structure returned by times() + */ +struct tms { + clock_t tms_utime; /* user time */ + clock_t tms_stime; /* system time */ + clock_t tms_cutime; /* user time, children */ + clock_t tms_cstime; /* system time, children */ +}; + +#if defined(__STDC__) && !defined(_KERNEL) +clock_t times(struct tms *); +#endif + +#endif /* _SYS_TIMES_H */ diff --git a/usr/src/uts/3b2/sys/timod.h b/usr/src/uts/3b2/sys/timod.h new file mode 100644 index 0000000..40641c6 --- /dev/null +++ b/usr/src/uts/3b2/sys/timod.h @@ -0,0 +1,100 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TIMOD_H +#define _SYS_TIMOD_H + +#ident "@(#)head.sys:sys/timod.h 11.3" + +/* Internal flags */ +#define USED 0x0001 /* data structure in use */ +#define FATAL 0x0002 /* fatal error M_ERROR occurred */ +#define WAITIOCACK 0x0004 /* waiting for info for ioctl act */ +#define MORE 0x0008 /* more data */ +#define EXPEDITED 0x0010 /* processing expedited TSDU */ +#define CLTS 0x0020 /* connectionless transport */ +#define COTS 0x0040 /* connection-oriented transport */ +#define OPENWAIT 0x0080 /* sleeping in open routine */ +#define CONNWAIT 0x0100 /* waiting for connect confirmation */ +#define LOCORDREL 0x0200 /* local end has orderly released */ +#define REMORDREL 0x0400 /* remote end had orderly released */ +#define NAMEPROC 0x0800 /* processing a NAME ioctl */ + +/* Internal buffer size (in bytes) pre-allocated for address fields */ +#define PRADDRSZ 128 + +/* Sleep timeout in open */ +#define TIMWAIT (1*HZ) + +/* Timod ioctls */ +#define TIMOD ('T'<<8) +#define TI_GETINFO (TIMOD|140) +#define TI_OPTMGMT (TIMOD|141) +#define TI_BIND (TIMOD|142) +#define TI_UNBIND (TIMOD|143) +#define TI_GETMYNAME (TIMOD|144) +#define TI_GETPEERNAME (TIMOD|145) +#define TI_SETMYNAME (TIMOD|146) +#define TI_SETPEERNAME (TIMOD|147) + + +/* TI interface user level structure - one per open file */ + +struct _ti_user { + ushort ti_flags; /* flags */ + int ti_rcvsize; /* rcv buffer size */ + char *ti_rcvbuf; /* rcv buffer */ + int ti_ctlsize; /* ctl buffer size */ + char *ti_ctlbuf; /* ctl buffer */ + char *ti_lookdbuf; /* look data buffer */ + char *ti_lookcbuf; /* look ctl buffer */ + int ti_lookdsize; /* look data buf size */ + int ti_lookcsize; /* look ctl buf size */ + int ti_maxpsz; /* TIDU size */ + long ti_servtype; /* service type */ + int ti_lookflg; /* buffered look flag */ + int ti_state; /* user level state */ + int ti_ocnt; /* # outstanding connect indications */ +}; + +/* Old TI interface user level structure - needed for compatibility */ + +struct _oldti_user { + ushort ti_flags; /* flags */ + int ti_rcvsize; /* rcv buffer size */ + char *ti_rcvbuf; /* rcv buffer */ + int ti_ctlsize; /* ctl buffer size */ + char *ti_ctlbuf; /* ctl buffer */ + char *ti_lookdbuf; /* look data buffer */ + char *ti_lookcbuf; /* look ctl buffer */ + int ti_lookdsize; /* look data buf size */ + int ti_lookcsize; /* look ctl buf size */ + int ti_maxpsz; /* TIDU size */ + long ti_servtype; /* service type */ + int ti_lookflg; /* buffered look flag */ +}; + + +/* This should be replaced */ +#define OPENFILES ulimit(4, 0) + +extern long ulimit(); + +/* + * Routine to be used by transport providers to process + * TI_GETMYNAME and TI_GETPEERNAME ioctls. + */ +extern int ti_doname(); + +/* + * Return values for ti_doname. + */ +#define DONAME_FAIL 0 /* failing ioctl (done) */ +#define DONAME_DONE 1 /* done processing */ +#define DONAME_CONT 2 /* continue proceesing (not done yet)*/ + +#endif /* _SYS_TIMOD_H */ diff --git a/usr/src/uts/3b2/sys/tiuser.h b/usr/src/uts/3b2/sys/tiuser.h new file mode 100644 index 0000000..69b678e --- /dev/null +++ b/usr/src/uts/3b2/sys/tiuser.h @@ -0,0 +1,252 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TIUSER_H +#define _SYS_TIUSER_H + +#ident "@(#)head.sys:sys/tiuser.h 11.5" + +#define _SYS_TIUSER_H + +/* + * The following are the error codes needed by both the kernel + * level transport providers and the user level library. + */ + +#define TBADADDR 1 /* incorrect addr format */ +#define TBADOPT 2 /* incorrect option format */ +#define TACCES 3 /* incorrect permissions */ +#define TBADF 4 /* illegal transport fd */ +#define TNOADDR 5 /* couldn't allocate addr */ +#define TOUTSTATE 6 /* out of state */ +#define TBADSEQ 7 /* bad call sequnce number */ +#define TSYSERR 8 /* system error */ +#define TLOOK 9 /* event requires attention */ +#define TBADDATA 10 /* illegal amount of data */ +#define TBUFOVFLW 11 /* buffer not large enough */ +#define TFLOW 12 /* flow control */ +#define TNODATA 13 /* no data */ +#define TNODIS 14 /* discon_ind not found on q */ +#define TNOUDERR 15 /* unitdata error not found */ +#define TBADFLAG 16 /* bad flags */ +#define TNOREL 17 /* no ord rel found on q */ +#define TNOTSUPPORT 18 /* primitive not supported */ +#define TSTATECHNG 19 /* state is in process of changing */ + +/* + * The following are the events returned by t_look + */ +#define T_LISTEN 0x0001 /* connection indication received */ +#define T_CONNECT 0x0002 /* connect confirmation received */ +#define T_DATA 0x0004 /* normal data received */ +#define T_EXDATA 0x0008 /* expedited data received */ +#define T_DISCONNECT 0x0010 /* disconnect received */ +#define T_ERROR 0x0020 /* fatal error occurred */ +#define T_UDERR 0x0040 /* data gram error indication */ +#define T_ORDREL 0x0080 /* orderly release indication */ +#define T_EVENTS 0x00ff /* event mask */ + +/* + * The following are the flag definitions needed by the + * user level library routines. + */ + +#define T_MORE 0x001 /* more data */ +#define T_EXPEDITED 0x002 /* expedited data */ +#define T_NEGOTIATE 0x004 /* set opts */ +#define T_CHECK 0x008 /* check opts */ +#define T_DEFAULT 0x010 /* get default opts */ +#define T_SUCCESS 0x020 /* successful */ +#define T_FAILURE 0x040 /* failure */ + +/* + * protocol specific service limits + */ + +struct t_info { + long addr; /* size of protocol address */ + long options; /* size of protocol options */ + long tsdu; /* size of max transport service data unit */ + long etsdu; /* size of max expedited tsdu */ + long connect; /* max data for connection primitives */ + long discon; /* max data for disconnect primitives */ + long servtype; /* provider service type */ +}; + +/* + * Service type defines + */ +#define T_COTS 01 /* connection oriented transport service */ +#define T_COTS_ORD 02 /* connection oriented w/ orderly release */ +#define T_CLTS 03 /* connectionless transport service */ + +/* + * netbuf structure + */ + +struct netbuf { + unsigned int maxlen; + unsigned int len; + char *buf; +}; + +/* + * t_bind - format of the addres and options arguments of bind + */ + +struct t_bind { + struct netbuf addr; + unsigned qlen; +}; + +/* + * options management + */ +struct t_optmgmt { + struct netbuf opt; + long flags; +}; + +/* + * disconnect structure + */ +struct t_discon { + struct netbuf udata; /* user data */ + int reason; /* reason code */ + int sequence; /* sequence number */ +}; + +/* + * call structure + */ +struct t_call { + struct netbuf addr; /* address */ + struct netbuf opt; /* options */ + struct netbuf udata; /* user data */ + int sequence; /* sequence number */ +}; + +/* + * data gram structure + */ +struct t_unitdata { + struct netbuf addr; /* address */ + struct netbuf opt; /* options */ + struct netbuf udata; /* user data */ +}; + +/* + * unitdata error + */ +struct t_uderr { + struct netbuf addr; /* address */ + struct netbuf opt; /* options */ + long error; /* error code */ +}; + +/* + * The following are structure types used when dynamically + * allocating the above structures via t_structalloc(). + */ +#define T_BIND 1 /* struct t_bind */ +#define T_OPTMGMT 2 /* struct t_optmgmt */ +#define T_CALL 3 /* struct t_call */ +#define T_DIS 4 /* struct t_discon */ +#define T_UNITDATA 5 /* struct t_unitdata */ +#define T_UDERROR 6 /* struct t_uderr */ +#define T_INFO 7 /* struct t_info */ + +/* + * The following bits specify which fields of the above + * structures should be allocated by t_structalloc(). + */ +#define T_ADDR 0x01 /* address */ +#define T_OPT 0x02 /* options */ +#define T_UDATA 0x04 /* user data */ +#define T_ALL 0x07 /* all the above */ + + +/* + * the following are the states for the user + */ + +#define T_UNINIT 0 /* uninitialized */ +#define T_UNBND 1 /* unbound */ +#define T_IDLE 2 /* idle */ +#define T_OUTCON 3 /* outgoing connection pending */ +#define T_INCON 4 /* incoming connection pending */ +#define T_DATAXFER 5 /* data transfer */ +#define T_OUTREL 6 /* outgoing release pending */ +#define T_INREL 7 /* incoming release pending */ +#define T_FAKE 8 /* fake state used when state */ + /* cannot be determined */ +#define T_HACK 12 /* needed to maintain compatibility !!! + * (used by switch statement in + * t_getstate.c) + * DO NOT REMOVE UNTIL _spec FILE + * REORDERED!!!! + */ + +#define T_NOSTATES 9 + + +#define ROUNDUP(X) ((X + 0x03)&~0x03) + +/* + * The following are TLI user level events which cause + * state changes. + */ + +#define T_OPEN 0 +#define T_BIND 1 +#define T_OPTMGMT 2 +#define T_UNBIND 3 +#define T_CLOSE 4 +#define T_SNDUDATA 5 +#define T_RCVUDATA 6 +#define T_RCVUDERR 7 +#define T_CONNECT1 8 +#define T_CONNECT2 9 +#define T_RCVCONNECT 10 +#define T_LISTN 11 +#define T_ACCEPT1 12 +#define T_ACCEPT2 13 +#define T_ACCEPT3 14 +#define T_SND 15 +#define T_RCV 16 +#define T_SNDDIS1 17 +#define T_SNDDIS2 18 +#define T_RCVDIS1 19 +#define T_RCVDIS2 20 +#define T_RCVDIS3 21 +#define T_SNDREL 22 +#define T_RCVREL 23 +#define T_PASSCON 24 + +#define T_NOEVENTS 25 + +#define nvs 127 /* not a valid state change */ + +extern char tiusr_statetbl[T_NOEVENTS][T_NOSTATES]; + +/* macro to change state */ +/* TLI_NEXTSTATE(event, current state) */ +#define TLI_NEXTSTATE(X,Y) tiusr_statetbl[X][Y] + +/* + * Flags for t_getname. + */ +#define LOCALNAME 0 +#define REMOTENAME 1 + +/* + * Band definitions for data flow. + */ +#define TI_NORMAL 0 +#define TI_EXPEDITED 1 + +#endif /* _SYS_TIUSER_H */ diff --git a/usr/src/uts/3b2/sys/todc.h b/usr/src/uts/3b2/sys/todc.h new file mode 100644 index 0000000..faf0b0c --- /dev/null +++ b/usr/src/uts/3b2/sys/todc.h @@ -0,0 +1,59 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TODC_H +#define _SYS_TODC_H + +#ident "@(#)head.sys:sys/todc.h 11.3" +/* Time of Day Clock */ + +struct clkseg { + int :28; unsigned units:4; + int :28; unsigned tens:4; + }; + +struct clock { + int :28; unsigned test:4; + int :28; unsigned tenths:4; + struct clkseg secs; + struct clkseg mins; + struct clkseg hours; + struct clkseg days; + int :28; unsigned dayweek:4; + struct clkseg months; + int :28; unsigned years:4; + int :28; unsigned stop_star:4; + int :28; unsigned int_stat:4; +}; + +struct todc { + short htenths; + short hsecs; + short hmins; + short hhours; + short hdays; + short hweekday; + short hmonth; + short hyear; +}; + +#define OTOD 0x00041000L +#define SBDTOD ((struct clock *)OTOD) + +#if defined(__STDC__) + +extern void rtodc(struct todc *); +extern void wtodc(void); + +#else + +extern void rtodc(); +extern void wtodc(); + +#endif + +#endif /* _SYS_TODC_H */ diff --git a/usr/src/uts/3b2/sys/trace.h b/usr/src/uts/3b2/sys/trace.h new file mode 100644 index 0000000..f42380b --- /dev/null +++ b/usr/src/uts/3b2/sys/trace.h @@ -0,0 +1,24 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TRACE_H +#define _SYS_TRACE_H + +#ident "@(#)head.sys:sys/trace.h 11.2" +/* + * Per trace structure + */ +struct trace { + struct clist tr_outq; + short tr_state; + short tr_chbits; + short tr_rcnt; + unsigned char tr_chno; + char tr_ct; +}; + +#endif /* _SYS_TRACE_H */ diff --git a/usr/src/uts/3b2/sys/ts.h b/usr/src/uts/3b2/sys/ts.h new file mode 100644 index 0000000..7bbfe69 --- /dev/null +++ b/usr/src/uts/3b2/sys/ts.h @@ -0,0 +1,55 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TS_H +#define _SYS_TS_H + +#ident "@(#)head.sys:sys/ts.h 1.5" +/* + * time-sharing dispatcher parameter table entry + */ +typedef struct tsdpent { + int ts_globpri; /* global (class independent) priority */ + long ts_quantum; /* time quantum given to procs at this level */ + short ts_tqexp; /* ts_umdpri assigned when proc at this level */ + /* exceeds its time quantum */ + short ts_slpret; /* ts_umdpri assigned when proc at this level */ + /* returns to user mode after sleeping */ + short ts_maxwait; /* bumped to ts_lwait if more than ts_maxwait */ + /* secs elapse before receiving full quantum */ + short ts_lwait; /* ts_umdpri assigned if ts_dispwait exceeds */ + /* ts_maxwait */ +} tsdpent_t; + + +/* + * time-sharing class specific proc structure + */ +typedef struct tsproc { + long ts_timeleft; /* time remaining in procs quantum */ + short ts_cpupri; /* system controlled component of ts_umdpri */ + short ts_uprilim; /* user priority limit */ + short ts_upri; /* user priority */ + short ts_umdpri; /* user mode priority within ts class */ + char ts_nice; /* nice value for compatibility */ + unsigned char ts_flags; /* flags defined below */ + short ts_dispwait; /* number of wall clock seconds since start */ + /* of quantum (not reset upon preemption) */ + struct proc *ts_procp; /* pointer to proc table entry */ + char *ts_pstatp; /* pointer to p_stat */ + int *ts_pprip; /* pointer to p_pri */ + uint *ts_pflagp; /* pointer to p_flag */ + struct tsproc *ts_next; /* link to next tsproc on list */ + struct tsproc *ts_prev; /* link to previous tsproc on list */ +} tsproc_t; + + +/* flags */ +#define TSKPRI 0x01 /* proc at kernel mode priority */ +#define TSBACKQ 0x02 /* proc goes to back of disp q when preempted */ + +#endif /* _SYS_TS_H */ diff --git a/usr/src/uts/3b2/sys/tspriocntl.h b/usr/src/uts/3b2/sys/tspriocntl.h new file mode 100644 index 0000000..4d18880 --- /dev/null +++ b/usr/src/uts/3b2/sys/tspriocntl.h @@ -0,0 +1,44 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TSPRIOCNTL_H +#define _SYS_TSPRIOCNTL_H + +#ident "@(#)head.sys:sys/tspriocntl.h 1.5" +/* + * Time-sharing class specific structures for the priocntl system call. + */ + +typedef struct tsparms { + short ts_uprilim; /* user priority limit */ + short ts_upri; /* user priority */ +} tsparms_t; + + +typedef struct tsinfo { + short ts_maxupri; /* configured limits of user priority range */ +} tsinfo_t; + +#define TS_NOCHANGE -32768 + +/* + * The following is used by the dispadmin(1M) command for + * scheduler administration and is not for general use. + */ + +typedef struct tsadmin { + struct tsdpent *ts_dpents; + short ts_ndpents; + short ts_cmd; +} tsadmin_t; + +#define TS_GETDPSIZE 1 +#define TS_GETDPTBL 2 +#define TS_SETDPTBL 3 + + +#endif /* _SYS_TSPRIOCNTL_H */ diff --git a/usr/src/uts/3b2/sys/ttcompat.h b/usr/src/uts/3b2/sys/ttcompat.h new file mode 100644 index 0000000..6173211 --- /dev/null +++ b/usr/src/uts/3b2/sys/ttcompat.h @@ -0,0 +1,59 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/ttcompat.h 1.1" + +/* + * BSD/XENIX/V7 ttcompat module header file + */ + +/* + * Old-style terminal state. + */ +typedef struct { + int t_flags; /* flags */ + char t_ispeed, t_ospeed; /* speeds */ + char t_erase; /* erase last character */ + char t_kill; /* erase entire line */ + char t_intrc; /* interrupt */ + char t_quitc; /* quit */ + char t_startc; /* start output */ + char t_stopc; /* stop output */ + char t_eofc; /* end-of-file */ + char t_brkc; /* input delimiter (like nl) */ + char t_suspc; /* stop process signal */ + char t_dsuspc; /* delayed stop process signal */ + char t_rprntc; /* reprint line */ + char t_flushc; /* flush output (toggles) */ + char t_werasc; /* word erase */ + char t_lnextc; /* literal next character */ + int t_xflags; /* XXX extended flags */ +} compat_state_t; + +/* + * Per-tty structure. + */ +typedef struct { + mblk_t *t_savbp; + mblk_t *t_iocpending; /* ioctl pending successful allocation */ + compat_state_t t_curstate; /* current emulated state */ + struct sgttyb t_new_sgttyb; /* new sgttyb from TIOCSET[PN] */ + struct tchars t_new_tchars; /* new tchars from TIOCSETC */ + struct ltchars t_new_ltchars; /* new ltchars from TIOCSLTC */ + int t_new_lflags; /* new lflags from TIOCLSET/LBIS/LBIC */ + int t_state; /* state bits */ + int t_iocid; /* ID of "ioctl" we handle specially */ + int t_ioccmd; /* ioctl code for that "ioctl" */ +} ttcompat_state_t; + + +#define TS_FREE 0x00 /* not in use */ +#define TS_INUSE 0x01 /* allocated */ +#define TS_W_IN 0x02 /* waiting for an M_IOCDATA response to an M_COPYIN request */ +#define TS_W_OUT 0x04 /* waiting for an M_IOCDATA response to an M_COPYOUT request */ +#define TS_IOCWAIT 0x08 /* waiting for an M_IOCACK/M_IOCNAK from downstream */ + diff --git a/usr/src/uts/3b2/sys/ttold.h b/usr/src/uts/3b2/sys/ttold.h new file mode 100644 index 0000000..7d834d5 --- /dev/null +++ b/usr/src/uts/3b2/sys/ttold.h @@ -0,0 +1,335 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TTOLD_H +#define _SYS_TTOLD_H + +#ident "@(#)head.sys:sys/ttold.h 11.10" + +/* All the ioctls (BSD, V7, XENIX, S5) defines are in termios.h */ +/* this file has mostly BSD structures and flags */ +/* this also has the contents of SUN/BSD ttychars.h and ttydev.h */ +/* there are some defines that are common between ttold.h and termios.h. */ +/* ttold.h should always follow termios.h so the defines in termios.h have */ +/* precedence over ttold.h */ + +/* BSD special characters. Structure for TIOCSTC/TIOCGTC */ +struct tchars { + char t_intrc; /* interrupt */ + char t_quitc; /* quit */ + char t_startc; /* start output */ + char t_stopc; /* stop output */ + char t_eofc; /* end-of-file */ + char t_brkc; /* input delimiter (like nl) */ +}; + +/* note xenix defines tchars as tc */ +struct tc { + char t_intrc; /* interrupt */ + char t_quitc; /* quit */ + char t_startc; /* start output */ + char t_stopc; /* stop output */ + char t_eofc; /* end-of-file */ + char t_brkc; /* input delimiter (like nl) */ +}; +/* BSD local special chars. Structure for TIOCSLTC/TIOCGLTC */ +struct ltchars { + char t_suspc; /* stop process signal */ + char t_dsuspc; /* delayed stop process signal */ + char t_rprntc; /* reprint line */ + char t_flushc; /* flush output (toggles) */ + char t_werasc; /* word erase */ + char t_lnextc; /* literal next character */ +}; + +/* + * Structure for TIOCGETP and TIOCSETP ioctls. + */ + +#ifndef _SGTTY_H +/* sg_flags value changed from short (in SUN/BSD) to int in System V to */ +/* match sgtty.h definition */ +struct sgttyb { + char sg_ispeed; /* input speed */ + char sg_ospeed; /* output speed */ + char sg_erase; /* erase character */ + char sg_kill; /* kill character */ + int sg_flags; /* mode flags */ +}; +#endif /* _SGTTY_H */ + +/* + * 4.3BSD/XENIX tty ioctl commands that are either: + * 1) deprecated + * 2) not implemented (and never were implemented) + * 3) implemented on top of new-style "ioctl"s. + */ + +/* + * These ioctls are also defined in termios.h. + * because XENIX expects to see them in termio.h + */ + +#ifndef tIOC +#define tIOC ('t'<<8) +#endif + +#ifndef _SYS_TERMIOS_H +/* defined in termios.h also so that all the ioctl codes are visible*/ + +#define TIOCGETD (tIOC|0) +#define TIOCSETD (tIOC|1) +#ifndef _SGTTY_H +#define TIOCHPCL (tIOC|2) +#define TIOCGETP (tIOC|8) +#define TIOCSETP (tIOC|9) +#endif /* _SGTTY_H */ +#define TIOCSETN (tIOC|10) +#ifndef _SGTTY_H +#define TIOCEXCL (tIOC|13) +#define TIOCNXCL (tIOC|14) +#endif /* _SGTTY_H */ +#define TIOCFLUSH (tIOC|16) +#define TIOCSETC (tIOC|17) +#define TIOCGETC (tIOC|18) + +/* BSD ioctls that are not the same as XENIX */ +#define TIOCLBIS (tIOC|127) /* bis local mode bits */ +#define TIOCLBIC (tIOC|126) /* bic local mode bits */ +#define TIOCLSET (tIOC|125) /* set entire local mode word */ +#define TIOCLGET (tIOC|124) /* get local modes */ +#define TIOCSBRK (tIOC|123) /* set break bit */ +#define TIOCCBRK (tIOC|122) /* clear break bit */ +#define TIOCSDTR (tIOC|121) /* set data terminal ready */ +#define TIOCCDTR (tIOC|120) /* clear data terminal ready */ +#define TIOCSLTC (tIOC|117) /* set local special chars */ +#define TIOCGLTC (tIOC|116) /* get local special chars */ +#define TIOCNOTTY (tIOC|113) /* void tty association */ +#define TIOCSTOP (tIOC|111) /* stop output, like ^S */ +#define TIOCSTART (tIOC|110) /* start output, like ^Q */ + +#define TIOCREMOTE (tIOC|30) /* remote input editing */ + +/* windowing ioctls and structure also defined in termios.h */ + +#define TIOC ('T'<<8) + +#define TIOCGWINSZ (TIOC|104) +#define TIOCSWINSZ (TIOC|103) + +/* Windowing structure to support TIOCSWINSZ/TIOCGWINSZ */ +struct winsize { + unsigned short ws_row; /* rows, in characters*/ + unsigned short ws_col; /* columns, in character */ + unsigned short ws_xpixel; /* horizontal size, pixels */ + unsigned short ws_ypixel; /* vertical size, pixels */ +}; + + +#endif /* end _SYS_TERMIOS_H */ + +/* Old SVR3.0 flags - should be removed if there is no problem */ +/* note they are commented out */ + +#if 0 + +#define O_HUPCL 01 +#define O_XTABS 02 +#define O_LCASE 04 /* simulate lower case */ +#define O_ECHO 010 /* echo input */ +#define O_CRMOD 020 /* map \r to \r\n on output */ +#define O_RAW 040 /* no i/o processing */ +#define O_ODDP 0100 /* get/send odd parity */ +#define O_EVENP 0200 /* get/send even parity */ +#define O_NLDELAY 001400 /* \n delay */ +#define O_NL1 000400 +#define O_NL2 001000 +#define O_TBDELAY 002000 /* horizontal tab delay */ +#define O_NOAL 004000 +#define O_CRDELAY 030000 /* \r delay */ +#define O_CR1 010000 +#define O_CR2 020000 +#define O_VTDELAY 040000 /* vertical tab delay */ +#define O_BSDELAY 0100000 /* \b delay */ + +#endif + +/* 4.3 BSD additions. These are new codes and some of the + * flags that were there in SVR3.2 ttold.h have been given + * new codes. Otherwise they will not fit in a word. + */ + +#define O_TANDEM 0x00000001 /* send stopc on out q full */ +#define O_CBREAK 0x00000002 /* half-cooked mode */ +#define O_LCASE 0x00000004 /* simulate lower case */ +#define O_ECHO 0x00000008 /* echo input */ +#define O_CRMOD 0x00000010 /* map \r to \r\n on output */ +#define O_RAW 0x00000020 /* no i/o processing */ +#define O_ODDP 0x00000040 /* get/send odd parity */ +#define O_EVENP 0x00000080 /* get/send even parity */ +#define O_ANYP 0x000000c0 /* get any parity/send none */ +#define O_NLDELAY 0x00000300 /* \n delay */ +#define O_NL0 0x00000000 +#define O_NL1 0x00000100 /* tty 37 */ +#define O_NL2 0x00000200 /* vt05 */ +#define O_NL3 0x00000300 +#define O_TBDELAY 0x00000c00 /* horizontal tab delay */ +#define O_TAB0 0x00000000 +#define O_TAB1 0x00000400 /* tty 37 */ +#define O_TAB2 0x00000800 +#define O_XTABS 0x00000c00 /* expand tabs on output */ +#define O_CRDELAY 0x00003000 /* \r delay */ +#define O_CR0 0x00000000 +#define O_CR1 0x00001000 /* tn 300 */ +#define O_CR2 0x00002000 /* tty 37 */ +#define O_CR3 0x00003000 /* concept 100 */ +#define O_VTDELAY 0x00004000 /* vertical tab delay */ +#define O_FF0 0x00000000 +#define O_FF1 0x00004000 /* tty 37 */ +#define O_BSDELAY 0x00008000 /* \b delay */ +#define O_BS0 0x00000000 +#define O_BS1 0x00008000 +#define O_ALLDELAY (O_NLDELAY|O_TBDELAY|O_CRDELAY|O_VTDELAY|O_BSDELAY) +#define O_CRTBS 0x00010000 /* do backspacing for crt */ +#define O_PRTERA 0x00020000 /* \ ... / erase */ +#define O_CRTERA 0x00040000 /* " \b " to wipe out char */ +#define O_TILDE 0x00080000 /* hazeltine tilde kludge */ +#define O_MDMBUF 0x00100000 /* start/stop output on carrier intr */ +#define O_LITOUT 0x00200000 /* literal output */ +#define O_TOSTOP 0x00400000 /* SIGSTOP on background output */ +#define O_FLUSHO 0x00800000 /* flush output to terminal */ +#define O_NOHANG 0x01000000 /* no SIGHUP on carrier drop */ +#define O_L001000 0x02000000 +#define O_CRTKIL 0x04000000 /* kill line with " \b " */ +#define O_PASS8 0x08000000 +#define O_CTLECH 0x10000000 /* echo control chars as ^X */ +#define O_PENDIN 0x20000000 /* tp->t_rawq needs reread */ +#define O_DECCTQ 0x40000000 /* only ^Q starts after ^S */ +#define O_NOFLSH 0x80000000 /* no output flush on signal */ + +/* more BSD flags */ +#define LCRTBS (O_CRTBS>>16) +#define LPRTERA (O_PRTERA>>16) +#define LCRTERA (O_CRTERA>>16) +#define LTILDE (O_TILDE>>16) +#define LMDMBUF (O_MDMBUF>>16) +#define LLITOUT (O_LITOUT>>16) +#define LTOSTOP (O_TOSTOP>>16) +#define LFLUSHO (O_FLUSHO>>16) +#define LNOHANG (O_NOHANG>>16) +#define LCRTKIL (O_CRTKIL>>16) +#define LPASS8 (O_PASS8>>16) +#define LCTLECH (O_CTLECH>>16) +#define LPENDIN (O_PENDIN>>16) +#define LDECCTQ (O_DECCTQ>>16) +#define LNOFLSH (O_NOFLSH>>16) + + +#define NOPOST 0x00000001 /* no processing on output (LITOUT with 7 bits + parity) */ +#define NOISIG 0x00000002 /* disable all signal-generating characters */ +#define STOPB 0x00000004 /* two stop bits */ + +#define OTTYDISC 0 /* old, v7 std tty driver */ +#define NETLDISC 1 /* line discip for berk net */ +#define NTTYDISC 2 /* new tty discipline */ +#define TABLDISC 3 /* hitachi tablet discipline */ +#define NTABLDISC 4 /* gtco tablet discipline */ +#define MOUSELDISC 5 /* mouse discipline */ +#define KBDLDISC 6 /* up/down keyboard trans (console) */ + +/* + * contents from SUN/BSD ttychars.h + * User visible structures and constants + * related to terminal handling. + */ +struct ttychars { + char tc_erase; /* erase last character */ + char tc_kill; /* erase entire line */ + char tc_intrc; /* interrupt */ + char tc_quitc; /* quit */ + char tc_startc; /* start output */ + char tc_stopc; /* stop output */ + char tc_eofc; /* end-of-file */ + char tc_brkc; /* input delimiter (like nl) */ + char tc_suspc; /* stop process signal */ + char tc_dsuspc; /* delayed stop process signal */ + char tc_rprntc; /* reprint line */ + char tc_flushc; /* flush output (toggles) */ + char tc_werasc; /* word erase */ + char tc_lnextc; /* literal next character */ +}; + +#ifndef _SYS_TERMIOS_H + +#define CTRL(c) ((c)&037) + +/* default BSD special characters */ +#define CERASE 0177 +#define CKILL CTRL('u') +#define CINTR CTRL('c') +#define CQUIT 034 /* FS, ^\ */ +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CEOF CTRL('d') +#define CEOT CEOF +#define CBRK 0377 +#define CSUSP CTRL('z') +#define CDSUSP CTRL('y') +#define CRPRNT CTRL('r') +#define CFLUSH CTRL('o') +#define CWERASE CTRL('w') +#define CLNEXT CTRL('v') + + +/* + * Contents from SUN/BSD ttydev.h. + * Terminal definitions related to underlying hardware. + */ + +/* + * Speeds + */ +#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 +#define EXTA 14 +#define EXTB 15 + +#endif /* end _SYS_TERMIOS_H */ + +#if 0 +/* + * Hardware bits. + * SHOULD NOT BE HERE. + */ +#define DONE 0200 +#define IENABLE 0100 + +/* + * Modem control commands. + */ +#define DMSET 0 +#define DMBIS 1 +#define DMBIC 2 +#define DMGET 3 + +#endif /* end if 0 comment */ + +#endif /* _SYS_TTOLD_H */ diff --git a/usr/src/uts/3b2/sys/tty.h b/usr/src/uts/3b2/sys/tty.h new file mode 100644 index 0000000..4979288 --- /dev/null +++ b/usr/src/uts/3b2/sys/tty.h @@ -0,0 +1,179 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TTY_H +#define _SYS_TTY_H + +#ident "@(#)head.sys:sys/tty.h 11.4" +/* + * A clist structure is the head of a linked list queue of characters. + * The routines getc* and putc* manipulate these structures. + */ + +struct clist { + int c_cc; /* character count */ + struct cblock *c_cf; /* pointer to first */ + struct cblock *c_cl; /* pointer to last */ +}; + +/* Macro to find clist structure given pointer into it */ +#define CMATCH(pointer) (char *)(cfree + (pointer - cfree)) + +/* Character control block for interrupt level control */ + +struct ccblock { + caddr_t c_ptr; /* buffer address */ + ushort c_count; /* character count */ + ushort c_size; /* buffer size */ +}; + +/* + * A tty structure is needed for each UNIX character device that + * is used for normal terminal IO. + */ +#define NCC 8 +struct tty { + struct clist t_rawq; /* raw input queue */ + struct clist t_canq; /* canonical queue */ + struct clist t_outq; /* output queue */ + struct ccblock t_tbuf; /* tx control block */ + struct ccblock t_rbuf; /* rx control block */ + int (* t_proc)(); /* routine for device functions */ + ushort t_iflag; /* input modes */ + ushort t_oflag; /* output modes */ + ushort t_cflag; /* control modes */ + ushort t_lflag; /* line discipline modes */ + short t_state; /* internal state */ + o_pid_t t_pgrp; /* process group name */ + char t_line; /* line discipline */ + char t_delct; /* delimiter count */ + char t_term; /* terminal type */ + char t_tmflag; /* terminal flags */ + char t_col; /* current column */ + char t_row; /* current row */ + char t_vrow; /* variable row */ + char t_lrow; /* last physical row */ + char t_hqcnt; /* no. high queue packets on t_outq */ + char t_dstat; /* used by terminal handlers + and line disciplines */ + unsigned char t_cc[NCC]; /* settable control chars */ +}; + +/* + * The structure of a clist block + */ +#define CLSIZE 64 +struct cblock { + struct cblock *c_next; + char c_first; + char c_last; + char c_data[CLSIZE]; +}; + +extern struct cblock *cfree; +extern struct cblock *getcb(); +extern struct cblock *getcf(); +extern struct clist ttnulq; +extern int cfreecnt; + +struct chead { + struct cblock *c_next; + int c_size; + int c_flag; +}; +extern struct chead cfreelist; + +struct inter { + int cnt; +}; + +#define QESC 0200 /* queue escape */ +#define HQEND 01 /* high queue end */ + +#define TTIPRI 28 +#define TTOPRI 29 + +#ifdef u3b15 +/* following defs allow for job control in both vpm and stand-alone + tty environments */ +#define VPMTTY 1 +#define SATTY 2 +#endif + +/* limits */ +extern int ttlowat[], tthiwat[]; +#define TTYHOG 256 +#define TTXOLO 132 +#define TTXOHI 180 + +/* Hardware bits */ +#define DONE 0200 +#define IENABLE 0100 +#define OVERRUN 040000 +#define FRERROR 020000 +#define PERROR 010000 + +/* Internal state */ +#define TIMEOUT 01 /* Delay timeout in progress */ +#define WOPEN 02 /* Waiting for open to complete */ +#define ISOPEN 04 /* Device is open */ +#define TBLOCK 010 +#define CARR_ON 020 /* Software copy of carrier-present */ +#define BUSY 040 /* Output in progress */ +#define OASLP 0100 /* Wakeup when output done */ +#define IASLP 0200 /* Wakeup when input done */ +#define TTSTOP 0400 /* Output stopped by ctl-s */ +#define EXTPROC 01000 /* External processing */ +#define TACT 02000 +#define CLESC 04000 /* Last char escape */ +#define RTO 010000 /* Raw Timeout */ +#define TTIOW 020000 +#define TTXON 040000 +#define TTXOFF 0100000 + +/* l_output status */ +#define CPRES 0100000 + +/* device commands */ +#define T_OUTPUT 0 +#define T_TIME 1 +#define T_SUSPEND 2 +#define T_RESUME 3 +#define T_BLOCK 4 +#define T_UNBLOCK 5 +#define T_RFLUSH 6 +#define T_WFLUSH 7 +#define T_BREAK 8 +#define T_INPUT 9 +#define T_DISCONNECT 10 +#define T_PARM 11 +#define T_SWTCH 12 + +/* + * Terminal flags (set in t_tmflgs). + */ + +#define SNL 1 /* non-standard new-line needed */ +#define ANL 2 /* automatic new-line */ +#define LCF 4 /* Special treatment of last col, row */ +#define TERM_CTLECHO 010 /* Echo terminal control characters */ +#define TERM_INVIS 020 /* do not send escape sequences to user */ +#define QLOCKB 040 /* high queue locked for base level */ +#define QLOCKI 0100 /* high queue locked for interrupts */ +#define TERM_BIT 0200 /* Bit reserved for terminal drivers. */ + /* Usually used to indicate that an esc*/ + /* character has arrived and that the */ + /* next character is special. */ + /* This bit is the same as the TM_SET */ + /* bit which may never be set by a user*/ +/* + * device reports + */ +#define L_BUF 0 +#define L_BREAK 3 + +#endif /* _SYS_TTY_H */ diff --git a/usr/src/uts/3b2/sys/tuneable.h b/usr/src/uts/3b2/sys/tuneable.h new file mode 100644 index 0000000..739deaf --- /dev/null +++ b/usr/src/uts/3b2/sys/tuneable.h @@ -0,0 +1,40 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TUNEABLE_H +#define _SYS_TUNEABLE_H + +#ident "@(#)head.sys:sys/tuneable.h 11.5" + +typedef struct tune { + int t_gpgslo; /* If freemem < t_getpgslow, then start */ + /* to steal pages from processes. */ + int t_gpgshi; /* Once we start to steal pages, don't */ + /* stop until freemem > t_getpgshi. */ + int t_pad[5]; /* Padding for driver compatibility. */ + int t_maxumem; /* The maximum size of a user's virtual */ + /* address space in pages. */ + int t_fsflushr; /* The rate at which fsflush is run in */ + /* seconds. */ + int t_minarmem; /* The minimum available resident (not */ + /* swapable) memory to maintain in */ + /* order to avoid deadlock. In pages. */ + int t_minasmem; /* The minimum available swapable */ + /* memory to maintain in order to avoid */ + /* deadlock. In pages. */ +} tune_t; + +extern tune_t tune; + +/* The following is the default value for t_gpgsmsk. It cannot be + * defined in /etc/master or /stand/system due to limitations of the + * config program. + */ + +#define GETPGSMSK PG_REF|PG_NDREF + +#endif /* _SYS_TUNEABLE_H */ diff --git a/usr/src/uts/3b2/sys/types.h b/usr/src/uts/3b2/sys/types.h new file mode 100644 index 0000000..0c0395f --- /dev/null +++ b/usr/src/uts/3b2/sys/types.h @@ -0,0 +1,188 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#ident "@(#)head.sys:sys/types.h 11.29" + +typedef struct { int r[1]; } * physadr; +typedef long daddr_t; /* type */ +typedef char * caddr_t; /* ? type */ +typedef unsigned char unchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef short cnt_t; /* ? type */ + +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; /* time of day in seconds */ +#endif /* END _TIME_T */ + + +typedef struct _label { int val[10]; } label_t; +typedef long off_t; /* ? type */ +typedef unsigned long paddr_t; /* type */ +typedef int key_t; /* IPC key type */ +typedef unsigned char use_t; /* use count for swap. */ +typedef short sysid_t; +typedef short index_t; +typedef short lock_t; /* lock work for busy wait */ +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; /* len param for string funcs */ +#endif + +typedef enum boolean { B_FALSE, B_TRUE } boolean_t; + +/* + * The following types are for various kinds of identifiers. The + * actual type must be the same for all since some system calls + * (such as sigsend) take arguments that may be any of these + * types. The enumeration type idtype_t defined in sys/procset.h + * is used to indicate what type of id is being specified. + */ + +typedef long id_t; /* A process id, */ + /* process group id, */ + /* session id, */ + /* scheduling class id, */ + /* user id, or group id.*/ + +/* POSIX typedefs already large */ + +typedef ulong mode_t; /* file attribute type */ +typedef long uid_t; /* UID type */ +typedef uid_t gid_t; /* GID type */ +typedef ulong nlink_t; /* file link type */ +typedef ulong dev_t; /* expanded device type */ +typedef ulong ino_t; /* expanded inode type */ +typedef id_t pid_t; /* process id type */ + + +/* SVR4.0 typedefs */ +typedef ulong major_t; /* major part of device number */ +typedef ulong minor_t; /* minor part of device number */ + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; /* relative time in a specified resolution */ +#endif /* ifndef _CLOCK_T */ + +/* + * For compatilbility reasons the following typedefs (prefixed o_) + * can't grow regardless of the EFT definition. Although, + * applications should not explicitly use these typedefs + * they may be included via a system header definition. + * WARNING: These typedefs may be removed in a future + * release. + * ex. the definitions in s5inode.h remain small + * to preserve compatibility in the S5 + * file system type. + */ +typedef ushort o_mode_t; /* old file attribute type */ +typedef short o_dev_t; /* old device type */ +typedef ushort o_uid_t; /* old UID type */ +typedef o_uid_t o_gid_t; /* old GID type */ +typedef short o_nlink_t; /* old file link type */ +typedef short o_pid_t; /* old process id type */ /* DDD used by shm.h */ +typedef ushort o_ino_t; /* old inode type */ + + + +#if defined(_KERNEL) + +#define SHRT_MIN -32768 /* min value of a "short int" */ +#define SHRT_MAX 32767 /* max value of a "short int" */ +#define USHRT_MAX 65535 /* max value of an "unsigned short int" */ +#define INT_MIN (-2147483647-1) /* min value of an "int" */ +#define INT_MAX 2147483647 /* max value of an "int" */ +#define UINT_MAX 4294967295 /* max value of an "unsigned int" */ +#define LONG_MIN (-2147483647-1) /* min value of a "long int" */ +#define LONG_MAX 2147483647 /* max value of a "long int" */ +#define ULONG_MAX 4294967295 /* max value of an "unsigned long int" */ + +#endif /* defined(_KERNEL) */ + + +#define P_MYPID ((pid_t)0) + +/* + * The following is the value of type id_t to use to indicate the + * caller's current id. See procset.h for the type idtype_t + * which defines which kind of id is being specified. + */ + +#define P_MYID (-1) +#define NOPID (pid_t)(-1) + +#ifndef NODEV +#define NODEV (dev_t)(-1) +#endif + +/* + * A host identifier is used to uniquely define a particular node + * on an rfs network. Its type is as follows. + */ + +typedef long hostid_t; + +/* + * The following value of type hostid_t is used to indicate the + * current host. The actual hostid for each host is in the + * kernel global variable rfs_hostid. + */ + +#define P_MYHOSTID (-1) + +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef struct _quad { long val[2]; } quad; /* used by UFS */ +typedef char * addr_t; /* ? type */ + +typedef unsigned long k_sigset_t; /* kernel signal set type */ +typedef unsigned long k_fltset_t; /* kernel fault set type */ + +/* + * These were added to allow non-ANSI compilers to compile the system. + */ + +#ifdef __STDC__ + +#ifndef _VOID +#define _VOID void +#endif + + /* End of ANSI section */ + +#else + +#ifndef _VOID +#define _VOID char +#endif + +#ifndef const +#define const +#endif + +#ifndef volatile +#define volatile +#endif + +#endif /* of non-ANSI section */ + +/* + * Nested include for BSD/sockets source compatibility. + * (The select macros used to be defined here). + */ +#include "sys/select.h" + + +#endif /* _SYS_TYPES_H */ diff --git a/usr/src/uts/3b2/sys/uadmin.h b/usr/src/uts/3b2/sys/uadmin.h new file mode 100644 index 0000000..5c31714 --- /dev/null +++ b/usr/src/uts/3b2/sys/uadmin.h @@ -0,0 +1,26 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_UADMIN_H +#define _SYS_UADMIN_H + +#ident "@(#)head.sys:sys/uadmin.h 11.7" + +#define A_REBOOT 1 +#define A_SHUTDOWN 2 +#define A_REMOUNT 4 +#define A_SWAPCTL 16 + +#define AD_HALT 0 +#define AD_BOOT 1 +#define AD_IBOOT 2 + +#if defined(__STDC__) && !defined(_KERNEL) +int uadmin(int, int, int); +#endif + +#endif /* _SYS_UADMIN_H */ diff --git a/usr/src/uts/3b2/sys/ucontext.h b/usr/src/uts/3b2/sys/ucontext.h new file mode 100644 index 0000000..da43bd0 --- /dev/null +++ b/usr/src/uts/3b2/sys/ucontext.h @@ -0,0 +1,65 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/ucontext.h 1.9" + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H + +#include "sys/types.h" +#include "sys/regset.h" +#include "sys/signal.h" + +typedef struct { + gregset_t gregs; /* general register set */ + fpregset_t fpregs; /* floating point register set */ +} mcontext_t; + +typedef struct ucontext { + u_long uc_flags; + struct ucontext *uc_link; + sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long uc_filler[23]; +} ucontext_t; + +#define GETCONTEXT 0 +#define SETCONTEXT 1 + +/* + * values for uc_flags + * these are implementation dependent flags, that should be hidden + * from the user interface, defining which elements of ucontext + * are valid, and should be restored on call to setcontext + */ + +#define UC_SIGMASK 001 +#define UC_STACK 002 +#define UC_CPU 004 +#define UC_MAU 010 + +#define UC_MCONTEXT (UC_CPU|UC_MAU) + +/* + * UC_ALL specifies the default context + */ + +#define UC_ALL (UC_SIGMASK|UC_STACK|UC_MCONTEXT) + +#ifdef _KERNEL + +#if defined(__STDC__) +void savecontext(ucontext_t *, k_sigset_t); +void restorecontext(ucontext_t *); +#else +void savecontext(); +void restorecontext(); +#endif + +#endif +#endif /* _SYS_UCONTEXT_H */ diff --git a/usr/src/uts/3b2/sys/uio.h b/usr/src/uts/3b2/sys/uio.h new file mode 100644 index 0000000..4938584 --- /dev/null +++ b/usr/src/uts/3b2/sys/uio.h @@ -0,0 +1,51 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_UIO_H +#define _SYS_UIO_H + +#ident "@(#)head.sys:sys/uio.h 1.6" + +/* + * I/O parameter information. A uio structure describes the I/O which + * is to be performed by an operation. Typically the data movement will + * be performed by a routine such as uiomove(), which updates the uio + * structure to reflect what was done. + */ + +typedef struct iovec { + caddr_t iov_base; + int iov_len; +} iovec_t; + +typedef struct uio { + iovec_t *uio_iov; /* pointer to array of iovecs */ + int uio_iovcnt; /* number of iovecs */ + off_t uio_offset; /* file offset */ + short uio_segflg; /* address space (kernel or user) */ + short uio_fmode; /* file mode flags */ + daddr_t uio_limit; /* u-limit (maximum "block" offset) */ + int uio_resid; /* residual count */ +} uio_t; + +/* + * I/O direction. + */ +typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t; + +/* + * Segment flag values. + */ +typedef enum uio_seg { UIO_USERSPACE, UIO_SYSSPACE, UIO_USERISPACE } uio_seg_t; + +int uiomove(); +int ureadc(); /* should be errno_t in future */ +int uwritec(); +int uiomvuio(); +void uioskip(); + +#endif /* _SYS_UIO_H */ diff --git a/usr/src/uts/3b2/sys/ulimit.h b/usr/src/uts/3b2/sys/ulimit.h new file mode 100644 index 0000000..6e5dc83 --- /dev/null +++ b/usr/src/uts/3b2/sys/ulimit.h @@ -0,0 +1,45 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +/* Copyright (c) 1987, 1988 Microsoft Corporation */ +/* All Rights Reserved */ + +/* This Module contains Proprietary Information of Microsoft */ +/* Corporation and should be treated as Confidential. */ + +#ident "@(#)head.sys:sys/ulimit.h 1.3" + +/* + * @(#) ulimit.h 1.2 88/05/04 head.sys:ulimit.h + */ + +/* + * THIS FILE CONTAINS CODE WHICH IS DESIGNED TO BE + * PORTABLE BETWEEN DIFFERENT MACHINE ARCHITECTURES + * AND CONFIGURATIONS. IT SHOULD NOT REQUIRE ANY + * MODIFICATIONS WHEN ADAPTING XENIX TO NEW HARDWARE. + */ + +/* + * The following are codes which can be + * passed to the ulimit system call. (Xenix compatible.) + */ + +#define UL_GFILLIM 1 /* get file limit */ +#define UL_SFILLIM 2 /* set file limit */ +#define UL_GMEMLIM 3 /* get process size limit */ +#define UL_GDESLIM 4 /* get file descriptor limit */ +#define UL_GTXTOFF 64 /* get text offset */ + +/* + * The following are symbolic constants required for + * X/Open Conformance. They are the equivalents of + * the constants above. + */ + +#define UL_GETFSIZE UL_GFILLIM /* get file limit */ +#define UL_SETFSIZE UL_SFILLIM /* set file limit */ diff --git a/usr/src/uts/3b2/sys/un.h b/usr/src/uts/3b2/sys/un.h new file mode 100644 index 0000000..6a8255a --- /dev/null +++ b/usr/src/uts/3b2/sys/un.h @@ -0,0 +1,48 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_UN_H +#define _SYS_UN_H + +#ident "@(#)head.sys:sys/un.h 1.2" + +/* + * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * PROPRIETARY NOTICE (Combined) + * + * This source code is unpublished proprietary information + * constituting, or derived under license from AT&T's UNIX(r) System V. + * In addition, portions of such source code were derived from Berkeley + * 4.3 BSD under license from the Regents of the University of + * California. + * + * + * + * Copyright Notice + * + * Notice of copyright on this source code product does not indicate + * publication. + * + * (c) 1986,1987,1988.1989 Sun Microsystems, Inc + * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * All rights reserved. + * + */ + +/* + * Definitions for UNIX IPC domain. + */ +struct sockaddr_un { + short sun_family; /* AF_UNIX */ + char sun_path[108]; /* path name (gag) */ +}; + +#ifdef KERNEL +int unp_discard(); +#endif + +#endif /* _SYS_UN_H */ diff --git a/usr/src/uts/3b2/sys/user.h b/usr/src/uts/3b2/sys/user.h new file mode 100644 index 0000000..9ca9361 --- /dev/null +++ b/usr/src/uts/3b2/sys/user.h @@ -0,0 +1,355 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H + +#ident "@(#)head.sys:sys/user.h 11.40" + +#include "sys/proc.h" +#include "sys/signal.h" +#include "sys/siginfo.h" +#include "sys/psw.h" +#include "sys/pcb.h" +#include "sys/mau.h" +#include "sys/resource.h" + +/* + * The user structure; one allocated per process. Contains all the + * per-process data that doesn't need to be referenced while the + * process is swapped. + * + * The user block is USIZE*click bytes long; resides at virtual kernel + * address 0xC0000000 on the 3B2; contains the system stack per user; + * is cross referenced with the proc structure for the same process. + * + * NOTE -- NOTE + * + * WHEN THIS HEADER CHANGES, BOTH ml/misc.s AND ml/ttrap.s MUST BE + * EXAMINED FOR ANY DEPENDENCIES UPON OFFSETS WITHIN THE UBLOCK. + * IN PARTICULAR - .SET's ARE DONE ON: + * u_iop, + * u_pcb, + * u_kpcb, + * u_pcbp, + * u_stack, + * u_flist, + * u_tracepc, + * u_caddrflt, + * u_sigevpend, + * pr_base, + * pr_size, + * pr_off, and + * pr_scale + * + ********************************************************************** + * + */ + +/* + * User file descriptors are allocate dynamically, in multiples + * of NFPCHUNK. WARNING: ml/misc.s:vstart_s knows about the + * size of struct ufchunk. If this changes, or in NFPCHUNK is + * changed, remember to update misc.s. + */ + +#define NFPCHUNK 24 + +struct ufchunk { + struct file *uf_ofile[NFPCHUNK]; + char uf_pofile[NFPCHUNK]; + struct ufchunk *uf_next; +}; + +#define UF_FDLOCK 0x2 /* file descriptor locked (SysV-style) */ + +#define MAXSYSARGS 8 /* Maximum # of arguments passed to a syscall */ +#define PSARGSZ 80 /* Space for exec arguments (used by ps(1)) */ + +#define PSCOMSIZ 14 + +typedef struct { /* kernel syscall set type */ + long word[16]; +} k_sysset_t; + +/* flags for u_sigflag field */ +#define SOMASK 0x001 /* use u_sigoldmask on return from signal */ + +typedef struct user { + struct ipcb u_ipcb; + + pcb_t u_pcb; /* pcb, save area when switching */ + + struct pcb *u_pcbp; /* %pcbp while not running */ + struct kpcb u_kpcb; /* kernel per-process pcb */ + int u_r0tmp; /* user %r0 during CALLPS */ +#ifdef DEBUG + long u_aoutstamp; + char u_filler1[36]; +#else + char u_filler1[40]; +#endif + long u_spop; /* support processor being used */ + mau_t u_mau; + + /* + * Pointer to function to handle user-space external + * memory faults encountered in the kernel. + */ + int u_caddrflt; + + /* + * Number of shared-memory segments currently attached. + */ + char u_nshmseg; + + /* + * Flag to indicate there is a signal or event pending to + * the current process. Used to make a quick check just + * prior to return from kernel to user mode. + */ + char u_sigevpend; + + char u_filler2[34]; /* Padding */ + + /* + * The following for RFS. u_srchan is needed because ioctls on + * the server can hit RF_SERVER() hooks in copyin and copyout, + * and rcopying/rcopyout need the implicit parameter. + */ + ushort rfs_pad0; + ushort rfs_pad1; + int u_syscall; /* system call number */ + struct sndd *u_srchan; /* server channel back to client */ + long rfs_pad2; + + long u_bsize; /* block size of device */ + char u_psargs[PSARGSZ]; /* arguments from exec */ + char u_filler3[16]; /* Padding for swap compatibility */ + char *u_tracepc; /* Return PC if tracing enabled */ + int u_sysabort; /* Debugging: if set, abort syscall */ + int u_systrap; /* Are any syscall mask bits set? */ + k_sysset_t u_entrymask; /* syscall stop-on-entry mask */ + k_sysset_t u_exitmask; /* syscall stop-on-exit mask */ + + /* + * This filler area is reserved for expanding the debugger interface + * definitions (above) and the signal interface definitions (below). + * No other use should be made of it. + */ + char u_filler4[296]; /* Padding for swap compatibility */ + + int u_sigflag; /* per-process signal flags */ + struct ucontext *u_oldcontext; /* previous user context */ + stack_t u_sigaltstack; /* sp & on-stack state variable */ + k_sigset_t u_signodefer; /* signals defered when caught */ + k_sigset_t u_sigonstack; /* signals taken on alternate stack */ + k_sigset_t u_sigresethand; /* signals reset when caught */ + k_sigset_t u_sigrestart; /* signals that restart system calls */ + k_sigset_t u_sigoldmask; /* for sigsuspend */ + k_sigset_t u_sigmask[MAXSIG]; /* signals held while in catcher */ + void (*u_signal[MAXSIG])(); /* Disposition of signals */ + + int u_pgproc; /* Used by the MAU driver */ + int u_fpovr; /* flag for FP overflow workaround */ + label_t u_qsav; /* longjmp label for quits and intrs */ + + char u_dmm; /* Double-mapped memory */ + + /* + * The following (u_segflg and u_error) are obsolete. + */ + char u_segflg; /* 0=user D, 1=system, 2=user I */ + char u_error; /* return error code */ + + /* + * The following four fields are for backward compatibility + * with old device drivers; the actual user credentials are + * found through p_cred in struct proc. These fields may + * not support valid uid's or gid's when the system is + * configured with large user id's. + */ + + o_uid_t u_uid; /* effective user id */ + o_gid_t u_gid; /* effective group id */ + o_uid_t u_ruid; /* real user id */ + o_gid_t u_rgid; /* real group id */ + + proc_t *u_procp; /* pointer to proc structure */ + + int *u_ap; /* pointer to arglist */ + + /* + * The following (u_r through u_rablock) are all obsolete. + */ + union { + struct { + int r_v1; + int r_v2; + } r_reg; + off_t r_off; + time_t r_time; + } u_r; + caddr_t u_base; /* base address for IO */ + unsigned u_count; /* bytes remaining for IO */ + off_t u_offset; /* offset in file for IO */ + short u_fmode; /* file mode for IO */ + ushort u_pbsize; /* Bytes in block for IO */ + ushort u_pboff; /* offset in block for IO */ + char u_filler4_1[2]; /* padding */ + daddr_t u_rablock; /* read ahead block address */ + + short u_errcnt; /* syscall error count */ + + struct vnode *u_cdir; /* current directory */ + + struct vnode *u_rdir; /* root directory */ + + char u_filler5[24]; /* Padding */ + + int *u_stack; /* Ptr to start of kernel stack. */ + char u_filler6[4]; /* filler pointer */ + + int u_arg[MAXSYSARGS]; /* arguments to current system call */ + + struct rlimit u_rlimit[RLIM_NLIMITS]; /* resource usage limits */ + + char u_filler7[28]; /* Padding for swap compatibility */ + + uint u_tsize; /* text size (clicks) */ + uint u_dsize; /* data size (clicks) */ + uint u_ssize; /* stack size (clicks) */ + + k_siginfo_t u_siginfo; /* debugger interface: stop-on-fault */ + char u_filler8[52]; /* Padding for swap compatibility */ + + /* + * This offset must be reflected in misc.s and ttrap.s. + */ + /* Secret 3B2 illegal opcode for FP simulation */ + int *u_iop; + + /* + * u_utime, u_stime, u_cutime, u_cstime have been moved to proc table + */ + + clock_t u_uservirt; /* User virtual time */ + clock_t u_procvirt; /* Process virtual time */ + char u_filler9[8]; /* Padding */ + + int *u_ar0; /* address of user's saved R0 */ + + /* + * These offsets must be reflected in ttrap.s and misc.s. + */ + + struct prof { /* profile arguments */ + short *pr_base; /* buffer base */ + unsigned pr_size; /* buffer size */ + unsigned pr_off; /* pc offset */ + unsigned pr_scale; /* pc scaling */ + } u_prof; + + /* WARNING: the definitions for u_ttyp and + ** u_ttyd will be deleted at the next major + ** release following SVR4. + */ + + o_pid_t *u_ottyp; /* for binary compatibility only ! */ + o_dev_t u_ttyd; /* for binary compatibility only - + ** NODEV will be assigned for large + ** controlling terminal devices. + */ + + + char u_filler10[2]; + + int u_execid; + long u_execsz; + + char u_filler11[52]; + + /* + * Executable file info. + */ + struct exdata { + struct vnode *vp; + size_t ux_tsize; /* text size */ + size_t ux_dsize; /* data size */ + size_t ux_bsize; /* bss size */ + size_t ux_lsize; /* lib size */ + long ux_nshlibs; /* number of shared libs needed */ + short ux_mag; /* magic number MUST be here */ + off_t ux_toffset; /* file offset to raw text */ + off_t ux_doffset; /* file offset to raw data */ + off_t ux_loffset; /* file offset to lib sctn */ + caddr_t ux_txtorg; /* start addr of text in mem */ + caddr_t ux_datorg; /* start addr of data in mem */ + caddr_t ux_entloc;/* entry location */ + } u_exdata; + + char u_comm[PSCOMSIZ]; + + time_t u_start; + clock_t u_ticks; + long u_mem; + long u_ior; + long u_iow; + long u_iosw; + long u_ioch; + char u_acflag; + mode_t u_cmask; /* mask for file creation */ + short u_lock; /* process/text locking flags */ + int u_nofiles; /* number of open file slots */ + struct ufchunk u_flist; /* open file list */ + pid_t *u_ttyp; /* temporary pointer until we work + ** compatibility issues on ttyp + */ +} user_t; + +extern struct user u; +/* floating u area support */ +#define KERNSTACK 0x1000 /* 2 pages */ +struct seguser { + struct user segu_u; + char segu_stack[KERNSTACK]; +}; +#define KUSER(seg) (&((seg)->segu_u)) + +#define u_rval1 u_r.r_reg.r_v1 +#define u_rval2 u_r.r_reg.r_v2 +#define u_roff u_r.r_off +#define u_rtime u_r.r_time + +#define u_cred u_procp->p_cred + +#define u_altflags u_sigaltstack.ss_flags +#define u_altsp u_sigaltstack.ss_sp +#define u_altsize u_sigaltstack.ss_size + +/* ioflag values: Read/Write, User/Kernel, Ins/Data */ +#define U_WUD 0 +#define U_RUD 1 +#define U_WKD 2 +#define U_RKD 3 +#define U_WUI 4 +#define U_RUI 5 + +/* u_spop values */ +#define U_SPOP_MAU 0x1L + +#ifdef _KERNEL + +#if defined(__STDC__) +extern void addupc(void(*)(), struct prof *, int); +#else +extern void addupc(); +#endif /* __STDC__ */ + +#endif /* _KERNEL */ + +#endif /* _SYS_USER_H */ diff --git a/usr/src/uts/3b2/sys/ustat.h b/usr/src/uts/3b2/sys/ustat.h new file mode 100644 index 0000000..249d504 --- /dev/null +++ b/usr/src/uts/3b2/sys/ustat.h @@ -0,0 +1,32 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/ustat.h 11.7" + +/* WARNING: The ustat system call will become obsolete in the +** next major release following SVR4. Application code should +** migrate to the replacement system call statvfs(2). +*/ + +#ifndef _SYS_USTAT_H +#define _SYS_USTAT_H + +#ifndef _SYS_TYPES_H +#include "sys/types.h" +#endif + + +struct ustat { + daddr_t f_tfree; /* total free */ + o_ino_t f_tinode; /* total inodes free */ + char f_fname[6]; /* filsys name */ + char f_fpack[6]; /* filsys pack name */ +}; + + + +#endif /* _SYS_USTAT_H */ diff --git a/usr/src/uts/3b2/sys/utime.h b/usr/src/uts/3b2/sys/utime.h new file mode 100644 index 0000000..a88b692 --- /dev/null +++ b/usr/src/uts/3b2/sys/utime.h @@ -0,0 +1,23 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/utime.h 1.3" +/* utimbuf is used by utime(2) */ + +#ifndef _SYS_UTIME_H +#define _SYS_UTIME_H + +#ifndef _SYS_TYPES_H +#include "sys/types.h" +#endif + +struct utimbuf { + time_t actime; /* access time */ + time_t modtime; /* modification time */ +}; + +#endif /* _SYS_UTIME_H */ diff --git a/usr/src/uts/3b2/sys/utsname.h b/usr/src/uts/3b2/sys/utsname.h new file mode 100644 index 0000000..45b77d3 --- /dev/null +++ b/usr/src/uts/3b2/sys/utsname.h @@ -0,0 +1,58 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H + +#ident "@(#)head.sys:sys/utsname.h 11.10" + +/* + * If you are compiling the kernel, the value used in initializing + * the utsname structure in the master.d/kernel file better be the + * same as SYS_NMLN. + */ +#if !defined(_STYPES) +#define SYS_NMLN 257 /* 4.0 size of utsname elements.*/ + /* Must be at least 257 to */ + /* support Internet hostnames. */ +#else +#define SYS_NMLN 9 /* old size of utsname elements */ +#endif /* _STYPES */ + +struct utsname { + char sysname[SYS_NMLN]; + char nodename[SYS_NMLN]; + char release[SYS_NMLN]; + char version[SYS_NMLN]; + char machine[SYS_NMLN]; +}; + +extern struct utsname utsname; + +#if !defined(_KERNEL) +#if defined(__STDC__) +int uname(struct utsname *); +int nuname(struct utsname *); +#else +int uname(); +int nuname(); +#endif /* !(KERNEL) */ +#endif /* (__STDC__) */ + +#if !defined(_KERNEL) && !defined(_STYPES) +static int +uname(buf) +struct utsname *buf; +{ + int ret; + + ret = nuname(buf); + return ret; +} +#endif /* !defined(_KERNEL) && !defined(_STYPES) */ + +#endif /* _SYS_UTSNAME_H */ diff --git a/usr/src/uts/3b2/sys/utssys.h b/usr/src/uts/3b2/sys/utssys.h new file mode 100644 index 0000000..6a483e4 --- /dev/null +++ b/usr/src/uts/3b2/sys/utssys.h @@ -0,0 +1,45 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/utssys.h 1.1" + +/* + * Definitions related to the utssys() system call. + */ + +/* + * "commands" of utssys + */ +#define UTS_UNAME 0x0 +#define UTS_USTAT 0x2 /* 1 was umask */ +#define UTS_FUSERS 0x3 + +/* + * Flags to UTS_FUSERS + */ +#define F_FILE_ONLY 0x1 +#define F_CONTAINED 0x2 + +/* + * structure yielded by UTS_FUSERS + */ +typedef struct f_user { + pid_t fu_pid; + int fu_flags; /* see below */ + uid_t fu_uid; +} f_user_t; + +/* + * fu_flags values + */ +#define F_CDIR 0x1 +#define F_RDIR 0x2 +#define F_TEXT 0x4 +#define F_MAP 0x8 +#define F_OPEN 0x10 +#define F_TRACE 0x20 +#define F_TTY 0x40 diff --git a/usr/src/uts/3b2/sys/var.h b/usr/src/uts/3b2/sys/var.h new file mode 100644 index 0000000..e16f7f0 --- /dev/null +++ b/usr/src/uts/3b2/sys/var.h @@ -0,0 +1,49 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VAR_H +#define _SYS_VAR_H + +#ident "@(#)head.sys:sys/var.h 11.17" + +/* + * System Configuration Information + */ +struct var { + int v_buf; /* Nbr of I/O buffers. */ + int v_call; /* Nbr of callout (timeout) entries. */ + int v_proc; /* Size of proc table. */ + struct proc **ve_proc; /* Ptr to next available proc entry */ + /* following the last one used. */ + int v_nglobpris; /* Nbr of global sched prios configured */ + int v_maxsyspri; /* Max global pri used by sys class. */ + int v_clist; /* Nbr of clists allocated. */ + int v_maxup; /* Max number of processes per user. */ + int v_hbuf; /* Nbr of hash buffers to allocate. */ + int v_hmask; /* Hash mask for buffers. */ + int v_pbuf; /* Nbr of physical I/O buffers. */ + int v_sptmap; /* Size of system virtual space */ + /* allocation map. */ + int v_maxpmem; /* The maximum physical memory to use. */ + /* If v_maxpmem == 0, then use all */ + /* available physical memory. */ + /* Otherwise, value is amount of mem to */ + /* use specified in pages. */ + int v_autoup; /* The age a delayed-write buffer must */ + /* be in seconds before bdflush will */ + /* write it out. */ + int v_bufhwm; /* high-water-mark of buffer cache */ + /* memory usage, in units of K Bytes */ +/* #ifdef MERGE */ + int v_xsdsegs; /* Number of XENIX shared data segs */ + int v_xsdslots; /* Number of slots in xsdtab[] per segment */ +/* #endif MERGE */ +}; + +extern struct var v; + +#endif /* _SYS_VAR_H */ diff --git a/usr/src/uts/3b2/sys/vfs.h b/usr/src/uts/3b2/sys/vfs.h new file mode 100644 index 0000000..7c3f4c7 --- /dev/null +++ b/usr/src/uts/3b2/sys/vfs.h @@ -0,0 +1,165 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VFS_H +#define _SYS_VFS_H + +#ident "@(#)head.sys:sys/vfs.h 1.19" + +/* + * Data associated with mounted file systems. + */ + +/* + * File system identifier. Should be unique (at least per machine). + */ +typedef struct { + long val[2]; /* file system id type */ +} fsid_t; + +/* + * File identifier. Should be unique per filesystem on a single + * machine. This is typically called by a stateless file server + * in order to generate "file handles". + */ +#define MAXFIDSZ 16 +#define freefid(fidp) \ + kmem_free((caddr_t)(fidp), sizeof (struct fid) - MAXFIDSZ + (fidp)->fid_len) + +typedef struct fid { + u_short fid_len; /* length of data in bytes */ + char fid_data[MAXFIDSZ]; /* data (variable length) */ +} fid_t; + +/* + * Structure per mounted file system. Each mounted file system has + * an array of operations and an instance record. The file systems + * are kept on a singly linked list headed by "rootvfs" and terminated + * by NULL. + */ +typedef struct vfs { + struct vfs *vfs_next; /* next VFS in VFS list */ + struct vfsops *vfs_op; /* operations on VFS */ + struct vnode *vfs_vnodecovered; /* vnode mounted on */ +#ifdef RFSUNMOUNTHACK + char *vfs_namecovered; /* path name mounted on */ +#endif + u_long vfs_flag; /* flags */ + u_long vfs_bsize; /* native block size */ + int vfs_fstype; /* file system type index */ + fsid_t vfs_fsid; /* file system id */ + caddr_t vfs_data; /* private data */ + dev_t vfs_dev; /* device of mounted VFS */ + u_long vfs_bcount; /* I/O count (accounting) */ + u_short vfs_nsubmounts; /* immediate sub-mount count */ +} vfs_t; + +/* + * VFS flags. + */ +#define VFS_RDONLY 0x01 /* read-only vfs */ +#define VFS_MLOCK 0x02 /* lock vfs so that subtree is stable */ +#define VFS_MWAIT 0x04 /* someone is waiting for lock */ +#define VFS_NOSUID 0x08 /* setuid disallowed */ +#define VFS_REMOUNT 0x10 /* modify mount options only */ +#define VFS_NOTRUNC 0x20 /* does not truncate long file names */ +#define VFS_UNLINKABLE 0x40 /* unlink(2) can be applied to root */ + +/* + * Argument structure for mount(2). + */ +struct mounta { + char *spec; + char *dir; + int flags; + char *fstype; + char *dataptr; + int datalen; +}; + +/* + * Operations supported on virtual file system. + */ +typedef struct vfsops { + int (*vfs_mount)(); /* mount file system */ + int (*vfs_unmount)(); /* unmount file system */ + int (*vfs_root)(); /* get root vnode */ + int (*vfs_statvfs)(); /* get file system statistics */ + int (*vfs_sync)(); /* flush fs buffers */ + int (*vfs_vget)(); /* get vnode from fid */ + int (*vfs_mountroot)(); /* mount the root filesystem */ + int (*vfs_swapvp)(); /* return vnode for swap */ + int (*vfs_filler[4])(); /* for future expansion */ +} vfsops_t; + +#define VFS_MOUNT(vfsp, mvp, uap, cr) \ + (*(vfsp)->vfs_op->vfs_mount)(vfsp, mvp, uap, cr) +#define VFS_UNMOUNT(vfsp, cr) (*(vfsp)->vfs_op->vfs_unmount)(vfsp, cr) +#define VFS_ROOT(vfsp, vpp) (*(vfsp)->vfs_op->vfs_root)(vfsp, vpp) +#define VFS_STATVFS(vfsp, sp) (*(vfsp)->vfs_op->vfs_statvfs)(vfsp, sp) +#define VFS_SYNC(vfsp, flag, cr) \ + (*(vfsp)->vfs_op->vfs_sync)(vfsp, flag, cr) +#define VFS_VGET(vfsp, vpp, fidp) \ + (*(vfsp)->vfs_op->vfs_vget)(vfsp, vpp, fidp) +#define VFS_MOUNTROOT(vfsp, init) \ + (*(vfsp)->vfs_op->vfs_mountroot)(vfsp, init) +#define VFS_SWAPVP(vfsp, vpp, nm) \ + (*(vfsp)->vfs_op->vfs_swapvp)(vfsp, vpp, nm) + +/* + * Filesystem type switch table. + */ +typedef struct vfssw { + char *vsw_name; /* type name string */ + int (*vsw_init)(); /* init routine */ + struct vfsops *vsw_vfsops; /* filesystem operations vector */ + long vsw_flag; /* flags */ +} vfssw_t; + +/* + * Public operations. + */ +extern void vfs_mountroot(); /* mount the root */ +extern void vfs_add(); /* add a new vfs to mounted vfs list */ +extern void vfs_remove(); /* remove a vfs from mounted vfs list */ +extern int vfs_lock(); /* lock a vfs */ +extern void vfs_unlock(); /* unlock a vfs */ +extern vfs_t *getvfs(); /* return vfs given fsid */ +extern vfs_t *vfs_devsearch(); /* find vfs given device */ +extern vfssw_t *vfs_getvfssw(); /* find vfssw ptr given fstype name */ +extern u_long vf_to_stf(); /* map VFS flags to statfs flags */ +extern int dounmount(); /* unmount a vfs */ + +#define VFS_INIT(vfsp, op, data) { \ + (vfsp)->vfs_next = (struct vfs *)0; \ + (vfsp)->vfs_op = (op); \ + (vfsp)->vfs_flag = 0; \ + (vfsp)->vfs_data = (data); \ + (vfsp)->vfs_nsubmounts = 0; \ +} + +/* + * Globals. + */ +extern struct vfs *rootvfs; /* ptr to root vfs structure */ +extern struct vfssw vfssw[]; /* table of filesystem types */ +extern char rootfstype[]; /* name of root fstype */ +extern int nfstype; /* # of elements in vfssw array */ + +/* + * Reasons for calling the vfs_mountroot() operation. + */ + +enum whymountroot { ROOT_INIT, ROOT_REMOUNT, ROOT_UNMOUNT }; +typedef enum whymountroot whymountroot_t; + +/* + * VFS_SYNC flags. + */ +#define SYNC_ATTR 0x01 /* sync attributes only */ + +#endif /* _SYS_VFS_H */ diff --git a/usr/src/uts/3b2/sys/vfstab.h b/usr/src/uts/3b2/sys/vfstab.h new file mode 100644 index 0000000..7810eff --- /dev/null +++ b/usr/src/uts/3b2/sys/vfstab.h @@ -0,0 +1,52 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)head.sys:sys/vfstab.h 1.2" + +#define VFSTAB "/etc/vfstab" +#define VFS_LINE_MAX 1024 + +#define VFS_TOOLONG 1 /* entry exceeds VFS_LINE_MAX */ +#define VFS_TOOMANY 2 /* too many fields in line */ +#define VFS_TOOFEW 3 /* too few fields in line */ + +#define vfsnull(vp) ((vp)->vfs_special = (vp)->vfs_fsckdev =\ + (vp)->vfs_mountp = (vp)->vfs_fstype =\ + (vp)->vfs_fsckpass = (vp)->vfs_automnt =\ + (vp)->vfs_mntopts = NULL) + +#define putvfsent(fd, vp)\ + fprintf((fd), "%s\t%s\t%s\t%s\t%s\t%s\t%s\n",\ + (vp)->vfs_special ? (vp)->vfs_special : "-",\ + (vp)->vfs_fsckdev ? (vp)->vfs_fsckdev : "-",\ + (vp)->vfs_mountp ? (vp)->vfs_mountp : "-",\ + (vp)->vfs_fstype ? (vp)->vfs_fstype : "-",\ + (vp)->vfs_fsckpass ? (vp)->vfs_fsckpass : "-",\ + (vp)->vfs_automnt ? (vp)->vfs_automnt : "-",\ + (vp)->vfs_mntopts ? (vp)->vfs_mntopts : "-") + +struct vfstab { + char *vfs_special; + char *vfs_fsckdev; + char *vfs_mountp; + char *vfs_fstype; + char *vfs_fsckpass; + char *vfs_automnt; + char *vfs_mntopts; +}; + +#ifdef __STDC__ +extern int getvfsent(FILE *, struct vfstab *); +extern int getvfsspec(FILE *, struct vfstab *, char *); +extern int getvfsfile(FILE *, struct vfstab *, char *); +extern int getvfsany(FILE *, struct vfstab *, struct vfstab *); +#else +extern int getvfsent( ); +extern int getvfsspec( ); +extern int getvfsfile( ); +extern int getvfsany( ); +#endif diff --git a/usr/src/uts/3b2/sys/vm.h b/usr/src/uts/3b2/sys/vm.h new file mode 100644 index 0000000..6151447 --- /dev/null +++ b/usr/src/uts/3b2/sys/vm.h @@ -0,0 +1,18 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VM_H +#define _SYS_VM_H + +#ident "@(#)head.sys:sys/vm.h 1.3" + +#include "sys/vmparam.h" +#include "sys/vmmac.h" +#include "sys/vmmeter.h" +#include "sys/vmsystm.h" + +#endif /* _SYS_VM_H */ diff --git a/usr/src/uts/3b2/sys/vmmac.h b/usr/src/uts/3b2/sys/vmmac.h new file mode 100644 index 0000000..4282c3c --- /dev/null +++ b/usr/src/uts/3b2/sys/vmmac.h @@ -0,0 +1,39 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VMMAC_H +#define _SYS_VMMAC_H + +#ident "@(#)head.sys:sys/vmmac.h 1.3" + +#include "sys/sysmacros.h" + + +/* + * Turn virtual addresses into kernel map indices. + * + * "Sysmap" is an array of page table entries used to map virtual + * addresses, starting at (kernel virtual address) Sysbase, to many + * different things. Sysmap is managed throught the resource map named + * "kernelmap". kmx means kernelmap index, the index (into Sysmap) + * returned by rmalloc(kernelmap, ...). + * + * kmxtob expects an (integer) kernel map index and returns the virtual + * address by the mmu page number. btokmx expects a (caddr_t) virtual + * address and returns the integer kernel map index. + */ +#define kmxtob(a) (Sysbase + ((a) << MMU_PAGESHIFT)) +#define btokmx(b) (((caddr_t)(b) - Sysbase) >> MMU_PAGESHIFT) + +/* Average new into old with aging factor time */ +#define ave(smooth, cnt, time) \ + smooth = ((time - 1) * (smooth) + (cnt)) / (time) + +/* XXX - this doesn't really belong here */ +#define outofmem() wakeup((caddr_t)nproc[2]); + +#endif /* _SYS_VMMAC_H */ diff --git a/usr/src/uts/3b2/sys/vmmeter.h b/usr/src/uts/3b2/sys/vmmeter.h new file mode 100644 index 0000000..597cefe --- /dev/null +++ b/usr/src/uts/3b2/sys/vmmeter.h @@ -0,0 +1,161 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VMMETER_H +#define _SYS_VMMETER_H + +#ident "@(#)head.sys:sys/vmmeter.h 1.2" + +/* + * Virtual memory related instrumentation + */ + +/* + * Note that all the vmmeter entries between v_first and v_last + * must be unsigned [int], as they are used as such in vmmeter(). + */ +struct vmmeter { +#define v_first v_swtch + unsigned v_swtch; /* context switches */ + unsigned v_trap; /* calls to trap */ + unsigned v_syscall; /* calls to syscall() */ + unsigned v_intr; /* device interrupts */ + unsigned v_pdma; /* pseudo-dma interrupts XXX: VAX only */ + unsigned v_pswpin; /* pages swapped in */ + unsigned v_pswpout; /* pages swapped out */ + unsigned v_pgin; /* pageins */ + unsigned v_pgout; /* pageouts */ + unsigned v_pgpgin; /* pages paged in */ + unsigned v_pgpgout; /* pages paged out */ + unsigned v_intrans; /* intransit blocking page faults */ + unsigned v_pgrec; /* total page reclaims (includes pageout) */ + unsigned v_xsfrec; /* found in free list rather than on swapdev */ + unsigned v_xifrec; /* found in free list rather than in filsys */ + unsigned v_exfod; /* pages filled on demand from executables */ + /* XXX: above entry currently unused */ + unsigned v_zfod; /* pages zero filled on demand */ + unsigned v_vrfod; /* fills of pages mapped by vread() */ + /* XXX: above entry currently unused */ + unsigned v_nexfod; /* number of exfod's created */ + /* XXX: above entry currently unused */ + unsigned v_nzfod; /* number of zfod's created */ + /* XXX: above entry currently unused */ + unsigned v_nvrfod; /* number of vrfod's created */ + /* XXX: above entry currently unused */ + unsigned v_pgfrec; /* page reclaims from free list */ + unsigned v_faults; /* total page faults taken */ + unsigned v_scan; /* page examinations in page out daemon */ + unsigned v_rev; /* revolutions of the paging daemon hand */ + unsigned v_seqfree; /* pages taken from sequential programs */ + /* XXX: above entry currently unused */ + unsigned v_dfree; /* pages freed by daemon */ + unsigned v_fastpgrec; /* fast reclaims in locore XXX: VAX only */ +#define v_last v_fastpgrec + unsigned v_swpin; /* swapins */ + unsigned v_swpout; /* swapouts */ +}; +#ifdef _KERNEL +/* + * struct v_first to v_last v_swp* + * ------ ----------------- ------ + * cnt 1 second interval accum 5 second interval accum + * rate 5 second average previous interval + * sum free running counter + */ +struct vmmeter cnt, rate, sum; +#endif + +/* + * Systemwide totals computed every five seconds. + * All these are snapshots, except for t_free. + */ +struct vmtotal { + short t_rq; /* length of the run queue */ + short t_dw; /* jobs in ``disk wait'' (neg priority) */ + short t_pw; /* jobs in page wait */ + short t_sl; /* ``active'' jobs sleeping in core */ + short t_sw; /* swapped out ``active'' jobs */ + int t_vm; /* total virtual memory */ + /* XXX: above entry currently unused */ + int t_avm; /* active virtual memory */ + /* XXX: above entry currently unused */ + short t_rm; /* total real memory in use */ + short t_arm; /* active real memory */ + int t_vmtxt; /* virtual memory used by text */ + /* XXX: above entry currently unused */ + int t_avmtxt; /* active virtual memory used by text */ + /* XXX: above entry currently unused */ + short t_rmtxt; /* real memory used by text */ + /* XXX: above entry currently unused */ + short t_armtxt; /* active real memory used by text */ + /* XXX: above entry currently unused */ + short t_free; /* free memory pages (60 second average) */ +}; +#ifdef _KERNEL +struct vmtotal total; +#endif + +/* + * Optional instrumentation. + */ +#ifdef PGINPROF + +#define NDMON 128 +#define NSMON 128 + +#define DRES 20 +#define SRES 5 + +#define PMONMIN 20 +#define PRES 50 +#define NPMON 64 + +#define RMONMIN 130 +#define RRES 5 +#define NRMON 64 + +/* data and stack size distribution counters */ +unsigned int dmon[NDMON+1]; +unsigned int smon[NSMON+1]; + +/* page in time distribution counters */ +unsigned int pmon[NPMON+2]; + +/* reclaim time distribution counters */ +unsigned int rmon[NRMON+2]; + +int pmonmin; +int pres; +int rmonmin; +int rres; + +unsigned rectime; /* accumulator for reclaim times */ +unsigned pgintime; /* accumulator for page in times */ +#endif + +/* + * Virtual Address Cache flush instrumentation. + * + * Everything from f_first to f_last must be unsigned [int]. + */ +struct flushmeter { +#define f_first f_ctx + unsigned f_ctx; /* No. of context flushes */ + unsigned f_segment; /* No. of segment flushes */ + unsigned f_page; /* No. of complete page flushes */ + unsigned f_partial; /* No. of partial page flushes */ +#define f_last f_partial +}; + +#ifdef _KERNEL +#ifdef VAC +/* cnt is 1 sec accum; rate is 5 sec avg; sum is grand total */ +struct flushmeter flush_cnt, flush_rate, flush_sum; +#endif /* VAC */ +#endif /* _KERNEL */ + +#endif /* _SYS_VMMETER_H */ diff --git a/usr/src/uts/3b2/sys/vmparam.h b/usr/src/uts/3b2/sys/vmparam.h new file mode 100644 index 0000000..fe1bebc --- /dev/null +++ b/usr/src/uts/3b2/sys/vmparam.h @@ -0,0 +1,119 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VMPARAM_H +#define _SYS_VMPARAM_H + +#ident "@(#)head.sys:sys/vmparam.h 1.3" + +/* this file has not been converted for the 3b2 yet */ + +/* + * Machine dependent constants + */ + +/* + * USRTEXT is the start of the user text/data space, while USRSTACK + * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are + * the number of pages from the beginning of the user address space + * to the beginning of the text and from the end of the stack to the + * end of the user address space respectively. + */ +#define USRTEXT 0x2000 +#define USRSTACK (0 - (128 * 1024*1024)) +#define LOWPAGES btoc(USRTEXT) +#define HIGHPAGES 0 + +/* + * Virtual memory related constants for UNIX resource control, all in bytes + */ +#ifndef DFLDSIZ +#define DFLDSIZ (512 * 1024*1024) /* initial data size limit */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (512 * 1024*1024) /* max data size limit */ +#endif +#ifndef DFLSSIZ +#define DFLSSIZ (16 * 1024*1024) /* initial stack size limit */ +#endif +#ifndef MAXSSIZ +#define MAXSSIZ MAXDSIZ /* max stack size limit */ +#endif + +#define SSIZE 1 /* initial stack size */ +#define SINCR 1 /* increment of stack */ + +/* + * Size of the kernel segkmem system pte table. This virtual + * space is controlled by the resource map "kernelmap". + */ +#define SYSPTSIZE (0x640000 / MMU_PAGESIZE) + +/* + * Minimum allowable virtual address space to be used + * by the seg_map segment driver for fast kernel mappings. + */ +#define MINMAPSIZE 0x200000 + +/* + * The time for a process to be blocked before being very swappable. + * This is a number of seconds which the system takes as being a non-trivial + * amount of real time. You probably shouldn't change this; + * it is used in subtle ways (fractions and multiples of it are, that is, like + * half of a ``long time'', almost a long time, etc.) + * It is related to human patience and other factors which don't really + * change over time. + */ +#define MAXSLP 20 + +/* + * A swapped in process is given a small amount of core without being bothered + * by the page replacement algorithm. Basically this says that if you are + * swapped in you deserve some resources. We protect the last SAFERSS + * pages against paging and will just swap you out rather than paging you. + * Note that each process has at least UPAGES pages which are not + * paged anyways so this number just means a swapped in process is + * given around 32k bytes. + */ +#define SAFERSS 3 /* nominal ``small'' resident set size + protected against replacement */ + +/* + * DISKRPM is used to estimate the number of paging i/o operations + * which one can expect from a single disk controller. + */ +#define DISKRPM 60 + +/* + * Paging thresholds (see vm_pageout.c). + * Strategy of 3/17/83: + * lotsfree is 256k bytes, but at most 1/8 of memory + * desfree is 100k bytes, but at most 1/16 of memory + * minfree is 32k bytes, but at most 1/2 of desfree + */ +#define LOTSFREE (256 * 1024) +#define LOTSFREEFRACT 8 +#define DESFREE (100 * 1024) +#define DESFREEFRACT 16 +#define MINFREE (32 * 1024) +#define MINFREEFRACT 2 + +/* + * There are two clock hands, initially separated by HANDSPREAD bytes + * (but at most all of user memory). The amount of time to reclaim + * a page once the pageout process examines it increases with this + * distance and decreases as the scan rate rises. + */ +#define HANDSPREAD (2 * 1024 * 1024) + +/* + * Paged text files that are less than PGTHRESH bytes + * may be "prefaulted in" instead of demand paged. + */ +#define PGTHRESH (32 * 1024) + +#endif /* _SYS_VMPARAM_H */ diff --git a/usr/src/uts/3b2/sys/vmsystm.h b/usr/src/uts/3b2/sys/vmsystm.h new file mode 100644 index 0000000..c3bbf74 --- /dev/null +++ b/usr/src/uts/3b2/sys/vmsystm.h @@ -0,0 +1,67 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VMSYSTM_H +#define _SYS_VMSYSTM_H + +#ident "@(#)head.sys:sys/vmsystm.h 1.4" + +/* + * Miscellaneous virtual memory subsystem variables and structures. + */ + +#ifdef _KERNEL +int freemem; /* remaining blocks of free memory */ +int avefree; /* moving average of remaining free blocks */ +int avefree30; /* 30 sec (avefree is 5 sec) moving average */ +int deficit; /* estimate of needs of new swapped in procs */ +int nscan; /* number of scans in last second */ +int multprog; /* current multiprogramming degree */ +int desscan; /* desired pages scanned per second */ + +/* writable copies of tunables */ +int maxpgio; /* max paging i/o per sec before start swaps */ +int maxslp; /* max sleep time before very swappable */ +int lotsfree; /* max free before clock freezes */ +int minfree; /* minimum free pages before swapping begins */ +int desfree; /* no of pages to try to keep free via daemon */ +int saferss; /* no pages not to steal; decays with slptime */ +#endif + +/* + * Fork/vfork accounting. + */ +struct forkstat +{ + int cntfork; + int cntvfork; + int sizfork; + int sizvfork; +}; +#ifdef _KERNEL +struct forkstat forkstat; + +#if defined(__STDC__) +extern void vmtotal(void); +extern int valid_va_range(addr_t *, u_int *, u_int, int); +extern int valid_usr_range(addr_t, size_t); +extern int useracc(caddr_t, uint, int); +extern int page_deladd(int, int, rval_t *); +extern void map_addr(addr_t *, u_int, off_t, int); +#else +extern void vmtotal(void); +extern void vmtotal(); +extern int valid_va_range(); +extern int valid_usr_range(); +extern int useracc(); +extern int page_deladd(); +extern void map_addr(); +#endif /* __STDC__ */ + +#endif /* _KERNEL */ + +#endif /* _SYS_VMSYSTM_H */ diff --git a/usr/src/uts/3b2/sys/vnode.h b/usr/src/uts/3b2/sys/vnode.h new file mode 100644 index 0000000..94a9522 --- /dev/null +++ b/usr/src/uts/3b2/sys/vnode.h @@ -0,0 +1,319 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VNODE_H +#define _SYS_VNODE_H + +#ident "@(#)head.sys:sys/vnode.h 1.29" + +#include "sys/time.h" + +/* + * The vnode is the focus of all file activity in UNIX. + * A vnode is allocated for each active file, each current + * directory, each mounted-on file, and the root. + */ + +/* + * vnode types. VNON means no type. These values are unrelated to + * values in on-disk inodes. + */ +typedef enum vtype { + VNON = 0, + VREG = 1, + VDIR = 2, + VBLK = 3, + VCHR = 4, + VLNK = 5, + VFIFO = 6, + VXNAM = 7, + VBAD = 8 +} vtype_t; + +typedef struct vnode { + u_short v_flag; /* vnode flags (see below) */ + u_short v_count; /* reference count */ + struct vfs *v_vfsmountedhere; /* ptr to vfs mounted here */ + struct vnodeops *v_op; /* vnode operations */ + struct vfs *v_vfsp; /* ptr to containing VFS */ + struct stdata *v_stream; /* associated stream */ + struct page *v_pages; /* vnode pages list */ + enum vtype v_type; /* vnode type */ + dev_t v_rdev; /* device (VCHR, VBLK) */ + caddr_t v_data; /* private data for fs */ + struct filock *v_filocks; /* ptr to filock list */ + long v_filler[8]; /* padding */ +} vnode_t; + +/* + * vnode flags. + */ +#define VROOT 0x01 /* root of its file system */ +#define VTEXT 0x02 /* vnode is a pure text prototype */ +#define VISSWAP 0x40 /* vnode is part of virtual swap device */ +/* #ifdef MERGE */ +#define VXLOCKED 0x8000 /* Xenix frlock */ +/* #endif MERGE */ +#define VNOMAP 0x04 /* file cannot be mapped/faulted */ + +/* + * Operations on vnodes. + */ +typedef struct vnodeops { + int (*vop_open)(); + int (*vop_close)(); + int (*vop_read)(); + int (*vop_write)(); + int (*vop_ioctl)(); + int (*vop_setfl)(); + int (*vop_getattr)(); + int (*vop_setattr)(); + int (*vop_access)(); + int (*vop_lookup)(); + int (*vop_create)(); + int (*vop_remove)(); + int (*vop_link)(); + int (*vop_rename)(); + int (*vop_mkdir)(); + int (*vop_rmdir)(); + int (*vop_readdir)(); + int (*vop_symlink)(); + int (*vop_readlink)(); + int (*vop_fsync)(); + void (*vop_inactive)(); + int (*vop_fid)(); + void (*vop_rwlock)(); + void (*vop_rwunlock)(); + int (*vop_seek)(); + int (*vop_cmp)(); + int (*vop_frlock)(); + int (*vop_space)(); + int (*vop_realvp)(); + int (*vop_getpage)(); + int (*vop_putpage)(); + int (*vop_map)(); + int (*vop_addmap)(); + int (*vop_delmap)(); + int (*vop_poll)(); + int (*vop_dump)(); + int (*vop_filler[8])(); +} vnodeops_t; + +#define VOP_OPEN(vpp, mode, cr) (*(*(vpp))->v_op->vop_open)(vpp, mode, cr) +#define VOP_CLOSE(vp, f, c, o, cr) (*(vp)->v_op->vop_close)(vp, f, c, o, cr) +#define VOP_READ(vp,uiop,iof,cr) (*(vp)->v_op->vop_read)(vp,uiop,iof,cr) +#define VOP_WRITE(vp,uiop,iof,cr) (*(vp)->v_op->vop_write)(vp,uiop,iof,cr) +#define VOP_IOCTL(vp,cmd,a,f,cr,rvp) (*(vp)->v_op->vop_ioctl)(vp,cmd,a,f,cr,rvp) +#define VOP_SETFL(vp, f, a, cr) (*(vp)->v_op->vop_setfl)(vp, f, a, cr) +#define VOP_GETATTR(vp, vap, f, cr) (*(vp)->v_op->vop_getattr)(vp, vap, f, cr) +#define VOP_SETATTR(vp, vap, f, cr) (*(vp)->v_op->vop_setattr)(vp, vap, f, cr) +#define VOP_ACCESS(vp, mode, f, cr) (*(vp)->v_op->vop_access)(vp, mode, f, cr) +#define VOP_LOOKUP(vp,cp,vpp,pnp,f,rdir,cr) \ + (*(vp)->v_op->vop_lookup)(vp,cp,vpp,pnp,f,rdir,cr) +#define VOP_CREATE(dvp,p,vap,ex,mode,vpp,cr) \ + (*(dvp)->v_op->vop_create)(dvp,p,vap,ex,mode,vpp,cr) +#define VOP_REMOVE(dvp,p,cr) (*(dvp)->v_op->vop_remove)(dvp,p,cr) +#define VOP_LINK(tdvp,fvp,p,cr) (*(fvp)->v_op->vop_link)(tdvp,fvp,p,cr) +#define VOP_RENAME(fvp,fnm,tdvp,tnm,cr) \ + (*(fvp)->v_op->vop_rename)(fvp,fnm,tdvp,tnm,cr) +#define VOP_MKDIR(dp,p,vap,vpp,cr) (*(dp)->v_op->vop_mkdir)(dp,p,vap,vpp,cr) +#define VOP_RMDIR(dp,p,cdir,cr) (*(dp)->v_op->vop_rmdir)(dp,p,cdir,cr) +#define VOP_READDIR(vp,uiop,cr,eofp) (*(vp)->v_op->vop_readdir)(vp,uiop,cr,eofp) +#define VOP_SYMLINK(dvp,lnm,vap,tnm,cr) \ + (*(dvp)->v_op->vop_symlink) (dvp,lnm,vap,tnm,cr) +#define VOP_READLINK(vp, uiop, cr) (*(vp)->v_op->vop_readlink)(vp, uiop, cr) +#define VOP_FSYNC(vp, cr) (*(vp)->v_op->vop_fsync)(vp, cr) +#define VOP_INACTIVE(vp, cr) (*(vp)->v_op->vop_inactive)(vp, cr) +#define VOP_FID(vp, fidpp) (*(vp)->v_op->vop_fid)(vp, fidpp) +#define VOP_RWLOCK(vp) (*(vp)->v_op->vop_rwlock)(vp) +#define VOP_RWUNLOCK(vp) (*(vp)->v_op->vop_rwunlock)(vp) +#define VOP_SEEK(vp, ooff, noffp) (*(vp)->v_op->vop_seek)(vp, ooff, noffp) +#define VOP_CMP(vp1, vp2) (*(vp1)->v_op->vop_cmp)(vp1, vp2) +#define VOP_FRLOCK(vp,cmd,a,f,o,cr) (*(vp)->v_op->vop_frlock)(vp,cmd,a,f,o,cr) +#define VOP_SPACE(vp,cmd,a,f,o,cr) (*(vp)->v_op->vop_space)(vp,cmd,a,f,o,cr) +#define VOP_REALVP(vp1, vp2) (*(vp1)->v_op->vop_realvp)(vp1, vp2) +#define VOP_GETPAGE(vp,of,sz,pr,pl,ps,sg,a,rw,cr)\ + (*(vp)->v_op->vop_getpage) (vp,of,sz,pr,pl,ps,sg,a,rw,cr) +#define VOP_PUTPAGE(vp,of,sz,fl,cr) (*(vp)->v_op->vop_putpage)(vp,of,sz,fl,cr) +#define VOP_MAP(vp,of,as,a,sz,p,mp,fl,cr) \ + (*(vp)->v_op->vop_map) (vp,of,as,a,sz,p,mp,fl,cr) +#define VOP_ADDMAP(vp,of,as,a,sz,p,mp,fl,cr) \ + (*(vp)->v_op->vop_addmap) (vp,of,as,a,sz,p,mp,fl,cr) +#define VOP_DELMAP(vp,of,as,a,sz,p,mp,fl,cr) \ + (*(vp)->v_op->vop_delmap) (vp,of,as,a,sz,p,mp,fl,cr) +#define VOP_POLL(vp, events, anyyet, reventsp, phpp) \ + (*(vp)->v_op->vop_poll)(vp, events, anyyet, reventsp, phpp) +#define VOP_DUMP(vp,addr,bn,count) (*(vp)->v_op->vop_dump)(vp,addr,vn,count) + +/* + * I/O flags for VOP_READ and VOP_WRITE. + */ +#define IO_APPEND 0x01 /* append write (VOP_WRITE) */ +#define IO_SYNC 0x02 /* sync I/O (VOP_WRITE) */ + +/* + * Flags for VOP_LOOKUP. + */ +#define LOOKUP_DIR 0x01 /* want parent dir vp */ + +/* + * Vnode attributes. A bit-mask is supplied as part of the + * structure to indicate the attributes the caller wants to + * set (setattr) or extract (getattr). + */ +typedef struct vattr { + long va_mask; /* bit-mask of attributes */ + vtype_t va_type; /* vnode type (for create) */ + mode_t va_mode; /* file access mode */ + uid_t va_uid; /* owner user id */ + gid_t va_gid; /* owner group id */ + dev_t va_fsid; /* file system id (dev for now) */ + ino_t va_nodeid; /* node id */ + nlink_t va_nlink; /* number of references to file */ + u_long va_size; /* file size in bytes */ + timestruc_t va_atime; /* time of last access */ + timestruc_t va_mtime; /* time of last modification */ + timestruc_t va_ctime; /* time file ``created'' */ + dev_t va_rdev; /* device the file represents */ + u_long va_blksize; /* fundamental block size */ + u_long va_nblocks; /* # of blocks allocated */ + u_long va_vcode; /* version code */ + long va_filler[8]; /* padding */ +} vattr_t; + +/* + * Attributes of interest to the caller of setattr or getattr. + */ +#define AT_TYPE 0x0001 +#define AT_MODE 0x0002 +#define AT_UID 0x0004 +#define AT_GID 0x0008 +#define AT_FSID 0x0010 +#define AT_NODEID 0x0020 +#define AT_NLINK 0x0040 +#define AT_SIZE 0x0080 +#define AT_ATIME 0x0100 +#define AT_MTIME 0x0200 +#define AT_CTIME 0x0400 +#define AT_RDEV 0x0800 +#define AT_BLKSIZE 0x1000 +#define AT_NBLOCKS 0x2000 +#define AT_VCODE 0x4000 + +#define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ + AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ + AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) + +#define AT_STAT (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ + AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV) + +#define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME) + +#define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ + AT_BLKSIZE|AT_NBLOCKS|AT_VCODE) + +/* + * Modes. Some values same as S_xxx entries from stat.h for convenience. + */ +#define VSUID 04000 /* set user id on execution */ +#define VSGID 02000 /* set group id on execution */ +#define VSVTX 01000 /* save swapped text even after use */ + +/* + * Permissions. + */ +#define VREAD 00400 +#define VWRITE 00200 +#define VEXEC 00100 + +#define MODEMASK 07777 /* mode bits plus permission bits */ +#define PERMMASK 00777 /* permission bits */ + +/* + * Check whether mandatory file locking is enabled. + */ + +/* #ifdef MERGE */ +#define MANDLOCK(vp, mode) \ + ((vp)->v_type == VREG && ((((mode) & (VSGID|(VEXEC>>3))) == VSGID) \ + || ((vp)->v_flag & VXLOCKED) == VXLOCKED)) +#if 0 /* MERGE else case */ +#define MANDLOCK(type, mode) \ + ((type) == VREG && ((mode) & (VSGID|(VEXEC>>3))) == VSGID) +#endif +/* #endif MERGE*/ + +/* + * Public vnode manipulation functions. + */ +extern int vn_open(); +extern int vn_create(); +extern int vn_rdwr(); +extern int vn_close(); +extern void vn_rele(); +extern int vn_link(); +extern int vn_rename(); +extern int vn_remove(); +extern vnode_t *specvp(); +extern vnode_t *makespecvp(); + +#define VN_HOLD(vp) { \ + (vp)->v_count++; \ +} + +#define VN_RELE(vp) { \ + vn_rele(vp); \ +} + +#define VN_INIT(vp, vfsp, type, dev) { \ + (vp)->v_flag = 0; \ + (vp)->v_count = 1; \ + (vp)->v_vfsp = (vfsp); \ + (vp)->v_type = (type); \ + (vp)->v_rdev = (dev); \ + (vp)->v_pages = NULL; \ + (vp)->v_stream = NULL; \ +} + +/* + * Compare two vnodes for equality. In general this macro should be used + * in preference to calling VOP_CMP directly. + */ +#define VN_CMP(VP1,VP2) ((VP1) == (VP2) ? 1 : \ + ((VP1) && (VP2) && ((VP1)->v_op == (VP2)->v_op) ? VOP_CMP(VP1,VP2) : 0)) + +/* + * Flags for vnode operations. + */ +enum rm { RMFILE, RMDIRECTORY }; /* rm or rmdir (remove) */ +enum symfollow { NO_FOLLOW, FOLLOW }; /* follow symlinks (or not) */ +enum vcexcl { NONEXCL, EXCL }; /* (non)excl create */ +enum create { CRCREAT, CRMKNOD, CRMKDIR, CRCORE }; /* reason for create */ + +typedef enum rm rm_t; +typedef enum symfollow symfollow_t; +typedef enum vcexcl vcexcl_t; +typedef enum create create_t; + +/* + * Flags to pass to VOP_SETATTR. + */ +#define ATTR_UTIME 0x01 /* non-default utime(2) request */ +#define ATTR_EXEC 0x02 /* invocation from exec(2) */ + +/* + * Generally useful macros. + */ +#define VBSIZE(vp) ((vp)->v_vfsp->vfs_bsize) +#define NULLVP ((struct vnode *)0) +#define NULLVPP ((struct vnode **)0) + +#ifdef _KERNEL +extern int lookupname(); +#endif + +#endif /* _SYS_VNODE_H */ diff --git a/usr/src/uts/3b2/sys/vtoc.h b/usr/src/uts/3b2/sys/vtoc.h new file mode 100644 index 0000000..f8eabe5 --- /dev/null +++ b/usr/src/uts/3b2/sys/vtoc.h @@ -0,0 +1,112 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_VTOC_H +#define _SYS_VTOC_H + +#ident "@(#)head.sys:sys/vtoc.h 11.4" +/* + * VTOC.H + */ + +#define V_NUMPAR 16 /* The number of partitions */ + +#define VTOC_SANE 0x600DDEEE /* Indicates a sane VTOC */ +#define V_VERSION 0x01 /* layout version number */ + +/* Partition identification tags */ +#define V_BOOT 0x01 /* Boot partition */ +#define V_ROOT 0x02 /* Root filesystem */ +#define V_SWAP 0x03 /* Swap filesystem */ +#define V_USR 0x04 /* Usr filesystem */ +#define V_BACKUP 0x05 /* full disk */ +#define V_STAND 0x06 /* Stand partition */ +#define V_VAR 0x07 /* Var partition */ +#define V_HOME 0x08 /* Home partition */ + +/* Partition permission flags */ +#define V_UNMNT 0x01 /* Unmountable partition */ +#define V_RONLY 0x10 /* Read only */ + +/* driver ioctl() commands */ +#define VIOC ('V'<<8) +#define V_PREAD (VIOC|1) /* Physical Read */ +#define V_PWRITE (VIOC|2) /* Physical Write */ +#define V_PDREAD (VIOC|3) /* Read of Physical Description Area */ +#define V_PDWRITE (VIOC|4) /* Write of Physical Description Area */ +#define V_GETSSZ (VIOC|5) /* Get the sector size of media */ + +/* ioctl() error return codes */ +#define V_BADREAD 0x01 +#define V_BADWRITE 0x02 + +/* Sanity word for the physical description area */ +#define VALID_PD 0xCA5E600D + +struct partition { + ushort p_tag; /*ID tag of partition*/ + ushort p_flag; /*permision flags*/ + daddr_t p_start; /*start sector no of partition*/ + long p_size; /*# of blocks in partition*/ +}; + +struct vtoc { + unsigned long v_bootinfo[3]; /*info needed by mboot*/ + unsigned long v_sanity; /*to verify vtoc sanity*/ + unsigned long v_version; /*layout version*/ + char v_volume[8]; /*volume name*/ + ushort v_sectorsz; /*sector size in bytes*/ + ushort v_nparts; /*number of partitions*/ + unsigned long v_reserved[10]; /*free space*/ + struct partition v_part[V_NUMPAR]; /*partition headers*/ + time_t timestamp[V_NUMPAR]; /*partition timestamp*/ +}; + +struct pdinfo { + unsigned long driveid; /*identifies the device type*/ + unsigned long sanity; /*verifies device sanity*/ + unsigned long version; /*version number*/ + char serial[12]; /*serial number of the device*/ + unsigned long cyls; /*number of cylinders per drive*/ + unsigned long tracks; /*number tracks per cylinder*/ + unsigned long sectors; /*number sectors per track*/ + unsigned long bytes; /*number of bytes per sector*/ + unsigned long logicalst; /*sector address of logical sector 0*/ + unsigned long errlogst; /*sector address of error log area*/ + unsigned long errlogsz; /*size in bytes of error log area*/ + unsigned long mfgst; /*sector address of mfg. defect info*/ + unsigned long mfgsz; /*size in bytes of mfg. defect info*/ + unsigned long defectst; /*sector address of the defect map*/ + unsigned long defectsz; /*size in bytes of defect map*/ + unsigned long relno; /*number of relocation areas*/ + unsigned long relst; /*sector address of relocation area*/ + unsigned long relsz; /*size in sectors of relocation area*/ + unsigned long relnext; /*address of next avail reloc sector*/ +}; + +struct diaginfo { /* diagnostic info block */ + unsigned long diagst; /* sector address of dgn area */ + unsigned long diagsz; /* size in sectors of dgn area */ +}; /* diaginfo added by SCSI */ + +struct pdsector { + struct pdinfo pdinfo; /*disk physical info*/ + struct diaginfo diaginfo; /* diagnostic info block */ + unsigned long gapsz; /* fmthard, vmkfs: to set gap size */ + unsigned long reserved[7]; /*reserved for UNIX*/ + unsigned long devsp[97]; /*used for device specific info*/ + /*remaining words in sector 0*/ +}; + +struct io_arg { + int retval; + unsigned long sectst; + unsigned long memaddr; + unsigned long datasz; +} ; + +#endif /* _SYS_VTOC_H */ diff --git a/usr/src/uts/3b2/sys/wait.h b/usr/src/uts/3b2/sys/wait.h new file mode 100644 index 0000000..50562e4 --- /dev/null +++ b/usr/src/uts/3b2/sys/wait.h @@ -0,0 +1,74 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#include "sys/types.h" +#include "sys/siginfo.h" +#include "sys/procset.h" + +#ident "@(#)head.sys:sys/wait.h 1.10" + +/* + * arguments to wait functions + */ + +#define WEXITED 0001 /* wait for processes that have exited */ +#define WTRAPPED 0002 /* wait for processes stopped while tracing */ +#define WSTOPPED 0004 /* wait for processes stopped by signals */ +#define WCONTINUED 0010 /* wait for processes continued */ + +#define WUNTRACED WSTOPPED /* for POSIX */ + +#define WNOHANG 0100 /* non blocking form of wait */ +#define WNOWAIT 0200 /* non destructive form of wait */ + +#define WOPTMASK (WEXITED|WTRAPPED|WSTOPPED|WCONTINUED|WNOHANG|WNOWAIT) + +/* + * macros for stat return from wait functions + */ + +#define WSTOPFLG 0177 +#define WCONTFLG 0177777 +#define WCOREFLG 0200 +#define WSIGMASK 0177 + +#define WLOBYTE(stat) ((int)((stat)&0377)) +#define WHIBYTE(stat) ((int)(((stat)>>8)&0377)) +#define WWORD(stat) ((int)((stat))&0177777) + +#define WIFEXITED(stat) (WLOBYTE(stat)==0) +#define WIFSIGNALED(stat) (WLOBYTE(stat)>0&&WHIBYTE(stat)==0) +#define WIFSTOPPED(stat) (WLOBYTE(stat)==WSTOPFLG&&WHIBYTE(stat)!=0) +#define WIFCONTINUED(stat) (WWORD(stat)==WCONTFLG) + +#define WEXITSTATUS(stat) WHIBYTE(stat) +#define WTERMSIG(stat) (WLOBYTE(stat)&WSIGMASK) +#define WSTOPSIG(stat) WHIBYTE(stat) +#define WCOREDUMP(stat) ((stat)&WCOREFLG) + + + +#if !defined(_KERNEL) +#if defined(__STDC__) + +extern pid_t wait(int *); +extern pid_t waitpid(pid_t, int *, int); +extern int waitid(idtype_t, id_t, siginfo_t *, int); + +#else + +extern pid_t wait(); +extern pid_t waitpid(); +extern int waitid(); + +#endif /* __STDC__ */ +#endif /* _KERNEL */ + +#endif /* _SYS_WAIT_H */ diff --git a/usr/src/uts/3b2/unix.fast.mk b/usr/src/uts/3b2/unix.fast.mk new file mode 100644 index 0000000..bcf4851 --- /dev/null +++ b/usr/src/uts/3b2/unix.fast.mk @@ -0,0 +1,158 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)kernel:unix.fast.mk 1.19" + +ROOT = +DIS = dis +NM = nm +SIZE = size +STRIP = strip +INC=$(ROOT)/usr/include + +LIBS= lib.os lib.io lib.vm +NODE = kernel +REL = +VER = +NAME = $(NODE)$(VER) + +INS=install +INSDIR=. +MKBOOT = mkboot +MASTERD=./master.d +DASHO = -O +CFLAGS= $(DASHO) -I$(INC) -DDEBUG -D_KERNEL -DREM $(MORECPP) +FRC = + +LD_KERNEL_ELF = \ + $(LD) -r -o $(NAME) -u bt_availbit -u reclock -u setmask -u fbread \ + -u ls_remove -u segdev_create -u dma_breakup -u dma_pageio \ + locore.o ddi.o name.o syms.o \ + getsizes.o fs/fs.o disp/gendisp.o \ + $(LIBS) + +LD_KERNEL_COFF = \ + $(LD) -r -o $(NAME) -u bt_availbit -u reclock -u setmask -u fbread \ + -u ls_remove -u segdev_create -u dma_breakup -u dma_pageio \ + vuifile start.o gate.o locore.o ddi.o name.o \ + getsizes.o fs/fs.o disp/gendisp.o \ + $(LIBS) + +all:FRC + cd ml; $(MAKE) -f ml.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../os; $(MAKE) -f os.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../vm; $(MAKE) -f vm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../fs; $(MAKE) -f fs.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../exec; $(MAKE) -f exec.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../io; $(MAKE) -f io.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../debug; $(MAKE) -f debug.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../disp; $(MAKE) -f disp.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../netinet; $(MAKE) -f netinet.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../rpc; $(MAKE) -f rpc.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../ktli; $(MAKE) -f ktli.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../des; $(MAKE) -f des.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + cd ../klm; $(MAKE) -f klm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + + cd ../boot; $(MAKE) -f boot.mk "ROOT=$(ROOT)" "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" & \ + wait + $(MAKE) -f unix.mk NAME=$(NAME) unix + +machine:FRC + cd ml; $(MAKE) -f ml.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +system:FRC + cd os; $(MAKE) -f os.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +vmsys:FRC + cd vm; $(MAKE) -f vm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +fs:FRC + cd fs; $(MAKE) -f fs.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +exec:FRC + cd exec; $(MAKE) -f exec.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +drivers:FRC + cd io; $(MAKE) -f io.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +debug:FRC + cd debug; $(MAKE) -f debug.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +boot:FRC + cd boot; $(MAKE) -f boot.mk "ROOT=$(ROOT)" "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +disp:FRC + cd disp; $(MAKE) -f disp.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +netinet:FRC + cd netinet; $(MAKE) -f netinet.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +rpc:FRC + cd rpc; $(MAKE) -f rpc.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +ktli:FRC + cd ktli; $(MAKE) -f ktli.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +des:FRC + cd des; $(MAKE) -f des.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +klm:FRC + cd klm; $(MAKE) -f klm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +unix: $(LIBS) vuifile start.o gate.o locore.o ddi.o name.o getsizes.o fs/fs.o disp/gendisp.o $(MASTERD)/kernel + -rm -f $(NAME) + + if [ x$(CCSTYPE) = xCOFF ] ; \ + then $(LD_KERNEL_COFF) ; \ + else $(LD_KERNEL_ELF) ; \ + fi + + $(MKBOOT) -m $(MASTERD) -d . -k $(NAME); + @echo $(NAME) made. + +clean: + cd ml; $(MAKE) -f ml.mk clean + cd os; $(MAKE) -f os.mk clean + cd vm; $(MAKE) -f vm.mk clean + cd fs; $(MAKE) -f fs.mk clean + cd exec; $(MAKE) -f exec.mk clean + cd io; $(MAKE) -f io.mk clean + cd debug; $(MAKE) -f debug.mk clean + cd disp; $(MAKE) -f disp.mk clean + cd netinet; $(MAKE) -f netinet.mk clean + cd rpc; $(MAKE) -f rpc.mk clean + cd ktli; $(MAKE) -f ktli.mk clean + cd des; $(MAKE) -f des.mk clean + cd klm; $(MAKE) -f klm.mk clean + cd boot; $(MAKE) -f boot.mk clean + -rm -f *.o + +clobber: clean + cd ml; $(MAKE) -f ml.mk clobber + cd os; $(MAKE) -f os.mk clobber + cd vm; $(MAKE) -f vm.mk clobber + cd fs; $(MAKE) -f fs.mk clobber + cd exec; $(MAKE) -f exec.mk clobber + cd io; $(MAKE) -f io.mk clobber + cd debug; $(MAKE) -f debug.mk clobber + cd disp; $(MAKE) -f disp.mk clobber + cd netinet; $(MAKE) -f netinet.mk clobber + cd rpc; $(MAKE) -f rpc.mk clobber + cd ktli; $(MAKE) -f ktli.mk clobber + cd des; $(MAKE) -f des.mk clobber + cd klm; $(MAKE) -f klm.mk clobber + cd boot; $(MAKE) -f boot.mk clobber + -rm -f KERNEL $(NAME) $(NAME).* ld.out load.* + + +install:all +# $(INS) -f $(INSDIR) "$(NAME)" + cd boot; $(MAKE) -f boot.mk install "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" ; \ + wait + + +FRC: diff --git a/usr/src/uts/3b2/unix.full.mk b/usr/src/uts/3b2/unix.full.mk new file mode 100644 index 0000000..ffb4e6c --- /dev/null +++ b/usr/src/uts/3b2/unix.full.mk @@ -0,0 +1,143 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)kernel:unix.full.mk 1.19" +MORECPP=-DDEBUG + +ROOT = +DIS = dis +NM = nm +SIZE = size +STRIP = strip +INC=$(ROOT)/usr/include + +LIBS= lib.os lib.io lib.vm +NODE = kernel +REL = +VER = +NAME = $(NODE)$(VER) + +INS=install +INSDIR=. +MKBOOT = mkboot +MASTERD=./master.d +DASHO = -O +CFLAGS= $(DASHO) -I$(INC) -DDEBUG -D_KERNEL -DREM $(MORECPP) +FRC = + +LD_KERNEL_ELF = \ + $(LD) -r -o $(NAME) -u bt_availbit -u reclock -u setmask -u fbread \ + -u ls_remove -u segdev_create -u dma_breakup -u dma_pageio \ + locore.o ddi.o name.o syms.o \ + getsizes.o fs/fs.o disp/gendisp.o \ + $(LIBS) + +LD_KERNEL_COFF = \ + $(LD) -r -o $(NAME) -u bt_availbit -u reclock -u setmask -u fbread \ + -u ls_remove -u segdev_create -u dma_breakup -u dma_pageio \ + vuifile start.o gate.o locore.o ddi.o name.o \ + getsizes.o fs/fs.o disp/gendisp.o \ + $(LIBS) + +all:FRC machine system vmsys fs exec drivers debug disp netinet rpc ktli des klm boot + $(MAKE) -f unix.mk NAME=$(NAME) unix + +machine:FRC + cd ml; $(MAKE) -f ml.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +system:FRC + cd os; $(MAKE) -f os.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +vmsys:FRC + cd vm; $(MAKE) -f vm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +exec:FRC + cd exec; $(MAKE) -f exec.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +drivers:FRC + cd io; $(MAKE) -f io.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +debug:FRC + cd debug; $(MAKE) -f debug.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +boot:FRC + cd boot; $(MAKE) -f boot.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +fs:FRC + cd fs; $(MAKE) -f fs.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +disp:FRC + cd disp; $(MAKE) -f disp.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +netinet:FRC + cd netinet; $(MAKE) -f netinet.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +rpc:FRC + cd rpc; $(MAKE) -f rpc.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +ktli:FRC + cd ktli; $(MAKE) -f ktli.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +des:FRC + cd des; $(MAKE) -f des.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +klm:FRC + cd klm; $(MAKE) -f klm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +unix: $(LIBS) vuifile start.o gate.o locore.o ddi.o name.o getsizes.o fs/fs.o disp/gendisp.o $(MASTERD)/kernel + -rm -f $(NAME) + + if [ x$(CCSTYPE) = xCOFF ] ; \ + then $(LD_KERNEL_COFF) ; \ + else $(LD_KERNEL_ELF) ; \ + fi + + $(MKBOOT) -m $(MASTERD) -d . -k $(NAME); + @echo $(NAME) made. + +clean: + cd ml; $(MAKE) -f ml.mk clean + cd os; $(MAKE) -f os.mk clean + cd vm; $(MAKE) -f vm.mk clean + cd fs; $(MAKE) -f fs.mk clean + cd exec; $(MAKE) -f exec.mk clean + cd io; $(MAKE) -f io.mk clean + cd debug; $(MAKE) -f debug.mk clean + cd disp; $(MAKE) -f disp.mk clean + cd netinet; $(MAKE) -f netinet.mk clean + cd rpc; $(MAKE) -f rpc.mk clean + cd ktli; $(MAKE) -f ktli.mk clean + cd des; $(MAKE) -f des.mk clean + cd klm; $(MAKE) -f klm.mk clean + cd boot; $(MAKE) -f boot.mk clean + -rm -f *.o + +clobber: + cd ml; $(MAKE) -f ml.mk clobber + cd os; $(MAKE) -f os.mk clobber + cd vm; $(MAKE) -f vm.mk clobber + cd fs; $(MAKE) -f fs.mk clobber + cd exec; $(MAKE) -f exec.mk clobber + cd io; $(MAKE) -f io.mk clobber + cd debug; $(MAKE) -f debug.mk clobber + cd disp; $(MAKE) -f disp.mk clobber + cd netinet; $(MAKE) -f netinet.mk clobber + cd rpc; $(MAKE) -f rpc.mk clobber + cd ktli; $(MAKE) -f ktli.mk clobber + cd des; $(MAKE) -f des.mk clobber + cd klm; $(MAKE) -f klm.mk clobber + cd boot; $(MAKE) -f boot.mk clobber + -rm -f KERNEL $(NAME) $(NAME).* ld.out load.* + + +install:all +# $(INS) -f $(INSDIR) "$(NAME)" + cd boot; $(MAKE) -f boot.mk install "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" ; \ + wait + + +FRC: diff --git a/usr/src/uts/3b2/unix.mk b/usr/src/uts/3b2/unix.mk new file mode 100644 index 0000000..24ab3db --- /dev/null +++ b/usr/src/uts/3b2/unix.mk @@ -0,0 +1,143 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)kernel:unix.mk 1.7" +MORECPP=-DDEBUG + +ROOT = +DIS = dis +NM = nm +SIZE = size +STRIP = strip +INC=$(ROOT)/usr/include + +LIBS= lib.os lib.io lib.vm +NODE = kernel +REL = +VER = +NAME = $(NODE)$(VER) + +INS=install +INSDIR=. +MKBOOT = mkboot +MASTERD=./master.d +DASHO = -O +CFLAGS= $(DASHO) -I$(INC) -DDEBUG -D_KERNEL -DREM $(MORECPP) +FRC = + +LD_KERNEL_ELF = \ + $(LD) -r -o $(NAME) -u bt_availbit -u reclock -u setmask -u fbread \ + -u ls_remove -u segdev_create -u dma_breakup -u dma_pageio \ + locore.o ddi.o name.o syms.o \ + getsizes.o fs/fs.o disp/gendisp.o \ + $(LIBS) + +LD_KERNEL_COFF = \ + $(LD) -r -o $(NAME) -u bt_availbit -u reclock -u setmask -u fbread \ + -u ls_remove -u segdev_create -u dma_breakup -u dma_pageio \ + vuifile start.o gate.o locore.o ddi.o name.o \ + getsizes.o fs/fs.o disp/gendisp.o \ + $(LIBS) + +all:FRC machine system vmsys fs exec drivers debug disp netinet rpc ktli des klm boot + $(MAKE) -f unix.mk NAME=$(NAME) unix + +machine:FRC + cd ml; $(MAKE) -f ml.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +system:FRC + cd os; $(MAKE) -f os.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +vmsys:FRC + cd vm; $(MAKE) -f vm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +exec:FRC + cd exec; $(MAKE) -f exec.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +drivers:FRC + cd io; $(MAKE) -f io.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +debug:FRC + cd debug; $(MAKE) -f debug.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +boot:FRC + cd boot; $(MAKE) -f boot.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +fs:FRC + cd fs; $(MAKE) -f fs.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +disp:FRC + cd disp; $(MAKE) -f disp.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +netinet:FRC + cd netinet; $(MAKE) -f netinet.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +rpc:FRC + cd rpc; $(MAKE) -f rpc.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +ktli:FRC + cd ktli; $(MAKE) -f ktli.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +des:FRC + cd des; $(MAKE) -f des.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +klm:FRC + cd klm; $(MAKE) -f klm.mk "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" + +unix: $(LIBS) vuifile start.o gate.o locore.o ddi.o name.o getsizes.o fs/fs.o disp/gendisp.o $(MASTERD)/kernel + -rm -f $(NAME) + + if [ x$(CCSTYPE) = xCOFF ] ; \ + then $(LD_KERNEL_COFF) ; \ + else $(LD_KERNEL_ELF) ; \ + fi + + $(MKBOOT) -m $(MASTERD) -d . -k $(NAME); + @echo $(NAME) made. + +clean: + cd ml; $(MAKE) -f ml.mk clean + cd os; $(MAKE) -f os.mk clean + cd vm; $(MAKE) -f vm.mk clean + cd fs; $(MAKE) -f fs.mk clean + cd exec; $(MAKE) -f exec.mk clean + cd io; $(MAKE) -f io.mk clean + cd debug; $(MAKE) -f debug.mk clean + cd disp; $(MAKE) -f disp.mk clean + cd netinet; $(MAKE) -f netinet.mk clean + cd rpc; $(MAKE) -f rpc.mk clean + cd ktli; $(MAKE) -f ktli.mk clean + cd des; $(MAKE) -f des.mk clean + cd klm; $(MAKE) -f klm.mk clean + cd boot; $(MAKE) -f boot.mk clean + -rm -f *.o + +clobber: + cd ml; $(MAKE) -f ml.mk clobber + cd os; $(MAKE) -f os.mk clobber + cd vm; $(MAKE) -f vm.mk clobber + cd fs; $(MAKE) -f fs.mk clobber + cd exec; $(MAKE) -f exec.mk clobber + cd io; $(MAKE) -f io.mk clobber + cd debug; $(MAKE) -f debug.mk clobber + cd disp; $(MAKE) -f disp.mk clobber + cd netinet; $(MAKE) -f netinet.mk clobber + cd rpc; $(MAKE) -f rpc.mk clobber + cd ktli; $(MAKE) -f ktli.mk clobber + cd des; $(MAKE) -f des.mk clobber + cd klm; $(MAKE) -f klm.mk clobber + cd boot; $(MAKE) -f boot.mk clobber + -rm -f KERNEL $(NAME) $(NAME).* ld.out load.* + + +install:all +# $(INS) -f $(INSDIR) "$(NAME)" + cd boot; $(MAKE) -f boot.mk install "FRC=$(FRC)" "DASHO=$(DASHO)" "MORECPP=$(MORECPP)" "INC=$(INC)" ; \ + wait + + +FRC: diff --git a/usr/src/uts/3b2/vm/anon.h b/usr/src/uts/3b2/vm/anon.h new file mode 100644 index 0000000..8a8f586 --- /dev/null +++ b/usr/src/uts/3b2/vm/anon.h @@ -0,0 +1,64 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_ANON_H +#define _VM_ANON_H + +#ident "@(#)kernel:vm/anon.h 1.4" + +/* + * VM - Anonymous pages. + */ + +/* + * Each page which is anonymous, either in memory or in swap, + * has an anon structure. The structure's primary purpose is + * to hold a reference count so that we can detect when the last + * copy of a multiply-referenced copy-on-write page goes away. + * When on the free list, un.next gives the next anon structure + * in the list. Otherwise, un.page is a ``hint'' which probably + * points to the current page. This must be explicitly checked + * since the page can be moved underneath us. This is simply + * an optimization to avoid having to look up each page when + * doing things like fork. + */ +struct anon { + int an_refcnt; + union { + struct page *an_page; /* ``hint'' to the real page */ + struct anon *an_next; /* free list pointer */ + } un; + struct anon *an_bap; /* pointer to real anon */ +#ifdef DEBUG + int an_use; +#define AN_NONE 0 +#define AN_DATA 1 +#define AN_UPAGE 2 +#endif +}; + +struct anoninfo { + u_int ani_max; /* maximum anon pages available */ + u_int ani_free; /* number of anon pages currently free */ + u_int ani_resv; /* number of anon pages reserved */ +}; + +#ifdef _KERNEL +extern struct anoninfo anoninfo; + +struct anon *anon_alloc(); +void anon_dup(/* old, new, size */); +void anon_free(/* app, size */); +int anon_getpage(/* app, protp, pl, sz, seg, addr, rw, cred */); +struct page *anon_private(/* app, seg, addr, ppsteal */); +struct page *anon_zero(/* seg, addr, app */); +void anon_unloadmap(/* ap, ref, mod */); +int anon_resv(/* size */); +void anon_unresv(/* size */); +#endif /* _KERNEL */ + +#endif /* _VM_ANON_H */ diff --git a/usr/src/uts/3b2/vm/as.h b/usr/src/uts/3b2/vm/as.h new file mode 100644 index 0000000..1a84055 --- /dev/null +++ b/usr/src/uts/3b2/vm/as.h @@ -0,0 +1,79 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_AS_H +#define _VM_AS_H + +#ident "@(#)kernel:vm/as.h 1.9" + +#include "vm/faultcode.h" +#include "vm/vm_hat.h" + +/* + * VM - Address spaces. + */ + +/* + * Each address space consists of a list of sorted segments + * and machine dependent address translation information. + * + * All the hard work is in the segment drivers and the + * hardware address translation code. + */ +struct as { + u_int a_lock: 1; + u_int a_want: 1; + u_int a_paglck: 1; + u_int : 13; + u_short a_keepcnt; /* number of `keeps' */ + struct seg *a_segs; /* segments in this address space */ + struct seg *a_seglast; /* last segment hit on the address space */ + size_t a_size; /* size of address space */ + size_t a_rss; /* memory claim for this address space */ + struct hat a_hat; /* hardware address translation */ +}; + +#ifdef _KERNEL + +/* + * Flags for as_gap. + */ +#define AH_DIR 0x1 /* direction flag mask */ +#define AH_LO 0x0 /* find lowest hole */ +#define AH_HI 0x1 /* find highest hole */ +#define AH_CONTAIN 0x2 /* hole must contain `addr' */ + +#ifdef __STDC__ +extern size_t rm_assize(struct as *); +extern int as_lock(struct as *, int, u_int); +#else +extern size_t rm_assize(); +extern int as_lock(); +#endif + +struct seg *as_segat(/* as, addr */); +struct as *as_alloc(); +void as_free(/* as */); +struct as *as_dup(/* as */); +int as_addseg(/* as, seg */); +faultcode_t as_fault(/* as, addr, size, type, rw */); +faultcode_t as_faulta(/* as, addr, size */); +int as_setprot(/* as, addr, size, prot */); +int as_checkprot(/* as, addr, size, prot */); +int as_unmap(/* as, addr, size */); +int as_map(/* as, addr, size, crfp, crargsp */); +int as_gap(/* as, minlen, basep, lenp, flags, addr */); +int as_memory(/* as, addrp, sizep */); +u_int as_swapout(/* as */); +int as_incore(/* as, addr, size, vecp, sizep */); +int as_ctl(/* as, addr, size, func, attr, arg, bitmap, pos */); +u_int as_getprot(/* as, addr, naddrp */); + +struct anon_map *as_shmlookup(/* as, addr */); +#endif /* _KERNEL */ + +#endif /* _VM_AS_H */ diff --git a/usr/src/uts/3b2/vm/bootconf.h b/usr/src/uts/3b2/vm/bootconf.h new file mode 100644 index 0000000..0f5cf76 --- /dev/null +++ b/usr/src/uts/3b2/vm/bootconf.h @@ -0,0 +1,41 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_BOOTCONF_H +#define _VM_BOOTCONF_H + +#ident "@(#)kernel:vm/bootconf.h 1.3" + +/* + * Boot time configuration information objects + */ + +#define MAXFSNAME 16 +#define MAXOBJNAME 128 +/* + * Boot configuration information + */ +struct bootobj { + char bo_fstype[MAXFSNAME]; /* filesystem type name (e.g. nfs) */ + char bo_name[MAXOBJNAME]; /* name of object */ + int bo_flags; /* flags, see below */ + int bo_offset; /* number of blocks */ + int bo_size; /* number of blocks */ + struct vnode *bo_vp; /* vnode of object */ +}; + +/* + * flags + */ +#define BO_VALID 0x01 /* all information in object is valid */ +#define BO_BUSY 0x02 /* object is busy */ + +extern struct bootobj rootfs; +extern struct bootobj dumpfile; +extern struct bootobj swapfile; + +#endif /* _VM_BOOTCONF_H */ diff --git a/usr/src/uts/3b2/vm/cpu.h b/usr/src/uts/3b2/vm/cpu.h new file mode 100644 index 0000000..86c04dc --- /dev/null +++ b/usr/src/uts/3b2/vm/cpu.h @@ -0,0 +1,13 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_CPU_H +#define _VM_CPU_H + +#ident "@(#)kernel:vm/cpu.h 1.2" + +#endif /* _VM_CPU_H */ diff --git a/usr/src/uts/3b2/vm/debugger.h b/usr/src/uts/3b2/vm/debugger.h new file mode 100644 index 0000000..c0f7f0b --- /dev/null +++ b/usr/src/uts/3b2/vm/debugger.h @@ -0,0 +1,138 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_DEBUGGER_H +#define _VM_DEBUGGER_H + + +#ident "@(#)kernel:vm/debugger.h 1.3" +/* + * This file describes the interface between the kernel their debuggers. + * Actually, the term ``kernel'' here is too restrictive - it actually + * applies to any standalone program which is to be run under a debugger. + * The term ``debugger'' here applies to any debugger service which + * uses this interface. + * + * The debugger requires that nobody mess with parts of virtual + * memory if they expect any debugger services. These rules + * apply to all the virtual memory between DEBUGSTART and DEBUGEND: + * + * * Do not write to these addresses. + * * Do not read from (depend on the contents of) these addresses, + * except as documented in the debugvec structure. + * * Do not remap these addresses. + * * Do not change or double-map the pmegs that these addresses + * map through. + * * Do not change or double-map the main memory that these + * addresses map to. + * * These rules apply in + * all map contexts (Sun-3, Sun-4, Sun-386i) + * the kernel context 0 (Sun-2) + * + * Besides the rules for virtual memory cooperation, the following + * debugger/debuggee interface is defined: + * + * * If a debugger is present, it will pass in a '-d' flag + * to the program being debugged (although the program being + * debugged might want to verify that the debugger is actually + * present before taking it as the truth to avoid problems + * with users using the wrong flags in the wrong places). + * The '-d' flag being passed into the debugger itself will + * cause the debugger to prompt for debuggee program name and + * allow debugger commands before debuggee is started. + * * The top *dvec->dv_pages tell the number of pages + * taken from the end of memory. If the debuggee is + * managing all memory, the amount of usable memory is: + * *romp->v_memorysize - mmu_ptob(*dvec->dv_pages) [earlier PROMs] + * *romp->v_memoryavail - mmu_ptob(*dvec->dv_pages) [later PROMs] + * * If the debuggee changes the trace exception handler or + * the trap exception handler for TRAPBRKNO, it MUST call + * (*dvec->dv_scbsync)() after all exception handler changes + * are made. Other exception handlers can be changed + * without any special provisions. + * * If the debuggee is going to relocate itself, it is very + * desirable to have it call (*dvec->dv_scbsync)() soon + * AFTER the relocation to the correct virtual address. + * * The debuggee can call the debugger at any time by + * an explicit call using the CALL_DEBUG() macro, + * a ``trap #TRAPBRKNO'' (68000), ``t TRAPBRKNO'' (sparc), + * ``int 3'' (i386), or by jumping to *dvec->dv_trap. + * * The debuggee is expected not to try and trace itself + * under the debugger - the only way the trace bit can + * be turned on in the debuggee is via the ``rte'' + * instruction. This case is detected and handled + * correctly by the debugger when single stepping, + * except in the case were the rte is returning to + * another rte which is returning to user land + * (welcome to the real world of 680x0 processors). + */ + +#if defined(sun2) || defined(sun3) || defined(sun386) +#define DVEC DEBUGSTART /* location of vector table */ +#define TRAPBRKNO 10 /* breakpoint trap no */ +#endif /* sun2 || sun3 || sun386 */ + +#ifdef sun4 +#define DVEC (DEBUGSTART + 4096) /* location of vector table */ +#define TRAPBRKNO 127 /* breakpoint trap no */ +#endif /* sun4 */ + +/* + * The debugger gets a one megabyte virtual address range in which it + * can reside. It is hoped that this space is large enough to accommodate + * the largest kernel debugger that would be needed but not too large to + * cramp the kernel's virtual address space. We locate the debugger + * in the megabyte before the PROM monitor, except on the 386, where we + * locate it 16 megabytes (minus 20k) in front of the monitor. + */ +#define DEBUGSIZE 0x100000 + +#ifndef LOCORE + +#ifdef sun386 +#define DEBUGSTART (MONSTART - 0x1000000 + 0x5000) /* 16 megs virtual */ +#else +#define DEBUGSTART (MONSTART - DEBUGSIZE) +#endif +#define DEBUGEND (MONSTART) + +typedef int (*func_t)(); + +struct debugvec { + int dv_entry; /* entry point into debugger */ + func_t dv_trap; /* function to trap to enter debugger */ + int *dv_pages; /* ptr to # of pages stolen */ + func_t dv_scbsync; /* function to call after scb is changed */ +#ifdef sun386 + long *dv_vstart; /* start of virtual memory (default 0) */ + char *dv_kbflag; /* pointer to keyboard state flag */ +#endif +}; +#define dvec ((struct debugvec *)DVEC) + +/* + * Use the CALL_DEBUG macro to generate a synchronous call to the debugger. + * + * Because of a bug in some old versions of /bin/as, using this macro + * can crash the assembler as doing (*(func_t)DVEC)() generates a call to + * an absolute address which is not handled correctly by the buggy assemblers. + */ +#if defined (sparc) || defined(sun386) +/* current sparc assemblers cannot handle a call to fixed virtual address */ +#define CALL_DEBUG() { func_t callit = (func_t)DVEC; (*callit)(); } +#else +#define CALL_DEBUG() (*(func_t)DVEC)() +#endif +#endif /* !LOCORE */ + +#if defined(sun386) && !defined(COFF) +#define COFF 1 +#endif + +#define KADBBASE 0xfe000000 /* DEBUGSTART - 0x5000 */ + +#endif /* _VM_DEBUGGER_H */ diff --git a/usr/src/uts/3b2/vm/faultcode.h b/usr/src/uts/3b2/vm/faultcode.h new file mode 100644 index 0000000..bbab20e --- /dev/null +++ b/usr/src/uts/3b2/vm/faultcode.h @@ -0,0 +1,36 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_FAULTCODE_H +#define _VM_FAULTCODE_H + +#ident "@(#)kernel:vm/faultcode.h 1.2" + +/* + * This file describes the "code" that is delivered during + * SIGBUS and SIGSEGV exceptions. It also describes the data + * type returned by vm routines which handle faults. + * + * If FC_CODE(fc) == FC_OBJERR, then FC_ERRNO(fc) contains the errno value + * returned by the underlying object mapped at the fault address. + */ +#define FC_HWERR 0x1 /* misc hardware error (e.g. bus timeout) */ +#define FC_ALIGN 0x2 /* hardware alignment error */ +#define FC_NOMAP 0x3 /* no mapping at the fault address */ +#define FC_PROT 0x4 /* access exceeded current protections */ +#define FC_OBJERR 0x5 /* underlying object returned errno value */ + +#define FC_MAKE_ERR(e) (((e) << 8) | FC_OBJERR) + +#define FC_CODE(fc) ((fc) & 0xff) +#define FC_ERRNO(fc) ((unsigned)(fc) >> 8) + +#ifndef LOCORE +typedef int faultcode_t; /* type returned by vm fault routines */ +#endif /* LOCORE */ + +#endif /* _VM_FAULTCODE_H */ diff --git a/usr/src/uts/3b2/vm/hat.h b/usr/src/uts/3b2/vm/hat.h new file mode 100644 index 0000000..526acda --- /dev/null +++ b/usr/src/uts/3b2/vm/hat.h @@ -0,0 +1,125 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_HAT_H +#define _VM_HAT_H + +#ident "@(#)kernel:vm/hat.h 1.5" + +/* + * VM - Hardware Address Translation management. + * + * This file describes the machine independent interfaces to + * the hardware address translation management routines. Other + * machine specific interfaces and structures are defined + * in . The hat layer manages the address + * translation hardware as a cache driven by calls from the + * higher levels of the VM system. + */ + +#include "vm/vm_hat.h" + +#ifdef _KERNEL +/* + * No flags specified. + */ +#define HAT_NOFLAGS 0 + +/* + * One time hat initialization + */ +void hat_init(); + +/* + * Operations on hat resources for an address space: + * - initialize any needed hat structures for the address space + * - free all hat resources now owned by this address space + * - initialize any needed hat structures when the process is + * swapped in. + * - free all hat resources that are not needed while the process + * is swapped out. + * - dup any hat resources that can be created when duplicating + * another process' address space. + * + * N.B. - The hat structure is guaranteed to be zeroed when created. + * The hat layer can choose to define hat_alloc as a macro to avoid + * a subroutine call if this is sufficient initialization. + */ +void hat_alloc(/* as */); +void hat_free(/* as */); +void hat_swapin(/* as */); +void hat_swapout(/* as */); +int hat_dup(/* as */); + +/* Operations to allocate/reserve mapping structures + * - allocate/reserve mapping structures for a segment. + * - free mapping structures for a given segment. + */ +u_int hat_map(/* seg, ppl, base, prot, flags */); + +/* + * Flags to pass to hat_map(). + * + * XXX - Not all used right now. Currently only seg_vn pages are + * pre-loaded; i.e. before a fault. + */ +#define HAT_PRELOAD 1 /* pre-load pages for segment. */ +#define HAT_VNLIST 2 /* When preloading pages, use vnode list. */ +#define HAT_FRLIST 4 /* "" , use free/intrans list pointers. */ + +/* + * Operations on a named address with in a segment: + * - load/lock the given page struct + * - load/lock the given page frame number + * - unlock the given address + * + * (Perhaps we need an interface to load several pages at once?) + */ +void hat_memload(/* seg, addr, pp, prot, flags */); +void hat_devload(/* seg, addr, pf, prot, flags */); +void hat_unlock(/* seg, addr */); + +/* + * Operations over an address range: + * - change protections + * - change mapping to refer to a new segment + * - unload mapping + */ +void hat_chgprot(/* seg, addr, len, prot */); +void hat_newseg(/* seg, addr, len, nseg */); +void hat_unload(/* seg, addr, len, flags */); + +/* + * Flags to pass to hat_memload(),hat_devload(), and hat_unload(). + */ +#define HAT_LOCK 1 +#define HAT_UNLOCK 2 +#define HAT_FREEPP 4 +#define HAT_RELEPP 8 + +/* + * Operations that work on all active translation for a given page: + * - unload all translations to page + * - get hw stats from hardware into page struct and reset hw stats + */ +void hat_pageunload(/* pp */); +void hat_pagesync(/* pp */); + +/* + * Operations that return physical page numbers (ie - used by mapin): + * - return the pfn for kernel virtual address + * - return the pfn for arbitrary virtual address + */ +u_int hat_getkpfnum(/* addr */); +/* + * XXX - This one is not yet implemented - not yet needed + * u_int hat_getpfnum(as, addr); + */ + +#endif /* _KERNEL */ + +#endif /* _VM_HAT_H */ diff --git a/usr/src/uts/3b2/vm/kernel.h b/usr/src/uts/3b2/vm/kernel.h new file mode 100644 index 0000000..07b687c --- /dev/null +++ b/usr/src/uts/3b2/vm/kernel.h @@ -0,0 +1,25 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_KERNEL_H +#define _VM_KERNEL_H + +#ident "@(#)kernel:vm/kernel.h 1.3" + +/* + * Global variables for the kernel + */ + +u_long rmalloc(); + +/* 1.2 */ +time_t boottime; +struct timezone tz; /* XXX */ + +long avenrun[3]; /* FSCALED average run queue lengths */ + +#endif /* _VM_KERNEL_H */ diff --git a/usr/src/uts/3b2/vm/mp.h b/usr/src/uts/3b2/vm/mp.h new file mode 100644 index 0000000..b9099bd --- /dev/null +++ b/usr/src/uts/3b2/vm/mp.h @@ -0,0 +1,56 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_MP_H +#define _VM_MP_H + +#ident "@(#)kernel:vm/mp.h 1.4" + +/* + * VM - multiprocessor/ing support. + * + * Currently the mon_enter() / mon_exit() pair implements a + * simple monitor for objects protected by the appropriate lock. + * The cv_wait() / cv_broadcast pait implements a simple + * condition variable which can be used for `sleeping' + * and `waking' inside a monitor if some resource + * is needed which is not available. + */ + +typedef struct mon_t { + unchar dummy; +} mon_t; + +#if defined(DEBUG) || defined(lint) +void mon_enter(/* lk */); +void mon_exit(/* lk */); +void cv_wait(/* lk, cond */); +void cv_broadcast(/* lk, cond */); + +#else + +/* + * mon_enter is used as a type of multiprocess semaphore + * used to implement a monitor where the lock represents + * the ability to operate on the associated object. + * For now, the lock/object association is done + * by convention only. + * For single processor systems that are debugged, no lock is needed. + * For multiprocessor systems that are debugged, a simple lock suffices. + * Only the single processor macros are included. + */ + +#define mon_enter(lk) +#define mon_exit(lk) +#define cv_wait(lk, cond) ((void) sleep(cond, PSWP+1)) +#define cv_broadcast(lk, cond) ((void) wakeup(cond)) + +#endif /* DEBUG */ + +#define lock_init(lk) (lk)->dummy = 0 + +#endif /* _VM_MP_H */ diff --git a/usr/src/uts/3b2/vm/page.h b/usr/src/uts/3b2/vm/page.h new file mode 100644 index 0000000..cedbff3 --- /dev/null +++ b/usr/src/uts/3b2/vm/page.h @@ -0,0 +1,218 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_PAGE_H +#define _VM_PAGE_H + +#ident "@(#)kernel:vm/page.h 1.15" + +/* + * VM - Ram pages. + * + * Each physical page has a page structure, which is used to maintain + * these pages as a cache. A page can be found via a hashed lookup + * based on the [vp, offset]. If a page has an [vp, offset] identity, + * then it is entered on a doubly linked circular list off the + * vnode using the vpnext/vpprev pointers. If the p_free bit + * is on, then the page is also on a doubly linked circular free + * list using next/prev pointers. If the p_intrans bit is on, + * then the page is currently being read in or written back. + * In this case, the next/prev pointers are used to link the + * pages together for a consecutive IO request. If the page + * is in transit and the the page is coming in (pagein), then you + * must wait for the IO to complete before you can attach to the page. + * + */ +typedef struct page { + u_int p_lock: 1, /* locked for name manipulation */ + p_want: 1, /* page wanted */ + p_free: 1, /* on free list */ + p_intrans: 1, /* data for [vp, offset] intransit */ + p_gone: 1, /* page has been released */ + p_mod: 1, /* software copy of modified bit */ + p_ref: 1, /* software copy of reference bit */ + p_pagein: 1, /* being paged in, data not valid */ + p_nc: 1, /* do not cache page */ + p_age: 1; /* on page_freelist */ + u_int p_nio : 6; /* # of outstanding io reqs needed */ + u_short p_keepcnt; /* number of page `keeps' */ + struct vnode *p_vnode; /* logical vnode this page is from */ + u_int p_offset; /* offset into vnode for this page */ + struct page *p_hash; /* hash by [vnode, offset] */ + struct page *p_next; /* next page in free/intrans lists */ + struct page *p_prev; /* prev page in free/intrans lists */ + struct page *p_vpnext; /* next page in vnode list */ + struct page *p_vpprev; /* prev page in vnode list */ + caddr_t p_mapping; /* hat specific translation info */ + u_short p_lckcnt; /* number of locks on page data */ + u_short p_cowcnt; /* number of copy on write lock */ + daddr_t p_dblist[PAGESIZE/NBPSCTR]; /* disk storage for the page */ +#ifdef DEBUG + struct proc *p_uown; /* process owning it as u-page */ +#endif +} page_t; + +#ifdef _KERNEL +#define PAGE_HOLD(pp) (pp)->p_keepcnt++ +#define PAGE_RELE(pp) page_rele(pp) + +/* + * page_get() request flags. + */ +#ifndef P_NOSLEEP +#define P_NOSLEEP 0x0000 +#define P_CANWAIT 0x0001 +#define P_PHYSCONTIG 0x0002 +#endif + +#define PAGE_HASHSZ page_hashsz + +extern int page_hashsz; +extern page_t **page_hash; + +/* + * In the long term, we should generalize the next three values to + * a tuple controlled at a higher level to allow for non-contiguous + * memory layout. + */ +extern page_t *pages; /* array of all page structures */ +extern page_t *epages; /* end of all pages */ +extern u_int pages_base; /* page # for pages[0] */ +extern uint pages_end; + +#ifdef sun386 +extern page_t *epages2; /* end of absolutely all pages */ +extern u_int pages_base2; /* page # for compaq expanded mem */ +#endif + +/* + * Variables controlling locking of physical memory. + */ +extern u_int pages_pp_locked; /* physical pages actually locked */ +extern u_int pages_pp_claimed; /* physical pages reserved */ +extern u_int pages_pp_kernel; /* physical page locks by kernel */ +extern u_int pages_pp_maximum; /* tuning: lock + claim <= max */ + +/* + * Page frame operations. + */ + +void page_init(/* pp, num, base */); +void page_reclaim(/* pp */); +page_t *page_find(/* vp, off */); +page_t *page_lookup(/* vp, off */); +int page_enter(/* pp, vp, off */); +void page_abort(/* pp */); +void page_free(/* pp */); +page_t *page_get(/* bytes, flags */); +int page_pp_lock(/* pp, claim, kernel */); +void page_pp_unlock(/* pp, claim, kernel */); +void page_pp_useclaim(/* opp, npp */); +int page_addclaim(/* claim */); +void page_subclaim(/* claim */); +void page_hashin(/* pp, vp, offset, lock */); +void page_hashout(/* pp */); +void page_sub(/* ppp, pp */); +void page_sortadd(/* ppp, pp */); +void page_wait(/* pp */); +page_t *page_numtookpp(/* pfnum */); + +#if defined(DEBUG) || defined(sun386) + +u_int page_pptonum(/* pp */); +page_t *page_numtopp(/* pfnum */); + +#else + + +#define page_pptonum(pp) \ + (((uint)((pp) - pages) * \ + (PAGESIZE/MMU_PAGESIZE)) + pages_base) + +#define page_numtopp(pfnum) \ + ((pfnum) < pages_base || (pfnum) >= pages_end) ? \ + ((struct page *) NULL) : \ + ((struct page *) (&pages[(uint) ((pfnum) - pages_base) / \ + (PAGESIZE/MMU_PAGESIZE)])) + +#endif + +#ifdef DEBUG + +void page_rele(/* pp */); +void page_lock(/* pp */); +void page_unlock(/* pp */); + +#else + + +#include "vm/mp.h" +extern mon_t page_mplock; /* lock for manipulating page links */ + +#define page_rele(pp) { \ + mon_enter(&page_mplock); \ + \ + if (--((struct page *)(pp))->p_keepcnt == 0) { \ + while (((struct page *)(pp))->p_want) { \ + cv_broadcast(&page_mplock, (char *)(pp)); \ + ((struct page *)(pp))->p_want = 0; \ + } \ + } \ + \ + mon_exit(&page_mplock); \ + \ + if (((struct page *)(pp))->p_keepcnt == 0 \ + && (((struct page *)(pp))->p_gone \ + || ((struct page *)(pp))->p_vnode == NULL)) \ + page_abort(pp); \ +} +#define page_lock(pp) { \ + mon_enter(&page_mplock); \ + while (pp->p_lock) \ + page_cv_wait(pp); \ + pp->p_lock = 1; \ + mon_exit(&page_mplock); \ +} + +#define page_unlock(pp) { \ + mon_enter(&page_mplock); \ + ((struct page *)(pp))->p_lock = 0; \ + while (((struct page *)(pp))->p_want) { \ + cv_broadcast(&page_mplock, (char *)(pp)); \ + ((struct page *)(pp))->p_want = 0; \ + } \ + mon_exit(&page_mplock); \ +} + +#endif + +#endif /* _KERNEL */ + +/* + * Page hash table is a power-of-two in size, externally chained + * through the hash field. PAGE_HASHAVELEN is the average length + * desired for this chain, from which the size of the page_hash + * table is derived at boot time and stored in the kernel variable + * page_hashsz. In the hash function it is given by PAGE_HASHSZ. + * PAGE_HASHVPSHIFT is defined so that 1 << PAGE_HASHVPSHIFT is + * the approximate size of a vnode struct. + */ +#define PAGE_HASHAVELEN 4 +#define PAGE_HASHVPSHIFT 6 +#define PAGE_HASHFUNC(vp, off) \ + ((((off) >> PAGESHIFT) + ((int)(vp) >> PAGE_HASHVPSHIFT)) & \ + (PAGE_HASHSZ - 1)) + +#if defined(__STDC__) +extern void page_cv_wait(page_t *); +extern void ppcopy(page_t *, page_t *); +#else +extern void page_cv_wait(); +extern void ppcopy(); +#endif /* __STDC__ */ + +#endif /* _VM_PAGE_H */ diff --git a/usr/src/uts/3b2/vm/pte.h b/usr/src/uts/3b2/vm/pte.h new file mode 100644 index 0000000..8870268 --- /dev/null +++ b/usr/src/uts/3b2/vm/pte.h @@ -0,0 +1,13 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_PTE_H +#define _VM_PTE_H + +#ident "@(#)kernel:vm/pte.h 1.2" + +#endif /* _VM_PTE_H */ diff --git a/usr/src/uts/3b2/vm/pvn.h b/usr/src/uts/3b2/vm/pvn.h new file mode 100644 index 0000000..5343b3f --- /dev/null +++ b/usr/src/uts/3b2/vm/pvn.h @@ -0,0 +1,53 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_PVN_H +#define _VM_PVN_H + +#ident "@(#)kernel:vm/pvn.h 1.2" + +/* + * VM - paged vnode. + * + * The VM system manages memory as a cache of paged vnodes. + * This file desribes the interfaces to common subroutines + * used to help implement the VM/file system routines. + */ + +struct page *pvn_kluster(/* vp, off, seg, addr, offp, lenp, vp_off, + vp_len, isra */); +void pvn_fail(/* plist, flags */); +void pvn_done(/* bp */); +struct page *pvn_vplist_dirty(/* vp, off, flags */); +struct page *pvn_range_dirty(/* vp, off, eoff, offlo, offhi, flags */); +void pvn_vptrunc(/* vp, vplen, zbytes */); +void pvn_unloadmap(/* vp, offset, ref, mod */); +int pvn_getpages(/* getapage, vp, off, len, protp, pl, plsz, seg, addr, + rw, cred */); + +/* + * When requesting pages from the getpage routines, pvn_getpages will + * allocate space to return PVN_GETPAGE_NUM pages which map PVN_GETPAGE_SZ + * worth of bytes. These numbers are chosen to be the minimum of the max's + * given in terms of bytes and pages. + */ +#define PVN_MAX_GETPAGE_SZ 0x10000 /* getpage size limit */ +#define PVN_MAX_GETPAGE_NUM 0x8 /* getpage page limit */ + +#if PVN_MAX_GETPAGE_SZ > PVN_MAX_GETPAGE_NUM * PAGESIZE + +#define PVN_GETPAGE_SZ ptob(PVN_MAX_GETPAGE_NUM) +#define PVN_GETPAGE_NUM PVN_MAX_GETPAGE_NUM + +#else + +#define PVN_GETPAGE_SZ PVN_MAX_GETPAGE_SZ +#define PVN_GETPAGE_NUM btop(PVN_MAX_GETPAGE_SZ) + +#endif + +#endif /* _VM_PVN_H */ diff --git a/usr/src/uts/3b2/vm/reboot.h b/usr/src/uts/3b2/vm/reboot.h new file mode 100644 index 0000000..6dfe7c3 --- /dev/null +++ b/usr/src/uts/3b2/vm/reboot.h @@ -0,0 +1,35 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_REBOOT_H +#define _VM_REBOOT_H + +#ident "@(#)kernel:vm/reboot.h 1.2" + +/* + * Arguments to reboot system call and flags to init. + * + * On the VAX, these are passed to boot program in r11, + * and on to init. + * + * On the Sun, these are parsed from the boot command line + * and used to construct the argument list for init. + */ +#define RB_AUTOBOOT 0 /* flags for system auto-booting itself */ + +#define RB_ASKNAME 0x001 /* ask for file name to reboot from */ +#define RB_SINGLE 0x002 /* reboot to single user only */ +#define RB_NOSYNC 0x004 /* dont sync before reboot */ +#define RB_HALT 0x008 /* don't reboot, just halt */ +#define RB_INITNAME 0x010 /* name given for /etc/init */ +#define RB_NOBOOTRC 0x020 /* don't run /etc/rc.boot */ +#define RB_DEBUG 0x040 /* being run under debugger */ +#define RB_DUMP 0x080 /* dump system core */ +#define RB_WRITABLE 0x100 /* mount root read/write */ +#define RB_STRING 0x200 /* pass boot args to prom monitor */ + +#endif /* _VM_REBOOT_H */ diff --git a/usr/src/uts/3b2/vm/rm.h b/usr/src/uts/3b2/vm/rm.h new file mode 100644 index 0000000..32d45b5 --- /dev/null +++ b/usr/src/uts/3b2/vm/rm.h @@ -0,0 +1,43 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_RM_H +#define _VM_RM_H + +#ident "@(#)kernel:vm/rm.h 1.5" + +/* + * VM - Resource Management. + */ + +#ifdef DEBUG + +struct page *rm_allocpage(/* seg, addr */); +struct page *rm_allocpage(/* seg, addr, len, flags */); + +#else + +#define rm_allocpage(seg, addr, len, flags) \ + (struct page *) (page_get((u_int) (len), (u_int) (flags))) + +#endif + +void rm_outofanon(); +void rm_outofhat(); +size_t rm_asrss(/* as */); +size_t rm_assize(/* as */); + +/* + * rm_allocpage() request flags. + */ +#ifndef P_NOSLEEP +#define P_NOSLEEP 0x0000 +#define P_CANWAIT 0x0001 +#define P_PHYSCONTIG 0x0002 +#endif + +#endif /* _VM_RM_H */ diff --git a/usr/src/uts/3b2/vm/seg.h b/usr/src/uts/3b2/vm/seg.h new file mode 100644 index 0000000..241480c --- /dev/null +++ b/usr/src/uts/3b2/vm/seg.h @@ -0,0 +1,144 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_SEG_H +#define _VM_SEG_H + +#ident "@(#)kernel:vm/seg.h 1.8" + +#include "vm/faultcode.h" +#include "vm/mp.h" + +/* + * VM - Segments. + */ + +/* + * An address space contains a set of segments, managed by drivers. + * Drivers support mapped devices, sharing, copy-on-write, etc. + * + * The seg structure contains a lock to prevent races, the base virtual + * address and size of the segment, a back pointer to the containing + * address space, pointers to maintain a circularly doubly linked list + * of segments in the same address space, and procedure and data hooks + * for the driver. The seg list on the address space is sorted by + * ascending base addresses and overlapping segments are not allowed. + * + * After a segment is created, faults may occur on pages of the segment. + * When a fault occurs, the fault handling code must get the desired + * object and set up the hardware translation to the object. For some + * objects, the fault handling code also implements copy-on-write. + * + * When the hat wants to unload a translation, it can call the unload + * routine which is responsible for processing reference and modify bits. + */ + +/* + * Fault information passed to the seg fault handling routine. + * The F_SOFTLOCK and F_SOFTUNLOCK are used by software + * to lock and unlock pages for physical I/O. + */ +enum fault_type { + F_INVAL, /* invalid page */ + F_PROT, /* protection fault */ + F_SOFTLOCK, /* software requested locking */ + F_SOFTUNLOCK /* software requested unlocking */ +}; + +/* + * seg_rw gives the access type for a fault operation + */ +enum seg_rw { + S_OTHER, /* unknown or not touched */ + S_READ, /* read access attempted */ + S_WRITE, /* write access attempted */ + S_EXEC /* execution access attempted */ +}; + +struct seg { + mon_t s_lock; + addr_t s_base; /* base virtual address */ + u_int s_size; /* size in bytes */ + struct as *s_as; /* containing address space */ + struct seg *s_next; /* next seg in this address space */ + struct seg *s_prev; /* prev seg in this address space */ + struct seg_ops { +#if defined(__STDC__) + int (*dup)(struct seg *, struct seg *); + int (*unmap)(struct seg *, addr_t, u_int); + void (*free)(struct seg *); + faultcode_t (*fault)(struct seg *, addr_t, u_int, + enum fault_type, enum seg_rw); + faultcode_t (*faulta)(struct seg *, addr_t); + void (*unload)(struct seg *, addr_t, u_int, u_int); + int (*setprot)(struct seg *, addr_t, u_int, u_int); + int (*checkprot)(struct seg *, addr_t, u_int, u_int); + int (*kluster)(struct seg *, addr_t, int); + u_int (*swapout)(struct seg *); + int (*sync)(struct seg *, addr_t, u_int, int, u_int); + int (*incore)(struct seg *, addr_t, u_int, char *); + int (*lockop)(struct seg *, addr_t, u_int, int, int, + ulong *, u_int); + int (*getprot)(struct seg *, addr_t, u_int, u_int *); + off_t (*getoffset)(struct seg *, addr_t); + int (*gettype)(struct seg *, addr_t); + int (*getvp)(struct seg *, addr_t, struct vnode **); +#else + int (*dup)(); + int (*unmap)(); + void (*free)(); + faultcode_t (*fault)(); + faultcode_t (*faulta)(); + void (*unload)(); + int (*setprot)(); + int (*checkprot)(); + int (*kluster)(); + u_int (*swapout)(); + int (*sync)(); + int (*incore)(); + int (*lockop)(); + int (*getprot)(); + off_t (*getoffset)(); + int (*gettype)(); + int (*getvp)(); +#endif + } *s_ops; + _VOID *s_data; /* private data for instance */ +}; + +#ifdef _KERNEL +/* + * Generic segment operations + */ +struct seg *seg_alloc(/* as, base, size */); +int seg_attach(/* as, base, size, seg */); +void seg_free(/* seg */); + +#ifdef DEBUG + +u_int seg_page(/* seg, addr */); +u_int seg_pages(/* seg */); + +#else + +#define seg_page(seg, addr) \ + ((u_int)(((addr) - (seg)->s_base) >> PAGESHIFT)) + +#define seg_pages(seg) \ + ((u_int)(((seg)->s_size + PAGEOFFSET) >> PAGESHIFT)) + +#endif + +#if defined(__STDC__) +extern void seg_unmap(struct seg *); +#else +extern void seg_unmap(); +#endif /* __STDC__ */ + +#endif /* _KERNEL */ + +#endif /* _VM_SEG_H */ diff --git a/usr/src/uts/3b2/vm/seg_dev.c b/usr/src/uts/3b2/vm/seg_dev.c new file mode 100644 index 0000000..3b21669 --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_dev.c @@ -0,0 +1,602 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/seg_dev.c 1.16" + +/* + * VM - segment of a mapped device. + * + * This segment driver is used when mapping character special devices. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/mman.h" +#include "sys/systm.h" +#include "sys/errno.h" +#include "sys/kmem.h" +#include "sys/cmn_err.h" +#include "sys/vnode.h" +#include "sys/debug.h" +#include "sys/proc.h" +#include "sys/user.h" + +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/seg_dev.h" +#include "vm/pvn.h" +#include "vm/vpage.h" + +/* + * Private seg op routines. + */ +STATIC int segdev_dup(/* seg, newsegp */); +STATIC int segdev_unmap(/* seg, addr, len */); +STATIC void segdev_free(/* seg */); +STATIC faultcode_t segdev_fault(/* seg, addr, len, type, rw */); +STATIC faultcode_t segdev_faulta(/* seg, addr */); +STATIC void segdev_unload(/* seg, addr, ref, mod */); +STATIC int segdev_setprot(/* seg, addr, size, len */); +STATIC int segdev_checkprot(/* seg, addr, size, len */); +STATIC int segdev_getprot(/* seg, addr, size, len */); +STATIC off_t segdev_getoffset(/* seg, addr */); +STATIC int segdev_gettype(/* seg, addr */); +STATIC int segdev_getvp(/* seg, addr, vpp */); +STATIC int segdev_badop(); +STATIC int segdev_incore(/* seg, addr, size, vec */); +STATIC int segdev_ctlops(/* seg, addr, size, [flags] */); + +STATIC struct seg_ops segdev_ops = { + segdev_dup, + segdev_unmap, + segdev_free, + segdev_fault, + segdev_faulta, + segdev_unload, + segdev_setprot, + segdev_checkprot, + segdev_badop, /* kluster */ + (u_int (*)()) NULL, /* swapout */ + segdev_ctlops, /* sync */ + segdev_incore, + segdev_ctlops, /* lockop */ + segdev_getprot, + segdev_getoffset, + segdev_gettype, + segdev_getvp, +}; + +/* + * Create a device segment. + */ +int +segdev_create(seg, argsp) + struct seg *seg; + _VOID *argsp; +{ + register struct segdev_data *sdp; + register struct segdev_crargs *a = (struct segdev_crargs *)argsp; + register int error; + extern struct vnode *specfind(); + + error = hat_map(seg, NULL, a->offset, a->prot, HAT_NOFLAGS); + if (error != 0) + return(error); + + sdp = (struct segdev_data *)kmem_alloc(sizeof (struct segdev_data),KM_SLEEP); + sdp->mapfunc = a->mapfunc; + sdp->offset = a->offset; + sdp->prot = a->prot; + sdp->maxprot = a->maxprot; + sdp->pageprot = 0; + sdp->vpage = NULL; + + /* Hold associated vnode -- segdev only deals with CHR devices */ + sdp->vp = specfind(a->dev, VCHR); + ASSERT(sdp->vp != NULL); + + seg->s_ops = &segdev_ops; + seg->s_data = (char *)sdp; + + /* Inform the vnode of the new mapping */ + error = VOP_ADDMAP(sdp->vp, sdp->offset, seg->s_as, &seg->s_base, + seg->s_size, sdp->prot, sdp->maxprot, 0, u.u_cred); + + return (error); +} + +/* + * Duplicate seg and return new segment in newsegp. + */ +STATIC int +segdev_dup(seg, newseg) + struct seg *seg, *newseg; +{ + register struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + register struct segdev_data *newsdp; + struct segdev_crargs a; + int error; + + a.mapfunc = sdp->mapfunc; + a.dev = sdp->vp->v_rdev; + a.offset = sdp->offset; + a.prot = sdp->prot; + a.maxprot = sdp->maxprot; + + error = segdev_create(newseg, (caddr_t)&a); + if (error != 0) + return (error); + newsdp = (struct segdev_data *)newseg->s_data; + newsdp->pageprot = sdp->pageprot; + if (sdp->vpage != NULL) { + register u_int nbytes = seg_pages(seg) * sizeof (struct vpage); + + if (newsdp->vpage == NULL) + newsdp->vpage = (struct vpage *)kmem_alloc(nbytes,KM_SLEEP); + bcopy((caddr_t)sdp->vpage, (caddr_t)newsdp->vpage, nbytes); + } + return (error); +} + +/* + * Split a segment at addr for length len. + */ +/*ARGSUSED*/ +STATIC int +segdev_unmap(seg, addr, len) + register struct seg *seg; + register addr_t addr; + u_int len; +{ + register struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + register struct segdev_data *nsdp; + register struct seg *nseg; + register u_int opages, /* old segment size in pages */ + npages, /* new segment size in pages */ + dpages; /* pages being deleted (unmapped)*/ + + addr_t nbase; + u_int nsize; + + /* + * Check for bad sizes + */ + if (addr < seg->s_base || addr + len > seg->s_base + seg->s_size || + (len & PAGEOFFSET) || ((u_int)addr & PAGEOFFSET)) + cmn_err(CE_PANIC, "segdev_unmap"); + + /* + * Unload any hardware translations in the range to be taken out. + */ + hat_unload(seg, addr, len, HAT_NOFLAGS); + + /* Inform the vnode of the unmapping. */ + ASSERT(sdp->vp != NULL); + if (VOP_DELMAP(sdp->vp, sdp->offset, seg->s_as, addr, len, sdp->prot, + sdp->maxprot, MAP_SHARED, u.u_cred) != 0) + cmn_err(CE_WARN, "segdev_unmap VOP_DELMAP failure"); + /* + * Check for entire segment + */ + if (addr == seg->s_base && len == seg->s_size) { + seg_free(seg); + return (0); + } + + opages = seg_pages(seg); + dpages = btop(len); + npages = opages - dpages; + + /* + * Check for beginning of segment + */ + if (addr == seg->s_base) { + if (sdp->vpage != NULL) { + register uint nbytes; + register struct vpage *ovpage; + + ovpage = sdp->vpage; /* keep pointer to vpage */ + + nbytes = npages * sizeof (struct vpage); + sdp->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + bcopy((caddr_t)&ovpage[dpages], + (caddr_t)sdp->vpage, nbytes); + + /* free up old vpage */ + kmem_free(ovpage, opages * sizeof (struct vpage)); + } + sdp->offset += len; + + seg->s_base += len; + seg->s_size -= len; + return (0); + } + + /* + * Check for end of segment + */ + if (addr + len == seg->s_base + seg->s_size) { + if (sdp->vpage != NULL) { + register uint nbytes; + register struct vpage *ovpage; + + ovpage = sdp->vpage; /* keep pointer to vpage */ + + nbytes = npages * sizeof (struct vpage); + sdp->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + bcopy((caddr_t)ovpage, (caddr_t)sdp->vpage, nbytes); + + /* free up old vpage */ + kmem_free(ovpage, opages * sizeof (struct vpage)); + + } + seg->s_size -= len; + return (0); + } + + /* + * The section to go is in the middle of the segment, + * have to make it into two segments. nseg is made for + * the high end while seg is cut down at the low end. + */ + nbase = addr + len; /* new seg base */ + nsize = (seg->s_base + seg->s_size) - nbase; /* new seg size */ + seg->s_size = addr - seg->s_base; /* shrink old seg */ + nseg = seg_alloc(seg->s_as, nbase, nsize); + if (nseg == NULL) + cmn_err(CE_PANIC, "segdev_unmap seg_alloc"); + + nseg->s_ops = seg->s_ops; + nsdp = (struct segdev_data *)kmem_alloc(sizeof (struct segdev_data),KM_SLEEP); + nseg->s_data = (char *)nsdp; + nsdp->pageprot = sdp->pageprot; + nsdp->prot = sdp->prot; + nsdp->maxprot = sdp->maxprot; + nsdp->mapfunc = sdp->mapfunc; + nsdp->offset = sdp->offset + nseg->s_base - seg->s_base; + VN_HOLD(sdp->vp); /* Hold vnode associated with the new seg */ + nsdp->vp = sdp->vp; + + if (sdp->vpage == NULL) + nsdp->vpage = NULL; + else { + /* need to split vpage into two arrays */ + register uint nbytes; + register struct vpage *ovpage; + + ovpage = sdp->vpage; /* keep pointer to vpage */ + + npages = seg_pages(seg); /* seg has shrunk */ + nbytes = npages * sizeof (struct vpage); + sdp->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + + bcopy((caddr_t)ovpage, (caddr_t)sdp->vpage, nbytes); + + npages = seg_pages(nseg); + nbytes = npages * sizeof (struct vpage); + nsdp->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + + bcopy((caddr_t)&ovpage[opages - dpages], + (caddr_t)nsdp->vpage, nbytes); + + /* free up old vpage */ + kmem_free(ovpage, opages * sizeof (struct vpage)); + } + + /* + * Now we do something so that all the translations which used + * to be associated with seg but are now associated with nseg. + */ + hat_newseg(seg, nseg->s_base, nseg->s_size, nseg); + + return (0); +} + +/* + * Free a segment. + */ +STATIC void +segdev_free(seg) + struct seg *seg; +{ + register struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + u_int npages = seg_pages(seg); + + VN_RELE(sdp->vp); + if (sdp->vpage != NULL) + kmem_free((caddr_t)sdp->vpage, npages * sizeof (struct vpage)); + + kmem_free((char *)sdp, sizeof (*sdp)); +} + +/* + * Handle a fault on a device segment. + */ +STATIC faultcode_t +segdev_fault(seg, addr, len, type, rw) + register struct seg *seg; + register addr_t addr; + u_int len; + enum fault_type type; + enum seg_rw rw; +{ + register struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + register addr_t adr; + register u_int prot, protchk; + int pf; + struct vpage *vpage; + + if (type == F_PROT) { + /* + * Since the seg_dev driver does not implement copy-on-write, + * this means that a valid translation is already loaded, + * but we got an fault trying to access the device. + * Return an error here to prevent going in an endless + * loop reloading the same translation... + */ + return (FC_PROT); + } + + if (type != F_SOFTUNLOCK) { + if (sdp->pageprot == 0) { + switch (rw) { + case S_READ: + protchk = PROT_READ; + break; + case S_WRITE: + protchk = PROT_WRITE; + break; + case S_EXEC: + protchk = PROT_EXEC; + break; + case S_OTHER: + default: + protchk = PROT_READ | PROT_WRITE | PROT_EXEC; + break; + } + prot = sdp->prot; + if ((prot & protchk) == 0) + return (FC_PROT); + vpage = NULL; + } else { + vpage = &sdp->vpage[seg_page(seg, addr)]; + } + } + + for (adr = addr; adr < addr + len; adr += PAGESIZE) { + if (type == F_SOFTUNLOCK) { + hat_unlock(seg, adr); + continue; + } + if (vpage != NULL) { + switch (rw) { + case S_READ: + protchk = PROT_READ; + break; + case S_WRITE: + protchk = PROT_WRITE; + break; + case S_EXEC: + protchk = PROT_EXEC; + break; + case S_OTHER: + default: + protchk = PROT_READ | PROT_WRITE | PROT_EXEC; + break; + } + prot = vpage->vp_prot; + vpage++; + if ((prot & protchk) == 0) + return (FC_PROT); + } + + pf = (*sdp->mapfunc)(sdp->vp->v_rdev, + sdp->offset + (adr - seg->s_base), prot); + if (pf == -1) + return (FC_MAKE_ERR(EFAULT)); + + hat_devload(seg, adr, pf, prot, type == F_SOFTLOCK); + } + + return (0); +} + +/* + * Asynchronous page fault. We simply do nothing since this + * entry point is not supposed to load up the translation. + */ +/*ARGSUSED*/ +STATIC faultcode_t +segdev_faulta(seg, addr) + struct seg *seg; + addr_t addr; +{ + + return (0); +} + +/*ARGSUSED*/ +STATIC void +segdev_unload(seg, addr, ref, mod) + struct seg *seg; + addr_t addr; + u_int ref, mod; +{ + + /* cannot use ref and mod bits on devices, so ignore 'em */ +} + +STATIC int +segdev_setprot(seg, addr, len, prot) + register struct seg *seg; + register addr_t addr; + register u_int len, prot; +{ + register struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + register struct vpage *vp, *evp; + + if ((sdp->maxprot & prot) != prot) + return (EACCES); /* violated maxprot */ + + if (addr == seg->s_base && len == seg->s_size && sdp->pageprot == 0) { + if (sdp->prot == prot) + return (0); /* all done */ + sdp->prot = (u_char)prot; + } else { + sdp->pageprot = 1; + if (sdp->vpage == NULL) { + /* + * First time through setting per page permissions, + * initialize all the vpage structures to prot + */ + sdp->vpage = (struct vpage *)kmem_zalloc(seg_pages(seg) + * sizeof (struct vpage), KM_SLEEP); + evp = &sdp->vpage[seg_pages(seg)]; + for (vp = sdp->vpage; vp < evp; vp++) + vp->vp_prot = sdp->prot; + } + /* + * Now go change the needed vpages protections. + */ + evp = &sdp->vpage[seg_page(seg, addr + len)]; + for (vp = &sdp->vpage[seg_page(seg, addr)]; vp < evp; vp++) + vp->vp_prot = prot; + } + + if (prot == 0) + hat_unload(seg, addr, len, HAT_NOFLAGS); + else + hat_chgprot(seg, addr, len, prot); + return (0); +} + +STATIC int +segdev_checkprot(seg, addr, len, prot) + register struct seg *seg; + register addr_t addr; + register u_int len, prot; +{ + struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + register struct vpage *vp, *evp; + + /* + * If segment protection can be used, simply check against them + */ + if (sdp->pageprot == 0) + return (((sdp->prot & prot) != prot) ? EACCES : 0); + + /* + * Have to check down to the vpage level + */ + evp = &sdp->vpage[seg_page(seg, addr + len)]; + for (vp = &sdp->vpage[seg_page(seg, addr)]; vp < evp; vp++) + if ((vp->vp_prot & prot) != prot) + return (EACCES); + + return (0); +} + +STATIC int +segdev_getprot(seg, addr, len, protv) + register struct seg *seg; + register addr_t addr; + register u_int len, *protv; +{ + struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + u_int pgno = seg_page(seg, addr+len) - seg_page(seg, addr) + 1; + + if (pgno != 0) { + if (sdp->pageprot == 0) { + do protv[--pgno] = sdp->prot; + while (pgno != 0); + } else { + register pgoff = seg_page(seg, addr); + do { + pgno--; + protv[pgno] = sdp->vpage[pgno+pgoff].vp_prot; + } while (pgno != 0); + } + } + return 0; +} + +/* ARGSUSED */ +STATIC off_t +segdev_getoffset(seg, addr) + register struct seg *seg; + addr_t addr; +{ + register struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + + return sdp->offset; +} + +/* ARGSUSED */ +STATIC int +segdev_gettype(seg, addr) + register struct seg *seg; + addr_t addr; +{ + return MAP_SHARED; +} + + +/* ARGSUSED */ +STATIC int +segdev_getvp(seg, addr, vpp) + register struct seg *seg; + addr_t addr; + struct vnode **vpp; +{ + register struct segdev_data *sdp = (struct segdev_data *)seg->s_data; + + *vpp = sdp->vp; + return 0; +} + +STATIC +segdev_badop() +{ + + cmn_err(CE_PANIC, "segdev_badop"); + /*NOTREACHED*/ +} + +/* + * segdev pages are not in the cache, and thus can't really be controlled. + * syncs, locks, and advice are simply always successful. + */ +/*ARGSUSED*/ +STATIC int +segdev_ctlops(seg, addr, len, flags) + struct seg *seg; + addr_t addr; + u_int len, flags; +{ + + return (0); +} + +/* + * segdev pages are always "in core". + */ +/*ARGSUSED*/ +STATIC int +segdev_incore(seg, addr, len, vec) + struct seg *seg; + addr_t addr; + register u_int len; + register char *vec; +{ + u_int v = 0; + + for (len = (len + PAGEOFFSET) & PAGEMASK; len; len -= PAGESIZE, + v += PAGESIZE) + *vec++ = 1; + return (v); +} diff --git a/usr/src/uts/3b2/vm/seg_dev.h b/usr/src/uts/3b2/vm/seg_dev.h new file mode 100644 index 0000000..55758e6 --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_dev.h @@ -0,0 +1,47 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_SEG_DEV_H +#define _VM_SEG_DEV_H + +#ident "@(#)kernel:vm/seg_dev.h 1.6" + +/* + * Structure who's pointer is passed to the segvn_create routine + */ +struct segdev_crargs { + int (*mapfunc)(); /* map function to call */ + u_int offset; /* starting offset */ + dev_t dev; /* device number */ + u_char prot; /* protection */ + u_char maxprot; /* maximum protection */ +}; + +/* + * (Semi) private data maintained by the seg_dev driver per segment mapping + */ +struct segdev_data { + int (*mapfunc)(); /* really returns struct pte, not int */ + u_int offset; /* device offset for start of mapping */ + struct vnode *vp; /* Vnode associated with device */ + u_char pageprot; /* true if per page protections present */ + u_char prot; /* current segment prot if pageprot == 0 */ + u_char maxprot; /* maximum segment protections */ + struct vpage *vpage; /* per-page information, if needed */ +}; + +#ifdef _KERNEL + +#if defined(__STDC__) +extern int segdev_create(struct seg *, void *); +#else +extern int segdev_create(); +#endif + +#endif /* _KERNEL */ + +#endif /* _VM_SEG_DEV_H */ diff --git a/usr/src/uts/3b2/vm/seg_kmem.c b/usr/src/uts/3b2/vm/seg_kmem.c new file mode 100644 index 0000000..b413295 --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_kmem.c @@ -0,0 +1,698 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/seg_kmem.c 1.17" + +/* + * VM - kernel segment routines + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/errno.h" +#include "sys/sysmacros.h" +#include "sys/systm.h" +#include "sys/vm.h" +#include "sys/user.h" +#include "sys/mman.h" +#include "sys/map.h" +#include "sys/tuneable.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" +#include "sys/immu.h" + +#include "vm/seg_kmem.h" +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/anon.h" +#include "vm/rm.h" +#include "vm/page.h" + +extern u_int hat_vtokp_prot(); +extern int ptmalloc(); + +/* + * Private seg op routines. + */ + +#if defined(__STDC__) +STATIC void segkmem_unload(struct seg *, addr_t, u_int, u_int); +STATIC int segkmem_setprot(struct seg *, addr_t, u_int, u_int); +STATIC int segkmem_checkprot(struct seg *, addr_t, u_int, u_int); +STATIC int segkmem_getprot(struct seg *, addr_t, u_int, u_int *); +STATIC int segkmem_fault(struct seg *, addr_t, u_int, + enum fault_type, enum seg_rw); +STATIC int segkmem_faulta(struct seg *, addr_t); +STATIC off_t segkmem_getoffset(struct seg *, addr_t); +STATIC int segkmem_gettype(struct seg *, addr_t); +STATIC int segkmem_getvp(struct seg *, addr_t, struct vnode **); +STATIC void segkmem_badop(void); +STATIC int segkmem_alloc(struct seg *, addr_t, u_int, int); +STATIC void segkmem_free(struct seg *, addr_t, u_int); +STATIC void segkmem_mapin(struct seg *, addr_t, u_int, u_int, u_int, int); +STATIC void segkmem_mapout(struct seg *, addr_t, u_int); +#else +STATIC void segkmem_unload(); +STATIC int segkmem_setprot(); +STATIC int segkmem_checkprot(); +STATIC int segkmem_getprot(); +STATIC int segkmem_fault(); +STATIC int segkmem_faulta(); +STATIC off_t segkmem_getoffset(); +STATIC int segkmem_gettype(); +STATIC int segkmem_getvp(); +STATIC void segkmem_badop(); +STATIC int segkmem_alloc(); +STATIC void segkmem_free(); +STATIC void segkmem_mapin(); +STATIC void segkmem_mapout(); +#endif + +/* + * Machine specific public segments. + */ +struct seg ktextseg; +struct seg kvseg; +struct seg kpseg; +struct seg kdvmaseg; + +STATIC struct seg_ops segkmem_ops = { + (int(*)())segkmem_badop, /* dup */ + (int(*)())segkmem_badop, /* split */ + (void(*)())segkmem_badop, /* free */ + segkmem_fault, + segkmem_faulta, + segkmem_unload, + segkmem_setprot, + segkmem_checkprot, + (int(*)())segkmem_badop, /* kluster */ + (u_int(*)())segkmem_badop, /* swapout */ + (int(*)())segkmem_badop, /* sync */ + (int(*)())segkmem_badop, /* incore */ + (int(*)())segkmem_badop, /* lockop */ + segkmem_getprot, + segkmem_getoffset, + segkmem_gettype, + segkmem_getvp, +}; + +/* + * The segkmem driver will (optional) use an array of pte's to back + * up the mappings for compatibility reasons. This driver treates + * argsp as a pointer to the pte array to be used for the segment. + */ +int +segkmem_create(seg, argsp) + struct seg *seg; + caddr_t argsp; +{ + /* + * No need to notify the hat layer, since the SDT's are + * already allocated for seg_kmem; i.e. no need to call + * hat_map(). + */ + + seg->s_ops = &segkmem_ops; + seg->s_data = argsp; /* actually a pte_t array */ + return (0); +} + +/*ARGSUSED*/ +STATIC int +segkmem_fault(seg, addr, len, type, rw) + struct seg *seg; + addr_t addr; + u_int len; + enum fault_type type; + enum seg_rw rw; +{ + + return (-1); +} + +/*ARGSUSED*/ +STATIC int +segkmem_faulta(seg, addr) + struct seg *seg; + addr_t addr; +{ + + return (-1); +} + +/*ARGSUSED*/ +STATIC void +segkmem_unload(seg, addr, ref, mod) + struct seg *seg; + addr_t addr; + u_int ref, mod; +{ + + /* ends up being called for mapout, ignore */ +} + +STATIC int +segkmem_setprot(seg, addr, len, prot) + struct seg *seg; + addr_t addr; + u_int len, prot; +{ + register pte_t *ppte; + register addr_t eaddr; + register u_int pprot; + + ASSERT(seg->s_as == &kas); + ASSERT(len <= seg->s_size); + ASSERT(addr <= addr+len); + ASSERT(addr >= seg->s_base && addr+len <= seg->s_base + seg->s_size); + ASSERT(seg->s_ops == &segkmem_ops); + if (prot) + pprot = hat_vtokp_prot(prot); + if (seg->s_data) { + ppte = (pte_t *)seg->s_data; + ppte += btoct(addr - seg->s_base); + } else { + /* must be one of the non-paged segments */ + cmn_err(CE_PANIC,"segkmem_setprot: invalid for non-paged segment"); + /*NOTREACHED*/ + } + for (eaddr = addr + len; addr < eaddr; addr += PAGESIZE) { + if (prot == 0) { + /* invalidate software pte (if any) */ + + /* XXX - *ppte++ = mmu_pteinvalid; */ + ppte->pg_pte = 0; + ++ppte; + + } else { + /* assume physical segment has kernel write permissions */ + ppte->pgm.pg_w = pprot; + } + } + return 0; +} + +STATIC u_int +getprot(ppte) +register pte_t *ppte; +{ + if (!PG_ISVALID(ppte)) + return (u_int) 0; + else if (ppte->pgm.pg_w) + return (u_int) (PROT_READ | PROT_EXEC); + else + return (u_int) (PROT_READ | PROT_EXEC | PROT_WRITE); +} + +STATIC int +segkmem_checkprot(seg, addr, len, prot) + register struct seg *seg; + register addr_t addr; + u_int len; + register u_int prot; +{ + register pte_t *ppte; + pte_t tpte; + addr_t eaddr; + + ASSERT(seg->s_as == &kas); + ASSERT(len <= seg->s_size); + ASSERT(addr <= addr+len); + ASSERT(addr >= seg->s_base && addr+len <= seg->s_base + seg->s_size); + ASSERT(seg->s_ops == &segkmem_ops); + if (seg->s_data) { + ppte = (pte_t *)seg->s_data; + ppte += btoct(addr - seg->s_base); + } else { + cmn_err(CE_PANIC,"segkmem_checkprot: invalid for non-paged segment"); + /*NOTREACHED*/ + } + + for (eaddr = addr + len; addr < eaddr; addr += PAGESIZE) { + tpte = *ppte++; /* structure assignment */ + if ((getprot(&tpte) & prot) != prot) + return (EACCES); + } + return (0); +} + +STATIC int +segkmem_getprot(seg, addr, len, protv) + register struct seg *seg; + register addr_t addr; + register u_int len, *protv; +{ + u_int pgno = seg_page(seg, addr+len) - seg_page(seg, addr) + 1; + register pte_t *ppte; + register i; + pte_t tpte; + + if (seg->s_data == NULL) + return -1; + + ppte = (pte_t *)seg->s_data; + ppte += btoct(addr - seg->s_base); + + for (i = 0; i < pgno; i++) { + tpte = *ppte++; + protv[i] = getprot(&tpte); + } + + return 0; +} + +/* ARGSUSED */ +STATIC off_t +segkmem_getoffset(seg, addr) + struct seg *seg; + addr_t addr; +{ + return 0; +} + +/* ARGSUSED */ +STATIC int +segkmem_gettype(seg, addr) + struct seg *seg; + addr_t addr; +{ + return MAP_SHARED; +} + +/* ARGSUSED */ +STATIC int +segkmem_getvp(seg, addr, vpp) + register struct seg *seg; + addr_t addr; + struct vnode **vpp; +{ + *vpp = NULL; + return -1; +} + +STATIC void +segkmem_badop() +{ + + cmn_err(CE_PANIC, "segkmem_badop"); +} + +/* + * Special public segkmem routines + */ + +/* + * Allocate physical pages for the given kernel virtual address. + * Performs most of the work of the old memall/vmaccess combination. + */ +STATIC int +segkmem_alloc(seg, addr, len, canwait) + struct seg *seg; + addr_t addr; + u_int len; + int canwait; +{ + page_t *pp; + register pte_t *ppte; + pte_t tpte; + int val; + + tpte.pg_pte = PG_V; + ASSERT(seg->s_as == &kas); + ASSERT(len <= seg->s_size); + ASSERT(addr <= addr+len); + ASSERT(addr >= seg->s_base && addr+len <= seg->s_base + seg->s_size); + ASSERT(seg->s_ops == &segkmem_ops); + if (seg->s_data == NULL) { + cmn_err(CE_PANIC,"segkmem_alloc: invalid for non-paged segment"); + /*NOTREACHED*/ + } + pp = rm_allocpage(seg, addr, len, (canwait) ? P_CANWAIT : P_NOSLEEP); + if (pp != (page_t *)NULL) { + ppte = (pte_t *)seg->s_data; + ppte += btoct(addr - seg->s_base); + while (pp != (page_t *)NULL) { + ASSERT(!PG_ISVALID(ppte)); + tpte.pgm.pg_pfn = page_pptonum(pp); + /* the Sun code would do a + * hat_pteload(seg, addr, pp, tpte, PTELD_LOCK); + * but we are not allocating the page table + * space for the p_mapping links. + * Those links would make this code + * unnecessarily messy (page table would + * alternate with mapping tables every segment). + * Instead, we rely on the p_keepcnt not getting + * decremented to mark the page as non-swappable. + * The page comes in with p_keepcnt == 1. + */ +#ifdef DEBUG + ASSERT(pp->p_uown == NULL); + pp->p_uown = (struct proc *) addr; + ASSERT(pp->p_vnode == NULL); +#endif + page_sub(&pp, pp); + *ppte++ = tpte; /* structure assignment */ + flushaddr(addr); + addr += PAGESIZE; + } + val = 1; + } else + val = 0; + + return (val); +} + +/*ARGSUSED*/ +STATIC void +segkmem_free(seg, addr, len) + register struct seg *seg; + addr_t addr; + u_int len; +{ + page_t *pp; + register pte_t *ppte; + pte_t tpte; + addr_t sv_addr = addr; + u_int sv_len = len; + + ASSERT(seg->s_as == &kas); + ASSERT(len <= seg->s_size); + ASSERT(addr <= addr+len); + ASSERT(addr >= seg->s_base && addr+len <= seg->s_base + seg->s_size); + ASSERT(seg->s_ops == &segkmem_ops); + if (seg->s_data) { + ppte = (pte_t *)seg->s_data; + ppte += btoct(addr - seg->s_base); + } else { + cmn_err(CE_PANIC,"segkmem_free: invalid for non-paged segment"); + /*NOTREACHED*/ + } + + for (; (int)len > 0; len -= PAGESIZE, addr += PAGESIZE) { + tpte = *ppte; /* structure assignment */ + ASSERT(PG_ISVALID(ppte)); + + /* XXX - *ppte++ = mmu_pteinvalid; */ + ppte->pg_pte = 0; + ++ppte; + + pp = page_numtookpp(tpte.pgm.pg_pfn); + if (pp == NULL) + cmn_err(CE_PANIC, "segkmem_free"); +#ifdef DEBUG + ASSERT(pp->p_uown == (struct proc *) addr); + pp->p_uown = NULL; + ASSERT(pp->p_vnode == NULL); + ASSERT(pp->p_keepcnt == 1); +#endif + /* + * and release the keep count. + */ + PAGE_RELE(pp); /* this should free the page */ + } + flushmmu(sv_addr, btoc(sv_len)); + +} + +/* + * segkmem_mapin() and segkmem_mapout() are for manipulating kernel + * addresses only. Since some users of segkmem_mapin() forget to unmap, + * this is done implicitly. + * NOTE: addr and len must always be multiples of the mmu page size. Also, + * this routine cannot be used to set invalid translations. + */ +STATIC void +segkmem_mapin(seg, addr, len, vprot, pcookie, flags) + struct seg *seg; + register addr_t addr; + register u_int len; + u_int vprot; + u_int pcookie; + int flags; +{ + register pte_t *ppte; + page_t *pp, *opp; + pte_t apte; + + ASSERT(seg->s_as == &kas); + ASSERT(len <= seg->s_size); + ASSERT(addr <= addr+len); + ASSERT(addr >= seg->s_base && addr+len <= seg->s_base + seg->s_size); + ASSERT(seg->s_ops == &segkmem_ops); + if (seg->s_data) { + ppte = (pte_t *)seg->s_data; + ppte += btoct(addr - seg->s_base); + } else { + cmn_err(CE_PANIC,"segkmem_mapin: invalid for non-paged segment"); + /*NOTREACHED*/ + } + + apte.pg_pte = pcookie; + if (vprot == PROT_NONE) + cmn_err(CE_PANIC, "segkmem_mapin -- invalid ptes"); + apte.pgm.pg_w = hat_vtokp_prot(vprot); + apte.pgm.pg_v = 1; + + /* + * Always lock the mapin'd translations. + */ + + for (; len != 0; ppte++, addr += MMU_PAGESIZE, len -= MMU_PAGESIZE) { + /* + * Determine the page frame we're mapping to allow + * the translation layer to manage cache consistency. + * If we're replacing a valid mapping, then ask the + * translation layer to unload the mapping and update + * data structures (necessary to maintain the information + * for cache consistency). We use page_numtookpp here + * instead of page_numtopp so that we don't get a page + * struct for physical pages in transition. + */ + pp = page_numtookpp(apte.pgm.pg_pfn); + ASSERT(pp == page_numtopp(apte.pgm.pg_pfn)); + + if ((flags & PTELD_INTREP) == 0) { + /* + * Because some users of mapin don't mapout things + * when they are done, we check for a currently + * valid translation. If we find one, then we + * unlock the old translation now. + */ + if (PG_ISVALID(ppte)) { + opp = page_numtookpp(ppte->pgm.pg_pfn); + ASSERT(opp == page_numtopp(ppte->pgm.pg_pfn)); + /* + * If the page is different than the one + * already loaded, unload it now. We test + * to see if the page is different before + * doing this since we can blow up if this + * virtual page contains a page struct used + * by hat_unload and we are just reloading + * going from non-cached to cached. + */ + if ((ppte->pg_pte & + (PG_V | PG_ADDR)) == + (apte.pg_pte & (PG_V | PG_ADDR))) + continue; +#ifdef DEBUG + if (opp) { + ASSERT(opp->p_uown == (struct proc *) addr); + opp->p_uown = NULL; + ASSERT(opp->p_vnode == NULL); + } +#endif + if (opp) PAGE_RELE(opp); + } + } + +#ifdef DEBUG + if (pp) { + /* the audit won't handle + * kmem/ublk multiple maps + */ + ASSERT(pp->p_keepcnt == 0); + ASSERT(pp->p_uown == NULL); + pp->p_uown = (struct proc *) addr; + ASSERT(pp->p_vnode == NULL); + } +#endif + if (pp) pp->p_keepcnt++; + + *ppte = apte; + flushaddr(addr); + apte.pgm.pg_pfn++; + } +} + +/* + * Release mapping for the kernel. This frees pmegs, which are a critical + * resource. The segment must be backed by software ptes. The pages + * specified are only freed if they are valid. This allows callers to + * clear out virtual space without knowing if it's mapped or not. + * NOTE: addr and len must always be multiples of the page size. + */ +STATIC void +segkmem_mapout(seg, addr, len) + struct seg *seg; + register addr_t addr; + register u_int len; +{ + register pte_t *ppte; + page_t *pp; + addr_t sv_addr = addr; + u_int sv_len = len; + + ASSERT(seg->s_as == &kas); + ASSERT(len <= seg->s_size); + ASSERT(addr <= addr+len); + ASSERT(addr >= seg->s_base && addr+len <= seg->s_base + seg->s_size); + ASSERT(seg->s_ops == &segkmem_ops); + if (seg->s_as != &kas) + cmn_err(CE_PANIC,"segkmem_mapout: bad as"); + if (seg->s_data == NULL) + cmn_err(CE_PANIC,"segkmem_mapout: invalid for non-paged segment"); + ppte = (pte_t *)(seg->s_data); + ppte += btoct(addr - seg->s_base); + for (; len != 0; addr += MMU_PAGESIZE, len -= MMU_PAGESIZE, ppte++) { + if (!PG_ISVALID(ppte)) + continue; + PG_CLRVALID(ppte); + pp = page_numtookpp(ppte->pgm.pg_pfn); + ASSERT(pp == page_numtopp(ppte->pgm.pg_pfn)); +#ifdef DEBUG + if (pp) { + ASSERT(pp->p_keepcnt == 1); + ASSERT(pp->p_uown == (struct proc *) addr); + pp->p_uown = NULL; + ASSERT(pp->p_vnode == NULL); + } +#endif + if (pp) PAGE_RELE(pp); + } + flushmmu(sv_addr, btoc(sv_len)); +} + +/* + * Allocate system virtual address space and allocate or link pages. + */ + +/* ARGSUSED */ +int +sptalloc(size, mode, base, flag) + register int size, mode; + register caddr_t base; + int flag; +{ + register sp; + + /* + * Allocate system virtual address space + */ + if ((sp = malloc(sptmap, size)) == 0) { +#ifdef DEBUG + cmn_err(CE_WARN, "No kernel virtual space."); + cmn_err(CE_CONT, "\tsize=%d, mode=%d, base=%d\n", + size, mode, base); +#endif + return NULL; + } + /* + * Allocate and fill in pages + */ + if (base == 0) { + if (segkmem_alloc(&kvseg, (addr_t)ctob(sp), ctob(size), + !(flag & NOSLEEP))) + return(ctob(sp)); + else { + rmfree(sptmap,size,sp); + return (NULL); + } + } else { + segkmem_mapin(&kvseg, (addr_t)ctob(sp), ctob(size), PROT_WRITE, + mkpte(0, (u_int)base), !(flag & NOSLEEP)); + return(ctob(sp)); + } +} + +void +sptfree(vaddr, size, flag) + caddr_t vaddr; + register int size; + int flag; +{ + register i, sp; + + sp = btoc(vaddr); + if (flag) { + segkmem_mapout(&kvseg, vaddr, ctob(size)); + } else { + for (i = 0; i < size; i++) + *(int *)kvtokptbl(ctob(sp + i)) = 0; + } + rmfree(sptmap, size, sp); +} + +STATIC char ksegtbl[ctos(SYSSEGSZ)]; /* parallel segment table for kseg */ + +/* Add a new segment to the kernel. Returns the new +** kernel segment virtual address. +*/ + +char * +kseg(sz) +register int sz; +{ + register char *va; + register pfn; + + if (sz <= 0 || sz > NPGPT) + return(0); + if ((pfn = ptmalloc(sptmap, sz, NPGPT-1)) == 0) + return(0); + + + if (availrmem - sz < tune.t_minarmem || + availsmem - sz < tune.t_minasmem) { + rmfree(sptmap, sz, pfn); + nomemmsg("kseg", sz, 0, 0); + return(0); + } + availrmem -= sz; + availsmem -= sz; + pages_pp_kernel += sz; + + if (!segkmem_alloc(&kvseg, (addr_t)ctob(pfn), ctob(sz), 1)) + cmn_err(CE_PANIC, "kseg - segkmem_alloc failed"); + + va = (char *) ctob(pfn); + ksegtbl[SEGNUM(va - (char *)syssegs)] = (char)sz; + bzero(va, ctob(sz)); + return(va); +} + +/* Free previously allocated kernel segment. + */ + +void +unkseg(va) +register char *va; +{ + register sz, pfn, sn; + + pfn = btoct(va); + sn = SEGNUM(va - (char *)syssegs); + sz = ksegtbl[sn]; + ASSERT(sz); + segkmem_free(&kvseg, va, ctob(sz)); + availrmem += sz; + availsmem += sz; + pages_pp_kernel -= sz; + flushmmu(va, sz); + rmfree(sptmap, sz, pfn); + ksegtbl[sn] = 0; +} diff --git a/usr/src/uts/3b2/vm/seg_kmem.h b/usr/src/uts/3b2/vm/seg_kmem.h new file mode 100644 index 0000000..91c3a75 --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_kmem.h @@ -0,0 +1,57 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_SEG_KMEM_H +#define _VM_SEG_KMEM_H + +#ident "@(#)kernel:vm/seg_kmem.h 1.7" + +/* + * VM - Kernel Segment Driver + */ + +/* + * These variables should be put in a place which + * is guaranteed not to get paged out of memory. + */ +extern struct as kas; /* kernel's address space */ +extern struct seg kpseg; /* kernel's "ptov" segment */ +extern struct seg kvseg; /* kernel's "sptalloc" segment */ +extern struct seg ktextseg; /* kernel's "most everything else" segment */ + +#if defined(__STDC__) + +extern int sptalloc(int, int, caddr_t, int); +extern void sptfree(caddr_t, int, int); + +/* + * For segkmem_create, the argsp is actually a pointer to the + * optional array of pte's used to map the given segment. + */ +extern int segkmem_create(struct seg *, void *); + +extern caddr_t kseg(int); +extern void unkseg(caddr_t); + +#else + +extern int sptalloc(); +extern void sptfree(); +extern int segkmem_create(); +extern caddr_t kseg(); +extern void unkseg(); + +#endif /* __STDC__ */ + +/* + * Flags to pass to segkmem_mapin(). + */ +#define PTELD_LOCK 0x01 +#define PTELD_INTREP 0x02 +#define PTELD_NOSYNC 0x04 + +#endif /* _VM_SEG_KMEM_H */ diff --git a/usr/src/uts/3b2/vm/seg_map.c b/usr/src/uts/3b2/vm/seg_map.c new file mode 100644 index 0000000..914b218 --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_map.c @@ -0,0 +1,927 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/seg_map.c 1.26" + +/* + * VM - generic vnode mapping segment. + * + * The segmap driver is used only by the kernel to get faster (than seg_vn) + * mappings [lower routine overhead; more persistent cache] to random + * vnode/offsets. Note than the kernel may (and does) use seg_vn as well. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/sysmacros.h" +#include "sys/buf.h" +#include "sys/systm.h" +#include "sys/vnode.h" +#include "sys/mman.h" +#include "sys/errno.h" +#include "sys/cred.h" +#include "sys/kmem.h" +#include "vm/trace.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" + +#include "vm/seg_kmem.h" +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/seg_map.h" +#include "vm/page.h" +#include "vm/pvn.h" +#include "vm/rm.h" + +extern void call_debug(); + +/* + * Private seg op routines. + */ +STATIC void segmap_free(/* seg */); +STATIC faultcode_t segmap_fault(/* seg, addr, len, type, rw */); +STATIC faultcode_t segmap_faulta(/* seg, addr */); +STATIC void segmap_unload(/* seg, addr, ref, mod */); +STATIC int segmap_checkprot(/* seg, addr, len, prot */); +STATIC int segmap_getprot(/* seg, addr, len, prot */); +STATIC int segmap_kluster(/* seg, addr, delta */); +STATIC off_t segmap_getoffset(/* seg, addr */); +STATIC int segmap_gettype(/* seg, addr */); +STATIC int segmap_getvp(/* seg, addr, vpp */); +STATIC int segmap_badop(); + +STATIC struct seg_ops segmap_ops = { + segmap_badop, /* dup */ + segmap_badop, /* unmap */ + segmap_free, + segmap_fault, + segmap_faulta, + segmap_unload, + segmap_badop, /* setprot */ + segmap_checkprot, + segmap_kluster, + (u_int (*)()) NULL, /* swapout */ + segmap_badop, /* sync */ + segmap_badop, /* incore */ + segmap_badop, /* lockop */ + segmap_getprot, + segmap_getoffset, + segmap_gettype, + segmap_getvp, +}; + +/* + * Private segmap routines. + */ +STATIC void segmap_smapadd(/* smd, smp */); +STATIC void segmap_smapsub(/* smd, smp */); +STATIC void segmap_hashin(/* smd, smp, vp, off, flags */); +STATIC void segmap_hashout(/* smd, smp */); + +/* + * Statistics for segmap operations. + */ +struct segmapcnt { + int smc_fault; /* number of segmap_faults */ + int smc_faulta; /* number of segmap_faultas */ + int smc_getmap; /* number of segmap_getmaps */ + int smc_get_use; /* # of getmaps that reuse an existing map */ + int smc_get_reclaim; /* # of getmaps that do a reclaim */ + int smc_get_reuse; /* # of getmaps that reuse a slot */ + int smc_rel_async; /* # of releases that are async */ + int smc_rel_write; /* # of releases that write */ + int smc_rel_free; /* # of releases that free */ + int smc_rel_abort; /* # of releases that abort */ + int smc_rel_dontneed; /* # of releases with dontneed set */ + int smc_release; /* # of releases with no other action */ + int smc_pagecreate; /* # of pagecreates */ +} segmapcnt; + +/* + * Return number of map pages in segment. + */ +#define MAP_PAGES(seg) ((seg)->s_size >> MAXBSHIFT) + +/* + * Translate addr into smap number within segment. + */ +#define MAP_PAGE(seg, addr) (((addr) - (seg)->s_base) >> MAXBSHIFT) + +/* + * Translate addr in seg into struct smap pointer. + */ +#define GET_SMAP(seg, addr) \ + &(((struct segmap_data *)((seg)->s_data))->smd_sm[MAP_PAGE(seg, addr)]) + +int +segmap_create(seg, argsp) + struct seg *seg; + _VOID *argsp; +{ + register struct segmap_data *smd; + register struct smap *smp; + struct segmap_crargs *a = (struct segmap_crargs *)argsp; + register u_int i; + u_int hashsz; + addr_t segend; + + /* + * No need to notify the hat layer, since the SDT's are + * already allocated for seg_map; i.e. no need to call + * hat_map(). + */ + + /* + * Make sure that seg->s_base and seg->s_base + seg->s_size + * are on MAXBSIZE aligned pieces of virtual memory. + * + * Since we assume we are creating a large segment + * (it's just segkmap), trimming off the excess at the + * beginning and end of the segment is considered safe. + */ + segend = (addr_t)((u_int)(seg->s_base + seg->s_size) & MAXBMASK); + seg->s_base = (addr_t)roundup((u_int)(seg->s_base), MAXBSIZE); + seg->s_size = segend - seg->s_base; + + i = MAP_PAGES(seg); + + smd = (struct segmap_data *)kmem_zalloc(sizeof (struct segmap_data), KM_SLEEP); + smd->smd_prot = a->prot; + smd->smd_sm = (struct smap *)kmem_zalloc((u_int)(sizeof (struct smap) * i), KM_SLEEP); + + /* + * Link up all the slots. + */ + for (smp = &smd->smd_sm[i - 1]; smp >= smd->smd_sm; smp--) + segmap_smapadd(smd, smp); + + /* + * Compute hash size rounding down to the next power of two. + */ + hashsz = MAP_PAGES(seg) / SMAP_HASHAVELEN; + for (i = (u_int)0x80 << ((sizeof(int) - 1) * NBBY); i != 0; i >>= 1) { + if ((hashsz & i) != 0) { + smd->smd_hashsz = hashsz = i; + break; + } + } + smd->smd_hash = (struct smap **)kmem_zalloc(hashsz * + sizeof (smd->smd_hash[0]), KM_SLEEP); + + seg->s_data = (char *)smd; + seg->s_ops = &segmap_ops; + + return (0); +} + +STATIC void +segmap_free(seg) + struct seg *seg; +{ + register struct segmap_data *smd = (struct segmap_data *)seg->s_data; + + kmem_free((caddr_t)smd->smd_hash, sizeof (smd->smd_hash[0]) * + smd->smd_hashsz); + kmem_free((caddr_t)smd->smd_sm, sizeof (struct smap) * MAP_PAGES(seg)); + kmem_free((caddr_t)smd, sizeof (*smd)); +} + +/* + * Do a F_SOFTUNLOCK call over the range requested. + * The range must have already been F_SOFTLOCK'ed. + */ +STATIC void +segmap_unlock(seg, addr, len, rw, smp) + struct seg *seg; + addr_t addr; + u_int len; + enum seg_rw rw; + register struct smap *smp; +{ + register page_t *pp; + register addr_t adr; + u_int off; + + off = smp->sm_off + ((u_int)addr & MAXBOFFSET); + for (adr = addr; adr < addr + len; adr += PAGESIZE, off += PAGESIZE) { + /* + * For now, we just kludge here by finding the page + * ourselves since we would not find the page using + * page_find() if someone has page_abort()'ed it. + * XXX - need to redo things to avoid this mess. + */ + for (pp = page_hash[PAGE_HASHFUNC(smp->sm_vp, off)]; pp != NULL; + pp = pp->p_hash) + if (pp->p_vnode == smp->sm_vp && pp->p_offset == off) + break; + if (pp == NULL || pp->p_pagein || pp->p_free) + cmn_err(CE_PANIC, "segmap_unlock"); + if (rw == S_WRITE) + pp->p_mod = 1; + if (rw != S_OTHER) { + trace4(TR_PG_SEGMAP_FLT, pp, pp->p_vnode, off, 1); + pp->p_ref = 1; + } + hat_unlock(seg, adr); + PAGE_RELE(pp); + } +} + +/* + * This routine is called via a machine specific fault handling + * routine. It is also called by software routines wishing to + * lock or unlock a range of addresses. + */ +STATIC faultcode_t +segmap_fault(seg, addr, len, type, rw) + struct seg *seg; + addr_t addr; + u_int len; + enum fault_type type; + enum seg_rw rw; +{ + register u_long sm_off; + u_long sm_endoff; + register u_long off; + register u_long endoff; + register u_long pp_off; + register page_t *pp; + page_t **ppp; + u_long invar; + struct segmap_data *smd; + register struct smap *smp; + struct vnode *vp; + page_t *pl[btopr(MAXBSIZE) + 1]; + u_int prot; + int err; + + segmapcnt.smc_fault++; + + smd = (struct segmap_data *)seg->s_data; + smp = GET_SMAP(seg, addr); + vp = smp->sm_vp; + + if (vp == NULL) + return (FC_MAKE_ERR(EIO)); + + ASSERT((((u_int)addr & MAXBOFFSET) + len) <= MAXBSIZE); + + /* + * First handle the easy stuff + */ + if (type == F_SOFTUNLOCK) { + segmap_unlock(seg, addr, len, rw, smp); + return (0); + } + + /* + * + * virtual sm_addr addr endaddr sm_endaddr + * addresses | | | | + * / /..request../ / + * / / / / + * | | | | + * object sm_off off endoff sm_endoff + * offsets + * + * sm_addr = (u_int)addr & MAXBMASK; + * sm_endaddr = sm_addr + MAXBSIZE; + * endaddr = addr + len; + * + */ + sm_off = smp->sm_off; + sm_endoff = sm_off + MAXBSIZE; + off = sm_off + ((u_int)addr & MAXBOFFSET); + endoff = off + len; + + ASSERT(endoff <= sm_endoff); + + trace3(TR_SEG_GETPAGE, seg, addr, TRC_SEG_SEGKMAP); + + err = VOP_GETPAGE(vp, off, len, &prot, pl, MAXBSIZE, seg, addr, rw, + (struct cred *)NULL); /* XXX - need real cred val */ + if (err) + return (FC_MAKE_ERR(err)); + + prot &= smd->smd_prot; + + /* + * Remove invariant from the loop. To compute the virtual + * address of the page, we use the following computation: + * + * addr = sm_addr + (pp->p_offset - sm_off) + * + * Since sm_addr and sm_off do not vary: + * + * addr = (invar = (sm_addr - sm_off)) + pp->p_offset + */ + invar = ((u_int)addr & MAXBMASK) - sm_off; + + for (ppp = pl; (pp = *ppp++) != NULL; ) { + ASSERT(pp->p_vnode == vp); + + pp_off = pp->p_offset; + if ((pp_off >= off) && (pp_off < endoff)) { + /* + * Within range requested. + */ + pp->p_ref = 1; + if (type == F_SOFTLOCK) { + /* + * Load up the translation keeping it + * locked and don't PAGE_RELE the page. + */ + hat_memload(seg, invar + pp_off, pp, prot, + HAT_LOCK); + } else { + hat_memload(seg, invar + pp_off, pp, prot, + HAT_NOFLAGS); + PAGE_RELE(pp); + } + } else if ((pp_off >= sm_off) && (pp_off < sm_endoff)) { + /* + * Within segmap buffer. + */ + hat_memload(seg, invar + pp_off, pp, prot, HAT_NOFLAGS); + PAGE_RELE(pp); + } else { + /* + * XXX - page is now orphaned !!! + */ + PAGE_RELE(pp); + } + } + + return (0); +} + +/* + * This routine is used to start I/O on pages asynchronously. + */ +STATIC faultcode_t +segmap_faulta(seg, addr) + struct seg *seg; + addr_t addr; +{ + register struct smap *smp; + int err; + + segmapcnt.smc_faulta++; + smp = GET_SMAP(seg, addr); + if (smp->sm_vp == NULL) { + call_debug("segmap_faulta - no vp"); + return (FC_MAKE_ERR(EIO)); + } + trace3(TR_SEG_GETPAGE, seg, addr, TRC_SEG_SEGKMAP); + err = VOP_GETPAGE(smp->sm_vp, smp->sm_off + (u_int)addr & MAXBOFFSET, + PAGESIZE, (u_int *)NULL, (page_t **)NULL, 0, + seg, addr, S_READ, + (struct cred *)NULL); /* XXX - need real cred val */ + if (err) + return (FC_MAKE_ERR(err)); + return (0); +} + +STATIC void +segmap_unload(seg, addr, ref, mod) + struct seg *seg; + addr_t addr; + u_int ref, mod; +{ + register struct smap *smp; + + smp = GET_SMAP(seg, addr); + pvn_unloadmap(smp->sm_vp, smp->sm_off + (u_int)addr & MAXBOFFSET, + ref, mod); +} + +/*ARGSUSED*/ +STATIC int +segmap_checkprot(seg, addr, len, prot) + struct seg *seg; + addr_t addr; + u_int len, prot; +{ + struct segmap_data *smd = (struct segmap_data *)seg->s_data; + + return (((smd->smd_prot & prot) != prot) ? EACCES : 0); +} + +STATIC int +segmap_getprot(seg, addr, len, protv) + register struct seg *seg; + register addr_t addr; + register u_int len, *protv; +{ + struct segmap_data *smd = (struct segmap_data *)seg->s_data; + u_int pgno = seg_page(seg, addr+len) - seg_page(seg, addr) + 1; + + if (pgno != 0) { + do protv[--pgno] = smd->smd_prot; + while (pgno != 0); + } + return 0; +} + +/* ARGSUSED */ +STATIC off_t +segmap_getoffset(seg, addr) + register struct seg *seg; + addr_t addr; +{ + register struct segmap_data *smd = (struct segmap_data *)seg->s_data; + + return smd->smd_sm->sm_off; +} + +/* ARGSUSED */ +STATIC int +segmap_gettype(seg, addr) + struct seg *seg; + addr_t addr; +{ + return MAP_SHARED; +} + +/* ARGSUSED */ +STATIC int +segmap_getvp(seg, addr, vpp) + register struct seg *seg; + addr_t addr; + struct vnode **vpp; +{ + register struct segmap_data *smd = (struct segmap_data *)seg->s_data; + + *vpp = smd->smd_sm->sm_vp; + return 0; +} + +/* + * Check to see if it makes sense to do kluster/read ahead to + * addr + delta relative to the mapping at addr. We assume here + * that delta is a signed PAGESIZE'd multiple (which can be negative). + * + * For segmap we always "approve" of this action from our standpoint. + */ +/*ARGSUSED*/ +STATIC int +segmap_kluster(seg, addr, delta) + struct seg *seg; + addr_t addr; + int delta; +{ + return (0); +} + +STATIC +segmap_badop() +{ + cmn_err(CE_PANIC, "segmap_badop"); + /*NOTREACHED*/ +} + +/* + * Special private segmap operations + */ + +/* + * Add smp to the free list on smd. If the smp still has a vnode + * association with it, then it is added to the end of the free list, + * otherwise it is added to the front of the list. + */ +STATIC void +segmap_smapadd(smd, smp) + register struct segmap_data *smd; + register struct smap *smp; +{ + if (smp->sm_refcnt != 0) + cmn_err(CE_PANIC, "segmap_smapadd"); + + if (smd->smd_free == (struct smap *)NULL) { + smp->sm_next = smp->sm_prev = smp; + } else { + smp->sm_next = smd->smd_free; + smp->sm_prev = (smd->smd_free)->sm_prev; + (smd->smd_free)->sm_prev = smp; + smp->sm_prev->sm_next = smp; + } + + if (smp->sm_vp == (struct vnode *)NULL) + smd->smd_free = smp; + else + smd->smd_free = smp->sm_next; + + /* + * XXX - need a better way to do this. + */ + if (smd->smd_want) { + wakeup((caddr_t)&smd->smd_free); + smd->smd_want = 0; + } +} + +/* + * Remove smp from the smd free list. If there is an old + * mapping in effect there, then delete it. + */ +STATIC void +segmap_smapsub(smd, smp) + register struct segmap_data *smd; + register struct smap *smp; +{ + if (smd->smd_free == smp) + smd->smd_free = smp->sm_next; /* go to next page */ + + if (smd->smd_free == smp) + smd->smd_free = NULL; /* smp list is gone */ + else { + smp->sm_prev->sm_next = smp->sm_next; + smp->sm_next->sm_prev = smp->sm_prev; + } + smp->sm_prev = smp->sm_next = smp; /* make smp a list of one */ + smp->sm_refcnt = 1; +} + +STATIC void +segmap_hashin(smd, smp, vp, off) + register struct segmap_data *smd; + register struct smap *smp; + struct vnode *vp; + u_int off; +{ + register struct smap **hpp; + + /* + * Funniness here - we don't increment the ref count on the vnode + * even though we have another pointer to it here. The reason + * for this is that we don't want the fact that a seg_map + * entry somewhere refers to a vnode to prevent the vnode + * itself from going away. This is because this reference + * to the vnode is a "soft one". In the case where a mapping + * is being used by a rdwr [or directory routine?] there already + * has to be a non-zero ref count on the vnode. In the case + * where the vp has been freed and the the smap structure is + * on the free list, there are no pages in memory that can + * refer to the vnode. Thus even if we reuse the same + * vnode/smap structure for a vnode which has the same + * address but represents a different object, we are ok. + */ + smp->sm_vp = vp; + smp->sm_off = off; + + hpp = &smd->smd_hash[SMAP_HASHFUNC(smd, vp, off)]; + smp->sm_hash = *hpp; + *hpp = smp; +} + +STATIC void +segmap_hashout(smd, smp) + register struct segmap_data *smd; + register struct smap *smp; +{ + register struct smap **hpp, *hp; + struct vnode *vp; + + vp = smp->sm_vp; + hpp = &smd->smd_hash[SMAP_HASHFUNC(smd, vp, smp->sm_off)]; + for (;;) { + hp = *hpp; + if (hp == NULL) + cmn_err(CE_PANIC, "segmap_hashout"); + if (hp == smp) + break; + hpp = &hp->sm_hash; + } + + *hpp = smp->sm_hash; + smp->sm_hash = NULL; + smp->sm_vp = NULL; + smp->sm_off = 0; +} + +/* + * Special public segmap operations + */ + +/* + * Create pages (without using VOP_GETPAGE) and load up tranlations to them. + * If softlock is TRUE, then set things up so that it looks like a call + * to segmap_fault with F_SOFTLOCK. + */ +void +segmap_pagecreate(seg, addr, len, softlock, dblist, bsize) + struct seg *seg; + register addr_t addr; + u_int len; + int softlock; + daddr_t *dblist; + int bsize; +{ + register page_t *pp; + register u_int off; + struct smap *smp; + struct vnode *vp; + addr_t eaddr; + u_int prot; + daddr_t *dbptr; + int i, dbcnt, blkpp; + + segmapcnt.smc_pagecreate++; + + if (dblist != NULL) { + dbptr = dblist; + dbcnt = (len + bsize - 1) / bsize; + } + eaddr = addr + len; + addr = (addr_t)((u_int)addr & PAGEMASK); + smp = GET_SMAP(seg, addr); + vp = smp->sm_vp; + off = smp->sm_off + ((u_int)addr & MAXBOFFSET); + prot = ((struct segmap_data *)seg->s_data)->smd_prot; + + for (; addr < eaddr; addr += PAGESIZE, off += PAGESIZE) { + pp = page_lookup(vp, off); + if (pp == NULL) { + pp = rm_allocpage(segkmap, addr, PAGESIZE, P_CANWAIT); + trace6(TR_SEG_ALLOCPAGE, segkmap, addr, + TRC_SEG_SEGKMAP, vp, off, pp); + if (page_enter(pp, vp, off)) + cmn_err(CE_PANIC, "segmap_page_create page_enter"); + page_unlock(pp); + if (softlock) { + hat_memload(segkmap, addr, pp, prot, 1); + } else { + hat_memload(segkmap, addr, pp, prot, 0); + PAGE_RELE(pp); + } + } else { + if (softlock) { + PAGE_HOLD(pp); + hat_memload(segkmap, addr, pp, prot, 1); + } else { + hat_memload(segkmap, addr, pp, prot, 0); + } + } + if (dblist != NULL) { + blkpp = PAGESIZE/bsize; + if (blkpp >= 1) { + for (i=0; i 0) { + pp->p_dblist[i] = *dbptr++; + dbcnt--; + } + } + } else { + pp->p_dblist[0] = *dbptr; + if (((pp->p_offset + PAGESIZE) & (bsize - 1)) == 0) + dbptr++; + } + } + } +} + +addr_t +segmap_getmap(seg, vp, off) + struct seg *seg; + struct vnode *vp; + u_int off; +{ + register struct segmap_data *smd = (struct segmap_data *)seg->s_data; + register struct smap *smp; + extern struct vnode *common_specvp(); + + segmapcnt.smc_getmap++; + + if ((off & MAXBOFFSET) != 0) + cmn_err(CE_PANIC, "segmap_getmap bad offset"); + + /* + * If this is a block device we have to be sure to use the + * "common" block device vnode for the mapping. + */ + if (vp->v_type == VBLK) + vp = common_specvp(vp); + + /* + * XXX - keep stats for hash function + */ + for (smp = smd->smd_hash[SMAP_HASHFUNC(smd, vp, off)]; + smp != NULL; smp = smp->sm_hash) + if (smp->sm_vp == vp && smp->sm_off == off) + break; + + if (smp != NULL) { + if (vp->v_count == 0) /* XXX - debugging */ + call_debug("segmap_getmap vp count of zero"); + if (smp->sm_refcnt > 0) { + segmapcnt.smc_get_use++; + smp->sm_refcnt++; /* another user */ + } else { + segmapcnt.smc_get_reclaim++; + segmap_smapsub(smd, smp); /* reclaim */ + } + } else { + /* + * Allocate a new slot and set it up. + */ + while ((smp = smd->smd_free) == NULL) { + /* + * XXX - need a better way to do this. + */ + smd->smd_want = 1; + (void) sleep((caddr_t)&smd->smd_free, PSWP+2); + } + segmap_smapsub(smd, smp); + if (smp->sm_vp != (struct vnode *)NULL) { + /* + * Destroy old vnode association and unload any + * hardware translations to the old object. + */ + segmapcnt.smc_get_reuse++; + segmap_hashout(smd, smp); + /* + * Send down the HAT_FREEPP flag to free the pages + * if these are the last mappings to them. This is + * done to get them on the cache list faster. + * Otherwise the pages would be orphaned until the + * page daemon finds them. + */ + hat_unload(seg, seg->s_base + ((smp - smd->smd_sm) * + MAXBSIZE), MAXBSIZE, HAT_FREEPP); + } + segmap_hashin(smd, smp, vp, off); + } + + trace5(TR_SEG_GETMAP, seg, (u_int)(seg->s_base + + (smp - smd->smd_sm) * MAXBSIZE) & PAGEMASK, + TRC_SEG_SEGKMAP, vp, off); + return (seg->s_base + ((smp - smd->smd_sm) * MAXBSIZE)); +} + +int +segmap_release(seg, addr, flags) + struct seg *seg; + addr_t addr; + u_int flags; +{ + register struct segmap_data *smd = (struct segmap_data *)seg->s_data; + register struct smap *smp; + int error; + + if (addr < seg->s_base || addr >= seg->s_base + seg->s_size || + ((u_int)addr & MAXBOFFSET) != 0) + cmn_err(CE_PANIC, "segmap_release addr"); + + smp = &smd->smd_sm[MAP_PAGE(seg, addr)]; + trace4(TR_SEG_RELMAP, seg, addr, TRC_SEG_SEGKMAP, smp->sm_refcnt); + + /* + * If only the SM_DONTNEED flag or no flags are specified, + * then we skip the call to VOP_PUTPAGE all together. + */ + if (flags != SM_DONTNEED && flags != 0) { + int bflags = 0; + + if (flags & SM_WRITE) + segmapcnt.smc_rel_write++; + if (flags & SM_ASYNC) { + bflags |= B_ASYNC; + segmapcnt.smc_rel_async++; + } + if (flags & SM_INVAL) { + bflags |= B_INVAL; + segmapcnt.smc_rel_abort++; + } + if (smp->sm_refcnt == 1) { + /* + * We only bother doing the FREE and DONTNEED flags + * if no one else is still referencing this mapping. + */ + if (flags & SM_FREE) { + bflags |= B_FREE; + segmapcnt.smc_rel_free++; + } + if (flags & SM_DONTNEED) { + bflags |= B_DONTNEED; + segmapcnt.smc_rel_dontneed++; + } + } + error = VOP_PUTPAGE(smp->sm_vp, smp->sm_off, MAXBSIZE, bflags, + (struct cred *)NULL); /* XXX - need real cred val */ + } else { + segmapcnt.smc_release++; + error = 0; + } + + if (--smp->sm_refcnt == 0) { + if (flags & SM_INVAL) { + segmap_hashout(smd, smp); /* remove map info */ + /* + * Don't bother telling hat_unload() to free the + * pages, the VOP_PUTPAGE above took care of that + * if the SM_INVAL flag was set. + * + * XXX - In fact, I don't know why we have to call + * hat_unload() in this case because VOP_PUTPAGE + * would have called pvn_getdirty() which would + * have called hat_pageunload() if the SM_INVAL + * flag was set. + */ + hat_unload(seg, addr, MAXBSIZE, HAT_NOFLAGS); + } + segmap_smapadd(smd, smp); /* add to free list */ + } + + return (error); +} + +/* + * segmap_inval - + * Step through freelist of segment for entries still on the + * hashlist. If found, and if they belong to vfsp, invalidate + * the entries. + */ +void +segmap_inval(seg, vfsp) + register struct seg *seg; + register struct vfs *vfsp; +{ + register struct segmap_data *smd; + register struct smap *smp, *nsmp; + + smd = (struct segmap_data *)seg->s_data; + smp = smd->smd_free; + if (!smp) + return; + do { + nsmp = smp->sm_next; + if (smp->sm_hash && smp->sm_vp && + (smp->sm_vp->v_vfsp == vfsp)) { + segmap_hashout(smd, smp); + hat_unload(seg, seg->s_base + ((smp - smd->smd_sm) * + MAXBSIZE), MAXBSIZE, HAT_NOFLAGS); + } + smp = nsmp; + } while (smp != smd->smd_free); +} + +void +segmap_flush(seg, vp) + struct seg *seg; + register struct vnode *vp; +{ + register struct segmap_data *smd = (struct segmap_data *)seg->s_data; + register struct smap *smp; + register u_int hashsz; + register int i; + + hashsz = smd->smd_hashsz; + for (i=0; ismd_hash[i]; smp != NULL; smp = smp->sm_hash) { + if (smp->sm_vp == vp) { + segmap_hashout(smd, smp); + hat_unload(seg, seg->s_base + + ((smp - smd->smd_sm) * MAXBSIZE), + MAXBSIZE, HAT_NOFLAGS); + } + } + } +} + +void +segmap_findmap(vp, off) + struct vnode *vp; + u_int off; +{ + struct seg *seg = segkmap; + register struct segmap_data *smd = (struct segmap_data *)seg->s_data; + register struct smap *smp; + extern struct vnode *common_specvp(); + + off = off & MAXBMASK; + + /* + * If this is a block device we have to be sure to use the + * "common" block device vnode for the mapping. + */ + if (vp->v_type == VBLK) + vp = common_specvp(vp); + + /* + * XXX - keep stats for hash function + */ + for (smp = smd->smd_hash[SMAP_HASHFUNC(smd, vp, off)]; + smp != NULL; smp = smp->sm_hash) + if (smp->sm_vp == vp && smp->sm_off == off) { + cmn_err(CE_CONT, " segmap %x", + seg->s_base + ((smp - smd->smd_sm) * MAXBSIZE)); + break; + } + cmn_err(CE_CONT, "\n"); +} + diff --git a/usr/src/uts/3b2/vm/seg_map.h b/usr/src/uts/3b2/vm/seg_map.h new file mode 100644 index 0000000..34976df --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_map.h @@ -0,0 +1,102 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_SEG_MAP_H +#define _VM_SEG_MAP_H + +#ident "@(#)kernel:vm/seg_map.h 1.7" + +struct segmap_crargs { + u_int prot; +}; + +/* + * Each smap struct represents a MAXBSIZE sized mapping to the + * given in the structure. The location of the + * the structure in the array gives the virtual address of the + * mapping. + */ +struct smap { + struct vnode *sm_vp; /* vnode pointer (if mapped) */ + u_int sm_off; /* file offset for mapping */ + /* + * These next 4 entries can be coded as + * u_shorts if we are tight on memory. + */ + u_int sm_refcnt; /* reference count for uses */ + struct smap *sm_hash; /* hash pointer */ + struct smap *sm_next; /* next pointer */ + struct smap *sm_prev; /* previous pointer */ +}; + +/* + * (Semi) private data maintained by the segmap driver per SEGMENT mapping + */ +struct segmap_data { + struct smap *smd_sm; /* array of smap structures */ + struct smap *smd_free; /* free list head pointer */ + u_char smd_prot; /* protections for all smap's */ + u_char smd_want; /* smap want flag */ + u_int smd_hashsz; /* power-of-two hash table size */ + struct smap **smd_hash; /* pointer to hash table */ +}; + +/* + * These are flags used on release. Some of these might get handled + * by segment operations needed for msync (when we figure them out). + * SM_ASYNC modifies SM_WRITE. SM_DONTNEED modifies SM_FREE. SM_FREE + * and SM_INVAL are mutually exclusive. + */ +#define SM_WRITE 0x01 /* write back the pages upon release */ +#define SM_ASYNC 0x02 /* do the write asynchronously */ +#define SM_FREE 0x04 /* put pages back on free list */ +#define SM_INVAL 0x08 /* invalidate page (no caching) */ +#define SM_DONTNEED 0x10 /* less likely to be needed soon */ + +#define MAXBSHIFT 13 /* log2(MAXBSIZE) */ + +#define MAXBOFFSET (MAXBSIZE - 1) +#define MAXBMASK (~MAXBOFFSET) + +/* + * SMAP_HASHAVELEN is the average length desired for this chain, from + * which the size of the smd_hash table is derived at segment create time. + * SMAP_HASHVPSHIFT is defined so that 1 << SMAP_HASHVPSHIFT is the + * approximate size of a vnode struct. + */ +#define SMAP_HASHAVELEN 4 +#define SMAP_HASHVPSHIFT 6 + +#define SMAP_HASHFUNC(smd, vp, off) \ + ((((off) >> MAXBSHIFT) + ((int)(vp) >> SMAP_HASHVPSHIFT)) & \ + ((smd)->smd_hashsz - 1)) + +#ifdef _KERNEL + +/* the kernel generic mapping segment */ +extern struct seg *segkmap; + +#if defined(__STDC__) + +extern int segmap_create(struct seg *, void *); +extern void segmap_pagecreate(struct seg *, addr_t, u_int, int, daddr_t*, int); +extern addr_t segmap_getmap(struct seg *, struct vnode *, u_int); +extern int segmap_release(struct seg *, addr_t, u_int); +extern void segmap_inval(struct seg *, struct vfs *); + +#else + +extern int segmap_create(); +extern void segmap_pagecreate(); +extern addr_t segmap_getmap(); +extern int segmap_release(); +extern void segmap_inval(); + +#endif +#endif /* _KERNEL */ + +#endif /* _VM_SEG_MAP_H */ diff --git a/usr/src/uts/3b2/vm/seg_u.c b/usr/src/uts/3b2/vm/seg_u.c new file mode 100644 index 0000000..818c9c8 --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_u.c @@ -0,0 +1,1086 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/seg_u.c 1.35" + +/* + * VM - u-area segment routines + * + * XXX: Many of the (struct segu_data *) arguments to the routines + * below should become (struct seg *)s when the seg_u segment + * type becomes more fully realized. + * + * Current model: + * Each u-area is described the SVR3.2 way in the proc structure, + * + * Desired model: + * segu_data describes nproc u-areas and the segment ops + * manipulate individual slots in segu_data, so that (e.g.) + * copying a u-area upon process creation turns into + * transcribing parts of segu_data from one place to another. + * + * Alternative design possibilities: + * When is swap space allocated? We can do it at process creation + * time, as part of setting up the u-area, or upon demand immediately + * before swapping out the u-area. In the latter case, we should + * reserve swap space at u-area creation time. + * + * Another possibility still is to use lazy allocation and defer + * grabbing swap space for a given u-area until we're about to + * swap it out, but subsequently keep hold of it until process + * destruction time. + * + * We currently use the last of these techniques since the others + * have been observed to cause races. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/errno.h" +#include "sys/sysmacros.h" +#include "sys/systm.h" +#include "sys/buf.h" +#include "sys/mman.h" +#include "sys/vnode.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" +#include "sys/tuneable.h" +#include "sys/inline.h" +#include "sys/kmem.h" + +#include "vm/anon.h" +#include "vm/rm.h" +#include "vm/page.h" +#include "vm/seg.h" +#include "vm/as.h" +#include "sys/swap.h" +#include "sys/proc.h" + +#include "sys/immu.h" +#include "vm/hat.h" +#include "vm/vm_hat.h" +#include "vm/seg_u.h" + +#if defined(__STDC__) +STATIC u_int segu_swapout(struct proc *); +STATIC u_int segu_swapin(struct proc *); +STATIC int segu_getslot(struct seg*, addr_t, u_int); +#else +STATIC u_int segu_swapout(); +STATIC u_int segu_swapin(); +STATIC int segu_getslot(); +#endif + +STATIC int segu_debug = 0; /* patchable for debugging */ + +#define UPAGE_PROT (PROT_READ | PROT_WRITE) + +#ifdef DEBUG +#define anon_alloc anon_upalloc +#define anon_decref anon_updecref +#define anon_free anon_upfree +extern struct anon *anon_upalloc(); +extern void anon_updecref(); +extern void anon_upfree(); +#else +extern void anon_decref(); /* XXX */ +#endif + +extern char runout; +extern void cleanup(); + +/* + * Private seg op routines. This set will flesh out more + * as seg_u comes closer to being a real segment type. + */ +#ifdef notdef +STATIC int segu_free(/* seg */); +STATIC faultcode_t segu_faulta(/* seg, addr */); +STATIC int segu_unload(/* seg, addr, ref, mod */); +#endif + +STATIC faultcode_t segu_fault(/* seg, addr, type, rw */); +STATIC int segu_checkprot(/* seg, addr, len, prot */); +STATIC int segu_getprot(/* seg, addr, len, prot */); +STATIC off_t segu_getoffset(/* seg, addr */); +STATIC int segu_gettype(/* seg, addr */); +STATIC int segu_getvp(/* seg, addr, vpp */); +STATIC int segu_kluster(/* seg, addr, delta */); +STATIC void segu_badop(); + +STATIC struct seg_ops segu_ops = { + (int(*)())segu_badop, /* dup */ + (int(*)())segu_badop, /* unmap */ + segu_badop, /* free */ + segu_fault, + (int(*)())segu_badop, /* faulta */ + segu_badop, /* unload */ + (int(*)())segu_badop, /* setprot */ + segu_checkprot, + segu_kluster, + (u_int (*)())segu_badop, /* swapout */ + (int(*)())segu_badop, /* sync */ + (int(*)())segu_badop, /* incore */ + (int(*)())segu_badop, /* lockop */ + segu_getprot, + segu_getoffset, + segu_gettype, + segu_getvp, +}; + +#ifdef __STDC__ +STATIC int segu_softload(struct seg *, addr_t, u_int, int, u_int); +STATIC int segu_softunload(struct seg *, addr_t, u_int, int, int); +#else +STATIC int segu_softload(); +STATIC int segu_softunload(); +#endif + +STATIC void +segu_badop() +{ + cmn_err(CE_PANIC, "seg_badop"); +} + +/* + * Check to see if it makes sense to do kluster/read ahead to + * addr + delta relative to the mapping at addr. We assume here + * that delta is a signed PAGESIZE'd multiple (which can be negative). + * + * For seg_u we always "approve" of this action from our standpoint. + */ +/* ARGSUSED */ +STATIC int +segu_kluster(seg, addr, delta) + struct seg *seg; + addr_t addr; + int delta; +{ + return(0); +} + +/* + * Segment operations specific to the seg_u segment type. + */ + +extern struct seguser *p0seguser; + +/* + * Create the overall segu segment. + * + * For the moment, we have no use for the argsp argument. + */ +/* ARGSUSED */ +int +segu_create(seg, argsp) + struct seg *seg; + caddr_t argsp; +{ + register u_int numslots; + register int i; + register struct segu_segdata *sdp; + + /* + * No need to notify the hat layer, since the SDT's are + * already allocated for seg_u; i.e. no need to call + * hat_map(). Seg_u does most of it's own dirty work, + * setting up it's own mappings. + */ + + /* + * Trim the segment's size down to the largest multiple of + * SEGU_PAGES that's no larger than the original value. + * + * XXX: Does it matter that we're discarding virtual address + * space off the end with no record of how much there was? + */ + numslots = seg->s_size / ptob(SEGU_PAGES); + seg->s_size = numslots * ptob(SEGU_PAGES); + + /* + * Allocate segment-specific information. + */ + seg->s_data = kmem_alloc(sizeof (struct segu_segdata), KM_NOSLEEP); + if (seg->s_data == NULL) + return (ENOMEM); + sdp = (struct segu_segdata *)seg->s_data; + + /* + * Allocate the slot array. + */ + sdp->usd_slots = (struct segu_data *) + kmem_alloc(numslots * sizeof (struct segu_data), KM_NOSLEEP); + if (sdp->usd_slots == NULL) { + kmem_free(seg->s_data, sizeof (struct segu_segdata)); + return (ENOMEM); + } + + /* + * Set up the slot free list, marking each slot as unallocated. + */ + sdp->usd_slots[0].su_flags = 0; + for (i = 1; i < numslots; i++) { + sdp->usd_slots[i - 1].su_next = &sdp->usd_slots[i]; + sdp->usd_slots[i].su_flags = 0; + } + sdp->usd_slots[numslots - 1].su_next = NULL; + + /* reserve the 1st entry for process 0 */ + sdp->usd_free = sdp->usd_slots[0].su_next; + sdp->usd_slots[0].su_flags = SEGU_ALLOCATED | SEGU_LOCKED; + p0seguser = (struct seguser *)seg->s_base; + + seg->s_ops = &segu_ops; + return(0); +} + +/* + * Swap in the u-area designated by sup. Return the number + * of bytes brought back in. + */ +STATIC u_int +segu_swapin(p) + register proc_t *p; +{ + register int bytesin, i; + register faultcode_t fc; + register pte_t *ppte, *upte; + register sde_t *sdeptr; + caddr_t addr; + + if (segu_debug) + cmn_err(CE_CONT, "segu_swapin(%x) [pid %d]\n", p, p->p_pid); + + bytesin = ptob(SEGU_PAGES); + fc = segu_fault(segu, (addr_t)p->p_segu, bytesin, F_SOFTLOCK, S_OTHER); + if (fc != 0) { + cmn_err(CE_PANIC, "segu_fault() in segu_swapin() failed to swap in the u area"); + } + + /* + * setup the pte's in proc structure + */ + ppte = (pte_t *)ubptbl(p); + addr = (caddr_t)p->p_segu; + for (i=0; i < SEGU_PAGES; i++) { + sdeptr = (sde_t *)kvtokstbl(addr); + upte = (pte_t *)vatopte(addr, sdeptr); + ppte->pg_pte = upte->pg_pte; + ppte++; + addr += PAGESIZE; + } + + return(ptob(SEGU_PAGES)); +} + +/* + * Swap out the u-area designated by p. Return the number + * of bytes swapped out. + */ +STATIC u_int +segu_swapout(p) + register proc_t *p; +{ + register int i; + register faultcode_t fc; + register pte_t *ppte; + + if (segu_debug) + cmn_err(CE_CONT, "segu_swapout(%x) [pid %d]\n", p, p->p_pid); + + fc = segu_fault(segu, (addr_t)p->p_segu, ptob(SEGU_PAGES), F_SOFTUNLOCK, S_OTHER); + if (fc != 0) { + cmn_err(CE_PANIC, "seg_fault() in segu_swapout() failed to swap u area out"); + } + + /* + * zeroed out the pte's in proc structure + */ + ppte = (pte_t *)ubptbl(p); + for (i=0; i < SEGU_PAGES; i++) { + ppte->pg_pte = 0; + ppte++; + } + return(ptob(SEGU_PAGES)); +} + +/* + * Swap in a process's u-block. + */ +/*ARGSUSED*/ +int +swapinub(p) + register proc_t *p; +{ + + /* + * If the u-block is already in-core, there's no work to do. + */ + if (p->p_flag & SULOAD) + return(1); + + /* + * If "freeswap" is zero, we don't free up the swap space; + * this is used by /proc so that a process u-block can be + * cheaply "swapped out" again if it had to be swapped in. + * XXX - we need to do this. + */ + segu_swapin(p); + p->p_flag |= SULOAD; + return(1); +} + +/* + * Swap out a process u-block. If the u-block has not actually been + * modified, no disk I/O is necessary. Return 0 if swap space must + * be allocated and isn't available, 1 otherwise. + */ +int +swapoutub(p) + register proc_t *p; +{ + segu_swapout(p); + p->p_flag &= ~SULOAD; + return 1; +} + +/* + * Lock arbitration to ensure that we don't try to swap out a u-block + * at the same time as it's being swapped in. + */ +void +ub_lock(p) + register proc_t *p; +{ + while (p->p_flag & SUSWAP) { + p->p_flag |= SUWANT; + sleep(((caddr_t)&p->p_flag)+1, PSWP); + } + p->p_flag |= SUSWAP; +} + +void +ub_rele(p) + register proc_t *p; +{ + register int s; + + p->p_flag &= ~SUSWAP; + if (p->p_flag & SUWANT) { + p->p_flag &= ~SUWANT; + wakeup(((caddr_t)&p->p_flag)+1); + } + /* + * If sched() went to sleep waiting for a process to swap in, + * wake it up (since we might have prevented a swap-in while + * we had the u-block locked). + */ + s = splhi(); + if (runout) { + runout = 0; + setrun(nproc[0]); + } + splx(s); +} + +int +segu_mapin(p) +struct proc *p; +{ + ub_lock(p); + if (p->p_flag & SULOAD) { + ub_rele(p); + return(0); + } + swapinub(p); + return(1); +} + +void +segu_mapout(p) +struct proc *p; +{ + ASSERT(p->p_flag & SULOAD); + swapoutub(p); + ub_rele(p); +} + + +/* + * Handle a fault on an address corresponding to one of the + * slots in the segu segment. + */ +/* ARGSUSED */ +STATIC faultcode_t +segu_fault(seg, vaddr, len, type, rw) + struct seg *seg; + addr_t vaddr; + u_int len; + enum fault_type type; + enum seg_rw rw; +{ + struct segu_segdata *sdp = (struct segu_segdata *)seg->s_data; + struct segu_data *sup; + int slot; + addr_t vbase; + int err; + + /* + * Sanity checks. + */ + if (seg != segu) + cmn_err(CE_PANIC, "segu_fault: wrong segment"); + if (type == F_PROT) + cmn_err(CE_PANIC, "segu_fault: unexpected F_PROT fault"); + + /* + * Verify that the range specified by vaddr and len falls + * completely within the mapped part of a single allocated + * slot, calculating the slot index and slot pointer while + * we're at it. + */ + slot = segu_getslot(seg, vaddr, len); + if (slot == -1) + return (FC_MAKE_ERR(EFAULT)); + sup = &sdp->usd_slots[slot]; + + vbase = seg->s_base + ptob(SEGU_PAGES) * slot; + + /* + * The F_SOFTLOCK and F_SOFTUNLOCK cases have more stringent + * range requirements: the given range must exactly coincide + * with the slot's mapped portion. + */ + if (type == F_SOFTLOCK || type == F_SOFTUNLOCK) { + if (vaddr != segu_stom(vbase) || len != ptob(SEGU_PAGES)) + return (FC_MAKE_ERR(EFAULT)); + } + + if (type == F_SOFTLOCK) { + /* + * Somebody is trying to lock down this slot, e.g., as + * part of swapping in a u-area contained in the slot. + */ + + /* + * It is erroneous to attempt to lock when already locked. + * + * XXX: Possibly this shouldn't be a panic. It depends + * on what assumptions we're willing to let clients + * make. + */ + if (sup->su_flags & SEGU_LOCKED) + cmn_err(CE_PANIC, "segu_fault: locking locked slot"); + + err = segu_softload(seg, segu_stom(vbase), + ptob(SEGU_PAGES), slot, 1); + if (err) + return (FC_MAKE_ERR(err)); + + sup->su_flags |= SEGU_LOCKED; + return (0); + } + + if (type == F_INVAL) { + /* + * Normal fault (e.g., by uaccess). The processing required + * is quite similar to that for the F_SOFTLOCK case in that + * we have to drag stuff in and make sure it's mapped. It + * differs in that we don't lock it down. + */ + + if (segu_debug) + printf("segu_fault(%x, %x, %d)\n", vaddr, len, type); + + /* + * If the slot is already locked, the only way we + * should fault is by referencing the red zone. + * + * XXX: Probably should tighten this check and verify + * that it's really a red zone reference. + * XXX: Is this the most appropriate error code? + */ + if (sup->su_flags & SEGU_LOCKED) + return (FC_MAKE_ERR(EINVAL)); + + err = segu_softload(seg, vaddr, len, slot, 0); + return (err ? FC_MAKE_ERR(err) : 0); + } + + if (type == F_SOFTUNLOCK) { + /* + * Somebody is trying to swap out this slot, e.g., as + * part of swapping out a u-area contained in this slot. + */ + + /* + * It is erroneous to attempt to unlock when not + * currently locked. + */ + if (!(sup->su_flags & SEGU_LOCKED)) + cmn_err(CE_PANIC, "segu_fault: unlocking unlocked slot"); + sup->su_flags &= ~SEGU_LOCKED; + + err = segu_softunload(seg, vaddr, len, slot, 1); + return (err ? FC_MAKE_ERR(err) : 0); + } + + cmn_err(CE_PANIC, "segu_fault: bogus fault type"); + /* NOTREACHED */ +} + +/* + * Check that the given protections suffice over the range specified by + * vaddr and len. For this segment type, the only issue is whether or + * not the range lies completely within the mapped part of an allocated slot. + * + * We let segu_getslot do all the dirty work. + */ +/* ARGSUSED */ +STATIC int +segu_checkprot(seg, vaddr, len, prot) + struct seg *seg; + addr_t vaddr; + u_int len; + u_int prot; +{ + register int slot = segu_getslot(seg, vaddr, len); + + return (slot == -1 ? EACCES : 0); +} + +STATIC int +segu_getprot(seg, addr, len, protv) + register struct seg *seg; + register addr_t addr; + register u_int len, *protv; +{ + u_int pgno = seg_page(seg, addr+len) - seg_page(seg, addr) + 1; + + if (pgno != 0) { + do protv[--pgno] = (u_int)(PROT_READ|PROT_WRITE); + while (pgno != 0); + } + return 0; +} + +/* ARGSUSED */ +STATIC off_t +segu_getoffset(seg, addr) + struct seg *seg; + addr_t addr; +{ + return 0; +} + +/* ARGSUSED */ +STATIC int +segu_gettype(seg, addr) + struct seg *seg; + addr_t addr; +{ + return MAP_SHARED; +} + +/* ARGSUSED */ +STATIC int +segu_getvp(seg, addr, vpp) + struct seg *seg; + addr_t addr; + struct vnode **vpp; +{ + *vpp = NULL; + return -1; +} + +/* + * Allocate resources for a single slot. + * + * When used for u-area, called at process creation time. + * + * Assumption: no resources exist as yet for this slot, so there's + * no possibility of (say) some swap space already being allocated. + * (This is a change from the previous implementation.) + */ +addr_t +segu_get(cp) + struct proc *cp; +{ + struct segu_segdata *sdp = (struct segu_segdata *)segu->s_data; + page_t *pp; + addr_t vbase; + addr_t va; + struct segu_data *sup; + int slot; + int i, j; + pte_t *ptptr, *fuptr; + sde_t *sdeptr; + caddr_t addr; + + /* + * Allocate virtual space. This amounts to grabbing a free slot. + */ + if ((sup = sdp->usd_free) == NULL) + return (NULL); + sdp->usd_free = sup->su_next; + slot = sup - sdp->usd_slots; + + vbase = segu->s_base + ptob(SEGU_PAGES) * slot; + + /* + * Reserve sufficient swap space for this slot. We'll + * actually allocate it in the loop below, but reserving it + * here allows us to back out more gracefully than if we + * had an allocation failure in the body of the loop. + * + * Note that we don't need swap space for the red zone page. + */ + if (anon_resv(ptob(SEGU_PAGES)) == 0) { + if (segu_debug) + printf("segu_get: no swap space available\n"); + return (NULL); + } + + if (availrmem - USIZE < tune.t_minarmem) { + nomemmsg("segu_get", USIZE, 0, 0); + anon_unresv(ctob(USIZE)); + return(NULL); + } else { + if (cp->p_flag & SSYS) { + availrmem -= USIZE; + pages_pp_kernel += USIZE; + } + } + + /* + * Allocate pages, avoiding allocating one for the red zone. + */ + pp = rm_allocpage(segu, segu_stom(vbase), ptob(SEGU_PAGES), P_CANWAIT); + if (pp == NULL) { + if (segu_debug) + printf("segu_get: no pages available\n"); + /* + * Give back the resources we've acquired. + */ + anon_unresv(ptob(SEGU_PAGES)); + if (cp->p_flag & SSYS) { + availrmem += USIZE; + pages_pp_kernel -= USIZE; + } + return (NULL); + } + + /* + * Allocate swap space. + * + * Because the interface for getting swap slots is designed + * to handle only one page at a time, we must deal with each + * page in the u-area individually instead of allocating a + * contiguous chunk of swap space for the whole thing as we + * would prefer. + * + * This being the case, we actually do more in this loop than + * simply allocate swap space. As we handle each page, we + * complete its setup. + */ + for (i = 0, va = vbase; i < SEGU_PAGES; i++, va += ptob(1)) { + register struct anon *ap; + struct vnode *vp; + u_int off; + + /* + * Sanity check. + */ + if (pp == NULL) + cmn_err(CE_PANIC, "segu_get: not enough pages"); + + /* + * Get a swap slot. + */ + if ((ap = anon_alloc()) == NULL) + cmn_err(CE_PANIC, "segu_get: swap allocation failure"); + sup->su_swaddr[i] = ap; + + /* + * Tie the next page to the swap slot. + */ + swap_xlate(ap, &vp, &off); + while (page_enter(pp, vp, off)) { + /* + * The page was already tied to something + * else that we have no record of. Since + * the page we wish be named by + * already exists, we abort the old page. + */ + page_t *p1; + + p1 = page_find(vp, off); + if (p1 != NULL) + page_abort(p1); + } + + /* + * Mark the page for long term keep. + * + * XXX: Until we switch over to using a separate long + * term keep count field, we need do nothing. + * XXX: When the page structure is modified to include a + * long-term keep count field, we'll want to use + * that field. In the meantime, we have to make do + * with the (short term) p_keepcnt field. This + * introduces possibilities for deadlock unless we're + * very careful to constrain ourselves elsewhere + * (e.g., in how we say the pages should be released + * at segmap_release time). + */ + + /* + * Load and lock an MMU translation for the page. + */ + hat_memload(segu, va, pp, UPAGE_PROT, 1); + + page_unlock(pp); + + /* + * Prepare to use the next page. + */ + page_sub(&pp, pp); + } + + /* + * Finally, mark this slot as allocated and locked. + */ + sup->su_flags = SEGU_ALLOCATED | SEGU_LOCKED; + + /* floating u area support */ + sup->su_proc = cp; + addr = (caddr_t)segu_stom(vbase); + ptptr = (pte_t *)ubptbl(cp); + for (j=0; jpg_pte = fuptr->pg_pte; + addr += PAGESIZE; + } + + /* + * Return the address of the base of the mapped part of + * the slot. + */ + return (segu_stom(vbase)); +} + +/* + * Reclaim resources for a single slot. + * + * When used for u-area, called at process destruction time. + * + * N.B.: Since this routine deallocates all of the slot's resources, + * callers can't count on the resources remaining accessible. In + * particular, any stack contained in the slot will vanish, so we'd + * better not be running on that stack. + * + * We can't simply undo everything that segu_get did directly, + * because someone else may have acquired a reference to one or + * more of the associated pages in the meantime. + */ +void +segu_release(p) + struct proc *p; +{ + struct segu_segdata *sdp = (struct segu_segdata *)segu->s_data; + addr_t vbase; + addr_t vaddr; + struct segu_data *sup; + int slot; + + /* floating u area support */ + int s; + + s = spl7(); + ((sde_t *)dflt_sdt_p)->wd2.address = phys_ubptbl(nproc[0]->p_ubptbl); + srama[SCN3] = dflt_sdt_p; + ((int *)sramb)[SCN3] = 0; + splx(s); + + vaddr = (addr_t)p->p_segu; + vbase = segu_mtos(vaddr); + p->p_segu = (struct seguser *)NULL; + /* + * Get the slot corresponding to this virtual address. + */ + slot = (vbase - segu->s_base) / ptob(SEGU_PAGES); + sup = &sdp->usd_slots[slot]; + + /* + * XXX: Do we need to lock this slot's pages while we're + * messing with them? What can happen once we decrement + * the keep count below? + */ + + /* + * Unload the mmu translations for this slot. + * + * If this slot is locked, unlock it, unlock the mmu + * translation, and decrement the keep count. + */ + if (sup->su_flags & SEGU_LOCKED) { + sup->su_flags &= ~SEGU_LOCKED; + hat_unload(segu, vaddr, ptob(SEGU_PAGES), HAT_UNLOCK|HAT_RELEPP); + } else { + hat_unload(segu, vaddr, ptob(SEGU_PAGES), HAT_NOFLAGS); + } + + if (p->p_flag & SSYS) { + availrmem += USIZE; + pages_pp_kernel -= USIZE; + } + /* + * Release our claim on swap space for the pages controlled + * by this slot. + */ + anon_free(sup->su_swaddr, ptob(SEGU_PAGES)); + anon_unresv(ptob(SEGU_PAGES)); + + /* + * Mark the slot as unallocated and put it back on the free list. + */ + sup->su_flags &= ~SEGU_ALLOCATED; + sup->su_next = sdp->usd_free; + sdp->usd_free = sup; +} + +struct segu_data * +segu_getentry(seg, vaddr) + register struct seg *seg; + addr_t vaddr; +{ + register int slot; + struct segu_data *entry; + + ASSERT(seg == segu); + slot = segu_getslot(seg, vaddr, ptob(SEGU_PAGES)); + entry = ((struct segu_segdata *)seg->s_data)->usd_slots; + entry = entry + slot; + return(entry); +} + +/* + * Private routines for use by seg_u operations. + */ + +/* + * Verify that the range designated by vaddr and len lies completely + * within the mapped part of a single allocated slot. If so, return + * the slot's index; otherwise return -1. + */ +STATIC int +segu_getslot(seg, vaddr, len) + register struct seg *seg; + addr_t vaddr; + u_int len; +{ + register int slot; + register struct segu_segdata *sdp; + register struct segu_data *sup; + addr_t vlast; + addr_t vmappedbase; + + sdp = (struct segu_segdata *)seg->s_data; + + /* + * Make sure the base is in range of the segment as a whole. + */ + if (vaddr < seg->s_base || vaddr >= seg->s_base + seg->s_size) + return (-1); + + /* + * Figure out what slot the address lies in. + */ + slot = (vaddr - seg->s_base) / ptob(SEGU_PAGES); + sup = &sdp->usd_slots[slot]; + + /* + * Make sure the end of the range falls in the same slot. + */ + vlast = vaddr + len - 1; + if ((vlast - seg->s_base) / ptob(SEGU_PAGES) != slot) + return (-1); + + /* + * Nobody has any business touching this slot if it's not currently + * allocated. + */ + if (!(sup->su_flags & SEGU_ALLOCATED)) + return (-1); + + /* + * Finally, verify that the range is completely in the mapped part + * of the slot. + */ + vmappedbase = segu_stom(seg->s_base + ptob(SEGU_PAGES) * slot); + if (vaddr < vmappedbase || vlast >= vmappedbase + ptob(SEGU_PAGES)) + return (-1); + + return (slot); +} + +/* + * Unload intra-slot resources in the range given by vaddr and len. + * Assumes that the range is known to fall entirely within the mapped + * part of the slot given as argument and that the slot itself is + * allocated. + */ +STATIC int +segu_softunload(seg, vaddr, len, slot, locked) + struct seg *seg; + addr_t vaddr; + u_int len; + int slot; + int locked; +{ + register struct segu_data *sup; + register struct page *pp; + register u_int i; + register pte_t *ppte; + + /* + * Loop through the pages in the given range. + */ + vaddr = (addr_t)((u_int)vaddr & PAGEMASK); + len = roundup(len, ptob(1)); + + /* + * We tried calling hat_unload with HAT_FREEPP to put the pages on + * the free list if there weren't anymore mappings, but it hurt + * performance slightly. + */ + if (locked) { + hat_unload(seg, vaddr, len, HAT_UNLOCK|HAT_RELEPP); + } else { + hat_unload(seg, vaddr, len, HAT_RELEPP); + } + + /* + * floating u area support + * get the owner process + */ + sup = &((struct segu_segdata *)segu->s_data)->usd_slots[slot]; + ppte = (pte_t *)ubptbl(sup->su_proc); + + /* + * The code below is machine dependent. We have to sync + * the ref/mod bits of the page table contained in the + * proc structure back to the page structures. We could + * do the following computations: + * + * i = (vaddr - (seg->s_base + slot * ptob(SEGU_PAGES))) / ptob(1); + * swap_xlate(sup->su_swaddr[i], &vp, &off); + * if ((pp = page_find(vp, off)) == NULL) + * cmn_err(CE_PANIC, "segu_softunload: missing page"); + * + * But, as long as we have the page frame numbers we may as well + * use them. + */ + for (i = 0; i < USIZE; i++, ppte++) { + pp = page_numtopp(ppte->pgm.pg_pfn); + pp->p_ref |= ppte->pgm.pg_ref; + pp->p_mod |= ppte->pgm.pg_mod; + + if (pp->p_mapping == NULL && pp->p_keepcnt == 0 && + !pp->p_lock && pp->p_mod) { + /* + * XXX: Want most powerful credentials we can + * get. Punt for now. + */ + (void) VOP_PUTPAGE(pp->p_vnode, pp->p_offset, PAGESIZE, + B_ASYNC | B_FREE, (struct ucred *)NULL); + } + } + + return (0); +} + +/* + * Load and possibly lock intra-slot resources in the range given + * by vaddr and len. Assumes that the range is known to fall entirely + * within the mapped part of the slot given as argument and that the + * slot itself is allocated. + */ +STATIC int +segu_softload(seg, vaddr, len, slot, lock) + struct seg *seg; + addr_t vaddr; + u_int len; + int slot; + u_int lock; +{ + struct segu_segdata *sdp = (struct segu_segdata *)segu->s_data; + register struct segu_data + *sup = &sdp->usd_slots[slot]; + register addr_t va; + addr_t vlim; + register u_int i; + + /* + * Loop through the pages in the given range. + */ + va = (addr_t)((u_int)vaddr & PAGEMASK); + vaddr = va; + len = roundup(len, ptob(1)); + vlim = va + len; + /* Calculate starting page index within slot. */ + i = (va - (seg->s_base + slot * ptob(SEGU_PAGES))) / ptob(1); + for ( ; va < vlim; va += ptob(1), i++) { + page_t *pl[2]; + struct vnode *vp; + u_int off; + register int err; + + /* + * Summon the page. If it's not resident, arrange + * for synchronous i/o to pull it in. + * + * XXX: Need read credentials value; for now we punt. + */ + swap_xlate(sup->su_swaddr[i], &vp, &off); + err = VOP_GETPAGE(vp, off, ptob(1), (u_int *)NULL, + pl, ptob(1), seg, va, S_WRITE, (struct ucred *)NULL); + if (err) { + /* + * Back out of what we've done so far. + */ + (void) segu_softunload(seg, vaddr, (u_int)(va - vaddr), + slot, lock); + return (err); + } + /* + * The returned page list will have exactly one entry, + * which is returned to us already kept. + */ + + /* + * Load an MMU translation for the page. + */ + hat_memload(seg, va, pl[0], UPAGE_PROT, lock); + + /* + * If we're locking down resources, we need to increment + * the page's long term keep count. In any event, we + * need to decrement the (short term) keep count. + * + * XXX: For the moment the long and short term keep counts + * are the same thing, so in the locking case, the + * count manipulations cancel. + */ + if (!lock) + PAGE_RELE(pl[0]); + } + + return (0); +} + diff --git a/usr/src/uts/3b2/vm/seg_u.h b/usr/src/uts/3b2/vm/seg_u.h new file mode 100644 index 0000000..de3daeb --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_u.h @@ -0,0 +1,109 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_SEG_U_H +#define _VM_SEG_U_H + +#ident "@(#)kernel:vm/seg_u.h 1.5" + +/* + * VM - U-area segment management + * + * This file contains definitions related to the u-area segment type. + * + * This segment type is not yet implemented. The intent is that the + * things defined here evolve into the seg_u implementation. + */ + +/* + * The number of pages covered by a single seg_u slot. + * + * This value is the number of (software) pages in the u-area + * (including the stack in the u-area) plus an additional page + * for a stack red zone. If the seg_u implementation is ever + * generalized to allow variable-size stack allocation, this + * define will have to change. + */ +/* we don't need an extra page for redzone */ +#define SEGU_PAGES USIZE + +#define segu_stom(v) (v) +#define segu_mtos(v) (v) + + + +/* + * Private information per overall segu segment (as opposed + * to per slot within segment) + * + * XXX: We may wish to modify the free list to handle it as a queue + * instead of a stack; this possibly could reduce the frequency + * of cache flushes. If so, we would need a list tail pointer + * as well as a list head pointer. + */ +struct segu_segdata { + /* + * info needed: + * - slot vacancy info + * - a way of getting to state info for each slot + */ + struct segu_data *usd_slots; /* array of segu_data structs, + one per slot */ + struct segu_data *usd_free; /* slot free list head */ +}; + +/* + * Private per-slot information. + */ +struct segu_data { + struct segu_data *su_next; /* free list link */ + struct anon *su_swaddr[SEGU_PAGES]; /* disk address of u area when + swapped */ + u_int su_flags; /* state info: see below */ + struct proc *su_proc; /* owner fo the slot */ +}; + +/* + * Flag bits + * + * When the SEGU_LOCKED bit is set, all the resources associated with the + * corresponding slot are locked in place, so that referencing addresses + * in the slot's range will not cause a fault. Clients using this driver + * to manage a u-area lock down the slot when the corresponding process + * becomes runnable and unlock it when the process is swapped out. + */ +#define SEGU_ALLOCATED 0x01 /* slot is in use */ +#define SEGU_LOCKED 0x02 /* slot's resources locked */ + +/* + * Private segment information for seg_u. + * + * At this stage of the implementation, + * the proc structure contains the goodies. + */ + +#ifdef _KERNEL +extern struct seg kwuseg; +extern struct seg *segu; + +/* + * Public routine declarations not part of the segment ops vector go here. + */ + +#if defined(__STDC__) +extern int segu_create(struct seg *, void *); +extern addr_t segu_get(struct proc *); +extern void segu_release(struct proc *); +#else +extern int segu_create(); +extern addr_t segu_get(); +extern void segu_release(); +#endif /* __STDC__ */ + +#endif /* _KERNEL */ + +#endif /* _VM_SEG_U_H */ diff --git a/usr/src/uts/3b2/vm/seg_vn.c b/usr/src/uts/3b2/vm/seg_vn.c new file mode 100644 index 0000000..98ed5af --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_vn.c @@ -0,0 +1,2363 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/seg_vn.c 1.41" + +/* + * VM - shared or copy-on-write from a vnode/anonymous memory. + */ + +#include "sys/types.h" +#include "sys/bitmap.h" +#include "sys/param.h" +#include "sys/errno.h" +#include "sys/buf.h" +#include "sys/systm.h" +#include "sys/vnode.h" +#include "sys/mman.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" +#include "sys/cred.h" +#include "sys/vmsystm.h" +#include "sys/swap.h" +#include "sys/kmem.h" +#include "sys/inline.h" +#include "sys/tuneable.h" +#include "sys/sysmacros.h" + +#include "vm/trace.h" +#include "vm/hat.h" +#include "vm/mp.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/seg_vn.h" +#include "vm/pvn.h" +#include "vm/anon.h" +#include "vm/page.h" +#include "vm/vpage.h" +#include "vm/seg_kmem.h" + +/* + * Private seg op routines. + */ +STATIC int segvn_dup(/* seg, newsegp */); +STATIC int segvn_unmap(/* seg, addr, len */); +STATIC void segvn_free(/* seg */); +STATIC faultcode_t segvn_fault(/* seg, addr, type, rw */); +STATIC faultcode_t segvn_faulta(/* seg, addr */); +STATIC void segvn_unload(/* seg, addr, ref, mod */); +STATIC int segvn_setprot(/* seg, addr, len, prot */); +STATIC int segvn_checkprot(/* seg, addr, len, prot */); +STATIC int segvn_getprot(/* seg, addr, len, prot */); +STATIC off_t segvn_getoffset(/* seg, addr */); +STATIC int segvn_gettype(/* seg, addr */); +STATIC int segvn_getvp(/* seg, addr, vpp */); +STATIC int segvn_kluster(/* seg, addr, delta */); +STATIC u_int segvn_swapout(/* seg */); +STATIC int segvn_sync(/* seg, addr, len, attr, flags */); +STATIC int segvn_incore(/* seg, addr, len, vec */); +void free_vp_pages(/* vp, off, len */); +STATIC int segvn_lockop(/* seg, addr, len, attr, op, bitmap, pos */); + +struct seg_ops segvn_ops = { + segvn_dup, + segvn_unmap, + segvn_free, + segvn_fault, + segvn_faulta, + segvn_unload, + segvn_setprot, + segvn_checkprot, + segvn_kluster, + segvn_swapout, + segvn_sync, + segvn_incore, + segvn_lockop, + segvn_getprot, + segvn_getoffset, + segvn_gettype, + segvn_getvp, +}; + +/* + * Common zfod structures, provided as a shorthand for others to use. + */ +STATIC +struct segvn_crargs zfod_segvn_crargs = { + (struct vnode *)NULL, + 0, + (struct cred *)NULL, + MAP_PRIVATE, + PROT_ALL, + PROT_ALL, + (struct anon_map *)NULL, +}; + +STATIC +struct segvn_crargs kzfod_segvn_crargs = { + (struct vnode *)NULL, + 0, + (struct cred *)NULL, + MAP_PRIVATE, + PROT_ALL & ~PROT_USER, + PROT_ALL & ~PROT_USER, + (struct anon_map *)NULL, +}; + +caddr_t zfod_argsp = (caddr_t)&zfod_segvn_crargs; /* user zfod argsp */ +caddr_t kzfod_argsp = (caddr_t)&kzfod_segvn_crargs; /* kernel zfod argsp */ + +/* + * Variables for maintaining the free lists + * of segvn_data and anon_map structures. + */ +STATIC struct segvn_data *segvn_freelist; +STATIC int segvn_freeincr = 14; +STATIC struct anon_map *anonmap_freelist; +STATIC int anonmap_freeincr = 21; + +STATIC u_int anon_slop = 64*1024; /* allow segs to expand in place */ + +STATIC int segvn_concat(/* seg1, seg2, a */); +STATIC int segvn_extend_prev(/* seg1, seg2, a */); +STATIC int segvn_extend_next(/* seg1, seg2, a */); +STATIC void segvn_vpage(/* seg */); + +int +segvn_create(seg, argsp) + struct seg *seg; + _VOID *argsp; +{ + register struct segvn_crargs *a = (struct segvn_crargs *)argsp; + register struct segvn_data *svd; + register u_int swresv = 0; + register struct cred *cred; + int error; + + if (a->type != MAP_PRIVATE && a->type != MAP_SHARED) + cmn_err(CE_PANIC, "segvn_create type"); + + /* + * Check arguments. If a shared anon structure is given then + * it is illegal to also specify a vp or a PRIVATE mapping. + */ + if (a->amp != NULL && (a->vp != NULL || a->type == MAP_PRIVATE)) + cmn_err(CE_PANIC, "segvn_create anon_map"); + + /* + * If segment may need private pages, + * reserve them now. + */ + if (a->type == MAP_PRIVATE && (a->prot & PROT_WRITE)) { + if (anon_resv(seg->s_size) == 0) + return (ENOMEM); + swresv = seg->s_size; + } + + /* + * Reserve any mapping structures that may be required. + */ + error = hat_map(seg, + (a->vp == NULL) ? NULL : a->vp->v_pages, + a->offset & PAGEMASK, + (a->type == MAP_PRIVATE) ? a->prot & ~PROT_WRITE : a->prot, + HAT_PRELOAD|HAT_VNLIST); + if (error != 0) { + if (swresv != 0) + anon_unresv(swresv); + return(error); + } + + if (a->cred) { + cred = a->cred; + crhold(cred); + } else { + cred = crgetcred(); + } + + /* Inform the vnode of the new mapping */ + if (a->vp) + error = VOP_ADDMAP(a->vp, a->offset & PAGEMASK, seg->s_as, + &seg->s_base, seg->s_size, a->prot, + a->maxprot, 0, cred); + + /* + * If more than one segment in the address space, and + * they're adjacent virtually, try to concatenate them. + * Don't concatenate if an explicit anon_map structure + * was supplied (e.g., SystemV shared memory). + * + * We also don't try concatenation if this is a segment + * for the kernel's address space. This is a kludge + * because the kernel has several threads of control + * active at the same time and we can get in trouble + * if we reallocate the anon_map while another process + * is trying to fill the old anon_map in. + * XXX - need as/seg locking to fix the general problem of + * multiple threads in an address space instead of this kludge. + */ + if ((seg->s_prev != seg) && (a->amp == NULL) && (seg->s_as != &kas)) { + register struct seg *pseg, *nseg; + + /* first, try to concatenate the previous and new segments */ + pseg = seg->s_prev; + if (pseg->s_base + pseg->s_size == seg->s_base && + pseg->s_ops == &segvn_ops && + segvn_extend_prev(pseg, seg, a, swresv) == 0) { + /* success! now try to concatenate with following seg */ + crfree(cred); + nseg = pseg->s_next; + if (nseg != pseg && nseg->s_ops == &segvn_ops && + pseg->s_base + pseg->s_size == nseg->s_base) + (void) segvn_concat(pseg, nseg); + return (0); + } + /* failed, so try to concatenate with following seg */ + nseg = seg->s_next; + if (seg->s_base + seg->s_size == nseg->s_base && + nseg->s_ops == &segvn_ops && + segvn_extend_next(seg, nseg, a, swresv) == 0) { + crfree(cred); + return (0); + } + } + + if (a->vp != NULL) { + VN_HOLD(a->vp); + } else if (a->amp != NULL && a->type == MAP_SHARED) { + a->amp->refcnt++; + } + svd = (struct segvn_data *)kmem_fast_alloc((caddr_t *)&segvn_freelist, + sizeof (*segvn_freelist), segvn_freeincr, KM_SLEEP); + lock_init(&svd->lock); + svd->vp = a->vp; + svd->offset = a->offset & PAGEMASK; + svd->prot = a->prot; + svd->maxprot = a->maxprot; + svd->pageprot = 0; + svd->type = a->type; + svd->vpage = NULL; + svd->cred = cred; + svd->swresv = swresv; + if ((svd->amp = a->amp) == NULL) { + /* + * Not attaching to a shared anon object. + */ + svd->anon_index = 0; + } else { + /* + * For now we will insure that the segment size isn't larger + * than the size - offset gives us. Later on we may wish to + * have the anon array dynamically allocated itself so that + * we don't always have to allocate all the anon pointer slots. + * This of course involves adding extra code to check that we + * aren't trying to use an anon pointer slot beyond the end + * of the currently allocated anon array. + */ + if ((a->amp->size - a->offset) < seg->s_size) + cmn_err(CE_PANIC, "segvn_create anon_map size"); + svd->anon_index = btop(a->offset); + } + + seg->s_ops = &segvn_ops; + seg->s_data = (char *)svd; + + return (error); +} + +/* + * Concatenate two existing segments, if possible. + * Return 0 on success. + */ +STATIC int +segvn_concat(seg1, seg2) + struct seg *seg1, *seg2; +{ + register struct segvn_data *svd1, *svd2; + register u_int size; + register struct anon_map *amp1, *amp2; + + svd1 = (struct segvn_data *)seg1->s_data; + svd2 = (struct segvn_data *)seg2->s_data; + + /* both segments exist, try to merge them */ +#define incompat(x) (svd1->x != svd2->x) + if (incompat(vp) || incompat(maxprot) || incompat(prot) || + incompat(type)) + return (-1); + /* XXX - should also check cred */ +#undef incompat + /* vp == NULL implies zfod, offset doesn't matter */ + if (svd1->vp != NULL && + svd1->offset + seg1->s_size != svd2->offset) + return (-1); + amp1 = svd1->amp; + amp2 = svd2->amp; + /* XXX - for now, reject if any private pages. could merge. */ + if (amp1 != NULL || amp2 != NULL) + return (-1); + /* reject if vpage exists. could merge. */ + if ((svd1->vpage != NULL) || (svd2->vpage != NULL)) + return (-1); + /* all looks ok, merge second into first */ + svd1->swresv += svd2->swresv; + size = seg2->s_size; + seg_free(seg2); + seg1->s_size += size; + return (0); +} + +/* + * Extend the previous segment (seg1) to include the + * new segment (seg2 + a), if possible. + * Return 0 on success. + */ +STATIC int +segvn_extend_prev(seg1, seg2, a, swresv) + struct seg *seg1, *seg2; + register struct segvn_crargs *a; + u_int swresv; +{ + register struct segvn_data *svd1; + register u_int size; + register struct anon_map *amp1; + + /* second segment is new, try to extend first */ + svd1 = (struct segvn_data *)seg1->s_data; + /* XXX - should also check cred */ + if (svd1->vp != a->vp || svd1->maxprot != a->maxprot || + svd1->prot != a->prot || svd1->type != a->type) + return (-1); + /* vp == NULL implies zfod, offset doesn't matter */ + if (svd1->vp != NULL && + svd1->offset + seg1->s_size != (a->offset & PAGEMASK)) + return (-1); + if (svd1->vpage != NULL) { + return (-1); + } + amp1 = svd1->amp; + if (amp1) { + /* + * segment has private pages, can + * data structures be expanded? + */ + if (amp1->refcnt > 1 && amp1->size != seg1->s_size) + return (-1); + if (amp1->size - ctob(svd1->anon_index) < + seg1->s_size + seg2->s_size) { + struct anon **aa; + u_int asize; + + /* + * We need a bigger anon array. Allocate a new + * one with anon_slop worth of slop at the + * end so it will be easier to expand in + * place the next time we need to do this. + */ + asize = seg1->s_size + seg2->s_size + anon_slop; + aa = (struct anon **) + kmem_zalloc((u_int)btop(asize) * + sizeof (struct anon *), KM_SLEEP); + bcopy((caddr_t)(amp1->anon + svd1->anon_index), + (caddr_t)aa, + btop(seg1->s_size) * sizeof (struct anon *)); + kmem_free((caddr_t)amp1->anon, + btop(amp1->size) * sizeof (struct anon *)); + amp1->anon = aa; + amp1->size = asize; + svd1->anon_index = 0; + } else { + /* + * Can just expand anon array in place. + * Clear out anon slots after the end + * of the currently used slots. + */ + bzero((caddr_t)(amp1->anon + svd1->anon_index + + seg_pages(seg1)), + seg_pages(seg2) * sizeof (struct anon *)); + } + } + size = seg2->s_size; + seg_free(seg2); + seg1->s_size += size; + svd1->swresv += swresv; + return (0); +} + +/* + * Extend the next segment (seg2) to include the + * new segment (seg1 + a), if possible. + * Return 0 on success. + */ +STATIC int +segvn_extend_next(seg1, seg2, a, swresv) + struct seg *seg1, *seg2; + register struct segvn_crargs *a; + u_int swresv; +{ + register struct segvn_data *svd2 = (struct segvn_data *)seg2->s_data; + register u_int size; + register struct anon_map *amp2; + + /* first segment is new, try to extend second */ + /* XXX - should also check cred */ + if (svd2->vp != a->vp || svd2->maxprot != a->maxprot || + svd2->prot != a->prot || svd2->type != a->type) + return (-1); + /* vp == NULL implies zfod, offset doesn't matter */ + if (svd2->vp != NULL && + (a->offset & PAGEMASK) + seg1->s_size != svd2->offset) + return (-1); + if (svd2->vpage != NULL) { + return (-1); + } + amp2 = svd2->amp; + if (amp2) { + /* + * segment has private pages, can + * data structures be expanded? + */ + if (amp2->refcnt > 1) + return (-1); + if (ctob(svd2->anon_index) < seg1->s_size) { + struct anon **aa; + u_int asize; + + /* + * We need a bigger anon array. Allocate a new + * one with anon_slop worth of slop at the + * beginning so it will be easier to expand in + * place the next time we need to do this. + */ + asize = seg1->s_size + seg2->s_size + anon_slop; + aa = (struct anon **) + kmem_zalloc((u_int)btop(asize) * + sizeof (struct anon *), KM_SLEEP); + bcopy((caddr_t)(amp2->anon + svd2->anon_index), + (caddr_t)(aa + btop(anon_slop) + seg_pages(seg1)), + btop(seg2->s_size) * sizeof (struct anon *)); + kmem_free((caddr_t)amp2->anon, + btop(amp2->size) * sizeof (struct anon *)); + amp2->anon = aa; + amp2->size = asize; + svd2->anon_index = btop(anon_slop); + } else { + /* + * Can just expand anon array in place. + * Clear out anon slots going backwards + * towards the beginning of the array. + */ + bzero((caddr_t)(amp2->anon + svd2->anon_index - + seg_pages(seg1)), + seg_pages(seg1) * sizeof (struct anon *)); + svd2->anon_index -= seg_pages(seg1); + } + } + size = seg1->s_size; + seg_free(seg1); + seg2->s_size += size; + seg2->s_base -= size; + svd2->offset -= size; + svd2->swresv += swresv; + return (0); +} + +STATIC int +segvn_dup(seg, newseg) + struct seg *seg, *newseg; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct segvn_data *newsvd; + register u_int npages = seg_pages(seg); + int error = 0; + + /* + * If segment has anon reserved, + * reserve more for the new seg. + */ + if (svd->swresv) { + if (anon_resv(svd->swresv) == 0) + return (ENOMEM); + } + newsvd = + (struct segvn_data *)kmem_fast_alloc((caddr_t *)&segvn_freelist, + sizeof (*segvn_freelist), segvn_freeincr, KM_SLEEP); + lock_init(&newsvd->lock); + if ((newsvd->vp = svd->vp) != NULL) { + VN_HOLD(svd->vp); + } else if (svd->type == MAP_SHARED && svd->amp == NULL) { + /* + * We have a shared mapping for which there is no vp and no + * anon map structure yet. We need to allocate the anon + * map struct now so that it will be properly shared. + */ + svd->amp = (struct anon_map *)kmem_fast_alloc( + (caddr_t *)&anonmap_freelist, + sizeof (*anonmap_freelist), anonmap_freeincr, KM_SLEEP); + + svd->amp->refcnt = 1; + svd->amp->size = seg->s_size; + svd->amp->anon = (struct anon **)kmem_zalloc(npages * + sizeof (struct anon *), KM_SLEEP); + } + newsvd->offset = svd->offset; + newsvd->prot = svd->prot; + newsvd->maxprot = svd->maxprot; + newsvd->pageprot = svd->pageprot; + newsvd->type = svd->type; + newsvd->cred = svd->cred; + crhold(newsvd->cred); + newsvd->swresv = svd->swresv; + if ((newsvd->amp = svd->amp) == NULL) { + /* + * Not attaching to a shared anon object. + */ + newsvd->anon_index = 0; + } else { + if (svd->type == MAP_SHARED) { + svd->amp->refcnt++; + newsvd->anon_index = svd->anon_index; + } else { + /* + * Allocate and initialize new anon_map structure. + */ + newsvd->anon_index = 0; + + newsvd->amp = (struct anon_map *)kmem_fast_alloc( + (caddr_t *)&anonmap_freelist, + sizeof (*anonmap_freelist), anonmap_freeincr, + KM_SLEEP); + + newsvd->amp->refcnt = 1; + newsvd->amp->size = seg->s_size; + newsvd->amp->anon = (struct anon **)kmem_alloc( + npages * sizeof (struct anon *), KM_SLEEP); + + hat_chgprot(seg, seg->s_base, seg->s_size, ~PROT_WRITE); + + anon_dup(&svd->amp->anon[svd->anon_index], + newsvd->amp->anon, seg->s_size); + } + } + /* + * If necessary, create a vpage structure for the new segment. + * Do not copy any page lock indications. + */ + if (svd->vpage != NULL) { + register u_int i; + register struct vpage *ovp = svd->vpage; + register struct vpage *nvp; + + nvp = newsvd->vpage = (struct vpage *)kmem_alloc( + (npages * sizeof (struct vpage)), KM_SLEEP); + for (i = 0; i < npages; i++) { + *nvp = *ovp++; + (nvp++)->vp_pplock = 0; + } + } else + newsvd->vpage = NULL; + + newseg->s_ops = &segvn_ops; + newseg->s_data = (char *)newsvd; + + /* Inform the vnode of the new mapping */ + if (newsvd->vp) + error = VOP_ADDMAP(newsvd->vp, newsvd->offset, newseg->s_as, + &newseg->s_base, newseg->s_size, newsvd->prot, + newsvd->maxprot, 0, newsvd->cred); + return (error); +} +STATIC int +segvn_unmap(seg, addr, len) + register struct seg *seg; + register addr_t addr; + u_int len; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct segvn_data *nsvd; + register struct seg *nseg; + register u_int opages, /* old segment size in pages */ + npages, /* new segment size in pages */ + dpages; /* pages being deleted (unmapped)*/ + struct anon **app; + addr_t nbase; + u_int nsize; + + + /* + * Check for bad sizes + */ + if (addr < seg->s_base || addr + len > seg->s_base + seg->s_size || + (len & PAGEOFFSET) || ((u_int)addr & PAGEOFFSET)) + cmn_err(CE_PANIC, "segvn_unmap"); + + /* Inform the vnode of the unmapping. */ + if (svd->vp) { + if (VOP_DELMAP(svd->vp, svd->offset, seg->s_as, addr, len, + svd->prot, svd->maxprot, svd->type, svd->cred) != 0) + cmn_err(CE_WARN, "segvn_unmap VOP_DELMAP"); + } + /* + * Remove any page locks set through this mapping. + */ + (void) segvn_lockop(seg, addr, len, 0, MC_UNLOCK, + (ulong *)NULL, (size_t)NULL); + + /* + * Unload any hardware translations in the range to be taken out. + */ + hat_unload(seg, addr, len, HAT_NOFLAGS); + + /* + * Check for entire segment + */ + if (addr == seg->s_base && len == seg->s_size) { + seg_free(seg); + return (0); + } + + opages = seg_pages(seg); + dpages = btop(len); + npages = opages - dpages; + + /* + * Check for beginning of segment + */ + if (addr == seg->s_base) { + if (svd->vpage != NULL) { + register uint nbytes; + register struct vpage *ovpage; + + ovpage = svd->vpage; /* keep pointer to vpage */ + + nbytes = npages * sizeof (struct vpage); + svd->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + bcopy((caddr_t)&ovpage[dpages], + (caddr_t)svd->vpage, nbytes); + + /* free up old vpage */ + kmem_free(ovpage, opages * sizeof (struct vpage)); + } + if (svd->amp != NULL && (svd->amp->refcnt == 1 || + svd->type == MAP_PRIVATE)) { + /* + * Free up now unused parts of anon_map array. + */ + app = &svd->amp->anon[svd->anon_index]; + anon_free(app, len); + bzero((caddr_t)app, dpages * sizeof (*app)); + svd->anon_index += dpages; + } + if (svd->vp != NULL) { + free_vp_pages(svd->vp, svd->offset, len); + svd->offset += len; + } + + if (svd->swresv) { + anon_unresv(len); + svd->swresv -= len; + } + + seg->s_base += len; + seg->s_size -= len; + return (0); + } + + /* + * Check for end of segment + */ + if (addr + len == seg->s_base + seg->s_size) { + if (svd->vpage != NULL) { + register uint nbytes; + register struct vpage *ovpage; + + ovpage = svd->vpage; /* keep pointer to vpage */ + + nbytes = npages * sizeof (struct vpage); + svd->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + bcopy((caddr_t)ovpage, (caddr_t)svd->vpage, nbytes); + + /* free up old vpage */ + kmem_free(ovpage, opages * sizeof (struct vpage)); + + } + if (svd->amp != NULL && (svd->amp->refcnt == 1 || + svd->type == MAP_PRIVATE)) { + /* + * Free up now unused parts of anon_map array + */ + app = &svd->amp->anon[svd->anon_index + npages]; + anon_free(app, len); + bzero((caddr_t)app, dpages * sizeof (*app)); + } + + if (svd->swresv) { + anon_unresv(len); + svd->swresv -= len; + } + + seg->s_size -= len; + if (svd->vp != NULL) { + free_vp_pages(svd->vp, svd->offset + seg->s_size, len); + } + + return (0); + } + + /* + * The section to go is in the middle of the segment, + * have to make it into two segments. nseg is made for + * the high end while seg is cut down at the low end. + */ + nbase = addr + len; /* new seg base */ + nsize = (seg->s_base + seg->s_size) - nbase; /* new seg size */ + seg->s_size = addr - seg->s_base; /* shrink old seg */ + nseg = seg_alloc(seg->s_as, nbase, nsize); + if (nseg == NULL) + cmn_err(CE_PANIC, "segvn_unmap seg_alloc"); + + nseg->s_ops = seg->s_ops; + nsvd = (struct segvn_data *)kmem_fast_alloc((caddr_t *)&segvn_freelist, + sizeof (*segvn_freelist), segvn_freeincr, KM_SLEEP); + nseg->s_data = (char *)nsvd; + lock_init(&nsvd->lock); + nsvd->pageprot = svd->pageprot; + nsvd->prot = svd->prot; + nsvd->maxprot = svd->maxprot; + nsvd->type = svd->type; + nsvd->vp = svd->vp; + nsvd->cred = svd->cred; + nsvd->offset = svd->offset + nseg->s_base - seg->s_base; + nsvd->swresv = 0; + if (svd->vp != NULL) { + free_vp_pages(svd->vp, svd->offset + seg->s_size, len); + VN_HOLD(nsvd->vp); + } + crhold(svd->cred); + + if (svd->vpage == NULL) + nsvd->vpage = NULL; + else { + /* need to split vpage into two arrays */ + register uint nbytes; + register struct vpage *ovpage; + + ovpage = svd->vpage; /* keep pointer to vpage */ + + npages = seg_pages(seg); /* seg has shrunk */ + nbytes = npages * sizeof (struct vpage); + svd->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + + bcopy((caddr_t)ovpage, (caddr_t)svd->vpage, nbytes); + + npages = seg_pages(nseg); + nbytes = npages * sizeof (struct vpage); + nsvd->vpage = (struct vpage *)kmem_alloc(nbytes, KM_SLEEP); + + bcopy((caddr_t)&ovpage[opages - dpages], + (caddr_t)nsvd->vpage, nbytes); + + /* free up old vpage */ + kmem_free(ovpage, opages * sizeof (struct vpage)); + } + + if (svd->amp == NULL) { + nsvd->amp = NULL; + nsvd->anon_index = 0; + } else { + /* + * Share the same anon_map structure. + */ + opages = btop(addr - seg->s_base); + npages = btop(nseg->s_base - seg->s_base); + + if (svd->amp->refcnt == 1 || + svd->type == MAP_PRIVATE) { + /* + * Free up now unused parts of anon_map array + */ + app = &svd->amp->anon[svd->anon_index + opages]; + anon_free(app, len); + bzero((caddr_t)app, dpages * sizeof (*app)); + } + nsvd->amp = svd->amp; + nsvd->anon_index = svd->anon_index + npages; + nsvd->amp->refcnt++; + } + if (svd->swresv) { + if (seg->s_size + nseg->s_size + len != svd->swresv) + cmn_err(CE_PANIC, "segvn_unmap: cannot split swap reservation"); + anon_unresv(len); + svd->swresv = seg->s_size; + nsvd->swresv = nseg->s_size; + } + + /* + * Now we do something so that all the translations which used + * to be associated with seg but are now associated with nseg. + */ + hat_newseg(seg, nseg->s_base, nseg->s_size, nseg); + + return (0); /* I'm glad that's all over with! */ +} + +STATIC void +segvn_free(seg) + struct seg *seg; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct anon **app; + u_int npages = seg_pages(seg); + + /* + * Be sure to unlock pages. XXX Why do things get free'ed instead + * of unmapped? XXX + */ + (void) segvn_lockop(seg, seg->s_base, seg->s_size, + 0, MC_UNLOCK, (ulong *)NULL, (size_t)NULL); + + /* + * Deallocate the vpage and anon pointers if necessary and possible. + */ + if (svd->vpage != NULL) + kmem_free((caddr_t)svd->vpage, npages * sizeof (struct vpage)); + if (svd->amp != NULL) { + /* + * If there are no more references to this anon_map + * structure, then deallocate the structure after freeing + * up all the anon slot pointers that we can. + */ + if (--svd->amp->refcnt == 0) { + if (svd->type == MAP_PRIVATE) { + /* + * Private - we only need to anon_free + * the part that this segment refers to. + */ + anon_free(&svd->amp->anon[svd->anon_index], + seg->s_size); + } else { + /* + * Shared - anon_free the entire + * anon_map's worth of stuff. + */ + anon_free(svd->amp->anon, svd->amp->size); + } + kmem_free((caddr_t)svd->amp->anon, + btop(svd->amp->size) * sizeof (struct anon *)); + kmem_fast_free((caddr_t *)&anonmap_freelist, + (caddr_t)svd->amp); + } else if (svd->type == MAP_PRIVATE) { + /* + * We had a private mapping which still has + * a held anon_map so just free up all the + * anon slot pointers that we were using. + */ + app = &svd->amp->anon[svd->anon_index]; + anon_free(app, seg->s_size); + bzero((caddr_t)app, npages * sizeof (*app)); + } + } + + /* + * Release swap reservation. + */ + if (svd->swresv) + anon_unresv(svd->swresv); + /* + * Release claim on vnode, credentials, and finally free the + * private data. + */ + if (svd->vp != NULL) { + free_vp_pages(svd->vp, svd->offset, seg->s_size); + VN_RELE(svd->vp); + } + crfree(svd->cred); + kmem_fast_free((caddr_t *)&segvn_freelist, (caddr_t)svd); +} + +/* + * Do a F_SOFTUNLOCK call over the range requested. + * The range must have already been F_SOFTLOCK'ed. + */ +STATIC void +segvn_softunlock(seg, addr, len, rw) + struct seg *seg; + addr_t addr; + u_int len; + enum seg_rw rw; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct anon **app; + register page_t *pp; + register struct vpage *vpage; + register addr_t adr; + struct vnode *vp; + u_int offset; + + if (svd->amp != NULL) + app = &svd->amp->anon[svd->anon_index + seg_page(seg, addr)]; + else + app = NULL; + + if (svd->vpage != NULL) + vpage = &svd->vpage[seg_page(seg, addr)]; + else + vpage = NULL; + + for (adr = addr; adr < addr + len; adr += PAGESIZE) { + if (app != NULL && *app != NULL) + swap_xlate(*app, &vp, &offset); + else { + vp = svd->vp; + offset = svd->offset + (adr - seg->s_base); + } + + /* + * For now, we just kludge here by finding the page + * ourselves since we would not find the page using + * page_find() if someone has page_abort()'ed it. + * XXX - need to redo things to avoid this mess. + */ + for (pp = page_hash[PAGE_HASHFUNC(vp, offset)]; pp != NULL; + pp = pp->p_hash) + if (pp->p_vnode == vp && pp->p_offset == offset) + break; + if (pp == NULL || pp->p_pagein || pp->p_free) + cmn_err(CE_PANIC, "segvn_softunlock"); + + if (vpage != NULL) + (void) vpage_lock(&svd->lock, vpage); + if (rw == S_WRITE) { + pp->p_mod = 1; + if (vpage != NULL) + vpage->vp_mod = 1; + } + if (rw != S_OTHER) { + trace4(TR_PG_SEGVN_FLT, pp, vp, offset, 1); + pp->p_ref = 1; + if (vpage != NULL) + vpage->vp_ref = 1; + } + hat_unlock(seg, adr); + PAGE_RELE(pp); + availrmem++; + pages_pp_kernel--; + if (vpage != NULL) { + vpage_unlock(&svd->lock, vpage); + vpage++; + } + if (app != NULL) + app++; + } +} + +/* + * Returns true if the app array has some non-anonymous memory + * The offp and lenp paramters are in/out paramters. On entry + * these values represent the starting offset and length of the + * mapping. When true is returned, these values may be modified + * to be the largest range which includes non-anoymous memory. + */ +STATIC int +non_anon(app, offp, lenp) + register struct anon **app; + u_int *offp, *lenp; +{ + register int i, el; + int low, high; + + low = -1; + for (i = 0, el = *lenp; i < el; i += PAGESIZE) { + if (*app++ == NULL) { + if (low == -1) + low = i; + high = i; + } + } + if (low != -1) { + /* + * Found at least one non-anon page. + * Set up the off and len return values. + */ + if (low != 0) + *offp += low; + *lenp = high - low + PAGESIZE; + return (1); + } + return (0); +} + +#define PAGE_HANDLED ((page_t *)-1) + +/* + * Release all the pages in the NULL terminated ppp list + * which haven't already been converted to PAGE_HANDLED. + */ +STATIC void +segvn_pagelist_rele(ppp) + register page_t **ppp; +{ + + for (; *ppp != NULL; ppp++) { + if (*ppp != PAGE_HANDLED) + PAGE_RELE(*ppp); + } +} + +/* + * Currently ld.so is not setting protections up with execute + * permissions on jump tables which are kept in ``data space''. + * So for now, we skip checking for exec permissions by default. + * This kludge will go away later after the runtime loader is fixed. + */ + +STATIC int exectst = 0; +STATIC int stealCOW = 1; + +/* + * Handles all the dirty work of getting the right + * anonymous pages and loading up the translations. + * This routine is called only from segvn_fault() + * when looping over the range of addresses requested. + * + * The basic algorithm here is: + * If this is an anon_zero case + * Call anon_zero to allocate page + * Load up translation + * Return + * endif + * If this is an anon page + * If page might be needed + * Use anon_getpage to get the page + * else if page needed + * Lookup primary page if locks are involved + * Find page in pl[] list passed in + * endif + * If we have primary page + * Load up the translation to the page + * If not a COW + * return + * endif + * Call anon_private to handle COW + * Transfer lock counts + * Load up (writable) translation to new page + */ +STATIC int +segvn_faultpage(seg, addr, off, app, vpage, pl, vpprot, type, rw) + struct seg *seg; + addr_t addr; + u_int off; + struct anon **app; + struct vpage *vpage; + page_t *pl[]; + u_int vpprot; + enum fault_type type; + enum seg_rw rw; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register page_t *pp, **ppp; + int pagesteal = 0; + page_t *anon_pl[1 + 1]; + page_t *opp; /* original object page */ + u_int prot; + int err; + int readyforCOW; + + /* + * Initialize protection value for this page. + * If we have per page protection values check it now. + */ + if (svd->pageprot) { + u_int protchk; + + switch (rw) { + case S_READ: + protchk = PROT_READ; + break; + case S_WRITE: + protchk = PROT_WRITE; + break; + case S_EXEC: + protchk = exectst ? PROT_EXEC : PROT_READ; + break; + case S_OTHER: + default: + protchk = PROT_READ | PROT_WRITE | PROT_EXEC; + break; + } + + prot = vpage->vp_prot; + if ((prot & protchk) == 0) + return (FC_PROT); /* illegal access type */ + } else { + prot = svd->prot; + } + + if (type == F_SOFTLOCK) + if (availrmem - 1 < tune.t_minarmem) + return (FC_MAKE_ERR(ENOMEM)); /* out of real memory */ + else { + --availrmem; + pages_pp_kernel++; + } + + if (svd->vp == NULL && *app == NULL) { + /* + * Allocate a (normally) writable + * anonymous page of zeroes. + */ + if ((pp = anon_zero(seg, addr, app)) == NULL) { + err = ENOMEM; + goto out; /* out of swap space */ + } + pp->p_ref = 1; + if (type == F_SOFTLOCK) { + /* + * Load up the translation keeping it + * locked and don't PAGE_RELE the page. + */ + hat_memload(seg, addr, pp, prot, 1); + } else { + hat_memload(seg, addr, pp, prot, 0); + PAGE_RELE(pp); + } + return (0); + } + + /* + * Set flag used to determine if things are already set up + */ + readyforCOW = (type == F_PROT && rw == S_WRITE && + svd->type == MAP_PRIVATE); + + /* + * This code works very hard at avoiding work. In the case + * of faults on the private copy of an object (the result of + * a previous copy-on-write), an attempt to find its page + * structure is optimized away if it appears we never need + * the structure. We don't need it if this is a simply copy- + * on-write of a page already in the hat -- we'll just use it's + * mapped address to implement the copy. This is allowed iff: + * It's a copy-on-write fault (page is already in memory); + * The page is shared (and thus can not be stolen); and + * The page is not locked in this mapping. + * Otherwise, anon_getpage must be called to obtain the page + * structure. + */ + if (app != NULL && *app != NULL) { + if (readyforCOW && (*app)->an_refcnt > 1 && + vpage != NULL && vpage->vp_pplock == 0) { + /* + * Skip calling anon_getpage() - the + * page is already loaded in the hat + * layer with a read-only translation + * and won't be made writable. + */ + opp = pp = NULL; + } else { + err = anon_getpage(app, &vpprot, anon_pl, PAGESIZE, + seg, addr, rw, svd->cred); + if (err) + goto out; + if (svd->type == MAP_SHARED) { + /* + * If this is a shared mapping to an + * anon_map, then ignore the write + * permissions returned by anon_getpage(). + * They apply to the private mappings + * of this anon_map. + */ + vpprot |= PROT_WRITE; + } + opp = pp = anon_pl[0]; + } + } else if (readyforCOW) { + /* + * No need to bother getting original page unless + * a lock is involved. And if it is, then we already + * know the page is in the hat layer, so just look it + * up. + */ + pp = NULL; + if ((vpage != NULL) && vpage->vp_pplock) { + if ((opp = page_lookup(svd->vp, off)) == NULL) + cmn_err(CE_PANIC,"segvn_faultpage lookup failed"); + } else + opp = NULL; + } else { + /* + * Find original page. We must be bringing it in + * from the list in pl[]. + */ + pp = NULL; + for (ppp = pl; (opp = *ppp) != NULL; ppp++) { + if (opp == PAGE_HANDLED) + continue; + ASSERT(opp->p_vnode == svd->vp); /* XXX */ + if (opp->p_offset == off) + break; + } + if (opp == NULL) + cmn_err(CE_PANIC,"segvn_faultpage not found"); + pp = opp; + *ppp = PAGE_HANDLED; + } + + if (pp != NULL) { + int noCOW; + + /* + * This is the primary page we need. + * Check to see if we really want to + * lock this page/translation or not. + */ + trace4(TR_PG_SEGVN_FLT, pp, pp->p_vnode, pp->p_offset, 0); + pp->p_ref = 1; + + if (stealCOW && app != NULL && *app == NULL && + freemem < minfree && pp->p_keepcnt == 1 && + pp->p_mod == 0 && pp->p_mapping == NULL && + pp->p_lckcnt == 0 && pp->p_cowcnt == 0) + pagesteal = 1; + + noCOW = (((prot & vpprot) & PROT_WRITE) != 0 || + (type != F_PROT && rw != S_WRITE) || + svd->type == MAP_SHARED); + + if (type == F_SOFTLOCK && noCOW) { + /* + * Load up the translation keeping it + * locked and don't PAGE_RELE the page. + */ + hat_memload(seg, addr, pp, prot & vpprot, 1); + } else { + hat_memload(seg, addr, pp, prot & vpprot, 0); + PAGE_RELE(pp); + } + + /* + * If not a copy on write case return now. + */ + if (noCOW) + return (0); + } + + ASSERT(app != NULL); + + if (vpage != NULL && vpage_lock(&svd->lock, vpage) < 0) { + /* + * In the multiprocessor case we should probably + * just unlock and return and assume that another + * processor got here first. But for now, we + * simply panic in this situation. + */ + cmn_err(CE_PANIC, "segvn_faultpage vpage_lock"); + } + +#ifdef sun386 + /* + * We need to lock down the translation to prevent another + * write fault while we are processing the copy-on-write. + */ + hat_lock(seg, addr); + PAGE_HOLD(pp); +#endif + + /* + * anon_private() will make a new copy of the contents of this + * page. If we have the original page structure, hold it to + * prevent it from being paged out; we can't tolerate a page + * fault during the copy because it may have been elicited by + * some other process (e.g. through a /proc operation). + * + * XXX -- if we don't have the original page structure, it is + * implicitly assumed that this is a copy-on-write fault (type + * F_PROT) elicited in the context of the currently-running + * process, and therefore that the associated segment address + * is mapped in. This depends on the fact that if /proc is + * faulting it in, the type will be F_SOFTLOCK rather than + * F_PROT. + */ + + if (opp) + PAGE_HOLD(opp); + + /* + * Allocate a page and perform the copy. + */ + pp = anon_private(app, seg, addr, opp, pagesteal); + + if (opp) + PAGE_RELE(opp); + +#ifdef sun386 + PAGE_RELE(pp); + hat_unlock(seg, addr); +#endif + + if (pp == NULL) { + err = ENOMEM; /* out of swap space */ + goto out; + } + + /* + * If we have a vpage pointer, see if it indicates that we have + * ``locked'' the page we map -- if so, transfer the locking resource + * to the new page. In any case, remove the lock on the vpage itself. + */ + if (vpage != NULL) { + if (vpage->vp_pplock) + page_pp_useclaim(opp, pp); + vpage_unlock(&svd->lock, vpage); + } + + if (type == F_SOFTLOCK) { + /* + * Load up the translation keeping it + * locked and don't PAGE_RELE the page. + */ + hat_memload(seg, addr, pp, prot, 1); + } else { + hat_memload(seg, addr, pp, prot, 0); + PAGE_RELE(pp); + } + + return (0); +out: + if (type == F_SOFTLOCK) { + availrmem++; + pages_pp_kernel--; + } + return (FC_MAKE_ERR(err)); +} + +/* + * This routine is called via a machine specific fault handling routine. + * It is also called by software routines wishing to lock or unlock + * a range of addresses. + * + * Here is the basic algorithm: + * If unlocking + * Call segvn_softunlock + * Return + * endif + * Checking and set up work + * If we will need some non-anonymous pages + * Call VOP_GETPAGE over the range of non-anonymous pages + * endif + * Loop over all addresses requested + * Call segvn_faultpage passing in page list + * to load up translations and handle anonymous pages + * endloop + * Load up translation to any additional pages in page list not + * already handled that fit into this segment + */ + +STATIC faultcode_t +segvn_fault(seg, addr, len, type, rw) + struct seg *seg; + addr_t addr; + u_int len; + enum fault_type type; + enum seg_rw rw; +{ + struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register page_t **plp, **ppp, *pp; + struct anon **app; + u_int off; + addr_t a; + struct vpage *vpage; + u_int vpprot, prot; + int err; + page_t *pl[PVN_GETPAGE_NUM + 1]; + u_int plsz, pl_alloc_sz; + int page; + + /* + * First handle the easy stuff + */ + if (type == F_SOFTUNLOCK) { + segvn_softunlock(seg, addr, len, rw); + return (0); + } + + /* + * If we have the same proections for the entire segment, + * insure that the access being attempted is legimate. + */ + if (svd->pageprot == 0) { + u_int protchk; + + switch (rw) { + case S_READ: + protchk = PROT_READ; + break; + case S_WRITE: + protchk = PROT_WRITE; + break; + case S_EXEC: + protchk = exectst ? PROT_EXEC : PROT_READ; + break; + case S_OTHER: + default: + protchk = PROT_READ | PROT_WRITE | PROT_EXEC; + break; + } + + if ((svd->prot & protchk) == 0) + return (FC_PROT); /* illegal access type */ + } + + /* + * Check to see if we need to allocate an anon_map structure. + */ + if (svd->amp == NULL && (svd->vp == NULL || + ((type == F_PROT || rw == S_WRITE) && svd->type == MAP_PRIVATE))) { + /* ok, we need to do it */ + svd->amp = (struct anon_map *)kmem_fast_alloc( + (caddr_t *)&anonmap_freelist, sizeof (*anonmap_freelist), + anonmap_freeincr, KM_SLEEP); + svd->amp->refcnt = 1; + svd->amp->size = seg->s_size; + svd->amp->anon = (struct anon **)kmem_zalloc((u_int) + (seg_pages(seg) * sizeof (struct anon *)), KM_SLEEP); + } + + page = seg_page(seg, addr); + if (svd->amp == NULL) + app = NULL; + else + app = &svd->amp->anon[svd->anon_index + page]; + + if (svd->vpage == NULL) + vpage = NULL; + else + vpage = &svd->vpage[page]; + + plp = pl; + *plp = (page_t *)NULL; + pl_alloc_sz = 0; + off = svd->offset + (addr - seg->s_base); + /* + * See if we need to call VOP_GETPAGE for + * *any* of the range being faulted on. + * We can skip all of this work if there + * was no original vnode or if this is write + * protection fault to a private mapping. + */ + if (svd->vp != NULL && !(type == F_PROT && rw == S_WRITE && + svd->type == MAP_PRIVATE)) { + u_int vp_off, vp_len; + int dogetpage; + + if (len > ptob((sizeof (pl) / sizeof (pl[0])) - 1)) { + /* + * Page list won't fit in local array, + * allocate one of the needed size. + */ + pl_alloc_sz = (btop(len) + 1) * sizeof (page_t *); + plp = (page_t **)kmem_zalloc(pl_alloc_sz, KM_SLEEP); + plsz = len; + } else + plsz = PVN_GETPAGE_SZ; + + vp_off = off; + vp_len = len; + + if (app == NULL) + dogetpage = 1; + else if (len <= PAGESIZE) + dogetpage = (*app == NULL); /* inline non_anon() */ + else + dogetpage = non_anon(app, &vp_off, &vp_len); + + if (dogetpage) { + enum seg_rw arw; + + /* + * Need to get some non-anonymous pages. + * We need to make only one call to GETPAGE to do + * this to prevent certain deadlocking conditions + * when we are doing locking. In this case + * non_anon() should have picked up the smallest + * range which includes all the non-anonymous + * pages in the requested range. We have to + * be careful regarding which rw flag to pass in + * because on a private mapping, the underlying + * object is never allowed to be written. + */ + if (rw == S_WRITE && svd->type == MAP_PRIVATE) { + arw = S_READ; + } else { + arw = rw; + } + trace3(TR_SEG_GETPAGE, seg, addr, TRC_SEG_FILE); + err = VOP_GETPAGE(svd->vp, vp_off, vp_len, &vpprot, + plp, plsz, seg, addr + (vp_off - off), arw, + svd->cred); + if (err) { + segvn_pagelist_rele(plp); + if (pl_alloc_sz) + kmem_free((caddr_t)plp, pl_alloc_sz); + return (FC_MAKE_ERR(err)); + } + if (svd->type == MAP_PRIVATE) + vpprot &= ~PROT_WRITE; + } + } + + /* + * N.B. at this time the plp array has all the needed non-anon + * pages in addition to (possibly) having some adjacent pages. + */ + + /* + * Ok, now loop over the address range and handle faults + */ + for (a = addr; a < addr + len; a += PAGESIZE, off += PAGESIZE) { + err = segvn_faultpage(seg, a, off, app, vpage, plp, vpprot, + type, rw); + if (err) { + if (type == F_SOFTLOCK && a > addr) + segvn_softunlock(seg, addr, (u_int)(a - addr), + S_OTHER); + segvn_pagelist_rele(plp); + if (pl_alloc_sz) + kmem_free((caddr_t)plp, pl_alloc_sz); + return (err); + } + if (app) + app++; + if (vpage) + vpage++; + } + + /* + * Now handle any other pages in the list returned. + * If the page can be used, load up the translations now. + */ + if (svd->pageprot == 0) + prot = svd->prot; + for (ppp = plp; (pp = *ppp) != NULL; ppp++) { + int diff; + + if (pp == PAGE_HANDLED) + continue; + + diff = pp->p_offset - svd->offset; + if (diff >= 0 && diff < seg->s_size) { + ASSERT(svd->vp == pp->p_vnode); + + page = btop(diff); + if (svd->pageprot) + prot = svd->vpage[page].vp_prot; + + if (svd->amp == NULL || + svd->amp->anon[svd->anon_index + page] == NULL) { + hat_memload(seg, seg->s_base + diff, pp, + vpprot & prot, 0); + } + } + PAGE_RELE(pp); + } + + if (pl_alloc_sz) + kmem_free((caddr_t)plp, pl_alloc_sz); + return (0); +} +/* + * This routine is used to start I/O on pages asynchronously. + */ +STATIC faultcode_t +segvn_faulta(seg, addr) + struct seg *seg; + addr_t addr; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct anon **app; + int err; + + if (svd->amp != NULL) { + app = &svd->amp->anon[svd->anon_index + seg_page(seg, addr)]; + if (*app != NULL) { + err = anon_getpage(app, (u_int *)NULL, + (page_t **)NULL, 0, seg, addr, S_READ, + svd->cred); + if (err) + return (FC_MAKE_ERR(err)); + return (0); + } + } + + if (svd->vp == NULL) + return (0); /* zfod page - do nothing now */ + + trace3(TR_SEG_GETPAGE, seg, addr, TRC_SEG_FILE); + err = VOP_GETPAGE(svd->vp, svd->offset + (addr - seg->s_base), + PAGESIZE, (u_int *)NULL, (page_t **)NULL, 0, seg, addr, + S_OTHER, svd->cred); + if (err) + return (FC_MAKE_ERR(err)); + return (0); +} + +STATIC void +segvn_unload(seg, addr, ref, mod) + struct seg *seg; + addr_t addr; + u_int ref, mod; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register int page; + register struct vpage *vpage; + + if (svd->vpage == NULL) { + /* + * For now since we are doing a global page replacement + * policy, we don't worry about keeping track of virtual + * ref and modified bits. + */ + return; + } + + page = seg_page(seg, addr); + vpage = &svd->vpage[page]; + if (svd->amp != NULL) { + register struct anon *ap; + + ap = svd->amp->anon[svd->anon_index + page]; + if (ap) { + anon_unloadmap(ap, ref, mod); + goto unloaded; + } + } + pvn_unloadmap(svd->vp, svd->offset + (addr - seg->s_base), ref, mod); +unloaded: + vpage->vp_mod |= mod; + vpage->vp_ref |= ref; +} + +STATIC int +segvn_setprot(seg, addr, len, prot) + register struct seg *seg; + register addr_t addr; + register u_int len, prot; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct vpage *svp, *evp; + struct vnode *vp; + + if ((svd->maxprot & prot) != prot) + return (EACCES); /* violated maxprot */ + + /* + * If it's a private mapping and we're making it writable + * and no swap space has been reserved, have to reserve + * it all now. If it's private and we're removing write + * permission for the whole mapping and we haven't + * modified any pages, we can release the swap space. + */ + if (svd->type == MAP_PRIVATE && (prot & PROT_WRITE) != 0 + && svd->swresv == 0) { + if (anon_resv(seg->s_size) == 0) + return (EAGAIN); + svd->swresv = seg->s_size; + } + + if (addr == seg->s_base && len == seg->s_size && svd->pageprot == 0) { + if (svd->type == MAP_PRIVATE && (prot & PROT_WRITE) == 0 + && svd->swresv > 0 && svd->amp == NULL) { + anon_unresv(svd->swresv); + svd->swresv = 0; + } + if (svd->prot == prot) + return (0); /* all done */ + svd->prot = (u_char)prot; + } else { + struct anon **app; + page_t *pp; + u_int offset, off; + /* + * A vpage structure exists or else the change does not + * involve the entire segment. Establish a vpage structure + * if none is there. Then, for each page in the range, + * adjust its individual permissions. Note that write- + * enabling a MAP_PRIVATE page can affect the claims for + * locked down memory. Overcommitting memory terminates + * the operation. + */ + segvn_vpage(seg); + if (svd->amp == NULL) + app = NULL; + else + app = &svd->amp->anon[svd->anon_index + + seg_page(seg, addr)]; + offset = svd->offset + (addr - seg->s_base); + evp = &svd->vpage[seg_page(seg, addr + len)]; + for (svp = &svd->vpage[seg_page(seg, addr)]; svp < evp; svp++) { + if (svp->vp_pplock && (svp->vp_prot != prot) + && (svd->type == MAP_PRIVATE)) { + if (app != NULL && *app != NULL) + swap_xlate (*app, &vp, &off); + else { + vp = svd->vp; + off = offset; + } + if ((pp = page_lookup(vp, off)) == NULL) + cmn_err(CE_PANIC, " no page"); + if ((svp->vp_prot ^ prot) & PROT_WRITE) + if (prot & PROT_WRITE) { + if (!page_addclaim(pp)) + break; + } else + page_subclaim(pp); + } + svp->vp_prot = prot; + offset += PAGESIZE; + if (app) + app++; + } + + /* + * Did we terminate prematurely? If so, simply unload + * the translations to the things we've updated so far. + */ + if (svp != evp) { + len = (svp - &svd->vpage[seg_page(seg, addr)]) * + PAGESIZE; + if (len != 0) + hat_unload(seg, addr, len, HAT_NOFLAGS); + return (EAGAIN); + } + } + + if ((svd->type == MAP_PRIVATE && (prot & PROT_WRITE) != 0) || + prot == 0) { + /* + * Either private data with write access (in which case + * we need to throw out all former translations so that + * we get the right translations set up on fault and we + * don't allow write access to any copy-on-write pages + * that might be around) or we don't have permission + * to access the memory at all (in which case we have to + * unload any current translations that might exist). + */ + hat_unload(seg, addr, len, HAT_NOFLAGS); + } else { + /* + * A shared mapping or a private mapping in which write + * protection is going to be denied - just change all the + * protections over the range of addresses in question. + */ + hat_chgprot(seg, addr, len, prot); + } + + return (0); +} + +STATIC int +segvn_checkprot(seg, addr, len, prot) + register struct seg *seg; + register addr_t addr; + register u_int len, prot; +{ + struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct vpage *vp, *evp; + + /* + * If segment protection can be used, simply check against them. + */ + if (svd->pageprot == 0) + return (((svd->prot & prot) != prot) ? EACCES : 0); + + /* + * Have to check down to the vpage level. + */ + evp = &svd->vpage[seg_page(seg, addr + len)]; + for (vp = &svd->vpage[seg_page(seg, addr)]; vp < evp; vp++) + if ((vp->vp_prot & prot) != prot) + return (EACCES); + + return (0); +} + +STATIC int +segvn_getprot(seg, addr, len, protv) + register struct seg *seg; + register addr_t addr; + register u_int len, *protv; +{ + struct segvn_data *svd = (struct segvn_data *)seg->s_data; + u_int pgno = seg_page(seg, addr+len) - seg_page(seg, addr) + 1; + + if (pgno != 0) { + if (svd->pageprot == 0) { + do protv[--pgno] = svd->prot; + while (pgno != 0); + } else { + register pgoff = seg_page(seg, addr); + do { + pgno--; + protv[pgno] = svd->vpage[pgno+pgoff].vp_prot; + } while (pgno != 0); + } + } + return 0; +} + +/* ARGSUSED */ +STATIC off_t +segvn_getoffset(seg, addr) + register struct seg *seg; + addr_t addr; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + + return svd->offset; +} + +/* ARGSUSED */ +STATIC int +segvn_gettype(seg, addr) + register struct seg *seg; + addr_t addr; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + + return svd->type; +} + +/* ARGSUSED */ +STATIC int +segvn_getvp(seg, addr, vpp) + register struct seg *seg; + addr_t addr; + struct vnode **vpp; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + + *vpp = svd->vp; + return 0; +} + +/* + * Check to see if it makes sense to do kluster/read ahead to + * addr + delta relative to the mapping at addr. We assume here + * that delta is a signed PAGESIZE'd multiple (which can be negative). + * + * For segvn, we currently "approve" of the action if we are + * still in the segment and it maps from the same vp/off. + */ +STATIC int +segvn_kluster(seg, addr, delta) + register struct seg *seg; + register addr_t addr; + int delta; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct anon *oap, *ap; + register int pd; + register u_int page; + struct vnode *vp1, *vp2; + u_int off1, off2; + + if (addr + delta < seg->s_base || + addr + delta >= (seg->s_base + seg->s_size)) + return (-1); /* exceeded segment bounds */ + + pd = delta / PAGESIZE; /* divide to preserve sign bit */ + page = seg_page(seg, addr); + + if (svd->type == MAP_SHARED) + return (0); /* shared mapping - all ok */ + + if (svd->amp == NULL) + return (0); /* off original vnode */ + + page += svd->anon_index; + oap = svd->amp->anon[page]; + ap = svd->amp->anon[page + pd]; + + if ((oap == NULL && ap != NULL) || (oap != NULL && ap == NULL)) + return (-1); /* one with and one without an anon */ + + if (oap == NULL) /* implies that ap == NULL */ + return (0); /* off original vnode */ + + /* + * Now we know we have two anon pointers - check to + * see if they happen to be properly allocated. + */ + swap_xlate(ap, &vp1, &off1); + swap_xlate(oap, &vp2, &off2); + if (!VOP_CMP(vp1, vp2) || off1 - off2 != delta) + return (-1); + return (0); +} + +/* + * Swap the pages of seg out to secondary storage, returning the + * number of bytes of storage freed. + * + * The basic idea is first to unload all translations and then to call + * VOP_PUTPAGE for all newly-unmapped pages, to push them out to the + * swap device. Pages to which other segments have mappings will remain + * mapped and won't be swapped. Our caller (as_swapout) has already + * performed the unloading step. + * + * The value returned is intended to correlate well with the process's + * memory requirements. However, there are some caveats: + * 1) When given a shared segment as argument, this routine will + * only succeed in swapping out pages for the last sharer of the + * segment. (Previous callers will only have decremented mapping + * reference counts.) + * 2) We assume that the hat layer maintains a large enough translation + * cache to capture process reference patterns. + */ +STATIC u_int +segvn_swapout(seg) + struct seg *seg; +{ + struct segvn_data *svd = (struct segvn_data *)seg->s_data; + struct anon_map *amp = svd->amp; + register u_int pgcnt = 0; + u_int npages; + register u_int page; + + /* + * Find pages unmapped by our caller and force them + * out to the virtual swap device. + */ + npages = seg->s_size >> PAGESHIFT; + for (page = 0; page < npages; page++) { + register page_t *pp; + register struct anon **app; + struct vnode *vp; + u_int off; + + /* + * Obtain pair for the page, then look it up. + * + * Note that this code is willing to consider regular + * pages as well as anon pages. Is this appropriate here? + */ + if (amp != NULL && *(app = &->anon[svd->anon_index + page]) + != NULL) + swap_xlate(*app, &vp, &off); + else { + off = svd->offset + ptob(page); + vp = svd->vp; + } + if ((pp = page_find(vp, off)) == NULL || pp->p_free) + continue; + + /* + * Skip if page is logically unavailable for removal. + */ + if (pp->p_lckcnt > 0 || pp->p_cowcnt > 0) + continue; + + /* + * Examine the page to see whether it can be tossed out, + * keeping track of how many we've found. + */ + if (pp->p_keepcnt != 0) { + /* + * If the page is marked as in transit going out + * and has no mappings, it's very likely that + * the page is in transit because of klustering. + Assume this is so and take credit for it here. + */ + if (pp->p_intrans && !pp->p_pagein && !pp->p_mapping) + pgcnt++; + continue; + } + + if (pp->p_mapping != NULL) + continue; + + /* + * Since the keepcnt was 0 the page should not be + * in a gone state nor is not directly or indirectly + * involved in any IO at this time. + */ + + /* + * No longer mapped -- we can toss it out. How + * we do so depends on whether or not it's dirty. + * + * XXX: Need we worry about locking between the + * time of the hat_pagesync call and the actions + * that depend on its result? + */ + hat_pagesync(pp); + if (pp->p_mod && pp->p_vnode) { + /* + * We must clean the page before it can be + * freed. Setting B_FREE will cause pvn_done + * to free the page when the i/o completes. + * XXX: This also causes it to be accounted + * as a pageout instead of a swap: need + * B_SWAPOUT bit to use instead of B_FREE. + */ + (void) VOP_PUTPAGE(pp->p_vnode, pp->p_offset, PAGESIZE, + B_ASYNC | B_FREE, svd->cred); + } else { + /* + * The page was clean. Lock it and free it. + * + * XXX: Can we ever encounter modified pages + * with no associated vnode here? + */ + page_lock(pp); + page_free(pp, 0); + } + + /* + * Credit now even if i/o is in progress. + */ + pgcnt++; + } + + return (ptob(pgcnt)); +} + +/* + * Synchronize primary storage cache with real object in virtual memory. + */ +STATIC int +segvn_sync(seg, addr, len, attr, flags) + struct seg *seg; + register addr_t addr; + u_int len; + int attr; + u_int flags; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct anon **app; + register struct anon *ap; + register struct vpage *vpp = svd->vpage; + register page_t *pp; + u_int offset; + struct vnode *vp; + u_int off; + addr_t eaddr; + int bflags; + int err = 0; + int segtype; + int pageprot; + int prot; + + + offset = svd->offset + (addr - seg->s_base); + bflags = B_FORCE | ((flags & MS_ASYNC) ? B_ASYNC : 0) | + ((flags & MS_INVALIDATE) ? B_INVAL : 0); + + if (attr) { + pageprot = attr & ~(SHARED|PRIVATE); + segtype = attr & SHARED ? MAP_SHARED : MAP_PRIVATE; + + /* + * We are done if the segment types don't match + * or if we have segment level protections and + * they don't match. + */ + if (svd->type != segtype) + return(0); + if (vpp == NULL) { + if (svd->prot != pageprot) + return(0); + prot = svd->prot; + } else + vpp = &svd->vpage[seg_page(seg, addr)]; + + } else if ((svd->amp == NULL) && (flags & MS_INVALIDATE) == 0) { + + /* + * No attributes, no anonymous pages and MS_INVALIDATE flag + * is not on, just use one big request. + */ + err = VOP_PUTPAGE(svd->vp, offset, len, bflags, svd->cred); + return (err); + } + + if (svd->amp == NULL) + app = NULL; + else + app = &svd->amp->anon[svd->anon_index + seg_page(seg, addr)]; + + for (eaddr = addr + len; addr < eaddr; addr += PAGESIZE) { + + if (app != NULL && (ap = *app++) != NULL) + swap_xlate (ap, &vp, &off); + else { + vp = svd->vp; + off = offset; + } + offset += PAGESIZE; + + if (attr) { + if (vpp) + prot = vpp++->vp_prot; + if ( prot != pageprot ) + continue; + } + + /* + * See if any of these pages are locked -- if so, then we + * will have to truncate an invalidate request at the first + * locked one. + */ + if (flags & MS_INVALIDATE) { + if ((pp = page_lookup(vp, off)) != NULL) + if (pp->p_lckcnt || pp->p_cowcnt) + return EBUSY; + } + + /* + * XXX - Should ultimately try to kluster + * calls to VOP_PUTPAGE for performance. + */ + err = VOP_PUTPAGE(vp, off, PAGESIZE, bflags, svd->cred); + if (err) + break; + } + return (err); +} + +/* + * Determine if we have data corresponding to pages in the + * primary storage virtual memory cache (i.e., "in core"). + * N.B. Assumes things are "in core" if page structs exist. + */ +STATIC int +segvn_incore(seg, addr, len, vec) + struct seg *seg; + register addr_t addr; + u_int len; + register char *vec; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct anon **app; + struct vnode *vp; + u_int offset; + u_int p, ep; + register int ret; + register struct vpage *vpp; + register page_t *pp; + u_int start; + + if (svd->amp == NULL && svd->vp == NULL) { + bzero(vec, btoc(len)); + return (len); /* no anonymous pages created yet */ + } + + p = seg_page(seg, addr); + ep = seg_page(seg, addr + len); + vpp = (svd->vpage) ? &svd->vpage[p]: NULL; + start = svd->vp ? 0x10 : 0; + + for ( ; p < ep; p++, addr += PAGESIZE) { + ret = start; + if ((svd->amp != NULL) && + (*(app = &svd->amp->anon[svd->anon_index + p]) != NULL)) { + swap_xlate(*app, &vp, &offset); + ret |= 0x20; + } else { + vp = svd->vp; + offset = svd->offset + (addr - seg->s_base); + } + pp = page_find(vp, offset); + if (pp != NULL) { + ret |= 0x1; + if (pp->p_lckcnt) + ret |= 0x8; + if (pp->p_cowcnt) + ret |= 0x4; + } + if (vpp && ((vpp++)->vp_pplock)) + ret |= 2; + *vec++ = (char) ret; + } + return (len); +} + +/* + * Lock down (or unlock) pages mapped by this segment. + */ +STATIC int +segvn_lockop(seg, addr, len, attr, op, lockmap, pos) + struct seg *seg; + addr_t addr; + u_int len; + int attr; + int op; + ulong *lockmap; + size_t pos; +{ + struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct vpage *vpp = svd->vpage; + register struct vpage *evp; + page_t *pp; + struct anon **app; + u_int offset; + u_int off; + int segtype; + int pageprot; + int claim; + int err; + struct vnode *vp; + + if (attr) { + pageprot = attr & ~(SHARED|PRIVATE); + segtype = attr & SHARED ? MAP_SHARED : MAP_PRIVATE; + + /* + * We are done if the segment types don't match + * or if we have segment level protections and + * they don't match. + */ + if (svd->type != segtype) + return(0); + if (svd->pageprot == 0 && svd->prot != pageprot) + return(0); + + } + + /* + * If we're locking, then we must create a vpage structure if + * none exists. If we're unlocking, then check to see if there + * is a vpage -- if not, then we could not have locked anything. + */ + + if (vpp == NULL) { + if (op == MC_LOCK) + segvn_vpage(seg); + else + return (0); + } + + if ( op == MC_LOCK && svd->amp == NULL && svd->vp == NULL) { + svd->amp = (struct anon_map *)kmem_fast_alloc( + (caddr_t *)&anonmap_freelist, + sizeof (*anonmap_freelist), anonmap_freeincr, KM_SLEEP); + + svd->amp->refcnt = 1; + svd->amp->size = seg->s_size; + svd->amp->anon = (struct anon **)kmem_zalloc(seg_pages(seg) * + sizeof (struct anon *), KM_SLEEP); + } + + /* + * Set up bounds for looping over the range of pages. + */ + if (svd->amp == NULL) + app = NULL; + else + app = &svd->amp->anon[svd->anon_index + seg_page(seg, addr)]; + + offset = svd->offset + (addr - seg->s_base); + evp = &svd->vpage[seg_page(seg, addr + len)]; + + /* + * Loop over all pages in the range. Process if we're locking and + * page has not already been locked in this mapping; or if we're + * unlocking and the page has been locked. + */ + + for (vpp = &svd->vpage[seg_page(seg, addr)]; vpp < evp; vpp++, pos++) { + if ((attr == 0 || vpp->vp_prot == pageprot) + && ((op == MC_LOCK && !vpp->vp_pplock) + || (op == MC_UNLOCK && vpp->vp_pplock))) { + + /* + * If we're locking, softfault the page in memory. + */ + if (op == MC_LOCK) + if (segvn_fault(seg, addr, PAGESIZE, + F_SOFTLOCK, S_OTHER) != 0) + return (EIO); + + /* + * Get name for page, accounting for + * existence of private copy. + */ + if (app != NULL && *app != NULL) { + swap_xlate(*app, &vp, &off); + claim = 0; + } else { + vp = svd->vp; + off = offset; + claim = ((vpp->vp_prot & PROT_WRITE) != 0) & + (svd->type == MAP_PRIVATE); + } + + /* + * Get page frame. It's ok if the page is + * not available when we're unlocking, as this + * may simply mean that a page we locked got + * truncated out of existence after we locked it. + */ + if ((pp = page_lookup(vp, off)) == NULL) + if (op == MC_LOCK) + cmn_err(CE_PANIC, "segvn_lockop: no page"); + + /* + * Perform page-level operation appropriate to + * operation. If locking, undo the SOFTLOCK + * performed to bring the page into memory + * after setting the lock. If unlocking, + * and no page was found, account for the claim + * separately. + */ + if (op == MC_LOCK) { + err = page_pp_lock(pp, claim, 0); + (void) segvn_fault(seg, addr, PAGESIZE, + F_SOFTUNLOCK, S_OTHER); + if (!err) + return (EAGAIN); + vpp->vp_pplock = 1; + if (lockmap != (ulong *)NULL) { + BT_SET(lockmap, pos); + } + } else { + if (pp) + page_pp_unlock(pp, claim, 0); + vpp->vp_pplock = 0; + } + } + addr += PAGESIZE; + offset += PAGESIZE; + if (app) + app++; + } + return (0); +} + +/* + * Create a vpage structure for this seg. + */ +STATIC void +segvn_vpage(seg) + struct seg *seg; +{ + register struct segvn_data *svd = (struct segvn_data *)seg->s_data; + register struct vpage *vp, *evp; + + /* + * If no vpage structure exists, allocate one. Copy the protections + * from the segment itself to the individual pages. + */ + if (svd->vpage == NULL) { + svd->pageprot = 1; + svd->vpage = (struct vpage *) + kmem_zalloc(seg_pages(seg) * sizeof (struct vpage), KM_SLEEP); + evp = &svd->vpage[seg_page(seg, seg->s_base + seg->s_size)]; + for (vp = svd->vpage; vp < evp; vp++) + vp->vp_prot = svd->prot; + } +} diff --git a/usr/src/uts/3b2/vm/seg_vn.h b/usr/src/uts/3b2/vm/seg_vn.h new file mode 100644 index 0000000..1700173 --- /dev/null +++ b/usr/src/uts/3b2/vm/seg_vn.h @@ -0,0 +1,86 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_SEG_VN_H +#define _VM_SEG_VN_H + +#ident "@(#)kernel:vm/seg_vn.h 1.5" + +#include "vm/mp.h" + +/* + * A pointer to this structure is passed to segvn_create(). + */ +struct segvn_crargs { + struct vnode *vp; /* vnode mapped from */ + u_int offset; /* starting offset of vnode for mapping */ + struct cred *cred; /* credentials */ + u_char type; /* type of sharing done */ + u_char prot; /* protections */ + u_char maxprot; /* maximum protections */ + struct anon_map *amp; /* anon mapping to map to */ +}; + +/* + * The anon_map structure is used by the seg_vn driver to manage + * unnamed (anonymous) memory. When anonymous memory is shared, + * then the different segvn_data structures will point to the + * same anon_map structure. Also, if a segment is unmapped + * in the middle where an anon_map structure exists, the + * newly created segment will also share the anon_map structure, + * although the two segments will use different ranges of the + * anon array. When mappings are private (or shared with + * a reference count of 1), an unmap operation will free up + * a range of anon slots in the array given by the anon_map + * structure. Because of fragmentation due to this unmapping, + * we have to store the size of the anon array in the anon_map + * structure so that we can free everything when the referernce + * count goes to zero. + */ +struct anon_map { + u_int refcnt; /* reference count on this structure */ + u_int size; /* size in bytes mapped by the anon array */ + struct anon **anon; /* pointer to an array of anon * pointers */ + u_int swresv; /* swap space reserved for this anon_map */ +}; + +/* + * (Semi) private data maintained by the seg_vn driver per segment mapping. + */ +struct segvn_data { + mon_t lock; + u_char pageprot; /* true if per page protections present */ + u_char prot; /* current segment prot if pageprot == 0 */ + u_char maxprot; /* maximum segment protections */ + u_char type; /* type of sharing done */ + struct vnode *vp; /* vnode that segment mapping is to */ + u_int offset; /* starting offset of vnode for mapping */ + u_int anon_index; /* starting index into anon_map anon array */ + struct anon_map *amp; /* pointer to anon share structure, if needed */ + struct vpage *vpage; /* per-page information, if needed */ + struct cred *cred; /* mapping credentials */ + u_int swresv; /* swap space reserved for this segment */ +}; + +#ifdef _KERNEL + +#if defined(__STDC__) +extern int segvn_create(struct seg *, void *); +#else +extern int segvn_create(); +#endif + +extern struct seg_ops segvn_ops; + +/* + * Provided as shorthand for creating user zfod segments. + */ +extern caddr_t zfod_argsp; +extern caddr_t kzfod_argsp; +#endif /* _KERNEL */ + +#endif /* _VM_SEG_VN_H */ diff --git a/usr/src/uts/3b2/vm/trace.h b/usr/src/uts/3b2/vm/trace.h new file mode 100644 index 0000000..339eca6 --- /dev/null +++ b/usr/src/uts/3b2/vm/trace.h @@ -0,0 +1,328 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_TRACE_H +#define _VM_TRACE_H + +#ident "@(#)kernel:vm/trace.h 1.3" + +/* + * Trace point definitions. Beware of conflicts with the + * window system keyboard translation macros (TR_ASCII et al). + * + * The set of active trace points is recorded in the variable + * tracedevents. Because we declare this variable as an fd_set, + * the maximum allowable trace point index is bounded by FD_SETSIZE. + * + * For the most part, these trace points are quite specific to SunOS 4.0. + * + * The trace point definitions follow stringent conventions for the benefit + * of postprocessors wishing to manipulate trace information. The names + * all start with TR_, and each definition is followed on the next line by + * a comment whose content is a printf-like formatting string. Successive + * format items are fed by successive tr_datum* values from the current + * trace item. The only unusual format is %C, which is followed by an angle + * bracketed, comma separated list of (unquoted) strings, the i-th of which + * is to be printed when the associated value is i (0-origin). + * + * Note that the current trace points confine themselves to the C, d, and + * x formats so that postprocessors can confine themselves to supporting + * only these formats. This situation may change when additional trace + * points are defined. + */ + +/* + * User-level trace annotation. + */ +#define TR_STAMP 0 /* user: vtrace(VTR_STAMP, value); */ +/* "value %d pid %d" */ + +/* + * Paging trace points. The TR_PG_* trace points all start by recording + * pp, vp, and off values. + */ +#define TR_PG_POCLEAN 1 /* about to clean a page in pageout */ +/* "pp %x vp %x off %d hand %d freemem %d" */ +#define TR_PG_POFREE 2 /* add page to free list in pageout */ +/* "pp %x vp %x off %d hand %d freemem %d" */ +#define TR_PG_RECLAIM 3 /* page obtained in page_reclaim */ +/* "pp %x vp %x off %d ap %x age %d freemem %d" */ +#define TR_PG_ENTER 4 /* page_enter: page assoc. with */ +/* "pp %x vp %x off %d retval %d" */ +#define TR_PG_ABORT 5 /* page_abort: page disassoc. w/ */ +/* "pp %x vp %x off %d code %C" */ +#define TR_PG_FREE 6 /* call to page_free */ +/* "pp %x vp %x off %d dontneed %d freemem %d code %C" */ +#define TR_PG_ALLOC 7 /* single page allocated in page_get */ +/* "pp %x vp %x off %d age %d fromcache %d" */ +#define TR_PG_SEGMAP_FLT 8 /* segmap_fault sets p_ref = 1 */ +/* "pp %x vp %x off %d softlock %d" */ +#define TR_PG_SEGVN_FLT 9 /* segvn_fault sets p_ref = 1 */ +/* "pp %x vp %x off %d softlock %d" */ +#define TR_PG_PVN_DONE 10 /* pvn_done sets p_gone = 1 */ +/* "pp %x vp %x off %d" */ +#define TR_PG_PVN_GETDIRTY 11 /* pvn_getdirty sets p_ref = 0 */ +/* "pp %x vp %x off %d" */ +#define TR_PG_HAT_NEWSEG 12 /* hat_newseg OR's p_ref */ +/* "pp %x vp %x off %d referenced %d" */ +#define TR_PG_HAT_GETPME 13 /* hat_getpme OR's p_ref */ +/* "pp %x vp %x off %d referenced %d" */ +#define TR_PG_POREF 14 /* clock hand finds p_ref == 1 */ +/* "pp %x vp %x off %d hand %d" */ + +#define TR_PAGE_GET_SLEEP 19 /* sleep during page alloc request */ +/* "bytes %x canwait %d freemem %d after? %d" */ +#define TR_PAGE_GET 20 /* page allocation request */ +/* "bytes %x canwait %d freemem %d code %C" */ + +/* + * Page abort codes + */ +#define TRC_ABORT_ABORTED 0 +#define TRC_ABORT_KEPT 1 +#define TRC_ABORT_INTRANS 2 + +/* + * Page free codes + */ +#define TRC_FREE_GONE 0 +#define TRC_FREE_FREE 1 +#define TRC_FREE_CACHETL 2 +#define TRC_FREE_CACHEHD 3 + +/* + * Page get codes + */ +#define TRC_GET_ALLOCATED 0 +#define TRC_GET_TOOBIG 1 +#define TRC_GET_NOMEM 2 +/* + * File system buffer tracing points; all trace + */ +#define TR_BREADHIT 21 /* buffer read found in cache */ +/* "" */ +#define TR_BREADMISS 22 /* buffer read not in cache */ +/* "" */ +#define TR_BWRITE 23 /* buffer written */ +/* "" */ +#define TR_BRELSE 24 /* brelse */ +/* "" */ + +/* + * Calibration trace record + */ +#define TR_CALIBRATE 30 /* calibration point in hardclock */ +/* "seqnum %d sec %d usec %d" */ + +/* + * Paging daemon trace points + */ +#define TR_PAGEOUT 31 /* pageout daemon statistics */ +/* "after? %d nscan %d desscan %d freemem %d lotsfree %d" */ +#define TR_PAGEOUT_CALL 32 /* pageout daemon call */ +/* "callpoint %C" */ +#define TR_PAGEOUT_MAXPGIO 33 /* pushes > maxpgio in checkpage */ +/* "freemem %d nscan %d" */ +#define TR_PAGEOUT_WRAP 34 /* front clock hand wrap around */ +/* "freemem %d hand %d" */ +/* + * Pageout daemon call location codes + */ +#define TRC_POCALL_GETNPAGE 0 +#define TRC_POCALL_GETFRLW 1 +#define TRC_POCALL_SCHEDCPU 2 +#define TRC_POCALL_SCHEDPAG 3 +#define TRC_POCALL_SWDONE 4 + +/* + * Mapping of objects to vnode and values + */ +#define TR_MP_SWAP 40 /* allocate a page of swap */ +/* "vp %x off %d ap %x" */ +#define TR_MP_LNODE 41 /* allocate an lnode */ +/* "vp %x lvp %x" */ +#define TR_MP_SNODE 42 /* allocate an snode */ +/* "vp %x dev %x makespecvp %d" */ +#define TR_MP_INODE 43 /* allocate an inode */ +/* "vp %x dev %x inode %x" */ +#define TR_MP_RNODE 44 /* allocate an rnode */ +/* "vp %x fsid %x %x len %x fid %x %x" */ +#define TR_MP_TRUNC0 45 /* truncate file to zero length */ +/* "vp %x" */ +#define TR_MP_TRUNC 46 /* truncate file */ +/* "vp %x newlen %d oldlen %d" */ + +/* + * Segment trace points + */ +#define TR_SEG_GETMAP 50 /* get a segmap */ +/* "seg %x addr %d type %C vp %x off %d" */ +#define TR_SEG_RELMAP 51 /* release a segmap */ +/* "seg %x addr %d type %C refcnt %d" */ +#define TR_SEG_ALLOCPAGE 52 /* call to rm_allocpage */ +/* "seg %x addr %d type %C vp %x off %d pp %x" */ +#define TR_SEG_GETPAGE 53 /* call to VOP_GETPAGE */ +/* "seg %x addr %d type %C" */ +#define TR_SEG_KLUSTER 54 /* call to pvn_kluster */ +/* "seg %x addr %d readahead %d" */ + +/* + * Segment type codes + */ +#define TRC_SEG_KSEG 0 +#define TRC_SEG_SEGKMAP 1 +#define TRC_SEG_ANON 2 +#define TRC_SEG_FILE 3 +#define TRC_SEG_UNK 4 + +/* + * Process trace points + */ +#define TR_PR_WAKEUP 60 /* before call to wakeup */ +/* "ptime %d cpu %d stime %d runout %d" */ + +/* + * Swapper trace points + */ +#define TR_SWAP_LOOP 70 /* at loop: in sched */ +/* "mapwant %d avenrun %d avefree %d avefree30 %d pginrate %d pgoutrate %d" */ +#define TR_SWAP_OUT 71 /* call to swapout */ +/* "proc %x hardwap? %d freed %d" */ +#define TR_SWAP_SLEEP 72 /* sched calls sleep() */ +/* "chan %x runin %d runout %d wantin %d" */ +#define TR_SWAP_IN_CHECK 73 /* decision point on calling swapin */ +/* "proc %x freemem %d deficit %d needs %d outpri %d maxslp %d" */ +#define TR_SWAP_OUT_CHECK 74 /* decision point on calling swapout */ +/* "proc %x sleeper %d desperate %d deservin %d inpri %d maxslp %d" */ +#define TR_SWAP_IN 75 /* call to swapin */ +/* "proc %x taken %d" */ +#define TR_SWAP_OUT_CHECK0 76 /* decision point on calling swapout */ +/* "proc %x freemem %d rssize %d slptime %d maxslp %d swappable %x" */ + +/* + * ufs trace points + */ +#define TR_UFS_RWIP 80 /* call to rwip */ +/* "inode %x uio %x rw %x ioflag %d offset %d location %C" */ + +/* + * rwip location type codes + */ +#define TRC_RWIP_ENTER 0 +#define TRC_RWIP_GETMAP 1 +#define TRC_RWIP_BMAPALLOC 2 +#define TRC_RWIP_UIOMOVE 3 +#define TRC_RWIP_RELEASE 4 +#define TRC_RWIP_IUPDAT 5 +#define TRC_RWIP_RETURN 6 + +/* + * Memory allocator trace points; all trace the amount of memory involved. + */ + +/* + * System call trace points. + */ + +/* + * Parameters needed for trace post-processing. Be careful to keep this + * up-to-date. MAXTRACEID is the highest number used for a trace id. + * MAXTRACECODE is the highest number used to represent a code, for example + * the codes for TR_PG_FREE are gone, free, cachetl, and cachehd. These are + * represented as 0, 1, 2, and 3, respectively. If 3 were the highest code + * used for any trace point, that would be the value of MAXTRACECODE. + + */ +#define MAXTRACEID TR_UFS_RWIP +#define MAXTRACECODE TRC_RWIP_RETURN + +/* + * Generic format for data saved with trace calls. + * + * The format of tr_time varies depending on whether or not there's + * a high resolution timer available. If so, it's the timer's value; + * if not, it's the low 16 bits of hrestime.tv_sec concatenated to the + * high 16 bits of hrestime.tv_usec. Tr_pid records the process active + * at the time of the trace call; it's not meaningful if called from + * interrupt level. + */ +struct trace_rec { + u_long tr_time; + short tr_tag; + u_short tr_pid; + u_long tr_datum0; + u_long tr_datum1; + u_long tr_datum2; + u_long tr_datum3; + u_long tr_datum4; + u_long tr_datum5; +}; + + + +/* + * Requests for the vtrace() system call. + */ +#define VTR_DISABLE 0 /* trace specified events */ +#define VTR_ENABLE 1 /* don't trace specified events */ +#define VTR_VALUE 2 /* return currently-traced events */ +#define VTR_STAMP 3 /* cause TR_STAMP event */ +#define VTR_RESET 4 /* reset eventstraced to zero */ + +#ifdef _KERNEL +#ifdef TRACE + +extern fd_set tracedevents; +extern u_int tracebufents; +extern u_int eventstraced; +extern struct trace_rec *tracebuffer; +extern void inittrace(); +extern void resettracebuf(); +extern void traceit(); + +#define pack(a, b) ((a)<<16)|(b) + +/* + * Lint doesn't believe that there are valid reasons for comparing + * constants to each other... + */ +#ifdef lint +#define trace(ev, d0, d1, d2, d3, d4, d5) \ + if (FD_ISSET((ev), &tracedevents)) \ + traceit((ev), (u_long)(d0), (u_long)(d1), (u_long)(d2), \ + (u_long)(d3), (u_long)(d4), (u_long)(d5)) +#else /* lint */ +#define trace(ev, d0, d1, d2, d3, d4, d5) \ + if ((u_int)(ev) < FD_SETSIZE && FD_ISSET((ev), &tracedevents)) \ + traceit((ev), (u_long)(d0), (u_long)(d1), (u_long)(d2), \ + (u_long)(d3), (u_long)(d4), (u_long)(d5)) +#endif /* lint */ + +#define trace6(ev, d0, d1, d2, d3, d4, d5) \ + trace(ev, d0, d1, d2, d3, d4, d5) +#define trace5(ev, d0, d1, d2, d3, d4) trace(ev, d0, d1, d2, d3, d4, 0) +#define trace4(ev, d0, d1, d2, d3) trace(ev, d0, d1, d2, d3, 0, 0) +#define trace3(ev, d0, d1, d2) trace(ev, d0, d1, d2, 0, 0, 0) +#define trace2(ev, d0, d1) trace(ev, d0, d1, 0, 0, 0, 0) +#define trace1(ev, d0) trace(ev, d0, 0, 0, 0, 0, 0) + +#else /* TRACE */ + +#define pack(a, b) + +#define trace trace6 +#define trace6(ev, d0, d1, d2, d3, d4, d5) +#define trace5(ev, d0, d1, d2, d3, d4) +#define trace4(ev, d0, d1, d2, d3) +#define trace3(ev, d0, d1, d2) +#define trace2(ev, d0, d1) +#define trace1(ev, d0) + +#endif /* TRACE */ +#endif /* _KERNEL */ + +#endif /* _VM_TRACE_H */ diff --git a/usr/src/uts/3b2/vm/vm.mk b/usr/src/uts/3b2/vm/vm.mk new file mode 100644 index 0000000..83465d3 --- /dev/null +++ b/usr/src/uts/3b2/vm/vm.mk @@ -0,0 +1,406 @@ +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T +# All Rights Reserved + +# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +# The copyright notice above does not evidence any +# actual or intended publication of such source code. + +#ident "@(#)kernel:vm/vm.mk 1.14" + +ROOT = +INC = $(ROOT)/usr/include +MKBOOT = mkboot +MASTERD = ../master.d +LIBNAME = ../lib.vm +DASHO = -O +CFLAGS = -I$(INC) -D_KERNEL $(MORECPP) $(DASHO) +PFLAGS = -I$(INC) -D_KERNEL $(MORECPP) +FRC = + +FILES = \ + $(LIBNAME)(seg_dev.o) \ + $(LIBNAME)(seg_kmem.o) \ + $(LIBNAME)(seg_map.o) \ + $(LIBNAME)(seg_u.o) \ + $(LIBNAME)(seg_vn.o) \ + $(LIBNAME)(vm_anon.o) \ + $(LIBNAME)(vm_as.o) \ + $(LIBNAME)(vm_hat.o) \ + $(LIBNAME)(vm_machdep.o) \ + $(LIBNAME)(vm_mp.o) \ + $(LIBNAME)(vm_page.o) \ + $(LIBNAME)(vm_pvn.o) \ + $(LIBNAME)(vm_rm.o) \ + $(LIBNAME)(vm_seg.o) \ + $(LIBNAME)(vm_swap.o) \ + $(LIBNAME)(vm_vpage.o) + + +all: pick $(LIBNAME) + +.PRECIOUS: $(LIBNAME) + +# included for development, should be removed for distribution + +pick: + -@if [ "`ls *.o 2>/dev/null`" ] ; \ + then \ + echo "\tar ruv $(LIBNAME) *.o" ; \ + $(AR) ruv $(LIBNAME) *.o ; \ + echo "\trm -f *.o" ; \ + rm -f *.o ; \ + fi + +$(LIBNAME): $(FILES) + $(AR) ruv $(LIBNAME) *.o ; + rm -f *.o ; + +.c.a: + $(CC) -c $(CFLAGS) $< + +clean: + -rm -f *.o + +clobber: clean + -rm -f $(LIBNAME) + +FRC: + -rm -f $(LIBNAME) + $(AR) qc $(LIBNAME) + + +$(LIBNAME)(seg_dev.o): seg_dev.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/user.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/seg_dev.h \ + $(INC)/vm/pvn.h \ + $(INC)/vm/vpage.h \ + $(FRC) + +$(LIBNAME)(seg_kmem.o): seg_kmem.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/vm.h \ + $(INC)/sys/user.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/map.h \ + $(INC)/sys/tuneable.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/immu.h \ + $(INC)/vm/seg_kmem.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/anon.h \ + $(INC)/vm/rm.h \ + $(INC)/vm/page.h \ + $(FRC) + +$(LIBNAME)(seg_map.o): seg_map.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/buf.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/kmem.h \ + $(INC)/vm/trace.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/vm/seg_kmem.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/seg_map.h \ + $(INC)/vm/page.h \ + $(INC)/vm/pvn.h \ + $(INC)/vm/rm.h \ + $(FRC) + +$(LIBNAME)(seg_u.o): seg_u.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/buf.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/tuneable.h \ + $(INC)/vm/anon.h \ + $(INC)/vm/rm.h \ + $(INC)/vm/page.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/as.h \ + $(INC)/sys/swap.h \ + $(INC)/sys/immu.h \ + $(INC)/vm/vm_hat.h \ + $(INC)/vm/seg_u.h \ + $(INC)/sys/proc.h \ + $(FRC) + +$(LIBNAME)(seg_vn.o): seg_vn.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/buf.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/vmsystm.h \ + $(INC)/sys/swap.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/tuneable.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/vm/trace.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/mp.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/seg_vn.h \ + $(INC)/vm/pvn.h \ + $(INC)/vm/anon.h \ + $(INC)/vm/page.h \ + $(INC)/vm/vpage.h \ + $(INC)/vm/seg_kmem.h \ + $(FRC) + +$(LIBNAME)(vm_anon.o): vm_anon.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/time.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/vmmeter.h \ + $(INC)/sys/swap.h \ + $(INC)/sys/tuneable.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/disp.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/anon.h \ + $(INC)/vm/as.h \ + $(INC)/vm/page.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/pvn.h \ + $(INC)/vm/rm.h \ + $(INC)/vm/mp.h \ + $(INC)/vm/trace.h \ + $(INC)/vm/vmlog.h \ + $(FRC) + +$(LIBNAME)(vm_as.o): vm_as.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/immu.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/seg_vn.h \ + $(FRC) + +$(LIBNAME)(vm_machdep.o): vm_machdep.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/user.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/vm.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/page.h \ + $(INC)/vm/seg_vn.h \ + $(INC)/vm/seg_kmem.h \ + $(INC)/sys/immu.h \ + $(INC)/vm/cpu.h \ + $(FRC) + +$(LIBNAME)(vm_hat.o): vm_hat.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/immu.h \ + $(INC)/vm/vm_hat.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/as.h \ + $(INC)/vm/page.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/bitmasks.h \ + $(INC)/sys/tuneable.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/inline.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/fs/s5dir.h \ + $(INC)/sys/user.h \ + $(INC)/sys/systm.h \ + $(FRC) + +$(LIBNAME)(vm_page.o): vm_page.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/buf.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/time.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/vm.h \ + $(INC)/vm/trace.h \ + $(INC)/sys/swap.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/tuneable.h \ + $(INC)/sys/disp.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/anon.h \ + $(INC)/vm/page.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/pvn.h \ + $(INC)/vm/mp.h \ + $(INC)/vm/vmlog.h \ + $(INC)/vm/reboot.h \ + $(INC)/sys/systm.h \ + $(INC)/vm/debugger.h \ + $(FRC) + +$(LIBNAME)(vm_pvn.o): vm_pvn.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/time.h \ + $(INC)/sys/buf.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/vmmeter.h \ + $(INC)/sys/vmsystm.h \ + $(INC)/sys/mman.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/cred.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/vm/trace.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/rm.h \ + $(INC)/vm/pvn.h \ + $(INC)/vm/page.h \ + $(INC)/vm/seg_map.h \ + $(INC)/vm/vmlog.h \ + $(INC)/vm/kernel.h \ + $(INC)/sys/systm.h \ + $(FRC) + +$(LIBNAME)(vm_rm.o): vm_rm.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/user.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/rm.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/page.h \ + $(FRC) + +$(LIBNAME)(vm_seg.o): vm_seg.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/immu.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/mp.h \ + $(FRC) + +$(LIBNAME)(vm_swap.o): vm_swap.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/sys/sysmacros.h \ + $(INC)/sys/systm.h \ + $(INC)/sys/signal.h \ + $(INC)/sys/errno.h \ + $(INC)/sys/sbd.h \ + $(INC)/sys/immu.h \ + $(INC)/sys/psw.h \ + $(INC)/sys/pcb.h \ + $(INC)/sys/user.h \ + $(INC)/sys/proc.h \ + $(INC)/sys/kmem.h \ + $(INC)/sys/vfs.h \ + $(INC)/sys/vnode.h \ + $(INC)/sys/file.h \ + $(INC)/sys/uio.h \ + $(INC)/sys/conf.h \ + $(INC)/sys/cmn_err.h \ + $(INC)/sys/debug.h \ + $(INC)/sys/tuneable.h \ + $(INC)/vm/bootconf.h \ + $(INC)/vm/trace.h \ + $(INC)/vm/as.h \ + $(INC)/vm/seg.h \ + $(INC)/vm/page.h \ + $(INC)/vm/seg_vn.h \ + $(INC)/vm/hat.h \ + $(INC)/vm/anon.h \ + $(INC)/sys/swap.h \ + $(INC)/vm/seg_map.h \ + $(FRC) + +$(LIBNAME)(vm_vpage.o): vm_vpage.c \ + $(INC)/sys/types.h \ + $(INC)/sys/param.h \ + $(INC)/vm/vpage.h \ + $(INC)/vm/mp.h \ + $(FRC) + diff --git a/usr/src/uts/3b2/vm/vm_anon.c b/usr/src/uts/3b2/vm/vm_anon.c new file mode 100644 index 0000000..cfd0930 --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_anon.c @@ -0,0 +1,606 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_anon.c 1.16" + +/* + * VM - anonymous pages. + * + * This layer sits immediately above the vm_swap layer. It manages + * physical pages that have no permanent identity in the file system + * name space, using the services of the vm_swap layer to allocate + * backing storage for these pages. Since these pages have no external + * identity, they are discarded when the last reference is removed. + * + * An important function of this layer is to manage low-level sharing + * of pages that are logically distinct but that happen to be + * physically identical (e.g., the corresponding pages of the processes + * resulting from a fork before one process or the other changes their + * contents). This pseudo-sharing is present only as an optimization + * and is not to be confused with true sharing in which multiple + * address spaces deliberately contain references to the same object; + * such sharing is managed at a higher level. + * + * The key data structure here is the anon struct, which contains a + * reference count for its associated physical page and a hint about + * the identity of that page. Anon structs typically live in arrays, + * with an instance's position in its array determining where the + * corresponding backing storage is allocated; however, the swap_xlate() + * routine abstracts away this representation information so that the + * rest of the anon layer need not know it. (See the swap layer for + * more details on anon struct layout.) + * + * In the future versions of the system, the association between an + * anon struct and its position on backing store will change so that + * we don't require backing store all anonymous pages in the system. + * This is important for consideration for large memory systems. + * We can also use this technique to delay binding physical locations + * to anonymous pages until pageout/swapout time where we can make + * smarter allocation decisions to improve anonymous klustering. + * + * Many of the routines defined here take a (struct anon **) argument, + * which allows the code at this level to manage anon pages directly, + * so that callers can regard anon structs as opaque objects and not be + * concerned with assigning or inspecting their contents. + * + * Clients of this layer refer to anon pages indirectly. That is, they + * maintain arrays of pointers to anon structs rather than maintaining + * anon structs themselves. The (struct anon **) arguments mentioned + * above are pointers to entries in these arrays. It is these arrays + * that capture the mapping between offsets within a given segment and + * the corresponding anonymous backing storage address. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/systm.h" +#include "sys/mman.h" +#include "sys/time.h" +#include "sys/cred.h" +#include "sys/vnode.h" +#include "sys/vmmeter.h" +#include "sys/swap.h" +#include "sys/tuneable.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" + +#include "sys/proc.h" /* XXX - needed for PREEMPT() */ +#include "sys/disp.h" /* XXX - needed for PREEMPT() */ + +#include "vm/hat.h" +#include "vm/anon.h" +#include "vm/as.h" +#include "vm/page.h" +#include "vm/seg.h" +#include "vm/pvn.h" +#include "vm/rm.h" +#include "vm/mp.h" +#include "vm/trace.h" + +#include "vm/vmlog.h" /* XXX */ + +extern int availsmem; +extern void pagecopy(); +extern void pagezero(); + +struct anoninfo anoninfo; + +STATIC mon_t anon_lock; +STATIC int anon_resv_debug = 0; +STATIC int anon_enforce_resv = 1; +STATIC int npagesteal; + +/* + * Reserve anon space. + * Return non-zero on success. + */ +int +anon_resv(size) + u_int size; +{ + register u_int pages = btopr(size); + + if (availsmem - pages < tune.t_minasmem) { + nomemmsg("anon_resv", pages, 0, 0); + return 0; + } + + anoninfo.ani_resv += pages; + if (anoninfo.ani_resv > anoninfo.ani_max) { + if (anon_enforce_resv) + anoninfo.ani_resv -= pages; + else if (anon_resv_debug) + cmn_err(CE_CONT, "anon: swap space overcommitted by %d\n", + anoninfo.ani_resv - anoninfo.ani_max); + return (!anon_enforce_resv); + } + availsmem -= pages; + return (1); +} + +/* + * Give back an anon reservation. + */ +void +anon_unresv(size) + u_int size; +{ + register u_int pages = btopr(size); + + availsmem += pages; + anoninfo.ani_resv -= pages; + if ((int)anoninfo.ani_resv < 0) + cmn_err(CE_WARN, "anon: reservations below zero???\n"); +} + +/* + * Allocate an anon slot. + */ +struct anon * +anon_alloc() +{ + register struct anon *ap; + + mon_enter(&anon_lock); + ap = swap_alloc(); + if (ap != NULL) { + anoninfo.ani_free--; + ap->an_refcnt = 1; + ap->un.an_page = NULL; +#ifdef DEBUG + ASSERT(ap->an_use == AN_NONE); + ap->an_use = AN_DATA; +#endif + } + mon_exit(&anon_lock); + return (ap); +} + +#ifdef DEBUG +struct anon * +anon_upalloc() +{ + register struct anon *ap; + + mon_enter(&anon_lock); + ap = swap_alloc(); + if (ap != NULL) { + anoninfo.ani_free--; + ap->an_refcnt = 1; + ap->un.an_page = NULL; + ASSERT(ap->an_use == AN_NONE); + ap->an_use = AN_UPAGE; + } + mon_exit(&anon_lock); + return (ap); +} +#endif + +/* + * Decrement the reference count of an anon page. + * If reference count goes to zero, free it and + * its associated page (if any). + */ +STATIC void +anon_decref(ap) + register struct anon *ap; +{ + register page_t *pp; + struct vnode *vp; + u_int off; + + mon_enter(&anon_lock); + + ASSERT(ap->an_refcnt > 0); +#ifdef DEBUG + ASSERT(ap->an_use == AN_DATA); +#endif + if (ap->an_refcnt == 1) { + /* + * If there is a page for this anon slot we will need to + * call page_abort to get rid of the vp association and + * put the page back on the free list as really free. + */ + swap_xlate(ap, &vp, &off); + ap->an_refcnt--; + pp = page_find(vp, off); +VMLOG(X_ANONDECREF_FREE, ap, off, pp); +#ifdef DEBUG + ap->an_use = AN_NONE; +#endif + swap_free(ap); + anoninfo.ani_free++; + } else { + ap->an_refcnt--; + pp = NULL; + } +VMLOG(X_ANONDECREF, ap, off, ap->an_refcnt); + + mon_exit(&anon_lock); + + /* + * If we had a page, now we can do the page_abort + * since the anon_lock has been released. + */ + if (pp != NULL) { +VMLOG(X_ANONDECREF_ABORT, ap, off, pp); + page_abort(pp); + } +} + +#ifdef DEBUG +void +anon_updecref(ap) + register struct anon *ap; +{ + register page_t *pp; + struct vnode *vp; + u_int off; + + mon_enter(&anon_lock); + + ASSERT(ap->an_use == AN_UPAGE); + ASSERT(ap->an_refcnt == 1); + if (ap->an_refcnt == 1) { + /* + * If there is a page for this anon slot we will need to + * call page_abort to get rid of the vp association and + * put the page back on the free list as really free. + */ + swap_xlate(ap, &vp, &off); + ap->an_refcnt--; + pp = page_find(vp, off); +VMLOG(X_ANONDECREF_FREE, ap, off, pp); + ap->an_use = AN_NONE; + swap_free(ap); + anoninfo.ani_free++; + } else { + ap->an_refcnt--; + pp = NULL; + } +VMLOG(X_ANONDECREF, ap, off, ap->an_refcnt); + + mon_exit(&anon_lock); + + /* + * If we had a page, now we can do the page_abort + * since the anon_lock has been released. + */ + if (pp != NULL) { +VMLOG(X_ANONDECREF_ABORT, ap, off, pp); + page_abort(pp); + } +} +#endif + +/* + * Duplicate references to size bytes worth of anon pages. + * Used when duplicating a segment that contains private anon pages. + * This code assumes that procedure calling this one has already used + * hat_chgprot() to disable write access to the range of addresses that + * that *old actually refers to. + */ +void +anon_dup(old, new, size) + register struct anon **old, **new; + u_int size; +{ + register int i; + + i = btopr(size); + while (i-- > 0) { + if ((*new = *old) != NULL) { + (*new)->an_refcnt++; +#ifdef DEBUG + ASSERT((*new)->an_use == AN_DATA); +#endif + } + old++; + new++; + } +} + +/* + * Free a group of "size" anon pages, size in bytes. + */ +void +anon_free(app, size) + register struct anon **app; + u_int size; +{ + register int i; + + i = btopr(size); + while (i-- > 0) { + if (*app) + anon_decref(*app); + app++; + /* + * This loop takes a while so we put in a preemption point + * here. We preempt only when the current process is not + * in zombie state. (This function is also called when a + * process's state is set to zombie) + */ + if (curproc->p_stat != SZOMB) + PREEMPT(); + } +} + +#ifdef DEBUG +void +anon_upfree(app, size) + register struct anon **app; + u_int size; +{ + register int i; + + i = btopr(size); + while (i-- > 0) { + if (*app) + anon_updecref(*app); + app++; + } +} +#endif + +/* + * Return the kept page(s) and protections back to the segment driver. + */ +int +anon_getpage(app, protp, pl, plsz, seg, addr, rw, cred) + struct anon **app; + u_int *protp; + page_t *pl[]; + u_int plsz; + struct seg *seg; + addr_t addr; + enum seg_rw rw; + struct cred *cred; +{ + register page_t *pp, **ppp; + register struct anon *ap = *app; + struct vnode *vp; + u_int off; + int err; + extern int nopagereclaim; + +VMLOG(X_ANONGETPAGE, seg, addr, app); + swap_xlate(ap, &vp, &off); +again: + pp = ap->un.an_page; + /* + * If the anon pointer has a page associated with it, + * see if it looks ok. If page is being page in, + * wait for it to finish as we must return a list of + * pages since this routine acts like the VOP_GETPAGE + * routine does. + */ + if (pp != NULL && pp->p_vnode == vp && pp->p_offset == off && + !pp->p_gone) { + if (pp->p_intrans && (pp->p_pagein || nopagereclaim)) { +VMLOG(X_ANONGETPAGE_GOTIT_WAIT, pp, pp->p_vnode, pp->p_offset); + page_wait(pp); + goto again; /* try again */ + } + if (pp->p_free) + page_reclaim(pp); + PAGE_HOLD(pp); + if (ap->an_refcnt == 1) + *protp = PROT_ALL; + else + *protp = PROT_ALL & ~PROT_WRITE; + pl[0] = pp; + pl[1] = NULL; + err = 0; +VMLOG(X_ANONGETPAGE_GOTIT, pp, seg, addr); + } else { + /* + * Simply treat it as a vnode fault on the anon vp. + */ + trace3(TR_SEG_GETPAGE, seg, addr, TRC_SEG_ANON); + err = VOP_GETPAGE(vp, off, PAGESIZE, protp, pl, plsz, + seg, addr, rw, cred); + if (err == 0) { + for (ppp = pl; (pp = *ppp++) != NULL; ) { + if (pp->p_offset == off) { + ap->un.an_page = pp; + break; + } + } + } +VMLOG(X_ANONGETPAGE_VOP, pp, vp, off); + if (ap->an_refcnt != 1) + *protp &= ~PROT_WRITE; /* make read-only */ + } + return (err); +} + +/* + * Turn a reference to a shared anon page into a private + * page with a copy of the data from the original page. + */ +page_t * +anon_private(app, seg, addr, opp, steal) + struct anon **app; + struct seg *seg; + addr_t addr; + page_t *opp; + int steal; +{ + register struct anon *old = *app; + register struct anon *new; + register page_t *pp; + struct vnode *vp; + u_int off; + +VMLOG(X_ANONPRIVATE, seg, addr, app); + + new = anon_alloc(); + if (new == (struct anon *)NULL) { + rm_outofanon(); + return ((page_t *)NULL); /* out of swap space */ + } + + swap_xlate(new, &vp, &off); +again: + pp = page_lookup(vp, off); + +/* + * Because of a 386 hw bug, the page that we would be copying from + * (opp) has had an additional PAGE_HOLD applied to it by + * the time we get here. + * XXX - but the translation is also locked for the 386 in this case. + */ +#ifdef sun386 +#define STEAL_KEEP 2 +#else +#define STEAL_KEEP 1 +#endif + + if (pp == NULL && steal != 0 && old == NULL + && opp->p_mod == 0 && opp->p_keepcnt == STEAL_KEEP) { + pp = opp; + hat_pageunload(pp); /* XXX - not kosher for 386 */ + page_hashout(pp); /* destroy old name for page */ + trace6(TR_SEG_ALLOCPAGE, seg, addr, TRC_SEG_ANON, vp, off, pp); + if (page_enter(pp, vp, off)) /* rename as anon page */ + cmn_err(CE_PANIC, "anon private steal"); + new->un.an_page = pp; + *app = new; + pp->p_mod = 1; + PAGE_HOLD(pp); + page_unlock(pp); + npagesteal++; + return (pp); + } + + if (pp == NULL) { + /* + * Normal case, need to allocate new page frame. + */ + pp = rm_allocpage(seg, addr, PAGESIZE, P_CANWAIT); + trace6(TR_SEG_ALLOCPAGE, seg, addr, TRC_SEG_ANON, vp, off, pp); + if (page_enter(pp, vp, off)) { + page_abort(pp); + goto again; /* try again */ + } +VMLOG(X_ANONPRIVATE_ALLOC, pp, vp, off); + } else { + /* + * Already found a page with the right identity - just use it. + */ + page_lock(pp); + PAGE_HOLD(pp); + } + new->un.an_page = pp; + + /* + * To make this work we have to have *app still pointing at + * the original anon structure here for anon_getpage()! + */ + pp->p_intrans = pp->p_pagein = 1; + + /* + * If we have the original page (which has been held), copy + * directly from it. Otherwise copy directly from the segment + * address, which--XXX--is assumed to be mapped in. + */ + if (opp) + ppcopy(opp, pp); + else + pagecopy(addr, pp); + + pp->p_intrans = pp->p_pagein = 0; + + /* + * Ok, now we can unload the old translation info + */ + *app = new; + hat_unload(seg, addr, PAGESIZE, HAT_NOFLAGS); + + pp->p_mod = 1; /* mark as modified */ + page_unlock(pp); + + /* + * If we copied away from an anonymous page, then + * we are one step closer to freeing up an anon slot. + */ + if (old != NULL) + anon_decref(old); + return (pp); +} + +/* + * Allocate a private zero-filled anon page. + */ + +/* ARGSUSED */ +page_t * +anon_zero(seg, addr, app) + struct seg *seg; + addr_t addr; + struct anon **app; +{ + register struct anon *ap; + register page_t *pp; + struct vnode *vp; + u_int off; + +VMLOG(X_ANONZERO, seg, addr, app); + *app = ap = anon_alloc(); + if (ap == NULL) { + rm_outofanon(); + return ((page_t *)NULL); + } + + swap_xlate(ap, &vp, &off); +again: + pp = page_lookup(vp, off); + + if (pp == NULL) { + /* + * Normal case, need to allocate new page frame. + */ + pp = rm_allocpage(seg, addr, PAGESIZE, P_CANWAIT); + trace6(TR_SEG_ALLOCPAGE, seg, addr, TRC_SEG_ANON, vp, off, pp); + if (page_enter(pp, vp, off)) { + page_abort(pp); + goto again; /* try again */ + } +VMLOG(X_ANONZERO_ALLOC, pp, vp, off); + } else { + /* + * Already found a page with the right identity - just use it. + */ + page_lock(pp); + PAGE_HOLD(pp); + } + ap->un.an_page = pp; + + pagezero(pp, 0, PAGESIZE); + cnt.v_zfod++; + pp->p_mod = 1; /* mark as modified so pageout writes back */ + page_unlock(pp); + return (pp); +} + +/* + * This gets calls by the seg_vn driver unload routine + * which is called by the hat code when it decides to + * unload a particular mapping. + */ +void +anon_unloadmap(ap, ref, mod) + struct anon *ap; + u_int ref, mod; +{ + struct vnode *vp; + u_int off; + + swap_xlate(ap, &vp, &off); + pvn_unloadmap(vp, off, ref, mod); +} diff --git a/usr/src/uts/3b2/vm/vm_as.c b/usr/src/uts/3b2/vm/vm_as.c new file mode 100644 index 0000000..b1116bd --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_as.c @@ -0,0 +1,987 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_as.c 1.24" + +/* + * VM - address spaces. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/errno.h" +#include "sys/systm.h" +#include "sys/mman.h" +#include "sys/sysmacros.h" +#include "sys/debug.h" +#include "sys/sysinfo.h" +#include "sys/kmem.h" +#include "sys/inline.h" +#include "sys/user.h" +#include "sys/cmn_err.h" + +#include "sys/immu.h" +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/seg_vn.h" + +extern int valid_va_range(); + +/* + * Variables for maintaining the free list of address space structures. + */ +STATIC struct as *as_freelist; +STATIC int as_freeincr = 8; + +/* + * Find a segment containing addr. as->a_seglast is used as a + * cache to remember the last segment hit we had here. We + * start looking there and go circularly around the seglist. + */ +struct seg * +as_segat(as, addr) + register struct as *as; + register addr_t addr; +{ + register struct seg *seg, *sseg; + + if (as->a_seglast == NULL) + as->a_seglast = as->a_segs; + + sseg = seg = as->a_seglast; + if (seg != NULL) { + do { + if (seg->s_base <= addr && + addr < (seg->s_base + seg->s_size)) { + as->a_seglast = seg; + return (seg); + } + seg = seg->s_next; + } while (seg != sseg); + } + return (NULL); +} + +/* + * Allocate and initialize an address space data structure. + * We call hat_alloc to allow any machine dependent + * information in the hat structure to be initialized. + */ +struct as * +as_alloc() +{ + register struct as *as; + + as = (struct as *)kmem_fast_alloc((caddr_t *)&as_freelist, + sizeof (*as_freelist), as_freeincr, KM_SLEEP); + struct_zero((caddr_t)as, sizeof (*as)); + hat_alloc(as); + return (as); +} + +/* + * Free an address space data structure. + * Need to free the hat first and then + * all the segments on this as and finally + * the space for the as struct itself. + */ +void +as_free(as) + register struct as *as; +{ + + hat_free(as); + while (as->a_segs != NULL) + seg_unmap(as->a_segs); + kmem_fast_free((caddr_t *)&as_freelist, (caddr_t)as); +} + +struct as * +as_dup(as) + register struct as *as; +{ + register struct as *newas; + register struct seg *seg, *sseg, *newseg; + + newas = as_alloc(); + sseg = seg = as->a_segs; + + if (seg != NULL) { + do { + newseg = seg_alloc(newas, seg->s_base, seg->s_size); + if (newseg == NULL) { + as_free(newas); + return (NULL); + } + if ((*seg->s_ops->dup)(seg, newseg) != 0) { + /* + * We call seg_free() on the new seg + * because the segment is not set up + * completely; i.e. it has no ops. + */ + seg_free(newseg); + as_free(newas); + return (NULL); + } + newas->a_size += seg->s_size; + seg = seg->s_next; + } while (seg != sseg); + } + + if (hat_dup(as, newas) != 0) { + as_free(newas); + return(NULL); + } + + return (newas); +} + +/* + * Add a new segment to the address space, sorting + * it into the proper place in the linked list. + */ +int +as_addseg(as, newseg) + register struct as *as; + register struct seg *newseg; +{ + register struct seg *seg; + register addr_t base; + register addr_t eaddr; + + seg = as->a_segs; + if (seg == NULL) { + newseg->s_next = newseg->s_prev = newseg; + as->a_segs = newseg; + } else { + /* + * Figure out where to add the segment to keep list sorted + */ + base = newseg->s_base; + eaddr = base + newseg->s_size; + do { + if (base < seg->s_base) { + if (eaddr > seg->s_base) + return (-1); + break; + } + if (base < seg->s_base + seg->s_size) + return (-1); + seg = seg->s_next; + } while (seg != as->a_segs); + + newseg->s_next = seg; + newseg->s_prev = seg->s_prev; + seg->s_prev = newseg; + newseg->s_prev->s_next = newseg; + + if (base < as->a_segs->s_base) + as->a_segs = newseg; /* newseg is at front */ + } + + return (0); +} + +/* + * Handle a ``fault'' at addr for size bytes. + */ +faultcode_t +as_fault(as, addr, size, type, rw) + struct as *as; + addr_t addr; + u_int size; + enum fault_type type; + enum seg_rw rw; +{ + register struct seg *seg; + register addr_t raddr; /* rounded down addr */ + register u_int rsize; /* rounded up size */ + register u_int ssize; + register faultcode_t res = 0; + addr_t addrsav; + struct seg *segsav; + + switch (type) { + + case F_SOFTLOCK: + vminfo.v_sftlock++; + break; + + case F_PROT: + vminfo.v_pfault++; + break; + + case F_INVAL: + vminfo.v_vfault++; + break; + } + + raddr = (addr_t)((u_int)addr & PAGEMASK); + rsize = (((u_int)(addr + size) + PAGEOFFSET) & PAGEMASK) - (u_int)raddr; + + seg = as_segat(as, raddr); + if (seg == NULL) + return (FC_NOMAP); + + addrsav = raddr; + segsav = seg; + + do { + if (raddr >= seg->s_base + seg->s_size) { + seg = seg->s_next; /* goto next seg */ + if (raddr != seg->s_base) { + res = FC_NOMAP; + break; + } + } + if (raddr + rsize > seg->s_base + seg->s_size) + ssize = seg->s_base + seg->s_size - raddr; + else + ssize = rsize; + + res = (*seg->s_ops->fault)(seg, raddr, ssize, type, rw); + if (res != 0) + break; + + raddr += ssize; + rsize -= ssize; + } while (rsize != 0); + + /* + * If were SOFTLOCKing and we encountered a failure, + * we must SOFTUNLOCK the range we already did. + */ + if (res != 0 && type == F_SOFTLOCK) { + for (seg = segsav; addrsav < raddr; addrsav += ssize) { + if (addrsav >= seg->s_base + seg->s_size) + seg = seg->s_next; /* goto next seg */ + /* + * Now call the fault routine again to perform the + * unlock using S_OTHER instead of the rw variable + * since we never got a chance to touch the pages. + */ + if (raddr > seg->s_base + seg->s_size) + ssize = seg->s_base + seg->s_size - addrsav; + else + ssize = raddr - addrsav; + (void) (*seg->s_ops->fault)(seg, addrsav, ssize, + F_SOFTUNLOCK, S_OTHER); + } + } + + return (res); +} + +/* + * Asynchronous ``fault'' at addr for size bytes. + */ +faultcode_t +as_faulta(as, addr, size) + struct as *as; + addr_t addr; + u_int size; +{ + register struct seg *seg; + register addr_t raddr; /* rounded down addr */ + register u_int rsize; /* rounded up size */ + register faultcode_t res; + + raddr = (addr_t)((u_int)addr & PAGEMASK); + rsize = (((u_int)(addr + size) + PAGEOFFSET) & PAGEMASK) - (u_int)raddr; + + seg = as_segat(as, raddr); + if (seg == NULL) + return (FC_NOMAP); + + do { + if (raddr >= seg->s_base + seg->s_size) { + seg = seg->s_next; /* goto next seg */ + if (raddr != seg->s_base) + return (FC_NOMAP); + } + + res = (*seg->s_ops->faulta)(seg, raddr); + if (res != 0) + return (res); + + raddr += PAGESIZE; + rsize -= PAGESIZE; + } while (rsize != 0); + + return (0); +} + +/* + * Set the virtual mapping for the interval from [addr : addr + size) + * in address space `as' to have the specified protection. + * It is ok for the range to cross over several segments, + * as long as they are contiguous. + */ + +int +as_setprot(as, addr, size, prot) + struct as *as; + addr_t addr; + u_int size; + u_int prot; +{ + register struct seg *seg; + register u_int ssize; + register addr_t raddr; /* rounded down addr */ + register u_int rsize; /* rounded up size */ + int error = 0; + + raddr = (addr_t)((u_int)addr & PAGEMASK); + rsize = (((u_int)(addr + size) + PAGEOFFSET) & PAGEMASK) - (u_int)raddr; + + seg = as_segat(as, raddr); + if (seg == NULL) + return (ENOMEM); + + do { + if (raddr >= seg->s_base + seg->s_size) { + seg = seg->s_next; /* goto next seg */ + if (raddr != seg->s_base) + return (ENOMEM); + } + if ((raddr + rsize) > (seg->s_base + seg->s_size)) + ssize = seg->s_base + seg->s_size - raddr; + else + ssize = rsize; + + error = (*seg->s_ops->setprot)(seg, raddr, ssize, prot); + if (error != 0) + return (error); + + raddr += ssize; + rsize -= ssize; + } while (rsize != 0); + + return (0); +} + +/* + * Check to make sure that the interval from [addr : addr + size) + * in address space `as' has at least the specified protection. + * It is ok for the range to cross over several segments, as long + * as they are contiguous. + */ +int +as_checkprot(as, addr, size, prot) + struct as *as; + addr_t addr; + u_int size; + u_int prot; +{ + register struct seg *seg; + register u_int ssize; + register addr_t raddr; /* rounded down addr */ + register u_int rsize; /* rounded up size */ + int error; + + raddr = (addr_t)((u_int)addr & PAGEMASK); + rsize = (((u_int)(addr + size) + PAGEOFFSET) & PAGEMASK) - (u_int)raddr; + + seg = as_segat(as, raddr); + if (seg == NULL) + return (ENOMEM); + + do { + if (raddr >= seg->s_base + seg->s_size) { + seg = seg->s_next; /* goto next seg */ + if (raddr != seg->s_base) + return (ENOMEM); + } + if ((raddr + rsize) > (seg->s_base + seg->s_size)) + ssize = seg->s_base + seg->s_size - raddr; + else + ssize = rsize; + + error = (*seg->s_ops->checkprot)(seg, raddr, ssize, prot); + if (error != 0) + return (error); + + rsize -= ssize; + raddr += ssize; + } while (rsize != 0); + + return (0); +} + +int +as_unmap(as, addr, size) + register struct as *as; + addr_t addr; + u_int size; +{ + register struct seg *seg, *seg_next; + register addr_t raddr, eaddr; + register u_int ssize; + addr_t obase; + + raddr = (addr_t)((u_int)addr & PAGEMASK); + eaddr = (addr_t)(((u_int)(addr + size) + PAGEOFFSET) & PAGEMASK); + + seg_next = as->a_segs; + if (seg_next != NULL) { + do { + /* + * Save next segment pointer since seg can be + * destroyed during the segment unmap operation. + * We also have to save the old base. + */ + seg = seg_next; + seg_next = seg->s_next; + obase = seg->s_base; + + if (raddr >= seg->s_base + seg->s_size) + continue; /* not there yet */ + + if (eaddr <= seg->s_base) + break; /* all done */ + + if (raddr < seg->s_base) + raddr = seg->s_base; /* skip to seg start */ + + if (eaddr > (seg->s_base + seg->s_size)) + ssize = seg->s_base + seg->s_size - raddr; + else + ssize = eaddr - raddr; + + if ((*seg->s_ops->unmap)(seg, raddr, ssize) != 0) + return (-1); + + as->a_size -= ssize; + raddr += ssize; + + /* + * Check to see if we have looked at all the segs. + * + * We check a_segs because the unmaps above could + * have unmapped the last segment. + */ + } while (as->a_segs != NULL && obase < seg_next->s_base); + } + + return (0); +} + +int +as_map(as, addr, size, crfp, argsp) + struct as *as; + addr_t addr; + u_int size; + int (*crfp)(); + caddr_t argsp; +{ + register struct seg *seg; + register addr_t raddr; /* rounded down addr */ + register u_int rsize; /* rounded up size */ + int error; + + raddr = (addr_t)((u_int)addr & PAGEMASK); + rsize = (((u_int)(addr + size) + PAGEOFFSET) & PAGEMASK) - (u_int)raddr; + + if (as->a_size + rsize > u.u_rlimit[RLIMIT_VMEM].rlim_cur) + return (ENOMEM); + + seg = seg_alloc(as, addr, size); + if (seg == NULL) + return (ENOMEM); + + /* + * Remember that this was the most recently touched segment. + * If the create routine merges this segment into an existing + * segment, seg_free will adjust the a_seglast hint. + */ + as->a_seglast = seg; + + error = (*crfp)(seg, argsp); + if (error != 0) { + seg_free(seg); + } else { + /* + * add size now so as_unmap will work if as_ctl fails + */ + as->a_size += rsize; + + if (as->a_paglck) { + error = as_ctl(as, addr, size, MC_LOCK, 0, + (caddr_t)NULL, (ulong *)NULL, (size_t)NULL); + if (error != 0) + (void) as_unmap(as, addr, size); + } + } + + return (error); +} + +/* + * Find a hole of at least size minlen within [base, base+len). + * If flags specifies AH_HI, the hole will have the highest possible address + * in the range. Otherwise, it will have the lowest possible address. + * If flags specifies AH_CONTAIN, the hole will contain the address addr. + * If an adequate hole is found, base and len are set to reflect the part of + * the hole that is within range, and 0 is returned. Otherwise, + * -1 is returned. + * XXX This routine is not correct when base+len overflows addr_t. + */ +/* VARARGS5 */ +int +as_gap(as, minlen, basep, lenp, flags, addr) + struct as *as; + register u_int minlen; + addr_t *basep; + u_int *lenp; + int flags; + addr_t addr; +{ + register addr_t lobound, hibound; + register addr_t lo, hi; + register struct seg *seg, *sseg; + + lobound = *basep; + hibound = lobound + *lenp; + if (lobound > hibound) /* overflow */ + return (-1); + + sseg = seg = as->a_segs; + if (seg == NULL) { + if (valid_va_range(basep, lenp, minlen, flags & AH_DIR)) + return (0); + else + return (-1); + } + + if ((flags & AH_DIR) == AH_LO) { /* search from lo to hi */ + lo = lobound; + do { + hi = seg->s_base; + if (hi > lobound && hi > lo) { + *basep = MAX(lo, lobound); + *lenp = MIN(hi, hibound) - *basep; + if (valid_va_range(basep,lenp,minlen,AH_LO) && + ((flags & AH_CONTAIN) == 0 || + (*basep <= addr && *basep + *lenp > addr))) + return (0); + } + lo = seg->s_base + seg->s_size; + } while (lo < hibound && (seg = seg->s_next) != sseg); + + if (hi < lo) + hi = hibound; + + /* check against upper bound */ + if (lo < hibound) { + *basep = MAX(lo, lobound); + *lenp = MIN(hi, hibound) - *basep; + if (valid_va_range(basep, lenp, minlen, AH_LO) && + ((flags & AH_CONTAIN) == 0 || + (*basep <= addr && *basep + *lenp > addr))) + return (0); + } + } else { /* search from hi to lo */ + seg = seg->s_prev; + hi = hibound; + do { + lo = seg->s_base + seg->s_size; + if (lo < hibound && hi > lo) { + *basep = MAX(lo, lobound); + *lenp = MIN(hi, hibound) - *basep; + if (valid_va_range(basep,lenp,minlen,AH_HI) && + ((flags & AH_CONTAIN) == 0 || + (*basep <= addr && *basep + *lenp > addr))) + return (0); + } + hi = seg->s_base; + } while (hi > lobound && (seg = seg->s_prev) != sseg); + + if (lo > hi) + lo = lobound; + + /* check against lower bound */ + if (hi > lobound) { + *basep = MAX(lo, lobound); + *lenp = MIN(hi, hibound) - *basep; + if (valid_va_range(basep, lenp, minlen, AH_HI) && + ((flags & AH_CONTAIN) == 0 || + (*basep <= addr && *basep + *lenp > addr))) + return (0); + } + } + return (-1); +} + +/* + * Return the next range within [base, base+len) that is backed + * with "real memory". Skip holes and non-seg_vn segments. + * We're lazy and only return one segment at a time. + */ +int +as_memory(as, basep, lenp) + struct as *as; + addr_t *basep; + u_int *lenp; +{ + register struct seg *seg, *sseg; + register addr_t addr, eaddr; + addr_t segend; + struct seg *cseg = NULL; + + /* XXX - really want as_segatorabove? */ + if (as->a_seglast == NULL) + as->a_seglast = as->a_segs; + + addr = *basep; + eaddr = addr + *lenp; + + sseg = seg = as->a_seglast; + if (seg == NULL) + return(EINVAL); + + do { + if (seg->s_ops != &segvn_ops) + continue; + if (seg->s_base <= addr && + addr < (segend = (seg->s_base + seg->s_size))) { + /* found a containing segment */ + as->a_seglast = seg; + *basep = addr; + if (segend > eaddr) + *lenp = eaddr - addr; + else + *lenp = segend - addr; + return (0); + } else if (seg->s_base > addr) { + if (cseg == NULL || cseg->s_base > seg->s_base) { + /* + * Save closest seg above the range. + * We have to keep scanning because + * we started with the hint instead + * of the beginning of the list. + */ + cseg = seg; + } + } + } while ((seg = seg->s_next) != sseg); + + if (cseg == NULL) /* no valid segs within range */ + return (EINVAL); + + /* + * Only found a close segment, see if there's + * a valid range we can return. + */ + if (cseg->s_base >= eaddr) /* closest segment is out of range */ + return (ENOMEM); + + as->a_seglast = cseg; /* reset hint */ + + *basep = cseg->s_base; + if (cseg->s_base + cseg->s_size > eaddr) + *lenp = eaddr - cseg->s_base; /* segment contains eaddr */ + else + *lenp = cseg->s_size; /* seg is between addr and eaddr */ + return (0); +} + +/* + * Swap the pages associated with the address space as out to + * secondary storage, returning the number of bytes actually + * swapped. + * + * The value returned is intended to correlate well with the process's + * memory requirements. Its usefulness for this purpose depends on + * how well the segment-level routines do at returning accurate + * information. + */ +u_int +as_swapout(as) + register struct as *as; +{ + register struct seg *seg, *sseg; + register u_int swpcnt = 0; + + /* + * Kernel-only processes have given up their address + * spaces. Of course, we shouldn't be attempting to + * swap out such processes in the first place... + */ + if (as == NULL) + return (0); + + /* + * Free all mapping resources associated with the address + * space. The segment-level swapout routines capitalize + * on this unmapping by scavanging pages that have become + * unmapped here. + */ + hat_swapout(as); + + /* + * Call the swapout routines of all segments in the address + * space to do the actual work, accumulating the amount of + * space reclaimed. + */ + sseg = seg = as->a_segs; + if (seg != NULL) { + do { + register struct seg_ops *ov = seg->s_ops; + + /* + * We have to check to see if the seg has + * an ops vector because the seg may have + * been in the middle of being set up when + * the process was picked for swapout. + */ + if ((ov != NULL) && (ov->swapout != NULL)) + swpcnt += (*ov->swapout)(seg); + } while ((seg = seg->s_next) != sseg); + } + + return (swpcnt); +} + +/* + * Determine whether data from the mappings in interval [addr : addr + size) + * are in the primary memory (core) cache. + */ +int +as_incore(as, addr, size, vec, sizep) + struct as *as; + addr_t addr; + u_int size; + char *vec; + u_int *sizep; +{ + register struct seg *seg; + register u_int ssize; + register addr_t raddr; /* rounded down addr */ + register u_int rsize; /* rounded up size */ + u_int isize; /* iteration size */ + + *sizep = 0; + raddr = (addr_t)((u_int)addr & PAGEMASK); + rsize = ((((u_int)addr + size) + PAGEOFFSET) & PAGEMASK) - (u_int)raddr; + seg = as_segat(as, raddr); + if (seg == NULL) + return (-1); + for (; rsize != 0; rsize -= ssize, raddr += ssize) { + if (raddr >= seg->s_base + seg->s_size) { + seg = seg->s_next; + if (raddr != seg->s_base) + return (-1); + } + if ((raddr + rsize) > (seg->s_base + seg->s_size)) + ssize = seg->s_base + seg->s_size - raddr; + else + ssize = rsize; + *sizep += isize = + (*seg->s_ops->incore)(seg, raddr, ssize, vec); + if (isize != ssize) + return (-1); + vec += btoc(ssize); + } + return (0); +} + +/* + * Cache control operations over the interval [addr : addr + size) in + * address space "as". + */ +int +as_ctl(as, addr, size, func, attr, arg, lock_map, pos) + struct as *as; + addr_t addr; + u_int size; + int func; + int attr; + caddr_t arg; + ulong *lock_map; + size_t pos; +{ + register struct seg *seg; /* working segment */ + register struct seg *sseg; /* first segment of address space */ + register addr_t raddr; /* rounded down addr */ + register u_int rsize; /* rounded up size */ + register u_int ssize; /* size of seg */ + int error; /* result */ + + /* + * If these are address space lock/unlock operations, loop over + * all segments in the address space, as appropriate. + */ + if (func == MC_LOCKAS) { + if ((int)arg & MCL_FUTURE) + as->a_paglck = 1; + if (((int)arg & MCL_CURRENT) == 0) + return (0); + + sseg = seg = as->a_segs; + if (seg == NULL) + return(0); + do { + error = (*seg->s_ops->lockop)(seg, seg->s_base, + seg->s_size, attr, MC_LOCK, lock_map, pos); + if (error != 0) + return (error); + pos += seg_pages(seg); + } while((seg = seg->s_next) != sseg); + + return (0); + } else if (func == MC_UNLOCKAS) { + as->a_paglck = 0; + + sseg = seg = as->a_segs; + if (seg == NULL) + return(0); + do { + error = (*seg->s_ops->lockop)(seg, seg->s_base, + seg->s_size, attr, MC_UNLOCK, NULL, 0); + if (error != 0) + return (error); + } while((seg = seg->s_next) != sseg); + + return (0); + } + + /* + * Normalize addresses and sizes. + */ + raddr = (addr_t)((u_int)addr & PAGEMASK); + rsize = (((u_int)(addr + size) + PAGEOFFSET) & PAGEMASK) - (u_int)raddr; + + /* + * Get initial segment. + */ + if ((seg = as_segat(as, raddr)) == NULL) + return (ENOMEM); + + /* + * Loop over all segments. If a hole in the address range is + * discovered, then fail. For each segment, perform the appropriate + * control operation. + */ + + while (rsize != 0) { + + /* + * Make sure there's no hole, calculate the portion + * of the next segment to be operated over. + */ + if (raddr >= seg->s_base + seg->s_size) { + seg = seg->s_next; + if (raddr != seg->s_base) + return (ENOMEM); + } + if ((raddr + rsize) > (seg->s_base + seg->s_size)) + ssize = seg->s_base + seg->s_size - raddr; + else + ssize = rsize; + + /* + * Dispatch on specific function. + */ + switch (func) { + + /* + * Synchronize cached data from mappings with backing + * objects. + */ + case MC_SYNC: + if (error = (*seg->s_ops->sync) + (seg, raddr, ssize, attr, (u_int)arg)) + return (error); + break; + + /* + * Lock pages in memory. + */ + case MC_LOCK: + if (error = (*seg->s_ops->lockop)(seg, raddr, ssize, attr, func, lock_map, pos)) + return (error); + break; + + /* + * Unlock mapped pages. + */ + case MC_UNLOCK: + (void) (*seg->s_ops->lockop)(seg, raddr, ssize, attr, func, (ulong *)NULL, (size_t)NULL); + break; + + /* + * Can't happen. + */ + default: + cmn_err(CE_PANIC, "as_ctl: bad operation %d", func); + /* NOTREACHED */ + } + + rsize -= ssize; + raddr += ssize; + } + return (0); +} + +u_int +as_getprot(as, addr, naddr) + struct as *as; + register caddr_t addr; + caddr_t *naddr; +{ + register struct seg *seg; + caddr_t eaddr; + u_int prot; + u_int nprot; + + seg = as_segat(as, addr); + + eaddr = seg->s_base + seg->s_size; + (*seg->s_ops->getprot)(seg, addr, 0, &prot); + while ((addr += PAGESIZE) < eaddr) { + (*seg->s_ops->getprot)(seg, addr, 0, &nprot); + if (nprot != prot) + break; + } + *naddr = addr; + return prot; +} + +/* Special code for exec to move the stack segment from its interim + * place in the old address to the right place in the new address space. + */ + +int +as_exec(oas, ostka, stksz, nas, nstka, hatflag) + struct as *oas; + addr_t ostka; + int stksz; + struct as *nas; + addr_t nstka; + u_int hatflag; +{ + struct seg *stkseg; + + stkseg = as_segat(oas, ostka); + ASSERT(stkseg != NULL); + ASSERT(stkseg->s_base == ostka && stkseg->s_size == stksz); + if (oas->a_segs == stkseg) + oas->a_segs = stkseg->s_next; + if (oas->a_segs == stkseg) + oas->a_segs = NULL; + else { + stkseg->s_prev->s_next = stkseg->s_next; + stkseg->s_next->s_prev = stkseg->s_prev; + } + if (oas->a_seglast == stkseg) + oas->a_seglast = oas->a_segs; + stkseg->s_as = nas; + stkseg->s_base = nstka; + as_addseg(nas, stkseg); + return(hat_exec(oas, ostka, stksz, nas, nstka, hatflag)); +} diff --git a/usr/src/uts/3b2/vm/vm_hat.c b/usr/src/uts/3b2/vm/vm_hat.c new file mode 100644 index 0000000..79777ab --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_hat.c @@ -0,0 +1,3066 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_hat.c 1.49" + +/* + * VM - Hardware Address Translation management. + * + * The hat layer manages the address translation hardware as a cache + * driven by calls from the higher levels in the VM system. Nearly + * all the details of how the hardware is managed shound not be visible + * above this layer except for miscellaneous machine specific functions + * (e.g. mapin/mapout) that work in conjunction with this code. Other + * than a small number of machine specific places, the hat data + * structures seen by the higher levels in the VM system are opaque + * and are only operated on by the hat routines. Each address space + * contains a struct hat and a page contains an opaque pointer which + * is used by the hat code to hold a list of active translations to + * that page. + * + * Notes: + * + * The p_mapping list hanging off the page structure is protected + * by spl's in the Sun code. Currently, we do not have to do this + * because our mappings are not interrupt replaceable. + * + * It is assumed by this code: + * + * - no load/unload requests will span section boundaries. + * + * - + * + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/immu.h" +#include "sys/vnode.h" +#include "sys/mman.h" +#include "sys/bitmasks.h" +#include "sys/tuneable.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" +#include "sys/sysmacros.h" +#include "sys/inline.h" +#include "sys/errno.h" +#include "sys/psw.h" +#include "sys/pcb.h" +#include "sys/proc.h" +#include "sys/signal.h" +#include "sys/fs/s5dir.h" +#include "sys/user.h" +#include "sys/systm.h" +#include "sys/buf.h" +#include "vm/vm_hat.h" +#include "vm/hat.h" +#include "vm/seg.h" +#include "vm/as.h" +#include "vm/page.h" +#include "vm/anon.h" +#include "vm/seg_vn.h" + +#ifdef DEBUG + +/* + * Single thread locking on mappings; not necessarily true but useful + * for initial debugging. + */ +#define LOCK_THREAD 1 + +u_int hat_debug = 0x0; +u_int hat_duppts = 1; +u_int hat_mappts = 1; +u_int hat_ptpgs = 0xffffffff; +u_int hat_pgcnt = 0; +u_int hat_pgfail = 0; +u_int hat_ptstolen = 0; + +#define RET_ADDR(last_arg) (*((long *)&last_arg + 1)) + +#define HAT_MAX_LOG 200 + +long hat_log_ptr = 0; +long hat_log_ovr = 0; + +struct hat_log_entry { + char *hl_str; + u_long hl_x; + u_long hl_y; + u_long hl_z; +} hat_log[HAT_MAX_LOG]; + +#define HAT_LOG(cond, str, x, y, z) \ + { \ + if (cond) { \ + if (hat_log_ptr == HAT_MAX_LOG) { \ + hat_log_ovr = 1; \ + hat_log_ptr = 0; \ + } \ + hat_log[hat_log_ptr].hl_str = str; \ + hat_log[hat_log_ptr].hl_x = (u_long)x; \ + hat_log[hat_log_ptr].hl_y = (u_long)y; \ + hat_log[hat_log_ptr].hl_z = (u_long)z; \ + ++hat_log_ptr; \ + } \ + } + +printhatlog() +{ + register int i; + + if (hat_log_ovr != 0) { + for(i = hat_log_ptr; i < HAT_MAX_LOG; i++) { + cmn_err(CE_CONT, "%s: %x %x %x\n", + hat_log[i].hl_str, + hat_log[i].hl_x, + hat_log[i].hl_y, + hat_log[i].hl_z); + dodmddelay(); + } + } + + for(i = 0; i < hat_log_ptr; i++) { + cmn_err(CE_CONT, "%s: %x %x %x\n", + hat_log[i].hl_str, + hat_log[i].hl_x, + hat_log[i].hl_y, + hat_log[i].hl_z); + dodmddelay(); + } +} + +#define CHECK_PTE(seg, pte) \ + { \ + if (seg == segkmap) \ + ASSERT(pte >= ksegmappt && pte < eksegmappt); \ + else if (seg == segu) \ + ASSERT(pte >= ksegupt && pte < eksegupt); \ + else \ + ASSERT((pte < ksegmappt || pte >= eksegmappt) && \ + (pte < ksegupt || pte >= eksegupt) ); \ + } +#else +#define HAT_LOG(cond, str, x, y, z) +#define CHECK_PTE(seg, pte) +#endif + +struct as kas; + +extern struct seg *segkmap; /* kernel generic mapping segment */ +extern int kvsegmap[]; +extern pte_t *ksegmappt; +extern pte_t *eksegmappt; +extern struct seg *segu; /* kernel u-area mapping segment */ +extern int kvsegu[]; +extern pte_t *ksegupt; +extern pte_t *eksegupt; + +STATIC void hat_pteload(); +STATIC u_int hat_growsdt(); +STATIC u_int hat_sdtalloc(); +STATIC void hat_sdtfree(); +STATIC pte_t *hat_ptalloc(); +STATIC void hat_ptfree(); +STATIC ptdat_t *hat_pt2ptdat(); + +STATIC u_int pt_waiting; /* Number of procs waiting for a pdt. */ +STATIC ptdat_t free_pts; /* List of free page tables. */ +STATIC ptdat_t active_pts; /* List of active page tables. */ +STATIC page_t sdtfreelist; /* List of pgs that contain free sdt's. */ + +STATIC int sde_invalid[9]; /* invalid sde used for initialization. */ +SRAMA mmu_invalid; + +/* XXX - ublock kludge, default segment table for section 3. */ + +STATIC int dflt_sdt[9]; +SRAMA dflt_sdt_p; + +/* + * Initialize the hardware address translation structures. + * Called by startup() after the vm structures have been allocated + * and mapped in. + */ +void +hat_init() +{ + /* + * Initialize the segment table and page table lists. + */ + sdtfreelist.p_prev = sdtfreelist.p_next = &sdtfreelist; + free_pts.pt_prev = free_pts.pt_next = &free_pts; + active_pts.pt_prev = active_pts.pt_next = &active_pts; + + /* + * We don't have to do anything to initialize the invalid SDT because + * it's guaranteed to be all zeroes. Hence, the valid bit won't be on. + * + * Note, the address of an SDT must be on a 32 byte boundary. + */ + mmu_invalid = ((kvtophys((caddr_t)sde_invalid) + 0x1F) & ~0x1F); + + /* + * XXX - ublock kludge, set up a default segment table that is + * to be used when a process has no as, hence no hat, structure. + * + * Note, the address of an SDT must be on a 32 byte boundary. + */ + dflt_sdt_p = ((kvtophys((caddr_t)dflt_sdt) + 0x1F) & ~0x1F); + ((sde_t *)dflt_sdt_p)->seg_prot = KRWE; + ((sde_t *)dflt_sdt_p)->seg_len = ctomo(USIZE); + ((sde_t *)dflt_sdt_p)->seg_flags = SDE_flags; +} + +/* + * Allocate hat structure for address space (as). + * Called from as_alloc() when address space is being set up. + */ +void +hat_alloc(as) + register struct as *as; +{ + register hat_t *hatp = &as->a_hat; + + /* + * Initialize srama's to mmu_invalid and dflt_sdt to + * indicate segment tables for sections 2 and 3 have not + * yet been allocated. + */ + hatp->hat_srama[HAT_SCN2] = mmu_invalid; + hatp->hat_srama[HAT_SCN3] = dflt_sdt_p; + *((int *)&hatp->hat_sramb[HAT_SCN2]) = 0; + *((int *)&hatp->hat_sramb[HAT_SCN3]) = 0; +} + +/* + * Free all of the translation resources for the specified address space. + * Called from as_free when the address space is being destroyed. + */ +void +hat_free(as) + struct as *as; +{ + register sde_t *sde, *lastsde; + register pte_t *pte, *lastpte; + register pte_t **nextpte; + register hat_t *hatp = &as->a_hat; + pte_t *pt; + page_t *pp; + int section; + int s; + + /* + * XXX - ublock kludge, the hat structure is about to be blown away. + * If it is the current process, we must switch segment tables to the + * default segment table so the ublock will still be accessible. + * + * Note, this also takes care of entirely flushing the mmu cache for + * sections 2 and 3. + */ + + if (as == u.u_procp->p_as) { + s = splhi(); + srama[SCN2] = mmu_invalid; + ((int *)sramb)[SCN2] = 0; + ((sde_t *)dflt_sdt_p)->wd2.address = + phys_ubptbl(u.u_procp->p_ubptbl); + srama[SCN3] = dflt_sdt_p; + ((int *)sramb)[SCN3] = 0; + splx(s); + } + + if (hatp->hat_srama[HAT_SCN2] != mmu_invalid) { + section = SCN2; + sde = (sde_t *)hatp->hat_srama[HAT_SCN2]; + lastsde = sde + hatp->hat_sramb[HAT_SCN2].SDTlen; + } else { + section = SCN3; + sde = (sde_t *)hatp->hat_srama[HAT_SCN3]; + lastsde = sde + hatp->hat_sramb[HAT_SCN3].SDTlen; + + /* + * XXX - ublock kludge, skip over ublock. + */ + if (++sde > lastsde) + return; + } + +next_scn: + + do { + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde)) + continue; + + ASSERT(sde->wd2.address != NULL); + pt = (pte_t *)sde->wd2.address; + lastpte = pt + NPGPT; + pte = pt; + do { + if (pte->pg_pte == NULL) + continue; + +#if DEBUG && LOCK_THREAD == 1 + ASSERT(!PG_ISLOCKED(pte)); +#endif + + as->a_rss--; + + pp = page_numtopp(pte->pgm.pg_pfn); + if (pp == NULL) + continue; + pp->p_ref |= pte->pgm.pg_ref; + pp->p_mod |= pte->pgm.pg_mod; + + /* + * Must remove pte from its + * p_mapping list. + */ + + nextpte = (pte_t **)(&(pp->p_mapping)); + while (*nextpte != pte) { + ASSERT(*nextpte != (pte_t *)NULL); + nextpte = + (pte_t **)(*nextpte + NPGPT); + } + *nextpte = *((pte_t **)(pte + NPGPT)); + + /* + * Don't have to perform the regular + * page table accounting here (i.e. + * next_pte ptrs, NULL out the pte, + * decrement the pte_in_use count, ...) + * because we are going to hat_ptfree() + * the whole page table. hat_ptalloc() + * will initialize everything before it + * is reallocated. + */ + + } while (++pte < lastpte); + + /* + * Free the page tbl and the (p_mapping list) + * next_pte ptrs. + */ + hat_ptfree(pt); + + } while (++sde <= lastsde); + + /* "grow" the segment tbls to 0 length. */ + hat_growsdt(hatp, section, 0); + + if (++section == SCN3) { + sde = (sde_t *)hatp->hat_srama[HAT_SCN3]; + lastsde = sde + hatp->hat_sramb[HAT_SCN3].SDTlen; + + /* + * XXX - ublock kludge, skip over ublock. + */ + if (++sde <= lastsde) + goto next_scn; + } +} + +/* + * Set up any translation structures, for the specified address space, + * that are needed or preferred when the process is being swapped in. + * + * For the 3b2, since we don't free the segment tables on swap out, we + * don't do anything here. The page tables will be allocated by hat_memload. + */ +/* ARGSUSED */ +void +hat_swapin(as) + struct as *as; +{ +} + +/* + * Free all of the translation resources, for the specified address space, + * that can be freed while the process is swapped out. Called from as_swapout. + * + * For the 3b2, all of the page tables are freed. We prefer to leave the + * segment tables intact because they have to be physically contiguous + * and it may be extremely difficult to regain the contiguous space on swapin. + * We simply see if the segment tables can be shrunk. + */ +void +hat_swapout(as) + register struct as *as; +{ + hat_t *hatp = &as->a_hat; + ptdat_t *ptd; + ptdat_t ptdat_tmp; + page_t *pp; + int section; + + ASSERT(as != u.u_procp->p_as); + + /* + * We split this routine into two seperate blocks to get better + * register allocation for heavily used variables. + */ + + /* + * Check to see if we can shrink the segment tables in this + * block of code. + */ + + { + + register struct seg *seg; + register struct seg *sseg; + register struct seg *pseg; + register u_int maxseg; + register u_int section; + register u_int i; + + sseg = seg = as->a_segs; + + ASSERT(sseg != NULL); + + i = SCN2; + + do { + section = SECNUM(seg->s_base); + ASSERT(section == SCN2 || section == SCN3); + + if (section != i) { + hat_growsdt(hatp, i, 0); + continue; + } + + do { + pseg = seg; + seg = seg->s_next; + } while ((section == SECNUM(seg->s_base)) && (seg != sseg)); + + maxseg = SEGNUM(pseg->s_base + pseg->s_size - 1); + + if (hatp->hat_sramb[section - SCN2].SDTlen > maxseg) { + hat_growsdt(hatp, section, maxseg+1); + } + + } while (++i == SCN3); + + } /* end of segment table block */ + + /* + * Free up page tables in this block of code. + */ + + { + + register sde_t *sde, *lastsde; + register pte_t *pte, *lastpte; + register pte_t *pt, **nextpte; + + if (hatp->hat_srama[HAT_SCN2] != mmu_invalid) { + section = SCN2; + sde = (sde_t *)hatp->hat_srama[HAT_SCN2]; + lastsde = sde + hatp->hat_sramb[HAT_SCN2].SDTlen; + } else { + section = SCN3; + sde = (sde_t *)hatp->hat_srama[HAT_SCN3]; + lastsde = sde + hatp->hat_sramb[HAT_SCN3].SDTlen; + + /* + * XXX - ublock kludge, skip over ublock. + */ + + if (++sde > lastsde) + return; + } + +next_scn: + + do { + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde)) + continue; + + ASSERT(sde->wd2.address != NULL); + pt = (pte_t *)sde->wd2.address; + ptd = hat_pt2ptdat(pt, &ptdat_tmp); + if (ptd->pt_keepcnt != 0) + continue; + + lastpte = pt + NPGPT; + pte = pt; + do { + if (pte->pg_pte == NULL) + continue; + +#if DEBUG && LOCK_THREAD == 1 + ASSERT(!PG_ISLOCKED(pte) ); +#endif + + as->a_rss--; + + pp = page_numtopp(pte->pgm.pg_pfn); + if (pp == NULL) + continue; + pp->p_ref |= pte->pgm.pg_ref; + pp->p_mod |= pte->pgm.pg_mod; + + /* + * Must remove pte from its + * p_mapping list. + */ + nextpte = (pte_t **)(&(pp->p_mapping)); + while (*nextpte != pte) { + ASSERT(*nextpte != (pte_t *)NULL); + nextpte = + (pte_t **)(*nextpte + NPGPT); + } + *nextpte = *((pte_t **)(pte + NPGPT)); + + /* + * Don't have to perform the regular + * page table accounting here (i.e. + * next_pte ptrs, NULL out the pte, + * decrement the pte_in_use count, ...) + * because we are going to hat_ptfree() + * the whole page table. hat_ptalloc() + * will initialize everything before it + * is reallocated. + */ + + } while (++pte < lastpte); + + /* + * Free the page tbl and the (p_mapping list) + * nextpte ptrs. + */ + hat_ptfree(pt); + SD_CLRVALID(sde); + + } while (++sde <= lastsde); + + if (++section == SCN3) { + sde = (sde_t *)hatp->hat_srama[HAT_SCN3]; + lastsde = sde + hatp->hat_sramb[HAT_SCN3].SDTlen; + + /* + * XXX - ublock kludge, skip over ublock. + */ + if (++sde <= lastsde) + goto next_scn; + } + + } /* end of page table block */ + +} + +/* + * Unload all of the hardware translations that map page pp. + */ +void +hat_pageunload(pp) + register page_t *pp; +{ + register pte_t *pte; + register struct as *as; + register ptdat_t *ptdat; + ptdat_t ptdat_tmp; + struct as *cur_as = u.u_procp->p_as; + + ASSERT(pp != NULL); + + pte = (pte_t *)(pp->p_mapping); + + while (pte != NULL) { + + /* + * Sync ref and mod bits back to page structure + * before we invalidate the pte. + */ + pp->p_ref |= pte->pgm.pg_ref; + pp->p_mod |= pte->pgm.pg_mod; + + ptdat = hat_pt2ptdat(pte, &ptdat_tmp); + as = ptdat->pt_as; + as->a_rss--; + + /* + * If the pte belongs to the current process or the kernel, + * we must flush the virtual address from the mmu cache. + */ + + if (as == cur_as || as == &kas) { + u_int page_num = ((u_int)pte - ((u_int)pte & ~255)) >> 2; + HAT_LOG((hat_debug & 2), + "hat_pageunload: flushing addr = ", + ((ptdat->pt_secseg << 16) | + (page_num << PNUMSHFT)), + as, 0); + + flushaddr( ((ptdat->pt_secseg << 16) | + (page_num << PNUMSHFT)) ); + } + +#if DEBUG && LOCK_THREAD == 1 + ASSERT(!PG_ISLOCKED(pte)); +#endif + + /* + * If the number of active pte's in the page table drops + * to zero, we can free the page table. Otherwise, just + * invalidate the pte. + * + * Note, we don't have to NULL out the next_pte pointer + * of the p_mapping list, because we NULL'd the head ptr + * to the list. Hence, there's currently no way to get + * to this pte; it's not on any list. The next time we put + * the pte on a list, we'll automatically set the next_pte + * ptr. + */ + + ASSERT(ptdat->pt_inuse > 0); + + if (--ptdat->pt_inuse == 0) { + int section; + sde_t *sde; + pte_t *nextpte; + + section = ptdat->pt_secseg >> 14; + + /* Must be a user address */ + ASSERT(ptdat->pt_keepcnt == 0); + ASSERT(as != &kas); + ASSERT(section == SCN2 || section == SCN3); + + /* + * Invalidate the sde pointing to this page tbl. + * It's OK to use the physical address because + * phys/virt are 1-1 . + */ + sde = (sde_t *)(as->a_hat.hat_srama[section - SCN2]) + + ((ptdat->pt_secseg >> 1) & SEGNMASK); + + ASSERT(sde->wd2.address == ((u_int)pte & (~255))); + + SD_CLRVALID(sde); + + nextpte = *((pte_t **)(pte + NPGPT)); + hat_ptfree((u_int)pte & (~255)); + pte = nextpte; + } else { + pte->pg_pte = 0; + pte = *((pte_t **)(pte + NPGPT)); + } + } + + /* + * Do this here to make debugging this routine easier. + */ + pp->p_mapping = NULL; +} + +/* + * Unload all of the mappings in the range [addr,addr+len) . + */ +void +hat_unload(seg, addr, len, flags) + struct seg *seg; + register addr_t addr; + u_int len; + u_int flags; +{ + register addr_t endaddr; + register pte_t *pte; + register pte_t **nextpte; + register page_t *pp; + register u_int npgs; + struct as *as = seg->s_as; + hat_t *hatp = &seg->s_as->a_hat; + sde_t *sde; + sde_t *lastsde; + pte_t *pt; + ptdat_t *ptdat; + ptdat_t ptdat_tmp; + int section; + u_int free_page = flags & HAT_FREEPP; + u_int rele_page = flags & HAT_RELEPP; + + HAT_LOG(((hat_debug & 8) && ((seg == segu) || (seg == segkmap))), + "hat_unload", addr, len, RET_ADDR(len)); + + endaddr = addr + len - 1; + section = SECNUM(addr); + + /* addr is page aligned */ + ASSERT(((u_long)addr & POFFMASK) == 0); + + /* doesn't cross section boundary */ + ASSERT(section == SECNUM(endaddr)); + + /* valid section */ + ASSERT(section != 0); + + if (section == SCN1) { + sde = (sde_t *)srama[SCN1]; + + ASSERT(seg == segkmap || seg == segu); + ASSERT(sramb[SCN1].SDTlen >= SEGNUM(endaddr)); + + } else { /* SCN2 or SCN3 */ + + sde = (sde_t *)hatp->hat_srama[section - SCN2]; + + /* + * This test is needed because relvm() calls hat_free() + * and then the segment driver free routines. The segment + * driver free routines call hat_unload() on the segments + * address range, but hat_free() already destroyed all of + * the mappings. This is the only case where the SDT's + * don't exist when this routine gets called. All other + * times the segment has been hat_map()'d, hence the SDT + * for it exists. + */ + if (sde == (sde_t *)mmu_invalid || sde == (sde_t *)dflt_sdt_p) + return; + + ASSERT(hatp->hat_sramb[section-SCN2].SDTlen >= SEGNUM(endaddr)); + } + + lastsde = sde + SEGNUM(endaddr); + sde += SEGNUM(addr); + + do { + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde)) { + addr = (addr_t)(((u_int)addr + NBPS) & (~(NBPS - 1))); + continue; + } + + ASSERT(sde->wd2.address != NULL); + + pt = (pte_t *)(sde->wd2.address); + pte = pt + PAGNUM(addr); + ptdat = hat_pt2ptdat(pt, &ptdat_tmp); + npgs = 0; + do { + if (pte->pg_pte == 0) { + ++pte; + addr += NBPP; + continue; + } + + CHECK_PTE(seg, pte); + +#if DEBUG && LOCK_THREAD == 1 + if (flags & HAT_UNLOCK) { + ASSERT(PG_ISLOCKED(pte)); + PG_CLRLOCK(pte); + } else { + ASSERT(!PG_ISLOCKED(pte)); + } +#endif + + ++npgs; + flushaddr(addr); + + pp = page_numtopp(pte->pgm.pg_pfn); + if (pp != NULL) { + pp->p_ref |= pte->pgm.pg_ref; + pp->p_mod |= pte->pgm.pg_mod; + + /* Must remove from p_mapping list. + */ + nextpte = (pte_t **)(&(pp->p_mapping)); + while (*nextpte != pte) { + ASSERT(*nextpte != NULL); + nextpte = (pte_t **)(*nextpte + NPGPT); + } + *nextpte = *((pte_t **)(pte + NPGPT)); + + if (rele_page) { + PAGE_RELE(pp); + } + + /* Avoid orphaned pages; code taken from + * checkpage() in os/vm_pageout.c. + */ + if (free_page && + (pp->p_keepcnt == 0) && /* not kept */ + (pp->p_mapping == 0) && /* no mappings */ + (pp->p_lock == 0) && /* nothing funny */ + (pp->p_free == 0) && + (pp->p_intrans == 0) && + (pp->p_lckcnt == 0) && + (pp->p_cowcnt == 0) ) { + if (pp->p_mod && pp->p_vnode) { + (void) VOP_PUTPAGE(pp->p_vnode, + pp->p_offset, + PAGESIZE, + B_ASYNC | B_FREE, + (struct cred *) 0); + } else { + page_lock(pp); + page_free(pp, 0); + } + } + } + + pte->pg_pte = 0; + ++pte; + addr += NBPP; + + } while (((u_long)addr & (PNUMMASK << PNUMSHFT)) + && addr < endaddr); + + ASSERT(as->a_rss >= npgs); + as->a_rss -= npgs; + + if (flags & HAT_UNLOCK) { + ASSERT(ptdat->pt_keepcnt >= npgs); + ptdat->pt_keepcnt -= npgs; + } + + ASSERT(ptdat->pt_inuse >= npgs); + ptdat->pt_inuse -= npgs; + + if (ptdat->pt_inuse == 0) { + hat_ptfree(pt); + SD_CLRVALID(sde); + } + + } while (++sde <= lastsde); +} + +/* + * Change the protections for the virtual address range [addr,addr+len) + * to the protection prot. + * + * For the 3b2: + * + * (~)PROT_USER will be handled at the segment table level, + * since the user/kernel access bits are in the segment descriptor entry. + * This is not a problem because user/kernel pages don't reside in the + * same segments. + * + * The only catcheable access violation at the page level is write access. + * Therefore, the only pte bit that needs to be set in this routine, except + * in the PROT_NONE case, is the fault-on-write bit. + * + * PROT_NONE will be handled by using the valid bit in the page table + * entry. If a user does not have access to a page, the valid bit will + * be cleared. + */ +void +hat_chgprot(seg, addr, len, prot) + struct seg *seg; + register addr_t addr; + u_int len; + u_int prot; +{ + register addr_t endaddr; + register pte_t *pte; + register sde_t *sde; + register sde_t *lastsde; + struct hat *hatp = &seg->s_as->a_hat; + int section; + + endaddr = addr + len - 1; + section = SECNUM(addr); + + /* addr is page aligned */ + ASSERT(((u_long)addr & POFFMASK) == 0); + + /* doesn't cross section boundary */ + ASSERT(section == SECNUM(endaddr)); + + /* valid section */ + ASSERT(section != 0); + + if (section == SCN1) { + sde = (sde_t *)srama[SCN1]; + + ASSERT(seg == segkmap || seg == segu); + ASSERT(sramb[SCN1].SDTlen >= SEGNUM(endaddr)); + + } else { /* SCN2 or SCN3 */ + + sde = (sde_t *)hatp->hat_srama[section - SCN2]; + + ASSERT(sde != (sde_t *)mmu_invalid); + ASSERT(sde != (sde_t *)dflt_sdt_p); + ASSERT(hatp->hat_sramb[section-SCN2].SDTlen >= SEGNUM(endaddr)); + } + + lastsde = sde + SEGNUM(endaddr); + sde += SEGNUM(addr); + + /* + * (~)PROT_USER handled at the segment descriptor table level, + */ + prot &= (PROT_READ | PROT_WRITE | PROT_EXEC); + + if (prot & PROT_WRITE) { + do { + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde)) { + addr = (addr_t) + (((u_int)addr + NBPS) & (~(NBPS - 1))); + continue; + } + + ASSERT(sde->wd2.address != NULL); + pte = (pte_t *)sde->wd2.address + PAGNUM(addr); + do { + /* + * No need to check for valid pte + * here because we're just CLEARING + * the fault on write bit. + */ + PG_CLRW(pte); + ++pte; + flushaddr(addr); + addr += NBPP; + } while (((u_long)addr & (PNUMMASK << PNUMSHFT)) + && addr < endaddr); + } while (++sde <= lastsde); + } else if (prot == PROT_NONE) { + do { + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde)) { + addr = (addr_t) + (((u_int)addr + NBPS) & (~(NBPS - 1))); + continue; + } + + ASSERT(sde->wd2.address != NULL); + pte = (pte_t *)sde->wd2.address + PAGNUM(addr); + do { + /* + * No need to check for valid pte + * here because we're just CLEARING + * the valid bit. + */ + PG_CLRVALID(pte); + ++pte; + flushaddr(addr); + addr += NBPP; + } while (((u_long)addr & (PNUMMASK << PNUMSHFT)) + && addr < endaddr); + } while (++sde <= lastsde); + } else { + do { + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde)) { + addr = (addr_t) + (((u_int)addr + NBPS) & (~(NBPS - 1))); + continue; + } + + ASSERT(sde->wd2.address != NULL); + pte = (pte_t *)sde->wd2.address + PAGNUM(addr); + do { + /* + * Don't set fault on write bit + * if pte is 0. It will be set when + * it is hat_memload()'d. + */ + if (pte->pg_pte != 0) + PG_SETW(pte); + ++pte; + flushaddr(addr); + addr += NBPP; + } while (((u_long)addr & (PNUMMASK << PNUMSHFT)) + && addr < endaddr); + } while (++sde <= lastsde); + } +} + +/* + * Get all the hardware dependent attributes for a page struct + */ +void +hat_pagesync(pp) + register page_t *pp; +{ + register pte_t *pte; + register struct as *as; + register struct as *cur_as = u.u_procp->p_as; + register ptdat_t *ptdat; + ptdat_t ptdat_tmp; + u_int page_num; + + pte = (pte_t *)pp->p_mapping; + + while (pte != NULL) { + pp->p_ref |= pte->pgm.pg_ref; + PG_CLRREF(pte); + pp->p_mod |= pte->pgm.pg_mod; + PG_CLRMOD(pte); + + /* + * If the pte belongs to the current process or the kernel, + * we must flush the virtual address from the mmu cache so + * the ref and mod bits in the pte will get updated by the + * mmu. Otherwise the mmu would find the bits set in the + * cache and think they were already set in the pte. + */ + ptdat = hat_pt2ptdat(pte, &ptdat_tmp); + + if ((as = ptdat->pt_as) == cur_as || as == &kas) { + page_num = ((u_int)pte - ((u_int)pte & ~255)) >> 2; + + HAT_LOG((hat_debug & 2), + "hat_pagesync: flushing addr = ", + ((ptdat->pt_secseg << 16) | + (page_num << PNUMSHFT)), + as, 0); + + flushaddr( ((ptdat->pt_secseg << 16) | + (page_num << PNUMSHFT)) ); + } + + pte = *((pte_t **)(pte + NPGPT)); + } +} + +/* + * Set up addr to map to page pp with protection prot. + */ +void +hat_memload(seg, addr, pp, prot, lock) + struct seg *seg; + addr_t addr; + page_t *pp; + u_int prot; + u_int lock; +{ + HAT_LOG(((hat_debug & 0x4) && lock), + "hat_memload-l:", addr, pp, RET_ADDR(lock)); + HAT_LOG(((hat_debug & 0x8) && ((seg == segkmap) || (seg == segu))), + "hat_memload-k:", addr, pp, RET_ADDR(lock)); + + hat_pteload(seg, addr, pp, page_pptonum(pp), prot, lock); +} + +/* + * Set up addr to map to cookie pf with protection prot. + */ +void +hat_devload(seg, addr, pf, prot, lock) + struct seg *seg; + addr_t addr; + u_int pf; + u_int prot; + int lock; +{ + HAT_LOG(((hat_debug & 0x4) && lock), + "hat_devload-l:", addr, pf, RET_ADDR(lock)); + HAT_LOG(((hat_debug & 0x8) && ((seg == segkmap) || (seg == segu))), + "hat_devload-k:", addr, pf, RET_ADDR(lock)); + + hat_pteload(seg, addr, NULL, pf, prot, lock); +} + +/* + * Set up addr to map pfn with protection prot. May, or may not, + * have an associated pp structure. + */ +STATIC void +hat_pteload(seg, addr, pp, pfn, prot, lock) + struct seg *seg; + register addr_t addr; + register page_t *pp; + u_int pfn; + u_int prot; + u_int lock; +{ + register sde_t *sde; + register pte_t *pte; + ptdat_t *ptdat; + ptdat_t ptdat_tmp; + u_int section; + u_int addr_seg; + u_int mode; + SRAMA sra; + SRAMB srb; + + section = SECNUM(addr); + addr_seg = SEGNUM(addr); + + ASSERT((pp->p_mapping == NULL) || + ((pp->p_mapping >= (caddr_t)0x2000000) && + (pp->p_mapping < (caddr_t)0x3000000))); + + /* addr is page aligned */ + ASSERT(((int)addr & POFFMASK) == 0); + + /* kernel address, but not segkmap or segu */ + ASSERT(!(section == SCN1 && seg != segkmap && seg != segu)); + + /* overlap with u-block */ + ASSERT(!(section == SCN3 && addr_seg == 0)); + + /* valid section */ + ASSERT(section != 0); + + if (section == SCN1) { + sra = srama[section]; + srb = sramb[section]; + } else { /* SCN2 or SCN3 */ + sra = seg->s_as->a_hat.hat_srama[section-SCN2]; + srb = seg->s_as->a_hat.hat_sramb[section-SCN2]; + } + + if ((sde = (sde_t *)sra) == (sde_t *)mmu_invalid || + addr_seg > srb.SDTlen) { + cmn_err(CE_PANIC, "hat_pteload: SDT not allocated."); + /* NOTREACHED */ + } + + sde += addr_seg; + + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde) ) { + ASSERT(section == SCN2 || section == SCN3); + + /* + * If the thing we are mapping is associated with a pp, + * we must bump the keepcnt to prevent it from being + * stolen because may sleep in hat_ptalloc(). + */ + if (pp) { + ++pp->p_keepcnt; + pte = hat_ptalloc(&ptdat, HAT_CANWAIT); + --pp->p_keepcnt; + } else { + pte = hat_ptalloc(&ptdat, HAT_CANWAIT); + } + + /* Shouldn't have failed. */ + ASSERT(pte != (pte_t *)NULL); + + /* + * Update the page table data (ptdat) to which the + * pte will belong. + */ + ptdat->pt_as = seg->s_as; + ptdat->pt_secseg = ((u_int)addr >> SEGNSHFT) << 1; + ptdat->pt_inuse = 1; + ptdat->pt_keepcnt = 0; + + sde->wd2.address = (paddr_t)pte; + sde->seg_prot = (prot & PROT_USER) ? KRWE|URWE : KRWE ; + sde->seg_flags = SDE_flags; + sde->seg_len = (stob(1)>>3) - 1; + + pte += PAGNUM(addr); + ASSERT(pte->pg_pte == 0); + } else { + ASSERT(sde->wd2.address != NULL); + + pte = (pte_t *)sde->wd2.address + PAGNUM(addr); + + CHECK_PTE(seg, pte); + + if (pte->pg_pte != 0) { + if ((u_int)pte->pgm.pg_pfn != pfn) { + cmn_err(CE_PANIC, "hat_pteload - trying to change existing mapping."); + /* NOTREACHED */ + } + + /* + * (~)PROT_USER is handled at the SDT level. + */ + prot &= (PROT_READ | PROT_WRITE | PROT_EXEC); + + if (prot & PROT_WRITE) + mode = PG_V; + else if (prot == PROT_NONE) + mode = 0; + else + mode = PG_V | PG_W; + /* + * Sync up sofware copy of ref & mod bits + * before we clear them in the pte. We're + * also going to flush the mmu cache because + * the mmu wouldn't bother resetting them, in + * the pte, if it thinks they're already set. + * We also have to flush because we may have + * changed the permissions of the translation. + */ + if (pp) { + pp->p_ref |= pte->pgm.pg_ref; + pp->p_mod |= pte->pgm.pg_mod; + } + + if (lock & HAT_LOCK) { + ptdat = hat_pt2ptdat(pte, &ptdat_tmp); + ++ptdat->pt_keepcnt; +#if DEBUG && LOCK_THREAD == 1 + mode |= PG_LOCK; + } else { + /* + * If we're remapping an already existing + * locked mapping, we must preserve the + * lock bit in the pte; i.e. even though + * lock was not specified, this call does + * not unlock the mapping. Only hat_unlock + * or hat_unload can unlock a mapping. + */ + if (PG_ISLOCKED(pte)) + mode |= PG_LOCK; + } +#else + } +#endif + pte->pg_pte = (u_int)mkpte(mode, pfn); + flushaddr(addr); + return; /* success */ + } + ptdat = hat_pt2ptdat(pte, &ptdat_tmp); + /* XXX - ASSERT(ptdat->pt_inuse < NPGPT); */ + ptdat->pt_inuse++; + } + + /* + * (~)PROT_USER is handled at the SDT level. + */ + prot &= (PROT_READ | PROT_WRITE | PROT_EXEC); + + if (prot & PROT_WRITE) + mode = PG_V; + else if (prot == PROT_NONE) + mode = 0; + else + mode = PG_V | PG_W; + + if (lock & HAT_LOCK) { + ++ptdat->pt_keepcnt; +#if DEBUG && LOCK_THREAD == 1 + mode |= PG_LOCK; +#endif + } + + pte->pg_pte = (u_int)mkpte(mode, pfn); + + /* add to p_mapping list */ + + if (pp) { + *((pte_t **)(pte + NPGPT)) = (pte_t *)pp->p_mapping; + pp->p_mapping = (caddr_t)pte; + } + + seg->s_as->a_rss++; +} + +int +hat_dup(as, new_as) + struct as *as; + struct as *new_as; +{ + register addr_t addr; + register addr_t endaddr; + u_int addr_seg; + u_int addr_pag; + u_int hat_scn; + u_int sra; + u_int error; + sde_t *last_sde; + sde_t *sde; + sde_t *new_sde; + pte_t *pte; + pte_t *new_pte; + ptdat_t *ptdat; + ptdat_t *ptdat_tmp; + u_int copyflag; + page_t *pp; + page_t *opp; + struct seg *sseg; + struct seg *seg; /* parent seg ptr. */ + struct seg *new_seg; /* child seg ptr. */ + struct segvn_data *svd; /* parent seg private data */ + struct segvn_data *new_svd; /* child seg private data */ + struct anon_map *amp; /* parent anon map ptr. */ + struct anon_map *new_amp; /* child anon map ptr. */ + struct anon **anon; /* parent anon entry ptr. */ + struct anon **new_anon; /* child anon entry ptr. */ + u_int index; + struct vnode *svp; + u_int soff; + + /* + * Grow the child's SDT to the length of the parent's. + */ + hat_scn = HAT_SCN2; + do { + ASSERT(new_as->a_hat.hat_srama[hat_scn] == mmu_invalid || + new_as->a_hat.hat_srama[hat_scn] == dflt_sdt_p); + ASSERT(new_as->a_hat.hat_sramb[hat_scn].SDTlen == 0); + + sra = as->a_hat.hat_srama[hat_scn]; + + if (sra == dflt_sdt_p || sra == mmu_invalid) + continue; + + error = hat_growsdt(&new_as->a_hat, hat_scn+SCN2, + as->a_hat.hat_sramb[hat_scn].SDTlen + 1); + + if (error != 0) + return (error); + + } while (++hat_scn == HAT_SCN3); + +#ifdef DEBUG + if (hat_duppts == 0) + return(0); +#endif + + /* + * Optimize behavior for seg_vn type segments. + * + * Initialize the page tables of the new address space + * by copying the valid seg_vn mappings from the original address + * space . + * + * As a heuristic, if a MAP_PRIVATE page has already been + * copy-on-write'd we will give a private copy of the page + * to the child. In general, we believe the child will write + * the same pages that the parent has already written. Our + * performance studies show that this RADICALLY reduces the + * number of c-o-w faults caused by the shell. + * + * NOTES: + * + * We do not inform any file system that might manage a + * particular page that a new reference has been made to + * it. + * + * We're only guessing that the process will need the + * copied mappings. We don't bother sleeping for any + * mapping resources. + * + * In the future, we might try some other heuristics + * to avoid down on unnecessary copying (for example, + * instead of copying all stack pages, only copy the + * current one which we find based on the current + * (parent) stack pointer). + */ + + sseg = seg = as->a_segs; + new_seg = new_as->a_segs; + + ASSERT(seg != NULL && new_seg != NULL); + + do { + /* + * Make sure the seg lists are 1-1. + */ + ASSERT( (seg->s_ops == new_seg->s_ops) && + (seg->s_base == new_seg->s_base) && + (seg->s_size == new_seg->s_size) ); + + /* + * Only copy the mappings if this is a vnode-type segment. + * For now, in order to tell whether a segment is a + * vnode-type segment, we check what functions are used + * to manipulate it. Ultimately, we would like a type field + * to let us know what kind of segment it is. Or we can + * take the object-oriented approach and add a function + * into the seg_ops that will do this duplication for us. + * There may eventually be other types of segments that + * we can 'duplicate' on fork. + */ + if (seg->s_ops != &segvn_ops) { + new_seg = new_seg->s_next; + continue; + } + + svd = (struct segvn_data *)(seg->s_data); + + /* + * If the original segment has per page protections + * (a vpage array), play safe and do not copy the mappings. + */ + if (svd->pageprot) { + new_seg = new_seg->s_next; + continue; + } + + /* + * If the original segment is MAP_PRIVATE, has write + * permission and has the anon map set up, then we will + * anticipate the c-o-w faults and make a copy of the + * pages. + */ + amp = svd->amp; + if (amp) { + /* + * The child's anon structures should have been set + * up in segvn_dup(). + */ + new_svd = (struct segvn_data *)(new_seg->s_data); + ASSERT(new_svd != NULL); + new_amp = new_svd->amp; + ASSERT(new_amp != NULL); + anon = amp->anon; + ASSERT(anon != NULL); + new_anon = new_amp->anon; + ASSERT(new_anon != NULL); + + if ((svd->type == MAP_PRIVATE) && + (svd->prot & PROT_WRITE)) { + copyflag = 1; + } else { + copyflag = 0; + } + } else { + copyflag = 0; + } + + /* + * Calculate parameters and find data structures of the + * mappings in the original segment. + */ + addr = seg->s_base; + hat_scn = SECNUM(addr) - SCN2; + addr_seg = SEGNUM(addr); + endaddr = addr + seg->s_size - 1; + + /* page aligned */ + ASSERT(((u_long)addr & POFFMASK) == 0); + + /* user mapping */ + ASSERT(hat_scn == HAT_SCN2 || hat_scn == HAT_SCN3); + + /* u-area overlap */ + ASSERT(!(hat_scn == HAT_SCN3 && addr_seg == 0)); + + /* cross section boundary */ + ASSERT(hat_scn == (SECNUM(endaddr) - SCN2)); + + sde = (sde_t *)as->a_hat.hat_srama[hat_scn]; + last_sde = sde + SEGNUM(endaddr); + sde += addr_seg; + new_sde = (sde_t *)new_as->a_hat.hat_srama[hat_scn] + addr_seg; + + /* + * For each sde associated with the original segment, + * if it has valid page tables present, copy the entries + * to the sde for the new segment. We may have to allocate + * page tables for the new segment if they are not present. + */ + + do { + ASSERT(!SD_ISCONTIG(sde)); + + if (!SD_ISVALID(sde)) { + addr = (addr_t) + (((u_int)addr + NBPS) & (~(NBPS - 1))); + if (copyflag) { + index = (addr - seg->s_base) >> PNUMSHFT; + anon = amp->anon + index; + new_anon = new_amp->anon + index; + } + ++new_sde; + continue; + } + + ASSERT(sde->wd2.address != NULL); + + addr_pag = PAGNUM(addr); + pte = (pte_t *)sde->wd2.address + addr_pag; + + /* + * If sde for new segment does not have a page table, + * allocate one. New_pte will point to the base of + * the page table. + */ + if (!SD_ISVALID(new_sde)) { + new_pte = hat_ptalloc(&ptdat, HAT_NOSLEEP|HAT_NOSTEAL); + if (new_pte == NULL) + return(0); + + ptdat->pt_as = new_as; + ptdat->pt_secseg = ((u_int)addr >> SEGNSHFT)<<1; + ptdat->pt_inuse = 0; + ptdat->pt_keepcnt = 0; + + *new_sde = *sde; /* will mark it valid */ + new_sde->wd2.address = (paddr_t) new_pte; + } else { + new_pte = (pte_t *)new_sde->wd2.address; + ptdat = hat_pt2ptdat(new_pte, &ptdat_tmp); + } + + new_pte += addr_pag; + + /* + * Walk through page table, copying valid entries. + */ + do { + ASSERT(new_pte->pg_pte == 0); + + if (PG_ISVALID(pte)) { + if (copyflag && *anon) { + /* + * Allocate the new page, + * a new anon structure, + * copy the page contents, + * and tie everything together. + * + * XXX - I should be calling + * rm_allocpage() here, but + * for now I want to save the + * extra function call. + */ + pp = page_get(PAGESIZE, P_NOSLEEP); + if (pp == NULL) + return(0); + + *new_anon = anon_alloc(); + swap_xlate(*new_anon, &svp, &soff); + page_enter(pp, svp, soff); + (*new_anon)->un.an_page = pp; + pp->p_intrans = 1; + pp->p_pagein = 1; + opp = + page_numtopp(pte->pgm.pg_pfn); + ppcopy(opp, pp); + pp->p_mod = 1; + pp->p_intrans = 0; + pp->p_pagein = 0; + /* + * The child must have write + * permission to get here. So, + * the valid bit should be on + * and the f-o-w bit should be + * off. + */ + new_pte->pg_pte = + (u_int)mkpte(PG_V, page_pptonum(pp)); + + /* + * Add to p_mapping list. + */ + *((pte_t **)(new_pte + NPGPT)) = + (pte_t *)pp->p_mapping; + pp->p_mapping = + (caddr_t)new_pte; + + page_unlock(pp); + PAGE_RELE(pp); + + /* + * If the parent refcount is 1, + * cancel the copy on write. + * + * Note: We don't have to flush + * the ATB because segvn_dup + * called hat_chgprot, to set + * the copy-on-write, and that + * flushes the ATB. + */ + if (((*anon)->an_refcnt--) == 1) + PG_CLRW(pte); + } else { + /* + * The fault-on-write bit + * has already been set in + * the parent's pte, if it's + * needed, by segvn_dup(). + */ + new_pte->pg_pte = pte->pg_pte; + + /* + * Add to p_mapping list. + */ + *((pte_t **)(new_pte + NPGPT)) = + *((pte_t **)(pte + NPGPT)); + *((pte_t **)(pte + NPGPT)) = + new_pte; + } +#if DEBUG && LOCK_THREAD == 1 + /* + * Child should not inherit lock bit. + */ + PG_CLRLOCK(new_pte); +#endif + ++new_as->a_rss; + ++ptdat->pt_inuse; + } + + ++pte; + ++new_pte; + ++anon; + ++new_anon; + addr += NBPP; + + } while (((u_long)addr & (PNUMMASK << PNUMSHFT)) + && addr < endaddr); + + ++new_sde; + + } while (++sde <= last_sde); + + new_seg = new_seg->s_next; + + } while ((seg = seg->s_next) != sseg); + + return (0); +} + +/* + * hat_map(seg, ppl, base, prot, flags) + * + * Allocate any hat resources needed for a new segment. + * + * This routine is invoked by the seg_create() routines in the segment + * drivers. + * + * On the 3b2, we grow the SDT to the appropriate size. Also, for vnode + * type segments, we load up translations to any pages of the segment + * that are already in core. + */ +u_int +hat_map(seg, ppl, file_base, prot, flags) + register struct seg *seg; + page_t *ppl; + off_t file_base; + u_int prot; + u_int flags; +{ + register addr_t addr; + register page_t *pp; + register pte_t *pte; + register long file_off; /* offset of page in file */ + hat_t *hatp; + struct as *as; + addr_t endaddr; + SRAMA sra; + int newnseg; + int curnseg; /* segment id of current last HW seg */ + int section; + sde_t *sde; + long file_end; /* end of VM segment in file */ + long addr_off; /* loop invariant; see comments below. */ + ptdat_t *ptdat; + ptdat_t ptdat_tmp; + int mode; + int error; + + addr = seg->s_base; + endaddr = addr + seg->s_size - 1; + newnseg = SEGNUM(endaddr); + section = SECNUM(addr); + + ASSERT(((u_long)addr & POFFMASK) == 0); /* page aligned */ + ASSERT(section == SECNUM(endaddr)); /* cross section boundary */ + + if (section == SCN0 || section == SCN1) { /* valid for hat_map */ + /* + * curnseg = sramb[section].SDTlen; + * + * XXX - need some validity checks here, but everything + * I think should be true isn't. + * + * ASSERT(newnseg <= curnseg); + */ + + return (0); + } + + as = seg->s_as; + hatp = &(as->a_hat); + sra = hatp->hat_srama[section - SCN2]; + if (sra == mmu_invalid || sra == dflt_sdt_p) + curnseg = -1; + else + curnseg = hatp->hat_sramb[section - SCN2].SDTlen; + + if (newnseg > curnseg) { + /* + * hat_growsdt() is called with newnseg+1 because it takes + * the number of SDE entries needed for the section. We + * have to add 1 since segment id numbering starts at 0. + */ + if ((error = hat_growsdt(hatp, section, newnseg+1)) != 0) { + return (error); + } + ASSERT(as == u.u_procp->p_as); + loadmmu(hatp, section); + sra = hatp->hat_srama[section - SCN2]; + } + +#ifdef DEBUG + if (hat_mappts == 0) + return(0); +#endif + + if ((flags & HAT_PRELOAD) == 0) + return(0); + + /* + * XXX - Some day we may pre-load other segment types. + */ + ASSERT((flags & HAT_VNLIST) != 0); + + /* + * Set up as many of the hardware address translations as we can. + * If the segment is a vnode-type segment and it has a non-NULL vnode, + * we walk down the list of incore pages associated with the vnode. + * For each page on that list, if the page maps into the range managed + * by the segment we calculate the corresponding virtual address and + * set up the hardware translation tables to point to the page. + * + * Note: the file system that owns the vnode is not informed about the + * new references we have made to the page. + */ + + /* + * Walk down the list of pages associated with the + * vnode, setting up the translation tables if the + * page maps into addresses in this segment. + */ + if ((pp = ppl) == NULL) /* page list is empty */ + return(0); + + /* + * Calculate the protections we need for the pages + * (i.e. whether to set fault on write bit or not). + */ + if (prot & PROT_WRITE) + mode = PG_V; + else if (prot == PROT_NONE) + return(0); /* don't bother */ + else + mode = PG_V | PG_W; + + /* + * Remove invariant from the loop. To compute the virtual + * address of the page, we use the following computation: + * + * addr = seg->s_base + (file_off - file_base) + * + * Since seg->s_base and file_base do not vary for this segment: + * + * addr = file_off + (addr_off = (seg->s_base - file_base)) + * + * Note: currently addr = seg->s_base; + */ + addr_off = (u_int)addr - file_base; + file_end = file_base + seg->s_size; + + do { + /* + * If page is intrans, ignore it. (There may be + * races if we try to use it.) + */ + if (pp->p_intrans) { + continue; + } + + /* + * See if the file offset is within the range mapped + * by the segment. + */ + file_off = pp->p_offset; + ASSERT((file_off & POFFMASK) == 0); + if ((file_off < (u_int)file_base) || (file_off >= file_end)) { + continue; + } + + /* Reclaim the page because we're committed to loading up a + * translation to it. + */ + if (pp->p_free) { + page_reclaim(pp); + } + + addr = (addr_t) (addr_off + file_off); + ASSERT(((u_int)addr & POFFMASK) == 0); + ASSERT(section == SECNUM(addr)); + + /* + * Get the segment descriptor entry for the page. + * If it is not yet valid (page tables not present), + * allocate and set up the page tables. Then get + * the page table entry for the page. + */ + + sde = (sde_t *)sra + SEGNUM(addr); + + ASSERT(SEGNUM(addr) <= (hatp->hat_sramb[section-SCN2]).SDTlen); + + if (!SD_ISVALID(sde)) { + /* + * We're only guessing that the process will need + * these mappings. Don't bother sleeping for a PDT + * or stealing one from another process. + */ + pte = hat_ptalloc(&ptdat, HAT_NOSLEEP|HAT_NOSTEAL); + if (pte == NULL) + return(0); + + ptdat->pt_as = as; + ptdat->pt_secseg = ((u_int)addr >> SEGNSHFT) << 1; + ptdat->pt_inuse = 0; + ptdat->pt_keepcnt = 0; + + sde->wd2.address = kvtophys((caddr_t)pte); + sde->seg_prot = KRWE|URWE; + sde->seg_flags = SDE_flags; + sde->seg_len = (stob(1) >> 3) - 1; + + pte += PAGNUM(addr); + + } else { /* page table is present */ + + ASSERT(sde->wd2.address != NULL); + pte = (pte_t *)sde->wd2.address + PAGNUM(addr); + ASSERT(pte->pg_pte == 0); + ptdat = hat_pt2ptdat(pte, &ptdat_tmp); + } + + pte->pg_pte = (u_int)mkpte(mode, page_pptonum(pp)); + ptdat->pt_inuse++; + as->a_rss++; + + /* + * Finally, add this reference to the p_mapping list. + * If page is on the freelist and we mapped it into + * the process address space, take it off the freelist. + * Then get the next page on the vnode page list. + */ + *((pte_t **)(pte + NPGPT)) = (pte_t *)pp->p_mapping; + pp->p_mapping = (caddr_t)pte; + + } while ((pp = pp->p_vpnext) != ppl); + + return (0); +} + +/* + * Unlock translation at addr. + * + * Under the 3b2 implementation, this just means checking that the + * translation was locked and decrementing the page table keepcnt + * in the ptdat structure. + */ +void +hat_unlock(seg, addr) + struct seg *seg; + register addr_t addr; +{ + register sde_t *sde; + register pte_t *pte; + register hat_t *hatp = &seg->s_as->a_hat; + register ptdat_t *ptd; + int section; + ptdat_t ptdat_tmp; + + HAT_LOG((hat_debug & 4), "hat_unlock", addr, seg, 0); + + section = SECNUM(addr); + + /* addr is page aligned */ + ASSERT(((u_long)addr & POFFMASK) == 0); + + /* valid section */ + ASSERT(section != 0); + + if (section == SCN1) { + sde = (sde_t *)srama[SCN1]; + + ASSERT(seg == segkmap || seg == segu); + ASSERT(sramb[SCN1].SDTlen >= SEGNUM(addr)); + + } else { /* SCN2 or SCN3 */ + + sde = (sde_t *)hatp->hat_srama[section - SCN2]; + + ASSERT(sde != (sde_t *)mmu_invalid); + ASSERT(sde != (sde_t *)dflt_sdt_p); + ASSERT(hatp->hat_sramb[section-SCN2].SDTlen >= SEGNUM(addr)); + } + + sde += SEGNUM(addr); + + if (SD_ISVALID(sde)) { + ASSERT(sde->wd2.address != NULL); + pte = (pte_t *)sde->wd2.address + PAGNUM(addr); +#if DEBUG && LOCK_THREAD == 1 + ASSERT(PG_ISLOCKED(pte)); + PG_CLRLOCK(pte); +#endif + ptd = hat_pt2ptdat(pte, &ptdat_tmp); + ASSERT(ptd->pt_keepcnt != 0); + if ((--ptd->pt_keepcnt) == 0 && pt_waiting != 0) { + wakeup((caddr_t)&free_pts); + pt_waiting = 0; + } + } else { + cmn_err(CE_PANIC, "hat_unlock: invalid sde."); + /* NOTREACHED */ + } +} + +/* + * Associate all the mappings in the range [addr..addr+len) with + * segment seg. Since we don't cache segments in this hat implementation, + * this routine is a noop. + */ +/* ARGSUSED */ +void +hat_newseg(seg, addr, len, nseg) + struct seg *seg; + addr_t addr; + u_int len; + struct seg *nseg; +{ +} + +STATIC ptdat_t * +hat_pt2ptdat(pt, ptd) + register paddr_t pt; + register ptdat_t *ptd; +{ + register page_t *pp; + register u_int pt_pfn; + + pt_pfn = phystopfn(pt); + + if ((pp = page_numtopp(pt_pfn)) == NULL) { + /* + * Must be a kernel page table. + */ + ptd->pt_as = &kas; + + if ((pt >= (u_int)ksegmappt) && (pt < (u_int)eksegmappt)) { + ptd->pt_secseg = (SCN1 << 14) | + ((SEGNUM(kvsegmap) + + (((pt - (u_int)ksegmappt) >> 9))) << 1); + } else if ((pt >= (u_int)ksegupt) && (pt < (u_int)eksegupt)) { + ptd->pt_secseg = (SCN1 << 14) | + ((SEGNUM(kvsegu) + + (((pt - (u_int)ksegupt) >> 9))) << 1); + } else { + cmn_err(CE_PANIC, "hat_pt2ptdat: invalid pte ptr"); + } + + /* + * We add 1 so the hat will never try to free a kernel + * page table. + */ + ptd->pt_inuse = NPGPT+1; + ptd->pt_keepcnt = NPGPT+1; + } else { + ASSERT(pp->p_ptdats != NULL); + + ptd = (ptdat_t *)(pp->p_ptdats) + + (((u_int)pt >> 9) & 3); + } + + return (ptd); +} + +/* + * Return the page frame number corresponding to the virtual address vaddr. + * + * Required interface defined by the Driver-Kernel Interface (DKI). + * + */ +u_int +hat_getkpfnum(vaddr) + caddr_t vaddr; +{ + return( kvtopfn(vaddr) ); +} + +/* + * hat_vtokp_prot(vprot): + * used for kernel segments to check the requested virtual page + * protections and to convert them to the physical protections. + * Only ro/rw permissions are available in the page table entry + * (using the copy-on-write bit). + * So, only kernel level permissions are permitted. + * The value returned is the value to be placed in the copy-on-write bit. + */ +u_int +hat_vtokp_prot(vprot) + u_int vprot; +{ + if (vprot & PROT_USER) { + cmn_err(CE_PANIC, "hat_vtokp_prot: user addr in kernel space"); + /* NOTREACHED */ + } + + switch (vprot) { + case 0: + cmn_err(CE_PANIC, "hat_vtokp_prot: null permission"); + /* NOTREACHED */ + case PROT_READ: + case PROT_EXEC: + case PROT_READ | PROT_EXEC: + return (1); + case PROT_WRITE: + case PROT_READ | PROT_WRITE: + case PROT_READ | PROT_WRITE | PROT_EXEC: + return (0); + default: + cmn_err(CE_PANIC, "hat_vtokp_prot: bad prot"); + /* NOTREACHED */ + } +} + +/* + * hat_growsdt(hatp, section, nentries) + * + * "grow" the specified section's segment table to the specified number of + * entires. + * + * hatp -> pointer to the hat the section belongs to. + * section -> section containing the hardware segment. + * nentries -> number of entries in the new SDT[section] table. + */ + +STATIC u_int +hat_growsdt(hatp, section, nentries) + hat_t *hatp; + int section; + register int nentries; +{ + register oentries, nlastseg; + register osize, nsize; + SRAMA obase, nbase; + register int i; + int error; + + ASSERT(section == SCN2 || section == SCN3); + + if ((nentries > MAXSDTSEG) || (nentries < 0)) + return (ENOMEM); + + obase = hatp->hat_srama[section - SCN2]; + oentries = hatp->hat_sramb[section - SCN2].SDTlen + 1; + + /* + * (o|n)size = size of the SDT tables in units of minimum size + * segment tables. + */ + + if (obase == mmu_invalid || obase == dflt_sdt_p) + osize = 0; + else + osize = btosdt(sdetob(oentries)); + + nsize = btosdt(sdetob(nentries)); + + nlastseg = btosde(sdttob(nsize)); + + if (nsize <= osize) { + + /* invalidate extra sde's at end of new last SDT */ + + for (i = nentries; i < nlastseg; ++i) + SD_CLRVALID((sde_t *)obase + i); + + /* free any extra SDT's */ + hat_sdtfree(obase + sdttob(nsize), osize - nsize); + + /* update SDT size in the hat structure */ + + if (nentries == 0) { + if (section == SCN2) { + hatp->hat_srama[HAT_SCN2] = mmu_invalid; + *(int *)&hatp->hat_sramb[HAT_SCN2] = 0; + } else { + hatp->hat_srama[HAT_SCN3] = dflt_sdt_p; + *(int *)&hatp->hat_sramb[HAT_SCN3] = 0; + } + } else { + *(int *)&hatp->hat_sramb[section - SCN2] = + (nentries - 1) << SRAMBSHIFT; + } + } else { + /* allocate new SDT */ + int slpflg = (nsize > NSDTPP) ? P_NOSLEEP : P_CANWAIT ; + + if ((error = hat_sdtalloc(&nbase, nsize, slpflg)) != 0) + return (error); + + /* copy entries */ + + bcopy((caddr_t)obase, (caddr_t)nbase, sdetob(oentries)); + + /* free old SDT */ + + if (osize == 0) { + /* + * Don't worry, if we are not growing the segment + * table for the current process, the first entry + * will get set appropriately in pswtch(). We set + * the first entry now in case a loadmmu() is done + * after we return. + */ + if (section == SCN3) { + register sde_t *sde = (sde_t *)nbase; + + sde->wd2.address = + phys_ubptbl(u.u_procp->p_ubptbl); + sde->seg_prot = KRWE; + sde->seg_len = ctomo(USIZE); + sde->seg_flags = SDE_flags; + } + } else { + hat_sdtfree(obase, osize); + } + + /* update SDT addr and size in the hat structure */ + + hatp->hat_srama[section - SCN2] = kvtophys((caddr_t)nbase); + *(int *)&hatp->hat_sramb[section - SCN2] = + (nentries - 1) << SRAMBSHIFT; + + } + + return (0); +} + +/* + * hat_sdtalloc(base, n, flag) + * + * n = number of (NBPSDT byte) segment tables to allocate. + * + * flag & HAT_NOSLEEP -> return immediately if no memory. + * flag & HAT_CANWAIT -> wait if no memory currently available. + * + * Allocate segment tables. Typically called to get segment tables for + * user process but may be called for ptdat structures from ptbl_alloc. + * + */ +STATIC u_int +hat_sdtalloc(base, n, flag) + paddr_t *base; + int n; + u_int flag; +{ + register u_int x; + register u_int i; + register u_int mask; + register page_t *pp; + paddr_t physaddr; + + if (n == 0) { + *base = NULL; + return (0); + } + + /* + * If we are trying to allocate less than a full + * page of segment tables, then check the list of + * pages which currently are being used for segment + * tables. + */ + + if (n < NSDTPP) { + mask = setmask[n]; + + for (pp = sdtfreelist.p_next; + pp != &sdtfreelist; + pp = pp->p_next) { + x = (u_int)pp->p_sdtbits; + for (i = 0; i <= NSDTPP - n; i++, x >>= 1) + if ((x & mask) == 0) { + /* + * We have found some segment tables. + * If no segment tables are left in + * the page, then remove page from + * the segment table list. + */ + pp->p_sdtbits = (caddr_t) + ((u_int)pp->p_sdtbits | (mask << i)); + + if ((u_int)pp->p_sdtbits == setmask[NSDTPP]) { + pp->p_prev->p_next = pp->p_next; + pp->p_next->p_prev = pp->p_prev; + pp->p_prev = NULL; + pp->p_next = NULL; + } + + /* + * Get address of segment table we + * have allocated. Update the free + * segment table count and clear the + * segment table. + */ + physaddr = pfntophys(page_pptonum(pp)) + + sdttob(i); + + (void) bzero((caddr_t)physaddr, sdttob(n)); + *base = physaddr; + return (0); + } + } + } + + /* + * We could not allocate the required number of contiguous segment + * tables from a single page on the free list. + * + * Allocate some more physical memory. + */ + + i = sdttopgs(n); + if (availrmem - i < tune.t_minarmem || + availsmem - i < tune.t_minasmem ){ + nomemmsg("hat_sdtalloc", i, 0, 0); + *base = NULL; + return (ENOMEM); + } + availrmem -= i; + availsmem -= i; + pages_pp_kernel += i; + + pp = page_get(ctob(i), (flag & HAT_CANWAIT)|P_PHYSCONTIG); + if (pp == NULL) { + cmn_err(CE_CONT, "hat_sdtalloc - not enough physically contiguouts memory for segment tables; $d pages.\n", i); + availrmem += i; + availsmem += i; + pages_pp_kernel -= i; + *base = NULL; + return (EAGAIN); + } + ASSERT(pp->p_mapping == NULL); + + physaddr = pfntophys(page_pptonum(pp)); + + ASSERT((physaddr & POFFMASK) == 0); + + /* + * Clear the free page table bit masks for all + * the pages that we have just allocated. + */ + for(; i > 1; --i, ++pp) { + pp->p_sdtbits = (caddr_t) setmask[NSDTPP]; + pp->p_next = NULL; + pp->p_prev = NULL; + } + + /* + * Add any unused segment tables to the end of the + * free list. + * + * Note: the following only works if NSDTPP == 2^n; + * otherwise, use i = n % NSDTPP. + */ + + i = n & (NSDTPP - 1); + if (i != 0) { + pp->p_sdtbits = (caddr_t) setmask[i]; + pp->p_next = sdtfreelist.p_next; + pp->p_prev = &sdtfreelist; + sdtfreelist.p_next->p_prev = pp; + sdtfreelist.p_next = pp; + } else { + pp->p_sdtbits = (caddr_t) setmask[NSDTPP]; + pp->p_next = NULL; + pp->p_prev = NULL; + } + + /* + * Update the count of the number of free page tables + * and zero out the page tables we have just allocated. + */ + (void) bzero((caddr_t)physaddr, sdttob(n)); + *base = physaddr; + + return (0); +} + +/* + * Free previously allocated segment tables + */ +STATIC void +hat_sdtfree(base, n) + paddr_t base; + register int n; +{ + register page_t *pp; + register int index; + int firstfree; + + if (n == 0) + return; + + /* + * Get a pointer to the page structure for the page in + * which we are freeing segment tables. Compute the index + * into the page of the first segment table being freed. + */ + pp = page_numtopp(phystopfn(base)); + ASSERT(pp != NULL); + + index = (base - (base & (~POFFMASK))) >> BPSDTSHFT; + + /* + * Compute the number of segment tables in the first page + * which we are freeing. + */ + firstfree = MIN(n, NSDTPP - index); + + /* Free segment tables up to first page boundary. + */ + if (firstfree < NSDTPP) { + pp->p_sdtbits = (caddr_t) + ((u_int)pp->p_sdtbits & ~(setmask[firstfree] << index)); + + if (pp->p_sdtbits == 0) { + /* Should already be on the freelist because + * we didn't free the whole page but it is + * completely deallocated. + */ + ASSERT(pp->p_next != NULL); + ASSERT(pp->p_prev != NULL); + pp->p_prev->p_next = pp->p_next; + pp->p_next->p_prev = pp->p_prev; + PAGE_RELE(pp); + ++availrmem; + ++availsmem; + --pages_pp_kernel; + } else if (pp->p_next == NULL) { + /* pp is not on the freelist yet, this must be + * the first free in this page. + */ + ASSERT(pp->p_prev == NULL); + ASSERT(((u_int)pp->p_sdtbits | + (setmask[firstfree]<p_next = sdtfreelist.p_next; + pp->p_prev = &sdtfreelist; + sdtfreelist.p_next->p_prev = pp; + sdtfreelist.p_next = pp; + } + + ++pp; + n -= firstfree; + } + + /* + * Free any full pages of segment tables. + */ + while (n >= NSDTPP) { + /* Page should not be on the free list because we're + * freeing the whole page, so it should have been + * completely allocated. + */ + ASSERT(pp->p_next == NULL); + ASSERT(pp->p_prev == NULL); + ASSERT((u_int)pp->p_sdtbits == 0xffffffff); + + pp->p_sdtbits = 0; + + PAGE_RELE(pp); + + ++availrmem; + ++availsmem; + --pages_pp_kernel; + + ++pp; + n -= NSDTPP; + } + + /* Free up any trailing segment tables. + */ + if (n > 0) { + pp->p_sdtbits = (caddr_t) + ((u_int)pp->p_sdtbits & ~(setmask[n])); + + if (pp->p_sdtbits == 0) { + /* Should already be on the freelist because + * we didn't free the whole page but it is + * completely deallocated. + */ + ASSERT(pp->p_next != NULL); + ASSERT(pp->p_prev != NULL); + pp->p_prev->p_next = pp->p_next; + pp->p_next->p_prev = pp->p_prev; + PAGE_RELE(pp); + ++availrmem; + ++availsmem; + --pages_pp_kernel; + } else if (pp->p_next == NULL) { + /* pp is not on the freelist yet, this must be + * the first free in this page. + */ + ASSERT(pp->p_prev == NULL); + ASSERT(((u_int)pp->p_sdtbits | + (setmask[firstfree]<p_next = sdtfreelist.p_next; + pp->p_prev = &sdtfreelist; + sdtfreelist.p_next->p_prev = pp; + sdtfreelist.p_next = pp; + } + } + + return; +} + + +/* + * pte = hat_ptalloc(ptd_ret, flag) + * + * pte = address of the first pte in the page table that was allocated. + * + * ptd_ret = address of a ptr to the ptdat structure for the page table to be + * allocated. + * + * flag & HAT_NOSLEEP -> return immediately if no memory. + * flag & HAT_CANWAIT -> wait if no memory currently available. + * flag & HAT_NOSTEAL -> don't steal a page table from another proc. + * + * Allocate page tables; below are some macros that will be used in + * hat_ptalloc() and hat_ptfree() . + * + */ + +#define APPEND_PT(PTD, LIST) { \ + LIST.pt_prev->pt_next = PTD; \ + PTD->pt_prev = LIST.pt_prev; \ + PTD->pt_next = &LIST; \ + LIST.pt_prev = PTD; \ + } + +#define PREPEND_PT(PTD, LIST) { \ + LIST.pt_next->pt_prev = PTD; \ + PTD->pt_next = LIST.pt_next; \ + PTD->pt_prev = &LIST; \ + LIST.pt_next = PTD; \ + } + +#define REMOVE_PT(PTD) { \ + PTD->pt_prev->pt_next = PTD->pt_next; \ + PTD->pt_next->pt_prev = PTD->pt_prev; \ + } + +STATIC pte_t * +hat_ptalloc(ptd_ret, flag) + ptdat_t **ptd_ret; + u_int flag; +{ + register ptdat_t *ptd; + register paddr_t physaddr; + register pte_t *pte; + register pte_t **nextpte; + page_t *pp; + struct as *as; + struct as *cur_as; + sde_t *sde; + int section; + int segment; + int i; + +tryagain: + + if ((ptd = free_pts.pt_next) != &free_pts) { + /* Take ptdat off of page table free list. + */ + REMOVE_PT(ptd); + + /* Put ptdat on the end of the active page table list. + */ + APPEND_PT(ptd, active_pts); + + /* Update page table bitmap. + */ + pp = ptd->pt_pp; + pte = ptd->pt_addr; + physaddr = (u_int)pte; + pp->p_ptbits |= + 1 << ((physaddr - (ctob(btoct(physaddr)))) >> (BPTSHFT + 1)); + + /* Return ptdat and page table address. + */ + bzero((caddr_t)pte, NBPPT); + *ptd_ret = ptd; + return (pte); + } + + /* Try to allocate a new page for page tables. + */ +#ifdef DEBUG + if (hat_pgcnt < hat_ptpgs) +#endif + if (availrmem - 1 < tune.t_minarmem || + availsmem - 1 < tune.t_minasmem) { + nomemmsg("hat_ptalloc", 1, 0, 0); + } else { + --availrmem; + --availsmem; + ++pages_pp_kernel; + + if ((pp = page_get(NBPP, P_NOSLEEP)) == NULL) { + ++availrmem; + ++availsmem; + --pages_pp_kernel; +#ifdef DEBUG + ++hat_pgfail; +#endif + } else if (hat_sdtalloc((u_int *)ptd_ret, 1, HAT_NOSLEEP) != 0) { + ASSERT(pp->p_mapping == NULL); + PAGE_RELE(pp); + ++availrmem; + ++availsmem; + --pages_pp_kernel; + } else { + /* Return ptdat and page table address. + */ +#ifdef DEBUG + ++hat_pgcnt; +#endif + ASSERT(pp->p_mapping == NULL); + ptd = *ptd_ret; + pp->p_ptbits = 1; + pp->p_ptdats = (caddr_t) ptd; + physaddr = pfntophys(page_pptonum(pp)); + pte = (pte_t *)physaddr; + bzero((caddr_t)pte, NBPPT); + APPEND_PT(ptd, active_pts); + + /* Put the rest of the page tables on the freelist. + */ + for (i = 0; i < ((NPTPP >> 1) - 1); i++) { + ++ptd; + physaddr += (NBPPT << 1); + ptd->pt_addr = (pte_t *)physaddr; + ptd->pt_pp = pp; + APPEND_PT(ptd, free_pts); + } + + return (pte); + } + } + + /* Try to steal a page table from some other process. + */ + if ((flag & HAT_NOSTEAL) == 0) { + + cur_as = u.u_procp->p_as; + + for (ptd = active_pts.pt_next; + ptd != &active_pts; + ptd = ptd->pt_next) { +#ifdef DEBUG + ++hat_ptstolen; +#endif + + ASSERT((ptd->pt_as != NULL) && (ptd->pt_as != &kas)); + + /* XXX - TEMPORARY + * if ((ptd->pt_keepcnt == 0) && (ptd->pt_as != cur_as)) { + */ + if (ptd->pt_keepcnt == 0) { + addr_t addr = (addr_t)(ptd->pt_secseg << 16); + + as = ptd->pt_as; + section = ptd->pt_secseg >> 14; + + ASSERT(section == SCN2 || section == SCN3); + + sde = (sde_t *)as->a_hat.hat_srama[section - SCN2]; + segment = (ptd->pt_secseg >> 1) & SEGNMASK; + + ASSERT(segment <= (int)as->a_hat.hat_sramb[section-SCN2].SDTlen); + + /* Doesn't overlap with u-area; the u-area's + * page table is in the proc structure, it + * shouldn't be on the active list. + */ + ASSERT((section != SCN3) || (segment != 0)); + + sde += segment; + ASSERT(SD_ISVALID(sde)); + physaddr = sde->wd2.address; + ASSERT(physaddr != NULL); + SD_CLRVALID(sde); + + pte = (pte_t *)physaddr; + for(i = 0; i < NPGPT; i++, pte++, addr += NBPP){ + if (pte->pg_pte == NULL) + continue; + as->a_rss--; + pp = page_numtopp(pte->pgm.pg_pfn); + if (pp != NULL) { + pp->p_ref |= pte->pgm.pg_ref; + pp->p_mod |= pte->pgm.pg_mod; + + /* Must remove pte from its + * p_mapping list. + */ + nextpte = + (pte_t **)(&(pp->p_mapping)); + while (*nextpte != pte) { + ASSERT(*nextpte != NULL); + nextpte = + (pte_t **)(*nextpte + NPGPT); + } + *nextpte = *((pte_t **)(pte + NPGPT)); + } + pte->pg_pte = 0; + flushaddr(addr); + } + + /* Move page table to end of active list. + */ + REMOVE_PT(ptd); + APPEND_PT(ptd, active_pts); + + /* Return the page table's address and ptdat. + * Already cleared the pte's above. + */ + *ptd_ret = ptd; + return ((pte_t *)physaddr); + } + } + } + + if ((flag & HAT_CANWAIT) == 0) + return((pte_t *)NULL); + +#ifdef DEBUG + if (hat_debug & 1) + cmn_err(CE_CONT, "hat_ptalloc - have to wait.\n"); +#endif + + ++pt_waiting; + sleep((caddr_t)&free_pts, PSWP+2); + goto tryagain; +} + +/* + * Free previously allocated page tables + */ +STATIC void +hat_ptfree(pt) + paddr_t pt; +{ + register page_t *pp; + register ptdat_t *ptd; + register int i; + int index; + + ASSERT(pt != NULL); + + pp = page_numtopp(phystopfn(pt)); + ASSERT(pp != NULL); + + index = (pt - ctob(btoct(pt))) >> (BPTSHFT + 1); + + ptd = (ptdat_t *)pp->p_ptdats + index; + ASSERT(ptd->pt_keepcnt == 0); + ptd->pt_addr = (pte_t *)pt; + ptd->pt_pp = pp; + + pp->p_ptbits &= ~(0x1 << index); + + if ((pp->p_ptbits & PT_RESERVE) != 0) { + /* Remove ptd from active page table list and put it + * at the head of the free page table list. + */ + REMOVE_PT(ptd); + PREPEND_PT(ptd, free_pts); + if (pt_waiting) { + wakeup((caddr_t)&free_pts); + pt_waiting = 0; + } + } else { + if (pt_waiting) { + wakeup((caddr_t)&free_pts); + pt_waiting = 0; + } else if (pp->p_ptbits == 0) { +#ifdef DEBUG + --hat_pgcnt; +#endif + /* Remove the other page tables, in this page, from + * the freelist and remove the current one from the + * active list. + */ + ptd = (ptdat_t *)pp->p_ptdats; + for (i = 0; i < (NPTPP >> 1); i++, ptd++) { + REMOVE_PT(ptd); + } + + hat_sdtfree(pp->p_ptdats, 1); + + /* Free the page. + */ + pp->p_ptdats = NULL; + PAGE_RELE(pp); + ++availrmem; + ++availsmem; + --pages_pp_kernel; + return; + } + /* Remove ptd from active page table list and put it + * on the tail of the free page table list. + */ + REMOVE_PT(ptd); + APPEND_PT(ptd, free_pts); + } +} + +int +hat_exec(oas, ostka, stksz, nas, nstka, hatflag) + struct as *oas; + addr_t ostka; + int stksz; + struct as *nas; + addr_t nstka; + u_int hatflag; +{ + struct hat *hatp = &oas->a_hat; + int osec; + int nsec; + addr_t endaddr; + addr_t nextaddr; + int skipsize; + int curnseg, endnseg; + int curoseg; + int error; + sde_t *osde; + sde_t *nsde; + struct ptdat *ptd; + struct ptdat *optd; + struct ptdat ptdat_tmp; + pte_t *pt; + pte_t *opte; + pte_t *npt; + pte_t *npte; + pte_t **nextpte; + int pfn; + struct page *pp; + + ASSERT(PAGOFF(stksz) == 0); + ASSERT(PAGOFF((u_int)ostka) == 0); + ASSERT(PAGOFF((u_int)nstka) == 0); + nsec = SECNUM(nstka); + osec = SECNUM(ostka); + endaddr = nstka + stksz - 1; + curoseg = SEGNUM(ostka); + curnseg = SEGNUM(nstka); + endnseg = SEGNUM(endaddr); + if ((error = hat_growsdt(&nas->a_hat, nsec, endnseg+1)) != 0) + return(error); + osde = (sde_t *)oas->a_hat.hat_srama[osec - SCN2]; + osde += curoseg; + nsde = (sde_t *)nas->a_hat.hat_srama[nsec - SCN2]; + nsde += curnseg; + if (hatflag) { + /* Move the page tables themselves as the flag + * states that they contain only pages to be moved + * and the pages are properly aligned in the table. + */ + + for (; curnseg <= endnseg; osde++, nsde++, curnseg++) { + if (!SD_ISVALID(osde)) + continue; + pt = (pte_t *)osde->wd2.address; + ptd = hat_pt2ptdat(pt, &ptdat_tmp); + ptd->pt_as = nas; + ptd->pt_secseg = (((nsec << 13) | curnseg) << 1); + *nsde = *osde; + SD_CLRVALID(osde); + oas->a_rss -= ptd->pt_inuse; + nas->a_rss += ptd->pt_inuse; + } + loadmmu(hatp, osec); + return(0); + } + + /* The PTEs have to be moved */ + + while (stksz > 0) { + if (!SD_ISVALID(osde)) { + nextaddr = (addr_t) roundup((u_int)ostka+1, stob(1)); + skipsize = nextaddr - ostka; + osde++; + stksz -= skipsize; + ostka = nextaddr; + curoseg++; + nstka += skipsize; + if (SEGNUM(nstka) != curnseg) { + nsde++; + curnseg++; + } + continue; + } + pt = (pte_t *)osde->wd2.address; + opte = pt + PAGNUM(ostka); + if (opte->pg_pte == 0) { + goto nextpage; + } + pfn = opte->pgm.pg_pfn; + pp = page_numtopp(pfn); + if (!SD_ISVALID(nsde)) { + ASSERT(pp != NULL); + pp->p_keepcnt++; + optd = hat_pt2ptdat(pt, &ptdat_tmp); + optd->pt_keepcnt++; + if (hat_ptalloc((paddr_t *)&npt, &ptd, 0)!= 0) { + cmn_err(CE_PANIC,"hat_exec: hat_ptalloc failed."); + /* NOTREACHED */ + } + optd->pt_keepcnt--; + pp->p_keepcnt--; + ptd->pt_as = nas; + ptd->pt_secseg = ((u_int)nstka >> SEGNSHFT) << 1; + ptd->pt_inuse = 0; + ptd->pt_keepcnt = 0; + nsde->wd2.address = (paddr_t) pt; + nsde->seg_prot = KRWE|URWE; + nsde->seg_flags = SDE_flags; + nsde->seg_len = (stob(1)>>3) - 1; + } + else + npt = (pte_t *) nsde->wd2.address; + npte = npt + PAGNUM(nstka); + npte->pg_pte = pt->pg_pte; + nextpte = (pte_t **) (&(pp->p_mapping)); + while (*nextpte != opte) { + ASSERT(*nextpte != (pte_t *)NULL); + nextpte = + (pte_t **)(*nextpte + NPGPT); + } + *((pte_t **)(npte + NPGPT)) = *((pte_t **)(opte + NPGPT)); + opte->pg_pte = 0; + /* the convention elsewhere (hat_unload) is that + * the old mapping pointer need not be cleared. + */ + *nextpte = npte; + ptd = hat_pt2ptdat(pt, &ptdat_tmp); + oas->a_rss--; + if (--ptd->pt_inuse == 0) { + hat_ptfree(pt); + SD_CLRVALID(osde); + } + ptd = hat_pt2ptdat(npt, &ptdat_tmp); + ptd->pt_inuse++; + nas->a_rss++; +nextpage: + ostka += NBPP; + if (SEGNUM(ostka) != curoseg) { + osde++; + curoseg++; + } + nstka += NBPP; + if (SEGNUM(nstka) != curnseg) { + nsde++; + curnseg++; + } + stksz -= NBPP; + } + return(0); +} + +void +hat_asload() +{ + register struct hat *hatp = &(u.u_procp->p_as->a_hat); + + loadmmu(hatp, SCN2); + loadmmu(hatp, SCN3); +} + +/* + * Determine (kernel) virtual address of the sde_t needed for translation + * of virtual address within the address space of current process + * + * va --> virtual address + */ + +sde_t * +vatosde(va) + caddr_t va; +{ + register sde_t *sde; + register proc_t *p; + register int sid; + union { + unsigned intvar; + VAR vaddr; + } virtaddr; + + virtaddr.intvar = (unsigned)va; + sid = virtaddr.vaddr.v_sid; + + /* + * Set sde to base of required SDT. + */ + + switch (sid) { + case SCN0: + case SCN1: + sde = (sde_t *)srama[sid]; + break; + case SCN2: + case SCN3: + p = u.u_procp; + sde = (sde_t *)p->p_as->a_hat.hat_srama[sid - SCN2]; + break; + } + sde += virtaddr.vaddr.v_ssl; + + return (sde); +} + +/* + * Determine (kernel) virtual address of the pte_t needed for translation + * of virtual address within the address space of current process + * + * va --> virtual address + * sde --> (kernel) virtual address of segment descriptor used for + * translating va + */ + +/* + * Really only needed for backward compatibility. No reason why this + * shouldn't be a macro. Undef it from sys/immu.h . + */ +#undef vatopte + +pte_t * +vatopte(va, sde) + caddr_t va; + register sde_t *sde; +{ + register pte_t *pte; + union { + caddr_t intvar; + VAR vaddr; + } virtaddr; + + virtaddr.intvar = va; + + pte = (pte_t *)sde->wd2.address + virtaddr.vaddr.v_psl; + return (pte); +} + +/* + * Routine to translate virtual addresses to physical addresses. + * Used by the floppy, Integral, and Duart driver to access the dma. + * If an invalid address is received vtop returns a 0. + */ + +#define EBADDR 0 + +extern struct proc *curproc; + +paddr_t +vtop(vaddr, pp) + register caddr_t vaddr; + proc_t *pp; +{ + register paddr_t retval; + register sde_t *sp; + register sde_t *sde_p; + register pte_t *pte_p; + register int sid; + register s; + + s = splhi(); + sid = SECNUM(vaddr); + if (sid == SCN0 || sid == SCN1 || pp == curproc) { + splx(s); + return (svirtophys(vaddr)); + } else { + sp = (sde_t *)pp->p_as->a_hat.hat_srama[sid - SCN2]; + sde_p = &sp[SEGNUM(vaddr)]; + if (SD_INDIRECT(sde_p)) + sde_p = (sde_t *)(sde_p->wd2.address); + + /* perform validity check */ + + if ((sde_p->seg_flags & SDE_flags) != SDE_flags) { + splx(s); + return ((paddr_t)EBADDR); + } + + /* perform maximum offset check */ + + if (((u_int)vaddr & MSK_IDXSEG) > (long)motob(sde_p->seg_len)) { + splx(s); + return ((paddr_t)EBADDR); + } + + if (SD_ISCONTIG(sde_p)) { + retval = (paddr_t)((long)(sde_p->wd2.address & ~0x7) + + ((u_int)vaddr & MSK_IDXSEG)); + } else { + pte_p = (pte_t *)((int)sde_p->wd2.address & ~0x1f); + pte_p = &pte_p[((u_int)vaddr >> 11) & 0x3f]; + if (!pte_p->pgm.pg_v) { + splx(s); + return(EBADDR); + } + retval = pfntophys(pte_p->pgm.pg_pfn) + PAGOFF(vaddr); + } + splx(s); + return (retval); + } +} + +paddr_t +svirtophys(vaddr) + long vaddr; +{ + register int retval; + register int prio; + register int tempaddr; + register int caddrsave; + int svirtophyserr(); + + prio = splhi(); + tempaddr = vaddr; + vaddr = (tempaddr & ~3); + caddrsave = u.u_caddrflt; + u.u_caddrflt = (int)svirtophyserr; + asm(" MOVTRW *0(%ap),%r8"); + asm(" NOP"); + u.u_caddrflt = caddrsave; + retval |= (tempaddr & 3); + splx(prio); + return ((paddr_t) retval); +} + +void +svirtophysfail() +{ + asm(" .globl svirtophyserr"); + asm("svirtophyserr: "); + cmn_err(CE_PANIC, "svirtophys - movtrw failed."); + /* NOTREACHED */ +} + +/* + * This routine flushes the mmu for a range of addresses. + */ + +void +flushmmu(va, npgs) + register caddr_t va; /* First virtual address to flush. */ + register int npgs; /* Number of pages to flush. */ +{ + register int i; + for (i = 0; i < npgs; i++) + flushaddr(va + ctob(i)); +} diff --git a/usr/src/uts/3b2/vm/vm_hat.h b/usr/src/uts/3b2/vm/vm_hat.h new file mode 100644 index 0000000..4a2d497 --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_hat.h @@ -0,0 +1,138 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_VM_HAT_H +#define _VM_VM_HAT_H + +#ident "@(#)kernel:vm/vm_hat.h 1.15" + +#include "sys/immu.h" +#include "vm/page.h" + +/* + * VM - Hardware Address Translation management. + * + * This file describes the contents of the machine specific + * hat data structures and the machine specific hat procedures. + * The machine independent interface is described in . + */ + +/* + * The hat structure is the machine dependent hardware address translation + * structure kept in the address space structure to show the translation. + */ +typedef struct hat { + SRAMA hat_srama[2]; /* SDT addresses for sections 2 and 3 */ + SRAMB hat_sramb[2]; /* SRAMB entries for sections 2 and 3 */ +} hat_t; + +/* + * The page table data (ptdat) structure is a machine dependent hardware + * address translation structure that keeps information about a page table. + * This struct is not kept for the kernel page tables. + * + * Active page tables: + * + * pt_as - address space the page table belongs to. + * pt_secseg - section/segment the page table is mapping. + * pt_inuse - number of active pte's in the page table. + * pt_keepcnt - number of pte's SOFTLOCK'd in page table. + * + * Free page tables: + * + * pt_addr - physical addr of the page table. + * pt_pp - pp of the page that contains page table. + * + */ +typedef struct ptdat { + union { + struct { + struct as *ptas; + ushort ptsecseg; + u_char ptinuse; + u_char ptkeepcnt; + } pt_active; + struct { + pte_t *ptaddr; + page_t *ptpp; + } pt_free; + } pt_use; + struct ptdat *pt_prev; /* prev ptdat in the list. */ + struct ptdat *pt_next; /* next ptdat in the list. */ +} ptdat_t; + +#define pt_as pt_use.pt_active.ptas +#define pt_secseg pt_use.pt_active.ptsecseg +#define pt_inuse pt_use.pt_active.ptinuse +#define pt_keepcnt pt_use.pt_active.ptkeepcnt +#define pt_addr pt_use.pt_free.ptaddr +#define pt_pp pt_use.pt_free.ptpp + +/* + * Flags to indicate the section of the virtual address space with respect + * to the hat structure contained in the as structure for a process. + */ +#define HAT_SCN2 0 +#define HAT_SCN3 1 + +/* + * Flags to pass to hat_ptalloc(). + * + * NOTE: HAT_NOSLEEP and HAT_CANWAIT must match up with P_NOSLEEP + * and P_CANWAIT (respectively) in vm/page.h . + */ +#define HAT_NOSLEEP 0 /* return immediately if no memory. */ +#define HAT_CANWAIT 1 /* wait if no memory currently available. */ +#define HAT_NOSTEAL 2 /* don't steal a page tbl from another proc. */ + +/* + * Page table flag bits + */ +#define PT_RESERVE 0x100 + +#define p_ptbits p_offset +#define p_ptdats p_mapping +#define p_sdtbits p_mapping + +#ifdef _KERNEL + +/* + * Round up the p_ubptbl address, that was given, to the next 32 byte + * boundary and convert it to a physical address. + * + * paddr_t + * phys_ubptbl(pp->p_ubptbl) + * caddr_t virtaddr; + * { + * virtaddr = (virtaddr + 0x1F) & ~0x1F; + * return( kvtophys(virtaddr) ); + * } + */ +#if defined(lint) + +#define phys_ubptbl(va) ((paddr_t)kvtophys((caddr_t)\ + ((((u_long)(va)) + 0x1F) & ~0x1F))) + +#else + +asm paddr_t +phys_ubptbl(va) +{ +% mem va; + ADDW3 &0x1f,va,%r0 + ANDW3 &0xffffffe0,%r0,%r1 + MOVTRW 0(%r1),%r0 +} + +#endif + +extern SRAMA dflt_sdt_p; +extern SRAMA mmu_invalid; + +#endif /* _KERNEL */ + +#endif /* _VM_VM_HAT_H */ diff --git a/usr/src/uts/3b2/vm/vm_machdep.c b/usr/src/uts/3b2/vm/vm_machdep.c new file mode 100644 index 0000000..1e132ec --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_machdep.c @@ -0,0 +1,405 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_machdep.c 1.18" +/* + * UNIX machine dependent virtual memory support. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/systm.h" +#include "sys/sysmacros.h" +#include "sys/signal.h" +#include "sys/errno.h" +#include "sys/sbd.h" +#include "sys/immu.h" +#include "sys/psw.h" +#include "sys/pcb.h" +#include "sys/user.h" +#include "sys/proc.h" +#include "sys/vm.h" +#include "sys/vfs.h" +#include "sys/vnode.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" +#include "sys/immu.h" + +#include "sys/vmsystm.h" +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/page.h" +#include "vm/seg_vn.h" +#include "vm/seg_kmem.h" +#include "vm/cpu.h" + +/* + * map_addr() is the routine called when the system is to + * chose an address for the user. We will pick an address + * range which is just above UVSHM. + * + * addrp is a value/result parameter. On input it is a hint from the user + * to be used in a completely machine dependent fashion. We decide to + * completely ignore this hint. + * + * On output it is NULL if no address can be found in the current + * processes address space or else an address that is currently + * not mapped for len bytes with a page of red zone on either side. + * If align is true, then the selected address will obey the alignment + * constraints of a vac machine based on the given off value. + * + * On the 3b2, we don't have a virtual address cache, so this arg is + * ignored. + * + * We try to map everything into section 3 of the virtual address space. + * This was done to allow the heap to grow to the section boundary. Also, + * this makes the segment table for section 2 smaller while section 3 is + * is the one that grows. + */ +/*ARGSUSED*/ +void +map_addr(addrp, len, off, align) + addr_t *addrp; + register u_int len; + off_t off; + int align; +{ + register struct as *as = u.u_procp->p_as; + addr_t base; + u_int slen; + + base = (addr_t) UVSHM; + slen = (addr_t) UVEND - base; + len = (len + PAGEOFFSET) & PAGEMASK; + + /* + * Redzone for each side of the request. This is done to leave + * one page unmapped between segments. This is not required, but + * it's useful for the user because if their program strays across + * a segment boundary, it will catch a fault immediately making + * debugging a little easier. + */ + len += 2 * PAGESIZE; + + /* + * Look for a large enough hole starting above UVSHM. + * After finding it, use the lower part. + */ + if (as_gap(as, len, &base, &slen, AH_LO, (addr_t)NULL) == 0) + *addrp = (addr_t)((u_int)base + PAGESIZE); + else + *addrp = NULL; /* no more virtual space */ +} + +/* + * Determine whether [base, base+len) contains a mapable range of + * addresses at least minlen long. base and len are adjusted if + * required to provide a mapable range. + */ + +/* ARGSUSED */ +int +valid_va_range(basep, lenp, minlen, dir) + register addr_t *basep; + register u_int *lenp; + register u_int minlen; + register int dir; +{ + + register addr_t hi, lo; + + lo = *basep; + hi = lo + *lenp; + if (hi < lo ) /* overflow */ + return(0); + if (hi - lo < minlen) + return (0); + return (1); +} + +/* + * Determine whether [addr, addr+len) are vaild user address. + */ +int +valid_usr_range(addr, len) + register addr_t addr; + register size_t len; +{ + register int start_scn, end_scn; + register addr_t eaddr = addr + len; + + if (eaddr <= addr || eaddr > (addr_t)UVEND) + return(0); + + start_scn = SECNUM(addr); + end_scn = SECNUM(eaddr); + + if ((start_scn < SCN2) || /* kernel section 0,1 or */ + (start_scn != end_scn)) /* crosses section boundary */ + return(0); + + if (start_scn == SCN2) /* SCN2 */ + return(1); + + if (SEGNUM(addr) != 0) /* SCN3 and doesn't overlap u-area */ + return(1); + + return(0); +} +/* + * Move pages from one kernel virtual address to another. + * Both addresses are assumed to reside in the Sysmap, + * and size must be a multiple of CLBYTES. + */ + +/* ARGSUSED */ +void +pagemove(from, to, size) + register caddr_t from, to; + int size; +{ +} + + +/* + * Locate the next free virtual address (above UVSHM) within the given process. + */ +caddr_t +findvaddr(p) + struct proc *p; +{ + register struct as *as; + register struct seg *seg; + register caddr_t vaddr; + register caddr_t vaddrt; + + as = p->p_as; + + vaddr = (caddr_t) UVSHM; + + seg = as->a_segs; + if (seg != NULL) { + /* + * segs are sorted by base virtual address, + * and are in a circular list, so we can + * easily get to the highest used virtual address. + */ + seg = seg->s_prev; + vaddrt = seg->s_base + seg->s_size; + if (vaddr < vaddrt) + vaddr = vaddrt; + } + + vaddr = (caddr_t)((uint)(vaddr + NBPS - 1) & ~SOFFMASK); + return vaddr; +} + +/* + * Fast inline data copy. Data sizes MUST be an exact multiple + * of 64 bytes, and and addresses must be word aligned. + */ + +#if defined(lint) + +#define inlinecopy(src, dest, len) bcopy(src, dest, len) + +#else + +int asm +inlinecopy(src, dest, len) +{ +% mem src, dest, len; lab startmove; + + MOVW src, %r0 + MOVW dest, %r1 + MOVW len, %r2 + ARSW3 &0x06, %r2, %r2 + +startmove: + + MOVW (%r0), (%r1) + MOVW 4(%r0), 4(%r1) + MOVW 8(%r0), 8(%r1) + MOVW 12(%r0), 12(%r1) + MOVW 16(%r0), 16(%r1) + MOVW 20(%r0), 20(%r1) + MOVW 24(%r0), 24(%r1) + MOVW 28(%r0), 28(%r1) + MOVW 32(%r0), 32(%r1) + MOVW 36(%r0), 36(%r1) + MOVW 40(%r0), 40(%r1) + MOVW 44(%r0), 44(%r1) + MOVW 48(%r0), 48(%r1) + MOVW 52(%r0), 52(%r1) + MOVW 56(%r0), 56(%r1) + MOVW 60(%r0), 60(%r1) + ADDW2 &64, %r0 + ADDW2 &64, %r1 + DECW %r2 + BNEB startmove +} + +#endif + +/* + * Copy the data from the physical page represented by "frompp" to + * to that represented by "topp". + * + * This routine should be made as fast as possible because it is a + * high runner; e.g. copy on write pages. On the 3b2, function calls + * are expensive. Also, we really don't have to do all of the boundary + * checking bcopy() does because we know we have 2 page boundaries. For + * efficiency we use the fast inlinecopy() routine above. + */ +void +ppcopy(frompp, topp) + page_t *frompp; + page_t *topp; +{ + register addr_t fromva, tova; + + ASSERT(frompp != NULL && topp != NULL); + fromva = (addr_t) ptosv(page_pptonum(frompp)); + tova = (addr_t) ptosv(page_pptonum(topp)); + inlinecopy(fromva, tova, PAGESIZE); +} + +/* + * pagecopy() and pagezero() assume that they will not be called at + * interrupt level. + */ + +/* + * Copy the data from `addr' to physical page represented by `pp'. + * `addr' is a (user) virtual address which we might fault on. + */ +void +pagecopy(addr, pp) + addr_t addr; + page_t *pp; +{ + register addr_t va; + + ASSERT(pp != NULL); + va = (addr_t) ptosv(page_pptonum(pp)); + (void) copyin((caddr_t)addr, va, PAGESIZE); +} + +/* + * Zero the physical page from off to off + len given by `pp' + * without changing the reference and modified bits of page. + * pagezero uses global CADDR2 and assumes that no one uses this + * map at interrupt level and no one sleeps with an active mapping there. + */ +void +pagezero(pp, off, len) + page_t *pp; + u_int off, len; +{ + register caddr_t va; + + ASSERT((int)len > 0 && (int)off >= 0 && off + len <= PAGESIZE); + ASSERT(pp != NULL); + + va = (caddr_t) ptosv(page_pptonum(pp)); + (void) bzero(va + off, len); +} + +/* find an isolated hole in the user address space to use to + * build the new stack image. + * Prefer a hole that is aligned properly for a page table + * so the page table(s) can be moved later. + */ + +caddr_t +execstk_addr(size, hatflagp) + int size; + u_int *hatflagp; /* to tell the hat whether a PT move or PTE copy + * is needed */ +{ + addr_t hstart, secend; + int hsize; + int sec; + struct seg *sseg, *seg; + addr_t eaddr, ptstart; + addr_t svhstart = NULL; +#define SEGSIZE (1<p_as->a_segs; + *hatflagp = 1; + if (sseg == NULL) + return((addr_t) UVBASE); + for (sec = 2; sec < 4; sec++) { + switch(sec) { + case 2: + hstart = (addr_t) UVBASE; + secend = (addr_t) 0xbffff800; + break; + case 3: + hstart = (addr_t) UVSTACK; + secend = (addr_t) 0xfffff800; + break; + } + do { + eaddr = seg->s_base + seg->s_size; + if (seg->s_base > hstart) { + if (seg->s_base > secend) + hsize = secend - hstart; + else hsize = seg->s_base - hstart; + if (hsize >= size && svhstart == NULL) + svhstart = hstart; + if (seg->s_base <= secend) { + ptstart = (addr_t) ((u_int)seg->s_base + & ~(SEGSIZE-1)); + hsize -= seg->s_base - ptstart; + if (seg->s_base != ptstart) + /* the isolation page */ + hsize += PAGESIZE; + } + ptstart = (addr_t)roundup((u_int)hstart, SEGSIZE); + hsize -= ptstart - hstart; + if (hsize >= size) + return(ptstart); + } + if (eaddr >= hstart) + /* need free page before hole */ + hstart = eaddr + PAGESIZE; + if (hstart > secend) + goto nextsec; + if (seg->s_next == sseg) { + /* it is the last segment, so all + * the rest is fair game. + */ + hsize = secend - hstart; + if (hsize >= size && svhstart == NULL) + svhstart = hstart; + ptstart = (addr_t)roundup((u_int)hstart, SEGSIZE); + hsize -= ptstart - hstart; + if (hsize >= size) + return(ptstart); + if (sec == 2) + goto nextsec; + } + } while (seg = seg->s_next, seg != sseg); +nextsec: ; + } + *hatflagp = 0; + return(svhstart); +} diff --git a/usr/src/uts/3b2/vm/vm_mp.c b/usr/src/uts/3b2/vm/vm_mp.c new file mode 100644 index 0000000..38ea9c3 --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_mp.c @@ -0,0 +1,84 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_mp.c 1.4" + +/* + * VM - multiprocessor/ing support. + * + * Currently the mon_enter() / mon_exit() pair implements a + * simple monitor for objects protected by the appropriate lock. + * The cv_wait() / cv_broadcast pait implements a simple + * condition variable which can be used for `sleeping' + * and `waking' inside a monitor if some resource is + * is needed which is not available. + * + * XXX - this code is written knowing about the semantics + * of sleep/wakeup and UNIX scheduling on a uniprocessor machine. + */ + +#include "sys/param.h" +#include "sys/types.h" +#include "sys/systm.h" +#include "sys/inline.h" +#include "sys/cmn_err.h" + +#include "vm/mp.h" + +#ifdef DEBUG +#define ISLOCKED 0x1 +#define LOCKWANT 0x2 + +/* + * mon_enter is used as a type of multiprocess semaphore + * used to implement a monitor where the lock represents + * the ability to operate on the associated object. + * For now, the lock/object association is done + * by convention only. + */ +void +mon_enter(lk) + mon_t *lk; +{} + +/* + * Release the lock associated with a monitor, + * waiting up anybody that has already decided + * to wait for this lock (monitor). + */ +void +mon_exit(lk) + mon_t *lk; +{} + +/* + * Wait for the named condition variable. + * Must already have the monitor lock when cv_wait is called. + */ +void +cv_wait(lk, cond) + mon_t *lk; + char *cond; +{ + + (void) sleep(cond, PSWP+1); +} + +/* + * Wake up all processes waiting on the named condition variable. + * + * We just use current UNIX sleep/wakeup semantics to delay the actual + * context switching until later after we have released the lock. + */ +void +cv_broadcast(lk, cond) + mon_t *lk; + char *cond; +{ + wakeup(cond); +} +#endif /*DEBUG */ diff --git a/usr/src/uts/3b2/vm/vm_page.c b/usr/src/uts/3b2/vm/vm_page.c new file mode 100644 index 0000000..e31e363 --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_page.c @@ -0,0 +1,1857 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_page.c 1.40" + +/* + * VM - physical page management. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/systm.h" +#include "sys/buf.h" +#include "sys/errno.h" +#include "sys/time.h" +#include "sys/vfs.h" +#include "sys/vnode.h" +#include "sys/immu.h" /* XXX - needed for outofmem() */ +#include "sys/proc.h" /* XXX - needed for outofmem() */ +#include "sys/vm.h" +#include "vm/trace.h" +#include "sys/swap.h" +#include "sys/debug.h" +#include "sys/cmn_err.h" +#include "sys/tuneable.h" +#include "sys/sysmacros.h" +#include "sys/sysinfo.h" +#include "sys/inline.h" +#include "sys/disp.h" /* XXX - needed for PREEMPT() */ + +#include "vm/hat.h" +#include "vm/anon.h" +#include "vm/page.h" +#include "vm/seg.h" +#include "vm/pvn.h" +#include "vm/mp.h" +#include "vm/vmlog.h" + +#if defined(__STDC__) +STATIC void page_add(page_t **, page_t *); +STATIC int page_addmem(int); +STATIC int page_delmem(int); +STATIC void page_print(page_t *); +STATIC void page_unfree(page_t *); +#else +STATIC void page_add(); +STATIC int page_addmem(); +STATIC int page_delmem(); +STATIC void page_print(); +STATIC void page_unfree(); +#endif + +STATIC int nopageage = 1; + +STATIC u_int max_page_get; /* max page_get request size in pages */ +STATIC u_int freemem_wait; /* someone waiting for freemem */ + +u_int pages_pp_locked = 0; /* physical pages actually locked */ +u_int pages_pp_claimed = 0; /* physical pages reserved */ +u_int pages_pp_kernel = 0; /* physical page locks by kernel */ + +extern void cleanup(); +void call_debug(); + +/* XXX where should this be defined ? */ +struct buf *bclnlist; +int availrmem; +int availsmem; + +#ifdef PAGE_DEBUG +int do_checks = 0; +int do_check_vp = 1; +int do_check_free = 1; +int do_check_list = 1; +int do_check_pp = 1; + +STATIC void page_vp_check(); +STATIC void page_free_check(); +STATIC void page_list_check(); +STATIC void page_pp_check(); + +#define CHECK(vp) if (do_checks && do_check_vp) page_vp_check(vp) +#define CHECKFREE() if (do_checks && do_check_free) page_free_check() +#define CHECKLIST(pp) if (do_checks && do_check_list) page_list_check(pp) +#define CHECKPP(pp) if (do_checks && do_check_pp) page_pp_check(pp) + +#else /* PAGE_DEBUG */ + +#define CHECK(vp) +#define CHECKFREE() +#define CHECKLIST(pp) +#define CHECKPP(pp) + +#endif /* PAGE_DEBUG */ + + +/* + * Set to non-zero to avoid reclaiming pages which are + * busy being paged back until the IO and completed. + */ +int nopagereclaim = 0; + +/* + * The logical page free list is maintained as two physical lists. + * The free list contains those pages that should be reused first. + * The cache list contains those pages that should remain unused as + * long as possible so that they might be reclaimed. + */ +STATIC page_t *page_freelist; /* free list of pages */ +STATIC page_t *page_cachelist; /* cache list of free pages */ +STATIC int page_freelist_size; /* size of free list */ +STATIC int page_cachelist_size; /* size of cache list */ + +mon_t page_mplock; /* lock for manipulating page links */ + +STATIC mon_t page_freelock; /* lock for manipulating free list */ + +page_t *pages; /* array of all page structures */ +page_t *epages; /* end of all pages */ +u_int pages_base; /* page # for pages[0] */ +u_int pages_end; /* page # for pages[max] */ + +#ifdef sun386 +page_t *epages2; /* end of all pages */ +u_int pages_base2; /* page # for discontiguous phys mem */ +u_int pages_end2; /* page # for end */ + +#define OK_PAGE_GET 0x50 /* min ok value for MAX_PAGE_GET */ +#define KEEP_FREE 0x20 /* number of pages to keep free */ + +#endif /* sun386 */ + + +STATIC mon_t page_locklock; /* mutex on locking variables */ + +#if 0 +STATIC u_int pages_pp_factor = 10;/* divisor for unlocked percentage */ +#endif + +#define PAGE_LOCK_MAXIMUM \ + ((1 << (sizeof (((page_t *)0)->p_lckcnt) * NBBY)) - 1) + +STATIC struct page_tcnt { + int pc_free_cache; /* free's into cache list */ + int pc_free_dontneed; /* free's with dontneed */ + int pc_free_pageout; /* free's from pageout */ + int pc_free_free; /* free's into free list */ + int pc_get_cache; /* get's from cache list */ + int pc_get_free; /* get's from free list */ + int pc_reclaim; /* reclaim's */ + int pc_abortfree; /* abort's of free pages */ + int pc_find_hit; /* find's that find page */ + int pc_find_miss; /* find's that don't find page */ +#define PC_HASH_CNT (2*PAGE_HASHAVELEN) + int pc_find_hashlen[PC_HASH_CNT+1]; +} pagecnt; + +/* + * Initialize the physical page structures. + * Since we cannot call the dynamic memory allocator yet, + * we have startup() allocate memory for the page + * structs and the hash tables for us. + */ +#ifdef sun386 +void +page_init(pp, num, base, num2, base2) + register page_t *pp; + u_int num, base; + u_int num2, base2; +#else +void +page_init(pp, num, base) + register page_t *pp; + u_int num, base; +#endif +{ + + /* + * Store away info in globals. In the future, we will want to + * redo this stuff so that we can have multiple chunks. + */ + pages = pp; + epages = &pp[num]; + pages_base = base; + pages_end = base + num; + +#ifdef sun386 + epages2 = &pp[num+num2]; + pages_base2 = base2; + pages_end2 = base2 + num2; +#endif + /* + * Arbitrarily limit the max page_get request + * to 1/2 of the page structs we have. + * + * If this value is < OK_PAGE_GET, then we set max_page_get to + * num - KEEP_FREE. If this number is less 1/2 of memory, + * use 1/2 of mem. If it's greater than OK_PAGE_GET, use OK_PAGE_GET. + * + * All of this is just an attempt to run even if very little memory + * is available. There are no guarantees! The system will probably + * die later with insufficient memory even though we get by here. + */ +#ifdef sun386 + max_page_get = (num + num2) >> 1; + + if (max_page_get < OK_PAGE_GET && num - KEEP_FREE > max_page_get) { + max_page_get = num - KEEP_FREE; + if (max_page_get > OK_PAGE_GET) + max_page_get = OK_PAGE_GET; + } +#else + max_page_get = num >> 1; +#endif + + /* + * The physical space for the pages array + * representing ram pages have already been + * allocated. Here we mark all the pages as + * locked. Later calls to page_free() will + * make the pages available. + */ +#ifdef sun386 + for (; pp < epages2; pp++) + pp->p_lock = 1; +#else + for (; pp < epages; pp++) + pp->p_lock = 1; +#endif + /* + * Determine the number of pages that can be pplocked. This + * is the number of page frames less the maximum that can be + * taken for buffers less another percentage. The percentage should + * be a tunable parameter, and in SVR4 should be one of the "tune" + * structures. + */ +/* + pages_pp_maximum = +#ifdef sun386 + num + num2; +#else sun386 + num; +#endif sun386 + pages_pp_maximum = num / 10; +*/ + if (pages_pp_maximum <= (tune.t_minarmem + 20) || + pages_pp_maximum > num) + pages_pp_maximum = num / 10; +#if 0 + pages_pp_maximum -= (btop(nbuf * MAXBSIZE) + 1) + + (pages_pp_maximum / pages_pp_factor); +#endif + + /* + * Verify that the hashing stuff has been initialized by machdep.c + */ + if (page_hash == NULL || page_hashsz == 0) + cmn_err(CE_PANIC, "page_init"); + +#ifdef lint + page_print(pp); +#endif /* lint */ +} + +/* + * Use cv_wait() to wait for the given page. It is assumed that + * the page_mplock is already locked upon entry and will this lock + * will continue to be held upon return. + */ +void +page_cv_wait(pp) + page_t *pp; +{ + int s; + + /* + * Protect against someone clearing the + * want bit before we get to sleep. + */ + s = splvm(); + if (bclnlist == NULL) { + /* page may be done except for cleanup if + * bclnlist != NULL. + * during startup, in particular, this + * would cause deadlock. + * Later, it causes an unnecessary delay + * unless that case is handled. + */ + pp->p_want = 1; + cv_wait(&page_mplock, (char *)pp); + } + (void) splx(s); + + /* + * We may have been awakened from swdone, + * in which case we must clean up the i/o + * list before being able to use the page. + */ + mon_exit(&page_mplock); + if (bclnlist != NULL) + cleanup(); + mon_enter(&page_mplock); +} + +/* + * Reclaim the given page from the free list to vp list. + */ +void +page_reclaim(pp) + register page_t *pp; +{ + int s; + register struct anon *ap; + + ASSERT (pp >= pages && pp < epages); + s = splimp(); + mon_enter(&page_freelock); + + if (pp->p_free) { +#ifdef TRACE + register int age = pp->p_age; + + ap = NULL; +#endif /* TRACE */ + page_unfree(pp); + pagecnt.pc_reclaim++; + if (pp->p_vnode) { + cnt.v_pgrec++; + cnt.v_pgfrec++; + vminfo.v_pgrec++; + + if (ap = swap_anon(pp->p_vnode, pp->p_offset)) { + if (ap->un.an_page == NULL && ap->an_refcnt > 0) + ap->un.an_page = pp; + cnt.v_xsfrec++; + vminfo.v_xsfrec++; + } else { + cnt.v_xifrec++; + vminfo.v_xifrec++; + } + CHECK(pp->p_vnode); + } + + trace6(TR_PG_RECLAIM, pp, pp->p_vnode, pp->p_offset, + ap, age, freemem); + } + + mon_exit(&page_freelock); + (void) splx(s); +} + +/* + * Quick page lookup to merely find if a named page exists + * somewhere w/o having to worry about which list it is on. + */ +page_t * +page_find(vp, off) + register struct vnode *vp; + register u_int off; +{ + register page_t *pp; + register int len = 0; + + for (pp = page_hash[PAGE_HASHFUNC(vp, off)]; pp; pp = pp->p_hash, len++) + if (pp->p_vnode == vp && pp->p_offset == off && pp->p_gone == 0) + break; + if (pp) + pagecnt.pc_find_hit++; + else + pagecnt.pc_find_miss++; + if (len > PC_HASH_CNT) + len = PC_HASH_CNT; + pagecnt.pc_find_hashlen[len]++; + return (pp); +} + +/* + * Find a page representing the specified . + * If we find the page but it is intransit coming in, + * we wait for the IO to complete and then reclaim the + * page if it was found on the free list. + */ +page_t * +page_lookup(vp, off) + struct vnode *vp; + u_int off; +{ + register page_t *pp; + +again: + pp = page_find(vp, off); + if (pp != NULL) { + ASSERT (pp >= pages && pp < epages); + /* + * Try calling cleanup here to reap the + * async buffers queued up for processing. + */ + if (pp->p_intrans && pp->p_pagein && bclnlist) { +VMLOG(X_PAGELOOKUP_CLEANUP, pp, vp, off); + cleanup(); + } + + mon_enter(&page_mplock); + while (pp->p_lock && pp->p_intrans && pp->p_vnode == vp && + pp->p_offset == off && !pp->p_gone && + (pp->p_pagein || nopagereclaim)) { +VMLOG(X_PAGELOOKUP_WAIT, pp, vp, off); + cnt.v_intrans++; + page_cv_wait(pp); + } +VMLOG(X_PAGELOOKUP_WAITDONE, pp, pp->p_vnode, pp->p_offset); + mon_exit(&page_mplock); + + /* + * If we still have the right page and it is now + * on the free list, get it back via page_reclaim. + * Note that when a page is on the free list, it + * maybe ripped away at interrupt level. After + * we reclaim the page, this page cannot not be + * taken away from as at interrupt level anymore. + */ + if (pp->p_vnode == vp && pp->p_offset == off && !pp->p_gone && + pp->p_free) + page_reclaim(pp); + /* + * Verify page contents again, if we + * lost it go start all over again. + */ + if (pp->p_vnode != vp || pp->p_offset != off || pp->p_gone) + goto again; + } + return (pp); +} + +/* + * Enter page ``pp'' in the hash chains and + * vnode page list as referring to . + */ +int +page_enter(pp, vp, offset) + page_t *pp; + struct vnode *vp; + u_int offset; +{ + int v; + + mon_enter(&page_mplock); + + if (page_find(vp, offset) != NULL) { + /* already entered? */ + v = -1; + } else { +VMLOG(X_PAGEENTER, pp, vp, offset); + page_hashin(pp, vp, offset, 1); + CHECK(vp); + + v = 0; + } + + mon_exit(&page_mplock); + + trace4(TR_PG_ENTER, pp, vp, offset, v); + + return (v); +} + +/* + * page_abort will cause a page to lose its + * identity and to go (back) to the free list. + * XXX - redo page locking and transitions, + * redo page_abort so that we can affort to wait. + */ +void +page_abort(pp) + register page_t *pp; +{ + +VMLOG(X_PAGEABORT, pp, pp->p_vnode, pp->p_offset); + ASSERT (pp >= pages && pp < epages); + if (pp->p_vnode == NULL) { + if (pp->p_free) + return; /* nothing to do */ + } else + pp->p_gone = 1; + /* + * Page is set to go away -- kill any logical locking. + */ + if (pp->p_lckcnt > 0) { + mon_enter(&page_locklock); + pages_pp_locked--; + availrmem++; + pp->p_lckcnt = 0; + mon_exit(&page_locklock); + } + if (pp->p_cowcnt > 0) { + mon_enter(&page_locklock); + pages_pp_locked -= pp->p_cowcnt; + availrmem += pp->p_cowcnt; + pp->p_cowcnt = 0; + mon_exit(&page_locklock); + } + + if (pp->p_keepcnt > 0) { + /* + * We cannot do anything with the page now. + * Hope that page_free is called later when + * the keep count goes back to zero. + */ +VMLOG(X_PAGEABORT_KEPT, pp, pp->p_vnode, pp->p_offset); + trace4(TR_PG_ABORT, pp, pp->p_vnode, pp->p_offset, 1); + return; + } + if (pp->p_intrans) { + /* + * Since the page is already `gone', we can + * just let pvn_done() worry about freeing + * this page later when the IO finishes. + */ +VMLOG(X_PAGEABORT_INTRANS, pp, pp->p_vnode, pp->p_offset); + trace4(TR_PG_ABORT, pp, pp->p_vnode, pp->p_offset, 2); + return; + } + if (pp->p_mapping) { + /* + * Should be ok to just unload now + */ +VMLOG(X_PAGEABORT_UNLOAD, pp, pp->p_vnode, pp->p_offset); + hat_pageunload(pp); + } + pp->p_ref = pp->p_mod = 0; + trace4(TR_PG_ABORT, pp, pp->p_vnode, pp->p_offset, 0); + if (pp->p_free) { +VMLOG(X_PAGEABORT_FREE, pp, pp->p_vnode, pp->p_offset); + /* + * Already on free list - pull the page out of the free + * list so it can be re-entered using page_free() below. + */ + page_unfree(pp); + pagecnt.pc_abortfree++; + } +#ifdef VMDEBUG + else { +VMLOG(X_PAGEABORT_GONE, pp, pp->p_vnode, pp->p_offset); + } +#endif + /* + * Let page_free() do the rest of the work + */ + page_free(pp, 0); +} + +/* + * Put page on the "free" list. The free list is really two circular lists + * with page_freelist and page_cachelist pointers into the middle of the lists. + */ +void +page_free(pp, dontneed) + register page_t *pp; + int dontneed; +{ + register struct vnode *vp; + struct anon *ap; + int s; + + ASSERT (pp >= pages && pp < epages); +#ifdef DEBUG + ASSERT(pp->p_uown == NULL); +#endif + vp = pp->p_vnode; +VMLOG(X_PAGEFREE, pp, vp, pp->p_offset); + + CHECK(vp); + + /* + * If we are a swap page, get rid of corresponding + * page hint pointer in the anon vector (since it is + * easy to do right now) so that we have to find this + * page via a page_lookup to force a reclaim. + */ + if (ap = swap_anon(pp->p_vnode, pp->p_offset)) { + if (ap->an_refcnt > 0) + ap->un.an_page = NULL; + } + + if (pp->p_gone) { +VMLOG(X_PAGEFREE_GONE, pp, vp, pp->p_offset); + if (pp->p_intrans || pp->p_keepcnt != 0) { +VMLOG(X_PAGEFREE_INTRANS, pp, vp, pp->p_offset); + /* + * This page will be freed later from pvn_done + * (intrans) or the segment unlock routine. + * For now, the page will continue to exist, + * but with the "gone" bit on. + */ + trace6(TR_PG_FREE, pp, vp, pp->p_offset, + dontneed, freemem, 0); + return; + } +VMLOG(X_PAGEFREE_NOTINTRANS, pp, vp, pp->p_offset); + if (vp) + page_hashout(pp); + vp = NULL; + } + + if (pp->p_keepcnt != 0 || pp->p_mapping != NULL || pp->p_free || + pp->p_lckcnt != 0 || pp->p_cowcnt != 0) + cmn_err(CE_PANIC, "page_free"); + + s = splimp(); + mon_enter(&page_freelock); + + /* + * Now we add the page to the head of the free list. + * But if this page is associated with a paged vnode + * then we adjust the head forward so that the page is + * effectively at the end of the list. + */ + freemem++; + pp->p_free = 1; + pp->p_ref = pp->p_mod = 0; + if (vp == NULL) { + /* page has no identity, put it on the front of the free list */ + pp->p_age = 1; + page_freelist_size++; + page_add(&page_freelist, pp); + pagecnt.pc_free_free++; + trace6(TR_PG_FREE, pp, vp, pp->p_offset, dontneed, freemem, 1); + } else { + page_cachelist_size++; + page_add(&page_cachelist, pp); + if (!dontneed || nopageage) { + /* move it to the tail of the list */ + page_cachelist = page_cachelist->p_next; + pagecnt.pc_free_cache++; + trace6(TR_PG_FREE, pp, vp, pp->p_offset, + dontneed, freemem, 2); + } else { + pagecnt.pc_free_dontneed++; + trace6(TR_PG_FREE, pp, vp, pp->p_offset, + dontneed, freemem, 3); + } + } + + mon_exit(&page_freelock); + + CHECK(vp); + CHECKFREE(); + + page_unlock(pp); + + if (freemem_wait) { +VMLOG(X_PAGEFREE_FREEMEM_WAIT, pp, freemem, freemem_wait); + freemem_wait = 0; + wakeup((caddr_t)&freemem); + } + (void) splx(s); +} + +STATIC int free_pages = 1; + +void +free_vp_pages(vp, off, len) + register struct vnode *vp; + register u_int off; + u_int len; +{ + extern int swap_in_range(); + register page_t *pp, *epp; + register u_int eoff; + int s; + + eoff = off + len; + + if (free_pages == 0) + return; + if (swap_in_range(vp, off, len)) + return; + CHECK(vp); + /* free_vp_page may take some time so PREEMPT() */ + PREEMPT(); + if ((pp = epp = vp->v_pages) != 0) { + s = splimp(); + do { + ASSERT(pp->p_vnode == vp); + if (pp->p_offset < off || pp->p_offset >= eoff) + continue; + ASSERT( !pp->p_intrans || pp->p_keepcnt); + if (pp->p_mod ) /* XXX somebody needs to handle these */ + continue; + if (pp->p_keepcnt || pp->p_mapping || pp->p_free || + pp->p_lckcnt || pp->p_cowcnt) + continue; + ASSERT(pp >= pages && pp < epages); +VMLOG(X_PAGEFREE, pp, vp, pp->p_offset); + ASSERT(!pp->p_gone); + mon_enter(&page_freelock); + freemem++; + pp->p_free = 1; + pp->p_ref = 0; + page_cachelist_size++; + page_add(&page_cachelist, pp); + page_cachelist = page_cachelist->p_next; + pagecnt.pc_free_cache++; + trace6(TR_PG_FREE, pp, vp, pp->p_offset, + dontneed, freemem, 3); + mon_exit(&page_freelock); + CHECK(vp); + CHECKFREE(); + page_unlock(pp); + } while ((pp = pp->p_vpnext) != epp); + if (freemem_wait && page_cachelist != NULL) { +VMLOG(X_PAGEFREE_FREEMEM_WAIT, pp, freemem, freemem_wait); + freemem_wait = 0; + wakeup((caddr_t)&freemem); + } + splx(s); + } +} + +/* + * Remove the page from the free list. + */ +STATIC void +page_unfree(pp) + register page_t *pp; +{ + + ASSERT (pp >= pages && pp < epages); + if (!pp->p_free) + cmn_err(CE_PANIC, "page_unfree"); + page_sub(pp->p_age ? &page_freelist : &page_cachelist, pp); + if (pp->p_age) { + page_freelist_size--; + } else { + page_cachelist_size--; + } + pp->p_free = pp->p_age = 0; + freemem--; +} + +/* + * Allocate enough pages for bytes of data. + * Return a doubly linked, circular list of pages. + * Must spl around entire routine to prevent races from + * pages being allocated at interrupt level. + */ +page_t * +page_get(bytes, flags) + u_int bytes; + u_int flags; +{ + register page_t *pp; + page_t *plist = NULL; + register int npages; + register int physcontig; + int s, i; + + npages = btopr(bytes); + /* + * Try to see whether request is too large to *ever* be + * satisfied, in order to prevent deadlock. We arbitrarily + * decide to limit maximum size requests to max_page_get. + */ + if (npages >= max_page_get) { + trace4(TR_PAGE_GET, bytes, flags, freemem, 1); + return (plist); + } + + physcontig = ((flags & P_PHYSCONTIG) && (npages > 1)); + + /* + * If possible, wait until there are enough + * free pages to satisfy our entire request. + * + * XXX: Before waiting, we try to arrange to get more pages by + * processing the i/o completion list and prodding the + * pageout daemon. However, there's nothing to guarantee + * that these actions will provide enough pages to satisfy + * the request. In particular, the pageout daemon stops + * running when freemem > lotsfree, so if npages > lotsfree + * there's nothing going on that will bring freemem up to + * a value large enough to satisfy the request. + */ + s = splimp(); + while (freemem < npages) { + +try_again: + if (!(flags & P_CANWAIT)) { + trace4(TR_PAGE_GET, bytes, flags, freemem, 2); + (void) splx(s); + return (plist); + } + /* + * Given that we can wait, call cleanup directly to give + * it a chance to add pages to the free list. This strategy + * avoids the cost of context switching to the pageout + * daemon unless it's really necessary. + */ + if (bclnlist != NULL) { + (void) splx(s); + cleanup(); + s = splimp(); + continue; + } + /* + * There's nothing immediate waiting to become available. + * Turn the pageout daemon loose to find something. + */ + trace1(TR_PAGEOUT_CALL, 0); + outofmem(); + freemem_wait++; + VMLOG(X_PAGEGET_SLEEP, npages, freemem, freemem_wait); + trace4(TR_PAGE_GET_SLEEP, bytes, flags, freemem, 0); + (void) sleep((caddr_t)&freemem, PSWP+2); + trace4(TR_PAGE_GET_SLEEP, bytes, flags, freemem, 1); + } + + mon_enter(&page_freelock); + + if (physcontig) { + register int numpages = npages; + + for(pp = pages; pp < epages; ++pp) { + if (pp->p_free) { + for(++pp; --numpages > 0 && pp < epages; pp++) + if (!pp->p_free) + break; + if (numpages == 0) + break; + numpages = npages; + } + } + + if (numpages != 0) { + mon_exit(&page_freelock); + goto try_again; + } + } + + freemem -= npages; + + VMLOG(X_PAGEGET_GOTMEM, npages, freemem, freemem_wait); + trace4(TR_PAGE_GET, bytes, flags, freemem, 0); + /* + * If satisfying this request has left us with too little + * memory, start the wheels turning to get some back. The + * first clause of the test prevents waking up the pageout + * daemon in situations where it would decide that there's + * nothing to do. (However, it also keeps bclnlist from + * being processed when it otherwise would.) + * + * XXX: Check against lotsfree rather than desfree? + */ + if (nscan < desscan && freemem < desfree) { + trace1(TR_PAGEOUT_CALL, 1); + outofmem(); + } + + /* + * Pull the pages off the free list and build the return list. + */ + while (npages--) { + + if (physcontig) { + --pp; + } else if ((pp = page_freelist) == NULL) { + pp = page_cachelist; + if (pp == NULL) + cmn_err(CE_PANIC, "page_get: freemem error"); + ASSERT(pp->p_age == 0); + } +#ifdef DEBUG + else { + ASSERT(pp->p_age != 0); + ASSERT(pp->p_vnode == NULL); + } +#endif + + if (pp->p_age) { + trace5(TR_PG_ALLOC, pp, pp->p_vnode, pp->p_offset, + 0, 0); + pagecnt.pc_get_free++; + page_sub(&page_freelist, pp); + page_freelist_size--; + } else { + trace5(TR_PG_ALLOC, pp, pp->p_vnode, pp->p_offset, + pp->p_age, 1); + pagecnt.pc_get_cache++; + page_sub(&page_cachelist, pp); + page_cachelist_size--; + if (pp->p_vnode) { + /* destroy old vnode association */ + CHECK(pp->p_vnode); + page_hashout(pp); + } + } + + ASSERT(pp->p_mapping == NULL); + + /* + * Initialize the p_dblist[] fields. + */ + for (i=0; i<(PAGESIZE/NBPSCTR); i++) + pp->p_dblist[i] = -1; + + pp->p_free = pp->p_mod = pp->p_nc = pp->p_age = 0; + pp->p_lock = pp->p_intrans = pp->p_pagein = 0; + pp->p_ref = 1; /* protect against immediate pageout */ + pp->p_keepcnt = 1; /* mark the page as `kept' */ + page_add(&plist, pp); + } + mon_exit(&page_freelock); + CHECKFREE(); + (void) splx(s); + return (plist); +} + +#ifdef DEBUG +/* + * XXX - need to fix up all this page rot! + */ + +/* + * Release a keep count on the page and handle aborting the page if the + * page is no longer held by anyone and the page has lost its identity. + */ +void +page_rele(pp) + page_t *pp; +{ + + mon_enter(&page_mplock); + + ASSERT (pp >= pages && pp < epages); + if (pp->p_keepcnt == 0) /* sanity check */ + cmn_err(CE_PANIC, "page_rele"); + if (--pp->p_keepcnt == 0) { + while (pp->p_want) { + cv_broadcast(&page_mplock, (char *)pp); + pp->p_want = 0; + } + } + + mon_exit(&page_mplock); + + if (pp->p_keepcnt == 0 && (pp->p_gone || pp->p_vnode == NULL)) + page_abort(pp); /* yuck */ +} + +/* + * Lock a page. + */ +void +page_lock(pp) + page_t *pp; +{ + + ASSERT (pp >= pages && pp < epages); + mon_enter(&page_mplock); + while (pp->p_lock) + page_cv_wait(pp); + pp->p_lock = 1; + mon_exit(&page_mplock); +} + +/* + * Unlock a page. + */ +void +page_unlock(pp) + page_t *pp; +{ + + ASSERT (pp >= pages && pp < epages); + mon_enter(&page_mplock); +/* XXX */ + if (pp->p_intrans) + call_debug("page_unlock: unlocking intrans page"); +/* XXX */ + pp->p_lock = 0; + while (pp->p_want) { + cv_broadcast(&page_mplock, (char *)pp); + pp->p_want = 0; + } + mon_exit(&page_mplock); +} +#endif + +/* + * Add page ``pp'' to the hash/vp chains for . + */ +void +page_hashin(pp, vp, offset, lock) + register page_t *pp; + register struct vnode *vp; + u_int offset, lock; +{ + register page_t **hpp; + + ASSERT (pp >= pages && pp < epages); +#ifdef DEBUG + ASSERT(pp->p_uown == NULL); +#endif + pp->p_vnode = vp; + pp->p_offset = offset; + pp->p_lock = lock; + + hpp = &page_hash[PAGE_HASHFUNC(vp, offset)]; + pp->p_hash = *hpp; + *hpp = pp; + + /* + * Add the page to the front of the linked list of pages + * using p_vpnext/p_vpprev pointers for the list. + */ + if (vp->v_pages == NULL) { + pp->p_vpnext = pp->p_vpprev = pp; + } else { + pp->p_vpnext = vp->v_pages; + pp->p_vpprev = vp->v_pages->p_vpprev; + vp->v_pages->p_vpprev = pp; + pp->p_vpprev->p_vpnext = pp; + } + vp->v_pages = pp; + CHECKPP(pp); +} + +/* + * Remove page ``pp'' from the hash and vp chains and remove vp association. + */ +void +page_hashout(pp) + register page_t *pp; +{ + register page_t **hpp, *hp; + register struct vnode *vp; + + ASSERT (pp >= pages && pp < epages); + CHECKPP(pp); + vp = pp->p_vnode; + hpp = &page_hash[PAGE_HASHFUNC(vp, pp->p_offset)]; + for (;;) { + hp = *hpp; + if (hp == pp) + break; + if (hp == NULL) + cmn_err(CE_PANIC, "page_hashout"); + hpp = &hp->p_hash; + } + *hpp = pp->p_hash; + + pp->p_hash = NULL; + pp->p_vnode = NULL; + pp->p_offset = 0; + pp->p_gone = 0; + + /* + * Remove this page from the linked list of pages + * using p_vpnext/p_vpprev pointers for the list. + */ + CHECKPP(pp); + if (vp->v_pages == pp) + vp->v_pages = pp->p_vpnext; /* go to next page */ + + if (vp->v_pages == pp) + vp->v_pages = NULL; /* page list is gone */ + else { + pp->p_vpprev->p_vpnext = pp->p_vpnext; + pp->p_vpnext->p_vpprev = pp->p_vpprev; + } + pp->p_vpprev = pp->p_vpnext = pp; /* make pp a list of one */ +} + +/* + * Add the page to the front of the linked list of pages + * using p_next/p_prev pointers for the list. + */ +STATIC void +page_add(ppp, pp) + register page_t **ppp, *pp; +{ + + ASSERT (pp >= pages && pp < epages); + if (*ppp == NULL) { + pp->p_next = pp->p_prev = pp; + } else { + pp->p_next = *ppp; + pp->p_prev = (*ppp)->p_prev; + (*ppp)->p_prev = pp; + pp->p_prev->p_next = pp; + } + *ppp = pp; + CHECKPP(pp); +} + +/* + * Remove this page from the linked list of pages + * using p_next/p_prev pointers for the list. + */ +void +page_sub(ppp, pp) + register page_t **ppp, *pp; +{ + + ASSERT (pp >= pages && pp < epages); + CHECKPP(pp); + if (*ppp == NULL || pp == NULL) + cmn_err(CE_PANIC, "page_sub"); + + if (*ppp == pp) + *ppp = pp->p_next; /* go to next page */ + + if (*ppp == pp) + *ppp = NULL; /* page list is gone */ + else { + pp->p_prev->p_next = pp->p_next; + pp->p_next->p_prev = pp->p_prev; + } + pp->p_prev = pp->p_next = pp; /* make pp a list of one */ +} + +/* + * Add this page to the list of pages, sorted by offset. + * Assumes that the list given by *ppp is already sorted. + */ +void +page_sortadd(ppp, pp) + register page_t **ppp, *pp; +{ + register page_t *p1; + register u_int off; + + ASSERT (pp >= pages && pp < epages); + CHECKLIST(*ppp); + CHECKPP(pp); + if (*ppp == NULL) { + pp->p_next = pp->p_prev = pp; + *ppp = pp; + } else { + /* + * Figure out where to add the page to keep list sorted + */ + p1 = *ppp; + if (pp->p_vnode != p1->p_vnode && p1->p_vnode != NULL && + pp->p_vnode != NULL) + call_debug("page_sortadd: bad vp"); + + off = pp->p_offset; + if (off < p1->p_prev->p_offset) { + do { + if (off == p1->p_offset) + call_debug("page_sortadd: same offset"); + if (off < p1->p_offset) + break; + p1 = p1->p_next; + } while (p1 != *ppp); + } + + /* link in pp before p1 */ + pp->p_next = p1; + pp->p_prev = p1->p_prev; + p1->p_prev = pp; + pp->p_prev->p_next = pp; + + if (off < (*ppp)->p_offset) + *ppp = pp; /* pp is at front */ + } + CHECKLIST(*ppp); +} + +/* + * Wait for page if kept and then reclaim the page if it is free. + * Caller needs to verify page contents after calling this routine. + */ +void +page_wait(pp) + register page_t *pp; +{ + struct vnode *vp; + u_int offset; + + ASSERT (pp >= pages && pp < epages); + CHECKPP(pp); + vp = pp->p_vnode; + offset = pp->p_offset; + + mon_enter(&page_mplock); + while (pp->p_keepcnt > 0) + page_cv_wait(pp); + mon_exit(&page_mplock); + + /* + * If the page is now on the free list and still has + * its original identity, get it back. If the page + * has lost its old identity, the caller of page_wait + * is responsible for verifying the page contents. + */ + if (pp->p_free && pp->p_vnode == vp && pp->p_offset == offset) + page_reclaim(pp); + CHECKPP(pp); +} + +/* + * Lock a physical page into memory "long term". Used to support "lock + * in memory" functions. Accepts the page to be locked, and a claim variable + * to indicate whether a claim for an extra page should be recorded (to + * support, for instance, a potential copy-on-write). + */ + +/* ARGSUSED */ + +int +page_pp_lock(pp, claim, kernel) + page_t *pp; /* page to be locked */ + int claim; /* amount extra to be claimed */ + int kernel; /* must succeed -- ignore checking */ +{ + int r = 0; /* result -- assume failure */ + + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); + page_lock(pp); + mon_enter(&page_locklock); + + /* To support potential copy-on-write, reserve extra + * page. + */ + if (claim) { + if ((availrmem - 1 ) >= pages_pp_maximum) { + --availrmem; + pages_pp_locked++; + if (pp->p_cowcnt < (u_short) PAGE_LOCK_MAXIMUM) + if (++pp->p_cowcnt == PAGE_LOCK_MAXIMUM) + printf("Page frame 0x%x locked permanently\n", + page_pptonum(pp)); + r = 1; + } + } else { + if (pp->p_lckcnt) { + if (pp->p_lckcnt < (u_short) PAGE_LOCK_MAXIMUM) + if (++pp->p_lckcnt == PAGE_LOCK_MAXIMUM) + printf("Page frame 0x%x locked permanently\n", + page_pptonum(pp)); + r = 1; + } else { + if ((availrmem - 1 ) >= pages_pp_maximum) { + pages_pp_locked++; + --availrmem; + ++pp->p_lckcnt; + r = 1; + } + } + } + mon_exit(&page_locklock); + page_unlock(pp); + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); + return (r); +} + +/* + * Decommit a lock on a physical page frame. Account for claims if + * appropriate. + */ + +/* ARGSUSED */ + +void +page_pp_unlock(pp, claim, kernel) + page_t *pp; /* page to be unlocked */ + int claim; /* amount to be unclaimed */ + int kernel; /* this was a kernel lock */ +{ + + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); + page_lock(pp); + mon_enter(&page_locklock); + if (claim) { + ASSERT(pp->p_cowcnt > 0); + pp->p_cowcnt--; + pages_pp_locked--; + availrmem++; + } else { + ASSERT(pp->p_lckcnt > 0); + if (--pp->p_lckcnt == 0) { + pages_pp_locked--; + availrmem++; + } + } + mon_exit(&page_locklock); + page_unlock(pp); + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); +} + +/* + * Transfer a claim to a real lock on a physical page. Used after a + * copy-on-write of a locked page has occurred. + */ +void +page_pp_useclaim(opp, npp) + page_t *opp; /* original page frame losing lock */ + page_t *npp; /* new page frame gaining lock */ +{ + + ASSERT((short)opp->p_lckcnt >= 0); + ASSERT((short)opp->p_cowcnt >= 0); + ASSERT((short)npp->p_lckcnt >= 0); + ASSERT((short)npp->p_cowcnt >= 0); + page_lock(npp); + page_lock(opp); + mon_enter(&page_locklock); + npp->p_lckcnt++; + ASSERT(opp->p_cowcnt); + opp->p_cowcnt--; + mon_exit(&page_locklock); + page_unlock(opp); + page_unlock(npp); + ASSERT((short)opp->p_lckcnt >= 0); + ASSERT((short)opp->p_cowcnt >= 0); + ASSERT((short)npp->p_lckcnt >= 0); + ASSERT((short)npp->p_cowcnt >= 0); +} + +/* + * Simple claim adjust functions -- used to support to support changes in + * claims due to changes in access permissions. + */ +int +page_addclaim(pp) + page_t *pp; /* claim count to add */ +{ + int r = 1; /* result */ + + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); + mon_enter(&page_locklock); + ASSERT(pp->p_lckcnt > 0); + if (--pp->p_lckcnt == 0) { + pp->p_cowcnt++; + } else { + if ((availrmem - 1 ) >= pages_pp_maximum) { + --availrmem; + pages_pp_locked++; + if (pp->p_cowcnt < (u_short) PAGE_LOCK_MAXIMUM) + if (++pp->p_cowcnt == PAGE_LOCK_MAXIMUM) + printf("Page frame 0x%x locked permanently\n", + page_pptonum(pp)); + } else { + pp->p_lckcnt++; + r = 0; + } + } + mon_exit(&page_locklock); + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); + return (r); +} + +void +page_subclaim(pp) + page_t *pp; /* claim count to remove */ +{ + + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); + mon_enter(&page_locklock); + ASSERT(pp->p_cowcnt > 0); + pp->p_cowcnt--; + if (pp->p_lckcnt) { + availrmem++; + pages_pp_locked--; + } + pp->p_lckcnt++; + mon_exit(&page_locklock); + ASSERT((short)pp->p_lckcnt >= 0); + ASSERT((short)pp->p_cowcnt >= 0); +} + +/* + * Simple functions to transform a page pointer to a + * physical page number and vice versa. For now assume + * pages refers to the page number pages_base and pages + * increase from there with one page structure per + * PAGESIZE / MMU_PAGESIZE physical page frames. + */ + +#ifdef sun386 +u_int +page_pptonum(pp) + page_t *pp; +{ + if (pp > epages2) + cmn_err(CE_PANIC, "page_pptonum"); + + if (pp >= epages) + return ((u_int)((pp - epages) * (PAGESIZE/MMU_PAGESIZE)) + + pages_base2); + + return ((u_int)((pp - pages) * (PAGESIZE/MMU_PAGESIZE)) + pages_base); +} + +page_t * +page_numtopp(pfn) + register u_int pfn; +{ + if (pfn >= pages_base2 && pfn < pages_end2) + return (&epages[(pfn - pages_base2)/(PAGESIZE/MMU_PAGESIZE)]); + + if (pfn < pages_base || pfn >= pages_end) + return ((page_t *)NULL); + else + return (&pages[(pfn - pages_base) / (PAGESIZE/MMU_PAGESIZE)]); +} + +#else + +#ifdef DEBUG + +u_int +page_pptonum(pp) + page_t *pp; +{ + return ((u_int)((pp - pages) * (PAGESIZE/MMU_PAGESIZE)) + pages_base); +} + +page_t * +page_numtopp(pfn) + register u_int pfn; +{ + if (pfn < pages_base || pfn >= pages_end) + return ((page_t *)NULL); + else + return (&pages[(pfn - pages_base) / (PAGESIZE/MMU_PAGESIZE)]); +} +#endif /*DEBUG*/ +#endif /*sun386*/ + +/* + * This routine is like page_numtopp, but will only return page structs + * for pages which are ok for loading into hardware using the page struct. + */ +page_t * +page_numtookpp(pfn) + register u_int pfn; +{ + register page_t *pp; + +#ifdef sun386 + if (pfn >= pages_base2 && pfn < pages_end2) { + pp = &epages[(pfn - pages_base2) / (PAGESIZE/MMU_PAGESIZE)]; + if (pp->p_free || pp->p_gone) + return ((page_t *)NULL); + return (pp); + } +#endif + + if (pfn < pages_base || pfn >= pages_end) + return ((page_t *)NULL); + pp = &pages[(pfn - pages_base) / (PAGESIZE/MMU_PAGESIZE)]; + if (pp->p_free || pp->p_gone) + return ((page_t *)NULL); + return (pp); +} + +/* + * This routine is like page_numtopp, but will only return page structs + * for pages which are ok for loading into hardware using the page struct. + * If not for the things like the window system lock page where we + * want to make sure that the kernel and the user are exactly cache + * consistent, we could just always return a NULL pointer here since + * anyone mapping physical memory isn't guaranteed all that much + * on a virtual address cached machine anyways. The important thing + * here is not to return page structures for things that are possibly + * currently loaded in DVMA space, while having the window system lock + * page still work correctly. + */ +page_t * +page_numtouserpp(pfn) + register u_int pfn; +{ + register page_t *pp; + +#ifdef sun386 + if (pfn >= pages_base2 && pfn < pages_end2) { + pp = &epages[(pfn - pages_base2) / (PAGESIZE/MMU_PAGESIZE)]; + if (pp->p_free || pp->p_gone || pp->p_intrans || pp->p_lock || + /* is this page possibly involved in indirect (raw) IO */ + (pp->p_keepcnt > 0 && pp->p_vnode != NULL)) + return ((page_t *)NULL); + return (pp); + } +#endif + + if (pfn < pages_base || pfn >= pages_end) + return ((page_t *)NULL); + pp = &pages[(pfn - pages_base) / (PAGESIZE/MMU_PAGESIZE)]; + if (pp->p_free || pp->p_gone || pp->p_intrans || pp->p_lock || + /* is this page possibly involved in indirect (raw) IO? */ + (pp->p_keepcnt > 0 && pp->p_vnode != NULL)) + return ((page_t *)NULL); + return (pp); +} + +/* + * Debugging routine only! + * XXX - places calling this either need to + * remove the test altogether or call cmn_err(CE_PANIC). + */ +#include "vm/reboot.h" +#include "vm/debugger.h" + +extern int call_demon(); + +void +call_debug(mess) + char *mess; +{ + cmn_err(CE_WARN, mess); + call_demon(); +} + +#ifdef PAGE_DEBUG +/* + * Debugging routine only! + */ +STATIC void +page_vp_check(vp) + register struct vnode *vp; +{ + register page_t *pp; + int count = 0; + int err = 0; + + if (vp == NULL) + return; + + if ((pp = vp->v_pages) == NULL) { + /* random check to see if no pages on this vp exist */ + if ((pp = page_find(vp, 0)) != NULL) { + cmn_err(CE_CONT, "page_vp_check: pp=%x on NULL vp list\n", vp); + call_debug("page_vp_check"); + } + return; + } + + do { + if (pp->p_vnode != vp) { + cmn_err(CE_CONT, "pp=%x pp->p_vnode=%x, vp=%x\n", + pp, pp->p_vnode, vp); + err++; + } + if (pp->p_vpnext->p_vpprev != pp) { + cmn_err(CE_CONT, "pp=%x, pp->p_vpnext=%x, pp->p_vpnext->p_vpprev=%x\n", + pp, pp->p_vpnext, pp->p_vpnext->p_vpprev); + err++; + } + if (++count > 10000) { + cmn_err(CE_CONT, "vp loop\n"); + err++; + break; + } + pp = pp->p_vpnext; + } while (err == 0 && pp != vp->v_pages); + + if (err) + call_debug("page_vp_check"); +} + +/* + * Debugging routine only! + */ +STATIC void +page_free_check() +{ + int err = 0; + int count = 0; + register page_t *pp; + + if (page_freelist != NULL) { + pp = page_freelist; + do { + if (pp->p_free == 0 || pp->p_age == 0) { + err++; + cmn_err(CE_CONT, "page_free_check: pp = %x\n", pp); + } + count++; + pp = pp->p_next; + } while (pp != page_freelist); + } + if (page_cachelist != NULL) { + pp = page_cachelist; + do { + if (pp->p_free == 0 || pp->p_age != 0) { + err++; + cmn_err(CE_CONT, "page_free_check: pp = %x\n", pp); + } + count++; + pp = pp->p_next; + } while (pp != page_cachelist); + } + + if (err || count != freemem) { + cmn_err(CE_CONT, "page_free_check: count = %x, freemem = %x\n", + count, freemem); + call_debug("page_check_free"); + } +} + +/* + * Debugging routine only! + * Verify that the list is properly sorted by offset on same vp + */ +void +page_list_check(plist) + page_t *plist; +{ + register page_t *pp = plist; + + if (pp == NULL) + return; + while (pp->p_next != plist) { + if (pp->p_next->p_offset <= pp->p_offset || + pp->p_vnode != pp->p_next->p_vnode) { + cmn_err(CE_CONT, "pp = %x <%x, %x> pp next = %x <%x, %x>\n", + pp, pp->p_vnode, pp->p_offset, pp->p_next, + pp->p_next->p_vnode, pp->p_next->p_offset); + call_debug("page_list_check"); + } + pp = pp->p_next; + } +} + +/* + * Debugging routine only! + * Verify that pp is actually on vp page list. + */ +void +page_pp_check(pp) + register page_t *pp; +{ + register page_t *p1; + register struct vnode *vp; + + if ((vp = pp->p_vnode) == (struct vnode *)NULL) + return; + + if ((p1 = vp->v_pages) == (page_t *)NULL) { + cmn_err(CE_CONT, "pp = %x, vp = %x\n", pp, vp); + call_debug("NULL vp page list"); + return; + } + + do { + if (p1 == pp) + return; + } while ((p1 = p1->p_vpnext) != vp->v_pages); + + cmn_err(CE_CONT, "page %x not on vp %x page list\n", pp, vp); + call_debug("vp page list"); +} +#endif /* PAGE_DEBUG */ + +/* + * The following are used by the sys3b S3BDELMEM and S3BADDMEM + * functions. + */ + +STATIC page_t *Delmem; /* Linked list of deleted pages. */ +STATIC int Delmem_cnt; /* Count of number of deleted pages. */ + +STATIC int +page_delmem(count) + register int count; +{ + register page_t *pp; + + if (freemem < count + || availrmem - count < tune.t_minarmem + || availsmem - count < tune.t_minasmem) { + return EINVAL; + } + + while (count > 0) { + page_t **ppl; + + ppl = &Delmem; + + pp = page_get(PAGESIZE, P_NOSLEEP); + if (pp == NULL) + return EINVAL; + page_add(ppl, pp); + + count--; + Delmem_cnt++; + availrmem--; + availsmem--; + } + + return(0); +} + +STATIC int +page_addmem(count) + register int count; +{ + register page_t *pp; + + while (count > 0) { + page_t **ppl; + + pp = *(ppl = &Delmem); + if (pp == NULL) + return EINVAL; + page_sub(ppl, pp); + page_rele(pp); + + count--; + Delmem_cnt--; + availrmem++; + availsmem++; + } + + return(0); +} + +int +page_deladd(add, count, rvp) + register int count; + rval_t *rvp; +{ + register int error; + + if (add) + error = page_addmem(count); + else + error = page_delmem(count); + if (error == 0) { + if (add) + rvp->r_val1 = freemem; + else + rvp->r_val1 = Delmem_cnt; + } + return(error); +} + +/* + * Debugging routine only! + */ + +STATIC void +page_print(pp) + register page_t *pp; +{ + register struct vnode *vp; + + cmn_err(CE_CONT, "^mapping 0x%x nio %d keepcnt %d lck %d cow %d", + pp->p_mapping, pp->p_nio, pp->p_keepcnt, + pp->p_lckcnt, pp->p_cowcnt); + cmn_err(CE_CONT, "^%s%s%s%s%s%s%s%s%s\n", + (pp->p_lock) ? " LOCK" : "" , + (pp->p_want) ? " WANT" : "" , + (pp->p_free) ? " FREE" : "" , + (pp->p_intrans) ? " INTRANS" : "" , + (pp->p_gone) ? " GONE" : "" , + (pp->p_mod) ? " MOD" : "" , + (pp->p_ref) ? " REF" : "" , + (pp->p_pagein) ? " PAGEIN" : "" , + (pp->p_age) ? " AGE" : "" ); + cmn_err(CE_CONT, "^vnode 0x%x, offset 0x%x", + pp->p_vnode, pp->p_offset); + if (swap_anon(pp->p_vnode, pp->p_offset)) + cmn_err(CE_CONT, "^ (ANON)"); + else if ((vp = pp->p_vnode) != 0) + cmn_err(CE_CONT, "^ v_flag 0x%x, v_count %d, v_type %d", + vp->v_flag, vp->v_count, vp->v_type); + cmn_err(CE_CONT, "^\nnext 0x%x, prev 0x%x, vpnext 0x%x vpprev 0x%x\n", + pp->p_next, pp->p_prev, pp->p_vpnext, pp->p_vpprev); +} + +void +phystopp(v) +{ + int pfn; + page_t *pp; + + pfn = v >> PAGESHIFT; + cmn_err(CE_CONT, "^pfn=0x%x, ", pfn); + pp = page_numtopp(pfn); + if (pp) + cmn_err(CE_CONT, "^pp=0x%x\n", pp); + else + cmn_err(CE_CONT, "^pp=NULL\n"); +} + +void +pptophys(pp) + page_t *pp; +{ + int pfn; + + pfn = ((u_int)((pp - pages) * (PAGESIZE/MMU_PAGESIZE)) + pages_base); + cmn_err(CE_CONT, "^pfn=0x%x, ", pfn); + cmn_err(CE_CONT, "^phys=0x%x\n", ctob(pfn)); +} + +xpage_find(vp, off) + register struct vnode *vp; + register u_int off; +{ + register page_t *pp; + register int len = 0; + + for (pp = page_hash[PAGE_HASHFUNC(vp, off)]; pp; pp = pp->p_hash, len++) + if (pp->p_vnode == vp && pp->p_offset == off) { + if (pp->p_gone == 0) + return 0; + } + return 1; +} + +void +findpage(vp, off) + register struct vnode *vp; + register u_int off; +{ + register page_t *pp; + register int len = 0; + register int found = 0; + + for (pp = page_hash[PAGE_HASHFUNC(vp, off)]; pp; pp = pp->p_hash, len++) + if (pp->p_vnode == vp && pp->p_offset == off) { + if (found++) + cmn_err(CE_CONT, "^\t\t\t\t\t\t "); + cmn_err(CE_CONT, "^%x %s%s%s%s%s%s%s%s%s %d\n", + pp, + (pp->p_lock) ? "L" : " " , + (pp->p_want) ? "W" : " " , + (pp->p_free) ? "F" : " " , + (pp->p_intrans) ? "I" : " " , + (pp->p_gone) ? "G" : " " , + (pp->p_mod) ? "M" : " " , + (pp->p_ref) ? "R" : " " , + (pp->p_pagein) ? "P" : " " , + (pp->p_age) ? "A" : "" , + pp->p_keepcnt); + } + if (found == 0) + cmn_err(CE_CONT, "^not found\n"); +} + + diff --git a/usr/src/uts/3b2/vm/vm_pvn.c b/usr/src/uts/3b2/vm/vm_pvn.c new file mode 100644 index 0000000..5ff6b2b --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_pvn.c @@ -0,0 +1,976 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_pvn.c 1.19" + +/* + * VM - paged vnode. + * + * This file supplies vm support for the vnode operations that deal with pages. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/sysmacros.h" +#include "sys/systm.h" +#include "sys/inline.h" +#include "sys/time.h" +#include "sys/buf.h" +#include "sys/vnode.h" +#include "sys/uio.h" +#include "sys/vmmeter.h" +#include "sys/vmsystm.h" +#include "sys/mman.h" +#include "sys/vfs.h" +#include "sys/cred.h" +#include "sys/kmem.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" +#include "sys/sysinfo.h" +#include "vm/trace.h" + +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/rm.h" +#include "vm/pvn.h" +#include "vm/page.h" +#include "vm/seg_map.h" +#include "vm/vmlog.h" + +extern void bp_mapout(); +extern int kzero(); +extern void pageio_done(); + +STATIC int pvn_debug = 0; +STATIC int pvn_nofodklust = 0; +STATIC int pvn_range_noklust = 0; + +#define dprint if (pvn_debug) cmn_err +#define dprint2 if (pvn_debug > 1) cmn_err +#define dprint3 if (pvn_debug > 2) cmn_err + +/* + * Find the largest contiguous block which contains `addr' for file offset + * `offset' in it while living within the file system block sizes (`vp_off' + * and `vp_len') and the address space limits for which no pages currently + * exist and which map to consecutive file offsets. + */ +page_t * +pvn_kluster(vp, off, seg, addr, offp, lenp, vp_off, vp_len, isra) + struct vnode *vp; + register u_int off; + register struct seg *seg; + register addr_t addr; + u_int *offp, *lenp; + u_int vp_off, vp_len; + int isra; +{ + register int delta, delta2; + register page_t *pp; + page_t *plist = NULL; + addr_t straddr; + int bytesavail; + u_int vp_end; + + ASSERT(off >= vp_off && off < vp_off + vp_len); + + /* + * We only want to do klustering/read ahead if there + * is more than minfree pages currently available. + */ + if (freemem - minfree > 0) + bytesavail = ptob(freemem - minfree); + else + bytesavail = 0; + + if (bytesavail == 0) { + if (isra) + return ((page_t *)NULL); /* ra case - give up */ + else + bytesavail = PAGESIZE; /* just pretending */ + } + + if (bytesavail < vp_len) { + /* + * Don't have enough free memory for the + * max request, try sizing down vp request. + */ + delta = off - vp_off; + vp_len -= delta; + vp_off += delta; + if (bytesavail < vp_len) { + /* + * Still not enough memory, just settle for + * bytesavail which is at least PAGESIZE. + */ + vp_len = bytesavail; + } + } + + vp_end = vp_off + vp_len; + ASSERT(off >= vp_off && off < vp_end); + + if (page_find(vp, off)) + return ((page_t *)NULL); /* already have page */ + + if (vp_len <= PAGESIZE || pvn_nofodklust) { + straddr = addr; + *offp = off; + *lenp = MIN(vp_len, PAGESIZE); + } else { + /* scan forward from front */ + for (delta = PAGESIZE; off + delta < vp_end; + delta += PAGESIZE) { + if (page_find(vp, off + delta)) + break; /* already have this page */ + /* + * Call back to the segment driver to verify that + * the klustering/read ahead operation makes sense. + */ + if ((*seg->s_ops->kluster)(seg, addr, delta)) + break; /* page not file extension */ + } + delta2 = delta; + + /* scan back from front */ + for (delta = 0; off + delta > vp_off; delta -= PAGESIZE) { + if (page_find(vp, off + delta - PAGESIZE)) + break; /* already have the page */ + /* + * Call back to the segment driver to verify that + * the klustering/read ahead operation makes sense. + */ + if ((*seg->s_ops->kluster)(seg, addr, delta - PAGESIZE)) + break; /* page not eligible */ + } + + straddr = addr + delta; + *offp = off = off + delta; + *lenp = delta2 - delta; + ASSERT(off >= vp_off); + + if ((vp_off + vp_len) < (off + *lenp)) { + ASSERT(vp_end > off); + *lenp = vp_end - off; + } + } + + /* + * Allocate pages for at for delta bytes. + * Note that for the non-read ahead case we might not have the + * memory available right now so that rm_allocpage operation could + * sleep and someone else might race to this same spot if the + * vnode object was not locked before this routine was called. + */ + delta2 = *lenp; + delta = roundup(delta2, PAGESIZE); + /* `pp' list kept */ + pp = rm_allocpage(seg, straddr, (u_int)delta, P_CANWAIT); + + plist = pp; + do { + pp->p_intrans = 1; + pp->p_pagein = 1; + +#ifdef TRACE + { + addr_t taddr = straddr + (off - *offp); + + trace3(TR_SEG_KLUSTER, seg, taddr, isra); + trace6(TR_SEG_ALLOCPAGE, seg, taddr, TRC_SEG_UNK, + vp, off, pp); + } +#endif /* TRACE */ + if (page_enter(pp, vp, off)) { /* `pp' locked if ok */ + /* + * Oops - somebody beat us to the punch + * and has entered the page before us. + * To recover, we use pvn_fail to free up + * all the pages we have already allocated + * and we return NULL so that whole operation + * is attempted over again. This should never + * happen if the caller of pvn_kluster does + * vnode locking to prevent multiple processes + * from creating the same pages as the same time. + */ +dprint(CE_CONT, "pvn_kluster: page exists, aborting %x <%x, %x>\n", pp, vp, off); + pvn_fail(plist, B_READ); + return ((page_t *)NULL); + } + off += PAGESIZE; + } while ((pp = pp->p_next) != plist); + + return (plist); +} + +/* + * Entry point to be use by page r/w subr's and other such routines which + * want to report an error and abort a list of pages setup for pageio + * which do not do though the normal pvn_done processing. + */ +void +pvn_fail(plist, flags) + page_t *plist; + int flags; +{ + static struct buf abort_buf; + struct buf *bp; + page_t *pp; + int len; + int s; + +VMLOG(X_PVNFAIL, plist, plist->p_vnode, plist->p_offset); + len = 0; + pp = plist; + do { + len += PAGESIZE; + } while ((pp = pp->p_next) != plist); + + bp = &abort_buf; + s = splimp(); + while (bp->b_pages != NULL) { +dprint(CE_CONT, "pvn_fail: abort_buf busy, sleeping - plist %x, flags %x\n", + plist, flags); + (void) sleep((caddr_t)&bp->b_pages, PSWP+2); + } +dprint(CE_CONT, "pvn_fail: aborting - plist %x, flags %x\n", plist, flags); + (void) splx(s); + /* ~B_PAGEIO is a flag to pvn_done not to pageio_done the bp */ + bp->b_flags = B_KERNBUF | B_ERROR | B_ASYNC | (flags & ~B_PAGEIO); + bp->b_pages = plist; + bp->b_bcount = len; + pvn_done(bp); /* let pvn_done do all the work */ + if (bp->b_pages != NULL) { + /* XXX - this should never happen, should it be a panic? */ +dprint(CE_CONT, "pvn_fail: page list not empty! - plist %x\n", plist); + bp->b_pages = NULL; + } + wakeup((caddr_t)&bp->b_pages); +} + +/* + * Routine to be called when pageio's complete. + * + * XXX - need to check all the page transitions + */ +void +pvn_done(bp) + register struct buf *bp; +{ + register page_t *pp; + register int bytes; + + pp = bp->b_pages; +VMLOG(X_PVNDONE, bp, pp->p_vnode, pp->p_offset); + + /* + * Release any I/O mappings to the pages described by the + * buffer that are finished before processing the completed I/O. + */ + if ((bp->b_flags & B_REMAPPED) && (pp->p_nio <= 1)) + bp_mapout(bp); + + /* + * Handle of each page in the I/O operation. + */ + for (bytes = 0; bytes < bp->b_bcount; bytes += PAGESIZE) { + if (pp->p_nio > 1) { + /* + * There were multiple IO requests outstanding + * for this particular page. This can happen + * when the file system block size is smaller + * than PAGESIZE. Since there are more IO + * requests still outstanding, we don't process + * the page given on the buffer now. + */ + if (bp->b_flags & B_ERROR) { + if (bp->b_flags & B_READ) { +dprint(CE_CONT, "page read failure with nio %d on <%x, %x>, aborting page %x\n", + pp->p_nio, pp->p_vnode, pp->p_offset, pp); + trace3(TR_PG_PVN_DONE, pp, pp->p_vnode, + pp->p_offset); + page_abort(pp); /* assumes no waiting */ + } else { +dprint(CE_CONT, "page write failure with nio %d on <%x, %x>, marking page %x dirty\n", + pp->p_nio, pp->p_vnode, pp->p_offset, pp); + pp->p_mod = 1; + } + } + pp->p_nio--; + break; + /* real page locked for the other io operations */ + } + + pp = bp->b_pages; + page_sub(&bp->b_pages, pp); +VMLOG(X_PVNDONE_OTHER, pp, pp->p_vnode, pp->p_offset); + + pp->p_intrans = 0; + pp->p_pagein = 0; + + PAGE_RELE(pp); + +VMLOG(X_PVNDONE_PAGE, pp, pp->p_vnode, pp->p_offset); + + /* + * Check to see if page was freed by the PAGE_RELE() + */ + if (pp->p_free) + continue; + + /* + * Check to see if the page is now gone or has error + */ + if ((pp->p_gone || pp->p_vnode == NULL || + ((bp->b_flags & (B_ERROR|B_READ)) == (B_ERROR|B_READ)))) { +dprint2(CE_CONT, "pvn_done aborting page %x <%x, %x>\n", pp, pp->p_vnode, pp->p_offset); + page_abort(pp); + continue; + } + + /* + * Check if we are going to do invalidation + */ + if ((bp->b_flags & B_INVAL) != 0) { +VMLOG(X_PVNDONE_INVAL, bp, bp->b_flags, pp); +dprint2(CE_CONT, "pvn_done invalidate %x <%x, %x>\n", pp, pp->p_vnode, pp->p_offset); + page_abort(pp); + continue; + } + + if ((bp->b_flags & (B_ERROR | B_READ)) == B_ERROR) { +VMLOG(X_PVNDONE_WRITE_ERR, bp, bp->b_flags, pp); + if (bp->b_flags & B_FREE) { +dprint2(CE_CONT, "pageout failure [ENOMEM?] on <%x, %x>, making page %x dirty again\n", + pp->p_vnode, pp->p_offset, pp); + } else { +dprint(CE_CONT, "page write failure on <%x, %x>, making page %x dirty again\n", + pp->p_vnode, pp->p_offset, pp); + } + /* + * Write operation failed. We don't want + * to abort (or free) the page. We set + * the mod bit again so it will get + * written back again later when things + * are hopefully better again. + */ + pp->p_mod = 1; + } + + if (bp->b_flags & B_FREE) { + cnt.v_pgpgout++; + vminfo.v_pgpgout++; + if (pp->p_keepcnt == 0) { + /* + * Check if someone has reclaimed the + * page. If no ref or mod, no one is + * using it so we can free it. + * The rest of the system is careful + * to use hat_ghostunload to unload + * translations set up for IO w/o + * affecting ref and mod bits. + */ + if (pp->p_mod == 0 && pp->p_mapping) + hat_pagesync(pp); + if ((!pp->p_ref && !pp->p_mod) || + pp->p_gone || pp->p_vnode == NULL) { + if (pp->p_mapping) + hat_pageunload(pp); +VMLOG(X_PVNDONE_DIRTY_FREE, pp, *(int *)pp, pp->p_offset); + page_free(pp, + (int)(bp->b_flags & B_DONTNEED)); + cnt.v_dfree++; + vminfo.v_dfree++; + } else { +dprint2(CE_CONT, "page %x reclaimed, ref %d mod %d\n", pp, pp->p_ref, pp->p_mod); + page_unlock(pp); + cnt.v_pgrec++; + vminfo.v_pgrec++; + } + } else { +VMLOG(X_PVNDONE_DIRTY_UNLOCK, pp, *(int *)pp, pp->p_offset); + page_unlock(pp); + } + continue; + } + +VMLOG(X_PVNDONE_UNLOCK, pp, *(int *)pp, pp->p_offset); + page_unlock(pp); /* a read or write */ + } + + /* + * Count pageout operations if applicable. Release the + * buf struct associated with the operation if async & pageio. + */ + if (bp->b_flags & B_FREE) { + cnt.v_pgout++; + vminfo.v_pgout++; + } + if ((bp->b_flags & (B_ASYNC | B_PAGEIO)) == (B_ASYNC | B_PAGEIO)) + pageio_done(bp); +} + +/* + * Flags are composed of {B_ASYNC, B_INVAL, B_FREE, B_DONTNEED, B_DELWRI} + * B_DELWRI indicates that this page is part of a kluster operation and + * is only to be considered if it doesn't involve any waiting here. + * Returns non-zero if page added to dirty list. + */ +STATIC int +pvn_getdirty(pp, dirty, flags) + register page_t *pp, **dirty; + int flags; +{ + struct vnode *vp; + u_int offset; + + vp = pp->p_vnode; + offset = pp->p_offset; + if (pp->p_free) { + if ((flags & B_INVAL) != 0) { + /* + * Since the page is already clean, + * we can just abort it here. + */ +VMLOG(X_PVNDIRTY_ABORT, pp, pp->p_offset, flags); + page_abort(pp); + } +VMLOG(X_PVNDIRTY_FREE_RET, pp, pp->p_offset, flags); + return (0); + } + + if ((flags & B_DELWRI) != 0 && (pp->p_keepcnt > 0 || pp->p_lock)) { + /* + * This is a klusting case that would + * case us to block, just give up. + */ + return (0); + } + + if (pp->p_intrans && (flags & (B_INVAL | B_ASYNC)) == B_ASYNC) { + /* + * Don't bother waiting for an intrans page if we are not + * doing invalidation and this is an async operation + * (the page will be correct when the current io completes). + */ +VMLOG(X_PVNDIRTY_INTRANS, pp, pp->p_offset, flags); + return (0); + } + + /* + * XXX - the following code is a hack to try and avoid a deadlock + * when someone is trying to lock pages for a nfsd request, but + * hasn't gotten them all while this process has gotten the + * inode locked for an async putpage call for a system sync + * and is about to wait below on the page held by the nfsd. + */ + if (flags == B_ASYNC && pp->p_keepcnt > 0) + return (0); + + /* + * If we have to invalidate or free the page, + * wait for the page keep count to go to zero. + */ + if ((flags & (B_INVAL | B_FREE)) != 0) { + while (pp->p_keepcnt > 0) { +VMLOG(X_PVNDIRTY_WAIT, pp, *(int *)pp, pp->p_offset); + page_wait(pp); + } + } + +VMLOG(X_PVNDIRTY_LOCK, pp, pp->p_vnode, pp->p_offset); + page_lock(pp); + + if (pp->p_vnode != vp || pp->p_offset != offset) { + /* + * Lost the page - nothing to do? + */ +VMLOG(X_PVNDIRTY_LOST, pp, pp->p_vnode, vp); + page_unlock(pp); + return (0); + } + + /* + * If the page has mappings and it is not the case that the + * page is already marked dirty and we are going to unload + * the page below because we are going to free/invalidate + * it, then we sync current mod bits from the hat layer now. + */ + if (pp->p_mapping && !(pp->p_mod && (flags & (B_FREE | B_INVAL)) != 0)) + hat_pagesync(pp); + + if (pp->p_mod == 0) { +VMLOG(X_PVNDIRTY_NOMOD, pp, pp->p_vnode, pp->p_offset); + if ((flags & (B_INVAL | B_FREE)) != 0) { + if (pp->p_mapping) + hat_pageunload(pp); + if ((flags & B_INVAL) != 0) { +VMLOG(X_PVNDIRTY_INVAL, pp, pp->p_vnode, pp->p_offset); + page_unlock(pp); + page_abort(pp); + return (0); + } + if (pp->p_free == 0) { + if ((flags & B_FREE) != 0) { +VMLOG(X_PVNDIRTY_FREE, pp, pp->p_vnode, pp->p_offset); + page_free(pp, (flags & B_DONTNEED)); + return (0); + } + } + } +VMLOG(X_PVNDIRTY_NOMOD_RET, pp, pp->p_vnode, pp->p_offset); + page_unlock(pp); + return (0); + } + + /* + * Page is dirty, get it ready for the write back + * and add page to the dirty list. First unload + * the page if we are going to free/invalidate it. + */ + if (pp->p_mapping && (flags & (B_FREE | B_INVAL)) != 0) + hat_pageunload(pp); + pp->p_mod = 0; + pp->p_ref = 0; + trace3(TR_PG_PVN_GETDIRTY, pp, pp->p_vnode, pp->p_offset); + pp->p_intrans = 1; + pp->p_pagein = (flags & B_INVAL) ? 1 : 0; + PAGE_HOLD(pp); + page_sortadd(dirty, pp); +VMLOG(X_PVNDIRTY_ADD, pp, pp->p_vnode, pp->p_offset); + return (1); +} + +/* + * Run down the vplist and handle all pages whose offset is >= off. + * Returns a list of dirty kept pages all ready to be written back. + * + * Assumptions: + * The vp is already locked by the VOP_PUTPAGE routine calling this. + * That the VOP_GETPAGE also locks the vp, and thus no one can + * add a page to the vp list while the vnode is locked. + * Flags are {B_ASYNC, B_INVAL, B_FREE, B_DONTNEED} + */ +page_t * +pvn_vplist_dirty(vp, off, flags) + register struct vnode *vp; + u_int off; + int flags; +{ + register page_t *pp; + register page_t *ppnext; + register page_t *ppsav; + register int ppnext_wasfree, ppsav_wasfree; + register int ppnext_age, ppsav_age; + page_t *dirty; + + if (vp->v_type == VCHR || (pp = vp->v_pages) == NULL) + return ((page_t *)NULL); + +#define PAGE_KEEP(pp, wasfree, age) \ +{ \ + if ((pp)->p_free) { \ + age = (pp)->p_age; \ + page_reclaim(pp); \ + wasfree = 1; \ + } else { \ + age = wasfree = 0; \ + } \ + PAGE_HOLD(pp); \ +} +#define PAGE_UNKEEP(pp, wasfree, age) \ +{ \ + PAGE_RELE(pp); \ + if (wasfree && (pp)->p_keepcnt == 0 && (pp)->p_mapping == NULL) \ + page_free(pp, age); \ +} + + /* + * Traverse the page list. We have to be careful since pages + * can be removed from the vplist while we are looking at it + * (a page being pulled off the free list for something else, + * or an async io operation completing and the page and/or + * bp is marked for invalidation) so have to be careful determining + * that we have examined all the pages. We use ppsav to point + * to the first page that stayed on the vp list after calling + * pvn_getdirty and we PAGE_KEEP it to prevent it from going away + * on us. When we PAGE_UNKEEP the page, it will go back to + * the free list if that's where we got it from. We also need + * to PAGE_KEEP the next pp in the vplist to prevent it from + * going away while we are traversing the list. + */ + + ppnext = NULL; + ppnext_age = ppnext_wasfree = 0; + + ppsav = NULL; + ppsav_age = ppsav_wasfree = 0; + + dirty = NULL; + + do { + if (ppnext != NULL) { +VMLOG(X_VPLIST_UNKEEP_NEXTL, pp, ppnext, ppnext_wasfree); + PAGE_UNKEEP(ppnext, ppnext_wasfree, ppnext_age); + } + + if (pp->p_vpnext != pp) { + ppnext = pp->p_vpnext; + PAGE_KEEP(ppnext, ppnext_wasfree, ppnext_age); +VMLOG(X_VPLIST_KEEP_NEXT, pp, ppnext, ppnext_wasfree); + } else { +VMLOG(X_VPLIST_NEXT_NULL, pp, ppnext, ppnext_wasfree); + ppnext = NULL; + } + + if (pp->p_offset >= off) { +VMLOG(X_VPLIST_GETDIRTY, pp, pp->p_offset, flags); + (void) pvn_getdirty(pp, &dirty, flags); + } + + if (ppsav == NULL && vp->v_pages == pp) { + /* + * If we haven't found a marker before and this pp + * is still on the vplist, use it as our marker. + */ + ppsav = pp; + PAGE_KEEP(ppsav, ppsav_wasfree, ppsav_age); +VMLOG(X_VPLIST_KEEPSAV, ppsav, ppsav->p_offset, ppsav_wasfree); + } + } while (vp->v_pages != NULL && (pp = ppnext) != NULL && pp != ppsav); + + if (ppnext != NULL) { +VMLOG(X_VPLIST_UNKEEP_NEXT, ppnext, ppnext->p_offset, ppnext_wasfree); + PAGE_UNKEEP(ppnext, ppnext_wasfree, ppnext_age); + } + if (ppsav != NULL) { +VMLOG(X_VPLIST_UNKEEP_SAV, ppsav, ppsav->p_offset, ppsav_wasfree); + PAGE_UNKEEP(ppsav, ppsav_wasfree, ppsav_age); + } + + return (dirty); +} + +/* + * Use page_find's and handle all pages for this vnode whose offset + * is >= off and < eoff. This routine will also do klustering up + * to offlo and offhi up until a page which is not found. We assume + * that offlo <= off and offhi >= eoff. + * + * Returns a list of dirty kept pages all ready to be written back. + */ +page_t * +pvn_range_dirty(vp, off, eoff, offlo, offhi, flags) + register struct vnode *vp; + u_int off, eoff; + u_int offlo, offhi; + int flags; +{ + page_t *dirty = NULL; + register page_t *pp; + register u_int o; + + ASSERT(offlo <= off && offhi >= eoff); + + off &= PAGEMASK; + eoff = (eoff + PAGEOFFSET) & PAGEMASK; + + /* first do all the pages from [off..eoff) */ + for (o = off; o < eoff; o += PAGESIZE) { + pp = page_find(vp, o); + if (pp != NULL) { +VMLOG(X_RANGE_GETDIRTY, pp, pp->p_offset, flags); + (void) pvn_getdirty(pp, &dirty, flags); + } + } + + if (pvn_range_noklust) + return (dirty); + + /* now scan backwards looking for pages to kluster */ + for (o = off - PAGESIZE; (int)o >= 0 && o >= offlo; o -= PAGESIZE) { + pp = page_find(vp, o); + if (pp == NULL) + break; /* page not found */ + if (pvn_getdirty(pp, &dirty, flags | B_DELWRI) == 0) + break; /* page not added to dirty list */ + } + + /* now scan forwards looking for pages to kluster */ + for (o = eoff; o < offhi; o += PAGESIZE) { + pp = page_find(vp, o); + if (pp == NULL) + break; /* page not found */ + if (pvn_getdirty(pp, &dirty, flags | B_DELWRI) == 0) + break; /* page not added to dirty list */ + } + + return (dirty); +} + +/* + * Take care of invalidating all the pages for vnode vp going to size + * vplen. This includes zero'ing out zbytes worth of file beyond vplen. + * This routine should only be called with the vp locked by the file + * system code so that more pages cannot be added when sleep here. + */ +void +pvn_vptrunc(vp, vplen, zbytes) + register struct vnode *vp; + register u_int vplen; + u_int zbytes; +{ + register page_t *pp; + + if (vp->v_pages == NULL || vp->v_type == VCHR) + return; + + /* + * Simple case - abort all the pages on the vnode + */ + if (vplen == 0) { + while ((pp = vp->v_pages) != (page_t *)NULL) { + /* + * When aborting these pages, we make sure that + * we wait to make sure they are really gone. + */ + page_lock(pp); + while (pp->p_keepcnt > 0) + page_wait(pp); + if (pp->p_vnode == vp) + page_abort(pp); + else + page_unlock(pp); + } + return; + } + + /* + * Tougher case - have to find all the pages on the + * vnode which need to be aborted or partially zeroed. + */ + + /* + * First we get the last page and handle the partially + * zeroing via kernel mappings. This will make the page + * dirty so that we know that when this page is written + * back, the zeroed information will go out with it. If + * the page is not currently in memory, then the kzero + * operation will cause it to be brought it. We use kzero + * instead of bzero so that if the page cannot be read in + * for any reason, the system will not panic. We need + * to zero out a minimum of the fs given zbytes, but we + * might also have to do more to get the entire last page. + */ + if (zbytes != 0) { + addr_t addr; + + if ((zbytes + (vplen & MAXBOFFSET)) > MAXBSIZE) + cmn_err(CE_PANIC, "pvn_vptrunc zbytes"); + addr = segmap_getmap(segkmap, vp, vplen & MAXBMASK); + (void) kzero(addr + (vplen & MAXBOFFSET), + MAX(zbytes, PAGESIZE - (vplen & PAGEOFFSET))); + (void) segmap_release(segkmap, addr, SM_WRITE | SM_ASYNC); + } + + /* + * Synchronously abort all pages on the vp list which are + * beyond the new length. The algorithm here is to start + * scanning at the beginning of the vplist until there + * are no pages with an offset >= vplen. If we find such + * a page, we wait for it if it is kept for any reason and + * then we abort it after verifying that it is still a page + * that needs to go away. We assume here that the vplist + * is not messed with at interrupt level. + */ +again: + for (pp = vp->v_pages; pp != NULL; pp = pp->p_vpnext) { + if (pp->p_offset >= vplen) { + /* need to abort this page */ + page_lock(pp); + while (pp->p_keepcnt > 0) + page_wait(pp); + /* verify page contents again */ + if (pp->p_vnode == vp && pp->p_offset >= vplen) + page_abort(pp); + else + page_unlock(pp); + goto again; /* start over again */ + } + if (pp == pp->p_vpnext || vp->v_pages == pp->p_vpnext) + break; + } +} + +/* + * This routine is called when the low level address translation + * code decides to unload a translation. It calls back to the + * segment driver which in many cases ends up here. + */ +/*ARGSUSED*/ +void +pvn_unloadmap(vp, offset, ref, mod) + struct vnode *vp; + u_int offset; + u_int ref, mod; +{ + + /* + * XXX - what is the pvn code going to do w/ this information? + * This guy gets called for each loaded page when a executable + * using the segvn driver terminates... + */ +} + +/* + * Handles common work of the VOP_GETPAGE routines when the more than + * one page must be returned by calling a file system specific operation + * to do most of the work. Must be called with the vp already locked + * by the VOP_GETPAGE routine. + */ +int +pvn_getpages(getapage, vp, off, len, protp, pl, plsz, seg, addr, rw, cred) + int (*getapage)(); + struct vnode *vp; + u_int off, len; + u_int *protp; + page_t *pl[]; + u_int plsz; + struct seg *seg; + addr_t addr; + enum seg_rw rw; + struct cred *cred; +{ + register page_t **tpl, **ppp; + register int i; + page_t *pl_array[PVN_GETPAGE_NUM + 1]; + int plsz_extra; + int err = 0; + + if (pl != NULL) { + tpl = pl_array; + ppp = pl; + plsz_extra = plsz - len; + if (plsz_extra < 0) + cmn_err(CE_PANIC, "pvn_getpage len"); + } else { + tpl = NULL; + } + + for (i = 0; i < len; i += PAGESIZE) { + err = (*getapage)(vp, off + i, protp, tpl, PVN_GETPAGE_SZ, + seg, addr + i, rw, cred); + if (err) + break; + if (tpl != NULL) { + for (; *tpl != NULL && (int)plsz > 0; tpl++) { + register u_int toff = (*tpl)->p_offset; + + if (toff >= off && toff < off + len) { + /* + * Copy this page back to + * primary page list. + */ + *ppp++ = *tpl; + plsz -= PAGESIZE; + /* + * See if we should skip ahead for next + * for loop because we got more more + * than just the page we asked for. + * + * N.B. This code assumes that if the + * getapage function returns pages + * beyond the one requested that there + * will be no missing pages between the + * requested page and the highest page. + */ + if (toff > off + i) + i = toff - off; + } else if (plsz_extra > 0) { + /* + * Not part of the range we really + * needed, but we can fit it in. + */ + *ppp++ = *tpl; + plsz -= PAGESIZE; + plsz_extra -= PAGESIZE; + } else { + /* + * We don't have room for it. + */ + PAGE_RELE(*tpl); + } + } + while (*tpl != NULL) + PAGE_RELE(*tpl++); + tpl = pl_array; + } + } + + if (pl != NULL) { + *ppp = NULL; /* terminate list */ + if (err) { + for (ppp = pl; *ppp != NULL; *ppp++ = NULL) + PAGE_RELE(*ppp); + } + } + + return (err); +} + +#ifdef VMDEBUG +#include "vm/kernel.h" + +/* XXX -- where is this defined ? */ +extern struct vnode *rootvp; + +#define NVM_LOG 5000 + +struct vm_log { + time_t vm_time; + int vm_what; + struct proc *vm_p; + int vm_a; + int vm_b; + int vm_c; +}; + +struct vm_log *vm_log; +struct vm_log *vmp; +int do_vmlog = 0; +int nvm_log = NVM_LOG; +int vm_min = 0; +int vm_max = 999; + +void +_vmlog(what, a, b, c) +{ + extern struct proc *curproc; + + if (do_vmlog && vm_log == (struct vm_log *)NULL) { + if (rootvp == (struct vnode *)NULL) + return; /* too soon */ + + do_vmlog = 0; + vm_log = (struct vm_log *)kmem_zalloc((u_int) + (nvm_log * sizeof (*vm_log)), KM_SLEEP); + vmp = vm_log; + do_vmlog = 1; + } + if (what >= vm_min && what < vm_max) { + vmp->vm_time = hrestime.tv_sec; + vmp->vm_what = what; + vmp->vm_p = curproc; + vmp->vm_a = a; + vmp->vm_b = b; + vmp->vm_c = c; + if (++vmp >= &vm_log[nvm_log]) + vmp = vm_log; + } +} +#endif /* VMDEBUG */ diff --git a/usr/src/uts/3b2/vm/vm_rm.c b/usr/src/uts/3b2/vm/vm_rm.c new file mode 100644 index 0000000..0b5d1df --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_rm.c @@ -0,0 +1,98 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_rm.c 1.7" + +/* + * VM - resource manager + * As you can see, it needs lots of work + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/systm.h" +#include "sys/errno.h" +#include "sys/signal.h" +#include "sys/user.h" +#include "sys/proc.h" +#include "sys/cmn_err.h" + +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/rm.h" +#include "vm/seg.h" +#include "vm/page.h" + +#ifdef DEBUG +/*ARGSUSED*/ +page_t * +rm_allocpage(seg, addr, len, flags) + struct seg *seg; + addr_t addr; + u_int len; + u_int flags; +{ + + return (page_get(len, flags)); +} +#endif + +/* + * This routine is called when we couldn't allocate an anon slot. + * For now, we simply print out a message and kill of the process + * who happened to have gotten burned. + * + * XXX - swap reservation needs lots of work so this only happens in + * `nice' places or we need to have a method to allow for recovery. + */ +void +rm_outofanon() +{ + struct proc *p; + + p = u.u_procp; + cmn_err(CE_WARN, "Sorry, pid %d (%s) was killed due to lack of swap space\n", + p->p_pid, u.u_comm); + /* + * To be sure no looping (e.g. in vmsched trying to + * swap out) mark process locked in core (as though + * done by user) after killing it so no one will try + * to swap it out. + */ + psignal(p, SIGKILL); + p->p_flag |= SLOCK; +} + +void +rm_outofhat() +{ + + cmn_err(CE_PANIC, "out of mapping resources"); /* XXX */ + /*NOTREACHED*/ +} + +/* + * Yield the size of an address space. + */ +size_t +rm_assize(as) + register struct as *as; +{ + + return (as == (struct as *)NULL ? 0 : as->a_size); +} + +/* + * Yield the memory claim requirement for an address space. + */ +size_t +rm_asrss(as) + register struct as *as; +{ + + return (as == (struct as *)NULL ? 0 : as->a_rss); +} diff --git a/usr/src/uts/3b2/vm/vm_seg.c b/usr/src/uts/3b2/vm/vm_seg.c new file mode 100644 index 0000000..ae53fbd --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_seg.c @@ -0,0 +1,178 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_seg.c 1.12" + +/* + * VM - segment management. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/systm.h" +#include "sys/debug.h" +#include "sys/kmem.h" +#include "sys/inline.h" + +#include "sys/immu.h" + +#include "sys/vmsystm.h" +#include "vm/hat.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/seg_kmem.h" +#include "vm/mp.h" + +/* + * Variables for maintaining the free list of segment structures. + */ +STATIC struct seg *seg_freelist; +STATIC int seg_freeincr = 32; + +/* + * Allocate a segment to cover [base, base+size) + * and attach it to the specified address space. + */ +struct seg * +seg_alloc(as, base, size) + struct as *as; + register addr_t base; + register u_int size; +{ + register struct seg *new; + addr_t segbase; + u_int segsize; + + segbase = (addr_t)((u_int)base & PAGEMASK); + segsize = + (((u_int)(base + size) + PAGEOFFSET) & PAGEMASK) - (u_int)segbase; + + if (!valid_va_range(&segbase, &segsize, segsize, AH_LO)) + return ((struct seg *)NULL); /* bad virtual addr range */ + + if ( (as != &kas) && !valid_usr_range(segbase, segsize) ) + return ((struct seg *)NULL); /* bad virtual addr range */ + + new = (struct seg *)kmem_fast_alloc((caddr_t *)&seg_freelist, + sizeof (*seg_freelist), seg_freeincr, KM_SLEEP); + struct_zero((caddr_t)new, sizeof (*new)); + if (seg_attach(as, segbase, segsize, new) < 0) { + kmem_fast_free((caddr_t *)&seg_freelist, (char *)new); + return ((struct seg *)NULL); + } + /* caller must fill in ops, data */ + return (new); +} + +/* + * Attach a segment to the address space. Used by seg_alloc() + * and for kernel startup to attach to static segments. + */ +int +seg_attach(as, base, size, seg) + struct as *as; + addr_t base; + u_int size; + struct seg *seg; +{ + + seg->s_as = as; + seg->s_base = base; + seg->s_size = size; + + /* + * as_addseg() will add the segment at the appropraite point + * in the list. It will return -1 if there is overlap with + * an already existing segment. + */ + + return (as_addseg(as, seg)); +} + +/* + * Unmap a segment and free it from its associated address space. + * This should be called by anybody who's finished with a whole segment's + * mapping. Just calls s_ops->unmap() on the whole mapping . It is the + * responsibility of the segment driver to unlink the the segment + * from the address space, and to free public and private data structures + * associated with the segment. (This is typically done by a call to + * seg_free()). + */ +void +seg_unmap(seg) + register struct seg *seg; +{ + /* Shouldn't have called seg_unmap if mapping isn't yet established */ + ASSERT(seg->s_data != NULL); + + /* Unmap the whole mapping */ + (*seg->s_ops->unmap)(seg, seg->s_base, seg->s_size); +} + +/* + * Free the segment from its associated as. This should only be called + * if a mapping to the segment has not yet been established (e.g., if + * an error occurs in the middle of doing an as_map when the segment + * has already been partially set up) or if it has already been deleted + * (e.g., from a segment driver unmap routine if the unmap applies to the + * entire segment). If the mapping is currently set up then seg_unmap() should + * be called instead. + */ +void +seg_free(seg) + register struct seg *seg; +{ + register struct as *as = seg->s_as; + + if (as->a_segs == seg) + as->a_segs = seg->s_next; /* go to next seg */ + + if (as->a_segs == seg) + as->a_segs = NULL; /* seg list is gone */ + else { + seg->s_prev->s_next = seg->s_next; + seg->s_next->s_prev = seg->s_prev; + } + + if (as->a_seglast == seg) + as->a_seglast = as->a_segs; + + /* + * If the segment private data field is NULL, + * then segment driver is not attached yet. + */ + if (seg->s_data != NULL) + (*seg->s_ops->free)(seg); + + kmem_fast_free((caddr_t *)&seg_freelist, (caddr_t)seg); +} + +#ifdef DEBUG + +/* + * Translate addr into page number within segment. + */ +u_int +seg_page(seg, addr) + struct seg *seg; + addr_t addr; +{ + + return ((u_int)((addr - seg->s_base) >> PAGESHIFT)); +} + +/* + * Return number of pages in segment. + */ +u_int +seg_pages(seg) + struct seg *seg; +{ + + return ((u_int)((seg->s_size + PAGEOFFSET) >> PAGESHIFT)); +} +#endif diff --git a/usr/src/uts/3b2/vm/vm_swap.c b/usr/src/uts/3b2/vm/vm_swap.c new file mode 100644 index 0000000..3b87070 --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_swap.c @@ -0,0 +1,1236 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_swap.c 1.39" + +/* + * Virtual swap device + * + * The virtual swap device consists of the logical concatenation of one + * or more physical swap areas. It provides a logical array of anon + * slots, each of which corresponds to a page of swap space. + * + * Each physical swap area has an associated anon array representing + * its physical storage. These anon arrays are logically concatenated + * sequentially to form the overall swap device anon array. Thus, the + * offset of a given entry within this logical array is computed as the + * sum of the sizes of each area preceding the entry plus the offset + * within the area containing the entry. + * + * The anon array entries for unused swap slots within an area are + * linked together into a free list. Allocation proceeds by finding a + * suitable area (attempting to balance use among all the areas) and + * then returning the first free entry within the area. Thus, there's + * no linear relation between offset within the swap device and the + * address (within its segment(s)) of the page that the slot backs; + * instead, it's an arbitrary one-to-one mapping. + * + * Associated with each swap area is a swapinfo structure. These + * structures are linked into a linear list that determines the + * ordering of swap areas in the logical swap device. Each contains a + * pointer to the corresponding anon array, the area's size, and its + * associated vnode. + * + * We we delete a swap device, since it is too complicated to find + * and relocate all the data structures that point to our anon slots, + * we use the an_bap field to go indirect to the new backing anon slot. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/sysmacros.h" +#include "sys/systm.h" +#include "sys/signal.h" +#include "sys/errno.h" +#include "sys/sbd.h" +#include "sys/immu.h" +#include "sys/psw.h" +#include "sys/pcb.h" +#include "sys/user.h" +#include "sys/var.h" +#include "sys/proc.h" +#include "sys/kmem.h" +#include "sys/vfs.h" +#include "sys/stat.h" +#include "sys/vnode.h" +#include "sys/mode.h" +#include "sys/file.h" +#include "sys/uio.h" +#include "sys/conf.h" +#include "sys/cmn_err.h" +#include "sys/debug.h" +#include "sys/tuneable.h" +#include "sys/inline.h" +#include "vm/bootconf.h" +#include "vm/trace.h" +#include "vm/as.h" +#include "vm/seg.h" +#include "vm/page.h" +#include "vm/seg_vn.h" +#include "vm/hat.h" +#include "vm/anon.h" +#include "sys/swap.h" +#include "vm/seg_map.h" + +extern struct vnode *common_specvp(); +extern int lookupname(); +extern int suser(); +extern void segmap_flush(); + +/* + * To balance the load among multiple swap areas, we don't allow + * more than swap_maxcontig allocations to be satisfied from a + * single swap area before moving on to the next swap area. This + * effectively "interleaves" allocations among the many swap areas. + */ +STATIC int swap_maxcontig = 1024 * 1024 / PAGESIZE; /* 1MB of pages */ + +struct swapinfo *swapinfo; +STATIC struct swapinfo *silast; +STATIC int nswapfiles; +STATIC int sw_rdwr(); +STATIC void swapinfo_free(); +STATIC int swapadd(); +STATIC int swapdel(); +STATIC void delswap(); +STATIC void undelswap(); +void swapconf(); /* configure first swap device */ +STATIC char *swapname = NULL; + +/* + * Allocate a single page from the virtual swap device. + */ +struct anon * +swap_alloc() +{ + register struct swapinfo *sip = silast; + register struct anon *ap; + + do { + if ((sip->si_flags & ST_INDEL) == 0) { + ap = sip->si_free; + if (ap) { + sip->si_free = ap->un.an_next; + sip->si_nfpgs--; + if (++sip->si_allocs >= swap_maxcontig) { + sip->si_allocs = 0; + if ((silast = sip->si_next) == NULL) + silast = swapinfo; + } +# ifdef TRACE + { + struct vnode *vp; + uint off; + swap_xlate(ap, &vp, &off); + trace3(TR_MP_SWAP, vp, off, ap); + } +# endif /* TRACE */ + return (ap); + } + sip->si_allocs = 0; + } + if ((sip = sip->si_next) == NULL) + sip = swapinfo; + } while (sip != silast); + return ((struct anon *)NULL); +} + +/* + * Free a swap page. + */ +void +swap_free(ap) + register struct anon *ap; +{ + register struct swapinfo *sip = swapinfo; + + /* + * Find the swap area containing ap and then put + * ap at the head of that area's free list. + * If we are an indirect anon pointer + * then free up the back end too. + */ + if (ap->an_bap) { + register struct anon *bap; + + bap = ap->an_bap; + ASSERT(bap->an_bap == ap); + ASSERT(bap->an_refcnt == 0); + ap->an_bap = NULL; + bap->an_bap = NULL; + swap_free(bap); + } + + do { + if (sip->si_anon <= ap && ap <= sip->si_eanon) { + ap->un.an_next = sip->si_free; + sip->si_free = ap; + sip->si_nfpgs++; + + /* If swap area is deleted and the + * front is now free we can free up + * all the data structures now. + */ + if ((sip->si_flags & ST_DELETED) + && (sip->si_nfpgs == sip->si_npgs)) { + swapinfo_free(sip); + } + return; + } + } while ((sip = sip->si_next) != NULL); + cmn_err(CE_PANIC, "swap_free"); + /*NOTREACHED*/ +} + +/* + * Return the pair + * corresponding to the given anon struct. + */ +void +swap_xlate(ap, vpp, offsetp) + register struct anon *ap; + register struct vnode **vpp; + register uint *offsetp; +{ + register struct swapinfo *sip = swapinfo; + + /* + * Use the back pointer if we are indirect. + */ + if (ap->an_bap) { + register struct anon *bap; + + bap = ap->an_bap; + ASSERT(ap->an_refcnt > 0); + ASSERT(bap->an_bap == ap); + ASSERT(bap->an_refcnt == 0); + ap = bap; + } + do { + if (sip->si_anon <= ap && ap <= sip->si_eanon) { + *offsetp = sip->si_soff + + ((ap - sip->si_anon) << PAGESHIFT); + *vpp = sip->si_vp; + return; + } + } while ((sip = sip->si_next) != NULL); + cmn_err(CE_PANIC, "swap_xlate"); + /*NOTREACHED*/ +} + +/* + * Return the anon struct corresponding for the given + * if it is part of the virtual swap device. + * This is used by page_free and page_reclaim to tear down + * (or setup ) the `hint' in the anon structure. If we have + * a refcnt then this ap is directly in use, so return it. + * Otherwise return the back pointer, which will either be + * NULL, or an ap that is indirectly pointing to this ap. + * Our callers would not do anything unless we give them + * an ap with a non zero refcnt. + */ +struct anon * +swap_anon(vp, offset) + register struct vnode *vp; + register uint offset; +{ + register struct swapinfo *sip = swapinfo; + register struct anon *ap; + register struct anon *bap; + + if (vp && sip) { + do { + if (vp == sip->si_vp && offset >= sip->si_soff + && offset < sip->si_eoff) { + ap = (sip->si_anon + + ((offset-sip->si_soff) >> PAGESHIFT)); + bap = ap->an_bap; + if (ap->an_refcnt) { + ASSERT( (bap == 0) + || ((bap->an_bap == ap) + && (bap->an_refcnt == 0))); + return (ap); + } else { + ASSERT( (bap == 0) + || ((bap->an_bap == ap) + && (bap->an_refcnt > 0))); + return (bap); + } + } + } while ((sip = sip->si_next) != NULL); + } + return ((struct anon *)NULL); +} + +/* does the vp offset range overlap a swap device */ + +int +swap_in_range(vp, offset, len) + register struct vnode *vp; + register uint offset; + uint len; +{ + register struct swapinfo *sip = swapinfo; + register uint eoff; + + eoff = offset + len; + ASSERT (eoff > offset); + if (vp && sip) { + do { + if (vp != sip->si_vp || eoff <= sip->si_soff + || offset >= sip->si_eoff || sip->si_flags&ST_DELETED) + continue; + return(1); + } while ((sip = sip->si_next) != NULL); + } + return(0); +} +/* + * swread and swwrite implement the /dev/drum device, an indirect, + * user visible, device to allow reading of the (virtual) swap device. + */ + +/*ARGSUSED*/ +swread(dev, uio) + dev_t dev; + struct uio *uio; +{ + + return (sw_rdwr(uio, UIO_READ)); +} + +/*ARGSUSED*/ +swwrite(dev, uio) + dev_t dev; + struct uio *uio; +{ + + return (sw_rdwr(uio, UIO_WRITE)); +} + +/* + * Common routine used to break up reads and writes to the + * (virtual) swap device to the underlying vnode(s). This is + * used to implement the user visable /dev/drum interface. + */ +/*ARGSUSED*/ +STATIC int +sw_rdwr(uio, rw) + register struct uio *uio; + enum uio_rw rw; +{ + register struct swapinfo *sip = swapinfo; + int nbytes = uio->uio_resid; + uint off = 0; + uint size = 0; + int error = 0; + + do { + size = sip->si_eoff - sip->si_soff; + if (uio->uio_offset >= off && + uio->uio_offset < off + size) + break; + off += size; + } while ((sip = sip->si_next) != NULL); + + if (sip) { + uio->uio_offset -= off; + do { + size = sip->si_eoff - sip->si_soff; + uio->uio_resid = MIN(size - uio->uio_offset, nbytes); + nbytes -= uio->uio_resid; + if (rw == UIO_READ) + error = VOP_READ(sip->si_vp, uio, 0, u.u_cred); + else + error = VOP_WRITE(sip->si_vp, uio, 0, u.u_cred); + uio->uio_offset = 0; + } while (error == 0 && uio->uio_resid == 0 && nbytes > 0 && + (sip = sip->si_next)); + uio->uio_resid = nbytes + uio->uio_resid; + } + + return (error); +} + +/* + * See if name is one of our swap files + * even though lookupname failed. + * This can be used by swapdel to delete + * swap resources on remote machines + * where the link has gone down. + */ +STATIC struct vnode * +swapdel_byname(name, lowblk) + char *name; /* pathname to delete. */ + register uint lowblk; /* Low block number of area to delete. */ +{ + register struct swapinfo **sipp, *osip; + register uint soff; + + /* + * Find the swap file entry for the file to + * be deleted. Skip any entries that are in + * transition. + */ + + soff = ctob(btoc(lowblk << SCTRSHFT)); /* must be page aligned */ + + for (sipp = &swapinfo; (osip = *sipp) != NULL; sipp = &osip->si_next) { + if ((strcmp(osip->si_pname, name) == 0) + && (osip->si_soff == soff) && (osip->si_flags == 0)) { + VN_HOLD(osip->si_svp); + return osip->si_svp; + } + } + + return NULL; +} + + +/* + * New system call to manipulate swap files. + */ + +struct swapcmda { + int sc_dummy; /* uadmin cmd argument */ + int sc_cmd; /* command code for swapctl */ + void *sc_arg; /* argument pointer for swaptcl */ +}; + +int +swapctl(uap, rvp) + register struct swapcmda *uap; + rval_t *rvp; +{ + register struct swapinfo *sip; + register error = 0; + + struct swapent st, *ust; + struct swapres sr; + struct vnode *vp; + register int cnt = 0; + int length; + + switch (uap->sc_cmd) { + case SC_GETNSWP: + + rvp->r_val1 = nswapfiles; + return(0); + + case SC_LIST: + if (copyin((caddr_t)uap->sc_arg, + (caddr_t)&length, sizeof(int)) != 0) + return(EFAULT); + + /* + * Return an error if we don't have enough space + * for thw whole table. We also have to check + * during the loop, since we can add entries + * on the fly. + */ + if (length < nswapfiles) + return(ENOMEM); + + ust = (swapent_t *)((swaptbl_t *)uap->sc_arg)->swt_ent; + + sip = swapinfo; + do { + if (sip->si_flags & ST_DELETED) + continue; + if (length-- == 0) /* no place for more entries */ + break; + if (copyin((caddr_t)ust, (caddr_t)&st, sizeof(swapent_t)) != 0) + return(EFAULT); + st.ste_flags = sip->si_flags; + st.ste_length = (sip->si_eoff-sip->si_soff) >> SCTRSHFT; + st.ste_start = sip->si_soff >> SCTRSHFT; + st.ste_pages = sip->si_npgs; + st.ste_free = sip->si_nfpgs; + + if (copyout((caddr_t)&st, (caddr_t)ust, sizeof(swapent_t)) != 0) { + rvp->r_val1 = cnt; + return (EFAULT); + } + if (sip->si_pname) + if (copyout(sip->si_pname, st.ste_path, strlen(sip->si_pname)) != 0) { + rvp->r_val1 = cnt; + return (EFAULT); + } + ust++; + cnt++; + } while ((sip = sip->si_next) != NULL); + rvp->r_val1 = cnt; + if (sip) + return (ENOMEM); + return 0; + + case SC_ADD: + case SC_REMOVE: + break; + default: + return(EINVAL); + } + if (!suser(u.u_cred)) + return(EPERM); + + if (copyin((caddr_t)uap->sc_arg, (caddr_t)&sr, sizeof(swapres_t))) + return(EFAULT); + + /* Allocate the space to read pathname in the kernel space */ + + if (swapname == NULL) { + if ((swapname = (char *)kmem_alloc(MAXPATHLEN, + KM_NOSLEEP)) == NULL) { + return(ENOMEM); + } + } + error = copyinstr(sr.sr_name, swapname, MAXPATHLEN, 0); + if (error) + return(error); + + error = lookupname(swapname, UIO_SYSSPACE, FOLLOW, NULLVPP, &vp); + if (error) { + if (uap->sc_cmd == SC_ADD) + return(error); + /* see if we match by name */ + vp = swapdel_byname(swapname, (uint)sr.sr_start); + if (vp == NULL) + return(error); + } + + switch (vp->v_type) { + case VBLK: + break; + + case VREG: + if (vp->v_vfsp->vfs_flag & VFS_RDONLY) { + error = EROFS; + } else + error = VOP_ACCESS(vp, VREAD|VWRITE, 0, u.u_cred); + break; + + case VDIR: + error = EISDIR; + break; + default: + error = ENOSYS; + break; + } + if (error == 0) { + if (uap->sc_cmd == SC_REMOVE) + error = swapdel(vp, sr.sr_start); + else + error = swapadd(vp, sr.sr_start, sr.sr_length, swapname); + } + VN_RELE(vp); + return(error); + +} + +/* + * Add a new swap file. + */ +STATIC int +swapadd(vp, lowblk, nblks, swapname) + struct vnode *vp; + uint lowblk; + uint nblks; + char *swapname; +{ + register struct anon *ap, *ap2; + register struct swapinfo **sipp, *nsip; + register struct vnode *cvp; + struct vattr vattr; + register uint pages; + uint soff, eoff; + int error; + + u.u_error = 0; /* SCSI open bug fix */ + if (error = VOP_OPEN(&vp, FREAD|FWRITE, u.u_cred)) { + return error; + } + cvp = common_specvp(vp); + + /* + * Get partition size. Return error if empty partition, + * or if request does not fit within the partition. + * If this is the first swap device, we can reduce + * the size of the swap area to match what is + * available. This can happen if the system was built + * on a machine with a different size swap partition. + */ + vattr.va_mask = AT_SIZE; + if (error = VOP_GETATTR(cvp, &vattr, 0, u.u_cred)) + goto out; + + soff = lowblk << SCTRSHFT; + if ((vattr.va_size == 0) || (soff >= vattr.va_size)) { + error = EINVAL; + goto out; + } + + eoff = soff + (nblks << SCTRSHFT); + if (eoff > vattr.va_size) { + uint endblk; + if (swapinfo != NULL) { + error = EINVAL; + goto out; + } + eoff = vattr.va_size; + endblk = eoff >> SCTRSHFT; + cmn_err(CE_WARN, + "swapadd: configured values for swplo (%d) and nswap (%d) are too large for", + lowblk, nblks); + cmn_err(CE_CONT, + "partition size (%d). nswap reduced to %d blocks\n", + endblk, endblk - lowblk); + } + + /* + * The starting and ending offsets must be page aligned. + * Round soff up to next page boundary, round eoff + * down to previous page boundary. + */ + soff = ctob(btoc(soff)); + eoff = ctob(btoct(eoff)); + if (soff >= eoff) { + error = EINVAL; + goto out; + } + + pages = btoc(eoff - soff); + + for (sipp = &swapinfo; (nsip = *sipp) != NULL; sipp = &nsip->si_next) { + /* See if this swapfile aleady exists in one form + * or another. It can be in many stages of existance, + * being added by another process, in use, being + * deleted, or been deleted (but the data structures + * are still around.). + */ + if (nsip->si_flags & ST_DELETED) { + if (nsip->si_soff == soff && nsip->si_npgs == pages + && (strcmp(nsip->si_pname, swapname) == 0)) { + + /* We are adding a device that + * we were trying to delete. + * We are done with the delete, + * but haven't free'd up all the + * data structures yet, so we need + * to undo the deletion, turn the + * vnode swap flag back on, + * and keep the device open. + * Add our pages back into the + * total available for swap. + */ + VN_HOLD(vp); + nsip->si_svp = vp; + nsip->si_vp = cvp; + nsip->si_flags &= ~ST_DELETED; + undelswap(nsip); + nsip->si_flags &= ~ST_INDEL; + anoninfo.ani_max += nsip->si_npgs; + availsmem += nsip->si_npgs; + cvp->v_flag |= VISSWAP; + nswapfiles++; + return (0); + } + continue; + } + if (nsip->si_vp == cvp) { + if (nsip->si_soff == soff && nsip->si_npgs == pages + && (nsip->si_flags & ST_DOINGDEL)) { + + /* We are adding a device that + * we were trying to delete. + * We are still in the middle + * of the deletion, so just turn off + * the flag so the deltion will stop. + * Swapdel will add our pages back + * into the total available for swap. + */ + nsip->si_flags &= ~ST_INDEL; + goto out; + } + /* disallow overlapping swap files */ + if ((soff < nsip->si_eoff) && (eoff > nsip->si_soff)) { + error = EEXIST; + goto out; + } + } + } + + nsip = (struct swapinfo *)kmem_zalloc(sizeof (struct swapinfo), KM_SLEEP); + nsip->si_vp = cvp; + nsip->si_svp = vp; /* snode */ + nsip->si_flags = ST_INDEL; + + /* add this swap device to end of list */ + *sipp = nsip; + if (silast == NULL) /* first swap device */ + silast = nsip; + + cvp->v_flag |= VISSWAP; + + nsip->si_soff = soff; + nsip->si_eoff = eoff; + nsip->si_anon = (struct anon *)kmem_zalloc(pages*sizeof (struct anon), KM_SLEEP); + nsip->si_eanon = nsip->si_anon + (pages - 1); + nsip->si_pname = (char *) kmem_zalloc((strlen(swapname) + 1), KM_SLEEP); + bcopy(swapname, nsip->si_pname, strlen(swapname)); + + /* + * ap2 now points to the first usable slot in the swap area. + * Set up free list links so that the head of the list is at + * the front of the usable portion of the array. + */ + ap = nsip->si_eanon; + ap2 = nsip->si_anon; + while (--ap >= ap2) + ap->un.an_next = ap + 1; + nsip->si_free = ap + 1; + nsip->si_npgs = pages; + nsip->si_nfpgs = pages; + + anoninfo.ani_free += pages; + anoninfo.ani_max += pages; + availsmem += pages; + nswapfiles++; + nsip->si_flags &= ~ST_INDEL; + + VN_HOLD(vp); + if (error) { +out: + (void) VOP_CLOSE(vp, FREAD|FWRITE, 1, (off_t) 0, u.u_cred); + } + + return (error); +} + + +/* + * Delete a swap file. + */ +STATIC int +swapdel(vp, lowblk) + register struct vnode *vp; + register int lowblk; /* Low block number of area to delete. */ +{ + register struct swapinfo **sipp, *osip, **psipp = NULL; + register struct vnode *cvp; + register int ok = 0; + register uint soff; + + /* + * Find the swap file entry for the file to + * be deleted. Skip any entries that are in + * transition. Also, make sure that we don't + * delete the last swap file. + */ + + cvp = common_specvp(vp); + + soff = ctob(btoc(lowblk << SCTRSHFT)); /* must be page aligned */ + + for (sipp = &swapinfo; (osip = *sipp) != NULL; sipp = &osip->si_next) { + if ((osip->si_vp == cvp) + && (osip->si_soff == soff) && (osip->si_flags == 0)) { + psipp = sipp; + } else if ((osip->si_flags & ST_INDEL) == 0) + ok++; + } + + /* + * If the file was not found, error. + */ + + if (psipp == NULL) + return EINVAL; + + /* + * If we're trying to delete the last swap file, error. + */ + + if (!ok) + return ENOMEM; + + osip = *psipp; + + /* + * Do not delete if we will be low on swap pages. + */ + + if ((anoninfo.ani_max - anoninfo.ani_resv) - osip->si_npgs + < tune.t_minasmem) { + cmn_err(CE_WARN, "swapdel - too few free pages"); + return ENOMEM; + } + + /* + * Set the delete flag. We will not + * allocate any more pages from this device. + * ST_DOINGDEL limits us to one process + * doing a swapdel per swap file. + */ + osip->si_flags |= ST_INDEL|ST_DOINGDEL; + anoninfo.ani_max -= osip->si_npgs; + availsmem -= osip->si_npgs; + + /* + * try to remove pages - this may sleep, and + * swapadd may add this file back and turn off ST_INDEL. + * In that case, we stop trying to delete it. + */ + + if (osip->si_nfpgs < osip->si_npgs) + delswap(osip); + + ASSERT (osip->si_nfpgs <= osip->si_npgs); + osip->si_flags &= ~ST_DOINGDEL; + + /* + * If we are not still trying to delete + * this swap device, because we have + * swapadd'ed it again, then we are done. + * We added back the pages in swapadd. + */ + + if ((osip->si_flags & ST_INDEL) == 0) { + undelswap(osip); + anoninfo.ani_max += osip->si_npgs; + availsmem += osip->si_npgs; + return (0); + } + + /* + * If we have finally freed all the pages, + * we can delete all the data structures. + * If the front is not yet free, the data + * structures will be free'd by swap_free. + */ + vp = osip->si_svp; + if (osip->si_nfpgs == osip->si_npgs) + swapinfo_free(osip); + else + osip->si_flags |= ST_DELETED; + + segmap_flush(segkmap, cvp); + (void) VOP_CLOSE(vp, FREAD|FWRITE, 1, (off_t) 0, u.u_cred); + cvp->v_flag &= ~VISSWAP; + VN_RELE(vp); + + nswapfiles--; + + return 0; +} + +/* + * We are finished with this swap resource and + * can not delete all the data structures. + */ +STATIC void +swapinfo_free(sip) + register struct swapinfo *sip; +{ + register struct swapinfo **sipp; + register uint pages; + + sipp = &swapinfo; + ASSERT(*sipp != NULL); + + do { + if (*sipp == sip) + break; + sipp = &(*sipp)->si_next; + } while (*sipp != NULL); + + if (*sipp == NULL) + cmn_err(CE_PANIC, "swap device vp %x off %x gone", + sip->si_vp, sip->si_soff); + + if (silast == sip) + if ((silast = sip->si_next) == NULL) + silast = swapinfo; + *sipp = sip->si_next; + + /* si_npgs may not be true number of anon entries allocated */ + pages = btoc(sip->si_eoff - sip->si_soff); + kmem_free(sip->si_anon, pages*sizeof(struct anon)); + kmem_free(sip->si_pname, strlen(sip->si_pname) + 1); + kmem_free((caddr_t)sip, sizeof(*sip)); +} + + +#define delswap_done(sip) ((sip->si_nfpgs == sip->si_npgs) || ((sip->si_flags & ST_INDEL) == 0)) + +/* + * Free up swap space on the swap device being deleted. + * We make two passes thru the anon slots. On the first + * pass we only handle pages that are already in memory, + * so we don't force any of these pages out if we have + * to read some pages in. + */ + +STATIC void +delswap(sip) + struct swapinfo *sip; +{ + register struct anon *new, *old; + register page_t *opp; + register struct anon *eanon; + register struct anon *cur; + struct vnode *nvp, *ovp; + u_int noff, ooff; + int pass, dummy, resid; + + for (pass = 0; pass < 2 ; pass++) { + + cur = sip->si_anon; + eanon = sip->si_eanon; + + for ( ; cur <= eanon; cur++ ) { + + if (delswap_done(sip)) + return; + + /* + * If an_bap is not NULL, we can be an + * anon slot that points to the backing + * anon slot, or the anon slot that is + * being pointed at. + */ + if (cur->an_bap) { + register struct anon *bap = cur->an_bap; + + ASSERT(bap->an_bap == cur); + if (cur->an_refcnt) { + /* + * This is the anon slot (front). + * It has already been relocated. + */ + ASSERT(bap->an_refcnt == 0); + continue; + } else { + /* + * This is the object of indirection + * (the back). We relocate the front + * instead of this entry, and free + * this up when we are done. + */ + ASSERT(bap->an_refcnt > 0); + old = bap; + } + } else { + if (cur->an_refcnt == NULL) + continue; + old = cur; + } + + swap_xlate(old, &ovp, &ooff); + opp = page_lookup(ovp, ooff); + + if (opp == NULL) { + if (pass == 0) + continue; + } + /* + * If this page has been swapped out, + * then bring it back in. + */ + while (opp == NULL) { + vn_rdwr(UIO_READ, ovp, &dummy, 1, ooff, + UIO_SYSSPACE, 0, (long)0, 0, &resid); + opp = page_lookup(ovp, ooff); + } + + /* + * we may have slept, so it is time + * to check that we still need to handle + * this anon slot. + */ + if (old->an_refcnt == 0) { + continue; + } + + page_lock(opp); + PAGE_HOLD(opp); + + new = swap_alloc(); + if (new == NULL) + cmn_err(CE_PANIC, "delswap: out of anon"); + + swap_xlate(new, &nvp, &noff); + + page_hashout(opp); /* destroy old name for page */ + + /* enter new name for old page */ + while (page_enter(opp, nvp, noff)) { + page_t *npp; + + npp = page_find(nvp, noff); + if (npp != NULL) + page_abort(npp); + } + + /* set up indirection */ + old->an_bap = new; + new->an_bap = old; + if (cur != old) { + /* + * "old" used to point to "cur". + * We have relocated old to point + * to new, and now we free up cur. + */ + ASSERT(cur->an_bap == old); + ASSERT(cur->an_refcnt == 0); + cur->an_bap = NULL; + /* inline swap_free */ + cur->un.an_next = sip->si_free; + sip->si_free = cur; + sip->si_nfpgs++; + } + + opp->p_mod = 1; /* mark page as modified */ + + page_unlock(opp); + PAGE_RELE(opp); + + } + } + +} + +/* + * Break the indirections set up so far. This is used + * when we swapadd back a resource that we have deleted + * but have not freed the data structures, and when we + * stop a swapdel in the middle of deleting a resource. + * We make two passes thru the anon slots. On the first + * pass we only handle pages that are already in memory, + * so we don't force any of these pages out if we have + * to read some pages in. + */ + +STATIC void +undelswap(sip) + struct swapinfo *sip; +{ + register struct anon *dir, *ind; + register page_t *opp; + register struct anon *eanon; + struct vnode *nvp, *ovp; + u_int noff, ooff; + int pass, dummy, resid; + + nvp = sip->si_vp; + + for (pass = 0; pass < 2 ; pass++) { + + dir = sip->si_anon; + eanon = sip->si_eanon; + noff = sip->si_soff; + + for ( ; dir <= eanon; dir++, noff += PAGESIZE ) { + + if (delswap_done(sip)) + return; + + if ((dir->an_refcnt == 0) || (dir->an_bap == NULL)) + continue; + + ind = dir->an_bap; + ASSERT(ind->an_bap == dir); + ASSERT(ind->an_refcnt == 0); + + /* swap_xlate finds the indirect page */ + swap_xlate(dir, &ovp, &ooff); + opp = page_lookup(ovp, ooff); + + if (opp == NULL) { + if (pass == 0) + continue; + } + /* + * If this page has been swapped out, + * then bring it back in. + */ + while (opp == NULL) { + vn_rdwr(UIO_READ, ovp, &dummy, 1, ooff, + UIO_SYSSPACE, 0, (long)0, 0, &resid); + opp = page_lookup(ovp, ooff); + } + + /* + * we may have slept, so it is time + * to check that we still need to handle + * this anon slot. + */ + if (dir->an_refcnt == 0) { + continue; + } + + page_lock(opp); + PAGE_HOLD(opp); + + page_hashout(opp); /* destroy name for (indirect) page */ + + /* enter new (original) name for direct page */ + while (page_enter(opp, nvp, noff)) { + page_t *npp; + + npp = page_find(nvp, noff); + if (npp != NULL) + page_abort(npp); + } + + ASSERT(ind->an_bap == dir); + ASSERT(ind->an_refcnt == 0); + /* break the indirection */ + dir->an_bap = NULL; + ind->an_bap = NULL; + swap_free(ind); + + opp->p_mod = 1; /* mark page as modified */ + + page_unlock(opp); + PAGE_RELE(opp); + + } + } + +} + + +/* + * Obsolete sys3b function: manipulate swap files. + * This only works on block devices. + */ + +int +swapfunc(si) + register swpi_t *si; +{ + register error = 0; + register struct swapinfo *sip; + register char *ustp; + swpt_t st; + struct vnode *vp; + + switch (si->si_cmd) { + case SI_LIST: + + ustp = si->si_buf; + sip = swapinfo; + do { + /* Don't report this device if it has been deleted + * but the data structures have not been freed. + */ + if (sip->si_flags & ST_DELETED) + continue; + st.st_dev = (o_dev_t)cmpdev(sip->si_vp->v_rdev); + st.st_flags = sip->si_flags; + st.st_swplo = sip->si_soff >> SCTRSHFT; + st.st_npgs = sip->si_npgs; + st.st_nfpgs = sip->si_nfpgs; + st.st_ucnt = 1; + st.pad1 = st.pad2 = st.pad3 = 0; + if (copyout((caddr_t)&st, ustp, sizeof(swpt_t)) != 0) { + error = EFAULT; + break; + } + ustp += sizeof(swpt_t); + } while ((sip = sip->si_next) != NULL); + break; + + case SI_ADD: + case SI_DEL: + if (!suser(u.u_cred)) { + error = EPERM; + break; + } + + if (swapname == NULL) { + if ((swapname = (char *)kmem_alloc(MAXPATHLEN, + KM_NOSLEEP)) == NULL) { + error = ENOMEM; + break; + } + } + error = copyinstr(si->si_buf, swapname, MAXPATHLEN, 0); + if (error) + break; + + error = lookupname(swapname, UIO_SYSSPACE, FOLLOW, NULLVPP, &vp); + if (error) + break; + + if (vp->v_type == VBLK) { + if (si->si_cmd == SI_DEL) + error = swapdel(vp, si->si_swplo); + else + error = swapadd(vp, si->si_swplo, si->si_nblks, + swapname); + } else + error = ENOTBLK; + VN_RELE(vp); + break; + default: + return(EINVAL); + } + + return error; +} + + +/* + * Debugging routine only. + */ +void +sxlate(ap) + register struct anon *ap; +{ + register struct swapinfo *sip = swapinfo; + + if (ap->an_bap) + ap = ap->an_bap; + do { + if (sip->si_anon <= ap && ap <= sip->si_eanon) { + cmn_err(CE_CONT, "vp=%x offset=%x\n", + sip->si_vp, + sip->si_soff + + ((ap - sip->si_anon) << PAGESHIFT)); + return; + } + } while ((sip = sip->si_next) != NULL); + cmn_err(CE_CONT, "%x not an anon pointer\n", ap); + return; +} + + +/* + * Add the initial swap device. + */ +void +swapconf() +{ + register int error; + + if (error = lookupname(swapfile.bo_name, UIO_SYSSPACE, + FOLLOW, NULLVPP, &swapfile.bo_vp)) + cmn_err(CE_PANIC, "swapconf lookupname %s failed - error %d\n", + swapfile.bo_name, error); + + /* + * bo_offset, and bo_size have been + * filled in by cunix. + */ + (void)strcpy(swapfile.bo_fstype, rootfstype); + swapfile.bo_flags |= BO_VALID; + + if (swapadd(swapfile.bo_vp, swapfile.bo_offset, + swapfile.bo_size, swapfile.bo_name)) + cmn_err(CE_PANIC, "swapconf - swapadd failed"); +} diff --git a/usr/src/uts/3b2/vm/vm_vpage.c b/usr/src/uts/3b2/vm/vm_vpage.c new file mode 100644 index 0000000..f9ff622 --- /dev/null +++ b/usr/src/uts/3b2/vm/vm_vpage.c @@ -0,0 +1,73 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ident "@(#)kernel:vm/vm_vpage.c 1.3" + +/* + * VM - virtual page utilities. + */ + +#include "sys/types.h" +#include "sys/param.h" +#include "sys/systm.h" +#include "vm/vpage.h" +#include "vm/mp.h" + +/* + * Lock a virtual page via its prot structure. + * First acquire a higher-level lock against multiprocessing + * which protects a set of page-level locks (to save space). + * If the vpage structure is locked, wait for it to be unlocked, + * and then indicate failure to the caller. Otherwise, + * lock the virtual page, release the higher level lock and return. + */ +int +vpage_lock(l, vp) + register mon_t *l; + register struct vpage *vp; +{ + register int v; + + mon_enter(l); + + if (vp->vp_lock) { + while (vp->vp_lock) { + vp->vp_want = 1; + cv_wait(l, (char *)vp); + } + v = -1; + } else { + vp->vp_lock = 1; + v = 0; + } + + mon_exit(l); + return (v); +} + +/* + * Unlock a vpage. + * Get a high-level lock to protect the prot structure + * against multiprocessing. Clear the lock and clear + * the want, remembering if anyone wants the page. + * Release the high-level lock and kick any waiters. + */ +void +vpage_unlock(l, vp) + register mon_t *l; + register struct vpage *vp; +{ + register int w; + + mon_enter(l); + vp->vp_lock = 0; + w = vp->vp_want; + vp->vp_want = 0; + if (w) + cv_broadcast(l, (char *)vp); + mon_exit(l); +} diff --git a/usr/src/uts/3b2/vm/vmlog.h b/usr/src/uts/3b2/vm/vmlog.h new file mode 100644 index 0000000..147975a --- /dev/null +++ b/usr/src/uts/3b2/vm/vmlog.h @@ -0,0 +1,93 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_VMLOG_H +#define _VM_VMLOG_H + +#ident "@(#)kernel:vm/vmlog.h 1.4" + +/* + * For temporary debugging only + */ + +extern int do_vmlog; +extern void _vmlog(/* what, a, b, c */); + +#ifdef VMDEBUG +#define VMLOG(N, A, B, C) \ + { if (do_vmlog) _vmlog((int)N, (int)(A), (int)(B), (int)(C)); } +#else +#define VMLOG(N, A, B, C) +#endif + +#define X_ANONALLOC 1 +#define X_ANONINCREF_PAGEWAIT 2 +#define X_ANONINCREF_UNLOAD 3 +#define X_ANONDECREF 4 +#define X_ANONDECREF_FREE 5 +#define X_ANONDECREF_ABORT 6 +#define X_ANONGETPAGE 7 +#define X_ANONGETPAGE_GOTIT_WAIT 8 +#define X_ANONGETPAGE_GOTIT 9 +#define X_ANONGETPAGE_VOP 10 +#define X_ANONPRIVATE 11 +#define X_ANONPRIVATE_GETPAGE 12 +#define X_ANONPRIVATE_ALLOC 13 +#define X_ANONZERO 14 +#define X_ANONZERO_ALLOC 15 +#define X_ANONZERO_LOAD 16 + +#define X_PAGELOOKUP_CLEANUP 19 +#define X_PAGELOOKUP_WAIT 20 +#define X_PAGELOOKUP_WAITDONE 21 +#define X_PAGEENTER 22 +#define X_PAGEABORT 23 +#define X_PAGEABORT_KEPT 24 +#define X_PAGEABORT_INTRANS 25 +#define X_PAGEABORT_UNLOAD 26 +#define X_PAGEABORT_FREE 27 +#define X_PAGEABORT_GONE 28 +#define X_PAGEFREE 29 +#define X_PAGEFREE_GONE 30 +#define X_PAGEFREE_INTRANS 31 +#define X_PAGEFREE_NOTINTRANS 32 +#define X_PAGEFREE_FREEMEM_WAIT 33 +#define X_PAGEGET_SLEEP 34 +#define X_PAGEGET_GOTMEM 35 + +#define X_PVNFAIL 40 +#define X_PVNDONE 41 +#define X_PVNDONE_ZERO 42 +#define X_PVNDONE_SYNC_READ 43 +#define X_PVNDONE_OTHER 44 +#define X_PVNDONE_PAGE 45 +#define X_PVNDONE_INVAL 46 +#define X_PVNDONE_WRITE_ERR 47 +#define X_PVNDONE_DIRTY_FREE 48 +#define X_PVNDONE_DIRTY_UNLOCK 49 +#define X_PVNDONE_UNLOCK 50 +#define X_PVNDIRTY_ABORT 51 +#define X_PVNDIRTY_FREE_RET 52 +#define X_PVNDIRTY_INTRANS 53 +#define X_PVNDIRTY_LOCK 54 +#define X_PVNDIRTY_WAIT 55 +#define X_PVNDIRTY_LOST 56 +#define X_PVNDIRTY_NOMOD 57 +#define X_PVNDIRTY_INVAL 58 +#define X_PVNDIRTY_FREE 59 +#define X_PVNDIRTY_NOMOD_RET 60 +#define X_PVNDIRTY_ADD 61 +#define X_VPLIST_UNKEEP_NEXTL 62 +#define X_VPLIST_KEEP_NEXT 63 +#define X_VPLIST_NEXT_NULL 64 +#define X_VPLIST_GETDIRTY 65 +#define X_VPLIST_KEEPSAV 66 +#define X_VPLIST_UNKEEP_SAV 67 +#define X_VPLIST_UNKEEP_NEXT 69 +#define X_RANGE_GETDIRTY 70 + +#endif /* _VM_VMLOG_H */ diff --git a/usr/src/uts/3b2/vm/vpage.h b/usr/src/uts/3b2/vm/vpage.h new file mode 100644 index 0000000..d868402 --- /dev/null +++ b/usr/src/uts/3b2/vm/vpage.h @@ -0,0 +1,30 @@ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _VM_VPAGE_H +#define _VM_VPAGE_H + +#ident "@(#)kernel:vm/vpage.h 1.3" + +/* + * VM - Information per virtual page. + */ +struct vpage { + u_int vp_prot: 4; /* see prot flags */ + u_int vp_advise: 3; /* see madvise flags */ + u_int vp_lock: 1; /* someone has this vpage locked */ + u_int vp_want: 1; /* someone wants this vpage */ + u_int vp_ref: 1; /* reference bit */ + u_int vp_mod: 1; /* (maybe) modify bit, from hat */ + u_int vp_pplock: 1; /* physical page locked by me */ + u_int : 4; +}; + +int vpage_lock(/* l, vp */); +void vpage_unlock(/* l, vp */); + +#endif /* _VM_VPAGE_H */ diff --git a/usr/src/uts/3b2/vuifile b/usr/src/uts/3b2/vuifile new file mode 100644 index 0000000..3816f0a --- /dev/null +++ b/usr/src/uts/3b2/vuifile @@ -0,0 +1,113 @@ +/* #ident "@(#)kernel:vuifile 1.11" */ + +MEMORY { + KP_boot: origin = 0x02004000, length = 0x080000 + + KV_gate: origin = 0, length = 0x001000 + KV_demot: origin = 0x20000, length = 0x020000 + KV_sbdint: origin = 0x40000, length = 0x020000 + KV_text: origin = 0x40000000, length = 0x160000 + KV_data: origin = 0x40160000, length = 0x080000 + KV_bss: origin = 0x401e0000, length = 0x120000 + KV_sysseg: origin = 0x40300000, length = 0x200000 + KV_windows: origin = 0x40500000, length = 0x040000 + KV_segmap: origin = 0x40540000, length = 0x400000 + KV_segu: origin = 0x40940000, length = 0x200000 + + UV_ublock: origin = 0xc0000000, length = 0x020000 + UV_stack: origin = 0xc0020000, length = 0x0e0000 + } + +SECTIONS { + + /* sections whose names do not begin with a period are physical */ + boott: { + sboott = .; + start.o(.text) + } > KP_boot + bootd: { + start.o(.data,.bss,.rodata) + bootSIZE = . - sboott; + } > KP_boot + + /* sections whose names begin with a period are virtual */ + .gate: { + gate.o(.data) + } > KV_gate + + /* sections .text, .data and .bss are given special handling by lboot */ + .text: { + locore.o(.text) + } > KV_text + + .data: { + locore.o(.data) + *(.data) + *(.rodata) + } > KV_data + + .bss: { + locore.o(.bss) + } > KV_bss + + kv_sbdint (NOLOAD): + { + unxsbdst = . ; + mmusdc1 = . ; + mmusdc2 = . + 0x100; + mmupdc1r = . + 0x200; + mmupdc2r = . + 0x300; + mmupdc1l = . + 0x400; + mmupdc2l = . + 0x500; + mmusrama = . + 0x600; + mmusramb = . + 0x700; + mmufltcr = . + 0x800; + mmufltar = . + 0x900; + mmucr = . + 0xa00; + mmuvar = . + 0xb00; + sbdpit = . + 0x2000; + clrclkint = . + 0x2013; + sbdnvram = . + 0x3000; + sbdrcsr = . + 0x4000; + sbdwcsr = . + 0x4000; + dmaid = . + 0x5000; + dmaiuA = . + 0x6000; + dmaiuB = . + 0x7000; + dmac = . + 0x8000; + duart = . + 0x9000; + idisk = . + 0xa000; + ifloppy = . + 0xd000; + dmaif = . + 0xe000; + } > KV_sbdint + + kv_sysseg (NOLOAD): + { + syssegs = .; + } > KV_sysseg + + kv_windows (NOLOAD): + { + win_ublk = .; + } > KV_windows + + kv_segmap (NOLOAD): + { + kvsegmap = .; + } > KV_segmap + + kv_segu (NOLOAD): + { + kvsegu = .; + } > KV_segu + + uv_stack (NOLOAD): + { + userstack = .; + } > UV_stack + + uv_ublock (NOLOAD): + { + u = .; + } > UV_ublock + + }