Date: Sat, 26 Dec 1998 22:38:02 +0100 From: adrian@FreeBSD.ORG To: freebsd-hackers@FreeBSD.ORG Subject: auto-allocation of ptys Message-ID: <199812262138.WAA04817@ywing.creative.net.au>
next in thread | raw e-mail | index | archive | help
I got sick of running out of ptys while running X, and having to result in rebuilding a kernel with more ptys enabled. So, I modified sys/kern/tty_pty.c to dynamically allocate pt_ioctl and tty structs when a pty access is made. I'm not totally familar with the tty IO system just yet, so it creates the structs whenever *some* form of access is done, not just open(). It also doesn't return the memory used by pt_ioctl and tty structs back to the memory pool - I didn't think the code complexity it would add would justify it. The patch is relative to sys/kern/tty_pty.c in 2.2.7-REL . Redefine MAXPTY in the source to set the initial number of ptys to allow to be opened. It creates two sysctl variables - kern.maxpty and kern.openptys - it allows you to set the max number of ptys you can have opened, and shows the current number of ptys opened respectively. This patch breaks pstat -t (strangely enough :) ... I haven't looked at it yet, but I guess you would have to just walk the pt_dynpty linked lists to grab the open ptys and go from there. It also will break devfs - I'm sure a devfs solution could be nutted out, but I'm still looking at it atm, and I'm not entirely sure on the status of it. The upshoot of all this of course is that you don't have to rebuild your kernel whenever you need more ptys. :-) Does anyone want to take a look at the idea and comment on it ? Adrian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812262138.WAA04817>