From owner-svn-src-head@FreeBSD.ORG Sun Aug 23 20:26:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F9C7106568C; Sun, 23 Aug 2009 20:26:10 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E9C48FC12; Sun, 23 Aug 2009 20:26:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NKQAGH071427; Sun, 23 Aug 2009 20:26:10 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NKQAxX071421; Sun, 23 Aug 2009 20:26:10 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908232026.n7NKQAxX071421@svn.freebsd.org> From: Ed Schouten Date: Sun, 23 Aug 2009 20:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196480 - in head/sys: conf dev/pty kern modules/pty X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 20:26:10 -0000 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 #include #include +#include #include #include #include @@ -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 __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