From owner-p4-projects@FreeBSD.ORG Mon Sep 22 21:04:01 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 772C11065672; Mon, 22 Sep 2008 21:04:01 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38E65106566B for ; Mon, 22 Sep 2008 21:04:01 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 24A798FC1D for ; Mon, 22 Sep 2008 21:04:01 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8ML41DU097020 for ; Mon, 22 Sep 2008 21:04:01 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8ML41mr097010 for perforce@freebsd.org; Mon, 22 Sep 2008 21:04:01 GMT (envelope-from imp@freebsd.org) Date: Mon, 22 Sep 2008 21:04:01 GMT Message-Id: <200809222104.m8ML41mr097010@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 150309 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2008 21:04:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=150309 Change 150309 by imp@imp_paco-paco on 2008/09/22 21:03:52 IFC @150307 Affected files ... .. //depot/projects/arm/src/sys/compat/linux/linux_misc.c#36 integrate .. //depot/projects/arm/src/sys/dev/bge/if_bge.c#42 integrate .. //depot/projects/arm/src/sys/kern/tty.c#25 integrate .. //depot/projects/arm/src/sys/kern/tty_ttydisc.c#5 integrate .. //depot/projects/arm/src/sys/netgraph/netgraph.h#13 integrate .. //depot/projects/arm/src/sys/netgraph/ng_base.c#24 integrate .. //depot/projects/arm/src/sys/sys/tty.h#7 integrate .. //depot/projects/arm/src/sys/sys/ttydevsw.h#3 integrate .. //depot/projects/arm/src/sys/sys/ttydisc.h#4 integrate .. //depot/projects/arm/src/sys/sys/ttyhook.h#1 branch .. //depot/projects/arm/src/sys/sys/ttyqueue.h#3 integrate .. //depot/projects/arm/src/sys/ufs/ufs/ufs_dirhash.c#5 integrate .. //depot/projects/arm/src/tools/tools/nanobsd/nanobsd.sh#15 integrate .. //depot/projects/arm/src/usr.sbin/pstat/pstat.8#4 integrate .. //depot/projects/arm/src/usr.sbin/pstat/pstat.c#7 integrate Differences ... ==== //depot/projects/arm/src/sys/compat/linux/linux_misc.c#36 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.226 2008/09/11 15:28:28 rdivacky Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.227 2008/09/22 18:59:24 trasz Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -306,7 +306,7 @@ * than vn_open(). */ #ifdef MAC - error = mac_vnode_check_open(td->td_ucred, vp, FREAD); + error = mac_vnode_check_open(td->td_ucred, vp, VREAD); if (error) goto cleanup; #endif ==== //depot/projects/arm/src/sys/dev/bge/if_bge.c#42 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.212 2008/09/08 18:10:15 oleg Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.213 2008/09/22 20:55:19 marius Exp $"); /* * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. @@ -134,7 +134,7 @@ * ID burned into it, though it will always be overriden by the vendor * ID in the EEPROM. Just to be safe, we cover all possibilities. */ -static struct bge_type { +static const struct bge_type { uint16_t bge_vid; uint16_t bge_did; } bge_devs[] = { @@ -1851,7 +1851,7 @@ static int bge_probe(device_t dev) { - struct bge_type *t = bge_devs; + const struct bge_type *t = bge_devs; struct bge_softc *sc = device_get_softc(dev); uint16_t vid, did; @@ -1873,7 +1873,8 @@ #if __FreeBSD_version > 700024 const char *pname; - if (pci_get_vpd_ident(dev, &pname) == 0) + if (bge_has_eaddr(sc) && + pci_get_vpd_ident(dev, &pname) == 0) snprintf(model, 64, "%s", pname); else #endif ==== //depot/projects/arm/src/sys/kern/tty.c#25 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/tty.c,v 1.289 2008/09/16 14:57:23 ed Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/tty.c,v 1.290 2008/09/22 19:25:14 ed Exp $"); #include "opt_compat.h" @@ -36,6 +36,7 @@ #include #include #include +#include #include #ifdef COMPAT_43TTY #include @@ -59,6 +60,7 @@ #include #undef TTYDEFCHARS #include +#include #include @@ -855,7 +857,7 @@ tp = malloc(sizeof(struct tty), M_TTY, M_WAITOK|M_ZERO); tp->t_devsw = tsw; - tp->t_softc = sc; + tp->t_devswsoftc = sc; tp->t_flags = tsw->tsw_flags; tty_init_termios(tp); @@ -923,7 +925,7 @@ tty_lock_assert(tp, MA_OWNED); if (tp->t_sessioncnt != 0 || - (tp->t_flags & (TF_GONE|TF_OPENED)) != TF_GONE) { + (tp->t_flags & (TF_GONE|TF_OPENED|TF_HOOK)) != TF_GONE) { /* TTY is still in use. */ tty_unlock(tp); return; @@ -1653,6 +1655,89 @@ ttydevsw_inwakeup(tp); } +static int +ttyhook_defrint(struct tty *tp, char c, int flags) +{ + + if (ttyhook_rint_bypass(tp, &c, 1) != 1) + return (-1); + + return (0); +} + +int +ttyhook_register(struct tty **rtp, struct thread *td, int fd, + struct ttyhook *th, void *softc) +{ + struct tty *tp; + struct file *fp; + struct cdev *dev; + struct cdevsw *cdp; + int error; + + /* Validate the file descriptor. */ + if (fget(td, fd, &fp) != 0) + return (EINVAL); + + /* Make sure the vnode is bound to a character device. */ + error = EINVAL; + if (fp->f_type != DTYPE_VNODE || fp->f_vnode->v_type != VCHR || + fp->f_vnode->v_rdev == NULL) + goto done1; + dev = fp->f_vnode->v_rdev; + + /* Make sure it is a TTY. */ + cdp = dev_refthread(dev); + if (cdp == NULL) + goto done1; + if ((cdp->d_flags & D_TTY) == 0) + goto done2; + tp = dev->si_drv1; + + /* Try to attach the hook to the TTY. */ + error = EBUSY; + tty_lock(tp); + MPASS((tp->t_hook == NULL) == ((tp->t_flags & TF_HOOK) == 0)); + if (tp->t_flags & TF_HOOK) + goto done3; + + tp->t_flags |= TF_HOOK; + tp->t_hook = th; + tp->t_hooksoftc = softc; + *rtp = tp; + error = 0; + + /* Maybe we can switch into bypass mode now. */ + ttydisc_optimize(tp); + + /* Silently convert rint() calls to rint_bypass() when possible. */ + if (!ttyhook_hashook(tp, rint) && ttyhook_hashook(tp, rint_bypass)) + th->th_rint = ttyhook_defrint; + +done3: tty_unlock(tp); +done2: dev_relthread(dev); +done1: fdrop(fp, td); + return (error); +} + +void +ttyhook_unregister(struct tty *tp) +{ + + tty_lock_assert(tp, MA_OWNED); + MPASS(tp->t_flags & TF_HOOK); + + /* Disconnect the hook. */ + tp->t_flags &= ~TF_HOOK; + tp->t_hook = NULL; + + /* Maybe we need to leave bypass mode. */ + ttydisc_optimize(tp); + + /* Maybe deallocate the TTY as well. */ + tty_rel_free(tp); +} + #include "opt_ddb.h" #ifdef DDB #include @@ -1686,6 +1771,7 @@ { TF_EXCLUDE, 'X' }, { TF_BYPASS, 'l' }, { TF_ZOMBIE, 'Z' }, + { TF_HOOK, 's' }, { 0, '\0' }, }; ==== //depot/projects/arm/src/sys/kern/tty_ttydisc.c#5 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/tty_ttydisc.c,v 1.4 2008/09/10 20:12:10 csjp Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/tty_ttydisc.c,v 1.6 2008/09/22 19:25:14 ed Exp $"); #include #include @@ -79,6 +79,8 @@ #define CTL_ALNUM(c) (((c) >= '0' && (c) <= '9') || \ ((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) +#define TTY_STACKBUF 256 + void ttydisc_open(struct tty *tp) { @@ -100,6 +102,9 @@ ttydevsw_inwakeup(tp); ttydevsw_outwakeup(tp); } + + if (ttyhook_hashook(tp, close)) + ttyhook_close(tp); } static int @@ -433,7 +438,7 @@ int ttydisc_write(struct tty *tp, struct uio *uio, int ioflag) { - char ob[256]; + char ob[TTY_STACKBUF]; char *obstart; int error = 0; unsigned int oblen = 0; @@ -557,11 +562,12 @@ { tty_lock_assert(tp, MA_OWNED); - if (!CMP_FLAG(i, ICRNL|IGNCR|IMAXBEL|INLCR|ISTRIP|IXON) && + if ((!CMP_FLAG(i, ICRNL|IGNCR|IMAXBEL|INLCR|ISTRIP|IXON) && (!CMP_FLAG(i, BRKINT) || CMP_FLAG(i, IGNBRK)) && (!CMP_FLAG(i, PARMRK) || CMP_FLAG(i, IGNPAR|IGNBRK) == (IGNPAR|IGNBRK)) && - !CMP_FLAG(l, ECHO|ICANON|IEXTEN|ISIG|PENDIN)) { + !CMP_FLAG(l, ECHO|ICANON|IEXTEN|ISIG|PENDIN)) || + ttyhook_hashook(tp, rint_bypass)) { tp->t_flags |= TF_BYPASS; } else { tp->t_flags &= ~TF_BYPASS; @@ -818,6 +824,9 @@ tty_lock_assert(tp, MA_OWNED); atomic_add_long(&tty_nin, 1); + + if (ttyhook_hashook(tp, rint)) + return ttyhook_rint(tp, c, flags); if (tp->t_flags & TF_BYPASS) goto processed; @@ -1035,7 +1044,7 @@ } size_t -ttydisc_rint_bypass(struct tty *tp, char *buf, size_t len) +ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len) { size_t ret; @@ -1045,6 +1054,9 @@ atomic_add_long(&tty_nin, len); + if (ttyhook_hashook(tp, rint_bypass)) + return ttyhook_rint_bypass(tp, buf, len); + ret = ttyinq_write(&tp->t_inq, buf, len, 0); ttyinq_canonicalize(&tp->t_inq); @@ -1057,12 +1069,38 @@ tty_lock_assert(tp, MA_OWNED); + if (ttyhook_hashook(tp, rint_done)) + ttyhook_rint_done(tp); + /* Wake up readers. */ tty_wakeup(tp, FREAD); /* Wake up driver for echo. */ ttydevsw_outwakeup(tp); } +size_t +ttydisc_rint_poll(struct tty *tp) +{ + size_t l; + + tty_lock_assert(tp, MA_OWNED); + + if (ttyhook_hashook(tp, rint_poll)) + return ttyhook_rint_poll(tp); + + /* + * XXX: Still allow character input when there's no space in the + * buffers, but we haven't entered the high watermark. This is + * to allow backspace characters to be inserted when in + * canonical mode. + */ + l = ttyinq_bytesleft(&tp->t_inq); + if (l == 0 && (tp->t_flags & TF_HIWAT_IN) == 0) + return (1); + + return (l); +} + static void ttydisc_wakeup_watermark(struct tty *tp) { @@ -1093,9 +1131,15 @@ if (tp->t_flags & TF_STOPPED) return (0); + if (ttyhook_hashook(tp, getc_inject)) + return ttyhook_getc_inject(tp, buf, len); + len = ttyoutq_read(&tp->t_outq, buf, len); + + if (ttyhook_hashook(tp, getc_capture)) + ttyhook_getc_capture(tp, buf, len); + ttydisc_wakeup_watermark(tp); - atomic_add_long(&tty_nout, len); return (len); @@ -1104,22 +1148,63 @@ int ttydisc_getc_uio(struct tty *tp, struct uio *uio) { - int error; + int error = 0; int obytes = uio->uio_resid; + size_t len; + char buf[TTY_STACKBUF]; tty_lock_assert(tp, MA_OWNED); if (tp->t_flags & TF_STOPPED) return (0); - error = ttyoutq_read_uio(&tp->t_outq, tp, uio); - ttydisc_wakeup_watermark(tp); + /* + * When a TTY hook is attached, we cannot perform unbuffered + * copying to userspace. Just call ttydisc_getc() and + * temporarily store data in a shadow buffer. + */ + if (ttyhook_hashook(tp, getc_capture) || + ttyhook_hashook(tp, getc_inject)) { + while (uio->uio_resid > 0) { + /* Read to shadow buffer. */ + len = ttydisc_getc(tp, buf, + MIN(uio->uio_resid, sizeof buf)); + if (len == 0) + break; + + /* Copy to userspace. */ + tty_unlock(tp); + error = uiomove(buf, len, uio); + tty_lock(tp); + + if (error != 0) + break; + } + } else { + error = ttyoutq_read_uio(&tp->t_outq, tp, uio); - atomic_add_long(&tty_nout, obytes - uio->uio_resid); + ttydisc_wakeup_watermark(tp); + atomic_add_long(&tty_nout, obytes - uio->uio_resid); + } return (error); } +size_t +ttydisc_getc_poll(struct tty *tp) +{ + + tty_lock_assert(tp, MA_OWNED); + + if (tp->t_flags & TF_STOPPED) + return (0); + + if (ttyhook_hashook(tp, getc_poll)) + return ttyhook_getc_poll(tp); + + return ttyoutq_bytesused(&tp->t_outq); +} + /* * XXX: not really related to the TTYDISC, but we'd better put * tty_putchar() here, because we need to perform proper output ==== //depot/projects/arm/src/sys/netgraph/netgraph.h#13 (text+ko) ==== @@ -37,7 +37,7 @@ * * Author: Julian Elischer * - * $FreeBSD: src/sys/netgraph/netgraph.h,v 1.74 2008/06/24 18:49:49 gnn Exp $ + * $FreeBSD: src/sys/netgraph/netgraph.h,v 1.75 2008/09/22 19:28:18 thompsa Exp $ * $Whistle: netgraph.h,v 1.29 1999/11/01 07:56:13 julian Exp $ */ @@ -1130,6 +1130,7 @@ item_p ng_package_msg_self(node_p here, hook_p hook, struct ng_mesg *msg); void ng_replace_retaddr(node_p here, item_p item, ng_ID_t retaddr); int ng_rmhook_self(hook_p hook); /* if a node wants to kill a hook */ +int ng_rmnode_flags(node_p here, int flags); int ng_rmnode_self(node_p here); /* if a node wants to suicide */ int ng_rmtype(struct ng_type *tp); int ng_snd_item(item_p item, int queue); ==== //depot/projects/arm/src/sys/netgraph/ng_base.c#24 (text+ko) ==== @@ -38,7 +38,7 @@ * Authors: Julian Elischer * Archie Cobbs * - * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.163 2008/09/13 09:17:02 mav Exp $ + * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.164 2008/09/22 19:28:18 thompsa Exp $ * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ */ @@ -1507,7 +1507,7 @@ /* Shut this node down as soon as everyone is clear of it */ /* Should add arg "immediately" to jump the queue */ int -ng_rmnode_self(node_p node) +ng_rmnode_flags(node_p node, int flags) { int error; @@ -1517,10 +1517,16 @@ if (node->nd_flags & NGF_CLOSING) return (0); - error = ng_send_fn(node, NULL, &ng_rmnode, NULL, 0); + error = ng_send_fn1(node, NULL, &ng_rmnode, NULL, 0, flags); return (error); } +int +ng_rmnode_self(node_p node) +{ + return (ng_rmnode_flags(node, NG_NOFLAGS)); +} + static void ng_rmhook_part2(node_p node, hook_p hook, void *arg1, int arg2) { ==== //depot/projects/arm/src/sys/sys/tty.h#7 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/tty.h,v 1.106 2008/09/04 16:30:53 ed Exp $ + * $FreeBSD: src/sys/sys/tty.h,v 1.108 2008/09/22 19:25:14 ed Exp $ */ #ifndef _SYS_TTY_H_ @@ -80,6 +80,7 @@ #define TF_EXCLUDE 0x1000 /* Exclusive access. */ #define TF_BYPASS 0x2000 /* Optimized input path. */ #define TF_ZOMBIE 0x4000 /* Modem disconnect received. */ +#define TF_HOOK 0x8000 /* TTY has hook attached. */ unsigned int t_revokecnt; /* (t) revoke() count. */ /* Buffering mechanisms. */ @@ -112,13 +113,15 @@ struct termios t_termios_lock_out; /* cua%s.lock. */ struct ttydevsw *t_devsw; /* (c) Driver hooks. */ + struct ttyhook *t_hook; /* (t) Capture/inject hook. */ /* Process signal delivery. */ struct pgrp *t_pgrp; /* (t) Foreground process group. */ struct session *t_session; /* (t) Associated session. */ unsigned int t_sessioncnt; /* (t) Backpointing sessions. */ - void *t_softc; /* (c) Soft config, for drivers. */ + void *t_devswsoftc; /* (c) Soft config, for drivers. */ + void *t_hooksoftc; /* (t) Soft config, for hooks. */ struct cdev *t_dev; /* (c) Primary character device. */ }; @@ -144,55 +147,57 @@ #ifdef _KERNEL /* Allocation and deallocation. */ -struct tty *tty_alloc(struct ttydevsw *, void *, struct mtx *); -void tty_rel_pgrp(struct tty *, struct pgrp *); -void tty_rel_sess(struct tty *, struct session *); -void tty_rel_gone(struct tty *); +struct tty *tty_alloc(struct ttydevsw *tsw, void *softc, struct mtx *mtx); +void tty_rel_pgrp(struct tty *tp, struct pgrp *pgrp); +void tty_rel_sess(struct tty *tp, struct session *sess); +void tty_rel_gone(struct tty *tp); #define tty_lock(tp) mtx_lock((tp)->t_mtx) #define tty_unlock(tp) mtx_unlock((tp)->t_mtx) #define tty_lock_assert(tp,ma) mtx_assert((tp)->t_mtx, (ma)) /* Device node creation. */ -void tty_makedev(struct tty *, struct ucred *, const char *, ...) +void tty_makedev(struct tty *tp, struct ucred *cred, const char *fmt, ...) __printflike(3, 4); #define tty_makealias(tp,fmt,...) \ make_dev_alias((tp)->t_dev, fmt, ## __VA_ARGS__) /* Signalling processes. */ -void tty_signal_sessleader(struct tty *, int); -void tty_signal_pgrp(struct tty *, int); +void tty_signal_sessleader(struct tty *tp, int signal); +void tty_signal_pgrp(struct tty *tp, int signal); /* Waking up readers/writers. */ -int tty_wait(struct tty *, struct cv *); -int tty_timedwait(struct tty *, struct cv *, int); -void tty_wakeup(struct tty *, int); +int tty_wait(struct tty *tp, struct cv *cv); +int tty_timedwait(struct tty *tp, struct cv *cv, int timo); +void tty_wakeup(struct tty *tp, int flags); /* System messages. */ -int tty_checkoutq(struct tty *); -int tty_putchar(struct tty *, char); +int tty_checkoutq(struct tty *tp); +int tty_putchar(struct tty *tp, char c); -int tty_ioctl(struct tty *, u_long, void *, struct thread *); -int tty_ioctl_compat(struct tty *, u_long, caddr_t, struct thread *); -void tty_init_console(struct tty *, speed_t); -void tty_flush(struct tty *, int); -void tty_hiwat_in_block(struct tty *); -void tty_hiwat_in_unblock(struct tty *); -dev_t tty_udev(struct tty *); +int tty_ioctl(struct tty *tp, u_long cmd, void *data, struct thread *td); +int tty_ioctl_compat(struct tty *tp, u_long cmd, caddr_t data, + struct thread *td); +void tty_init_console(struct tty *tp, speed_t speed); +void tty_flush(struct tty *tp, int flags); +void tty_hiwat_in_block(struct tty *tp); +void tty_hiwat_in_unblock(struct tty *tp); +dev_t tty_udev(struct tty *tp); #define tty_opened(tp) ((tp)->t_flags & TF_OPENED) #define tty_gone(tp) ((tp)->t_flags & TF_GONE) -#define tty_softc(tp) ((tp)->t_softc) +#define tty_softc(tp) ((tp)->t_devswsoftc) #define tty_devname(tp) devtoname((tp)->t_dev) /* Status line printing. */ -void tty_info(struct tty *); +void tty_info(struct tty *tp); /* Pseudo-terminal hooks. */ -int pts_alloc_external(int, struct thread *, struct file *, - struct cdev *, const char *); +int pts_alloc_external(int fd, struct thread *td, struct file *fp, + struct cdev *dev, const char *name); /* Drivers and line disciplines also need to call these. */ +#include #include -#include +#include #endif /* _KERNEL */ #endif /* !_SYS_TTY_H_ */ ==== //depot/projects/arm/src/sys/sys/ttydevsw.h#3 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/ttydevsw.h,v 1.2 2008/09/04 16:39:02 ed Exp $ + * $FreeBSD: src/sys/sys/ttydevsw.h,v 1.4 2008/09/22 19:25:14 ed Exp $ */ #ifndef _SYS_TTYDEVSW_H_ @@ -40,16 +40,18 @@ * Driver routines that are called from the line discipline to adjust * hardware parameters and such. */ -typedef int tsw_open_t(struct tty *); -typedef void tsw_close_t(struct tty *); -typedef void tsw_outwakeup_t(struct tty *); -typedef void tsw_inwakeup_t(struct tty *); -typedef int tsw_ioctl_t(struct tty *, u_long, caddr_t, struct thread *); -typedef int tsw_param_t(struct tty *, struct termios *); -typedef int tsw_modem_t(struct tty *, int, int); -typedef int tsw_mmap_t(struct tty *, vm_offset_t, vm_paddr_t *, int); -typedef void tsw_pktnotify_t(struct tty *, char); -typedef void tsw_free_t(void *); +typedef int tsw_open_t(struct tty *tp); +typedef void tsw_close_t(struct tty *tp); +typedef void tsw_outwakeup_t(struct tty *tp); +typedef void tsw_inwakeup_t(struct tty *tp); +typedef int tsw_ioctl_t(struct tty *tp, u_long cmd, caddr_t data, + struct thread *td); +typedef int tsw_param_t(struct tty *tp, struct termios *t); +typedef int tsw_modem_t(struct tty *tp, int sigon, int sigoff); +typedef int tsw_mmap_t(struct tty *tp, vm_offset_t offset, + vm_paddr_t * paddr, int nprot); +typedef void tsw_pktnotify_t(struct tty *tp, char event); +typedef void tsw_free_t(void *softc); struct ttydevsw { unsigned int tsw_flags; /* Default TTY flags. */ @@ -95,9 +97,7 @@ MPASS(!tty_gone(tp)); /* Prevent spurious wakeups. */ - if (tp->t_flags & TF_STOPPED) - return; - if (ttyoutq_bytesused(&tp->t_outq) == 0) + if (ttydisc_getc_poll(tp) == 0) return; tp->t_devsw->tsw_outwakeup(tp); ==== //depot/projects/arm/src/sys/sys/ttydisc.h#4 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/ttydisc.h,v 1.4 2008/09/17 13:59:05 ed Exp $ + * $FreeBSD: src/sys/sys/ttydisc.h,v 1.6 2008/09/22 19:25:14 ed Exp $ */ #ifndef _SYS_TTYDISC_H_ @@ -42,20 +42,22 @@ struct uio; /* Top half routines. */ -void ttydisc_open(struct tty *); -void ttydisc_close(struct tty *); -int ttydisc_read(struct tty *, struct uio *, int); -int ttydisc_write(struct tty *, struct uio *, int); -void ttydisc_optimize(struct tty *); +void ttydisc_open(struct tty *tp); +void ttydisc_close(struct tty *tp); +int ttydisc_read(struct tty *tp, struct uio *uio, int ioflag); +int ttydisc_write(struct tty *tp, struct uio *uio, int ioflag); +void ttydisc_optimize(struct tty *tp); /* Bottom half routines. */ -void ttydisc_modem(struct tty *, int); +void ttydisc_modem(struct tty *tp, int open); #define ttydisc_can_bypass(tp) ((tp)->t_flags & TF_BYPASS) -int ttydisc_rint(struct tty *, char, int); -size_t ttydisc_rint_bypass(struct tty *, char *, size_t); -void ttydisc_rint_done(struct tty *); -size_t ttydisc_getc(struct tty *, void *, size_t); -int ttydisc_getc_uio(struct tty *, struct uio *); +int ttydisc_rint(struct tty *tp, char c, int flags); +size_t ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len); +void ttydisc_rint_done(struct tty *tp); +size_t ttydisc_rint_poll(struct tty *tp); +size_t ttydisc_getc(struct tty *tp, void *buf, size_t len); +int ttydisc_getc_uio(struct tty *tp, struct uio *uio); +size_t ttydisc_getc_poll(struct tty *tp); /* Error codes for ttydisc_rint(). */ #define TRE_FRAMING 0x01 @@ -81,36 +83,4 @@ return ttyoutq_bytesleft(&tp->t_outq); } -static __inline size_t -ttydisc_rint_poll(struct tty *tp) -{ - size_t l; - - tty_lock_assert(tp, MA_OWNED); - - /* - * XXX: Still allow character input when there's no space in the - * buffers, but we haven't entered the high watermark. This is - * to allow backspace characters to be inserted when in - * canonical mode. - */ - l = ttyinq_bytesleft(&tp->t_inq); - if (l == 0 && (tp->t_flags & TF_HIWAT_IN) == 0) - return (1); - - return (l); -} - -static __inline size_t -ttydisc_getc_poll(struct tty *tp) -{ - - tty_lock_assert(tp, MA_OWNED); - - if (tp->t_flags & TF_STOPPED) - return (0); - - return ttyoutq_bytesused(&tp->t_outq); -} - #endif /* !_SYS_TTYDISC_H_ */ ==== //depot/projects/arm/src/sys/sys/ttyqueue.h#3 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/ttyqueue.h,v 1.2 2008/08/30 09:18:27 ed Exp $ + * $FreeBSD: src/sys/sys/ttyqueue.h,v 1.3 2008/09/22 18:44:09 ed Exp $ */ #ifndef _SYS_TTYQUEUE_H_ @@ -69,19 +69,22 @@ #ifdef _KERNEL /* Input queue handling routines. */ -void ttyinq_setsize(struct ttyinq *, struct tty *, size_t); -void ttyinq_free(struct ttyinq *); -int ttyinq_read_uio(struct ttyinq *, struct tty *, struct uio *, - size_t, size_t); -size_t ttyinq_write(struct ttyinq *, const void *, size_t, int); -int ttyinq_write_nofrag(struct ttyinq *, const void *, size_t, int); -void ttyinq_canonicalize(struct ttyinq *); -size_t ttyinq_findchar(struct ttyinq *, const char *, size_t, char *); -void ttyinq_flush(struct ttyinq *); -int ttyinq_peekchar(struct ttyinq *, char *, int *); -void ttyinq_unputchar(struct ttyinq *); -void ttyinq_reprintpos_set(struct ttyinq *); -void ttyinq_reprintpos_reset(struct ttyinq *); +void ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len); +void ttyinq_free(struct ttyinq *ti); +int ttyinq_read_uio(struct ttyinq *ti, struct tty *tp, struct uio *uio, + size_t readlen, size_t flushlen); +size_t ttyinq_write(struct ttyinq *ti, const void *buf, size_t len, + int quote); +int ttyinq_write_nofrag(struct ttyinq *ti, const void *buf, size_t len, + int quote); +void ttyinq_canonicalize(struct ttyinq *ti); +size_t ttyinq_findchar(struct ttyinq *ti, const char *breakc, size_t maxlen, + char *lastc); +void ttyinq_flush(struct ttyinq *ti); +int ttyinq_peekchar(struct ttyinq *ti, char *c, int *quote); +void ttyinq_unputchar(struct ttyinq *ti); +void ttyinq_reprintpos_set(struct ttyinq *ti); +void ttyinq_reprintpos_reset(struct ttyinq *ti); static __inline void ttyinq_init(struct ttyinq *ti) @@ -125,20 +128,20 @@ } /* Input buffer iteration. */ -typedef void ttyinq_line_iterator_t(void *, char, int); -void ttyinq_line_iterate_from_linestart(struct ttyinq *, - ttyinq_line_iterator_t *, void *); -void ttyinq_line_iterate_from_reprintpos(struct ttyinq *, - ttyinq_line_iterator_t *, void *); +typedef void ttyinq_line_iterator_t(void *data, char c, int flags); +void ttyinq_line_iterate_from_linestart(struct ttyinq *ti, + ttyinq_line_iterator_t *iterator, void *data); +void ttyinq_line_iterate_from_reprintpos(struct ttyinq *ti, + ttyinq_line_iterator_t *iterator, void *data); /* Output queue handling routines. */ -void ttyoutq_flush(struct ttyoutq *); -void ttyoutq_setsize(struct ttyoutq *, struct tty *, size_t); -void ttyoutq_free(struct ttyoutq *); -size_t ttyoutq_read(struct ttyoutq *, void *, size_t); -int ttyoutq_read_uio(struct ttyoutq *, struct tty *, struct uio *); -size_t ttyoutq_write(struct ttyoutq *, const void *, size_t); -int ttyoutq_write_nofrag(struct ttyoutq *, const void *, size_t); +void ttyoutq_flush(struct ttyoutq *to); +void ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len); +void ttyoutq_free(struct ttyoutq *to); +size_t ttyoutq_read(struct ttyoutq *to, void *buf, size_t len); +int ttyoutq_read_uio(struct ttyoutq *to, struct tty *tp, struct uio *uio); +size_t ttyoutq_write(struct ttyoutq *to, const void *buf, size_t len); +int ttyoutq_write_nofrag(struct ttyoutq *to, const void *buf, size_t len); static __inline void ttyoutq_init(struct ttyoutq *to) ==== //depot/projects/arm/src/sys/ufs/ufs/ufs_dirhash.c#5 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_dirhash.c,v 1.25 2008/09/16 16:23:56 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_dirhash.c,v 1.26 2008/09/22 20:53:22 jhb Exp $"); #include "opt_ufs.h" @@ -461,6 +461,16 @@ VI_UNLOCK(vp); /* + * Remove the hash from the list since we are going to free its + * memory. + */ + DIRHASHLIST_LOCK(); + if (dh->dh_onlist) + TAILQ_REMOVE(&ufsdirhash_list, dh, dh_list); + ufs_dirhashmem -= dh->dh_memreq; + DIRHASHLIST_UNLOCK(); + + /* * At this point, any waiters for the lock should hold their * own reference on the dirhash structure. They will drop * that reference once they grab the vnode interlock and see @@ -479,11 +489,6 @@ if (dh->dh_blkfree != NULL) FREE(dh->dh_blkfree, M_DIRHASH); } - DIRHASHLIST_LOCK(); - if (dh->dh_onlist) - TAILQ_REMOVE(&ufsdirhash_list, dh, dh_list); - ufs_dirhashmem -= dh->dh_memreq; - DIRHASHLIST_UNLOCK(); /* * Drop the inode's reference to the data structure. ==== //depot/projects/arm/src/tools/tools/nanobsd/nanobsd.sh#15 (text+ko) ==== @@ -24,7 +24,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $FreeBSD: src/tools/tools/nanobsd/nanobsd.sh,v 1.39 2008/09/21 18:02:00 simon Exp $ +# $FreeBSD: src/tools/tools/nanobsd/nanobsd.sh,v 1.40 2008/09/22 20:21:39 bms Exp $ # set -e @@ -402,6 +402,10 @@ c - $1, "sectors" > "/dev/stderr" exit 2 } + + # Force slice 1 to be marked active. This is necessary + # for booting the image from a USB device to work. + print "a 1" } ' > ${MAKEOBJDIRPREFIX}/_.fdisk ==== //depot/projects/arm/src/usr.sbin/pstat/pstat.8#4 (text+ko) ==== @@ -33,7 +33,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)pstat.8 8.5 (Berkeley) 5/13/94 -.\" $FreeBSD: src/usr.sbin/pstat/pstat.8,v 1.51 2008/08/20 22:09:33 ed Exp $ +.\" $FreeBSD: src/usr.sbin/pstat/pstat.8,v 1.52 2008/09/22 19:25:14 ed Exp $ .\" .Dd August 20, 2008 .Dt PSTAT 8 @@ -202,6 +202,8 @@ block mode input routine in use .It Z connection lost +.It s +i/o being snooped .El .Pp The ==== //depot/projects/arm/src/usr.sbin/pstat/pstat.c#7 (text+ko) ==== @@ -46,7 +46,7 @@ #endif /* not lint */ #endif #include -__FBSDID("$FreeBSD: src/usr.sbin/pstat/pstat.c,v 1.105 2008/08/20 08:31:58 ed Exp $"); +__FBSDID("$FreeBSD: src/usr.sbin/pstat/pstat.c,v 1.106 2008/09/22 19:25:14 ed Exp $"); #include #include @@ -312,6 +312,7 @@ { TF_EXCLUDE, 'X' }, { TF_BYPASS, 'l' }, { TF_ZOMBIE, 'Z' }, + { TF_HOOK, 's' }, { 0, '\0' }, };