summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-08-23 20:26:09 +0000
committerEd Schouten <ed@FreeBSD.org>2009-08-23 20:26:09 +0000
commitbfdaa523828e5a7e690ec5d7e9b5353bef992d2f (patch)
tree22a9ea714bac9bb97ca35541c414ec1e74cc0164
parent562c5c5bf0e2132becca80623bda5038e069406e (diff)
Notes
-rw-r--r--sys/conf/files2
-rw-r--r--sys/conf/options1
-rw-r--r--sys/dev/pty/pty.c (renamed from sys/kern/tty_pty.c)22
-rw-r--r--sys/kern/tty_pts.c4
-rw-r--r--sys/modules/pty/Makefile8
5 files changed, 27 insertions, 10 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 699979850277..b5baadee14bb 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1297,6 +1297,7 @@ dev/ppc/ppc_puc.c optional ppc puc
dev/pst/pst-iop.c optional pst
dev/pst/pst-pci.c optional pst pci
dev/pst/pst-raid.c optional pst
+dev/pty/pty.c optional pty
dev/puc/puc.c optional puc
dev/puc/puc_cfg.c optional puc
dev/puc/puc_pccard.c optional puc pccard
@@ -2059,7 +2060,6 @@ kern/tty_info.c standard
kern/tty_inq.c standard
kern/tty_outq.c standard
kern/tty_pts.c standard
-kern/tty_pty.c optional pty
kern/tty_tty.c standard
kern/tty_ttydisc.c standard
kern/uipc_accf.c optional inet
diff --git a/sys/conf/options b/sys/conf/options
index ac2d87c0195d..22484e34ab02 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -672,7 +672,6 @@ ISAPNP opt_isa.h
DEV_BPF opt_bpf.h
DEV_MCA opt_mca.h
DEV_CARP opt_carp.h
-DEV_PTY opt_tty.h
DEV_SPLASH opt_splash.h
# EISA support
diff --git a/sys/kern/tty_pty.c b/sys/dev/pty/pty.c
index 169229d15eca..d3dce9f1746a 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/dev/pty/pty.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
@@ -117,11 +118,24 @@ pty_clone(void *arg, struct ucred *cr, char *name, int namelen,
NULL, UID_ROOT, GID_WHEEL, 0666, "%s", name);
}
-static void
-pty_init(void *unused)
+static int
+pty_modevent(module_t mod, int type, void *data)
{
- EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000);
+ switch(type) {
+ case MOD_LOAD:
+ EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000);
+ break;
+ case MOD_SHUTDOWN:
+ break;
+ case MOD_UNLOAD:
+ /* XXX: No unloading support yet. */
+ return (EBUSY);
+ default:
+ return (EOPNOTSUPP);
+ }
+
+ return (0);
}
-SYSINIT(pty, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pty_init, NULL);
+DEV_MODULE(pty, pty_modevent, NULL);
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c
index c77cf2a1d828..b38070a3f12e 100644
--- a/sys/kern/tty_pts.c
+++ b/sys/kern/tty_pts.c
@@ -30,14 +30,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_tty.h"
-
/* Add compatibility bits for FreeBSD. */
#define PTS_COMPAT
-#ifdef DEV_PTY
/* Add /dev/ptyXX compat bits. */
#define PTS_EXTERNAL
-#endif /* DEV_PTY */
/* Add bits to make Linux binaries work. */
#define PTS_LINUX
diff --git a/sys/modules/pty/Makefile b/sys/modules/pty/Makefile
new file mode 100644
index 000000000000..fd563fe1e2ff
--- /dev/null
+++ b/sys/modules/pty/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/pty
+
+KMOD= pty
+SRCS= pty.c
+
+.include <bsd.kmod.mk>