diff options
author | ed <ed@FreeBSD.org> | 2009-09-06 10:27:45 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-09-06 10:27:45 +0000 |
commit | 73faea23017b4ce65aa723109ce740c5dacc3dc1 (patch) | |
tree | 6d9a466863179e420214ce35c14f77dc63cfd4c0 /sys/kern/tty_pts.c | |
parent | d8177c84337105c433440a5aa9dada5bf71e0d65 (diff) | |
download | FreeBSD-src-73faea23017b4ce65aa723109ce740c5dacc3dc1.zip FreeBSD-src-73faea23017b4ce65aa723109ce740c5dacc3dc1.tar.gz |
Move ptmx into pty(4).
Now that pty(4) is a loadable kernel module, I'd better move /dev/ptmx
in there as well. This means that pty(4) now provides almost all
pseudo-terminal compatibility code. This means it's very easy to test
whether applications use the proper library interfaces when allocating
pseudo-terminals (namely posix_openpt and openpty).
Diffstat (limited to 'sys/kern/tty_pts.c')
-rw-r--r-- | sys/kern/tty_pts.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index b38070a..350244b 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); /* Add compatibility bits for FreeBSD. */ #define PTS_COMPAT -/* Add /dev/ptyXX compat bits. */ +/* Add pty(4) compat bits. */ #define PTS_EXTERNAL /* Add bits to make Linux binaries work. */ #define PTS_LINUX @@ -694,7 +694,10 @@ static struct ttydevsw pts_class = { .tsw_free = ptsdrv_free, }; -static int +#ifndef PTS_EXTERNAL +static +#endif /* !PTS_EXTERNAL */ +int pts_alloc(int fflags, struct thread *td, struct file *fp) { int unit, ok; @@ -815,29 +818,11 @@ posix_openpt(struct thread *td, struct posix_openpt_args *uap) return (0); } -#if defined(PTS_COMPAT) || defined(PTS_LINUX) -static int -ptmx_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) -{ - - return (pts_alloc(fflags & (FREAD|FWRITE), td, fp)); -} - -static struct cdevsw ptmx_cdevsw = { - .d_version = D_VERSION, - .d_fdopen = ptmx_fdopen, - .d_name = "ptmx", -}; -#endif /* PTS_COMPAT || PTS_LINUX */ - static void pts_init(void *unused) { pts_pool = new_unrhdr(0, INT_MAX, NULL); -#if defined(PTS_COMPAT) || defined(PTS_LINUX) - make_dev(&ptmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "ptmx"); -#endif /* PTS_COMPAT || PTS_LINUX */ } SYSINIT(pts, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pts_init, NULL); |