Date: Sun, 23 Aug 2009 20:26:10 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r196480 - in head/sys: conf dev/pty kern modules/pty Message-ID: <200908232026.n7NKQAxX071421@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Sun Aug 23 20:26:09 2009 New Revision: 196480 URL: http://svn.freebsd.org/changeset/base/196480 Log: Allow pty(4) to be loaded as a kld. Unfortunately, the wrappers that are present in pts(4) don't have the mechanics to allow pty(4) to be unloaded safely, so I'm forcing this kld to return EBUSY. This also means we have to enable some extra code in pts(4) unconditionally. Proposed by: rwatson Added: head/sys/dev/pty/ head/sys/dev/pty/pty.c - copied, changed from r196449, head/sys/kern/tty_pty.c head/sys/modules/pty/ head/sys/modules/pty/Makefile (contents, props changed) Deleted: head/sys/kern/tty_pty.c Modified: head/sys/conf/files head/sys/conf/options head/sys/kern/tty_pts.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/conf/files Sun Aug 23 20:26:09 2009 (r196480) @@ -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 Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/conf/options Sun Aug 23 20:26:09 2009 (r196480) @@ -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 Copied and modified: head/sys/dev/pty/pty.c (from r196449, head/sys/kern/tty_pty.c) ============================================================================== --- head/sys/kern/tty_pty.c Sun Aug 23 07:32:30 2009 (r196449, copy source) +++ head/sys/dev/pty/pty.c Sun Aug 23 20:26:09 2009 (r196480) @@ -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, c 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); Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/kern/tty_pts.c Sun Aug 23 20:26:09 2009 (r196480) @@ -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 Added: head/sys/modules/pty/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/pty/Makefile Sun Aug 23 20:26:09 2009 (r196480) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/pty + +KMOD= pty +SRCS= pty.c + +.include <bsd.kmod.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908232026.n7NKQAxX071421>