Subject: ptys being left unclosed (#365) Index: sys/vfs_vnops.c 2.11BSD Description: ptys were being left stranded (unclosed). Repeat-By: rlogin to a 2.11 system at rev 364. Repeat. Notice that the pty allocated is always one higher. Eventually the system will run out and rlogind will not work. Fix: Sigh. I should take a day or two off and learn how to port code. In vn_closefile() failing to clear the f_data field of the file structure before calling 'closei' would cause the call to the driver close routine to be skipped. During the scan for aliases (multiple inodes can refer to the same special block or character device) the close routine of a device driver is not called if there are existing references outstanding. If the f_data field of the file structure being closed is not 0 then a premature return would be done. The fix is small but, alas, will require a rebuild of the kernel. With luck you will be able to do #363, 364 and 365 all at the same time and only rebuild the kernel once. Cut where indicated saving to a file (/tmp/365) and then: patch -p0 < /tmp/365 cd /sys/GENERIC make mv unix /genunix cd /sys/YOUR_KERNEL make make install reboot As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ------------------------cut here---------------------- *** /sys/sys/vfs_vnops.c.old Fri Feb 7 12:28:04 1997 --- /sys/sys/vfs_vnops.c Fri Feb 7 21:33:27 1997 *************** *** 35,41 **** * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * @(#)vfs_vnops.c 8.14.2 (2.11BSD) 1997/2/7 */ #include --- 35,41 ---- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ! * @(#)vfs_vnops.c 8.14.3 (2.11BSD) 1997/2/7 */ #include *************** *** 209,218 **** vn_closefile(fp) register struct file *fp; { - register int error; register struct inode *ip = (struct inode *)fp->f_data; ! error = closei(ip, fp->f_flag); irele(ip); ! return(error); } --- 209,222 ---- vn_closefile(fp) register struct file *fp; { register struct inode *ip = (struct inode *)fp->f_data; ! /* ! * Need to clear the inode pointer in the file structure so that the ! * inode is not seen during the scan for aliases of character or block ! * devices in closei(). ! */ ! fp->f_data = (caddr_t)0; /* XXX */ irele(ip); ! return(closei(ip, fp->f_flag)); } *** /VERSION.old Thu Feb 6 22:43:10 1997 --- /VERSION Fri Feb 7 21:31:20 1997 *************** *** 1,4 **** ! Current Patch Level: 364 Date: February 6, 1997 2.11 BSD --- 1,4 ---- ! Current Patch Level: 365 Date: February 6, 1997 2.11 BSD