diff options
author | ed <ed@FreeBSD.org> | 2008-08-23 16:03:00 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-08-23 16:03:00 +0000 |
commit | 7eb781849646a1c8242153f6483702f5db549aae (patch) | |
tree | 3c4ba430e85b4eb024e1c6cc3741d4f7d238ef4a /sys | |
parent | bfd94967b5427b46b90ca3ce36c70147fc226f9f (diff) | |
download | FreeBSD-src-7eb781849646a1c8242153f6483702f5db549aae.zip FreeBSD-src-7eb781849646a1c8242153f6483702f5db549aae.tar.gz |
Allow the user to suppress the rate-limited pty(4) warning.
The pty(4) driver raises up to warnings when an old BSD-style PTY is
created. The reason why I added this warning, was to make it easier to
spot applications that allocate BSD-style PTY's, while they should just
use openpty() or posix_openpt().
Add a sysctl, which allows you to override the number of remaining
messages, making it possible to suppress the warnings.
Requested by: kib
Reviewed by: kib
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/tty_pty.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index e2edd21..9c26799 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <sys/fcntl.h> #include <sys/kernel.h> #include <sys/proc.h> +#include <sys/sysctl.h> #include <sys/systm.h> #include <sys/tty.h> @@ -46,7 +47,10 @@ __FBSDID("$FreeBSD$"); * si_drv1 inside the cdev to mark whether the PTY is in use. */ -static int pty_warningcnt = 10; +static unsigned int pty_warningcnt = 10; +SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW, + &pty_warningcnt, 0, + "Warnings that will be triggered upon PTY allocation"); static int ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) |