Subject: INGRES Lock Driver (#232) Index: sys/{ingreslock.c, many others} 2.11BSD Description: The INGRES lock driver is missing from the system. Repeat-By: Observation. Alternatively you could port the INGRES system from /usr/ingres/PORT and notice that there is no concurrency control between multiple INGRES sessions. Fix: This update is being issued now to give folks time to put the driver into the system before the INGRES package is released. That port is being done by a fellow in Norway and is in the final testing stages and will be posted soon. The shar archive below contains two files: /tmp/new.232 and /tmp/patch.232. The first adds three files to the system while the second updates twelve files in the system. The INGRES lock driver has been assigned major device number 25. If this conflicts with locally written drivers you will have to edit the MAKEDEV and pdp/conf.c files manually. The following files are added to the system: /usr/src/sys/sys/ingreslock.c # the source to the lock driver /usr/src/sys/h/ingreslock.h # definitions and structures for the driver /usr/src/sys/GENERIC/ingres.h # the config file specifying if the driver is # to be loaded into the kernel. The following files in the system are updated: /dev/MAKEDEV # the mknod command for ingreslock added /usr/src/sys/conf/config # cleanup and 'INGRES' added. /usr/src/sys/conf/GENERIC # 'INGRES NO' added. /usr/src/sys/conf/Make.sys # ingreslock.c added to list of kernel srcs /usr/src/sys/conf/Make.nsunix # ingreslock.o added to list of objects /usr/src/sys/conf/Make.sunix # ingreslock.o added to list of objects /usr/src/sys/conf/Make.unix # ingreslock.o added to list of objects /usr/src/sys/sys/kern_exit.c # exit() modified to release locks on proc exit /usr/src/sys/pdp/conf.c # INGRES device added to device tables /usr/src/sys/pdp/machdep2.c # external lock table allocated /usr/src/sys/GENERIC/Makefile /usr/src/sys/GENERIC/Make.sys /VERSION To install the lock driver unpack the shar archive below. There should be the two files 'patch.232' and 'new.232' created in /tmp. Then: sh /tmp/new.232 patch -p0 < /tmp/patch.232 NOTE: You must now update a couple files in EACH kernel directory present on the system. You do not have to do anything with the "GENERIC" kernel because that has already been done by the patch command above. The 'Make.sys' file has to be copied into each kernel's directory. Also, the include file 'ingres.h' must be present. By default the lock driver is not loaded into the kernel because ingres.h contains the line "#define NINGRES 0". IF you do want the INGRES lock driver to be incorporated into your kernel then edit 'ingres.h' and change the '0' to a '1'. Example: cd /sys foreach i (FOO BAR PICKLE) cp GENERIC/ingres.h $i/ingres.h cp conf/Make.sys $i/Make.sys end Also you will want to update the corresponding kernel config files in /sys/conf. Simply add the line "INGRES NO" (or "INGRES YES") to the end of each config file. The patch file updates the GENERIC config file as an example. One more step is required to complete the kernel changes. The module 'ingreslock.o' must be added to the overlay structure in the kernel Makefiles. Typically 'ingreslock.o' would be added to 'OV7' but the .o may be placed anywhere there is 1056 bytes of available room. Example: 66c66 < OV7= mch_fpsim.o kern_sysctl.o --- > OV7= mch_fpsim.o kern_sysctl.o ingreslock.o If you have requested that the lock driver be present then you will want to recompile the kernel, install it and reboot. Actually creating the /dev/ingreslock node can be postponed if desired until the INGRES kit is available. If you do wish to create it now: cd /dev ./MAKEDEV ingreslock You will see an error if the 'ingres' user is not present in the password file. ===========================cut here======================= #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # /tmp/patch.232 # /tmp/new.232 # This archive created: Fri Mar 17 20:11:08 1995 export PATH; PATH=/bin:/usr/bin:$PATH if test -f '/tmp/patch.232' then echo shar: "will not over-write existing file '/tmp/patch.232'" else sed 's/^X//' << \SHAR_EOF > '/tmp/patch.232' X*** /dev/MAKEDEV.old Fri Nov 20 20:52:04 1992 X--- /dev/MAKEDEV Mon Feb 20 21:46:55 1995 X*************** X*** 4,10 **** X # All rights reserved. The Berkeley software License Agreement X # specifies the terms and conditions for redistribution. X # X! # @(#)MAKEDEV 4.27 (Berkeley) 4/15/86 X # X # Device "make" file. Valid arguments: X # std standard devices X--- 4,10 ---- X # All rights reserved. The Berkeley software License Agreement X # specifies the terms and conditions for redistribution. X # X! # @(#)MAKEDEV 4.27.1 (2.11BSD GTE) 2/14/95 X # X # Device "make" file. Valid arguments: X # std standard devices X*************** X*** 39,47 **** X # vp* unibus versatec parallel interface X # Call units: X # Special purpose devices: X! # dr* unibus dr11 X! # ram* memory disk X! # dn* dn11 dialer X umask 77 X for i X do X--- 39,49 ---- X # vp* unibus versatec parallel interface X # Call units: X # Special purpose devices: X! # dr* unibus dr11 X! # ram* memory disk X! # dn* dn11 dialer X! # ingreslock Ingres lock driver. X! X umask 77 X for i X do X*************** X*** 342,347 **** X--- 344,355 ---- X echo bad unit for ${name} in: $i X ;; X esac X+ ;; X+ X+ ingreslock) X+ mknod ingreslock c 25 0 X+ chown ingres ingreslock X+ chmod 200 ingreslock X ;; X X local) X*** /usr/src/sys/conf/config.old Fri Mar 12 19:02:25 1993 X--- /usr/src/sys/conf/config Tue Feb 28 20:10:03 1995 X*************** X*** 1,6 **** X #! /bin/sh X # X! # 2.10BSD script to set up a new kernel configuration directory. X X LO=../h/localopts.h X X--- 1,10 ---- X #! /bin/sh X+ # 2.11BSD script to set up a new kernel configuration directory. X # X! # 2/28/95 - fixed errors introduced earlier. remove the chmod at the X! # end, rely instead on the system administrator's choice of X! # umask. X! # 2/14/95 - added ingres lock driver. removed vax cruft. X X LO=../h/localopts.h X X*************** X*** 73,96 **** X # Copy in the standard configuration files, boot program, X # makefiles, and cpu-dependent files. X X! if [ $MACHINE = VAX ]; then X! echo "Copying standard VAX files to ../$MACHINE." X! cp VAX.compile/VAX.c ../$MACHINE X else X! echo "Copying standard files to ../$MACHINE." X! if [ $NEC = 0 ]; then X! if [ $INET = YES ]; then X! cp spl/$NETFIX ../$MACHINE/NETSPLFIX X! fi X! cp spl/$SPLFIX ../$MACHINE/SPLFIX X! else X! if [ $INET = YES ]; then X! cp spl_3com/$NETFIX ../$MACHINE/NETSPLFIX X! fi X! cp spl_3com/$SPLFIX ../$MACHINE/SPLFIX X fi X! cp boot/${BOOTDEV}boot.s ../$MACHINE/boot.s X fi X X sed -e "s/%ROOTDEV%/$ROOTDEV/" \ X -e "s/%SWAPDEV%/$SWAPDEV/" \ X--- 77,95 ---- X # Copy in the standard configuration files, boot program, X # makefiles, and cpu-dependent files. X X! echo "Copying standard files to ../$MACHINE." X! if [ $NEC = 0 ]; then X! if [ $INET = YES ]; then X! cp spl/$NETFIX ../$MACHINE/NETSPLFIX X! fi X! cp spl/$SPLFIX ../$MACHINE/SPLFIX X else X! if [ $INET = YES ]; then X! cp spl_3com/$NETFIX ../$MACHINE/NETSPLFIX X fi X! cp spl_3com/$SPLFIX ../$MACHINE/SPLFIX X fi X+ cp boot/${BOOTDEV}boot.s ../$MACHINE/boot.s X X sed -e "s/%ROOTDEV%/$ROOTDEV/" \ X -e "s/%SWAPDEV%/$SWAPDEV/" \ X*************** X*** 173,178 **** X--- 172,182 ---- X echo "#define NLP $NLP" > ../$MACHINE/lp.h X echo "#define LP_MAXCOL $LP_MAXCOL" >> ../$MACHINE/lp.h X echo "#define NPTY $NPTY" > ../$MACHINE/pty.h X+ if [ $INGRES = YES ]; then X+ echo "#define NINGRES 1" > ../$MACHINE/ingres.h X+ else X+ echo "#define NINGRES 0" > ../$MACHINE/ingres.h X+ fi X echo "#define NQE $NQE" > ../$MACHINE/qe.h X echo "#define NQT $NQT" > ../$MACHINE/qt.h X echo "#define NRAM $NRAM" > ../$MACHINE/ram.h X*************** X*** 246,267 **** X X echo "OPTS=$OPTS" > ../$MACHINE/Makefile X X! if [ $MACHINE = VAX ]; then X! cat VAX.compile/Makefile >> ../$MACHINE/Makefile X! elif [ $INET = YES ]; then X cat Make.nsunix >> ../$MACHINE/Makefile X! cp Make.sys Make.net Make.pdpnet Make.pdpuba \ X! Make.pdp Make.pdpmba ../$MACHINE X elif [ $KERN_NONSEP = NO ]; then X cat Make.sunix >> ../$MACHINE/Makefile X- cp Make.sys Make.pdpuba Make.pdp Make.pdpmba ../$MACHINE X else X cat Make.unix >> ../$MACHINE/Makefile X- cp Make.sys Make.pdpuba Make.pdp Make.pdpmba ../$MACHINE X fi X X! # save copy of localopts.h X cp $LO ../$MACHINE X! X! # set permissions X! chmod 664 ../$MACHINE/* X--- 250,266 ---- X X echo "OPTS=$OPTS" > ../$MACHINE/Makefile X X! cp Make.sys Make.pdp Make.pdpuba Make.pdpmba ../$MACHINE X! X! if [ $INET = YES ]; then X cat Make.nsunix >> ../$MACHINE/Makefile X! cp Make.net Make.pdpnet ../$MACHINE X elif [ $KERN_NONSEP = NO ]; then X cat Make.sunix >> ../$MACHINE/Makefile X else X cat Make.unix >> ../$MACHINE/Makefile X fi X X! # install copy of localopts.h and make it readable for applications X cp $LO ../$MACHINE X! chmod a+r ../$MACHINE X*** /usr/src/sys/conf/GENERIC.old Sat Jan 22 17:11:43 1994 X--- /usr/src/sys/conf/GENERIC Tue Feb 14 20:41:01 1995 X*************** X*** 253,256 **** X # X # Note that profiling is not currently working. We don't have any plans on X # fixing it, so this is essentially a non-supported feature. X! PROFILE NO # system profiling with KW11P clock X--- 253,258 ---- X # X # Note that profiling is not currently working. We don't have any plans on X # fixing it, so this is essentially a non-supported feature. X! PROFILE NO # system profiling with KW11P clock X! X! INGRES NO # include the Ingres lock driver X*** /usr/src/sys/conf/Make.sys.old Sat Jan 14 00:50:17 1995 X--- /usr/src/sys/conf/Make.sys Mon Feb 20 19:54:52 1995 X*************** X*** 9,15 **** X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.0 (2.11BSD GTE) 1/14/95 X # X S= ../sys X VPATH= ../sys X--- 9,15 ---- X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.1 (2.11BSD GTE) 2/14/95 X # X S= ../sys X VPATH= ../sys X*************** X*** 24,29 **** X--- 24,30 ---- X ${S}/quota_subr.c ${S}/subr_log.c ${S}/subr_prf.c ${S}/subr_rmap.c \ X ${S}/subr_xxx.c ${S}/sys_generic.c ${S}/sys_inode.c \ X ${S}/sys_kern.c ${S}/sys_pipe.c \ X+ ${S}/ingreslock.c \ X ${S}/sys_process.c ${S}/syscalls.c ${S}/tty.c ${S}/tty_conf.c \ X ${S}/tty_pty.c ${S}/tty_subr.c ${S}/tty_tb.c ${S}/tty_tty.c \ X ${S}/ufs_alloc.c ${S}/ufs_bio.c ${S}/ufs_bmap.c \ X*************** X*** 36,41 **** X--- 37,43 ---- X kern_proc.o kern_prot.o kern_resource.o kern_sig.o kern_sysctl.o \ X kern_subr.o kern_synch.o kern_time.o kern_xxx.o quota_sys.o \ X quota_kern.o quota_ufs.o quota_subr.o subr_log.o subr_prf.o subr_rmap.o \ X+ ingreslock.o \ X subr_xxx.o sys_generic.o sys_inode.o sys_kern.o \ X sys_pipe.o sys_process.o syscalls.o tty.o tty_conf.o tty_pty.o \ X tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o \ X*** /usr/src/sys/conf/Make.nsunix.old Sat Jan 14 00:43:25 1995 X--- /usr/src/sys/conf/Make.nsunix Mon Feb 20 19:54:19 1995 X*************** X*** 9,15 **** X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.0 (2.11BSD GTE) 1/14/95 X # X ######################################################### X # Networking, separate I/D kernel # X--- 9,15 ---- X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.1 (2.11BSD GTE) 2/14/95 X # X ######################################################### X # Networking, separate I/D kernel # X*************** X*** 77,83 **** X OV6= clock.o dn.o init_main.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \ X subr_log.o toy.o X OV7= tmscp.o kern_sysctl.o X! OV8= mch_fpsim.o X X KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ X ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ X--- 77,83 ---- X OV6= clock.o dn.o init_main.o kern_pdp.o machdep2.o subr_prf.o syscalls.o \ X subr_log.o toy.o X OV7= tmscp.o kern_sysctl.o X! OV8= mch_fpsim.o ingreslock.o X X KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ X ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ X*** /usr/src/sys/conf/Make.sunix.old Sat Jan 14 00:43:45 1995 X--- /usr/src/sys/conf/Make.sunix Mon Feb 20 19:54:27 1995 X*************** X*** 9,15 **** X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.0 (2.11BSD GTE) 1/14/95 X # X ######################################################### X # Non-network, but separate I/D kernel # X--- 9,15 ---- X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.1 (2.11BSD GTE) 2/14/95 X # X ######################################################### X # Non-network, but separate I/D kernel # X*************** X*** 62,68 **** X quota_ufs.o subr_log.o vm_swp.o vm_swap.o vm_proc.o toy.o X OV5= ht.o tm.o ts.o X OV6= tmscp.o kern_sysctl.o X! OV7= mch_fpsim.o X X KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ X ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ X--- 62,68 ---- X quota_ufs.o subr_log.o vm_swp.o vm_swap.o vm_proc.o toy.o X OV5= ht.o tm.o ts.o X OV6= tmscp.o kern_sysctl.o X! OV7= mch_fpsim.o ingreslock.o X X KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ X ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ X*** /usr/src/sys/conf/Make.unix.old Sat Jan 14 00:44:11 1995 X--- /usr/src/sys/conf/Make.unix Mon Feb 20 19:54:34 1995 X*************** X*** 9,15 **** X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.0 (2.11BSD GTE) 1/14/95 X # X ######################################################### X # Non-networking, non-separate I/D kernel # X--- 9,15 ---- X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.1 (2.11BSD GTE) 2/14/95 X # X ######################################################### X # Non-networking, non-separate I/D kernel # X*************** X*** 62,68 **** X ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o \ X ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o \ X vm_proc.o vm_sched.o vm_swap.o vm_swp.o vm_text.o xp.o subr_log.o \ X! kern_sysctl.o X X OV1= X OV2= X--- 62,68 ---- X ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o \ X ufs_mount.o ufs_namei.o ufs_subr.o ufs_syscalls.o \ X vm_proc.o vm_sched.o vm_swap.o vm_swp.o vm_text.o xp.o subr_log.o \ X! kern_sysctl.o ingreslock.o X X OV1= X OV2= X*** /usr/src/sys/sys/kern_exit.c.old Fri Mar 12 19:35:37 1993 X--- /usr/src/sys/sys/kern_exit.c Tue Feb 14 22:02:53 1995 X*************** X*** 3,9 **** X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X * X! * @(#)kern_exit.c 2.0 (2.11BSD GTE) 3/10/93 X */ X X #include "param.h" X--- 3,9 ---- X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X * X! * @(#)kern_exit.c 2.1 (2.11BSD GTE) 2/14/95 X */ X X #include "param.h" X*************** X*** 22,27 **** X--- 22,28 ---- X #ifdef QUOTA X #include "quota.h" X #endif X+ #include "ingres.h" X X /* X * exit system call: pass back caller's arg X*************** X*** 100,105 **** X--- 101,111 ---- X p->p_prev = &zombproc; X zombproc = p; X p->p_stat = SZOMB; X+ X+ #if NINGRES > 0 X+ ingres_rma(p->p_pid); /* Remove any ingres locks */ X+ #endif X+ X noproc = 1; X for (pp = &pidhash[PIDHASH(p->p_pid)]; *pp; pp = &(*pp)->p_hash) X if (*pp == p) { X*** /usr/src/sys/pdp/conf.c.old Thu Dec 29 17:41:18 1994 X--- /usr/src/sys/pdp/conf.c Wed Feb 15 20:25:25 1995 X*************** X*** 3,9 **** X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X * X! * @(#)conf.c 2.3 (2.11BSD Berkeley) 12/29/94 X */ X X #include "param.h" X--- 3,9 ---- X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X * X! * @(#)conf.c 2.4 (2.11BSD GTE) 2/15/95 X */ X X #include "param.h" X*************** X*** 336,341 **** X--- 336,355 ---- X int mmrw(); X #define mmselect seltrue X X+ #include "ingres.h" X+ #if NINGRES > 0 X+ int ingres_open(), ingres_write(); X+ #define ingres_read nodev X+ #define ingres_ioctl nodev X+ #define ingres_close nulldev X+ #else X+ #define ingres_open nodev X+ #define ingres_close nodev X+ #define ingres_read nodev X+ #define ingres_write nodev X+ #define ingres_ioctl nodev X+ #endif X+ X int ttselect(), seltrue(); X X struct cdevsw cdevsw[] = { X*************** X*** 439,444 **** X--- 453,462 ---- X dhvopen, dhvclose, dhvread, dhvwrite, X dhvioctl, dhvstop, dhv_tty, dhvselect, X nulldev, X+ /* ingres = 25 */ X+ ingres_open, ingres_close, ingres_read, ingres_write, X+ ingres_ioctl, nulldev, 0, seltrue, X+ nulldev, X }; X X int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); X*************** X*** 497,503 **** X /* NOTREACHED */ X } X X! #define MAXDEV 25 X static char chrtoblktbl[MAXDEV] = { X /* CHR */ /* BLK */ X /* 0 */ NODEV, X--- 515,521 ---- X /* NOTREACHED */ X } X X! #define MAXDEV 26 X static char chrtoblktbl[MAXDEV] = { X /* CHR */ /* BLK */ X /* 0 */ NODEV, X*************** X*** 524,530 **** X /* 21 */ NODEV, X /* 22 */ NODEV, X /* 23 */ 12, /* tmscp */ X! /* 24 */ NODEV X }; X /* X * Routine to convert from character to block device number. X--- 542,549 ---- X /* 21 */ NODEV, X /* 22 */ NODEV, X /* 23 */ 12, /* tmscp */ X! /* 24 */ NODEV, X! /* 25 */ NODEV X }; X /* X * Routine to convert from character to block device number. X*** /usr/src/sys/pdp/machdep2.c.old Wed Mar 17 19:59:35 1993 X--- /usr/src/sys/pdp/machdep2.c Mon Feb 20 20:00:15 1995 X*************** X*** 3,9 **** X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X * X! * @(#)machdep2.c 2.2 (2.11BSD GTE) 3/13/93 X */ X X #include "param.h" X--- 3,9 ---- X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X * X! * @(#)machdep2.c 2.3 (2.11BSD GTE) 2/15/95 X */ X X #include "param.h" X*************** X*** 29,35 **** X--- 29,40 ---- X #include "namei.h" X #include "ra.h" X #include "tms.h" X+ #include "ingres.h" X X+ #if NINGRES > 0 X+ #include X+ #endif X+ X #ifdef QUOTA X #include "quota.h" X #endif X*************** X*** 134,143 **** X #endif X X #ifdef EXTERNALITIMES X! #define C (ninode * sizeof (struct icommon2)) X! if ((xitimes = malloc(coremap, btoc(C))) == 0) X panic("xitimes"); X! xitdesc = ((btoc(C) << 8) | RW); X #undef C X #endif X X--- 139,148 ---- X #endif X X #ifdef EXTERNALITIMES X! #define C (btoc(ninode * sizeof (struct icommon2))) X! if ((xitimes = malloc(coremap, C)) == 0) X panic("xitimes"); X! xitdesc = ((C - 1) << 8) | RW; X #undef C X #endif X X*************** X*** 158,173 **** X nchsize = ninode * 11 / 10; X B = (btoc(nchsize * sizeof(struct namecache))); X if ((nmidesc.se_addr = malloc(coremap, B)) == 0) X! panic("nameimalloc"); X nmidesc.se_desc = ((B - 1) << 8) | RW; X namecache = (struct namecache *)SEG5; X } X X #if NRAC > 0 || NTMSCP > 0 X- { X if ((_iobase = malloc(coremap, btoc(_iosize))) == 0) X panic("_iobase"); X- } X #endif NRAC X X #define B (size_t)(((long)nbuf * (MAXBSIZE)) / ctob(1)) X--- 163,176 ---- X nchsize = ninode * 11 / 10; X B = (btoc(nchsize * sizeof(struct namecache))); X if ((nmidesc.se_addr = malloc(coremap, B)) == 0) X! panic("nmidesc"); X nmidesc.se_desc = ((B - 1) << 8) | RW; X namecache = (struct namecache *)SEG5; X } X X #if NRAC > 0 || NTMSCP > 0 X if ((_iobase = malloc(coremap, btoc(_iosize))) == 0) X panic("_iobase"); X #endif NRAC X X #define B (size_t)(((long)nbuf * (MAXBSIZE)) / ctob(1)) X*************** X*** 177,188 **** X X #define C (btoc(MSG_BSIZE)) X if ((msgbuf.msg_click = malloc(coremap, C)) == 0) X! panic("msgbufmem"); X msgbuf.msg_magic = MSG_MAGIC; X msgbuf.msg_bufc = SEG5; X msgbuf.msg_bufx = msgbuf.msg_bufr = 0; X #undef C X X #if NRAM > 0 X ramsize = raminit(); X #endif X--- 180,199 ---- X X #define C (btoc(MSG_BSIZE)) X if ((msgbuf.msg_click = malloc(coremap, C)) == 0) X! panic("msgbuf"); X msgbuf.msg_magic = MSG_MAGIC; X msgbuf.msg_bufc = SEG5; X msgbuf.msg_bufx = msgbuf.msg_bufr = 0; X #undef C X X+ #if NINGRES > 0 X+ #define C (btoc(LOCKTABSIZE)) X+ X+ if (Locktabseg.se_addr = malloc(coremap, C)) X+ Locktabseg.se_desc = ((C - 1) << 8) | RW; X+ #undef C X+ #endif X+ X #if NRAM > 0 X ramsize = raminit(); X #endif X*************** X*** 265,271 **** X * Clstaddt was the physical address of clists. X */ X if (nclist * sizeof(struct cblock) > ctob(stoc(1))) X! panic("clist area too large"); X setubregno(0, clstaddr); X clstaddr = (ubadr_t)0; X X--- 276,282 ---- X * Clstaddt was the physical address of clists. X */ X if (nclist * sizeof(struct cblock) > ctob(stoc(1))) X! panic("clist > 8k"); X setubregno(0, clstaddr); X clstaddr = (ubadr_t)0; X X*** /usr/src/sys/GENERIC/Makefile.old Sat Jan 14 00:36:30 1995 X--- /usr/src/sys/GENERIC/Makefile Mon Feb 20 19:55:38 1995 X*************** X*** 63,69 **** X quota_ufs.o subr_log.o vm_swp.o vm_swap.o vm_proc.o toy.o X OV5= ht.o tm.o ts.o mem.o X OV6= tmscp.o rl.o X! OV7= mch_fpsim.o kern_sysctl.o X X KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ X ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ X--- 63,69 ---- X quota_ufs.o subr_log.o vm_swp.o vm_swap.o vm_proc.o toy.o X OV5= ht.o tm.o ts.o mem.o X OV6= tmscp.o rl.o X! OV7= mch_fpsim.o kern_sysctl.o ingreslock.o X X KERNOBJ=${CONF} ${BASE} ${OV1} ${OV2} ${OV3} ${OV4} ${OV5} \ X ${OV6} ${OV7} ${OV8} ${OV9} ${OV10} ${OV11} ${OV12} \ X*** /usr/src/sys/GENERIC/Make.sys.old Sat Jan 14 00:50:20 1995 X--- /usr/src/sys/GENERIC/Make.sys Mon Feb 20 19:55:22 1995 X*************** X*** 9,15 **** X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.0 (2.11BSD GTE) 1/14/95 X # X S= ../sys X VPATH= ../sys X--- 9,15 ---- X # software without specific prior written permission. This software X # is provided ``as is'' without express or implied warranty. X # X! # 2.1 (2.11BSD GTE) 2/14/95 X # X S= ../sys X VPATH= ../sys X*************** X*** 24,29 **** X--- 24,30 ---- X ${S}/quota_subr.c ${S}/subr_log.c ${S}/subr_prf.c ${S}/subr_rmap.c \ X ${S}/subr_xxx.c ${S}/sys_generic.c ${S}/sys_inode.c \ X ${S}/sys_kern.c ${S}/sys_pipe.c \ X+ ${S}/ingreslock.c \ X ${S}/sys_process.c ${S}/syscalls.c ${S}/tty.c ${S}/tty_conf.c \ X ${S}/tty_pty.c ${S}/tty_subr.c ${S}/tty_tb.c ${S}/tty_tty.c \ X ${S}/ufs_alloc.c ${S}/ufs_bio.c ${S}/ufs_bmap.c \ X*************** X*** 36,41 **** X--- 37,43 ---- X kern_proc.o kern_prot.o kern_resource.o kern_sig.o kern_sysctl.o \ X kern_subr.o kern_synch.o kern_time.o kern_xxx.o quota_sys.o \ X quota_kern.o quota_ufs.o quota_subr.o subr_log.o subr_prf.o subr_rmap.o \ X+ ingreslock.o \ X subr_xxx.o sys_generic.o sys_inode.o sys_kern.o \ X sys_pipe.o sys_process.o syscalls.o tty.o tty_conf.o tty_pty.o \ X tty_subr.o tty_tb.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o \ X*** /VERSION.old Mon Mar 13 20:20:34 1995 X--- /VERSION Fri Mar 17 20:07:05 1995 X*************** X*** 1,4 **** X! Current Patch Level: 231 X X 2.11 BSD X ============ X--- 1,4 ---- X! Current Patch Level: 232 X X 2.11 BSD X ============ SHAR_EOF fi if test -f '/tmp/new.232' then echo shar: "will not over-write existing file '/tmp/new.232'" else sed 's/^X//' << \SHAR_EOF > '/tmp/new.232' X#! /bin/sh X# This is a shell archive, meaning: X# 1. Remove everything above the #! /bin/sh line. X# 2. Save the resulting text in a file. X# 3. Execute the file with /bin/sh (not csh) to create: X# /usr/src/sys/sys/ingreslock.c X# /usr/src/sys/h/ingreslock.h X# /usr/src/sys/GENERIC/ingres.h X# This archive created: Fri Mar 17 19:59:09 1995 Xexport PATH; PATH=/bin:/usr/bin:$PATH Xif test -f '/usr/src/sys/sys/ingreslock.c' Xthen X echo shar: "will not over-write existing file '/usr/src/sys/sys/ingreslock.c'" Xelse Xsed 's/^X//' << \SHAR_EOF > '/usr/src/sys/sys/ingreslock.c' XX/* XX * Rewritten for 2.11BSD. Feb 20 1995, Steven Schultz (sms@wlv.iipo.gtegsc.com) XX * XX * The lock table is allocated external to the kernel (in pdp/machdep2.c at XX * kernel startup time) because 8 concurrent Ingres sessions would have cost XX * over 500 bytes of D space. XX */ XX XX#include "ingres.h" XX#if NINGRES > 0 XX XX#include "param.h" XX#include XX#include XX#include XX#include XX#include XX#include XX XX/* XX * Wait channels for locktable. We need something which is even, unique and XX * not mapped out to sleep on when waiting for a lock. XX*/ XX int Locksleep[IL_NLOCKS]; XX segm Locktabseg; XX struct Lockform *Locktab = (struct Lockform *)SEG5; XX XX/* XX * array of number of locks which can be set for each lock. XX * It looks tempting to make this an array of char or u_char. DON'T. The XX * entries are used as wait channel addresses and must be 'even'. XX*/ XX int Lockset[] = XX { XX IL_NLOCKS, XX IL_PLOCKS, XX IL_RLOCKS, XX IL_DLOCKS XX }; XX XX#define keycomp(a,b) bcmp(a,b,KEYSIZE) XX XXingres_open(dev, flag, mode) XX dev_t dev; XX int flag; XX int mode; XX { XX XX if ((flag & FWRITE) == 0) XX return(EBADF); XX if (Locktabseg.se_addr == 0) XX return(ENOMEM); XX return(0); XX } XX XX/* XX * ingres_write() : write driver XX * 1. copy Lock request info to lockbuf XX * 2. follow action in l_act XX * 3. Error return conditions XX * -1: lockrequest fails(only on act=1) XX * -2: attempt to release a lock not set XX * by calling program XX * -3: illegal action requested XX * XX * Install the line "ingres_rma(p->p_pid)" in the routine XX * "exit" (in sys/kern_exit.c) after "p->p_stat = SZOMB". XX*/ XX XXingres_write(dev, uio, flag) XX dev_t dev; XX struct uio *uio; XX int flag; XX{ XX struct Lockreq lockbuf; XX register struct Lockreq *ll; XX register int i; XX int error = 0, blockflag; XX XX if (uio->uio_resid != sizeof (struct ulock)) XX return(EINVAL); XX error = uiomove(&lockbuf.lr_req, sizeof (struct ulock), uio); XX if (error) XX return(error); XX lockbuf.lr_pid = u.u_procp->p_pid; XX ll = &lockbuf; XX if ((ll->lr_act < A_RLS1) XX && ((ll->lr_type < T_CS) || (ll->lr_type > T_DB ) XX || (ll->lr_mod < M_EXCL) || (ll->lr_mod > M_SHARE ))) XX return(EINVAL); XX XX/* XX * At this point we are in the high kernel and do not need to save seg5 XX * before changing it. Making sure that 'normalseg5' is called before doing XX * a sleep() or return() is sufficient. XX * XX * It is simpler to map the lock table once here rather than in each routine XX * called below. XX*/ XX ingres_maplock(); XX XX switch(ll->lr_act) XX { XX case A_RTN: XX /* XX * attempt to set lock. XX * error return if failure. XX */ XX blockflag = FALSE; XX for ( i = 0; i <= ll->lr_type; i++) XX if (Lockset[i] == 0) XX blockflag = TRUE; XX if (blockflag || ingres_unique(ll) >= 0) XX error = -1; XX else XX ingres_enter(ll); XX break; XX XX case A_SLP: XX /* attempt to set lock. XX * sleep on blocking address if failure. XX */ XX do XX { XX do XX { XX blockflag = TRUE; XX for ( i = 0; i <= ll->lr_type; i++) XX if (Lockset[i] == 0) XX { XX normalseg5(); XX sleep(&Lockset[i],LOCKPRI); XX ingres_maplock(); XX blockflag = FALSE; XX } XX } XX while (!blockflag); XX if (( i = ingres_unique(ll)) >= 0 ) XX { XX blockflag = FALSE; XX Locktab[i].l_wflag = W_ON; XX normalseg5(); XX sleep(&Locksleep[i],LOCKPRI); XX ingres_maplock(); XX } XX } XX while (!blockflag); XX ingres_enter(ll); XX break; XX XX case A_RLS1: XX /* remove 1 lock */ XX if ((i = ingres_find(ll)) >= 0) XX ingres_rm(i,ll->lr_pid); XX else XX error = -2; XX break; XX XX case A_RLSA: XX /* remove all locks for this process id*/ XX ingres_rma(ll->lr_pid); /* does a normalseg5() */ XX break; XX XX case A_ABT: /* abort all locks */ XX ingres_abt(); XX break; XX XX default : XX error = -3; XX break; XX } XX normalseg5(); XX return(error); XX} XX XX/* XX * ingres_unique- check for match on key XX * XX * return index of Locktab if match found XX * else return -1 XX */ XX XXstatic XXingres_unique(q) XXregister struct Lockreq *q; XX{ XX register int k; XX register struct Lockform *p = Locktab; XX XX for (k = 0; k < IL_NLOCKS; k++, p++) XX { XX if ((p->l_mod != M_EMTY) XX && (keycomp(p->l_key,q->lr_key) == 0) XX && (p->l_type == q->lr_type) XX && ((p->l_mod == M_EXCL) || (q->lr_mod == M_EXCL))) XX return(k); XX } XX return(-1); XX} XX XXstatic XXingres_find(q) XXregister struct Lockreq *q; XX { XX register int k; XX register struct Lockform *p = Locktab; XX XX for (k = 0; k < IL_NLOCKS; k++, p++) XX { XX if ((p->l_mod != M_EMTY) XX && (keycomp(p->l_key,q->lr_key) == 0) XX && (p->l_type == q->lr_type) XX && (p->l_pid == q->lr_pid)) XX return(k); XX } XX return(-1); XX } XX XX/* XX * remove the lth Lock XX * if the correct user is requesting the move. XX */ XX XXstatic void XXingres_rm(l,llpid) XX int l, llpid; XX { XX register struct Lockform *a = &Locktab[l]; XX register int k; XX XX if (a->l_pid == llpid && a->l_mod != M_EMTY) XX { XX a->l_mod = M_EMTY; XX a->l_pid = 0; XX if (a->l_wflag == W_ON) XX { XX a->l_wflag = W_OFF; XX wakeup(&Locksleep[l]); XX } XX for (k = 0; k <= a->l_type; k++) XX { XX Lockset[k]++; XX if (Lockset[k] == 1) XX wakeup(&Lockset[k]); XX } XX } XX } XX XX/* XX * ingres_rma releases all locks for a given process id(pd). XX*/ XX XXingres_rma(pd) XX int pd; XX { XX register int i; XX register struct Lockform *p = Locktab; XX/* XX * Have to map the lock table because we can be called from kern_exit.c XX * when a process exits. XX*/ XX ingres_maplock(); XX XX/* XX * Replicate the pid check here to avoid function calls. If this process XX * has no Ingres locks outstanding then we avoid IL_NLOCKS function calls XX * and returns. XX*/ XX for (i = 0; i < IL_NLOCKS; i++, p++) XX { XX if (p->l_pid == pd && (p->l_mod != M_EMTY)) XX ingres_rm(i,pd); XX } XX normalseg5(); XX } XX XX/* XX * enter Lockbuf in locktable XX * return position in Locktable XX * error return of -1 XX */ XX XXstatic XXingres_enter(ll) XXstruct Lockreq *ll; XX { XX register int k, l; XX register struct Lockform *p = Locktab; XX XX for (k = 0; k < IL_NLOCKS; k++, p++) XX { XX if (p->l_mod == M_EMTY) XX { XX p->l_pid = ll->lr_pid; XX p->l_type = ll->lr_type; XX p->l_mod = ll->lr_mod; XX bcopy(ll->lr_key, p->l_key, KEYSIZE); XX for (l = 0; l <= ll->lr_type; l++) XX Lockset[l]--; XX return(k); XX } XX } XX return (-1); XX } XX XX/* XX * ingres_abt - abort all locks XX */ XX XXstatic void XXingres_abt() XX { XX register int k; XX XX for (k = 0; k < IL_NLOCKS; k++) XX wakeup( &Locktab[k] ); XX for (k = 0; k < 4; k++) XX wakeup( &Lockset[k]); XX bzero(Locktab, LOCKTABSIZE); XX Lockset[0] = IL_NLOCKS; XX Lockset[1] = IL_PLOCKS; XX Lockset[2] = IL_RLOCKS; XX Lockset[3] = IL_DLOCKS; XX } XX#endif /* NINGRES > 0 */ XSHAR_EOF Xfi Xif test -f '/usr/src/sys/h/ingreslock.h' Xthen X echo shar: "will not over-write existing file '/usr/src/sys/h/ingreslock.h'" Xelse Xsed 's/^X//' << \SHAR_EOF > '/usr/src/sys/h/ingreslock.h' XX#if !defined(lint) && defined(DOSCCS) XXstatic char *sccsid = "@(#)ildr.h 1.0 (2.11BSD GTE) 2/14/95"; XX#endif lint XX XX/* XX * This is the include file for the Ingres concurrency (lock) driver. XX * Only the parameters NLOCKS, PLOCKS, RLOCKS and DLOCKS may be changed. XX * XX * The initial values allow for 10 simultaneous Ingres users on the system. XX * This should be enough but if you wish to raise that limit then change XX * _only_ the 'IL_DLOCKS' parameter below. XX*/ XX XX#define KEYSIZE 12 XX/* max number of data base locks (max # of Ingreses) */ XX#define IL_DLOCKS 10 XX#define IL_RLOCKS ((2*IL_DLOCKS) + 6) XX#define IL_PLOCKS (IL_RLOCKS + 3) XX#define IL_NLOCKS (IL_PLOCKS + 1) XX XX/* XX * Do not change anything below this line unless you are modifying the XX * driver. XX*/ XX XX#define LOCKPRI 1 XX#define TRUE 1 XX#define FALSE 0 XX#define M_EMTY 0 XX#define M_SHARE 2 XX#define M_EXCL 1 XX#define T_CS 0 XX#define T_PAGE 1 XX#define T_REL 2 XX#define T_DB 3 XX#define A_RTN 1 XX#define A_SLP 2 XX#define A_RLS1 3 XX#define A_RLSA 4 XX#define A_ABT 5 XX#define W_ON 1 XX#define W_OFF 0 XX XX/* XX * data structure for Lock table XX */ XXstruct Lockform XX { XX int l_pid; XX char l_wflag; /* wait flag: = 1 a process is waiting*/ XX char l_type; /* type of lock: XX = 0 for critical section XX = 1 for page XX = 2 for logical XX = 3 for data base XX */ XX char l_mod; /* mod of Lock or lock action requested XX * = 0 slot empty XX * = 1 exclusive lock XX * = 2 shared lock XX */ XX char l_pad; XX char l_key[KEYSIZE]; XX }; XX XX/* XX * This is the structure written by Ingres programs. XX * XX * This structure _must_ agree in size and alignment with the 'lockreq' XX * structure defined in /usr/ingres/source/lock.h XX*/ XX XXstruct ulock XX { XX char _act; /* requested action: XX * =1 request lock, err return XX * =2 request lock, sleep XX * =3 release lock XX * =4 release all locks for pid XX */ XX char _type; /* same as Locktab l_type */ XX char _mod; /* same as Locktab l_mod */ XX char _pad; /* Pad byte to align key on word boundary */ XX char _key[KEYSIZE]; /* requested key */ XX }; XX XXstruct Lockreq XX { XX int lr_pid; /* requesting process id */ XX struct ulock lr_req; /* The structure written by the user */ XX }; XX XX#define lr_act lr_req._act XX#define lr_type lr_req._type XX#define lr_mod lr_req._mod XX#define lr_key lr_req._key XX XX#define ingres_maplock() mapseg5(Locktabseg.se_addr, Locktabseg.se_desc) XX#define LOCKTABSIZE (IL_NLOCKS * sizeof (struct Lockform)) XX XX extern segm Locktabseg; XSHAR_EOF Xfi Xif test -f '/usr/src/sys/GENERIC/ingres.h' Xthen X echo shar: "will not over-write existing file '/usr/src/sys/GENERIC/ingres.h'" Xelse Xsed 's/^X//' << \SHAR_EOF > '/usr/src/sys/GENERIC/ingres.h' XX#define NINGRES 0 XSHAR_EOF Xfi Xexit 0 X# End of shell archive SHAR_EOF fi exit 0 # End of shell archive